mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
feat(Core/SAI): Implement SMART_ACTION_SET_GUID (#15978)
* feat(Core/SAI): Implement SMART_ACTION_SET_GUID * Update SmartScript.cpp * Update src/server/game/AI/SmartScripts/SmartScriptMgr.h * Update SmartScript.cpp
This commit is contained in:
@@ -2688,6 +2688,31 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SET_GUID:
|
||||
{
|
||||
for (WorldObject* target : targets)
|
||||
{
|
||||
ObjectGuid guidToSend = me ? me->GetGUID() : go->GetGUID();
|
||||
|
||||
if (e.action.setGuid.invokerGUID)
|
||||
{
|
||||
if (Unit* invoker = GetLastInvoker())
|
||||
{
|
||||
guidToSend = invoker->GetGUID();
|
||||
}
|
||||
}
|
||||
|
||||
if (Creature* creature = target->ToCreature())
|
||||
{
|
||||
creature->AI()->SetGUID(guidToSend, e.action.setGuid.index);
|
||||
}
|
||||
else if (GameObject* object = target->ToGameObject())
|
||||
{
|
||||
object->AI()->SetGUID(guidToSend, e.action.setGuid.index);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry {} SourceType {}, Event {}, Unhandled Action type {}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
break;
|
||||
|
||||
@@ -762,6 +762,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
|
||||
case SMART_ACTION_ZONE_UNDER_ATTACK: return NO_PARAMS;
|
||||
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);
|
||||
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());
|
||||
@@ -1914,6 +1915,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_ACTION_SET_CORPSE_DELAY:
|
||||
case SMART_ACTION_ATTACK_STOP:
|
||||
case SMART_ACTION_PLAY_CINEMATIC:
|
||||
case SMART_ACTION_SET_GUID:
|
||||
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);
|
||||
|
||||
@@ -692,8 +692,9 @@ enum SMART_ACTION
|
||||
SMART_ACTION_CU_ENCOUNTER_START = 222, // Resets cooldowns on all targets and removes Heroism debuff(s)
|
||||
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_AC_END = 225, // placeholder
|
||||
SMART_ACTION_AC_END = 226, // placeholder
|
||||
};
|
||||
|
||||
enum class SmartActionSummonCreatureFlags
|
||||
@@ -1357,6 +1358,12 @@ struct SmartAction
|
||||
{
|
||||
uint32 entry;
|
||||
} cinematic;
|
||||
|
||||
struct
|
||||
{
|
||||
SAIBool invokerGUID;
|
||||
uint32 index;
|
||||
} setGuid;
|
||||
//! Note for any new future actions
|
||||
//! All parameters must have type uint32
|
||||
|
||||
|
||||
Reference in New Issue
Block a user