From 1e1679a1f7d9cdecb49f40f8084b46dbfd48577b Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Sun, 12 Jul 2020 15:36:55 +0200 Subject: Core/DataStores: Port refactors from Update DBC field names to generated ones (#24999) (cherry picked from commit c92950b3e1f6366d85d707365a8ad2caddafeecc) --- src/server/scripts/Commands/cs_character.cpp | 2 +- src/server/scripts/Commands/cs_debug.cpp | 18 ++++++------------ src/server/scripts/Commands/cs_group.cpp | 3 ++- src/server/scripts/Commands/cs_learn.cpp | 8 ++++---- src/server/scripts/Commands/cs_lookup.cpp | 2 +- src/server/scripts/Commands/cs_misc.cpp | 4 ++-- 6 files changed, 16 insertions(+), 21 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 86575afcdae..2add325bfa2 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -279,7 +279,7 @@ public: if (titleInfo && target->HasTitle(titleInfo)) { - std::string name = (target->GetNativeGender() == GENDER_MALE ? titleInfo->Name : titleInfo->Name1)[handler->GetSessionDbcLocale()]; + std::string name = target->GetNativeGender() == GENDER_MALE ? titleInfo->Name[loc] : titleInfo->Name1[loc]; if (name.empty()) continue; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 3ff8463ce56..aac8b3379e5 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1472,8 +1472,7 @@ public: } if (!mEntry->IsDungeon()) { - handler->PSendSysMessage("'%s' is not a dungeon map.", - mEntry->MapName[handler->GetSessionDbcLocale()]); + handler->PSendSysMessage("'%s' is not a dungeon map.", mEntry->MapName[handler->GetSessionDbcLocale()]); return true; } int32 difficulty = difficulty_str ? atoi(difficulty_str) : -1; @@ -1484,34 +1483,29 @@ public: } if (difficulty >= 0 && !sDB2Manager.GetMapDifficultyData(mEntry->ID, Difficulty(difficulty))) { - handler->PSendSysMessage("Difficulty %d is not valid for '%s'.", - difficulty, mEntry->MapName[handler->GetSessionDbcLocale()]); + handler->PSendSysMessage("Difficulty %d is not valid for '%s'.", difficulty, mEntry->MapName[handler->GetSessionDbcLocale()]); return true; } if (difficulty == -1) { - handler->PSendSysMessage("Resetting all difficulties for '%s'.", - mEntry->MapName[handler->GetSessionDbcLocale()]); + handler->PSendSysMessage("Resetting all difficulties for '%s'.", mEntry->MapName[handler->GetSessionDbcLocale()]); for (DifficultyEntry const* diff : sDifficultyStore) { if (sDB2Manager.GetMapDifficultyData(map, Difficulty(diff->ID))) { - handler->PSendSysMessage("Resetting difficulty %d for '%s'.", - diff->ID, mEntry->MapName[handler->GetSessionDbcLocale()]); + handler->PSendSysMessage("Resetting difficulty %d for '%s'.", diff->ID, mEntry->MapName[handler->GetSessionDbcLocale()]); sInstanceSaveMgr->ForceGlobalReset(map, Difficulty(diff->ID)); } } } else if (mEntry->IsNonRaidDungeon() && difficulty == DIFFICULTY_NORMAL) { - handler->PSendSysMessage("'%s' does not have any permanent saves for difficulty %d.", - mEntry->MapName[handler->GetSessionDbcLocale()], difficulty); + handler->PSendSysMessage("'%s' does not have any permanent saves for difficulty %d.", mEntry->MapName[handler->GetSessionDbcLocale()], difficulty); } else { - handler->PSendSysMessage("Resetting difficulty %d for '%s'.", - difficulty, mEntry->MapName[handler->GetSessionDbcLocale()]); + handler->PSendSysMessage("Resetting difficulty %d for '%s'.", difficulty, mEntry->MapName[handler->GetSessionDbcLocale()]); sInstanceSaveMgr->ForceGlobalReset(map, Difficulty(difficulty)); } return true; diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 2f5c92a0082..078d1c319e5 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -419,6 +419,7 @@ public: { // ... than, it prints information like "is online", where he is, etc... onlineState = "online"; + LocaleConstant locale = handler->GetSessionDbcLocale(); phases = PhasingHandler::FormatPhases(p->GetPhaseShift()); AreaTableEntry const* area = sAreaTableStore.LookupEntry(p->GetAreaId()); @@ -426,7 +427,7 @@ public: { AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID); if (zone) - zoneName = zone->AreaName[handler->GetSessionDbcLocale()]; + zoneName = zone->AreaName[locale]; } } else diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index 3a5699cdcd0..b23f38bc2e2 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -250,12 +250,12 @@ public: if (!talentInfo) continue; - TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TabID); if (!talentTabInfo) continue; // prevent learn talent for different family (cheating) - if (((1 << petFamily->PetTalentType) & talentTabInfo->petTalentMask) == 0) + if (((1 << petFamily->PetTalentType) & talentTabInfo->PetTalentMask) == 0) continue; // search highest talent rank @@ -263,9 +263,9 @@ public: for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank) { - if (talentInfo->RankID[rank] != 0) + if (talentInfo->SpellRank[rank] != 0) { - spellId = talentInfo->RankID[rank]; + spellId = talentInfo->SpellRank[rank]; break; } } diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 217b02a3b50..6eb2ef1d6c5 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -1337,13 +1337,13 @@ public: uint32 counter = 0; uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); + LocaleConstant locale = handler->GetSessionDbcLocale(); // search in Map.dbc for (uint32 id = 0; id < sMapStore.GetNumRows(); id++) { if (MapEntry const* mapInfo = sMapStore.LookupEntry(id)) { - LocaleConstant locale = handler->GetSessionDbcLocale(); std::string name = mapInfo->MapName[locale]; if (name.empty()) continue; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index a7ff2cb6c2f..d8d24e4934a 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1914,13 +1914,13 @@ public: AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId); if (area) { - zoneName = area->AreaName[handler->GetSessionDbcLocale()]; + zoneName = area->AreaName[locale]; AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID); if (zone) { areaName = zoneName; - zoneName = zone->AreaName[handler->GetSessionDbcLocale()]; + zoneName = zone->AreaName[locale]; } } -- cgit v1.2.3