| 1 | /* |
|---|
| 2 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
|---|
| 3 | * |
|---|
| 4 | * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with this program; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #ifndef TRINITYCORE_GOSSIP_H |
|---|
| 22 | #define TRINITYCORE_GOSSIP_H |
|---|
| 23 | |
|---|
| 24 | #include "Common.h" |
|---|
| 25 | #include "QuestDef.h" |
|---|
| 26 | #include "NPCHandler.h" |
|---|
| 27 | |
|---|
| 28 | class WorldSession; |
|---|
| 29 | |
|---|
| 30 | #define GOSSIP_MAX_MENU_ITEMS 64 // client supported items unknown, but provided number must be enough |
|---|
| 31 | #define DEFAULT_GOSSIP_MESSAGE 0xffffff |
|---|
| 32 | |
|---|
| 33 | //POI defines |
|---|
| 34 | enum Poi_Icon |
|---|
| 35 | { |
|---|
| 36 | ICON_POI_0 = 0, // Grey ? |
|---|
| 37 | ICON_POI_1 = 1, // Red ? |
|---|
| 38 | ICON_POI_2 = 2, // Blue ? |
|---|
| 39 | ICON_POI_BWTOMB = 3, // Blue and White Tomb Stone |
|---|
| 40 | ICON_POI_HOUSE = 4, // House |
|---|
| 41 | ICON_POI_TOWER = 5, // Tower |
|---|
| 42 | ICON_POI_REDFLAG = 6, // Red Flag with Yellow ! |
|---|
| 43 | ICON_POI_TOMB = 7, // Tomb Stone |
|---|
| 44 | ICON_POI_BWTOWER = 8, // Blue and White Tower |
|---|
| 45 | ICON_POI_REDTOWER = 9, // Red Tower |
|---|
| 46 | ICON_POI_BLUETOWER = 10, // Blue Tower |
|---|
| 47 | ICON_POI_RWTOWER = 11, // Red and White Tower |
|---|
| 48 | ICON_POI_REDTOMB = 12, // Red Tomb Stone |
|---|
| 49 | ICON_POI_RWTOMB = 13, // Red and White Tomb Stone |
|---|
| 50 | ICON_POI_BLUETOMB = 14, // Blue Tomb Stone |
|---|
| 51 | ICON_POI_NOTHING = 15, // NOTHING |
|---|
| 52 | ICON_POI_16 = 16, // Red ? |
|---|
| 53 | ICON_POI_17 = 17, // Grey ? |
|---|
| 54 | ICON_POI_18 = 18, // Blue ? |
|---|
| 55 | ICON_POI_19 = 19, // Red and White ? |
|---|
| 56 | ICON_POI_20 = 20, // Red ? |
|---|
| 57 | ICON_POI_GREYLOGS = 21, // Grey Wood Logs |
|---|
| 58 | ICON_POI_BWLOGS = 22, // Blue and White Wood Logs |
|---|
| 59 | ICON_POI_BLUELOGS = 23, // Blue Wood Logs |
|---|
| 60 | ICON_POI_RWLOGS = 24, // Red and White Wood Logs |
|---|
| 61 | ICON_POI_REDLOGS = 25, // Red Wood Logs |
|---|
| 62 | ICON_POI_26 = 26, // Grey ? |
|---|
| 63 | ICON_POI_27 = 27, // Blue and White ? |
|---|
| 64 | ICON_POI_28 = 28, // Blue ? |
|---|
| 65 | ICON_POI_29 = 29, // Red and White ? |
|---|
| 66 | ICON_POI_30 = 30, // Red ? |
|---|
| 67 | ICON_POI_GREYHOUSE = 31, // Grey House |
|---|
| 68 | ICON_POI_BWHOUSE = 32, // Blue and White House |
|---|
| 69 | ICON_POI_BLUEHOUSE = 33, // Blue House |
|---|
| 70 | ICON_POI_RWHOUSE = 34, // Red and White House |
|---|
| 71 | ICON_POI_REDHOUSE = 35, // Red House |
|---|
| 72 | ICON_POI_GREYHORSE = 36, // Grey Horse |
|---|
| 73 | ICON_POI_BWHORSE = 37, // Blue and White Horse |
|---|
| 74 | ICON_POI_BLUEHORSE = 38, // Blue Horse |
|---|
| 75 | ICON_POI_RWHORSE = 39, // Red and White Horse |
|---|
| 76 | ICON_POI_REDHORSE = 40 // Red Horse |
|---|
| 77 | }; |
|---|
| 78 | |
|---|
| 79 | struct GossipMenuItem |
|---|
| 80 | { |
|---|
| 81 | uint8 m_gIcon; |
|---|
| 82 | bool m_gCoded; |
|---|
| 83 | std::string m_gMessage; |
|---|
| 84 | uint32 m_gSender; |
|---|
| 85 | uint32 m_gAction; |
|---|
| 86 | std::string m_gBoxMessage; |
|---|
| 87 | uint32 m_gBoxMoney; |
|---|
| 88 | }; |
|---|
| 89 | |
|---|
| 90 | typedef std::vector<GossipMenuItem> GossipMenuItemList; |
|---|
| 91 | |
|---|
| 92 | struct QuestMenuItem |
|---|
| 93 | { |
|---|
| 94 | uint32 m_qId; |
|---|
| 95 | uint8 m_qIcon; |
|---|
| 96 | }; |
|---|
| 97 | |
|---|
| 98 | typedef std::vector<QuestMenuItem> QuestMenuItemList; |
|---|
| 99 | |
|---|
| 100 | class TRINITY_DLL_SPEC GossipMenu |
|---|
| 101 | { |
|---|
| 102 | public: |
|---|
| 103 | GossipMenu(); |
|---|
| 104 | ~GossipMenu(); |
|---|
| 105 | |
|---|
| 106 | void AddMenuItem(uint8 Icon, std::string Message, bool Coded = false); |
|---|
| 107 | void AddMenuItem(uint8 Icon, std::string Message, uint32 dtSender, uint32 dtAction, std::string BoxMessage, uint32 BoxMoney, bool Coded = false); |
|---|
| 108 | |
|---|
| 109 | // for using from scripts, don't must be inlined |
|---|
| 110 | void AddMenuItem(uint8 Icon, char const* Message, bool Coded = false); |
|---|
| 111 | void AddMenuItem(uint8 Icon, char const* Message, uint32 dtSender, uint32 dtAction, char const* BoxMessage, uint32 BoxMoney, bool Coded = false); |
|---|
| 112 | |
|---|
| 113 | unsigned int MenuItemCount() const |
|---|
| 114 | { |
|---|
| 115 | return m_gItems.size(); |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | bool Empty() const |
|---|
| 119 | { |
|---|
| 120 | return m_gItems.empty(); |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | GossipMenuItem const& GetItem( unsigned int Id ) |
|---|
| 124 | { |
|---|
| 125 | return m_gItems[ Id ]; |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | uint32 MenuItemSender( unsigned int ItemId ); |
|---|
| 129 | uint32 MenuItemAction( unsigned int ItemId ); |
|---|
| 130 | bool MenuItemCoded( unsigned int ItemId ); |
|---|
| 131 | |
|---|
| 132 | void ClearMenu(); |
|---|
| 133 | |
|---|
| 134 | protected: |
|---|
| 135 | GossipMenuItemList m_gItems; |
|---|
| 136 | }; |
|---|
| 137 | |
|---|
| 138 | class QuestMenu |
|---|
| 139 | { |
|---|
| 140 | public: |
|---|
| 141 | QuestMenu(); |
|---|
| 142 | ~QuestMenu(); |
|---|
| 143 | |
|---|
| 144 | void AddMenuItem( uint32 QuestId, uint8 Icon); |
|---|
| 145 | void ClearMenu(); |
|---|
| 146 | |
|---|
| 147 | uint8 MenuItemCount() const |
|---|
| 148 | { |
|---|
| 149 | return m_qItems.size(); |
|---|
| 150 | } |
|---|
| 151 | |
|---|
| 152 | bool Empty() const |
|---|
| 153 | { |
|---|
| 154 | return m_qItems.empty(); |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | bool HasItem( uint32 questid ); |
|---|
| 158 | |
|---|
| 159 | QuestMenuItem const& GetItem( uint16 Id ) |
|---|
| 160 | { |
|---|
| 161 | return m_qItems[ Id ]; |
|---|
| 162 | } |
|---|
| 163 | |
|---|
| 164 | protected: |
|---|
| 165 | QuestMenuItemList m_qItems; |
|---|
| 166 | }; |
|---|
| 167 | |
|---|
| 168 | class TRINITY_DLL_SPEC PlayerMenu |
|---|
| 169 | { |
|---|
| 170 | private: |
|---|
| 171 | GossipMenu mGossipMenu; |
|---|
| 172 | QuestMenu mQuestMenu; |
|---|
| 173 | WorldSession* pSession; |
|---|
| 174 | |
|---|
| 175 | public: |
|---|
| 176 | PlayerMenu( WorldSession *Session ); |
|---|
| 177 | ~PlayerMenu(); |
|---|
| 178 | |
|---|
| 179 | GossipMenu& GetGossipMenu() { return mGossipMenu; } |
|---|
| 180 | QuestMenu& GetQuestMenu() { return mQuestMenu; } |
|---|
| 181 | |
|---|
| 182 | bool Empty() const { return mGossipMenu.Empty() && mQuestMenu.Empty(); } |
|---|
| 183 | |
|---|
| 184 | void ClearMenus(); |
|---|
| 185 | uint32 GossipOptionSender( unsigned int Selection ); |
|---|
| 186 | uint32 GossipOptionAction( unsigned int Selection ); |
|---|
| 187 | bool GossipOptionCoded( unsigned int Selection ); |
|---|
| 188 | |
|---|
| 189 | void SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ); |
|---|
| 190 | void CloseGossip(); |
|---|
| 191 | void SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, const char * locName ); |
|---|
| 192 | void SendTalking( uint32 textID ); |
|---|
| 193 | void SendTalking( char const * title, char const * text ); |
|---|
| 194 | |
|---|
| 195 | /*********************************************************/ |
|---|
| 196 | /*** QUEST SYSTEM ***/ |
|---|
| 197 | /*********************************************************/ |
|---|
| 198 | void SendQuestGiverStatus( uint8 questStatus, uint64 npcGUID ); |
|---|
| 199 | |
|---|
| 200 | void SendQuestGiverQuestList( QEmote eEmote, std::string Title, uint64 npcGUID ); |
|---|
| 201 | |
|---|
| 202 | void SendQuestQueryResponse ( Quest const *pQuest ); |
|---|
| 203 | void SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept); |
|---|
| 204 | |
|---|
| 205 | void SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, bool EnbleNext ); |
|---|
| 206 | void SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel ); |
|---|
| 207 | }; |
|---|
| 208 | #endif |
|---|