mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-01 10:03:47 +00:00
Big update.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "GossipDef.h"
|
||||
#include "Formulas.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Object.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "QuestDef.h"
|
||||
@@ -73,8 +74,9 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me
|
||||
* @param menuItemId Gossip menu item id.
|
||||
* @param sender Identifier of the current menu.
|
||||
* @param action Custom action given to OnGossipHello.
|
||||
* @param boxMoney Custom price for pop-up box. If > 0, it will replace DB value.
|
||||
*/
|
||||
void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action)
|
||||
void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action, uint32 boxMoney)
|
||||
{
|
||||
/// Find items for given menu id.
|
||||
GossipMenuItemsMapBounds bounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId);
|
||||
@@ -125,7 +127,7 @@ void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, ui
|
||||
}
|
||||
|
||||
/// Add menu item with existing method. Menu item id -1 is also used in ADD_GOSSIP_ITEM macro.
|
||||
AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded);
|
||||
AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, boxMoney ? boxMoney : itr->second.BoxMoney, itr->second.BoxCoded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,8 +220,8 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID) const
|
||||
data << uint32(questID);
|
||||
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
|
||||
data << uint32(quest->GetFlags()); // 3.3.3 quest flags
|
||||
data << uint8(quest->IsRepeatable() && !quest->IsDailyOrWeekly() && !quest->IsMonthly()); // 3.3.3 icon changes: blue question mark or yellow exclamation mark
|
||||
std::string title = quest->GetTitle();
|
||||
|
||||
int32 locale = _session->GetSessionDbLocaleIndex();
|
||||
@@ -243,7 +245,7 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const
|
||||
PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(poiId);
|
||||
if (!poi)
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Request to send non-existing POI (Id: %u), ignored.", poiId);
|
||||
LOG_ERROR("sql.sql", "Request to send non-existing POI (Id: {}), ignored.", poiId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -306,44 +308,63 @@ void QuestMenu::ClearMenu()
|
||||
_questMenuItems.clear();
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID)
|
||||
void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, std::string const& Title, ObjectGuid guid)
|
||||
{
|
||||
WorldPacket data(SMSG_QUESTGIVER_QUEST_LIST, 100 + _questMenu.GetMenuItemCount() * 75); // guess size
|
||||
data << npcGUID;
|
||||
data << Title;
|
||||
data << uint32(eEmote._Delay); // player emote
|
||||
data << uint32(eEmote._Emote); // NPC emote
|
||||
WorldPacket data(SMSG_QUESTGIVER_QUEST_LIST, 100); // guess size
|
||||
data << guid;
|
||||
|
||||
if (QuestGreeting const* questGreeting = sObjectMgr->GetQuestGreeting(guid.GetTypeId(), guid.GetEntry()))
|
||||
{
|
||||
std::string strGreeting = questGreeting->Text;
|
||||
|
||||
LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex();
|
||||
if (localeConstant != LOCALE_enUS)
|
||||
if (QuestGreetingLocale const* questGreetingLocale = sObjectMgr->GetQuestGreetingLocale(guid.GetTypeId(), guid.GetEntry()))
|
||||
ObjectMgr::GetLocaleString(questGreetingLocale->Greeting, localeConstant, strGreeting);
|
||||
|
||||
data << strGreeting;
|
||||
data << uint32(questGreeting->EmoteDelay);
|
||||
data << uint32(questGreeting->EmoteType);
|
||||
}
|
||||
else
|
||||
{
|
||||
data << Title;
|
||||
data << uint32(eEmote._Delay); // player emote
|
||||
data << uint32(eEmote._Emote); // NPC emote
|
||||
}
|
||||
|
||||
size_t count_pos = data.wpos();
|
||||
data << uint8 (_questMenu.GetMenuItemCount());
|
||||
data << uint8(0);
|
||||
uint32 count = 0;
|
||||
for (uint32 iI = 0; iI < _questMenu.GetMenuItemCount(); ++iI)
|
||||
{
|
||||
QuestMenuItem const& qmi = _questMenu.GetItem(iI);
|
||||
|
||||
uint32 questID = qmi.QuestId;
|
||||
for (uint32 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
|
||||
{
|
||||
QuestMenuItem const& questMenuItem = _questMenu.GetItem(i);
|
||||
|
||||
uint32 questID = questMenuItem.QuestId;
|
||||
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questID))
|
||||
{
|
||||
++count;
|
||||
std::string title = quest->GetTitle();
|
||||
|
||||
int32 locale = _session->GetSessionDbLocaleIndex();
|
||||
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
|
||||
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
|
||||
LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex();
|
||||
if (localeConstant != LOCALE_enUS)
|
||||
if (QuestLocale const* questTemplateLocale = sObjectMgr->GetQuestLocale(questID))
|
||||
ObjectMgr::GetLocaleString(questTemplateLocale->Title, localeConstant, title);
|
||||
|
||||
data << uint32(questID);
|
||||
data << uint32(qmi.QuestIcon);
|
||||
data << uint32(questMenuItem.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
|
||||
data << uint32(quest->GetFlags()); // 3.3.3 quest flags
|
||||
data << uint8(quest->IsRepeatable() && !quest->IsDailyOrWeekly() && !quest->IsMonthly()); // 3.3.3 changes icon: blue question or yellow exclamation
|
||||
data << title;
|
||||
}
|
||||
}
|
||||
|
||||
data.put<uint8>(count_pos, count);
|
||||
_session->SendPacket(&data);
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC %s", npcGUID.ToString().c_str());
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST (QuestGiver: {})", guid.ToString());
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID) const
|
||||
@@ -353,7 +374,7 @@ void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID) con
|
||||
data << uint8(questStatus);
|
||||
|
||||
_session->SendPacket(&data);
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC %s, status=%u", npcGUID.ToString().c_str(), questStatus);
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC {}, status={}", npcGUID.ToString(), questStatus);
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const
|
||||
@@ -456,7 +477,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
|
||||
}
|
||||
_session->SendPacket(&data);
|
||||
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS %s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS {}, questid={}", npcGUID.ToString(), quest->GetQuestId());
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
|
||||
@@ -587,7 +608,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
|
||||
data << questObjectiveText[i];
|
||||
|
||||
_session->SendPacket(&data);
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", quest->GetQuestId());
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid={}", quest->GetQuestId());
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const
|
||||
@@ -677,7 +698,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
|
||||
data << uint32(quest->RewardFactionValueIdOverride[i]);
|
||||
|
||||
_session->SendPacket(&data);
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD %s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD {}, questid={}", npcGUID.ToString(), quest->GetQuestId());
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel) const
|
||||
@@ -768,5 +789,5 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGU
|
||||
data << uint32(0x10);
|
||||
|
||||
_session->SendPacket(&data);
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS %s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS {}, questid={}", npcGUID.ToString(), quest->GetQuestId());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user