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:
@@ -3434,9 +3434,11 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
//if range is ok and we are actually in LOS
|
||||
if (me->IsWithinDistInMap(unit, range) && me->IsWithinLOSInMap(unit))
|
||||
{
|
||||
SmartEvent::LOSHostilityMode hostilityMode = static_cast<SmartEvent::LOSHostilityMode>(e.event.los.hostilityMode);
|
||||
//if friendly event&&who is not hostile OR hostile event&&who is hostile
|
||||
if ((e.event.los.noHostile && !me->IsHostileTo(unit)) ||
|
||||
(!e.event.los.noHostile && me->IsHostileTo(unit)))
|
||||
if ((hostilityMode == SmartEvent::LOSHostilityMode::Any) ||
|
||||
(hostilityMode == SmartEvent::LOSHostilityMode::NotHostile && !me->IsHostileTo(unit)) ||
|
||||
(hostilityMode == SmartEvent::LOSHostilityMode::Hostile && me->IsHostileTo(unit)))
|
||||
{
|
||||
if (e.event.los.playerOnly && unit->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
@@ -3456,9 +3458,11 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
//if range is ok and we are actually in LOS
|
||||
if (me->IsWithinDistInMap(unit, range) && me->IsWithinLOSInMap(unit))
|
||||
{
|
||||
SmartEvent::LOSHostilityMode hostilityMode = static_cast<SmartEvent::LOSHostilityMode>(e.event.los.hostilityMode);
|
||||
//if friendly event&&who is not hostile OR hostile event&&who is hostile
|
||||
if ((e.event.los.noHostile && !me->IsHostileTo(unit)) ||
|
||||
(!e.event.los.noHostile && me->IsHostileTo(unit)))
|
||||
if ((hostilityMode == SmartEvent::LOSHostilityMode::Any) ||
|
||||
(hostilityMode == SmartEvent::LOSHostilityMode::NotHostile && !me->IsHostileTo(unit)) ||
|
||||
(hostilityMode == SmartEvent::LOSHostilityMode::Hostile && me->IsHostileTo(unit)))
|
||||
{
|
||||
if (e.event.los.playerOnly && unit->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user