diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Achievements/AchievementMgr.cpp | 11 | ||||
-rw-r--r-- | src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 2 | ||||
-rwxr-xr-x | src/server/game/Entities/Creature/GossipDef.cpp | 34 | ||||
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 10 | ||||
-rwxr-xr-x | src/server/game/Globals/ObjectMgr.cpp | 142 | ||||
-rwxr-xr-x | src/server/game/Globals/ObjectMgr.h | 23 | ||||
-rwxr-xr-x | src/server/game/Server/Protocol/Handlers/ItemHandler.cpp | 6 | ||||
-rwxr-xr-x | src/server/game/Server/Protocol/Handlers/QueryHandler.cpp | 25 |
8 files changed, 91 insertions, 162 deletions
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 9c065bf6d4c..4252176941d 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -2054,8 +2054,8 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) { if (AchievementRewardLocale const* loc = sAchievementMgr->GetAchievementRewardLocale(achievement)) { - sObjectMgr->GetLocaleString(loc->subject, loc_idx, subject); - sObjectMgr->GetLocaleString(loc->text, loc_idx, text); + ObjectMgr::GetLocaleString(loc->subject, loc_idx, subject); + ObjectMgr::GetLocaleString(loc->text, loc_idx, text); } } @@ -2545,11 +2545,8 @@ void AchievementGlobalMgr::LoadRewardLocales() for (int i = 1; i < TOTAL_LOCALES; ++i) { LocaleConstant locale = (LocaleConstant) i; - std::string str = fields[1 + 2 * (i - 1)].GetString(); - sObjectMgr->AddLocaleString(str, locale, data.subject); - - str = fields[1 + 2 * (i - 1) + 1].GetString(); - sObjectMgr->AddLocaleString(str, locale, data.text); + 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()); diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 44392e6b3b2..9224f4ad677 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -602,7 +602,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player // local name if (loc_idx >= 0) if (ItemLocale const *il = sObjectMgr->GetItemLocale(proto->ItemId)) - sObjectMgr->GetLocaleString(il->Name, loc_idx, name); + ObjectMgr::GetLocaleString(il->Name, loc_idx, name); // DO NOT use GetItemEnchantMod(proto->RandomProperty) as it may return a result // that matches the search but it may not equal item->GetItemRandomPropertyId() diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index dfadebdf27e..e17f8163bff 100755 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -161,7 +161,7 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const int locale = _session->GetSessionDbLocaleIndex(); if (locale >= 0) if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) - sObjectMgr->GetLocaleString(localeData->Title, locale, title); + ObjectMgr::GetLocaleString(localeData->Title, locale, title); data << title; // max 0x200 } @@ -188,7 +188,7 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const int32 locale = _session->GetSessionDbLocaleIndex(); if (locale >= 0) if (PointOfInterestLocale const *localeData = sObjectMgr->GetPointOfInterestLocale(poiId)) - sObjectMgr->GetLocaleString(localeData->IconName, locale, iconText); + ObjectMgr::GetLocaleString(localeData->IconName, locale, iconText); WorldPacket data(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 10); // guess size data << uint32(poi->flags); @@ -268,7 +268,7 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title int loc_idx = _session->GetSessionDbLocaleIndex(); if (loc_idx >= 0) if (QuestLocale const *ql = sObjectMgr->GetQuestLocale(questID)) - sObjectMgr->GetLocaleString(ql->Title, loc_idx, title); + ObjectMgr::GetLocaleString(ql->Title, loc_idx, title); data << uint32(questID); data << uint32(qmi.QuestIcon); @@ -306,10 +306,10 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const *quest, uint64 npcGUID, { if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) { - sObjectMgr->GetLocaleString(localeData->Title, locale, questTitle); - sObjectMgr->GetLocaleString(localeData->Details, locale, questDetails); - sObjectMgr->GetLocaleString(localeData->Objectives, locale, questObjectives); - sObjectMgr->GetLocaleString(localeData->EndText, locale, questEndText); + ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); + ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails); + ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives); + ObjectMgr::GetLocaleString(localeData->EndText, locale, questEndText); } } @@ -416,14 +416,14 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const { if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) { - sObjectMgr->GetLocaleString(localeData->Title, locale, questTitle); - sObjectMgr->GetLocaleString(localeData->Details, locale, questDetails); - sObjectMgr->GetLocaleString(localeData->Objectives, locale, questObjectives); - sObjectMgr->GetLocaleString(localeData->EndText, locale, questEndText); - sObjectMgr->GetLocaleString(localeData->CompletedText, locale, questCompletedText); + ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); + ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails); + ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives); + ObjectMgr::GetLocaleString(localeData->EndText, locale, questEndText); + ObjectMgr::GetLocaleString(localeData->CompletedText, locale, questCompletedText); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - sObjectMgr->GetLocaleString(localeData->ObjectiveText[i], locale, questObjectiveText[i]); + ObjectMgr::GetLocaleString(localeData->ObjectiveText[i], locale, questObjectiveText[i]); } } @@ -543,8 +543,8 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b { if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) { - sObjectMgr->GetLocaleString(localeData->Title, locale, questTitle); - sObjectMgr->GetLocaleString(localeData->OfferRewardText, locale, questOfferRewardText); + ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); + ObjectMgr::GetLocaleString(localeData->OfferRewardText, locale, questOfferRewardText); } } @@ -637,8 +637,8 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const *quest, uint64 npcGUID, { if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) { - sObjectMgr->GetLocaleString(localeData->Title, locale, questTitle); - sObjectMgr->GetLocaleString(localeData->RequestItemsText, locale, requestItemsText); + ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); + ObjectMgr::GetLocaleString(localeData->RequestItemsText, locale, requestItemsText); } } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d5f45ef64a1..cf3512acda3 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -14095,8 +14095,8 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool uint32 idxEntry = MAKE_PAIR32(menuId, itr->second.OptionIndex); if (GossipMenuItemsLocale const *no = sObjectMgr->GetGossipMenuItemsLocale(idxEntry)) { - sObjectMgr->GetLocaleString(no->OptionText, locale, strOptionText); - sObjectMgr->GetLocaleString(no->BoxText, locale, strBoxText); + ObjectMgr::GetLocaleString(no->OptionText, locale, strOptionText); + ObjectMgr::GetLocaleString(no->BoxText, locale, strBoxText); } } @@ -14458,7 +14458,7 @@ void Player::SendPreparedQuest(uint64 guid) int loc_idx = GetSession()->GetSessionDbLocaleIndex(); if (loc_idx >= 0) if (NpcTextLocale const *nl = sObjectMgr->GetNpcTextLocale(textid)) - sObjectMgr->GetLocaleString(nl->Text_0[0], loc_idx, title); + ObjectMgr::GetLocaleString(nl->Text_0[0], loc_idx, title); } else { @@ -14467,7 +14467,7 @@ void Player::SendPreparedQuest(uint64 guid) int loc_idx = GetSession()->GetSessionDbLocaleIndex(); if (loc_idx >= 0) if (NpcTextLocale const *nl = sObjectMgr->GetNpcTextLocale(textid)) - sObjectMgr->GetLocaleString(nl->Text_1[0], loc_idx, title); + ObjectMgr::GetLocaleString(nl->Text_1[0], loc_idx, title); } } } @@ -16165,7 +16165,7 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver) int loc_idx = pReceiver->GetSession()->GetSessionDbLocaleIndex(); if (loc_idx >= 0) if (const QuestLocale* pLocale = sObjectMgr->GetQuestLocale(pQuest->GetQuestId())) - sObjectMgr->GetLocaleString(pLocale->Title, loc_idx, strTitle); + ObjectMgr::GetLocaleString(pLocale->Title, loc_idx, strTitle); WorldPacket data(SMSG_QUEST_CONFIRM_ACCEPT, (4 + strTitle.size() + 8)); data << uint32(pQuest->GetQuestId()); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 262400d1483..060326b8d84 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -251,23 +251,11 @@ bool SpellClickInfo::IsFitToRequirements(Unit const* clicker, Unit const* clicke return true; } -ObjectMgr::ObjectMgr() -{ - m_hiCharGuid = 1; - m_hiCreatureGuid = 1; - m_hiPetGuid = 1; - m_hiVehicleGuid = 1; - m_hiItemGuid = 1; - m_hiGoGuid = 1; - m_hiDoGuid = 1; - m_hiCorpseGuid = 1; - m_hiPetNumber = 1; - m_hiMoTransGuid = 1; - m_ItemTextId = 1; - m_mailid = 1; - m_equipmentSetGuid = 1; - m_auctionid = 1; -} +ObjectMgr::ObjectMgr(): m_auctionid(1), m_equipmentSetGuid(1), + m_ItemTextId(1), m_mailid(1), m_hiPetNumber(1), m_hiCharGuid(1), + m_hiCreatureGuid(1), m_hiPetGuid(1), m_hiVehicleGuid(1), m_hiItemGuid(1), + m_hiGoGuid(1), m_hiDoGuid(1), m_hiCorpseGuid(1), m_hiMoTransGuid(1) +{} ObjectMgr::~ObjectMgr() { @@ -291,7 +279,7 @@ ObjectMgr::~ObjectMgr() m_mCacheTrainerSpellMap.clear(); } -void ObjectMgr::AddLocaleString(std::string& s, LocaleConstant locale, StringVector& data) +void ObjectMgr::AddLocaleString(std::string const& s, LocaleConstant locale, StringVector& data) { if (!s.empty()) { @@ -324,11 +312,8 @@ void ObjectMgr::LoadCreatureLocales() for (uint8 i = 1; i < TOTAL_LOCALES; ++i) { LocaleConstant locale = (LocaleConstant) i; - std::string str = fields[1 + 2 * (i - 1)].GetString(); - AddLocaleString(str, locale, data.Name); - - str = fields[1 + 2 * (i - 1) + 1].GetString(); - AddLocaleString(str, locale, data.SubName); + AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.Name); + AddLocaleString(fields[1 + 2 * (i - 1) + 1].GetString(), locale, data.SubName); } } while (result->NextRow()); @@ -364,11 +349,8 @@ void ObjectMgr::LoadGossipMenuItemsLocales() for (uint8 i = 1; i < TOTAL_LOCALES; ++i) { LocaleConstant locale = (LocaleConstant) i; - std::string str = fields[2 + 2 * (i - 1)].GetString(); - AddLocaleString(str, locale, data.OptionText); - - str = fields[2 + 2 * (i - 1) + 1].GetString(); - AddLocaleString(str, locale, data.BoxText); + AddLocaleString(fields[2 + 2 * (i - 1)].GetString(), locale, data.OptionText); + AddLocaleString(fields[2 + 2 * (i - 1) + 1].GetString(), locale, data.BoxText); } } while (result->NextRow()); @@ -396,10 +378,7 @@ void ObjectMgr::LoadPointOfInterestLocales() PointOfInterestLocale& data = mPointOfInterestLocaleMap[entry]; for (uint8 i = 1; i < TOTAL_LOCALES; ++i) - { - std::string str = fields[i].GetString(); - AddLocaleString(str, LocaleConstant(i), data.IconName); - } + AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName); } while (result->NextRow()); sLog->outString(">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)mPointOfInterestLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime)); @@ -1706,7 +1685,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float return 0; uint32 level = cInfo->minlevel == cInfo->maxlevel ? cInfo->minlevel : urand(cInfo->minlevel, cInfo->maxlevel); // Only used for extracting creature base stats - CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(level, cInfo->unit_class); + CreatureBaseStats const* stats = GetCreatureBaseStats(level, cInfo->unit_class); uint32 guid = GenerateLowGuid(HIGHGUID_UNIT); CreatureData& data = NewOrExistCreatureData(guid); @@ -2012,7 +1991,7 @@ uint64 ObjectMgr::GetPlayerGUIDByName(std::string name) const return guid; } -bool ObjectMgr::GetPlayerNameByGUID(const uint64 guid, std::string &name) const +bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string &name) const { // prevent DB access for online player if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -2032,7 +2011,7 @@ bool ObjectMgr::GetPlayerNameByGUID(const uint64 guid, std::string &name) const return false; } -uint32 ObjectMgr::GetPlayerTeamByGUID(const uint64 guid) const +uint32 ObjectMgr::GetPlayerTeamByGUID(uint64 guid) const { // prevent DB access for online player if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -2051,7 +2030,7 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(const uint64 guid) const return 0; } -uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 guid) const +uint32 ObjectMgr::GetPlayerAccountIdByGUID(uint64 guid) const { // prevent DB access for online player if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -2103,11 +2082,8 @@ void ObjectMgr::LoadItemLocales() for (uint8 i = 1; i < TOTAL_LOCALES; ++i) { LocaleConstant locale = (LocaleConstant) i; - std::string str = fields[1 + 2 * (i - 1)].GetString(); - AddLocaleString(str, locale, data.Name); - - str = fields[1 + 2 * (i - 1) + 1].GetString(); - AddLocaleString(str, locale, data.Description); + AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.Name); + AddLocaleString(fields[1 + 2 * (i - 1) + 1].GetString(), locale, data.Description); } } while (result->NextRow()); @@ -2741,10 +2717,7 @@ void ObjectMgr::LoadItemSetNameLocales() ItemSetNameLocale& data = mItemSetNameLocaleMap[entry]; for (uint8 i = 1; i < TOTAL_LOCALES; ++i) - { - std::string str = fields[i].GetString(); - AddLocaleString(str, LocaleConstant(i), data.Name); - } + AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name); } while (result->NextRow()); sLog->outString(">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(mItemSetNameLocaleMap.size()), GetMSTimeDiffToNow(oldMSTime)); @@ -4430,32 +4403,17 @@ void ObjectMgr::LoadQuestLocales() for (uint8 i = 1; i < TOTAL_LOCALES; ++i) { LocaleConstant locale = (LocaleConstant) i; - std::string str = fields[1 + 11 * (i - 1)].GetString(); - AddLocaleString(str, locale, data.Title); - - str = fields[1 + 11 * (i - 1) + 1].GetString(); - AddLocaleString(str, locale, data.Details); - str = fields[1 + 11 * (i - 1) + 2].GetString(); - AddLocaleString(str, locale, data.Objectives); - - str = fields[1 + 11 * (i - 1) + 3].GetString(); - AddLocaleString(str, locale, data.OfferRewardText); - - str = fields[1 + 11 * (i - 1) + 4].GetString(); - AddLocaleString(str, locale, data.RequestItemsText); - - str = fields[1 + 11 * (i - 1) + 5].GetString(); - AddLocaleString(str, locale, data.EndText); - - str = fields[1 + 11 * (i - 1) + 6].GetString(); - AddLocaleString(str, locale, data.CompletedText); + AddLocaleString(fields[1 + 11 * (i - 1)].GetString(), locale, data.Title); + AddLocaleString(fields[1 + 11 * (i - 1) + 1].GetString(), locale, data.Details); + 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.EndText); + AddLocaleString(fields[1 + 11 * (i - 1) + 6].GetString(), locale, data.CompletedText); for (uint8 k = 0; k < 4; ++k) - { - str = fields[1 + 11 * (i - 1) + 7 + k].GetString(); - AddLocaleString(str, locale, data.ObjectiveText[k]); - } + AddLocaleString(fields[1 + 11 * (i - 1) + 7 + k].GetString(), locale, data.ObjectiveText[k]); } } while (result->NextRow()); @@ -4753,7 +4711,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) case SCRIPT_COMMAND_CREATE_ITEM: { - if (!sObjectMgr->GetItemTemplate(tmp.CreateItem.ItemEntry)) + if (!GetItemTemplate(tmp.CreateItem.ItemEntry)) { sLog->outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", tableName.c_str(), tmp.CreateItem.ItemEntry, tmp.id); @@ -4858,20 +4816,11 @@ void ObjectMgr::LoadEventScripts() // Load all possible script entries from spells for (uint32 i = 1; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) - { - SpellInfo const* spell = sSpellMgr->GetSpellInfo(i); - if (spell) - { + if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(i)) for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { if (spell->Effects[j].Effect == SPELL_EFFECT_SEND_EVENT) - { if (spell->Effects[j].MiscValue) evt_scripts.insert(spell->Effects[j].MiscValue); - } - } - } - } for (size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx) { @@ -5115,11 +5064,7 @@ void ObjectMgr::LoadPageTextLocales() PageTextLocale& data = mPageTextLocaleMap[entry]; for (uint8 i = 1; i < TOTAL_LOCALES; ++i) - { - std::string str = fields[i].GetString(); - AddLocaleString(str, LocaleConstant(i), data.Text); - } - + AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text); } while (result->NextRow()); sLog->outString(">> Loaded %lu PageText locale strings in %u ms", (unsigned long)mPageTextLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime)); @@ -5351,11 +5296,8 @@ void ObjectMgr::LoadNpcTextLocales() LocaleConstant locale = (LocaleConstant) i; for (uint8 j = 0; j < MAX_LOCALES; ++j) { - std::string str0 = fields[1 + 8 * 2 * (i - 1) + 2 * j].GetString(); - AddLocaleString(str0, locale, data.Text_0[j]); - - std::string str1 = fields[1 + 8 * 2 * (i - 1) + 2 * j + 1].GetString(); - AddLocaleString(str1, locale, data.Text_1[j]); + AddLocaleString(fields[1 + 8 * 2 * (i - 1) + 2 * j].GetString(), locale, data.Text_0[j]); + AddLocaleString(fields[1 + 8 * 2 * (i - 1) + 2 * j + 1].GetString(), locale, data.Text_1[j]); } } } while (result->NextRow()); @@ -6392,24 +6334,17 @@ void ObjectMgr::LoadGameObjectLocales() GameObjectLocale& data = mGameObjectLocaleMap[entry]; for (uint8 i = 1; i < TOTAL_LOCALES; ++i) - { - std::string str = fields[i].GetString(); - AddLocaleString(str, LocaleConstant(i), data.Name); - } + AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name); for (uint8 i = 1; i < TOTAL_LOCALES; ++i) - { - std::string str = fields[i + (TOTAL_LOCALES - 1)].GetString(); - AddLocaleString(str, LocaleConstant(i), data.CastBarCaption); - } - + AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption); } while (result->NextRow()); sLog->outString(">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)mGameObjectLocaleMap.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } -inline void CheckGOLockId(GameObjectTemplate* goInfo, uint32 dataN, uint32 N) +inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) { if (sLockStore.LookupEntry(dataN)) return; @@ -7873,10 +7808,7 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max ++count; for (uint8 i = 0; i < TOTAL_LOCALES; ++i) - { - std::string str = fields[i + 1].GetString(); - AddLocaleString(str, LocaleConstant(i), data.Content); - } + AddLocaleString(fields[i + 1].GetString(), LocaleConstant(i), data.Content); } while (result->NextRow()); if (min_value == MIN_TRINITY_STRING_ID) @@ -8887,9 +8819,9 @@ void ObjectMgr::LoadFactionChangeItems() uint32 alliance = fields[0].GetUInt32(); uint32 horde = fields[1].GetUInt32(); - if (!sObjectMgr->GetItemTemplate(alliance)) + if (!GetItemTemplate(alliance)) sLog->outErrorDb("Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", alliance); - else if (!sObjectMgr->GetItemTemplate(horde)) + else if (!GetItemTemplate(horde)) sLog->outErrorDb("Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", horde); else factionchange_items[alliance] = horde; diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 68a70b451ab..4898727e995 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -338,7 +338,7 @@ struct SpellClickInfo { uint32 spellId; uint32 questStart; // quest start (quest must be active or rewarded for spell apply) - uint32 questEnd; // quest end (quest don't must be rewarded for spell apply) + uint32 questEnd; // quest end (quest must not be rewarded for spell apply) bool questStartCanActive; // if true then quest start can be active (not only rewarded) uint8 castFlags; uint32 auraRequired; @@ -592,8 +592,10 @@ class ObjectMgr { friend class PlayerDumpReader; friend class ACE_Singleton<ObjectMgr, ACE_Null_Mutex>; - ObjectMgr(); - ~ObjectMgr(); + + private: + ObjectMgr(); + ~ObjectMgr(); public: typedef UNORDERED_MAP<uint32, Item*> ItemMap; @@ -629,7 +631,7 @@ class ObjectMgr CreatureTemplateContainer const* GetCreatureTemplates() { return &CreatureTemplateStore; } CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId); CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID); - uint32 ChooseDisplayId(uint32 team, const CreatureTemplate *cinfo, const CreatureData *data = NULL); + static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate *cinfo, const CreatureData *data = NULL); static void ChooseCreatureFlags(const CreatureTemplate *cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData *data = NULL); EquipmentInfo const *GetEquipmentInfo(uint32 entry); CreatureAddon const *GetCreatureAddon(uint32 lowguid); @@ -667,9 +669,9 @@ class ObjectMgr void GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, PlayerLevelInfo* info) const; uint64 GetPlayerGUIDByName(std::string name) const; - bool GetPlayerNameByGUID(const uint64 guid, std::string &name) const; - uint32 GetPlayerTeamByGUID(const uint64 guid) const; - uint32 GetPlayerAccountIdByGUID(const uint64 guid) const; + bool GetPlayerNameByGUID(uint64 guid, std::string &name) const; + uint32 GetPlayerTeamByGUID(uint64 guid) const; + uint32 GetPlayerAccountIdByGUID(uint64 guid) const; uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const; uint32 GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team); @@ -928,7 +930,6 @@ class ObjectMgr uint32 GenerateLowGuid(HighGuid guidhigh); uint32 GenerateAuctionID(); uint64 GenerateEquipmentSetGuid(); - uint32 GenerateMailID(); uint32 GeneratePetNumber(); @@ -1168,8 +1169,8 @@ class ObjectMgr // for wintergrasp only GraveYardMap mGraveYardMap; - void AddLocaleString(std::string& s, LocaleConstant locale, StringVector& data); - inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value) const + static void AddLocaleString(const std::string& s, LocaleConstant locale, StringVector& data); + static inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value) { if (data.size() > size_t(loc_idx) && !data[loc_idx].empty()) value = data[loc_idx]; @@ -1194,7 +1195,7 @@ class ObjectMgr uint32 m_mailid; uint32 m_hiPetNumber; - // first free low guid for seelcted guid type + // first free low guid for selected guid type uint32 m_hiCharGuid; uint32 m_hiCreatureGuid; uint32 m_hiPetGuid; diff --git a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp index 2bcfd9aa0d2..b1afc3d6c97 100755 --- a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp @@ -297,8 +297,8 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data) { if (ItemLocale const *il = sObjectMgr->GetItemLocale(pProto->ItemId)) { - sObjectMgr->GetLocaleString(il->Name, loc_idx, Name); - sObjectMgr->GetLocaleString(il->Description, loc_idx, Description); + ObjectMgr::GetLocaleString(il->Name, loc_idx, Name); + ObjectMgr::GetLocaleString(il->Description, loc_idx, Description); } } // guess size @@ -1036,7 +1036,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) if (ItemSetNameLocale const *isnl = sObjectMgr->GetItemSetNameLocale(itemid)) - sObjectMgr->GetLocaleString(isnl->Name, loc_idx, Name); + ObjectMgr::GetLocaleString(isnl->Name, loc_idx, Name); WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4+Name.size()+1+4)); data << uint32(itemid); diff --git a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp index 40803a0d13b..88cff4fc7cf 100755 --- a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp @@ -120,15 +120,13 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult result) SendPacket(&data); } -void WorldSession::HandleNameQueryOpcode(WorldPacket & recv_data) +void WorldSession::HandleNameQueryOpcode(WorldPacket& recv_data) { uint64 guid; recv_data >> guid; - Player *pChar = ObjectAccessor::FindPlayer(guid); - - if (pChar) + if (Player *pChar = ObjectAccessor::FindPlayer(guid)) SendNameQueryOpcode(pChar); else SendNameQueryOpcodeFromDB(guid); @@ -147,7 +145,7 @@ void WorldSession::SendQueryTimeResponse() SendPacket(&data); } -/// Only _static_ data send in this packet !!! +/// Only _static_ data is sent in this packet !!! void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data) { uint32 entry; @@ -168,8 +166,8 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data) { if (CreatureLocale const *cl = sObjectMgr->GetCreatureLocale(entry)) { - sObjectMgr->GetLocaleString(cl->Name, loc_idx, Name); - sObjectMgr->GetLocaleString(cl->SubName, loc_idx, SubName); + ObjectMgr::GetLocaleString(cl->Name, loc_idx, Name); + ObjectMgr::GetLocaleString(cl->SubName, loc_idx, SubName); } } sLog->outDetail("WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name.c_str(), entry); @@ -210,7 +208,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data) } } -/// Only _static_ data send in this packet !!! +/// Only _static_ data is sent in this packet !!! void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data) { uint32 entry; @@ -234,8 +232,8 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data) { if (GameObjectLocale const *gl = sObjectMgr->GetGameObjectLocale(entry)) { - sObjectMgr->GetLocaleString(gl->Name, loc_idx, Name); - sObjectMgr->GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption); + ObjectMgr::GetLocaleString(gl->Name, loc_idx, Name); + ObjectMgr::GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption); } } sLog->outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry); @@ -365,8 +363,8 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) { for (int i = 0; i < MAX_LOCALES; ++i) { - sObjectMgr->GetLocaleString(nl->Text_0[i], loc_idx, Text_0[i]); - sObjectMgr->GetLocaleString(nl->Text_1[i], loc_idx, Text_1[i]); + ObjectMgr::GetLocaleString(nl->Text_0[i], loc_idx, Text_0[i]); + ObjectMgr::GetLocaleString(nl->Text_1[i], loc_idx, Text_1[i]); } } } @@ -400,6 +398,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_NPC_TEXT_UPDATE"); } +/// Only _static_ data is sent in this packet !!! void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data) { sLog->outDetail("WORLD: Received CMSG_PAGE_TEXT_QUERY"); @@ -429,7 +428,7 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) if (PageTextLocale const *pl = sObjectMgr->GetPageTextLocale(pageID)) - sObjectMgr->GetLocaleString(pl->Text, loc_idx, Text); + ObjectMgr::GetLocaleString(pl->Text, loc_idx, Text); data << Text; data << uint32(pageText->NextPage); |