aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortreeston <treeston.mmoc@gmail.com>2016-08-28 19:43:30 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-18 17:22:53 +0100
commita0d48b92d5ec2360b4c0f324726e7ff7343578de (patch)
tree6d29739e6087d7c45f3f034ec797631d5dd011b8 /src
parent00fed3d44f390e114d0b8ca0731b7075ada07810 (diff)
Creature/Gossip: offer replacement functions for the existing preprocessor gossip macros
(cherry picked from commit 175db157f76d8a8de42bb53f1b1564f12600616a) You saw nothing (build fix). (cherry picked from commit 72a7f4b507f93d575c406f727bf71e3ecaf20bd8) Build fix. Again. Oops. (cherry picked from commit 61eb70fd827e79018449f204ce93b9b6bf46eabf) ....right, I actually went through a full rebuild now just to make sure it works. (cherry picked from commit 8531f012a2d63df7f505507573639be512c2adba) Last one. For real. Please. (Build fix #5). (cherry picked from commit a32536d490a32241a3ac1db9b61109f61a47b02c)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedGossip.cpp31
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedGossip.h13
2 files changed, 43 insertions, 1 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedGossip.cpp b/src/server/game/AI/ScriptedAI/ScriptedGossip.cpp
new file mode 100644
index 00000000000..0c4d372dd66
--- /dev/null
+++ b/src/server/game/AI/ScriptedAI/ScriptedGossip.cpp
@@ -0,0 +1,31 @@
+/*
+* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation; either version 2 of the License, or (at your
+* option) any later version.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+* more details.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "ScriptedGossip.h"
+#include "Player.h"
+#include "Creature.h"
+
+void ClearGossipMenuFor(Player* player) { player->PlayerTalkClass->ClearMenus(); }
+// Using provided text, not from DB
+void AddGossipItemFor(Player* player, uint32 icon, const char* text, uint32 sender, uint32 action) { player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, icon, text, sender, action, "", 0); }
+// Using provided texts, not from DB
+void AddGossipItemFor(Player* player, uint32 icon, const char* text, uint32 sender, uint32 action, const char* popupText, uint32 popupMoney, bool coded) { player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, icon, text, sender, action, popupText, popupMoney, coded); }
+// Uses gossip item info from DB
+void AddGossipItemFor(Player* player, uint32 gossipMenuID, uint32 gossipMenuItemID, uint32 sender, uint32 action) { player->PlayerTalkClass->GetGossipMenu().AddMenuItem(gossipMenuID, gossipMenuItemID, sender, action); }
+void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const& guid) { player->PlayerTalkClass->SendGossipMenu(npcTextID, guid); }
+void SendGossipMenuFor(Player* player, uint32 npcTextID, Creature const* creature) { if (creature) SendGossipMenuFor(player, npcTextID, creature->GetGUID()); }
+void CloseGossipMenuFor(Player* player) { player->PlayerTalkClass->SendCloseGossip(); }
diff --git a/src/server/game/AI/ScriptedAI/ScriptedGossip.h b/src/server/game/AI/ScriptedAI/ScriptedGossip.h
index 5b7e7f63373..82b1be50a41 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedGossip.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedGossip.h
@@ -82,8 +82,19 @@ enum eTradeskill
GOSSIP_SENDER_SEC_STABLEMASTER = 10
};
-// Defined fuctions to use with player.
+class Creature;
+void ClearGossipMenuFor(Player* player);
+// Using provided text, not from DB
+void AddGossipItemFor(Player* player, uint32 icon, const char* text, uint32 sender, uint32 action);
+// Using provided texts, not from DB
+void AddGossipItemFor(Player* player, uint32 icon, const char* text, uint32 sender, uint32 action, const char* popupText, uint32 popupMoney, bool coded);
+// Uses gossip item info from DB
+void AddGossipItemFor(Player* player, uint32 gossipMenuID, uint32 gossipMenuItemID, uint32 sender, uint32 action);
+void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const& guid);
+void SendGossipMenuFor(Player* player, uint32 npcTextID, Creature const* creature);
+void CloseGossipMenuFor(Player* player);
+// Defined fuctions to use with player.
// This fuction add's a menu item,
// a - Icon Id
// b - Text