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:
Subv2112
2012-01-22 07:54:32 -05:00
parent 48a9c17dd8
commit a3f595ee10
2 changed files with 39 additions and 1 deletions

View File

@@ -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())

View File

@@ -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;