mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Core/SAI: Implemented SMART_ACTION_SEND_TARGET_TO_TARGET, it can be used to send targets previously stored with SMART_ACTION_STORE_TARGET, to another npc, the other npc can then access them as if it was its own stored list
Signed-off-by: Subv2112 <s.v.h21@hotmail.com>
This commit is contained in:
@@ -1794,6 +1794,38 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SEND_TARGET_TO_TARGET:
|
||||
{
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
|
||||
if (!targets)
|
||||
return;
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
bool smart = false;
|
||||
SmartAI* ai = NULL;
|
||||
if (IsGameObject(*itr))
|
||||
{
|
||||
smart = IsSmartGO((*itr)->ToGameObject());
|
||||
ai = CAST_AI(SmartAI, (*itr)->ToGameObject()->AI());
|
||||
}
|
||||
|
||||
if (IsCreature(*itr))
|
||||
{
|
||||
smart = IsSmart((*itr)->ToCreature());
|
||||
ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI());
|
||||
}
|
||||
|
||||
if (smart && ai)
|
||||
ai->GetScript()->StoreTargetList(GetTargetList(e.action.sendTargetToTarget.id), e.action.sendTargetToTarget.id);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SEND_GOSSIP_MENU:
|
||||
{
|
||||
if (!GetBaseObject())
|
||||
|
||||
@@ -473,8 +473,9 @@ enum SMART_ACTION
|
||||
SMART_ACTION_JUMP_TO_POS = 97, // speedXY, speedZ, targetX, targetY, targetZ
|
||||
SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId
|
||||
SMART_ACTION_GO_SET_LOOT_STATE = 99, // state
|
||||
SMART_ACTION_SEND_TARGET_TO_TARGET = 100, // id
|
||||
|
||||
SMART_ACTION_END = 100,
|
||||
SMART_ACTION_END = 101,
|
||||
};
|
||||
|
||||
struct SmartAction
|
||||
@@ -883,6 +884,11 @@ struct SmartAction
|
||||
uint32 state;
|
||||
} setGoLootState;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 id;
|
||||
} sendTargetToTarget;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 param1;
|
||||
|
||||
Reference in New Issue
Block a user