aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp26
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp1
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h13
3 files changed, 34 insertions, 6 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 143cb1f0ec1..cbbf83bca25 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -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;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index fab2a6b7722..b1516916760 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -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);
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 327d03d31ff..49e25afe681 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -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
{