Core/DB: Update all locales to actual TrinityCore (#1160)

* Core/Misc Update all locales table structure to simple system. Port from TrinityCore
Co-Authored-By: Winfidonarleyan <dowlandtop@yandex.com>
* Core/Db/Gossip Update structure gossip_menu and gossip_menu_action to actual TrinityCore
* Core/DB Update Broadcast system to actual TC
* Core/Mail: implement Quest Mail Sender
* Core/Quest Split quest template locales
This commit is contained in:
Kargatum
2019-01-13 05:56:06 +07:00
committed by Viste(Кирилл)
parent 76772e434d
commit b34bc28e5b
26 changed files with 59397 additions and 525 deletions
File diff suppressed because it is too large Load Diff
@@ -15,7 +15,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PrepareStatement(WORLD_SEL_QUEST_POOLS, "SELECT entry, pool_entry FROM pool_quest", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_QUEST_POOLS, "SELECT entry, pool_entry FROM pool_quest", CONNECTION_SYNCH);
PrepareStatement(WORLD_DEL_CRELINKED_RESPAWN, "DELETE FROM linked_respawn WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_CRELINKED_RESPAWN, "DELETE FROM linked_respawn WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_REP_CREATURE_LINKED_RESPAWN, "REPLACE INTO linked_respawn (guid, linkedGuid) VALUES (?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_REP_CREATURE_LINKED_RESPAWN, "REPLACE INTO linked_respawn (guid, linkedGuid) VALUES (?, ?)", CONNECTION_ASYNC);
PrepareStatement(WORLD_SEL_CREATURE_TEXT, "SELECT entry, groupid, id, text, type, language, probability, emote, duration, sound, BroadcastTextID, TextRange FROM creature_text", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_TEXT, "SELECT CreatureID, GroupID, ID, Text, Type, Language, Probability, Emote, Duration, Sound, BroadcastTextId, TextRange FROM creature_text", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_SMART_SCRIPTS, "SELECT entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o FROM smart_scripts ORDER BY entryorguid, source_type, id, link", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_SMART_SCRIPTS, "SELECT entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o FROM smart_scripts ORDER BY entryorguid, source_type, id, link", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_SMARTAI_WP, "SELECT entry, pointid, position_x, position_y, position_z FROM waypoints ORDER BY entry, pointid", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_SMARTAI_WP, "SELECT entry, pointid, position_x, position_y, position_z FROM waypoints ORDER BY entry, pointid", CONNECTION_SYNCH);
PrepareStatement(WORLD_DEL_GAMEOBJECT, "DELETE FROM gameobject WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAMEOBJECT, "DELETE FROM gameobject WHERE guid = ?", CONNECTION_ASYNC);
+17 -15
View File
@@ -2878,13 +2878,12 @@ void AchievementGlobalMgr::LoadRewardLocales()
m_achievementRewardLocales.clear(); // need for reload case m_achievementRewardLocales.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, subject_loc1, text_loc1, subject_loc2, text_loc2, subject_loc3, text_loc3, subject_loc4, text_loc4, " // 0 1 2 3
"subject_loc5, text_loc5, subject_loc6, text_loc6, subject_loc7, text_loc7, subject_loc8, text_loc8" QueryResult result = WorldDatabase.Query("SELECT ID, Locale, Subject, Text FROM achievement_reward_locale");
" FROM locales_achievement_reward");
if (!result) if (!result)
{ {
sLog->outString(">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); sLog->outErrorDb(">> Loaded 0 achievement reward locale strings. DB table `achievement_reward_locale` is empty");
sLog->outString(); sLog->outString();
return; return;
} }
@@ -2893,24 +2892,27 @@ void AchievementGlobalMgr::LoadRewardLocales()
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32(); uint32 ID = fields[0].GetUInt32();
std::string LocaleName = fields[1].GetString();
std::string Subject = fields[2].GetString();
std::string Text = fields[3].GetString();
if (m_achievementRewards.find(entry) == m_achievementRewards.end()) if (m_achievementRewards.find(ID) == m_achievementRewards.end())
{ {
sLog->outErrorDb("Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry); sLog->outErrorDb("Table `achievement_reward_locale` (Entry: %u) has locale strings for non-existing achievement reward.", ID);
continue; continue;
} }
AchievementRewardLocale& data = m_achievementRewardLocales[entry]; AchievementRewardLocale& data = m_achievementRewardLocales[ID];
LocaleConstant locale = GetLocaleByName(LocaleName);
if (locale == LOCALE_enUS)
continue;
ObjectMgr::AddLocaleString(Subject, locale, data.Subject);
ObjectMgr::AddLocaleString(Text, locale, data.Text);
for (int i = 1; i < TOTAL_LOCALES; ++i)
{
LocaleConstant locale = (LocaleConstant) i;
ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.subject);
ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1) + 1].GetString(), locale, data.text);
}
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %lu Achievement Reward Locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString(); sLog->outString();
} }
@@ -232,8 +232,8 @@ typedef std::map<uint32, AchievementReward> AchievementRewards;
struct AchievementRewardLocale struct AchievementRewardLocale
{ {
StringVector subject; StringVector Subject;
StringVector text; StringVector Text;
}; };
typedef std::map<uint32, AchievementRewardLocale> AchievementRewardLocales; typedef std::map<uint32, AchievementRewardLocale> AchievementRewardLocales;
+10 -10
View File
@@ -41,7 +41,7 @@ namespace Trinity
class BattlegroundChatBuilder class BattlegroundChatBuilder
{ {
public: public:
BattlegroundChatBuilder(ChatMsg msgtype, int32 textId, Player const* source, va_list* args = NULL) BattlegroundChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, va_list* args = NULL)
: _msgtype(msgtype), _textId(textId), _source(source), _args(args) { } : _msgtype(msgtype), _textId(textId), _source(source), _args(args) { }
void operator()(WorldPacket& data, LocaleConstant loc_idx) void operator()(WorldPacket& data, LocaleConstant loc_idx)
@@ -70,7 +70,7 @@ namespace Trinity
} }
ChatMsg _msgtype; ChatMsg _msgtype;
int32 _textId; uint32 _textId;
Player const* _source; Player const* _source;
va_list* _args; va_list* _args;
}; };
@@ -78,7 +78,7 @@ namespace Trinity
class Battleground2ChatBuilder class Battleground2ChatBuilder
{ {
public: public:
Battleground2ChatBuilder(ChatMsg msgtype, int32 textId, Player const* source, int32 arg1, int32 arg2) Battleground2ChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, int32 arg1, int32 arg2)
: _msgtype(msgtype), _textId(textId), _source(source), _arg1(arg1), _arg2(arg2) {} : _msgtype(msgtype), _textId(textId), _source(source), _arg1(arg1), _arg2(arg2) {}
void operator()(WorldPacket& data, LocaleConstant loc_idx) void operator()(WorldPacket& data, LocaleConstant loc_idx)
@@ -95,10 +95,10 @@ namespace Trinity
private: private:
ChatMsg _msgtype; ChatMsg _msgtype;
int32 _textId; uint32 _textId;
Player const* _source; Player const* _source;
int32 _arg1; uint32 _arg1;
int32 _arg2; uint32 _arg2;
}; };
} // namespace Trinity } // namespace Trinity
@@ -1693,7 +1693,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
return false; return false;
} }
void Battleground::SendMessageToAll(int32 entry, ChatMsg type, Player const* source) void Battleground::SendMessageToAll(uint32 entry, ChatMsg type, Player const* source)
{ {
if (!entry) if (!entry)
return; return;
@@ -1703,7 +1703,7 @@ void Battleground::SendMessageToAll(int32 entry, ChatMsg type, Player const* sou
BroadcastWorker(bg_do); BroadcastWorker(bg_do);
} }
void Battleground::PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ...) void Battleground::PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...)
{ {
if (!entry) if (!entry)
return; return;
@@ -1718,7 +1718,7 @@ void Battleground::PSendMessageToAll(int32 entry, ChatMsg type, Player const* so
va_end(ap); va_end(ap);
} }
void Battleground::SendWarningToAll(int32 entry, ...) void Battleground::SendWarningToAll(uint32 entry, ...)
{ {
if (!entry) if (!entry)
return; return;
@@ -1743,7 +1743,7 @@ void Battleground::SendWarningToAll(int32 entry, ...)
} }
} }
void Battleground::SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 arg1, int32 arg2) void Battleground::SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 arg1, uint32 arg2)
{ {
Trinity::Battleground2ChatBuilder bg_builder(type, entry, source, arg1, arg2); Trinity::Battleground2ChatBuilder bg_builder(type, entry, source, arg1, arg2);
Trinity::LocalizedPacketDo<Trinity::Battleground2ChatBuilder> bg_do(bg_builder); Trinity::LocalizedPacketDo<Trinity::Battleground2ChatBuilder> bg_do(bg_builder);
+4 -4
View File
@@ -488,12 +488,12 @@ class Battleground
void EndBattleground(TeamId winnerTeamId); void EndBattleground(TeamId winnerTeamId);
void BlockMovement(Player* player); void BlockMovement(Player* player);
void SendWarningToAll(int32 entry, ...); void SendWarningToAll(uint32 entry, ...);
void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL); void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = NULL);
void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ...); void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...);
// specialized version with 2 string id args // specialized version with 2 string id args
void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0); void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 strId1 = 0, uint32 strId2 = 0);
// Raid Group // Raid Group
Group* GetBgRaid(TeamId teamId) const { return m_BgRaids[teamId]; } Group* GetBgRaid(TeamId teamId) const { return m_BgRaids[teamId]; }
+5 -5
View File
@@ -59,7 +59,7 @@ std::vector<ChatCommand> const& ChatHandler::getCommandTable()
return commandTableCache; return commandTableCache;
} }
std::string ChatHandler::PGetParseString(int32 entry, ...) const std::string ChatHandler::PGetParseString(uint32 entry, ...) const
{ {
const char *format = GetTrinityString(entry); const char *format = GetTrinityString(entry);
char str[1024]; char str[1024];
@@ -70,7 +70,7 @@ std::string ChatHandler::PGetParseString(int32 entry, ...) const
return std::string(str); return std::string(str);
} }
const char *ChatHandler::GetTrinityString(int32 entry) const char const* ChatHandler::GetTrinityString(uint32 entry) const
{ {
return m_session->GetTrinityString(entry); return m_session->GetTrinityString(entry);
} }
@@ -209,12 +209,12 @@ void ChatHandler::SendGlobalGMSysMessage(const char *str)
free(buf); free(buf);
} }
void ChatHandler::SendSysMessage(int32 entry) void ChatHandler::SendSysMessage(uint32 entry)
{ {
SendSysMessage(GetTrinityString(entry)); SendSysMessage(GetTrinityString(entry));
} }
void ChatHandler::PSendSysMessage(int32 entry, ...) void ChatHandler::PSendSysMessage(uint32 entry, ...)
{ {
const char *format = GetTrinityString(entry); const char *format = GetTrinityString(entry);
va_list ap; va_list ap;
@@ -1217,7 +1217,7 @@ std::string ChatHandler::GetNameLink(Player* chr) const
return playerLink(chr->GetName()); return playerLink(chr->GetName());
} }
const char *CliHandler::GetTrinityString(int32 entry) const char const* CliHandler::GetTrinityString(uint32 entry) const
{ {
return sObjectMgr->GetTrinityStringForDBCLocale(entry); return sObjectMgr->GetTrinityStringForDBCLocale(entry);
} }
+13 -13
View File
@@ -56,13 +56,13 @@ class ChatHandler
static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = NULL; return start; } static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = NULL; return start; }
// function with different implementation for chat/console // function with different implementation for chat/console
virtual const char *GetTrinityString(int32 entry) const; virtual char const* GetTrinityString(uint32 entry) const;
virtual void SendSysMessage(const char *str); virtual void SendSysMessage(char const* str);
void SendSysMessage(int32 entry); void SendSysMessage(uint32 entry);
void PSendSysMessage(const char *format, ...) ATTR_PRINTF(2, 3); void PSendSysMessage(char const* format, ...) ATTR_PRINTF(2, 3);
void PSendSysMessage(int32 entry, ...); void PSendSysMessage(uint32 entry, ...);
std::string PGetParseString(int32 entry, ...) const; std::string PGetParseString(uint32 entry, ...) const;
bool ParseCommands(const char* text); bool ParseCommands(const char* text);
@@ -139,13 +139,13 @@ class CliHandler : public ChatHandler
explicit CliHandler(void* callbackArg, Print* zprint) : m_callbackArg(callbackArg), m_print(zprint) {} explicit CliHandler(void* callbackArg, Print* zprint) : m_callbackArg(callbackArg), m_print(zprint) {}
// overwrite functions // overwrite functions
const char *GetTrinityString(int32 entry) const; char const* GetTrinityString(uint32 entry) const override;
bool isAvailable(ChatCommand const& cmd) const; bool isAvailable(ChatCommand const& cmd) const override;
void SendSysMessage(const char *str); void SendSysMessage(const char *str) override;
std::string GetNameLink() const; std::string GetNameLink() const override;
bool needReportToTarget(Player* chr) const; bool needReportToTarget(Player* chr) const override;
LocaleConstant GetSessionDbcLocale() const; LocaleConstant GetSessionDbcLocale() const override;
int GetSessionDbLocaleIndex() const; int GetSessionDbLocaleIndex() const override;
private: private:
void* m_callbackArg; void* m_callbackArg;
+3 -3
View File
@@ -1117,9 +1117,9 @@ bool ConditionMgr::addToGossipMenus(Condition* cond)
{ {
for (GossipMenusContainer::iterator itr = pMenuBounds.first; itr != pMenuBounds.second; ++itr) for (GossipMenusContainer::iterator itr = pMenuBounds.first; itr != pMenuBounds.second; ++itr)
{ {
if ((*itr).second.entry == cond->SourceGroup && (*itr).second.text_id == uint32(cond->SourceEntry)) if ((*itr).second.MenuID == cond->SourceGroup && (*itr).second.TextID == uint32(cond->SourceEntry))
{ {
(*itr).second.conditions.push_back(cond); (*itr).second.Conditions.push_back(cond);
return true; return true;
} }
} }
@@ -1136,7 +1136,7 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond)
{ {
for (GossipMenuItemsContainer::iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) for (GossipMenuItemsContainer::iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr)
{ {
if ((*itr).second.MenuId == cond->SourceGroup && (*itr).second.OptionIndex == uint32(cond->SourceEntry)) if ((*itr).second.MenuID == cond->SourceGroup && (*itr).second.OptionID == uint32(cond->SourceEntry))
{ {
(*itr).second.Conditions.push_back(cond); (*itr).second.Conditions.push_back(cond);
return true; return true;
+37 -16
View File
@@ -75,23 +75,44 @@ void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, ui
for (GossipMenuItemsContainer::const_iterator itr = bounds.first; itr != bounds.second; ++itr) for (GossipMenuItemsContainer::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
{ {
/// Find the one with the given menu item id. /// Find the one with the given menu item id.
if (itr->second.OptionIndex != menuItemId) if (itr->second.OptionID != menuItemId)
continue; continue;
/// Store texts for localization. /// Store texts for localization.
std::string strOptionText = itr->second.OptionText; std::string strOptionText, strBoxText;
std::string strBoxText = itr->second.BoxText; BroadcastText const* optionBroadcastText = sObjectMgr->GetBroadcastText(itr->second.OptionBroadcastTextID);
BroadcastText const* boxBroadcastText = sObjectMgr->GetBroadcastText(itr->second.BoxBroadcastTextID);
/// OptionText
if (optionBroadcastText)
ObjectMgr::GetLocaleString(optionBroadcastText->MaleText, GetLocale(), strOptionText);
else
strOptionText = itr->second.OptionText;
/// BoxText
if (boxBroadcastText)
ObjectMgr::GetLocaleString(boxBroadcastText->MaleText, GetLocale(), strBoxText);
else
strBoxText = itr->second.BoxText;
/// Check need of localization. /// Check need of localization.
if (GetLocale() != DEFAULT_LOCALE) if (GetLocale() != DEFAULT_LOCALE)
/// Find localizations from database. {
if (GossipMenuItemsLocale const* no = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, menuItemId))) if (!optionBroadcastText)
{ {
/// Translate texts if there are any. /// Find localizations from database.
ObjectMgr::GetLocaleString(no->OptionText, GetLocale(), strOptionText); if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, menuItemId)))
ObjectMgr::GetLocaleString(no->BoxText, GetLocale(), strBoxText); ObjectMgr::GetLocaleString(gossipMenuLocale->OptionText, GetLocale(), strOptionText);
} }
if (!boxBroadcastText)
{
/// Find localizations from database.
if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, menuItemId)))
ObjectMgr::GetLocaleString(gossipMenuLocale->BoxText, GetLocale(), strBoxText);
}
}
/// Add menu item with existing method. Menu item id -1 is also used in ADD_GOSSIP_ITEM macro. /// 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, itr->second.BoxMoney, itr->second.BoxCoded);
} }
@@ -588,23 +609,23 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const
{ {
std::string questTitle = quest->GetTitle(); std::string questTitle = quest->GetTitle();
std::string questOfferRewardText = quest->GetOfferRewardText(); std::string RewardText = quest->GetOfferRewardText();
int32 locale = _session->GetSessionDbLocaleIndex(); int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0) if (locale >= 0)
{ {
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle);
ObjectMgr::GetLocaleString(localeData->OfferRewardText, locale, questOfferRewardText);
} if (QuestOfferRewardLocale const* questOfferRewardLocale = sObjectMgr->GetQuestOfferRewardLocale(quest->GetQuestId()))
ObjectMgr::GetLocaleString(questOfferRewardLocale->RewardText, locale, RewardText);
} }
WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 400); // guess size WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 400); // guess size
data << uint64(npcGUID); data << uint64(npcGUID);
data << uint32(quest->GetQuestId()); data << uint32(quest->GetQuestId());
data << questTitle; data << questTitle;
data << questOfferRewardText; data << RewardText;
data << uint8(enableNext ? 1 : 0); // Auto Finish data << uint8(enableNext ? 1 : 0); // Auto Finish
data << uint32(quest->GetFlags()); // 3.3.3 questFlags data << uint32(quest->GetFlags()); // 3.3.3 questFlags
@@ -690,10 +711,10 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
if (locale >= 0) if (locale >= 0)
{ {
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle);
ObjectMgr::GetLocaleString(localeData->RequestItemsText, locale, requestItemsText);
} if (QuestRequestItemsLocale const* questRequestItemsLocale = sObjectMgr->GetQuestRequestItemsLocale(quest->GetQuestId()))
ObjectMgr::GetLocaleString(questRequestItemsLocale->CompletionText, locale, requestItemsText);
} }
if (!quest->GetReqItemsCount() && canComplete) if (!quest->GetReqItemsCount() && canComplete)
+20 -4
View File
@@ -1849,8 +1849,17 @@ namespace Trinity
: i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(Language(language)), i_target(target) { } : i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(Language(language)), i_target(target) { }
void operator()(WorldPacket& data, LocaleConstant loc_idx) void operator()(WorldPacket& data, LocaleConstant loc_idx)
{ {
char const* text = sObjectMgr->GetTrinityString(i_textId, loc_idx); if (BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(i_textId))
ChatHandler::BuildChatPacket(data, i_msgtype, i_language, i_object, i_target, text, 0, "", loc_idx); {
uint8 gender = GENDER_MALE;
if (Unit const* unit = i_object->ToUnit())
gender = unit->getGender();
std::string text = broadcastText->GetText(loc_idx, gender);
ChatHandler::BuildChatPacket(data, i_msgtype, i_language, i_object, i_target, text, 0, "", loc_idx);
}
else
sLog->outError("MonsterChatBuilder: `broadcast_text` id %i missing", i_textId);
} }
private: private:
@@ -1975,10 +1984,17 @@ void WorldObject::MonsterWhisper(int32 textId, Player const* target, bool IsBoss
if (!target) if (!target)
return; return;
uint8 gender = GENDER_MALE;
if (Unit const* unit = ToUnit())
gender = unit->getGender();
LocaleConstant loc_idx = target->GetSession()->GetSessionDbLocaleIndex(); LocaleConstant loc_idx = target->GetSession()->GetSessionDbLocaleIndex();
char const* text = sObjectMgr->GetTrinityString(textId, loc_idx);
BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(textId);
std::string text = broadcastText->GetText(loc_idx, gender);
WorldPacket data; WorldPacket data;
ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, text, 0, "", loc_idx); ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, text.c_str(), 0, "", loc_idx);
target->GetSession()->SendPacket(&data); target->GetSession()->SendPacket(&data);
} }
+36 -15
View File
@@ -14818,7 +14818,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
if (Creature* creature = source->ToCreature()) if (Creature* creature = source->ToCreature())
{ {
if (!(itr->second.OptionNpcflag & npcflags)) if (!(itr->second.OptionNpcFlag & npcflags))
continue; continue;
switch (itr->second.OptionType) switch (itr->second.OptionType)
@@ -14881,7 +14881,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
canTalk = false; canTalk = false;
break; break;
default: default:
sLog->outErrorDb("Creature entry %u has unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId); sLog->outErrorDb("Creature entry %u has unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuID);
canTalk = false; canTalk = false;
break; break;
} }
@@ -14902,22 +14902,40 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
if (canTalk) if (canTalk)
{ {
std::string strOptionText = itr->second.OptionText; std::string strOptionText, strBoxText;
std::string strBoxText = itr->second.BoxText; BroadcastText const* optionBroadcastText = sObjectMgr->GetBroadcastText(itr->second.OptionBroadcastTextID);
BroadcastText const* boxBroadcastText = sObjectMgr->GetBroadcastText(itr->second.BoxBroadcastTextID);
LocaleConstant locale = GetSession()->GetSessionDbLocaleIndex();
int32 locale = GetSession()->GetSessionDbLocaleIndex(); if (optionBroadcastText)
if (locale >= 0) ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? optionBroadcastText->MaleText : optionBroadcastText->FemaleText, locale, strOptionText);
else
strOptionText = itr->second.OptionText;
if (boxBroadcastText)
ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? boxBroadcastText->MaleText : boxBroadcastText->FemaleText, locale, strBoxText);
else
strBoxText = itr->second.BoxText;
if (locale != DEFAULT_LOCALE)
{ {
uint32 idxEntry = MAKE_PAIR32(menuId, itr->second.OptionIndex); if (!optionBroadcastText)
if (GossipMenuItemsLocale const* no = sObjectMgr->GetGossipMenuItemsLocale(idxEntry))
{ {
ObjectMgr::GetLocaleString(no->OptionText, locale, strOptionText); /// Find localizations from database.
ObjectMgr::GetLocaleString(no->BoxText, locale, strBoxText); if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, menuId)))
ObjectMgr::GetLocaleString(gossipMenuLocale->OptionText, locale, strOptionText);
}
if (!boxBroadcastText)
{
/// Find localizations from database.
if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, menuId)))
ObjectMgr::GetLocaleString(gossipMenuLocale->BoxText, locale, strBoxText);
} }
} }
menu->GetGossipMenu().AddMenuItem(itr->second.OptionIndex, itr->second.OptionIcon, strOptionText, 0, itr->second.OptionType, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded); menu->GetGossipMenu().AddMenuItem(itr->second.OptionID, 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); menu->GetGossipMenu().AddGossipMenuItemData(itr->second.OptionID, itr->second.ActionMenuID, itr->second.ActionPoiID);
} }
} }
} }
@@ -15111,8 +15129,8 @@ uint32 Player::GetGossipTextId(uint32 menuId, WorldObject* source)
for (GossipMenusContainer::const_iterator itr = menuBounds.first; itr != menuBounds.second; ++itr) for (GossipMenusContainer::const_iterator itr = menuBounds.first; itr != menuBounds.second; ++itr)
{ {
if (sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.conditions)) if (sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.Conditions))
textId = itr->second.text_id; textId = itr->second.TextID;
} }
return textId; return textId;
@@ -15887,7 +15905,10 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
{ {
//- TODO: Poor design of mail system //- TODO: Poor design of mail system
SQLTransaction trans = CharacterDatabase.BeginTransaction(); SQLTransaction trans = CharacterDatabase.BeginTransaction();
MailDraft(mail_template_id).SendMailTo(trans, this, questGiver, MAIL_CHECK_MASK_HAS_BODY, quest->GetRewMailDelaySecs()); if (quest->GetRewMailSenderEntry() != 0)
MailDraft(mail_template_id).SendMailTo(trans, this, quest->GetRewMailSenderEntry(), MAIL_CHECK_MASK_HAS_BODY, quest->GetRewMailDelaySecs());
else
MailDraft(mail_template_id).SendMailTo(trans, this, questGiver, MAIL_CHECK_MASK_HAS_BODY, quest->GetRewMailDelaySecs());
CharacterDatabase.CommitTransaction(trans); CharacterDatabase.CommitTransaction(trans);
} }
+296 -334
View File
@@ -305,24 +305,22 @@ void ObjectMgr::LoadCreatureLocales()
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 id = fields[0].GetUInt32(); uint32 ID = fields[0].GetUInt32();
std::string localeName = fields[1].GetString(); std::string LocaleName = fields[1].GetString();
std::string Name = fields[2].GetString();
std::string Title = fields[3].GetString();
std::string name = fields[2].GetString(); CreatureLocale& data = _creatureLocaleStore[ID];
std::string title = fields[3].GetString(); LocaleConstant locale = GetLocaleByName(LocaleName);
CreatureLocale& data = _creatureLocaleStore[id];
LocaleConstant locale = GetLocaleByName(localeName);
if (locale == LOCALE_enUS) if (locale == LOCALE_enUS)
continue; continue;
AddLocaleString(name, locale, data.Name); AddLocaleString(Name, locale, data.Name);
AddLocaleString(title, locale, data.Title); AddLocaleString(Title, locale, data.Title);
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %lu Сreature Locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
} }
void ObjectMgr::LoadGossipMenuItemsLocales() void ObjectMgr::LoadGossipMenuItemsLocales()
@@ -331,12 +329,8 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
_gossipMenuItemsLocaleStore.clear(); // need for reload case _gossipMenuItemsLocaleStore.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT menu_id, id, " // 0 1 2 3 4
"option_text_loc1, box_text_loc1, option_text_loc2, box_text_loc2, " QueryResult result = WorldDatabase.Query("SELECT MenuID, OptionID, Locale, OptionText, BoxText FROM gossip_menu_option_locale");
"option_text_loc3, box_text_loc3, option_text_loc4, box_text_loc4, "
"option_text_loc5, box_text_loc5, option_text_loc6, box_text_loc6, "
"option_text_loc7, box_text_loc7, option_text_loc8, box_text_loc8 "
"FROM locales_gossip_menu_option");
if (!result) if (!result)
return; return;
@@ -345,21 +339,23 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint16 menuId = fields[0].GetUInt16(); uint16 MenuID = fields[0].GetUInt16();
uint16 id = fields[1].GetUInt16(); uint16 OptionID = fields[1].GetUInt16();
std::string LocaleName = fields[2].GetString();
std::string OptionText = fields[3].GetString();
std::string BoxText = fields[4].GetString();
GossipMenuItemsLocale& data = _gossipMenuItemsLocaleStore[MAKE_PAIR32(menuId, id)]; GossipMenuItemsLocale& data = _gossipMenuItemsLocaleStore[MAKE_PAIR32(MenuID, OptionID)];
LocaleConstant locale = GetLocaleByName(LocaleName);
if (locale == LOCALE_enUS)
continue;
AddLocaleString(OptionText, locale, data.OptionText);
AddLocaleString(BoxText, locale, data.BoxText);
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
{
LocaleConstant locale = (LocaleConstant) i;
AddLocaleString(fields[2 + 2 * (i - 1)].GetString(), locale, data.OptionText);
AddLocaleString(fields[2 + 2 * (i - 1) + 1].GetString(), locale, data.BoxText);
}
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u Gossip Menu Option Locale strings in %u ms", (uint32)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
} }
void ObjectMgr::LoadPointOfInterestLocales() void ObjectMgr::LoadPointOfInterestLocales()
@@ -368,7 +364,8 @@ void ObjectMgr::LoadPointOfInterestLocales()
_pointOfInterestLocaleStore.clear(); // need for reload case _pointOfInterestLocaleStore.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, icon_name_loc1, icon_name_loc2, icon_name_loc3, icon_name_loc4, icon_name_loc5, icon_name_loc6, icon_name_loc7, icon_name_loc8 FROM locales_points_of_interest"); // 0 1 2
QueryResult result = WorldDatabase.Query("SELECT ID, locale, Name FROM points_of_interest_locale");
if (!result) if (!result)
return; return;
@@ -377,16 +374,20 @@ void ObjectMgr::LoadPointOfInterestLocales()
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32(); uint32 ID = fields[0].GetUInt32();
std::string LocaleName = fields[1].GetString();
std::string Name = fields[2].GetString();
PointOfInterestLocale& data = _pointOfInterestLocaleStore[entry]; PointOfInterestLocale& data = _pointOfInterestLocaleStore[ID];
LocaleConstant locale = GetLocaleByName(LocaleName);
if (locale == LOCALE_enUS)
continue;
AddLocaleString(Name, locale, data.IconName);
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName);
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u Points Of Interest Locale strings in %u ms", (uint32)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
} }
void ObjectMgr::LoadCreatureTemplates() void ObjectMgr::LoadCreatureTemplates()
@@ -2223,8 +2224,7 @@ void ObjectMgr::LoadItemLocales()
_itemLocaleStore.clear(); // need for reload case _itemLocaleStore.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, name_loc1, description_loc1, name_loc2, description_loc2, name_loc3, description_loc3, name_loc4, description_loc4, name_loc5, description_loc5, name_loc6, description_loc6, name_loc7, description_loc7, name_loc8, description_loc8 FROM locales_item"); QueryResult result = WorldDatabase.Query("SELECT ID, locale, Name, Description FROM item_template_locale");
if (!result) if (!result)
return; return;
@@ -2232,20 +2232,22 @@ void ObjectMgr::LoadItemLocales()
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32(); uint32 ID = fields[0].GetUInt32();
std::string LocaleName = fields[1].GetString();
std::string Name = fields[2].GetString();
std::string Description = fields[3].GetString();
ItemLocale& data = _itemLocaleStore[entry]; ItemLocale& data = _itemLocaleStore[ID];
LocaleConstant locale = GetLocaleByName(LocaleName);
if (locale == LOCALE_enUS)
continue;
AddLocaleString(Name, locale, data.Name);
AddLocaleString(Description, locale, data.Description);
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
{
LocaleConstant locale = (LocaleConstant) i;
AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.Name);
AddLocaleString(fields[1 + 2 * (i - 1) + 1].GetString(), locale, data.Description);
}
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u Item Locale strings in %u ms", (uint32)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
} }
void ObjectMgr::LoadItemTemplates() void ObjectMgr::LoadItemTemplates()
@@ -2849,7 +2851,7 @@ void ObjectMgr::LoadItemSetNameLocales()
_itemSetNameLocaleStore.clear(); // need for reload case _itemSetNameLocaleStore.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT `entry`, `name_loc1`, `name_loc2`, `name_loc3`, `name_loc4`, `name_loc5`, `name_loc6`, `name_loc7`, `name_loc8` FROM `locales_item_set_names`"); QueryResult result = WorldDatabase.Query("SELECT ID, locale, Name FROM item_set_names_locale");
if (!result) if (!result)
return; return;
@@ -2858,16 +2860,20 @@ void ObjectMgr::LoadItemSetNameLocales()
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32(); uint32 ID = fields[0].GetUInt32();
std::string LocaleName = fields[1].GetString();
std::string Name = fields[2].GetString();
ItemSetNameLocale& data = _itemSetNameLocaleStore[entry]; ItemSetNameLocale& data = _itemSetNameLocaleStore[ID];
LocaleConstant locale = GetLocaleByName(LocaleName);
if (locale == LOCALE_enUS)
continue;
AddLocaleString(Name, locale, data.Name);
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name);
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u Item Set Name Locale strings in %u ms", uint32(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
} }
void ObjectMgr::LoadItemSetNames() void ObjectMgr::LoadItemSetNames()
@@ -3978,8 +3984,8 @@ void ObjectMgr::LoadQuests()
// Load `quest_template_addon` // Load `quest_template_addon`
// 0 1 2 3 4 5 6 7 8 // 0 1 2 3 4 5 6 7 8
result = WorldDatabase.Query("SELECT ID, MaxLevel, AllowableClasses, SourceSpellID, PrevQuestID, NextQuestID, ExclusiveGroup, RewardMailTemplateID, RewardMailDelay, " result = WorldDatabase.Query("SELECT ID, MaxLevel, AllowableClasses, SourceSpellID, PrevQuestID, NextQuestID, ExclusiveGroup, RewardMailTemplateID, RewardMailDelay, "
//9 10 11 12 13 14 15 16 //9 10 11 12 13 14 15 16 17
"RequiredSkillID, RequiredSkillPoints, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, ProvidedItemCount, SpecialFlags FROM quest_template_addon"); "RequiredSkillID, RequiredSkillPoints, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, ProvidedItemCount, RewardMailSenderEntry, SpecialFlags FROM quest_template_addon LEFT JOIN quest_mail_sender ON Id=QuestId");
if (!result) { if (!result) {
sLog->outError(">> Loaded 0 quest template addons. DB table `quest_template_addon` is empty."); sLog->outError(">> Loaded 0 quest template addons. DB table `quest_template_addon` is empty.");
@@ -4479,6 +4485,7 @@ void ObjectMgr::LoadQuests()
qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId); qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId);
qinfo->RewardMailTemplateId = 0; // no mail will send to player qinfo->RewardMailTemplateId = 0; // no mail will send to player
qinfo->RewardMailDelay = 0; // no mail will send to player qinfo->RewardMailDelay = 0; // no mail will send to player
qinfo->RewardMailSenderEntry = 0;
} }
else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end()) else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end())
{ {
@@ -4487,6 +4494,7 @@ void ObjectMgr::LoadQuests()
qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second); qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second);
qinfo->RewardMailTemplateId = 0; // no mail will send to player qinfo->RewardMailTemplateId = 0; // no mail will send to player
qinfo->RewardMailDelay = 0; // no mail will send to player qinfo->RewardMailDelay = 0; // no mail will send to player
qinfo->RewardMailSenderEntry = 0;
} }
else else
usedMailTemplates[qinfo->RewardMailTemplateId] = qinfo->GetQuestId(); usedMailTemplates[qinfo->RewardMailTemplateId] = qinfo->GetQuestId();
@@ -4581,16 +4589,8 @@ void ObjectMgr::LoadQuestLocales()
_questLocaleStore.clear(); // need for reload case _questLocaleStore.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT Id, " // 0 1 2 3 4 5 6 7 8 9 10
"Title_loc1, Details_loc1, Objectives_loc1, OfferRewardText_loc1, RequestItemsText_loc1, EndText_loc1, CompletedText_loc1, ObjectiveText1_loc1, ObjectiveText2_loc1, ObjectiveText3_loc1, ObjectiveText4_loc1, " QueryResult result = WorldDatabase.Query("SELECT ID, locale, Title, Details, Objectives, EndText, CompletedText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4 FROM quest_template_locale");
"Title_loc2, Details_loc2, Objectives_loc2, OfferRewardText_loc2, RequestItemsText_loc2, EndText_loc2, CompletedText_loc2, ObjectiveText1_loc2, ObjectiveText2_loc2, ObjectiveText3_loc2, ObjectiveText4_loc2, "
"Title_loc3, Details_loc3, Objectives_loc3, OfferRewardText_loc3, RequestItemsText_loc3, EndText_loc3, CompletedText_loc3, ObjectiveText1_loc3, ObjectiveText2_loc3, ObjectiveText3_loc3, ObjectiveText4_loc3, "
"Title_loc4, Details_loc4, Objectives_loc4, OfferRewardText_loc4, RequestItemsText_loc4, EndText_loc4, CompletedText_loc4, ObjectiveText1_loc4, ObjectiveText2_loc4, ObjectiveText3_loc4, ObjectiveText4_loc4, "
"Title_loc5, Details_loc5, Objectives_loc5, OfferRewardText_loc5, RequestItemsText_loc5, EndText_loc5, CompletedText_loc5, ObjectiveText1_loc5, ObjectiveText2_loc5, ObjectiveText3_loc5, ObjectiveText4_loc5, "
"Title_loc6, Details_loc6, Objectives_loc6, OfferRewardText_loc6, RequestItemsText_loc6, EndText_loc6, CompletedText_loc6, ObjectiveText1_loc6, ObjectiveText2_loc6, ObjectiveText3_loc6, ObjectiveText4_loc6, "
"Title_loc7, Details_loc7, Objectives_loc7, OfferRewardText_loc7, RequestItemsText_loc7, EndText_loc7, CompletedText_loc7, ObjectiveText1_loc7, ObjectiveText2_loc7, ObjectiveText3_loc7, ObjectiveText4_loc7, "
"Title_loc8, Details_loc8, Objectives_loc8, OfferRewardText_loc8, RequestItemsText_loc8, EndText_loc8, CompletedText_loc8, ObjectiveText1_loc8, ObjectiveText2_loc8, ObjectiveText3_loc8, ObjectiveText4_loc8"
" FROM locales_quest");
if (!result) if (!result)
return; return;
@@ -4599,29 +4599,26 @@ void ObjectMgr::LoadQuestLocales()
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32(); uint32 ID = fields[0].GetUInt32();
std::string LocaleName = fields[1].GetString();
QuestLocale& data = _questLocaleStore[entry]; QuestLocale& data = _questLocaleStore[ID];
LocaleConstant locale = GetLocaleByName(LocaleName);
if (locale == LOCALE_enUS)
continue;
for (uint8 i = 1; i < TOTAL_LOCALES; ++i) AddLocaleString(fields[2].GetString(), locale, data.Title);
{ AddLocaleString(fields[3].GetString(), locale, data.Details);
LocaleConstant locale = (LocaleConstant) i; AddLocaleString(fields[4].GetString(), locale, data.Objectives);
AddLocaleString(fields[7].GetString(), locale, data.AreaDescription);
AddLocaleString(fields[8].GetString(), locale, data.CompletedText);
AddLocaleString(fields[1 + 11 * (i - 1)].GetString(), locale, data.Title); for (uint8 i = 0; i < 4; ++i)
AddLocaleString(fields[1 + 11 * (i - 1) + 1].GetString(), locale, data.Details); AddLocaleString(fields[i + 7].GetString(), locale, data.ObjectiveText[i]);
AddLocaleString(fields[1 + 11 * (i - 1) + 2].GetString(), locale, data.Objectives);
AddLocaleString(fields[1 + 11 * (i - 1) + 3].GetString(), locale, data.OfferRewardText);
AddLocaleString(fields[1 + 11 * (i - 1) + 4].GetString(), locale, data.RequestItemsText);
AddLocaleString(fields[1 + 11 * (i - 1) + 5].GetString(), locale, data.AreaDescription);
AddLocaleString(fields[1 + 11 * (i - 1) + 6].GetString(), locale, data.CompletedText);
for (uint8 k = 0; k < 4; ++k)
AddLocaleString(fields[1 + 11 * (i - 1) + 7 + k].GetString(), locale, data.ObjectiveText[k]);
}
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u Quest Locale strings in %u ms", (uint32)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
} }
void ObjectMgr::LoadScripts(ScriptsType type) void ObjectMgr::LoadScripts(ScriptsType type)
@@ -4691,13 +4688,6 @@ void ObjectMgr::LoadScripts(ScriptsType type)
tableName.c_str(), tmp.Talk.TextID, tmp.id); tableName.c_str(), tmp.Talk.TextID, tmp.id);
continue; continue;
} }
if (tmp.Talk.TextID < MIN_DB_SCRIPT_STRING_ID || tmp.Talk.TextID >= MAX_DB_SCRIPT_STRING_ID)
{
sLog->outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u",
tableName.c_str(), tmp.Talk.TextID, MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID, tmp.id);
continue;
}
break; break;
} }
@@ -5231,7 +5221,8 @@ void ObjectMgr::LoadPageTextLocales()
_pageTextLocaleStore.clear(); // need for reload case _pageTextLocaleStore.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, text_loc1, text_loc2, text_loc3, text_loc4, text_loc5, text_loc6, text_loc7, text_loc8 FROM locales_page_text"); // 0 1 2
QueryResult result = WorldDatabase.Query("SELECT ID, locale, Text FROM page_text_locale");
if (!result) if (!result)
return; return;
@@ -5240,16 +5231,18 @@ void ObjectMgr::LoadPageTextLocales()
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32(); uint32 ID = fields[0].GetUInt32();
std::string LocaleName = fields[1].GetString();
std::string Text = fields[2].GetString();
PageTextLocale& data = _pageTextLocaleStore[entry]; PageTextLocale& data = _pageTextLocaleStore[ID];
LocaleConstant locale = GetLocaleByName(LocaleName);
AddLocaleString(Text, locale, data.Text);
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text);
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u Page Text Locale strings in %u ms", (uint32)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
} }
void ObjectMgr::LoadInstanceTemplate() void ObjectMgr::LoadInstanceTemplate()
@@ -5401,49 +5394,74 @@ void ObjectMgr::LoadGossipText()
{ {
uint32 oldMSTime = getMSTime(); uint32 oldMSTime = getMSTime();
QueryResult result = WorldDatabase.Query("SELECT * FROM npc_text"); QueryResult result = WorldDatabase.Query("SELECT ID, "
"text0_0, text0_1, BroadcastTextID0, lang0, Probability0, em0_0, em0_1, em0_2, em0_3, em0_4, em0_5, "
"text1_0, text1_1, BroadcastTextID1, lang1, Probability1, em1_0, em1_1, em1_2, em1_3, em1_4, em1_5, "
"text2_0, text2_1, BroadcastTextID2, lang2, Probability2, em2_0, em2_1, em2_2, em2_3, em2_4, em2_5, "
"text3_0, text3_1, BroadcastTextID3, lang3, Probability3, em3_0, em3_1, em3_2, em3_3, em3_4, em3_5, "
"text4_0, text4_1, BroadcastTextID4, lang4, Probability4, em4_0, em4_1, em4_2, em4_3, em4_4, em4_5, "
"text5_0, text5_1, BroadcastTextID5, lang5, Probability5, em5_0, em5_1, em5_2, em5_3, em5_4, em5_5, "
"text6_0, text6_1, BroadcastTextID6, lang6, Probability6, em6_0, em6_1, em6_2, em6_3, em6_4, em6_5, "
"text7_0, text7_1, BroadcastTextID7, lang7, Probability7, em7_0, em7_1, em7_2, em7_3, em7_4, em7_5 "
"FROM npc_text");
int count = 0;
if (!result) if (!result)
{ {
sLog->outString(">> Loaded %u npc texts", count); sLog->outErrorDb(">> Loaded 0 npc texts, table is empty!");
sLog->outString(); sLog->outString();
return; return;
} }
_gossipTextStore.rehash(result->GetRowCount()); _gossipTextStore.rehash(result->GetRowCount());
int cic; uint32 count = 0;
uint8 cic;
do do
{ {
++count;
cic = 0; cic = 0;
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 Text_ID = fields[cic++].GetUInt32(); uint32 id = fields[cic++].GetUInt32();
if (!Text_ID) if (!id)
{ {
sLog->outErrorDb("Table `npc_text` has record wit reserved id 0, ignore."); sLog->outErrorDb("Table `npc_text` has record wit reserved id 0, ignore.");
continue; continue;
} }
GossipText& gText = _gossipTextStore[Text_ID]; GossipText& gText = _gossipTextStore[id];
for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; i++) for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
{ {
gText.Options[i].Text_0 = fields[cic++].GetString(); gText.Options[i].Text_0 = fields[cic++].GetString();
gText.Options[i].Text_1 = 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].Language = fields[cic++].GetUInt8();
gText.Options[i].Probability = fields[cic++].GetFloat(); gText.Options[i].Probability = fields[cic++].GetFloat();
for (uint8 j=0; j < MAX_GOSSIP_TEXT_EMOTES; ++j) for (uint8 j = 0; j < MAX_GOSSIP_TEXT_EMOTES; ++j)
{ {
gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt16(); gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt16();
gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt16(); gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt16();
} }
} }
for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; i++)
{
if (gText.Options[i].BroadcastTextID)
{
if (!sObjectMgr->GetBroadcastText(gText.Options[i].BroadcastTextID))
{
sLog->outErrorDb("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;
}
}
}
count++;
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -5456,16 +5474,10 @@ void ObjectMgr::LoadNpcTextLocales()
_npcTextLocaleStore.clear(); // need for reload case _npcTextLocaleStore.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT ID, " QueryResult result = WorldDatabase.Query("SELECT ID, Locale, "
"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, " // 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
"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, Text0_1, Text1_0, Text1_1, Text2_0, Text2_1, Text3_0, Text3_1, Text4_0, Text4_1, Text5_0, Text5_1, Text6_0, Text6_1, Text7_0, Text7_1 "
"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, " "FROM npc_text_locale");
"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) if (!result)
return; return;
@@ -5474,23 +5486,23 @@ void ObjectMgr::LoadNpcTextLocales()
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32(); uint32 ID = fields[0].GetUInt32();
std::string LocaleName = fields[1].GetString();
NpcTextLocale& data = _npcTextLocaleStore[entry]; NpcTextLocale& data = _npcTextLocaleStore[ID];
LocaleConstant locale = GetLocaleByName(LocaleName);
if (locale == LOCALE_enUS)
continue;
for (uint8 i = 1; i < TOTAL_LOCALES; ++i) for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
{ {
LocaleConstant locale = (LocaleConstant) i; AddLocaleString(fields[2 + i * 2].GetString(), locale, data.Text_0[i]);
for (uint8 j = 0; j < MAX_LOCALES; ++j) AddLocaleString(fields[3 + i * 2].GetString(), locale, data.Text_1[i]);
{
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()); } while (result->NextRow());
sLog->outString(">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u Npc Text Locale strings in %u ms", (uint32)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
} }
void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
@@ -5677,6 +5689,66 @@ void ObjectMgr::LoadQuestAreaTriggers()
sLog->outString(); sLog->outString();
} }
void ObjectMgr::LoadQuestOfferRewardLocale()
{
uint32 oldMSTime = getMSTime();
_questOfferRewardLocaleStore.clear(); // need for reload case
// 0 1 2
QueryResult result = WorldDatabase.Query("SELECT Id, locale, RewardText FROM quest_offer_reward_locale");
if (!result)
return;
do
{
Field* fields = result->Fetch();
uint32 id = fields[0].GetUInt32();
std::string localeName = fields[1].GetString();
LocaleConstant locale = GetLocaleByName(localeName);
if (locale == LOCALE_enUS)
continue;
QuestOfferRewardLocale& data = _questOfferRewardLocaleStore[id];
AddLocaleString(fields[2].GetString(), locale, data.RewardText);
} while (result->NextRow());
sLog->outString(">> Loaded %lu Quest Offer Reward locale strings in %u ms", _questOfferRewardLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestRequestItemsLocale()
{
uint32 oldMSTime = getMSTime();
_questRequestItemsLocaleStore.clear(); // need for reload case
// 0 1 2
QueryResult result = WorldDatabase.Query("SELECT Id, locale, CompletionText FROM quest_request_items_locale");
if (!result)
return;
do
{
Field* fields = result->Fetch();
uint32 id = fields[0].GetUInt32();
std::string localeName = fields[1].GetString();
LocaleConstant locale = GetLocaleByName(localeName);
if (locale == LOCALE_enUS)
continue;
QuestRequestItemsLocale& data = _questRequestItemsLocaleStore[id];
AddLocaleString(fields[2].GetString(), locale, data.CompletionText);
} while (result->NextRow());
sLog->outString(">> Loaded %lu Quest Request Items locale strings in %u ms", _questRequestItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadTavernAreaTriggers() void ObjectMgr::LoadTavernAreaTriggers()
{ {
uint32 oldMSTime = getMSTime(); uint32 oldMSTime = getMSTime();
@@ -6287,24 +6359,22 @@ void ObjectMgr::LoadGameObjectLocales()
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 id = fields[0].GetUInt32(); uint32 ID = fields[0].GetUInt32();
std::string localeName = fields[1].GetString(); std::string LocaleName = fields[1].GetString();
std::string Name = fields[2].GetString();
std::string CastBarCaption = fields[3].GetString();
std::string name = fields[2].GetString(); GameObjectLocale& data = _gameObjectLocaleStore[ID];
std::string castBarCaption = fields[3].GetString(); LocaleConstant locale = GetLocaleByName(LocaleName);
GameObjectLocale& data = _gameObjectLocaleStore[id];
LocaleConstant locale = GetLocaleByName(localeName);
if (locale == LOCALE_enUS) if (locale == LOCALE_enUS)
continue; continue;
AddLocaleString(name, locale, data.Name); AddLocaleString(Name, locale, data.Name);
AddLocaleString(castBarCaption, locale, data.CastBarCaption); AddLocaleString(CastBarCaption, locale, data.CastBarCaption);
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u Gameobject Locale strings in %u ms", (uint32)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
} }
inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
@@ -7578,108 +7648,52 @@ void ObjectMgr::LoadGameObjectForQuests()
sLog->outString(); sLog->outString();
} }
bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value) bool ObjectMgr::LoadTrinityStrings()
{ {
uint32 oldMSTime = getMSTime(); uint32 oldMSTime = getMSTime();
int32 start_value = min_value; _trinityStringStore.clear(); // for reload case
int32 end_value = max_value; QueryResult result = WorldDatabase.PQuery("SELECT entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8 FROM trinity_string");
// some string can have negative indexes range
if (start_value < 0)
{
if (end_value >= start_value)
{
sLog->outErrorDb("Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
return false;
}
// real range (max+1, min+1) exaple: (-10, -1000) -> -999...-10+1
std::swap(start_value, end_value);
++start_value;
++end_value;
}
else
{
if (start_value >= end_value)
{
sLog->outErrorDb("Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
return false;
}
}
// cleanup affected map part for reloading case
for (TrinityStringLocaleContainer::iterator itr = _trinityStringLocaleStore.begin(); itr != _trinityStringLocaleStore.end();)
{
if (itr->first >= start_value && itr->first < end_value)
_trinityStringLocaleStore.erase(itr++);
else
++itr;
}
QueryResult result = WorldDatabase.PQuery("SELECT entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8 FROM %s", table);
if (!result) if (!result)
{ {
if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings sLog->outString(">> Loaded 0 trinity strings. DB table `trinity_strings` is empty.");
sLog->outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
else
sLog->outString(">> Loaded 0 string templates. DB table `%s` is empty.", table);
sLog->outString(); sLog->outString();
return false; return false;
} }
uint32 count = 0;
do do
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
int32 entry = fields[0].GetInt32(); uint32 entry = fields[0].GetUInt32();
if (entry == 0) TrinityString& data = _trinityStringStore[entry];
{
sLog->outErrorDb("Table `%s` contain reserved entry 0, ignored.", table);
continue;
}
else if (entry < start_value || entry >= end_value)
{
sLog->outErrorDb("Table `%s` contain entry %i out of allowed range (%d - %d), ignored.", table, entry, min_value, max_value);
continue;
}
TrinityStringLocale& data = _trinityStringLocaleStore[entry]; data.Content.resize(DEFAULT_LOCALE + 1);
if (!data.Content.empty())
{
sLog->outErrorDb("Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry);
continue;
}
data.Content.resize(1);
++count;
for (uint8 i = 0; i < TOTAL_LOCALES; ++i) for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
AddLocaleString(fields[i + 1].GetString(), LocaleConstant(i), data.Content); AddLocaleString(fields[i + 1].GetString(), LocaleConstant(i), data.Content);
} while (result->NextRow()); } while (result->NextRow());
if (min_value == MIN_TRINITY_STRING_ID) sLog->outString(">> Loaded %u trinity strings in %u ms", (uint32)_trinityStringStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString(">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outString(">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
sLog->outString(); sLog->outString();
return true; return true;
} }
const char *ObjectMgr::GetTrinityString(int32 entry, LocaleConstant /*locale_idx*/) const char const* ObjectMgr::GetTrinityString(uint32 entry, LocaleConstant locale) const
{ {
if (TrinityStringLocale const* msl = GetTrinityStringLocale(entry)) if (TrinityString const* ts = GetTrinityString(entry))
return msl->Content[DEFAULT_LOCALE].c_str(); {
if (ts->Content.size() > size_t(locale) && !ts->Content[locale].empty())
return ts->Content[locale].c_str();
return ts->Content[DEFAULT_LOCALE].c_str();
}
sLog->outErrorDb("Trinity string entry %u not found in DB.", entry);
if (entry > 0)
sLog->outErrorDb("Entry %i not found in `trinity_string` table.", entry);
else
sLog->outErrorDb("Trinity string entry %i not found in DB.", entry);
return "<error>"; return "<error>";
} }
@@ -8231,39 +8245,35 @@ void ObjectMgr::LoadGossipMenu()
_gossipMenusStore.clear(); _gossipMenusStore.clear();
QueryResult result = WorldDatabase.Query("SELECT entry, text_id FROM gossip_menu"); QueryResult result = WorldDatabase.Query("SELECT MenuID, TextID FROM gossip_menu");
if (!result) if (!result)
{ {
sLog->outErrorDb(">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!"); sLog->outErrorDb(">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!");
sLog->outString(); sLog->outString();
return; return;
} }
uint32 count = 0;
do do
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
GossipMenus gMenu; GossipMenus gMenu;
gMenu.entry = fields[0].GetUInt16(); gMenu.MenuID = fields[0].GetUInt16();
gMenu.text_id = fields[1].GetUInt32(); gMenu.TextID = fields[1].GetUInt32();
if (!GetGossipText(gMenu.text_id)) if (!GetGossipText(gMenu.TextID))
{ {
sLog->outErrorDb("Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id); sLog->outErrorDb("Table gossip_menu entry %u are using non-existing TextID %u", gMenu.MenuID, gMenu.TextID);
continue; continue;
} }
_gossipMenusStore.insert(GossipMenusContainer::value_type(gMenu.entry, gMenu)); _gossipMenusStore.insert(GossipMenusContainer::value_type(gMenu.MenuID, gMenu));
++count; } while (result->NextRow());
}
while (result->NextRow());
sLog->outString(">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u gossip_menu entries in %u ms", (uint32)_gossipMenusStore.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString(); sLog->outString();
} }
@@ -8274,60 +8284,69 @@ void ObjectMgr::LoadGossipMenuItems()
_gossipMenuItemsStore.clear(); _gossipMenuItemsStore.clear();
QueryResult result = WorldDatabase.Query( QueryResult result = WorldDatabase.Query(
// 0 1 2 3 4 // 0 1 2 3 4 5 6 7 8 9 10 11 12
"SELECT menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, " "SELECT MenuID, OptionID, OptionIcon, OptionText, OptionBroadcastTextID, OptionType, OptionNpcFlag, ActionMenuID, ActionPoiID, BoxCoded, BoxMoney, BoxText, BoxBroadcastTextID "
// 5 6 7 8 9 "FROM gossip_menu_option ORDER BY MenuID, OptionID");
"action_menu_id, action_poi_id, box_coded, box_money, box_text "
"FROM gossip_menu_option ORDER BY menu_id, id");
if (!result) if (!result)
{ {
sLog->outErrorDb(">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!"); sLog->outErrorDb(">> Loaded 0 gossip_menu_option IDs. DB table `gossip_menu_option` is empty!");
sLog->outString(); sLog->outString();
return; return;
} }
uint32 count = 0;
do do
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
GossipMenuItems gMenuItem; GossipMenuItems gMenuItem;
gMenuItem.MenuId = fields[0].GetUInt16(); gMenuItem.MenuID = fields[0].GetUInt16();
gMenuItem.OptionIndex = fields[1].GetUInt16(); gMenuItem.OptionID = fields[1].GetUInt16();
gMenuItem.OptionIcon = fields[2].GetUInt32(); gMenuItem.OptionIcon = fields[2].GetUInt32();
gMenuItem.OptionText = fields[3].GetString(); gMenuItem.OptionText = fields[3].GetString();
gMenuItem.OptionType = fields[4].GetUInt8(); gMenuItem.OptionBroadcastTextID = fields[4].GetUInt32();
gMenuItem.OptionNpcflag = fields[5].GetUInt32(); gMenuItem.OptionType = fields[5].GetUInt8();
gMenuItem.ActionMenuId = fields[6].GetUInt32(); gMenuItem.OptionNpcFlag = fields[6].GetUInt32();
gMenuItem.ActionPoiId = fields[7].GetUInt32(); gMenuItem.ActionMenuID = fields[7].GetUInt32();
gMenuItem.BoxCoded = fields[8].GetBool(); gMenuItem.ActionPoiID = fields[8].GetUInt32();
gMenuItem.BoxMoney = fields[9].GetUInt32(); gMenuItem.BoxCoded = fields[9].GetBool();
gMenuItem.BoxText = fields[10].GetString(); gMenuItem.BoxMoney = fields[10].GetUInt32();
gMenuItem.BoxText = fields[11].GetString();
gMenuItem.BoxBroadcastTextID = fields[12].GetUInt32();
if (gMenuItem.OptionIcon >= 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.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon); sLog->outErrorDb("Table `gossip_menu_option` for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionIcon);
gMenuItem.OptionIcon = GOSSIP_ICON_CHAT; gMenuItem.OptionIcon = GOSSIP_ICON_CHAT;
} }
if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX) if (gMenuItem.OptionBroadcastTextID && !GetBroadcastText(gMenuItem.OptionBroadcastTextID))
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.ActionPoiId && !GetPointOfInterest(gMenuItem.ActionPoiId))
{ {
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); sLog->outErrorDb("Table `gossip_menu_option` for menu %u, id %u has non-existing or incompatible OptionBroadcastTextID %u, ignoring.", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionBroadcastTextID);
gMenuItem.ActionPoiId = 0; gMenuItem.OptionBroadcastTextID = 0;
} }
_gossipMenuItemsStore.insert(GossipMenuItemsContainer::value_type(gMenuItem.MenuId, gMenuItem)); if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX)
++count; sLog->outErrorDb("Table `gossip_menu_option` for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionType);
}
while (result->NextRow());
sLog->outString(">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); if (gMenuItem.ActionPoiID && !GetPointOfInterest(gMenuItem.ActionPoiID))
{
sLog->outErrorDb("Table `gossip_menu_option` for menu %u, id %u use non-existing ActionPoiID %u, ignoring", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.ActionPoiID);
gMenuItem.ActionPoiID = 0;
}
if (gMenuItem.BoxBroadcastTextID && !GetBroadcastText(gMenuItem.BoxBroadcastTextID))
{
sLog->outErrorDb("Table `gossip_menu_option` for menu %u, id %u has non-existing or incompatible BoxBroadcastTextID %u, ignoring.", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.BoxBroadcastTextID);
gMenuItem.BoxBroadcastTextID = 0;
}
_gossipMenuItemsStore.insert(GossipMenuItemsContainer::value_type(gMenuItem.MenuID, gMenuItem));
} while (result->NextRow());
sLog->outString(">> Loaded %u gossip_menu_option entries in %u ms", uint32(_gossipMenuItemsStore.size()), GetMSTimeDiffToNow(oldMSTime));
sLog->outString(); sLog->outString();
} }
@@ -8606,102 +8625,45 @@ void ObjectMgr::LoadBroadcastTextLocales()
{ {
uint32 oldMSTime = getMSTime(); uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT Id, MaleText_loc1, MaleText_loc2, MaleText_loc3, MaleText_loc4, MaleText_loc5, MaleText_loc6, MaleText_loc7, MaleText_loc8, FemaleText_loc1, FemaleText_loc2, FemaleText_loc3, FemaleText_loc4, FemaleText_loc5, FemaleText_loc6, FemaleText_loc7, FemaleText_loc8 FROM locales_broadcast_text"); QueryResult result = WorldDatabase.Query("SELECT ID, locale, MaleText, FemaleText FROM broadcast_text_locale");
if (!result) if (!result)
{ {
sLog->outString(">> Loaded 0 broadcast text locales. DB table `locales_broadcast_text` is empty."); sLog->outString(">> Loaded 0 broadcast text locales. DB table `broadcast_text_locale` is empty.");
sLog->outString(); sLog->outString();
return; return;
} }
uint32 count = 0;
do do
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 id = fields[0].GetUInt32(); uint32 id = fields[0].GetUInt32();
std::string LocaleName = fields[1].GetString();
std::string MaleText = fields[2].GetString();
std::string FemaleText = fields[3].GetString();
BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id); BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id);
if (bct == _broadcastTextStore.end()) if (bct == _broadcastTextStore.end())
{ {
sLog->outErrorDb("BroadcastText (Id: %u) in table `locales_broadcast_text` does not exist. Skipped!", id); sLog->outErrorDb("BroadcastText (Id: %u) in table `broadcast_text_locale` does not exist. Skipped!", id);
continue; continue;
} }
for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i) LocaleConstant locale = GetLocaleByName(LocaleName);
{ if (locale == LOCALE_enUS)
LocaleConstant locale = LocaleConstant(i); continue;
AddLocaleString(fields[1 + (i - 1)].GetString(), locale, bct->second.MaleText);
AddLocaleString(fields[9 + (i - 1)].GetString(), locale, bct->second.FemaleText);
}
++count; AddLocaleString(MaleText, locale, bct->second.MaleText);
AddLocaleString(FemaleText, locale, bct->second.FemaleText);
} }
while (result->NextRow()); while (result->NextRow());
sLog->outString(">> Loaded %u broadcast text locales in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u Broadcast Text Locales in %u ms", uint32(_broadcastTextStore.size()), GetMSTimeDiffToNow(oldMSTime));
sLog->outString(); sLog->outString();
} }
void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids)
{
ScriptMapMap* scripts = GetScriptsMapByType(type);
if (!scripts)
return;
for (ScriptMapMap::const_iterator itrMM = scripts->begin(); itrMM != scripts->end(); ++itrMM)
{
for (ScriptMap::const_iterator itrM = itrMM->second.begin(); itrM != itrMM->second.end(); ++itrM)
{
switch (itrM->second.command)
{
case SCRIPT_COMMAND_TALK:
{
if (!GetTrinityStringLocale (itrM->second.Talk.TextID))
sLog->outErrorDb("Table `%s` references invalid text id %u from `db_script_string`, script id: %u.", GetScriptsTableNameByType(type).c_str(), itrM->second.Talk.TextID, itrMM->first);
if (ids.find(itrM->second.Talk.TextID) != ids.end())
ids.erase(itrM->second.Talk.TextID);
}
default:
break;
}
}
}
}
void ObjectMgr::LoadDbScriptStrings()
{
LoadTrinityStrings("db_script_string", MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID);
std::set<int32> ids;
for (int32 i = MIN_DB_SCRIPT_STRING_ID; i < MAX_DB_SCRIPT_STRING_ID; ++i)
if (GetTrinityStringLocale(i))
ids.insert(i);
for (int type = SCRIPTS_FIRST; type < SCRIPTS_LAST; ++type)
CheckScripts(ScriptsType(type), ids);
for (std::set<int32>::const_iterator itr = ids.begin(); itr != ids.end(); ++itr)
sLog->outErrorDb("Table `db_script_string` has unused string id %u", *itr);
}
bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value)
{
// MAX_DB_SCRIPT_STRING_ID is max allowed negative value for scripts (scrpts can use only more deep negative values
// start/end reversed for negative values
if (start_value > MAX_DB_SCRIPT_STRING_ID || end_value >= start_value)
{
sLog->outErrorDb("Table '%s' load attempted with range (%d - %d) reserved by Trinity, strings not loaded.", table, start_value, end_value+1);
return false;
}
return sObjectMgr->LoadTrinityStrings(table, start_value, end_value);
}
CreatureBaseStats const* ObjectMgr::GetCreatureBaseStats(uint8 level, uint8 unitClass) CreatureBaseStats const* ObjectMgr::GetCreatureBaseStats(uint8 level, uint8 unitClass)
{ {
CreatureBaseStatsContainer::const_iterator it = _creatureBaseStatsStore.find(MAKE_PAIR16(level, unitClass)); CreatureBaseStatsContainer::const_iterator it = _creatureBaseStatsStore.find(MAKE_PAIR16(level, unitClass));
+40 -26
View File
@@ -469,15 +469,13 @@ typedef UNORDERED_MAP<uint32/*(mapid, spawnMode) pair*/, CellObjectGuidsMap> Map
// Trinity string ranges // Trinity string ranges
#define MIN_TRINITY_STRING_ID 1 // 'trinity_string' #define MIN_TRINITY_STRING_ID 1 // 'trinity_string'
#define MAX_TRINITY_STRING_ID 2000000000 #define MAX_TRINITY_STRING_ID 2000000000
#define MIN_DB_SCRIPT_STRING_ID MAX_TRINITY_STRING_ID // 'db_script_string'
#define MAX_DB_SCRIPT_STRING_ID 2000010000
#define MIN_CREATURE_AI_TEXT_STRING_ID (-1) // 'creature_ai_texts' #define MIN_CREATURE_AI_TEXT_STRING_ID (-1) // 'creature_ai_texts'
#define MAX_CREATURE_AI_TEXT_STRING_ID (-1000000) #define MAX_CREATURE_AI_TEXT_STRING_ID (-1000000)
// Trinity Trainer Reference start range // Trinity Trainer Reference start range
#define TRINITY_TRAINER_START_REF 200000 #define TRINITY_TRAINER_START_REF 200000
struct TrinityStringLocale struct TrinityString
{ {
StringVector Content; StringVector Content;
}; };
@@ -491,9 +489,11 @@ typedef UNORDERED_MAP<uint32, GameObjectLocale> GameObjectLocaleContainer;
typedef UNORDERED_MAP<uint32, ItemLocale> ItemLocaleContainer; typedef UNORDERED_MAP<uint32, ItemLocale> ItemLocaleContainer;
typedef UNORDERED_MAP<uint32, ItemSetNameLocale> ItemSetNameLocaleContainer; typedef UNORDERED_MAP<uint32, ItemSetNameLocale> ItemSetNameLocaleContainer;
typedef UNORDERED_MAP<uint32, QuestLocale> QuestLocaleContainer; typedef UNORDERED_MAP<uint32, QuestLocale> QuestLocaleContainer;
typedef UNORDERED_MAP<uint32, QuestOfferRewardLocale> QuestOfferRewardLocaleContainer;
typedef UNORDERED_MAP<uint32, QuestRequestItemsLocale> QuestRequestItemsLocaleContainer;
typedef UNORDERED_MAP<uint32, NpcTextLocale> NpcTextLocaleContainer; typedef UNORDERED_MAP<uint32, NpcTextLocale> NpcTextLocaleContainer;
typedef UNORDERED_MAP<uint32, PageTextLocale> PageTextLocaleContainer; typedef UNORDERED_MAP<uint32, PageTextLocale> PageTextLocaleContainer;
typedef UNORDERED_MAP<int32, TrinityStringLocale> TrinityStringLocaleContainer; typedef UNORDERED_MAP<int32, TrinityString> TrinityStringContainer;
typedef UNORDERED_MAP<uint32, GossipMenuItemsLocale> GossipMenuItemsLocaleContainer; typedef UNORDERED_MAP<uint32, GossipMenuItemsLocale> GossipMenuItemsLocaleContainer;
typedef UNORDERED_MAP<uint32, PointOfInterestLocale> PointOfInterestLocaleContainer; typedef UNORDERED_MAP<uint32, PointOfInterestLocale> PointOfInterestLocaleContainer;
@@ -570,25 +570,27 @@ struct PointOfInterest
struct GossipMenuItems struct GossipMenuItems
{ {
uint32 MenuId; uint32 MenuID;
uint32 OptionIndex; uint32 OptionID;
uint8 OptionIcon; uint8 OptionIcon;
std::string OptionText; std::string OptionText;
uint32 OptionBroadcastTextID;
uint32 OptionType; uint32 OptionType;
uint32 OptionNpcflag; uint32 OptionNpcFlag;
uint32 ActionMenuId; uint32 ActionMenuID;
uint32 ActionPoiId; uint32 ActionPoiID;
bool BoxCoded; bool BoxCoded;
uint32 BoxMoney; uint32 BoxMoney;
std::string BoxText; std::string BoxText;
ConditionList Conditions; ConditionList Conditions;
uint32 BoxBroadcastTextID;
}; };
struct GossipMenus struct GossipMenus
{ {
uint32 entry; uint32 MenuID;
uint32 text_id; uint32 TextID;
ConditionList conditions; ConditionList Conditions;
}; };
typedef std::multimap<uint32, GossipMenus> GossipMenusContainer; typedef std::multimap<uint32, GossipMenus> GossipMenusContainer;
@@ -952,9 +954,7 @@ class ObjectMgr
void ValidateSpellScripts(); void ValidateSpellScripts();
void InitializeSpellInfoPrecomputedData(); void InitializeSpellInfoPrecomputedData();
bool LoadTrinityStrings(char const* table, int32 min_value, int32 max_value); bool LoadTrinityStrings();
bool LoadTrinityStrings() { return LoadTrinityStrings("trinity_string", MIN_TRINITY_STRING_ID, MAX_TRINITY_STRING_ID); }
void LoadDbScriptStrings();
void LoadBroadcastTexts(); void LoadBroadcastTexts();
void LoadBroadcastTextLocales(); void LoadBroadcastTextLocales();
void LoadCreatureClassLevelStats(); void LoadCreatureClassLevelStats();
@@ -980,6 +980,8 @@ class ObjectMgr
void LoadItemSetNameLocales(); void LoadItemSetNameLocales();
void LoadQuestLocales(); void LoadQuestLocales();
void LoadNpcTextLocales(); void LoadNpcTextLocales();
void LoadQuestOfferRewardLocale();
void LoadQuestRequestItemsLocale();
void LoadPageTextLocales(); void LoadPageTextLocales();
void LoadGossipMenuItemsLocales(); void LoadGossipMenuItemsLocales();
void LoadPointOfInterestLocales(); void LoadPointOfInterestLocales();
@@ -1181,6 +1183,18 @@ class ObjectMgr
if (itr == _pointOfInterestLocaleStore.end()) return NULL; if (itr == _pointOfInterestLocaleStore.end()) return NULL;
return &itr->second; return &itr->second;
} }
QuestOfferRewardLocale const* GetQuestOfferRewardLocale(uint32 entry) const
{
auto itr = _questOfferRewardLocaleStore.find(entry);
if (itr == _questOfferRewardLocaleStore.end()) return nullptr;
return &itr->second;
}
QuestRequestItemsLocale const* GetQuestRequestItemsLocale(uint32 entry) const
{
auto itr = _questRequestItemsLocaleStore.find(entry);
if (itr == _questRequestItemsLocaleStore.end()) return nullptr;
return &itr->second;
}
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
{ {
NpcTextLocaleContainer::const_iterator itr = _npcTextLocaleStore.find(entry); NpcTextLocaleContainer::const_iterator itr = _npcTextLocaleStore.find(entry);
@@ -1189,15 +1203,17 @@ class ObjectMgr
} }
GameObjectData& NewGOData(uint32 guid) { return _gameObjectDataStore[guid]; } GameObjectData& NewGOData(uint32 guid) { return _gameObjectDataStore[guid]; }
void DeleteGOData(uint32 guid); void DeleteGOData(uint32 guid);
TrinityStringLocale const* GetTrinityStringLocale(int32 entry) const TrinityString const* GetTrinityString(uint32 entry) const
{ {
TrinityStringLocaleContainer::const_iterator itr = _trinityStringLocaleStore.find(entry); TrinityStringContainer::const_iterator itr = _trinityStringStore.find(entry);
if (itr == _trinityStringLocaleStore.end()) return NULL; if (itr == _trinityStringStore.end())
return NULL;
return &itr->second; return &itr->second;
} }
const char *GetTrinityString(int32 entry, LocaleConstant locale_idx) const; char const* GetTrinityString(uint32 entry, LocaleConstant locale) const;
const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry, DBCLocaleIndex); } char const* GetTrinityStringForDBCLocale(uint32 entry) const { return GetTrinityString(entry, DBCLocaleIndex); }
LocaleConstant GetDBCLocaleIndex() const { return DBCLocaleIndex; } LocaleConstant GetDBCLocaleIndex() const { return DBCLocaleIndex; }
void SetDBCLocaleIndex(LocaleConstant locale) { DBCLocaleIndex = locale; } void SetDBCLocaleIndex(LocaleConstant locale) { DBCLocaleIndex = locale; }
@@ -1380,7 +1396,6 @@ class ObjectMgr
private: private:
void LoadScripts(ScriptsType type); void LoadScripts(ScriptsType type);
void CheckScripts(ScriptsType type, std::set<int32>& ids);
void LoadQuestRelationsHelper(QuestRelations& map, std::string const& table, bool starter, bool go); void LoadQuestRelationsHelper(QuestRelations& map, std::string const& table, bool starter, bool go);
void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count); void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count);
@@ -1441,9 +1456,11 @@ class ObjectMgr
ItemLocaleContainer _itemLocaleStore; ItemLocaleContainer _itemLocaleStore;
ItemSetNameLocaleContainer _itemSetNameLocaleStore; ItemSetNameLocaleContainer _itemSetNameLocaleStore;
QuestLocaleContainer _questLocaleStore; QuestLocaleContainer _questLocaleStore;
QuestOfferRewardLocaleContainer _questOfferRewardLocaleStore;
QuestRequestItemsLocaleContainer _questRequestItemsLocaleStore;
NpcTextLocaleContainer _npcTextLocaleStore; NpcTextLocaleContainer _npcTextLocaleStore;
PageTextLocaleContainer _pageTextLocaleStore; PageTextLocaleContainer _pageTextLocaleStore;
TrinityStringLocaleContainer _trinityStringLocaleStore; TrinityStringContainer _trinityStringStore;
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore; GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore;
PointOfInterestLocaleContainer _pointOfInterestLocaleStore; PointOfInterestLocaleContainer _pointOfInterestLocaleStore;
@@ -1466,7 +1483,4 @@ class ObjectMgr
#define sObjectMgr ACE_Singleton<ObjectMgr, ACE_Null_Mutex>::instance() #define sObjectMgr ACE_Singleton<ObjectMgr, ACE_Null_Mutex>::instance()
// scripting access functions
bool LoadTrinityStrings(char const* table, int32 start_value = MAX_CREATURE_AI_TEXT_STRING_ID, int32 end_value = std::numeric_limits<int32>::min());
#endif #endif
+11 -11
View File
@@ -277,17 +277,17 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
recvData >> textID; recvData >> textID;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID); sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_NPC_TEXT_QUERY TextId: %u", textID);
#endif #endif
recvData >> guid; recvData >> guid;
GossipText const* pGossip = sObjectMgr->GetGossipText(textID); GossipText const* gossip = sObjectMgr->GetGossipText(textID);
WorldPacket data(SMSG_NPC_TEXT_UPDATE, 100); // guess size WorldPacket data(SMSG_NPC_TEXT_UPDATE, 100); // guess size
data << textID; data << textID;
if (!pGossip) if (!gossip)
{ {
for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i) for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
{ {
@@ -307,10 +307,10 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
{ {
std::string text0[MAX_GOSSIP_TEXT_OPTIONS], text1[MAX_GOSSIP_TEXT_OPTIONS]; std::string text0[MAX_GOSSIP_TEXT_OPTIONS], text1[MAX_GOSSIP_TEXT_OPTIONS];
LocaleConstant locale = GetSessionDbLocaleIndex(); LocaleConstant locale = GetSessionDbLocaleIndex();
for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i) for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
{ {
BroadcastText const* bct = sObjectMgr->GetBroadcastText(pGossip->Options[i].BroadcastTextID); BroadcastText const* bct = sObjectMgr->GetBroadcastText(gossip->Options[i].BroadcastTextID);
if (bct) if (bct)
{ {
text0[i] = bct->GetText(locale, GENDER_MALE, true); text0[i] = bct->GetText(locale, GENDER_MALE, true);
@@ -318,8 +318,8 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
} }
else else
{ {
text0[i] = pGossip->Options[i].Text_0; text0[i] = gossip->Options[i].Text_0;
text1[i] = pGossip->Options[i].Text_1; text1[i] = gossip->Options[i].Text_1;
} }
if (locale != DEFAULT_LOCALE && !bct) if (locale != DEFAULT_LOCALE && !bct)
@@ -331,7 +331,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
} }
} }
data << pGossip->Options[i].Probability; data << gossip->Options[i].Probability;
if (text0[i].empty()) if (text0[i].empty())
data << text1[i]; data << text1[i];
@@ -343,12 +343,12 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
else else
data << text1[i]; data << text1[i];
data << pGossip->Options[i].Language; data << gossip->Options[i].Language;
for (uint8 j = 0; j < MAX_GOSSIP_TEXT_EMOTES; ++j) for (uint8 j = 0; j < MAX_GOSSIP_TEXT_EMOTES; ++j)
{ {
data << pGossip->Options[i].Emotes[j]._Delay; data << gossip->Options[i].Emotes[j]._Delay;
data << pGossip->Options[i].Emotes[j]._Emote; data << gossip->Options[i].Emotes[j]._Emote;
} }
} }
} }
+7
View File
@@ -61,6 +61,13 @@ MailSender::MailSender(Player* sender)
m_senderId = sender->GetGUIDLow(); m_senderId = sender->GetGUIDLow();
} }
MailSender::MailSender(uint32 senderEntry)
{
m_messageType = MAIL_CREATURE;
m_senderId = senderEntry;
m_stationery = MAIL_STATIONERY_DEFAULT;
}
MailReceiver::MailReceiver(Player* receiver) : m_receiver(receiver), m_receiver_lowguid(receiver->GetGUIDLow()) MailReceiver::MailReceiver(Player* receiver) : m_receiver(receiver), m_receiver_lowguid(receiver->GetGUIDLow())
{ {
} }
+1
View File
@@ -77,6 +77,7 @@ class MailSender
MailSender(CalendarEvent* sender); MailSender(CalendarEvent* sender);
MailSender(AuctionEntry* sender); MailSender(AuctionEntry* sender);
MailSender(Player* sender); MailSender(Player* sender);
MailSender(uint32 senderEntry);
public: // Accessors public: // Accessors
MailMessageType GetMailMessageType() const { return m_messageType; } MailMessageType GetMailMessageType() const { return m_messageType; }
uint32 GetSenderId() const { return m_senderId; } uint32 GetSenderId() const { return m_senderId; }
+2 -1
View File
@@ -165,7 +165,8 @@ void Quest::LoadQuestTemplateAddon(Field* fields)
RequiredMinRepValue = fields[13].GetInt32(); RequiredMinRepValue = fields[13].GetInt32();
RequiredMaxRepValue = fields[14].GetInt32(); RequiredMaxRepValue = fields[14].GetInt32();
StartItemCount = fields[15].GetUInt8(); StartItemCount = fields[15].GetUInt8();
SpecialFlags = fields[16].GetUInt8(); RewardMailSenderEntry = fields[16].GetUInt32();
SpecialFlags = fields[17].GetUInt8();
if (SpecialFlags & QUEST_SPECIAL_FLAGS_AUTO_ACCEPT) if (SpecialFlags & QUEST_SPECIAL_FLAGS_AUTO_ACCEPT)
Flags |= QUEST_FLAGS_AUTO_ACCEPT; Flags |= QUEST_FLAGS_AUTO_ACCEPT;
+12
View File
@@ -176,6 +176,16 @@ struct QuestLocale
std::vector< StringVector > ObjectiveText; std::vector< StringVector > ObjectiveText;
}; };
struct QuestRequestItemsLocale
{
std::vector<std::string> CompletionText;
};
struct QuestOfferRewardLocale
{
std::vector<std::string> RewardText;
};
// This Quest class provides a convenient way to access a few pretotaled (cached) quest details, // This Quest class provides a convenient way to access a few pretotaled (cached) quest details,
// all base quest information, and any utility functions such as generating the amount of // all base quest information, and any utility functions such as generating the amount of
// xp to give // xp to give
@@ -246,6 +256,7 @@ class Quest
int32 GetRewSpellCast() const { return RewardSpell; } int32 GetRewSpellCast() const { return RewardSpell; }
uint32 GetRewMailTemplateId() const { return RewardMailTemplateId; } uint32 GetRewMailTemplateId() const { return RewardMailTemplateId; }
uint32 GetRewMailDelaySecs() const { return RewardMailDelay; } uint32 GetRewMailDelaySecs() const { return RewardMailDelay; }
uint32 GetRewMailSenderEntry() const { return RewardMailSenderEntry; }
uint32 GetPOIContinent() const { return POIContinent; } uint32 GetPOIContinent() const { return POIContinent; }
float GetPOIx() const { return POIx; } float GetPOIx() const { return POIx; }
float GetPOIy() const { return POIy; } float GetPOIy() const { return POIy; }
@@ -371,6 +382,7 @@ class Quest
uint32 RequiredMaxRepFaction = 0; uint32 RequiredMaxRepFaction = 0;
int32 RequiredMaxRepValue = 0; int32 RequiredMaxRepValue = 0;
uint32 StartItemCount = 0; uint32 StartItemCount = 0;
uint32 RewardMailSenderEntry = 0;
uint32 SpecialFlags = 0; // custom flags, not sniffed/WDB uint32 SpecialFlags = 0; // custom flags, not sniffed/WDB
}; };
+2 -1
View File
@@ -371,7 +371,8 @@ void Map::ScriptsProcess()
if (Player* player = _GetScriptPlayerSourceOrTarget(source, target, step.script)) if (Player* player = _GetScriptPlayerSourceOrTarget(source, target, step.script))
{ {
LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
std::string text(sObjectMgr->GetTrinityString(step.script->Talk.TextID, loc_idx)); BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(step.script->Talk.TextID);
std::string text = broadcastText->GetText(loc_idx, player->getGender());
switch (step.script->Talk.ChatType) switch (step.script->Talk.ChatType)
{ {
+1 -1
View File
@@ -655,7 +655,7 @@ void WorldSession::SendNotification(uint32 string_id, ...)
} }
} }
const char *WorldSession::GetTrinityString(int32 entry) const char const* WorldSession::GetTrinityString(uint32 entry) const
{ {
return sObjectMgr->GetTrinityString(entry, GetSessionDbLocaleIndex()); return sObjectMgr->GetTrinityString(entry, GetSessionDbLocaleIndex());
} }
+1 -1
View File
@@ -341,7 +341,7 @@ class WorldSession
// Locales // Locales
LocaleConstant GetSessionDbcLocale() const { return m_sessionDbcLocale; } LocaleConstant GetSessionDbcLocale() const { return m_sessionDbcLocale; }
LocaleConstant GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; } LocaleConstant GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; }
const char *GetTrinityString(int32 entry) const; char const* GetTrinityString(uint32 entry) const;
uint32 GetLatency() const { return m_latency; } uint32 GetLatency() const { return m_latency; }
void SetLatency(uint32 latency) { m_latency = latency; } void SetLatency(uint32 latency) { m_latency = latency; }
+19 -11
View File
@@ -155,27 +155,31 @@ void CreatureTextMgr::LoadCreatureTextLocales()
mLocaleTextMap.clear(); // for reload case mLocaleTextMap.clear(); // for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, groupid, id, text_loc1, text_loc2, text_loc3, text_loc4, text_loc5, text_loc6, text_loc7, text_loc8 FROM locales_creature_text"); QueryResult result = WorldDatabase.Query("SELECT CreatureId, GroupId, ID, Locale, Text FROM creature_text_locale");
if (!result) if (!result)
return; return;
uint32 textCount = 0;
do do
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
CreatureTextLocale& loc = mLocaleTextMap[CreatureTextId(fields[0].GetUInt32(), uint32(fields[1].GetUInt8()), uint32(fields[2].GetUInt8()))];
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
{
LocaleConstant locale = LocaleConstant(i);
ObjectMgr::AddLocaleString(fields[3 + i - 1].GetString(), locale, loc.Text);
}
++textCount; uint32 CreatureId = fields[0].GetUInt32();
uint32 GroupId = fields[1].GetUInt8();
uint32 ID = fields[2].GetUInt8();
std::string LocaleName = fields[3].GetString();
std::string Text = fields[4].GetString();
CreatureTextLocale& data = mLocaleTextMap[CreatureTextId(CreatureId, GroupId, ID)];
LocaleConstant locale = GetLocaleByName(LocaleName);
if (locale == LOCALE_enUS)
continue;
ObjectMgr::AddLocaleString(Text, locale, data.Text);
} while (result->NextRow()); } while (result->NextRow());
sLog->outString(">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(">> Loaded %u Creature Text Locale in %u ms", uint32(mLocaleTextMap.size()), GetMSTimeDiffToNow(oldMSTime));
sLog->outString(); sLog->outString();
} }
@@ -468,17 +472,21 @@ std::string CreatureTextMgr::GetLocalizedChatString(uint32 entry, uint8 gender,
if (locale > MAX_LOCALES) if (locale > MAX_LOCALES)
locale = DEFAULT_LOCALE; locale = DEFAULT_LOCALE;
std::string baseText = ""; std::string baseText = "";
BroadcastText const* bct = sObjectMgr->GetBroadcastText(groupItr->BroadcastTextId); BroadcastText const* bct = sObjectMgr->GetBroadcastText(groupItr->BroadcastTextId);
if (bct) if (bct)
baseText = bct->GetText(locale, gender); baseText = bct->GetText(locale, gender);
else else
baseText = groupItr->text; baseText = groupItr->text;
if (locale != DEFAULT_LOCALE && !bct) if (locale != DEFAULT_LOCALE && !bct)
{ {
LocaleCreatureTextMap::const_iterator locItr = mLocaleTextMap.find(CreatureTextId(entry, uint32(textGroup), id)); LocaleCreatureTextMap::const_iterator locItr = mLocaleTextMap.find(CreatureTextId(entry, uint32(textGroup), id));
if (locItr != mLocaleTextMap.end()) if (locItr != mLocaleTextMap.end())
ObjectMgr::GetLocaleString(locItr->second.Text, locale, baseText); ObjectMgr::GetLocaleString(locItr->second.Text, locale, baseText);
} }
return baseText; return baseText;
} }
+7 -8
View File
@@ -1463,6 +1463,8 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadItemLocales(); sObjectMgr->LoadItemLocales();
sObjectMgr->LoadItemSetNameLocales(); sObjectMgr->LoadItemSetNameLocales();
sObjectMgr->LoadQuestLocales(); sObjectMgr->LoadQuestLocales();
sObjectMgr->LoadQuestOfferRewardLocale();
sObjectMgr->LoadQuestRequestItemsLocale();
sObjectMgr->LoadNpcTextLocales(); sObjectMgr->LoadNpcTextLocales();
sObjectMgr->LoadPageTextLocales(); sObjectMgr->LoadPageTextLocales();
sObjectMgr->LoadGossipMenuItemsLocales(); sObjectMgr->LoadGossipMenuItemsLocales();
@@ -1805,10 +1807,7 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data) sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr->LoadWaypointScripts(); sObjectMgr->LoadWaypointScripts();
sLog->outString("Loading Scripts text locales..."); // must be after Load*Scripts calls
sObjectMgr->LoadDbScriptStrings();
sLog->outString("Loading spell script names..."); sLog->outString("Loading spell script names...");
sObjectMgr->LoadSpellScriptNames(); sObjectMgr->LoadSpellScriptNames();
@@ -2282,7 +2281,7 @@ namespace Trinity
{ {
public: public:
typedef std::vector<WorldPacket*> WorldPacketList; typedef std::vector<WorldPacket*> WorldPacketList;
explicit WorldWorldTextBuilder(int32 textId, va_list* args = NULL) : i_textId(textId), i_args(args) {} explicit WorldWorldTextBuilder(uint32 textId, va_list* args = NULL) : i_textId(textId), i_args(args) {}
void operator()(WorldPacketList& data_list, LocaleConstant loc_idx) void operator()(WorldPacketList& data_list, LocaleConstant loc_idx)
{ {
char const* text = sObjectMgr->GetTrinityString(i_textId, loc_idx); char const* text = sObjectMgr->GetTrinityString(i_textId, loc_idx);
@@ -2316,13 +2315,13 @@ namespace Trinity
} }
int32 i_textId; uint32 i_textId;
va_list* i_args; va_list* i_args;
}; };
} // namespace Trinity } // namespace Trinity
/// Send a System Message to all players (except self if mentioned) /// Send a System Message to all players (except self if mentioned)
void World::SendWorldText(int32 string_id, ...) void World::SendWorldText(uint32 string_id, ...)
{ {
va_list ap; va_list ap;
va_start(ap, string_id); va_start(ap, string_id);
@@ -2341,7 +2340,7 @@ void World::SendWorldText(int32 string_id, ...)
} }
/// Send a System Message to all GMs (except self if mentioned) /// Send a System Message to all GMs (except self if mentioned)
void World::SendGMText(int32 string_id, ...) void World::SendGMText(uint32 string_id, ...)
{ {
va_list ap; va_list ap;
va_start(ap, string_id); va_start(ap, string_id);
+2 -2
View File
@@ -651,9 +651,9 @@ class World
void LoadConfigSettings(bool reload = false); void LoadConfigSettings(bool reload = false);
void LoadModuleConfigSettings(); void LoadModuleConfigSettings();
void SendWorldText(int32 string_id, ...); void SendWorldText(uint32 string_id, ...);
void SendGlobalText(const char* text, WorldSession* self); void SendGlobalText(const char* text, WorldSession* self);
void SendGMText(int32 string_id, ...); void SendGMText(uint32 string_id, ...);
void SendGlobalMessage(WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL); void SendGlobalMessage(WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL);
void SendGlobalGMMessage(WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL); void SendGlobalGMMessage(WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL);
bool SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL); bool SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self = 0, TeamId teamId = TEAM_NEUTRAL);
+53 -41
View File
@@ -76,7 +76,6 @@ public:
{ "creature_onkill_reputation", SEC_ADMINISTRATOR, true, &HandleReloadOnKillReputationCommand, "" }, { "creature_onkill_reputation", SEC_ADMINISTRATOR, true, &HandleReloadOnKillReputationCommand, "" },
{ "creature_queststarter", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestStarterCommand, "" }, { "creature_queststarter", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestStarterCommand, "" },
{ "creature_template", SEC_ADMINISTRATOR, true, &HandleReloadCreatureTemplateCommand, "" }, { "creature_template", SEC_ADMINISTRATOR, true, &HandleReloadCreatureTemplateCommand, "" },
//{ "db_script_string", SEC_ADMINISTRATOR, true, &HandleReloadDbScriptStringCommand, "" },
{ "disables", SEC_ADMINISTRATOR, true, &HandleReloadDisablesCommand, "" }, { "disables", SEC_ADMINISTRATOR, true, &HandleReloadDisablesCommand, "" },
{ "disenchant_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesDisenchantCommand, "" }, { "disenchant_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesDisenchantCommand, "" },
{ "event_scripts", SEC_ADMINISTRATOR, true, &HandleReloadEventScriptsCommand, "" }, { "event_scripts", SEC_ADMINISTRATOR, true, &HandleReloadEventScriptsCommand, "" },
@@ -94,17 +93,19 @@ public:
{ "item_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesItemCommand, "" }, { "item_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesItemCommand, "" },
{ "item_set_names", SEC_ADMINISTRATOR, true, &HandleReloadItemSetNamesCommand, "" }, { "item_set_names", SEC_ADMINISTRATOR, true, &HandleReloadItemSetNamesCommand, "" },
{ "lfg_dungeon_rewards", SEC_ADMINISTRATOR, true, &HandleReloadLfgRewardsCommand, "" }, { "lfg_dungeon_rewards", SEC_ADMINISTRATOR, true, &HandleReloadLfgRewardsCommand, "" },
{ "locales_achievement_reward", SEC_ADMINISTRATOR, true, &HandleReloadLocalesAchievementRewardCommand, "" }, { "achievement_reward_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesAchievementRewardCommand, "" },
{ "locales_creature", SEC_ADMINISTRATOR, true, &HandleReloadLocalesCreatureCommand, "" }, { "creature_template_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesCreatureCommand, "" },
{ "locales_creature_text", SEC_ADMINISTRATOR, true, &HandleReloadLocalesCreatureTextCommand, "" }, { "creature_text_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesCreatureTextCommand, "" },
{ "locales_gameobject", SEC_ADMINISTRATOR, true, &HandleReloadLocalesGameobjectCommand, "" }, { "gameobject_template_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesGameobjectCommand, "" },
{ "locales_gossip_menu_option", SEC_ADMINISTRATOR, true, &HandleReloadLocalesGossipMenuOptionCommand, "" }, { "gossip_menu_option_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesGossipMenuOptionCommand, "" },
{ "locales_item", SEC_ADMINISTRATOR, true, &HandleReloadLocalesItemCommand, "" }, { "item_template_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesItemCommand, "" },
{ "locales_item_set_name", SEC_ADMINISTRATOR, true, &HandleReloadLocalesItemSetNameCommand, "" }, { "item_set_name_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesItemSetNameCommand, "" },
{ "locales_npc_text", SEC_ADMINISTRATOR, true, &HandleReloadLocalesNpcTextCommand, "" }, { "npc_text_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesNpcTextCommand, "" },
{ "locales_page_text", SEC_ADMINISTRATOR, true, &HandleReloadLocalesPageTextCommand, "" }, { "page_text_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesPageTextCommand, "" },
{ "locales_points_of_interest", SEC_ADMINISTRATOR, true, &HandleReloadLocalesPointsOfInterestCommand, "" }, { "points_of_interest_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesPointsOfInterestCommand, "" },
{ "locales_quest", SEC_ADMINISTRATOR, true, &HandleReloadLocalesQuestCommand, "" }, { "quest_template_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesQuestCommand, "" },
{ "quest_offer_reward_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesQuestOfferRewardCommand, "" },
{ "quest_request_item_locale", SEC_ADMINISTRATOR, true, &HandleReloadLocalesQuestRequestItemsCommand, "" },
{ "mail_level_reward", SEC_ADMINISTRATOR, true, &HandleReloadMailLevelRewardCommand, "" }, { "mail_level_reward", SEC_ADMINISTRATOR, true, &HandleReloadMailLevelRewardCommand, "" },
{ "mail_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesMailCommand, "" }, { "mail_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesMailCommand, "" },
{ "milling_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesMillingCommand, "" }, { "milling_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesMillingCommand, "" },
@@ -258,7 +259,6 @@ public:
HandleReloadEventScriptsCommand(handler, "a"); HandleReloadEventScriptsCommand(handler, "a");
HandleReloadSpellScriptsCommand(handler, "a"); HandleReloadSpellScriptsCommand(handler, "a");
handler->SendGlobalGMSysMessage("DB tables `*_scripts` reloaded."); handler->SendGlobalGMSysMessage("DB tables `*_scripts` reloaded.");
HandleReloadDbScriptStringCommand(handler, "a");
HandleReloadWpScriptsCommand(handler, "a"); HandleReloadWpScriptsCommand(handler, "a");
HandleReloadWpCommand(handler, "a"); HandleReloadWpCommand(handler, "a");
return true; return true;
@@ -310,6 +310,8 @@ public:
HandleReloadLocalesPageTextCommand(handler, "a"); HandleReloadLocalesPageTextCommand(handler, "a");
HandleReloadLocalesPointsOfInterestCommand(handler, "a"); HandleReloadLocalesPointsOfInterestCommand(handler, "a");
HandleReloadLocalesQuestCommand(handler, "a"); HandleReloadLocalesQuestCommand(handler, "a");
HandleReloadLocalesQuestOfferRewardCommand(handler, "a");
HandleReloadLocalesQuestRequestItemsCommand(handler, "a");
return true; return true;
} }
@@ -1012,14 +1014,6 @@ public:
return true; return true;
} }
static bool HandleReloadDbScriptStringCommand(ChatHandler* handler, const char* /*args*/)
{
sLog->outString("Re-Loading Script strings from `db_script_string`...");
sObjectMgr->LoadDbScriptStrings();
handler->SendGlobalGMSysMessage("DB table `db_script_string` reloaded.");
return true;
}
static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString("Re-Loading Graveyard-zone links..."); sLog->outString("Re-Loading Graveyard-zone links...");
@@ -1054,9 +1048,11 @@ public:
static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString("Re-Loading Locales Achievement Reward Data..."); sLog->outString("Re-Loading Achievement Reward Data Locale...");
sAchievementMgr->LoadRewardLocales(); sAchievementMgr->LoadRewardLocales();
handler->SendGlobalGMSysMessage("DB table `achievement_reward_locale` reloaded.");
handler->SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded."); handler->SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded.");
handler->SendGlobalGMSysMessage("|cff6C8CD5#|cFFFF0000 Таблица|r `achievement_reward_locale` |cFFFF0000перезагружена.|r");
return true; return true;
} }
@@ -1070,73 +1066,73 @@ public:
static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString("Re-Loading Locales Creature ..."); sLog->outString("Re-Loading Creature Template Locale...");
sObjectMgr->LoadCreatureLocales(); sObjectMgr->LoadCreatureLocales();
handler->SendGlobalGMSysMessage("DB table `locales_creature` reloaded."); handler->SendGlobalGMSysMessage("DB table `creature_template_locale` reloaded.");
return true; return true;
} }
static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString("Re-Loading Locales Creature Texts..."); sLog->outString("Re-Loading Creature Texts Locale...");
sCreatureTextMgr->LoadCreatureTextLocales(); sCreatureTextMgr->LoadCreatureTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_creature_text` reloaded."); handler->SendGlobalGMSysMessage("DB table `creature_text_locale` reloaded.");
return true; return true;
} }
static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString("Re-Loading Locales Gameobject ... "); sLog->outString("Re-Loading Gameobject Template Locale ... ");
sObjectMgr->LoadGameObjectLocales(); sObjectMgr->LoadGameObjectLocales();
handler->SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded."); handler->SendGlobalGMSysMessage("DB table `gameobject_template_locale` reloaded.");
return true; return true;
} }
static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString( "Re-Loading Locales Gossip Menu Option ... "); sLog->outString( "Re-Loading Gossip Menu Option Locale ... ");
sObjectMgr->LoadGossipMenuItemsLocales(); sObjectMgr->LoadGossipMenuItemsLocales();
handler->SendGlobalGMSysMessage("DB table `locales_gossip_menu_option` reloaded."); handler->SendGlobalGMSysMessage("DB table `gossip_menu_option_locale` reloaded.");
return true; return true;
} }
static bool HandleReloadLocalesItemCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadLocalesItemCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString("Re-Loading Locales Item ... "); sLog->outString("Re-Loading Item Template Locale ... ");
sObjectMgr->LoadItemLocales(); sObjectMgr->LoadItemLocales();
handler->SendGlobalGMSysMessage("DB table `locales_item` reloaded."); handler->SendGlobalGMSysMessage("DB table `item_template_locale` reloaded.");
return true; return true;
} }
static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString("Re-Loading Locales Item set name... "); sLog->outString("Re-Loading Item set name Locale... ");
sObjectMgr->LoadItemSetNameLocales(); sObjectMgr->LoadItemSetNameLocales();
handler->SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded."); handler->SendGlobalGMSysMessage("DB table `item_set_name_locale` reloaded.");
return true; return true;
} }
static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString("Re-Loading Locales NPC Text ... "); sLog->outString("Re-Loading NPC Text Locale ... ");
sObjectMgr->LoadNpcTextLocales(); sObjectMgr->LoadNpcTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded."); handler->SendGlobalGMSysMessage("DB table `npc_text_locale` reloaded.");
return true; return true;
} }
static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString("Re-Loading Locales Page Text ... "); sLog->outString("Re-Loading Page Text Locale ... ");
sObjectMgr->LoadPageTextLocales(); sObjectMgr->LoadPageTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_page_text` reloaded."); handler->SendGlobalGMSysMessage("DB table `page_text_locale` reloaded.");
return true; return true;
} }
static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/) static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/)
{ {
sLog->outString("Re-Loading Locales Points Of Interest ... "); sLog->outString("Re-Loading Points Of Interest Locale ... ");
sObjectMgr->LoadPointOfInterestLocales(); sObjectMgr->LoadPointOfInterestLocales();
handler->SendGlobalGMSysMessage("DB table `locales_points_of_interest` reloaded."); handler->SendGlobalGMSysMessage("DB table `points_of_interest_locale` reloaded.");
return true; return true;
} }
@@ -1144,7 +1140,23 @@ public:
{ {
sLog->outString("Re-Loading Locales Quest ... "); sLog->outString("Re-Loading Locales Quest ... ");
sObjectMgr->LoadQuestLocales(); sObjectMgr->LoadQuestLocales();
handler->SendGlobalGMSysMessage("DB table `locales_quest` reloaded."); handler->SendGlobalGMSysMessage("DB table `quest_template_locale` reloaded.");
return true;
}
static bool HandleReloadLocalesQuestOfferRewardCommand(ChatHandler* handler, char const* /*args*/)
{
sLog->outString("Re-Loading Quest Offer Reward Locale... ");
sObjectMgr->LoadQuestOfferRewardLocale();
handler->SendGlobalGMSysMessage("DB table `quest_offer_reward_locale` reloaded.");
return true;
}
static bool HandleReloadLocalesQuestRequestItemsCommand(ChatHandler* handler, char const* /*args*/)
{
sLog->outString("Re-Loading Quest Request Item Locale... ");
sObjectMgr->LoadQuestRequestItemsLocale();
handler->SendGlobalGMSysMessage("DB table `quest_request_item_locale` reloaded.");
return true; return true;
} }