feat(Core/SAI): Implement SMART_ACTION_DISABLE (#16254)

* init

* Create rev_1684036819129474700.sql

* Update rev_1684036819129474700.sql
This commit is contained in:
Gultask
2023-05-17 09:31:50 -03:00
committed by GitHub
parent 97dff23ba1
commit 69fab3df70
4 changed files with 80 additions and 1 deletions

View File

@@ -2797,6 +2797,18 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
break;
}
case SMART_ACTION_DISABLE:
{
for (WorldObject* target : targets)
{
if (IsUnit(target))
{
target->ToUnit()->SetImmuneToAll(!e.action.disable.state);
target->ToUnit()->SetVisible(e.action.disable.state);
}
}
break;
}
default:
LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry {} SourceType {}, Event {}, Unhandled Action type {}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;

View File

@@ -762,6 +762,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
case SMART_ACTION_LOAD_GRID: return NO_PARAMS;
case SMART_ACTION_MUSIC: return sizeof(SmartAction::music);
case SMART_ACTION_SET_GUID: return sizeof(SmartAction::setGuid);
case SMART_ACTION_DISABLE: return sizeof(SmartAction::disable);
default:
LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using an action with no unused params specified in SmartAIMgr::CheckUnusedActionParams(), please report this.",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
@@ -1918,6 +1919,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_ATTACK_STOP:
case SMART_ACTION_PLAY_CINEMATIC:
case SMART_ACTION_SET_GUID:
case SMART_ACTION_DISABLE:
break;
default:
LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type({}), event_type({}), Entry {} SourceType {} Event {}, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);

View File

@@ -693,8 +693,9 @@ enum SMART_ACTION
SMART_ACTION_DO_ACTION = 223, // ActionId
SMART_ACTION_ATTACK_STOP = 224, //
SMART_ACTION_SET_GUID = 225, // Sends the invoker's or the base object's own ObjectGuid to target
SMART_ACTION_DISABLE = 226, // Disable the targeted creatures, setting them Invisible and Immune to All
SMART_ACTION_AC_END = 226, // placeholder
SMART_ACTION_AC_END = 227, // placeholder
};
enum class SmartActionSummonCreatureFlags
@@ -1365,6 +1366,11 @@ struct SmartAction
SAIBool invokerGUID;
uint32 index;
} setGuid;
struct
{
SAIBool state;
} disable;
//! Note for any new future actions
//! All parameters must have type uint32