Core/SmartAI: Implement SMART_ACTION_SET_ROOT (103)
This commit is contained in:
@@ -1996,6 +1996,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
me->setRegeneratingHealth(e.action.setHealthRegen.regenHealth ? true : false);
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SET_ROOT:
|
||||
{
|
||||
if (me)
|
||||
me->SetControlled(e.action.setRoot.root ? true : false, UNIT_STATE_ROOT);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
break;
|
||||
|
||||
@@ -906,6 +906,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_ACTION_SEND_TARGET_TO_TARGET:
|
||||
case SMART_ACTION_SET_HOME_POS:
|
||||
case SMART_ACTION_SET_HEALTH_REGEN:
|
||||
case SMART_ACTION_SET_ROOT:
|
||||
break;
|
||||
default:
|
||||
sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
|
||||
|
||||
@@ -486,8 +486,9 @@ enum SMART_ACTION
|
||||
SMART_ACTION_SEND_TARGET_TO_TARGET = 100, // id
|
||||
SMART_ACTION_SET_HOME_POS = 101, // none
|
||||
SMART_ACTION_SET_HEALTH_REGEN = 102, // 0/1
|
||||
SMART_ACTION_SET_ROOT = 103, // off/on
|
||||
|
||||
SMART_ACTION_END = 103
|
||||
SMART_ACTION_END = 104
|
||||
};
|
||||
|
||||
struct SmartAction
|
||||
@@ -919,6 +920,11 @@ struct SmartAction
|
||||
uint32 regenHealth;
|
||||
} setHealthRegen;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 root;
|
||||
} setRoot;
|
||||
|
||||
//! Note for any new future actions
|
||||
//! All parameters must have type uint32
|
||||
|
||||
|
||||
@@ -15296,15 +15296,32 @@ void Unit::SetControlled(bool apply, UnitState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case UNIT_STATE_STUNNED: if (HasAuraType(SPELL_AURA_MOD_STUN)) return;
|
||||
else SetStunned(false); break;
|
||||
case UNIT_STATE_ROOT: if (HasAuraType(SPELL_AURA_MOD_ROOT) || GetVehicle()) return;
|
||||
else SetRooted(false); break;
|
||||
case UNIT_STATE_CONFUSED:if (HasAuraType(SPELL_AURA_MOD_CONFUSE)) return;
|
||||
else SetConfused(false); break;
|
||||
case UNIT_STATE_FLEEING: if (HasAuraType(SPELL_AURA_MOD_FEAR)) return;
|
||||
else SetFeared(false); break;
|
||||
default: return;
|
||||
case UNIT_STATE_STUNNED:
|
||||
if (HasAuraType(SPELL_AURA_MOD_STUN))
|
||||
return;
|
||||
else
|
||||
SetStunned(false);
|
||||
break;
|
||||
case UNIT_STATE_ROOT:
|
||||
if (HasAuraType(SPELL_AURA_MOD_ROOT) || GetVehicle())
|
||||
return;
|
||||
else
|
||||
SetRooted(false);
|
||||
break;
|
||||
case UNIT_STATE_CONFUSED:
|
||||
if (HasAuraType(SPELL_AURA_MOD_CONFUSE))
|
||||
return;
|
||||
else
|
||||
SetConfused(false);
|
||||
break;
|
||||
case UNIT_STATE_FLEEING:
|
||||
if (HasAuraType(SPELL_AURA_MOD_FEAR))
|
||||
return;
|
||||
else
|
||||
SetFeared(false);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
ClearUnitState(state);
|
||||
|
||||
Reference in New Issue
Block a user