TrinityCore
GossipDef.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_GOSSIP_H
19#define TRINITYCORE_GOSSIP_H
20
21#include "Common.h"
22#include "ObjectGuid.h"
23#include "Optional.h"
24
25class Object;
26class Quest;
27class WorldSession;
28struct GossipMenuItems;
29enum class QuestGiverStatus : uint64;
30
31#define GOSSIP_MAX_MENU_ITEMS 32
32#define DEFAULT_GOSSIP_MESSAGE 0xffffff
33
35{
36 None = 0, // White chat bubble. Default
37 Vendor = 1, // Brown bag
38 Taxinode = 2, // White wing
39 Trainer = 3, // Brown book
40 SpiritHealer = 4, // Golden interaction wheel (with red center)
41 Binder = 5, // Golden interaction wheel
42 Banker = 6, // Brown bag (with gold coin in lower corner)
43 PetitionVendor = 7, // White chat bubble (with "..." inside)
44 GuildTabardVendor = 8, // White tabard
45 Battlemaster = 9, // Two crossed swords
46 Auctioneer = 10, // Stack of gold coins
47 TalentMaster = 11, // White chat bubble
48 Stablemaster = 12, // White chat bubble
49 PetSpecializationMaster = 13, /*DEPRECATED*/ // White chat bubble
50 GuildBanker = 14, // White chat bubble
51 Spellclick = 15, // White chat bubble
52 DisableXPGain = 16, // White chat bubble
53 EnableXPGain = 17, // White chat bubble
54 Mailbox = 18, // White chat bubble
55 WorldPvPQueue = 19, /*NYI*/ // White chat bubble
56 LFGDungeon = 20, /*NYI*/ // White chat bubble
57 ArtifactRespec = 21, /*NYI*/ // White chat bubble
58 CemeterySelect = 22, /*DEPRECATED*/ // White chat bubble
59 SpecializationMaster = 23, /*DEPRECATED*/ // White chat bubble
60 GlyphMaster = 24, /*DEPRECATED*/ // White chat bubble
61 QueueScenario = 25, /*NYI*/ // White chat bubble
62 GarrisonArchitect = 26, /*NYI*/ // White chat bubble
63 GarrisonMissionNpc = 27, /*NYI*/ // White chat bubble
64 ShipmentCrafter = 28, /*NYI*/ // Brown document
65 GarrisonTradeskillNpc = 29, /*NYI*/ // White chat bubble
66 GarrisonRecruitment = 30, /*NYI*/ // White chat bubble
67 AdventureMap = 31, /*NYI*/ // White chat bubble
68 GarrisonTalent = 32, // White chat bubble
69 ContributionCollector = 33, /*NYI*/ // White chat bubble
70 Transmogrify = 34, // Purple helm
71 AzeriteRespec = 35, // White chat bubble
72 IslandsMissionNpc = 36, /*NYI*/ // White chat bubble
73 UIItemInteraction = 37, /*NYI*/ // White chat bubble
74 WorldMap = 38, /*NYI*/ // White chat bubble
75 Soulbind = 39, /*NYI*/ // White chat bubble
76 ChromieTimeNpc = 40, /*NYI*/ // White chat bubble
77 CovenantPreviewNpc = 41, /*NYI*/ // White chat bubble
78 RuneforgeLegendaryCrafting = 42, /*NYI*/ // White chat bubble
79 NewPlayerGuide = 43, /*NYI*/ // White chat bubble
80 RuneforgeLegendaryUpgrade = 44, /*NYI*/ // White chat bubble
81 CovenantRenownNpc = 45, /*NYI*/ // White chat bubble
85 ProfessionsOpen = 49,
87 TraitSystem = 51,
88 BarbersChoice = 52,
91
92 Count
93};
94
96{
97 Available = 0,
98 Unavailable = 1,
99 Locked = 2,
101};
102
104{
105 Item = 0,
106 Currency = 1
107};
108
110{
111 None = 0x0,
113};
114
116{
120 std::string OptionText;
126 std::string BoxText;
129
130 // action data
133
134 // additional scripting identifiers
137};
138
139// need an ordered container
140typedef std::vector<GossipMenuItem> GossipMenuItemContainer;
141
143{
146};
147
148typedef std::vector<QuestMenuItem> QuestMenuItemList;
149
151{
152 public:
153 GossipMenu();
154 GossipMenu(GossipMenu const&) = delete;
156 GossipMenu& operator=(GossipMenu const&) = delete;
159
160 uint32 AddMenuItem(int32 gossipOptionId, int32 orderIndex, GossipOptionNpc optionNpc, std::string optionText, uint32 language, GossipOptionFlags flags,
161 Optional<int32> gossipNpcOptionId, uint32 actionMenuId, uint32 actionPoiId, bool boxCoded, uint32 boxMoney,
162 std::string boxText, Optional<int32> spellId, Optional<int32> overrideIconId, uint32 sender, uint32 action);
163 void AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action);
164 void AddMenuItem(GossipMenuItems const& menuItem, uint32 sender, uint32 action);
165
166 void SetMenuId(uint32 menu_id) { _menuId = menu_id; }
167 uint32 GetMenuId() const { return _menuId; }
168 void SetLocale(LocaleConstant locale) { _locale = locale; }
169 LocaleConstant GetLocale() const { return _locale; }
170
172 {
173 return _menuItems.size();
174 }
175
176 bool Empty() const
177 {
178 return _menuItems.empty();
179 }
180
181 GossipMenuItem const* GetItem(int32 gossipOptionId) const;
182 GossipMenuItem const* GetItemByIndex(uint32 orderIndex) const;
183
184 uint32 GetMenuItemSender(uint32 orderIndex) const;
185 uint32 GetMenuItemAction(uint32 orderIndex) const;
186 bool IsMenuItemCoded(uint32 orderIndex) const;
187
188 void ClearMenu();
189
191 {
192 return _menuItems;
193 }
194
195 private:
199};
200
202{
203 public:
204 QuestMenu();
205 QuestMenu(QuestMenu const&) = delete;
206 QuestMenu(QuestMenu&&) = delete;
207 QuestMenu& operator=(QuestMenu const&) = delete;
210
211 void AddMenuItem(uint32 QuestId, uint8 Icon);
212 void ClearMenu();
213 uint8 GetMenuItemCount() const{ return uint8(_questMenuItems.size()); }
214 bool Empty() const { return _questMenuItems.empty(); }
215 bool HasItem(uint32 questId) const;
216 QuestMenuItem const& GetItem(uint16 index) const { return _questMenuItems[index]; }
217
218 private:
220};
221
223{
224 public:
225 void Reset()
226 {
228 TrainerId = 0;
229 PlayerChoiceId = 0;
230 }
231
235};
236
238{
239 public:
240 explicit PlayerMenu(WorldSession* session);
241 PlayerMenu(PlayerMenu const&) = delete;
243 PlayerMenu& operator=(PlayerMenu const&) = delete;
246
247 GossipMenu& GetGossipMenu() { return _gossipMenu; }
248 QuestMenu& GetQuestMenu() { return _questMenu; }
249 InteractionData& GetInteractionData() { return _interactionData; }
250
251 bool Empty() const { return _gossipMenu.Empty() && _questMenu.Empty(); }
252
253 void ClearMenus();
254 uint32 GetGossipOptionSender(uint32 selection) const { return _gossipMenu.GetMenuItemSender(selection); }
255 uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
256 bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
257
258 void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID);
259 void SendCloseGossip();
260 void SendPointOfInterest(uint32 poiId) const;
261
262 /*********************************************************/
263 /*** QUEST SYSTEM ***/
264 /*********************************************************/
265 void SendQuestGiverStatus(QuestGiverStatus questStatus, ObjectGuid npcGUID) const;
266
267 void SendQuestGiverQuestListMessage(Object* questgiver);
268
269 void SendQuestQueryResponse(Quest const* quest) const;
270 void SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool autoLaunched, bool displayPopup) const;
271
272 void SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool autoLaunched) const;
273 void SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool autoLaunched) const;
274
275 private:
280};
281#endif
LocaleConstant
Definition: Common.h:48
#define TC_GAME_API
Definition: Define.h:123
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
uint16 flags
Definition: DisableMgr.cpp:49
std::vector< GossipMenuItem > GossipMenuItemContainer
Definition: GossipDef.h:140
std::vector< QuestMenuItem > QuestMenuItemList
Definition: GossipDef.h:148
GossipOptionNpc
Definition: GossipDef.h:35
GossipOptionRewardType
Definition: GossipDef.h:104
GossipOptionStatus
Definition: GossipDef.h:96
GossipOptionFlags
Definition: GossipDef.h:110
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
QuestGiverStatus
Definition: QuestDef.h:153
bool Empty() const
Definition: GossipDef.h:176
void SetMenuId(uint32 menu_id)
Definition: GossipDef.h:166
GossipMenu(GossipMenu &&)=delete
uint32 GetMenuItemCount() const
Definition: GossipDef.h:171
GossipMenuItemContainer _menuItems
Definition: GossipDef.h:196
void SetLocale(LocaleConstant locale)
Definition: GossipDef.h:168
LocaleConstant GetLocale() const
Definition: GossipDef.h:169
uint32 GetMenuId() const
Definition: GossipDef.h:167
GossipMenu(GossipMenu const &)=delete
LocaleConstant _locale
Definition: GossipDef.h:198
GossipMenuItemContainer const & GetMenuItems() const
Definition: GossipDef.h:190
GossipMenu & operator=(GossipMenu const &)=delete
uint32 _menuId
Definition: GossipDef.h:197
GossipMenu & operator=(GossipMenu &&)=delete
uint32 PlayerChoiceId
Definition: GossipDef.h:234
ObjectGuid SourceGuid
Definition: GossipDef.h:232
uint32 TrainerId
Definition: GossipDef.h:233
Definition: Item.h:170
void Clear()
Definition: ObjectGuid.h:286
Definition: Object.h:150
QuestMenu _questMenu
Definition: GossipDef.h:277
PlayerMenu & operator=(PlayerMenu const &)=delete
InteractionData _interactionData
Definition: GossipDef.h:279
PlayerMenu(PlayerMenu &&)=delete
QuestMenu & GetQuestMenu()
Definition: GossipDef.h:248
bool IsGossipOptionCoded(uint32 selection) const
Definition: GossipDef.h:256
GossipMenu _gossipMenu
Definition: GossipDef.h:276
bool Empty() const
Definition: GossipDef.h:251
InteractionData & GetInteractionData()
Definition: GossipDef.h:249
PlayerMenu & operator=(PlayerMenu &&)=delete
WorldSession * _session
Definition: GossipDef.h:278
uint32 GetGossipOptionSender(uint32 selection) const
Definition: GossipDef.h:254
GossipMenu & GetGossipMenu()
Definition: GossipDef.h:247
PlayerMenu(PlayerMenu const &)=delete
uint32 GetGossipOptionAction(uint32 selection) const
Definition: GossipDef.h:255
QuestMenu(QuestMenu &&)=delete
QuestMenuItem const & GetItem(uint16 index) const
Definition: GossipDef.h:216
bool Empty() const
Definition: GossipDef.h:214
uint8 GetMenuItemCount() const
Definition: GossipDef.h:213
QuestMenuItemList _questMenuItems
Definition: GossipDef.h:219
QuestMenu & operator=(QuestMenu &&)=delete
QuestMenu(QuestMenu const &)=delete
QuestMenu & operator=(QuestMenu const &)=delete
Player session in the World.
Definition: WorldSession.h:963
uint32 Language
Definition: GossipDef.h:121
uint32 Action
Definition: GossipDef.h:136
Optional< int32 > GossipNpcOptionID
Definition: GossipDef.h:123
uint32 OrderIndex
Definition: GossipDef.h:118
GossipOptionNpc OptionNpc
Definition: GossipDef.h:119
Optional< int32 > OverrideIconID
Definition: GossipDef.h:128
uint32 BoxMoney
Definition: GossipDef.h:125
uint32 ActionPoiID
Definition: GossipDef.h:132
std::string OptionText
Definition: GossipDef.h:120
uint32 ActionMenuID
Definition: GossipDef.h:131
uint32 Sender
Definition: GossipDef.h:135
GossipOptionFlags Flags
Definition: GossipDef.h:122
std::string BoxText
Definition: GossipDef.h:126
int32 GossipOptionID
Definition: GossipDef.h:117
Optional< int32 > SpellID
Definition: GossipDef.h:127
uint32 QuestId
Definition: GossipDef.h:144
uint8 QuestIcon
Definition: GossipDef.h:145