TrinityCore
Loading...
Searching...
No Matches
ScriptedGossip.cpp
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#include "ScriptedGossip.h"
19#include "Creature.h"
20#include "Player.h"
21
23{
24 return player->PlayerTalkClass->GetGossipOptionSender(menuId);
25}
26
27uint32 GetGossipActionFor(Player* player, uint32 gossipListId)
28{
29 return player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
30}
31
32void InitGossipMenuFor(Player* player, uint32 menuId)
33{
34 player->PlayerTalkClass->GetGossipMenu().SetMenuId(menuId);
35}
36
38{
39 player->PlayerTalkClass->ClearMenus();
40}
41
42// Using provided text, not from DB
43void AddGossipItemFor(Player* player, GossipOptionIcon icon, std::string const& text, uint32 sender, uint32 action)
44{
45 player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, icon, text, sender, action, "", 0);
46}
47
48// Using provided texts, not from DB
49void AddGossipItemFor(Player* player, GossipOptionIcon icon, std::string const& text, uint32 sender, uint32 action, std::string const& popupText, uint32 popupMoney, bool coded)
50{
51 player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, icon, text, sender, action, popupText, popupMoney, coded);
52}
53
54// Uses gossip item info from DB
55void AddGossipItemFor(Player* player, uint32 gossipMenuID, uint32 gossipMenuItemID, uint32 sender, uint32 action)
56{
57 player->PlayerTalkClass->GetGossipMenu().AddMenuItem(gossipMenuID, gossipMenuItemID, sender, action);
58}
59
60void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const& guid)
61{
62 player->PlayerTalkClass->SendGossipMenu(npcTextID, guid);
63}
64
65void SendGossipMenuFor(Player* player, uint32 npcTextID, Creature const* creature)
66{
67 if (creature)
68 SendGossipMenuFor(player, npcTextID, creature->GetGUID());
69}
70
72{
74}
uint32_t uint32
Definition Define.h:133
GossipOptionIcon
Definition GossipDef.h:59
uint32 GetGossipActionFor(Player *player, uint32 gossipListId)
uint32 GetGossipSenderFor(Player *player, uint32 menuId)
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
void AddGossipItemFor(Player *player, GossipOptionIcon icon, std::string const &text, uint32 sender, uint32 action)
void ClearGossipMenuFor(Player *player)
void InitGossipMenuFor(Player *player, uint32 menuId)
void CloseGossipMenuFor(Player *player)
void SetMenuId(uint32 menu_id)
Definition GossipDef.h:170
uint32 AddMenuItem(int32 menuItemId, GossipOptionIcon icon, std::string const &message, uint32 sender, uint32 action, std::string const &boxMessage, uint32 boxMoney, bool coded=false)
Definition GossipDef.cpp:40
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void SendCloseGossip()
void ClearMenus()
void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID)
uint32 GetGossipOptionSender(uint32 selection) const
Definition GossipDef.h:268
GossipMenu & GetGossipMenu()
Definition GossipDef.h:262
uint32 GetGossipOptionAction(uint32 selection) const
Definition GossipDef.h:269
PlayerMenu * PlayerTalkClass
Definition Player.h:1969