mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-18 14:10:18 -04:00
Core/SAI: Add support to friendly+hostile to SMART_EVENT_OOC_LOS and SMART_EVENT_IC_LOS (#26579)
Change SMART_EVENT_OOC_LOS and SMART_EVENT_IC_LOS first parameter to have 3 values:
- 0 : Hostile
- 1 : Not hostile (not that Friendly and Not hostile have different meanings)
- 2 : Any, as in both Hostile and Not hostile
Close #24789
* Add validation on startup for allowed values.
Code cleanup.
* Fix errors
(cherry picked from commit 9e7cdb02d2)
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "SpellMgr.h"
|
||||
#include "Timer.h"
|
||||
#include "UnitDefines.h"
|
||||
#include "Util.h"
|
||||
#include "WaypointDefines.h"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -832,6 +833,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_EVENT_IC_LOS:
|
||||
if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax))
|
||||
return false;
|
||||
if (e.event.los.hostilityMode >= AsUnderlyingType(SmartEvent::LOSHostilityMode::End))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses hostilityMode with invalid value %u (max allowed value %u), skipped.",
|
||||
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.los.hostilityMode, AsUnderlyingType(SmartEvent::LOSHostilityMode::End) - 1);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case SMART_EVENT_RESPAWN:
|
||||
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map))
|
||||
|
||||
Reference in New Issue
Block a user