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 ForgeMaster = 55,
92 CharacterBanker = 56,
93 AccountBanker = 57,
95
96 Count
97};
98
100{
101 Available = 0,
102 Unavailable = 1,
103 Locked = 2,
105};
106
108{
109 Item = 0,
110 Currency = 1
111};
112
114{
115 None = 0x0,
116 QuestLabelPrepend = 0x1,
119};
120
122{
126 std::string OptionText;
132 std::string BoxText;
135
136 // action data
139
140 // additional scripting identifiers
143};
144
145// need an ordered container
146typedef std::vector<GossipMenuItem> GossipMenuItemContainer;
147
149{
152};
153
154typedef std::vector<QuestMenuItem> QuestMenuItemList;
155
157{
158 public:
159 GossipMenu();
160 GossipMenu(GossipMenu const&) = delete;
162 GossipMenu& operator=(GossipMenu const&) = delete;
165
166 uint32 AddMenuItem(int32 gossipOptionId, int32 orderIndex, GossipOptionNpc optionNpc, std::string optionText, uint32 language, GossipOptionFlags flags,
167 Optional<int32> gossipNpcOptionId, uint32 actionMenuId, uint32 actionPoiId, bool boxCoded, uint64 boxMoney,
168 std::string boxText, Optional<int32> spellId, Optional<int32> overrideIconId, uint32 sender, uint32 action);
169 void AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action);
170 void AddMenuItem(GossipMenuItems const& menuItem, uint32 sender, uint32 action);
171
172 void SetMenuId(uint32 menu_id) { _menuId = menu_id; }
173 uint32 GetMenuId() const { return _menuId; }
174 void SetLocale(LocaleConstant locale) { _locale = locale; }
175 LocaleConstant GetLocale() const { return _locale; }
176
178 {
179 return _menuItems.size();
180 }
181
182 bool Empty() const
183 {
184 return _menuItems.empty();
185 }
186
187 GossipMenuItem const* GetItem(int32 gossipOptionId) const;
188 GossipMenuItem const* GetItemByIndex(uint32 orderIndex) const;
189
190 uint32 GetMenuItemSender(uint32 orderIndex) const;
191 uint32 GetMenuItemAction(uint32 orderIndex) const;
192 bool IsMenuItemCoded(uint32 orderIndex) const;
193
194 void ClearMenu();
195
197 {
198 return _menuItems;
199 }
200
201 private:
205};
206
208{
209 public:
210 QuestMenu();
211 QuestMenu(QuestMenu const&) = delete;
212 QuestMenu(QuestMenu&&) = delete;
213 QuestMenu& operator=(QuestMenu const&) = delete;
216
217 void AddMenuItem(uint32 QuestId, uint8 Icon);
218 void ClearMenu();
219 uint8 GetMenuItemCount() const{ return uint8(_questMenuItems.size()); }
220 bool Empty() const { return _questMenuItems.empty(); }
221 bool HasItem(uint32 questId) const;
222 QuestMenuItem const& GetItem(uint16 index) const { return _questMenuItems[index]; }
223
224 private:
226};
227
229{
230 public:
231 void Reset()
232 {
234 TrainerId = 0;
235 PlayerChoiceId = 0;
236 IsLaunchedByQuest = false;
237 }
238
242 bool IsLaunchedByQuest = false;
243};
244
246{
247 public:
248 explicit PlayerMenu(WorldSession* session);
249 PlayerMenu(PlayerMenu const&) = delete;
251 PlayerMenu& operator=(PlayerMenu const&) = delete;
254
255 GossipMenu& GetGossipMenu() { return _gossipMenu; }
256 QuestMenu& GetQuestMenu() { return _questMenu; }
257 InteractionData& GetInteractionData() { return _interactionData; }
258
259 bool Empty() const { return _gossipMenu.Empty() && _questMenu.Empty(); }
260
261 void ClearMenus();
262 uint32 GetGossipOptionSender(uint32 selection) const { return _gossipMenu.GetMenuItemSender(selection); }
263 uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
264 bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
265
266 void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID);
267 void SendCloseGossip();
268 void SendPointOfInterest(uint32 poiId) const;
269
270 /*********************************************************/
271 /*** QUEST SYSTEM ***/
272 /*********************************************************/
273 void SendQuestGiverStatus(QuestGiverStatus questStatus, ObjectGuid npcGUID) const;
274
275 void SendQuestGiverQuestListMessage(Object* questgiver);
276
277 void SendQuestQueryResponse(Quest const* quest) const;
278 void SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool autoLaunched, bool displayPopup) const;
279
280 void SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool autoLaunched) const;
281 void SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool autoLaunched) const;
282
283 private:
288};
289#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:146
std::vector< QuestMenuItem > QuestMenuItemList
Definition: GossipDef.h:154
GossipOptionNpc
Definition: GossipDef.h:35
GossipOptionRewardType
Definition: GossipDef.h:108
GossipOptionStatus
Definition: GossipDef.h:100
GossipOptionFlags
Definition: GossipDef.h:114
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
QuestGiverStatus
Definition: QuestDef.h:157
bool Empty() const
Definition: GossipDef.h:182
void SetMenuId(uint32 menu_id)
Definition: GossipDef.h:172
GossipMenu(GossipMenu &&)=delete
uint32 GetMenuItemCount() const
Definition: GossipDef.h:177
GossipMenuItemContainer _menuItems
Definition: GossipDef.h:202
void SetLocale(LocaleConstant locale)
Definition: GossipDef.h:174
LocaleConstant GetLocale() const
Definition: GossipDef.h:175
uint32 GetMenuId() const
Definition: GossipDef.h:173
GossipMenu(GossipMenu const &)=delete
LocaleConstant _locale
Definition: GossipDef.h:204
GossipMenuItemContainer const & GetMenuItems() const
Definition: GossipDef.h:196
GossipMenu & operator=(GossipMenu const &)=delete
uint32 _menuId
Definition: GossipDef.h:203
GossipMenu & operator=(GossipMenu &&)=delete
uint32 PlayerChoiceId
Definition: GossipDef.h:241
ObjectGuid SourceGuid
Definition: GossipDef.h:239
uint32 TrainerId
Definition: GossipDef.h:240
bool IsLaunchedByQuest
Definition: GossipDef.h:242
Definition: Item.h:170
void Clear()
Definition: ObjectGuid.h:289
Definition: Object.h:186
QuestMenu _questMenu
Definition: GossipDef.h:285
PlayerMenu & operator=(PlayerMenu const &)=delete
InteractionData _interactionData
Definition: GossipDef.h:287
PlayerMenu(PlayerMenu &&)=delete
QuestMenu & GetQuestMenu()
Definition: GossipDef.h:256
bool IsGossipOptionCoded(uint32 selection) const
Definition: GossipDef.h:264
GossipMenu _gossipMenu
Definition: GossipDef.h:284
bool Empty() const
Definition: GossipDef.h:259
InteractionData & GetInteractionData()
Definition: GossipDef.h:257
PlayerMenu & operator=(PlayerMenu &&)=delete
WorldSession * _session
Definition: GossipDef.h:286
uint32 GetGossipOptionSender(uint32 selection) const
Definition: GossipDef.h:262
GossipMenu & GetGossipMenu()
Definition: GossipDef.h:255
PlayerMenu(PlayerMenu const &)=delete
uint32 GetGossipOptionAction(uint32 selection) const
Definition: GossipDef.h:263
QuestMenu(QuestMenu &&)=delete
QuestMenuItem const & GetItem(uint16 index) const
Definition: GossipDef.h:222
bool Empty() const
Definition: GossipDef.h:220
uint8 GetMenuItemCount() const
Definition: GossipDef.h:219
QuestMenuItemList _questMenuItems
Definition: GossipDef.h:225
QuestMenu & operator=(QuestMenu &&)=delete
QuestMenu(QuestMenu const &)=delete
QuestMenu & operator=(QuestMenu const &)=delete
Player session in the World.
Definition: WorldSession.h:976
uint32 Language
Definition: GossipDef.h:127
uint32 Action
Definition: GossipDef.h:142
Optional< int32 > GossipNpcOptionID
Definition: GossipDef.h:129
uint32 OrderIndex
Definition: GossipDef.h:124
GossipOptionNpc OptionNpc
Definition: GossipDef.h:125
Optional< int32 > OverrideIconID
Definition: GossipDef.h:134
uint32 ActionPoiID
Definition: GossipDef.h:138
std::string OptionText
Definition: GossipDef.h:126
uint32 ActionMenuID
Definition: GossipDef.h:137
uint64 BoxMoney
Definition: GossipDef.h:131
uint32 Sender
Definition: GossipDef.h:141
GossipOptionFlags Flags
Definition: GossipDef.h:128
std::string BoxText
Definition: GossipDef.h:132
int32 GossipOptionID
Definition: GossipDef.h:123
Optional< int32 > SpellID
Definition: GossipDef.h:133
uint32 QuestId
Definition: GossipDef.h:150
uint8 QuestIcon
Definition: GossipDef.h:151