aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedGossip.h6
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp2
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp4
-rwxr-xr-xsrc/server/game/Entities/Creature/GossipDef.cpp719
-rwxr-xr-xsrc/server/game/Entities/Creature/GossipDef.h140
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp218
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h6
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp56
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.h26
-rwxr-xr-xsrc/server/game/Scripting/MapScripts.cpp2
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/MiscHandler.cpp12
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/NPCHandler.cpp2
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/QuestHandler.cpp14
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp27
-rwxr-xr-xsrc/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp2
-rw-r--r--src/server/scripts/World/npcs_special.cpp6
16 files changed, 588 insertions, 654 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedGossip.h b/src/server/game/AI/ScriptedAI/ScriptedGossip.h
index 20616133016..9bf602d499d 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedGossip.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedGossip.h
@@ -79,13 +79,13 @@ enum eTradeskill
// d - Action (identifys this Menu Item)
// e - Text to be displayed in pop up box
// f - Money value in pop up box
-#define ADD_GOSSIP_ITEM(a, b, c, d) PlayerTalkClass->GetGossipMenu().AddMenuItem(a, b, c, d, "", 0)
-#define ADD_GOSSIP_ITEM_EXTENDED(a, b, c, d, e, f, g) PlayerTalkClass->GetGossipMenu().AddMenuItem(a, b, c, d, e, f, g)
+#define ADD_GOSSIP_ITEM(a, b, c, d) PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, a, b, c, d, "", 0)
+#define ADD_GOSSIP_ITEM_EXTENDED(a, b, c, d, e, f, g) PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, a, b, c, d, e, f, g)
// This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32) , b - npc guid(uint64)
#define SEND_GOSSIP_MENU(a, b) PlayerTalkClass->SendGossipMenu(a, b)
// Closes the Menu
-#define CLOSE_GOSSIP_MENU() PlayerTalkClass->CloseGossip()
+#define CLOSE_GOSSIP_MENU() PlayerTalkClass->SendCloseGossip()
#endif
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 1b992283af9..ff6ac09bafc 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1294,7 +1294,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
if (IsPlayer(*itr))
- (*itr)->ToPlayer()->PlayerTalkClass->CloseGossip();
+ (*itr)->ToPlayer()->PlayerTalkClass->SendCloseGossip();
delete targets;
break;
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 0a3a3cd9fb3..84212075013 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -620,9 +620,9 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond)
{
for (GossipMenuItemsMap::iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr)
{
- if ((*itr).second.menu_id == cond->mSourceGroup && (*itr).second.id == cond->mSourceEntry)
+ if ((*itr).second.MenuId == cond->mSourceGroup && (*itr).second.OptionIndex == cond->mSourceEntry)
{
- (*itr).second.conditions.push_back(cond);
+ (*itr).second.Conditions.push_back(cond);
return true;
}
}
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 75e665feac0..99dbe49d0d6 100755
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -26,8 +26,7 @@
GossipMenu::GossipMenu()
{
- m_gItems.reserve(16); // can be set for max from most often sizes to speedup push_back and less memory use
- m_gMenuId = 0;
+ _menuId = 0;
}
GossipMenu::~GossipMenu()
@@ -35,77 +34,83 @@ GossipMenu::~GossipMenu()
ClearMenu();
}
-void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSender, uint32 dtAction, const std::string& BoxMessage, uint32 BoxMoney, bool Coded)
+void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded /*= false*/)
{
- ASSERT(m_gItems.size() <= GOSSIP_MAX_MENU_ITEMS);
+ ASSERT(_menuItems.size() <= GOSSIP_MAX_MENU_ITEMS);
- GossipMenuItem gItem;
-
- gItem.m_gIcon = Icon;
- gItem.m_gMessage = Message;
- gItem.m_gCoded = Coded;
- gItem.m_gSender = dtSender;
- gItem.m_gOptionId = dtAction;
- gItem.m_gBoxMessage = BoxMessage;
- gItem.m_gBoxMoney = BoxMoney;
-
- m_gItems.push_back(gItem);
-}
-
-void GossipMenu::AddGossipMenuItemData(uint32 action_menu, uint32 action_poi, uint32 action_script)
-{
- GossipMenuItemData pItemData;
-
- pItemData.m_gAction_menu = action_menu;
- pItemData.m_gAction_poi = action_poi;
- pItemData.m_gAction_script = action_script;
+ // Find a free new id - script case
+ if (menuItemId == -1)
+ {
+ menuItemId = 0;
+ if (!_menuItems.empty())
+ {
+ for (GossipMenuItemContainer::const_iterator itr = _menuItems.begin(); itr != _menuItems.end(); ++itr)
+ {
+ if (int32(itr->first) > menuItemId)
+ {
+ menuItemId = menuItemId;
+ break;
+ }
+
+ menuItemId = itr->first + 1;
+ }
+ }
+ }
- m_gItemsData.push_back(pItemData);
-}
+ GossipMenuItem& menuItem = _menuItems[menuItemId];
-void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, bool Coded)
-{
- AddMenuItem(Icon, Message, 0, 0, "", 0, Coded);
+ menuItem.MenuItemIcon = icon;
+ menuItem.Message = message;
+ menuItem.IsCoded = coded;
+ menuItem.Sender = sender;
+ menuItem.OptionType = action;
+ menuItem.BoxMessage = boxMessage;
+ menuItem.BoxMoney = boxMoney;
}
-void GossipMenu::AddMenuItem(uint8 Icon, char const* Message, bool Coded)
+void GossipMenu::AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi, uint32 gossipActionScript)
{
- AddMenuItem(Icon, std::string(Message ? Message : ""), Coded);
-}
+ GossipMenuItemData& itemData = _menuItemData[menuItemId];
-void GossipMenu::AddMenuItem(uint8 Icon, char const* Message, uint32 dtSender, uint32 dtAction, char const* BoxMessage, uint32 BoxMoney, bool Coded)
-{
- AddMenuItem(Icon, std::string(Message ? Message : ""), dtSender, dtAction, std::string(BoxMessage ? BoxMessage : ""), BoxMoney, Coded);
+ itemData.GossipActionMenuId = gossipActionMenuId;
+ itemData.GossipActionPoi = gossipActionPoi;
+ itemData.GossipActionScript = gossipActionScript;
}
-uint32 GossipMenu::MenuItemSender(unsigned int ItemId)
+uint32 GossipMenu::GetMenuItemSender(uint32 menuItemId) const
{
- if (ItemId >= m_gItems.size()) return 0;
+ GossipMenuItemContainer::const_iterator itr = _menuItems.find(menuItemId);
+ if (itr == _menuItems.end())
+ return 0;
- return m_gItems[ ItemId ].m_gSender;
+ return itr->second.Sender;
}
-uint32 GossipMenu::MenuItemAction(unsigned int ItemId)
+uint32 GossipMenu::GetMenuItemAction(uint32 menuItemId) const
{
- if (ItemId >= m_gItems.size()) return 0;
+ GossipMenuItemContainer::const_iterator itr = _menuItems.find(menuItemId);
+ if (itr == _menuItems.end())
+ return 0;
- return m_gItems[ ItemId ].m_gOptionId;
+ return itr->second.OptionType;
}
-bool GossipMenu::MenuItemCoded(unsigned int ItemId)
+bool GossipMenu::IsMenuItemCoded(uint32 menuItemId) const
{
- if (ItemId >= m_gItems.size()) return 0;
+ GossipMenuItemContainer::const_iterator itr = _menuItems.find(menuItemId);
+ if (itr == _menuItems.end())
+ return false;
- return m_gItems[ ItemId ].m_gCoded;
+ return itr->second.IsCoded;
}
void GossipMenu::ClearMenu()
{
- m_gItems.clear();
- m_gItemsData.clear();
+ _menuItems.clear();
+ _menuItemData.clear();
}
-PlayerMenu::PlayerMenu(WorldSession *session) : pSession(session)
+PlayerMenu::PlayerMenu(WorldSession *session) : _session(session)
{
}
@@ -116,117 +121,85 @@ PlayerMenu::~PlayerMenu()
void PlayerMenu::ClearMenus()
{
- mGossipMenu.ClearMenu();
- mQuestMenu.ClearMenu();
+ _gossipMenu.ClearMenu();
+ _questMenu.ClearMenu();
}
-uint32 PlayerMenu::GossipOptionSender(unsigned int Selection)
+void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
{
- return mGossipMenu.MenuItemSender(Selection);
-}
-
-uint32 PlayerMenu::GossipOptionAction(unsigned int Selection)
-{
- return mGossipMenu.MenuItemAction(Selection);
-}
-
-bool PlayerMenu::GossipOptionCoded(unsigned int Selection)
-{
- return mGossipMenu.MenuItemCoded(Selection);
-}
-
-void PlayerMenu::SendGossipMenu(uint32 TitleTextId, uint64 objectGUID)
-{
- WorldPacket data(SMSG_GOSSIP_MESSAGE, (100)); // guess size
+ WorldPacket data(SMSG_GOSSIP_MESSAGE, 100); // guess size
data << uint64(objectGUID);
- data << uint32(mGossipMenu.GetMenuId()); // new 2.4.0
- data << uint32(TitleTextId);
- data << uint32(mGossipMenu.MenuItemCount()); // max count 0x10
+ data << uint32(_gossipMenu.GetMenuId()); // new 2.4.0
+ data << uint32(titleTextId);
+ data << uint32(_gossipMenu.GetMenuItemCount()); // max count 0x10
- for (uint32 iI = 0; iI < mGossipMenu.MenuItemCount(); ++iI)
+ for (GossipMenuItemContainer::const_iterator itr = _gossipMenu.GetMenuItems().begin(); itr != _gossipMenu.GetMenuItems().end(); ++itr)
{
- GossipMenuItem const& gItem = mGossipMenu.GetItem(iI);
- data << uint32(iI);
- data << uint8(gItem.m_gIcon);
- data << uint8(gItem.m_gCoded); // makes pop up box password
- data << uint32(gItem.m_gBoxMoney); // money required to open menu, 2.0.3
- data << gItem.m_gMessage; // text for gossip item
- data << gItem.m_gBoxMessage; // accept text (related to money) pop up box, 2.0.3
+ GossipMenuItem const& item = itr->second;
+ data << uint32(itr->first);
+ data << uint8(item.MenuItemIcon);
+ data << uint8(item.IsCoded); // makes pop up box password
+ data << uint32(item.BoxMoney); // money required to open menu, 2.0.3
+ data << item.Message; // text for gossip item
+ data << item.BoxMessage; // accept text (related to money) pop up box, 2.0.3
}
- data << uint32(mQuestMenu.MenuItemCount()); // max count 0x20
+ data << uint32(_questMenu.GetMenuItemCount()); // max count 0x20
- for (uint32 iI = 0; iI < mQuestMenu.MenuItemCount(); ++iI)
+ for (uint32 iI = 0; iI < _questMenu.GetMenuItemCount(); ++iI)
{
- QuestMenuItem const& qItem = mQuestMenu.GetItem(iI);
- uint32 questID = qItem.m_qId;
- Quest const* pQuest = sObjectMgr->GetQuestTemplate(questID);
+ QuestMenuItem const& item = _questMenu.GetItem(iI);
+ uint32 questID = item.QuestId;
+ Quest const* quest = sObjectMgr->GetQuestTemplate(questID);
data << uint32(questID);
- data << uint32(qItem.m_qIcon);
- data << int32(pQuest->GetQuestLevel());
- data << uint32(pQuest->GetFlags()); // 3.3.3 quest flags
- data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation
- std::string Title = pQuest->GetTitle();
-
- int loc_idx = pSession->GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
- if (QuestLocale const *ql = sObjectMgr->GetQuestLocale(questID))
- sObjectMgr->GetLocaleString(ql->Title, loc_idx, Title);
-
- data << Title; // max 0x200
+ data << uint32(item.QuestIcon);
+ data << int32(quest->GetQuestLevel());
+ data << uint32(quest->GetFlags()); // 3.3.3 quest flags
+ data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation
+ std::string title = quest->GetTitle();
+
+ int locale = _session->GetSessionDbLocaleIndex();
+ if (locale >= 0)
+ if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
+ sObjectMgr->GetLocaleString(localeData->Title, locale, title);
+
+ data << title; // max 0x200
}
- pSession->SendPacket(&data);
+ _session->SendPacket(&data);
}
-void PlayerMenu::CloseGossip()
+void PlayerMenu::SendCloseGossip() const
{
WorldPacket data(SMSG_GOSSIP_COMPLETE, 0);
- pSession->SendPacket(&data);
-}
-
-// Outdated
-void PlayerMenu::SendPointOfInterest(float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, char const * locName)
-{
- WorldPacket data(SMSG_GOSSIP_POI, (4+4+4+4+4+10)); // guess size
- data << uint32(Flags);
- data << float(X);
- data << float(Y);
- data << uint32(Icon);
- data << uint32(Data);
- data << locName;
-
- pSession->SendPacket(&data);
- //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Sent SMSG_GOSSIP_POI");
+ _session->SendPacket(&data);
}
-void PlayerMenu::SendPointOfInterest(uint32 poi_id)
+void PlayerMenu::SendPointOfInterest(uint32 poiId) const
{
- PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(poi_id);
+ PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(poiId);
if (!poi)
{
- sLog->outErrorDb("Request to send non-existing POI (Id: %u), ignored.", poi_id);
+ sLog->outErrorDb("Request to send non-existing POI (Id: %u), ignored.", poiId);
return;
}
- std::string icon_name = poi->icon_name;
-
- int loc_idx = pSession->GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
- if (PointOfInterestLocale const *pl = sObjectMgr->GetPointOfInterestLocale(poi_id))
- sObjectMgr->GetLocaleString(pl->IconName, loc_idx, icon_name);
+ std::string iconText = poi->icon_name;
+ int32 locale = _session->GetSessionDbLocaleIndex();
+ if (locale >= 0)
+ if (PointOfInterestLocale const *localeData = sObjectMgr->GetPointOfInterestLocale(poiId))
+ sObjectMgr->GetLocaleString(localeData->IconName, locale, iconText);
- WorldPacket data(SMSG_GOSSIP_POI, (4+4+4+4+4+10)); // guess size
+ WorldPacket data(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 10); // guess size
data << uint32(poi->flags);
data << float(poi->x);
data << float(poi->y);
data << uint32(poi->icon);
data << uint32(poi->data);
- data << icon_name;
+ data << iconText;
- pSession->SendPacket(&data);
- //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Sent SMSG_GOSSIP_POI");
+ _session->SendPacket(&data);
}
/*********************************************************/
@@ -235,7 +208,7 @@ void PlayerMenu::SendPointOfInterest(uint32 poi_id)
QuestMenu::QuestMenu()
{
- m_qItems.reserve(16); // can be set for max from most often sizes to speedup push_back and less memory use
+ _questMenuItems.reserve(16); // can be set for max from most often sizes to speedup push_back and less memory use
}
QuestMenu::~QuestMenu()
@@ -245,34 +218,31 @@ QuestMenu::~QuestMenu()
void QuestMenu::AddMenuItem(uint32 QuestId, uint8 Icon)
{
- Quest const* qinfo = sObjectMgr->GetQuestTemplate(QuestId);
- if (!qinfo) return;
+ if (!sObjectMgr->GetQuestTemplate(QuestId))
+ return;
- ASSERT(m_qItems.size() <= GOSSIP_MAX_MENU_ITEMS);
+ ASSERT(_questMenuItems.size() <= GOSSIP_MAX_MENU_ITEMS);
- QuestMenuItem qItem;
+ QuestMenuItem questMenuItem;
- qItem.m_qId = QuestId;
- qItem.m_qIcon = Icon;
+ questMenuItem.QuestId = QuestId;
+ questMenuItem.QuestIcon = Icon;
- m_qItems.push_back(qItem);
+ _questMenuItems.push_back(questMenuItem);
}
-bool QuestMenu::HasItem(uint32 questid)
+bool QuestMenu::HasItem(uint32 questId) const
{
- for (QuestMenuItemList::const_iterator i = m_qItems.begin(); i != m_qItems.end(); ++i)
- {
- if (i->m_qId == questid)
- {
+ for (QuestMenuItemList::const_iterator i = _questMenuItems.begin(); i != _questMenuItems.end(); ++i)
+ if (i->QuestId == questId)
return true;
- }
- }
+
return false;
}
void QuestMenu::ClearMenu()
{
- m_qItems.clear();
+ _questMenuItems.clear();
}
void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title, uint64 npcGUID)
@@ -284,25 +254,25 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title
data << uint32(eEmote._Emote); // NPC emote
size_t count_pos = data.wpos();
- data << uint8 ( mQuestMenu.MenuItemCount());
+ data << uint8 ( _questMenu.GetMenuItemCount());
uint32 count = 0;
- for (; count < mQuestMenu.MenuItemCount(); ++count)
+ for (; count < _questMenu.GetMenuItemCount(); ++count)
{
- QuestMenuItem const& qmi = mQuestMenu.GetItem(count);
+ QuestMenuItem const& qmi = _questMenu.GetItem(count);
- uint32 questID = qmi.m_qId;
+ uint32 questID = qmi.QuestId;
if (Quest const *pQuest = sObjectMgr->GetQuestTemplate(questID))
{
std::string title = pQuest->GetTitle();
- int loc_idx = pSession->GetSessionDbLocaleIndex();
+ int loc_idx = _session->GetSessionDbLocaleIndex();
if (loc_idx >= 0)
if (QuestLocale const *ql = sObjectMgr->GetQuestLocale(questID))
sObjectMgr->GetLocaleString(ql->Title, loc_idx, title);
data << uint32(questID);
- data << uint32(qmi.m_qIcon);
+ data << uint32(qmi.QuestIcon);
data << int32(pQuest->GetQuestLevel());
data << uint32(pQuest->GetFlags()); // 3.3.3 quest flags
data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation
@@ -311,52 +281,52 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title
}
data.put<uint8>(count_pos, count);
- pSession->SendPacket(&data);
+ _session->SendPacket(&data);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID));
}
-void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID)
+void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const
{
WorldPacket data(SMSG_QUESTGIVER_STATUS, 9);
data << uint64(npcGUID);
data << uint8(questStatus);
- pSession->SendPacket(&data);
+ _session->SendPacket(&data);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus);
}
-void PlayerMenu::SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID, bool ActivateAccept)
+void PlayerMenu::SendQuestGiverQuestDetails(Quest const *quest, uint64 npcGUID, bool activateAccept) const
{
- std::string Title = pQuest->GetTitle();
- std::string Details = pQuest->GetDetails();
- std::string Objectives = pQuest->GetObjectives();
- std::string EndText = pQuest->GetEndText();
+ std::string questTitle = quest->GetTitle();
+ std::string questDetails = quest->GetDetails();
+ std::string questObjectives = quest->GetObjectives();
+ std::string questEndText = quest->GetEndText();
- int loc_idx = pSession->GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
+ int32 locale = _session->GetSessionDbLocaleIndex();
+ if (locale >= 0)
{
- if (QuestLocale const *ql = sObjectMgr->GetQuestLocale(pQuest->GetQuestId()))
+ if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
- sObjectMgr->GetLocaleString(ql->Title, loc_idx, Title);
- sObjectMgr->GetLocaleString(ql->Details, loc_idx, Details);
- sObjectMgr->GetLocaleString(ql->Objectives, loc_idx, Objectives);
- sObjectMgr->GetLocaleString(ql->EndText, loc_idx, EndText);
+ sObjectMgr->GetLocaleString(localeData->Title, locale, questTitle);
+ sObjectMgr->GetLocaleString(localeData->Details, locale, questDetails);
+ sObjectMgr->GetLocaleString(localeData->Objectives, locale, questObjectives);
+ sObjectMgr->GetLocaleString(localeData->EndText, locale, questEndText);
}
}
WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 100); // guess size
data << uint64(npcGUID);
data << uint64(0); // wotlk, something todo with quest sharing?
- data << uint32(pQuest->GetQuestId());
- data << Title;
- data << Details;
- data << Objectives;
- data << uint8(ActivateAccept ? 1 : 0); // auto finish
- data << uint32(pQuest->GetFlags()); // 3.3.3 questFlags
- data << uint32(pQuest->GetSuggestedPlayers());
+ data << uint32(quest->GetQuestId());
+ data << questTitle;
+ data << questDetails;
+ data << questObjectives;
+ data << uint8(activateAccept ? 1 : 0); // auto finish
+ data << uint32(quest->GetFlags()); // 3.3.3 questFlags
+ data << uint32(quest->GetSuggestedPlayers());
data << uint8(0); // IsFinished? value is sent back to server in quest accept packet
- if (pQuest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
+ if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
{
data << uint32(0); // Rewarded chosen items hidden
data << uint32(0); // Rewarded items hidden
@@ -365,382 +335,361 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID,
}
else
{
- ItemTemplate const* IProto;
-
- data << uint32(pQuest->GetRewChoiceItemsCount());
+ data << uint32(quest->GetRewChoiceItemsCount());
for (uint32 i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
- if (!pQuest->RewChoiceItemId[i])
+ if (!quest->RewChoiceItemId[i])
continue;
- data << uint32(pQuest->RewChoiceItemId[i]);
- data << uint32(pQuest->RewChoiceItemCount[i]);
-
- IProto = sObjectMgr->GetItemTemplate(pQuest->RewChoiceItemId[i]);
+ data << uint32(quest->RewChoiceItemId[i]);
+ data << uint32(quest->RewChoiceItemCount[i]);
- if (IProto)
- data << uint32(IProto->DisplayInfoID);
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewChoiceItemId[i]))
+ data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0x00);
}
- data << uint32(pQuest->GetRewItemsCount());
+ data << uint32(quest->GetRewItemsCount());
for (uint32 i=0; i < QUEST_REWARDS_COUNT; ++i)
{
- if (!pQuest->RewItemId[i])
+ if (!quest->RewItemId[i])
continue;
- data << uint32(pQuest->RewItemId[i]);
- data << uint32(pQuest->RewItemCount[i]);
-
- IProto = sObjectMgr->GetItemTemplate(pQuest->RewItemId[i]);
+ data << uint32(quest->RewItemId[i]);
+ data << uint32(quest->RewItemCount[i]);
- if (IProto)
- data << uint32(IProto->DisplayInfoID);
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewItemId[i]))
+ data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
}
- data << uint32(pQuest->GetRewOrReqMoney());
- data << uint32(pQuest->XPValue(pSession->GetPlayer())*sWorld->getRate(RATE_XP_QUEST));
+ data << uint32(quest->GetRewOrReqMoney());
+ data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
}
// rewarded honor points. Multiply with 10 to satisfy client
- data << 10 * Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorMultiplier());
+ data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
data << float(0); // new 3.3.0, honor multiplier?
- data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
- data << int32(pQuest->GetRewSpellCast()); // casted spell
- data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
- data << uint32(pQuest->GetBonusTalents()); // bonus talents
- data << uint32(pQuest->GetRewArenaPoints()); // reward arena points
+ data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
+ data << int32(quest->GetRewSpellCast()); // casted spell
+ data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
+ data << uint32(quest->GetBonusTalents()); // bonus talents
+ data << uint32(quest->GetRewArenaPoints()); // reward arena points
data << uint32(0); // unk
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- data << uint32(pQuest->RewRepFaction[i]);
+ for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
+ data << uint32(quest->RewRepFaction[i]);
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- data << int32(pQuest->RewRepValueId[i]);
+ for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
+ data << int32(quest->RewRepValueId[i]);
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- data << int32(pQuest->RewRepValue[i]);
+ for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
+ data << int32(quest->RewRepValue[i]);
data << uint32(QUEST_EMOTE_COUNT);
- for (uint32 i=0; i < QUEST_EMOTE_COUNT; ++i)
+ for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
- data << uint32(pQuest->DetailsEmote[i]);
- data << uint32(pQuest->DetailsEmoteDelay[i]); // DetailsEmoteDelay (in ms)
+ data << uint32(quest->DetailsEmote[i]);
+ data << uint32(quest->DetailsEmoteDelay[i]); // DetailsEmoteDelay (in ms)
}
- pSession->SendPacket(&data);
+ _session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
}
-void PlayerMenu::SendQuestQueryResponse(Quest const *pQuest)
+void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
{
- std::string Title, Details, Objectives, EndText, CompletedText;
- std::string ObjectiveText[QUEST_OBJECTIVES_COUNT];
- Title = pQuest->GetTitle();
- Details = pQuest->GetDetails();
- Objectives = pQuest->GetObjectives();
- EndText = pQuest->GetEndText();
- CompletedText = pQuest->GetCompletedText();
- for (int i=0; i<QUEST_OBJECTIVES_COUNT; ++i)
- ObjectiveText[i]=pQuest->ObjectiveText[i];
-
- int loc_idx = pSession->GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
+ std::string questTitle = quest->GetTitle();
+ std::string questDetails = quest->GetDetails();
+ std::string questObjectives = quest->GetObjectives();
+ std::string questEndText = quest->GetEndText();
+ std::string questCompletedText = quest->GetCompletedText();
+
+ std::string questObjectiveText[QUEST_OBJECTIVES_COUNT];
+ for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ questObjectiveText[i] = quest->ObjectiveText[i];
+
+ int32 locale = _session->GetSessionDbLocaleIndex();
+ if (locale >= 0)
{
- if (QuestLocale const *ql = sObjectMgr->GetQuestLocale(pQuest->GetQuestId()))
+ if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
- sObjectMgr->GetLocaleString(ql->Title, loc_idx, Title);
- sObjectMgr->GetLocaleString(ql->Details, loc_idx, Details);
- sObjectMgr->GetLocaleString(ql->Objectives, loc_idx, Objectives);
- sObjectMgr->GetLocaleString(ql->EndText, loc_idx, EndText);
- sObjectMgr->GetLocaleString(ql->CompletedText, loc_idx, CompletedText);
+ sObjectMgr->GetLocaleString(localeData->Title, locale, questTitle);
+ sObjectMgr->GetLocaleString(localeData->Details, locale, questDetails);
+ sObjectMgr->GetLocaleString(localeData->Objectives, locale, questObjectives);
+ sObjectMgr->GetLocaleString(localeData->EndText, locale, questEndText);
+ sObjectMgr->GetLocaleString(localeData->CompletedText, locale, questCompletedText);
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- sObjectMgr->GetLocaleString(ql->ObjectiveText[i], loc_idx, ObjectiveText[i]);
+ sObjectMgr->GetLocaleString(localeData->ObjectiveText[i], locale, questObjectiveText[i]);
}
}
- WorldPacket data(SMSG_QUEST_QUERY_RESPONSE, 100); // guess size
+ WorldPacket data(SMSG_QUEST_QUERY_RESPONSE, 100); // guess size
- data << uint32(pQuest->GetQuestId()); // quest id
- data << uint32(pQuest->GetQuestMethod()); // Accepted values: 0, 1 or 2. 0 == IsAutoComplete() (skip objectives/details)
- data << uint32(pQuest->GetQuestLevel()); // may be -1, static data, in other cases must be used dynamic level: Player::GetQuestLevel (0 is not known, but assuming this is no longer valid for quest intended for client)
- data << uint32(pQuest->GetMinLevel()); // min level
- data << uint32(pQuest->GetZoneOrSort()); // zone or sort to display in quest log
+ data << uint32(quest->GetQuestId()); // quest id
+ data << uint32(quest->GetQuestMethod()); // Accepted values: 0, 1 or 2. 0 == IsAutoComplete() (skip objectives/details)
+ data << uint32(quest->GetQuestLevel()); // may be -1, static data, in other cases must be used dynamic level: Player::GetQuestLevel (0 is not known, but assuming this is no longer valid for quest intended for client)
+ data << uint32(quest->GetMinLevel()); // min level
+ data << uint32(quest->GetZoneOrSort()); // zone or sort to display in quest log
- data << uint32(pQuest->GetType()); // quest type
- data << uint32(pQuest->GetSuggestedPlayers()); // suggested players count
+ data << uint32(quest->GetType()); // quest type
+ data << uint32(quest->GetSuggestedPlayers()); // suggested players count
- data << uint32(pQuest->GetRepObjectiveFaction()); // shown in quest log as part of quest objective
- data << uint32(pQuest->GetRepObjectiveValue()); // shown in quest log as part of quest objective
+ data << uint32(quest->GetRepObjectiveFaction()); // shown in quest log as part of quest objective
+ data << uint32(quest->GetRepObjectiveValue()); // shown in quest log as part of quest objective
- data << uint32(pQuest->GetRepObjectiveFaction2()); // shown in quest log as part of quest objective OPOSITE faction
- data << uint32(pQuest->GetRepObjectiveValue2()); // shown in quest log as part of quest objective OPPOSITE faction
+ data << uint32(quest->GetRepObjectiveFaction2()); // shown in quest log as part of quest objective OPOSITE faction
+ data << uint32(quest->GetRepObjectiveValue2()); // shown in quest log as part of quest objective OPPOSITE faction
- data << uint32(pQuest->GetNextQuestInChain()); // client will request this quest from NPC, if not 0
- data << uint32(pQuest->GetXPId()); // used for calculating rewarded experience
+ data << uint32(quest->GetNextQuestInChain()); // client will request this quest from NPC, if not 0
+ data << uint32(quest->GetXPId()); // used for calculating rewarded experience
- if (pQuest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
+ if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
data << uint32(0); // Hide money rewarded
else
- data << uint32(pQuest->GetRewOrReqMoney()); // reward money (below max lvl)
+ data << uint32(quest->GetRewOrReqMoney()); // reward money (below max lvl)
- data << uint32(pQuest->GetRewMoneyMaxLevel()); // used in XP calculation at client
- data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
- data << int32(pQuest->GetRewSpellCast()); // casted spell
+ data << uint32(quest->GetRewMoneyMaxLevel()); // used in XP calculation at client
+ data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
+ data << int32(quest->GetRewSpellCast()); // casted spell
// rewarded honor points
- data << Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorMultiplier());
+ data << Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
data << float(0); // new reward honor (multipled by ~62 at client side)
- data << uint32(pQuest->GetSrcItemId()); // source item id
- data << uint32(pQuest->GetFlags() & 0xFFFF); // quest flags
- data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
- data << uint32(pQuest->GetPlayersSlain()); // players slain
- data << uint32(pQuest->GetBonusTalents()); // bonus talents
- data << uint32(pQuest->GetRewArenaPoints()); // bonus arena points
+ data << uint32(quest->GetSrcItemId()); // source item id
+ data << uint32(quest->GetFlags() & 0xFFFF); // quest flags
+ data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
+ data << uint32(quest->GetPlayersSlain()); // players slain
+ data << uint32(quest->GetBonusTalents()); // bonus talents
+ data << uint32(quest->GetRewArenaPoints()); // bonus arena points
data << uint32(0); // review rep show mask
- int iI;
-
- if (pQuest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
+ if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
{
- for (iI = 0; iI < QUEST_REWARDS_COUNT; ++iI)
+ for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
data << uint32(0) << uint32(0);
- for (iI = 0; iI < QUEST_REWARD_CHOICES_COUNT; ++iI)
+ for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
data << uint32(0) << uint32(0);
}
else
{
- for (iI = 0; iI < QUEST_REWARDS_COUNT; ++iI)
+ for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
- data << uint32(pQuest->RewItemId[iI]);
- data << uint32(pQuest->RewItemCount[iI]);
+ data << uint32(quest->RewItemId[i]);
+ data << uint32(quest->RewItemCount[i]);
}
- for (iI = 0; iI < QUEST_REWARD_CHOICES_COUNT; ++iI)
+ for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
- data << uint32(pQuest->RewChoiceItemId[iI]);
- data << uint32(pQuest->RewChoiceItemCount[iI]);
+ data << uint32(quest->RewChoiceItemId[i]);
+ data << uint32(quest->RewChoiceItemCount[i]);
}
}
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
- data << uint32(pQuest->RewRepFaction[i]);
+ for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
+ data << uint32(quest->RewRepFaction[i]);
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc?
- data << int32(pQuest->RewRepValueId[i]);
+ for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc?
+ data << int32(quest->RewRepValueId[i]);
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0)
- data << int32(pQuest->RewRepValue[i]);
+ for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0)
+ data << int32(quest->RewRepValue[i]);
- data << pQuest->GetPointMapId();
- data << pQuest->GetPointX();
- data << pQuest->GetPointY();
- data << pQuest->GetPointOpt();
+ data << quest->GetPointMapId();
+ data << quest->GetPointX();
+ data << quest->GetPointY();
+ data << quest->GetPointOpt();
- data << Title;
- data << Objectives;
- data << Details;
- data << EndText;
- data << CompletedText; // display in quest objectives window once all objectives are completed
+ data << questTitle;
+ data << questObjectives;
+ data << questDetails;
+ data << questEndText;
+ data << questCompletedText; // display in quest objectives window once all objectives are completed
- for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI)
+ for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
- if (pQuest->ReqCreatureOrGOId[iI] < 0)
- {
- // client expected gameobject template id in form (id|0x80000000)
- data << uint32((pQuest->ReqCreatureOrGOId[iI]*(-1))|0x80000000);
- }
+ if (quest->ReqCreatureOrGOId[i] < 0)
+ data << uint32((quest->ReqCreatureOrGOId[i] * (-1)) | 0x80000000); // client expects gameobject template id in form (id|0x80000000)
else
- {
- data << uint32(pQuest->ReqCreatureOrGOId[iI]);
- }
- data << uint32(pQuest->ReqCreatureOrGOCount[iI]);
- data << uint32(pQuest->ReqSourceId[iI]);
+ data << uint32(quest->ReqCreatureOrGOId[i]);
+
+ data << uint32(quest->ReqCreatureOrGOCount[i]);
+ data << uint32(quest->ReqSourceId[i]);
data << uint32(0); // req source count?
}
- for (iI = 0; iI < QUEST_ITEM_OBJECTIVES_COUNT; ++iI)
+ for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
- data << uint32(pQuest->ReqItemId[iI]);
- data << uint32(pQuest->ReqItemCount[iI]);
+ data << uint32(quest->ReqItemId[i]);
+ data << uint32(quest->ReqItemCount[i]);
}
- for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI)
- data << ObjectiveText[iI];
+ for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ data << questObjectiveText[i];
- pSession->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", pQuest->GetQuestId());
+ _session->SendPacket(&data);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", quest->GetQuestId());
}
-void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, uint64 npcGUID, bool EnableNext)
+void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const
{
- std::string Title = pQuest->GetTitle();
- std::string OfferRewardText = pQuest->GetOfferRewardText();
+ std::string questTitle = quest->GetTitle();
+ std::string questOfferRewardText = quest->GetOfferRewardText();
- int loc_idx = pSession->GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
+ int locale = _session->GetSessionDbLocaleIndex();
+ if (locale >= 0)
{
- if (QuestLocale const *ql = sObjectMgr->GetQuestLocale(pQuest->GetQuestId()))
+ if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
- sObjectMgr->GetLocaleString(ql->Title, loc_idx, Title);
- sObjectMgr->GetLocaleString(ql->OfferRewardText, loc_idx, OfferRewardText);
+ sObjectMgr->GetLocaleString(localeData->Title, locale, questTitle);
+ sObjectMgr->GetLocaleString(localeData->OfferRewardText, locale, questOfferRewardText);
}
}
- WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 50); // guess size
-
+ WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 50); // guess size
data << uint64(npcGUID);
- data << uint32(pQuest->GetQuestId());
- data << Title;
- data << OfferRewardText;
+ data << uint32(quest->GetQuestId());
+ data << questTitle;
+ data << questOfferRewardText;
- data << uint8(EnableNext ? 1 : 0); // Auto Finish
- data << uint32(pQuest->GetFlags()); // 3.3.3 questFlags
- data << uint32(pQuest->GetSuggestedPlayers()); // SuggestedGroupNum
+ data << uint8(enableNext ? 1 : 0); // Auto Finish
+ data << uint32(quest->GetFlags()); // 3.3.3 questFlags
+ data << uint32(quest->GetSuggestedPlayers()); // SuggestedGroupNum
- uint32 EmoteCount = 0;
+ uint32 emoteCount = 0;
for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
- if (pQuest->OfferRewardEmote[i] <= 0)
+ if (quest->OfferRewardEmote[i] <= 0)
break;
- ++EmoteCount;
+ ++emoteCount;
}
- data << EmoteCount; // Emote Count
- for (uint32 i = 0; i < EmoteCount; ++i)
+ data << emoteCount; // Emote Count
+ for (uint32 i = 0; i < emoteCount; ++i)
{
- data << uint32(pQuest->OfferRewardEmoteDelay[i]); // Delay Emote
- data << uint32(pQuest->OfferRewardEmote[i]);
+ data << uint32(quest->OfferRewardEmoteDelay[i]); // Delay Emote
+ data << uint32(quest->OfferRewardEmote[i]);
}
- ItemTemplate const *pItem;
-
- data << uint32(pQuest->GetRewChoiceItemsCount());
- for (uint32 i=0; i < pQuest->GetRewChoiceItemsCount(); ++i)
+ data << uint32(quest->GetRewChoiceItemsCount());
+ for (uint32 i=0; i < quest->GetRewChoiceItemsCount(); ++i)
{
- pItem = sObjectMgr->GetItemTemplate(pQuest->RewChoiceItemId[i]);
+ data << uint32(quest->RewChoiceItemId[i]);
+ data << uint32(quest->RewChoiceItemCount[i]);
- data << uint32(pQuest->RewChoiceItemId[i]);
- data << uint32(pQuest->RewChoiceItemCount[i]);
-
- if (pItem)
- data << uint32(pItem->DisplayInfoID);
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewChoiceItemId[i]))
+ data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
}
- data << uint32(pQuest->GetRewItemsCount());
- for (uint32 i = 0; i < pQuest->GetRewItemsCount(); ++i)
+ data << uint32(quest->GetRewItemsCount());
+ for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
{
- pItem = sObjectMgr->GetItemTemplate(pQuest->RewItemId[i]);
- data << uint32(pQuest->RewItemId[i]);
- data << uint32(pQuest->RewItemCount[i]);
+ data << uint32(quest->RewItemId[i]);
+ data << uint32(quest->RewItemCount[i]);
- if (pItem)
- data << uint32(pItem->DisplayInfoID);
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewItemId[i]))
+ data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
}
- data << uint32(pQuest->GetRewOrReqMoney());
- data << uint32(pQuest->XPValue(pSession->GetPlayer())*sWorld->getRate(RATE_XP_QUEST));
+ data << uint32(quest->GetRewOrReqMoney());
+ data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
// rewarded honor points. Multiply with 10 to satisfy client
- data << 10 * Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorMultiplier());
+ data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
data << float(0); // unk, honor multiplier?
data << uint32(0x08); // unused by client?
- data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
- data << int32(pQuest->GetRewSpellCast()); // casted spell
+ data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
+ data << int32(quest->GetRewSpellCast()); // casted spell
data << uint32(0); // unknown
- data << uint32(pQuest->GetBonusTalents()); // bonus talents
- data << uint32(pQuest->GetRewArenaPoints()); // arena points
+ data << uint32(quest->GetBonusTalents()); // bonus talents
+ data << uint32(quest->GetRewArenaPoints()); // arena points
data << uint32(0);
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
- data << uint32(pQuest->RewRepFaction[i]);
+ for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
+ data << uint32(quest->RewRepFaction[i]);
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (zero based)?
- data << int32(pQuest->RewRepValueId[i]);
+ for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (zero based)?
+ data << int32(quest->RewRepValueId[i]);
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override?
- data << uint32(pQuest->RewRepValue[i]);
+ for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override?
+ data << uint32(quest->RewRepValue[i]);
- pSession->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId());
+ _session->SendPacket(&data);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
}
-void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel)
+void PlayerMenu::SendQuestGiverRequestItems(Quest const *quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const
{
// We can always call to RequestItems, but this packet only goes out if there are actually
// items. Otherwise, we'll skip straight to the OfferReward
- std::string Title = pQuest->GetTitle();
- std::string RequestItemsText = pQuest->GetRequestItemsText();
+ std::string questTitle = quest->GetTitle();
+ std::string requestItemsText = quest->GetRequestItemsText();
- int loc_idx = pSession->GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
+ int32 locale = _session->GetSessionDbLocaleIndex();
+ if (locale >= 0)
{
- if (QuestLocale const *ql = sObjectMgr->GetQuestLocale(pQuest->GetQuestId()))
+ if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
- sObjectMgr->GetLocaleString(ql->Title, loc_idx, Title);
- sObjectMgr->GetLocaleString(ql->RequestItemsText, loc_idx, RequestItemsText);
+ sObjectMgr->GetLocaleString(localeData->Title, locale, questTitle);
+ sObjectMgr->GetLocaleString(localeData->RequestItemsText, locale, requestItemsText);
}
}
- if (!pQuest->GetReqItemsCount() && Completable)
+ if (!quest->GetReqItemsCount() && canComplete)
{
- SendQuestGiverOfferReward(pQuest, npcGUID, true);
+ SendQuestGiverOfferReward(quest, npcGUID, true);
return;
}
- WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 50); // guess size
+ WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 50); // guess size
data << uint64(npcGUID);
- data << uint32(pQuest->GetQuestId());
- data << Title;
- data << RequestItemsText;
+ data << uint32(quest->GetQuestId());
+ data << questTitle;
+ data << requestItemsText;
data << uint32(0x00); // unknown
- if (Completable)
- data << pQuest->GetCompleteEmote();
+ if (canComplete)
+ data << quest->GetCompleteEmote();
else
- data << pQuest->GetIncompleteEmote();
+ data << quest->GetIncompleteEmote();
// Close Window after cancel
- if (CloseOnCancel)
+ if (closeOnCancel)
data << uint32(0x01);
else
data << uint32(0x00);
- data << uint32(pQuest->GetFlags()); // 3.3.3 questFlags
- data << uint32(pQuest->GetSuggestedPlayers()); // SuggestedGroupNum
+ data << uint32(quest->GetFlags()); // 3.3.3 questFlags
+ data << uint32(quest->GetSuggestedPlayers()); // SuggestedGroupNum
// Required Money
- data << uint32(pQuest->GetRewOrReqMoney() < 0 ? -pQuest->GetRewOrReqMoney() : 0);
+ data << uint32(quest->GetRewOrReqMoney() < 0 ? -quest->GetRewOrReqMoney() : 0);
- data << uint32(pQuest->GetReqItemsCount());
- ItemTemplate const *pItem;
+ data << uint32(quest->GetReqItemsCount());
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
- if (!pQuest->ReqItemId[i])
+ if (!quest->ReqItemId[i])
continue;
- pItem = sObjectMgr->GetItemTemplate(pQuest->ReqItemId[i]);
-
- data << uint32(pQuest->ReqItemId[i]);
- data << uint32(pQuest->ReqItemCount[i]);
+ data << uint32(quest->ReqItemId[i]);
+ data << uint32(quest->ReqItemCount[i]);
- if (pItem)
- data << uint32(pItem->DisplayInfoID);
+ if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ReqItemId[i]))
+ data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
}
- if (!Completable)
+ if (!canComplete)
data << uint32(0x00);
else
data << uint32(0x03);
@@ -749,6 +698,6 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, uint64 npcGUID,
data << uint32(0x08);
data << uint32(0x10);
- pSession->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId());
+ _session->SendPacket(&data);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
}
diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h
index 30201e10cfa..8b8c7940e7f 100755
--- a/src/server/game/Entities/Creature/GossipDef.h
+++ b/src/server/game/Entities/Creature/GossipDef.h
@@ -127,30 +127,32 @@ enum Poi_Icon
struct GossipMenuItem
{
- uint8 m_gIcon;
- bool m_gCoded;
- std::string m_gMessage;
- uint32 m_gSender;
- uint32 m_gOptionId;
- std::string m_gBoxMessage;
- uint32 m_gBoxMoney;
+ uint8 MenuItemIcon;
+ bool IsCoded;
+ std::string Message;
+ uint32 Sender;
+ uint32 OptionType;
+ std::string BoxMessage;
+ uint32 BoxMoney;
};
-typedef std::vector<GossipMenuItem> GossipMenuItemList;
+// need an ordered container
+typedef std::map<uint32, GossipMenuItem> GossipMenuItemContainer;
struct GossipMenuItemData
{
- uint32 m_gAction_menu;
- uint32 m_gAction_poi;
- uint32 m_gAction_script;
+ uint32 GossipActionMenuId; // MenuId of the gossip triggered by this action
+ uint32 GossipActionPoi;
+ uint32 GossipActionScript;
};
-typedef std::vector<GossipMenuItemData> GossipMenuItemDataList;
+// need an ordered container
+typedef std::map<uint32, GossipMenuItemData> GossipMenuItemDataContainer;
struct QuestMenuItem
{
- uint32 m_qId;
- uint8 m_qIcon;
+ uint32 QuestId;
+ uint8 QuestIcon;
};
typedef std::vector<QuestMenuItem> QuestMenuItemList;
@@ -161,49 +163,56 @@ class GossipMenu
GossipMenu();
~GossipMenu();
- void AddMenuItem(uint8 Icon, const std::string& Message, bool Coded = false);
- void AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSender, uint32 dtAction, const std::string& BoxMessage, uint32 BoxMoney, bool Coded = false);
+ void AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded = false);
- // for using from scripts, don't must be inlined
- void AddMenuItem(uint8 Icon, char const* Message, bool Coded = false);
- void AddMenuItem(uint8 Icon, char const* Message, uint32 dtSender, uint32 dtAction, char const* BoxMessage, uint32 BoxMoney, bool Coded = false);
+ void SetMenuId(uint32 menu_id) { _menuId = menu_id; }
+ uint32 GetMenuId() const { return _menuId; }
- void SetMenuId(uint32 menu_id) { m_gMenuId = menu_id; }
- uint32 GetMenuId() const { return m_gMenuId; }
+ void AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi, uint32 gossipActionScript);
- void AddGossipMenuItemData(uint32 action_menu, uint32 action_poi, uint32 action_script);
-
- unsigned int MenuItemCount() const
+ uint32 GetMenuItemCount() const
{
- return m_gItems.size();
+ return _menuItems.size();
}
bool Empty() const
{
- return m_gItems.empty();
+ return _menuItems.empty();
}
- GossipMenuItem const& GetItem(unsigned int Id) const
+ GossipMenuItem const* GetItem(unsigned int id) const
{
- return m_gItems[ Id ];
+ GossipMenuItemContainer::const_iterator itr = _menuItems.find(id);
+ if (itr != _menuItems.end())
+ return &itr->second;
+
+ return NULL;
}
- GossipMenuItemData const& GetItemData(unsigned int indexId) const
+ GossipMenuItemData const* GetItemData(unsigned int indexId) const
{
- return m_gItemsData[indexId];
+ GossipMenuItemDataContainer::const_iterator itr = _menuItemData.find(indexId);
+ if (itr != _menuItemData.end())
+ return &itr->second;
+
+ return NULL;
}
- uint32 MenuItemSender(unsigned int ItemId);
- uint32 MenuItemAction(unsigned int ItemId);
- bool MenuItemCoded(unsigned int ItemId);
+ uint32 GetMenuItemSender(uint32 menuItemId) const;
+ uint32 GetMenuItemAction(uint32 menuItemId) const;
+ bool IsMenuItemCoded(uint32 menuItemId) const;
void ClearMenu();
- protected:
- GossipMenuItemList m_gItems;
- GossipMenuItemDataList m_gItemsData;
+ GossipMenuItemContainer const& GetMenuItems() const
+ {
+ return _menuItems;
+ }
- uint32 m_gMenuId;
+ private:
+ GossipMenuItemContainer _menuItems;
+ GossipMenuItemDataContainer _menuItemData;
+ uint32 _menuId;
};
class QuestMenu
@@ -215,64 +224,63 @@ class QuestMenu
void AddMenuItem(uint32 QuestId, uint8 Icon);
void ClearMenu();
- uint8 MenuItemCount() const
+ uint8 GetMenuItemCount() const
{
- return m_qItems.size();
+ return _questMenuItems.size();
}
bool Empty() const
{
- return m_qItems.empty();
+ return _questMenuItems.empty();
}
- bool HasItem(uint32 questid);
+ bool HasItem(uint32 questId) const;
- QuestMenuItem const& GetItem(uint16 Id) const
+ QuestMenuItem const& GetItem(uint16 index) const
{
- return m_qItems[ Id ];
+ return _questMenuItems[index];
}
- protected:
- QuestMenuItemList m_qItems;
+ private:
+ QuestMenuItemList _questMenuItems;
};
class PlayerMenu
{
- private:
- GossipMenu mGossipMenu;
- QuestMenu mQuestMenu;
- WorldSession* pSession;
-
public:
- PlayerMenu(WorldSession *Session);
+ explicit PlayerMenu(WorldSession* session);
~PlayerMenu();
- GossipMenu& GetGossipMenu() { return mGossipMenu; }
- QuestMenu& GetQuestMenu() { return mQuestMenu; }
+ GossipMenu& GetGossipMenu() { return _gossipMenu; }
+ QuestMenu& GetQuestMenu() { return _questMenu; }
- bool Empty() const { return mGossipMenu.Empty() && mQuestMenu.Empty(); }
+ bool Empty() const { return _gossipMenu.Empty() && _questMenu.Empty(); }
void ClearMenus();
- uint32 GossipOptionSender(unsigned int Selection);
- uint32 GossipOptionAction(unsigned int Selection);
- bool GossipOptionCoded(unsigned int Selection);
+ uint32 GetGossipOptionSender(uint32 selection) const { return _gossipMenu.GetMenuItemSender(selection); }
+ uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
+ bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
- void SendGossipMenu(uint32 TitleTextId, uint64 npcGUID);
- void CloseGossip();
- void SendPointOfInterest(float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, const char * locName);
- void SendPointOfInterest(uint32 poi_id);
+ void SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const;
+ void SendCloseGossip() const;
+ void SendPointOfInterest(uint32 poiId) const;
/*********************************************************/
/*** QUEST SYSTEM ***/
/*********************************************************/
- void SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID);
+ void SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const;
void SendQuestGiverQuestList(QEmote eEmote, const std::string& Title, uint64 npcGUID);
- void SendQuestQueryResponse (Quest const *pQuest);
- void SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID, bool ActivateAccept);
+ void SendQuestQueryResponse(Quest const* quest) const;
+ void SendQuestGiverQuestDetails(Quest const *quest, uint64 npcGUID, bool activateAccept) const;
- void SendQuestGiverOfferReward(Quest const* pQuest, uint64 npcGUID, bool EnableNext);
- void SendQuestGiverRequestItems(Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel);
+ void SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const;
+ void SendQuestGiverRequestItems(Quest const *quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const;
+
+ private:
+ GossipMenu _gossipMenu;
+ QuestMenu _questMenu;
+ WorldSession* _session;
};
#endif
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 914db049216..9f7e5e1968e 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -13932,90 +13932,90 @@ void Player::SendNewItem(Item *item, uint32 count, bool received, bool created,
/*** GOSSIP SYSTEM ***/
/*********************************************************/
-void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId, bool showQuests)
+void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool showQuests /*= false*/)
{
- PlayerMenu* pMenu = PlayerTalkClass;
- pMenu->ClearMenus();
+ PlayerMenu* menu = PlayerTalkClass;
+ menu->ClearMenus();
- pMenu->GetGossipMenu().SetMenuId(menuId);
+ menu->GetGossipMenu().SetMenuId(menuId);
- GossipMenuItemsMapBounds pMenuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId);
+ GossipMenuItemsMapBounds menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId);
// if default menuId and no menu options exist for this, use options from default options
- if (pMenuItemBounds.first == pMenuItemBounds.second && menuId == GetDefaultGossipMenuForSource(pSource))
- pMenuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(0);
+ if (menuItemBounds.first == menuItemBounds.second && menuId == GetDefaultGossipMenuForSource(source))
+ menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(0);
uint32 npcflags = 0;
- Creature *pCreature = NULL;
+ Creature* creature = NULL;
- if (pSource->GetTypeId() == TYPEID_UNIT)
+ if (source->GetTypeId() == TYPEID_UNIT)
{
- pCreature = pSource->ToCreature();
- npcflags = pCreature->GetUInt32Value(UNIT_NPC_FLAGS);
+ creature = source->ToCreature();
+ npcflags = creature->GetUInt32Value(UNIT_NPC_FLAGS);
if (npcflags & UNIT_NPC_FLAG_QUESTGIVER && showQuests)
- PrepareQuestMenu(pSource->GetGUID());
+ PrepareQuestMenu(source->GetGUID());
}
- for (GossipMenuItemsMap::const_iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr)
+ for (GossipMenuItemsMap::const_iterator itr = menuItemBounds.first; itr != menuItemBounds.second; ++itr)
{
- bool bCanTalk = true;
- if (!sConditionMgr->IsPlayerMeetToConditions(this, itr->second.conditions))
+ bool canTalk = true;
+ if (!sConditionMgr->IsPlayerMeetToConditions(this, itr->second.Conditions))
continue;
- if (pSource->GetTypeId() == TYPEID_UNIT)
+ if (source->GetTypeId() == TYPEID_UNIT)
{
- if (!(itr->second.npc_option_npcflag & npcflags))
+ if (!(itr->second.OptionNpcflag & npcflags))
continue;
- switch(itr->second.option_id)
+ switch (itr->second.OptionType)
{
case GOSSIP_OPTION_ARMORER:
- bCanTalk = false; // added in special mode
+ canTalk = false; // added in special mode
break;
case GOSSIP_OPTION_SPIRITHEALER:
if (!isDead())
- bCanTalk = false;
+ canTalk = false;
break;
case GOSSIP_OPTION_VENDOR:
{
- VendorItemData const* vItems = pCreature->GetVendorItems();
- if (!vItems || vItems->Empty())
+ VendorItemData const* vendorItems = creature->GetVendorItems();
+ if (!vendorItems || vendorItems->Empty())
{
- sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", pCreature->GetGUIDLow(), pCreature->GetEntry());
- bCanTalk = false;
+ sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry());
+ canTalk = false;
}
break;
}
case GOSSIP_OPTION_TRAINER:
- if (!pCreature->isCanTrainingOf(this, false))
- bCanTalk = false;
+ if (!creature->isCanTrainingOf(this, false))
+ canTalk = false;
break;
case GOSSIP_OPTION_LEARNDUALSPEC:
- if (!(GetSpecsCount() == 1 && pCreature->isCanTrainingAndResetTalentsOf(this) && !(getLevel() < sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))))
- bCanTalk = false;
+ if (!(GetSpecsCount() == 1 && creature->isCanTrainingAndResetTalentsOf(this) && !(getLevel() < sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))))
+ canTalk = false;
break;
case GOSSIP_OPTION_UNLEARNTALENTS:
- if (!pCreature->isCanTrainingAndResetTalentsOf(this))
- bCanTalk = false;
+ if (!creature->isCanTrainingAndResetTalentsOf(this))
+ canTalk = false;
break;
case GOSSIP_OPTION_UNLEARNPETTALENTS:
- if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || pCreature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || pCreature->GetCreatureInfo()->trainer_class != CLASS_HUNTER)
- bCanTalk = false;
+ if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || creature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || creature->GetCreatureInfo()->trainer_class != CLASS_HUNTER)
+ canTalk = false;
break;
case GOSSIP_OPTION_TAXIVENDOR:
- if (GetSession()->SendLearnNewTaxiNode(pCreature))
+ if (GetSession()->SendLearnNewTaxiNode(creature))
return;
break;
case GOSSIP_OPTION_BATTLEFIELD:
- if (!pCreature->isCanInteractWithBattleMaster(this, false))
- bCanTalk = false;
+ if (!creature->isCanInteractWithBattleMaster(this, false))
+ canTalk = false;
break;
case GOSSIP_OPTION_STABLEPET:
if (getClass() != CLASS_HUNTER)
- bCanTalk = false;
+ canTalk = false;
break;
case GOSSIP_OPTION_QUESTGIVER:
- bCanTalk = false;
+ canTalk = false;
break;
case GOSSIP_OPTION_GOSSIP:
case GOSSIP_OPTION_SPIRITGUIDE:
@@ -14026,78 +14026,78 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId, bool showQue
case GOSSIP_OPTION_AUCTIONEER:
break; // no checks
case GOSSIP_OPTION_OUTDOORPVP:
- if (!sOutdoorPvPMgr->CanTalkTo(this, pCreature, itr->second))
- bCanTalk = false;
+ if (!sOutdoorPvPMgr->CanTalkTo(this, creature, itr->second))
+ canTalk = false;
break;
default:
- sLog->outErrorDb("Creature entry %u have unknown gossip option %u for menu %u", pCreature->GetEntry(), itr->second.option_id, itr->second.menu_id);
- bCanTalk = false;
+ sLog->outErrorDb("Creature entry %u have unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId);
+ canTalk = false;
break;
}
}
- else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
+ else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
{
- GameObject *pGo = (GameObject*)pSource;
+ GameObject *go = source->ToGameObject();
- switch(itr->second.option_id)
+ switch (itr->second.OptionType)
{
case GOSSIP_OPTION_QUESTGIVER:
- if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER)
- PrepareQuestMenu(pSource->GetGUID());
- bCanTalk = false;
+ if (go->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER)
+ PrepareQuestMenu(source->GetGUID());
+ canTalk = false;
break;
case GOSSIP_OPTION_GOSSIP:
- if (pGo->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER && pGo->GetGoType() != GAMEOBJECT_TYPE_GOOBER)
- bCanTalk = false;
+ if (go->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER && go->GetGoType() != GAMEOBJECT_TYPE_GOOBER)
+ canTalk = false;
break;
default:
- bCanTalk = false;
+ canTalk = false;
break;
}
}
- if (bCanTalk)
+ if (canTalk)
{
- std::string strOptionText = itr->second.option_text;
- std::string strBoxText = itr->second.box_text;
+ std::string strOptionText = itr->second.OptionText;
+ std::string strBoxText = itr->second.BoxText;
- int loc_idx = GetSession()->GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
+ int32 locale = GetSession()->GetSessionDbLocaleIndex();
+ if (locale >= 0)
{
- uint32 idxEntry = MAKE_PAIR32(menuId, itr->second.id);
+ uint32 idxEntry = MAKE_PAIR32(menuId, itr->second.OptionIndex);
if (GossipMenuItemsLocale const *no = sObjectMgr->GetGossipMenuItemsLocale(idxEntry))
{
- sObjectMgr->GetLocaleString(no->OptionText, loc_idx, strOptionText);
- sObjectMgr->GetLocaleString(no->BoxText, loc_idx, strBoxText);
+ sObjectMgr->GetLocaleString(no->OptionText, locale, strOptionText);
+ sObjectMgr->GetLocaleString(no->BoxText, locale, strBoxText);
}
}
- pMenu->GetGossipMenu().AddMenuItem(itr->second.option_icon, strOptionText, 0, itr->second.option_id, strBoxText, itr->second.box_money, itr->second.box_coded);
- pMenu->GetGossipMenu().AddGossipMenuItemData(itr->second.action_menu_id, itr->second.action_poi_id, itr->second.action_script_id);
+ menu->GetGossipMenu().AddMenuItem(itr->second.OptionIndex, itr->second.OptionIcon, strOptionText, 0, itr->second.OptionType, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded);
+ menu->GetGossipMenu().AddGossipMenuItemData(itr->second.OptionIndex, itr->second.ActionMenuId, itr->second.ActionPoiId, itr->second.ActionScriptId);
}
}
}
-void Player::SendPreparedGossip(WorldObject *pSource)
+void Player::SendPreparedGossip(WorldObject* source)
{
- if (!pSource)
+ if (!source)
return;
- if (pSource->GetTypeId() == TYPEID_UNIT)
+ if (source->GetTypeId() == TYPEID_UNIT)
{
// in case no gossip flag and quest menu not empty, open quest menu (client expect gossip menu with this flag)
- if (!pSource->ToCreature()->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) && !PlayerTalkClass->GetQuestMenu().Empty())
+ if (!source->ToCreature()->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) && !PlayerTalkClass->GetQuestMenu().Empty())
{
- SendPreparedQuest(pSource->GetGUID());
+ SendPreparedQuest(source->GetGUID());
return;
}
}
- else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
+ else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
{
// probably need to find a better way here
if (!PlayerTalkClass->GetGossipMenu().GetMenuId() && !PlayerTalkClass->GetQuestMenu().Empty())
{
- SendPreparedQuest(pSource->GetGUID());
+ SendPreparedQuest(source->GetGUID());
return;
}
}
@@ -14105,67 +14105,73 @@ void Player::SendPreparedGossip(WorldObject *pSource)
// in case non empty gossip menu (that not included quests list size) show it
// (quest entries from quest menu will be included in list)
- uint32 textId = GetGossipTextId(pSource);
+ uint32 textId = GetGossipTextId(source);
if (uint32 menuId = PlayerTalkClass->GetGossipMenu().GetMenuId())
textId = GetGossipTextId(menuId);
- PlayerTalkClass->SendGossipMenu(textId, pSource->GetGUID());
+ PlayerTalkClass->SendGossipMenu(textId, source->GetGUID());
}
-void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 menuId)
+void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 menuId)
{
GossipMenu& gossipmenu = PlayerTalkClass->GetGossipMenu();
- if (gossipListId >= gossipmenu.MenuItemCount())
+ if (gossipListId >= gossipmenu.GetMenuItemCount())
return;
// if not same, then something funky is going on
if (menuId != gossipmenu.GetMenuId())
return;
- uint32 gossipOptionId = gossipmenu.GetItem(gossipListId).m_gOptionId;
- uint64 guid = pSource->GetGUID();
+ GossipMenuItem const* item = gossipmenu.GetItem(gossipListId);
+ if (!item)
+ return;
+
+ uint32 gossipOptionId = item->OptionType;
+ uint64 guid = source->GetGUID();
- if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
+ if (source->GetTypeId() == TYPEID_GAMEOBJECT)
{
if (gossipOptionId > GOSSIP_OPTION_QUESTGIVER)
{
- sLog->outError("Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), pSource->GetEntry());
+ sLog->outError("Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry());
return;
}
}
- GossipMenuItemData pMenuData = gossipmenu.GetItemData(gossipListId);
+ GossipMenuItemData const* menuItemData = gossipmenu.GetItemData(gossipListId);
+ if (menuItemData)
+ return;
- switch(gossipOptionId)
+ switch (gossipOptionId)
{
case GOSSIP_OPTION_GOSSIP:
{
- if (pMenuData.m_gAction_menu)
+ if (menuItemData->GossipActionMenuId)
{
- PrepareGossipMenu(pSource, pMenuData.m_gAction_menu);
- SendPreparedGossip(pSource);
+ PrepareGossipMenu(source, menuItemData->GossipActionMenuId);
+ SendPreparedGossip(source);
}
- if (pMenuData.m_gAction_poi)
- PlayerTalkClass->SendPointOfInterest(pMenuData.m_gAction_poi);
+ if (menuItemData->GossipActionPoi)
+ PlayerTalkClass->SendPointOfInterest(menuItemData->GossipActionPoi);
- if (pMenuData.m_gAction_script)
+ if (menuItemData->GossipActionScript)
{
- if (pSource->GetTypeId() == TYPEID_UNIT)
- GetMap()->ScriptsStart(sGossipScripts, pMenuData.m_gAction_script, this, pSource);
- else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
- GetMap()->ScriptsStart(sGossipScripts, pMenuData.m_gAction_script, pSource, this);
+ if (source->GetTypeId() == TYPEID_UNIT)
+ GetMap()->ScriptsStart(sGossipScripts, menuItemData->GossipActionScript, this, source);
+ else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
+ GetMap()->ScriptsStart(sGossipScripts, menuItemData->GossipActionScript, source, this);
}
break;
}
case GOSSIP_OPTION_OUTDOORPVP:
- sOutdoorPvPMgr->HandleGossipOption(this, pSource->GetGUID(), gossipListId);
+ sOutdoorPvPMgr->HandleGossipOption(this, source->GetGUID(), gossipListId);
break;
case GOSSIP_OPTION_SPIRITHEALER:
if (isDead())
- pSource->ToCreature()->CastSpell((pSource->ToCreature()), 17251, true, NULL, NULL, GetGUID());
+ source->ToCreature()->CastSpell((source->ToCreature()), 17251, true, NULL, NULL, GetGUID());
break;
case GOSSIP_OPTION_QUESTGIVER:
PrepareQuestMenu(guid);
@@ -14187,7 +14193,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
if (!HasEnoughMoney(10000000))
{
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
- PlayerTalkClass->CloseGossip();
+ PlayerTalkClass->SendCloseGossip();
break;
}
else
@@ -14200,46 +14206,46 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
CastSpell(this, 63624, true, NULL, NULL, GetGUID());
// Should show another Gossip text with "Congratulations..."
- PlayerTalkClass->CloseGossip();
+ PlayerTalkClass->SendCloseGossip();
}
}
break;
case GOSSIP_OPTION_UNLEARNTALENTS:
- PlayerTalkClass->CloseGossip();
- pSource->ToCreature()->CastSpell(this, 46331, true); // Trainer: Untrain Talents
+ PlayerTalkClass->SendCloseGossip();
+ source->ToCreature()->CastSpell(this, 46331, true); // Trainer: Untrain Talents
break;
case GOSSIP_OPTION_UNLEARNPETTALENTS:
- PlayerTalkClass->CloseGossip();
+ PlayerTalkClass->SendCloseGossip();
ResetPetTalents();
break;
case GOSSIP_OPTION_TAXIVENDOR:
- GetSession()->SendTaxiMenu((pSource->ToCreature()));
+ GetSession()->SendTaxiMenu((source->ToCreature()));
break;
case GOSSIP_OPTION_INNKEEPER:
- PlayerTalkClass->CloseGossip();
+ PlayerTalkClass->SendCloseGossip();
SetBindPoint(guid);
break;
case GOSSIP_OPTION_BANKER:
GetSession()->SendShowBank(guid);
break;
case GOSSIP_OPTION_PETITIONER:
- PlayerTalkClass->CloseGossip();
+ PlayerTalkClass->SendCloseGossip();
GetSession()->SendPetitionShowList(guid);
break;
case GOSSIP_OPTION_TABARDDESIGNER:
- PlayerTalkClass->CloseGossip();
+ PlayerTalkClass->SendCloseGossip();
GetSession()->SendTabardVendorActivate(guid);
break;
case GOSSIP_OPTION_AUCTIONEER:
- GetSession()->SendAuctionHello(guid, (pSource->ToCreature()));
+ GetSession()->SendAuctionHello(guid, (source->ToCreature()));
break;
case GOSSIP_OPTION_SPIRITGUIDE:
- PrepareGossipMenu(pSource);
- SendPreparedGossip(pSource);
+ PrepareGossipMenu(source);
+ SendPreparedGossip(source);
break;
case GOSSIP_OPTION_BATTLEFIELD:
{
- BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(pSource->GetEntry());
+ BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(source->GetEntry());
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
{
@@ -14364,13 +14370,13 @@ void Player::SendPreparedQuest(uint64 guid)
QuestMenuItem const& qmi0 = questMenu.GetItem(0);
- uint32 icon = qmi0.m_qIcon;
+ uint32 icon = qmi0.QuestIcon;
// single element case
- if (questMenu.MenuItemCount() == 1)
+ if (questMenu.GetMenuItemCount() == 1)
{
// Auto open -- maybe also should verify there is no greeting
- uint32 quest_id = qmi0.m_qId;
+ uint32 quest_id = qmi0.QuestId;
Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id);
if (pQuest)
@@ -14386,7 +14392,7 @@ void Player::SendPreparedQuest(uint64 guid)
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM);
if (!pObject || (!pObject->hasQuest(quest_id) && !pObject->hasInvolvedQuest(quest_id)))
{
- PlayerTalkClass->CloseGossip();
+ PlayerTalkClass->SendCloseGossip();
return;
}
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 1d3d2b5de08..299f3543cef 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1333,9 +1333,9 @@ class Player : public Unit, public GridObject<Player>
/*** GOSSIP SYSTEM ***/
/*********************************************************/
- void PrepareGossipMenu(WorldObject *pSource, uint32 menuId = 0, bool showQuests = false);
- void SendPreparedGossip(WorldObject *pSource);
- void OnGossipSelect(WorldObject *pSource, uint32 gossipListId, uint32 menuId);
+ void PrepareGossipMenu(WorldObject* source, uint32 menuId = 0, bool showQuests = false);
+ void SendPreparedGossip(WorldObject* source);
+ void OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 menuId);
uint32 GetGossipTextId(uint32 menuId);
uint32 GetGossipTextId(WorldObject *pSource);
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index a35a5564acc..595aa068142 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -8539,55 +8539,53 @@ void ObjectMgr::LoadGossipMenuItems()
GossipMenuItems gMenuItem;
- gMenuItem.menu_id = fields[0].GetUInt32();
- gMenuItem.id = fields[1].GetUInt32();
- gMenuItem.option_icon = fields[2].GetUInt8();
- gMenuItem.option_text = fields[3].GetString();
- gMenuItem.option_id = fields[4].GetUInt32();
- gMenuItem.npc_option_npcflag = fields[5].GetUInt32();
- gMenuItem.action_menu_id = fields[6].GetUInt32();
- gMenuItem.action_poi_id = fields[7].GetUInt32();
- gMenuItem.action_script_id = fields[8].GetUInt32();
- gMenuItem.box_coded = fields[9].GetUInt8() != 0;
- gMenuItem.box_money = fields[10].GetUInt32();
- gMenuItem.box_text = fields[11].GetString();
+ gMenuItem.MenuId = fields[0].GetUInt32();
+ gMenuItem.OptionIndex = fields[1].GetUInt32();
+ gMenuItem.OptionIcon = fields[2].GetUInt8();
+ gMenuItem.OptionText = fields[3].GetString();
+ gMenuItem.OptionType = fields[4].GetUInt32();
+ gMenuItem.OptionNpcflag = fields[5].GetUInt32();
+ gMenuItem.ActionMenuId = fields[6].GetUInt32();
+ gMenuItem.ActionPoiId = fields[7].GetUInt32();
+ gMenuItem.ActionScriptId = fields[8].GetUInt32();
+ gMenuItem.BoxCoded = fields[9].GetBool();
+ gMenuItem.BoxMoney = fields[10].GetUInt32();
+ gMenuItem.BoxText = fields[11].GetString();
- if (gMenuItem.option_icon >= GOSSIP_ICON_MAX)
+ if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX)
{
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.menu_id, gMenuItem.id, gMenuItem.option_icon);
- gMenuItem.option_icon = GOSSIP_ICON_CHAT;
+ sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon);
+ gMenuItem.OptionIcon = GOSSIP_ICON_CHAT;
}
- if (gMenuItem.option_id >= GOSSIP_OPTION_MAX)
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.menu_id, gMenuItem.id, gMenuItem.option_id);
+ if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX)
+ sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType);
- if (gMenuItem.action_poi_id && !GetPointOfInterest(gMenuItem.action_poi_id))
+ if (gMenuItem.ActionPoiId && !GetPointOfInterest(gMenuItem.ActionPoiId))
{
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_poi_id);
- gMenuItem.action_poi_id = 0;
+ sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId);
+ gMenuItem.ActionPoiId = 0;
}
- if (gMenuItem.action_script_id)
+ if (gMenuItem.ActionScriptId)
{
- if (gMenuItem.option_id != GOSSIP_OPTION_GOSSIP)
+ if (gMenuItem.OptionType != GOSSIP_OPTION_GOSSIP)
{
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u have action_script_id %u but option_id is not GOSSIP_OPTION_GOSSIP, ignoring", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_script_id);
+ sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u have action_script_id %u but option_id is not GOSSIP_OPTION_GOSSIP, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionScriptId);
continue;
}
- if (sGossipScripts.find(gMenuItem.action_script_id) == sGossipScripts.end())
+ if (sGossipScripts.find(gMenuItem.ActionScriptId) == sGossipScripts.end())
{
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u have action_script_id %u that does not exist in `gossip_scripts`, ignoring", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_script_id);
+ sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u have action_script_id %u that does not exist in `gossip_scripts`, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionScriptId);
continue;
}
- gossipScriptSet.erase(gMenuItem.action_script_id);
+ gossipScriptSet.erase(gMenuItem.ActionScriptId);
}
- m_mGossipMenuItemsMap.insert(GossipMenuItemsMap::value_type(gMenuItem.menu_id, gMenuItem));
-
+ m_mGossipMenuItemsMap.insert(GossipMenuItemsMap::value_type(gMenuItem.MenuId, gMenuItem));
++count;
-
}
while (result->NextRow());
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index ea19cbbdd06..35ebf4c3be5 100755
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -475,19 +475,19 @@ struct PointOfInterest
struct GossipMenuItems
{
- uint32 menu_id;
- uint32 id;
- uint8 option_icon;
- std::string option_text;
- uint32 option_id;
- uint32 npc_option_npcflag;
- uint32 action_menu_id;
- uint32 action_poi_id;
- uint32 action_script_id;
- bool box_coded;
- uint32 box_money;
- std::string box_text;
- ConditionList conditions;
+ uint32 MenuId;
+ uint32 OptionIndex;
+ uint8 OptionIcon;
+ std::string OptionText;
+ uint32 OptionType;
+ uint32 OptionNpcflag;
+ uint32 ActionMenuId;
+ uint32 ActionPoiId;
+ uint32 ActionScriptId;
+ bool BoxCoded;
+ uint32 BoxMoney;
+ std::string BoxText;
+ ConditionList Conditions;
};
struct GossipMenus
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 8df9e0998ad..c09c09632fa 100755
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -909,7 +909,7 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_CLOSE_GOSSIP:
// Source must be Player.
if (Player *pSource = _GetScriptPlayer(source, true, step.script))
- pSource->PlayerTalkClass->CloseGossip();
+ pSource->PlayerTalkClass->SendCloseGossip();
break;
case SCRIPT_COMMAND_PLAYMOVIE:
diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp
index 3a7cb84dcdc..7c9c26ddb7a 100755
--- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp
@@ -88,7 +88,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
recv_data >> guid >> menuId >> gossipListId;
- if (_player->PlayerTalkClass->GossipOptionCoded(gossipListId))
+ if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId))
recv_data >> code;
Creature *unit = NULL;
@@ -128,7 +128,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
unit->LastUsedScriptID = unit->GetCreatureInfo()->ScriptID;
if (go)
go->LastUsedScriptID = go->GetGOInfo()->ScriptId;
- _player->PlayerTalkClass->CloseGossip();
+ _player->PlayerTalkClass->SendCloseGossip();
return;
}
if (!code.empty())
@@ -136,13 +136,13 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
if (unit)
{
unit->AI()->sGossipSelectCode(_player, menuId, gossipListId, code.c_str());
- if (!sScriptMgr->OnGossipSelectCode(_player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str()))
+ if (!sScriptMgr->OnGossipSelectCode(_player, unit, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str()))
_player->OnGossipSelect(unit, gossipListId, menuId);
}
else
{
go->AI()->GossipSelectCode(_player, menuId, gossipListId, code.c_str());
- sScriptMgr->OnGossipSelectCode(_player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId), code.c_str());
+ sScriptMgr->OnGossipSelectCode(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str());
}
}
else
@@ -150,13 +150,13 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
if (unit)
{
unit->AI()->sGossipSelect(_player, menuId, gossipListId);
- if (!sScriptMgr->OnGossipSelect(_player, unit, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId)))
+ if (!sScriptMgr->OnGossipSelect(_player, unit, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId)))
_player->OnGossipSelect(unit, gossipListId, menuId);
}
else
{
go->AI()->GossipSelect(_player, menuId, gossipListId);
- sScriptMgr->OnGossipSelect(_player, go, _player->PlayerTalkClass->GossipOptionSender(gossipListId), _player->PlayerTalkClass->GossipOptionAction(gossipListId));
+ sScriptMgr->OnGossipSelect(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId));
}
}
}
diff --git a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
index 7118170390d..c3f53283401 100755
--- a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp
@@ -497,7 +497,7 @@ void WorldSession::SendBindPoint(Creature *npc)
data << uint32(bindspell);
SendPacket(&data);
- _player->PlayerTalkClass->CloseGossip();
+ _player->PlayerTalkClass->SendCloseGossip();
}
void WorldSession::HandleListStabledPetsOpcode(WorldPacket & recv_data)
diff --git a/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp b/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp
index 24cfea3949d..3c77cf72a93 100755
--- a/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp
@@ -130,7 +130,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
if (!pObject || (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->hasQuest(quest)) ||
(pObject->GetTypeId() == TYPEID_PLAYER && !pObject->ToPlayer()->CanShareQuest(quest)))
{
- _player->PlayerTalkClass->CloseGossip();
+ _player->PlayerTalkClass->SendCloseGossip();
_player->SetDivider(0);
return;
}
@@ -141,7 +141,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
// prevent cheating
if (!GetPlayer()->CanTakeQuest(qInfo, true))
{
- _player->PlayerTalkClass->CloseGossip();
+ _player->PlayerTalkClass->SendCloseGossip();
_player->SetDivider(0);
return;
}
@@ -176,7 +176,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
pPlayer->SetDivider(_player->GetGUID());
//need confirmation that any gossip window will close
- pPlayer->PlayerTalkClass->CloseGossip();
+ pPlayer->PlayerTalkClass->SendCloseGossip();
_player->SendQuestConfirmAccept(qInfo, pPlayer);
}
@@ -221,7 +221,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
default:
break;
}
- _player->PlayerTalkClass->CloseGossip();
+ _player->PlayerTalkClass->SendCloseGossip();
if (qInfo->GetSrcSpell() > 0)
_player->CastSpell(_player, qInfo->GetSrcSpell(), true);
@@ -230,7 +230,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
}
}
- _player->PlayerTalkClass->CloseGossip();
+ _player->PlayerTalkClass->SendCloseGossip();
}
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recv_data)
@@ -245,7 +245,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recv_data)
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM);
if (!pObject || (!pObject->hasQuest(quest) && !pObject->hasInvolvedQuest(quest)))
{
- _player->PlayerTalkClass->CloseGossip();
+ _player->PlayerTalkClass->SendCloseGossip();
return;
}
@@ -372,7 +372,7 @@ void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recv_data*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_CANCEL");
- _player->PlayerTalkClass->CloseGossip();
+ _player->PlayerTalkClass->SendCloseGossip();
}
void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recv_data)
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 94174e9cb82..a1961ae6c63 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -56,7 +56,6 @@ public:
{ "equiperror", SEC_ADMINISTRATOR, false, &HandleDebugSendEquipErrorCommand, "", NULL },
{ "largepacket", SEC_ADMINISTRATOR, false, &HandleDebugSendLargePacketCommand, "", NULL },
{ "opcode", SEC_ADMINISTRATOR, false, &HandleDebugSendOpcodeCommand, "", NULL },
- { "poi", SEC_ADMINISTRATOR, false, &HandleDebugSendPoiCommand, "", NULL },
{ "qpartymsg", SEC_ADMINISTRATOR, false, &HandleDebugSendQuestPartyMsgCommand, "", NULL },
{ "qinvalidmsg", SEC_ADMINISTRATOR, false, &HandleDebugSendQuestInvalidMsgCommand, "", NULL },
{ "sellerror", SEC_ADMINISTRATOR, false, &HandleDebugSendSellErrorCommand, "", NULL },
@@ -218,32 +217,6 @@ public:
return true;
}
- static bool HandleDebugSendPoiCommand(ChatHandler* handler, const char* args)
- {
- if (!*args)
- return false;
-
- Player *pPlayer = handler->GetSession()->GetPlayer();
- Unit* target = handler->getSelectedUnit();
- if (!target)
- {
- handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- return true;
- }
-
- char* icon_text = strtok((char*)args, " ");
- char* flags_text = strtok(NULL, " ");
- if (!icon_text || !flags_text)
- return false;
-
- uint32 icon = atol(icon_text);
- uint32 flags = atol(flags_text);
-
- sLog->outDetail("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon, flags);
- pPlayer->PlayerTalkClass->SendPointOfInterest(target->GetPositionX(), target->GetPositionY(), Poi_Icon(icon), flags, 30, "Test POI");
- return true;
- }
-
static bool HandleDebugSendEquipErrorCommand(ChatHandler* handler, const char* args)
{
if (!*args)
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
index d46afadb483..1bcb18821b4 100755
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
@@ -362,7 +362,7 @@ bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player *plr, uint64 guid,
m_FlagCarrierGUID = plr->GetGUID();
}
UpdateTowerState();
- plr->PlayerTalkClass->CloseGossip();
+ plr->PlayerTalkClass->SendCloseGossip();
return true;
}
return false;
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 68157202776..b2cd3cb86f9 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -1315,7 +1315,7 @@ public:
if (!pPlayer->HasEnoughMoney(10000000))
{
pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
- pPlayer->PlayerTalkClass->CloseGossip();
+ pPlayer->PlayerTalkClass->SendCloseGossip();
break;
}
else
@@ -1328,7 +1328,7 @@ public:
pPlayer->CastSpell(pPlayer, 63624, true, NULL, NULL, pPlayer->GetGUID());
// Should show another Gossip text with "Congratulations..."
- pPlayer->PlayerTalkClass->CloseGossip();
+ pPlayer->PlayerTalkClass->SendCloseGossip();
}
}
break;
@@ -2598,7 +2598,7 @@ public:
pPlayer->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
}
}
- pPlayer->PlayerTalkClass->CloseGossip();
+ pPlayer->PlayerTalkClass->SendCloseGossip();
return true;
}
};