diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 728f52d59..2041bdfa4 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -1145,7 +1145,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid if (it == bgDataStore.end()) return; - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(it->second.m_Battlegrounds.begin()->second->GetMapId(), player->GetLevel()); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(it->second.m_Battlegrounds.begin()->second->GetMapId(), player->GetLevel()); if (!bracketEntry) return; diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 2b14f5d34..5a6009b27 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -918,7 +918,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp return; } - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketById(bgTemplate->GetMapId(), bracket_id); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketById(bgTemplate->GetMapId(), bracket_id); if (!bracketEntry) { TC_LOG_ERROR("bg.battleground", "Battleground: Update: bg bracket entry not found for map %u bracket id %u", bgTemplate->GetMapId(), bracket_id); @@ -1443,7 +1443,7 @@ void SoloQueue::DoMatchmaking(GroupQueueInfo* ginfo, uint32 extraDiff, bool stro return; Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA); - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketById(bg->GetMapId(), bracketId); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketById(bg->GetMapId(), bracketId); if (!bracketEntry) { TC_LOG_ERROR("server", "SoloQueue::DoMatchmaking: bg bracket entry not found for map %u bracket id %u", bg->GetMapId(), bracketId); @@ -1818,7 +1818,7 @@ BattlegroundBracketId SoloQueue::GetSoloQueueBracketId() if (!bg) return BG_BRACKET_ID_FIRST; - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), DEFAULT_MAX_LEVEL); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), DEFAULT_MAX_LEVEL); if (!bracketEntry) return BG_BRACKET_ID_FIRST; diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index d4b3e2d82..75ce8f34d 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -51,7 +51,8 @@ struct WMOAreaTableTripple int32 adtId; }; -typedef std::map WMOAreaInfoByTripple; +typedef std::tuple WMOAreaTableKey; +typedef std::map WMOAreaInfoByTripple; DBCStorage sAreaTableStore(AreaTableEntryfmt); DBCStorage sAreaGroupStore(AreaGroupEntryfmt); @@ -582,10 +583,9 @@ void DBCManager::LoadDBCStores(const std::string& dataPath, uint32 defaultLocale LOAD_DBC(availableDbcLocales, bad_dbc_files, sPhaseStore, dbcPath, "Phase.dbc"); // 18414 LOAD_DBC(availableDbcLocales, bad_dbc_files, sPhaseGroupStore, dbcPath, "PhaseXPhaseGroup.dbc"); // 18414 - for (uint32 i = 0; i < sPhaseGroupStore.GetNumRows(); ++i) - if (PhaseGroupEntry const* group = sPhaseGroupStore.LookupEntry(i)) - if (PhaseEntry const* phase = sPhaseStore.LookupEntry(group->PhaseId)) - sPhasesByGroup[group->GroupId].insert(phase->ID); + for (PhaseGroupEntry const* group : sPhaseGroupStore) + if (PhaseEntry const* phase = sPhaseStore.LookupEntry(group->PhaseID)) + sPhasesByGroup[group->PhaseGroupID].push_back(phase->ID); LOAD_DBC(availableDbcLocales, bad_dbc_files, sPlayerConditionStore, dbcPath, "PlayerCondition.dbc"); // 18414 LOAD_DBC(availableDbcLocales, bad_dbc_files, sPvPDifficultyStore, dbcPath, "PvpDifficulty.dbc");//15595 @@ -869,9 +869,10 @@ void DBCManager::LoadDBCStores(const std::string& dataPath, uint32 defaultLocale LOAD_DBC(availableDbcLocales, bad_dbc_files, sVehicleStore, dbcPath, "Vehicle.dbc");//15595 LOAD_DBC(availableDbcLocales, bad_dbc_files, sVehicleSeatStore, dbcPath, "VehicleSeat.dbc");//15595 LOAD_DBC(availableDbcLocales, bad_dbc_files, sWMOAreaTableStore, dbcPath, "WMOAreaTable.dbc");//15595 - for (uint32 i = 0; i < sWMOAreaTableStore.GetNumRows(); ++i) - if (WMOAreaTableEntry const* entry = sWMOAreaTableStore.LookupEntry(i)) - sWMOAreaInfoByTripple.insert(WMOAreaInfoByTripple::value_type(WMOAreaTableTripple(entry->rootId, entry->adtId, entry->groupId), entry)); + + for (WMOAreaTableEntry const* entry : sWMOAreaTableStore) + sWMOAreaInfoByTripple[WMOAreaTableKey(entry->WMOID, entry->NameSetID, entry->WMOGroupID)] = entry; + LOAD_DBC(availableDbcLocales, bad_dbc_files, sWorldMapAreaStore, dbcPath, "WorldMapArea.dbc");//15595 LOAD_DBC(availableDbcLocales, bad_dbc_files, sWorldMapOverlayStore, dbcPath, "WorldMapOverlay.dbc");//15595 LOAD_DBC(availableDbcLocales, bad_dbc_files, sWorldSafeLocsStore, dbcPath, "WorldSafeLocs.dbc");//15595 @@ -911,31 +912,28 @@ void DBCManager::LoadDBCStores(const std::string& dataPath, uint32 defaultLocale TC_LOG_INFO("server.loading", ">> Initialized %d DBC data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); } -const std::string* GetRandomCharacterName(uint8 race, uint8 gender) +std::string const& DBCManager::GetRandomCharacterName(uint8 race, uint8 gender) { - uint32 size = sGenNameVectoArraysMap[race].stringVectorArray[gender].size(); - uint32 randPos = urand(0, size-1); - - return &sGenNameVectoArraysMap[race].stringVectorArray[gender][randPos]; + return Trinity::Containers::SelectRandomContainerElement(sGenNameVectoArraysMap[race].stringVectorArray[gender]); } -SimpleFactionsList const* GetFactionTeamList(uint32 faction) +SimpleFactionsList const* DBCManager::GetFactionTeamList(uint32 faction) { FactionTeamMap::const_iterator itr = sFactionTeamMap.find(faction); if (itr != sFactionTeamMap.end()) return &itr->second; - return NULL; + return nullptr; } -char const* GetPetName(uint32 petfamily, uint32 dbclang) +char const* DBCManager::GetPetName(uint32 petfamily, uint32 /*dbclang*/) { if (!petfamily) - return NULL; + return nullptr; CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(petfamily); if (!pet_family) - return NULL; - return pet_family->Name ? pet_family->Name : NULL; + return nullptr; + return pet_family->Name ? pet_family->Name : nullptr; } SpellEffectEntry const* GetSpellEffectEntry(uint32 spellId, uint32 effect, uint32 difficulty) @@ -950,16 +948,16 @@ SpellEffectEntry const* GetSpellEffectEntry(uint32 spellId, uint32 effect, uint3 return itr->second.effects[REGULAR_DIFFICULTY][effect]; } -TalentSpellPos const* GetTalentSpellPos(uint32 spellId) +TalentSpellPos const* DBCManager::GetTalentSpellPos(uint32 spellId) { TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId); if (itr == sTalentSpellPosMap.end()) - return NULL; + return nullptr; return &itr->second; } -uint32 GetTalentSpellCost(uint32 spellId) +uint32 DBCManager::GetTalentSpellCost(uint32 spellId) { if (TalentSpellPos const* pos = GetTalentSpellPos(spellId)) return pos->rank+1; @@ -967,27 +965,28 @@ uint32 GetTalentSpellCost(uint32 spellId) return 0; } -WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid) +WMOAreaTableEntry const* DBCManager::GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid) { - WMOAreaInfoByTripple::iterator i = sWMOAreaInfoByTripple.find(WMOAreaTableTripple(rootid, adtid, groupid)); - if (i == sWMOAreaInfoByTripple.end()) - return NULL; + auto i = sWMOAreaInfoByTripple.find(WMOAreaTableKey(int16(rootid), int8(adtid), groupid)); + if (i != sWMOAreaInfoByTripple.end()) return i->second; + + return nullptr; } -char const* GetRaceName(uint8 race, uint8 locale) +char const* DBCManager::GetRaceName(uint8 race, uint8 locale) { ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race); return raceEntry ? raceEntry->name : nullptr; } -char const* GetClassName(uint8 class_, uint8 locale) +char const* DBCManager::GetClassName(uint8 class_, uint8 locale) { ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_); return classEntry ? classEntry->name : nullptr; } -uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId) +uint32 DBCManager::GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId) { if (mapid != 530 && mapid != 571 && mapid != 732) // speed for most cases return mapid; @@ -998,7 +997,7 @@ uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId) return mapid; } -uint32 GetMaxLevelForExpansion(uint32 expansion) +uint32 DBCManager::GetMaxLevelForExpansion(uint32 expansion) { switch (expansion) { @@ -1022,7 +1021,7 @@ uint32 GetMaxLevelForExpansion(uint32 expansion) Used only for calculate xp gain by content lvl. Calculation on Gilneas and group maps of LostIslands calculated as CONTENT_1_60. */ -ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) +ContentLevels DBCManager::GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) { mapid = GetVirtualMapForMapAndZone(mapid, zoneId); if (mapid < 2) @@ -1066,20 +1065,22 @@ bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredT return (itemEntry->categoryMask & reqEntry->categoryMask) == reqEntry->categoryMask; } -void Zone2MapCoordinates(float& x, float& y, uint32 zone) +bool DBCManager::Zone2MapCoordinates(float& x, float& y, uint32 zone) const { WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); // if not listed then map coordinates (instance) if (!maEntry) - return; + return false; std::swap(x, y); // at client map coords swapped x = x*((maEntry->x2-maEntry->x1)/100)+maEntry->x1; y = y*((maEntry->y2-maEntry->y1)/100)+maEntry->y1; // client y coord from top to down + + return true; } -void Map2ZoneCoordinates(float& x, float& y, uint32 zone) +void DBCManager::Map2ZoneCoordinates(float& x, float& y, uint32 zone) { WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); @@ -1116,13 +1117,13 @@ std::vector const* dbc::GetSpecializetionSpells(uint32 specializationId) return &it->second; } -MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) +MapDifficulty const* DBCManager::GetMapDifficultyData(uint32 mapId, Difficulty difficulty) { MapDifficultyMap::const_iterator itr = sMapDifficultyMap.find(MAKE_PAIR32(mapId, difficulty)); - return itr != sMapDifficultyMap.end() ? &itr->second : NULL; + return itr != sMapDifficultyMap.end() ? &itr->second : nullptr; } -MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty) +MapDifficulty const* DBCManager::GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty) { uint32 tmpDiff = uint32(difficulty); MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff)); @@ -1159,7 +1160,7 @@ MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &di return mapDiff; } -PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level) +PvPDifficultyEntry const* DBCManager::GetBattlegroundBracketByLevel(uint32 mapid, uint32 level) { PvPDifficultyEntry const* maxEntry = NULL; // used for level > max listed level case for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) @@ -1183,14 +1184,14 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev return maxEntry; } -PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id) +PvPDifficultyEntry const* DBCManager::GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id) { for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) if (entry->mapId == mapid && entry->GetBracketId() == id) return entry; - return NULL; + return nullptr; } dbc::TalentTabs dbc::GetClassSpecializations(uint8 classId) @@ -1201,7 +1202,7 @@ dbc::TalentTabs dbc::GetClassSpecializations(uint8 classId) return sSpecializationClassStore[classId]; } -uint32 GetLiquidFlags(uint32 liquidType) +uint32 DBCManager::GetLiquidFlags(uint32 liquidType) { if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquidType)) return 1 << liq->SoundBank; @@ -1209,19 +1210,18 @@ uint32 GetLiquidFlags(uint32 liquidType) return 0; } -CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender) +CharStartOutfitEntry const* DBCManager::GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender) { std::map::const_iterator itr = sCharStartOutfitMap.find(race | (class_ << 8) | (gender << 16)); if (itr == sCharStartOutfitMap.end()) - return NULL; + return nullptr; return itr->second; } -uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId) +uint32 DBCManager::GetPowerIndexByClass(Powers power, uint32 classId) { - ASSERT(powerType < MAX_POWERS && classId < MAX_CLASSES); - return PowersByClass[classId][powerType]; + return PowersByClass[classId][power]; } uint32 ScalingStatValuesEntry::GetStatMultiplier(uint32 inventoryType) const @@ -1388,7 +1388,7 @@ DigsitePOIPolygon const* GetDigsitePOIPolygon(uint32 digsiteId) } /// Returns LFGDungeonEntry for a specific map and difficulty. Will return first found entry if multiple dungeons use the same map (such as Scarlet Monastery) -LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty) +LFGDungeonEntry const* DBCManager::GetLFGDungeon(uint32 mapId, Difficulty difficulty) { for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) { @@ -1396,11 +1396,11 @@ LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty) if (!dungeon) continue; - if (dungeon->map == int32(mapId) && Difficulty(dungeon->difficulty) == difficulty) + if (dungeon->MapID == int32(mapId) && Difficulty(dungeon->DifficultyID) == difficulty) return dungeon; } - return NULL; + return nullptr; } uint32 GetDefaultMapLight(uint32 mapId) @@ -1467,9 +1467,13 @@ void dbc::FillSpellPowers(uint32 spellId, std::vector& p powers.push_back(it->second); } -std::set const& GetPhasesForGroup(uint32 group) +std::vector const* DBCManager::GetPhasesForGroup(uint32 group) { - return sPhasesByGroup[group]; + auto itr = sPhasesByGroup.find(group); + if (itr != sPhasesByGroup.end()) + return &itr->second; + + return nullptr; } bool IsInArea(uint32 objectAreaId, uint32 areaId) diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index c9595d3d5..8e43b0f55 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -26,19 +26,7 @@ enum LocaleConstant : uint8; -char const* GetPetName(uint32 petfamily, uint32 dbclang); SpellEffectEntry const* GetSpellEffectEntry(uint32 spellId, uint32 effect, uint32 difficulty); -uint32 GetTalentSpellCost(uint32 spellId); -TalentSpellPos const* GetTalentSpellPos(uint32 spellId); - -char const* GetRaceName(uint8 race, uint8 locale); -char const* GetClassName(uint8 class_, uint8 locale); - -WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid); - -uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId); - -const std::string* GetRandomCharacterName(uint8 race, uint8 gender); enum ContentLevels { @@ -50,36 +38,21 @@ enum ContentLevels MAX_CONTENT }; -uint32 GetMaxLevelForExpansion(uint32 expansion); - -ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId); bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId); -void Zone2MapCoordinates(float &x, float &y, uint32 zone); -void Map2ZoneCoordinates(float &x, float &y, uint32 zone); uint32 GetClassBySkillId(uint32 skillId); uint32 GetSkillIdByClass(uint32 classId); -uint32 GetLiquidFlags(uint32 liquidType); - -PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level); -PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id); - -CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender); typedef std::vector > DigsitePOIPolygon; typedef std::map DigsitePOIPolygonContainer; DigsitePOIPolygon const* GetDigsitePOIPolygon(uint32 digsiteId); -uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId); -LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty); - uint32 GetDefaultMapLight(uint32 mapId); uint32 GetQuestUniqueBitFlag(uint32 questId); -std::set const& GetPhasesForGroup(uint32 group); bool IsInArea(uint32 objectAreaId, uint32 areaId); typedef std::list SimpleFactionsList; @@ -255,6 +228,8 @@ TC_GAME_API extern TaxiMask sAllianceTaxiNodesM TC_GAME_API extern TaxiMask sDeathKnightTaxiNodesMask; TC_GAME_API extern TaxiPathSetBySource sTaxiPathSetBySource; TC_GAME_API extern TaxiPathNodesByPath sTaxiPathNodesByPath; +TC_GAME_API extern DBCStorage sTransportAnimationStore; +TC_GAME_API extern DBCStorage sTransportRotationStore; TC_GAME_API extern DBCStorage sTotemCategoryStore; TC_GAME_API extern DBCStorage sUnitPowerBarStore; TC_GAME_API extern DBCStorage sVehicleStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 21ad4bad9..6dff3e3eb 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1693,16 +1693,16 @@ struct ItemSpecOverrideEntry struct LFGDungeonEntry { uint32 ID; // 0 - char const* name; // 1 + char const* name; // 1 uint32 minlevel; // 2 uint32 maxlevel; // 3 uint32 reclevel; // 4 uint32 recminlevel; // 5 uint32 recmaxlevel; // 6 - int32 map; // 7 - uint32 difficulty; // 8 - uint32 flags; // 9 - uint32 type; // 10 + int32 MapID; // 7 + uint32 DifficultyID; // 8 + uint32 Flags; // 9 + uint32 TypeID; // 10 int32 faction; // 11 //char const* iconname; // 12 uint32 expansion; // 13 @@ -1723,7 +1723,7 @@ struct LFGDungeonEntry //uint32 unk_10; // 28 // Helpers - uint32 Entry() const { return ID + (type << 24); } + uint32 Entry() const { return ID + (TypeID << 24); } }; struct LightEntry @@ -1788,9 +1788,9 @@ struct PhaseEntry struct PhaseGroupEntry { - uint32 ID; - uint32 PhaseId; - uint32 GroupId; + uint32 ID; // 1 + uint32 PhaseID; // 2 + uint32 PhaseGroupID; // 3 }; struct MailTemplateEntry @@ -2682,8 +2682,8 @@ struct UnitPowerBarEntry struct TransportAnimationEntry { //uint32 Id; - uint32 TransportEntry; - uint32 TimeSeg; + uint32 TransportID; + uint32 TimeIndex; float X; float Y; float Z; @@ -2692,9 +2692,9 @@ struct TransportAnimationEntry struct TransportRotationEntry { - //uint32 Id; - uint32 TransportEntry; - uint32 TimeSeg; + //uint32 ID; + uint32 GameObjectsID; + uint32 TimeIndex; float X; float Y; float Z; @@ -2803,21 +2803,21 @@ struct VehicleSeatEntry struct WMOAreaTableEntry { - uint32 Id; // 0 index - int32 rootId; // 1 used in root WMO - int32 adtId; // 2 used in adt file - int32 groupId; // 3 used in group WMO - //uint32 field4; - //uint32 field5; - //uint32 field6; - //uint32 field7; - //uint32 field8; - uint32 Flags; // 9 used for indoor/outdoor determination - uint32 AreaTableID; // 10 link to AreaTableEntry.ID - //char *Name; // 11 m_AreaName_lang - //uint32 field12; // 12 - //uint32 field13; // 13 - //uint32 field14; // 14 + uint32 ID; // 0 index + int32 WMOID; // 1 used in root WMO + int32 NameSetID; // 2 used in adt file + int32 WMOGroupID; // 3 used in group WMO + //uint32 SoundProviderPref; // 4 + //uint32 SoundProviderPrefUnderwater; // 5 + //uint32 AmbienceID; // 6 + //uint32 ZoneMusic; // 7 + //uint32 IntroSound; // 8 + uint32 Flags; // 9 used for indoor/outdoor determination + uint32 AreaTableID; // 10 link to AreaTableEntry.ID + //char* AreaName; // 11 + //uint32 UwIntroSound; // 12 + //uint32 UwZoneMusic; // 13 + //uint32 UwAmbience; // 14 }; struct WorldMapAreaEntry @@ -2911,7 +2911,7 @@ struct WorldStateUI #pragma pack(pop) #endif -typedef std::unordered_map> PhaseGroupContainer; +typedef std::unordered_map> PhaseGroupContainer; struct VectorArray { diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index b34b16eef..6d822ff51 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -202,7 +202,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) if (!dungeon) continue; - switch (dungeon->type) + switch (dungeon->TypeID) { case LFG_TYPE_DUNGEON: case LFG_TYPE_RAID: @@ -699,7 +699,7 @@ void LFGMgr::JoinLfg(Player* player, LfgRoles roles, LfgDungeonSet& dungeons, co DungeonQueue const& queue = GetQueueManager(gguid).GetQueue(*dungeons.begin()); LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(*dungeons.begin()); - bool flex = dungeon && dungeon->difficulty == RAID_DIFFICULTY_1025MAN_FLEX; + bool flex = dungeon && dungeon->DifficultyID == RAID_DIFFICULTY_1025MAN_FLEX; roleCheck.neededTanks = flex ? 0 : queue.GetRoleSlots(PLAYER_ROLE_TANK); roleCheck.neededHealers = flex ? 0 : queue.GetRoleSlots(PLAYER_ROLE_HEALER); diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 75980847f..767df276d 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -267,10 +267,10 @@ struct LFGDungeonData maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f), requiredItemLevel(0), tanksNeeded(0), healersNeeded(0), dpsNeeded(0), faction(0) { } - LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name), map(dbc->map), - type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype), - minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)), - seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f), + LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name), map(dbc->MapID), + type(dbc->TypeID), expansion(dbc->expansion), group(dbc->grouptype), + minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->DifficultyID)), + seasonal(dbc->Flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f), requiredItemLevel(0), tanksNeeded(dbc->tankNeeded), healersNeeded(dbc->healerNeeded), dpsNeeded(dbc->dpsNeeded), faction(dbc->faction), category(LfgCategory(dbc->category)) { } diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index c2a805c86..c3b360c27 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -430,7 +430,7 @@ void DungeonQueue::OutDebug(std::ostringstream& ss, bool client) const return; LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(m_dungeonID); - ss << " --- DUNGEON QUEUE --- Dungeon: " << GetDungeonID() << " (" << (dungeon ? dungeon->name : "???") << ")" << (dungeon && dungeon->difficulty ? " (Heroic)" : "") << "\n"; + ss << " --- DUNGEON QUEUE --- Dungeon: " << GetDungeonID() << " (" << (dungeon ? dungeon->name : "???") << ")" << (dungeon && dungeon->DifficultyID ? " (Heroic)" : "") << "\n"; for (auto&& bucket : m_buckets) bucket.OutDebug(ss, client); } @@ -474,7 +474,7 @@ QueueManager::QueueManager() if (!dungeon) continue; - MapEntry const* map = sMapStore.LookupEntry(dungeon->map); + MapEntry const* map = sMapStore.LookupEntry(dungeon->MapID); uint32 tank = dungeon->tankNeeded; uint32 heal = dungeon->healerNeeded; @@ -790,7 +790,7 @@ void QueueManager::UpdateShortageData() bool raid = false; if (auto lfg_dungeon = sLFGDungeonStore.LookupEntry(randomDungeonId)) - raid = lfg_dungeon->difficulty == RAID_DIFFICULTY_25MAN_LFR; + raid = lfg_dungeon->DifficultyID == RAID_DIFFICULTY_25MAN_LFR; // Queue exists for more than 90 seconds and we have "enough" people in queue uint32 total = tanksCount + healersCount + dpsCount; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 8e32a423e..ba7c8e1fc 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -817,8 +817,11 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, SetPhased(data->phaseid, false, true); if (data && data->phaseGroup) - for (auto ph : GetPhasesForGroup(data->phaseGroup)) - SetPhased(ph, false, true); + { + std::vector const* phasesInGroup = sDBCManager.GetPhasesForGroup(data->phaseGroup); + for (uint32 phaseId : *phasesInGroup) + SetPhased(phaseId, false, true); + } CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry); if (!cinfo) diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 9e0f62913..739fd9d40 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -913,8 +913,11 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap) if (data->phaseGroup) { - for (auto ph : GetPhasesForGroup(data->phaseGroup)) - SetPhased(ph, false, true); + std::vector const* phasesInGroup = sDBCManager.GetPhasesForGroup(data->phaseGroup); + for (uint32 phaseId : *phasesInGroup) + SetPhased(phaseId, false, true); + //for (auto ph : sDBCManager.GetPhasesForGroup(data->phaseGroup)) + //SetPhased(ph, false, true); } if (data->spawntimesecs >= 0) diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 79a09e3bd..0fb0600fd 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -3535,9 +3535,9 @@ void WorldObject::UpdateAreaAndZonePhase() { bool up = false; uint32 phaseGroup = uint32((*itr)->GetMiscValueB()); - std::set const& phases = GetPhasesForGroup(phaseGroup); - for (uint32 phase : phases) - up = SetPhased(phase, false, true); + std::vector const* phasesInGroup = sDBCManager.GetPhasesForGroup(phaseGroup); + for (uint32 phaseId : *phasesInGroup) + up = SetPhased(phaseId, false, true); if (!updateNeeded && up) updateNeeded = true; } @@ -3934,7 +3934,7 @@ WMOAreaTableEntry const* WorldObject::GetWMOArea() const if (map->GetAreaInfo(m_phaseMask, GetPositionX(), GetPositionY(), GetPositionZ(), mogpFlags, adtId, rootId, groupId)) { - const WMOAreaTableEntry * wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId); + const WMOAreaTableEntry * wmoEntry = sDBCManager.GetWMOAreaTableEntryByTripple(rootId, adtId, groupId); if (wmoEntry) return wmoEntry; } @@ -3945,7 +3945,7 @@ WMOAreaTableEntry const* WorldObject::GetWMOArea() const uint32 WorldObject::GetWMOAreaId() const { if (WMOAreaTableEntry const * wmoEntry = GetWMOArea()) - return wmoEntry->Id; + return wmoEntry->ID; return 0; } diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index e4a6a98c7..e49d8e48a 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -1422,7 +1422,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* onlinePet /*= NULL*/) uint32 spell = fields[0].GetUInt32(); - if (!GetTalentSpellCost(spell)) + if (!sDBCManager.GetTalentSpellCost(spell)) continue; if (need_execute) diff --git a/src/server/game/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp index a079feb96..3cdf1bbfd 100644 --- a/src/server/game/Entities/Player/KillRewarder.cpp +++ b/src/server/game/Entities/Player/KillRewarder.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -162,7 +162,7 @@ void KillRewarder::RewardXP(Player* player, float rate) xp *= diff > int32(sWorld->getIntConfig(CONFIG_XP_KILL_LEVEL_DIFFERENCE)) ? 0 : sWorld->getRate(RATE_XP_KILL, player); // 4.2.3. Calculate expansion penalty - if (_victim->GetTypeId() == TYPEID_UNIT && player->GetLevel() >= GetMaxLevelForExpansion(_victim->ToCreature()->GetCreatureTemplate()->expansion)) + if (_victim->GetTypeId() == TYPEID_UNIT && player->GetLevel() >= sDBCManager.GetMaxLevelForExpansion(_victim->ToCreature()->GetCreatureTemplate()->expansion)) xp = CalculatePct(xp, 10); // Players get only 10% xp for killing creatures of lower expansion levels than himself // 4.2.4. Give XP to player. diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 176d123bd..8c851a1cd 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -677,7 +677,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) } // original items - if (CharStartOutfitEntry const* oEntry = GetCharStartOutfitEntry(createInfo->Race, createInfo->Class, createInfo->Gender)) + if (CharStartOutfitEntry const* oEntry = sDBCManager.GetCharStartOutfitEntry(createInfo->Race, createInfo->Class, createInfo->Gender)) { for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j) { @@ -3503,7 +3503,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) PlayerTalentMap::iterator itr = GetTalentMap(spec)->find(spellId); if (itr == GetTalentMap(spec)->end()) { - if (TalentSpellPos const* talentPos = GetTalentSpellPos(spellId)) + if (TalentSpellPos const* talentPos = sDBCManager.GetTalentSpellPos(spellId)) { PlayerTalent* newtalent = new PlayerTalent(); @@ -3785,7 +3785,7 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent GetBattlePetMgr().Create(species); } - uint32 talentCost = GetTalentSpellCost(spellId); + uint32 talentCost = sDBCManager.GetTalentSpellCost(spellId); // cast talents with SPELL_EFFECT_LEARN_SPELL (other dependent spells will learned later as not auto-learned) // note: all spells with SPELL_EFFECT_LEARN_SPELL isn't passive @@ -3994,7 +3994,7 @@ void Player::RemoveSpell(uint32 spell_id, bool disabled, bool learn_low_rank) // unlearn non talent higher ranks (recursive) if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spell_id)) { - if (HasSpell(nextSpell) && !GetTalentSpellPos(nextSpell)) + if (HasSpell(nextSpell) && !sDBCManager.GetTalentSpellPos(nextSpell)) RemoveSpell(nextSpell, disabled, false); } //unlearn spells dependent from recently removed spells @@ -4048,7 +4048,7 @@ void Player::RemoveSpell(uint32 spell_id, bool disabled, bool learn_low_rank) atrigger->Remove(); // free talent points - uint32 talentCosts = GetTalentSpellCost(spell_id); + uint32 talentCosts = sDBCManager.GetTalentSpellCost(spell_id); if (talentCosts > 0 && giveTalentPoints) { if (talentCosts < GetUsedTalentCount()) @@ -6059,7 +6059,7 @@ bool Player::UpdateGatherSkill(uint32 skillId, uint32 skillValue, uint32 redLeve } if (GameObject const* gobject = lootObject->ToGameObject()) { - uint32 gain = Trinity::XP::BaseGain(GetLevel(), gobject->GetGOInfo()->chest.xpLevel, GetContentLevelsForMapAndZone(GetMapId(), GetZoneId())); + uint32 gain = Trinity::XP::BaseGain(GetLevel(), gobject->GetGOInfo()->chest.xpLevel, sDBCManager.GetContentLevelsForMapAndZone(GetMapId(), GetZoneId())); gain *= sWorld->getRate(RATE_XP_GATHER); gain += GetXPRestBonus(gain); @@ -25522,7 +25522,7 @@ void Player::ResetSpells(bool myClassOnly) // skip spells with first rank learned as talent (and all talents then also) uint32 firstRank = spellInfo->GetFirstRankSpell()->Id; - if (GetTalentSpellCost(firstRank) > 0) + if (sDBCManager.GetTalentSpellCost(firstRank) > 0) continue; // skip broken spells @@ -27743,7 +27743,7 @@ bool Player::IsKnowHowFlyIn(uint32 mapid, uint32 zone) const return true; // continent checked in SpellInfo::CheckLocation at cast and area update - uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone); + uint32 v_map = sDBCManager.GetVirtualMapForMapAndZone(mapid, zone); switch (v_map) { case 0: // Eastern Kingdoms diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index f063f5562..7da91fd4f 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -356,14 +356,14 @@ void Transport::Update(uint32 diff) for (auto itr = m_goValue.Transport.AnimationInfo->Path.begin(); itr != m_goValue.Transport.AnimationInfo->Path.end(); prev = (itr++)->second) { next = itr->second; - if (realTimer <= next->TimeSeg) + if (realTimer <= next->TimeIndex) break; } if (prev == next) prev = nullptr; if (prev) - pos = G3D::Vector3{ prev->X, prev->Y, prev->Z }.lerp({ next->X, next->Y, next->Z }, (float)(realTimer - prev->TimeSeg) / (next->TimeSeg - prev->TimeSeg)); + pos = G3D::Vector3{ prev->X, prev->Y, prev->Z }.lerp({ next->X, next->Y, next->Z }, (float)(realTimer - prev->TimeIndex) / (next->TimeIndex - prev->TimeIndex)); else if (next) pos = G3D::Vector3{ next->X, next->Y, next->Z }; @@ -387,14 +387,14 @@ void Transport::Update(uint32 diff) for (auto itr = m_goValue.Transport.AnimationInfo->Rotations.begin(); itr != m_goValue.Transport.AnimationInfo->Rotations.end(); prev = (itr++)->second) { next = itr->second; - if (realTimer <= next->TimeSeg) + if (realTimer <= next->TimeIndex) break; } if (prev == next) prev = nullptr; if (prev) - rot = G3D::Quat{ prev->X, prev->Y, prev->Z, prev->W }.slerp({ next->X, next->Y, next->Z, next->W }, (float)(realTimer - prev->TimeSeg) / (next->TimeSeg - prev->TimeSeg)); + rot = G3D::Quat{ prev->X, prev->Y, prev->Z, prev->W }.slerp({ next->X, next->Y, next->Z, next->W }, (float)(realTimer - prev->TimeIndex) / (next->TimeIndex - prev->TimeIndex)); else if (next) rot = G3D::Quat{ next->X, next->Y, next->Z, next->W }; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e98d6f53e..649b0d16b 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13703,7 +13703,7 @@ uint32 Unit::GetPowerIndex(uint32 powerType) const } } } - return GetPowerIndexByClass(powerType, classId); + return sDBCManager.GetPowerIndexByClass(static_cast(powerType), classId); } int32 Unit::GetCreatePowers(Powers power) const diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 83d413939..448d501cb 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2115,7 +2115,7 @@ void ObjectMgr::LoadCreatures() data.phaseMask = 1; } - if (data.phaseGroup && GetPhasesForGroup(data.phaseGroup).empty()) + if (data.phaseGroup && sDBCManager.GetPhasesForGroup(data.phaseGroup)->empty()) { TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with non-existing `phasegroup` (%u) set, `phasegroup` set to 0", guid, data.id, data.phaseGroup); data.phaseGroup = 0; @@ -2474,7 +2474,7 @@ void ObjectMgr::LoadGameobjects() data.phaseMask = 1; } - if (data.phaseGroup && GetPhasesForGroup(data.phaseGroup).empty()) + if (data.phaseGroup && sDBCManager.GetPhasesForGroup(data.phaseGroup)->empty()) { TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with non-existing `phasegroup` (%u) set, `phasegroup` set to 0", guid, data.id, data.phaseGroup); data.phaseGroup = 0; @@ -3526,7 +3526,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3 for (uint32 gender = 0; gender < GENDER_NONE; ++gender) { - if (CharStartOutfitEntry const* entry = GetCharStartOutfitEntry(race_, class_, gender)) + if (CharStartOutfitEntry const* entry = sDBCManager.GetCharStartOutfitEntry(race_, class_, gender)) { bool found = false; for (uint8 x = 0; x < MAX_OUTFIT_ITEMS; ++x) @@ -4823,7 +4823,7 @@ void ObjectMgr::LoadQuests() qinfo->_rewardSpell = 0; // no spell reward will display for this quest } - else if (GetTalentSpellCost(qinfo->_rewardSpell)) + else if (sDBCManager.GetTalentSpellCost(qinfo->_rewardSpell)) { TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->_rewardSpell, qinfo->_rewardSpell); @@ -7450,7 +7450,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry) if (!cinfo) return std::string(); - char const* petname = GetPetName(cinfo->family, sWorld->GetDefaultDbcLocale()); + char const* petname = sDBCManager.GetPetName(cinfo->family, sWorld->GetDefaultDbcLocale()); if (petname) return std::string(petname); else @@ -9053,7 +9053,7 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, return; } - if (GetTalentSpellCost(spell)) + if (sDBCManager.GetTalentSpellCost(spell)) { TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell); return; @@ -10959,7 +10959,7 @@ CreatureDifficultyInfo const* ObjectMgr::SelectDifficultyInfo(Map const* map, ui { Difficulty difficulty = map->GetDifficulty(); if (map->IsBattleground()) - if (auto newBracket = GetBattlegroundBracketByLevel(map->GetId(), ((BattlegroundMap*)map)->GetBG()->GetMinLevel())) + if (auto newBracket = sDBCManager.GetBattlegroundBracketByLevel(map->GetId(), ((BattlegroundMap*)map)->GetBG()->GetMinLevel())) difficulty = Difficulty(newBracket->bracketId + MAX_DIFFICULTY); auto difficultyInfo = GetCreatureDifficultyInfo(difficulty, entry); diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index d2847b10e..186455e35 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -2517,7 +2517,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const* if (!reference) return ERR_BATTLEGROUND_JOIN_FAILED; - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgOrTemplate->GetMapId(), reference->GetLevel()); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bgOrTemplate->GetMapId(), reference->GetLevel()); if (!bracketEntry) return ERR_BATTLEGROUND_JOIN_FAILED; @@ -2537,7 +2537,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const* if (member->GetTeam() != team) return ERR_BATTLEGROUND_JOIN_TIMED_OUT; // not in the same battleground level braket, don't let join - PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->mapId, member->GetLevel()); + PvPDifficultyEntry const* memberBracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bracketEntry->mapId, member->GetLevel()); if (memberBracketEntry != bracketEntry) return ERR_BATTLEGROUND_JOIN_RANGE_INDEX; // don't let join if someone from the group is already in that bg queue diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 7602fa0c3..a3f2e6b41 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -137,7 +137,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) return; // expected bracket entry - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->GetLevel()); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), _player->GetLevel()); if (!bracketEntry) return; @@ -398,7 +398,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) bgTypeId = bg->GetTypeID(); // expected bracket entry - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->GetLevel()); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), _player->GetLevel()); if (!bracketEntry) return; @@ -555,7 +555,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/) continue; // expected bracket entry - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->GetLevel()); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), _player->GetLevel()); if (!bracketEntry) continue; @@ -603,7 +603,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) BattlegroundTypeId bgTypeId = bg->GetTypeID(); BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, arenatype); - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->GetLevel()); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), _player->GetLevel()); if (!bracketEntry) return; @@ -689,7 +689,7 @@ void WorldSession::HandleBattlemasterJoinRated(WorldPacket& recvData) BattlegroundTypeId bgTypeId = bg->GetTypeID(); BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, 0); - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), GetPlayer()->GetLevel()); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), GetPlayer()->GetLevel()); if (!bracketEntry) return; @@ -889,7 +889,7 @@ void WorldSession::EnterSoloQueue(bool asGroup) if (!bg) return; - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), GetPlayer()->GetLevel()); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), GetPlayer()->GetLevel()); if (!bracketEntry) return; diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 3b601bf06..973087b93 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -2761,12 +2761,12 @@ void WorldSession::HandleRandomizeCharNameOpcode(WorldPacket& recvData) return; } - std::string const* name = GetRandomCharacterName(race, gender); - WorldPacket data(SMSG_RANDOMIZE_CHAR_NAME, 1 + name->size()); + std::string name = sDBCManager.GetRandomCharacterName(race, gender); + WorldPacket data(SMSG_RANDOMIZE_CHAR_NAME, 1 + name.size()); data.WriteBit(true); // result - data.WriteBits(name->size(), 6); + data.WriteBits(name.size(), 6); data.FlushBits(); - data.WriteString(*name); + data.WriteString(name); SendPacket(&data); } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 398e342fd..afca97185 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2561,7 +2561,7 @@ bool Map::IsOutdoors(float x, float y, float z) const return true; AreaTableEntry const* atEntry = 0; - WMOAreaTableEntry const* wmoEntry= GetWMOAreaTableEntryByTripple(rootId, adtId, groupId); + WMOAreaTableEntry const* wmoEntry = sDBCManager.GetWMOAreaTableEntryByTripple(rootId, adtId, groupId); if (wmoEntry) { TC_LOG_DEBUG("maps", "Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->AreaTableID); @@ -2638,7 +2638,7 @@ uint32 Map::GetAreaId(uint32 phaseMask, float x, float y, float z) const if (hasVmapArea && G3D::fuzzyGe(z, vmapZ - GROUND_HEIGHT_TOLERANCE) && (G3D::fuzzyLt(z, gridMapHeight - GROUND_HEIGHT_TOLERANCE) || vmapZ > gridMapHeight)) { // wmo found - if (WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId)) + if (WMOAreaTableEntry const* wmoEntry = sDBCManager.GetWMOAreaTableEntryByTripple(rootId, adtId, groupId)) areaId = wmoEntry->AreaTableID; if (!areaId) @@ -2811,7 +2811,7 @@ void Map::GetFullTerrainStatusForPosition(uint32 phaseMask, float x, float y, fl { data.areaInfo.emplace(wmoData->areaInfo->adtId, wmoData->areaInfo->rootId, wmoData->areaInfo->groupId, wmoData->areaInfo->mogpFlags); // wmo found - WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(wmoData->areaInfo->rootId, wmoData->areaInfo->adtId, wmoData->areaInfo->groupId); + WMOAreaTableEntry const* wmoEntry = sDBCManager.GetWMOAreaTableEntryByTripple(wmoData->areaInfo->rootId, wmoData->areaInfo->adtId, wmoData->areaInfo->groupId); data.outdoors = (wmoData->areaInfo->mogpFlags & 0x8) != 0; if (wmoEntry) { diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index a2c9a63ab..ea15e3ef8 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -234,7 +234,7 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun TC_LOG_DEBUG("maps", "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId()); - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), bg->GetMinLevel()); + PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), bg->GetMinLevel()); uint8 spawnMode; diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index 8095e9f8f..36a3ef9c5 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -15,6 +15,7 @@ * with this program. If not, see . */ +#include "DBCStores.h" #include "TransportMgr.h" #include "Transport.h" #include "InstanceScript.h" diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index bcb82cff3..5e10f4b37 100644 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -174,7 +174,7 @@ namespace Trinity gain = 0; else { - gain = BaseGain(player->GetLevel(), u->GetLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId())); + gain = BaseGain(player->GetLevel(), u->GetLevel(), sDBCManager.GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId())); if (gain != 0 && u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isElite()) { diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 9684bcadc..9c1a5d290 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -339,7 +339,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, float standi { float spillOverRepOut = standing; // check for sub-factions that receive spillover - SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID); + SimpleFactionsList const* flist = sDBCManager.GetFactionTeamList(factionEntry->ID); // if has no sub-factions, check for factions with same parent if (!flist && factionEntry->team && factionEntry->spilloverRateOut != 0.0f) { @@ -354,7 +354,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, float standi } else // spill to "sister" factions { - flist = GetFactionTeamList(factionEntry->team); + flist = sDBCManager.GetFactionTeamList(factionEntry->team); } } } diff --git a/src/server/game/Scenarios/ScenarioMgr.cpp b/src/server/game/Scenarios/ScenarioMgr.cpp index 25afd3ea2..e9cabb773 100644 --- a/src/server/game/Scenarios/ScenarioMgr.cpp +++ b/src/server/game/Scenarios/ScenarioMgr.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -37,7 +37,7 @@ uint32 ScenarioMgr::GetScenarioIdForMap(uint32 map) for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) { if (auto dungeon = sLFGDungeonStore.LookupEntry(i)) - if (dungeon->map == map) + if (dungeon->MapID == map) return dungeon->scenario; } return 0; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 999e07b69..dbf0392ea 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1705,7 +1705,7 @@ void World::SetInitialWorldSettings() ///- Initialize VMapManager function pointers (to untangle game/collision circular deps) VMAP::VMapManager2* vmmgr2 = VMAP::VMapFactory::createOrGetVMapManager(); - vmmgr2->GetLiquidFlagsPtr = &GetLiquidFlags; + vmmgr2->GetLiquidFlagsPtr = &DBCManager::GetLiquidFlags; vmmgr2->IsVMAPDisabledForPtr = &DisableMgr::IsVMAPDisabledFor; ///- Initialize config settings @@ -1759,8 +1759,13 @@ void World::SetInitialWorldSettings() ///- Load the DBC files TC_LOG_INFO("server.loading", "Initialize data stores..."); - LoadDBCStores(m_dataPath, m_availableDbcLocaleMask); - LoadDB2Stores(m_dataPath, m_availableDbcLocaleMask); + sDBCManager.LoadDBCStores(m_dataPath, m_defaultDbcLocale); + m_availableDbcLocaleMask = sDB2Manager.LoadStores(m_dataPath, m_defaultDbcLocale); + if (!(m_availableDbcLocaleMask & (1 << m_defaultDbcLocale))) + { + TC_LOG_FATAL("server.loading", "Unable to load db2/dbc files for %s locale specified in DBC.Locale config!", localeNames[m_defaultDbcLocale]); + exit(1); + } // Load cinematic cameras LoadM2Cameras(m_dataPath); @@ -2408,9 +2413,6 @@ void World::SetInitialWorldSettings() TC_LOG_INFO("server.loading", "Loading black market auctions..."); sBlackMarketMgr->LoadAuctions(); - TC_LOG_INFO("server.loading", "Loading missing KeyChains..."); - sObjectMgr->LoadMissingKeyChains(); - TC_LOG_INFO("server.loading", "Loading realm completed challenges..."); sObjectMgr->LoadRealmCompletedChallenges(); diff --git a/src/server/scripts/Commands/cs_achievement.cpp b/src/server/scripts/Commands/cs_achievement.cpp index 44e362b08..0c0508c57 100644 --- a/src/server/scripts/Commands/cs_achievement.cpp +++ b/src/server/scripts/Commands/cs_achievement.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -164,7 +164,7 @@ class achievement_commandscript : public CommandScript for (auto&& tree : *list) { uint32 achievement = tree->Achievement ? tree->Achievement->ID : 0; - char const* name = tree->Achievement ? tree->Achievement->Name[handler->GetSessionDbcLocale()] : "not found"; + char const* name = tree->Achievement ? tree->Achievement->Name : "not found"; handler->PSendSysMessage("CriteriaTree: %u (Achievement: %s (%u))", tree->Entry->ID, name, achievement); PrintCriteriaTree(handler, tree); } diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index dd9e3ea08..0227b9796 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -292,7 +292,7 @@ class character_commandscript : public CommandScript if (titleInfo && target->HasTitle(titleInfo)) { - std::string name = titleInfo->name[handler->GetSessionDbcLocale()]; + std::string name = titleInfo->name; if (name.empty()) continue; @@ -581,7 +581,7 @@ class character_commandscript : public CommandScript { FactionState const& faction = itr->second; FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID); - char const* factionName = factionEntry ? factionEntry->name[handler->GetSessionDbcLocale()] : "#Not found#"; + char const* factionName = factionEntry ? factionEntry->name : "#Not found#"; ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry); std::string rankName = handler->GetTrinityString(ReputationRankStrIndex(rank)); std::ostringstream ss; diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 80e748731..2e6ac9c7f 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -441,7 +441,7 @@ class list_commandscript : public CommandScript AuraApplication const* aurApp = itr->second; Aura const* aura = aurApp->GetBase(); - char const* name = aura->GetSpellInfo()->SpellName[handler->GetSessionDbcLocale()]; + char const* name = aura->GetSpellInfo()->SpellName; std::ostringstream ss_name; ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r"; diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 0e8de8774..d442502d7 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -107,9 +107,9 @@ class lookup_commandscript : public CommandScript bool match = false; for (int32 i = 0; i < TOTAL_LOCALES; ++i) { - if (*areaEntry->area_name[i]) + if (*areaEntry->area_name) { - name = areaEntry->area_name[i]; + name = areaEntry->area_name; if (!Utf8FitTo(name, wNamePart)) continue; @@ -311,7 +311,7 @@ class lookup_commandscript : public CommandScript bool match = false; for (int32 i = 0; i < TOTAL_LOCALES; ++i) { - if (*factionEntry->name[i]) + if (*factionEntry->name) { name = factionEntry->name[i]; if (!Utf8FitTo(name, wNamePart)) @@ -504,9 +504,9 @@ class lookup_commandscript : public CommandScript bool match = false; for (int32 i = 0; i < TOTAL_LOCALES; ++i) { - if (*set->name[i]) + if (*set->name) { - name = set->name[i]; + name = set->name; if (!Utf8FitTo(name, wNamePart)) continue; @@ -778,9 +778,9 @@ class lookup_commandscript : public CommandScript bool match = false; for (int32 i = 0; i < TOTAL_LOCALES; ++i) { - if (*skillInfo->name[i]) + if (*skillInfo->name) { - name = skillInfo->name[i]; + name = skillInfo->name; if (!Utf8FitTo(name, wNamePart)) continue; @@ -859,9 +859,9 @@ class lookup_commandscript : public CommandScript bool match = false; for (int32 i = 0; i < TOTAL_LOCALES; ++i) { - if (*spellInfo->SpellName[i]) + if (*spellInfo->SpellName) { - name = spellInfo->SpellName[i]; + name = spellInfo->SpellName; if (!Utf8FitTo(name, wNamePart)) continue; @@ -944,7 +944,7 @@ class lookup_commandscript : public CommandScript if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id)) { int locale = handler->GetSessionDbcLocale(); - std::string name = spellInfo->SpellName[locale]; + std::string name = spellInfo->SpellName; if (name.empty()) { handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND); @@ -1029,9 +1029,9 @@ class lookup_commandscript : public CommandScript bool match = false; for (int32 i = 0; i < TOTAL_LOCALES; ++i) { - if (*nodeEntry->name[i]) + if (*nodeEntry->name) { - name = nodeEntry->name[i]; + name = nodeEntry->name; if (!Utf8FitTo(name, wNamePart)) continue; @@ -1159,9 +1159,9 @@ class lookup_commandscript : public CommandScript bool match = false; for (int32 i = 0; i < TOTAL_LOCALES; ++i) { - if (*titleInfo->name[i]) + if (*titleInfo->name) { - name = titleInfo->name[i]; + name = titleInfo->name; if (!Utf8FitTo(name, wNamePart)) continue; @@ -1229,9 +1229,9 @@ class lookup_commandscript : public CommandScript bool match = false; for (int32 i = 0; i < TOTAL_LOCALES; ++i) { - if (*mapInfo->name[i]) + if (*mapInfo->name) { - name = mapInfo->name[i]; + name = mapInfo->name; if (!Utf8FitTo(name, wNamePart)) continue; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 05a0f9b86..9ae972450 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -438,9 +438,9 @@ class misc_commandscript : public CommandScript } handler->PSendSysMessage(LANG_MAP_POSITION, - mapId, (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : ""), - zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : ""), - areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : ""), + mapId, (mapEntry ? mapEntry->name : ""), + zoneId, (zoneEntry ? zoneEntry->area_name : ""), + areaId, (areaEntry ? areaEntry->area_name : ""), object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), @@ -2026,8 +2026,8 @@ class misc_commandscript : public CommandScript handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_HIGH, level); // Output XI. LANG_PINFO_CHR_RACE - raceStr = GetRaceName(raceid, locale); - classStr = GetClassName(classid, locale); + raceStr = sDBCManager.GetRaceName(raceid, locale); + classStr = sDBCManager.GetClassName(classid, locale); handler->PSendSysMessage(LANG_PINFO_CHR_RACE, (gender == 0 ? handler->GetTrinityString(LANG_CHARACTER_GENDER_MALE) : handler->GetTrinityString(LANG_CHARACTER_GENDER_FEMALE)), raceStr.c_str(), classStr.c_str()); // Output XII. LANG_PINFO_CHR_ALIVE @@ -2056,7 +2056,7 @@ class misc_commandscript : public CommandScript } if (target) - handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map ? map->name[handler->GetSessionDbcLocale()] : "", (!zoneName.empty() ? zoneName.c_str() : ""), (!areaName.empty() ? areaName.c_str() : "")); + handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map ? map->name : "", (!zoneName.empty() ? zoneName.c_str() : ""), (!areaName.empty() ? areaName.c_str() : "")); // Output XVII. - XVIX. if they are not empty if (!guildName.empty()) @@ -3609,8 +3609,8 @@ class misc_commandscript : public CommandScript { char const* areaName = "???"; if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(target->GetCustomVisibilityZoneID())) - if (zone->area_name[handler->GetSessionDbcLocale()]) - areaName = zone->area_name[handler->GetSessionDbcLocale()]; + if (zone->area_name) + areaName = zone->area_name; handler->PSendSysMessage("%u - %s: %.2f yards (%s)", target->GetEntry(), target->GetNameForLocaleIdx((LocaleConstant)handler->GetSessionDbLocaleIndex()).c_str(), target->GetCustomVisibilityDistance(), areaName); } else @@ -3632,8 +3632,8 @@ class misc_commandscript : public CommandScript { char const* areaName = "???"; if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(target->GetCustomVisibilityZoneID())) - if (zone->area_name[handler->GetSessionDbcLocale()]) - areaName = zone->area_name[handler->GetSessionDbcLocale()]; + if (zone->area_name) + areaName = zone->area_name; handler->PSendSysMessage("%u - %s: %.2f yards (%s)", target->GetEntry(), target->GetNameForLocaleIdx((LocaleConstant)handler->GetSessionDbLocaleIndex()).c_str(), target->GetCustomVisibilityDistance(), areaName); } else @@ -3657,13 +3657,13 @@ class misc_commandscript : public CommandScript std::stringstream ss; if (Map* map = target->FindMap()) - if (char const* name = map->GetEntry()->name[handler->GetSessionDbcLocale()]) + if (char const* name = map->GetEntry()->name) ss << name << " - "; if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(zoneId)) - if (char const* name = zone->area_name[handler->GetSessionDbcLocale()]) + if (char const* name = zone->area_name) ss << name << " - "; if (AreaTableEntry const* area = zoneId == areaId ? nullptr : sAreaTableStore.LookupEntry(areaId)) - if (char const* name = area->area_name[handler->GetSessionDbcLocale()]) + if (char const* name = area->area_name) ss << name << " - "; if (CreatureTemplate const* info = sObjectMgr->GetCreatureTemplate(entry)) ss << info->Name; @@ -3724,13 +3724,13 @@ class misc_commandscript : public CommandScript std::stringstream ss; if (Map* map = target->FindMap()) - if (char const* name = map->GetEntry()->name[handler->GetSessionDbcLocale()]) + if (char const* name = map->GetEntry()->name) ss << name << " - "; if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(zoneId)) - if (char const* name = zone->area_name[handler->GetSessionDbcLocale()]) + if (char const* name = zone->area_name) ss << name << " - "; if (AreaTableEntry const* area = zoneId == areaId ? nullptr : sAreaTableStore.LookupEntry(areaId)) - if (char const* name = area->area_name[handler->GetSessionDbcLocale()]) + if (char const* name = area->area_name) ss << name << " - "; if (GameObjectTemplate const* info = sObjectMgr->GetGameObjectTemplate(entry)) ss << info->name; diff --git a/src/server/scripts/Commands/cs_support.cpp b/src/server/scripts/Commands/cs_support.cpp index 6fe96c3ff..7290e24dc 100644 --- a/src/server/scripts/Commands/cs_support.cpp +++ b/src/server/scripts/Commands/cs_support.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -2759,8 +2759,8 @@ class support_commandscript : public CommandScript { if (auto&& skill = sSkillLineStore.LookupEntry(i)) { - std::string skillName = skill->name[LOCALE_enUS]; - std::string desc = skill->description[LOCALE_enUS]; + std::string skillName = skill->name; + std::string desc = skill->description; if ((skill->categoryId == 9 && !desc.empty()) || skill->categoryId == 11) { if (player->HasSkill(skill->id)) @@ -2787,8 +2787,8 @@ class support_commandscript : public CommandScript uint32 value = fields[1].GetUInt32(); if (auto&& skill = sSkillLineStore.LookupEntry(skillId)) { - std::string skillName = skill->name[LOCALE_enUS]; - std::string desc = skill->description[LOCALE_enUS]; + std::string skillName = skill->name; + std::string desc = skill->description; if ((skill->categoryId == 9 && !desc.empty()) || skill->categoryId == 11) handler->PSendSysMessage("%s - %u (value %u)", skillName.c_str(), skill->id, value); } diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp index 960d588fd..e6570c13f 100644 --- a/src/server/scripts/Commands/cs_titles.cpp +++ b/src/server/scripts/Commands/cs_titles.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -136,7 +136,7 @@ class titles_commandscript : public CommandScript std::string tNameLink = handler->GetNameLink(target); char titleNameStr[80]; - snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], target->GetName().c_str()); + snprintf(titleNameStr, 80, titleInfo->name, target->GetName().c_str()); target->SetTitle(titleInfo); handler->PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str()); @@ -184,7 +184,7 @@ class titles_commandscript : public CommandScript std::string tNameLink = handler->GetNameLink(target); char titleNameStr[80]; - snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], target->GetName().c_str()); + snprintf(titleNameStr, 80, titleInfo->name, target->GetName().c_str()); handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str());