Core/SAI: Remove deprecated events and actions (#27039)

(cherry picked from commit 887605d945)
This commit is contained in:
offl
2021-10-11 19:26:19 +03:00
committed by Shauren
parent 4c632bb690
commit 29190e5642
3 changed files with 23 additions and 186 deletions
@@ -751,32 +751,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
break;
}
case SMART_ACTION_SET_UNIT_FLAG:
{
for (WorldObject* target : targets)
{
if (IsUnit(target))
{
target->ToUnit()->AddUnitFlag(UnitFlags(e.action.unitFlag.flag));
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %s added flag %u to UNIT_FIELD_FLAGS",
target->GetGUID().ToString().c_str(), e.action.unitFlag.flag);
}
}
break;
}
case SMART_ACTION_REMOVE_UNIT_FLAG:
{
for (WorldObject* target : targets)
{
if (IsUnit(target))
{
target->ToUnit()->RemoveUnitFlag(UnitFlags(e.action.unitFlag.flag));
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %s removed flag %u to UNIT_FIELD_FLAGS",
target->GetGUID().ToString().c_str(), e.action.unitFlag.flag);
}
}
break;
}
case SMART_ACTION_AUTO_ATTACK:
{
if (!IsSmart())
@@ -1941,20 +1915,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
target->ToGameObject()->SendCustomAnim(e.action.sendGoCustomAnim.anim);
break;
}
case SMART_ACTION_ADD_DYNAMIC_FLAG:
{
for (WorldObject* target : targets)
target->AddDynamicFlag(e.action.flag.flag);
break;
}
case SMART_ACTION_REMOVE_DYNAMIC_FLAG:
{
for (WorldObject* target : targets)
target->RemoveDynamicFlag(e.action.flag.flag);
break;
}
case SMART_ACTION_JUMP_TO_POS:
{
for (WorldObject* target : targets)
@@ -3138,16 +3098,6 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax);
break;
}
case SMART_EVENT_TARGET_HEALTH_PCT:
{
if (!me || !me->IsEngaged() || !me->GetVictim() || !me->EnsureVictim()->GetMaxHealth())
return;
uint32 perc = (uint32)me->EnsureVictim()->GetHealthPct();
if (perc > e.event.minMaxRepeat.max || perc < e.event.minMaxRepeat.min)
return;
ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->GetVictim());
break;
}
case SMART_EVENT_MANA_PCT:
{
if (!me || !me->IsEngaged() || !me->GetMaxPower(POWER_MANA))
@@ -3158,16 +3108,6 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax);
break;
}
case SMART_EVENT_TARGET_MANA_PCT:
{
if (!me || !me->IsEngaged() || !me->GetVictim() || !me->EnsureVictim()->GetMaxPower(POWER_MANA))
return;
uint32 perc = uint32(me->EnsureVictim()->GetPowerPct(POWER_MANA));
if (perc > e.event.minMaxRepeat.max || perc < e.event.minMaxRepeat.min)
return;
ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->GetVictim());
break;
}
case SMART_EVENT_RANGE:
{
if (!me || !me->IsEngaged() || !me->GetVictim())
@@ -3197,22 +3137,6 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
ProcessTimedAction(e, e.event.targetCasting.repeatMin, e.event.targetCasting.repeatMax, me->GetVictim());
break;
}
case SMART_EVENT_FRIENDLY_HEALTH:
{
if (!me || !me->IsEngaged())
return;
Unit* target = DoSelectLowestHpFriendly((float)e.event.friendlyHealth.radius, e.event.friendlyHealth.hpDeficit);
if (!target || !target->IsInCombat())
{
// if there are at least two same npcs, they will perform the same action immediately even if this is useless...
RecalcTimer(e, 1000, 3000);
return;
}
ProcessTimedAction(e, e.event.friendlyHealth.repeatMin, e.event.friendlyHealth.repeatMax, target);
break;
}
case SMART_EVENT_FRIENDLY_IS_CC:
{
if (!me || !me->IsEngaged())
@@ -3319,18 +3243,6 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
ProcessAction(e, unit, var0, var1, bvar, spell, gob);
break;
case SMART_EVENT_IS_BEHIND_TARGET:
{
if (!me)
return;
if (Unit* victim = me->GetVictim())
{
if (!victim->HasInArc(static_cast<float>(M_PI), me))
ProcessTimedAction(e, e.event.behindTarget.cooldownMin, e.event.behindTarget.cooldownMax, victim);
}
break;
}
case SMART_EVENT_RECEIVE_EMOTE:
if (e.event.emote.emote == var0)
{
@@ -3789,17 +3701,13 @@ void SmartScript::UpdateTimer(SmartScriptHolder& e, uint32 const diff)
case SMART_EVENT_UPDATE_OOC:
case SMART_EVENT_UPDATE_IC:
case SMART_EVENT_HEALTH_PCT:
case SMART_EVENT_TARGET_HEALTH_PCT:
case SMART_EVENT_MANA_PCT:
case SMART_EVENT_TARGET_MANA_PCT:
case SMART_EVENT_RANGE:
case SMART_EVENT_VICTIM_CASTING:
case SMART_EVENT_FRIENDLY_HEALTH:
case SMART_EVENT_FRIENDLY_IS_CC:
case SMART_EVENT_FRIENDLY_MISSING_BUFF:
case SMART_EVENT_HAS_AURA:
case SMART_EVENT_TARGET_BUFFED:
case SMART_EVENT_IS_BEHIND_TARGET:
case SMART_EVENT_FRIENDLY_HEALTH_PCT:
case SMART_EVENT_DISTANCE_CREATURE:
case SMART_EVENT_DISTANCE_GAMEOBJECT: