Skip to content

Commit

Permalink
Core/SAI: Remove SMART_ACTION_ADD_AURA & actions to change object fla…
Browse files Browse the repository at this point in the history
…gs (#27571)
  • Loading branch information
offl authored Jan 10, 2022
1 parent 5f0e80b commit 5ba93a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 71 deletions.
34 changes: 0 additions & 34 deletions src/server/game/AI/SmartScripts/SmartScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,19 +693,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
break;
}
case SMART_ACTION_ADD_AURA:
{
for (WorldObject* target : targets)
{
if (IsUnit(target))
{
target->ToUnit()->AddAura(e.action.addAura.spell, target->ToUnit());
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ADD_AURA: Adding aura %u to unit %s",
e.action.addAura.spell, target->GetGUID().ToString().c_str());
}
}
break;
}
case SMART_ACTION_ACTIVATE_GOBJECT:
{
for (WorldObject* target : targets)
Expand Down Expand Up @@ -1920,27 +1907,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
target->ToCreature()->SetControlled(e.action.setRoot.root != 0, UNIT_STATE_ROOT);
break;
}
case SMART_ACTION_SET_GO_FLAG:
{
for (WorldObject* target : targets)
if (IsGameObject(target))
target->ToGameObject()->SetUInt32Value(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
break;
}
case SMART_ACTION_ADD_GO_FLAG:
{
for (WorldObject* target : targets)
if (IsGameObject(target))
target->ToGameObject()->SetFlag(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
break;
}
case SMART_ACTION_REMOVE_GO_FLAG:
{
for (WorldObject* target : targets)
if (IsGameObject(target))
target->ToGameObject()->RemoveFlag(GAMEOBJECT_FLAGS, e.action.goFlag.flag);
break;
}
case SMART_ACTION_SUMMON_CREATURE_GROUP:
{
std::list<TempSummon*> summonList;
Expand Down
27 changes: 4 additions & 23 deletions src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,6 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
case SMART_ACTION_CLOSE_GOSSIP: return NO_PARAMS;
case SMART_ACTION_TRIGGER_TIMED_EVENT: return sizeof(SmartAction::timeEvent);
case SMART_ACTION_REMOVE_TIMED_EVENT: return sizeof(SmartAction::timeEvent);
case SMART_ACTION_ADD_AURA: return sizeof(SmartAction::addAura);
case SMART_ACTION_CALL_SCRIPT_RESET: return NO_PARAMS;
case SMART_ACTION_SET_RANGED_MOVEMENT: return sizeof(SmartAction::setRangedMovement);
case SMART_ACTION_CALL_TIMED_ACTIONLIST: return sizeof(SmartAction::timedActionList);
Expand All @@ -893,9 +892,6 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
case SMART_ACTION_SET_HOME_POS: return NO_PARAMS;
case SMART_ACTION_SET_HEALTH_REGEN: return sizeof(SmartAction::setHealthRegen);
case SMART_ACTION_SET_ROOT: return sizeof(SmartAction::setRoot);
case SMART_ACTION_SET_GO_FLAG: return sizeof(SmartAction::goFlag);
case SMART_ACTION_ADD_GO_FLAG: return sizeof(SmartAction::goFlag);
case SMART_ACTION_REMOVE_GO_FLAG: return sizeof(SmartAction::goFlag);
case SMART_ACTION_SUMMON_CREATURE_GROUP: return sizeof(SmartAction::creatureGroup);
case SMART_ACTION_SET_POWER: return sizeof(SmartAction::power);
case SMART_ACTION_ADD_POWER: return sizeof(SmartAction::power);
Expand Down Expand Up @@ -1563,10 +1559,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (!IsSpellValid(e, e.action.cast.spell))
return false;
break;
case SMART_ACTION_ADD_AURA:
if (!IsSpellValid(e, e.action.addAura.spell))
return false;
break;
case SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS:
case SMART_ACTION_CALL_GROUPEVENTHAPPENS:
if (Quest const* qid = sObjectMgr->GetQuestTemplate(e.action.quest.quest))
Expand Down Expand Up @@ -2102,9 +2094,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_GO_SET_GO_STATE:
case SMART_ACTION_SEND_TARGET_TO_TARGET:
case SMART_ACTION_SET_HOME_POS:
case SMART_ACTION_SET_GO_FLAG:
case SMART_ACTION_ADD_GO_FLAG:
case SMART_ACTION_REMOVE_GO_FLAG:
case SMART_ACTION_SUMMON_CREATURE_GROUP:
case SMART_ACTION_MOVE_OFFSET:
case SMART_ACTION_SET_CORPSE_DELAY:
Expand All @@ -2120,12 +2109,16 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_REMOVE_UNIT_FLAG:
case SMART_ACTION_INSTALL_AI_TEMPLATE:
case SMART_ACTION_SET_SWIM:
case SMART_ACTION_ADD_AURA:
case SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT:
case SMART_ACTION_RESET_SCRIPT_BASE_OBJECT:
case SMART_ACTION_SEND_GO_CUSTOM_ANIM:
case SMART_ACTION_SET_DYNAMIC_FLAG:
case SMART_ACTION_ADD_DYNAMIC_FLAG:
case SMART_ACTION_REMOVE_DYNAMIC_FLAG:
case SMART_ACTION_SET_GO_FLAG:
case SMART_ACTION_ADD_GO_FLAG:
case SMART_ACTION_REMOVE_GO_FLAG:
case SMART_ACTION_SET_CAN_FLY:
case SMART_ACTION_REMOVE_AURAS_BY_TYPE:
case SMART_ACTION_SET_SIGHT_DIST:
Expand All @@ -2138,18 +2131,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
}

// Additional check for deprecated
switch (e.GetActionType())
{
// Deprecated
case SMART_ACTION_ADD_AURA:
case SMART_ACTION_SET_GO_FLAG:
TC_LOG_WARN("sql.sql.deprecation", "SmartAIMgr: Deprecated action_type(%u), Entry %d SourceType %u Event %u, it might be removed in the future, loaded for now.", e.GetActionType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
break;
default:
break;
}

if (!CheckUnusedActionParams(e))
return false;

Expand Down
18 changes: 4 additions & 14 deletions src/server/game/AI/SmartScripts/SmartScriptMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ enum SMART_ACTION
SMART_ACTION_CLOSE_GOSSIP = 72, // none
SMART_ACTION_TRIGGER_TIMED_EVENT = 73, // id(>1)
SMART_ACTION_REMOVE_TIMED_EVENT = 74, // id(>1)
SMART_ACTION_ADD_AURA = 75, // spellid, targets
SMART_ACTION_ADD_AURA = 75, // UNUSED, DO NOT REUSE
SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT = 76, // UNUSED, DO NOT REUSE
SMART_ACTION_RESET_SCRIPT_BASE_OBJECT = 77, // UNUSED, DO NOT REUSE
SMART_ACTION_CALL_SCRIPT_RESET = 78, // none
Expand Down Expand Up @@ -541,9 +541,9 @@ enum SMART_ACTION
SMART_ACTION_SET_HOME_POS = 101, // none
SMART_ACTION_SET_HEALTH_REGEN = 102, // 0/1
SMART_ACTION_SET_ROOT = 103, // off/on
SMART_ACTION_SET_GO_FLAG = 104, // Flags
SMART_ACTION_ADD_GO_FLAG = 105, // Flags
SMART_ACTION_REMOVE_GO_FLAG = 106, // Flags
SMART_ACTION_SET_GO_FLAG = 104, // UNUSED, DO NOT REUSE
SMART_ACTION_ADD_GO_FLAG = 105, // UNUSED, DO NOT REUSE
SMART_ACTION_REMOVE_GO_FLAG = 106, // UNUSED, DO NOT REUSE
SMART_ACTION_SUMMON_CREATURE_GROUP = 107, // Group, attackInvoker
SMART_ACTION_SET_POWER = 108, // PowerType, newPower
SMART_ACTION_ADD_POWER = 109, // PowerType, newPower
Expand Down Expand Up @@ -726,11 +726,6 @@ struct SmartAction
uint32 dec;
} incEventPhase;

struct
{
uint32 spell;
} addAura;

struct
{
uint32 spell;
Expand Down Expand Up @@ -1019,11 +1014,6 @@ struct SmartAction
SAIBool root;
} setRoot;

struct
{
uint32 flag;
} goFlag;

struct
{
uint32 state;
Expand Down

0 comments on commit 5ba93a9

Please sign in to comment.