mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 20:52:22 -04:00
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;
|
||||
|
||||
Reference in New Issue
Block a user