Core/SAI: Add SMART_ACTION_SEND_GOSSIP_MENU.
It allows the scripter to change the gossip (and gossip menu option) of a creature with SAI Param1 = `gossip_menu`.`entry` Param2 = `gossip_menu_option`.`id`
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "SmartAI.h"
|
||||
#include "Group.h"
|
||||
#include "Vehicle.h"
|
||||
#include "ScriptedGossip.h"
|
||||
|
||||
SmartScript::SmartScript()
|
||||
{
|
||||
@@ -1323,7 +1324,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (IsCreature(*itr))
|
||||
(*itr)->ToCreature()->Respawn();
|
||||
else if (IsGameObject(*itr))
|
||||
(*itr)->ToGameObject()->SetRespawnTime(e.action.RespawnTarget.GoRespawnTime);
|
||||
(*itr)->ToGameObject()->SetRespawnTime(e.action.RespawnTarget.goRespawnTime);
|
||||
}
|
||||
|
||||
delete targets;
|
||||
@@ -1784,6 +1785,29 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
me->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SEND_GOSSIP_MENU:
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SEND_GOSSIP_MENU: gossipMenuId %d, gossip_option_id %d",
|
||||
e.action.sendGossipMenu.gossipMenuId, e.action.sendGossipMenu.gossipOptionId);
|
||||
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
if (!targets)
|
||||
return;
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if(Player* player = (*itr)->ToPlayer())
|
||||
{
|
||||
if (e.action.sendGossipMenu.gossipMenuId)
|
||||
player->PrepareGossipMenu(GetBaseObject(), e.action.sendGossipMenu.gossipMenuId, true);
|
||||
else
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
|
||||
player->SEND_GOSSIP_MENU(e.action.sendGossipMenu.gossipOptionId, GetBaseObject()->GetGUID());
|
||||
}
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog->outErrorDb("SmartScript::ProcessAction: Unhandled Action type %u", e.GetActionType());
|
||||
break;
|
||||
|
||||
@@ -775,6 +775,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_ACTION_ADD_DYNAMIC_FLAG:
|
||||
case SMART_ACTION_REMOVE_DYNAMIC_FLAG:
|
||||
case SMART_ACTION_JUMP_TO_POS:
|
||||
case SMART_ACTION_SEND_GOSSIP_MENU:
|
||||
break;
|
||||
default:
|
||||
sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
|
||||
|
||||
@@ -450,18 +450,15 @@ enum SMART_ACTION
|
||||
SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST = 87, // script9 ids 1-9
|
||||
SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST = 88, // script9 id min, max
|
||||
SMART_ACTION_RANDOM_MOVE = 89, // maxDist
|
||||
|
||||
SMART_ACTION_SET_UNIT_FIELD_BYTES_1 = 90, // bytes, target
|
||||
SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1 = 91, // bytes, target
|
||||
|
||||
SMART_ACTION_INTERRUPT_SPELL = 92,
|
||||
|
||||
SMART_ACTION_SEND_GO_CUSTOM_ANIM = 93, // anim id
|
||||
|
||||
SMART_ACTION_SET_DYNAMIC_FLAG = 94, // Flags
|
||||
SMART_ACTION_ADD_DYNAMIC_FLAG = 95, // Flags
|
||||
SMART_ACTION_REMOVE_DYNAMIC_FLAG = 96, // Flags
|
||||
SMART_ACTION_JUMP_TO_POS = 97, // speedXY, speedZ, targetX, targetY, targetZ
|
||||
SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId
|
||||
|
||||
SMART_ACTION_END = 98,
|
||||
};
|
||||
@@ -859,8 +856,14 @@ struct SmartAction
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 GoRespawnTime;
|
||||
uint32 goRespawnTime;
|
||||
} RespawnTarget;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 gossipMenuId;
|
||||
uint32 gossipOptionId;
|
||||
} sendGossipMenu;
|
||||
|
||||
struct
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user