Core/Misc:

- Drop locales_npc_text
- Update npc_text for WoD
- Implemented Quest Greeting
- Sync auth database
This commit is contained in:
Vincent-Michael
2015-04-11 03:26:36 +02:00
parent 5659db6f03
commit 22e230ecec
18 changed files with 268 additions and 220 deletions
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
UPDATE `rbac_permissions` SET `name`='Command: reload quest_greeting' WHERE `id`=664;
+81
View File
@@ -0,0 +1,81 @@
ALTER TABLE `npc_text`
DROP `text0_0`,
DROP `text0_1`,
DROP `lang0`,
DROP `em0_0`,
DROP `em0_1`,
DROP `em0_2`,
DROP `em0_3`,
DROP `em0_4`,
DROP `em0_5`,
CHANGE `prob0` `Probability0` FLOAT NOT NULL DEFAULT '0',
DROP `text1_0`,
DROP `text1_1`,
DROP `lang1`,
DROP `em1_0`,
DROP `em1_1`,
DROP `em1_2`,
DROP `em1_3`,
DROP `em1_4`,
DROP `em1_5`,
CHANGE `prob1` `Probability1` FLOAT NOT NULL DEFAULT '0',
DROP `text2_0`,
DROP `text2_1`,
DROP `lang2`,
DROP `em2_0`,
DROP `em2_1`,
DROP `em2_2`,
DROP `em2_3`,
DROP `em2_4`,
DROP `em2_5`,
CHANGE `prob2` `Probability2` FLOAT NOT NULL DEFAULT '0',
DROP `text3_0`,
DROP `text3_1`,
DROP `lang3`,
DROP `em3_0`,
DROP `em3_1`,
DROP `em3_2`,
DROP `em3_3`,
DROP `em3_4`,
DROP `em3_5`,
CHANGE `prob3` `Probability3` FLOAT NOT NULL DEFAULT '0',
DROP `text4_0`,
DROP `text4_1`,
DROP `lang4`,
DROP `em4_0`,
DROP `em4_1`,
DROP `em4_2`,
DROP `em4_3`,
DROP `em4_4`,
DROP `em4_5`,
CHANGE `prob4` `Probability4` FLOAT NOT NULL DEFAULT '0',
DROP `text5_0`,
DROP `text5_1`,
DROP `lang5`,
DROP `em5_0`,
DROP `em5_1`,
DROP `em5_2`,
DROP `em5_3`,
DROP `em5_4`,
DROP `em5_5`,
CHANGE `prob5` `Probability5` FLOAT NOT NULL DEFAULT '0',
DROP `text6_0`,
DROP `text6_1`,
DROP `lang6`,
DROP `em6_0`,
DROP `em6_1`,
DROP `em6_2`,
DROP `em6_3`,
DROP `em6_4`,
DROP `em6_5`,
CHANGE `prob6` `Probability6` FLOAT NOT NULL DEFAULT '0',
DROP `text7_0`,
DROP `text7_1`,
DROP `lang7`,
DROP `em7_0`,
DROP `em7_1`,
DROP `em7_2`,
DROP `em7_3`,
DROP `em7_4`,
DROP `em7_5`,
CHANGE `prob7` `Probability7` FLOAT NOT NULL DEFAULT '0';
@@ -0,0 +1 @@
DROP TABLE locales_npc_text;
@@ -0,0 +1,4 @@
DELETE FROM `command` WHERE `name`='reload locales_npc_text';
DELETE FROM `command` WHERE `name`='reload quest_greeting';
INSERT INTO `command` (`name`, `permission`, `help`) VALUES
('reload quest_greeting', 664, 'Syntax: .reload quest_greeting\nReload quest_greeting table.');
+1 -1
View File
@@ -568,7 +568,7 @@ enum RBACPermissions
RBAC_PERM_COMMAND_RELOAD_LOCALES_GOSSIP_MENU_OPTION = 661,
// UNUSED
RBAC_PERM_COMMAND_RELOAD_LOCALES_ITEM_SET_NAME = 663,
RBAC_PERM_COMMAND_RELOAD_LOCALES_NPC_TEXT = 664,
RBAC_PERM_COMMAND_RELOAD_QUEST_GREETING = 664,
RBAC_PERM_COMMAND_RELOAD_LOCALES_PAGE_TEXT = 665,
RBAC_PERM_COMMAND_RELOAD_LOCALES_POINTS_OF_INTEREST = 666,
RBAC_PERM_COMMAND_RELOAD_QUEST_LOCALE = 667,
+19 -14
View File
@@ -331,44 +331,49 @@ void QuestMenu::ClearMenu()
_questMenuItems.clear();
}
void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID)
void PlayerMenu::SendQuestGiverQuestList(ObjectGuid guid)
{
WorldPackets::Quest::QuestGiverQuestList questList;
questList.QuestGiverGUID = guid;
questList.QuestGiverGUID = npcGUID;
questList.Greeting = Title;
questList.GreetEmoteDelay = eEmote._Delay;
questList.GreetEmoteType = eEmote._Emote;
if (QuestGreeting const* questGreeting = sObjectMgr->GetQuestGreeting(guid))
{
questList.GreetEmoteDelay = questGreeting->greetEmoteDelay;
questList.GreetEmoteType = questGreeting->greetEmoteType;
questList.Greeting = questGreeting->greeting;
}
else
TC_LOG_ERROR("misc", "Guid: %s - No quest greeting found.", guid.ToString().c_str());
// Store this instead of checking the Singleton every loop iteration
bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
for (uint32 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
QuestMenuItem const& qmi = _questMenu.GetItem(i);
QuestMenuItem const& questMenuItem = _questMenu.GetItem(i);
uint32 questID = qmi.QuestId;
uint32 questID = questMenuItem.QuestId;
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questID))
{
std::string title = quest->GetLogTitle();
int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
if (QuestTemplateLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(localeData->LogTitle, locale, title);
LocaleConstant locale = _session->GetSessionDbLocaleIndex();
if (locale >= LOCALE_enUS)
if (QuestTemplateLocale const* questTemplateLocaleData = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(questTemplateLocaleData->LogTitle, locale, title);
if (questLevelInTitle)
AddQuestLevelToTitle(title, quest->GetQuestLevel());
bool repeatable = false; // NYI
questList.GossipTexts.push_back(WorldPackets::Quest::GossipTextData(questID, qmi.QuestIcon, quest->GetQuestLevel(), quest->GetFlags(), quest->GetFlagsEx(), repeatable, title));
questList.GossipTexts.push_back(WorldPackets::Quest::GossipTextData(questID, questMenuItem.QuestIcon, quest->GetQuestLevel(), quest->GetFlags(), quest->GetFlagsEx(), repeatable, title));
}
}
_session->SendPacket(questList.Write());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_GIVER_QUEST_LIST_MESSAGE NPC=%s", npcGUID.ToString().c_str());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_GIVER_QUEST_LIST_MESSAGE NPC=%s", guid.ToString().c_str());
}
void PlayerMenu::SendQuestGiverStatus(uint32 questStatus, ObjectGuid npcGUID) const
@@ -451,7 +456,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
_session->SendPacket(packet.Write());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
TC_LOG_DEBUG(" etwork", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
}
void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
@@ -258,7 +258,7 @@ class PlayerMenu
/*********************************************************/
void SendQuestGiverStatus(uint32 questStatus, ObjectGuid npcGUID) const;
void SendQuestGiverQuestList(QEmote const& eEmote, const std::string& Title, ObjectGuid npcGUID);
void SendQuestGiverQuestList(ObjectGuid npcGUID);
void SendQuestQueryResponse(Quest const* quest) const;
void SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const;
+1 -42
View File
@@ -14108,48 +14108,7 @@ void Player::SendPreparedQuest(ObjectGuid guid)
}
}
QEmote qe;
qe._Delay = 0;
qe._Emote = 0;
std::string title = "";
// need pet case for some quests
Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
if (creature)
{
uint32 textid = GetGossipTextId(creature);
GossipText const* gossiptext = sObjectMgr->GetGossipText(textid);
if (!gossiptext)
{
qe._Delay = 0; //TEXTEMOTE_MESSAGE; //zyg: player emote
qe._Emote = 0; //TEXTEMOTE_HELLO; //zyg: NPC emote
title.clear();
}
else
{
qe = gossiptext->Options[0].Emotes[0];
if (!gossiptext->Options[0].Text_0.empty())
{
title = gossiptext->Options[0].Text_0;
int loc_idx = GetSession()->GetSessionDbLocaleIndex();
if (loc_idx >= 0)
if (NpcTextLocale const* nl = sObjectMgr->GetNpcTextLocale(textid))
ObjectMgr::GetLocaleString(nl->Text_0[0], loc_idx, title);
}
else
{
title = gossiptext->Options[0].Text_1;
int loc_idx = GetSession()->GetSessionDbLocaleIndex();
if (loc_idx >= 0)
if (NpcTextLocale const* nl = sObjectMgr->GetNpcTextLocale(textid))
ObjectMgr::GetLocaleString(nl->Text_1[0], loc_idx, title);
}
}
}
PlayerTalkClass->SendQuestGiverQuestList(qe, title, guid);
PlayerTalkClass->SendQuestGiverQuestList(guid);
}
bool Player::IsActiveQuest(uint32 quest_id) const
+96 -86
View File
@@ -5053,80 +5053,63 @@ void ObjectMgr::LoadInstanceEncounters()
TC_LOG_INFO("server.loading", ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const
NpcText const* ObjectMgr::GetNpcText(uint32 Text_ID) const
{
GossipTextContainer::const_iterator itr = _gossipTextStore.find(Text_ID);
if (itr != _gossipTextStore.end())
NpcTextContainer::const_iterator itr = _npcTextStore.find(Text_ID);
if (itr != _npcTextStore.end())
return &itr->second;
return NULL;
}
void ObjectMgr::LoadGossipText()
void ObjectMgr::LoadNPCText()
{
uint32 oldMSTime = getMSTime();
QueryResult result = WorldDatabase.Query("SELECT ID, "
"text0_0, text0_1, BroadcastTextID0, lang0, prob0, em0_0, em0_1, em0_2, em0_3, em0_4, em0_5, "
"text1_0, text1_1, BroadcastTextID1, lang1, prob1, em1_0, em1_1, em1_2, em1_3, em1_4, em1_5, "
"text2_0, text2_1, BroadcastTextID2, lang2, prob2, em2_0, em2_1, em2_2, em2_3, em2_4, em2_5, "
"text3_0, text3_1, BroadcastTextID3, lang3, prob3, em3_0, em3_1, em3_2, em3_3, em3_4, em3_5, "
"text4_0, text4_1, BroadcastTextID4, lang4, prob4, em4_0, em4_1, em4_2, em4_3, em4_4, em4_5, "
"text5_0, text5_1, BroadcastTextID5, lang5, prob5, em5_0, em5_1, em5_2, em5_3, em5_4, em5_5, "
"text6_0, text6_1, BroadcastTextID6, lang6, prob6, em6_0, em6_1, em6_2, em6_3, em6_4, em6_5, "
"text7_0, text7_1, BroadcastTextID7, lang7, prob7, em7_0, em7_1, em7_2, em7_3, em7_4, em7_5 "
"FROM npc_text");
"BroadcastTextID0, Probability0, "
"BroadcastTextID1, Probability1, "
"BroadcastTextID2, Probability2, "
"BroadcastTextID3, Probability3, "
"BroadcastTextID4, Probability4, "
"BroadcastTextID5, Probability5, "
"BroadcastTextID6, Probability6, "
"BroadcastTextID7, Probability7"
" FROM npc_text");
if (!result)
{
TC_LOG_INFO("server.loading", ">> Loaded 0 npc texts, table is empty!");
return;
}
_gossipTextStore.rehash(result->GetRowCount());
uint32 count = 0;
uint8 cic;
_npcTextStore.rehash(result->GetRowCount());
do
{
++count;
cic = 0;
Field* fields = result->Fetch();
uint32 id = fields[cic++].GetUInt32();
if (!id)
uint32 textID = fields[0].GetUInt32();
if (!textID)
{
TC_LOG_ERROR("sql.sql", "Table `npc_text` has record with reserved id 0, ignore.");
continue;
}
GossipText& gText = _gossipTextStore[id];
NpcText& npcText = _npcTextStore[textID];
for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
for (uint8 i = 0; i < MAX_NPC_TEXT_OPTIONS; ++i)
{
gText.Options[i].Text_0 = fields[cic++].GetString();
gText.Options[i].Text_1 = fields[cic++].GetString();
gText.Options[i].BroadcastTextID = fields[cic++].GetUInt32();
gText.Options[i].Language = fields[cic++].GetUInt8();
gText.Options[i].Probability = fields[cic++].GetFloat();
for (uint8 j = 0; j < MAX_GOSSIP_TEXT_EMOTES; ++j)
{
gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt16();
gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt16();
}
npcText.Data[i].BroadcastTextID = fields[1 + i].GetUInt32();
npcText.Data[i].Probability = fields[1 + i * 2].GetFloat();
}
for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; i++)
for (uint8 i = 0; i < MAX_NPC_TEXT_OPTIONS; i++)
{
if (gText.Options[i].BroadcastTextID)
if (npcText.Data[i].BroadcastTextID)
{
if (!sBroadcastTextStore.LookupEntry(gText.Options[i].BroadcastTextID))
if (!sBroadcastTextStore.LookupEntry(npcText.Data[i].BroadcastTextID))
{
TC_LOG_ERROR("sql.sql", "GossipText (Id: %u) in table `npc_text` has non-existing or incompatible BroadcastTextID%u %u.", id, i, gText.Options[i].BroadcastTextID);
gText.Options[i].BroadcastTextID = 0;
TC_LOG_ERROR("sql.sql", "NpcText (Id: %u) in table `npc_text` has non-existing or incompatible Index: %u BroadcastTextID %u.", textID, i, npcText.Data[i].BroadcastTextID);
npcText.Data[i].BroadcastTextID = 0;
}
}
}
@@ -5134,49 +5117,7 @@ void ObjectMgr::LoadGossipText()
}
while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadNpcTextLocales()
{
uint32 oldMSTime = getMSTime();
_npcTextLocaleStore.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT ID, "
"Text0_0_loc1, Text0_1_loc1, Text1_0_loc1, Text1_1_loc1, Text2_0_loc1, Text2_1_loc1, Text3_0_loc1, Text3_1_loc1, Text4_0_loc1, Text4_1_loc1, Text5_0_loc1, Text5_1_loc1, Text6_0_loc1, Text6_1_loc1, Text7_0_loc1, Text7_1_loc1, "
"Text0_0_loc2, Text0_1_loc2, Text1_0_loc2, Text1_1_loc2, Text2_0_loc2, Text2_1_loc2, Text3_0_loc2, Text3_1_loc1, Text4_0_loc2, Text4_1_loc2, Text5_0_loc2, Text5_1_loc2, Text6_0_loc2, Text6_1_loc2, Text7_0_loc2, Text7_1_loc2, "
"Text0_0_loc3, Text0_1_loc3, Text1_0_loc3, Text1_1_loc3, Text2_0_loc3, Text2_1_loc3, Text3_0_loc3, Text3_1_loc1, Text4_0_loc3, Text4_1_loc3, Text5_0_loc3, Text5_1_loc3, Text6_0_loc3, Text6_1_loc3, Text7_0_loc3, Text7_1_loc3, "
"Text0_0_loc4, Text0_1_loc4, Text1_0_loc4, Text1_1_loc4, Text2_0_loc4, Text2_1_loc4, Text3_0_loc4, Text3_1_loc1, Text4_0_loc4, Text4_1_loc4, Text5_0_loc4, Text5_1_loc4, Text6_0_loc4, Text6_1_loc4, Text7_0_loc4, Text7_1_loc4, "
"Text0_0_loc5, Text0_1_loc5, Text1_0_loc5, Text1_1_loc5, Text2_0_loc5, Text2_1_loc5, Text3_0_loc5, Text3_1_loc1, Text4_0_loc5, Text4_1_loc5, Text5_0_loc5, Text5_1_loc5, Text6_0_loc5, Text6_1_loc5, Text7_0_loc5, Text7_1_loc5, "
"Text0_0_loc6, Text0_1_loc6, Text1_0_loc6, Text1_1_loc6, Text2_0_loc6, Text2_1_loc6, Text3_0_loc6, Text3_1_loc1, Text4_0_loc6, Text4_1_loc6, Text5_0_loc6, Text5_1_loc6, Text6_0_loc6, Text6_1_loc6, Text7_0_loc6, Text7_1_loc6, "
"Text0_0_loc7, Text0_1_loc7, Text1_0_loc7, Text1_1_loc7, Text2_0_loc7, Text2_1_loc7, Text3_0_loc7, Text3_1_loc1, Text4_0_loc7, Text4_1_loc7, Text5_0_loc7, Text5_1_loc7, Text6_0_loc7, Text6_1_loc7, Text7_0_loc7, Text7_1_loc7, "
"Text0_0_loc8, Text0_1_loc8, Text1_0_loc8, Text1_1_loc8, Text2_0_loc8, Text2_1_loc8, Text3_0_loc8, Text3_1_loc1, Text4_0_loc8, Text4_1_loc8, Text5_0_loc8, Text5_1_loc8, Text6_0_loc8, Text6_1_loc8, Text7_0_loc8, Text7_1_loc8 "
" FROM locales_npc_text");
if (!result)
return;
do
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
NpcTextLocale& data = _npcTextLocaleStore[entry];
for (uint8 i = OLD_TOTAL_LOCALES - 1; i > 0; --i)
{
LocaleConstant locale = (LocaleConstant) i;
for (uint8 j = 0; j < MAX_GOSSIP_TEXT_OPTIONS; ++j)
{
AddLocaleString(fields[1 + 8 * 2 * (i - 1) + 2 * j].GetString(), locale, data.Text_0[j]);
AddLocaleString(fields[1 + 8 * 2 * (i - 1) + 2 * j + 1].GetString(), locale, data.Text_1[j]);
}
}
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u NpcText locale strings in %u ms", uint32(_npcTextLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
TC_LOG_INFO("server.loading", ">> Loaded %u npc texts in %u ms", _npcTextStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
//not very fast function but it is called only once a day, or on starting-up
@@ -5365,6 +5306,75 @@ void ObjectMgr::LoadQuestAreaTriggers()
TC_LOG_INFO("server.loading", ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
QuestGreeting const* ObjectMgr::GetQuestGreeting(ObjectGuid guid) const
{
auto itr = _questGreetingStore.find(guid.GetTypeId());
if (itr == _questGreetingStore.end())
return nullptr;
auto questItr = itr->second.find(guid.GetEntry());
if (questItr == itr->second.end())
return nullptr;
return questItr->second;
}
void ObjectMgr::LoadQuestGreetings()
{
uint32 oldMSTime = getMSTime();
_questGreetingStore.clear(); // need for reload case
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT ID, type, GreetEmoteType, GreetEmoteDelay, Greeting FROM quest_greeting");
if (!result)
{
TC_LOG_INFO("server.loading", ">> Loaded 0 npc texts, table is empty!");
return;
}
_questGreetingStore.rehash(result->GetRowCount());
do
{
Field* fields = result->Fetch();
uint32 id = fields[0].GetUInt32();
uint8 type = fields[1].GetUInt8();
// overwrite
switch (type)
{
case 0: // Creature
type = TYPEID_UNIT;
if (!sObjectMgr->GetCreatureTemplate(id))
{
TC_LOG_ERROR("sql.sql", "Table `quest_greeting`: creature template entry %u does not exist.", id);
continue;
}
break;
case 1: // GameObject
type = TYPEID_GAMEOBJECT;
if (!sObjectMgr->GetGameObjectTemplate(id))
{
TC_LOG_ERROR("sql.sql", "Table `quest_greeting`: gameobject template entry %u does not exist.", id);
continue;
}
break;
default:
continue;
}
uint16 greetEmoteType = fields[2].GetUInt32();
uint32 greetEmoteDelay = fields[3].GetUInt32();
std::string greeting = fields[4].GetString();
_questGreetingStore[type][id] = new QuestGreeting(greetEmoteType, greetEmoteDelay, greeting);
}
while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u quest_greeting in %u ms", _questGreetingStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadTavernAreaTriggers()
{
uint32 oldMSTime = getMSTime();
@@ -8012,7 +8022,7 @@ void ObjectMgr::LoadGossipMenu()
gMenu.entry = fields[0].GetUInt16();
gMenu.text_id = fields[1].GetUInt32();
if (!GetGossipText(gMenu.text_id))
if (!GetNpcText(gMenu.text_id))
{
TC_LOG_ERROR("sql.sql", "Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id);
continue;
+20 -13
View File
@@ -435,7 +435,6 @@ typedef std::unordered_map<uint32, CreatureLocale> CreatureLocaleContainer;
typedef std::unordered_map<uint32, GameObjectLocale> GameObjectLocaleContainer;
typedef std::unordered_map<uint32, QuestTemplateLocale> QuestTemplateLocaleContainer;
typedef std::unordered_map<uint32, QuestObjectivesLocale> QuestObjectivesLocaleContainer;
typedef std::unordered_map<uint32, NpcTextLocale> NpcTextLocaleContainer;
typedef std::unordered_map<uint32, PageTextLocale> PageTextLocaleContainer;
typedef std::unordered_map<uint32, GossipMenuItemsLocale> GossipMenuItemsLocaleContainer;
typedef std::unordered_map<uint32, PointOfInterestLocale> PointOfInterestLocaleContainer;
@@ -579,6 +578,19 @@ struct QuestPOI
typedef std::vector<QuestPOI> QuestPOIVector;
typedef std::unordered_map<uint32, QuestPOIVector> QuestPOIContainer;
struct QuestGreeting
{
uint16 greetEmoteType;
uint32 greetEmoteDelay;
std::string greeting;
QuestGreeting() : greetEmoteType(0), greetEmoteDelay(0) { }
QuestGreeting(uint16 _greetEmoteType, uint32 _greetEmoteDelay, std::string _greeting)
: greetEmoteType(_greetEmoteType), greetEmoteDelay(_greetEmoteDelay), greeting(_greeting) { }
};
typedef std::unordered_map<uint8, std::unordered_map<uint32, QuestGreeting const*>> QuestGreetingContainer;
struct GraveYardData
{
uint32 safeLocId;
@@ -792,7 +804,8 @@ class ObjectMgr
return _gameObjectForQuestStore.find(entry) != _gameObjectForQuestStore.end();
}
GossipText const* GetGossipText(uint32 Text_ID) const;
NpcText const* GetNpcText(uint32 textID) const;
QuestGreeting const* ObjectMgr::GetQuestGreeting(ObjectGuid guid) const;
WorldSafeLocsEntry const* GetDefaultGraveYard(uint32 team);
WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team);
@@ -966,7 +979,6 @@ class ObjectMgr
void LoadItemScriptNames();
void LoadQuestTemplateLocale();
void LoadQuestObjectivesLocale();
void LoadNpcTextLocales();
void LoadPageTextLocales();
void LoadGossipMenuItemsLocales();
void LoadPointOfInterestLocales();
@@ -976,11 +988,12 @@ class ObjectMgr
void LoadVehicleTemplateAccessories();
void LoadVehicleAccessories();
void LoadGossipText();
void LoadNPCText();
void LoadAreaTriggerTeleports();
void LoadAccessRequirements();
void LoadQuestAreaTriggers();
void LoadQuestGreetings();
void LoadAreaTriggerScripts();
void LoadTavernAreaTriggers();
void LoadGameObjectForQuests();
@@ -1126,12 +1139,6 @@ class ObjectMgr
if (itr == _questObjectivesLocaleStore.end()) return NULL;
return &itr->second;
}
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
{
NpcTextLocaleContainer::const_iterator itr = _npcTextLocaleStore.find(entry);
if (itr == _npcTextLocaleStore.end()) return NULL;
return &itr->second;
}
PageTextLocale const* GetPageTextLocale(uint32 entry) const
{
PageTextLocaleContainer::const_iterator itr = _pageTextLocaleStore.find(entry);
@@ -1337,7 +1344,7 @@ class ObjectMgr
QuestMap _questTemplates;
typedef std::unordered_map<uint32, GossipText> GossipTextContainer;
typedef std::unordered_map<uint32, NpcText> NpcTextContainer;
typedef std::unordered_map<uint32, uint32> QuestAreaTriggerContainer;
typedef std::set<uint32> TavernAreaTriggerContainer;
typedef std::set<uint32> GameObjectForQuestContainer;
@@ -1345,7 +1352,8 @@ class ObjectMgr
QuestAreaTriggerContainer _questAreaTriggerStore;
TavernAreaTriggerContainer _tavernAreaTriggerStore;
GameObjectForQuestContainer _gameObjectForQuestStore;
GossipTextContainer _gossipTextStore;
NpcTextContainer _npcTextStore;
QuestGreetingContainer _questGreetingStore;
AreaTriggerContainer _areaTriggerStore;
AreaTriggerScriptContainer _areaTriggerScriptStore;
AccessRequirementContainer _accessRequirementStore;
@@ -1444,7 +1452,6 @@ class ObjectMgr
ItemTemplateContainer _itemTemplateStore;
QuestTemplateLocaleContainer _questTemplateLocaleStore;
QuestObjectivesLocaleContainer _questObjectivesLocaleStore;
NpcTextLocaleContainer _npcTextLocaleStore;
PageTextLocaleContainer _pageTextLocaleStore;
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore;
PointOfInterestLocaleContainer _pointOfInterestLocaleStore;
+5 -24
View File
@@ -19,29 +19,17 @@
#ifndef __NPCHANDLER_H
#define __NPCHANDLER_H
struct QEmote
struct NpcTextData
{
uint32 _Emote;
uint32 _Delay;
};
#define MAX_GOSSIP_TEXT_EMOTES 3
struct GossipTextOption
{
std::string Text_0;
std::string Text_1;
uint32 BroadcastTextID;
uint32 Language;
float Probability;
QEmote Emotes[MAX_GOSSIP_TEXT_EMOTES];
uint32 BroadcastTextID;
};
#define MAX_GOSSIP_TEXT_OPTIONS 8
#define MAX_NPC_TEXT_OPTIONS 8
struct GossipText
struct NpcText
{
GossipTextOption Options[MAX_GOSSIP_TEXT_OPTIONS];
NpcTextData Data[MAX_NPC_TEXT_OPTIONS];
};
struct PageTextLocale
@@ -49,12 +37,5 @@ struct PageTextLocale
StringVector Text;
};
struct NpcTextLocale
{
NpcTextLocale() { }
StringVector Text_0[MAX_GOSSIP_TEXT_OPTIONS];
StringVector Text_1[MAX_GOSSIP_TEXT_OPTIONS];
};
#endif
+12 -13
View File
@@ -203,29 +203,28 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPackets::Query::QueryNPCText& p
{
TC_LOG_DEBUG("network", "WORLD: CMSG_NPC_TEXT_QUERY TextId: %u", packet.TextID);
GossipText const* gossip = sObjectMgr->GetGossipText(packet.TextID);
NpcText const* npcText = sObjectMgr->GetNpcText(packet.TextID);
WorldPackets::Query::QueryNPCTextResponse response;
response.TextID = packet.TextID;
bool hasText = false;
if (gossip)
if (npcText)
{
for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
for (uint8 i = 0; i < MAX_NPC_TEXT_OPTIONS; ++i)
{
response.Probabilities[i] = gossip->Options[i].Probability;
response.BroadcastTextID[i] = gossip->Options[i].BroadcastTextID;
if (!hasText && gossip->Options[i].BroadcastTextID)
hasText = true;
response.Probabilities[i] = npcText->Data[i].Probability;
response.BroadcastTextID[i] = npcText->Data[i].BroadcastTextID;
if (!response.Allow && npcText->Data[i].BroadcastTextID)
response.Allow = true;
}
response.Allow = true;
}
if (hasText)
SendPacket(response.Write());
else
if (!response.Allow)
TC_LOG_ERROR("sql.sql", "HandleNpcTextQueryOpcode: no BroadcastTextID found for text %u in `npc_text table`", packet.TextID);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_NPC_TEXT_UPDATE");
SendPacket(response.Write());
}
/// Only _static_ data is sent in this packet !!!
@@ -227,10 +227,10 @@ WorldPacket const* WorldPackets::Query::QueryNPCTextResponse::Write()
if (Allow)
{
_worldPacket << int32(MAX_GOSSIP_TEXT_OPTIONS * (4 + 4));
for (uint32 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
_worldPacket << int32(MAX_NPC_TEXT_OPTIONS * (4 + 4));
for (uint32 i = 0; i < MAX_NPC_TEXT_OPTIONS; ++i)
_worldPacket << Probabilities[i];
for (uint32 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
for (uint32 i = 0; i < MAX_NPC_TEXT_OPTIONS; ++i)
_worldPacket << BroadcastTextID[i];
}
@@ -168,8 +168,8 @@ namespace WorldPackets
uint32 TextID = 0;
bool Allow = false;
float Probabilities[MAX_GOSSIP_TEXT_OPTIONS];
uint32 BroadcastTextID[MAX_GOSSIP_TEXT_OPTIONS];
float Probabilities[MAX_NPC_TEXT_OPTIONS];
uint32 BroadcastTextID[MAX_NPC_TEXT_OPTIONS];
};
class DBQueryBulk final : public ClientPacket
@@ -37,4 +37,4 @@ WorldPacket const* WorldPackets::Token::UpdateListedAuctionableTokensResponse::W
}
return &_worldPacket;
}
}
+2 -2
View File
@@ -1508,7 +1508,7 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadGameObjectLocales();
sObjectMgr->LoadQuestTemplateLocale();
sObjectMgr->LoadQuestObjectivesLocale();
sObjectMgr->LoadNpcTextLocales();
sObjectMgr->LoadQuestGreetings();
sObjectMgr->LoadPageTextLocales();
sObjectMgr->LoadGossipMenuItemsLocales();
sObjectMgr->LoadPointOfInterestLocales();
@@ -1556,7 +1556,7 @@ void World::SetInitialWorldSettings()
sSpellMgr->LoadSpellGroupStackRules();
TC_LOG_INFO("server.loading", "Loading NPC Texts...");
sObjectMgr->LoadGossipText();
sObjectMgr->LoadNPCText();
TC_LOG_INFO("server.loading", "Loading Enchant Spells Proc datas...");
sSpellMgr->LoadSpellEnchantProcData();
+10 -10
View File
@@ -106,7 +106,6 @@ public:
{ "locales_creature_text", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_CRETURE_TEXT, true, &HandleReloadLocalesCreatureTextCommand, "", NULL },
{ "locales_gameobject", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_GAMEOBJECT, true, &HandleReloadLocalesGameobjectCommand, "", NULL },
{ "locales_gossip_menu_option", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_GOSSIP_MENU_OPTION, true, &HandleReloadLocalesGossipMenuOptionCommand, "", NULL },
{ "locales_npc_text", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_NPC_TEXT, true, &HandleReloadLocalesNpcTextCommand, "", NULL },
{ "locales_page_text", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_PAGE_TEXT, true, &HandleReloadLocalesPageTextCommand, "", NULL },
{ "locales_points_of_interest", rbac::RBAC_PERM_COMMAND_RELOAD_LOCALES_POINTS_OF_INTEREST, true, &HandleReloadLocalesPointsOfInterestCommand, "", NULL },
{ "mail_level_reward", rbac::RBAC_PERM_COMMAND_RELOAD_MAIL_LEVEL_REWARD, true, &HandleReloadMailLevelRewardCommand, "", NULL },
@@ -119,6 +118,7 @@ public:
{ "pickpocketing_loot_template", rbac::RBAC_PERM_COMMAND_RELOAD_PICKPOCKETING_LOOT_TEMPLATE, true, &HandleReloadLootTemplatesPickpocketingCommand, "", NULL },
{ "points_of_interest", rbac::RBAC_PERM_COMMAND_RELOAD_POINTS_OF_INTEREST, true, &HandleReloadPointsOfInterestCommand, "", NULL },
{ "prospecting_loot_template", rbac::RBAC_PERM_COMMAND_RELOAD_PROSPECTING_LOOT_TEMPLATE, true, &HandleReloadLootTemplatesProspectingCommand, "", NULL },
{ "quest_greeting", rbac::RBAC_PERM_COMMAND_RELOAD_QUEST_GREETING, true, &HandleReloadQuestGreetingCommand, "", NULL },
{ "quest_locale", rbac::RBAC_PERM_COMMAND_RELOAD_QUEST_LOCALE, true, &HandleReloadQuestLocaleCommand, "", NULL },
{ "quest_poi", rbac::RBAC_PERM_COMMAND_RELOAD_QUEST_POI, true, &HandleReloadQuestPOICommand, "", NULL },
{ "quest_template", rbac::RBAC_PERM_COMMAND_RELOAD_QUEST_TEMPLATE, true, &HandleReloadQuestTemplateCommand, "", NULL },
@@ -243,6 +243,7 @@ public:
static bool HandleReloadAllQuestCommand(ChatHandler* handler, const char* /*args*/)
{
HandleReloadQuestAreaTriggersCommand(handler, "a");
HandleReloadQuestGreetingCommand(handler, "a");
HandleReloadQuestPOICommand(handler, "a");
HandleReloadQuestTemplateCommand(handler, "a");
@@ -311,7 +312,6 @@ public:
HandleReloadLocalesCreatureTextCommand(handler, "a");
HandleReloadLocalesGameobjectCommand(handler, "a");
HandleReloadLocalesGossipMenuOptionCommand(handler, "a");
HandleReloadLocalesNpcTextCommand(handler, "a");
HandleReloadLocalesPageTextCommand(handler, "a");
HandleReloadLocalesPointsOfInterestCommand(handler, "a");
HandleReloadQuestLocaleCommand(handler, "a");
@@ -511,6 +511,14 @@ public:
return true;
}
static bool HandleReloadQuestGreetingCommand(ChatHandler* handler, const char* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Quest Greeting ... ");
sObjectMgr->LoadQuestGreetings();
handler->SendGlobalGMSysMessage("DB table `quest_greeting` reloaded.");
return true;
}
static bool HandleReloadQuestTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Quest Templates...");
@@ -1011,14 +1019,6 @@ public:
return true;
}
static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Locales NPC Text ... ");
sObjectMgr->LoadNpcTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded.");
return true;
}
static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Locales Page Text ... ");