From dd7f0262983ee64673b07919f9e691067df4ed79 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Thu, 4 Mar 2021 09:40:52 +0100 Subject: [PATCH 01/28] Load DBC from databases WiP Added dbc format Added new SqlStorage instance for each DBC Added loading part. --- src/game/Server/SQLStorages.cpp | 239 ++++++++++++++++++++++++++++++++ src/game/Server/SQLStorages.h | 83 +++++++++++ src/game/World/World.cpp | 3 +- 3 files changed, 324 insertions(+), 1 deletion(-) diff --git a/src/game/Server/SQLStorages.cpp b/src/game/Server/SQLStorages.cpp index 86c5c358466..f8fbee471f1 100644 --- a/src/game/Server/SQLStorages.cpp +++ b/src/game/Server/SQLStorages.cpp @@ -67,3 +67,242 @@ SQLHashStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry", " SQLMultiStorage sSpellScriptTargetStorage(SpellScriptTargetFmt, "entry", "spell_script_target"); SQLStorage const* GetSpellStore() { return &sSpellTemplate; } + + +// DBC store in database 0123456789012345678901234567890123456789 +const char AreaTablefmt[] = "iiiiixxxxxissssssssssssssssxiiiiixx"; +const char AreaTriggerfmt[] = "iiffffffff"; +const char AuctionHousefmt[] = "iiiixxxxxxxxxxxxxxxxx"; +const char BankBagSlotPricesfmt[] = "ii"; +const char BattlemasterListfmt[] = "iiiiiiiiiiiiixxssssssssssssssssxx"; +const char CharStartOutfitsrcfmt[] = "dbbbbiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxx"; const char CharStartOutfitdstfmt[] = "diiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxx"; +const char CharTitlesfmt[] = "ixssssssssssssssssxxxxxxxxxxxxxxxxxxi"; +const char ChatChannelsfmt[] = "iixssssssssssssssssxxxxxxxxxxxxxxxxxx"; +const char ChrClassesfmt[] = "ixixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix"; +const char ChrRacesfmt[] = "ixixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; +const char CinematicCamerafmt[] = "isiffff"; +const char CinematicSequencesfmt[] = "ixixxxxxxx"; +const char CreatureDisplayInfofmt[] = "iixifxxxxxxxxx"; +const char CreatureDisplayInfoExtrafmt[] = "iixxxxxxxxxxxxxxxxxxx"; +const char CreatureFamilyfmt[] = "ififiiiissssssssssssssssxx"; +const char CreatureModelDatafmt[] = "iixxfxxxxxxxxxxffxxxxxxx"; +const char CreatureSpellDatafmt[] = "iiiiixxxx"; +const char CreatureTypefmt[] = "ixxxxxxxxxxxxxxxxxx"; +const char DurabilityCostsfmt[] = "iiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; +const char DurabilityQualityfmt[] = "if"; +const char Emotesfmt[] = "ixxiiix"; +const char EmotesTextfmt[] = "ixixxxxxxxxxxxxxxxx"; +const char FactionTemplatefmt[] = "iiiiiiiiiiiiii"; +const char GameObjectDisplayInfofmt[] = "isxxxxxxxxxxffffff"; +const char GemPropertiesfmt[] = "iixxi"; +const char GMSurveyCurrentSurveyfmt[] = "ii"; +const char GMSurveyQuestionsfmt[] = "issssssssssssssssx"; +const char GMSurveySurveysfmt[] = "iiiiiiiiiii"; +const char GMTicketCategoryfmt[] = "issssssssssssssssx"; +const char gtCombatRatingsfmt[] = "f"; +const char gtChanceToMeleeCritBasefmt[] = "f"; +const char gtChanceToMeleeCritfmt[] = "f"; +const char gtChanceToSpellCritBasefmt[] = "f"; +const char gtChanceToSpellCritfmt[] = "f"; +const char gtOCTRegenHPfmt[] = "f"; +const char gtNPCManaCostScalerfmt[] = "f"; +const char gtRegenHPPerSptfmt[] = "f"; +const char gtRegenMPPerSptfmt[] = "f"; +const char Itemfmt[] = "iiii"; +const char ItemBagFamilyfmt[] = "ixxxxxxxxxxxxxxxxx"; +const char ItemClassfmt[] = "ixxssssssssssssssssx"; +const char ItemExtendedCostfmt[] = "iiiiiiiiiiiiii"; +const char ItemRandomPropertiesfmt[] = "ixiiixxssssssssssssssssx"; +const char ItemRandomSuffixfmt[] = "issssssssssssssssxxiiiiii"; +const char ItemSetfmt[] = "xssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii"; +const char LiquidTypefmt[] = "iiii"; +const char Lockfmt[] = "iiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; +const char MailTemplatefmt[] = "ixxxxxxxxxxxxxxxxxssssssssssssssssx"; +const char Mapfmt[] = "ixixssssssssssssssssxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiffiixxi"; +const char QuestSortfmt[] = "ixxxxxxxxxxxxxxxxx"; +const char RandPropPointsfmt[] = "iiiiiiiiiiiiiiii"; +const char SkillLinefmt[] = "iixssssssssssssssssxxxxxxxxxxxxxxxxxxi"; +const char SkillLineAbilityfmt[] = "iiiiixxiiiiixxi"; +const char SkillRaceClassInfofmt[] = "xiiiiiix"; +const char SkillTiersfmt[] = "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; +const char SoundEntriesfmt[] = "ixxxxxxxxxxxxxxxxxxxxxxxxxxxx"; +const char SpellCastTimesfmt[] = "iiii"; +const char SpellDurationfmt[] = "iiii"; +const char SpellFocusObjectfmt[] = "ixxxxxxxxxxxxxxxxx"; +const char SpellItemEnchantmentfmt[] = "iiiiiiixxxiiissssssssssssssssxiiii"; +const char SpellItemEnchantmentConditionfmt[] = "ibbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; +const char SpellRadiusfmt[] = "ifxx"; +const char SpellRangefmt[] = "iffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; +const char SpellShapeshiftFormfmt[] = "ixxxxxxxxxxxxxxxxxxiixiixxxiiiiiiii"; +const char SpellVisualfmt[] = "ixxxxxiixxxxxxxxxxxxxxxxx"; +const char StableSlotPricesfmt[] = "ii"; +const char SummonPropertiesfmt[] = "iiiiii"; +const char Talentfmt[] = "iiiiiiiiixxxxixxixxxi"; +const char TalentTabfmt[] = "ixxxxxxxxxxxxxxxxxxxiix"; +const char TaxiNodesfmt[] = "iifffssssssssssssssssxii"; +const char TaxiPathfmt[] = "iiii"; +const char TaxiPathNodefmt[] = "xiiifffiiii"; +const char TransportAnimationfmt[] = "xiifffx"; +const char TotemCategoryfmt[] = "ixxxxxxxxxxxxxxxxxii"; +const char WorldMapAreafmt[] = "xiixffffi"; +const char WMOAreaTablefmt[] = "iiiixxxxxiixxxxxxxxxxxxxxxxx"; + +SQLStorage sDBCAreaTable(AreaTablefmt, "ID", "dbc_areatable"); +SQLStorage sDBCAreaTrigger(AreaTriggerfmt, "ID", "dbc_areatrigger"); +SQLStorage sDBCAuctionHouse(AuctionHousefmt, "ID", "dbc_auctionhouse"); +SQLStorage sDBCBankBagSlotPrices(BankBagSlotPricesfmt, "ID", "dbc_bankbagslotprices"); +SQLStorage sDBCBattlemasterList(BattlemasterListfmt, "ID", "dbc_battlemasterlist"); +SQLStorage sDBCCharStartOutfit(CharStartOutfitsrcfmt, CharStartOutfitdstfmt, "ID", "dbc_charstartoutfit"); +SQLStorage sDBCCharTitles(CharTitlesfmt, "ID", "dbc_chartitles"); +SQLStorage sDBCChatChannels(ChatChannelsfmt, "ID", "dbc_chatchannels"); +SQLStorage sDBCChrClasses(ChrClassesfmt, "ID", "dbc_chrclasses"); +SQLStorage sDBCChrRaces(ChrRacesfmt, "ID", "dbc_chrraces"); +SQLStorage sDBCCinematicCamera(CinematicCamerafmt, "ID", "dbc_cinematiccamera"); +SQLStorage sDBCCinematicSequences(CinematicSequencesfmt, "ID", "dbc_cinematicsequences"); +SQLStorage sDBCCreatureDisplayInfo(CreatureDisplayInfofmt, "ID", "dbc_creaturedisplayinfo"); +SQLStorage sDBCCreatureDisplayInfoExtra(CreatureDisplayInfoExtrafmt, "ID", "dbc_creaturedisplayinfoextra"); +SQLStorage sDBCCreatureFamily(CreatureFamilyfmt, "ID", "dbc_creaturefamily"); +SQLStorage sDBCCreatureModelData(CreatureModelDatafmt, "ID", "dbc_creaturemodeldata"); +SQLStorage sDBCCreatureSpellData(CreatureSpellDatafmt, "ID", "dbc_creaturespelldata"); +SQLStorage sDBCCreatureType(CreatureTypefmt, "ID", "dbc_creaturetype"); +SQLStorage sDBCDurabilityCosts(DurabilityCostsfmt, "ID", "dbc_durabilitycosts"); +SQLStorage sDBCDurabilityQuality(DurabilityQualityfmt, "ID", "dbc_durabilityquality"); +SQLStorage sDBCEmotes(Emotesfmt, "ID", "dbc_emotes"); +SQLStorage sDBCEmotesText(EmotesTextfmt, "ID", "dbc_emotestext"); +SQLStorage sDBCFactionTemplate(FactionTemplatefmt, "ID", "dbc_factiontemplate"); +SQLStorage sDBCGameObjectDisplayInfo(GameObjectDisplayInfofmt, "ID", "dbc_gameobjectdisplayinfo"); +SQLStorage sDBCGemProperties(GemPropertiesfmt, "ID", "dbc_gemproperties"); +SQLStorage sDBCGMSurveyCurrentSurvey(GMSurveyCurrentSurveyfmt, "LANGID", "dbc_gmsurveycurrentsurvey"); +SQLStorage sDBCGMSurveyQuestions(GMSurveyQuestionsfmt, "ID", "dbc_gmsurveyquestions"); +SQLStorage sDBCGMSurveySurveys(GMSurveySurveysfmt, "ID", "dbc_gmsurveysurveys"); +SQLStorage sDBCGMTicketCategory(GMTicketCategoryfmt, "ID", "dbc_gmticketcategory"); +SQLStorage sDBCgtCombatRatings(gtCombatRatingsfmt, "Data", "dbc_gtcombatratings"); +SQLStorage sDBCgtChanceToMeleeCritBase(gtChanceToMeleeCritBasefmt, "Data", "dbc_gtchancetomeleecritbase"); +SQLStorage sDBCgtChanceToMeleeCrit(gtChanceToMeleeCritfmt, "Data", "dbc_gtchancetomeleecrit"); +SQLStorage sDBCgtChanceToSpellCritBase(gtChanceToSpellCritBasefmt, "Data", "dbc_gtchancetospellcritbase"); +SQLStorage sDBCgtChanceToSpellCrit(gtChanceToSpellCritfmt, "Data", "dbc_gtchancetospellcrit"); +SQLStorage sDBCgtOCTRegenHP(gtOCTRegenHPfmt, "Data", "dbc_gtoctregenhp"); +SQLStorage sDBCgtNPCManaCostScaler(gtNPCManaCostScalerfmt, "Data", "dbc_gtnpcmanacostscaler"); +SQLStorage sDBCgtRegenHPPerSpt(gtRegenHPPerSptfmt, "Data", "dbc_gtregenhpperspt"); +SQLStorage sDBCgtRegenMPPerSpt(gtRegenMPPerSptfmt, "Data", "dbc_gtregenmpperspt"); +SQLStorage sDBCItem(Itemfmt, "ID", "dbc_item"); +SQLStorage sDBCItemBagFamily(ItemBagFamilyfmt, "ID", "dbc_itembagfamily"); +SQLStorage sDBCItemClass(ItemClassfmt, "ClassID", "dbc_itemclass"); +SQLStorage sDBCItemExtendedCost(ItemExtendedCostfmt, "ID", "dbc_itemextendedcost"); +SQLStorage sDBCItemRandomProperties(ItemRandomPropertiesfmt, "ID", "dbc_itemrandomproperties"); +SQLStorage sDBCItemRandomSuffix(ItemRandomSuffixfmt, "ID", "dbc_itemrandomsuffix"); +SQLStorage sDBCItemSet(ItemSetfmt, "ID", "dbc_itemset"); +SQLStorage sDBCLiquidType(LiquidTypefmt, "ID", "dbc_liquidtype"); +SQLStorage sDBCLock(Lockfmt, "ID", "dbc_lock"); +SQLStorage sDBCMailTemplate(MailTemplatefmt, "ID", "dbc_mailtemplate"); +SQLStorage sDBCMap(Mapfmt, "ID", "dbc_map"); +SQLStorage sDBCQuestSort(QuestSortfmt, "ID", "dbc_questsort"); +SQLStorage sDBCRandPropPoints(RandPropPointsfmt, "ID", "dbc_randproppoints"); +SQLStorage sDBCSkillLine(SkillLinefmt, "ID", "dbc_skillline"); +SQLStorage sDBCSkillLineAbility(SkillLineAbilityfmt, "ID", "dbc_skilllineability"); +SQLStorage sDBCSkillRaceClassInfo(SkillRaceClassInfofmt, "ID", "dbc_skillraceclassinfo"); +SQLStorage sDBCSkillTiers(SkillTiersfmt, "ID", "dbc_skilltiers"); +SQLStorage sDBCSoundEntries(SoundEntriesfmt, "ID", "dbc_soundentries"); +SQLStorage sDBCSpellCastTimes(SpellCastTimesfmt, "ID", "dbc_spellcasttimes"); +SQLStorage sDBCSpellDuration(SpellDurationfmt, "ID", "dbc_spellduration"); +SQLStorage sDBCSpellFocusObject(SpellFocusObjectfmt, "ID", "dbc_spellfocusobject"); +SQLStorage sDBCSpellItemEnchantment(SpellItemEnchantmentfmt, "ID", "dbc_spellitemenchantment"); +SQLStorage sDBCSpellItemEnchantmentCondition(SpellItemEnchantmentConditionfmt, "ID", "dbc_spellitemenchantmentcondition"); +SQLStorage sDBCSpellRadius(SpellRadiusfmt, "ID", "dbc_spellradius"); +SQLStorage sDBCSpellRange(SpellRangefmt, "ID", "dbc_spellrange"); +SQLStorage sDBCSpellShapeshiftForm(SpellShapeshiftFormfmt, "ID", "dbc_spellshapeshiftform"); +SQLStorage sDBCSpellVisual(SpellVisualfmt, "ID", "dbc_spellvisual"); +SQLStorage sDBCStableSlotPrices(StableSlotPricesfmt, "ID", "dbc_stableslotprices"); +SQLStorage sDBCSummonProperties(SummonPropertiesfmt, "ID", "dbc_summonproperties"); +SQLStorage sDBCTalent(Talentfmt, "ID", "dbc_talent"); +SQLStorage sDBCTalentTab(TalentTabfmt, "ID", "dbc_talenttab"); +SQLStorage sDBCTaxiNodes(TaxiNodesfmt, "ID", "dbc_taxinodes"); +SQLStorage sDBCTaxiPath(TaxiPathfmt, "ID", "dbc_taxipath"); +SQLStorage sDBCTaxiPathNode(TaxiPathNodefmt, "ID", "dbc_taxipathnode"); +SQLStorage sDBCTransportAnimation(TransportAnimationfmt, "ID", "dbc_transportanimation"); +SQLStorage sDBCTotemCategory(TotemCategoryfmt, "ID", "dbc_totemcategory"); +SQLStorage sDBCWorldMapArea(WorldMapAreafmt, "ID", "dbc_worldmaparea"); +SQLStorage sDBCWMOAreaTable(WMOAreaTablefmt, "ID", "dbc_wmoareatable"); + +void LoadDBCTables() +{ + sDBCAreaTable.Load(); + sDBCAreaTrigger.Load(); + sDBCAuctionHouse.Load(); + sDBCBankBagSlotPrices.Load(); + sDBCBattlemasterList.Load(); + sDBCCharStartOutfit.Load(); + sDBCCharTitles.Load(); + sDBCChatChannels.Load(); + sDBCChrClasses.Load(); + sDBCChrRaces.Load(); + sDBCCinematicCamera.Load(); + sDBCCinematicSequences.Load(); + sDBCCreatureDisplayInfo.Load(); + sDBCCreatureDisplayInfoExtra.Load(); + sDBCCreatureFamily.Load(); + sDBCCreatureModelData.Load(); + sDBCCreatureSpellData.Load(); + sDBCCreatureType.Load(); + sDBCDurabilityCosts.Load(); + sDBCDurabilityQuality.Load(); + sDBCEmotes.Load(); + sDBCEmotesText.Load(); + sDBCFactionTemplate.Load(); + sDBCGameObjectDisplayInfo.Load(); + sDBCGemProperties.Load(); + sDBCGMSurveyCurrentSurvey.Load(); + sDBCGMSurveyQuestions.Load(); + sDBCGMSurveySurveys.Load(); + sDBCGMTicketCategory.Load(); + sDBCgtCombatRatings.Load(); + sDBCgtChanceToMeleeCritBase.Load(); + sDBCgtChanceToMeleeCrit.Load(); + sDBCgtChanceToSpellCritBase.Load(); + sDBCgtChanceToSpellCrit.Load(); + sDBCgtOCTRegenHP.Load(); + sDBCgtNPCManaCostScaler.Load(); + sDBCgtRegenHPPerSpt.Load(); + sDBCgtRegenMPPerSpt.Load(); + sDBCItem.Load(); + sDBCItemBagFamily.Load(); + sDBCItemClass.Load(); + sDBCItemExtendedCost.Load(); + sDBCItemRandomProperties.Load(); + sDBCItemRandomSuffix.Load(); + sDBCItemSet.Load(); + sDBCLiquidType.Load(); + sDBCLock.Load(); + sDBCMailTemplate.Load(); + sDBCMap.Load(); + sDBCQuestSort.Load(); + sDBCRandPropPoints.Load(); + sDBCSkillLine.Load(); + sDBCSkillLineAbility.Load(); + sDBCSkillRaceClassInfo.Load(); + sDBCSkillTiers.Load(); + sDBCSoundEntries.Load(); + sDBCSpellCastTimes.Load(); + sDBCSpellDuration.Load(); + sDBCSpellFocusObject.Load(); + sDBCSpellItemEnchantment.Load(); + sDBCSpellItemEnchantmentCondition.Load(); + sDBCSpellRadius.Load(); + sDBCSpellRange.Load(); + sDBCSpellShapeshiftForm.Load(); + sDBCSpellVisual.Load(); + sDBCStableSlotPrices.Load(); + sDBCSummonProperties.Load(); + sDBCTalent.Load(); + sDBCTalentTab.Load(); + sDBCTaxiNodes.Load(); + sDBCTaxiPath.Load(); + sDBCTaxiPathNode.Load(); + sDBCTransportAnimation.Load(); + sDBCTotemCategory.Load(); + sDBCWorldMapArea.Load(); + sDBCWMOAreaTable.Load(); + + sLog.outString(">> DBC loaded."); + sLog.outString(); +} diff --git a/src/game/Server/SQLStorages.h b/src/game/Server/SQLStorages.h index 16e1a055a54..b945aa7a0eb 100644 --- a/src/game/Server/SQLStorages.h +++ b/src/game/Server/SQLStorages.h @@ -44,6 +44,89 @@ extern SQLHashStorage sGOStorage; extern SQLMultiStorage sSpellScriptTargetStorage; + +// DBC stores in db +extern SQLStorage sDBCAreaTable; +extern SQLStorage sDBCAreaTrigger; +extern SQLStorage sDBCAuctionHouse; +extern SQLStorage sDBCBankBagSlotPrices; +extern SQLStorage sDBCBattlemasterList; +extern SQLStorage sDBCCharStartOutfit; +extern SQLStorage sDBCCharTitles; +extern SQLStorage sDBCChatChannels; +extern SQLStorage sDBCChrClasses; +extern SQLStorage sDBCChrRaces; +extern SQLStorage sDBCCinematicCamera; +extern SQLStorage sDBCCinematicSequences; +extern SQLStorage sDBCCreatureDisplayInfo; +extern SQLStorage sDBCCreatureDisplayInfoExtra; +extern SQLStorage sDBCCreatureFamily; +extern SQLStorage sDBCCreatureModelData; +extern SQLStorage sDBCCreatureSpellData; +extern SQLStorage sDBCCreatureType; +extern SQLStorage sDBCDurabilityCosts; +extern SQLStorage sDBCDurabilityQuality; +extern SQLStorage sDBCEmotes; +extern SQLStorage sDBCEmotesText; +extern SQLStorage sDBCFactionTemplate; +extern SQLStorage sDBCGameObjectDisplayInfo; +extern SQLStorage sDBCGemProperties; +extern SQLStorage sDBCGMSurveyCurrentSurvey; +extern SQLStorage sDBCGMSurveyQuestions; +extern SQLStorage sDBCGMSurveySurveys; +extern SQLStorage sDBCGMTicketCategory; +extern SQLStorage sDBCgtCombatRatings; +extern SQLStorage sDBCgtChanceToMeleeCritBase; +extern SQLStorage sDBCgtChanceToMeleeCrit; +extern SQLStorage sDBCgtChanceToSpellCritBase; +extern SQLStorage sDBCgtChanceToSpellCrit; +extern SQLStorage sDBCgtOCTRegenHP; +extern SQLStorage sDBCgtNPCManaCostScaler; +extern SQLStorage sDBCgtRegenHPPerSpt; +extern SQLStorage sDBCgtRegenMPPerSpt; +extern SQLStorage sDBCItem; +extern SQLStorage sDBCItemBagFamily; +extern SQLStorage sDBCItemClass; +extern SQLStorage sDBCItemExtendedCost; +extern SQLStorage sDBCItemRandomProperties; +extern SQLStorage sDBCItemRandomSuffix; +extern SQLStorage sDBCItemSet; +extern SQLStorage sDBCLiquidType; +extern SQLStorage sDBCLock; +extern SQLStorage sDBCMailTemplate; +extern SQLStorage sDBCMap; +extern SQLStorage sDBCQuestSort; +extern SQLStorage sDBCRandPropPoints; +extern SQLStorage sDBCSkillLine; +extern SQLStorage sDBCSkillLineAbility; +extern SQLStorage sDBCSkillRaceClassInfo; +extern SQLStorage sDBCSkillTiers; +extern SQLStorage sDBCSoundEntries; +extern SQLStorage sDBCSpellCastTimes; +extern SQLStorage sDBCSpellDuration; +extern SQLStorage sDBCSpellFocusObject; +extern SQLStorage sDBCSpellItemEnchantment; +extern SQLStorage sDBCSpellItemEnchantmentCondition; +extern SQLStorage sDBCSpellRadius; +extern SQLStorage sDBCSpellRange; +extern SQLStorage sDBCSpellShapeshiftForm; +extern SQLStorage sDBCSpellVisual; +extern SQLStorage sDBCStableSlotPrices; +extern SQLStorage sDBCSummonProperties; +extern SQLStorage sDBCTalent; +extern SQLStorage sDBCTalentTab; +extern SQLStorage sDBCTaxiNodes; +extern SQLStorage sDBCTaxiPath; +extern SQLStorage sDBCTaxiPathNode; +extern SQLStorage sDBCTransportAnimation; +extern SQLStorage sDBCTotemCategory; +extern SQLStorage sDBCWorldMapArea; +extern SQLStorage sDBCWMOAreaTable; + +void LoadDBCTables(); + + + SQLStorage const* GetSpellStore(); #endif diff --git a/src/game/World/World.cpp b/src/game/World/World.cpp index 37d07e0067f..4a5070db6e6 100644 --- a/src/game/World/World.cpp +++ b/src/game/World/World.cpp @@ -891,10 +891,11 @@ void World::SetInitialWorldSettings() sLog.outString("Loading world safe locs ..."); sObjectMgr.LoadWorldSafeLocs(); - + ///- Load the DBC files sLog.outString("Initialize DBC data stores..."); LoadDBCStores(m_dataPath); + LoadDBCTables(); DetectDBCLang(); sObjectMgr.SetDbc2StorageLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) From df604c037495c1811ec8ffa71b002371a34aa0d6 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Thu, 4 Mar 2021 16:57:16 +0100 Subject: [PATCH 02/28] "Templatize" SQLStorage class. Make it easier and less prone to errors. --- src/game/AI/BaseAI/PetAI.cpp | 4 +- src/game/AI/BaseAI/TotemAI.cpp | 2 +- src/game/AI/BaseAI/UnitAI.cpp | 2 +- src/game/AI/EventAI/CreatureEventAI.cpp | 4 +- src/game/AI/EventAI/CreatureEventAIMgr.cpp | 50 +-- src/game/AI/ScriptDevAI/base/CombatAI.cpp | 2 +- .../AI/ScriptDevAI/include/sc_creature.cpp | 4 +- .../karazhan/boss_curator.cpp | 2 +- .../eastern_kingdoms/karazhan/chess_event.cpp | 50 +-- .../naxxramas/boss_kelthuzad.cpp | 2 +- .../naxxramas/boss_sapphiron.cpp | 4 +- .../eastern_kingdoms/zulaman/boss_halazzi.cpp | 2 +- .../ScriptDevAI/scripts/kalimdor/mulgore.cpp | 2 +- .../temple_of_ahnqiraj/boss_cthun.cpp | 2 +- .../kalimdor/temple_of_ahnqiraj/boss_ouro.cpp | 2 +- .../scripts/outland/blades_edge_mountains.cpp | 2 +- .../serpent_shrine/boss_the_lurker_below.cpp | 2 +- .../scripts/outland/shadowmoon_valley.cpp | 2 +- .../scripts/world/item_scripts.cpp | 6 +- .../scripts/world/npc_professions.cpp | 2 +- src/game/AuctionHouse/AuctionHouseMgr.cpp | 2 +- src/game/BattleGround/BattleGround.cpp | 4 +- src/game/BattleGround/BattleGroundMgr.cpp | 6 +- src/game/Chat/Chat.cpp | 6 +- src/game/Chat/Level1.cpp | 2 +- src/game/Chat/Level2.cpp | 10 +- src/game/Chat/Level3.cpp | 54 +-- src/game/Chat/debugcmds.cpp | 2 +- src/game/DBScripts/ScriptMgr.cpp | 24 +- src/game/Entities/CharacterHandler.cpp | 2 +- src/game/Entities/Creature.cpp | 10 +- src/game/Entities/Creature.h | 267 --------------- src/game/Entities/DynamicObject.cpp | 2 +- src/game/Entities/GameObject.cpp | 8 +- src/game/Entities/Item.cpp | 6 +- src/game/Entities/ItemHandler.cpp | 2 +- src/game/Entities/NPCHandler.h | 8 - src/game/Entities/Object.cpp | 4 +- src/game/Entities/ObjectVisibility.h | 27 +- src/game/Entities/ObjectVisibilityDefines.h | 50 +++ src/game/Entities/Pet.cpp | 14 +- src/game/Entities/PetHandler.cpp | 4 +- src/game/Entities/Player.cpp | 78 ++--- src/game/Entities/Player.h | 4 +- src/game/Entities/QueryHandler.cpp | 2 +- src/game/Entities/Relations.cpp | 8 +- src/game/Entities/Totem.cpp | 2 +- src/game/Entities/Unit.cpp | 28 +- src/game/Entities/Unit.h | 6 +- src/game/GameEvents/GameEventMgr.cpp | 4 +- src/game/Globals/Conditions.cpp | 56 ++-- src/game/Globals/ObjectMgr.cpp | 241 +++++++------- src/game/Globals/ObjectMgr.h | 17 +- src/game/Globals/SharedDefines.h | 12 + src/game/Grids/GridNotifiersImpl.h | 2 +- src/game/Loot/LootMgr.cpp | 18 +- src/game/Maps/Map.h | 19 -- src/game/OutdoorPvP/OutdoorPvPSI.cpp | 2 +- src/game/Reputation/ReputationMgr.cpp | 16 +- src/game/Server/DBCStores.cpp | 6 +- src/game/Server/DBCStructure.h | 308 +++++++++++++++++- src/game/Server/SQLStorages.cpp | 189 +++++------ src/game/Server/SQLStorages.h | 191 +++++------ src/game/Skills/SkillDiscovery.cpp | 2 +- src/game/Skills/SkillExtraItems.cpp | 4 +- src/game/Spells/Scripts/SpellScript.cpp | 2 +- src/game/Spells/Spell.cpp | 20 +- src/game/Spells/SpellAuras.cpp | 24 +- src/game/Spells/SpellEffects.cpp | 28 +- src/game/Spells/SpellHandler.cpp | 12 +- src/game/Spells/SpellMgr.cpp | 72 ++-- src/game/Spells/SpellMgr.h | 28 +- src/game/Spells/SpellTargets.cpp | 2 +- src/game/Spells/UnitAuraProcHandler.cpp | 10 +- src/game/Tools/CharacterDatabaseCleaner.cpp | 2 +- src/game/Trade/TradeHandler.cpp | 4 +- src/shared/Database/SQLStorage.cpp | 44 --- src/shared/Database/SQLStorage.h | 9 +- src/shared/Database/SQLStorageImpl.h | 50 +++ 79 files changed, 1110 insertions(+), 1074 deletions(-) create mode 100644 src/game/Entities/ObjectVisibilityDefines.h diff --git a/src/game/AI/BaseAI/PetAI.cpp b/src/game/AI/BaseAI/PetAI.cpp index 47a8caa4144..215f08c7607 100644 --- a/src/game/AI/BaseAI/PetAI.cpp +++ b/src/game/AI/BaseAI/PetAI.cpp @@ -190,7 +190,7 @@ void PetAI::UpdateAI(const uint32 diff) && m_unit->IsWithinLOSInMap(victim, true)) { uint32 spellId = charminfo->GetSpellOpener(); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); Spell* spell = new Spell(m_unit, spellInfo, TRIGGERED_NONE); // Push back stored spell @@ -208,7 +208,7 @@ void PetAI::UpdateAI(const uint32 diff) if (!spellId) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) continue; diff --git a/src/game/AI/BaseAI/TotemAI.cpp b/src/game/AI/BaseAI/TotemAI.cpp index 06c9e97cf3a..b606ff05a65 100644 --- a/src/game/AI/BaseAI/TotemAI.cpp +++ b/src/game/AI/BaseAI/TotemAI.cpp @@ -66,7 +66,7 @@ void TotemAI::UpdateAI(const uint32 diff) return; // Search spell - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(getTotem().GetSpell()); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(getTotem().GetSpell()); if (!spellInfo) return; diff --git a/src/game/AI/BaseAI/UnitAI.cpp b/src/game/AI/BaseAI/UnitAI.cpp index c15eb9c8a39..2d0d48bc15a 100644 --- a/src/game/AI/BaseAI/UnitAI.cpp +++ b/src/game/AI/BaseAI/UnitAI.cpp @@ -150,7 +150,7 @@ CanCastResult UnitAI::DoCastSpellIfCan(Unit* target, uint32 spellId, uint32 cast // Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered if (!caster->IsNonMeleeSpellCasted(false) || (castFlags & (CAST_TRIGGERED | CAST_INTERRUPT_PREVIOUS))) { - if (const SpellEntry* spellInfo = sSpellTemplate.LookupEntry(spellId)) + if (const SpellEntry* spellInfo = sSpellTemplate.LookupEntry(spellId)) { // If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them if (castFlags & CAST_AURA_NOT_PRESENT) diff --git a/src/game/AI/EventAI/CreatureEventAI.cpp b/src/game/AI/EventAI/CreatureEventAI.cpp index eb5e9e66081..2ac8a50d0e4 100644 --- a/src/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/game/AI/EventAI/CreatureEventAI.cpp @@ -190,7 +190,7 @@ void CreatureEventAI::InitAI() if (!m_mainSpellId) { m_mainSpellId = i.action[actionIdx].cast.spellId; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_mainSpellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_mainSpellId); m_mainSpellCost = Spell::CalculatePowerCost(spellInfo, m_creature); m_mainSpellMinRange = GetSpellMinRange(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex)); m_mainAttackMask = SpellSchoolMask(m_mainAttackMask + spellInfo->SchoolMask); @@ -830,7 +830,7 @@ bool CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 if (!(action.cast.castFlags & (CAST_TRIGGERED | CAST_FORCE_CAST | CAST_FORCE_TARGET_SELF))) { spellId = action.cast.spellId; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return false; if (!IsIgnoreLosSpellCast(spellInfo)) diff --git a/src/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/game/AI/EventAI/CreatureEventAIMgr.cpp index a893a335e25..a9f45b75a61 100644 --- a/src/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -298,7 +298,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() temp.raw.params[i] = fields[6 + i].GetUInt32(); // Creature does not exist in database - if (!sCreatureStorage.LookupEntry(temp.creature_id)) + if (!sCreatureStorage.LookupEntry(temp.creature_id)) { sLog.outErrorEventAI("Event %u has script for non-existing creature entry (%u), skipping.", i, temp.creature_id); continue; @@ -345,7 +345,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_SPELLHIT: if (temp.spell_hit.spellId) { - SpellEntry const* pSpell = sSpellTemplate.LookupEntry(temp.spell_hit.spellId); + SpellEntry const* pSpell = sSpellTemplate.LookupEntry(temp.spell_hit.spellId); if (!pSpell) { sLog.outErrorEventAI("Creature %u has nonexistent SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); @@ -369,7 +369,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); break; case EVENT_T_OOC_LOS: - if (temp.ooc_los.conditionId && !sConditionStorage.LookupEntry(temp.ooc_los.conditionId)) + if (temp.ooc_los.conditionId && !sConditionStorage.LookupEntry(temp.ooc_los.conditionId)) { sLog.outErrorDb("Creature %u has `ConditionId` = %u but does not exist. Setting ConditionId to 0 for event %u.", temp.creature_id, temp.ooc_los.conditionId, i); temp.ooc_los.conditionId = 0; @@ -406,7 +406,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case EVENT_T_FRIENDLY_MISSING_BUFF: { - SpellEntry const* pSpell = sSpellTemplate.LookupEntry(temp.friendly_buff.spellId); + SpellEntry const* pSpell = sSpellTemplate.LookupEntry(temp.friendly_buff.spellId); if (!pSpell) { sLog.outErrorEventAI("Creature %u has nonexistent SpellID(%u) defined in event %u.", temp.creature_id, temp.friendly_buff.spellId, i); @@ -432,7 +432,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_SUMMONED_UNIT: case EVENT_T_SUMMONED_JUST_DIED: case EVENT_T_SUMMONED_JUST_DESPAWN: - if (!sCreatureStorage.LookupEntry(temp.summoned.creatureId)) + if (!sCreatureStorage.LookupEntry(temp.summoned.creatureId)) sLog.outErrorEventAI("Creature %u are using event(%u) with nonexistent creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summoned.creatureId); if (temp.summoned.repeatMax < temp.summoned.repeatMin) sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); @@ -445,7 +445,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() continue; case EVENT_T_DEATH: { - if (temp.death.conditionId && !sConditionStorage.LookupEntry(temp.death.conditionId)) + if (temp.death.conditionId && !sConditionStorage.LookupEntry(temp.death.conditionId)) { // condition does not exist for some reason sLog.outErrorDb("Creature %u has `ConditionId` = %u but does not exist. Setting ConditionId to 0 for event %u.", temp.creature_id, temp.death.conditionId, i); @@ -479,7 +479,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() continue; } - if (temp.receive_emote.conditionId && !sConditionStorage.LookupEntry(temp.receive_emote.conditionId)) + if (temp.receive_emote.conditionId && !sConditionStorage.LookupEntry(temp.receive_emote.conditionId)) { sLog.outErrorDb("Creature %u has `ConditionId` = %u but does not exist. Setting ConditionId to 0 for event %u.", temp.creature_id, temp.receive_emote.conditionId, i); temp.receive_emote.conditionId = 0; @@ -500,7 +500,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_MISSING_AURA: case EVENT_T_TARGET_MISSING_AURA: { - SpellEntry const* pSpell = sSpellTemplate.LookupEntry(temp.buffed.spellId); + SpellEntry const* pSpell = sSpellTemplate.LookupEntry(temp.buffed.spellId); if (!pSpell) { sLog.outErrorEventAI("Creature %u has nonexistent SpellID(%u) defined in event %u.", temp.creature_id, temp.buffed.spellId, i); @@ -518,7 +518,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_RECEIVE_AI_EVENT: { // Sender-Creature does not exist in database - if (temp.receiveAIEvent.senderEntry && !sCreatureStorage.LookupEntry(temp.receiveAIEvent.senderEntry)) + if (temp.receiveAIEvent.senderEntry && !sCreatureStorage.LookupEntry(temp.receiveAIEvent.senderEntry)) { sLog.outErrorEventAI("Event %u has nonexisting creature (%u) defined for event RECEIVE_AI_EVENT, skipping.", i, temp.receiveAIEvent.senderEntry); continue; @@ -562,7 +562,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_SPELLHIT_TARGET: if (temp.spell_hit_target.spellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(temp.spell_hit_target.spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(temp.spell_hit_target.spellId); if (!spellInfo) { sLog.outErrorEventAI("Creature %u has nonexistent SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit_target.spellId, i); @@ -655,7 +655,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: if (action.morph.creatureId != 0 || action.morph.modelId != 0) { - if (action.morph.creatureId && !sCreatureStorage.LookupEntry(action.morph.creatureId)) + if (action.morph.creatureId && !sCreatureStorage.LookupEntry(action.morph.creatureId)) { sLog.outErrorEventAI("Event %u Action %u uses nonexistent Creature entry %u.", i, j + 1, action.morph.creatureId); action.morph.creatureId = 0; @@ -702,7 +702,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; case ACTION_T_CAST: { - const SpellEntry* spell = sSpellTemplate.LookupEntry(action.cast.spellId); + const SpellEntry* spell = sSpellTemplate.LookupEntry(action.cast.spellId); if (!spell) sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast.spellId); /* FIXME: temp.raw.param3 not have event tipes with recovery time in it.... @@ -760,7 +760,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; } case ACTION_T_SPAWN : - if (!sCreatureStorage.LookupEntry(action.summon.creatureId)) + if (!sCreatureStorage.LookupEntry(action.summon.creatureId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon.creatureId); IsValidTargetType(temp.event_type, action.type, action.summon.target, i, j + 1); @@ -786,9 +786,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() IsValidTargetType(temp.event_type, action.type, action.quest_event.target, i, j + 1); break; case ACTION_T_CAST_EVENT: - if (!sCreatureStorage.LookupEntry(action.cast_event.creatureId)) + if (!sCreatureStorage.LookupEntry(action.cast_event.creatureId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.cast_event.creatureId); - if (!sSpellTemplate.LookupEntry(action.cast_event.spellId)) + if (!sSpellTemplate.LookupEntry(action.cast_event.spellId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast_event.spellId); IsValidTargetType(temp.event_type, action.type, action.cast_event.target, i, j + 1); break; @@ -821,13 +821,13 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event_all.questId); break; case ACTION_T_CAST_EVENT_ALL: - if (!sCreatureStorage.LookupEntry(action.cast_event_all.creatureId)) + if (!sCreatureStorage.LookupEntry(action.cast_event_all.creatureId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.cast_event_all.creatureId); - if (!sSpellTemplate.LookupEntry(action.cast_event_all.spellId)) + if (!sSpellTemplate.LookupEntry(action.cast_event_all.spellId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast_event_all.spellId); break; case ACTION_T_REMOVEAURASFROMSPELL: - if (!sSpellTemplate.LookupEntry(action.remove_aura.spellId)) + if (!sSpellTemplate.LookupEntry(action.remove_aura.spellId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.remove_aura.spellId); IsValidTargetType(temp.event_type, action.type, action.remove_aura.target, i, j + 1); break; @@ -852,14 +852,14 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } break; case ACTION_T_SUMMON_ID: - if (!sCreatureStorage.LookupEntry(action.summon_id.creatureId)) + if (!sCreatureStorage.LookupEntry(action.summon_id.creatureId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon_id.creatureId); IsValidTargetType(temp.event_type, action.type, action.summon_id.target, i, j + 1); if (m_CreatureEventAI_Summon_Map.find(action.summon_id.spawnId) == m_CreatureEventAI_Summon_Map.end()) sLog.outErrorEventAI("Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j + 1, action.summon_id.spawnId); break; case ACTION_T_KILLED_MONSTER: - if (!sCreatureStorage.LookupEntry(action.killed_monster.creatureId)) + if (!sCreatureStorage.LookupEntry(action.killed_monster.creatureId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.killed_monster.creatureId); IsValidTargetType(temp.event_type, action.type, action.killed_monster.target, i, j + 1); break; @@ -875,7 +875,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() IsValidTargetType(temp.event_type, action.type, action.set_inst_data64.target, i, j + 1); break; case ACTION_T_UPDATE_TEMPLATE: - if (!sCreatureStorage.LookupEntry(action.update_template.creatureId)) + if (!sCreatureStorage.LookupEntry(action.update_template.creatureId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.update_template.creatureId); break; case ACTION_T_SET_SHEATH: @@ -895,7 +895,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: if (action.mount.creatureId != 0 || action.mount.modelId != 0) { - if (action.mount.creatureId && !sCreatureStorage.LookupEntry(action.mount.creatureId)) + if (action.mount.creatureId && !sCreatureStorage.LookupEntry(action.mount.creatureId)) { sLog.outErrorEventAI("Event %u Action %u uses nonexistent Creature entry %u.", i, j + 1, action.mount.creatureId); action.morph.creatureId = 0; @@ -1032,7 +1032,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() IsValidTargetType(temp.event_type, action.type, action.attackStart.target, i, j + 1); break; case ACTION_T_DESPAWN_GUARDIANS: - if (action.despawnGuardians.entryId && !sCreatureStorage.LookupEntry(action.despawnGuardians.entryId)) + if (action.despawnGuardians.entryId && !sCreatureStorage.LookupEntry(action.despawnGuardians.entryId)) { sLog.outErrorEventAI("Event %u Action %u uses nonexistent Creature entry %u.", i, j + 1, action.despawnGuardians.entryId); action.despawnGuardians.entryId = 0; @@ -1106,7 +1106,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() CreatureEventAI_Action& action = temp.action[j]; if (temp.action[j].type == ACTION_T_CAST && temp.action[j].cast.target == TARGET_T_EVENT_SPECIFIC) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(temp.action[j].cast.spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(temp.action[j].cast.spellId); if (spellInfo->HasAttribute(SPELL_ATTR_EX_CANT_TARGET_SELF)) data.friendlyHp.targetSelf = false; } @@ -1125,7 +1125,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() // post check for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) { bool ainame = strcmp(cInfo->AIName, "EventAI") == 0 || strcmp(cInfo->AIName, "GuardianAI") == 0; bool hasevent = m_CreatureEventAI_Event_Map.find(i) != m_CreatureEventAI_Event_Map.end(); diff --git a/src/game/AI/ScriptDevAI/base/CombatAI.cpp b/src/game/AI/ScriptDevAI/base/CombatAI.cpp index 3851372691b..567cdd5f7a2 100644 --- a/src/game/AI/ScriptDevAI/base/CombatAI.cpp +++ b/src/game/AI/ScriptDevAI/base/CombatAI.cpp @@ -98,7 +98,7 @@ void RangedCombatAI::AddMainSpell(uint32 spellId) if (!m_mainSpellId) // only for first { m_mainSpellId = spellId; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_mainSpellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_mainSpellId); m_mainSpellCost = Spell::CalculatePowerCost(spellInfo, m_creature); m_mainSpellMinRange = GetSpellMinRange(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex)); m_mainAttackMask = SpellSchoolMask(m_mainAttackMask + spellInfo->SchoolMask); diff --git a/src/game/AI/ScriptDevAI/include/sc_creature.cpp b/src/game/AI/ScriptDevAI/include/sc_creature.cpp index 8b5b13761d4..55888e60020 100644 --- a/src/game/AI/ScriptDevAI/include/sc_creature.cpp +++ b/src/game/AI/ScriptDevAI/include/sc_creature.cpp @@ -130,7 +130,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, int32 school, int32 mech // Check if each spell is viable(set it to null if not) for (uint8 i = 0; i < 4; ++i) { - SpellEntry const* tempSpellInfo = GetSpellStore()->LookupEntry(m_creature->m_spells[i]); + SpellEntry const* tempSpellInfo = GetSpellStore()->LookupEntry(m_creature->m_spells[i]); // This spell doesn't exist if (!tempSpellInfo) @@ -230,7 +230,7 @@ void FillSpellSummary() SpellSummary[i].Effects = 0; SpellSummary[i].Targets = 0; - SpellEntry const* tempSpell = GetSpellStore()->LookupEntry(i); + SpellEntry const* tempSpell = GetSpellStore()->LookupEntry(i); // This spell doesn't exist if (!tempSpell) continue; diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/boss_curator.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/boss_curator.cpp index f0b51333e0b..645caee3149 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/boss_curator.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/boss_curator.cpp @@ -221,7 +221,7 @@ struct boss_curatorAI : public CombatAI uint32 randomSpell = astralFlareSpells[urand(0, 3)]; DoCastSpellIfCan(nullptr, randomSpell); ResetCombatAction(action, GetSubsequentActionTimer(action)); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(randomSpell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(randomSpell); // supposed to happen right away not on next oom if (m_creature->GetPower((Powers)spellInfo->powerType) < Spell::CalculatePowerCost(spellInfo, m_creature)) { diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp index 363f795d641..874f30fbc97 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp @@ -743,7 +743,7 @@ struct npc_king_llaneAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_HEROISM); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HEROISM); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HEROISM); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -757,7 +757,7 @@ struct npc_king_llaneAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_SWEEP); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SWEEP); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SWEEP); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -856,7 +856,7 @@ struct npc_warchief_blackhandAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_BLOODLUST); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_BLOODLUST); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_BLOODLUST); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -870,7 +870,7 @@ struct npc_warchief_blackhandAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_CLEAVE); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_CLEAVE); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_CLEAVE); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -932,7 +932,7 @@ struct npc_human_conjurerAI : public npc_chess_piece_genericAI DoCastSpellIfCan(pTarget, SPELL_ELEMENTAL_BLAST); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_ELEMENTAL_BLAST); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_ELEMENTAL_BLAST); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -946,7 +946,7 @@ struct npc_human_conjurerAI : public npc_chess_piece_genericAI DoCastSpellIfCan(pTarget, SPELL_RAIN_OF_FIRE); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_RAIN_OF_FIRE); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_RAIN_OF_FIRE); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1008,7 +1008,7 @@ struct npc_orc_warlockAI : public npc_chess_piece_genericAI DoCastSpellIfCan(pTarget, SPELL_FIREBALL); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_FIREBALL); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_FIREBALL); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1022,7 +1022,7 @@ struct npc_orc_warlockAI : public npc_chess_piece_genericAI DoCastSpellIfCan(pTarget, SPELL_POISON_CLOUD_ACTION); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_POISON_CLOUD_ACTION); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_POISON_CLOUD_ACTION); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1098,7 +1098,7 @@ struct npc_human_footmanAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_HEROIC_BLOW); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HEROIC_BLOW); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HEROIC_BLOW); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1112,7 +1112,7 @@ struct npc_human_footmanAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_SHIELD_BLOCK); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SHIELD_BLOCK); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SHIELD_BLOCK); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1188,7 +1188,7 @@ struct npc_orc_gruntAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_VICIOUS_STRIKE); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_VICIOUS_STRIKE); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_VICIOUS_STRIKE); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1202,7 +1202,7 @@ struct npc_orc_gruntAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_WEAPON_DEFLECTION); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_WEAPON_DEFLECTION); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_WEAPON_DEFLECTION); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1264,7 +1264,7 @@ struct npc_water_elementalAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_GEYSER); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_GEYSER); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_GEYSER); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1278,7 +1278,7 @@ struct npc_water_elementalAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_WATER_SHIELD); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_WATER_SHIELD); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_WATER_SHIELD); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1340,7 +1340,7 @@ struct npc_summoned_daemonAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_HELLFIRE_CHESS); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HELLFIRE_CHESS); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HELLFIRE_CHESS); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1354,7 +1354,7 @@ struct npc_summoned_daemonAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_FIRE_SHIELD); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_FIRE_SHIELD); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_FIRE_SHIELD); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1416,7 +1416,7 @@ struct npc_human_chargerAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_SMASH); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SMASH); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SMASH); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1430,7 +1430,7 @@ struct npc_human_chargerAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_STOMP); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_STOMP); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_STOMP); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1492,7 +1492,7 @@ struct npc_orc_wolfAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_BITE); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_BITE); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_BITE); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1506,7 +1506,7 @@ struct npc_orc_wolfAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_HOWL); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HOWL); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HOWL); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1568,7 +1568,7 @@ struct npc_human_clericAI : public npc_chess_piece_genericAI DoCastSpellIfCan(pTarget, SPELL_HEALING); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HEALING); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HEALING); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1582,7 +1582,7 @@ struct npc_human_clericAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_HOLY_LANCE); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HOLY_LANCE); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_HOLY_LANCE); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1644,7 +1644,7 @@ struct npc_orc_necrolyteAI : public npc_chess_piece_genericAI DoCastSpellIfCan(pTarget, SPELL_SHADOW_MEND_ACTION); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SHADOW_MEND_ACTION); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SHADOW_MEND_ACTION); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1658,7 +1658,7 @@ struct npc_orc_necrolyteAI : public npc_chess_piece_genericAI DoCastSpellIfCan(nullptr, SPELL_SHADOW_SPEAR); // reset timer based on spell values - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SHADOW_SPEAR); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SHADOW_SPEAR); return pSpell->RecoveryTime ? pSpell->RecoveryTime : pSpell->CategoryRecoveryTime; } @@ -1688,7 +1688,7 @@ bool GossipHello_npc_orc_necrolyte(Player* pPlayer, Creature* pCreature) struct go_chessboard : public GameObjectAI { - go_chessboard(GameObject* go) : GameObjectAI(go), m_auraSearchTimer(1000), m_spellInfo(sSpellTemplate.LookupEntry(SPELL_GAME_IN_SESSION)), m_started(false) {} + go_chessboard(GameObject* go) : GameObjectAI(go), m_auraSearchTimer(1000), m_spellInfo(sSpellTemplate.LookupEntry(SPELL_GAME_IN_SESSION)), m_started(false) {} uint32 m_auraSearchTimer; SpellEntry const* m_spellInfo; diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_kelthuzad.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_kelthuzad.cpp index eabf381f425..9ac1b91d366 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_kelthuzad.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_kelthuzad.cpp @@ -708,7 +708,7 @@ struct GuardianPeriodic : public AuraScript if (Unit* target = aura->GetTarget()) { if (target->HasAuraType(SPELL_AURA_MOD_STUN)) // Shackle Undead applies SPELL_AURA_MOD_STUN, so we cover all ranks of the spell this way - data.spellInfo = sSpellTemplate.LookupEntry(SPELL_GUARDIAN_SHACKLE); // Summon Ice Block + data.spellInfo = sSpellTemplate.LookupEntry(SPELL_GUARDIAN_SHACKLE); // Summon Ice Block } } }; diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_sapphiron.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_sapphiron.cpp index 20ec52712f4..8193df18a43 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_sapphiron.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/naxxramas/boss_sapphiron.cpp @@ -350,7 +350,7 @@ struct PeriodicIceBolt : public AuraScript if (target->IsAlive() && !target->HasAura(SPELL_ICEBOLT_IMMUNITY)) { target->CastSpell(target, SPELL_ICEBOLT_IMMUNITY, TRIGGERED_OLD_TRIGGERED); // Icebolt which causes immunity to frost dmg - data.spellInfo = sSpellTemplate.LookupEntry(SPELL_ICEBLOCK_SUMMON); // Summon Ice Block + data.spellInfo = sSpellTemplate.LookupEntry(SPELL_ICEBLOCK_SUMMON); // Summon Ice Block } } } @@ -386,7 +386,7 @@ struct DespawnBuffet : public AuraScript void OnPeriodicTrigger(Aura* aura, PeriodicTriggerData& data) const override { if (Unit* target = aura->GetTarget()) - data.spellInfo = sSpellTemplate.LookupEntry(SPELL_DESPAWN_BUFFET_EFFECT); // Summon Ice Block + data.spellInfo = sSpellTemplate.LookupEntry(SPELL_DESPAWN_BUFFET_EFFECT); // Summon Ice Block } }; diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/zulaman/boss_halazzi.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/zulaman/boss_halazzi.cpp index 80d9f90bb72..36c6fe8fe20 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/zulaman/boss_halazzi.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/zulaman/boss_halazzi.cpp @@ -376,7 +376,7 @@ struct npc_corrupted_lightning_totemAI : public ScriptedAI void JustRespawned() override { m_creature->SetInCombatWithZone(); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SPELL_LIGHTNING); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SPELL_LIGHTNING); m_creature->AddCooldown(*spellInfo); } diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/mulgore.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/mulgore.cpp index 065b9299ad4..89eff9d7a65 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/mulgore.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/mulgore.cpp @@ -116,7 +116,7 @@ struct npc_kyle_the_frenziedAI : public ScriptedAI // Workaround for broken function GetGameObject if (!pGo) { - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_LUNCH); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_LUNCH); uint32 uiGameobjectEntry = pSpell->EffectMiscValue[EFFECT_INDEX_1]; diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp index 6f6f993734d..8448cc0baa9 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp @@ -664,7 +664,7 @@ struct PeriodicRotate : public AuraScript target->SetFacingTo(newAngle); target->SetOrientation(newAngle); - data.spellInfo = sSpellTemplate.LookupEntry(SPELL_DARK_GLARE); + data.spellInfo = sSpellTemplate.LookupEntry(SPELL_DARK_GLARE); data.caster = aura->GetCaster(); data.target = nullptr; } diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_ouro.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_ouro.cpp index 0beea20e064..853339f98a7 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_ouro.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/temple_of_ahnqiraj/boss_ouro.cpp @@ -435,7 +435,7 @@ struct PeriodicScarabTrigger : public AuraScript { void OnPeriodicTrigger(Aura* aura, PeriodicTriggerData& data) const override { - data.spellInfo = sSpellTemplate.LookupEntry(SPELL_SUMMON_SCARABS); + data.spellInfo = sSpellTemplate.LookupEntry(SPELL_SUMMON_SCARABS); data.caster = aura->GetTarget(); data.target = nullptr; } diff --git a/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp b/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp index 7a4c9d7a1ac..ae37895cc32 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp @@ -1679,7 +1679,7 @@ enum // This is a first attempt to implement GO type 30 behaviour struct go_aura_generator_000AI : public GameObjectAI { - go_aura_generator_000AI(GameObject* go) : GameObjectAI(go), m_auraSearchTimer(1000), m_spellInfo(sSpellTemplate.LookupEntry(SPELL_OSCILLATING_FREQUENCY_SCANNER)) {} + go_aura_generator_000AI(GameObject* go) : GameObjectAI(go), m_auraSearchTimer(1000), m_spellInfo(sSpellTemplate.LookupEntry(SPELL_OSCILLATING_FREQUENCY_SCANNER)) {} uint32 m_auraSearchTimer; ObjectGuid m_player; diff --git a/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_the_lurker_below.cpp b/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_the_lurker_below.cpp index a5b6d9f836d..fff1a98c096 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_the_lurker_below.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/serpent_shrine/boss_the_lurker_below.cpp @@ -347,7 +347,7 @@ struct SpoutTurning : public AuraScript target->SetFacingTo(newAngle); target->SetOrientation(newAngle); - data.spellInfo = sSpellTemplate.LookupEntry(SPELL_SPOUT_DAMAGE); + data.spellInfo = sSpellTemplate.LookupEntry(SPELL_SPOUT_DAMAGE); data.caster = target; data.target = nullptr; } diff --git a/src/game/AI/ScriptDevAI/scripts/outland/shadowmoon_valley.cpp b/src/game/AI/ScriptDevAI/scripts/outland/shadowmoon_valley.cpp index 6f390a358e8..1ec8478a05e 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/shadowmoon_valley.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/shadowmoon_valley.cpp @@ -381,7 +381,7 @@ struct npc_dragonmaw_peonAI : public ScriptedAI // Workaround for broken function GetGameObject if (!pMutton) { - const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SERVING_MUTTON); + const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SERVING_MUTTON); uint32 uiGameobjectEntry = pSpell->EffectMiscValue[EFFECT_INDEX_0]; diff --git a/src/game/AI/ScriptDevAI/scripts/world/item_scripts.cpp b/src/game/AI/ScriptDevAI/scripts/world/item_scripts.cpp index f6cae024dc8..d0a49bf38c0 100644 --- a/src/game/AI/ScriptDevAI/scripts/world/item_scripts.cpp +++ b/src/game/AI/ScriptDevAI/scripts/world/item_scripts.cpp @@ -53,7 +53,7 @@ bool ItemUse_item_orb_of_draconic_energy(Player* pPlayer, Item* pItem, const Spe { pPlayer->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr); - if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_DOMINION_SOUL)) + if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_DOMINION_SOUL)) Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_TARGET_AURASTATE); return true; @@ -78,7 +78,7 @@ bool ItemUse_item_arcane_charges(Player* pPlayer, Item* pItem, const SpellCastTa pPlayer->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr); - if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_ARCANE_CHARGES)) + if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_ARCANE_CHARGES)) Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_ERROR); return true; @@ -121,7 +121,7 @@ bool ItemUse_item_gor_dreks_ointment(Player* pPlayer, Item* pItem, const SpellCa { pPlayer->SendEquipError(EQUIP_ERR_NONE, pItem, nullptr); - if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_GORDREKS_OINTMENT)) + if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_GORDREKS_OINTMENT)) Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_TARGET_AURASTATE); return true; diff --git a/src/game/AI/ScriptDevAI/scripts/world/npc_professions.cpp b/src/game/AI/ScriptDevAI/scripts/world/npc_professions.cpp index 4ccaeb6f707..d458112e6c9 100644 --- a/src/game/AI/ScriptDevAI/scripts/world/npc_professions.cpp +++ b/src/game/AI/ScriptDevAI/scripts/world/npc_professions.cpp @@ -198,7 +198,7 @@ int32 GetUnlearnCostLow(Player* pPlayer) // blacksmith bool EquippedOk(Player* pPlayer, uint32 spellId) { - SpellEntry const* spell = GetSpellStore()->LookupEntry(spellId); + SpellEntry const* spell = GetSpellStore()->LookupEntry(spellId); if (!spell) return false; diff --git a/src/game/AuctionHouse/AuctionHouseMgr.cpp b/src/game/AuctionHouse/AuctionHouseMgr.cpp index 8a25aa4ed4d..0bda7c7ae0c 100644 --- a/src/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouse/AuctionHouseMgr.cpp @@ -836,7 +836,7 @@ void WorldSession::BuildListAuctionItems(std::vector const& aucti if (proto->Class == ITEM_CLASS_RECIPE) { - if (SpellEntry const* spell = sSpellTemplate.LookupEntry(proto->Spells[0].SpellId)) + if (SpellEntry const* spell = sSpellTemplate.LookupEntry(proto->Spells[0].SpellId)) { if (_player->HasSpell(spell->EffectTriggerSpell[EFFECT_INDEX_0])) continue; diff --git a/src/game/BattleGround/BattleGround.cpp b/src/game/BattleGround/BattleGround.cpp index f7bccbdd19f..3e207200632 100644 --- a/src/game/BattleGround/BattleGround.cpp +++ b/src/game/BattleGround/BattleGround.cpp @@ -673,7 +673,7 @@ void BattleGround::RewardHonorToTeam(uint32 honor, Team teamId) */ void BattleGround::RewardReputationToTeam(uint32 factionId, uint32 reputation, Team teamId) { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) return; @@ -1013,7 +1013,7 @@ void BattleGround::RewardSpellCast(Player* player, uint32 spellId) const if (player->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE)) return; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) { sLog.outError("Battleground reward casting spell %u not exist.", spellId); diff --git a/src/game/BattleGround/BattleGroundMgr.cpp b/src/game/BattleGround/BattleGroundMgr.cpp index 75257c47c51..cd7ad945d6d 100644 --- a/src/game/BattleGround/BattleGroundMgr.cpp +++ b/src/game/BattleGround/BattleGroundMgr.cpp @@ -1816,7 +1816,7 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA void BattleGroundMgr::CreateInitialBattleGrounds() { uint32 count = 0; - // 0 1 2 3 4 5 6 7 + // 0 1 2 3 4 5 6 7 QueryResult* result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,HordeStartLoc,StartMaxDist FROM battleground_template"); if (!result) @@ -1870,7 +1870,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() uint32 start1 = fields[5].GetUInt32(); - WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(start1); + WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(start1); if (start) { allianceStartLoc[0] = start->x; @@ -1893,7 +1893,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() uint32 start2 = fields[6].GetUInt32(); - start = sWorldSafeLocsStore.LookupEntry(start2); + start = sWorldSafeLocsStore.LookupEntry(start2); if (start) { hordeStartLoc[0] = start->x; diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp index 432d8074347..be1f841b4a0 100644 --- a/src/game/Chat/Chat.cpp +++ b/src/game/Chat/Chat.cpp @@ -1889,7 +1889,7 @@ bool ChatHandler::CheckEscapeSequences(const char* message) if (!talentInfo) return false; - linkedSpell = sSpellTemplate.LookupEntry(talentInfo->RankID[0]); + linkedSpell = sSpellTemplate.LookupEntry(talentInfo->RankID[0]); if (!linkedSpell) return false; @@ -1916,7 +1916,7 @@ bool ChatHandler::CheckEscapeSequences(const char* message) spellid += c - '0'; c = reader.peek(); } - linkedSpell = sSpellTemplate.LookupEntry(spellid); + linkedSpell = sSpellTemplate.LookupEntry(spellid); if (!linkedSpell) return false; } @@ -1935,7 +1935,7 @@ bool ChatHandler::CheckEscapeSequences(const char* message) spellid += c - '0'; c = reader.peek(); } - linkedSpell = sSpellTemplate.LookupEntry(spellid); + linkedSpell = sSpellTemplate.LookupEntry(spellid); if (!linkedSpell) return false; } diff --git a/src/game/Chat/Level1.cpp b/src/game/Chat/Level1.cpp index 0bede076764..065625dce9b 100644 --- a/src/game/Chat/Level1.cpp +++ b/src/game/Chat/Level1.cpp @@ -246,7 +246,7 @@ bool ChatHandler::HandleGMVisibleCommand(char* args) } Player* player = m_session->GetPlayer(); - SpellEntry const* invisibleAuraInfo = sSpellTemplate.LookupEntry(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA)); + SpellEntry const* invisibleAuraInfo = sSpellTemplate.LookupEntry(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA)); if (!invisibleAuraInfo || !IsSpellAppliesAura(invisibleAuraInfo)) invisibleAuraInfo = nullptr; diff --git a/src/game/Chat/Level2.cpp b/src/game/Chat/Level2.cpp index a10532ef40c..8518d4f4f05 100644 --- a/src/game/Chat/Level2.cpp +++ b/src/game/Chat/Level2.cpp @@ -464,7 +464,7 @@ bool ChatHandler::HandleGoGraveyardCommand(char* args) if (!ExtractUInt32(&args, gyId)) return false; - WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(gyId); + WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(gyId); if (!gy) { PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, gyId); @@ -1442,7 +1442,7 @@ bool ChatHandler::HandleLookupFactionCommand(char* args) for (uint32 id = 0; id < sFactionStore.GetMaxEntry(); ++id) { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(id); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(id); if (factionEntry) { int loc = GetSessionDbcLocale(); @@ -1555,7 +1555,7 @@ bool ChatHandler::HandleModifyRepCommand(char* args) } } - FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) { @@ -3438,7 +3438,7 @@ bool ChatHandler::HandleCharacterReputationCommand(char* args) FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList(); for (const auto& itr : targetFSL) { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(itr.second.ID); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(itr.second.ID); ShowFactionListHelper(factionEntry, loc, &itr.second, target); } @@ -3782,7 +3782,7 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id) if (skillLine->classmask && (skillLine->classmask & classmask) == 0) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, player, false)) continue; diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp index 03d20465263..b8a27923e0b 100644 --- a/src/game/Chat/Level3.cpp +++ b/src/game/Chat/Level3.cpp @@ -1351,7 +1351,7 @@ bool ChatHandler::HandleCooldownClearCommand(char* args) if (!spell_id) return false; - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spell_id); if (!spellEntry) { PSendSysMessage(LANG_UNKNOWN_SPELL, target == m_session->GetPlayer() ? GetMangosString(LANG_YOU) : tNameLink.c_str()); @@ -1411,7 +1411,7 @@ bool ChatHandler::HandleLearnAllCommand(char* /*args*/) for (uint32 i = 0; i < sSpellTemplate.GetMaxEntry(); i++) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); if (!spellInfo) continue; @@ -1421,7 +1421,7 @@ bool ChatHandler::HandleLearnAllCommand(char* /*args*/) (spellInfo->EffectImplicitTargetA[j] == TARGET_NONE)) { uint32 spellId = spellInfo->EffectTriggerSpell[j]; - SpellEntry const* newSpell = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* newSpell = sSpellTemplate.LookupEntry(spellId); // skip broken spells if (!SpellMgr::IsSpellValid(newSpell, player, false)) @@ -1431,7 +1431,7 @@ bool ChatHandler::HandleLearnAllCommand(char* /*args*/) uint32 firstRankId = sSpellMgr.GetFirstSpellInChain(spellId); if (GetTalentSpellCost(firstRankId) > 0) continue; - + if (!IsSpellHaveEffect(newSpell, SPELL_EFFECT_PROFICIENCY)) { // only class spells @@ -1498,7 +1498,7 @@ bool ChatHandler::HandleLearnAllGMCommand(char* /*args*/) for (uint32 spell : gmSpellList) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer())) { PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell); @@ -1533,7 +1533,7 @@ bool ChatHandler::HandleLearnAllMySpellsCommand(char* /*args*/) if (!entry) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(entry->spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(entry->spellId); if (!spellInfo) continue; @@ -1598,7 +1598,7 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(char* /*args*/) if (!spellid) // ??? none spells in talent continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellid); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellid); if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, player, false)) continue; @@ -1650,14 +1650,14 @@ bool ChatHandler::HandleLearnCommand(char* args) // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form uint32 spell = ExtractSpellIdFromLink(&args); - if (!spell || !sSpellTemplate.LookupEntry(spell)) + if (!spell || !sSpellTemplate.LookupEntry(spell)) return false; bool allRanks = ExtractLiteralArg(&args, "all") != nullptr; if (!allRanks && *args) // can be fail also at syntax error return false; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, player)) { PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell); @@ -1793,7 +1793,7 @@ bool ChatHandler::HandleAddItemSetCommand(char* args) bool found = false; for (uint32 id = 0; id < sItemStorage.GetMaxEntry(); ++id) { - ItemPrototype const* pProto = sItemStorage.LookupEntry(id); + ItemPrototype const* pProto = sItemStorage.LookupEntry(id); if (!pProto) continue; @@ -2194,7 +2194,7 @@ bool ChatHandler::HandleListCreatureCommand(char* args) void ChatHandler::ShowItemListHelper(uint32 itemId, int loc_idx, Player* target /*=nullptr*/) { - ItemPrototype const* itemProto = sItemStorage.LookupEntry(itemId); + ItemPrototype const* itemProto = sItemStorage.LookupEntry(itemId); if (!itemProto) return; @@ -2236,7 +2236,7 @@ bool ChatHandler::HandleLookupItemCommand(char* args) // Search in `item_template` for (uint32 id = 0; id < sItemStorage.GetMaxEntry(); ++id) { - ItemPrototype const* pProto = sItemStorage.LookupEntry(id); + ItemPrototype const* pProto = sItemStorage.LookupEntry(id); if (!pProto) continue; @@ -2464,7 +2464,7 @@ bool ChatHandler::HandleLookupSpellCommand(char* args) // Search in Spell.dbc for (uint32 id = 0; id < sSpellTemplate.GetMaxEntry(); ++id) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(id); if (spellInfo) { int loc = int(DEFAULT_LOCALE); @@ -2594,7 +2594,7 @@ bool ChatHandler::HandleLookupCreatureCommand(char* args) for (uint32 id = 0; id < sCreatureStorage.GetMaxEntry(); ++id) { - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry (id); + CreatureInfo const* cInfo = sCreatureStorage.LookupEntry (id); if (!cInfo) continue; @@ -3088,7 +3088,7 @@ bool ChatHandler::HandleDamageCommand(char* args) // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form uint32 spellid = ExtractSpellIdFromLink(&args); - if (!spellid || !sSpellTemplate.LookupEntry(spellid)) + if (!spellid || !sSpellTemplate.LookupEntry(spellid)) return false; player->SpellNonMeleeDamageLog(target, spellid, damage); @@ -3149,7 +3149,7 @@ bool ChatHandler::HandleAuraCommand(char* args) // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form uint32 spellID = ExtractSpellIdFromLink(&args); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellID); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellID); if (!spellInfo) return false; @@ -3229,7 +3229,7 @@ bool ChatHandler::HandleLinkGraveCommand(char* args) else return false; - WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id); + WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id); if (!graveyard) { PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, g_id); @@ -4147,7 +4147,7 @@ bool ChatHandler::HandleListTalentsCommand(char* /*args*/) if (cost_itr == 0) continue; - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(uSpell.first); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(uSpell.first); if (!spellEntry) continue; @@ -4491,7 +4491,7 @@ bool ChatHandler::HandleQuestAddCommand(char* args) // check item starting quest (it can work incorrectly if added without item in inventory) for (uint32 id = 0; id < sItemStorage.GetMaxEntry(); ++id) { - ItemPrototype const* pProto = sItemStorage.LookupEntry(id); + ItemPrototype const* pProto = sItemStorage.LookupEntry(id); if (!pProto) continue; @@ -4638,7 +4638,7 @@ bool ChatHandler::HandleQuestCompleteCommand(char* args) uint32 repValue = pQuest->GetRepObjectiveValue(); uint32 curRep = player->GetReputationMgr().GetReputation(repFaction); if (curRep < repValue) - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction)) + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction)) player->GetReputationMgr().SetReputation(factionEntry, repValue); } @@ -5556,7 +5556,7 @@ bool ChatHandler::HandleCastCommand(char* args) if (!spell) return false; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); if (!spellInfo) return false; @@ -5595,7 +5595,7 @@ bool ChatHandler::HandleCastBackCommand(char* args) // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form uint32 spell = ExtractSpellIdFromLink(&args); - if (!spell || !sSpellTemplate.LookupEntry(spell)) + if (!spell || !sSpellTemplate.LookupEntry(spell)) return false; bool triggered = ExtractLiteralArg(&args, "triggered") != nullptr; @@ -5621,7 +5621,7 @@ bool ChatHandler::HandleCastDistCommand(char* args) if (!spell) return false; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); if (!spellInfo) return false; @@ -5669,7 +5669,7 @@ bool ChatHandler::HandleCastTargetCommand(char* args) // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form uint32 spell = ExtractSpellIdFromLink(&args); - if (!spell || !sSpellTemplate.LookupEntry(spell)) + if (!spell || !sSpellTemplate.LookupEntry(spell)) return false; bool triggered = ExtractLiteralArg(&args, "triggered") != nullptr; @@ -5726,7 +5726,7 @@ bool ChatHandler::HandleCastSelfCommand(char* args) if (!spell) return false; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); if (!spellInfo) return false; @@ -6922,7 +6922,7 @@ bool ChatHandler::ModifyStatCommandHelper(char* args, char const* statName, uint { if (!*args) return false; - + Unit* target = getSelectedUnit(); if (!target) @@ -7017,7 +7017,7 @@ bool ChatHandler::HandleModifyArcaneCommand(char *args) bool ChatHandler::HandleModifyMeleeApCommand(char *args) { - + return ModifyStatCommandHelper(args, "Melee Attack Power", SPELL_MOD_MELEE_AP); } diff --git a/src/game/Chat/debugcmds.cpp b/src/game/Chat/debugcmds.cpp index 000f661a68b..a5110a2afac 100644 --- a/src/game/Chat/debugcmds.cpp +++ b/src/game/Chat/debugcmds.cpp @@ -1079,7 +1079,7 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args) if (!spellid) return false; - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellid); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellid); if (!spellEntry) return false; diff --git a/src/game/DBScripts/ScriptMgr.cpp b/src/game/DBScripts/ScriptMgr.cpp index c2e356a0ca2..7c0d0526e68 100644 --- a/src/game/DBScripts/ScriptMgr.cpp +++ b/src/game/DBScripts/ScriptMgr.cpp @@ -64,11 +64,11 @@ uint8 GetSpellStartDBScriptPriority(SpellEntry const* spellinfo, SpellEffectInde return 9; // NonExisting triggered spells can also start DB-Spell-Scripts - if (spellinfo->Effect[effIdx] == SPELL_EFFECT_TRIGGER_SPELL && !sSpellTemplate.LookupEntry(spellinfo->EffectTriggerSpell[effIdx])) + if (spellinfo->Effect[effIdx] == SPELL_EFFECT_TRIGGER_SPELL && !sSpellTemplate.LookupEntry(spellinfo->EffectTriggerSpell[effIdx])) return 5; // NonExisting trigger missile spells can also start DB-Spell-Scripts - if (spellinfo->Effect[effIdx] == SPELL_EFFECT_TRIGGER_MISSILE && !sSpellTemplate.LookupEntry(spellinfo->EffectTriggerSpell[effIdx])) + if (spellinfo->Effect[effIdx] == SPELL_EFFECT_TRIGGER_MISSILE && !sSpellTemplate.LookupEntry(spellinfo->EffectTriggerSpell[effIdx])) return 4; // Can not start script @@ -146,7 +146,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) tmp.o = fields[16].GetFloat(); tmp.condition_id = fields[17].GetUInt32(); - if (tmp.condition_id && !sConditionStorage.LookupEntry(tmp.condition_id)) + if (tmp.condition_id && !sConditionStorage.LookupEntry(tmp.condition_id)) { sLog.outErrorDb("Table `%s` has condition_id = %u in command %u for script id %u, but this condition does not exist, skipping.", tablename, tmp.condition_id, tmp.command, tmp.id); continue; @@ -451,7 +451,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) break; case SCRIPT_COMMAND_REMOVE_AURA: // 14 { - if (!sSpellTemplate.LookupEntry(tmp.removeAura.spellId)) + if (!sSpellTemplate.LookupEntry(tmp.removeAura.spellId)) { sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u", tablename, tmp.removeAura.spellId, tmp.id); @@ -461,7 +461,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_CAST_SPELL: // 15 { - if (!sSpellTemplate.LookupEntry(tmp.castSpell.spellId)) + if (!sSpellTemplate.LookupEntry(tmp.castSpell.spellId)) { sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u", tablename, tmp.castSpell.spellId, tmp.id); @@ -470,7 +470,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) bool hasErrored = false; for (uint8 i = 0; i < MAX_TEXT_ID; ++i) { - if (tmp.textId[i] && !sSpellTemplate.LookupEntry(uint32(tmp.textId[i]))) + if (tmp.textId[i] && !sSpellTemplate.LookupEntry(uint32(tmp.textId[i]))) { sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u, dataint%u", tablename, uint32(tmp.textId[i]), tmp.id, i + 1); @@ -635,7 +635,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) uint32 taxiSpell = 0; for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry() && taxiSpell == 0; ++i) { - if (SpellEntry const* spell = sSpellTemplate.LookupEntry(i)) + if (SpellEntry const* spell = sSpellTemplate.LookupEntry(i)) for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { if (spell->Effect[j] == SPELL_EFFECT_SEND_TAXI && spell->EffectMiscValue[j] == int32(tmp.sendTaxiPath.taxiPathId)) @@ -674,7 +674,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) break; case SCRIPT_COMMAND_TERMINATE_COND: // 34 { - if (!sConditionStorage.LookupEntry(tmp.terminateCond.conditionId)) + if (!sConditionStorage.LookupEntry(tmp.terminateCond.conditionId)) { sLog.outErrorDb("Table `%s` has datalong = %u in SCRIPT_COMMAND_TERMINATE_COND for script id %u, but this condition_id does not exist.", tablename, tmp.terminateCond.conditionId, tmp.id); continue; @@ -730,7 +730,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) break; case SCRIPT_COMMAND_UPDATE_TEMPLATE: // 44 { - if (!sCreatureStorage.LookupEntry(tmp.updateTemplate.newTemplate)) + if (!sCreatureStorage.LookupEntry(tmp.updateTemplate.newTemplate)) { sLog.outErrorDb("Table `%s` uses nonexistent creature entry %u in SCRIPT_COMMAND_UPDATE_TEMPLATE for script id %u.", tablename, tmp.updateTemplate.newTemplate, tmp.id); continue; @@ -762,7 +762,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_CAST_CUSTOM_SPELL: // 46 { - if (!sSpellTemplate.LookupEntry(tmp.castSpell.spellId)) + if (!sSpellTemplate.LookupEntry(tmp.castSpell.spellId)) { sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_CAST_CUSTOM_SPELL for script id %u", tablename, tmp.castSpell.spellId, tmp.id); @@ -869,7 +869,7 @@ void ScriptMgr::LoadSpellScripts() // check ids for (ScriptMapMap::const_iterator itr = sSpellScripts.second.begin(); itr != sSpellScripts.second.end(); ++itr) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr->first); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr->first); if (!spellInfo) { sLog.outErrorDb("Table `dbscripts_on_spell` has not existing spell (Id: %u) as script id", itr->first); @@ -2531,7 +2531,7 @@ void ScriptMgr::CollectPossibleEventIds(std::set& eventIds) // Load all possible script entries from spells for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry(); ++i) { - SpellEntry const* spell = sSpellTemplate.LookupEntry(i); + SpellEntry const* spell = sSpellTemplate.LookupEntry(i); if (spell) { for (int j = 0; j < MAX_EFFECT_INDEX; ++j) diff --git a/src/game/Entities/CharacterHandler.cpp b/src/game/Entities/CharacterHandler.cpp index 8fa5f7a195f..8a3abf6c60c 100644 --- a/src/game/Entities/CharacterHandler.cpp +++ b/src/game/Entities/CharacterHandler.cpp @@ -801,7 +801,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) if (!pCurrChar->isGMVisible()) { SendNotification(LANG_INVISIBLE_INVISIBLE); - SpellEntry const* invisibleAuraInfo = sSpellTemplate.LookupEntry(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA)); + SpellEntry const* invisibleAuraInfo = sSpellTemplate.LookupEntry(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA)); if (invisibleAuraInfo && IsSpellAppliesAura(invisibleAuraInfo)) pCurrChar->CastSpell(pCurrChar, invisibleAuraInfo, TRIGGERED_OLD_TRIGGERED); } diff --git a/src/game/Entities/Creature.cpp b/src/game/Entities/Creature.cpp index 83df97aa27b..ed0915b81dd 100644 --- a/src/game/Entities/Creature.cpp +++ b/src/game/Entities/Creature.cpp @@ -1858,7 +1858,7 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim) { if (!m_spell) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_spell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_spell); if (!spellInfo) { sLog.outError("WORLD: unknown spell id %i", m_spell); @@ -1910,7 +1910,7 @@ SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim) { if (!m_spell) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_spell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_spell); if (!spellInfo) { sLog.outError("WORLD: unknown spell id %i", m_spell); @@ -2301,7 +2301,7 @@ bool Creature::MeetsSelectAttackingRequirement(Unit* pTarget, SpellEntry const* Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, uint32 spellId, uint32 selectFlags, SelectAttackingTargetParams params /*= SelectAttackingTargetParams()*/) const { - return SelectAttackingTarget(target, position, sSpellTemplate.LookupEntry(spellId), selectFlags, params); + return SelectAttackingTarget(target, position, sSpellTemplate.LookupEntry(spellId), selectFlags, params); } Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, SpellEntry const* spellInfo /*= nullptr*/, uint32 selectFlags/*= 0*/, SelectAttackingTargetParams params /*= SelectAttackingTargetParams()*/) const @@ -2416,7 +2416,7 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S void Creature::SelectAttackingTargets(std::vector& selectedTargets, AttackingTarget target, uint32 position, uint32 spellId, uint32 selectFlags/*= 0*/, SelectAttackingTargetParams params /*= SelectAttackingTargetParams()*/) const { - SelectAttackingTargets(selectedTargets, target, position, sSpellTemplate.LookupEntry(spellId), selectFlags, params); + SelectAttackingTargets(selectedTargets, target, position, sSpellTemplate.LookupEntry(spellId), selectFlags, params); } void Creature::SelectAttackingTargets(std::vector& selectedTargets, AttackingTarget target, uint32 position, SpellEntry const* spellInfo /*= nullptr*/, uint32 selectFlags/*= 0*/, SelectAttackingTargetParams params /*= SelectAttackingTargetParams()*/) const @@ -2708,7 +2708,7 @@ void Creature::ApplyGameEventSpells(GameEventCreatureData const* eventData, bool uint32 remove_spell = activated ? eventData->spell_id_end : eventData->spell_id_start; if (remove_spell) - if (SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(remove_spell)) + if (SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(remove_spell)) if (IsSpellAppliesAura(spellEntry)) RemoveAurasDueToSpell(remove_spell); diff --git a/src/game/Entities/Creature.h b/src/game/Entities/Creature.h index f63688084b3..eb0ea62c5be 100644 --- a/src/game/Entities/Creature.h +++ b/src/game/Entities/Creature.h @@ -67,273 +67,6 @@ enum CreatureExtraFlags CREATURE_EXTRA_FLAG_POISON_IMMUNITY = 0x01000000, // 16777216 creature is immune to poisons }; -// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform -#if defined( __GNUC__ ) -#pragma pack(1) -#else -#pragma pack(push,1) -#endif - -#define MAX_KILL_CREDIT 2 -#define MAX_CREATURE_MODEL 4 -#define USE_DEFAULT_DATABASE_LEVEL 0 // just used to show we don't want to force the new creature level and use the level stored in db -#define MINIMUM_LOOTING_TIME (2 * MINUTE * IN_MILLISECONDS) // give player enough time to pick loot - -// from `creature_template` table -struct CreatureInfo -{ - uint32 Entry; - char* Name; - char* SubName; - char* IconName; - uint32 MinLevel; - uint32 MaxLevel; - uint32 HeroicEntry; - uint32 ModelId[MAX_CREATURE_MODEL]; - uint32 Faction; - float Scale; - uint32 Family; // enum CreatureFamily values (optional) - uint32 CreatureType; // enum CreatureType values - uint32 InhabitType; - uint32 RegenerateStats; - bool RacialLeader; - uint32 NpcFlags; - uint32 UnitFlags; // enum UnitFlags mask values - uint32 DynamicFlags; - uint32 ExtraFlags; - uint32 CreatureTypeFlags; // enum CreatureTypeFlags mask values - float SpeedWalk; - float SpeedRun; - uint32 Detection; // Detection Range for Line of Sight aggro - uint32 CallForHelp; - uint32 Pursuit; - uint32 Leash; - uint32 Timeout; - uint32 UnitClass; // enum Classes. Note only 4 classes are known for creatures. - uint32 Rank; - int32 Expansion; // creature expansion, important for stats, CAN BE -1 as marker for some invalid cases. - float HealthMultiplier; - float PowerMultiplier; - float DamageMultiplier; - float DamageVariance; - float ArmorMultiplier; - float ExperienceMultiplier; - uint32 MinLevelHealth; - uint32 MaxLevelHealth; - uint32 MinLevelMana; - uint32 MaxLevelMana; - float MinMeleeDmg; - float MaxMeleeDmg; - float MinRangedDmg; - float MaxRangedDmg; - uint32 Armor; - uint32 MeleeAttackPower; - uint32 RangedAttackPower; - uint32 MeleeBaseAttackTime; - uint32 RangedBaseAttackTime; - uint32 DamageSchool; - uint32 MinLootGold; - uint32 MaxLootGold; - uint32 LootId; - uint32 PickpocketLootId; - uint32 SkinningLootId; - uint32 KillCredit[MAX_KILL_CREDIT]; - uint32 MechanicImmuneMask; - uint32 SchoolImmuneMask; - int32 ResistanceHoly; - int32 ResistanceFire; - int32 ResistanceNature; - int32 ResistanceFrost; - int32 ResistanceShadow; - int32 ResistanceArcane; - uint32 PetSpellDataId; - uint32 MovementType; - uint32 TrainerType; - uint32 TrainerSpell; - uint32 TrainerClass; - uint32 TrainerRace; - uint32 TrainerTemplateId; - uint32 VendorTemplateId; - uint32 EquipmentTemplateId; - uint32 GossipMenuId; - VisibilityDistanceType visibilityDistanceType; - char const* AIName; - uint32 ScriptID; - - // helpers - static HighGuid GetHighGuid() - { - return HIGHGUID_UNIT; // in pre-3.x always HIGHGUID_UNIT - } - - ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), Entry, lowguid); } - - SkillType GetRequiredLootSkill() const - { - if (CreatureTypeFlags & CREATURE_TYPEFLAGS_HERBLOOT) - return SKILL_HERBALISM; - if (CreatureTypeFlags & CREATURE_TYPEFLAGS_MININGLOOT) - return SKILL_MINING; - - return SKILL_SKINNING; // normal case - } - - bool isTameable() const - { - return CreatureType == CREATURE_TYPE_BEAST && Family != 0 && (CreatureTypeFlags & CREATURE_TYPEFLAGS_TAMEABLE); - } -}; - -struct CreatureTemplateSpells -{ - uint32 entry; - uint32 setId; - uint32 spells[CREATURE_MAX_SPELLS]; -}; - -struct CreatureCooldowns -{ - uint32 entry; - uint32 spellId; - uint32 cooldownMin; - uint32 cooldownMax; -}; - -struct EquipmentInfo -{ - uint32 entry; - uint32 equipentry[3]; -}; - -// depricated old way -struct EquipmentInfoRaw -{ - uint32 entry; - uint32 equipmodel[3]; - uint32 equipinfo[3]; - uint32 equipslot[3]; -}; - -enum SpawnFlags -{ - SPAWN_FLAG_RUN_ON_SPAWN = 0x01, - SPAWN_FLAG_HOVER = 0x02, -}; - -struct CreatureSpawnTemplate -{ - uint32 entry; - int64 unitFlags; - uint32 faction; - uint32 modelId; - int32 equipmentId; - uint32 curHealth; - uint32 curMana; - uint32 spawnFlags; - - bool IsRunning() const { return (spawnFlags & SPAWN_FLAG_RUN_ON_SPAWN) != 0; } - bool IsHovering() const { return (spawnFlags & SPAWN_FLAG_HOVER) != 0; } -}; - -// from `creature` table -struct CreatureData -{ - uint32 id; // entry in creature_template - uint16 mapid; - uint32 modelid_override; // overrides any model defined in creature_template - int32 equipmentId; - float posX; - float posY; - float posZ; - float orientation; - uint32 spawntimesecsmin; - uint32 spawntimesecsmax; - float spawndist; - uint32 currentwaypoint; - uint32 curhealth; - uint32 curmana; - bool is_dead; - uint8 movementType; - uint8 spawnMask; - int16 gameEvent; - uint16 GuidPoolId; - uint16 EntryPoolId; - uint16 OriginalZoneId; - CreatureSpawnTemplate const* spawnTemplate; - - // helper function - ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(CreatureInfo::GetHighGuid(), id, lowguid); } - uint32 GetRandomRespawnTime() const { return urand(spawntimesecsmin, spawntimesecsmax); } - - // return false if it should be handled by GameEventMgr or PoolMgr - bool IsNotPartOfPoolOrEvent() const { return (!gameEvent && !GuidPoolId && !EntryPoolId); } -}; - -enum SplineFlags -{ - SPLINEFLAG_WALKMODE = 0x0000100, - SPLINEFLAG_FLYING = 0x0000200, -}; - -// from `creature_addon` and `creature_template_addon`tables -struct CreatureDataAddon -{ - uint32 guidOrEntry; - uint32 mount; - uint32 bytes1; - uint8 sheath_state; // SheathState - uint8 flags; // UnitBytes2_Flags - uint32 emote; - uint32 move_flags; - uint32 const* auras; // loaded as char* "spell1 spell2 ... " -}; - -// Bases values for given Level and UnitClass -struct CreatureClassLvlStats -{ - uint32 BaseHealth; - uint32 BaseMana; - float BaseDamage; - float BaseMeleeAttackPower; - float BaseRangedAttackPower; - uint32 BaseArmor; -}; - -struct CreatureModelInfo -{ - uint32 modelid; - float bounding_radius; - float combat_reach; - float SpeedWalk; - float SpeedRun; - uint8 gender; - uint32 modelid_other_gender; // The oposite gender for this modelid (male/female) - uint32 modelid_alternative; // An alternative model. Generally same gender(2) -}; - -struct CreatureModelRace -{ - uint32 modelid; // Native model/base model the selection is for - uint32 racemask; // Races it applies to (and then a player source must exist for selection) - uint32 creature_entry; // Modelid from creature_template.entry will be selected - uint32 modelid_racial; // Explicit modelid. Used if creature_template entry is not defined -}; - -struct CreatureConditionalSpawn -{ - uint32 Guid; - uint32 EntryAlliance; - uint32 EntryHorde; - // Note: future condition flags to be added -}; - -// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform -#if defined( __GNUC__ ) -#pragma pack() -#else -#pragma pack(pop) -#endif - struct CreatureLocale { std::vector Name; diff --git a/src/game/Entities/DynamicObject.cpp b/src/game/Entities/DynamicObject.cpp index 1fed0bf2a4c..bb38e749539 100644 --- a/src/game/Entities/DynamicObject.cpp +++ b/src/game/Entities/DynamicObject.cpp @@ -93,7 +93,7 @@ bool DynamicObject::Create(uint32 guidlow, Unit* caster, uint32 spellId, SpellEf SetFloatValue(DYNAMICOBJECT_POS_Z, z); SetUInt32Value(DYNAMICOBJECT_CASTTIME, WorldTimer::getMSTime()); // new 2.4.0 - SpellEntry const* spellProto = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellProto = sSpellTemplate.LookupEntry(spellId); if (!spellProto) { sLog.outError("DynamicObject (spell %u) not created. Spell not exist!", spellId); diff --git a/src/game/Entities/GameObject.cpp b/src/game/Entities/GameObject.cpp index b7bb392c195..7e3aeeb8cdd 100644 --- a/src/game/Entities/GameObject.cpp +++ b/src/game/Entities/GameObject.cpp @@ -1857,7 +1857,7 @@ void GameObject::Use(Unit* user, SpellEntry const* spellInfo) if (!spellId) return; - SpellEntry const* triggeredSpellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* triggeredSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!triggeredSpellInfo) { sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId, GetEntry(), GetGoType()); @@ -2509,14 +2509,14 @@ SpellEntry const* GameObject::GetSpellForLock(Player const* player) const continue; if (lock->Type[i] == LOCK_KEY_SPELL) - if (SpellEntry const* spell = sSpellTemplate.LookupEntry(lock->Index[i])) + if (SpellEntry const* spell = sSpellTemplate.LookupEntry(lock->Index[i])) return spell; if (lock->Type[i] != LOCK_KEY_SKILL) break; for (auto&& playerSpell : player->GetSpellMap()) - if (SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(playerSpell.first)) + if (SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(playerSpell.first)) for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) if (spellInfo->Effect[i] == SPELL_EFFECT_OPEN_LOCK && ((uint32)spellInfo->EffectMiscValue[i]) == lock->Index[i]) if (player->CalculateSpellEffectValue(nullptr, spellInfo, SpellEffectIndex(i), nullptr) >= int32(lock->Skill[i])) @@ -2528,7 +2528,7 @@ SpellEntry const* GameObject::GetSpellForLock(Player const* player) const SpellCastResult GameObject::CastSpell(Unit* temporaryCaster, Unit* Victim, uint32 spellId, uint32 triggeredFlags, Item* castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy) { - return CastSpell(temporaryCaster, Victim, sSpellTemplate.LookupEntry(spellId), triggeredFlags, castItem, triggeredByAura, originalCaster, triggeredBy); + return CastSpell(temporaryCaster, Victim, sSpellTemplate.LookupEntry(spellId), triggeredFlags, castItem, triggeredByAura, originalCaster, triggeredBy); } SpellCastResult GameObject::CastSpell(Unit* temporaryCaster, Unit* Victim, SpellEntry const* spellInfo, uint32 triggeredFlags, Item* castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy) diff --git a/src/game/Entities/Item.cpp b/src/game/Entities/Item.cpp index a4e0748e52e..3d07bbeff8d 100644 --- a/src/game/Entities/Item.cpp +++ b/src/game/Entities/Item.cpp @@ -93,7 +93,7 @@ void AddItemsSetItem(Player* player, Item* item) { if (!spell) // free slot { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(set->spells[x]); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(set->spells[x]); if (!spellInfo) { sLog.outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid); @@ -680,7 +680,7 @@ uint32 Item::GetSpell() const int32 Item::GenerateItemRandomPropertyId(uint32 item_id) { - ItemPrototype const* itemProto = sItemStorage.LookupEntry(item_id); + ItemPrototype const* itemProto = sItemStorage.LookupEntry(item_id); if (!itemProto) return 0; @@ -1024,7 +1024,7 @@ bool Item::GemsFitSockets() const uint32 gemid = enchantEntry->GemID; if (gemid) { - ItemPrototype const* gemProto = sItemStorage.LookupEntry(gemid); + ItemPrototype const* gemProto = sItemStorage.LookupEntry(gemid); if (gemProto) { GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties); diff --git a/src/game/Entities/ItemHandler.cpp b/src/game/Entities/ItemHandler.cpp index 3f45cb3a74b..b7ab4c242c1 100644 --- a/src/game/Entities/ItemHandler.cpp +++ b/src/game/Entities/ItemHandler.cpp @@ -353,7 +353,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recv_data) { // send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown // use `item_template` or if not set then only use spell cooldowns - SpellEntry const* spell = sSpellTemplate.LookupEntry(Spell.SpellId); + SpellEntry const* spell = sSpellTemplate.LookupEntry(Spell.SpellId); if (spell) { bool db_data = Spell.SpellCooldown >= 0 || Spell.SpellCategoryCooldown >= 0; diff --git a/src/game/Entities/NPCHandler.h b/src/game/Entities/NPCHandler.h index 1df8de9f6d5..6cc0e22fabe 100644 --- a/src/game/Entities/NPCHandler.h +++ b/src/game/Entities/NPCHandler.h @@ -26,14 +26,6 @@ #pragma pack(push,1) #endif -struct PageText -{ - uint32 Page_ID; - char* Text; - - uint32 Next_Page; -}; - // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform #if defined( __GNUC__ ) #pragma pack() diff --git a/src/game/Entities/Object.cpp b/src/game/Entities/Object.cpp index 5bb39500bfe..5be4f056ef6 100644 --- a/src/game/Entities/Object.cpp +++ b/src/game/Entities/Object.cpp @@ -2589,7 +2589,7 @@ bool WorldObject::IsSpellReady(SpellEntry const& spellEntry, ItemPrototype const bool WorldObject::IsSpellReady(uint32 spellId, ItemPrototype const* itemProto /*= nullptr*/) const { - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellId); if (!spellEntry) return false; @@ -2666,7 +2666,7 @@ void WorldObject::LockOutSpells(SpellSchoolMask schoolMask, uint32 duration) void WorldObject::RemoveSpellCooldown(uint32 spellId, bool updateClient /*= true*/) { - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellId); if (!spellEntry) return; diff --git a/src/game/Entities/ObjectVisibility.h b/src/game/Entities/ObjectVisibility.h index 59263d81937..5b1557a2e6f 100644 --- a/src/game/Entities/ObjectVisibility.h +++ b/src/game/Entities/ObjectVisibility.h @@ -20,36 +20,11 @@ #define __OBJECT_VISIBILITY_H #include "Common.h" +#include "ObjectVisibilityDefines.h" class WorldObject; class Unit; -enum class VisibilityDistanceType : uint32 -{ - Normal = 0, - Tiny = 1, - Small = 2, - Large = 3, - Gigantic = 4, - Infinite = 5, - - Max -}; - -enum StealthType : uint32 -{ - STEALTH_UNIT = 0, - STEALTH_TRAP = 1, - STEALTH_TYPE_MAX, -}; - -enum InvisibilityType : uint32 -{ - INVISIBILITY_TRAP = 3, - INVISIBILITY_DRUNK = 6, - INVISIBILITY_TYPE_MAX = 32, -}; - class VisibilityData { public: diff --git a/src/game/Entities/ObjectVisibilityDefines.h b/src/game/Entities/ObjectVisibilityDefines.h new file mode 100644 index 00000000000..2935a3b2b35 --- /dev/null +++ b/src/game/Entities/ObjectVisibilityDefines.h @@ -0,0 +1,50 @@ +/* + * This file is part of the CMaNGOS Project. See AUTHORS 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 Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __OBJECT_VISIBILITY_DEFINES_H +#define __OBJECT_VISIBILITY_DEFINES_H + +#include "Common.h" + +enum class VisibilityDistanceType : uint32 +{ + Normal = 0, + Tiny = 1, + Small = 2, + Large = 3, + Gigantic = 4, + Infinite = 5, + + Max +}; + +enum StealthType : uint32 +{ + STEALTH_UNIT = 0, + STEALTH_TRAP = 1, + STEALTH_TYPE_MAX, +}; + +enum InvisibilityType : uint32 +{ + INVISIBILITY_TRAP = 3, + INVISIBILITY_DRUNK = 6, + INVISIBILITY_TYPE_MAX = 32, +}; + +#endif \ No newline at end of file diff --git a/src/game/Entities/Pet.cpp b/src/game/Entities/Pet.cpp index ed4d9c54587..b938695726c 100644 --- a/src/game/Entities/Pet.cpp +++ b/src/game/Entities/Pet.cpp @@ -134,7 +134,7 @@ SpellCastResult Pet::TryLoadFromDB(Unit* owner, uint32 petentry /*= 0*/, uint32 return SPELL_FAILED_NO_PET; } - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(summon_spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(summon_spell_id); bool isTemporarySummoned = spellInfo && GetSpellDuration(spellInfo) > 0; @@ -207,7 +207,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry /*= 0*/, uint32 petnumber } uint32 summon_spell_id = fields[21].GetUInt32(); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(summon_spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(summon_spell_id); if (permanentOnly && spellInfo && GetSpellDuration(spellInfo) > 0) { @@ -1049,7 +1049,7 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= nullptr*/) { // returning of reagents only for players, so best done here uint32 spellId = GetUInt32Value(UNIT_CREATED_BY_SPELL); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (spellInfo) { @@ -1568,7 +1568,7 @@ void Pet::_LoadSpellCooldowns() uint32 spell_id = fields[0].GetUInt32(); uint64 spell_time = fields[1].GetUInt64(); - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spell_id); if (!spellEntry) { sLog.outError("%s has unknown spell %u in `character_spell_cooldown`, skipping.", GetGuidStr().c_str(), spell_id); @@ -1730,7 +1730,7 @@ void Pet::_LoadAuras(uint32 timediff) int32 remaintime = fields[12].GetInt32(); uint32 effIndexMask = fields[13].GetUInt32(); - SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellid); + SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellid); if (!spellproto) { sLog.outError("Unknown spell (spellid %u), ignore.", spellid); @@ -1885,7 +1885,7 @@ void Pet::_SaveAuras() bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpellState state /*= PETSPELL_NEW*/, PetSpellType type /*= PETSPELL_NORMAL*/) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); if (!spellInfo) { // do pet spell book cleanup @@ -2069,7 +2069,7 @@ void Pet::InitPetCreateSpells() if (!CreateSpells->spellid[i]) break; - SpellEntry const* learn_spellproto = sSpellTemplate.LookupEntry(CreateSpells->spellid[i]); + SpellEntry const* learn_spellproto = sSpellTemplate.LookupEntry(CreateSpells->spellid[i]); if (!learn_spellproto) continue; diff --git a/src/game/Entities/PetHandler.cpp b/src/game/Entities/PetHandler.cpp index 5b7c2cd9995..25bbe478183 100644 --- a/src/game/Entities/PetHandler.cpp +++ b/src/game/Entities/PetHandler.cpp @@ -295,7 +295,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) Unit* unit_target = targetGuid ? _player->GetMap()->GetUnit(targetGuid) : nullptr; // do not cast unknown spells - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellid); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellid); if (!spellInfo) { sLog.outError("WORLD: unknown PET spell id %i", spellid); @@ -816,7 +816,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) Creature* petCreature = petUnit->GetTypeId() == TYPEID_UNIT ? static_cast(petUnit) : nullptr; Pet* pet = (petCreature && petCreature->IsPet()) ? static_cast(petUnit) : nullptr; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellid); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellid); if (!spellInfo) { sLog.outError("WORLD: unknown PET spell id %i", spellid); diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index 8fc21eba63c..71b03e42efe 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -351,7 +351,7 @@ SpellModifier::SpellModifier(SpellModOp _op, SpellModType _type, int32 _value, A bool SpellModifier::isAffectedOnSpell(SpellEntry const* spell) const { - SpellEntry const* affect_spell = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* affect_spell = sSpellTemplate.LookupEntry(spellId); // False if affect_spell == nullptr or spellFamily not equal if (!affect_spell || affect_spell->SpellFamilyName != spell->SpellFamilyName) return false; @@ -1715,7 +1715,7 @@ bool Player::BuildEnumData(QueryResult* result, WorldPacket& p_data) if (result && !(playerFlags & PLAYER_FLAGS_GHOST) && (pClass == CLASS_WARLOCK || pClass == CLASS_HUNTER)) { uint32 entry = fields[16].GetUInt32(); - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(entry); + CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(entry); if (cInfo) { petDisplayId = fields[17].GetUInt32(); @@ -3115,7 +3115,7 @@ static inline bool IsUnlearnSpellsPacketNeededForSpell(uint32 spellId) bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); if (!spellInfo) { // do character spell book cleanup (all characters) @@ -3610,7 +3610,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo // for shaman Dual-wield if (CanDualWield()) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); if (IsSpellHaveEffect(spellInfo, SPELL_EFFECT_DUAL_WIELD)) SetCanDualWield(false); @@ -3655,7 +3655,7 @@ void Player::_LoadSpellCooldowns(QueryResult* result) uint64 cat_time = fields[3].GetUInt64(); uint32 item_id = fields[4].GetUInt32(); - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spell_id); if (!spellEntry) { sLog.outError("%s has unknown spell %u in `character_spell_cooldown`, skipping.", GetGuidStr().c_str(), spell_id); @@ -4129,7 +4129,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell return TRAINER_SPELL_RED; // exist, already checked at loading - SpellEntry const* spell = sSpellTemplate.LookupEntry(trainer_spell->learnedSpell); + SpellEntry const* spell = sSpellTemplate.LookupEntry(trainer_spell->learnedSpell); // secondary prof. or not prof. spell uint32 skill = spell->EffectMiscValue[1]; @@ -5440,7 +5440,7 @@ bool Player::UpdateCraftSkill(uint32 spellid) uint32 SkillValue = GetSkillValuePure(skill->skillId); // Alchemy Discoveries here - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellid); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellid); if (spellEntry && spellEntry->Mechanic == MECHANIC_DISCOVERY) { if (uint32 discoveredSpell = GetSkillDiscoverySpell(skill->skillId, spellid, this)) @@ -6203,7 +6203,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type, Pl { case ACTION_BUTTON_SPELL: { - SpellEntry const* spellProto = sSpellTemplate.LookupEntry(action); + SpellEntry const* spellProto = sSpellTemplate.LookupEntry(action); if (!spellProto) { if (player) @@ -6431,7 +6431,7 @@ void Player::CheckAreaExploreAndOutdoor() { if (itr.second.state == PLAYERSPELL_REMOVED) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr.first); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr.first); if (!spellInfo || !IsNeedCastSpellAtOutdoor(spellInfo) || HasAura(itr.first)) continue; if ((spellInfo->Stances || spellInfo->StancesNot) && !IsNeedCastSpellAtFormApply(spellInfo, GetShapeshiftForm())) @@ -6541,7 +6541,7 @@ void Player::setFactionForRace(uint8 race) ReputationRank Player::GetReputationRank(uint32 faction) const { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction); return GetReputationMgr().GetRank(factionEntry); } @@ -6616,7 +6616,7 @@ int32 Player::CalculateReputationGain(ReputationSource source, int32 rep, int32 if (source == REPUTATION_SOURCE_QUEST && result && faction) { - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction)) + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction)) { int32 current = GetReputationMgr().GetReputation(factionEntry); @@ -6651,7 +6651,7 @@ void Player::RewardReputation(Creature* victim, float rate) { int32 donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, Rep->repvalue1, 0, Rep->repfaction1, victim->getLevel()); donerep1 = int32(donerep1 * rate); - FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(Rep->repfaction1); + FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(Rep->repfaction1); uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); if (factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1) GetReputationMgr().ModifyReputation(factionEntry1, donerep1); @@ -6659,7 +6659,7 @@ void Player::RewardReputation(Creature* victim, float rate) // Wiki: Team factions value divided by 2 if (factionEntry1 && Rep->is_teamaward1) { - FactionEntry const* team1_factionEntry = sFactionStore.LookupEntry(factionEntry1->team); + FactionEntry const* team1_factionEntry = sFactionStore.LookupEntry(factionEntry1->team); if (team1_factionEntry) GetReputationMgr().ModifyReputation(team1_factionEntry, donerep1 / 2); } @@ -6669,7 +6669,7 @@ void Player::RewardReputation(Creature* victim, float rate) { int32 donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, Rep->repvalue2, 0, Rep->repfaction2, victim->getLevel()); donerep2 = int32(donerep2 * rate); - FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(Rep->repfaction2); + FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(Rep->repfaction2); uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); if (factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2) GetReputationMgr().ModifyReputation(factionEntry2, donerep2); @@ -6677,7 +6677,7 @@ void Player::RewardReputation(Creature* victim, float rate) // Wiki: Team factions value divided by 2 if (factionEntry2 && Rep->is_teamaward2) { - FactionEntry const* team2_factionEntry = sFactionStore.LookupEntry(factionEntry2->team); + FactionEntry const* team2_factionEntry = sFactionStore.LookupEntry(factionEntry2->team); if (team2_factionEntry) GetReputationMgr().ModifyReputation(team2_factionEntry, donerep2 / 2); } @@ -6697,7 +6697,7 @@ void Player::RewardReputation(Quest const* pQuest) { int32 rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, pQuest->RewRepValue[i], pQuest->RewMaxRepValue[i], pQuest->RewRepFaction[i], GetQuestLevelForPlayer(pQuest)); - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->RewRepFaction[i])) + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->RewRepFaction[i])) GetReputationMgr().ModifyReputation(factionEntry, rep); } } @@ -7582,7 +7582,7 @@ void Player::ApplyItemEquipSpell(Item* item, bool apply, bool form_change) } // check if it is valid spell - SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellData.SpellId); + SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellData.SpellId); if (!spellproto) continue; @@ -7757,7 +7757,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType, bool sp if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellData.SpellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellData.SpellId); if (!spellInfo) { sLog.outError("WORLD: unknown Item spellid %i", spellData.SpellId); @@ -7801,7 +7801,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType, bool sp if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(proc_spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(proc_spell_id); if (!spellInfo) { sLog.outError("Player::CastItemCombatSpell Enchant %i, cast unknown spell %i", pEnchant->ID, proc_spell_id); @@ -7847,7 +7847,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets& targets, uint8 cast_ uint32 learn_spell_id = proto->Spells[0].SpellId; uint32 learning_spell_id = proto->Spells[1].SpellId; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(learn_spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(learn_spell_id); if (!spellInfo) { sLog.outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id); @@ -7882,7 +7882,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets& targets, uint8 cast_ if (i != spell_index) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellData.SpellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellData.SpellId); if (!spellInfo) { sLog.outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId); @@ -10517,7 +10517,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update) if (getClass() == CLASS_ROGUE) cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s; - SpellEntry const* spellProto = sSpellTemplate.LookupEntry(cooldownSpell); + SpellEntry const* spellProto = sSpellTemplate.LookupEntry(cooldownSpell); if (!spellProto) sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); @@ -13160,7 +13160,7 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver) } if (pQuest->GetRepObjectiveFaction()) - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction())) + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction())) GetReputationMgr().SetVisible(factionEntry); uint32 qtime = 0; @@ -13412,7 +13412,7 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver, if (spellId) { - if (SpellEntry const* spellProto = sSpellTemplate.LookupEntry(spellId)) + if (SpellEntry const* spellProto = sSpellTemplate.LookupEntry(spellId)) { Unit* caster = this; @@ -14470,11 +14470,11 @@ void Player::ReputationChanged(FactionEntry const* factionEntry) case FACTION_STORMPIKE_GUARD: case FACTION_SILVERWING_SENTINELS: { - FactionEntry const* factionEntryArathor = sFactionStore.LookupEntry(FACTION_LEAGUE_OF_ARATHOR); + FactionEntry const* factionEntryArathor = sFactionStore.LookupEntry(FACTION_LEAGUE_OF_ARATHOR); if (repMgr.GetRank(factionEntryArathor) < REP_EXALTED) break; - FactionEntry const* factionEntryStormpike = sFactionStore.LookupEntry(FACTION_STORMPIKE_GUARD); + FactionEntry const* factionEntryStormpike = sFactionStore.LookupEntry(FACTION_STORMPIKE_GUARD); if (repMgr.GetRank(factionEntryStormpike) < REP_EXALTED) break; - FactionEntry const* factionEntrySentinels = sFactionStore.LookupEntry(FACTION_SILVERWING_SENTINELS); + FactionEntry const* factionEntrySentinels = sFactionStore.LookupEntry(FACTION_SILVERWING_SENTINELS); if (repMgr.GetRank(factionEntrySentinels) < REP_EXALTED) break; SetTitle(TITLE_JUSTICAR); break; @@ -14483,11 +14483,11 @@ void Player::ReputationChanged(FactionEntry const* factionEntry) case FACTION_FROSTWOLF_CLAN: case FACTION_WARSONG_OUTRIDERS: { - FactionEntry const* factionEntryDefilers = sFactionStore.LookupEntry(FACTION_DEFILERS); + FactionEntry const* factionEntryDefilers = sFactionStore.LookupEntry(FACTION_DEFILERS); if (repMgr.GetRank(factionEntryDefilers) < REP_EXALTED) break; - FactionEntry const* factionEntryFrostwolf = sFactionStore.LookupEntry(FACTION_FROSTWOLF_CLAN); + FactionEntry const* factionEntryFrostwolf = sFactionStore.LookupEntry(FACTION_FROSTWOLF_CLAN); if (repMgr.GetRank(factionEntryFrostwolf) < REP_EXALTED) break; - FactionEntry const* factionEntryWarsong = sFactionStore.LookupEntry(FACTION_WARSONG_OUTRIDERS); + FactionEntry const* factionEntryWarsong = sFactionStore.LookupEntry(FACTION_WARSONG_OUTRIDERS); if (repMgr.GetRank(factionEntryWarsong) < REP_EXALTED) break; SetTitle(TITLE_CONQUEROR); break; @@ -15578,7 +15578,7 @@ void Player::_LoadAuras(QueryResult* result, uint32 timediff) int32 remaintime = fields[12].GetInt32(); uint32 effIndexMask = fields[13].GetUInt32(); - SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellid); + SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellid); if (!spellproto) { sLog.outError("Unknown spell (spellid %u), ignore.", spellid); @@ -18963,7 +18963,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) if (!gemid) continue; - ItemPrototype const* gemProto = sItemStorage.LookupEntry(gemid); + ItemPrototype const* gemProto = sItemStorage.LookupEntry(gemid); if (!gemProto) continue; @@ -19591,7 +19591,7 @@ void Player::ApplyEquipCooldown(Item* pItem) if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) continue; - SpellEntry const* spellentry = sSpellTemplate.LookupEntry(spellData.SpellId); + SpellEntry const* spellentry = sSpellTemplate.LookupEntry(spellData.SpellId); if (!spellentry) continue; @@ -19645,7 +19645,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) if (!spell_id) return; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); if (!spellInfo) return; @@ -19673,7 +19673,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) if (!HasSpell(first_spell)) return; - SpellEntry const* learnedInfo = sSpellTemplate.LookupEntry(learned_0); + SpellEntry const* learnedInfo = sSpellTemplate.LookupEntry(learned_0); if (!learnedInfo) return; @@ -19686,7 +19686,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) if (itr->second.state == PLAYERSPELL_REMOVED || itr->first == learned_0) continue; - SpellEntry const* itrInfo = sSpellTemplate.LookupEntry(itr->first); + SpellEntry const* itrInfo = sSpellTemplate.LookupEntry(itr->first); if (!itrInfo) return; @@ -20432,7 +20432,7 @@ struct UpdateZoneDependentPetsHelper { if (unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->IsPet() && !((Pet*)unit)->isControlled()) if (uint32 spell_id = unit->GetUInt32Value(UNIT_CREATED_BY_SPELL)) - if (SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spell_id)) + if (SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spell_id)) if (sSpellMgr.GetSpellAllowedInLocationError(spellEntry, owner->GetMapId(), zone_id, area_id, owner) != SPELL_CAST_OK) ((Pet*)unit)->Unsummon(PET_SAVE_AS_DELETED, owner); } @@ -21807,7 +21807,7 @@ void Player::LockOutSpells(SpellSchoolMask schoolMask, uint32 duration) continue; uint32 unSpellId = ownerSpellItr.first; - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(unSpellId); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(unSpellId); // Not send cooldown for this spells if (spellEntry->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE)) @@ -21843,7 +21843,7 @@ void Player::RemoveSpellLockout(SpellSchoolMask spellSchoolMask, std::set(unSpellId); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(unSpellId); // Not send cooldown for this spells if (!spellEntry || !(GetSpellSchoolMask(spellEntry) & spellSchoolMask) || spellEntry->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE)) diff --git a/src/game/Entities/Player.h b/src/game/Entities/Player.h index e8ebd865d6e..d3a4b22b216 100644 --- a/src/game/Entities/Player.h +++ b/src/game/Entities/Player.h @@ -2232,7 +2232,7 @@ class Player : public Unit auto spellCDItr = m_cooldownMap.begin(); while (spellCDItr != m_cooldownMap.end()) { - SpellEntry const* entry = sSpellTemplate.LookupEntry(spellCDItr->first); + SpellEntry const* entry = sSpellTemplate.LookupEntry(spellCDItr->first); if (entry && check(*entry)) { SendClearCooldown(spellCDItr->first, this); @@ -2569,7 +2569,7 @@ void RemoveItemsSetItem(Player* player, ItemPrototype const* proto); // "the bodies of template functions must be made available in a header file" template void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell const* spell, bool finalUse) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo || spellInfo->SpellFamilyName != GetSpellClass() || spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_DONE_BONUS)) return; // client condition int32 totalpct = 100; int32 totalflat = 0; diff --git a/src/game/Entities/QueryHandler.cpp b/src/game/Entities/QueryHandler.cpp index d275a8c38f9..58aec182311 100644 --- a/src/game/Entities/QueryHandler.cpp +++ b/src/game/Entities/QueryHandler.cpp @@ -417,7 +417,7 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recv_data) while (pageID) { - PageText const* pPage = sPageTextStore.LookupEntry(pageID); + PageText const* pPage = sPageTextStore.LookupEntry(pageID); // guess size WorldPacket data(SMSG_PAGE_TEXT_QUERY_RESPONSE, 50); data << pageID; diff --git a/src/game/Entities/Relations.cpp b/src/game/Entities/Relations.cpp index 4d7f531bb68..2044a79cd8b 100644 --- a/src/game/Entities/Relations.cpp +++ b/src/game/Entities/Relations.cpp @@ -180,7 +180,7 @@ static ReputationRank GetFactionReaction(FactionTemplateEntry const* thisTemplat if (!unit->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_IGNORE_REPUTATION)) { - const FactionEntry* thisFactionEntry = sFactionStore.LookupEntry(thisTemplate->faction); + const FactionEntry* thisFactionEntry = sFactionStore.LookupEntry(thisTemplate->faction); if (thisFactionEntry && thisFactionEntry->HasReputation()) { const ReputationMgr& reputationMgr = unitPlayer->GetReputationMgr(); @@ -250,7 +250,7 @@ ReputationRank Unit::GetReactionTo(Unit const* unit) const if (const ReputationRank* rank = thisPlayer->GetReputationMgr().GetForcedRankIfAny(unitFactionTemplate)) return (*rank); - const FactionEntry* unitFactionEntry = sFactionStore.LookupEntry(unitFactionTemplate->faction); + const FactionEntry* unitFactionEntry = sFactionStore.LookupEntry(unitFactionTemplate->faction); // If the faction has reputation ranks available, "at war" and contested PVP flags decide outcome if (!this->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_IGNORE_REPUTATION) && unitFactionEntry && unitFactionEntry->HasReputation()) @@ -271,7 +271,7 @@ ReputationRank Unit::GetReactionTo(Unit const* unit) const { if (const FactionTemplateEntry* unitFactionTemplate = unit->GetFactionTemplateEntry()) { - const FactionEntry* unitFactionEntry = sFactionStore.LookupEntry(unitFactionTemplate->faction); + const FactionEntry* unitFactionEntry = sFactionStore.LookupEntry(unitFactionTemplate->faction); if (unitFactionEntry && unitFactionEntry->HasReputation()) reaction = ReputationRank(int32(reaction) + 1); } @@ -1161,7 +1161,7 @@ bool Unit::CanAttackSpell(Unit const* target, SpellEntry const* spellInfo, bool { if (const FactionTemplateEntry* thisFactionTemplate = GetFactionTemplateEntry()) { - const FactionEntry* thisFactionEntry = sFactionStore.LookupEntry(thisFactionTemplate->faction); + const FactionEntry* thisFactionEntry = sFactionStore.LookupEntry(thisFactionTemplate->faction); if (thisFactionEntry && thisFactionEntry->HasReputation()) return unitPlayer->GetReputationMgr().IsAtWar(thisFactionEntry); } diff --git a/src/game/Entities/Totem.cpp b/src/game/Entities/Totem.cpp index 3a5c76ec79e..76d799b7927 100644 --- a/src/game/Entities/Totem.cpp +++ b/src/game/Entities/Totem.cpp @@ -159,7 +159,7 @@ void Totem::UnSummon() void Totem::SetTypeBySummonSpell(SpellEntry const* spellProto) { // Get spell casted by totem - SpellEntry const* totemSpell = sSpellTemplate.LookupEntry(GetSpell()); + SpellEntry const* totemSpell = sSpellTemplate.LookupEntry(GetSpell()); if (totemSpell) { // If spell have cast time -> so its active totem diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index 6763a7cc5f2..3710c33c883 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -1278,7 +1278,7 @@ void Unit::JustKilledCreature(Unit* killer, Creature* victim, Player* responsibl } // Interrupt channeling spell when a Possessed Summoned is killed - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(victim->GetUInt32Value(UNIT_CREATED_BY_SPELL)); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(victim->GetUInt32Value(UNIT_CREATED_BY_SPELL)); if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR_EX_FARSIGHT) && spellInfo->HasAttribute(SPELL_ATTR_EX_CHANNELED_1)) { Unit* creator = victim->GetMap()->GetUnit(victim->GetCreatorGuid()); @@ -1372,7 +1372,7 @@ void Unit::CastStop(uint32 except_spellid) SpellCastResult Unit::CastSpell(Unit* Victim, uint32 spellId, uint32 triggeredFlags, Item* castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) { @@ -1426,7 +1426,7 @@ SpellCastResult Unit::CastSpell(Unit* Victim, SpellEntry const* spellInfo, uint3 SpellCastResult Unit::CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, uint32 triggeredFlags, Item* castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) { @@ -1489,7 +1489,7 @@ SpellCastResult Unit::CastCustomSpell(Unit* Victim, SpellEntry const* spellInfo, // used for scripting SpellCastResult Unit::CastSpell(float x, float y, float z, uint32 spellId, uint32 triggeredFlags, Item* castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) { @@ -1611,7 +1611,7 @@ SpellCastResult Unit::CastCustomSpell(SpellCastTargets& targets, SpellEntry cons // Obsolete func need remove, here only for comotability vs another patches uint32 Unit::SpellNonMeleeDamageLog(Unit* pVictim, uint32 spellID, uint32 damage) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellID); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellID); SpellNonMeleeDamage spellDamageInfo(this, pVictim, spellInfo->Id, SpellSchoolMask(spellInfo->SchoolMask)); CalculateSpellDamage(&spellDamageInfo, damage, spellInfo); spellDamageInfo.target->CalculateAbsorbResistBlock(this, &spellDamageInfo, spellInfo); @@ -1695,7 +1695,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* spellDamageInfo, bool durability if (!pVictim->IsAlive() || pVictim->IsTaxiFlying() || pVictim->GetCombatManager().IsInEvadeMode()) return; - SpellEntry const* spellProto = sSpellTemplate.LookupEntry(spellDamageInfo->SpellID); + SpellEntry const* spellProto = sSpellTemplate.LookupEntry(spellDamageInfo->SpellID); if (spellProto == nullptr) { sLog.outError("Unit::DealSpellDamage have wrong damageInfo->SpellID: %u", spellDamageInfo->SpellID); @@ -2583,7 +2583,7 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* caster, SpellSchoolMask schoolMa case 31229: case 31230: { - SpellEntry const* cheatDeath = sSpellTemplate.LookupEntry(31231); + SpellEntry const* cheatDeath = sSpellTemplate.LookupEntry(31231); CastSpell(this, cheatDeath, TRIGGERED_OLD_TRIGGERED); AddCooldown(*cheatDeath, nullptr, false, 60 * IN_MILLISECONDS); // TODO this may be removed by fixing cooldown value in spell template // with health > 10% lost health until health==10%, in other case no losses @@ -4920,7 +4920,7 @@ void Unit::AddAuraToModList(Aura* aura) void Unit::RemoveRankAurasDueToSpell(uint32 spellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return; SpellAuraHolderMap::const_iterator next; @@ -5785,7 +5785,7 @@ void Unit::AddGameObject(GameObject* gameObj) if (gameObj->GetSpellId()) { - SpellEntry const* createBySpell = sSpellTemplate.LookupEntry(gameObj->GetSpellId()); + SpellEntry const* createBySpell = sSpellTemplate.LookupEntry(gameObj->GetSpellId()); // Need disable spell use for owner if (createBySpell && createBySpell->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE)) // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases) @@ -5824,7 +5824,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del) if (GetTypeId() == TYPEID_PLAYER) { - SpellEntry const* createBySpell = sSpellTemplate.LookupEntry(spellid); + SpellEntry const* createBySpell = sSpellTemplate.LookupEntry(spellid); // Need activate spell use for owner if (createBySpell && createBySpell->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE)) // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases) @@ -6257,7 +6257,7 @@ bool Unit::IsNeutralToAll() const if (!my_faction || !my_faction->faction) return true; - FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction); + FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction); if (raw_faction && raw_faction->reputationListID >= 0) return false; @@ -6496,7 +6496,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply) for (const auto& itr : sp_list) { if (itr.second.state == PLAYERSPELL_REMOVED) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr.first); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr.first); if (!spellInfo || !IsPassiveSpell(spellInfo)) continue; if (AuraState(spellInfo->CasterAuraState) == flag) CastSpell(this, itr.first, TRIGGERED_OLD_TRIGGERED, nullptr); @@ -9911,7 +9911,7 @@ void CharmInfo::InitCharmCreateSpells() if (spellId == 2) // hardcoded spell id 2 attack - only for possesss continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (IsPassiveSpell(spellInfo)) { m_unit->CastSpell(m_unit, spellId, TRIGGERED_OLD_TRIGGERED); @@ -10062,7 +10062,7 @@ void CharmInfo::LoadPetActionBar(const std::string& data) // check correctness if (PetActionBar[index].IsActionBarForSpell()) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(PetActionBar[index].GetAction()); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(PetActionBar[index].GetAction()); if (!spellInfo) SetActionBar(index, 0, ACT_DISABLED); else if (!IsAutocastable(spellInfo)) diff --git a/src/game/Entities/Unit.h b/src/game/Entities/Unit.h index 4fafa6b3328..ae7dc2f7323 100644 --- a/src/game/Entities/Unit.h +++ b/src/game/Entities/Unit.h @@ -188,8 +188,6 @@ enum UnitRename // byte flags value (UNIT_FIELD_BYTES_2,3) See enum ShapeshiftForm in SharedDefines.h -#define CREATURE_MAX_SPELLS 10 - enum Swing { NOSWING = 0, @@ -1995,7 +1993,7 @@ class Unit : public WorldObject void UpdateVisibilityAndView() override; // overwrite WorldObject::UpdateVisibilityAndView() // common function for visibility checks for player/creatures with detection code - bool IsVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, bool detect, bool inVisibleList = false, bool is3dDistance = true, bool spell = false) const; + bool IsVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, bool detect, bool inVisibleList = false, bool is3dDistance = true, bool spell = false) const; // virtual functions for all world objects types bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const override; @@ -2336,7 +2334,7 @@ class Unit : public WorldObject uint32 GetDamageDoneByOthers() { return m_damageByOthers; } uint32 GetModifierXpBasedOnDamageReceived(uint32 xp); - + void OverrideMountDisplayId(uint32 newDisplayId); void UpdateSplinePosition(); diff --git a/src/game/GameEvents/GameEventMgr.cpp b/src/game/GameEvents/GameEventMgr.cpp index 89bb92a7e9a..5d7c3088fd3 100644 --- a/src/game/GameEvents/GameEventMgr.cpp +++ b/src/game/GameEvents/GameEventMgr.cpp @@ -474,13 +474,13 @@ void GameEventMgr::LoadFromDB() newData.entry_id = 0; } - if (newData.spell_id_start && !sSpellTemplate.LookupEntry(newData.spell_id_start)) + if (newData.spell_id_start && !sSpellTemplate.LookupEntry(newData.spell_id_start)) { sLog.outErrorDb("Table `game_event_creature_data` have creature (Guid: %u) with nonexistent spell_start %u, set to no start spell.", guid, newData.spell_id_start); newData.spell_id_start = 0; } - if (newData.spell_id_end && !sSpellTemplate.LookupEntry(newData.spell_id_end)) + if (newData.spell_id_end && !sSpellTemplate.LookupEntry(newData.spell_id_end)) { sLog.outErrorDb("Table `game_event_creature_data` have creature (Guid: %u) with nonexistent spell_end %u, set to no end spell.", guid, newData.spell_id_end); newData.spell_id_end = 0; diff --git a/src/game/Globals/Conditions.cpp b/src/game/Globals/Conditions.cpp index 305eb46326d..f06c96568be 100644 --- a/src/game/Globals/Conditions.cpp +++ b/src/game/Globals/Conditions.cpp @@ -118,7 +118,7 @@ bool ConditionEntry::Meets(WorldObject const* target, Map const* map, WorldObjec sLog.outErrorDb("CONDITION %u type %u used with bad parameters, called from %s, used with target: %s, map %i, source %s", m_entry, m_condition, conditionSourceToStr[conditionSourceType], target ? target->GetGuidStr().c_str() : "", map ? map->GetId() : -1, source ? source->GetGuidStr().c_str() : ""); return false; - } + } bool result = Evaluate(target, map, source, conditionSourceType); @@ -136,28 +136,28 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, case CONDITION_NOT: { // Checked on load - return !sConditionStorage.LookupEntry(m_value1)->Meets(target, map, source, conditionSourceType); + return !sConditionStorage.LookupEntry(m_value1)->Meets(target, map, source, conditionSourceType); } case CONDITION_OR: { // Third and fourth condition are optional - if (m_value3 && sConditionStorage.LookupEntry(m_value3)->Meets(target, map, source, conditionSourceType)) + if (m_value3 && sConditionStorage.LookupEntry(m_value3)->Meets(target, map, source, conditionSourceType)) return true; - if (m_value4 && sConditionStorage.LookupEntry(m_value4)->Meets(target, map, source, conditionSourceType)) + if (m_value4 && sConditionStorage.LookupEntry(m_value4)->Meets(target, map, source, conditionSourceType)) return true; - - return sConditionStorage.LookupEntry(m_value1)->Meets(target, map, source, conditionSourceType) || sConditionStorage.LookupEntry(m_value2)->Meets(target, map, source, conditionSourceType); + + return sConditionStorage.LookupEntry(m_value1)->Meets(target, map, source, conditionSourceType) || sConditionStorage.LookupEntry(m_value2)->Meets(target, map, source, conditionSourceType); } case CONDITION_AND: { // Third and fourth condition are optional bool extraConditionsSatisfied = true; if (m_value3) - extraConditionsSatisfied = extraConditionsSatisfied && sConditionStorage.LookupEntry(m_value3)->Meets(target, map, source, conditionSourceType); + extraConditionsSatisfied = extraConditionsSatisfied && sConditionStorage.LookupEntry(m_value3)->Meets(target, map, source, conditionSourceType); if (m_value4) - extraConditionsSatisfied = extraConditionsSatisfied && sConditionStorage.LookupEntry(m_value4)->Meets(target, map, source, conditionSourceType); + extraConditionsSatisfied = extraConditionsSatisfied && sConditionStorage.LookupEntry(m_value4)->Meets(target, map, source, conditionSourceType); - return extraConditionsSatisfied && sConditionStorage.LookupEntry(m_value1)->Meets(target, map, source, conditionSourceType) && sConditionStorage.LookupEntry(m_value2)->Meets(target, map, source, conditionSourceType); + return extraConditionsSatisfied && sConditionStorage.LookupEntry(m_value1)->Meets(target, map, source, conditionSourceType) && sConditionStorage.LookupEntry(m_value2)->Meets(target, map, source, conditionSourceType); } case CONDITION_NONE: { @@ -184,7 +184,7 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, } case CONDITION_REPUTATION_RANK_MIN: { - FactionEntry const* faction = sFactionStore.LookupEntry(m_value1); + FactionEntry const* faction = sFactionStore.LookupEntry(m_value1); return faction && static_cast(target)->GetReputationMgr().GetRank(faction) >= ReputationRank(m_value2); } case CONDITION_TEAM: @@ -357,7 +357,7 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, } case CONDITION_REPUTATION_RANK_MAX: { - FactionEntry const* faction = sFactionStore.LookupEntry(m_value1);; + FactionEntry const* faction = sFactionStore.LookupEntry(m_value1);; Player const* player = static_cast(target); return faction && player->GetReputationMgr().GetRank(faction) <= ReputationRank(m_value2); } @@ -372,8 +372,8 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, } uint32 completedEncounterMask = ((DungeonMap*)map)->GetPersistanceState()->GetCompletedEncountersMask(); - DungeonEncounterEntry const* dbcEntry1 = sDungeonEncounterStore.LookupEntry(m_value1); - DungeonEncounterEntry const* dbcEntry2 = sDungeonEncounterStore.LookupEntry(m_value2); + DungeonEncounterEntry const* dbcEntry1 = sDungeonEncounterStore.LookupEntry(m_value1); + DungeonEncounterEntry const* dbcEntry2 = sDungeonEncounterStore.LookupEntry(m_value2); // Check that on proper map if (dbcEntry1->mapId != map->GetId()) { @@ -542,7 +542,7 @@ bool ConditionEntry::CheckParamRequirements(WorldObject const* target, Map const return true; return false; } - + return true; } @@ -558,7 +558,7 @@ bool ConditionEntry::IsValid() const sLog.outErrorDb("CONDITION_NOT (entry %u, type %d) has invalid value1 %u, must be lower than entry, skipped", m_entry, m_condition, m_value1); return false; } - ConditionEntry const* condition1 = sConditionStorage.LookupEntry(m_value1); + ConditionEntry const* condition1 = sConditionStorage.LookupEntry(m_value1); if (!condition1) { sLog.outErrorDb("CONDITION_NOT (entry %u, type %d) has value1 %u without proper condition, skipped", m_entry, m_condition, m_value1); @@ -579,13 +579,13 @@ bool ConditionEntry::IsValid() const sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has invalid value2 %u, must be lower than entry, skipped", m_entry, m_condition, m_value2); return false; } - ConditionEntry const* condition1 = sConditionStorage.LookupEntry(m_value1); + ConditionEntry const* condition1 = sConditionStorage.LookupEntry(m_value1); if (!condition1) { sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has value1 %u without proper condition, skipped", m_entry, m_condition, m_value1); return false; } - ConditionEntry const* condition2 = sConditionStorage.LookupEntry(m_value2); + ConditionEntry const* condition2 = sConditionStorage.LookupEntry(m_value2); if (!condition2) { sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has value2 %u without proper condition, skipped", m_entry, m_condition, m_value2); @@ -598,7 +598,7 @@ bool ConditionEntry::IsValid() const sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has invalid value3 %u, must be lower than entry, skipped", m_entry, m_condition, m_value3); return false; } - ConditionEntry const* condition3 = sConditionStorage.LookupEntry(m_value3); + ConditionEntry const* condition3 = sConditionStorage.LookupEntry(m_value3); if (!condition3) { sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has value3 %u without proper condition, skipped", m_entry, m_condition, m_value3); @@ -612,7 +612,7 @@ bool ConditionEntry::IsValid() const sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has invalid value4 %u, must be lower than entry, skipped", m_entry, m_condition, m_value4); return false; } - ConditionEntry const* condition4 = sConditionStorage.LookupEntry(m_value4); + ConditionEntry const* condition4 = sConditionStorage.LookupEntry(m_value4); if (!condition4) { sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has value4 %u without proper condition, skipped", m_entry, m_condition, m_value4); @@ -623,7 +623,7 @@ bool ConditionEntry::IsValid() const } case CONDITION_AURA: { - if (!sSpellTemplate.LookupEntry(m_value1)) + if (!sSpellTemplate.LookupEntry(m_value1)) { sLog.outErrorDb("Aura condition (entry %u, type %u) requires to have non existing spell (Id: %d), skipped", m_entry, m_condition, m_value1); return false; @@ -681,7 +681,7 @@ bool ConditionEntry::IsValid() const case CONDITION_REPUTATION_RANK_MIN: case CONDITION_REPUTATION_RANK_MAX: { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(m_value1);; + FactionEntry const* factionEntry = sFactionStore.LookupEntry(m_value1);; if (!factionEntry) { sLog.outErrorDb("Reputation condition (entry %u, type %u) requires to have reputation non existing faction (%u), skipped", m_entry, m_condition, m_value1); @@ -801,7 +801,7 @@ bool ConditionEntry::IsValid() const } case CONDITION_SPELL: { - if (!sSpellTemplate.LookupEntry(m_value1)) + if (!sSpellTemplate.LookupEntry(m_value1)) { sLog.outErrorDb("Spell condition (entry %u, type %u) requires to have non existing spell (Id: %d), skipped", m_entry, m_condition, m_value1); return false; @@ -839,7 +839,7 @@ bool ConditionEntry::IsValid() const } case CONDITION_CREATURE_IN_RANGE: { - if (!sCreatureStorage.LookupEntry(m_value1)) + if (!sCreatureStorage.LookupEntry(m_value1)) { sLog.outErrorDb("Creature in range condition (entry %u, type %u) has an invalid value in value1. (Creature %u does not exist in the database), skipping.", m_entry, m_condition, m_value1); return false; @@ -853,8 +853,8 @@ bool ConditionEntry::IsValid() const } case CONDITION_COMPLETED_ENCOUNTER: { - DungeonEncounterEntry const* dbcEntry1 = sDungeonEncounterStore.LookupEntry(m_value1); - DungeonEncounterEntry const* dbcEntry2 = sDungeonEncounterStore.LookupEntry(m_value2); + DungeonEncounterEntry const* dbcEntry1 = sDungeonEncounterStore.LookupEntry(m_value1); + DungeonEncounterEntry const* dbcEntry2 = sDungeonEncounterStore.LookupEntry(m_value2); if (!dbcEntry1) { sLog.outErrorDb("Completed Encounter condition (entry %u, type %u) has an unknown DungeonEncounter entry %u defined (in value1), skipping.", m_entry, m_condition, m_value1); @@ -901,7 +901,7 @@ bool ConditionEntry::IsValid() const } case CONDITION_SPAWN_COUNT: { - if (!sCreatureStorage.LookupEntry(m_value1)) + if (!sCreatureStorage.LookupEntry(m_value1)) { sLog.outErrorDb("Spawn count condition (entry %u, type %u) has an invalid value in value1. (Creature %u does not exist in the database), skipping.", m_entry, m_condition, m_value1); return false; @@ -924,7 +924,7 @@ bool ConditionEntry::IsValid() const // Check if a condition can be used without providing a player param bool ConditionEntry::CanBeUsedWithoutPlayer(uint32 entry) { - ConditionEntry const* condition = sConditionStorage.LookupEntry(entry); + ConditionEntry const* condition = sConditionStorage.LookupEntry(entry); if (!condition) return false; @@ -944,7 +944,7 @@ bool ConditionEntry::CanBeUsedWithoutPlayer(uint32 entry) bool IsConditionSatisfied(uint32 conditionId, WorldObject const* target, Map const* map, WorldObject const* source, ConditionSource conditionSourceType) { - if (ConditionEntry const* condition = sConditionStorage.LookupEntry(conditionId)) + if (ConditionEntry const* condition = sConditionStorage.LookupEntry(conditionId)) return condition->Meets(target, map, source, conditionSourceType); return false; diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index 17ffcab0347..06140549ae3 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -419,7 +419,7 @@ void ObjectMgr::LoadPointOfInterestLocales() sLog.outString(); } -struct SQLCreatureLoader : public SQLStorageLoaderBase +struct SQLCreatureLoader : public SQLStorageLoaderBase> { template void convert_from_str(uint32 /*field_pos*/, char const* src, D& dst) @@ -439,7 +439,7 @@ void ObjectMgr::LoadCreatureTemplates() // check data correctness for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) { - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i); + CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i); if (!cInfo) continue; @@ -554,7 +554,7 @@ void ObjectMgr::LoadCreatureTemplates() else if (!displayScaleEntry) displayScaleEntry = displayEntry; - CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry(cInfo->ModelId[j]); + CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry(cInfo->ModelId[j]); if (!minfo) sLog.outErrorDb("Creature (Entry: %u) are using modelid_%d (%u), but creature_model_info are missing for this model.", cInfo->Entry, j + 1, cInfo->ModelId[j]); } @@ -737,7 +737,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* uint32& cAura = const_cast(addon->auras[i]); cAura = uint32(j); - SpellEntry const* AdditionalSpellInfo = sSpellTemplate.LookupEntry(cAura); + SpellEntry const* AdditionalSpellInfo = sSpellTemplate.LookupEntry(cAura); if (!AdditionalSpellInfo) { sLog.outErrorDb("Creature (%s: %u) has wrong spell %u defined in `auras` field in `%s`.", guidEntryStr, addon->guidOrEntry, cAura, table); @@ -780,14 +780,14 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* const_cast(addon->auras[i]) = 0; } -void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment) +void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment) { creatureaddons.Load(); // check data correctness and convert 'auras' for (uint32 i = 1; i < creatureaddons.GetMaxEntry(); ++i) { - CreatureDataAddon const* addon = creatureaddons.LookupEntry(i); + CreatureDataAddon const* addon = creatureaddons.LookupEntry(i); if (!addon) continue; @@ -821,15 +821,15 @@ void ObjectMgr::LoadCreatureAddons() // check entry ids for (uint32 i = 1; i < sCreatureInfoAddonStorage.GetMaxEntry(); ++i) - if (CreatureDataAddon const* addon = sCreatureInfoAddonStorage.LookupEntry(i)) - if (!sCreatureStorage.LookupEntry(addon->guidOrEntry)) + if (CreatureDataAddon const* addon = sCreatureInfoAddonStorage.LookupEntry(i)) + if (!sCreatureStorage.LookupEntry(addon->guidOrEntry)) sLog.outErrorDb("Creature (Entry: %u) does not exist but has a record in `%s`", addon->guidOrEntry, sCreatureInfoAddonStorage.GetTableName()); LoadCreatureAddons(sCreatureDataAddonStorage, "GUID", "creature addons"); // check entry ids for (uint32 i = 1; i < sCreatureDataAddonStorage.GetMaxEntry(); ++i) - if (CreatureDataAddon const* addon = sCreatureDataAddonStorage.LookupEntry(i)) + if (CreatureDataAddon const* addon = sCreatureDataAddonStorage.LookupEntry(i)) if (mCreatureDataMap.find(addon->guidOrEntry) == mCreatureDataMap.end()) sLog.outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`", addon->guidOrEntry); } @@ -931,7 +931,7 @@ void ObjectMgr::LoadEquipmentTemplates() for (uint32 i = 0; i < sEquipmentStorage.GetMaxEntry(); ++i) { - EquipmentInfo const* eqInfo = sEquipmentStorage.LookupEntry(i); + EquipmentInfo const* eqInfo = sEquipmentStorage.LookupEntry(i); if (!eqInfo) continue; @@ -971,8 +971,8 @@ void ObjectMgr::LoadEquipmentTemplates() sEquipmentStorageRaw.Load(false); for (uint32 i = 1; i < sEquipmentStorageRaw.GetMaxEntry(); ++i) - if (sEquipmentStorageRaw.LookupEntry(i)) - if (sEquipmentStorage.LookupEntry(i)) + if (sEquipmentStorageRaw.LookupEntry(i)) + if (sEquipmentStorage.LookupEntry(i)) sLog.outErrorDb("Table 'creature_equip_template_raw` have redundant data for ID %u ('creature_equip_template` already have data)", i); sLog.outString(">> Loaded %u equipment template (deprecated format)", sEquipmentStorageRaw.GetRecordCount()); @@ -1040,7 +1040,7 @@ void ObjectMgr::LoadCreatureModelInfo() // post processing for (uint32 i = 1; i < sCreatureModelStorage.GetMaxEntry(); ++i) { - CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry(i); + CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry(i); if (!minfo) continue; @@ -1172,7 +1172,7 @@ void ObjectMgr::LoadCreatureModelRace() continue; } - if (!sCreatureModelStorage.LookupEntry(raceData.modelid)) + if (!sCreatureModelStorage.LookupEntry(raceData.modelid)) { sLog.outErrorDb("Table `creature_model_race` modelid %u does not exist in creature_model_info, skipping", raceData.modelid); continue; @@ -1210,7 +1210,7 @@ void ObjectMgr::LoadCreatureModelRace() if (raceData.modelid_racial) sLog.outErrorDb("Table `creature_model_race` modelid %u has modelid_racial for modelid %u but a creature_entry are already defined, modelid_racial will never be used.", raceData.modelid, raceData.modelid_racial); - if (!sCreatureStorage.LookupEntry(raceData.creature_entry)) + if (!sCreatureStorage.LookupEntry(raceData.creature_entry)) { sLog.outErrorDb("Table `creature_model_race` modelid %u has creature_entry for nonexistent creature_template (%u), skipping", raceData.modelid, raceData.creature_entry); continue; @@ -1224,7 +1224,7 @@ void ObjectMgr::LoadCreatureModelRace() continue; } - if (!sCreatureModelStorage.LookupEntry(raceData.modelid_racial)) + if (!sCreatureModelStorage.LookupEntry(raceData.modelid_racial)) { sLog.outErrorDb("Table `creature_model_race` modelid %u has modelid_racial %u, but are not defined in creature_model_info, skipping", raceData.modelid, raceData.modelid_racial); continue; @@ -1255,7 +1255,7 @@ void ObjectMgr::LoadCreatureConditionalSpawn() // post processing for (uint32 i = 1; i < sCreatureConditionalSpawnStore.GetMaxEntry(); ++i) { - CreatureConditionalSpawn const* spawn = sCreatureConditionalSpawnStore.LookupEntry(i); + CreatureConditionalSpawn const* spawn = sCreatureConditionalSpawnStore.LookupEntry(i); if (!spawn) continue; @@ -1286,7 +1286,7 @@ void ObjectMgr::LoadCreatureSpawnDataTemplates() sLog.outString(); return; } - + BarGoLink bar(result->GetRowCount()); uint32 count = 0; @@ -1402,7 +1402,7 @@ void ObjectMgr::LoadCreatures() // build single time for check creature data std::set heroicCreatures; for (uint32 i = 0; i < sCreatureStorage.GetMaxEntry(); ++i) - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) if (cInfo->HeroicEntry) heroicCreatures.insert(cInfo->HeroicEntry); @@ -2012,7 +2012,7 @@ void ObjectMgr::LoadItemLocales() sLog.outString(); } -struct SQLItemLoader : public SQLStorageLoaderBase +struct SQLItemLoader : public SQLStorageLoaderBase> { template void convert_from_str(uint32 /*field_pos*/, char const* src, D& dst) @@ -2029,7 +2029,7 @@ void ObjectMgr::LoadItemPrototypes() // check data correctness for (uint32 i = 1; i < sItemStorage.GetMaxEntry(); ++i) { - ItemPrototype const* proto = sItemStorage.LookupEntry(i); + ItemPrototype const* proto = sItemStorage.LookupEntry(i); ItemEntry const* dbcitem = sItemStore.LookupEntry(i); if (!proto) { @@ -2043,7 +2043,7 @@ void ObjectMgr::LoadItemPrototypes() for (const auto& Spell : proto->Spells) if (Spell.SpellCategory && Spell.SpellId) { - if (sSpellTemplate.LookupEntry(Spell.SpellId)) + if (sSpellTemplate.LookupEntry(Spell.SpellId)) sItemSpellCategoryStore[Spell.SpellCategory].insert(ItemCategorySpellPair(Spell.SpellId, i)); else sLog.outErrorDb("Item (Entry: %u) not correct %u spell id, must exist in spell table.", i, Spell.SpellId); @@ -2157,7 +2157,7 @@ void ObjectMgr::LoadItemPrototypes() } } - if (proto->RequiredSpell && !sSpellTemplate.LookupEntry(proto->RequiredSpell)) + if (proto->RequiredSpell && !sSpellTemplate.LookupEntry(proto->RequiredSpell)) { sLog.outErrorDb("Item (Entry: %u) have wrong (nonexistent) spell in RequiredSpell (%u)", i, proto->RequiredSpell); const_cast(proto)->RequiredSpell = 0; @@ -2168,7 +2168,7 @@ void ObjectMgr::LoadItemPrototypes() if (proto->RequiredReputationFaction) { - if (!sFactionStore.LookupEntry(proto->RequiredReputationFaction)) + if (!sFactionStore.LookupEntry(proto->RequiredReputationFaction)) { sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", i, proto->RequiredReputationFaction); const_cast(proto)->RequiredReputationFaction = 0; @@ -2248,7 +2248,7 @@ void ObjectMgr::LoadItemPrototypes() } else { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(proto->Spells[1].SpellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(proto->Spells[1].SpellId); if (!spellInfo) { sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%u)", i, 1 + 1, proto->Spells[1].SpellId); @@ -2302,7 +2302,7 @@ void ObjectMgr::LoadItemPrototypes() if (proto->Spells[j].SpellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(proto->Spells[j].SpellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(proto->Spells[j].SpellId); if (!spellInfo) { sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%u)", i, j + 1, proto->Spells[j].SpellId); @@ -2323,7 +2323,7 @@ void ObjectMgr::LoadItemPrototypes() if (proto->PageText) { - if (!sPageTextStore.LookupEntry(proto->PageText)) + if (!sPageTextStore.LookupEntry(proto->PageText)) sLog.outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", i, proto->PageText); } @@ -2525,7 +2525,7 @@ void ObjectMgr::LoadItemRequiredTarget() uint32 uiType = fields[1].GetUInt32(); uint32 uiTargetEntry = fields[2].GetUInt32(); - ItemPrototype const* pItemProto = sItemStorage.LookupEntry(uiItemId); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(uiItemId); if (!pItemProto) { @@ -2537,7 +2537,7 @@ void ObjectMgr::LoadItemRequiredTarget() for (const auto& Spell : pItemProto->Spells) { - if (SpellEntry const* pSpellInfo = sSpellTemplate.LookupEntry(Spell.SpellId)) + if (SpellEntry const* pSpellInfo = sSpellTemplate.LookupEntry(Spell.SpellId)) { if (Spell.SpellTrigger == ITEM_SPELLTRIGGER_ON_USE) { @@ -2580,7 +2580,7 @@ void ObjectMgr::LoadItemRequiredTarget() continue; } - if (!sCreatureStorage.LookupEntry(uiTargetEntry)) + if (!sCreatureStorage.LookupEntry(uiTargetEntry)) { sLog.outErrorDb("Table `item_required_target`: creature template entry %u does not exist.", uiTargetEntry); continue; @@ -2623,7 +2623,7 @@ void ObjectMgr::LoadPetLevelInfo() Field* fields = result->Fetch(); uint32 creature_id = fields[0].GetUInt32(); - if (!sCreatureStorage.LookupEntry(creature_id)) + if (!sCreatureStorage.LookupEntry(creature_id)) { sLog.outErrorDb("Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id); continue; @@ -3020,7 +3020,7 @@ void ObjectMgr::LoadPlayerInfo() } uint32 spell_id = fields[2].GetUInt32(); - if (!sSpellTemplate.LookupEntry(spell_id)) + if (!sSpellTemplate.LookupEntry(spell_id)) { sLog.outErrorDb("Non existing spell %u in `playercreateinfo_spell` table, ignoring.", spell_id); continue; @@ -3506,16 +3506,16 @@ CreatureTemplateSpells const* ObjectMgr::GetCreatureTemplateSpellSet(uint32 entr GameObjectInfo const* ObjectMgr::GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry(id); } Player* ObjectMgr::GetPlayer(const char* name) { return ObjectAccessor::FindPlayerByName(name); } Player* ObjectMgr::GetPlayer(ObjectGuid guid, bool inWorld /*=true*/) { return ObjectAccessor::FindPlayer(guid, inWorld); } -CreatureInfo const* ObjectMgr::GetCreatureTemplate(uint32 id) { return sCreatureStorage.LookupEntry(id); } -CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelid) { return sCreatureModelStorage.LookupEntry(modelid); } -EquipmentInfo const* ObjectMgr::GetEquipmentInfo(uint32 entry) { return sEquipmentStorage.LookupEntry(entry); } -EquipmentInfoRaw const* ObjectMgr::GetEquipmentInfoRaw(uint32 entry) { return sEquipmentStorageRaw.LookupEntry(entry); } -CreatureDataAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid) { return sCreatureDataAddonStorage.LookupEntry(lowguid); } -CreatureDataAddon const* ObjectMgr::GetCreatureTemplateAddon(uint32 entry) { return sCreatureInfoAddonStorage.LookupEntry(entry); } -ItemPrototype const* ObjectMgr::GetItemPrototype(uint32 id) { return sItemStorage.LookupEntry(id); } -InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 map) { return sInstanceTemplate.LookupEntry(map); } -WorldTemplate const* ObjectMgr::GetWorldTemplate(uint32 map) { return sWorldTemplate.LookupEntry(map); } -CreatureConditionalSpawn const* ObjectMgr::GetCreatureConditionalSpawn(uint32 lowguid) { return sCreatureConditionalSpawnStore.LookupEntry(lowguid); } +CreatureInfo const* ObjectMgr::GetCreatureTemplate(uint32 id) { return sCreatureStorage.LookupEntry(id); } +CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelid) { return sCreatureModelStorage.LookupEntry(modelid); } +EquipmentInfo const* ObjectMgr::GetEquipmentInfo(uint32 entry) { return sEquipmentStorage.LookupEntry(entry); } +EquipmentInfoRaw const* ObjectMgr::GetEquipmentInfoRaw(uint32 entry) { return sEquipmentStorageRaw.LookupEntry(entry); } +CreatureDataAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid) { return sCreatureDataAddonStorage.LookupEntry(lowguid); } +CreatureDataAddon const* ObjectMgr::GetCreatureTemplateAddon(uint32 entry) { return sCreatureInfoAddonStorage.LookupEntry(entry); } +ItemPrototype const* ObjectMgr::GetItemPrototype(uint32 id) { return sItemStorage.LookupEntry(id); } +InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 map) { return sInstanceTemplate.LookupEntry(map); } +WorldTemplate const* ObjectMgr::GetWorldTemplate(uint32 map) { return sWorldTemplate.LookupEntry(map); } +CreatureConditionalSpawn const* ObjectMgr::GetCreatureConditionalSpawn(uint32 lowguid) { return sCreatureConditionalSpawnStore.LookupEntry(lowguid); } /* ********************************************************************************************* */ /* * Loading Functions */ @@ -3781,7 +3781,7 @@ void ObjectMgr::LoadQuests() "RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt," // 107 108 109 110 111 112 113 114 "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4," - // 115 116 117 118 119 120 121 122 + // 115 116 117 118 119 120 121 122 "IncompleteEmote, IncompleteEmoteDelay, CompleteEmote, CompleteEmoteDelay, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4," // 123 124 125 126 "OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4," @@ -3946,21 +3946,21 @@ void ObjectMgr::LoadQuests() } // else Skill quests can have 0 skill level, this is ok - if (qinfo->RepObjectiveFaction && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction)) + if (qinfo->RepObjectiveFaction && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction)) { sLog.outErrorDb("Quest %u has `RepObjectiveFaction` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RepObjectiveFaction, qinfo->RepObjectiveFaction); // no changes, quest can't be done for this requirement } - if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction)) + if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction)) { sLog.outErrorDb("Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMinRepFaction, qinfo->RequiredMinRepFaction); // no changes, quest can't be done for this requirement } - if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction)) + if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction)) { sLog.outErrorDb("Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMaxRepFaction, qinfo->RequiredMaxRepFaction); @@ -4012,7 +4012,7 @@ void ObjectMgr::LoadQuests() if (qinfo->SrcItemId) { - if (!sItemStorage.LookupEntry(qinfo->SrcItemId)) + if (!sItemStorage.LookupEntry(qinfo->SrcItemId)) { sLog.outErrorDb("Quest %u has `SrcItemId` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->SrcItemId, qinfo->SrcItemId); @@ -4034,7 +4034,7 @@ void ObjectMgr::LoadQuests() if (qinfo->SrcSpell) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(qinfo->SrcSpell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(qinfo->SrcSpell); if (!spellInfo) { sLog.outErrorDb("Quest %u has `SrcSpell` = %u but spell %u doesn't exist, quest can't be done.", @@ -4062,7 +4062,7 @@ void ObjectMgr::LoadQuests() qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER); - if (!sItemStorage.LookupEntry(id)) + if (!sItemStorage.LookupEntry(id)) { sLog.outErrorDb("Quest %u has `ReqItemId%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, id); @@ -4081,7 +4081,7 @@ void ObjectMgr::LoadQuests() { if (uint32 id = qinfo->ReqSourceId[j]) { - if (!sItemStorage.LookupEntry(id)) + if (!sItemStorage.LookupEntry(id)) { sLog.outErrorDb("Quest %u has `ReqSourceId%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, id); @@ -4103,7 +4103,7 @@ void ObjectMgr::LoadQuests() { if (uint32 id = qinfo->ReqSpell[j]) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(id); if (!spellInfo) { sLog.outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.", @@ -4154,7 +4154,7 @@ void ObjectMgr::LoadQuests() qinfo->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement } - if (id > 0 && !sCreatureStorage.LookupEntry(id)) + if (id > 0 && !sCreatureStorage.LookupEntry(id)) { sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but creature with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, uint32(id)); @@ -4187,7 +4187,7 @@ void ObjectMgr::LoadQuests() { if (uint32 id = qinfo->RewChoiceItemId[j]) { - if (!sItemStorage.LookupEntry(id)) + if (!sItemStorage.LookupEntry(id)) { sLog.outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", qinfo->GetQuestId(), j + 1, id, id); @@ -4223,7 +4223,7 @@ void ObjectMgr::LoadQuests() { if (uint32 id = qinfo->RewItemId[j]) { - if (!sItemStorage.LookupEntry(id)) + if (!sItemStorage.LookupEntry(id)) { sLog.outErrorDb("Quest %u has `RewItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", qinfo->GetQuestId(), j + 1, id, id); @@ -4253,7 +4253,7 @@ void ObjectMgr::LoadQuests() sLog.outErrorDb("Quest %u has `RewRepFaction%d` = %u but `RewRepValue%d` = 0, quest will not reward this reputation.", qinfo->GetQuestId(), j + 1, qinfo->RewRepValue[j], j + 1); - if (!sFactionStore.LookupEntry(qinfo->RewRepFaction[j])) + if (!sFactionStore.LookupEntry(qinfo->RewRepFaction[j])) { sLog.outErrorDb("Quest %u has `RewRepFaction%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j + 1, qinfo->RewRepFaction[j], qinfo->RewRepFaction[j]); @@ -4270,7 +4270,7 @@ void ObjectMgr::LoadQuests() if (qinfo->RewSpell) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(qinfo->RewSpell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(qinfo->RewSpell); if (!spellInfo) { @@ -4294,7 +4294,7 @@ void ObjectMgr::LoadQuests() if (qinfo->RewSpellCast) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(qinfo->RewSpellCast); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(qinfo->RewSpellCast); if (!spellInfo) { @@ -4387,7 +4387,7 @@ void ObjectMgr::LoadQuests() // check QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE for (uint32 i = 0; i < sSpellTemplate.GetMaxEntry(); ++i) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); if (!spellInfo) continue; @@ -4592,7 +4592,7 @@ void ObjectMgr::LoadPetCreateSpells() continue; } - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(creature_id); + CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(creature_id); if (!cInfo) { sLog.outErrorDb("Creature id %u listed in `petcreateinfo_spell` not exist.", creature_id); @@ -4618,7 +4618,7 @@ void ObjectMgr::LoadPetCreateSpells() have_spell_db = true; - SpellEntry const* i_spell = sSpellTemplate.LookupEntry(PetCreateSpell.spellid[i]); + SpellEntry const* i_spell = sSpellTemplate.LookupEntry(PetCreateSpell.spellid[i]); if (!i_spell) { sLog.outErrorDb("Spell %u listed in `petcreateinfo_spell` does not exist", PetCreateSpell.spellid[i]); @@ -4649,7 +4649,7 @@ void ObjectMgr::LoadPetCreateSpells() std::map learnCache; for (uint32 spell_id = 1; spell_id < sSpellTemplate.GetMaxEntry(); ++spell_id) { - SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spell_id); if (!spellproto) continue; @@ -4666,7 +4666,7 @@ void ObjectMgr::LoadPetCreateSpells() uint32 dcount = 0; for (uint32 cr_id = 1; cr_id < sCreatureStorage.GetMaxEntry(); ++cr_id) { - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(cr_id); + CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(cr_id); if (!cInfo) continue; @@ -4743,11 +4743,11 @@ void ObjectMgr::LoadPageTexts() for (uint32 i = 1; i < sPageTextStore.GetMaxEntry(); ++i) { // check data correctness - PageText const* page = sPageTextStore.LookupEntry(i); + PageText const* page = sPageTextStore.LookupEntry(i); if (!page) continue; - if (page->Next_Page && !sPageTextStore.LookupEntry(page->Next_Page)) + if (page->Next_Page && !sPageTextStore.LookupEntry(page->Next_Page)) { sLog.outErrorDb("Page text (Id: %u) has not existing next page (Id:%u)", i, page->Next_Page); continue; @@ -4755,7 +4755,7 @@ void ObjectMgr::LoadPageTexts() // detect circular reference std::set checkedPages; - for (PageText const* pageItr = page; pageItr; pageItr = sPageTextStore.LookupEntry(pageItr->Next_Page)) + for (PageText const* pageItr = page; pageItr; pageItr = sPageTextStore.LookupEntry(pageItr->Next_Page)) { if (!pageItr->Next_Page) break; @@ -4799,7 +4799,7 @@ void ObjectMgr::LoadPageTextLocales() uint32 entry = fields[0].GetUInt32(); - if (!sPageTextStore.LookupEntry(entry)) + if (!sPageTextStore.LookupEntry(entry)) { ERROR_DB_STRICT_LOG("Table `locales_page_text` has data for nonexistent page text entry %u, skipped.", entry); continue; @@ -4854,7 +4854,7 @@ void ObjectMgr::LoadInstanceEncounters() bar.step(); uint32 entry = fields[0].GetUInt32(); - DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry); + DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry); if (!dungeonEncounter) { @@ -4868,7 +4868,7 @@ void ObjectMgr::LoadInstanceEncounters() { case ENCOUNTER_CREDIT_KILL_CREATURE: { - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(creditEntry); + CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(creditEntry); if (!cInfo) { sLog.outErrorDb("Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); @@ -4878,7 +4878,7 @@ void ObjectMgr::LoadInstanceEncounters() } case ENCOUNTER_CREDIT_CAST_SPELL: { - if (!sSpellTemplate.LookupEntry(creditEntry)) + if (!sSpellTemplate.LookupEntry(creditEntry)) { // skip spells that aren't in dbc for now // sLog.outErrorDb("Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); @@ -4902,7 +4902,7 @@ void ObjectMgr::LoadInstanceEncounters() sLog.outString(); } -struct SQLInstanceLoader : public SQLStorageLoaderBase +struct SQLInstanceLoader : public SQLStorageLoaderBase> { template void convert_from_str(uint32 /*field_pos*/, char const* src, D& dst) @@ -4981,7 +4981,7 @@ void ObjectMgr::LoadInstanceTemplate() sLog.outString(); } -struct SQLWorldLoader : public SQLStorageLoaderBase +struct SQLWorldLoader : public SQLStorageLoaderBase> { template void convert_from_str(uint32 /*field_pos*/, char const* src, D& dst) @@ -5020,14 +5020,23 @@ void ObjectMgr::LoadWorldTemplate() sLog.outString(); } +struct SQLConditionLoader : public SQLStorageLoaderBase> +{ + template + void convert_from_str(uint32 /*field_pos*/, char const* src, D& dst) + { + dst = D(sScriptDevAIMgr.GetScriptId(src)); + } +}; + void ObjectMgr::LoadConditions() { - SQLWorldLoader loader; + SQLConditionLoader loader; loader.Load(sConditionStorage); for (uint32 i = 0; i < sConditionStorage.GetMaxEntry(); ++i) { - ConditionEntry const* condition = sConditionStorage.LookupEntry(i); + ConditionEntry const* condition = sConditionStorage.LookupEntry(i); if (!condition) continue; @@ -5045,7 +5054,7 @@ void ObjectMgr::LoadConditions() if (qinfo->RequiredCondition) { - const ConditionEntry* condition = sConditionStorage.LookupEntry(qinfo->RequiredCondition); + const ConditionEntry* condition = sConditionStorage.LookupEntry(qinfo->RequiredCondition); if (!condition) // condition does not exist for some reason sLog.outErrorDb("Quest %u has `RequiredCondition` = %u but does not exist.", qinfo->GetQuestId(), qinfo->RequiredCondition); } @@ -5119,7 +5128,7 @@ void ObjectMgr::LoadGossipText() sLog.outString(); result.reset(WorldDatabase.Query("SELECT Id,Prob0,Prob1,Prob2,Prob3,Prob4,Prob5,Prob6,Prob7,BroadcastTextId0,BroadcastTextId1,BroadcastTextId2,BroadcastTextId3,BroadcastTextId4,BroadcastTextId5,BroadcastTextId6,BroadcastTextId7 FROM npc_text_broadcast_text")); - + count = 0; if (!result) { @@ -5302,7 +5311,7 @@ void ObjectMgr::LoadQuestgiverGreeting() switch (type) { case QUESTGIVER_CREATURE: - if (!sCreatureStorage.LookupEntry(entry)) + if (!sCreatureStorage.LookupEntry(entry)) { sLog.outErrorEventAI("Table questgiver_greeting uses nonexistent creature entry %u. Skipping.", entry); continue; @@ -5370,7 +5379,7 @@ void ObjectMgr::LoadQuestgiverGreetingLocales() switch (type) { case QUESTGIVER_CREATURE: - if (!sCreatureStorage.LookupEntry(entry)) + if (!sCreatureStorage.LookupEntry(entry)) { sLog.outErrorEventAI("Table questgiver_greeting uses nonexistent creature entry %u. Skipping.", entry); continue; @@ -5448,7 +5457,7 @@ void ObjectMgr::LoadTrainerGreetings() uint32 entry = fields[0].GetUInt32(); - if (!sCreatureStorage.LookupEntry(entry)) + if (!sCreatureStorage.LookupEntry(entry)) { sLog.outErrorDb("Table trainer_greeting uses nonexistent creature entry %u. Skipping.", entry); continue; @@ -5488,7 +5497,7 @@ void ObjectMgr::LoadTrainerGreetingLocales() uint32 entry = fields[0].GetUInt32(); - if (!sCreatureStorage.LookupEntry(entry)) + if (!sCreatureStorage.LookupEntry(entry)) { sLog.outErrorDb("Table locales_trainer_greeting uses nonexistent creature entry %u. Skipping.", entry); continue; @@ -6031,7 +6040,7 @@ void ObjectMgr::LoadGraveyardZones() continue; } - WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId); + WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId); if (!entry) { sLog.outErrorDb("Table `game_graveyard_zone` has record for nonexistent graveyard (WorldSafeLocs.dbc id) %u, skipped.", safeLocId); @@ -6102,7 +6111,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyardHelper( GraveYardData const& data = itr->second; // Checked on load - WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(data.safeLocId); + WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(data.safeLocId); // skip enemy faction graveyard // team == TEAM_BOTH_ALLOWED case can be at call from .neargrave @@ -6255,7 +6264,7 @@ uint32 ObjectMgr::GraveyardLinkKey(uint32 locationId, uint32 linkKind) * * \param linkKind The kind of the graveyard link to be added. Kind is either * GRAVEYARD_MAPLINK or GRAVEYARD_AREALINK - * + * * \param team The team that is allowed to use this graveyard link. Can be * TEAM_BOTH_ALLOWED, HORDE or ALLIANCE. * @@ -6432,7 +6441,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() if (at.conditionId) { - const ConditionEntry* condition = sConditionStorage.LookupEntry(at.conditionId); + const ConditionEntry* condition = sConditionStorage.LookupEntry(at.conditionId); if (!condition) // condition does not exist for some reason sLog.outErrorDb("Table `areatrigger_teleport` entry %u has `ConditionId` = %u but does not exist.", at.entry, at.conditionId); } @@ -6813,7 +6822,7 @@ inline void CheckGOLinkedTrapId(GameObjectInfo const* goInfo, uint32 dataN, uint inline void CheckGOSpellId(GameObjectInfo const* goInfo, uint32 dataN, uint32 N) { - if (sSpellTemplate.LookupEntry(dataN)) + if (sSpellTemplate.LookupEntry(dataN)) return; sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.", @@ -6956,7 +6965,7 @@ std::vector ObjectMgr::LoadGameobjectInfo() if (goInfo->goober.pageId) // pageId { - if (!sPageTextStore.LookupEntry(goInfo->goober.pageId)) + if (!sPageTextStore.LookupEntry(goInfo->goober.pageId)) sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.", goInfo->id, goInfo->type, goInfo->goober.pageId, goInfo->goober.pageId); } @@ -7250,7 +7259,7 @@ void ObjectMgr::LoadReputationRewardRate() repRate.creature_rate = fields[2].GetFloat(); repRate.spell_rate = fields[3].GetFloat(); - FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) { sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId); @@ -7334,7 +7343,7 @@ void ObjectMgr::LoadReputationOnKill() if (repOnKill.repfaction1) { - FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.repfaction1); + FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.repfaction1); if (!factionEntry1) { sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.repfaction1); @@ -7344,7 +7353,7 @@ void ObjectMgr::LoadReputationOnKill() if (repOnKill.repfaction2) { - FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.repfaction2); + FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.repfaction2); if (!factionEntry2) { sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.repfaction2); @@ -7405,7 +7414,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() repTemplate.faction_rate[3] = fields[11].GetFloat(); repTemplate.faction_rank[3] = fields[12].GetUInt32(); - FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) { @@ -7423,7 +7432,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() { if (repTemplate.faction[i]) { - FactionEntry const* factionSpillover = sFactionStore.LookupEntry(repTemplate.faction[i]); + FactionEntry const* factionSpillover = sFactionStore.LookupEntry(repTemplate.faction[i]); if (!factionSpillover) { @@ -7444,25 +7453,25 @@ void ObjectMgr::LoadReputationSpilloverTemplate() } } - FactionEntry const* factionEntry0 = sFactionStore.LookupEntry(repTemplate.faction[0]); + FactionEntry const* factionEntry0 = sFactionStore.LookupEntry(repTemplate.faction[0]); if (repTemplate.faction[0] && !factionEntry0) { sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]); continue; } - FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repTemplate.faction[1]); + FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repTemplate.faction[1]); if (repTemplate.faction[1] && !factionEntry1) { sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]); continue; } - FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repTemplate.faction[2]); + FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repTemplate.faction[2]); if (repTemplate.faction[2] && !factionEntry2) { sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]); continue; } - FactionEntry const* factionEntry3 = sFactionStore.LookupEntry(repTemplate.faction[3]); + FactionEntry const* factionEntry3 = sFactionStore.LookupEntry(repTemplate.faction[3]); if (repTemplate.faction[3] && !factionEntry3) { sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]); @@ -7568,7 +7577,7 @@ void ObjectMgr::LoadSpellTemplate() /* TODO add validation for spell_dbc */ for (SQLStorageBase::SQLSIterator itr = sSpellTemplate.getDataBegin(); itr < sSpellTemplate.getDataEnd(); ++itr) { - if (!sSpellTemplate.LookupEntry(itr->Id)) + if (!sSpellTemplate.LookupEntry(itr->Id)) { sLog.outErrorDb("LoadSpellDbc: implement validation to erase spell if it does not confirm to requirements for spells"); sSpellTemplate.EraseEntry(itr->Id); @@ -7577,7 +7586,7 @@ void ObjectMgr::LoadSpellTemplate() for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry(); ++i) { - SpellEntry const* spell = sSpellTemplate.LookupEntry(i); + SpellEntry const* spell = sSpellTemplate.LookupEntry(i); if (spell && spell->Category) sSpellCategoryStore[spell->Category].insert(i); @@ -7600,13 +7609,13 @@ void ObjectMgr::CheckSpellCones() { for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry(); ++i) { - SpellEntry const* spell = sSpellTemplate.LookupEntry(i); - SpellCone const* spellCone = sSpellCones.LookupEntry(i); + SpellEntry const* spell = sSpellTemplate.LookupEntry(i); + SpellCone const* spellCone = sSpellCones.LookupEntry(i); if (spell) { if (uint32 firstRankId = sSpellMgr.GetFirstSpellInChain(i)) { - SpellCone const* spellConeFirst = sSpellCones.LookupEntry(firstRankId); + SpellCone const* spellConeFirst = sSpellCones.LookupEntry(firstRankId); if (!spellConeFirst && !spellCone) // no cones for either - is fine continue; @@ -7628,7 +7637,7 @@ void ObjectMgr::LoadFactions() for (uint32 i = 0; i < sFactionStore.GetMaxEntry(); ++i) { - FactionEntry const* faction = sFactionStore.LookupEntry(i); + FactionEntry const* faction = sFactionStore.LookupEntry(i); if (faction && faction->team) { SimpleFactionsList& flist = sFactionTeamMap[faction->team]; @@ -7738,7 +7747,7 @@ void ObjectMgr::LoadBroadcastTextLocales() sLog.outString(">> Loaded %u texts from %s", count, "broadcast_text_locale"); sLog.outString(); } - + void ObjectMgr::DeleteCreatureData(uint32 guid) { // remove mapid*cellid -> guid_set map @@ -8468,7 +8477,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() // Check if a target meets condition conditionId bool ObjectMgr::IsConditionSatisfied(uint32 conditionId, WorldObject const* target, Map const* map, WorldObject const* source, ConditionSource conditionSourceType) const { - if (ConditionEntry const* condition = sConditionStorage.LookupEntry(conditionId)) + if (ConditionEntry const* condition = sConditionStorage.LookupEntry(conditionId)) return condition->Meets(target, map, source, conditionSourceType); return false; @@ -8756,7 +8765,7 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) uint32 entry = fields[0].GetUInt32(); uint32 spell = fields[1].GetUInt32(); - SpellEntry const* spellinfo = sSpellTemplate.LookupEntry(spell); + SpellEntry const* spellinfo = sSpellTemplate.LookupEntry(spell); if (!spellinfo) { sLog.outErrorDb("Table `%s` (Entry: %u ) has non existing spell %u, ignore", tableName, entry, spell); @@ -8851,7 +8860,7 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates) if (trainerSpell.conditionId) { - const ConditionEntry* condition = sConditionStorage.LookupEntry(trainerSpell.conditionId); + const ConditionEntry* condition = sConditionStorage.LookupEntry(trainerSpell.conditionId); if (!condition) // condition does not exist for some reason sLog.outErrorDb("Table `%s` (Entry: %u) has `condition_id` = %u but does not exist.", tableName, entry, trainerSpell.conditionId); } @@ -8881,7 +8890,7 @@ void ObjectMgr::LoadTrainerTemplates() for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) { if (cInfo->TrainerTemplateId) { @@ -8969,7 +8978,7 @@ void ObjectMgr::LoadVendorTemplates() for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) { if (cInfo->VendorTemplateId) { @@ -9147,7 +9156,7 @@ void ObjectMgr::LoadGossipMenu(std::set& gossipScriptSet) if (gMenu.conditionId) { - const ConditionEntry* condition = sConditionStorage.LookupEntry(gMenu.conditionId); + const ConditionEntry* condition = sConditionStorage.LookupEntry(gMenu.conditionId); if (!condition) { sLog.outErrorDb("Table gossip_menu for menu %u, text-id %u has condition_id %u that does not exist in `conditions`, ignoring", gMenu.entry, gMenu.text_id, gMenu.conditionId); @@ -9166,7 +9175,7 @@ void ObjectMgr::LoadGossipMenu(std::set& gossipScriptSet) // post loading tests for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) if (cInfo->GossipMenuId) if (m_mGossipMenusMap.find(cInfo->GossipMenuId) == m_mGossipMenusMap.end()) sLog.outErrorDb("Creature (Entry: %u) has GossipMenuId = %u for nonexistent menu", cInfo->Entry, cInfo->GossipMenuId); @@ -9225,7 +9234,7 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) typedef std::multimap Menu2CInfoMap; Menu2CInfoMap menu2CInfoMap; for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) if (cInfo->GossipMenuId) { menu2CInfoMap.insert(Menu2CInfoMap::value_type(cInfo->GossipMenuId, cInfo)); @@ -9329,7 +9338,7 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) if (gMenuItem.conditionId) { - const ConditionEntry* condition = sConditionStorage.LookupEntry(gMenuItem.conditionId); + const ConditionEntry* condition = sConditionStorage.LookupEntry(gMenuItem.conditionId); if (!condition) { sLog.outErrorDb("Table gossip_menu_option for menu %u, id %u has condition_id %u that does not exist in `conditions`, ignoring", gMenuItem.menu_id, gMenuItem.id, gMenuItem.conditionId); @@ -9470,7 +9479,7 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32 return false; } - if (conditionId && !sConditionStorage.LookupEntry(conditionId)) + if (conditionId && !sConditionStorage.LookupEntry(conditionId)) { sLog.outErrorDb("Table `%s` has `condition_id`=%u for item %u of %s %u but this condition is not valid, ignoring", tableName, conditionId, item_id, idStr, vendor_entry); return false; @@ -9697,14 +9706,14 @@ void ObjectMgr::LoadCreatureTemplateSpells() for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) templateSpells.spells[i] = fields[2 + i].GetUInt32(); - if (!sCreatureStorage.LookupEntry(templateSpells.entry)) + if (!sCreatureStorage.LookupEntry(templateSpells.entry)) { sLog.outErrorDb("LoadCreatureTemplateSpells: Spells found for creature entry %u, but creature does not exist, skipping", templateSpells.entry); continue; } for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) { - if (templateSpells.spells[i] && !sSpellTemplate.LookupEntry(templateSpells.spells[i]) && templateSpells.spells[i] != 2) // 2 is attack which is hardcoded in client + if (templateSpells.spells[i] && !sSpellTemplate.LookupEntry(templateSpells.spells[i]) && templateSpells.spells[i] != 2) // 2 is attack which is hardcoded in client { sLog.outErrorDb("LoadCreatureTemplateSpells: Spells found for creature entry %u, assigned spell %u does not exist, set to 0", templateSpells.entry, templateSpells.spells[i]); templateSpells.spells[i] = 0; @@ -9731,13 +9740,13 @@ void ObjectMgr::LoadCreatureCooldowns() Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); - if (!sCreatureStorage.LookupEntry(entry)) + if (!sCreatureStorage.LookupEntry(entry)) { sLog.outErrorDb("LoadCreatureCooldowns: Entry %u does not exist.", entry); continue; } uint32 spellId = fields[1].GetUInt32(); - if (!sSpellTemplate.LookupEntry(spellId)) + if (!sSpellTemplate.LookupEntry(spellId)) { sLog.outErrorDb("LoadCreatureCooldowns: SpellId %u does not exist.", spellId); continue; @@ -9773,7 +9782,7 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction) CreatureInfo const* GetCreatureTemplateStore(uint32 entry) { - return sCreatureStorage.LookupEntry(entry); + return sCreatureStorage.LookupEntry(entry); } Quest const* GetQuestTemplateStore(uint32 entry) diff --git a/src/game/Globals/ObjectMgr.h b/src/game/Globals/ObjectMgr.h index 4a50a69e0c1..70f112b8e56 100644 --- a/src/game/Globals/ObjectMgr.h +++ b/src/game/Globals/ObjectMgr.h @@ -41,6 +41,8 @@ class Group; class ArenaTeam; class Item; + +template class SQLStorage; struct GameTele @@ -354,17 +356,6 @@ struct GraveYardData typedef std::multimap < uint32 /*locId*/, GraveYardData > GraveYardMap; typedef std::pair GraveYardMapBounds; -struct WorldSafeLocsEntry -{ - uint32 ID; - uint32 map_id; - float x; - float y; - float z; - float o; - char* name; -}; - struct QuestgiverGreeting { std::string text; @@ -1237,7 +1228,7 @@ class ObjectMgr GossipMenuItemsMap m_mGossipMenuItemsMap; std::unordered_map> mCreatureSpawnEntryMap; - + PointOfInterestMap mPointsOfInterest; PetCreateSpellMap mPetCreateSpell; @@ -1265,7 +1256,7 @@ class ObjectMgr QuestRelationsMap m_GOQuestInvolvedRelations; private: - void LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment); + void LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment); void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr); void LoadQuestRelationsHelper(QuestRelationsMap& map, char const* table); void LoadVendors(char const* tableName, bool isTemplates); diff --git a/src/game/Globals/SharedDefines.h b/src/game/Globals/SharedDefines.h index 59c220c9525..8f5c5d2f5a3 100644 --- a/src/game/Globals/SharedDefines.h +++ b/src/game/Globals/SharedDefines.h @@ -2593,4 +2593,16 @@ enum MovementEvent EVENT_JUMP = 10001, // TODO: Implement knockback using this }; +enum SpawnFlags +{ + SPAWN_FLAG_RUN_ON_SPAWN = 0x01, + SPAWN_FLAG_HOVER = 0x02, +}; + +enum SplineFlags +{ + SPLINEFLAG_WALKMODE = 0x0000100, + SPLINEFLAG_FLYING = 0x0000200, +}; + #endif diff --git a/src/game/Grids/GridNotifiersImpl.h b/src/game/Grids/GridNotifiersImpl.h index ec2d578dc02..224c63dea3d 100644 --- a/src/game/Grids/GridNotifiersImpl.h +++ b/src/game/Grids/GridNotifiersImpl.h @@ -200,7 +200,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) if (target->GetTypeId() == TYPEID_PLAYER && target != i_check && (((Player*) target)->IsGameMaster() || ((Player*)target)->GetVisibility() == VISIBILITY_OFF)) return; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i_dynobject.GetSpellId()); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i_dynobject.GetSpellId()); SpellEffectIndex eff_index = i_dynobject.GetEffIndex(); Unit* caster = i_dynobject.GetCaster(); diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index 3f570f676e7..f0fefeeee07 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -128,7 +128,7 @@ void LootStore::LoadLootTable() if (conditionId) { - const ConditionEntry* condition = sConditionStorage.LookupEntry(conditionId); + const ConditionEntry* condition = sConditionStorage.LookupEntry(conditionId); if (!condition) { sLog.outErrorDb("Table `%s` for entry %u, item %u has condition_id %u that does not exist in `conditions`, ignoring", GetName(), entry, item, uint32(conditionId)); @@ -2220,7 +2220,7 @@ void Loot::PrintLootList(ChatHandler& chat, WorldSession* session) const for (auto lootItem : m_lootItems) { uint32 itemId = lootItem->itemId; - ItemPrototype const* pProto = sItemStorage.LookupEntry(itemId); + ItemPrototype const* pProto = sItemStorage.LookupEntry(itemId); if (!pProto) continue; @@ -2631,7 +2631,7 @@ void LoadLootTemplates_Creature() // remove real entries and check existence loot for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) { if (uint32 lootid = cInfo->LootId) { @@ -2661,7 +2661,7 @@ void LoadLootTemplates_Disenchant() // remove real entries and check existence loot for (uint32 i = 1; i < sItemStorage.GetMaxEntry(); ++i) { - if (ItemPrototype const* proto = sItemStorage.LookupEntry(i)) + if (ItemPrototype const* proto = sItemStorage.LookupEntry(i)) { if (uint32 lootid = proto->DisenchantID) { @@ -2729,7 +2729,7 @@ void LoadLootTemplates_Item() // remove real entries and check existence loot for (uint32 i = 1; i < sItemStorage.GetMaxEntry(); ++i) { - if (ItemPrototype const* proto = sItemStorage.LookupEntry(i)) + if (ItemPrototype const* proto = sItemStorage.LookupEntry(i)) { if (!(proto->Flags & ITEM_FLAG_HAS_LOOT)) continue; @@ -2754,7 +2754,7 @@ void LoadLootTemplates_Pickpocketing() // remove real entries and check existence loot for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) { if (uint32 lootid = cInfo->PickpocketLootId) { @@ -2780,7 +2780,7 @@ void LoadLootTemplates_Prospecting() // remove real entries and check existence loot for (uint32 i = 1; i < sItemStorage.GetMaxEntry(); ++i) { - ItemPrototype const* proto = sItemStorage.LookupEntry(i); + ItemPrototype const* proto = sItemStorage.LookupEntry(i); if (!proto) continue; @@ -2820,7 +2820,7 @@ void LoadLootTemplates_Skinning() // remove real entries and check existence loot for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) { if (uint32 lootid = cInfo->SkinningLootId) { @@ -3003,7 +3003,7 @@ void LootMgr::CheckDropStats(ChatHandler& chat, uint32 amountOfCheck, uint32 loo for (auto itemStat : sortedResult) { uint32 itemId = itemStat.first; - ItemPrototype const* pProto = sItemStorage.LookupEntry(itemId); + ItemPrototype const* pProto = sItemStorage.LookupEntry(itemId); if (!pProto) continue; diff --git a/src/game/Maps/Map.h b/src/game/Maps/Map.h index f1345a1547a..a197f8d7efd 100644 --- a/src/game/Maps/Map.h +++ b/src/game/Maps/Map.h @@ -66,25 +66,6 @@ class Transport; #pragma pack(push,1) #endif -struct InstanceTemplate -{ - uint32 map; // instance map - uint32 parent; // non-continent parent instance (for instance with entrance in another instances) - // or 0 (not related to continent 0 map id) - uint32 levelMin; - uint32 levelMax; - uint32 maxPlayers; - uint32 reset_delay; // in days - uint32 script_id; - bool mountAllowed; -}; - -struct WorldTemplate -{ - uint32 map; // non-instance map - uint32 script_id; -}; - enum LevelRequirementVsMode { LEVELREQUIREMENT_HEROIC = 70 diff --git a/src/game/OutdoorPvP/OutdoorPvPSI.cpp b/src/game/OutdoorPvP/OutdoorPvPSI.cpp index 120659a2e77..101ff0e446a 100644 --- a/src/game/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/game/OutdoorPvP/OutdoorPvPSI.cpp @@ -141,7 +141,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId) // reward the player player->CastSpell(player, SPELL_TRACES_OF_SILITHYST, TRIGGERED_OLD_TRIGGERED); player->RewardHonor(nullptr, 1, HONOR_REWARD_SILITHYST); - player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(FACTION_CENARION_CIRCLE), REPUTATION_REWARD_SILITHYST); + player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(FACTION_CENARION_CIRCLE), REPUTATION_REWARD_SILITHYST); return true; } diff --git a/src/game/Reputation/ReputationMgr.cpp b/src/game/Reputation/ReputationMgr.cpp index 39e5d592240..78f0380d62e 100644 --- a/src/game/Reputation/ReputationMgr.cpp +++ b/src/game/Reputation/ReputationMgr.cpp @@ -49,7 +49,7 @@ FactionState const* ReputationMgr::GetState(RepListID id) const int32 ReputationMgr::GetReputation(uint32 faction_id) const { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); if (!factionEntry) { @@ -86,7 +86,7 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const bool ReputationMgr::IsAtWar(uint32 faction_id) const { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); if (!factionEntry) { @@ -248,7 +248,7 @@ void ReputationMgr::Initialize() for (unsigned int i = 1; i < sFactionStore.GetMaxEntry(); ++i) { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(i); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(i); if (factionEntry && (factionEntry->HasReputation())) { @@ -282,7 +282,7 @@ void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi { // bonuses are already given, so just modify standing by rate int32 spilloverRep = standing * repTemplate->faction_rate[i]; - if (SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental)) + if (SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental)) anyRankIncreased = true; } } @@ -297,7 +297,7 @@ void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi if (!flist && factionEntry->team && factionEntry->spilloverRateOut != 0.0f) { spillOverRepOut *= factionEntry->spilloverRateOut; - if (FactionEntry const* parent = sFactionStore.LookupEntry(factionEntry->team)) + if (FactionEntry const* parent = sFactionStore.LookupEntry(factionEntry->team)) { FactionStateList::iterator parentState = m_factions.find(parent->reputationListID); // some team factions have own reputation standing, in this case do not spill to other sub-factions @@ -317,7 +317,7 @@ void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi // Spillover to affiliated factions for (uint32 itr : *flist) { - if (FactionEntry const* factionEntryCalc = sFactionStore.LookupEntry(itr)) + if (FactionEntry const* factionEntryCalc = sFactionStore.LookupEntry(itr)) { if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn)) continue; @@ -394,7 +394,7 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry) if (!factionTemplateEntry || !factionTemplateEntry->faction) return; - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction)) + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction)) SetVisible(factionEntry); } @@ -509,7 +509,7 @@ void ReputationMgr::LoadFromDB(QueryResult* result) { Field* fields = result->Fetch(); - FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt32()); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt32()); if (factionEntry && factionEntry->HasReputation()) { FactionState* faction = &m_factions[factionEntry->reputationListID]; diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 4b02c7cb5d9..f1ac3b6fa22 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -347,7 +347,7 @@ void LoadDBCStores(const std::string& dataPath) if (!skillLine) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); if (spellInfo && (spellInfo->Attributes & (SPELL_ATTR_ABILITY | SPELL_ATTR_PASSIVE | SPELL_ATTR_HIDDEN_CLIENTSIDE | SPELL_ATTR_HIDE_IN_COMBAT_LOG)) == (SPELL_ATTR_ABILITY | SPELL_ATTR_PASSIVE | SPELL_ATTR_HIDDEN_CLIENTSIDE | SPELL_ATTR_HIDE_IN_COMBAT_LOG)) { for (unsigned int i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i) @@ -376,7 +376,7 @@ void LoadDBCStores(const std::string& dataPath) // for (uint32 k = 0; k < 3; ++k) // { // if (enchantEntry->spellid[k]) - // if (!sSpellTemplate.LookupEntry(enchantEntry->spellid[k])) + // if (!sSpellTemplate.LookupEntry(enchantEntry->spellid[k])) // sLog.outErrorDb("Spell ID %u found in spell item enchant %u does not exist.", enchantEntry->spellid[k], i); // } //} @@ -499,7 +499,7 @@ void LoadDBCStores(const std::string& dataPath) { std::set spellPaths; for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry(); ++i) - if (SpellEntry const* sInfo = sSpellTemplate.LookupEntry(i)) + if (SpellEntry const* sInfo = sSpellTemplate.LookupEntry(i)) for (int j = 0; j < MAX_EFFECT_INDEX; ++j) if (sInfo->Effect[j] == 123 /*SPELL_EFFECT_SEND_TAXI*/) spellPaths.insert(sInfo->EffectMiscValue[j]); diff --git a/src/game/Server/DBCStructure.h b/src/game/Server/DBCStructure.h index b7c50187035..971e5c88a27 100644 --- a/src/game/Server/DBCStructure.h +++ b/src/game/Server/DBCStructure.h @@ -23,10 +23,15 @@ #include "MotionGenerators/Path.h" #include "Platform/Define.h" #include "Globals/SharedDefines.h" +#include "Entities/ObjectVisibilityDefines.h" +#include "Globals/Conditions.h" #include #include #include +#include "Util.h" +#include "Entities/ObjectGuid.h" +#include "Entities/ItemPrototype.h" // Structures using to access raw DBC data and required packing to portability @@ -220,7 +225,7 @@ struct CinematicSequencesEntry struct CreatureDisplayInfoEntry { uint32 Displayid; // 0 m_ID - uint32 ModelId; // 1 + uint32 ModelId; // 1 // 2 m_soundID uint32 ExtendedDisplayInfoID; // 3 m_extendedDisplayInfoID -> CreatureDisplayInfoExtraEntry::DisplayExtraId float scale; // 4 m_creatureModelScale @@ -1254,13 +1259,6 @@ struct WorldSafeLocsEntry }; */ -// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform -#if defined( __GNUC__ ) -#pragma pack() -#else -#pragma pack(pop) -#endif - struct ItemCategorySpellPair { uint32 spellId; @@ -1304,4 +1302,298 @@ typedef std::vector TaxiPathNodesByPath; #define TaxiMaskSize 16 typedef uint32 TaxiMask[TaxiMaskSize]; + +#define CREATURE_MAX_SPELLS 10 +#define MAX_KILL_CREDIT 2 +#define MAX_CREATURE_MODEL 4 +#define USE_DEFAULT_DATABASE_LEVEL 0 // just used to show we don't want to force the new creature level and use the level stored in db +#define MINIMUM_LOOTING_TIME (2 * MINUTE * IN_MILLISECONDS) // give player enough time to pick loot + +// from `creature_addon` and `creature_template_addon`tables +struct CreatureDataAddon +{ + uint32 guidOrEntry; + uint32 mount; + uint32 bytes1; + uint8 sheath_state; // SheathState + uint8 flags; // UnitBytes2_Flags + uint32 emote; + uint32 move_flags; + uint32 const* auras; // loaded as char* "spell1 spell2 ... " +}; + +// Bases values for given Level and UnitClass +struct CreatureClassLvlStats +{ + uint32 BaseHealth; + uint32 BaseMana; + float BaseDamage; + float BaseMeleeAttackPower; + float BaseRangedAttackPower; + uint32 BaseArmor; +}; + +struct CreatureModelInfo +{ + uint32 modelid; + float bounding_radius; + float combat_reach; + float SpeedWalk; + float SpeedRun; + uint8 gender; + uint32 modelid_other_gender; // The oposite gender for this modelid (male/female) + uint32 modelid_alternative; // An alternative model. Generally same gender(2) +}; + +struct CreatureModelRace +{ + uint32 modelid; // Native model/base model the selection is for + uint32 racemask; // Races it applies to (and then a player source must exist for selection) + uint32 creature_entry; // Modelid from creature_template.entry will be selected + uint32 modelid_racial; // Explicit modelid. Used if creature_template entry is not defined +}; + +struct CreatureConditionalSpawn +{ + uint32 Guid; + uint32 EntryAlliance; + uint32 EntryHorde; + // Note: future condition flags to be added +}; + +// from `creature_template` table +struct CreatureInfo +{ + uint32 Entry; + char* Name; + char* SubName; + char* IconName; + uint32 MinLevel; + uint32 MaxLevel; + uint32 HeroicEntry; + uint32 ModelId[MAX_CREATURE_MODEL]; + uint32 Faction; + float Scale; + uint32 Family; // enum CreatureFamily values (optional) + uint32 CreatureType; // enum CreatureType values + uint32 InhabitType; + uint32 RegenerateStats; + bool RacialLeader; + uint32 NpcFlags; + uint32 UnitFlags; // enum UnitFlags mask values + uint32 DynamicFlags; + uint32 ExtraFlags; + uint32 CreatureTypeFlags; // enum CreatureTypeFlags mask values + float SpeedWalk; + float SpeedRun; + uint32 Detection; // Detection Range for Line of Sight aggro + uint32 CallForHelp; + uint32 Pursuit; + uint32 Leash; + uint32 Timeout; + uint32 UnitClass; // enum Classes. Note only 4 classes are known for creatures. + uint32 Rank; + int32 Expansion; // creature expansion, important for stats, CAN BE -1 as marker for some invalid cases. + float HealthMultiplier; + float PowerMultiplier; + float DamageMultiplier; + float DamageVariance; + float ArmorMultiplier; + float ExperienceMultiplier; + uint32 MinLevelHealth; + uint32 MaxLevelHealth; + uint32 MinLevelMana; + uint32 MaxLevelMana; + float MinMeleeDmg; + float MaxMeleeDmg; + float MinRangedDmg; + float MaxRangedDmg; + uint32 Armor; + uint32 MeleeAttackPower; + uint32 RangedAttackPower; + uint32 MeleeBaseAttackTime; + uint32 RangedBaseAttackTime; + uint32 DamageSchool; + uint32 MinLootGold; + uint32 MaxLootGold; + uint32 LootId; + uint32 PickpocketLootId; + uint32 SkinningLootId; + uint32 KillCredit[MAX_KILL_CREDIT]; + uint32 MechanicImmuneMask; + uint32 SchoolImmuneMask; + int32 ResistanceHoly; + int32 ResistanceFire; + int32 ResistanceNature; + int32 ResistanceFrost; + int32 ResistanceShadow; + int32 ResistanceArcane; + uint32 PetSpellDataId; + uint32 MovementType; + uint32 TrainerType; + uint32 TrainerSpell; + uint32 TrainerClass; + uint32 TrainerRace; + uint32 TrainerTemplateId; + uint32 VendorTemplateId; + uint32 EquipmentTemplateId; + uint32 GossipMenuId; + VisibilityDistanceType visibilityDistanceType; + char const* AIName; + uint32 ScriptID; + + // helpers + static HighGuid GetHighGuid() + { + return HIGHGUID_UNIT; // in pre-3.x always HIGHGUID_UNIT + } + + ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), Entry, lowguid); } + + SkillType GetRequiredLootSkill() const + { + if (CreatureTypeFlags & CREATURE_TYPEFLAGS_HERBLOOT) + return SKILL_HERBALISM; + if (CreatureTypeFlags & CREATURE_TYPEFLAGS_MININGLOOT) + return SKILL_MINING; + + return SKILL_SKINNING; // normal case + } + + bool isTameable() const + { + return CreatureType == CREATURE_TYPE_BEAST && Family != 0 && (CreatureTypeFlags & CREATURE_TYPEFLAGS_TAMEABLE); + } +}; + +struct CreatureTemplateSpells +{ + uint32 entry; + uint32 setId; + uint32 spells[CREATURE_MAX_SPELLS]; +}; + +struct CreatureCooldowns +{ + uint32 entry; + uint32 spellId; + uint32 cooldownMin; + uint32 cooldownMax; +}; + +struct EquipmentInfo +{ + uint32 entry; + uint32 equipentry[3]; +}; + +// depricated old way +struct EquipmentInfoRaw +{ + uint32 entry; + uint32 equipmodel[3]; + uint32 equipinfo[3]; + uint32 equipslot[3]; +}; + +struct CreatureSpawnTemplate +{ + uint32 entry; + int64 unitFlags; + uint32 faction; + uint32 modelId; + int32 equipmentId; + uint32 curHealth; + uint32 curMana; + uint32 spawnFlags; + + bool IsRunning() const { return (spawnFlags & SPAWN_FLAG_RUN_ON_SPAWN) != 0; } + bool IsHovering() const { return (spawnFlags & SPAWN_FLAG_HOVER) != 0; } +}; + +// from `creature` table +struct CreatureData +{ + uint32 id; // entry in creature_template + uint16 mapid; + uint32 modelid_override; // overrides any model defined in creature_template + int32 equipmentId; + float posX; + float posY; + float posZ; + float orientation; + uint32 spawntimesecsmin; + uint32 spawntimesecsmax; + float spawndist; + uint32 currentwaypoint; + uint32 curhealth; + uint32 curmana; + bool is_dead; + uint8 movementType; + uint8 spawnMask; + int16 gameEvent; + uint16 GuidPoolId; + uint16 EntryPoolId; + uint16 OriginalZoneId; + CreatureSpawnTemplate const* spawnTemplate; + + // helper function + ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(CreatureInfo::GetHighGuid(), id, lowguid); } + uint32 GetRandomRespawnTime() const { return urand(spawntimesecsmin, spawntimesecsmax); } + + // return false if it should be handled by GameEventMgr or PoolMgr + bool IsNotPartOfPoolOrEvent() const { return (!gameEvent && !GuidPoolId && !EntryPoolId); } +}; + +struct PageText +{ + uint32 Page_ID; + char* Text; + + uint32 Next_Page; +}; + +struct InstanceTemplate +{ + uint32 map; // instance map + uint32 parent; // non-continent parent instance (for instance with entrance in another instances) + // or 0 (not related to continent 0 map id) + uint32 levelMin; + uint32 levelMax; + uint32 maxPlayers; + uint32 reset_delay; // in days + uint32 script_id; + bool mountAllowed; +}; + +struct WorldTemplate +{ + uint32 map; // non-instance map + uint32 script_id; +}; + +struct SpellCone +{ + uint32 spellId; + int32 coneAngle; +}; + +struct WorldSafeLocsEntry +{ + uint32 ID; + uint32 map_id; + float x; + float y; + float z; + float o; + char* name; +}; + +// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform +#if defined( __GNUC__ ) +#pragma pack() +#else +#pragma pack(pop) +#endif + #endif diff --git a/src/game/Server/SQLStorages.cpp b/src/game/Server/SQLStorages.cpp index f8fbee471f1..706930e858f 100644 --- a/src/game/Server/SQLStorages.cpp +++ b/src/game/Server/SQLStorages.cpp @@ -17,6 +17,7 @@ */ #include "Server/SQLStorages.h" +#include "DBCStructure.h" const char CreatureInfosrcfmt[] = "isssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiss"; const char CreatureInfodstfmt[] = "isssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisi"; @@ -44,29 +45,29 @@ const char DungeonEncounterFmt[] = "iiiiissssssssssssssssii"; const char FactionEntryfmt[] = "iiiiiiiiiiiiiiiiiiiffiissssssssssssssss"; const char WorldSafeLocsFmt[] = "iiffffs"; -SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "Entry", "creature_template"); -SQLStorage sCreatureDataAddonStorage(CreatureDataAddonInfofmt, "guid", "creature_addon"); -SQLStorage sCreatureModelStorage(CreatureModelfmt, "modelid", "creature_model_info"); -SQLStorage sCreatureInfoAddonStorage(CreatureInfoAddonInfofmt, "entry", "creature_template_addon"); -SQLStorage sEquipmentStorage(EquipmentInfofmt, "entry", "creature_equip_template"); -SQLStorage sEquipmentStorageRaw(EquipmentInfoRawfmt, "entry", "creature_equip_template_raw"); -SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "entry", "item_template"); -SQLStorage sPageTextStore(PageTextfmt, "entry", "page_text"); -SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "map", "instance_template"); -SQLStorage sWorldTemplate(WorldTemplatesrcfmt, WorldTemplatedstfmt, "map", "world_template"); -SQLStorage sConditionStorage(ConditionsFmt, "condition_entry", "conditions"); -SQLStorage sSpellTemplate(SpellEntryfmt, "id", "spell_template"); -SQLStorage sSpellCones(SpellConefmt, "id", "spell_cone"); -SQLStorage sDungeonEncounterStore(DungeonEncounterFmt, "id", "instance_dungeon_encounters"); -SQLStorage sFactionStore(FactionEntryfmt, "entry", "faction_store"); -SQLStorage sCreatureConditionalSpawnStore(CreatureConditionalSpawnSrcFmt, CreatureConditionalSpawnDstFmt, "guid", "creature_conditional_spawn"); -SQLStorage sWorldSafeLocsStore(WorldSafeLocsFmt, "id", "world_safe_locs"); +SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "Entry", "creature_template"); +SQLStorage sCreatureDataAddonStorage(CreatureDataAddonInfofmt, "guid", "creature_addon"); +SQLStorage sCreatureInfoAddonStorage(CreatureInfoAddonInfofmt, "entry", "creature_template_addon"); +SQLStorage sCreatureModelStorage(CreatureModelfmt, "modelid", "creature_model_info"); +SQLStorage sEquipmentStorage(EquipmentInfofmt, "entry", "creature_equip_template"); +SQLStorage sEquipmentStorageRaw(EquipmentInfoRawfmt, "entry", "creature_equip_template_raw"); +SQLStorage sPageTextStore(PageTextfmt, "entry", "page_text"); +SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "entry", "item_template"); +SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "map", "instance_template"); +SQLStorage sWorldTemplate(WorldTemplatesrcfmt, WorldTemplatedstfmt, "map", "world_template"); +SQLStorage sConditionStorage(ConditionsFmt, "condition_entry", "conditions"); +SQLStorage sSpellTemplate(SpellEntryfmt, "id", "spell_template"); +SQLStorage sSpellCones(SpellConefmt, "id", "spell_cone"); +SQLStorage sDungeonEncounterStore(DungeonEncounterFmt, "id", "instance_dungeon_encounters"); +SQLStorage sFactionStore(FactionEntryfmt, "entry", "faction_store"); +SQLStorage sCreatureConditionalSpawnStore(CreatureConditionalSpawnSrcFmt, CreatureConditionalSpawnDstFmt, "guid", "creature_conditional_spawn"); +SQLStorage sWorldSafeLocsStore(WorldSafeLocsFmt, "id", "world_safe_locs"); SQLHashStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry", "gameobject_template"); SQLMultiStorage sSpellScriptTargetStorage(SpellScriptTargetFmt, "entry", "spell_script_target"); -SQLStorage const* GetSpellStore() { return &sSpellTemplate; } +SQLStorage const* GetSpellStore() { return &sSpellTemplate; } // DBC store in database 0123456789012345678901234567890123456789 @@ -147,82 +148,82 @@ const char TotemCategoryfmt[] = "ixxxxxxxxxxxxxxxxxii"; const char WorldMapAreafmt[] = "xiixffffi"; const char WMOAreaTablefmt[] = "iiiixxxxxiixxxxxxxxxxxxxxxxx"; -SQLStorage sDBCAreaTable(AreaTablefmt, "ID", "dbc_areatable"); -SQLStorage sDBCAreaTrigger(AreaTriggerfmt, "ID", "dbc_areatrigger"); -SQLStorage sDBCAuctionHouse(AuctionHousefmt, "ID", "dbc_auctionhouse"); -SQLStorage sDBCBankBagSlotPrices(BankBagSlotPricesfmt, "ID", "dbc_bankbagslotprices"); -SQLStorage sDBCBattlemasterList(BattlemasterListfmt, "ID", "dbc_battlemasterlist"); -SQLStorage sDBCCharStartOutfit(CharStartOutfitsrcfmt, CharStartOutfitdstfmt, "ID", "dbc_charstartoutfit"); -SQLStorage sDBCCharTitles(CharTitlesfmt, "ID", "dbc_chartitles"); -SQLStorage sDBCChatChannels(ChatChannelsfmt, "ID", "dbc_chatchannels"); -SQLStorage sDBCChrClasses(ChrClassesfmt, "ID", "dbc_chrclasses"); -SQLStorage sDBCChrRaces(ChrRacesfmt, "ID", "dbc_chrraces"); -SQLStorage sDBCCinematicCamera(CinematicCamerafmt, "ID", "dbc_cinematiccamera"); -SQLStorage sDBCCinematicSequences(CinematicSequencesfmt, "ID", "dbc_cinematicsequences"); -SQLStorage sDBCCreatureDisplayInfo(CreatureDisplayInfofmt, "ID", "dbc_creaturedisplayinfo"); -SQLStorage sDBCCreatureDisplayInfoExtra(CreatureDisplayInfoExtrafmt, "ID", "dbc_creaturedisplayinfoextra"); -SQLStorage sDBCCreatureFamily(CreatureFamilyfmt, "ID", "dbc_creaturefamily"); -SQLStorage sDBCCreatureModelData(CreatureModelDatafmt, "ID", "dbc_creaturemodeldata"); -SQLStorage sDBCCreatureSpellData(CreatureSpellDatafmt, "ID", "dbc_creaturespelldata"); -SQLStorage sDBCCreatureType(CreatureTypefmt, "ID", "dbc_creaturetype"); -SQLStorage sDBCDurabilityCosts(DurabilityCostsfmt, "ID", "dbc_durabilitycosts"); -SQLStorage sDBCDurabilityQuality(DurabilityQualityfmt, "ID", "dbc_durabilityquality"); -SQLStorage sDBCEmotes(Emotesfmt, "ID", "dbc_emotes"); -SQLStorage sDBCEmotesText(EmotesTextfmt, "ID", "dbc_emotestext"); -SQLStorage sDBCFactionTemplate(FactionTemplatefmt, "ID", "dbc_factiontemplate"); -SQLStorage sDBCGameObjectDisplayInfo(GameObjectDisplayInfofmt, "ID", "dbc_gameobjectdisplayinfo"); -SQLStorage sDBCGemProperties(GemPropertiesfmt, "ID", "dbc_gemproperties"); -SQLStorage sDBCGMSurveyCurrentSurvey(GMSurveyCurrentSurveyfmt, "LANGID", "dbc_gmsurveycurrentsurvey"); -SQLStorage sDBCGMSurveyQuestions(GMSurveyQuestionsfmt, "ID", "dbc_gmsurveyquestions"); -SQLStorage sDBCGMSurveySurveys(GMSurveySurveysfmt, "ID", "dbc_gmsurveysurveys"); -SQLStorage sDBCGMTicketCategory(GMTicketCategoryfmt, "ID", "dbc_gmticketcategory"); -SQLStorage sDBCgtCombatRatings(gtCombatRatingsfmt, "Data", "dbc_gtcombatratings"); -SQLStorage sDBCgtChanceToMeleeCritBase(gtChanceToMeleeCritBasefmt, "Data", "dbc_gtchancetomeleecritbase"); -SQLStorage sDBCgtChanceToMeleeCrit(gtChanceToMeleeCritfmt, "Data", "dbc_gtchancetomeleecrit"); -SQLStorage sDBCgtChanceToSpellCritBase(gtChanceToSpellCritBasefmt, "Data", "dbc_gtchancetospellcritbase"); -SQLStorage sDBCgtChanceToSpellCrit(gtChanceToSpellCritfmt, "Data", "dbc_gtchancetospellcrit"); -SQLStorage sDBCgtOCTRegenHP(gtOCTRegenHPfmt, "Data", "dbc_gtoctregenhp"); -SQLStorage sDBCgtNPCManaCostScaler(gtNPCManaCostScalerfmt, "Data", "dbc_gtnpcmanacostscaler"); -SQLStorage sDBCgtRegenHPPerSpt(gtRegenHPPerSptfmt, "Data", "dbc_gtregenhpperspt"); -SQLStorage sDBCgtRegenMPPerSpt(gtRegenMPPerSptfmt, "Data", "dbc_gtregenmpperspt"); -SQLStorage sDBCItem(Itemfmt, "ID", "dbc_item"); -SQLStorage sDBCItemBagFamily(ItemBagFamilyfmt, "ID", "dbc_itembagfamily"); -SQLStorage sDBCItemClass(ItemClassfmt, "ClassID", "dbc_itemclass"); -SQLStorage sDBCItemExtendedCost(ItemExtendedCostfmt, "ID", "dbc_itemextendedcost"); -SQLStorage sDBCItemRandomProperties(ItemRandomPropertiesfmt, "ID", "dbc_itemrandomproperties"); -SQLStorage sDBCItemRandomSuffix(ItemRandomSuffixfmt, "ID", "dbc_itemrandomsuffix"); -SQLStorage sDBCItemSet(ItemSetfmt, "ID", "dbc_itemset"); -SQLStorage sDBCLiquidType(LiquidTypefmt, "ID", "dbc_liquidtype"); -SQLStorage sDBCLock(Lockfmt, "ID", "dbc_lock"); -SQLStorage sDBCMailTemplate(MailTemplatefmt, "ID", "dbc_mailtemplate"); -SQLStorage sDBCMap(Mapfmt, "ID", "dbc_map"); -SQLStorage sDBCQuestSort(QuestSortfmt, "ID", "dbc_questsort"); -SQLStorage sDBCRandPropPoints(RandPropPointsfmt, "ID", "dbc_randproppoints"); -SQLStorage sDBCSkillLine(SkillLinefmt, "ID", "dbc_skillline"); -SQLStorage sDBCSkillLineAbility(SkillLineAbilityfmt, "ID", "dbc_skilllineability"); -SQLStorage sDBCSkillRaceClassInfo(SkillRaceClassInfofmt, "ID", "dbc_skillraceclassinfo"); -SQLStorage sDBCSkillTiers(SkillTiersfmt, "ID", "dbc_skilltiers"); -SQLStorage sDBCSoundEntries(SoundEntriesfmt, "ID", "dbc_soundentries"); -SQLStorage sDBCSpellCastTimes(SpellCastTimesfmt, "ID", "dbc_spellcasttimes"); -SQLStorage sDBCSpellDuration(SpellDurationfmt, "ID", "dbc_spellduration"); -SQLStorage sDBCSpellFocusObject(SpellFocusObjectfmt, "ID", "dbc_spellfocusobject"); -SQLStorage sDBCSpellItemEnchantment(SpellItemEnchantmentfmt, "ID", "dbc_spellitemenchantment"); -SQLStorage sDBCSpellItemEnchantmentCondition(SpellItemEnchantmentConditionfmt, "ID", "dbc_spellitemenchantmentcondition"); -SQLStorage sDBCSpellRadius(SpellRadiusfmt, "ID", "dbc_spellradius"); -SQLStorage sDBCSpellRange(SpellRangefmt, "ID", "dbc_spellrange"); -SQLStorage sDBCSpellShapeshiftForm(SpellShapeshiftFormfmt, "ID", "dbc_spellshapeshiftform"); -SQLStorage sDBCSpellVisual(SpellVisualfmt, "ID", "dbc_spellvisual"); -SQLStorage sDBCStableSlotPrices(StableSlotPricesfmt, "ID", "dbc_stableslotprices"); -SQLStorage sDBCSummonProperties(SummonPropertiesfmt, "ID", "dbc_summonproperties"); -SQLStorage sDBCTalent(Talentfmt, "ID", "dbc_talent"); -SQLStorage sDBCTalentTab(TalentTabfmt, "ID", "dbc_talenttab"); -SQLStorage sDBCTaxiNodes(TaxiNodesfmt, "ID", "dbc_taxinodes"); -SQLStorage sDBCTaxiPath(TaxiPathfmt, "ID", "dbc_taxipath"); -SQLStorage sDBCTaxiPathNode(TaxiPathNodefmt, "ID", "dbc_taxipathnode"); -SQLStorage sDBCTransportAnimation(TransportAnimationfmt, "ID", "dbc_transportanimation"); -SQLStorage sDBCTotemCategory(TotemCategoryfmt, "ID", "dbc_totemcategory"); -SQLStorage sDBCWorldMapArea(WorldMapAreafmt, "ID", "dbc_worldmaparea"); -SQLStorage sDBCWMOAreaTable(WMOAreaTablefmt, "ID", "dbc_wmoareatable"); +SQLStorage sDBCAreaTable(AreaTablefmt, "ID", "dbc_areatable"); +SQLStorage sDBCAreaTrigger(AreaTriggerfmt, "ID", "dbc_areatrigger"); +SQLStorage sDBCAuctionHouse(AuctionHousefmt, "ID", "dbc_auctionhouse"); +SQLStorage sDBCBankBagSlotPrices(BankBagSlotPricesfmt, "ID", "dbc_bankbagslotprices"); +SQLStorage sDBCBattlemasterList(BattlemasterListfmt, "ID", "dbc_battlemasterlist"); +SQLStorage sDBCCharStartOutfit(CharStartOutfitsrcfmt, CharStartOutfitdstfmt, "ID", "dbc_charstartoutfit"); +SQLStorage sDBCCharTitles(CharTitlesfmt, "ID", "dbc_chartitles"); +SQLStorage sDBCChatChannels(ChatChannelsfmt, "ID", "dbc_chatchannels"); +SQLStorage sDBCChrClasses(ChrClassesfmt, "ID", "dbc_chrclasses"); +SQLStorage sDBCChrRaces(ChrRacesfmt, "ID", "dbc_chrraces"); +SQLStorage sDBCCinematicCamera(CinematicCamerafmt, "ID", "dbc_cinematiccamera"); +SQLStorage sDBCCinematicSequences(CinematicSequencesfmt, "ID", "dbc_cinematicsequences"); +SQLStorage sDBCCreatureDisplayInfo(CreatureDisplayInfofmt, "ID", "dbc_creaturedisplayinfo"); +SQLStorage sDBCCreatureDisplayInfoExtra(CreatureDisplayInfoExtrafmt, "ID", "dbc_creaturedisplayinfoextra"); +SQLStorage sDBCCreatureFamily(CreatureFamilyfmt, "ID", "dbc_creaturefamily"); +SQLStorage sDBCCreatureModelData(CreatureModelDatafmt, "ID", "dbc_creaturemodeldata"); +SQLStorage sDBCCreatureSpellData(CreatureSpellDatafmt, "ID", "dbc_creaturespelldata"); +SQLStorage sDBCCreatureType(CreatureTypefmt, "ID", "dbc_creaturetype"); +SQLStorage sDBCDurabilityCosts(DurabilityCostsfmt, "ID", "dbc_durabilitycosts"); +SQLStorage sDBCDurabilityQuality(DurabilityQualityfmt, "ID", "dbc_durabilityquality"); +SQLStorage sDBCEmotes(Emotesfmt, "ID", "dbc_emotes"); +SQLStorage sDBCEmotesText(EmotesTextfmt, "ID", "dbc_emotestext"); +SQLStorage sDBCFactionTemplate(FactionTemplatefmt, "ID", "dbc_factiontemplate"); +SQLStorage sDBCGameObjectDisplayInfo(GameObjectDisplayInfofmt, "ID", "dbc_gameobjectdisplayinfo"); +SQLStorage sDBCGemProperties(GemPropertiesfmt, "ID", "dbc_gemproperties"); +SQLStorage sDBCGMSurveyCurrentSurvey(GMSurveyCurrentSurveyfmt, "LANGID", "dbc_gmsurveycurrentsurvey"); +SQLStorage sDBCGMSurveyQuestions(GMSurveyQuestionsfmt, "ID", "dbc_gmsurveyquestions"); +SQLStorage sDBCGMSurveySurveys(GMSurveySurveysfmt, "ID", "dbc_gmsurveysurveys"); +SQLStorage sDBCGMTicketCategory(GMTicketCategoryfmt, "ID", "dbc_gmticketcategory"); +SQLStorage sDBCgtCombatRatings(gtCombatRatingsfmt, "Data", "dbc_gtcombatratings"); +SQLStorage sDBCgtChanceToMeleeCritBase(gtChanceToMeleeCritBasefmt, "Data", "dbc_gtchancetomeleecritbase"); +SQLStorage sDBCgtChanceToMeleeCrit(gtChanceToMeleeCritfmt, "Data", "dbc_gtchancetomeleecrit"); +SQLStorage sDBCgtChanceToSpellCritBase(gtChanceToSpellCritBasefmt, "Data", "dbc_gtchancetospellcritbase"); +SQLStorage sDBCgtChanceToSpellCrit(gtChanceToSpellCritfmt, "Data", "dbc_gtchancetospellcrit"); +SQLStorage sDBCgtOCTRegenHP(gtOCTRegenHPfmt, "Data", "dbc_gtoctregenhp"); +SQLStorage sDBCgtNPCManaCostScaler(gtNPCManaCostScalerfmt, "Data", "dbc_gtnpcmanacostscaler"); +SQLStorage sDBCgtRegenHPPerSpt(gtRegenHPPerSptfmt, "Data", "dbc_gtregenhpperspt"); +SQLStorage sDBCgtRegenMPPerSpt(gtRegenMPPerSptfmt, "Data", "dbc_gtregenmpperspt"); +SQLStorage sDBCItem(Itemfmt, "ID", "dbc_item"); +SQLStorage sDBCItemBagFamily(ItemBagFamilyfmt, "ID", "dbc_itembagfamily"); +SQLStorage sDBCItemClass(ItemClassfmt, "ClassID", "dbc_itemclass"); +SQLStorage sDBCItemExtendedCost(ItemExtendedCostfmt, "ID", "dbc_itemextendedcost"); +SQLStorage sDBCItemRandomProperties(ItemRandomPropertiesfmt, "ID", "dbc_itemrandomproperties"); +SQLStorage sDBCItemRandomSuffix(ItemRandomSuffixfmt, "ID", "dbc_itemrandomsuffix"); +SQLStorage sDBCItemSet(ItemSetfmt, "ID", "dbc_itemset"); +SQLStorage sDBCLiquidType(LiquidTypefmt, "ID", "dbc_liquidtype"); +SQLStorage sDBCLock(Lockfmt, "ID", "dbc_lock"); +SQLStorage sDBCMailTemplate(MailTemplatefmt, "ID", "dbc_mailtemplate"); +SQLStorage sDBCMap(Mapfmt, "ID", "dbc_map"); +SQLStorage sDBCQuestSort(QuestSortfmt, "ID", "dbc_questsort"); +SQLStorage sDBCRandPropPoints(RandPropPointsfmt, "ID", "dbc_randproppoints"); +SQLStorage sDBCSkillLine(SkillLinefmt, "ID", "dbc_skillline"); +SQLStorage sDBCSkillLineAbility(SkillLineAbilityfmt, "ID", "dbc_skilllineability"); +SQLStorage sDBCSkillRaceClassInfo(SkillRaceClassInfofmt, "ID", "dbc_skillraceclassinfo"); +SQLStorage sDBCSkillTiers(SkillTiersfmt, "ID", "dbc_skilltiers"); +SQLStorage sDBCSoundEntries(SoundEntriesfmt, "ID", "dbc_soundentries"); +SQLStorage sDBCSpellCastTimes(SpellCastTimesfmt, "ID", "dbc_spellcasttimes"); +SQLStorage sDBCSpellDuration(SpellDurationfmt, "ID", "dbc_spellduration"); +SQLStorage sDBCSpellFocusObject(SpellFocusObjectfmt, "ID", "dbc_spellfocusobject"); +SQLStorage sDBCSpellItemEnchantment(SpellItemEnchantmentfmt, "ID", "dbc_spellitemenchantment"); +SQLStorage sDBCSpellItemEnchantmentCondition(SpellItemEnchantmentConditionfmt, "ID", "dbc_spellitemenchantmentcondition"); +SQLStorage sDBCSpellRadius(SpellRadiusfmt, "ID", "dbc_spellradius"); +SQLStorage sDBCSpellRange(SpellRangefmt, "ID", "dbc_spellrange"); +SQLStorage sDBCSpellShapeshiftForm(SpellShapeshiftFormfmt, "ID", "dbc_spellshapeshiftform"); +SQLStorage sDBCSpellVisual(SpellVisualfmt, "ID", "dbc_spellvisual"); +SQLStorage sDBCStableSlotPrices(StableSlotPricesfmt, "ID", "dbc_stableslotprices"); +SQLStorage sDBCSummonProperties(SummonPropertiesfmt, "ID", "dbc_summonproperties"); +SQLStorage sDBCTalent(Talentfmt, "ID", "dbc_talent"); +SQLStorage sDBCTalentTab(TalentTabfmt, "ID", "dbc_talenttab"); +SQLStorage sDBCTaxiNodes(TaxiNodesfmt, "ID", "dbc_taxinodes"); +SQLStorage sDBCTaxiPath(TaxiPathfmt, "ID", "dbc_taxipath"); +SQLStorage sDBCTaxiPathNode(TaxiPathNodefmt, "ID", "dbc_taxipathnode"); +SQLStorage sDBCTransportAnimation(TransportAnimationfmt, "ID", "dbc_transportanimation"); +SQLStorage sDBCTotemCategory(TotemCategoryfmt, "ID", "dbc_totemcategory"); +SQLStorage sDBCWorldMapArea(WorldMapAreafmt, "ID", "dbc_worldmaparea"); +SQLStorage sDBCWMOAreaTable(WMOAreaTablefmt, "ID", "dbc_wmoareatable"); void LoadDBCTables() { diff --git a/src/game/Server/SQLStorages.h b/src/game/Server/SQLStorages.h index b945aa7a0eb..a5df64ba5a4 100644 --- a/src/game/Server/SQLStorages.h +++ b/src/game/Server/SQLStorages.h @@ -20,24 +20,25 @@ #define MANGOS_SQLSTORAGES_H #include "Database/SQLStorage.h" +#include "DBCStructure.h" -extern SQLStorage sCreatureStorage; -extern SQLStorage sCreatureDataAddonStorage; -extern SQLStorage sCreatureInfoAddonStorage; -extern SQLStorage sCreatureModelStorage; -extern SQLStorage sEquipmentStorage; -extern SQLStorage sEquipmentStorageRaw; -extern SQLStorage sPageTextStore; -extern SQLStorage sItemStorage; -extern SQLStorage sInstanceTemplate; -extern SQLStorage sWorldTemplate; -extern SQLStorage sConditionStorage; -extern SQLStorage sSpellTemplate; -extern SQLStorage sSpellCones; -extern SQLStorage sDungeonEncounterStore; -extern SQLStorage sFactionStore; -extern SQLStorage sCreatureConditionalSpawnStore; -extern SQLStorage sWorldSafeLocsStore; +extern SQLStorage sCreatureStorage; +extern SQLStorage sCreatureDataAddonStorage; +extern SQLStorage sCreatureInfoAddonStorage; +extern SQLStorage sCreatureModelStorage; +extern SQLStorage sEquipmentStorage; +extern SQLStorage sEquipmentStorageRaw; +extern SQLStorage sPageTextStore; +extern SQLStorage sItemStorage; +extern SQLStorage sInstanceTemplate; +extern SQLStorage sWorldTemplate; +extern SQLStorage sConditionStorage; +extern SQLStorage sSpellTemplate; +extern SQLStorage sSpellCones; +extern SQLStorage sDungeonEncounterStore; +extern SQLStorage sFactionStore; +extern SQLStorage sCreatureConditionalSpawnStore; +extern SQLStorage sWorldSafeLocsStore; extern SQLHashStorage sGOStorage; @@ -45,88 +46,88 @@ extern SQLHashStorage sGOStorage; extern SQLMultiStorage sSpellScriptTargetStorage; -// DBC stores in db -extern SQLStorage sDBCAreaTable; -extern SQLStorage sDBCAreaTrigger; -extern SQLStorage sDBCAuctionHouse; -extern SQLStorage sDBCBankBagSlotPrices; -extern SQLStorage sDBCBattlemasterList; -extern SQLStorage sDBCCharStartOutfit; -extern SQLStorage sDBCCharTitles; -extern SQLStorage sDBCChatChannels; -extern SQLStorage sDBCChrClasses; -extern SQLStorage sDBCChrRaces; -extern SQLStorage sDBCCinematicCamera; -extern SQLStorage sDBCCinematicSequences; -extern SQLStorage sDBCCreatureDisplayInfo; -extern SQLStorage sDBCCreatureDisplayInfoExtra; -extern SQLStorage sDBCCreatureFamily; -extern SQLStorage sDBCCreatureModelData; -extern SQLStorage sDBCCreatureSpellData; -extern SQLStorage sDBCCreatureType; -extern SQLStorage sDBCDurabilityCosts; -extern SQLStorage sDBCDurabilityQuality; -extern SQLStorage sDBCEmotes; -extern SQLStorage sDBCEmotesText; -extern SQLStorage sDBCFactionTemplate; -extern SQLStorage sDBCGameObjectDisplayInfo; -extern SQLStorage sDBCGemProperties; -extern SQLStorage sDBCGMSurveyCurrentSurvey; -extern SQLStorage sDBCGMSurveyQuestions; -extern SQLStorage sDBCGMSurveySurveys; -extern SQLStorage sDBCGMTicketCategory; -extern SQLStorage sDBCgtCombatRatings; -extern SQLStorage sDBCgtChanceToMeleeCritBase; -extern SQLStorage sDBCgtChanceToMeleeCrit; -extern SQLStorage sDBCgtChanceToSpellCritBase; -extern SQLStorage sDBCgtChanceToSpellCrit; -extern SQLStorage sDBCgtOCTRegenHP; -extern SQLStorage sDBCgtNPCManaCostScaler; -extern SQLStorage sDBCgtRegenHPPerSpt; -extern SQLStorage sDBCgtRegenMPPerSpt; -extern SQLStorage sDBCItem; -extern SQLStorage sDBCItemBagFamily; -extern SQLStorage sDBCItemClass; -extern SQLStorage sDBCItemExtendedCost; -extern SQLStorage sDBCItemRandomProperties; -extern SQLStorage sDBCItemRandomSuffix; -extern SQLStorage sDBCItemSet; -extern SQLStorage sDBCLiquidType; -extern SQLStorage sDBCLock; -extern SQLStorage sDBCMailTemplate; -extern SQLStorage sDBCMap; -extern SQLStorage sDBCQuestSort; -extern SQLStorage sDBCRandPropPoints; -extern SQLStorage sDBCSkillLine; -extern SQLStorage sDBCSkillLineAbility; -extern SQLStorage sDBCSkillRaceClassInfo; -extern SQLStorage sDBCSkillTiers; -extern SQLStorage sDBCSoundEntries; -extern SQLStorage sDBCSpellCastTimes; -extern SQLStorage sDBCSpellDuration; -extern SQLStorage sDBCSpellFocusObject; -extern SQLStorage sDBCSpellItemEnchantment; -extern SQLStorage sDBCSpellItemEnchantmentCondition; -extern SQLStorage sDBCSpellRadius; -extern SQLStorage sDBCSpellRange; -extern SQLStorage sDBCSpellShapeshiftForm; -extern SQLStorage sDBCSpellVisual; -extern SQLStorage sDBCStableSlotPrices; -extern SQLStorage sDBCSummonProperties; -extern SQLStorage sDBCTalent; -extern SQLStorage sDBCTalentTab; -extern SQLStorage sDBCTaxiNodes; -extern SQLStorage sDBCTaxiPath; -extern SQLStorage sDBCTaxiPathNode; -extern SQLStorage sDBCTransportAnimation; -extern SQLStorage sDBCTotemCategory; -extern SQLStorage sDBCWorldMapArea; -extern SQLStorage sDBCWMOAreaTable; +// DBC stores in <>db +extern SQLStorage sDBCAreaTable; +extern SQLStorage sDBCAreaTrigger; +extern SQLStorage sDBCAuctionHouse; +extern SQLStorage sDBCBankBagSlotPrices; +extern SQLStorage sDBCBattlemasterList; +extern SQLStorage sDBCCharStartOutfit; +extern SQLStorage sDBCCharTitles; +extern SQLStorage sDBCChatChannels; +extern SQLStorage sDBCChrClasses; +extern SQLStorage sDBCChrRaces; +extern SQLStorage sDBCCinematicCamera; +extern SQLStorage sDBCCinematicSequences; +extern SQLStorage sDBCCreatureDisplayInfo; +extern SQLStorage sDBCCreatureDisplayInfoExtra; +extern SQLStorage sDBCCreatureFamily; +extern SQLStorage sDBCCreatureModelData; +extern SQLStorage sDBCCreatureSpellData; +extern SQLStorage sDBCCreatureType; +extern SQLStorage sDBCDurabilityCosts; +extern SQLStorage sDBCDurabilityQuality; +extern SQLStorage sDBCEmotes; +extern SQLStorage sDBCEmotesText; +extern SQLStorage sDBCFactionTemplate; +extern SQLStorage sDBCGameObjectDisplayInfo; +extern SQLStorage sDBCGemProperties; +extern SQLStorage sDBCGMSurveyCurrentSurvey; +extern SQLStorage sDBCGMSurveyQuestions; +extern SQLStorage sDBCGMSurveySurveys; +extern SQLStorage sDBCGMTicketCategory; +extern SQLStorage sDBCgtCombatRatings; +extern SQLStorage sDBCgtChanceToMeleeCritBase; +extern SQLStorage sDBCgtChanceToMeleeCrit; +extern SQLStorage sDBCgtChanceToSpellCritBase; +extern SQLStorage sDBCgtChanceToSpellCrit; +extern SQLStorage sDBCgtOCTRegenHP; +extern SQLStorage sDBCgtNPCManaCostScaler; +extern SQLStorage sDBCgtRegenHPPerSpt; +extern SQLStorage sDBCgtRegenMPPerSpt; +extern SQLStorage sDBCItem; +extern SQLStorage sDBCItemBagFamily; +extern SQLStorage sDBCItemClass; +extern SQLStorage sDBCItemExtendedCost; +extern SQLStorage sDBCItemRandomProperties; +extern SQLStorage sDBCItemRandomSuffix; +extern SQLStorage sDBCItemSet; +extern SQLStorage sDBCLiquidType; +extern SQLStorage sDBCLock; +extern SQLStorage sDBCMailTemplate; +extern SQLStorage sDBCMap; +extern SQLStorage sDBCQuestSort; +extern SQLStorage sDBCRandPropPoints; +extern SQLStorage sDBCSkillLine; +extern SQLStorage sDBCSkillLineAbility; +extern SQLStorage sDBCSkillRaceClassInfo; +extern SQLStorage sDBCSkillTiers; +extern SQLStorage sDBCSoundEntries; +extern SQLStorage sDBCSpellCastTimes; +extern SQLStorage sDBCSpellDuration; +extern SQLStorage sDBCSpellFocusObject; +extern SQLStorage sDBCSpellItemEnchantment; +extern SQLStorage sDBCSpellItemEnchantmentCondition; +extern SQLStorage sDBCSpellRadius; +extern SQLStorage sDBCSpellRange; +extern SQLStorage sDBCSpellShapeshiftForm; +extern SQLStorage sDBCSpellVisual; +extern SQLStorage sDBCStableSlotPrices; +extern SQLStorage sDBCSummonProperties; +extern SQLStorage sDBCTalent; +extern SQLStorage sDBCTalentTab; +extern SQLStorage sDBCTaxiNodes; +extern SQLStorage sDBCTaxiPath; +extern SQLStorage sDBCTaxiPathNode; +extern SQLStorage sDBCTransportAnimation; +extern SQLStorage sDBCTotemCategory; +extern SQLStorage sDBCWorldMapArea; +extern SQLStorage sDBCWMOAreaTable; void LoadDBCTables(); -SQLStorage const* GetSpellStore(); +SQLStorage const* GetSpellStore(); #endif diff --git a/src/game/Skills/SkillDiscovery.cpp b/src/game/Skills/SkillDiscovery.cpp index 0c3981a32e3..42253d64453 100644 --- a/src/game/Skills/SkillDiscovery.cpp +++ b/src/game/Skills/SkillDiscovery.cpp @@ -85,7 +85,7 @@ void LoadSkillDiscoveryTable() if (reqSkillOrSpell > 0) // spell case { - SpellEntry const* reqSpellEntry = sSpellTemplate.LookupEntry(reqSkillOrSpell); + SpellEntry const* reqSpellEntry = sSpellTemplate.LookupEntry(reqSkillOrSpell); if (!reqSpellEntry) { if (reportedReqSpells.find(reqSkillOrSpell) == reportedReqSpells.end()) diff --git a/src/game/Skills/SkillExtraItems.cpp b/src/game/Skills/SkillExtraItems.cpp index 0c98a2fbfcd..2d5356d010b 100644 --- a/src/game/Skills/SkillExtraItems.cpp +++ b/src/game/Skills/SkillExtraItems.cpp @@ -72,14 +72,14 @@ void LoadSkillExtraItemTable() uint32 spellId = fields[0].GetUInt32(); - if (!sSpellTemplate.LookupEntry(spellId)) + if (!sSpellTemplate.LookupEntry(spellId)) { sLog.outError("Skill specialization %u has nonexistent spell id in `skill_extra_item_template`!", spellId); continue; } uint32 requiredSpecialization = fields[1].GetUInt32(); - if (!sSpellTemplate.LookupEntry(requiredSpecialization)) + if (!sSpellTemplate.LookupEntry(requiredSpecialization)) { sLog.outError("Skill specialization %u have nonexistent required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization); continue; diff --git a/src/game/Spells/Scripts/SpellScript.cpp b/src/game/Spells/Scripts/SpellScript.cpp index 4992c15b5a5..fbf5a9af6f2 100644 --- a/src/game/Spells/Scripts/SpellScript.cpp +++ b/src/game/Spells/Scripts/SpellScript.cpp @@ -85,7 +85,7 @@ void SpellScriptMgr::LoadScripts() uint32 spellId = fields[0].GetUInt32(); std::string scriptName = fields[1].GetCppString(); - if (!sSpellTemplate.LookupEntry(spellId)) + if (!sSpellTemplate.LookupEntry(spellId)) { sLog.outErrorDb("Spell %u has script %s in spell_scripts but spell does not exist. Skipping.", spellId, scriptName.data()); continue; diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index c2b4098b852..eba4cb4cd17 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -51,7 +51,7 @@ extern pEffect SpellEffects[MAX_SPELL_EFFECTS]; bool IsQuestTameSpell(uint32 spellId) { - SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); if (!spellproto) return false; @@ -318,7 +318,7 @@ Spell::Spell(Unit* caster, SpellEntry const* info, uint32 triggeredFlags, Object m_spellScript(SpellScriptMgr::GetSpellScript(info->Id)), m_spellLog(this), m_trueCaster(caster) { MANGOS_ASSERT(caster != nullptr && info != nullptr); - MANGOS_ASSERT(info == sSpellTemplate.LookupEntry(info->Id) && "`info` must be pointer to sSpellTemplate element"); + MANGOS_ASSERT(info == sSpellTemplate.LookupEntry(info->Id) && "`info` must be pointer to sSpellTemplate element"); m_spellInfo = info; m_triggeredBySpellInfo = triggeredBy; @@ -3076,7 +3076,7 @@ void Spell::cast(bool skipCheck) if (!itr.second.active || itr.second.disabled || itr.second.state == PLAYERSPELL_REMOVED) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr.first); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr.first); if (!spellInfo) continue; @@ -4408,7 +4408,7 @@ void Spell::HandleEffect(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTa void Spell::AddTriggeredSpell(uint32 spellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) { @@ -4421,7 +4421,7 @@ void Spell::AddTriggeredSpell(uint32 spellId) void Spell::AddPrecastSpell(uint32 spellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) { @@ -5031,7 +5031,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!pet) return SPELL_FAILED_NO_PET; - SpellEntry const* learn_spellproto = sSpellTemplate.LookupEntry(m_spellInfo->EffectTriggerSpell[i]); + SpellEntry const* learn_spellproto = sSpellTemplate.LookupEntry(m_spellInfo->EffectTriggerSpell[i]); if (!learn_spellproto) return SPELL_FAILED_NOT_KNOWN; @@ -5054,7 +5054,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!pet) return SPELL_FAILED_NO_PET; - SpellEntry const* learn_spellproto = sSpellTemplate.LookupEntry(m_spellInfo->EffectTriggerSpell[i]); + SpellEntry const* learn_spellproto = sSpellTemplate.LookupEntry(m_spellInfo->EffectTriggerSpell[i]); if (!learn_spellproto) return SPELL_FAILED_NOT_KNOWN; @@ -7199,7 +7199,7 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, SpellEntry const* parentSpel if (skillval >= 225 && (spellId300 > 0 || spellId225 > 0)) { uint32 spellid = skillval >= 300 ? spellId300 : spellId225; - SpellEntry const* pSpell = sSpellTemplate.LookupEntry(spellid); + SpellEntry const* pSpell = sSpellTemplate.LookupEntry(spellid); if (!pSpell) { sLog.outError("SelectMountByAreaAndSkill: unknown spell id %i by caster: %s", spellid, target->GetGuidStr().c_str()); @@ -7219,7 +7219,7 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, SpellEntry const* parentSpel { if (iter->second.state != PLAYERSPELL_REMOVED) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(iter->first); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(iter->first); for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED) @@ -7380,7 +7380,7 @@ void Spell::GetSpellRangeAndRadius(SpellEffectIndex effIndex, float& radius, boo float Spell::GetCone() { - if (SpellCone const* coneData = sSpellCones.LookupEntry(sSpellMgr.GetFirstSpellInChain(m_spellInfo->Id))) + if (SpellCone const* coneData = sSpellCones.LookupEntry(sSpellMgr.GetFirstSpellInChain(m_spellInfo->Id))) return G3D::toRadians(coneData->coneAngle); return M_PI_F / 3.f; // 60 degrees is default diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index 3d2b84a4a36..3476a8a934c 100755 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -331,7 +331,7 @@ Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 const* curr m_scriptValue(0) { MANGOS_ASSERT(target); - MANGOS_ASSERT(spellproto && spellproto == sSpellTemplate.LookupEntry(spellproto->Id) && "`info` must be pointer to sSpellTemplate element"); + MANGOS_ASSERT(spellproto && spellproto == sSpellTemplate.LookupEntry(spellproto->Id) && "`info` must be pointer to sSpellTemplate element"); m_currentBasePoints = currentBasePoints ? *currentBasePoints : spellproto->CalculateSimpleValue(eff); @@ -507,7 +507,7 @@ Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 const uint32 triggeredSpellId = spellproto->EffectTriggerSpell[eff]; - if (SpellEntry const* triggeredSpellInfo = sSpellTemplate.LookupEntry(triggeredSpellId)) + if (SpellEntry const* triggeredSpellInfo = sSpellTemplate.LookupEntry(triggeredSpellId)) for (unsigned int i : triggeredSpellInfo->EffectImplicitTargetA) if (i == TARGET_UNIT_CHANNEL_TARGET) return new SingleEnemyTargetAura(spellproto, eff, currentDamage, currentBasePoints, holder, target, caster, castItem); @@ -1118,7 +1118,7 @@ void Aura::TriggerSpell() // generic casting code with custom spells and target/caster customs uint32 trigger_spell_id = GetSpellProto()->EffectTriggerSpell[m_effIndex]; - SpellEntry const* triggeredSpellInfo = sSpellTemplate.LookupEntry(trigger_spell_id); + SpellEntry const* triggeredSpellInfo = sSpellTemplate.LookupEntry(trigger_spell_id); SpellEntry const* auraSpellInfo = GetSpellProto(); uint32 auraId = auraSpellInfo->Id; Unit* target = GetTarget(); @@ -1893,7 +1893,7 @@ void Aura::TriggerSpell() } // Reget trigger spell proto - triggeredSpellInfo = sSpellTemplate.LookupEntry(trigger_spell_id); + triggeredSpellInfo = sSpellTemplate.LookupEntry(trigger_spell_id); } else { @@ -2152,7 +2152,7 @@ void Aura::TriggerSpellWithValue() uint32 trigger_spell_id = GetSpellProto()->EffectTriggerSpell[m_effIndex]; int32 calculatedAmount = GetModifier()->m_amount; - SpellEntry const* triggeredSpellInfo = sSpellTemplate.LookupEntry(trigger_spell_id); + SpellEntry const* triggeredSpellInfo = sSpellTemplate.LookupEntry(trigger_spell_id); int32 basePoints[3] = { 0,0,0 }; // damage triggered from spell might not only be processed by first effect (but always EffectDieSides equal 1) if (triggeredSpellInfo) @@ -3510,7 +3510,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) if (itr.second.state == PLAYERSPELL_REMOVED) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr.first); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr.first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) Rage_val += target->CalculateSpellEffectValue(target, spellInfo, EFFECT_INDEX_0) * 10; } @@ -4337,7 +4337,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) default: sLog.outError("Spell selection called for unexpected original spell %u, new spell for this spell family?", GetId()); return; } - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); if (!spellInfo) return; @@ -6578,7 +6578,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) { if (itr.second.state == PLAYERSPELL_REMOVED) continue; if (itr.first == spellId1 || itr.first == spellId2) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr.first); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr.first); if (!spellInfo || !IsNeedCastSpellAtFormApply(spellInfo, form)) continue; target->CastSpell(target, itr.first, TRIGGERED_OLD_TRIGGERED, nullptr, this); @@ -6587,7 +6587,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) // Leader of the Pack if (((Player*)target)->HasSpell(17007)) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(24932); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(24932); if (spellInfo && spellInfo->Stances & (1 << (form - 1))) target->CastSpell(target, 24932, TRIGGERED_OLD_TRIGGERED, nullptr, this); } @@ -7983,7 +7983,7 @@ SpellAuraHolder::SpellAuraHolder(SpellEntry const* spellproto, Unit* target, Wor m_auraScript(SpellScriptMgr::GetAuraScript(spellproto->Id)) { MANGOS_ASSERT(target); - MANGOS_ASSERT(spellproto && spellproto == sSpellTemplate.LookupEntry(spellproto->Id) && "`info` must be pointer to sSpellTemplate element"); + MANGOS_ASSERT(spellproto && spellproto == sSpellTemplate.LookupEntry(spellproto->Id) && "`info` must be pointer to sSpellTemplate element"); if (!caster) m_casterGuid = target->GetObjectGuid(); @@ -8260,7 +8260,7 @@ void SpellAuraHolder::CleanupTriggeredSpells() if (!tSpellId) continue; - SpellEntry const* tProto = sSpellTemplate.LookupEntry(tSpellId); + SpellEntry const* tProto = sSpellTemplate.LookupEntry(tSpellId); if (!tProto) continue; @@ -8535,7 +8535,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) Unit* boostCaster = m_target; Unit* boostTarget = nullptr; ObjectGuid casterGuid = m_target->GetObjectGuid(); // caster can be nullptr, but guid is still valid for removal - SpellEntry const* boostEntry = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* boostEntry = sSpellTemplate.LookupEntry(spellId); for (uint32 target : boostEntry->EffectImplicitTargetA) { switch (target) diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index c0b5e45f15e..bf76deb81d4 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -3046,7 +3046,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) continue; - SpellEntry const* combatEntry = sSpellTemplate.LookupEntry(pEnchant->spellid[s]); + SpellEntry const* combatEntry = sSpellTemplate.LookupEntry(pEnchant->spellid[s]); if (!combatEntry || combatEntry->Dispel != DISPEL_POISON) continue; @@ -3145,7 +3145,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) case 561: // Judgement of command { if (unitTarget) - if (SpellEntry const* spell_proto = sSpellTemplate.LookupEntry(m_currentBasePoints[eff_idx])) + if (SpellEntry const* spell_proto = sSpellTemplate.LookupEntry(m_currentBasePoints[eff_idx])) m_caster->CastSpell(unitTarget, spell_proto, TRIGGERED_OLD_TRIGGERED, nullptr); return; @@ -3212,7 +3212,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; } - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id); if (!spellInfo) { @@ -3325,7 +3325,7 @@ void Spell::EffectTriggerSpellWithValue(SpellEffectIndex eff_idx) uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[eff_idx]; // normal case - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(triggered_spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(triggered_spell_id); if (!spellInfo) { @@ -3349,7 +3349,7 @@ void Spell::EffectTriggerSpellWithValue(SpellEffectIndex eff_idx) void Spell::EffectTriggerRitualOfSummoning(SpellEffectIndex eff_idx) { uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[eff_idx]; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(triggered_spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(triggered_spell_id); if (!spellInfo) { @@ -3370,7 +3370,7 @@ void Spell::EffectForceCast(SpellEffectIndex effIndex) uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effIndex]; // normal case - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(triggered_spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(triggered_spell_id); if (!spellInfo) { @@ -3453,7 +3453,7 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex) } // normal case - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(triggered_spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(triggered_spell_id); if (!spellInfo) { sLog.outError("EffectTriggerSpell of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); @@ -3527,7 +3527,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffectIndex effect_idx) uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effect_idx]; // normal case - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(triggered_spell_id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(triggered_spell_id); if (!spellInfo) { @@ -4248,7 +4248,7 @@ void Spell::EffectEnergize(SpellEffectIndex eff_idx) if (itr->second & (ELIXIR_UNSTABLE_MASK | ELIXIR_SHATTRATH_MASK)) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr->first); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr->first); if (spellInfo && (spellInfo->spellLevel < m_spellInfo->spellLevel || spellInfo->spellLevel > unitTarget->getLevel())) continue; @@ -5848,7 +5848,7 @@ void Spell::EffectLearnPetSpell(SpellEffectIndex eff_idx) if (!pet->IsAlive()) return; - SpellEntry const* learn_spellproto = sSpellTemplate.LookupEntry(m_spellInfo->EffectTriggerSpell[eff_idx]); + SpellEntry const* learn_spellproto = sSpellTemplate.LookupEntry(m_spellInfo->EffectTriggerSpell[eff_idx]); if (!learn_spellproto) return; @@ -5961,7 +5961,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) if (!itr->second.active || itr->second.disabled || itr->second.state == PLAYERSPELL_REMOVED) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr->first); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(itr->first); if (!spellInfo) continue; @@ -8101,7 +8101,7 @@ void Spell::EffectStuck(SpellEffectIndex /*eff_idx*/) { player->TeleportToHomebind(TELE_TO_SPELL); // Trigger cooldown - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(8690); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(8690); if (!spellInfo) return; Spell spell(player, spellInfo, TRIGGERED_OLD_TRIGGERED); @@ -8780,7 +8780,7 @@ void Spell::EffectReputation(SpellEffectIndex eff_idx) int32 rep_change = m_currentBasePoints[eff_idx]; uint32 faction_id = m_spellInfo->EffectMiscValue[eff_idx]; - FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); if (!factionEntry) return; @@ -9097,7 +9097,7 @@ void Spell::EffectDestroyAllTotems(SpellEffectIndex /*eff_idx*/) if (damage) { uint32 spell_id = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL); - if (SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id)) + if (SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell_id)) { uint32 manacost = spellInfo->manaCost + m_caster->GetCreateMana() * spellInfo->ManaCostPercentage / 100; mana += manacost * damage / 100; diff --git a/src/game/Spells/SpellHandler.cpp b/src/game/Spells/SpellHandler.cpp index 5a414a8876e..2064ee9c6ce 100644 --- a/src/game/Spells/SpellHandler.cpp +++ b/src/game/Spells/SpellHandler.cpp @@ -112,7 +112,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) { for (const auto& Spell : proto->Spells) { - if (SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(Spell.SpellId)) + if (SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(Spell.SpellId)) { if (IsNonCombatSpell(spellInfo)) { @@ -157,7 +157,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) } // send spell error - if (SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellid)) + if (SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellid)) Spell::SendCastResult(_player, spellInfo, cast_count, SPELL_FAILED_BAD_TARGETS); return; } @@ -335,7 +335,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) DEBUG_LOG("WORLD: CMSG_CAST_SPELL, spellId - %u, cast_count: %u data length = " SIZEFMTD, spellId, cast_count, recvPacket.size()); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) { sLog.outError("WORLD: unknown spell id %u", spellId); @@ -441,7 +441,7 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket) uint32 spellId; recvPacket >> spellId; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return; @@ -510,7 +510,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) if (!_player->IsSelfMover()) return; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) { sLog.outError("WORLD: unknown PET spell id %u", spellId); @@ -590,7 +590,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket& /*recv_data*/) if (_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)); if (spellInfo) _player->CastSpell(_player, spellInfo, TRIGGERED_NONE); diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index 9f3ac6a451c..a73fbadfae6 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -294,7 +294,7 @@ uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo) uint16 GetSpellAuraMaxTicks(uint32 spellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) { sLog.outError("GetSpellAuraMaxTicks: Spell %u not exist!", spellId); @@ -350,7 +350,7 @@ WeaponAttackType GetWeaponAttackType(SpellEntry const* spellInfo) SpellSpecific GetSpellSpecific(uint32 spellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return SPELL_NORMAL; @@ -593,7 +593,7 @@ void SpellMgr::LoadSpellTargetPositions() continue; } - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(Spell_ID); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(Spell_ID); if (!spellInfo) { sLog.outErrorDb("Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID); @@ -632,7 +632,7 @@ struct SpellRankHelper SpellRankHelper(SpellMgr& _mgr, StorageType& _storage): mgr(_mgr), worker(_storage), customRank(0) {} void RecordRank(EntryType& entry, uint32 spell_id) { - const SpellEntry* spell = sSpellTemplate.LookupEntry(spell_id); + const SpellEntry* spell = sSpellTemplate.LookupEntry(spell_id); if (!spell) { sLog.outErrorDb("Spell %u listed in `%s` does not exist", spell_id, worker.TableName()); @@ -892,7 +892,7 @@ void SpellMgr::LoadSpellProcItemEnchant() uint32 entry = fields[0].GetUInt32(); float ppmRate = fields[1].GetFloat(); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(entry); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(entry); if (!spellInfo) { @@ -956,7 +956,7 @@ void SpellMgr::LoadSpellBonuses() bar.step(); uint32 entry = fields[0].GetUInt32(); - SpellEntry const* spell = sSpellTemplate.LookupEntry(entry); + SpellEntry const* spell = sSpellTemplate.LookupEntry(entry); if (!spell) { sLog.outErrorDb("Spell %u listed in `spell_bonus_data` does not exist", entry); @@ -1193,7 +1193,7 @@ void SpellMgr::LoadSpellElixirs() uint32 entry = fields[0].GetUInt32(); uint8 mask = fields[1].GetUInt8(); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(entry); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(entry); if (!spellInfo) { @@ -1335,7 +1335,7 @@ bool SpellMgr::IsSpellCanAffectSpell(SpellEntry const* spellInfo_1, SpellEntry c bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return false; @@ -1349,7 +1349,7 @@ bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId) bool SpellMgr::IsProfessionSpell(uint32 spellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return false; @@ -1363,7 +1363,7 @@ bool SpellMgr::IsProfessionSpell(uint32 spellId) bool SpellMgr::IsPrimaryProfessionSpell(uint32 spellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return false; @@ -1431,7 +1431,7 @@ SpellEntry const* SpellMgr::SelectAuraRankForLevel(SpellEntry const* spellInfo, { for (uint32 nextSpellId = spellInfo->Id; nextSpellId != 0; nextSpellId = GetPrevSpellInChain(nextSpellId)) { - SpellEntry const* nextSpellInfo = sSpellTemplate.LookupEntry(nextSpellId); + SpellEntry const* nextSpellInfo = sSpellTemplate.LookupEntry(nextSpellId); if (!nextSpellInfo) break; @@ -1537,7 +1537,7 @@ void SpellMgr::LoadSpellChains() if (!spell_id) continue; - if (!sSpellTemplate.LookupEntry(spell_id)) + if (!sSpellTemplate.LookupEntry(spell_id)) { // sLog.outErrorDb("Talent %u not exist as spell",spell_id); continue; @@ -1566,7 +1566,7 @@ void SpellMgr::LoadSpellChains() continue; // some forward spells not exist and can be ignored (some outdated data) - SpellEntry const* spell_entry = sSpellTemplate.LookupEntry(spell_id); + SpellEntry const* spell_entry = sSpellTemplate.LookupEntry(spell_id); if (!spell_entry) // no cases continue; @@ -1581,7 +1581,7 @@ void SpellMgr::LoadSpellChains() continue; // some forward spells not exist and can be ignored (some outdated data) - SpellEntry const* forward_entry = sSpellTemplate.LookupEntry(forward_id); + SpellEntry const* forward_entry = sSpellTemplate.LookupEntry(forward_id); if (!forward_entry) continue; @@ -1665,7 +1665,7 @@ void SpellMgr::LoadSpellChains() node.rank = fields[3].GetUInt8(); node.req = fields[4].GetUInt32(); - if (!sSpellTemplate.LookupEntry(spell_id)) + if (!sSpellTemplate.LookupEntry(spell_id)) { sLog.outErrorDb("Spell %u listed in `spell_chain` does not exist", spell_id); continue; @@ -1709,14 +1709,14 @@ void SpellMgr::LoadSpellChains() continue; } - if (node.prev != 0 && !sSpellTemplate.LookupEntry(node.prev)) + if (node.prev != 0 && !sSpellTemplate.LookupEntry(node.prev)) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has nonexistent previous rank spell.", spell_id, node.prev, node.first, node.rank, node.req); continue; } - if (!sSpellTemplate.LookupEntry(node.first)) + if (!sSpellTemplate.LookupEntry(node.first)) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has not existing first rank spell.", spell_id, node.prev, node.first, node.rank, node.req); @@ -1733,7 +1733,7 @@ void SpellMgr::LoadSpellChains() continue; } - if (node.req != 0 && !sSpellTemplate.LookupEntry(node.req)) + if (node.req != 0 && !sSpellTemplate.LookupEntry(node.req)) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has not existing required spell.", spell_id, node.prev, node.first, node.rank, node.req); @@ -1872,7 +1872,7 @@ void SpellMgr::LoadSpellLearnSkills() for (uint32 spell = 0; spell < sSpellTemplate.GetMaxEntry(); ++spell) { bar.step(); - SpellEntry const* entry = sSpellTemplate.LookupEntry(spell); + SpellEntry const* entry = sSpellTemplate.LookupEntry(spell); if (!entry) continue; @@ -1932,13 +1932,13 @@ void SpellMgr::LoadSpellLearnSpells() node.active = fields[2].GetBool(); node.autoLearned = false; - if (!sSpellTemplate.LookupEntry(spell_id)) + if (!sSpellTemplate.LookupEntry(spell_id)) { sLog.outErrorDb("Spell %u listed in `spell_learn_spell` does not exist", spell_id); continue; } - if (!sSpellTemplate.LookupEntry(node.spell)) + if (!sSpellTemplate.LookupEntry(node.spell)) { sLog.outErrorDb("Spell %u listed in `spell_learn_spell` learning nonexistent spell %u", spell_id, node.spell); continue; @@ -1962,7 +1962,7 @@ void SpellMgr::LoadSpellLearnSpells() uint32 dbc_count = 0; for (uint32 spell = 0; spell < sSpellTemplate.GetMaxEntry(); ++spell) { - SpellEntry const* entry = sSpellTemplate.LookupEntry(spell); + SpellEntry const* entry = sSpellTemplate.LookupEntry(spell); if (!entry) continue; @@ -1976,7 +1976,7 @@ void SpellMgr::LoadSpellLearnSpells() dbc_node.active = true; // all dbc based learned spells is active (show in spell book or hide by client itself) // ignore learning nonexistent spells (broken/outdated/or generic learning spell 483 - if (!sSpellTemplate.LookupEntry(dbc_node.spell)) + if (!sSpellTemplate.LookupEntry(dbc_node.spell)) continue; // talent or passive spells or skill-step spells auto-casted and not need dependent learning, @@ -2018,7 +2018,7 @@ void SpellMgr::LoadSpellScriptTarget() // Check content for (SQLMultiStorage::SQLSIterator itr = sSpellScriptTargetStorage.getDataBegin(); itr < sSpellScriptTargetStorage.getDataEnd(); ++itr) { - SpellEntry const* spellProto = sSpellTemplate.LookupEntry(itr->spellId); + SpellEntry const* spellProto = sSpellTemplate.LookupEntry(itr->spellId); if (!spellProto) { sLog.outErrorDb("Table `spell_script_target`: spellId %u listed for TargetEntry %u does not exist.", itr->spellId, itr->targetEntry); @@ -2107,7 +2107,7 @@ void SpellMgr::LoadSpellScriptTarget() sSpellScriptTargetStorage.EraseEntry(itr->spellId); continue; } - if (const CreatureInfo* cInfo = sCreatureStorage.LookupEntry(itr->targetEntry)) + if (const CreatureInfo* cInfo = sCreatureStorage.LookupEntry(itr->targetEntry)) { if (itr->spellId == 30427 && !cInfo->SkinningLootId) { @@ -2129,7 +2129,7 @@ void SpellMgr::LoadSpellScriptTarget() { for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry(); ++i) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); if (!spellInfo) continue; @@ -2189,7 +2189,7 @@ void SpellMgr::LoadSpellPetAuras() } else { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spell); if (!spellInfo) { sLog.outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell); @@ -2208,7 +2208,7 @@ void SpellMgr::LoadSpellPetAuras() continue; } - SpellEntry const* spellInfo2 = sSpellTemplate.LookupEntry(aura); + SpellEntry const* spellInfo2 = sSpellTemplate.LookupEntry(aura); if (!spellInfo2) { sLog.outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura); @@ -2266,7 +2266,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) } case SPELL_EFFECT_LEARN_SPELL: { - SpellEntry const* spellInfo2 = sSpellTemplate.LookupEntry(spellInfo->EffectTriggerSpell[i]); + SpellEntry const* spellInfo2 = sSpellTemplate.LookupEntry(spellInfo->EffectTriggerSpell[i]); if (!IsSpellValid(spellInfo2, pl, msg)) { if (msg) @@ -2344,7 +2344,7 @@ void SpellMgr::LoadSpellAreas() spellArea.gender = Gender(fields[8].GetUInt8()); spellArea.autocast = fields[9].GetBool(); - if (!sSpellTemplate.LookupEntry(spell)) + if (!sSpellTemplate.LookupEntry(spell)) { sLog.outErrorDb("Spell %u listed in `spell_area` does not exist", spell); continue; @@ -2386,7 +2386,7 @@ void SpellMgr::LoadSpellAreas() continue; } - if (spellArea.conditionId && !sConditionStorage.LookupEntry(spellArea.conditionId)) + if (spellArea.conditionId && !sConditionStorage.LookupEntry(spellArea.conditionId)) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong conditionId (%u) requirement", spell, spellArea.conditionId); continue; @@ -2429,7 +2429,7 @@ void SpellMgr::LoadSpellAreas() if (spellArea.auraSpell) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(abs(spellArea.auraSpell)); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(abs(spellArea.auraSpell)); if (!spellInfo) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell)); @@ -2770,7 +2770,7 @@ void SpellMgr::CheckUsedSpells(char const* table) const { ++countSpells; - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spell); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spell); if (!spellEntry) { sLog.outError("Spell %u '%s' not exist but used in %s.", spell, name.c_str(), code.c_str()); @@ -2856,7 +2856,7 @@ void SpellMgr::CheckUsedSpells(char const* table) const bool found = false; for (uint32 spellId = 1; spellId < sSpellTemplate.GetMaxEntry(); ++spellId) { - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellId); if (!spellEntry) continue; @@ -3230,7 +3230,7 @@ void SpellMgr::LoadSpellAffects() uint32 entry = fields[0].GetUInt32(); uint8 effectId = fields[1].GetUInt8(); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(entry); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(entry); if (!spellInfo) { @@ -3293,7 +3293,7 @@ void SpellMgr::LoadSpellAffects() for (uint32 id = 0; id < sSpellTemplate.GetMaxEntry(); ++id) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(id); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(id); if (!spellInfo) continue; diff --git a/src/game/Spells/SpellMgr.h b/src/game/Spells/SpellMgr.h index 58ab33af0d7..d8a592dc76d 100644 --- a/src/game/Spells/SpellMgr.h +++ b/src/game/Spells/SpellMgr.h @@ -306,7 +306,7 @@ inline bool IsPassiveSpell(SpellEntry const* spellInfo) inline bool IsPassiveSpell(uint32 spellId) { - const SpellEntry* entry = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* entry = sSpellTemplate.LookupEntry(spellId); return (entry && IsPassiveSpell(entry)); } @@ -325,7 +325,7 @@ inline bool IsAutocastable(SpellEntry const* spellInfo) inline bool IsAutocastable(uint32 spellId) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return false; return IsAutocastable(spellInfo); @@ -525,7 +525,7 @@ inline bool IsSpellRemovedOnEvade(SpellEntry const* spellInfo) case 37119: // Spirit Particles (Spawn) case 37266: // Disease Cloud case 37411: // Skettis Corrupted Ghosts - case 37497: // Shadowmoon Ghost Invisibility (Ghostrider of Karabor in SMV) + case 37497: // Shadowmoon Ghost Invisibility (Ghostrider of Karabor in SMV) case 37509: // Ghostly Facade case 37816: // Shadowform case 38732: // Fire Shield @@ -1037,7 +1037,7 @@ inline bool IsPositiveEffectTargetMode(const SpellEntry* entry, SpellEffectIndex // Its possible to go infinite cycle with triggered spells. We are interested to peek only at the first layer so far if (!recursive && spellid && (spellid != entry->Id)) { - if (const SpellEntry* triggered = sSpellTemplate.LookupEntry(spellid)) + if (const SpellEntry* triggered = sSpellTemplate.LookupEntry(spellid)) { for (uint32 i = EFFECT_INDEX_0; i < MAX_EFFECT_INDEX; ++i) { @@ -1250,7 +1250,7 @@ inline bool IsPositiveSpellTargetModeForSpecificTarget(uint32 spellId, uint8 eff { if (!spellId) return false; - return IsPositiveSpellTargetModeForSpecificTarget(sSpellTemplate.LookupEntry(spellId), effectMask, caster, target); + return IsPositiveSpellTargetModeForSpecificTarget(sSpellTemplate.LookupEntry(spellId), effectMask, caster, target); } inline bool IsPositiveSpellTargetMode(const SpellEntry* entry, const WorldObject* caster = nullptr, const WorldObject* target = nullptr) @@ -1269,7 +1269,7 @@ inline bool IsPositiveSpellTargetMode(uint32 spellId, const WorldObject* caster, { if (!spellId) return false; - return IsPositiveSpellTargetMode(sSpellTemplate.LookupEntry(spellId), caster, target); + return IsPositiveSpellTargetMode(sSpellTemplate.LookupEntry(spellId), caster, target); } inline bool IsPositiveSpell(const SpellEntry* entry, const WorldObject* caster = nullptr, const WorldObject* target = nullptr) @@ -1301,11 +1301,11 @@ inline bool IsPositiveSpell(uint32 spellId, const WorldObject* caster = nullptr, { if (!spellId) return false; - return IsPositiveSpell(sSpellTemplate.LookupEntry(spellId), caster, target); + return IsPositiveSpell(sSpellTemplate.LookupEntry(spellId), caster, target); } inline void GetChainJumpRange(SpellEntry const* spellInfo, SpellEffectIndex effIdx, float& minSearchRangeCaster, float& maxSearchRangeTarget) -{ +{ const SpellRangeEntry* range = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE) maxSearchRangeTarget = range->maxRange; @@ -1599,7 +1599,7 @@ inline uint32 GetDispellMask(DispelType dispel) inline bool IsAuraAddedBySpell(uint32 auraType, uint32 spellId) { - SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); if (!spellproto) return false; for (int i = 0; i < 3; i++) @@ -2070,7 +2070,7 @@ inline bool IsSimilarExistingAuraStronger(const Unit* caster, uint32 spellid, co { if (!spellid) return false; - return IsSimilarExistingAuraStronger(caster, sSpellTemplate.LookupEntry(spellid), existing); + return IsSimilarExistingAuraStronger(caster, sSpellTemplate.LookupEntry(spellid), existing); } // Diminishing Returns interaction with spells @@ -2244,12 +2244,6 @@ struct SpellTargetPosition float target_Orientation; }; -struct SpellCone -{ - uint32 spellId; - int32 coneAngle; -}; - typedef std::unordered_map SpellTargetPositionMap; // Spell pet auras @@ -2396,7 +2390,7 @@ class SpellMgr SpellAffectMap::const_iterator itr = mSpellAffectMap.find((spellId << 8) + effectId); if (itr != mSpellAffectMap.end()) return ClassFamilyMask(itr->second); - if (SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellId)) + if (SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellId)) return ClassFamilyMask(spellEntry->EffectItemType[effectId]); return ClassFamilyMask(); } diff --git a/src/game/Spells/SpellTargets.cpp b/src/game/Spells/SpellTargets.cpp index 4b492779903..41e80a94f0e 100644 --- a/src/game/Spells/SpellTargets.cpp +++ b/src/game/Spells/SpellTargets.cpp @@ -307,7 +307,7 @@ void SpellTargetMgr::Initialize() { for (uint32 i = 0; i <= sSpellTemplate.GetMaxEntry(); ++i) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); if (!spellInfo) continue; diff --git a/src/game/Spells/UnitAuraProcHandler.cpp b/src/game/Spells/UnitAuraProcHandler.cpp index 4f4257f73f2..e1636e8aa41 100644 --- a/src/game/Spells/UnitAuraProcHandler.cpp +++ b/src/game/Spells/UnitAuraProcHandler.cpp @@ -686,7 +686,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(ProcExecutionData& data, SpellAuraHolder* SpellAuraProcResult Unit::TriggerProccedSpell(Unit* target, std::array& basepoints, uint32 triggeredSpellId, Item* castItem, Aura* triggeredByAura, uint32 cooldown) { - SpellEntry const* triggerEntry = sSpellTemplate.LookupEntry(triggeredSpellId); + SpellEntry const* triggerEntry = sSpellTemplate.LookupEntry(triggeredSpellId); if (!triggerEntry) { @@ -1854,7 +1854,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data) } } - SpellEntry const* windfurySpellEntry = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* windfurySpellEntry = sSpellTemplate.LookupEntry(spellId); if (!windfurySpellEntry) { sLog.outError("Unit::HandleDummyAuraProc: nonexistent spell id: %u (Windfury)", spellId); @@ -2003,7 +2003,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data) } // Remove cooldown (Chain Lightning - have Category Recovery time) - SpellEntry const* procSpellEntry = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* procSpellEntry = sSpellTemplate.LookupEntry(spellId); if (!procSpellEntry) { sLog.outError("Unit::HandleDummyAuraProc: nonexistent spell id: %u (Lightning Bolt and Chain Lightning)", spellId); @@ -2509,7 +2509,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(ProcExecutionData& data return SPELL_AURA_PROC_FAILED; } } - SpellEntry const* originalSpell = sSpellTemplate.LookupEntry(originalSpellId); + SpellEntry const* originalSpell = sSpellTemplate.LookupEntry(originalSpellId); if (!originalSpell) { sLog.outError("Unit::HandleProcTriggerSpellAuraProc: Spell %u unknown but selected as original in Illu", originalSpellId); @@ -2664,7 +2664,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(ProcExecutionData& data } // All ok. Check current trigger spell - SpellEntry const* triggerEntry = sSpellTemplate.LookupEntry(trigger_spell_id); + SpellEntry const* triggerEntry = sSpellTemplate.LookupEntry(trigger_spell_id); if (!triggerEntry) { // Not cast unknown spell diff --git a/src/game/Tools/CharacterDatabaseCleaner.cpp b/src/game/Tools/CharacterDatabaseCleaner.cpp index 93ad6a95195..b094b7e2901 100644 --- a/src/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/game/Tools/CharacterDatabaseCleaner.cpp @@ -101,7 +101,7 @@ void CharacterDatabaseCleaner::CleanCharacterSkills() bool CharacterDatabaseCleaner::SpellCheck(uint32 spell_id) { - return !!sSpellTemplate.LookupEntry(spell_id); + return !!sSpellTemplate.LookupEntry(spell_id); } void CharacterDatabaseCleaner::CleanCharacterSpell() diff --git a/src/game/Trade/TradeHandler.cpp b/src/game/Trade/TradeHandler.cpp index fb126638c0d..6aad533a1ae 100644 --- a/src/game/Trade/TradeHandler.cpp +++ b/src/game/Trade/TradeHandler.cpp @@ -327,7 +327,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) // not accept if spell can't be casted now (cheating) if (uint32 my_spell_id = my_trade->GetSpell()) { - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(my_spell_id); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(my_spell_id); Item* castItem = my_trade->GetSpellCastItem(); if (!spellEntry || !his_trade->GetItem(TRADE_SLOT_NONTRADED) || @@ -362,7 +362,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) // not accept if spell can't be casted now (cheating) if (uint32 his_spell_id = his_trade->GetSpell()) { - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(his_spell_id); + SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(his_spell_id); Item* castItem = his_trade->GetSpellCastItem(); if (!spellEntry || !my_trade->GetItem(TRADE_SLOT_NONTRADED) || diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index 8fb6375f3f9..737289197e6 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -120,50 +120,6 @@ void SQLStorageBase::Free() m_recordCount = 0; } -// ----------------------------------- SQLStorage -------------------------------------------- // - -void SQLStorage::EraseEntry(uint32 id) -{ - m_Index[id] = nullptr; -} - -void SQLStorage::Free() -{ - SQLStorageBase::Free(); - delete[] m_Index; - m_Index = nullptr; -} - -void SQLStorage::Load(bool error_at_empty /*= true*/) -{ - SQLStorageLoader loader; - loader.Load(*this, error_at_empty); -} - -SQLStorage::SQLStorage(const char* fmt, const char* _entry_field, const char* sqlname) -{ - Initialize(sqlname, _entry_field, fmt, fmt); - m_Index = nullptr; -} - -SQLStorage::SQLStorage(const char* src_fmt, const char* dst_fmt, const char* _entry_field, const char* sqlname) -{ - Initialize(sqlname, _entry_field, src_fmt, dst_fmt); - m_Index = nullptr; -} - -void SQLStorage::prepareToLoad(uint32 maxRecordId, uint32 recordCount, uint32 recordSize) -{ - // Clear (possible) old data and old index array - Free(); - - // Set index array - m_Index = new char* [maxRecordId]; - memset(m_Index, 0, maxRecordId * sizeof(char*)); - - SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); -} - // ----------------------------------- SQLHashStorage ---------------------------------------- // void SQLHashStorage::Load() { diff --git a/src/shared/Database/SQLStorage.h b/src/shared/Database/SQLStorage.h index 3ff15988b9b..7f241b23b9b 100644 --- a/src/shared/Database/SQLStorage.h +++ b/src/shared/Database/SQLStorage.h @@ -98,6 +98,7 @@ class SQLStorageBase char* m_data; }; +template class SQLStorage : public SQLStorageBase { template friend class SQLStorageLoaderBase; @@ -109,12 +110,11 @@ class SQLStorage : public SQLStorageBase ~SQLStorage() { Free(); } - template - T const* LookupEntry(uint32 id) const + ST const* LookupEntry(uint32 id) const { if (id >= GetMaxEntry()) return nullptr; - return reinterpret_cast(m_Index[id]); + return reinterpret_cast(m_Index[id]); } void Load(bool error_at_empty = true); @@ -278,7 +278,8 @@ class SQLStorageLoaderBase void storeValue(char* value, StorageClass& store, char* record, uint32 field_pos, uint32& offset); }; -class SQLStorageLoader : public SQLStorageLoaderBase +template +class SQLStorageLoader : public SQLStorageLoaderBase, SQLStorage> { }; diff --git a/src/shared/Database/SQLStorageImpl.h b/src/shared/Database/SQLStorageImpl.h index c9d4047b233..86fe410e5ed 100644 --- a/src/shared/Database/SQLStorageImpl.h +++ b/src/shared/Database/SQLStorageImpl.h @@ -355,4 +355,54 @@ void SQLStorageLoaderBase::Load(StorageClass& store delete result; } + +// ----------------------------------- SQLStorage -------------------------------------------- // +template +void SQLStorage::EraseEntry(uint32 id) +{ + m_Index[id] = nullptr; +} + +template +void SQLStorage::Free() +{ + SQLStorageBase::Free(); + delete[] m_Index; + m_Index = nullptr; +} + +template +void SQLStorage::Load(bool error_at_empty /*= true*/) +{ + SQLStorageLoader loader; + loader.Load(*this, error_at_empty); +} + +template +SQLStorage::SQLStorage(const char* fmt, const char* _entry_field, const char* sqlname) +{ + Initialize(sqlname, _entry_field, fmt, fmt); + m_Index = nullptr; +} + +template +SQLStorage::SQLStorage(const char* src_fmt, const char* dst_fmt, const char* _entry_field, const char* sqlname) +{ + Initialize(sqlname, _entry_field, src_fmt, dst_fmt); + m_Index = nullptr; +} + +template +void SQLStorage::prepareToLoad(uint32 maxRecordId, uint32 recordCount, uint32 recordSize) +{ + // Clear (possible) old data and old index array + Free(); + + // Set index array + m_Index = new char* [maxRecordId]; + memset(m_Index, 0, maxRecordId * sizeof(char*)); + + SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); +} + #endif From 7f605f2873d029dfbd4930362dff9dbd240879be Mon Sep 17 00:00:00 2001 From: Cyberium Date: Thu, 4 Mar 2021 19:31:06 +0100 Subject: [PATCH 03/28] Reneame SQLStorage::GetRecordCount to GetNumRows Will make it easier to replace dbcstore by sqlstore. --- src/game/Globals/ObjectMgr.cpp | 34 ++++++++++++++++---------------- src/game/Spells/SpellMgr.cpp | 2 +- src/shared/Database/SQLStorage.h | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index 06140549ae3..215275581bc 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -693,7 +693,7 @@ void ObjectMgr::LoadCreatureTemplates() } - sLog.outString(">> Loaded %u creature definitions", sCreatureStorage.GetRecordCount()); + sLog.outString(">> Loaded %u creature definitions", sCreatureStorage.GetNumRows()); sLog.outString(); } @@ -812,7 +812,7 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons ConvertCreatureAddonAuras(const_cast(addon), creatureaddons.GetTableName(), entryName); } - sLog.outString(">> Loaded %u %s", creatureaddons.GetRecordCount(), comment); + sLog.outString(">> Loaded %u %s", creatureaddons.GetNumRows(), comment); } void ObjectMgr::LoadCreatureAddons() @@ -966,7 +966,7 @@ void ObjectMgr::LoadEquipmentTemplates() } } - sLog.outString(">> Loaded %u equipment template", sEquipmentStorage.GetRecordCount()); + sLog.outString(">> Loaded %u equipment template", sEquipmentStorage.GetNumRows()); sLog.outString(); sEquipmentStorageRaw.Load(false); @@ -975,7 +975,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (sEquipmentStorage.LookupEntry(i)) sLog.outErrorDb("Table 'creature_equip_template_raw` have redundant data for ID %u ('creature_equip_template` already have data)", i); - sLog.outString(">> Loaded %u equipment template (deprecated format)", sEquipmentStorageRaw.GetRecordCount()); + sLog.outString(">> Loaded %u equipment template (deprecated format)", sEquipmentStorageRaw.GetNumRows()); sLog.outString(); } @@ -1127,7 +1127,7 @@ void ObjectMgr::LoadCreatureModelInfo() sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m); } - sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.GetRecordCount()); + sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.GetNumRows()); sLog.outString(); } @@ -1269,7 +1269,7 @@ void ObjectMgr::LoadCreatureConditionalSpawn() } } - sLog.outString(">> Loaded %u creature_conditional_spawn entries", sCreatureConditionalSpawnStore.GetRecordCount()); + sLog.outString(">> Loaded %u creature_conditional_spawn entries", sCreatureConditionalSpawnStore.GetNumRows()); sLog.outString(); } @@ -2493,7 +2493,7 @@ void ObjectMgr::LoadItemPrototypes() for (uint32 itr : notFoundOutfit) sLog.outErrorDb("Item (Entry: %u) not exist in `item_template` but referenced in `CharStartOutfit.dbc`", itr); - sLog.outString(">> Loaded %u item prototypes", sItemStorage.GetRecordCount()); + sLog.outString(">> Loaded %u item prototypes", sItemStorage.GetNumRows()); sLog.outString(); } @@ -4737,7 +4737,7 @@ void ObjectMgr::LoadItemTexts() void ObjectMgr::LoadPageTexts() { sPageTextStore.Load(); - sLog.outString(">> Loaded %u page texts", sPageTextStore.GetRecordCount()); + sLog.outString(">> Loaded %u page texts", sPageTextStore.GetNumRows()); sLog.outString(); for (uint32 i = 1; i < sPageTextStore.GetMaxEntry(); ++i) @@ -4977,7 +4977,7 @@ void ObjectMgr::LoadInstanceTemplate() } } - sLog.outString(">> Loaded %u Instance Template definitions", sInstanceTemplate.GetRecordCount()); + sLog.outString(">> Loaded %u Instance Template definitions", sInstanceTemplate.GetNumRows()); sLog.outString(); } @@ -5016,7 +5016,7 @@ void ObjectMgr::LoadWorldTemplate() } } - sLog.outString(">> Loaded %u World Template definitions", sWorldTemplate.GetRecordCount()); + sLog.outString(">> Loaded %u World Template definitions", sWorldTemplate.GetNumRows()); sLog.outString(); } @@ -5060,7 +5060,7 @@ void ObjectMgr::LoadConditions() } } - sLog.outString(">> Loaded %u Condition definitions", sConditionStorage.GetRecordCount()); + sLog.outString(">> Loaded %u Condition definitions", sConditionStorage.GetNumRows()); sLog.outString(); } @@ -6324,7 +6324,7 @@ void ObjectMgr::SetGraveYardLinkTeam(uint32 id, uint32 locKey, Team team) void ObjectMgr::LoadWorldSafeLocs() const { sWorldSafeLocsStore.Load(true); - sLog.outString(">> Loaded %u world safe locs", sWorldSafeLocsStore.GetRecordCount()); + sLog.outString(">> Loaded %u world safe locs", sWorldSafeLocsStore.GetNumRows()); } void ObjectMgr::LoadAreaTriggerTeleports() @@ -7046,7 +7046,7 @@ std::vector ObjectMgr::LoadGameobjectInfo() } } - sLog.outString(">> Loaded %u game object templates", sGOStorage.GetRecordCount()); + sLog.outString(">> Loaded %u game object templates", sGOStorage.GetNumRows()); sLog.outString(); return transportDisplayIds; @@ -7597,11 +7597,11 @@ void ObjectMgr::LoadSpellTemplate() #endif } - sLog.outString(">> Loaded %u spell_template records", sSpellTemplate.GetRecordCount()); + sLog.outString(">> Loaded %u spell_template records", sSpellTemplate.GetNumRows()); sLog.outString(); sSpellCones.Load(); - sLog.outString(">> Loaded %u spell_cone records", sSpellCones.GetRecordCount()); + sLog.outString(">> Loaded %u spell_cone records", sSpellCones.GetNumRows()); sLog.outString(); } @@ -7645,7 +7645,7 @@ void ObjectMgr::LoadFactions() } } - sLog.outString(">> Loaded %u faction_store records", sFactionStore.GetRecordCount()); + sLog.outString(">> Loaded %u faction_store records", sFactionStore.GetNumRows()); sLog.outString(); } @@ -8160,7 +8160,7 @@ void ObjectMgr::LoadGameObjectForQuests() return; } - BarGoLink bar(sGOStorage.GetRecordCount()); + BarGoLink bar(sGOStorage.GetNumRows()); uint32 count = 0; // collect GO entries for GO that must activated diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index a73fbadfae6..dff18c709de 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -2149,7 +2149,7 @@ void SpellMgr::LoadSpellScriptTarget() } } - sLog.outString(">> Loaded %u spell_script_target definitions", sSpellScriptTargetStorage.GetRecordCount()); + sLog.outString(">> Loaded %u spell_script_target definitions", sSpellScriptTargetStorage.GetNumRows()); sLog.outString(); } diff --git a/src/shared/Database/SQLStorage.h b/src/shared/Database/SQLStorage.h index 7f241b23b9b..71d61104a64 100644 --- a/src/shared/Database/SQLStorage.h +++ b/src/shared/Database/SQLStorage.h @@ -37,7 +37,7 @@ class SQLStorageBase const char* GetSrcFormat() const { return m_src_format; }; uint32 GetMaxEntry() const { return m_maxEntry; }; - uint32 GetRecordCount() const { return m_recordCount; }; + uint32 GetNumRows() const { return m_recordCount; }; template class SQLSIterator From 3388c8e5ce02cc42516c085976dcb04c5d037eae Mon Sep 17 00:00:00 2001 From: Cyberium Date: Thu, 4 Mar 2021 20:39:07 +0100 Subject: [PATCH 04/28] Templatize SQLHashStorage and SQLMultiStorage --- src/game/Chat/Level3.cpp | 3 +- src/game/DBScripts/ScriptMgr.cpp | 2 +- src/game/Entities/GameObject.cpp | 4 +- src/game/Entities/GameObject.h | 529 -------------------------- src/game/Entities/Player.cpp | 6 +- src/game/Globals/ObjectMgr.cpp | 26 +- src/game/Grids/GridNotifiersImpl.h | 4 +- src/game/Loot/LootMgr.cpp | 2 +- src/game/Maps/TransportMgr.cpp | 2 +- src/game/Server/DBCStructure.h | 542 +++++++++++++++++++++++++++ src/game/Server/SQLStorages.cpp | 4 +- src/game/Server/SQLStorages.h | 4 +- src/game/Spells/Spell.cpp | 24 +- src/game/Spells/Spell.h | 2 +- src/game/Spells/SpellMgr.cpp | 6 +- src/game/Spells/SpellMgr.h | 11 - src/game/Spells/SpellTargets.cpp | 6 +- src/shared/Database/SQLStorage.cpp | 175 --------- src/shared/Database/SQLStorage.h | 36 +- src/shared/Database/SQLStorageImpl.h | 194 ++++++++++ 20 files changed, 801 insertions(+), 781 deletions(-) diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp index b8a27923e0b..dd60bf628fa 100644 --- a/src/game/Chat/Level3.cpp +++ b/src/game/Chat/Level3.cpp @@ -57,6 +57,7 @@ #include "Loot/LootMgr.h" #include "World/WorldState.h" #include "Arena/ArenaTeam.h" +#include "Database/SQLStorage.h" #ifdef BUILD_AHBOT #include "AuctionHouseBot/AuctionHouseBot.h" @@ -2639,7 +2640,7 @@ bool ChatHandler::HandleLookupObjectCommand(char* args) uint32 counter = 0; - for (SQLStorageBase::SQLSIterator itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) { int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) diff --git a/src/game/DBScripts/ScriptMgr.cpp b/src/game/DBScripts/ScriptMgr.cpp index 7c0d0526e68..f9e219f9220 100644 --- a/src/game/DBScripts/ScriptMgr.cpp +++ b/src/game/DBScripts/ScriptMgr.cpp @@ -2499,7 +2499,7 @@ int32 ScriptMgr::GetRandomRelayDbscriptFromTemplate(uint32 id) void ScriptMgr::CollectPossibleEventIds(std::set& eventIds) { // Load all possible script entries from gameobjects - for (SQLStorageBase::SQLSIterator itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) { switch (itr->type) { diff --git a/src/game/Entities/GameObject.cpp b/src/game/Entities/GameObject.cpp index 7e3aeeb8cdd..b2d6a305704 100644 --- a/src/game/Entities/GameObject.cpp +++ b/src/game/Entities/GameObject.cpp @@ -430,7 +430,7 @@ void GameObject::Update(const uint32 diff) { if (m_respawnTime > 0) valid = false; - else // battlegrounds gameobjects has data2 == 0 && data5 == 3 + else // battlegrounds gameobjects has data2 == 0 && data5 == 3 radius = float(goInfo->trap.cooldown); } } @@ -1160,7 +1160,7 @@ void GameObject::TriggerLinkedGameObject(Unit* target) const if (!trapEntry) return; - GameObjectInfo const* trapInfo = sGOStorage.LookupEntry(trapEntry); + GameObjectInfo const* trapInfo = sGOStorage.LookupEntry(trapEntry); if (!trapInfo || trapInfo->type != GAMEOBJECT_TYPE_TRAP) return; diff --git a/src/game/Entities/GameObject.h b/src/game/Entities/GameObject.h index 595976ff7b4..3f1ab54feb9 100644 --- a/src/game/Entities/GameObject.h +++ b/src/game/Entities/GameObject.h @@ -34,536 +34,7 @@ #pragma pack(push,1) #endif -// from `gameobject_template` -struct GameObjectInfo -{ - uint32 id; - uint32 type; - uint32 displayId; - char* name; - char* IconName; - char* castBarCaption; - uint32 faction; - uint32 flags; - uint32 ExtraFlags; - float size; - union // different GO types have different data field - { - //0 GAMEOBJECT_TYPE_DOOR - struct - { - uint32 startOpen; //0 used client side to determine GO_ACTIVATED means open/closed - uint32 lockId; //1 -> Lock.dbc - uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 - uint32 noDamageImmune; //3 break opening whenever you recieve damage? - uint32 openTextID; //4 can be used to replace castBarCaption? - uint32 closeTextID; //5 - } door; - //1 GAMEOBJECT_TYPE_BUTTON - struct - { - uint32 startOpen; //0 - uint32 lockId; //1 -> Lock.dbc - uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 - uint32 linkedTrapId; //3 - uint32 noDamageImmune; //4 isBattlegroundObject - uint32 large; //5 - uint32 openTextID; //6 can be used to replace castBarCaption? - uint32 closeTextID; //7 - uint32 losOK; //8 - } button; - //2 GAMEOBJECT_TYPE_QUESTGIVER - struct - { - uint32 lockId; //0 -> Lock.dbc - uint32 questList; //1 - uint32 pageMaterial; //2 - uint32 gossipID; //3 - uint32 customAnim; //4 - uint32 noDamageImmune; //5 - int32 openTextID; //6 can be used to replace castBarCaption? - uint32 losOK; //7 - uint32 allowMounted; //8 - uint32 large; //9 - } questgiver; - //3 GAMEOBJECT_TYPE_CHEST - struct - { - uint32 lockId; //0 -> Lock.dbc - uint32 lootId; //1 - uint32 chestRestockTime; //2 - uint32 consumable; //3 - uint32 minSuccessOpens; //4 - uint32 maxSuccessOpens; //5 - int32 eventId; //6 lootedEvent - uint32 linkedTrapId; //7 - uint32 questId; //8 not used currently but store quest required for GO activation for player - uint32 level; //9 - uint32 losOK; //10 - uint32 leaveLoot; //11 - uint32 notInCombat; //12 - uint32 logLoot; //13 - uint32 openTextID; //14 can be used to replace castBarCaption? - uint32 groupLootRules; //15 - } chest; - //4 GAMEOBJECT_TYPE_BINDER - empty - //5 GAMEOBJECT_TYPE_GENERIC - struct - { - uint32 floatingTooltip; //0 - uint32 highlight; //1 - uint32 serverOnly; //2 - uint32 large; //3 - uint32 floatOnWater; //4 - uint32 questID; //5 - } _generic; - //6 GAMEOBJECT_TYPE_TRAP - struct - { - uint32 lockId; //0 -> Lock.dbc - uint32 level; //1 - uint32 diameter; //2 radius for trap activation - uint32 spellId; //3 - uint32 charges; //4 need respawn (if > 0) - uint32 cooldown; //5 time in secs - int32 autoCloseTime; //6 - uint32 startDelay; //7 - uint32 serverOnly; //8 - uint32 stealthed; //9 - uint32 large; //10 - uint32 invisible; //11 - uint32 openTextID; //12 can be used to replace castBarCaption? - uint32 closeTextID; //13 - } trap; - //7 GAMEOBJECT_TYPE_CHAIR - struct - { - uint32 slots; //0 - uint32 height; //1 - uint32 onlyCreatorUse; //2 - } chair; - //8 GAMEOBJECT_TYPE_SPELL_FOCUS - struct - { - uint32 focusId; //0 - uint32 dist; //1 - uint32 linkedTrapId; //2 - uint32 serverOnly; //3 - uint32 questID; //4 - uint32 large; //5 - } spellFocus; - //9 GAMEOBJECT_TYPE_TEXT - struct - { - uint32 pageID; //0 - uint32 language; //1 - uint32 pageMaterial; //2 - uint32 allowMounted; //3 - } text; - //10 GAMEOBJECT_TYPE_GOOBER - struct - { - uint32 lockId; //0 -> Lock.dbc - int32 questId; //1 - uint32 eventId; //2 - uint32 autoCloseTime; //3 - uint32 customAnim; //4 - uint32 consumable; //5 - int32 cooldown; //6 - uint32 pageId; //7 - uint32 language; //8 - uint32 pageMaterial; //9 - uint32 spellId; //10 - uint32 noDamageImmune; //11 - uint32 linkedTrapId; //12 - uint32 large; //13 - uint32 openTextID; //14 can be used to replace castBarCaption? - uint32 closeTextID; //15 - uint32 isPvPObject; //16 flags used only in battlegrounds - uint32 allowMounted; //17 - uint32 floatingTooltip; //18 - uint32 gossipID; //19 - } goober; - //11 GAMEOBJECT_TYPE_TRANSPORT - struct - { - uint32 pause; //0 - uint32 startOpen; //1 - uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 - } transport; - //12 GAMEOBJECT_TYPE_AREADAMAGE - struct - { - uint32 lockId; //0 - uint32 radius; //1 - uint32 damageMin; //2 - uint32 damageMax; //3 - uint32 damageSchool; //4 - uint32 autoCloseTime; //5 secs till autoclose = autoCloseTime / 0x10000 - uint32 openTextID; //6 - uint32 closeTextID; //7 - } areadamage; - //13 GAMEOBJECT_TYPE_CAMERA - struct - { - uint32 lockId; //0 -> Lock.dbc - uint32 cinematicId; //1 - uint32 eventID; //2 - uint32 openTextID; //3 can be used to replace castBarCaption? - } camera; - //14 GAMEOBJECT_TYPE_MAPOBJECT - empty - //15 GAMEOBJECT_TYPE_MO_TRANSPORT - struct - { - uint32 taxiPathId; //0 - uint32 moveSpeed; //1 - uint32 accelRate; //2 - uint32 startEventID; //3 - uint32 stopEventID; //4 - uint32 transportPhysics; //5 - uint32 mapID; //6 - } moTransport; - //16 GAMEOBJECT_TYPE_DUELFLAG - empty - //17 GAMEOBJECT_TYPE_FISHINGNODE - struct - { - uint32 _data0; //0 - uint32 lootId; //1 - } fishnode; - //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL - struct - { - uint32 reqParticipants; //0 - uint32 spellId; //1 - uint32 animSpell; //2 - uint32 ritualPersistent; //3 - uint32 casterTargetSpell; //4 - uint32 casterTargetSpellTargets; //5 - uint32 castersGrouped; //6 - uint32 ritualNoTargetCheck; //7 - } summoningRitual; - //19 GAMEOBJECT_TYPE_MAILBOX - empty - //20 GAMEOBJECT_TYPE_AUCTIONHOUSE - struct - { - uint32 actionHouseID; //0 - } auctionhouse; - //21 GAMEOBJECT_TYPE_GUARDPOST - struct - { - uint32 creatureID; //0 - uint32 charges; //1 - } guardpost; - //22 GAMEOBJECT_TYPE_SPELLCASTER - struct - { - uint32 spellId; //0 - int32 charges; //1 - uint32 partyOnly; //2 - uint32 allowMounted; //3 Is usable while on mount/vehicle. (0/1) - uint32 large; //4 - uint32 conditionID1; //5 - } spellcaster; - //23 GAMEOBJECT_TYPE_MEETINGSTONE - struct - { - uint32 minLevel; //0 - uint32 maxLevel; //1 - uint32 areaID; //2 - } meetingstone; - //24 GAMEOBJECT_TYPE_FLAGSTAND - struct - { - uint32 lockId; //0 - uint32 pickupSpell; //1 - uint32 radius; //2 - uint32 returnAura; //3 - uint32 returnSpell; //4 - uint32 noDamageImmune; //5 - uint32 openTextID; //6 - uint32 losOK; //7 - } flagstand; - //25 GAMEOBJECT_TYPE_FISHINGHOLE - struct - { - uint32 radius; //0 how close bobber must land for sending loot - uint32 lootId; //1 - uint32 minSuccessOpens; //2 - uint32 maxSuccessOpens; //3 - uint32 lockId; //4 -> Lock.dbc; possibly 1628 for all? - } fishinghole; - //26 GAMEOBJECT_TYPE_FLAGDROP - struct - { - uint32 lockId; //0 - uint32 eventID; //1 - uint32 pickupSpell; //2 - uint32 noDamageImmune; //3 - uint32 openTextID; //4 - } flagdrop; - //27 GAMEOBJECT_TYPE_MINI_GAME - struct - { - uint32 gameType; //0 - } miniGame; - //29 GAMEOBJECT_TYPE_CAPTURE_POINT - struct - { - uint32 radius; //0 - uint32 spell; //1 - uint32 worldState1; //2 - uint32 worldState2; //3 - uint32 winEventID1; //4 - uint32 winEventID2; //5 - uint32 contestedEventID1; //6 - uint32 contestedEventID2; //7 - uint32 progressEventID1; //8 - uint32 progressEventID2; //9 - uint32 neutralEventID1; //10 - uint32 neutralEventID2; //11 - uint32 neutralPercent; //12 - uint32 worldState3; //13 - uint32 minSuperiority; //14 - uint32 maxSuperiority; //15 - uint32 minTime; //16 - uint32 maxTime; //17 - uint32 large; //18 - uint32 highlight; //19 - } capturePoint; - //30 GAMEOBJECT_TYPE_AURA_GENERATOR - struct - { - uint32 startOpen; //0 - uint32 radius; //1 - uint32 auraID1; //2 - uint32 conditionID1; //3 - uint32 auraID2; //4 - uint32 conditionID2; //5 - int32 serverOnly; //6 - } auraGenerator; - //31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY - struct - { - uint32 mapID; //0 - uint32 difficulty; //1 - } dungeonDifficulty; - //32 GAMEOBJECT_TYPE_DO_NOT_USE_YET - struct - { - uint32 mapID; //0 - uint32 difficulty; //1 - } doNotUseYet; - //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING - struct - { - uint32 dmgPctState1; //0 - uint32 dmgPctState2; //1 - uint32 state1Name; //2 - uint32 state2Name; //3 - } destructibleBuilding; - //34 GAMEOBJECT_TYPE_GUILDBANK - empty - - // not use for specific field access (only for output with loop by all filed), also this determinate max union size - struct - { - uint32 data[24]; - } raw; - }; - - union - { - //6 GAMEOBJECT_TYPE_TRAP - struct - { - uint32 triggerOn; - } trapCustom; - - //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL - struct - { - uint32 delay; - } summoningRitualCustom; - - struct - { - uint32 data[1]; - } rawCustom; - }; - - uint32 MinMoneyLoot; - uint32 MaxMoneyLoot; - uint32 ScriptId; - - // helpers - bool IsDespawnAtAction() const - { - switch (type) - { - case GAMEOBJECT_TYPE_CHEST: return chest.consumable != 0; - case GAMEOBJECT_TYPE_GOOBER: return goober.consumable != 0; - default: return false; - } - } - - bool IsUsableMounted() const - { - switch (type) - { - case GAMEOBJECT_TYPE_MAILBOX: return true; - case GAMEOBJECT_TYPE_BARBER_CHAIR: return false; - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.allowMounted != 0; - case GAMEOBJECT_TYPE_TEXT: return text.allowMounted != 0; - case GAMEOBJECT_TYPE_GOOBER: return goober.allowMounted != 0; - case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.allowMounted != 0; - default: return false; - } - } - - uint32 GetLockId() const - { - switch (type) - { - case GAMEOBJECT_TYPE_DOOR: return door.lockId; - case GAMEOBJECT_TYPE_BUTTON: return button.lockId; - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.lockId; - case GAMEOBJECT_TYPE_CHEST: return chest.lockId; - case GAMEOBJECT_TYPE_TRAP: return trap.lockId; - case GAMEOBJECT_TYPE_GOOBER: return goober.lockId; - case GAMEOBJECT_TYPE_AREADAMAGE: return areadamage.lockId; - case GAMEOBJECT_TYPE_CAMERA: return camera.lockId; - case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.lockId; - case GAMEOBJECT_TYPE_FISHINGHOLE: return fishinghole.lockId; - case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.lockId; - default: return 0; - } - } - - bool GetDespawnPossibility() const // despawn at targeting of cast? - { - switch (type) - { - case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune != 0; - case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune != 0; - case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune != 0; - case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.noDamageImmune != 0; - case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.noDamageImmune != 0; - default: return true; - } - } - - bool CannotBeUsedUnderImmunity() const // Cannot be used/activated/looted by players under immunity effects (example: Divine Shield) - { - switch (type) - { - case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune != 0; - case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune != 0; - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.noDamageImmune != 0; - case GAMEOBJECT_TYPE_CHEST: return true; // All chests cannot be opened while immune on 3.3.5a - case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune != 0; - case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.noDamageImmune != 0; - case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.noDamageImmune != 0; - default: return false; - } - } - - uint32 GetCharges() const // despawn at uses amount - { - switch (type) - { - case GAMEOBJECT_TYPE_TRAP: return trap.charges; - case GAMEOBJECT_TYPE_GUARDPOST: return guardpost.charges; - case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.charges; - default: return 0; - } - } - - uint32 GetCooldown() const // not triggering at detection target or use until coolodwn expire - { - switch (type) - { - case GAMEOBJECT_TYPE_TRAP: return trap.cooldown; - case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown; - default: return 0; - } - } - uint32 GetLinkedGameObjectEntry() const - { - switch (type) - { - case GAMEOBJECT_TYPE_BUTTON: return button.linkedTrapId; - case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrapId; - case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrapId; - case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrapId; - default: return 0; - } - } - - uint32 GetAutoCloseTime() const - { - uint32 autoCloseTime = 0; - switch (type) - { - case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoCloseTime; break; - case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoCloseTime; break; - case GAMEOBJECT_TYPE_TRAP: autoCloseTime = trap.autoCloseTime; break; - case GAMEOBJECT_TYPE_GOOBER: autoCloseTime = goober.autoCloseTime; break; - case GAMEOBJECT_TYPE_TRANSPORT: autoCloseTime = transport.autoCloseTime; break; - case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areadamage.autoCloseTime; break; - default: break; - } - return autoCloseTime / 0x10000; - } - - uint32 GetLootId() const - { - switch (type) - { - case GAMEOBJECT_TYPE_CHEST: return chest.lootId; - case GAMEOBJECT_TYPE_FISHINGHOLE: return fishinghole.lootId; - default: return 0; - } - } - - uint32 GetGossipMenuId() const - { - switch (type) - { - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.gossipID; - case GAMEOBJECT_TYPE_GOOBER: return goober.gossipID; - default: return 0; - } - } - - bool IsLargeGameObject() const - { - switch (type) - { - case GAMEOBJECT_TYPE_BUTTON: return button.large != 0; - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.large != 0; - case GAMEOBJECT_TYPE_GENERIC: return _generic.large != 0; - case GAMEOBJECT_TYPE_TRAP: return trap.large != 0; - case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.large != 0; - case GAMEOBJECT_TYPE_GOOBER: return goober.large != 0; - case GAMEOBJECT_TYPE_TRANSPORT: return true; - case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.large != 0; - case GAMEOBJECT_TYPE_CAPTURE_POINT: return capturePoint.large != 0; - default: return false; - } - } - - bool IsServerOnly() const - { - switch (type) - { - case GAMEOBJECT_TYPE_GENERIC: return _generic.serverOnly; - case GAMEOBJECT_TYPE_TRAP: return trap.serverOnly; - case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.serverOnly; - case GAMEOBJECT_TYPE_AURA_GENERATOR: return auraGenerator.serverOnly; - default: return false; - } - } -}; // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform #if defined( __GNUC__ ) diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index 71b03e42efe..930894d1429 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -4247,7 +4247,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe if (has_items) { // data needs to be at first place for Item::LoadFromDB - // 0 1 2 3 4 5 6 7 8 9 10 11 12 + // 0 1 2 3 4 5 6 7 8 9 10 11 12 QueryResult* resultItems = CharacterDatabase.PQuery("SELECT itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, itemTextId, item_guid, item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail_id); if (resultItems) { @@ -8308,7 +8308,7 @@ uint8 Player::FindEquipSlot(ItemPrototype const* proto, uint32 slot, bool swap) // in both scenarios, a swap is required if (currentSlot == EQUIPMENT_SLOT_OFFHAND && (IsTwoHandUsed() || proto->InventoryType == INVTYPE_2HWEAPON)) continue; - + return currentSlot; } } @@ -15150,7 +15150,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) ObjectGuid guid(HIGHGUID_MO_TRANSPORT, transGUID); if (GameObjectData const* data = sObjectMgr.GetGOData(transGUID)) { - GameObjectInfo const* transportInfo = sGOStorage.LookupEntry(data->id); + GameObjectInfo const* transportInfo = sGOStorage.LookupEntry(data->id); if (transportInfo->type == GAMEOBJECT_TYPE_TRANSPORT) guid = ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, transGUID); } diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index 215275581bc..576dbaa8aca 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -2541,7 +2541,7 @@ void ObjectMgr::LoadItemRequiredTarget() { if (Spell.SpellTrigger == ITEM_SPELLTRIGGER_ON_USE) { - SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(pSpellInfo->Id); + auto bounds = sSpellScriptTargetStorage.getBounds(pSpellInfo->Id); if (bounds.first != bounds.second) break; @@ -3503,7 +3503,7 @@ CreatureTemplateSpells const* ObjectMgr::GetCreatureTemplateSpellSet(uint32 entr /* ********************************************************************************************* */ /* * Static Wrappers */ /* ********************************************************************************************* */ -GameObjectInfo const* ObjectMgr::GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry(id); } +GameObjectInfo const* ObjectMgr::GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry(id); } Player* ObjectMgr::GetPlayer(const char* name) { return ObjectAccessor::FindPlayerByName(name); } Player* ObjectMgr::GetPlayer(ObjectGuid guid, bool inWorld /*=true*/) { return ObjectAccessor::FindPlayer(guid, inWorld); } CreatureInfo const* ObjectMgr::GetCreatureTemplate(uint32 id) { return sCreatureStorage.LookupEntry(id); } @@ -4147,7 +4147,7 @@ void ObjectMgr::LoadQuests() for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { int32 id = qinfo->ReqCreatureOrGOId[j]; - if (id < 0 && !sGOStorage.LookupEntry(-id)) + if (id < 0 && !sGOStorage.LookupEntry(-id)) { sLog.outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but gameobject %u does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, uint32(-id)); @@ -5318,7 +5318,7 @@ void ObjectMgr::LoadQuestgiverGreeting() } break; case QUESTGIVER_GAMEOBJECT: - if (!sGOStorage.LookupEntry(entry)) + if (!sGOStorage.LookupEntry(entry)) { sLog.outErrorEventAI("Table questgiver_greeting uses nonexistent gameobject entry %u. Skipping.", entry); continue; @@ -5386,7 +5386,7 @@ void ObjectMgr::LoadQuestgiverGreetingLocales() } break; case QUESTGIVER_GAMEOBJECT: - if (!sGOStorage.LookupEntry(entry)) + if (!sGOStorage.LookupEntry(entry)) { sLog.outErrorEventAI("Table questgiver_greeting uses nonexistent gameobject entry %u. Skipping.", entry); continue; @@ -6788,7 +6788,7 @@ void ObjectMgr::LoadGameObjectLocales() sLog.outString(); } -struct SQLGameObjectLoader : public SQLStorageLoaderBase +struct SQLGameObjectLoader : public SQLStorageLoaderBase> { template void convert_from_str(uint32 /*field_pos*/, char const* src, D& dst) @@ -6808,7 +6808,7 @@ inline void CheckGOLockId(GameObjectInfo const* goInfo, uint32 dataN, uint32 N) inline void CheckGOLinkedTrapId(GameObjectInfo const* goInfo, uint32 dataN, uint32 N) { - if (GameObjectInfo const* trapInfo = sGOStorage.LookupEntry(dataN)) + if (GameObjectInfo const* trapInfo = sGOStorage.LookupEntry(dataN)) { if (trapInfo->type != GAMEOBJECT_TYPE_TRAP) sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.", @@ -6881,7 +6881,7 @@ std::vector ObjectMgr::LoadGameobjectInfo() std::vector transportDisplayIds; // some checks - for (SQLStorageBase::SQLSIterator itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) { GameObjectInfo const* goInfo = itr.getValue(); @@ -7545,7 +7545,7 @@ void ObjectMgr::LoadPointsOfInterest() static char SERVER_SIDE_SPELL[] = "CMaNGOS server-side spell"; -struct SQLSpellLoader : public SQLStorageLoaderBase +struct SQLSpellLoader : public SQLStorageLoaderBase> { template void default_fill(uint32 field_pos, S src, D& dst) @@ -7575,7 +7575,7 @@ void ObjectMgr::LoadSpellTemplate() sSpellTemplate.Load(); /* TODO add validation for spell_dbc */ - for (SQLStorageBase::SQLSIterator itr = sSpellTemplate.getDataBegin(); itr < sSpellTemplate.getDataEnd(); ++itr) + for (auto itr = sSpellTemplate.getDataBegin(); itr < sSpellTemplate.getDataEnd(); ++itr) { if (!sSpellTemplate.LookupEntry(itr->Id)) { @@ -8164,7 +8164,7 @@ void ObjectMgr::LoadGameObjectForQuests() uint32 count = 0; // collect GO entries for GO that must activated - for (SQLStorageBase::SQLSIterator itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) { bar.step(); switch (itr->type) @@ -9183,7 +9183,7 @@ void ObjectMgr::LoadGossipMenu(std::set& gossipScriptSet) if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) { - for (SQLStorageBase::SQLSIterator itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) if (uint32 menuid = itr->GetGossipMenuId()) if (m_mGossipMenusMap.find(menuid) == m_mGossipMenusMap.end()) sLog.outErrorDb("Gameobject (Entry: %u) has gossip_menu_id = %u for nonexistent menu", itr->id, menuid); @@ -9220,7 +9220,7 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) if (itr->first) menu_ids.insert(itr->first); - for (SQLStorageBase::SQLSIterator itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) if (uint32 menuid = itr->GetGossipMenuId()) menu_ids.erase(menuid); } diff --git a/src/game/Grids/GridNotifiersImpl.h b/src/game/Grids/GridNotifiersImpl.h index 224c63dea3d..f67b737701b 100644 --- a/src/game/Grids/GridNotifiersImpl.h +++ b/src/game/Grids/GridNotifiersImpl.h @@ -204,11 +204,11 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) SpellEffectIndex eff_index = i_dynobject.GetEffIndex(); Unit* caster = i_dynobject.GetCaster(); - SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(spellInfo->Id); + auto bounds = sSpellScriptTargetStorage.getBounds(spellInfo->Id); if (bounds.first != bounds.second) { bool found = false; - for (SQLMultiStorage::SQLMultiSIterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) + for (auto i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) { if (i_spellST->CanNotHitWithSpellEffect(eff_index)) continue; diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index f0fefeeee07..af3825e094a 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -2704,7 +2704,7 @@ void LoadLootTemplates_Gameobject() LootTemplates_Gameobject.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (SQLStorageBase::SQLSIterator itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) { if (uint32 lootid = itr->GetLootId()) { diff --git a/src/game/Maps/TransportMgr.cpp b/src/game/Maps/TransportMgr.cpp index cd7c9909090..1dd649de118 100644 --- a/src/game/Maps/TransportMgr.cpp +++ b/src/game/Maps/TransportMgr.cpp @@ -45,7 +45,7 @@ void TransportMgr::LoadTransportTemplates() { for (uint32 entry = 1; entry <= sGOStorage.GetMaxEntry(); ++entry) { - auto data = sGOStorage.LookupEntry(entry); + auto data = sGOStorage.LookupEntry(entry); if (data && data->type == GAMEOBJECT_TYPE_MO_TRANSPORT) { TransportTemplate& transportTemplate = m_transportTemplates[entry]; diff --git a/src/game/Server/DBCStructure.h b/src/game/Server/DBCStructure.h index 971e5c88a27..590e722d09b 100644 --- a/src/game/Server/DBCStructure.h +++ b/src/game/Server/DBCStructure.h @@ -1589,6 +1589,548 @@ struct WorldSafeLocsEntry char* name; }; +// from `gameobject_template` +struct GameObjectInfo +{ + uint32 id; + uint32 type; + uint32 displayId; + char* name; + char* IconName; + char* castBarCaption; + uint32 faction; + uint32 flags; + uint32 ExtraFlags; + float size; + union // different GO types have different data field + { + //0 GAMEOBJECT_TYPE_DOOR + struct + { + uint32 startOpen; //0 used client side to determine GO_ACTIVATED means open/closed + uint32 lockId; //1 -> Lock.dbc + uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 + uint32 noDamageImmune; //3 break opening whenever you recieve damage? + uint32 openTextID; //4 can be used to replace castBarCaption? + uint32 closeTextID; //5 + } door; + //1 GAMEOBJECT_TYPE_BUTTON + struct + { + uint32 startOpen; //0 + uint32 lockId; //1 -> Lock.dbc + uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 + uint32 linkedTrapId; //3 + uint32 noDamageImmune; //4 isBattlegroundObject + uint32 large; //5 + uint32 openTextID; //6 can be used to replace castBarCaption? + uint32 closeTextID; //7 + uint32 losOK; //8 + } button; + //2 GAMEOBJECT_TYPE_QUESTGIVER + struct + { + uint32 lockId; //0 -> Lock.dbc + uint32 questList; //1 + uint32 pageMaterial; //2 + uint32 gossipID; //3 + uint32 customAnim; //4 + uint32 noDamageImmune; //5 + int32 openTextID; //6 can be used to replace castBarCaption? + uint32 losOK; //7 + uint32 allowMounted; //8 + uint32 large; //9 + } questgiver; + //3 GAMEOBJECT_TYPE_CHEST + struct + { + uint32 lockId; //0 -> Lock.dbc + uint32 lootId; //1 + uint32 chestRestockTime; //2 + uint32 consumable; //3 + uint32 minSuccessOpens; //4 + uint32 maxSuccessOpens; //5 + int32 eventId; //6 lootedEvent + uint32 linkedTrapId; //7 + uint32 questId; //8 not used currently but store quest required for GO activation for player + uint32 level; //9 + uint32 losOK; //10 + uint32 leaveLoot; //11 + uint32 notInCombat; //12 + uint32 logLoot; //13 + uint32 openTextID; //14 can be used to replace castBarCaption? + uint32 groupLootRules; //15 + } chest; + //4 GAMEOBJECT_TYPE_BINDER - empty + //5 GAMEOBJECT_TYPE_GENERIC + struct + { + uint32 floatingTooltip; //0 + uint32 highlight; //1 + uint32 serverOnly; //2 + uint32 large; //3 + uint32 floatOnWater; //4 + uint32 questID; //5 + } _generic; + //6 GAMEOBJECT_TYPE_TRAP + struct + { + uint32 lockId; //0 -> Lock.dbc + uint32 level; //1 + uint32 diameter; //2 radius for trap activation + uint32 spellId; //3 + uint32 charges; //4 need respawn (if > 0) + uint32 cooldown; //5 time in secs + int32 autoCloseTime; //6 + uint32 startDelay; //7 + uint32 serverOnly; //8 + uint32 stealthed; //9 + uint32 large; //10 + uint32 invisible; //11 + uint32 openTextID; //12 can be used to replace castBarCaption? + uint32 closeTextID; //13 + } trap; + //7 GAMEOBJECT_TYPE_CHAIR + struct + { + uint32 slots; //0 + uint32 height; //1 + uint32 onlyCreatorUse; //2 + } chair; + //8 GAMEOBJECT_TYPE_SPELL_FOCUS + struct + { + uint32 focusId; //0 + uint32 dist; //1 + uint32 linkedTrapId; //2 + uint32 serverOnly; //3 + uint32 questID; //4 + uint32 large; //5 + } spellFocus; + //9 GAMEOBJECT_TYPE_TEXT + struct + { + uint32 pageID; //0 + uint32 language; //1 + uint32 pageMaterial; //2 + uint32 allowMounted; //3 + } text; + //10 GAMEOBJECT_TYPE_GOOBER + struct + { + uint32 lockId; //0 -> Lock.dbc + int32 questId; //1 + uint32 eventId; //2 + uint32 autoCloseTime; //3 + uint32 customAnim; //4 + uint32 consumable; //5 + int32 cooldown; //6 + uint32 pageId; //7 + uint32 language; //8 + uint32 pageMaterial; //9 + uint32 spellId; //10 + uint32 noDamageImmune; //11 + uint32 linkedTrapId; //12 + uint32 large; //13 + uint32 openTextID; //14 can be used to replace castBarCaption? + uint32 closeTextID; //15 + uint32 isPvPObject; //16 flags used only in battlegrounds + uint32 allowMounted; //17 + uint32 floatingTooltip; //18 + uint32 gossipID; //19 + } goober; + //11 GAMEOBJECT_TYPE_TRANSPORT + struct + { + uint32 pause; //0 + uint32 startOpen; //1 + uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 + } transport; + //12 GAMEOBJECT_TYPE_AREADAMAGE + struct + { + uint32 lockId; //0 + uint32 radius; //1 + uint32 damageMin; //2 + uint32 damageMax; //3 + uint32 damageSchool; //4 + uint32 autoCloseTime; //5 secs till autoclose = autoCloseTime / 0x10000 + uint32 openTextID; //6 + uint32 closeTextID; //7 + } areadamage; + //13 GAMEOBJECT_TYPE_CAMERA + struct + { + uint32 lockId; //0 -> Lock.dbc + uint32 cinematicId; //1 + uint32 eventID; //2 + uint32 openTextID; //3 can be used to replace castBarCaption? + } camera; + //14 GAMEOBJECT_TYPE_MAPOBJECT - empty + //15 GAMEOBJECT_TYPE_MO_TRANSPORT + struct + { + uint32 taxiPathId; //0 + uint32 moveSpeed; //1 + uint32 accelRate; //2 + uint32 startEventID; //3 + uint32 stopEventID; //4 + uint32 transportPhysics; //5 + uint32 mapID; //6 + } moTransport; + //16 GAMEOBJECT_TYPE_DUELFLAG - empty + //17 GAMEOBJECT_TYPE_FISHINGNODE + struct + { + uint32 _data0; //0 + uint32 lootId; //1 + } fishnode; + //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL + struct + { + uint32 reqParticipants; //0 + uint32 spellId; //1 + uint32 animSpell; //2 + uint32 ritualPersistent; //3 + uint32 casterTargetSpell; //4 + uint32 casterTargetSpellTargets; //5 + uint32 castersGrouped; //6 + uint32 ritualNoTargetCheck; //7 + } summoningRitual; + //19 GAMEOBJECT_TYPE_MAILBOX - empty + //20 GAMEOBJECT_TYPE_AUCTIONHOUSE + struct + { + uint32 actionHouseID; //0 + } auctionhouse; + //21 GAMEOBJECT_TYPE_GUARDPOST + struct + { + uint32 creatureID; //0 + uint32 charges; //1 + } guardpost; + //22 GAMEOBJECT_TYPE_SPELLCASTER + struct + { + uint32 spellId; //0 + int32 charges; //1 + uint32 partyOnly; //2 + uint32 allowMounted; //3 Is usable while on mount/vehicle. (0/1) + uint32 large; //4 + uint32 conditionID1; //5 + } spellcaster; + //23 GAMEOBJECT_TYPE_MEETINGSTONE + struct + { + uint32 minLevel; //0 + uint32 maxLevel; //1 + uint32 areaID; //2 + } meetingstone; + //24 GAMEOBJECT_TYPE_FLAGSTAND + struct + { + uint32 lockId; //0 + uint32 pickupSpell; //1 + uint32 radius; //2 + uint32 returnAura; //3 + uint32 returnSpell; //4 + uint32 noDamageImmune; //5 + uint32 openTextID; //6 + uint32 losOK; //7 + } flagstand; + //25 GAMEOBJECT_TYPE_FISHINGHOLE + struct + { + uint32 radius; //0 how close bobber must land for sending loot + uint32 lootId; //1 + uint32 minSuccessOpens; //2 + uint32 maxSuccessOpens; //3 + uint32 lockId; //4 -> Lock.dbc; possibly 1628 for all? + } fishinghole; + //26 GAMEOBJECT_TYPE_FLAGDROP + struct + { + uint32 lockId; //0 + uint32 eventID; //1 + uint32 pickupSpell; //2 + uint32 noDamageImmune; //3 + uint32 openTextID; //4 + } flagdrop; + //27 GAMEOBJECT_TYPE_MINI_GAME + struct + { + uint32 gameType; //0 + } miniGame; + //29 GAMEOBJECT_TYPE_CAPTURE_POINT + struct + { + uint32 radius; //0 + uint32 spell; //1 + uint32 worldState1; //2 + uint32 worldState2; //3 + uint32 winEventID1; //4 + uint32 winEventID2; //5 + uint32 contestedEventID1; //6 + uint32 contestedEventID2; //7 + uint32 progressEventID1; //8 + uint32 progressEventID2; //9 + uint32 neutralEventID1; //10 + uint32 neutralEventID2; //11 + uint32 neutralPercent; //12 + uint32 worldState3; //13 + uint32 minSuperiority; //14 + uint32 maxSuperiority; //15 + uint32 minTime; //16 + uint32 maxTime; //17 + uint32 large; //18 + uint32 highlight; //19 + } capturePoint; + //30 GAMEOBJECT_TYPE_AURA_GENERATOR + struct + { + uint32 startOpen; //0 + uint32 radius; //1 + uint32 auraID1; //2 + uint32 conditionID1; //3 + uint32 auraID2; //4 + uint32 conditionID2; //5 + int32 serverOnly; //6 + } auraGenerator; + //31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY + struct + { + uint32 mapID; //0 + uint32 difficulty; //1 + } dungeonDifficulty; + //32 GAMEOBJECT_TYPE_DO_NOT_USE_YET + struct + { + uint32 mapID; //0 + uint32 difficulty; //1 + } doNotUseYet; + //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING + struct + { + uint32 dmgPctState1; //0 + uint32 dmgPctState2; //1 + uint32 state1Name; //2 + uint32 state2Name; //3 + } destructibleBuilding; + //34 GAMEOBJECT_TYPE_GUILDBANK - empty + + // not use for specific field access (only for output with loop by all filed), also this determinate max union size + struct + { + uint32 data[24]; + } raw; + }; + + union + { + //6 GAMEOBJECT_TYPE_TRAP + struct + { + uint32 triggerOn; + } trapCustom; + + //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL + struct + { + uint32 delay; + } summoningRitualCustom; + + struct + { + uint32 data[1]; + } rawCustom; + }; + + uint32 MinMoneyLoot; + uint32 MaxMoneyLoot; + uint32 ScriptId; + + // helpers + bool IsDespawnAtAction() const + { + switch (type) + { + case GAMEOBJECT_TYPE_CHEST: return chest.consumable != 0; + case GAMEOBJECT_TYPE_GOOBER: return goober.consumable != 0; + default: return false; + } + } + + bool IsUsableMounted() const + { + switch (type) + { + case GAMEOBJECT_TYPE_MAILBOX: return true; + case GAMEOBJECT_TYPE_BARBER_CHAIR: return false; + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.allowMounted != 0; + case GAMEOBJECT_TYPE_TEXT: return text.allowMounted != 0; + case GAMEOBJECT_TYPE_GOOBER: return goober.allowMounted != 0; + case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.allowMounted != 0; + default: return false; + } + } + + uint32 GetLockId() const + { + switch (type) + { + case GAMEOBJECT_TYPE_DOOR: return door.lockId; + case GAMEOBJECT_TYPE_BUTTON: return button.lockId; + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.lockId; + case GAMEOBJECT_TYPE_CHEST: return chest.lockId; + case GAMEOBJECT_TYPE_TRAP: return trap.lockId; + case GAMEOBJECT_TYPE_GOOBER: return goober.lockId; + case GAMEOBJECT_TYPE_AREADAMAGE: return areadamage.lockId; + case GAMEOBJECT_TYPE_CAMERA: return camera.lockId; + case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.lockId; + case GAMEOBJECT_TYPE_FISHINGHOLE: return fishinghole.lockId; + case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.lockId; + default: return 0; + } + } + + bool GetDespawnPossibility() const // despawn at targeting of cast? + { + switch (type) + { + case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune != 0; + case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune != 0; + case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune != 0; + case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.noDamageImmune != 0; + case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.noDamageImmune != 0; + default: return true; + } + } + + bool CannotBeUsedUnderImmunity() const // Cannot be used/activated/looted by players under immunity effects (example: Divine Shield) + { + switch (type) + { + case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune != 0; + case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune != 0; + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.noDamageImmune != 0; + case GAMEOBJECT_TYPE_CHEST: return true; // All chests cannot be opened while immune on 3.3.5a + case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune != 0; + case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.noDamageImmune != 0; + case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.noDamageImmune != 0; + default: return false; + } + } + + uint32 GetCharges() const // despawn at uses amount + { + switch (type) + { + case GAMEOBJECT_TYPE_TRAP: return trap.charges; + case GAMEOBJECT_TYPE_GUARDPOST: return guardpost.charges; + case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.charges; + default: return 0; + } + } + + uint32 GetCooldown() const // not triggering at detection target or use until coolodwn expire + { + switch (type) + { + case GAMEOBJECT_TYPE_TRAP: return trap.cooldown; + case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown; + default: return 0; + } + } + + uint32 GetLinkedGameObjectEntry() const + { + switch (type) + { + case GAMEOBJECT_TYPE_BUTTON: return button.linkedTrapId; + case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrapId; + case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrapId; + case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrapId; + default: return 0; + } + } + + uint32 GetAutoCloseTime() const + { + uint32 autoCloseTime = 0; + switch (type) + { + case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoCloseTime; break; + case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoCloseTime; break; + case GAMEOBJECT_TYPE_TRAP: autoCloseTime = trap.autoCloseTime; break; + case GAMEOBJECT_TYPE_GOOBER: autoCloseTime = goober.autoCloseTime; break; + case GAMEOBJECT_TYPE_TRANSPORT: autoCloseTime = transport.autoCloseTime; break; + case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areadamage.autoCloseTime; break; + default: break; + } + return autoCloseTime / 0x10000; + } + + uint32 GetLootId() const + { + switch (type) + { + case GAMEOBJECT_TYPE_CHEST: return chest.lootId; + case GAMEOBJECT_TYPE_FISHINGHOLE: return fishinghole.lootId; + default: return 0; + } + } + + uint32 GetGossipMenuId() const + { + switch (type) + { + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.gossipID; + case GAMEOBJECT_TYPE_GOOBER: return goober.gossipID; + default: return 0; + } + } + + bool IsLargeGameObject() const + { + switch (type) + { + case GAMEOBJECT_TYPE_BUTTON: return button.large != 0; + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.large != 0; + case GAMEOBJECT_TYPE_GENERIC: return _generic.large != 0; + case GAMEOBJECT_TYPE_TRAP: return trap.large != 0; + case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.large != 0; + case GAMEOBJECT_TYPE_GOOBER: return goober.large != 0; + case GAMEOBJECT_TYPE_TRANSPORT: return true; + case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.large != 0; + case GAMEOBJECT_TYPE_CAPTURE_POINT: return capturePoint.large != 0; + default: return false; + } + } + + bool IsServerOnly() const + { + switch (type) + { + case GAMEOBJECT_TYPE_GENERIC: return _generic.serverOnly; + case GAMEOBJECT_TYPE_TRAP: return trap.serverOnly; + case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.serverOnly; + case GAMEOBJECT_TYPE_AURA_GENERATOR: return auraGenerator.serverOnly; + default: return false; + } + } +}; + +// pre-defined targeting for spells +struct SpellTargetEntry +{ + uint32 spellId; + uint32 type; + uint32 targetEntry; + uint32 inverseEffectMask; + + bool CanNotHitWithSpellEffect(SpellEffectIndex effect) const { return (inverseEffectMask & (1 << effect)) != 0; } +}; + // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform #if defined( __GNUC__ ) #pragma pack() diff --git a/src/game/Server/SQLStorages.cpp b/src/game/Server/SQLStorages.cpp index 706930e858f..ddd061b3c86 100644 --- a/src/game/Server/SQLStorages.cpp +++ b/src/game/Server/SQLStorages.cpp @@ -63,9 +63,9 @@ SQLStorage sFactionStore(FactionEntryfmt, "entry", "fa SQLStorage sCreatureConditionalSpawnStore(CreatureConditionalSpawnSrcFmt, CreatureConditionalSpawnDstFmt, "guid", "creature_conditional_spawn"); SQLStorage sWorldSafeLocsStore(WorldSafeLocsFmt, "id", "world_safe_locs"); -SQLHashStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry", "gameobject_template"); +SQLHashStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry", "gameobject_template"); -SQLMultiStorage sSpellScriptTargetStorage(SpellScriptTargetFmt, "entry", "spell_script_target"); +SQLMultiStorage sSpellScriptTargetStorage(SpellScriptTargetFmt, "entry", "spell_script_target"); SQLStorage const* GetSpellStore() { return &sSpellTemplate; } diff --git a/src/game/Server/SQLStorages.h b/src/game/Server/SQLStorages.h index a5df64ba5a4..f0da991a5b8 100644 --- a/src/game/Server/SQLStorages.h +++ b/src/game/Server/SQLStorages.h @@ -41,9 +41,9 @@ extern SQLStorage sCreatureConditionalSpawnStore; extern SQLStorage sWorldSafeLocsStore; -extern SQLHashStorage sGOStorage; +extern SQLHashStorage sGOStorage; -extern SQLMultiStorage sSpellScriptTargetStorage; +extern SQLMultiStorage sSpellScriptTargetStorage; // DBC stores in <>db diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index eba4cb4cd17..369cc96bd35 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -1091,7 +1091,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) Unit::DealDamageMods(caster, spellDamageInfo.target, spellDamageInfo.damage, &spellDamageInfo.absorb, SPELL_DIRECT_DAMAGE, m_spellInfo); - // Send log damage message to client + // Send log damage message to client if (reflectTarget) reflectTarget->SendSpellNonMeleeDamageLog(&spellDamageInfo); else @@ -1993,7 +1993,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targ if (tempTargetUnitMap.empty()) break; - SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); + auto bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); if (bounds.first != bounds.second) CheckSpellScriptTargets(bounds, tempTargetUnitMap, tempUnitList, effIndex); else @@ -2113,7 +2113,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targ case TARGET_ENUM_UNITS_SCRIPT_AOE_AT_SRC_LOC: { UnitList tempTargetUnitMap; - SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); + auto bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); // fill real target list if no spell script target defined FillAreaTargets(bounds.first != bounds.second ? tempTargetUnitMap : tempUnitList, @@ -2152,7 +2152,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targ case TARGET_ENUM_UNITS_SCRIPT_AOE_AT_DEST_LOC: { UnitList tempTargetUnitMap; - SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); + auto bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); // fill real target list if no spell script target defined FillAreaTargets(bounds.first != bounds.second ? tempTargetUnitMap : tempUnitList, radius, cone, PUSH_DEST_CENTER, SPELL_TARGETS_ALL); @@ -2178,8 +2178,8 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targ std::set entriesToUse; - SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); - for (SQLMultiStorage::SQLMultiSIterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) + auto bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); + for (auto i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) { if (i_spellST->CanNotHitWithSpellEffect(effIndex)) continue; @@ -2336,7 +2336,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targ case TARGET_ENUM_UNITS_SCRIPT_IN_CONE_60: { UnitList tempTargetUnitMap; - SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); + auto bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); // fill real target list if no spell script target defined FillAreaTargets(bounds.first != bounds.second ? tempTargetUnitMap : tempUnitList, radius, cone, PUSH_CONE, targetType); if (!tempTargetUnitMap.empty()) @@ -2561,7 +2561,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targ SpellCastResult Spell::CheckScriptTargeting(SpellEffectIndex effIndex, uint32 chainTargets, float radius, uint32 targetMode, UnitList& tempUnitList, GameObjectList& tempGOList) { - SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); + auto bounds = sSpellScriptTargetStorage.getBounds(m_spellInfo->Id); if (bounds.first == bounds.second) { @@ -2585,7 +2585,7 @@ SpellCastResult Spell::CheckScriptTargeting(SpellEffectIndex effIndex, uint32 ch // corrections for numerous spells missing it uint32 targetCount = std::max(chainTargets, uint32(1)); - for (SQLMultiStorage::SQLMultiSIterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) + for (auto i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) { if (i_spellST->CanNotHitWithSpellEffect(effIndex)) continue; @@ -2756,7 +2756,7 @@ SpellCastResult Spell::CheckScriptTargeting(SpellEffectIndex effIndex, uint32 ch return SPELL_CAST_OK; } -void Spell::CheckSpellScriptTargets(SQLMultiStorage::SQLMSIteratorBounds& bounds, UnitList& tempTargetUnitMap, UnitList& targetUnitMap, SpellEffectIndex effIndex) +void Spell::CheckSpellScriptTargets(SQLMultiStorage::SQLMSIteratorBounds& bounds, UnitList& tempTargetUnitMap, UnitList& targetUnitMap, SpellEffectIndex effIndex) { for (UnitList::const_iterator iter = tempTargetUnitMap.begin(); iter != tempTargetUnitMap.end(); ++iter) { @@ -2764,7 +2764,7 @@ void Spell::CheckSpellScriptTargets(SQLMultiStorage::SQLMSIteratorBoundsGetTypeId() != TYPEID_UNIT) continue; - for (SQLMultiStorage::SQLMultiSIterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) + for (auto i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) { SpellTargetEntry const* spellST = (*i_spellST); if (spellST->CanNotHitWithSpellEffect(effIndex)) @@ -7134,7 +7134,7 @@ float Spell::GetSpellSpeed() const return 0.f; if (IsChanneledSpell(m_spellInfo)) return 0.f; - + return m_spellInfo->speed; } diff --git a/src/game/Spells/Spell.h b/src/game/Spells/Spell.h index 193df9bc7f6..afb8ecb4e11 100644 --- a/src/game/Spells/Spell.h +++ b/src/game/Spells/Spell.h @@ -765,7 +765,7 @@ class Spell void FillTargetMap(); void SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targetB, TempTargetingData& targetingData); bool CheckAndAddMagnetTarget(Unit* unitTarget, SpellEffectIndex effIndex, bool targetB, TempTargetingData& data); - static void CheckSpellScriptTargets(SQLMultiStorage::SQLMSIteratorBounds& bounds, UnitList& tempTargetUnitMap, UnitList& targetUnitMap, SpellEffectIndex effIndex); + static void CheckSpellScriptTargets(SQLMultiStorage::SQLMSIteratorBounds& bounds, UnitList& tempTargetUnitMap, UnitList& targetUnitMap, SpellEffectIndex effIndex); void FilterTargetMap(UnitList& filterUnitList, SpellTargetFilterScheme scheme, uint32 chainTargetCount); void FillFromTargetFlags(TempTargetingData& targetingData, SpellEffectIndex effIndex); diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index dff18c709de..5da2ccc2c0e 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -2016,7 +2016,7 @@ void SpellMgr::LoadSpellScriptTarget() sSpellScriptTargetStorage.Load(); // Check content - for (SQLMultiStorage::SQLSIterator itr = sSpellScriptTargetStorage.getDataBegin(); itr < sSpellScriptTargetStorage.getDataEnd(); ++itr) + for (auto itr = sSpellScriptTargetStorage.getDataBegin(); itr < sSpellScriptTargetStorage.getDataEnd(); ++itr) { SpellEntry const* spellProto = sSpellTemplate.LookupEntry(itr->spellId); if (!spellProto) @@ -2072,7 +2072,7 @@ void SpellMgr::LoadSpellScriptTarget() if (!itr->targetEntry) break; - if (!sGOStorage.LookupEntry(itr->targetEntry)) + if (!sGOStorage.LookupEntry(itr->targetEntry)) { sLog.outErrorDb("Table `spell_script_target`: gameobject template entry %u does not exist.", itr->targetEntry); sSpellScriptTargetStorage.EraseEntry(itr->spellId); @@ -2138,7 +2138,7 @@ void SpellMgr::LoadSpellScriptTarget() if (spellInfo->Effect[j] && (spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_SCRIPT_NEAR_CASTER || (spellInfo->EffectImplicitTargetA[j] != TARGET_UNIT_CASTER && spellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_SCRIPT_NEAR_CASTER))) { - SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(i); + auto bounds = sSpellScriptTargetStorage.getBounds(i); if (bounds.first == bounds.second) { sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = %u (TARGET_UNIT_SCRIPT_NEAR_CASTER), but does not have record in `spell_script_target`", spellInfo->Id, TARGET_UNIT_SCRIPT_NEAR_CASTER); diff --git a/src/game/Spells/SpellMgr.h b/src/game/Spells/SpellMgr.h index d8a592dc76d..19babd60442 100644 --- a/src/game/Spells/SpellMgr.h +++ b/src/game/Spells/SpellMgr.h @@ -2223,17 +2223,6 @@ enum SpellTargetType #define MAX_SPELL_TARGET_TYPE 5 -// pre-defined targeting for spells -struct SpellTargetEntry -{ - uint32 spellId; - uint32 type; - uint32 targetEntry; - uint32 inverseEffectMask; - - bool CanNotHitWithSpellEffect(SpellEffectIndex effect) const { return (inverseEffectMask & (1 << effect)) != 0; } -}; - // coordinates for spells (accessed using SpellMgr functions) struct SpellTargetPosition { diff --git a/src/game/Spells/SpellTargets.cpp b/src/game/Spells/SpellTargets.cpp index 41e80a94f0e..002816463ae 100644 --- a/src/game/Spells/SpellTargets.cpp +++ b/src/game/Spells/SpellTargets.cpp @@ -292,9 +292,9 @@ SpellTargetingData& SpellTargetMgr::GetSpellTargetingData(uint32 spellId) } // check if at least one target is different from different effIdx -bool CheckBoundsEqualForEffects(SQLMultiStorage::SQLMSIteratorBounds& bounds, SpellEffectIndex effIdxSource, SpellEffectIndex effIdxTarget) +bool CheckBoundsEqualForEffects(SQLMultiStorage::SQLMSIteratorBounds& bounds, SpellEffectIndex effIdxSource, SpellEffectIndex effIdxTarget) { - for (SQLMultiStorage::SQLMultiSIterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) + for (auto i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) { SpellTargetEntry const* spellST = (*i_spellST); if (spellST->CanNotHitWithSpellEffect(effIdxSource) != spellST->CanNotHitWithSpellEffect(effIdxTarget)) @@ -446,7 +446,7 @@ void SpellTargetMgr::Initialize() continue; if (info.filter == TARGET_SCRIPT && effIdxSource != effIdxTarget) { - SQLMultiStorage::SQLMSIteratorBounds bounds = sSpellScriptTargetStorage.getBounds(i); + auto bounds = sSpellScriptTargetStorage.getBounds(i); if (!CheckBoundsEqualForEffects(bounds, SpellEffectIndex(effIdxSource), SpellEffectIndex(effIdxTarget))) continue; } diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index 737289197e6..16f0c882be4 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -18,179 +18,4 @@ #include "SQLStorage.h" -// ----------------------------------- SQLStorageBase ---------------------------------------- // -SQLStorageBase::SQLStorageBase() : - m_tableName(nullptr), - m_entry_field(nullptr), - m_src_format(nullptr), - m_dst_format(nullptr), - m_dstFieldCount(0), - m_srcFieldCount(0), - m_recordCount(0), - m_maxEntry(0), - m_recordSize(0), - m_data(nullptr) -{} - -void SQLStorageBase::Initialize(const char* tableName, const char* entry_field, const char* src_format, const char* dst_format) -{ - m_tableName = tableName; - m_entry_field = entry_field; - m_src_format = src_format; - m_dst_format = dst_format; - - m_srcFieldCount = strlen(m_src_format); - m_dstFieldCount = strlen(m_dst_format); -} - -char* SQLStorageBase::createRecord(uint32 recordId) -{ - char* newRecord = &m_data[m_recordCount * m_recordSize]; - ++m_recordCount; - - JustCreatedRecord(recordId, newRecord); - return newRecord; -} - -void SQLStorageBase::prepareToLoad(uint32 maxEntry, uint32 recordCount, uint32 recordSize) -{ - m_maxEntry = maxEntry; - m_recordSize = recordSize; - - delete[] m_data; - m_data = new char[recordCount * m_recordSize]; - memset(m_data, 0, recordCount * m_recordSize); - - m_recordCount = 0; -} - -// Function to delete the data -void SQLStorageBase::Free() -{ - if (!m_data) - return; - - uint32 offset = 0; - for (uint32 x = 0; x < m_dstFieldCount; ++x) - { - switch (m_dst_format[x]) - { - case FT_LOGIC: - offset += sizeof(bool); - break; - case FT_STRING: - { - for (uint32 recordItr = 0; recordItr < m_recordCount; ++recordItr) - delete[] *(char**)((char*)(m_data + (recordItr * m_recordSize)) + offset); - - offset += sizeof(char*); - break; - } - case FT_NA: - case FT_INT: - offset += sizeof(uint32); - break; - case FT_BYTE: - case FT_NA_BYTE: - offset += sizeof(char); - break; - case FT_FLOAT: - case FT_NA_FLOAT: - offset += sizeof(float); - break; - case FT_NA_POINTER: - // TODO- possible (and small) memleak here possible - offset += sizeof(char*); - break; - case FT_64BITINT: - offset += sizeof(uint64); - break; - case FT_IND: - case FT_SORT: - assert(false && "SQL storage not have sort field types"); - break; - default: - assert(false && "unknown format character"); - break; - } - } - delete[] m_data; - m_data = nullptr; - m_recordCount = 0; -} - -// ----------------------------------- SQLHashStorage ---------------------------------------- // -void SQLHashStorage::Load() -{ - SQLHashStorageLoader loader; - loader.Load(*this); -} - -void SQLHashStorage::Free() -{ - SQLStorageBase::Free(); - m_indexMap.clear(); -} - -void SQLHashStorage::prepareToLoad(uint32 maxRecordId, uint32 recordCount, uint32 recordSize) -{ - // Clear (possible) old data and old index array - Free(); - - SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); -} - -void SQLHashStorage::EraseEntry(uint32 id) -{ - // do not erase from m_records - RecordMap::iterator find = m_indexMap.find(id); - if (find != m_indexMap.end()) - find->second = nullptr; -} - -SQLHashStorage::SQLHashStorage(const char* fmt, const char* _entry_field, const char* sqlname) -{ - Initialize(sqlname, _entry_field, fmt, fmt); -} - -SQLHashStorage::SQLHashStorage(const char* src_fmt, const char* dst_fmt, const char* _entry_field, const char* sqlname) -{ - Initialize(sqlname, _entry_field, src_fmt, dst_fmt); -} - -// ----------------------------------- SQLMultiStorage --------------------------------------- // -void SQLMultiStorage::Load() -{ - SQLMultiStorageLoader loader; - loader.Load(*this); -} - -void SQLMultiStorage::Free() -{ - SQLStorageBase::Free(); - m_indexMultiMap.clear(); -} - -void SQLMultiStorage::prepareToLoad(uint32 maxRecordId, uint32 recordCount, uint32 recordSize) -{ - // Clear (possible) old data and old index array - Free(); - - SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); -} - -void SQLMultiStorage::EraseEntry(uint32 id) -{ - m_indexMultiMap.erase(id); -} - -SQLMultiStorage::SQLMultiStorage(const char* fmt, const char* _entry_field, const char* sqlname) -{ - Initialize(sqlname, _entry_field, fmt, fmt); -} - -SQLMultiStorage::SQLMultiStorage(const char* src_fmt, const char* dst_fmt, const char* _entry_field, const char* sqlname) -{ - Initialize(sqlname, _entry_field, src_fmt, dst_fmt); -} diff --git a/src/shared/Database/SQLStorage.h b/src/shared/Database/SQLStorage.h index 71d61104a64..18a875c11e0 100644 --- a/src/shared/Database/SQLStorage.h +++ b/src/shared/Database/SQLStorage.h @@ -23,6 +23,7 @@ #include "Database/DatabaseEnv.h" #include "DBCFileLoader.h" +template class SQLStorageBase { template friend class SQLStorageLoaderBase; @@ -39,7 +40,6 @@ class SQLStorageBase uint32 GetMaxEntry() const { return m_maxEntry; }; uint32 GetNumRows() const { return m_recordCount; }; - template class SQLSIterator { friend class SQLStorageBase; @@ -59,10 +59,8 @@ class SQLStorageBase uint32 recordSize; }; - template - SQLSIterator getDataBegin() const { return SQLSIterator(m_data, m_recordSize); } - template - SQLSIterator getDataEnd() const { return SQLSIterator(m_data + m_recordCount * m_recordSize, m_recordSize); } + SQLSIterator getDataBegin() const { return SQLSIterator(m_data, m_recordSize); } + SQLSIterator getDataEnd() const { return SQLSIterator(m_data + m_recordCount * m_recordSize, m_recordSize); } protected: SQLStorageBase(); @@ -99,7 +97,7 @@ class SQLStorageBase }; template -class SQLStorage : public SQLStorageBase +class SQLStorage : public SQLStorageBase { template friend class SQLStorageLoaderBase; @@ -135,7 +133,8 @@ class SQLStorage : public SQLStorageBase char** m_Index; }; -class SQLHashStorage : public SQLStorageBase +template +class SQLHashStorage : public SQLStorageBase { template friend class SQLStorageLoaderBase; @@ -145,7 +144,6 @@ class SQLHashStorage : public SQLStorageBase ~SQLHashStorage() { Free(); } - template T const* LookupEntry(uint32 id) const { RecordMap::const_iterator find = m_indexMap.find(id); @@ -172,7 +170,8 @@ class SQLHashStorage : public SQLStorageBase RecordMap m_indexMap; }; -class SQLMultiStorage : public SQLStorageBase +template +class SQLMultiStorage : public SQLStorageBase { template friend class SQLStorageLoaderBase; template friend class SQLMultiSIterator; @@ -188,13 +187,12 @@ class SQLMultiStorage : public SQLStorageBase ~SQLMultiStorage() { Free(); } // forward declaration - template class SQLMSIteratorBounds; + class SQLMSIteratorBounds; - template class SQLMultiSIterator { friend class SQLMultiStorage; - friend class SQLMSIteratorBounds; + friend class SQLMSIteratorBounds; public: T const* getValue() const { return reinterpret_cast(citerator->second); } @@ -211,21 +209,19 @@ class SQLMultiStorage : public SQLStorageBase RecordMultiMap::const_iterator citerator; }; - template class SQLMSIteratorBounds { friend class SQLMultiStorage; public: - const SQLMultiSIterator first; - const SQLMultiSIterator second; + const SQLMultiSIterator first; + const SQLMultiSIterator second; private: SQLMSIteratorBounds(std::pair pair) : first(pair.first), second(pair.second) {} }; - template - SQLMSIteratorBounds getBounds(uint32 key) const { return SQLMSIteratorBounds(m_indexMultiMap.equal_range(key)); } + SQLMSIteratorBounds getBounds(uint32 key) const { return SQLMSIteratorBounds(m_indexMultiMap.equal_range(key)); } void Load(); @@ -283,11 +279,13 @@ class SQLStorageLoader : public SQLStorageLoaderBase, SQLSto { }; -class SQLHashStorageLoader : public SQLStorageLoaderBase +template +class SQLHashStorageLoader : public SQLStorageLoaderBase, SQLHashStorage> { }; -class SQLMultiStorageLoader : public SQLStorageLoaderBase +template +class SQLMultiStorageLoader : public SQLStorageLoaderBase, SQLMultiStorage> { }; diff --git a/src/shared/Database/SQLStorageImpl.h b/src/shared/Database/SQLStorageImpl.h index 86fe410e5ed..df1009f7b17 100644 --- a/src/shared/Database/SQLStorageImpl.h +++ b/src/shared/Database/SQLStorageImpl.h @@ -405,4 +405,198 @@ void SQLStorage::prepareToLoad(uint32 maxRecordId, uint32 recordCount, uint3 SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); } +// ----------------------------------- SQLStorageBase ---------------------------------------- // +template +SQLStorageBase::SQLStorageBase() : + m_tableName(nullptr), + m_entry_field(nullptr), + m_src_format(nullptr), + m_dst_format(nullptr), + m_dstFieldCount(0), + m_srcFieldCount(0), + m_recordCount(0), + m_maxEntry(0), + m_recordSize(0), + m_data(nullptr) +{} + +template +void SQLStorageBase::Initialize(const char* tableName, const char* entry_field, const char* src_format, const char* dst_format) +{ + m_tableName = tableName; + m_entry_field = entry_field; + m_src_format = src_format; + m_dst_format = dst_format; + + m_srcFieldCount = strlen(m_src_format); + m_dstFieldCount = strlen(m_dst_format); +} + +template +char* SQLStorageBase::createRecord(uint32 recordId) +{ + char* newRecord = &m_data[m_recordCount * m_recordSize]; + ++m_recordCount; + + JustCreatedRecord(recordId, newRecord); + return newRecord; +} + +template +void SQLStorageBase::prepareToLoad(uint32 maxEntry, uint32 recordCount, uint32 recordSize) +{ + m_maxEntry = maxEntry; + m_recordSize = recordSize; + + delete[] m_data; + m_data = new char[recordCount * m_recordSize]; + memset(m_data, 0, recordCount * m_recordSize); + + m_recordCount = 0; +} + +// Function to delete the data +template +void SQLStorageBase::Free() +{ + if (!m_data) + return; + + uint32 offset = 0; + for (uint32 x = 0; x < m_dstFieldCount; ++x) + { + switch (m_dst_format[x]) + { + case FT_LOGIC: + offset += sizeof(bool); + break; + case FT_STRING: + { + for (uint32 recordItr = 0; recordItr < m_recordCount; ++recordItr) + delete[] * (char**)((char*)(m_data + (recordItr * m_recordSize)) + offset); + + offset += sizeof(char*); + break; + } + case FT_NA: + case FT_INT: + offset += sizeof(uint32); + break; + case FT_BYTE: + case FT_NA_BYTE: + offset += sizeof(char); + break; + case FT_FLOAT: + case FT_NA_FLOAT: + offset += sizeof(float); + break; + case FT_NA_POINTER: + // TODO- possible (and small) memleak here possible + offset += sizeof(char*); + break; + case FT_64BITINT: + offset += sizeof(uint64); + break; + case FT_IND: + case FT_SORT: + assert(false && "SQL storage not have sort field types"); + break; + default: + assert(false && "unknown format character"); + break; + } + } + delete[] m_data; + m_data = nullptr; + m_recordCount = 0; +} + +// ----------------------------------- SQLHashStorage ---------------------------------------- // +template +void SQLHashStorage::Load() +{ + SQLHashStorageLoader loader; + loader.Load(*this); +} + +template +void SQLHashStorage::Free() +{ + SQLStorageBase::Free(); + m_indexMap.clear(); +} + +template +void SQLHashStorage::prepareToLoad(uint32 maxRecordId, uint32 recordCount, uint32 recordSize) +{ + // Clear (possible) old data and old index array + Free(); + + SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); +} + +template +void SQLHashStorage::EraseEntry(uint32 id) +{ + // do not erase from m_records + RecordMap::iterator find = m_indexMap.find(id); + if (find != m_indexMap.end()) + find->second = nullptr; +} + +template +SQLHashStorage::SQLHashStorage(const char* fmt, const char* _entry_field, const char* sqlname) +{ + Initialize(sqlname, _entry_field, fmt, fmt); +} + +template +SQLHashStorage::SQLHashStorage(const char* src_fmt, const char* dst_fmt, const char* _entry_field, const char* sqlname) +{ + Initialize(sqlname, _entry_field, src_fmt, dst_fmt); +} + +// ----------------------------------- SQLMultiStorage --------------------------------------- // +template +void SQLMultiStorage::Load() +{ + SQLMultiStorageLoader loader; + loader.Load(*this); +} + +template +void SQLMultiStorage::Free() +{ + SQLStorageBase::Free(); + m_indexMultiMap.clear(); +} + +template +void SQLMultiStorage::prepareToLoad(uint32 maxRecordId, uint32 recordCount, uint32 recordSize) +{ + // Clear (possible) old data and old index array + Free(); + + SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); +} + +template +void SQLMultiStorage::EraseEntry(uint32 id) +{ + m_indexMultiMap.erase(id); +} + +template +SQLMultiStorage::SQLMultiStorage(const char* fmt, const char* _entry_field, const char* sqlname) +{ + Initialize(sqlname, _entry_field, fmt, fmt); +} + +template +SQLMultiStorage::SQLMultiStorage(const char* src_fmt, const char* dst_fmt, const char* _entry_field, const char* sqlname) +{ + Initialize(sqlname, _entry_field, src_fmt, dst_fmt); +} + + #endif From abb5a2066310e95fcb873bb62864bfa9dd9255d4 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Fri, 5 Mar 2021 15:24:22 +0100 Subject: [PATCH 05/28] Improve SqlStorageBase iterator class Make it more compatible wiht c++ iterator standard. silent a casting warning. --- src/shared/Database/SQLStorage.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shared/Database/SQLStorage.h b/src/shared/Database/SQLStorage.h index 18a875c11e0..e5621a86d1b 100644 --- a/src/shared/Database/SQLStorage.h +++ b/src/shared/Database/SQLStorage.h @@ -50,6 +50,7 @@ class SQLStorageBase void operator ++() { pointer += recordSize; } T const* operator *() const { return getValue(); } T const* operator ->() const { return getValue(); } + bool operator!=(const SQLSIterator& other) const { return pointer != other.pointer; } bool operator <(const SQLSIterator& r) const { return pointer < r.pointer; } void operator =(const SQLSIterator& r) { pointer = r.pointer; recordSize = r.recordSize; } @@ -59,8 +60,8 @@ class SQLStorageBase uint32 recordSize; }; - SQLSIterator getDataBegin() const { return SQLSIterator(m_data, m_recordSize); } - SQLSIterator getDataEnd() const { return SQLSIterator(m_data + m_recordCount * m_recordSize, m_recordSize); } + SQLSIterator begin() const { return SQLSIterator(m_data, m_recordSize); } + SQLSIterator end() const { return SQLSIterator(m_data + static_cast(m_recordCount * m_recordSize), m_recordSize); } protected: SQLStorageBase(); From 70bb5a13d6a1cf6a5a3b1a837c8de95338b6f2b6 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Fri, 5 Mar 2021 17:09:05 +0100 Subject: [PATCH 06/28] Change sCreatureStorage and sGOStorage loop format --- src/game/AI/EventAI/CreatureEventAIMgr.cpp | 17 ++- src/game/Chat/Level3.cpp | 14 +-- src/game/DBScripts/ScriptMgr.cpp | 2 +- src/game/Globals/ObjectMgr.cpp | 121 +++++++++------------ src/game/Loot/LootMgr.cpp | 48 ++++---- src/game/Maps/TransportMgr.cpp | 11 +- src/game/Spells/SpellMgr.cpp | 2 +- 7 files changed, 92 insertions(+), 123 deletions(-) diff --git a/src/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/game/AI/EventAI/CreatureEventAIMgr.cpp index a9f45b75a61..5df97b7c674 100644 --- a/src/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -1123,17 +1123,14 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() m_usedTextsAmount = usedTextIds.size(); // post check - for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) + for (auto cInfo : sCreatureStorage) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) - { - bool ainame = strcmp(cInfo->AIName, "EventAI") == 0 || strcmp(cInfo->AIName, "GuardianAI") == 0; - bool hasevent = m_CreatureEventAI_Event_Map.find(i) != m_CreatureEventAI_Event_Map.end(); - if (ainame && !hasevent) - sLog.outErrorEventAI("EventAI not has script for creature entry (%u), but AIName = '%s'.", i, cInfo->AIName); - else if (!ainame && hasevent) - sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", i, cInfo->AIName); - } + bool ainame = strcmp(cInfo->AIName, "EventAI") == 0 || strcmp(cInfo->AIName, "GuardianAI") == 0; + bool hasevent = m_CreatureEventAI_Event_Map.find(cInfo->Entry) != m_CreatureEventAI_Event_Map.end(); + if (ainame && !hasevent) + sLog.outErrorEventAI("EventAI not has script for creature entry (%u), but AIName = '%s'.", cInfo->Entry, cInfo->AIName); + else if (!ainame && hasevent) + sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", cInfo->Entry, cInfo->AIName); } CheckUnusedAITexts(); diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp index dd60bf628fa..3e999ecad1a 100644 --- a/src/game/Chat/Level3.cpp +++ b/src/game/Chat/Level3.cpp @@ -2593,16 +2593,12 @@ bool ChatHandler::HandleLookupCreatureCommand(char* args) uint32 counter = 0; - for (uint32 id = 0; id < sCreatureStorage.GetMaxEntry(); ++id) + for (auto cInfo : sCreatureStorage) { - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry (id); - if (!cInfo) - continue; - int loc_idx = GetSessionDbLocaleIndex(); char const* name = ""; // "" for avoid repeating check for default locale - sObjectMgr.GetCreatureLocaleStrings(id, loc_idx, &name); + sObjectMgr.GetCreatureLocaleStrings(cInfo->Entry, loc_idx, &name); if (!*name || !Utf8FitTo(name, wnamepart)) { name = cInfo->Name; @@ -2611,9 +2607,9 @@ bool ChatHandler::HandleLookupCreatureCommand(char* args) } if (m_session) - PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name); + PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, cInfo->Entry, cInfo->Entry, name); else - PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name); + PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, cInfo->Entry, name); ++counter; } @@ -2640,7 +2636,7 @@ bool ChatHandler::HandleLookupObjectCommand(char* args) uint32 counter = 0; - for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr : sGOStorage) { int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) diff --git a/src/game/DBScripts/ScriptMgr.cpp b/src/game/DBScripts/ScriptMgr.cpp index f9e219f9220..60dc290e361 100644 --- a/src/game/DBScripts/ScriptMgr.cpp +++ b/src/game/DBScripts/ScriptMgr.cpp @@ -2499,7 +2499,7 @@ int32 ScriptMgr::GetRandomRelayDbscriptFromTemplate(uint32 id) void ScriptMgr::CollectPossibleEventIds(std::set& eventIds) { // Load all possible script entries from gameobjects - for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr : sGOStorage) { switch (itr->type) { diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index 576dbaa8aca..53323a92c5b 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -437,24 +437,20 @@ void ObjectMgr::LoadCreatureTemplates() std::set hasHeroicEntries; // already loaded creatures with heroic entry values // check data correctness - for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) + for (auto cInfo : sCreatureStorage) { - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i); - if (!cInfo) - continue; - if (cInfo->HeroicEntry) { CreatureInfo const* heroicInfo = GetCreatureTemplate(cInfo->HeroicEntry); if (!heroicInfo) { - sLog.outErrorDb("Creature (Entry: %u) have `heroic_entry`=%u but creature entry %u not exist.", i, cInfo->HeroicEntry, cInfo->HeroicEntry); + sLog.outErrorDb("Creature (Entry: %u) have `heroic_entry`=%u but creature entry %u not exist.", cInfo->Entry, cInfo->HeroicEntry, cInfo->HeroicEntry); continue; } - if (heroicEntries.find(i) != heroicEntries.end()) + if (heroicEntries.find(cInfo->Entry) != heroicEntries.end()) { - sLog.outErrorDb("Creature (Entry: %u) listed as heroic but have value in `heroic_entry`.", i); + sLog.outErrorDb("Creature (Entry: %u) listed as heroic but have value in `heroic_entry`.", cInfo->Entry); continue; } @@ -466,59 +462,59 @@ void ObjectMgr::LoadCreatureTemplates() if (hasHeroicEntries.find(cInfo->HeroicEntry) != hasHeroicEntries.end()) { - sLog.outErrorDb("Creature (Entry: %u) have `heroic_entry`=%u but creature entry %u have heroic entry also.", i, cInfo->HeroicEntry, cInfo->HeroicEntry); + sLog.outErrorDb("Creature (Entry: %u) have `heroic_entry`=%u but creature entry %u have heroic entry also.", cInfo->Entry, cInfo->HeroicEntry, cInfo->HeroicEntry); continue; } if (cInfo->UnitClass != heroicInfo->UnitClass) { - sLog.outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in heroic mode (Entry: %u, class %u).", i, cInfo->UnitClass, cInfo->HeroicEntry, heroicInfo->UnitClass); + sLog.outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in heroic mode (Entry: %u, class %u).", cInfo->Entry, cInfo->UnitClass, cInfo->HeroicEntry, heroicInfo->UnitClass); continue; } if (cInfo->NpcFlags != heroicInfo->NpcFlags) { - sLog.outErrorDb("Creature (Entry: %u) has different `npcflag` in heroic mode (Entry: %u).", i, cInfo->HeroicEntry); + sLog.outErrorDb("Creature (Entry: %u) has different `npcflag` in heroic mode (Entry: %u).", cInfo->Entry, cInfo->HeroicEntry); continue; } if (cInfo->TrainerClass != heroicInfo->TrainerClass) { - sLog.outErrorDb("Creature (Entry: %u) has different `trainer_class` in heroic mode (Entry: %u).", i, cInfo->HeroicEntry); + sLog.outErrorDb("Creature (Entry: %u) has different `trainer_class` in heroic mode (Entry: %u).", cInfo->Entry, cInfo->HeroicEntry); continue; } if (cInfo->TrainerRace != heroicInfo->TrainerRace) { - sLog.outErrorDb("Creature (Entry: %u) has different `trainer_race` in heroic mode (Entry: %u).", i, cInfo->HeroicEntry); + sLog.outErrorDb("Creature (Entry: %u) has different `trainer_race` in heroic mode (Entry: %u).", cInfo->Entry, cInfo->HeroicEntry); continue; } if (cInfo->TrainerType != heroicInfo->TrainerType) { - sLog.outErrorDb("Creature (Entry: %u) has different `trainer_type` in heroic mode (Entry: %u).", i, cInfo->HeroicEntry); + sLog.outErrorDb("Creature (Entry: %u) has different `trainer_type` in heroic mode (Entry: %u).", cInfo->Entry, cInfo->HeroicEntry); continue; } if (cInfo->TrainerSpell != heroicInfo->TrainerSpell) { - sLog.outErrorDb("Creature (Entry: %u) has different `trainer_spell` in heroic mode (Entry: %u).", i, cInfo->HeroicEntry); + sLog.outErrorDb("Creature (Entry: %u) has different `trainer_spell` in heroic mode (Entry: %u).", cInfo->Entry, cInfo->HeroicEntry); continue; } if (heroicInfo->AIName && *heroicInfo->AIName) { - sLog.outErrorDb("Heroic mode creature (Entry: %u) has `AIName`, but in any case will used normal mode creature (Entry: %u) AIName.", cInfo->HeroicEntry, i); + sLog.outErrorDb("Heroic mode creature (Entry: %u) has `AIName`, but in any case will used normal mode creature (Entry: %u) AIName.", cInfo->HeroicEntry, cInfo->Entry); continue; } if (heroicInfo->ScriptID) { - sLog.outErrorDb("Heroic mode creature (Entry: %u) has `ScriptName`, but in any case will used normal mode creature (Entry: %u) ScriptName.", cInfo->HeroicEntry, i); + sLog.outErrorDb("Heroic mode creature (Entry: %u) has `ScriptName`, but in any case will used normal mode creature (Entry: %u) ScriptName.", cInfo->HeroicEntry, cInfo->Entry); continue; } - hasHeroicEntries.insert(i); + hasHeroicEntries.insert(cInfo->Entry); heroicEntries.insert(cInfo->HeroicEntry); } @@ -1401,10 +1397,11 @@ void ObjectMgr::LoadCreatures() // build single time for check creature data std::set heroicCreatures; - for (uint32 i = 0; i < sCreatureStorage.GetMaxEntry(); ++i) - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) - if (cInfo->HeroicEntry) - heroicCreatures.insert(cInfo->HeroicEntry); + for (auto cInfo : sCreatureStorage) + { + if (cInfo->HeroicEntry) + heroicCreatures.insert(cInfo->HeroicEntry); + } BarGoLink bar(result->GetRowCount()); @@ -4664,12 +4661,8 @@ void ObjectMgr::LoadPetCreateSpells() // fill data from DBC as more correct source if available uint32 dcount = 0; - for (uint32 cr_id = 1; cr_id < sCreatureStorage.GetMaxEntry(); ++cr_id) + for (auto cInfo : sCreatureStorage) { - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(cr_id); - if (!cInfo) - continue; - CreatureSpellDataEntry const* petSpellEntry = cInfo->PetSpellDataId ? sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId) : nullptr; if (!petSpellEntry) continue; @@ -4689,7 +4682,7 @@ void ObjectMgr::LoadPetCreateSpells() PetCreateSpell.spellid[i] = petspell_id; } - mPetCreateSpell[cr_id] = PetCreateSpell; + mPetCreateSpell[cInfo->Entry] = PetCreateSpell; ++dcount; } @@ -6881,10 +6874,8 @@ std::vector ObjectMgr::LoadGameobjectInfo() std::vector transportDisplayIds; // some checks - for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto goInfo : sGOStorage) { - GameObjectInfo const* goInfo = itr.getValue(); - if (goInfo->size <= 0.0f) // prevent use too small scales { ERROR_DB_STRICT_LOG("Gameobject (Entry: %u GoType: %u) have too small size=%f", @@ -7575,7 +7566,7 @@ void ObjectMgr::LoadSpellTemplate() sSpellTemplate.Load(); /* TODO add validation for spell_dbc */ - for (auto itr = sSpellTemplate.getDataBegin(); itr < sSpellTemplate.getDataEnd(); ++itr) + for (auto itr = sSpellTemplate.begin(); itr < sSpellTemplate.end(); ++itr) { if (!sSpellTemplate.LookupEntry(itr->Id)) { @@ -8164,7 +8155,7 @@ void ObjectMgr::LoadGameObjectForQuests() uint32 count = 0; // collect GO entries for GO that must activated - for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr : sGOStorage) { bar.step(); switch (itr->type) @@ -8888,19 +8879,16 @@ void ObjectMgr::LoadTrainerTemplates() for (CacheTrainerSpellMap::const_iterator tItr = m_mCacheTrainerTemplateSpellMap.begin(); tItr != m_mCacheTrainerTemplateSpellMap.end(); ++tItr) trainer_ids.insert(tItr->first); - for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) + for (auto cInfo : sCreatureStorage) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (cInfo->TrainerTemplateId) { - if (cInfo->TrainerTemplateId) + if (m_mCacheTrainerTemplateSpellMap.find(cInfo->TrainerTemplateId) != m_mCacheTrainerTemplateSpellMap.end()) + trainer_ids.erase(cInfo->TrainerTemplateId); + else { - if (m_mCacheTrainerTemplateSpellMap.find(cInfo->TrainerTemplateId) != m_mCacheTrainerTemplateSpellMap.end()) - trainer_ids.erase(cInfo->TrainerTemplateId); - else - { - sLog.outErrorDb("Creature (Entry: %u) has TrainerTemplateId = %u for nonexistent trainer template", cInfo->Entry, cInfo->TrainerTemplateId); - hasErrored = true; - } + sLog.outErrorDb("Creature (Entry: %u) has TrainerTemplateId = %u for nonexistent trainer template", cInfo->Entry, cInfo->TrainerTemplateId); + hasErrored = true; } } } @@ -8976,17 +8964,14 @@ void ObjectMgr::LoadVendorTemplates() for (CacheVendorItemMap::const_iterator vItr = m_mCacheVendorTemplateItemMap.begin(); vItr != m_mCacheVendorTemplateItemMap.end(); ++vItr) vendor_ids.insert(vItr->first); - for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) + for (auto cInfo : sCreatureStorage) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (cInfo->VendorTemplateId) { - if (cInfo->VendorTemplateId) - { - if (m_mCacheVendorTemplateItemMap.find(cInfo->VendorTemplateId) != m_mCacheVendorTemplateItemMap.end()) - vendor_ids.erase(cInfo->VendorTemplateId); - else - sLog.outErrorDb("Creature (Entry: %u) has VendorTemplateId = %u for nonexistent vendor template", cInfo->Entry, cInfo->VendorTemplateId); - } + if (m_mCacheVendorTemplateItemMap.find(cInfo->VendorTemplateId) != m_mCacheVendorTemplateItemMap.end()) + vendor_ids.erase(cInfo->VendorTemplateId); + else + sLog.outErrorDb("Creature (Entry: %u) has VendorTemplateId = %u for nonexistent vendor template", cInfo->Entry, cInfo->VendorTemplateId); } } @@ -9173,17 +9158,16 @@ void ObjectMgr::LoadGossipMenu(std::set& gossipScriptSet) delete result; // post loading tests - for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) + for (auto cInfo : sCreatureStorage) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) - if (cInfo->GossipMenuId) - if (m_mGossipMenusMap.find(cInfo->GossipMenuId) == m_mGossipMenusMap.end()) - sLog.outErrorDb("Creature (Entry: %u) has GossipMenuId = %u for nonexistent menu", cInfo->Entry, cInfo->GossipMenuId); + if (cInfo->GossipMenuId) + if (m_mGossipMenusMap.find(cInfo->GossipMenuId) == m_mGossipMenusMap.end()) + sLog.outErrorDb("Creature (Entry: %u) has GossipMenuId = %u for nonexistent menu", cInfo->Entry, cInfo->GossipMenuId); } if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) { - for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr : sGOStorage) if (uint32 menuid = itr->GetGossipMenuId()) if (m_mGossipMenusMap.find(menuid) == m_mGossipMenusMap.end()) sLog.outErrorDb("Gameobject (Entry: %u) has gossip_menu_id = %u for nonexistent menu", itr->id, menuid); @@ -9220,7 +9204,7 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) if (itr->first) menu_ids.insert(itr->first); - for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr : sGOStorage) if (uint32 menuid = itr->GetGossipMenuId()) menu_ids.erase(menuid); } @@ -9233,16 +9217,17 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) // prepare menuid -> CreatureInfo map for fast access typedef std::multimap Menu2CInfoMap; Menu2CInfoMap menu2CInfoMap; - for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) - if (cInfo->GossipMenuId) - { - menu2CInfoMap.insert(Menu2CInfoMap::value_type(cInfo->GossipMenuId, cInfo)); + for (auto cInfo : sCreatureStorage) + { + if (cInfo->GossipMenuId) + { + menu2CInfoMap.insert(Menu2CInfoMap::value_type(cInfo->GossipMenuId, cInfo)); - // unused check data preparing part - if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) - menu_ids.erase(cInfo->GossipMenuId); - } + // unused check data preparing part + if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) + menu_ids.erase(cInfo->GossipMenuId); + } + } do { diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index af3825e094a..14ff44cda34 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -2629,19 +2629,17 @@ void LoadLootTemplates_Creature() LootTemplates_Creature.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) + for (auto cInfo : sCreatureStorage) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (uint32 lootid = cInfo->LootId) { - if (uint32 lootid = cInfo->LootId) - { - if (ids_set.find(lootid) == ids_set.end()) - LootTemplates_Creature.ReportNotExistedId(lootid); - else - ids_setUsed.insert(lootid); - } + if (ids_set.find(lootid) == ids_set.end()) + LootTemplates_Creature.ReportNotExistedId(lootid); + else + ids_setUsed.insert(lootid); } } + for (uint32 itr : ids_setUsed) ids_set.erase(itr); @@ -2704,7 +2702,7 @@ void LoadLootTemplates_Gameobject() LootTemplates_Gameobject.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (auto itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + for (auto itr : sGOStorage) { if (uint32 lootid = itr->GetLootId()) { @@ -2752,17 +2750,14 @@ void LoadLootTemplates_Pickpocketing() LootTemplates_Pickpocketing.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) + for (auto cInfo : sCreatureStorage) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (uint32 lootid = cInfo->PickpocketLootId) { - if (uint32 lootid = cInfo->PickpocketLootId) - { - if (ids_set.find(lootid) == ids_set.end()) - LootTemplates_Pickpocketing.ReportNotExistedId(lootid); - else - ids_setUsed.insert(lootid); - } + if (ids_set.find(lootid) == ids_set.end()) + LootTemplates_Pickpocketing.ReportNotExistedId(lootid); + else + ids_setUsed.insert(lootid); } } for (uint32 itr : ids_setUsed) @@ -2818,17 +2813,14 @@ void LoadLootTemplates_Skinning() LootTemplates_Skinning.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) + for (auto cInfo : sCreatureStorage) { - if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) + if (uint32 lootid = cInfo->SkinningLootId) { - if (uint32 lootid = cInfo->SkinningLootId) - { - if (ids_set.find(lootid) == ids_set.end()) - LootTemplates_Skinning.ReportNotExistedId(lootid); - else - ids_setUsed.insert(lootid); - } + if (ids_set.find(lootid) == ids_set.end()) + LootTemplates_Skinning.ReportNotExistedId(lootid); + else + ids_setUsed.insert(lootid); } } for (uint32 itr : ids_setUsed) diff --git a/src/game/Maps/TransportMgr.cpp b/src/game/Maps/TransportMgr.cpp index 1dd649de118..cdd0796a64b 100644 --- a/src/game/Maps/TransportMgr.cpp +++ b/src/game/Maps/TransportMgr.cpp @@ -43,15 +43,14 @@ TransportTemplate* TransportMgr::GetTransportTemplate(uint32 entry) void TransportMgr::LoadTransportTemplates() { - for (uint32 entry = 1; entry <= sGOStorage.GetMaxEntry(); ++entry) + for (auto data : sGOStorage) { - auto data = sGOStorage.LookupEntry(entry); - if (data && data->type == GAMEOBJECT_TYPE_MO_TRANSPORT) + if (data->type == GAMEOBJECT_TYPE_MO_TRANSPORT) { - TransportTemplate& transportTemplate = m_transportTemplates[entry]; - transportTemplate.entry = entry; + TransportTemplate& transportTemplate = m_transportTemplates[data->id]; + transportTemplate.entry = data->id; if (!GenerateWaypoints(data, transportTemplate)) - m_transportTemplates.erase(entry); + m_transportTemplates.erase(data->id); } } } diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index 5da2ccc2c0e..847ccef8524 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -2016,7 +2016,7 @@ void SpellMgr::LoadSpellScriptTarget() sSpellScriptTargetStorage.Load(); // Check content - for (auto itr = sSpellScriptTargetStorage.getDataBegin(); itr < sSpellScriptTargetStorage.getDataEnd(); ++itr) + for (auto itr = sSpellScriptTargetStorage.begin(); itr < sSpellScriptTargetStorage.end(); ++itr) { SpellEntry const* spellProto = sSpellTemplate.LookupEntry(itr->spellId); if (!spellProto) From b3e9bbbeb7b496c54d809eee59f6fa11bbf860d2 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Fri, 5 Mar 2021 18:17:02 +0100 Subject: [PATCH 07/28] Convert more SQLStorages loop - sCreatureDataAddonStorage - sCreatureInfoAddonStorage - sCreatureModelStorage - sEquipmentStorage - sEquipmentStorageRaw - sPageTextStore - sItemStorage - sInstanceTemplate - sWorldTemplate - sConditionStorage - sSpellTemplate - sFactionStore - sCreatureConditionalSpawnStore --- src/game/Chat/Level2.cpp | 48 +++--- src/game/Chat/Level3.cpp | 74 ++++----- src/game/DBScripts/ScriptMgr.cpp | 31 ++-- src/game/Globals/Conditions.h | 2 + src/game/Globals/ObjectMgr.cpp | 249 +++++++++++++------------------ src/game/Loot/LootMgr.cpp | 41 ++--- src/game/Server/DBCStores.cpp | 9 +- src/game/Spells/SpellMgr.cpp | 32 +--- 8 files changed, 194 insertions(+), 292 deletions(-) diff --git a/src/game/Chat/Level2.cpp b/src/game/Chat/Level2.cpp index 8518d4f4f05..6e1a835d0de 100644 --- a/src/game/Chat/Level2.cpp +++ b/src/game/Chat/Level2.cpp @@ -1440,39 +1440,35 @@ bool ChatHandler::HandleLookupFactionCommand(char* args) uint32 counter = 0; // Counter for figure out that we found smth. - for (uint32 id = 0; id < sFactionStore.GetMaxEntry(); ++id) + for (auto factionEntry : sFactionStore) { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(id); - if (factionEntry) - { - int loc = GetSessionDbcLocale(); - std::string name = factionEntry->name[loc]; - if (name.empty()) - continue; + int loc = GetSessionDbcLocale(); + std::string name = factionEntry->name[loc]; + if (name.empty()) + continue; - if (!Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) { - loc = 0; - for (; loc < MAX_LOCALE; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; + if (loc == GetSessionDbcLocale()) + continue; - name = factionEntry->name[loc]; - if (name.empty()) - continue; + name = factionEntry->name[loc]; + if (name.empty()) + continue; - if (Utf8FitTo(name, wnamepart)) - break; - } + if (Utf8FitTo(name, wnamepart)) + break; } + } - if (loc < MAX_LOCALE) - { - FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : nullptr; - ShowFactionListHelper(factionEntry, LocaleConstant(loc), repState, target); - ++counter; - } + if (loc < MAX_LOCALE) + { + FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : nullptr; + ShowFactionListHelper(factionEntry, LocaleConstant(loc), repState, target); + ++counter; } } diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp index 3e999ecad1a..96fe4588890 100644 --- a/src/game/Chat/Level3.cpp +++ b/src/game/Chat/Level3.cpp @@ -1410,12 +1410,8 @@ bool ChatHandler::HandleLearnAllCommand(char* /*args*/) return false; } - for (uint32 i = 0; i < sSpellTemplate.GetMaxEntry(); i++) + for (auto spellInfo : sSpellTemplate) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); - if (!spellInfo) - continue; - for (uint32 j = 0; j < MAX_EFFECT_INDEX; j++) { if ((spellInfo->Effect[j] == SPELL_EFFECT_LEARN_SPELL) && @@ -1792,12 +1788,8 @@ bool ChatHandler::HandleAddItemSetCommand(char* args) DETAIL_LOG(GetMangosString(LANG_ADDITEMSET), itemsetId); bool found = false; - for (uint32 id = 0; id < sItemStorage.GetMaxEntry(); ++id) + for (auto pProto : sItemStorage) { - ItemPrototype const* pProto = sItemStorage.LookupEntry(id); - if (!pProto) - continue; - if (pProto->ItemSet == itemsetId) { found = true; @@ -2235,20 +2227,16 @@ bool ChatHandler::HandleLookupItemCommand(char* args) uint32 counter = 0; // Search in `item_template` - for (uint32 id = 0; id < sItemStorage.GetMaxEntry(); ++id) + for (auto pProto : sItemStorage) { - ItemPrototype const* pProto = sItemStorage.LookupEntry(id); - if (!pProto) - continue; - int loc_idx = GetSessionDbLocaleIndex(); std::string name; // "" for let later only single time check default locale name directly - sObjectMgr.GetItemLocaleStrings(id, loc_idx, &name); + sObjectMgr.GetItemLocaleStrings(pProto->ItemId, loc_idx, &name); if ((name.empty() || !Utf8FitTo(name, wnamepart)) && !Utf8FitTo(pProto->Name1, wnamepart)) continue; - ShowItemListHelper(id, loc_idx, pl); + ShowItemListHelper(pProto->ItemId, loc_idx, pl); ++counter; } @@ -2463,38 +2451,34 @@ bool ChatHandler::HandleLookupSpellCommand(char* args) uint32 counter = 0; // Counter for figure out that we found smth. // Search in Spell.dbc - for (uint32 id = 0; id < sSpellTemplate.GetMaxEntry(); ++id) + for (auto spellInfo : sSpellTemplate) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(id); - if (spellInfo) - { - int loc = int(DEFAULT_LOCALE); - std::string name = spellInfo->SpellName[loc]; - if (name.empty()) - continue; + int loc = int(DEFAULT_LOCALE); + std::string name = spellInfo->SpellName[loc]; + if (name.empty()) + continue; - if (!Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) { - loc = 0; - for (; loc < MAX_LOCALE; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; + if (loc == GetSessionDbcLocale()) + continue; - name = spellInfo->SpellName[loc]; - if (name.empty()) - continue; + name = spellInfo->SpellName[loc]; + if (name.empty()) + continue; - if (Utf8FitTo(name, wnamepart)) - break; - } + if (Utf8FitTo(name, wnamepart)) + break; } + } - if (loc < MAX_LOCALE) - { - ShowSpellListHelper(target, spellInfo, LocaleConstant(loc)); - ++counter; - } + if (loc < MAX_LOCALE) + { + ShowSpellListHelper(target, spellInfo, LocaleConstant(loc)); + ++counter; } } if (counter == 0) // if counter == 0 then we found nth @@ -4486,12 +4470,8 @@ bool ChatHandler::HandleQuestAddCommand(char* args) } // check item starting quest (it can work incorrectly if added without item in inventory) - for (uint32 id = 0; id < sItemStorage.GetMaxEntry(); ++id) + for (auto pProto : sItemStorage) { - ItemPrototype const* pProto = sItemStorage.LookupEntry(id); - if (!pProto) - continue; - if (pProto->StartQuest == entry) { PSendSysMessage(LANG_COMMAND_QUEST_STARTFROMITEM, entry, pProto->ItemId); diff --git a/src/game/DBScripts/ScriptMgr.cpp b/src/game/DBScripts/ScriptMgr.cpp index 60dc290e361..c5610b16f94 100644 --- a/src/game/DBScripts/ScriptMgr.cpp +++ b/src/game/DBScripts/ScriptMgr.cpp @@ -633,17 +633,18 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) { uint32 taxiSpell = 0; - for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry() && taxiSpell == 0; ++i) + for (auto spell : sSpellTemplate) { - if (SpellEntry const* spell = sSpellTemplate.LookupEntry(i)) - for (int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) + { + if (spell->Effect[j] == SPELL_EFFECT_SEND_TAXI && spell->EffectMiscValue[j] == int32(tmp.sendTaxiPath.taxiPathId)) { - if (spell->Effect[j] == SPELL_EFFECT_SEND_TAXI && spell->EffectMiscValue[j] == int32(tmp.sendTaxiPath.taxiPathId)) - { - taxiSpell = i; - break; - } + taxiSpell = spell->Id; + break; } + } + if (taxiSpell) + break; } if (taxiSpell) @@ -2529,18 +2530,14 @@ void ScriptMgr::CollectPossibleEventIds(std::set& eventIds) } // Load all possible script entries from spells - for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry(); ++i) + for (auto spell : sSpellTemplate) { - SpellEntry const* spell = sSpellTemplate.LookupEntry(i); - if (spell) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { - for (int j = 0; j < MAX_EFFECT_INDEX; ++j) + if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT) { - if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT) - { - if (spell->EffectMiscValue[j]) - eventIds.insert(spell->EffectMiscValue[j]); - } + if (spell->EffectMiscValue[j]) + eventIds.insert(spell->EffectMiscValue[j]); } } } diff --git a/src/game/Globals/Conditions.h b/src/game/Globals/Conditions.h index 99b3e556c4e..ef415987179 100644 --- a/src/game/Globals/Conditions.h +++ b/src/game/Globals/Conditions.h @@ -139,6 +139,8 @@ class ConditionEntry // Checks if the condition is met bool Meets(WorldObject const* target, Map const* map, WorldObject const* source, ConditionSource conditionSourceType) const; + uint32 GetEntry() const { return m_entry; } + private: void DisableCondition() { m_condition = CONDITION_NONE; m_flags ^= CONDITION_FLAG_REVERSE_RESULT; } bool CheckParamRequirements(WorldObject const* target, Map const* map, WorldObject const* source) const; diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index 53323a92c5b..d1d166a4d28 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -816,18 +816,16 @@ void ObjectMgr::LoadCreatureAddons() LoadCreatureAddons(sCreatureInfoAddonStorage, "Entry", "creature template addons"); // check entry ids - for (uint32 i = 1; i < sCreatureInfoAddonStorage.GetMaxEntry(); ++i) - if (CreatureDataAddon const* addon = sCreatureInfoAddonStorage.LookupEntry(i)) - if (!sCreatureStorage.LookupEntry(addon->guidOrEntry)) - sLog.outErrorDb("Creature (Entry: %u) does not exist but has a record in `%s`", addon->guidOrEntry, sCreatureInfoAddonStorage.GetTableName()); + for (auto addon : sCreatureInfoAddonStorage) + if (!sCreatureStorage.LookupEntry(addon->guidOrEntry)) + sLog.outErrorDb("Creature (Entry: %u) does not exist but has a record in `%s`", addon->guidOrEntry, sCreatureInfoAddonStorage.GetTableName()); LoadCreatureAddons(sCreatureDataAddonStorage, "GUID", "creature addons"); // check entry ids - for (uint32 i = 1; i < sCreatureDataAddonStorage.GetMaxEntry(); ++i) - if (CreatureDataAddon const* addon = sCreatureDataAddonStorage.LookupEntry(i)) - if (mCreatureDataMap.find(addon->guidOrEntry) == mCreatureDataMap.end()) - sLog.outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`", addon->guidOrEntry); + for (auto addon : sCreatureDataAddonStorage) + if (mCreatureDataMap.find(addon->guidOrEntry) == mCreatureDataMap.end()) + sLog.outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`", addon->guidOrEntry); } void ObjectMgr::LoadCreatureClassLvlStats() @@ -925,13 +923,8 @@ void ObjectMgr::LoadEquipmentTemplates() { sEquipmentStorage.Load(true); - for (uint32 i = 0; i < sEquipmentStorage.GetMaxEntry(); ++i) + for (auto eqInfo : sEquipmentStorage) { - EquipmentInfo const* eqInfo = sEquipmentStorage.LookupEntry(i); - - if (!eqInfo) - continue; - for (uint8 j = 0; j < 3; ++j) { if (!eqInfo->equipentry[j]) @@ -940,7 +933,7 @@ void ObjectMgr::LoadEquipmentTemplates() ItemPrototype const* itemProto = GetItemPrototype(eqInfo->equipentry[j]); if (!itemProto) { - sLog.outErrorDb("Unknown item (entry=%u) in creature_equip_template.equipentry%u for entry = %u, forced to 0.", eqInfo->equipentry[j], j + 1, i); + sLog.outErrorDb("Unknown item (entry=%u) in creature_equip_template.equipentry%u for entry = %u, forced to 0.", eqInfo->equipentry[j], j + 1, eqInfo->entry); const_cast(eqInfo)->equipentry[j] = 0; continue; } @@ -956,7 +949,7 @@ void ObjectMgr::LoadEquipmentTemplates() itemProto->InventoryType != INVTYPE_RANGEDRIGHT && itemProto->InventoryType != INVTYPE_RELIC) { - sLog.outErrorDb("Item (entry=%u) in creature_equip_template.equipentry%u for entry = %u is not equipable in a hand, forced to 0.", eqInfo->equipentry[j], j + 1, i); + sLog.outErrorDb("Item (entry=%u) in creature_equip_template.equipentry%u for entry = %u is not equipable in a hand, forced to 0.", eqInfo->equipentry[j], j + 1, eqInfo->entry); const_cast(eqInfo)->equipentry[j] = 0; } } @@ -966,10 +959,9 @@ void ObjectMgr::LoadEquipmentTemplates() sLog.outString(); sEquipmentStorageRaw.Load(false); - for (uint32 i = 1; i < sEquipmentStorageRaw.GetMaxEntry(); ++i) - if (sEquipmentStorageRaw.LookupEntry(i)) - if (sEquipmentStorage.LookupEntry(i)) - sLog.outErrorDb("Table 'creature_equip_template_raw` have redundant data for ID %u ('creature_equip_template` already have data)", i); + for (auto eqRawInfo : sEquipmentStorageRaw) + if (sEquipmentStorage.LookupEntry(eqRawInfo->entry)) + sLog.outErrorDb("Table 'creature_equip_template_raw` have redundant data for ID %u ('creature_equip_template` already have data)", eqRawInfo->entry); sLog.outString(">> Loaded %u equipment template (deprecated format)", sEquipmentStorageRaw.GetNumRows()); sLog.outString(); @@ -1034,12 +1026,8 @@ void ObjectMgr::LoadCreatureModelInfo() sCreatureModelStorage.Load(); // post processing - for (uint32 i = 1; i < sCreatureModelStorage.GetMaxEntry(); ++i) + for (auto minfo : sCreatureModelStorage) { - CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry(i); - if (!minfo) - continue; - if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid)) sLog.outErrorDb("Table `creature_model_info` has model for nonexistent model id (%u).", minfo->modelid); @@ -1249,12 +1237,8 @@ void ObjectMgr::LoadCreatureConditionalSpawn() sCreatureConditionalSpawnStore.Load(); // post processing - for (uint32 i = 1; i < sCreatureConditionalSpawnStore.GetMaxEntry(); ++i) + for (auto spawn : sCreatureConditionalSpawnStore) { - CreatureConditionalSpawn const* spawn = sCreatureConditionalSpawnStore.LookupEntry(i); - if (!spawn) - continue; - CreatureInfo const* cInfoAlliance = GetCreatureTemplate(spawn->EntryAlliance); CreatureInfo const* cInfoHorde = GetCreatureTemplate(spawn->EntryHorde); @@ -2024,10 +2008,9 @@ void ObjectMgr::LoadItemPrototypes() loader.Load(sItemStorage); // check data correctness - for (uint32 i = 1; i < sItemStorage.GetMaxEntry(); ++i) + for (auto proto : sItemStorage) { - ItemPrototype const* proto = sItemStorage.LookupEntry(i); - ItemEntry const* dbcitem = sItemStore.LookupEntry(i); + ItemEntry const* dbcitem = sItemStore.LookupEntry(proto->ItemId); if (!proto) { /* to many errors, and possible not all items really used in game @@ -2041,62 +2024,62 @@ void ObjectMgr::LoadItemPrototypes() if (Spell.SpellCategory && Spell.SpellId) { if (sSpellTemplate.LookupEntry(Spell.SpellId)) - sItemSpellCategoryStore[Spell.SpellCategory].insert(ItemCategorySpellPair(Spell.SpellId, i)); + sItemSpellCategoryStore[Spell.SpellCategory].insert(ItemCategorySpellPair(Spell.SpellId, proto->ItemId)); else - sLog.outErrorDb("Item (Entry: %u) not correct %u spell id, must exist in spell table.", i, Spell.SpellId); + sLog.outErrorDb("Item (Entry: %u) not correct %u spell id, must exist in spell table.", proto->ItemId, Spell.SpellId); } if (dbcitem) { if (proto->InventoryType != dbcitem->InventoryType) { - sLog.outErrorDb("Item (Entry: %u) not correct %u inventory type, must be %u (still using DB value).", i, proto->InventoryType, dbcitem->InventoryType); + sLog.outErrorDb("Item (Entry: %u) not correct %u inventory type, must be %u (still using DB value).", proto->ItemId, proto->InventoryType, dbcitem->InventoryType); // It safe let use InventoryType from DB } if (proto->DisplayInfoID != dbcitem->DisplayId) { - sLog.outErrorDb("Item (Entry: %u) not correct %u display id, must be %u (using it).", i, proto->DisplayInfoID, dbcitem->DisplayId); + sLog.outErrorDb("Item (Entry: %u) not correct %u display id, must be %u (using it).", proto->ItemId, proto->DisplayInfoID, dbcitem->DisplayId); const_cast(proto)->DisplayInfoID = dbcitem->DisplayId; } if (proto->Sheath != dbcitem->Sheath) { - sLog.outErrorDb("Item (Entry: %u) not correct %u sheath, must be %u (using it).", i, proto->Sheath, dbcitem->Sheath); + sLog.outErrorDb("Item (Entry: %u) not correct %u sheath, must be %u (using it).", proto->ItemId, proto->Sheath, dbcitem->Sheath); const_cast(proto)->Sheath = dbcitem->Sheath; } } else { - sLog.outErrorDb("Item (Entry: %u) not correct (not listed in list of existing items).", i); + sLog.outErrorDb("Item (Entry: %u) not correct (not listed in list of existing items).", proto->ItemId); } if (proto->Class >= MAX_ITEM_CLASS) { - sLog.outErrorDb("Item (Entry: %u) has wrong Class value (%u)", i, proto->Class); + sLog.outErrorDb("Item (Entry: %u) has wrong Class value (%u)", proto->ItemId, proto->Class); const_cast(proto)->Class = ITEM_CLASS_MISC; } if (proto->SubClass >= MaxItemSubclassValues[proto->Class]) { - sLog.outErrorDb("Item (Entry: %u) has wrong Subclass value (%u) for class %u", i, proto->SubClass, proto->Class); + sLog.outErrorDb("Item (Entry: %u) has wrong Subclass value (%u) for class %u", proto->ItemId, proto->SubClass, proto->Class); const_cast(proto)->SubClass = 0;// exist for all item classes } if (proto->Quality >= MAX_ITEM_QUALITY) { - sLog.outErrorDb("Item (Entry: %u) has wrong Quality value (%u)", i, proto->Quality); + sLog.outErrorDb("Item (Entry: %u) has wrong Quality value (%u)", proto->ItemId, proto->Quality); const_cast(proto)->Quality = ITEM_QUALITY_NORMAL; } if (proto->BuyCount <= 0) { - sLog.outErrorDb("Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", i, proto->BuyCount); + sLog.outErrorDb("Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", proto->ItemId, proto->BuyCount); const_cast(proto)->BuyCount = 1; } if (proto->InventoryType >= MAX_INVTYPE) { - sLog.outErrorDb("Item (Entry: %u) has wrong InventoryType value (%u)", i, proto->InventoryType); + sLog.outErrorDb("Item (Entry: %u) has wrong InventoryType value (%u)", proto->ItemId, proto->InventoryType); const_cast(proto)->InventoryType = INVTYPE_NON_EQUIP; } @@ -2104,13 +2087,13 @@ void ObjectMgr::LoadItemPrototypes() { if (proto->Flags & ITEM_FLAG_HAS_LOOT) { - sLog.outErrorDb("Item container (Entry: %u) has not allowed for containers flag ITEM_FLAG_LOOTABLE (%u), flag removed.", i, ITEM_FLAG_HAS_LOOT); + sLog.outErrorDb("Item container (Entry: %u) has not allowed for containers flag ITEM_FLAG_LOOTABLE (%u), flag removed.", proto->ItemId, ITEM_FLAG_HAS_LOOT); const_cast(proto)->Flags &= ~ITEM_FLAG_HAS_LOOT; } if (proto->Flags & ITEM_FLAG_IS_PROSPECTABLE) { - sLog.outErrorDb("Item container (Entry: %u) has not allowed for containers flag ITEM_FLAG_PROSPECTABLE (%u), flag removed.", i, ITEM_FLAG_IS_PROSPECTABLE); + sLog.outErrorDb("Item container (Entry: %u) has not allowed for containers flag ITEM_FLAG_PROSPECTABLE (%u), flag removed.", proto->ItemId, ITEM_FLAG_IS_PROSPECTABLE); const_cast(proto)->Flags &= ~ITEM_FLAG_IS_PROSPECTABLE; } } @@ -2118,14 +2101,14 @@ void ObjectMgr::LoadItemPrototypes() { if (proto->ContainerSlots > 0) { - sLog.outErrorDb("Non-container item (Entry: %u) has ContainerSlots (%u), set to 0.", i, proto->ContainerSlots); + sLog.outErrorDb("Non-container item (Entry: %u) has ContainerSlots (%u), set to 0.", proto->ItemId, proto->ContainerSlots); const_cast(proto)->ContainerSlots = 0; } } if (proto->RequiredSkill >= MAX_SKILL_TYPE) { - sLog.outErrorDb("Item (Entry: %u) has wrong RequiredSkill value (%u)", i, proto->RequiredSkill); + sLog.outErrorDb("Item (Entry: %u) has wrong RequiredSkill value (%u)", proto->ItemId, proto->RequiredSkill); const_cast(proto)->RequiredSkill = 0; } @@ -2147,44 +2130,44 @@ void ObjectMgr::LoadItemPrototypes() if (req) { if (!(proto->AllowableClass & CLASSMASK_ALL_PLAYABLE)) - sLog.outErrorDb("Item (Entry: %u) not have in `AllowableClass` any playable classes (%u) and can't be equipped or use.", i, proto->AllowableClass); + sLog.outErrorDb("Item (Entry: %u) not have in `AllowableClass` any playable classes (%u) and can't be equipped or use.", proto->ItemId, proto->AllowableClass); if (!(proto->AllowableRace & RACEMASK_ALL_PLAYABLE)) - sLog.outErrorDb("Item (Entry: %u) not have in `AllowableRace` any playable races (%u) and can't be equipped or use.", i, proto->AllowableRace); + sLog.outErrorDb("Item (Entry: %u) not have in `AllowableRace` any playable races (%u) and can't be equipped or use.", proto->ItemId, proto->AllowableRace); } } if (proto->RequiredSpell && !sSpellTemplate.LookupEntry(proto->RequiredSpell)) { - sLog.outErrorDb("Item (Entry: %u) have wrong (nonexistent) spell in RequiredSpell (%u)", i, proto->RequiredSpell); + sLog.outErrorDb("Item (Entry: %u) have wrong (nonexistent) spell in RequiredSpell (%u)", proto->ItemId, proto->RequiredSpell); const_cast(proto)->RequiredSpell = 0; } if (proto->RequiredReputationRank >= MAX_REPUTATION_RANK) - sLog.outErrorDb("Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", i, proto->RequiredReputationRank); + sLog.outErrorDb("Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", proto->ItemId, proto->RequiredReputationRank); if (proto->RequiredReputationFaction) { if (!sFactionStore.LookupEntry(proto->RequiredReputationFaction)) { - sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", i, proto->RequiredReputationFaction); + sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", proto->ItemId, proto->RequiredReputationFaction); const_cast(proto)->RequiredReputationFaction = 0; } if (proto->RequiredReputationRank == MIN_REPUTATION_RANK) - sLog.outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", i); + sLog.outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", proto->ItemId); } else if (proto->RequiredReputationRank > MIN_REPUTATION_RANK) - sLog.outErrorDb("Item (Entry: %u) has RequiredReputationFaction ==0 but RequiredReputationRank > 0, rank setting is useless.", i); + sLog.outErrorDb("Item (Entry: %u) has RequiredReputationFaction ==0 but RequiredReputationRank > 0, rank setting is useless.", proto->ItemId); if (proto->Stackable == 0) { - sLog.outErrorDb("Item (Entry: %u) has wrong value in stackable (%u), replace by default 1.", i, proto->Stackable); + sLog.outErrorDb("Item (Entry: %u) has wrong value in stackable (%u), replace by default 1.", proto->ItemId, proto->Stackable); const_cast(proto)->Stackable = 1; } else if (proto->Stackable > 255) { - sLog.outErrorDb("Item (Entry: %u) has too large value in stackable (%u), replace by hardcoded upper limit (255).", i, proto->Stackable); + sLog.outErrorDb("Item (Entry: %u) has too large value in stackable (%u), replace by hardcoded upper limit (255).", proto->ItemId, proto->Stackable); const_cast(proto)->Stackable = 255; } @@ -2192,7 +2175,7 @@ void ObjectMgr::LoadItemPrototypes() { if (proto->ContainerSlots > MAX_BAG_SIZE) { - sLog.outErrorDb("Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", i, proto->ContainerSlots, MAX_BAG_SIZE); + sLog.outErrorDb("Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", proto->ItemId, proto->ContainerSlots, MAX_BAG_SIZE); const_cast(proto)->ContainerSlots = MAX_BAG_SIZE; } } @@ -2202,7 +2185,7 @@ void ObjectMgr::LoadItemPrototypes() // for ItemStatValue != 0 if (proto->ItemStat[j].ItemStatValue && proto->ItemStat[j].ItemStatType >= MAX_ITEM_MOD) { - sLog.outErrorDb("Item (Entry: %u) has wrong stat_type%d (%u)", i, j + 1, proto->ItemStat[j].ItemStatType); + sLog.outErrorDb("Item (Entry: %u) has wrong stat_type%d (%u)", proto->ItemId, j + 1, proto->ItemStat[j].ItemStatType); const_cast(proto)->ItemStat[j].ItemStatType = 0; } } @@ -2211,7 +2194,7 @@ void ObjectMgr::LoadItemPrototypes() { if (proto->Damage[j].DamageType >= MAX_SPELL_SCHOOL) { - sLog.outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", i, j + 1, proto->Damage[j].DamageType); + sLog.outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", proto->ItemId, j + 1, proto->Damage[j].DamageType); const_cast(proto)->Damage[j].DamageType = 0; } } @@ -2222,7 +2205,7 @@ void ObjectMgr::LoadItemPrototypes() // spell_1 if (proto->Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", i, 0 + 1, proto->Spells[0].SpellTrigger); + sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", proto->ItemId, 0 + 1, proto->Spells[0].SpellTrigger); const_cast(proto)->Spells[0].SpellId = 0; const_cast(proto)->Spells[0].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; const_cast(proto)->Spells[1].SpellId = 0; @@ -2232,14 +2215,14 @@ void ObjectMgr::LoadItemPrototypes() // spell_2 have learning spell if (proto->Spells[1].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", i, 1 + 1, proto->Spells[1].SpellTrigger); + sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", proto->ItemId, 1 + 1, proto->Spells[1].SpellTrigger); const_cast(proto)->Spells[0].SpellId = 0; const_cast(proto)->Spells[1].SpellId = 0; const_cast(proto)->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (!proto->Spells[1].SpellId) { - sLog.outErrorDb("Item (Entry: %u) not has expected spell in spellid_%d in special learning format.", i, 1 + 1); + sLog.outErrorDb("Item (Entry: %u) not has expected spell in spellid_%d in special learning format.", proto->ItemId, 1 + 1); const_cast(proto)->Spells[0].SpellId = 0; const_cast(proto)->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -2248,7 +2231,7 @@ void ObjectMgr::LoadItemPrototypes() SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(proto->Spells[1].SpellId); if (!spellInfo) { - sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%u)", i, 1 + 1, proto->Spells[1].SpellId); + sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%u)", proto->ItemId, 1 + 1, proto->Spells[1].SpellId); const_cast(proto)->Spells[0].SpellId = 0; const_cast(proto)->Spells[1].SpellId = 0; const_cast(proto)->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -2256,7 +2239,7 @@ void ObjectMgr::LoadItemPrototypes() // allowed only in special format else if (proto->Spells[1].SpellId == SPELL_ID_GENERIC_LEARN) { - sLog.outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%u)", i, 1 + 1, proto->Spells[1].SpellId); + sLog.outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%u)", proto->ItemId, 1 + 1, proto->Spells[1].SpellId); const_cast(proto)->Spells[0].SpellId = 0; const_cast(proto)->Spells[1].SpellId = 0; const_cast(proto)->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -2268,13 +2251,13 @@ void ObjectMgr::LoadItemPrototypes() { if (proto->Spells[j].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", i, j + 1, proto->Spells[j].SpellTrigger); + sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", proto->ItemId, j + 1, proto->Spells[j].SpellTrigger); const_cast(proto)->Spells[j].SpellId = 0; const_cast(proto)->Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (proto->Spells[j].SpellId != 0) { - sLog.outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%u) for learning special format", i, j + 1, proto->Spells[j].SpellId); + sLog.outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%u) for learning special format", proto->ItemId, j + 1, proto->Spells[j].SpellId); const_cast(proto)->Spells[j].SpellId = 0; } } @@ -2286,7 +2269,7 @@ void ObjectMgr::LoadItemPrototypes() { if (proto->Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || proto->Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", i, j + 1, proto->Spells[j].SpellTrigger); + sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", proto->ItemId, j + 1, proto->Spells[j].SpellTrigger); const_cast(proto)->Spells[j].SpellId = 0; const_cast(proto)->Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -2294,7 +2277,7 @@ void ObjectMgr::LoadItemPrototypes() else if (proto->Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_CHANCE_ON_HIT) { if (proto->Class != ITEM_CLASS_WEAPON) - sLog.outErrorDb("Item (Entry: %u) isn't weapon (Class: %u) but has on hit spelltrigger_%d (%u), it will not triggered.", i, proto->Class, j + 1, proto->Spells[j].SpellTrigger); + sLog.outErrorDb("Item (Entry: %u) isn't weapon (Class: %u) but has on hit spelltrigger_%d (%u), it will not triggered.", proto->ItemId, proto->Class, j + 1, proto->Spells[j].SpellTrigger); } if (proto->Spells[j].SpellId) @@ -2302,13 +2285,13 @@ void ObjectMgr::LoadItemPrototypes() SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(proto->Spells[j].SpellId); if (!spellInfo) { - sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%u)", i, j + 1, proto->Spells[j].SpellId); + sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%u)", proto->ItemId, j + 1, proto->Spells[j].SpellId); const_cast(proto)->Spells[j].SpellId = 0; } // allowed only in special format else if (proto->Spells[j].SpellId == SPELL_ID_GENERIC_LEARN) { - sLog.outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%u)", i, j + 1, proto->Spells[j].SpellId); + sLog.outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%u)", proto->ItemId, j + 1, proto->Spells[j].SpellId); const_cast(proto)->Spells[j].SpellId = 0; } } @@ -2316,32 +2299,32 @@ void ObjectMgr::LoadItemPrototypes() } if (proto->Bonding >= MAX_BIND_TYPE) - sLog.outErrorDb("Item (Entry: %u) has wrong Bonding value (%u)", i, proto->Bonding); + sLog.outErrorDb("Item (Entry: %u) has wrong Bonding value (%u)", proto->ItemId, proto->Bonding); if (proto->PageText) { if (!sPageTextStore.LookupEntry(proto->PageText)) - sLog.outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", i, proto->PageText); + sLog.outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", proto->ItemId, proto->PageText); } if (proto->LockID && !sLockStore.LookupEntry(proto->LockID)) - sLog.outErrorDb("Item (Entry: %u) has wrong LockID (%u)", i, proto->LockID); + sLog.outErrorDb("Item (Entry: %u) has wrong LockID (%u)", proto->ItemId, proto->LockID); if (proto->Sheath >= MAX_SHEATHETYPE) { - sLog.outErrorDb("Item (Entry: %u) has wrong Sheath (%u)", i, proto->Sheath); + sLog.outErrorDb("Item (Entry: %u) has wrong Sheath (%u)", proto->ItemId, proto->Sheath); const_cast(proto)->Sheath = SHEATHETYPE_NONE; } if (proto->RandomProperty && !sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(proto->RandomProperty))) { - sLog.outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", i, proto->RandomProperty); + sLog.outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", proto->ItemId, proto->RandomProperty); const_cast(proto)->RandomProperty = 0; } if (proto->RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(proto->RandomSuffix))) { - sLog.outErrorDb("Item (Entry: %u) has wrong RandomSuffix (%u)", i, proto->RandomSuffix); + sLog.outErrorDb("Item (Entry: %u) has wrong RandomSuffix (%u)", proto->ItemId, proto->RandomSuffix); const_cast(proto)->RandomSuffix = 0; } @@ -2355,15 +2338,15 @@ void ObjectMgr::LoadItemPrototypes() if (proto->ItemSet && !sItemSetStore.LookupEntry(proto->ItemSet)) { - sLog.outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", i, proto->ItemSet); + sLog.outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", proto->ItemId, proto->ItemSet); const_cast(proto)->ItemSet = 0; } if (proto->Area && !GetAreaEntryByAreaID(proto->Area)) - sLog.outErrorDb("Item (Entry: %u) has wrong Area (%u)", i, proto->Area); + sLog.outErrorDb("Item (Entry: %u) has wrong Area (%u)", proto->ItemId, proto->Area); if (proto->Map && !sMapStore.LookupEntry(proto->Map)) - sLog.outErrorDb("Item (Entry: %u) has wrong Map (%u)", i, proto->Map); + sLog.outErrorDb("Item (Entry: %u) has wrong Map (%u)", proto->ItemId, proto->Map); if (proto->BagFamily) { @@ -2377,30 +2360,30 @@ void ObjectMgr::LoadItemPrototypes() ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j + 1); if (!bf) { - sLog.outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", i); + sLog.outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", proto->ItemId); const_cast(proto)->BagFamily &= ~mask; } } } if (proto->TotemCategory && !sTotemCategoryStore.LookupEntry(proto->TotemCategory)) - sLog.outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", i, proto->TotemCategory); + sLog.outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", proto->ItemId, proto->TotemCategory); for (int j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j) { if (proto->Socket[j].Color && (proto->Socket[j].Color & SOCKET_COLOR_ALL) != proto->Socket[j].Color) { - sLog.outErrorDb("Item (Entry: %u) has wrong socketColor_%d (%u)", i, j + 1, proto->Socket[j].Color); + sLog.outErrorDb("Item (Entry: %u) has wrong socketColor_%d (%u)", proto->ItemId, j + 1, proto->Socket[j].Color); const_cast(proto)->Socket[j].Color = 0; } } if (proto->GemProperties && !sGemPropertiesStore.LookupEntry(proto->GemProperties)) - sLog.outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", i, proto->GemProperties); + sLog.outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", proto->ItemId, proto->GemProperties); if (proto->RequiredDisenchantSkill < -1) { - sLog.outErrorDb("Item (Entry: %u) has wrong RequiredDisenchantSkill (%i), set to (-1).", i, proto->RequiredDisenchantSkill); + sLog.outErrorDb("Item (Entry: %u) has wrong RequiredDisenchantSkill (%i), set to (-1).", proto->ItemId, proto->RequiredDisenchantSkill); const_cast(proto)->RequiredDisenchantSkill = -1; } else if (proto->RequiredDisenchantSkill != -1) @@ -2408,14 +2391,14 @@ void ObjectMgr::LoadItemPrototypes() if (proto->Quality > ITEM_QUALITY_EPIC || proto->Quality < ITEM_QUALITY_UNCOMMON) { ERROR_DB_STRICT_LOG("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable quality (%u), reset it.", - i, proto->RequiredDisenchantSkill, proto->Quality); + proto->ItemId, proto->RequiredDisenchantSkill, proto->Quality); const_cast(proto)->RequiredDisenchantSkill = -1; } else if (proto->Class != ITEM_CLASS_WEAPON && proto->Class != ITEM_CLASS_ARMOR) { // some wrong data in wdb for unused items ERROR_DB_STRICT_LOG("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable item class (%u), reset it.", - i, proto->RequiredDisenchantSkill, proto->Class); + proto->ItemId, proto->RequiredDisenchantSkill, proto->Class); const_cast(proto)->RequiredDisenchantSkill = -1; } } @@ -2424,17 +2407,17 @@ void ObjectMgr::LoadItemPrototypes() { if (proto->Quality > ITEM_QUALITY_EPIC || proto->Quality < ITEM_QUALITY_UNCOMMON) { - sLog.outErrorDb("Item (Entry: %u) has wrong quality (%u) for disenchanting, remove disenchanting loot id.", i, proto->Quality); + sLog.outErrorDb("Item (Entry: %u) has wrong quality (%u) for disenchanting, remove disenchanting loot id.", proto->ItemId, proto->Quality); const_cast(proto)->DisenchantID = 0; } else if (proto->Class != ITEM_CLASS_WEAPON && proto->Class != ITEM_CLASS_ARMOR) { - sLog.outErrorDb("Item (Entry: %u) has wrong item class (%u) for disenchanting, remove disenchanting loot id.", i, proto->Class); + sLog.outErrorDb("Item (Entry: %u) has wrong item class (%u) for disenchanting, remove disenchanting loot id.", proto->ItemId, proto->Class); const_cast(proto)->DisenchantID = 0; } else if (proto->RequiredDisenchantSkill < 0) { - sLog.outErrorDb("Item (Entry: %u) marked as non-disenchantable by RequiredDisenchantSkill == -1, remove disenchanting loot id.", i); + sLog.outErrorDb("Item (Entry: %u) marked as non-disenchantable by RequiredDisenchantSkill == -1, remove disenchanting loot id.", proto->ItemId); const_cast(proto)->DisenchantID = 0; } } @@ -2442,25 +2425,25 @@ void ObjectMgr::LoadItemPrototypes() { // lot DB cases if (proto->RequiredDisenchantSkill >= 0) - ERROR_DB_STRICT_LOG("Item (Entry: %u) marked as disenchantable by RequiredDisenchantSkill, but not have disenchanting loot id.", i); + ERROR_DB_STRICT_LOG("Item (Entry: %u) marked as disenchantable by RequiredDisenchantSkill, but not have disenchanting loot id.", proto->ItemId); } if (proto->FoodType >= MAX_PET_DIET) { - sLog.outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)", i, proto->FoodType); + sLog.outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)", proto->ItemId, proto->FoodType); const_cast(proto)->FoodType = 0; } if (proto->ExtraFlags) { if (proto->ExtraFlags & ~ITEM_EXTRA_ALL) - sLog.outErrorDb("Item (Entry: %u) has wrong ExtraFlags (%u) with unused bits set", i, proto->ExtraFlags); + sLog.outErrorDb("Item (Entry: %u) has wrong ExtraFlags (%u) with unused bits set", proto->ItemId, proto->ExtraFlags); if (proto->ExtraFlags & ITEM_EXTRA_REAL_TIME_DURATION) { if (proto->Duration == 0) { - sLog.outErrorDb("Item (Entry: %u) has redundant real-time duration flag in ExtraFlags, item not have duration", i); + sLog.outErrorDb("Item (Entry: %u) has redundant real-time duration flag in ExtraFlags, item not have duration", proto->ItemId); const_cast(proto)->ExtraFlags &= ~ITEM_EXTRA_REAL_TIME_DURATION; } } @@ -4382,12 +4365,8 @@ void ObjectMgr::LoadQuests() } // check QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE - for (uint32 i = 0; i < sSpellTemplate.GetMaxEntry(); ++i) + for (auto spellInfo : sSpellTemplate) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); - if (!spellInfo) - continue; - for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { if (spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE) @@ -4644,12 +4623,8 @@ void ObjectMgr::LoadPetCreateSpells() // cache spell->learn spell map for use in next loop std::map learnCache; - for (uint32 spell_id = 1; spell_id < sSpellTemplate.GetMaxEntry(); ++spell_id) + for (auto spellproto : sSpellTemplate) { - SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spell_id); - if (!spellproto) - continue; - if (spellproto->Effect[0] != SPELL_EFFECT_LEARN_SPELL && spellproto->Effect[0] != SPELL_EFFECT_LEARN_PET_SPELL) continue; @@ -4733,16 +4708,11 @@ void ObjectMgr::LoadPageTexts() sLog.outString(">> Loaded %u page texts", sPageTextStore.GetNumRows()); sLog.outString(); - for (uint32 i = 1; i < sPageTextStore.GetMaxEntry(); ++i) + for (auto page : sPageTextStore) { - // check data correctness - PageText const* page = sPageTextStore.LookupEntry(i); - if (!page) - continue; - if (page->Next_Page && !sPageTextStore.LookupEntry(page->Next_Page)) { - sLog.outErrorDb("Page text (Id: %u) has not existing next page (Id:%u)", i, page->Next_Page); + sLog.outErrorDb("Page text (Id: %u) has not existing next page (Id:%u)", page->Page_ID, page->Next_Page); continue; } @@ -4909,24 +4879,20 @@ void ObjectMgr::LoadInstanceTemplate() SQLInstanceLoader loader; loader.Load(sInstanceTemplate); - for (uint32 i = 0; i < sInstanceTemplate.GetMaxEntry(); ++i) + for (auto temp : sInstanceTemplate) { - InstanceTemplate const* temp = GetInstanceTemplate(i); - if (!temp) - continue; - MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map); if (!mapEntry) { sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", temp->map); - sInstanceTemplate.EraseEntry(i); + sInstanceTemplate.EraseEntry(temp->map); continue; } if (!mapEntry->Instanceable()) { sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: non-instanceable mapid %d for template!", temp->map); - sInstanceTemplate.EraseEntry(i); + sInstanceTemplate.EraseEntry(temp->map); continue; } @@ -4988,24 +4954,20 @@ void ObjectMgr::LoadWorldTemplate() SQLWorldLoader loader; loader.Load(sWorldTemplate, false); - for (uint32 i = 0; i < sWorldTemplate.GetMaxEntry(); ++i) + for (auto temp : sWorldTemplate) { - WorldTemplate const* temp = GetWorldTemplate(i); - if (!temp) - continue; - MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map); if (!mapEntry) { sLog.outErrorDb("ObjectMgr::LoadWorldTemplate: bad mapid %d for template!", temp->map); - sWorldTemplate.EraseEntry(i); + sWorldTemplate.EraseEntry(temp->map); continue; } if (mapEntry->Instanceable()) { sLog.outErrorDb("ObjectMgr::LoadWorldTemplate: instanceable mapid %d for template!", temp->map); - sWorldTemplate.EraseEntry(i); + sWorldTemplate.EraseEntry(temp->map); } } @@ -5027,16 +4989,12 @@ void ObjectMgr::LoadConditions() SQLConditionLoader loader; loader.Load(sConditionStorage); - for (uint32 i = 0; i < sConditionStorage.GetMaxEntry(); ++i) + for (auto condition : sConditionStorage) { - ConditionEntry const* condition = sConditionStorage.LookupEntry(i); - if (!condition) - continue; - if (!condition->IsValid()) { - sLog.outErrorDb("ObjectMgr::LoadConditions: invalid condition_entry %u, skip", i); - sConditionStorage.EraseEntry(i); + sLog.outErrorDb("ObjectMgr::LoadConditions: invalid condition_entry %u, skip", condition->GetEntry()); + sConditionStorage.EraseEntry(condition->GetEntry()); continue; } } @@ -7566,7 +7524,7 @@ void ObjectMgr::LoadSpellTemplate() sSpellTemplate.Load(); /* TODO add validation for spell_dbc */ - for (auto itr = sSpellTemplate.begin(); itr < sSpellTemplate.end(); ++itr) + for (auto itr : sSpellTemplate) { if (!sSpellTemplate.LookupEntry(itr->Id)) { @@ -7575,11 +7533,10 @@ void ObjectMgr::LoadSpellTemplate() } } - for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry(); ++i) + for (auto spell : sSpellTemplate) { - SpellEntry const* spell = sSpellTemplate.LookupEntry(i); - if (spell && spell->Category) - sSpellCategoryStore[spell->Category].insert(i); + if (spell->Category) + sSpellCategoryStore[spell->Category].insert(spell->Id); // DBC not support uint64 fields but SpellEntry have SpellFamilyFlags mapped at 2 uint32 fields // uint32 field already converted to bigendian if need, but must be swapped for correct uint64 bigendian view @@ -7598,13 +7555,12 @@ void ObjectMgr::LoadSpellTemplate() void ObjectMgr::CheckSpellCones() { - for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry(); ++i) + for (auto spell : sSpellTemplate) { - SpellEntry const* spell = sSpellTemplate.LookupEntry(i); - SpellCone const* spellCone = sSpellCones.LookupEntry(i); + SpellCone const* spellCone = sSpellCones.LookupEntry(spell->Id); if (spell) { - if (uint32 firstRankId = sSpellMgr.GetFirstSpellInChain(i)) + if (uint32 firstRankId = sSpellMgr.GetFirstSpellInChain(spell->Id)) { SpellCone const* spellConeFirst = sSpellCones.LookupEntry(firstRankId); if (!spellConeFirst && !spellCone) // no cones for either - is fine @@ -7614,9 +7570,9 @@ void ObjectMgr::CheckSpellCones() continue; if (!spellConeFirst && spellCone) - sLog.outErrorDb("Table spell_cone is missing entry for spell %u - angle %d for its first rank %u. But has cone for this one.", i, spellCone->coneAngle, firstRankId); + sLog.outErrorDb("Table spell_cone is missing entry for spell %u - angle %d for its first rank %u. But has cone for this one.", spell->Id, spellCone->coneAngle, firstRankId); else if (spellCone->coneAngle != spellConeFirst->coneAngle) - sLog.outErrorDb("Table spell_cone has different cone angle for spell Id %u - angle %d and first rank %u - angle %d", i, spellCone->coneAngle, firstRankId, spellConeFirst->coneAngle); + sLog.outErrorDb("Table spell_cone has different cone angle for spell Id %u - angle %d and first rank %u - angle %d", spell->Id, spellCone->coneAngle, firstRankId, spellConeFirst->coneAngle); } } } @@ -7626,13 +7582,12 @@ void ObjectMgr::LoadFactions() { sFactionStore.Load(); - for (uint32 i = 0; i < sFactionStore.GetMaxEntry(); ++i) + for (auto faction : sFactionStore) { - FactionEntry const* faction = sFactionStore.LookupEntry(i); - if (faction && faction->team) + if (faction->team) { SimpleFactionsList& flist = sFactionTeamMap[faction->team]; - flist.push_back(i); + flist.push_back(faction->ID); } } diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index 14ff44cda34..160969f691a 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -2657,17 +2657,14 @@ void LoadLootTemplates_Disenchant() LootTemplates_Disenchant.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (uint32 i = 1; i < sItemStorage.GetMaxEntry(); ++i) + for (auto proto : sItemStorage) { - if (ItemPrototype const* proto = sItemStorage.LookupEntry(i)) + if (uint32 lootid = proto->DisenchantID) { - if (uint32 lootid = proto->DisenchantID) - { - if (ids_set.find(lootid) == ids_set.end()) - LootTemplates_Disenchant.ReportNotExistedId(lootid); - else - ids_setUsed.insert(lootid); - } + if (ids_set.find(lootid) == ids_set.end()) + LootTemplates_Disenchant.ReportNotExistedId(lootid); + else + ids_setUsed.insert(lootid); } } for (uint32 itr : ids_setUsed) @@ -2725,21 +2722,17 @@ void LoadLootTemplates_Item() LootTemplates_Item.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (uint32 i = 1; i < sItemStorage.GetMaxEntry(); ++i) + for (auto proto : sItemStorage) { - if (ItemPrototype const* proto = sItemStorage.LookupEntry(i)) - { - if (!(proto->Flags & ITEM_FLAG_HAS_LOOT)) - continue; + if (!(proto->Flags & ITEM_FLAG_HAS_LOOT)) + continue; - if (ids_set.find(proto->ItemId) != ids_set.end() || proto->MaxMoneyLoot > 0) - ids_set.erase(proto->ItemId); - // wdb have wrong data cases, so skip by default - else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) - LootTemplates_Item.ReportNotExistedId(proto->ItemId); - } + if (ids_set.find(proto->ItemId) != ids_set.end() || proto->MaxMoneyLoot > 0) + ids_set.erase(proto->ItemId); + // wdb have wrong data cases, so skip by default + else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) + LootTemplates_Item.ReportNotExistedId(proto->ItemId); } - // output error for any still listed (not referenced from appropriate table) ids LootTemplates_Item.ReportUnusedIds(ids_set); } @@ -2773,12 +2766,8 @@ void LoadLootTemplates_Prospecting() LootTemplates_Prospecting.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (uint32 i = 1; i < sItemStorage.GetMaxEntry(); ++i) + for (auto proto : sItemStorage) { - ItemPrototype const* proto = sItemStorage.LookupEntry(i); - if (!proto) - continue; - if (!(proto->Flags & ITEM_FLAG_IS_PROSPECTABLE)) continue; diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index f1ac3b6fa22..9ea5ffecf61 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -498,11 +498,10 @@ void LoadDBCStores(const std::string& dataPath) // include existing nodes that have at least single not spell base (scripted) path { std::set spellPaths; - for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry(); ++i) - if (SpellEntry const* sInfo = sSpellTemplate.LookupEntry(i)) - for (int j = 0; j < MAX_EFFECT_INDEX; ++j) - if (sInfo->Effect[j] == 123 /*SPELL_EFFECT_SEND_TAXI*/) - spellPaths.insert(sInfo->EffectMiscValue[j]); + for (auto sInfo : sSpellTemplate) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) + if (sInfo->Effect[j] == 123 /*SPELL_EFFECT_SEND_TAXI*/) + spellPaths.insert(sInfo->EffectMiscValue[j]); memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask)); for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i) diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index 847ccef8524..98d2eaa68ef 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -1869,13 +1869,9 @@ void SpellMgr::LoadSpellLearnSkills() // search auto-learned skills and add its to map also for use in unlearn spells/talents uint32 dbc_count = 0; BarGoLink bar(sSpellTemplate.GetMaxEntry()); - for (uint32 spell = 0; spell < sSpellTemplate.GetMaxEntry(); ++spell) + for (auto entry : sSpellTemplate) { bar.step(); - SpellEntry const* entry = sSpellTemplate.LookupEntry(spell); - - if (!entry) - continue; for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { @@ -1888,7 +1884,7 @@ void SpellMgr::LoadSpellLearnSkills() if (dbc_node.skill && dbc_node.step) { - mSpellLearnSkills[spell] = dbc_node; + mSpellLearnSkills[entry->Id] = dbc_node; ++dbc_count; break; } @@ -2127,18 +2123,14 @@ void SpellMgr::LoadSpellScriptTarget() // Check all spells if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) { - for (uint32 i = 1; i < sSpellTemplate.GetMaxEntry(); ++i) + for (auto spellInfo : sSpellTemplate) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(i); - if (!spellInfo) - continue; - for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { if (spellInfo->Effect[j] && (spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_SCRIPT_NEAR_CASTER || (spellInfo->EffectImplicitTargetA[j] != TARGET_UNIT_CASTER && spellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_SCRIPT_NEAR_CASTER))) { - auto bounds = sSpellScriptTargetStorage.getBounds(i); + auto bounds = sSpellScriptTargetStorage.getBounds(spellInfo->Id); if (bounds.first == bounds.second) { sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = %u (TARGET_UNIT_SCRIPT_NEAR_CASTER), but does not have record in `spell_script_target`", spellInfo->Id, TARGET_UNIT_SCRIPT_NEAR_CASTER); @@ -2854,12 +2846,8 @@ void SpellMgr::CheckUsedSpells(char const* table) const ++countMasks; bool found = false; - for (uint32 spellId = 1; spellId < sSpellTemplate.GetMaxEntry(); ++spellId) + for (auto spellEntry : sSpellTemplate) { - SpellEntry const* spellEntry = sSpellTemplate.LookupEntry(spellId); - if (!spellEntry) - continue; - if (family >= 0 && spellEntry->SpellFamilyName != uint32(family)) continue; @@ -3291,12 +3279,8 @@ void SpellMgr::LoadSpellAffects() sLog.outString(); sLog.outString(">> Loaded %u spell affect definitions", count); - for (uint32 id = 0; id < sSpellTemplate.GetMaxEntry(); ++id) + for (auto spellInfo : sSpellTemplate) { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(id); - if (!spellInfo) - continue; - for (int effectId = 0; effectId < MAX_EFFECT_INDEX; ++effectId) { if (spellInfo->Effect[effectId] != SPELL_EFFECT_APPLY_AURA || ( @@ -3309,10 +3293,10 @@ void SpellMgr::LoadSpellAffects() if (spellInfo->EffectItemType[effectId] != 0) continue; - if (mSpellAffectMap.find((id << 8) + effectId) != mSpellAffectMap.end()) + if (mSpellAffectMap.find((spellInfo->Id << 8) + effectId) != mSpellAffectMap.end()) continue; - sLog.outErrorDb("Spell %u (%s) misses spell_affect for effect %u", id, spellInfo->SpellName[sWorld.GetDefaultDbcLocale()], effectId); + sLog.outErrorDb("Spell %u (%s) misses spell_affect for effect %u", spellInfo->Id, spellInfo->SpellName[sWorld.GetDefaultDbcLocale()], effectId); } } } From d80a6d639e2d333639edab6ae56e7242c4deb5ba Mon Sep 17 00:00:00 2001 From: Cyberium Date: Fri, 5 Mar 2021 19:00:34 +0100 Subject: [PATCH 08/28] Should fix template build --- src/shared/Database/SQLStorage.h | 6 +++--- src/shared/Database/SQLStorageImpl.h | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/shared/Database/SQLStorage.h b/src/shared/Database/SQLStorage.h index e5621a86d1b..d19a6b08316 100644 --- a/src/shared/Database/SQLStorage.h +++ b/src/shared/Database/SQLStorage.h @@ -111,7 +111,7 @@ class SQLStorage : public SQLStorageBase ST const* LookupEntry(uint32 id) const { - if (id >= GetMaxEntry()) + if (id >= SQLStorageBase::GetMaxEntry()) return nullptr; return reinterpret_cast(m_Index[id]); } @@ -175,8 +175,8 @@ template class SQLMultiStorage : public SQLStorageBase { template friend class SQLStorageLoaderBase; - template friend class SQLMultiSIterator; - template friend class SQLMSIteratorBounds; + friend class SQLMultiSIterator; + friend class SQLMSIteratorBounds; private: typedef std::multimap RecordMultiMap; diff --git a/src/shared/Database/SQLStorageImpl.h b/src/shared/Database/SQLStorageImpl.h index df1009f7b17..31f79cd2d91 100644 --- a/src/shared/Database/SQLStorageImpl.h +++ b/src/shared/Database/SQLStorageImpl.h @@ -366,7 +366,7 @@ void SQLStorage::EraseEntry(uint32 id) template void SQLStorage::Free() { - SQLStorageBase::Free(); + SQLStorageBase::Free(); delete[] m_Index; m_Index = nullptr; } @@ -381,14 +381,14 @@ void SQLStorage::Load(bool error_at_empty /*= true*/) template SQLStorage::SQLStorage(const char* fmt, const char* _entry_field, const char* sqlname) { - Initialize(sqlname, _entry_field, fmt, fmt); + SQLStorage::Initialize(sqlname, _entry_field, fmt, fmt); m_Index = nullptr; } template SQLStorage::SQLStorage(const char* src_fmt, const char* dst_fmt, const char* _entry_field, const char* sqlname) { - Initialize(sqlname, _entry_field, src_fmt, dst_fmt); + SQLStorage::Initialize(sqlname, _entry_field, src_fmt, dst_fmt); m_Index = nullptr; } @@ -402,7 +402,7 @@ void SQLStorage::prepareToLoad(uint32 maxRecordId, uint32 recordCount, uint3 m_Index = new char* [maxRecordId]; memset(m_Index, 0, maxRecordId * sizeof(char*)); - SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); + SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); } // ----------------------------------- SQLStorageBase ---------------------------------------- // @@ -515,14 +515,14 @@ void SQLStorageBase::Free() template void SQLHashStorage::Load() { - SQLHashStorageLoader loader; + SQLHashStorageLoader loader; loader.Load(*this); } template void SQLHashStorage::Free() { - SQLStorageBase::Free(); + SQLStorageBase::Free(); m_indexMap.clear(); } @@ -532,7 +532,7 @@ void SQLHashStorage::prepareToLoad(uint32 maxRecordId, uint32 recordCount, u // Clear (possible) old data and old index array Free(); - SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); + SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize); } template @@ -547,13 +547,13 @@ void SQLHashStorage::EraseEntry(uint32 id) template SQLHashStorage::SQLHashStorage(const char* fmt, const char* _entry_field, const char* sqlname) { - Initialize(sqlname, _entry_field, fmt, fmt); + SQLHashStorage::Initialize(sqlname, _entry_field, fmt, fmt); } template SQLHashStorage::SQLHashStorage(const char* src_fmt, const char* dst_fmt, const char* _entry_field, const char* sqlname) { - Initialize(sqlname, _entry_field, src_fmt, dst_fmt); + SQLHashStorage::Initialize(sqlname, _entry_field, src_fmt, dst_fmt); } // ----------------------------------- SQLMultiStorage --------------------------------------- // @@ -589,13 +589,13 @@ void SQLMultiStorage::EraseEntry(uint32 id) template SQLMultiStorage::SQLMultiStorage(const char* fmt, const char* _entry_field, const char* sqlname) { - Initialize(sqlname, _entry_field, fmt, fmt); + SQLMultiStorage::Initialize(sqlname, _entry_field, fmt, fmt); } template SQLMultiStorage::SQLMultiStorage(const char* src_fmt, const char* dst_fmt, const char* _entry_field, const char* sqlname) { - Initialize(sqlname, _entry_field, src_fmt, dst_fmt); + SQLMultiStorage::Initialize(sqlname, _entry_field, src_fmt, dst_fmt); } From 5c6b4fa29955ac9d93b80dae305698e2373a3635 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Sat, 6 Mar 2021 18:06:37 +0100 Subject: [PATCH 09/28] Fix PlayerBot build --- src/game/PlayerBot/AI/PlayerbotHunterAI.cpp | 2 +- src/game/PlayerBot/Base/PlayerbotAI.cpp | 64 ++++++++++---------- src/game/PlayerBot/Base/PlayerbotClassAI.cpp | 8 +-- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/game/PlayerBot/AI/PlayerbotHunterAI.cpp b/src/game/PlayerBot/AI/PlayerbotHunterAI.cpp index a2dd0c81922..844a41527bf 100644 --- a/src/game/PlayerBot/AI/PlayerbotHunterAI.cpp +++ b/src/game/PlayerBot/AI/PlayerbotHunterAI.cpp @@ -323,7 +323,7 @@ CombatManeuverReturns PlayerbotHunterAI::DoNextCombatManeuverPVE(Unit* pTarget) if (m_bot.isAttackReady(RANGED_ATTACK)) m_bot.CastSpell(pTarget, AUTO_SHOT, TRIGGERED_OLD_TRIGGERED); - const SpellEntry* spellInfo = sSpellTemplate.LookupEntry(AUTO_SHOT); + const SpellEntry* spellInfo = sSpellTemplate.LookupEntry(AUTO_SHOT); if (!spellInfo) return RETURN_CONTINUE; diff --git a/src/game/PlayerBot/Base/PlayerbotAI.cpp b/src/game/PlayerBot/Base/PlayerbotAI.cpp index aa7d21a4b11..ad855a7e71a 100644 --- a/src/game/PlayerBot/Base/PlayerbotAI.cpp +++ b/src/game/PlayerBot/Base/PlayerbotAI.cpp @@ -167,7 +167,7 @@ bool PlayerbotAI::CanReachWithSpellAttack(Unit* target) if (target->HasAura(spellId, EFFECT_INDEX_0)) continue; - const SpellEntry* spellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) continue; @@ -240,7 +240,7 @@ uint32 PlayerbotAI::getSpellId(const char* args, bool master) const if (itr->second.state == PLAYERSPELL_REMOVED || itr->second.disabled || IsPassiveSpell(spellId)) continue; - const SpellEntry* pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) continue; @@ -304,7 +304,7 @@ uint32 PlayerbotAI::getPetSpellId(const char* args) const if (itr->second.state == PETSPELL_REMOVED || IsPassiveSpell(spellId)) continue; - const SpellEntry* pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) continue; @@ -359,7 +359,7 @@ uint32 PlayerbotAI::initSpell(uint32 spellId) } if (next == 0) { - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) return spellId; @@ -394,7 +394,7 @@ uint32 PlayerbotAI::initPetSpell(uint32 spellIconId) if (itr->second.state == PETSPELL_REMOVED || IsPassiveSpell(spellId)) continue; - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) continue; @@ -1799,7 +1799,7 @@ void PlayerbotAI::HandleBotOutgoingPacket(const WorldPacket& packet) p >> spellId >> result >> castCount; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return; @@ -1950,7 +1950,7 @@ void PlayerbotAI::HandleBotOutgoingPacket(const WorldPacket& packet) uint32 spellId = itr->first; if (itr->second.state == PLAYERSPELL_REMOVED || itr->second.disabled || IsPassiveSpell(spellId)) continue; - const SpellEntry* pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) continue; @@ -2308,7 +2308,7 @@ void PlayerbotAI::HandleBotOutgoingPacket(const WorldPacket& packet) // DEBUG_LOG("castItemGuid (%s) casterItemGuid(%s) spellId (%u) cast_count (%u) castFlags (%u) msTime (%u)",castItemGuid.GetString().c_str(),casterGuid.GetString().c_str(), spellId, cast_count, castFlags, msTime); - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) return; @@ -2772,7 +2772,7 @@ Item* PlayerbotAI::FindMount(uint32 matchingRidingSkill) const break; } } - const SpellEntry* const spellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const spellInfo = sSpellTemplate.LookupEntry(spellId); if (spellInfo) { Spell* spell = new Spell(m_bot, spellInfo, false); @@ -2812,7 +2812,7 @@ Item* PlayerbotAI::FindMount(uint32 matchingRidingSkill) const break; } } - const SpellEntry* const spellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const spellInfo = sSpellTemplate.LookupEntry(spellId); if (spellInfo) { Spell* spell = new Spell(m_bot, spellInfo, false); @@ -5203,7 +5203,7 @@ void PlayerbotAI::UpdateAI(const uint32 /*p_time*/) return; } - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(TAME_BEAST_1); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(TAME_BEAST_1); if (!spellInfo) return; @@ -5255,7 +5255,7 @@ void PlayerbotAI::UpdateAI(const uint32 /*p_time*/) return; } - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_CraftSpellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_CraftSpellId); if (!spellInfo) return; @@ -5419,7 +5419,7 @@ bool PlayerbotAI::canObeyCommandFrom(const Player& player) const bool PlayerbotAI::In_Range(Unit* Target, uint32 spellId) { - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) return false; @@ -5490,7 +5490,7 @@ SpellCastResult PlayerbotAI::CastSpell(uint32 spellId) // see Creature.cpp 1738 for reference // don't allow bot to cast damage spells on friends - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) { TellMaster("missing spell entry in CastSpell for spellid %u.", spellId); @@ -5632,7 +5632,7 @@ SpellCastResult PlayerbotAI::CastPetSpell(uint32 spellId, Unit* target) if (!pet) return SPELL_FAILED_NO_PET; - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) { TellMaster("Missing spell entry in CastPetSpell()"); @@ -5685,7 +5685,7 @@ SpellCastResult PlayerbotAI::Buff(uint32 spellId, Unit* target, void (*beforeCas if (target->HasAura(spellId)) return SPELL_FAILED_AURA_BOUNCED; - SpellEntry const* spellProto = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellProto = sSpellTemplate.LookupEntry(spellId); if (!spellProto) return SPELL_NOT_FOUND; @@ -6079,7 +6079,7 @@ bool PlayerbotAI::PickPocket(Unit* pTarget) bool PlayerbotAI::HasSpellReagents(uint32 spellId) { - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) return false; @@ -6103,7 +6103,7 @@ bool PlayerbotAI::HasSpellReagents(uint32 spellId) uint32 PlayerbotAI::GetSpellCharges(uint32 spellId) { - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) return 0; @@ -7135,7 +7135,7 @@ void PlayerbotAI::UseItem(Item* item, uint32 targetFlag, ObjectGuid targetGUID) return; } - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) { TellMaster("Can't find spell entry for spell %u on item %u", spellId, item->GetEntry()); @@ -9587,7 +9587,7 @@ void PlayerbotAI::_HandleCommandTalent(std::string& text, Player& fromPlayer) if (spentPoints < (talentInfo->Row * MAX_TALENT_RANK)) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(talentInfo->RankID[curtalent_maxrank]); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(talentInfo->RankID[curtalent_maxrank]); if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, m_bot, false)) continue; @@ -9661,7 +9661,7 @@ void PlayerbotAI::_HandleCommandProcess(std::string& text, Player& fromPlayer) Item* reagent = itemList.back(); itemList.pop_back(); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return; @@ -9976,7 +9976,7 @@ void PlayerbotAI::_HandleCommandEnchant(std::string& text, Player& fromPlayer) uint32 spellId; extractSpellId(text, spellId); - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return; @@ -10028,7 +10028,7 @@ void PlayerbotAI::_HandleCommandEnchant(std::string& text, Player& fromPlayer) if (!SkillAbility) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SkillAbility->spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SkillAbility->spellId); if (!spellInfo) continue; @@ -10182,7 +10182,7 @@ void PlayerbotAI::_HandleCommandCraft(std::string& text, Player& fromPlayer) return; } - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return; @@ -10226,7 +10226,7 @@ void PlayerbotAI::_HandleCommandCraft(std::string& text, Player& fromPlayer) if (!SkillAbility) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SkillAbility->spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SkillAbility->spellId); if (!spellInfo) continue; @@ -10505,7 +10505,7 @@ void PlayerbotAI::_HandleCommandPet(std::string& text, Player& fromPlayer) if (itr->second.state == PETSPELL_REMOVED || IsPassiveSpell(spellId)) continue; - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) continue; @@ -10559,7 +10559,7 @@ void PlayerbotAI::_HandleCommandSpells(std::string& /*text*/, Player& fromPlayer if (itr->second.state == PLAYERSPELL_REMOVED || itr->second.disabled || IsPassiveSpell(spellId)) continue; - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) continue; @@ -10766,7 +10766,7 @@ void PlayerbotAI::_HandleCommandSkill(std::string& text, Player& fromPlayer) ++totalSpellLearnt; totalCost += cost; - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) continue; @@ -10819,7 +10819,7 @@ void PlayerbotAI::_HandleCommandSkill(std::string& text, Player& fromPlayer) ++totalSpellLearnt; totalCost += cost; - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) continue; @@ -10880,7 +10880,7 @@ void PlayerbotAI::_HandleCommandSkill(std::string& text, Player& fromPlayer) continue; uint32 spellId = tSpell->spell; - const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); + const SpellEntry* const pSpellInfo = sSpellTemplate.LookupEntry(spellId); if (!pSpellInfo) continue; uint32 cost = uint32(floor(tSpell->spellCost * fDiscountMod)); @@ -10959,7 +10959,7 @@ void PlayerbotAI::_HandleCommandSkill(std::string& text, Player& fromPlayer) uint32 SpellId; m_bot->HasSpell(skillLine->forward_spellid) ? SpellId = skillLine->forward_spellid : SpellId = skillLine->spellId; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SpellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SpellId); if (!spellInfo) continue; @@ -10987,7 +10987,7 @@ void PlayerbotAI::_HandleCommandSkill(std::string& text, Player& fromPlayer) if (!skillLine) continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); if (!spellInfo) continue; diff --git a/src/game/PlayerBot/Base/PlayerbotClassAI.cpp b/src/game/PlayerBot/Base/PlayerbotClassAI.cpp index ed11cc59388..7dba41f0e60 100644 --- a/src/game/PlayerBot/Base/PlayerbotClassAI.cpp +++ b/src/game/PlayerBot/Base/PlayerbotClassAI.cpp @@ -236,7 +236,7 @@ bool PlayerbotClassAI::FindTargetAndHeal() if (m_ai.GetClassAI()->HealPlayer(targetToHeal) & RETURN_CONTINUE) return true; - return false; + return false; } /** @@ -402,7 +402,7 @@ bool PlayerbotClassAI::FleeFromAoEIfCan(uint32 spellId, Unit* pTarget) // Step 1: Get radius from hostile AoE spell float radius = 0; - SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); if (spellproto) radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[EFFECT_INDEX_0])); @@ -426,7 +426,7 @@ bool PlayerbotClassAI::FleeFromTrapGOIfCan(uint32 goEntry, Unit* pTarget) if (!goEntry) return false; // Step 1: check if the GO exists and find its trap radius - GameObjectInfo const* trapInfo = sGOStorage.LookupEntry(goEntry); + GameObjectInfo const* trapInfo = sGOStorage.LookupEntry(goEntry); if (!trapInfo || trapInfo->type != GAMEOBJECT_TYPE_TRAP) return false; @@ -463,7 +463,7 @@ bool PlayerbotClassAI::FleeFromNpcWithAuraIfCan(uint32 NpcEntry, uint32 spellId, // Step 1: Get radius from hostile aura spell float radius = 0; - SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); + SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); if (spellproto) radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[EFFECT_INDEX_0])); From 90b7002253058b3a4e2cfd25d6af5719d97302ac Mon Sep 17 00:00:00 2001 From: Cyberium Date: Mon, 8 Mar 2021 15:12:59 +0100 Subject: [PATCH 10/28] Use sDBCAreaTable store. --- src/game/Chat/Level1.cpp | 6 +- src/game/Loot/LootMgr.cpp | 4 +- src/game/Maps/GridMap.cpp | 4 +- src/game/Server/DBCStores.cpp | 145 ++++++++++---------------------- src/game/Server/DBCStores.h | 2 +- src/game/Server/SQLStorages.cpp | 81 +++++++++++++++++- src/game/Server/SQLStorages.h | 27 ++++++ src/game/World/World.cpp | 2 +- 8 files changed, 159 insertions(+), 112 deletions(-) diff --git a/src/game/Chat/Level1.cpp b/src/game/Chat/Level1.cpp index 065625dce9b..12692f60379 100644 --- a/src/game/Chat/Level1.cpp +++ b/src/game/Chat/Level1.cpp @@ -612,7 +612,7 @@ bool ChatHandler::HandleGonameCommand(char* args) // to point to see at target with same orientation float x, y, z; target->GetContactPoint(target, x, y, z); - + if (GenericTransport* transport = target->GetTransport()) transport->CalculatePassengerOffset(x, y, z); _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE, nullptr, target->GetTransport()); @@ -1331,9 +1331,9 @@ bool ChatHandler::HandleLookupAreaCommand(char* args) wstrToLower(wnamepart); // Search in AreaTable.dbc - for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag) + for (uint32 areaflag = 0; areaflag < sDBCAreaTable.GetNumRows(); ++areaflag) { - AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag); + AreaTableEntry const* areaEntry = sDBCAreaTable.LookupEntry(areaflag); if (areaEntry) { int loc = GetSessionDbcLocale(); diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index 160969f691a..95c62e763ba 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -2679,9 +2679,9 @@ void LoadLootTemplates_Fishing() LootTemplates_Fishing.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (uint32 i = 1; i < sAreaStore.GetNumRows(); ++i) + for (uint32 i = 1; i < sDBCAreaTable.GetNumRows(); ++i) { - if (AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i)) + if (AreaTableEntry const* areaEntry = sDBCAreaTable.LookupEntry(i)) if (ids_set.find(areaEntry->ID) != ids_set.end()) ids_set.erase(areaEntry->ID); } diff --git a/src/game/Maps/GridMap.cpp b/src/game/Maps/GridMap.cpp index bb5fbd80900..7596b032816 100644 --- a/src/game/Maps/GridMap.cpp +++ b/src/game/Maps/GridMap.cpp @@ -565,7 +565,7 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re uint32 liqTypeIdx = liquidEntry->Type; if (entry < 21) { - if (AreaTableEntry const* area = sAreaStore.LookupEntry(getArea(x, y))) + if (AreaTableEntry const* area = sDBCAreaTable.LookupEntry(getArea(x, y))) { uint32 overrideLiquid = area->LiquidTypeOverride[entry - 1]; if (!overrideLiquid && area->zone) @@ -1126,7 +1126,7 @@ float TerrainInfo::GetWaterOrGroundLevel(float x, float y, float z, float& groun // its shallow water so return ground under it return groundZ; } - + return liquid_status.level; } diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 9ea5ffecf61..0bd3fcbd869 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -29,33 +29,33 @@ #include -typedef std::map AreaFlagByAreaID; -typedef std::map AreaFlagByMapID; - -struct WMOAreaTableTripple -{ - WMOAreaTableTripple(int32 r, int32 a, int32 g) : groupId(g), rootId(r), adtId(a) - { - } - - bool operator <(const WMOAreaTableTripple& b) const - { - return memcmp(this, &b, sizeof(WMOAreaTableTripple)) < 0; - } - - // ordered by entropy; that way memcmp will have a minimal medium runtime - int32 groupId; - int32 rootId; - int32 adtId; -}; - -typedef std::map> WMOAreaInfoByTripple; - -DBCStorage sAreaStore(AreaTableEntryfmt); -static AreaFlagByAreaID sAreaFlagByAreaID; -static AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files - -static WMOAreaInfoByTripple sWMOAreaInfoByTripple; +// typedef std::map AreaFlagByAreaID; +// typedef std::map AreaFlagByMapID; +// +// struct WMOAreaTableTripple +// { +// WMOAreaTableTripple(int32 r, int32 a, int32 g) : groupId(g), rootId(r), adtId(a) +// { +// } +// +// bool operator <(const WMOAreaTableTripple& b) const +// { +// return memcmp(this, &b, sizeof(WMOAreaTableTripple)) < 0; +// } +// +// // ordered by entropy; that way memcmp will have a minimal medium runtime +// int32 groupId; +// int32 rootId; +// int32 adtId; +// }; +// +// typedef std::map> WMOAreaInfoByTripple; +// +// DBCStorage sDBCAreaTable(AreaTableEntryfmt); +// static AreaFlagByAreaID sAreaFlagByAreaID; +// static AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files +// +// static WMOAreaInfoByTripple sWMOAreaInfoByTripple; DBCStorage sAreaTriggerStore(AreaTriggerEntryfmt); DBCStorage sAuctionHouseStore(AuctionHouseEntryfmt); @@ -250,21 +250,21 @@ void LoadDBCStores(const std::string& dataPath) // bitmask for index of fullLocaleNameList uint32 availableDbcLocales = 0xFFFFFFFF; - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sAreaStore, dbcPath, "AreaTable.dbc"); - - // must be after sAreaStore loading - for (uint32 i = 0; i < sAreaStore.GetNumRows(); ++i) // areaflag numbered from 0 - { - if (AreaTableEntry const* area = sAreaStore.LookupEntry(i)) - { - // fill AreaId->DBC records - sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID), area->exploreFlag)); - - // fill MapId->DBC records ( skip sub zones and continents ) - if (area->zone == 0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530) - sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid, area->exploreFlag)); - } - } +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAreaTable, dbcPath, "AreaTable.dbc"); +// +// // must be after sAreaStore loading +// for (uint32 i = 0; i < sDBCAreaTable.GetNumRows(); ++i) // areaflag numbered from 0 +// { +// if (AreaTableEntry const* area = sDBCAreaTable.LookupEntry(i)) +// { +// // fill AreaId->DBC records +// sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID), area->exploreFlag)); +// +// // fill MapId->DBC records ( skip sub zones and continents ) +// if (area->zone == 0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530) +// sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid, area->exploreFlag)); +// } +// } LoadDBC(availableDbcLocales, bar, bad_dbc_files, sAreaTriggerStore, dbcPath, "AreaTrigger.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sAuctionHouseStore, dbcPath, "AuctionHouse.dbc"); @@ -574,7 +574,7 @@ void LoadDBCStores(const std::string& dataPath) !sGemPropertiesStore.LookupEntry(1127) || !sItemExtendedCostStore.LookupEntry(2425) || !sCharTitlesStore.LookupEntry(71) || - !sAreaStore.LookupEntry(1768)) + !sDBCAreaTable.LookupEntry(1768)) { sLog.outError("\nYou have _outdated_ DBC files. Please re-extract DBC files for one from client build: %s", AcceptableClientBuildsListStr().c_str()); Log::WaitBeforeContinueIfNeed(); @@ -617,66 +617,7 @@ uint32 GetTalentSpellCost(uint32 spellId) return GetTalentSpellCost(GetTalentSpellPos(spellId)); } -int32 GetAreaFlagByAreaID(uint32 area_id) -{ - AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id); - if (i == sAreaFlagByAreaID.end()) - return -1; - - return i->second; -} -uint32 GetAreaIdByLocalizedName(const std::string& name) -{ - for (uint32 i = 0; i <= sAreaStore.GetNumRows(); i++) - { - if (AreaTableEntry const* AreaEntry = sAreaStore.LookupEntry(i)) - { - for (uint32 i = 0; i < MAX_LOCALE; ++i) - { - std::string area_name(AreaEntry->area_name[i]); - if (area_name.size() > 0 && name.find(" - " + area_name) != std::string::npos) - { - return AreaEntry->ID; - } - } - } - } - return 0; -} - -std::vector& GetWMOAreaTableEntriesByTripple(int32 rootid, int32 adtid, int32 groupid) -{ - return sWMOAreaInfoByTripple[WMOAreaTableTripple(rootid, adtid, groupid)]; -} - -AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id) -{ - int32 areaflag = GetAreaFlagByAreaID(area_id); - if (areaflag < 0) - return nullptr; - - return sAreaStore.LookupEntry(areaflag); -} - -AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id) -{ - if (area_flag) - return sAreaStore.LookupEntry(area_flag); - - if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id)) - return GetAreaEntryByAreaID(mapEntry->linked_zone); - - return nullptr; -} - -uint32 GetAreaFlagByMapId(uint32 mapid) -{ - AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid); - if (i == sAreaFlagByMapID.end()) - return 0; - return i->second; -} uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId) { diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index 5ed9388d69a..8a69a8ca5dc 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -67,7 +67,7 @@ bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, flo uint32 GetCreatureModelRace(uint32 model_id); -extern DBCStorage sAreaStore;// recommend access using functions +//extern DBCStorage sDBCAreaTable;// recommend access using functions extern DBCStorage sAreaTriggerStore; extern DBCStorage sAuctionHouseStore; extern DBCStorage sBankBagSlotPricesStore; diff --git a/src/game/Server/SQLStorages.cpp b/src/game/Server/SQLStorages.cpp index ddd061b3c86..131b78d9557 100644 --- a/src/game/Server/SQLStorages.cpp +++ b/src/game/Server/SQLStorages.cpp @@ -70,7 +70,7 @@ SQLMultiStorage sSpellScriptTargetStorage(SpellScriptTargetFmt SQLStorage const* GetSpellStore() { return &sSpellTemplate; } -// DBC store in database 0123456789012345678901234567890123456789 +// DBC store in database const char AreaTablefmt[] = "iiiiixxxxxissssssssssssssssxiiiiixx"; const char AreaTriggerfmt[] = "iiffffffff"; const char AuctionHousefmt[] = "iiiixxxxxxxxxxxxxxxxx"; @@ -225,6 +225,25 @@ SQLStorage sDBCTotemCategory(TotemCategoryf SQLStorage sDBCWorldMapArea(WorldMapAreafmt, "ID", "dbc_worldmaparea"); SQLStorage sDBCWMOAreaTable(WMOAreaTablefmt, "ID", "dbc_wmoareatable"); +AreaFlagByAreaID sAreaFlagByAreaID; +AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files + +WMOAreaInfoByTripple sWMOAreaInfoByTripple; + +void InitializeDBC() +{ + // must be after sAreaStore loading + for (auto areaEntry : sDBCAreaTable) // areaflag numbered from 0 + { + // fill AreaId->DBC records + sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(areaEntry->ID), areaEntry->exploreFlag)); + + // fill MapId->DBC records ( skip sub zones and continents ) + if (areaEntry->zone == 0 && areaEntry->mapid != 0 && areaEntry->mapid != 1 && areaEntry->mapid != 530) + sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(areaEntry->mapid, areaEntry->exploreFlag)); + } +} + void LoadDBCTables() { sDBCAreaTable.Load(); @@ -304,6 +323,66 @@ void LoadDBCTables() sDBCWorldMapArea.Load(); sDBCWMOAreaTable.Load(); + InitializeDBC(); + sLog.outString(">> DBC loaded."); sLog.outString(); } + +int32 GetAreaFlagByAreaID(uint32 area_id) +{ + AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id); + if (i == sAreaFlagByAreaID.end()) + return -1; + + return i->second; +} + +uint32 GetAreaIdByLocalizedName(const std::string& name) +{ + for (auto areaEntry : sDBCAreaTable) + { + for (uint32 i = 0; i < MAX_LOCALE; ++i) + { + std::string area_name(areaEntry->area_name[i]); + if (area_name.size() > 0 && name.find(" - " + area_name) != std::string::npos) + { + return areaEntry->ID; + } + } + } + return 0; +} + +std::vector& GetWMOAreaTableEntriesByTripple(int32 rootid, int32 adtid, int32 groupid) +{ + return sWMOAreaInfoByTripple[WMOAreaTableTripple(rootid, adtid, groupid)]; +} + +AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id) +{ + int32 areaflag = GetAreaFlagByAreaID(area_id); + if (areaflag < 0) + return nullptr; + + return sDBCAreaTable.LookupEntry(areaflag); +} + +AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id) +{ + if (area_flag) + return sDBCAreaTable.LookupEntry(area_flag); + + if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id)) + return GetAreaEntryByAreaID(mapEntry->linked_zone); + + return nullptr; +} + +uint32 GetAreaFlagByMapId(uint32 mapid) +{ + AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid); + if (i == sAreaFlagByMapID.end()) + return 0; + return i->second; +} diff --git a/src/game/Server/SQLStorages.h b/src/game/Server/SQLStorages.h index f0da991a5b8..b2e85d89995 100644 --- a/src/game/Server/SQLStorages.h +++ b/src/game/Server/SQLStorages.h @@ -124,6 +124,33 @@ extern SQLStorage sDBCTotemCategory; extern SQLStorage sDBCWorldMapArea; extern SQLStorage sDBCWMOAreaTable; +typedef std::map AreaFlagByAreaID; +typedef std::map AreaFlagByMapID; + +struct WMOAreaTableTripple +{ + WMOAreaTableTripple(int32 r, int32 a, int32 g) : groupId(g), rootId(r), adtId(a) + { + } + + bool operator <(const WMOAreaTableTripple& b) const + { + return memcmp(this, &b, sizeof(WMOAreaTableTripple)) < 0; + } + + // ordered by entropy; that way memcmp will have a minimal medium runtime + int32 groupId; + int32 rootId; + int32 adtId; +}; + +typedef std::map> WMOAreaInfoByTripple; + +extern AreaFlagByAreaID sAreaFlagByAreaID; +extern AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files + +extern WMOAreaInfoByTripple sWMOAreaInfoByTripple; + void LoadDBCTables(); diff --git a/src/game/World/World.cpp b/src/game/World/World.cpp index 4a5070db6e6..6c3ee56bd14 100644 --- a/src/game/World/World.cpp +++ b/src/game/World/World.cpp @@ -894,8 +894,8 @@ void World::SetInitialWorldSettings() ///- Load the DBC files sLog.outString("Initialize DBC data stores..."); - LoadDBCStores(m_dataPath); LoadDBCTables(); + LoadDBCStores(m_dataPath); DetectDBCLang(); sObjectMgr.SetDbc2StorageLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) From 5fe6b3a90beefa92ad315c450503c9bf82a40d46 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 11:39:15 +0100 Subject: [PATCH 11/28] Implement sql storage n and d format Now we are able to define the index in the format and it can not be the first column. This is needed for AreaTable. However we might need to double check why its done that way for that table. Rremoved the need to define the name of the column as an index because code can find it using the provided format. Added the support for table that have no index like gtcombatratings. --- src/shared/Database/SQLStorage.h | 1 + src/shared/Database/SQLStorageImpl.h | 122 +++++++++++++++++++++++---- 2 files changed, 107 insertions(+), 16 deletions(-) diff --git a/src/shared/Database/SQLStorage.h b/src/shared/Database/SQLStorage.h index d19a6b08316..89107f7f064 100644 --- a/src/shared/Database/SQLStorage.h +++ b/src/shared/Database/SQLStorage.h @@ -104,6 +104,7 @@ class SQLStorage : public SQLStorageBase public: SQLStorage(const char* fmt, const char* _entry_field, const char* sqlname); + SQLStorage(const char* fmt, const char* sqlname); SQLStorage(const char* src_fmt, const char* dst_fmt, const char* _entry_field, const char* sqlname); diff --git a/src/shared/Database/SQLStorageImpl.h b/src/shared/Database/SQLStorageImpl.h index 31f79cd2d91..dba56d2a8d6 100644 --- a/src/shared/Database/SQLStorageImpl.h +++ b/src/shared/Database/SQLStorageImpl.h @@ -22,6 +22,7 @@ #include "ProgressBar.h" #include "Log.h" #include "DBCFileLoader.h" +#include template template // S source-type, D destination-type @@ -129,6 +130,7 @@ void SQLStorageLoaderBase::storeValue(V value, Stor offset += sizeof(char); break; case FT_INT: + case FT_IND: subclass->convert(x, value, *((uint32*)(&p[offset]))); offset += sizeof(uint32); break; @@ -156,7 +158,6 @@ void SQLStorageLoaderBase::storeValue(V value, Stor subclass->default_fill(x, value, *((uint64*)(&p[offset]))); offset += sizeof(uint64); break; - case FT_IND: case FT_SORT: assert(false && "SQL storage not have sort field types"); break; @@ -181,6 +182,7 @@ void SQLStorageLoaderBase::storeValue(char const* v offset += sizeof(char); break; case FT_INT: + case FT_IND: subclass->convert_from_str(x, value, *((uint32*)(&p[offset]))); offset += sizeof(uint32); break; @@ -200,7 +202,6 @@ void SQLStorageLoaderBase::storeValue(char const* v subclass->convert_from_str(x, value, *((uint64*)(&p[offset]))); offset += sizeof(uint64); break; - case FT_IND: case FT_SORT: assert(false && "SQL storage not have sort field types"); break; @@ -213,8 +214,7 @@ void SQLStorageLoaderBase::storeValue(char const* v template void SQLStorageLoaderBase::Load(StorageClass& store, bool error_at_empty /*= true*/) { - Field* fields = nullptr; - QueryResult* result = WorldDatabase.PQuery("SELECT MAX(%s) FROM %s", store.EntryFieldName(), store.GetTableName()); + QueryResult* result = WorldDatabase.PQuery("SHOW COLUMNS FROM %s", store.GetTableName()); if (!result) { sLog.outError("Error loading %s table (not exist?)\n", store.GetTableName()); @@ -222,21 +222,95 @@ void SQLStorageLoaderBase::Load(StorageClass& store exit(1); // Stop server at loading non exited table or not accessable table } - uint32 maxRecordId = (*result)[0].GetUInt32() + 1; + std::vector colNameList; + colNameList.reserve(result->GetRowCount()); + do + { + Field* fields = result->Fetch(); + colNameList.push_back(fields[0].GetString()); + } while (result->NextRow()); + + delete result; + + int32 indexPos = -1; + std::string indexName = store.EntryFieldName(); + if (indexName.empty()) + { + for (int32 i = 0; i < int32(store.GetDstFieldCount()); ++i) + { + auto format = store.GetSrcFormat(i); + if (format == FT_IND || format == FT_SORT) + { + indexPos = i; + break; + } + } + + if (indexPos >= 0) + { + if (indexPos >= colNameList.size()) + { + sLog.outError("Error loading %s table, provided index position is greater than column number\n", store.GetTableName()); + Log::WaitBeforeContinueIfNeed(); + exit(1); + } + indexName = colNameList[indexPos]; + } + } + else + { + std::transform(indexName.begin(), indexName.end(), indexName.begin(), [](char c) { return std::tolower(c); }); + for (uint32 i = 0; i < colNameList.size(); ++i) + { + std::string colName = colNameList[i]; + std::transform(colName.begin(), colName.end(), colName.begin(), [](char c) { return std::tolower(c); }); + if (indexName == colName) + { + indexName = colNameList[i]; + indexPos = i; + break; + } + } + + if (indexPos < 0) + { + sLog.outError("Error loading %s table (Entry field is not found in column name list)\n", store.GetTableName()); + Log::WaitBeforeContinueIfNeed(); + exit(1); + } + } + + Field* fields = nullptr; + uint32 maxRecordId = 0; uint32 recordCount = 0; uint32 recordsize = 0; - delete result; result = WorldDatabase.PQuery("SELECT COUNT(*) FROM %s", store.GetTableName()); if (result) { - fields = result->Fetch(); - recordCount = fields[0].GetUInt32(); + recordCount = result[0][0].GetUInt32(); delete result; } - result = WorldDatabase.PQuery("SELECT * FROM %s", store.GetTableName()); + if (indexPos < 0) + { + maxRecordId = recordCount; + } + else + { + result = WorldDatabase.PQuery("SELECT MAX(%s) FROM %s", indexName.c_str(), store.GetTableName()); + if (!result) + { + sLog.outError("Error loading %s table (not exist?)\n", store.GetTableName()); + Log::WaitBeforeContinueIfNeed(); + exit(1); // Stop server at loading non exited table or not accessable table + } + + maxRecordId = (*result)[0].GetUInt32() + 1; + delete result; + } + result = WorldDatabase.PQuery("SELECT * FROM %s", store.GetTableName()); if (!result) { if (error_at_empty) @@ -245,6 +319,7 @@ void SQLStorageLoaderBase::Load(StorageClass& store sLog.outString("%s table is empty!\n", store.GetTableName()); recordCount = 0; + maxRecordId = 0; return; } @@ -268,6 +343,7 @@ void SQLStorageLoaderBase::Load(StorageClass& store case FT_BYTE: recordsize += sizeof(char); break; case FT_INT: + case FT_IND: recordsize += sizeof(uint32); break; case FT_FLOAT: recordsize += sizeof(float); break; @@ -283,9 +359,7 @@ void SQLStorageLoaderBase::Load(StorageClass& store recordsize += sizeof(char*); break; case FT_64BITINT: recordsize += sizeof(uint64); break; - case FT_IND: case FT_SORT: - assert(false && "SQL storage not have sort field types"); break; default: assert(false && "unknown format character"); @@ -296,13 +370,20 @@ void SQLStorageLoaderBase::Load(StorageClass& store // Prepare data storage and lookup storage store.prepareToLoad(maxRecordId, recordCount, recordsize); + uint32 generatedId = 0; BarGoLink bar(recordCount); do { fields = result->Fetch(); bar.step(); - char* record = store.createRecord(fields[0].GetUInt32()); + uint32 id = 0; + if (indexPos < 0) + id = generatedId++; + else + id = fields[indexPos].GetUInt32(); + + char* record = store.createRecord(id); offset = 0; // dependend on dest-size @@ -330,17 +411,20 @@ void SQLStorageLoaderBase::Load(StorageClass& store { case FT_LOGIC: storeValue((bool)(fields[y].GetUInt32() > 0), store, record, x, offset); ++x; break; case FT_BYTE: storeValue((char)fields[y].GetUInt8(), store, record, x, offset); ++x; break; + case FT_IND: case FT_INT: storeValue((uint32)fields[y].GetUInt32(), store, record, x, offset); ++x; break; case FT_FLOAT: storeValue((float)fields[y].GetFloat(), store, record, x, offset); ++x; break; case FT_STRING: storeValue((char const*)fields[y].GetString(), store, record, x, offset); ++x; break; case FT_64BITINT: storeValue(fields[y].GetUInt64(), store, record, x, offset); ++x; break; + case FT_SORT: + ++x; + break; + case FT_NA: case FT_NA_BYTE: case FT_NA_FLOAT: // Do Not increase x break; - case FT_IND: - case FT_SORT: case FT_NA_POINTER: assert(false && "SQL storage not have sort or pointer field types"); break; @@ -378,6 +462,13 @@ void SQLStorage::Load(bool error_at_empty /*= true*/) loader.Load(*this, error_at_empty); } +template +SQLStorage::SQLStorage(const char* fmt, const char* sqlname) +{ + SQLStorage::Initialize(sqlname, "",fmt, fmt); + m_Index = nullptr; +} + template SQLStorage::SQLStorage(const char* fmt, const char* _entry_field, const char* sqlname) { @@ -479,6 +570,7 @@ void SQLStorageBase::Free() break; } case FT_NA: + case FT_IND: case FT_INT: offset += sizeof(uint32); break; @@ -497,9 +589,7 @@ void SQLStorageBase::Free() case FT_64BITINT: offset += sizeof(uint64); break; - case FT_IND: case FT_SORT: - assert(false && "SQL storage not have sort field types"); break; default: assert(false && "unknown format character"); From 4fa514e155e9e7c82ca9aad065afc464b645c6e4 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 11:41:48 +0100 Subject: [PATCH 12/28] Adjust SQLStorage format and constructor using n/d to define the index and removing column name. --- src/game/Server/SQLStorages.cpp | 366 ++++++++++++++++---------------- 1 file changed, 183 insertions(+), 183 deletions(-) diff --git a/src/game/Server/SQLStorages.cpp b/src/game/Server/SQLStorages.cpp index 131b78d9557..6ec3901b5e7 100644 --- a/src/game/Server/SQLStorages.cpp +++ b/src/game/Server/SQLStorages.cpp @@ -19,49 +19,49 @@ #include "Server/SQLStorages.h" #include "DBCStructure.h" -const char CreatureInfosrcfmt[] = "isssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiss"; -const char CreatureInfodstfmt[] = "isssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisi"; -const char CreatureDataAddonInfofmt[] = "iiibbiis"; -const char CreatureConditionalSpawnSrcFmt[] = "iiix"; -const char CreatureConditionalSpawnDstFmt[] = "iii"; -const char CreatureModelfmt[] = "iffffbii"; -const char CreatureInfoAddonInfofmt[] = "iiibbiis"; -const char EquipmentInfofmt[] = "iiii"; -const char EquipmentInfoRawfmt[] = "iiiiiiiiii"; -const char GameObjectInfosrcfmt[] = "iiisssiiifiiiiiiiiiiiiiiiiiiiiiiiiiiis"; -const char GameObjectInfodstfmt[] = "iiisssiiifiiiiiiiiiiiiiiiiiiiiiiiiiiii"; -const char ItemPrototypesrcfmt[] = "iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifsiiiiii"; -const char ItemPrototypedstfmt[] = "iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiii"; -const char PageTextfmt[] = "isi"; -const char InstanceTemplatesrcfmt[] = "iiiiiisl"; -const char InstanceTemplatedstfmt[] = "iiiiiiil"; -const char WorldTemplatesrcfmt[] = "is"; -const char WorldTemplatedstfmt[] = "ii"; -const char ConditionsFmt[] = "iiiiiiix"; -const char SpellScriptTargetFmt[] = "iiii"; -const char SpellEntryfmt[] = "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiissssssssssssssssssssssssssssssssiiiiiLiiiifffiiiiiiiii"; -const char SpellConefmt[] = "ii"; -const char DungeonEncounterFmt[] = "iiiiissssssssssssssssii"; -const char FactionEntryfmt[] = "iiiiiiiiiiiiiiiiiiiffiissssssssssssssss"; -const char WorldSafeLocsFmt[] = "iiffffs"; +const char CreatureInfosrcfmt[] = "nsssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiss"; +const char CreatureInfodstfmt[] = "nsssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisi"; +const char CreatureDataAddonInfofmt[] = "niibbiis"; +const char CreatureConditionalSpawnSrcFmt[] = "niix"; +const char CreatureConditionalSpawnDstFmt[] = "nii"; +const char CreatureModelfmt[] = "nffffbii"; +const char CreatureInfoAddonInfofmt[] = "niibbiis"; +const char EquipmentInfofmt[] = "niii"; +const char EquipmentInfoRawfmt[] = "niiiiiiiii"; +const char GameObjectInfosrcfmt[] = "niisssiiifiiiiiiiiiiiiiiiiiiiiiiiiiiis"; +const char GameObjectInfodstfmt[] = "niisssiiifiiiiiiiiiiiiiiiiiiiiiiiiiiii"; +const char ItemPrototypesrcfmt[] = "niiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifsiiiiii"; +const char ItemPrototypedstfmt[] = "niiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiii"; +const char PageTextfmt[] = "nsi"; +const char InstanceTemplatesrcfmt[] = "niiiiisl"; +const char InstanceTemplatedstfmt[] = "niiiiiil"; +const char WorldTemplatesrcfmt[] = "ns"; +const char WorldTemplatedstfmt[] = "ni"; +const char ConditionsFmt[] = "niiiiiix"; +const char SpellScriptTargetFmt[] = "niii"; +const char SpellEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiissssssssssssssssssssssssssssssssiiiiiLiiiifffiiiiiiiii"; +const char SpellConefmt[] = "ni"; +const char DungeonEncounterFmt[] = "niiiissssssssssssssssii"; +const char FactionEntryfmt[] = "niiiiiiiiiiiiiiiiiiffiissssssssssssssss"; +const char WorldSafeLocsFmt[] = "niffffs"; -SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "Entry", "creature_template"); -SQLStorage sCreatureDataAddonStorage(CreatureDataAddonInfofmt, "guid", "creature_addon"); -SQLStorage sCreatureInfoAddonStorage(CreatureInfoAddonInfofmt, "entry", "creature_template_addon"); -SQLStorage sCreatureModelStorage(CreatureModelfmt, "modelid", "creature_model_info"); -SQLStorage sEquipmentStorage(EquipmentInfofmt, "entry", "creature_equip_template"); -SQLStorage sEquipmentStorageRaw(EquipmentInfoRawfmt, "entry", "creature_equip_template_raw"); -SQLStorage sPageTextStore(PageTextfmt, "entry", "page_text"); -SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "entry", "item_template"); -SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "map", "instance_template"); -SQLStorage sWorldTemplate(WorldTemplatesrcfmt, WorldTemplatedstfmt, "map", "world_template"); -SQLStorage sConditionStorage(ConditionsFmt, "condition_entry", "conditions"); -SQLStorage sSpellTemplate(SpellEntryfmt, "id", "spell_template"); -SQLStorage sSpellCones(SpellConefmt, "id", "spell_cone"); -SQLStorage sDungeonEncounterStore(DungeonEncounterFmt, "id", "instance_dungeon_encounters"); -SQLStorage sFactionStore(FactionEntryfmt, "entry", "faction_store"); -SQLStorage sCreatureConditionalSpawnStore(CreatureConditionalSpawnSrcFmt, CreatureConditionalSpawnDstFmt, "guid", "creature_conditional_spawn"); -SQLStorage sWorldSafeLocsStore(WorldSafeLocsFmt, "id", "world_safe_locs"); +SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "", "creature_template"); +SQLStorage sCreatureDataAddonStorage(CreatureDataAddonInfofmt, "creature_addon"); +SQLStorage sCreatureInfoAddonStorage(CreatureInfoAddonInfofmt, "creature_template_addon"); +SQLStorage sCreatureModelStorage(CreatureModelfmt, "creature_model_info"); +SQLStorage sEquipmentStorage(EquipmentInfofmt, "creature_equip_template"); +SQLStorage sEquipmentStorageRaw(EquipmentInfoRawfmt, "creature_equip_template_raw"); +SQLStorage sPageTextStore(PageTextfmt, "page_text"); +SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "", "item_template"); +SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "", "instance_template"); +SQLStorage sWorldTemplate(WorldTemplatesrcfmt, WorldTemplatedstfmt, "", "world_template"); +SQLStorage sConditionStorage(ConditionsFmt, "conditions"); +SQLStorage sSpellTemplate(SpellEntryfmt, "spell_template"); +SQLStorage sSpellCones(SpellConefmt, "spell_cone"); +SQLStorage sDungeonEncounterStore(DungeonEncounterFmt, "instance_dungeon_encounters"); +SQLStorage sFactionStore(FactionEntryfmt, "faction_store"); +SQLStorage sCreatureConditionalSpawnStore(CreatureConditionalSpawnSrcFmt, CreatureConditionalSpawnDstFmt, "", "creature_conditional_spawn"); +SQLStorage sWorldSafeLocsStore(WorldSafeLocsFmt, "world_safe_locs"); SQLHashStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry", "gameobject_template"); @@ -71,35 +71,35 @@ SQLStorage const* GetSpellStore() { return &sSpellTemplate; } // DBC store in database -const char AreaTablefmt[] = "iiiiixxxxxissssssssssssssssxiiiiixx"; -const char AreaTriggerfmt[] = "iiffffffff"; -const char AuctionHousefmt[] = "iiiixxxxxxxxxxxxxxxxx"; -const char BankBagSlotPricesfmt[] = "ii"; -const char BattlemasterListfmt[] = "iiiiiiiiiiiiixxssssssssssssssssxx"; +const char AreaTablefmt[] = "iiinixxxxxissssssssssssssssxiiiiixx"; +const char AreaTriggerfmt[] = "niffffffff"; +const char AuctionHousefmt[] = "niiixxxxxxxxxxxxxxxxx"; +const char BankBagSlotPricesfmt[] = "ni"; +const char BattlemasterListfmt[] = "niiiiiiiiiiiixxssssssssssssssssxx"; const char CharStartOutfitsrcfmt[] = "dbbbbiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxx"; const char CharStartOutfitdstfmt[] = "diiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxx"; -const char CharTitlesfmt[] = "ixssssssssssssssssxxxxxxxxxxxxxxxxxxi"; -const char ChatChannelsfmt[] = "iixssssssssssssssssxxxxxxxxxxxxxxxxxx"; -const char ChrClassesfmt[] = "ixixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix"; -const char ChrRacesfmt[] = "ixixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; -const char CinematicCamerafmt[] = "isiffff"; -const char CinematicSequencesfmt[] = "ixixxxxxxx"; -const char CreatureDisplayInfofmt[] = "iixifxxxxxxxxx"; -const char CreatureDisplayInfoExtrafmt[] = "iixxxxxxxxxxxxxxxxxxx"; -const char CreatureFamilyfmt[] = "ififiiiissssssssssssssssxx"; -const char CreatureModelDatafmt[] = "iixxfxxxxxxxxxxffxxxxxxx"; -const char CreatureSpellDatafmt[] = "iiiiixxxx"; -const char CreatureTypefmt[] = "ixxxxxxxxxxxxxxxxxx"; -const char DurabilityCostsfmt[] = "iiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; -const char DurabilityQualityfmt[] = "if"; -const char Emotesfmt[] = "ixxiiix"; -const char EmotesTextfmt[] = "ixixxxxxxxxxxxxxxxx"; -const char FactionTemplatefmt[] = "iiiiiiiiiiiiii"; -const char GameObjectDisplayInfofmt[] = "isxxxxxxxxxxffffff"; -const char GemPropertiesfmt[] = "iixxi"; -const char GMSurveyCurrentSurveyfmt[] = "ii"; -const char GMSurveyQuestionsfmt[] = "issssssssssssssssx"; -const char GMSurveySurveysfmt[] = "iiiiiiiiiii"; -const char GMTicketCategoryfmt[] = "issssssssssssssssx"; +const char CharTitlesfmt[] = "nxssssssssssssssssxxxxxxxxxxxxxxxxxxi"; +const char ChatChannelsfmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxx"; +const char ChrClassesfmt[] = "nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix"; +const char ChrRacesfmt[] = "nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; +const char CinematicCamerafmt[] = "nsiffff"; +const char CinematicSequencesfmt[] = "nxixxxxxxx"; +const char CreatureDisplayInfofmt[] = "nixifxxxxxxxxx"; +const char CreatureDisplayInfoExtrafmt[] = "nixxxxxxxxxxxxxxxxxxx"; +const char CreatureFamilyfmt[] = "nfifiiiissssssssssssssssxx"; +const char CreatureModelDatafmt[] = "nixxfxxxxxxxxxxffxxxxxxx"; +const char CreatureSpellDatafmt[] = "niiiixxxx"; +const char CreatureTypefmt[] = "nxxxxxxxxxxxxxxxxxx"; +const char DurabilityCostsfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiii"; +const char DurabilityQualityfmt[] = "nf"; +const char Emotesfmt[] = "nxxiiix"; +const char EmotesTextfmt[] = "nxixxxxxxxxxxxxxxxx"; +const char FactionTemplatefmt[] = "niiiiiiiiiiiii"; +const char GameObjectDisplayInfofmt[] = "nsxxxxxxxxxxffffff"; +const char GemPropertiesfmt[] = "nixxi"; +const char GMSurveyCurrentSurveyfmt[] = "ni"; +const char GMSurveyQuestionsfmt[] = "nssssssssssssssssx"; +const char GMSurveySurveysfmt[] = "niiiiiiiiii"; +const char GMTicketCategoryfmt[] = "nssssssssssssssssx"; const char gtCombatRatingsfmt[] = "f"; const char gtChanceToMeleeCritBasefmt[] = "f"; const char gtChanceToMeleeCritfmt[] = "f"; @@ -109,121 +109,121 @@ const char gtOCTRegenHPfmt[] = "f"; const char gtNPCManaCostScalerfmt[] = "f"; const char gtRegenHPPerSptfmt[] = "f"; const char gtRegenMPPerSptfmt[] = "f"; -const char Itemfmt[] = "iiii"; -const char ItemBagFamilyfmt[] = "ixxxxxxxxxxxxxxxxx"; -const char ItemClassfmt[] = "ixxssssssssssssssssx"; -const char ItemExtendedCostfmt[] = "iiiiiiiiiiiiii"; -const char ItemRandomPropertiesfmt[] = "ixiiixxssssssssssssssssx"; -const char ItemRandomSuffixfmt[] = "issssssssssssssssxxiiiiii"; -const char ItemSetfmt[] = "xssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii"; -const char LiquidTypefmt[] = "iiii"; -const char Lockfmt[] = "iiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; -const char MailTemplatefmt[] = "ixxxxxxxxxxxxxxxxxssssssssssssssssx"; -const char Mapfmt[] = "ixixssssssssssssssssxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiffiixxi"; -const char QuestSortfmt[] = "ixxxxxxxxxxxxxxxxx"; -const char RandPropPointsfmt[] = "iiiiiiiiiiiiiiii"; -const char SkillLinefmt[] = "iixssssssssssssssssxxxxxxxxxxxxxxxxxxi"; -const char SkillLineAbilityfmt[] = "iiiiixxiiiiixxi"; +const char Itemfmt[] = "niii"; +const char ItemBagFamilyfmt[] = "nxxxxxxxxxxxxxxxxx"; +const char ItemClassfmt[] = "nxxssssssssssssssssx"; +const char ItemExtendedCostfmt[] = "niiiiiiiiiiiii"; +const char ItemRandomPropertiesfmt[] = "nxiiixxssssssssssssssssx"; +const char ItemRandomSuffixfmt[] = "nssssssssssssssssxxiiiiii"; +const char ItemSetfmt[] = "dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii"; +const char LiquidTypefmt[] = "niii"; +const char Lockfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; +const char MailTemplatefmt[] = "nxxxxxxxxxxxxxxxxxssssssssssssssssx"; +const char Mapfmt[] = "nxixssssssssssssssssxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiffiixxi"; +const char QuestSortfmt[] = "nxxxxxxxxxxxxxxxxx"; +const char RandPropPointsfmt[] = "niiiiiiiiiiiiiii"; +const char SkillLinefmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxxi"; +const char SkillLineAbilityfmt[] = "niiiixxiiiiixxi"; const char SkillRaceClassInfofmt[] = "xiiiiiix"; -const char SkillTiersfmt[] = "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; -const char SoundEntriesfmt[] = "ixxxxxxxxxxxxxxxxxxxxxxxxxxxx"; -const char SpellCastTimesfmt[] = "iiii"; -const char SpellDurationfmt[] = "iiii"; -const char SpellFocusObjectfmt[] = "ixxxxxxxxxxxxxxxxx"; -const char SpellItemEnchantmentfmt[] = "iiiiiiixxxiiissssssssssssssssxiiii"; -const char SpellItemEnchantmentConditionfmt[] = "ibbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; -const char SpellRadiusfmt[] = "ifxx"; -const char SpellRangefmt[] = "iffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; -const char SpellShapeshiftFormfmt[] = "ixxxxxxxxxxxxxxxxxxiixiixxxiiiiiiii"; -const char SpellVisualfmt[] = "ixxxxxiixxxxxxxxxxxxxxxxx"; -const char StableSlotPricesfmt[] = "ii"; -const char SummonPropertiesfmt[] = "iiiiii"; -const char Talentfmt[] = "iiiiiiiiixxxxixxixxxi"; -const char TalentTabfmt[] = "ixxxxxxxxxxxxxxxxxxxiix"; -const char TaxiNodesfmt[] = "iifffssssssssssssssssxii"; -const char TaxiPathfmt[] = "iiii"; -const char TaxiPathNodefmt[] = "xiiifffiiii"; -const char TransportAnimationfmt[] = "xiifffx"; -const char TotemCategoryfmt[] = "ixxxxxxxxxxxxxxxxxii"; -const char WorldMapAreafmt[] = "xiixffffi"; -const char WMOAreaTablefmt[] = "iiiixxxxxiixxxxxxxxxxxxxxxxx"; +const char SkillTiersfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; +const char SoundEntriesfmt[] = "nxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; +const char SpellCastTimesfmt[] = "niii"; +const char SpellDurationfmt[] = "niii"; +const char SpellFocusObjectfmt[] = "nxxxxxxxxxxxxxxxxx"; +const char SpellItemEnchantmentfmt[] = "niiiiiixxxiiissssssssssssssssxiiii"; +const char SpellItemEnchantmentConditionfmt[] = "nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; +const char SpellRadiusfmt[] = "nfxx"; +const char SpellRangefmt[] = "nffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; +const char SpellShapeshiftFormfmt[] = "nxxxxxxxxxxxxxxxxxxiixiixxxiiiiiiii"; +const char SpellVisualfmt[] = "nxxxxxiixxxxxxxxxxxxxxxxx"; +const char StableSlotPricesfmt[] = "ni"; +const char SummonPropertiesfmt[] = "niiiii"; +const char Talentfmt[] = "niiiiiiiixxxxixxixxxi"; +const char TalentTabfmt[] = "nxxxxxxxxxxxxxxxxxxxiix"; +const char TaxiNodesfmt[] = "nifffssssssssssssssssxii"; +const char TaxiPathfmt[] = "niii"; +const char TaxiPathNodefmt[] = "niiifffiiii"; +const char TransportAnimationfmt[] = "niifffx"; +const char TotemCategoryfmt[] = "nxxxxxxxxxxxxxxxxxii"; +const char WorldMapAreafmt[] = "diixffffi"; +const char WMOAreaTablefmt[] = "niiixxxxxiixxxxxxxxxxxxxxxxx"; -SQLStorage sDBCAreaTable(AreaTablefmt, "ID", "dbc_areatable"); -SQLStorage sDBCAreaTrigger(AreaTriggerfmt, "ID", "dbc_areatrigger"); -SQLStorage sDBCAuctionHouse(AuctionHousefmt, "ID", "dbc_auctionhouse"); -SQLStorage sDBCBankBagSlotPrices(BankBagSlotPricesfmt, "ID", "dbc_bankbagslotprices"); -SQLStorage sDBCBattlemasterList(BattlemasterListfmt, "ID", "dbc_battlemasterlist"); -SQLStorage sDBCCharStartOutfit(CharStartOutfitsrcfmt, CharStartOutfitdstfmt, "ID", "dbc_charstartoutfit"); -SQLStorage sDBCCharTitles(CharTitlesfmt, "ID", "dbc_chartitles"); -SQLStorage sDBCChatChannels(ChatChannelsfmt, "ID", "dbc_chatchannels"); -SQLStorage sDBCChrClasses(ChrClassesfmt, "ID", "dbc_chrclasses"); -SQLStorage sDBCChrRaces(ChrRacesfmt, "ID", "dbc_chrraces"); -SQLStorage sDBCCinematicCamera(CinematicCamerafmt, "ID", "dbc_cinematiccamera"); -SQLStorage sDBCCinematicSequences(CinematicSequencesfmt, "ID", "dbc_cinematicsequences"); -SQLStorage sDBCCreatureDisplayInfo(CreatureDisplayInfofmt, "ID", "dbc_creaturedisplayinfo"); -SQLStorage sDBCCreatureDisplayInfoExtra(CreatureDisplayInfoExtrafmt, "ID", "dbc_creaturedisplayinfoextra"); -SQLStorage sDBCCreatureFamily(CreatureFamilyfmt, "ID", "dbc_creaturefamily"); -SQLStorage sDBCCreatureModelData(CreatureModelDatafmt, "ID", "dbc_creaturemodeldata"); -SQLStorage sDBCCreatureSpellData(CreatureSpellDatafmt, "ID", "dbc_creaturespelldata"); -SQLStorage sDBCCreatureType(CreatureTypefmt, "ID", "dbc_creaturetype"); -SQLStorage sDBCDurabilityCosts(DurabilityCostsfmt, "ID", "dbc_durabilitycosts"); -SQLStorage sDBCDurabilityQuality(DurabilityQualityfmt, "ID", "dbc_durabilityquality"); -SQLStorage sDBCEmotes(Emotesfmt, "ID", "dbc_emotes"); -SQLStorage sDBCEmotesText(EmotesTextfmt, "ID", "dbc_emotestext"); -SQLStorage sDBCFactionTemplate(FactionTemplatefmt, "ID", "dbc_factiontemplate"); -SQLStorage sDBCGameObjectDisplayInfo(GameObjectDisplayInfofmt, "ID", "dbc_gameobjectdisplayinfo"); -SQLStorage sDBCGemProperties(GemPropertiesfmt, "ID", "dbc_gemproperties"); -SQLStorage sDBCGMSurveyCurrentSurvey(GMSurveyCurrentSurveyfmt, "LANGID", "dbc_gmsurveycurrentsurvey"); -SQLStorage sDBCGMSurveyQuestions(GMSurveyQuestionsfmt, "ID", "dbc_gmsurveyquestions"); -SQLStorage sDBCGMSurveySurveys(GMSurveySurveysfmt, "ID", "dbc_gmsurveysurveys"); -SQLStorage sDBCGMTicketCategory(GMTicketCategoryfmt, "ID", "dbc_gmticketcategory"); -SQLStorage sDBCgtCombatRatings(gtCombatRatingsfmt, "Data", "dbc_gtcombatratings"); -SQLStorage sDBCgtChanceToMeleeCritBase(gtChanceToMeleeCritBasefmt, "Data", "dbc_gtchancetomeleecritbase"); -SQLStorage sDBCgtChanceToMeleeCrit(gtChanceToMeleeCritfmt, "Data", "dbc_gtchancetomeleecrit"); -SQLStorage sDBCgtChanceToSpellCritBase(gtChanceToSpellCritBasefmt, "Data", "dbc_gtchancetospellcritbase"); -SQLStorage sDBCgtChanceToSpellCrit(gtChanceToSpellCritfmt, "Data", "dbc_gtchancetospellcrit"); -SQLStorage sDBCgtOCTRegenHP(gtOCTRegenHPfmt, "Data", "dbc_gtoctregenhp"); -SQLStorage sDBCgtNPCManaCostScaler(gtNPCManaCostScalerfmt, "Data", "dbc_gtnpcmanacostscaler"); -SQLStorage sDBCgtRegenHPPerSpt(gtRegenHPPerSptfmt, "Data", "dbc_gtregenhpperspt"); -SQLStorage sDBCgtRegenMPPerSpt(gtRegenMPPerSptfmt, "Data", "dbc_gtregenmpperspt"); -SQLStorage sDBCItem(Itemfmt, "ID", "dbc_item"); -SQLStorage sDBCItemBagFamily(ItemBagFamilyfmt, "ID", "dbc_itembagfamily"); -SQLStorage sDBCItemClass(ItemClassfmt, "ClassID", "dbc_itemclass"); -SQLStorage sDBCItemExtendedCost(ItemExtendedCostfmt, "ID", "dbc_itemextendedcost"); -SQLStorage sDBCItemRandomProperties(ItemRandomPropertiesfmt, "ID", "dbc_itemrandomproperties"); -SQLStorage sDBCItemRandomSuffix(ItemRandomSuffixfmt, "ID", "dbc_itemrandomsuffix"); -SQLStorage sDBCItemSet(ItemSetfmt, "ID", "dbc_itemset"); -SQLStorage sDBCLiquidType(LiquidTypefmt, "ID", "dbc_liquidtype"); -SQLStorage sDBCLock(Lockfmt, "ID", "dbc_lock"); -SQLStorage sDBCMailTemplate(MailTemplatefmt, "ID", "dbc_mailtemplate"); -SQLStorage sDBCMap(Mapfmt, "ID", "dbc_map"); -SQLStorage sDBCQuestSort(QuestSortfmt, "ID", "dbc_questsort"); -SQLStorage sDBCRandPropPoints(RandPropPointsfmt, "ID", "dbc_randproppoints"); -SQLStorage sDBCSkillLine(SkillLinefmt, "ID", "dbc_skillline"); -SQLStorage sDBCSkillLineAbility(SkillLineAbilityfmt, "ID", "dbc_skilllineability"); -SQLStorage sDBCSkillRaceClassInfo(SkillRaceClassInfofmt, "ID", "dbc_skillraceclassinfo"); -SQLStorage sDBCSkillTiers(SkillTiersfmt, "ID", "dbc_skilltiers"); -SQLStorage sDBCSoundEntries(SoundEntriesfmt, "ID", "dbc_soundentries"); -SQLStorage sDBCSpellCastTimes(SpellCastTimesfmt, "ID", "dbc_spellcasttimes"); -SQLStorage sDBCSpellDuration(SpellDurationfmt, "ID", "dbc_spellduration"); -SQLStorage sDBCSpellFocusObject(SpellFocusObjectfmt, "ID", "dbc_spellfocusobject"); -SQLStorage sDBCSpellItemEnchantment(SpellItemEnchantmentfmt, "ID", "dbc_spellitemenchantment"); -SQLStorage sDBCSpellItemEnchantmentCondition(SpellItemEnchantmentConditionfmt, "ID", "dbc_spellitemenchantmentcondition"); -SQLStorage sDBCSpellRadius(SpellRadiusfmt, "ID", "dbc_spellradius"); -SQLStorage sDBCSpellRange(SpellRangefmt, "ID", "dbc_spellrange"); -SQLStorage sDBCSpellShapeshiftForm(SpellShapeshiftFormfmt, "ID", "dbc_spellshapeshiftform"); -SQLStorage sDBCSpellVisual(SpellVisualfmt, "ID", "dbc_spellvisual"); -SQLStorage sDBCStableSlotPrices(StableSlotPricesfmt, "ID", "dbc_stableslotprices"); -SQLStorage sDBCSummonProperties(SummonPropertiesfmt, "ID", "dbc_summonproperties"); -SQLStorage sDBCTalent(Talentfmt, "ID", "dbc_talent"); -SQLStorage sDBCTalentTab(TalentTabfmt, "ID", "dbc_talenttab"); -SQLStorage sDBCTaxiNodes(TaxiNodesfmt, "ID", "dbc_taxinodes"); -SQLStorage sDBCTaxiPath(TaxiPathfmt, "ID", "dbc_taxipath"); -SQLStorage sDBCTaxiPathNode(TaxiPathNodefmt, "ID", "dbc_taxipathnode"); -SQLStorage sDBCTransportAnimation(TransportAnimationfmt, "ID", "dbc_transportanimation"); -SQLStorage sDBCTotemCategory(TotemCategoryfmt, "ID", "dbc_totemcategory"); -SQLStorage sDBCWorldMapArea(WorldMapAreafmt, "ID", "dbc_worldmaparea"); -SQLStorage sDBCWMOAreaTable(WMOAreaTablefmt, "ID", "dbc_wmoareatable"); +SQLStorage sDBCAreaTable(AreaTablefmt, "dbc_areatable"); +SQLStorage sDBCAreaTrigger(AreaTriggerfmt, "dbc_areatrigger"); +SQLStorage sDBCAuctionHouse(AuctionHousefmt, "dbc_auctionhouse"); +SQLStorage sDBCBankBagSlotPrices(BankBagSlotPricesfmt, "dbc_bankbagslotprices"); +SQLStorage sDBCBattlemasterList(BattlemasterListfmt, "dbc_battlemasterlist"); +SQLStorage sDBCCharStartOutfit(CharStartOutfitsrcfmt, CharStartOutfitdstfmt, "", "dbc_charstartoutfit"); +SQLStorage sDBCCharTitles(CharTitlesfmt, "dbc_chartitles"); +SQLStorage sDBCChatChannels(ChatChannelsfmt, "dbc_chatchannels"); +SQLStorage sDBCChrClasses(ChrClassesfmt, "dbc_chrclasses"); +SQLStorage sDBCChrRaces(ChrRacesfmt, "dbc_chrraces"); +SQLStorage sDBCCinematicCamera(CinematicCamerafmt, "dbc_cinematiccamera"); +SQLStorage sDBCCinematicSequences(CinematicSequencesfmt, "dbc_cinematicsequences"); +SQLStorage sDBCCreatureDisplayInfo(CreatureDisplayInfofmt, "dbc_creaturedisplayinfo"); +SQLStorage sDBCCreatureDisplayInfoExtra(CreatureDisplayInfoExtrafmt, "dbc_creaturedisplayinfoextra"); +SQLStorage sDBCCreatureFamily(CreatureFamilyfmt, "dbc_creaturefamily"); +SQLStorage sDBCCreatureModelData(CreatureModelDatafmt, "dbc_creaturemodeldata"); +SQLStorage sDBCCreatureSpellData(CreatureSpellDatafmt, "dbc_creaturespelldata"); +SQLStorage sDBCCreatureType(CreatureTypefmt, "dbc_creaturetype"); +SQLStorage sDBCDurabilityCosts(DurabilityCostsfmt, "dbc_durabilitycosts"); +SQLStorage sDBCDurabilityQuality(DurabilityQualityfmt, "dbc_durabilityquality"); +SQLStorage sDBCEmotes(Emotesfmt, "dbc_emotes"); +SQLStorage sDBCEmotesText(EmotesTextfmt, "dbc_emotestext"); +SQLStorage sDBCFactionTemplate(FactionTemplatefmt, "dbc_factiontemplate"); +SQLStorage sDBCGameObjectDisplayInfo(GameObjectDisplayInfofmt, "dbc_gameobjectdisplayinfo"); +SQLStorage sDBCGemProperties(GemPropertiesfmt, "dbc_gemproperties"); +SQLStorage sDBCGMSurveyCurrentSurvey(GMSurveyCurrentSurveyfmt, "dbc_gmsurveycurrentsurvey"); +SQLStorage sDBCGMSurveyQuestions(GMSurveyQuestionsfmt, "dbc_gmsurveyquestions"); +SQLStorage sDBCGMSurveySurveys(GMSurveySurveysfmt, "dbc_gmsurveysurveys"); +SQLStorage sDBCGMTicketCategory(GMTicketCategoryfmt, "dbc_gmticketcategory"); +SQLStorage sDBCgtCombatRatings(gtCombatRatingsfmt, "dbc_gtcombatratings"); +SQLStorage sDBCgtChanceToMeleeCritBase(gtChanceToMeleeCritBasefmt, "dbc_gtchancetomeleecritbase"); +SQLStorage sDBCgtChanceToMeleeCrit(gtChanceToMeleeCritfmt, "dbc_gtchancetomeleecrit"); +SQLStorage sDBCgtChanceToSpellCritBase(gtChanceToSpellCritBasefmt, "dbc_gtchancetospellcritbase"); +SQLStorage sDBCgtChanceToSpellCrit(gtChanceToSpellCritfmt, "dbc_gtchancetospellcrit"); +SQLStorage sDBCgtOCTRegenHP(gtOCTRegenHPfmt, "dbc_gtoctregenhp"); +SQLStorage sDBCgtNPCManaCostScaler(gtNPCManaCostScalerfmt, "dbc_gtnpcmanacostscaler"); +SQLStorage sDBCgtRegenHPPerSpt(gtRegenHPPerSptfmt, "dbc_gtregenhpperspt"); +SQLStorage sDBCgtRegenMPPerSpt(gtRegenMPPerSptfmt, "dbc_gtregenmpperspt"); +SQLStorage sDBCItem(Itemfmt, "dbc_item"); +SQLStorage sDBCItemBagFamily(ItemBagFamilyfmt, "dbc_itembagfamily"); +SQLStorage sDBCItemClass(ItemClassfmt, "dbc_itemclass"); +SQLStorage sDBCItemExtendedCost(ItemExtendedCostfmt, "dbc_itemextendedcost"); +SQLStorage sDBCItemRandomProperties(ItemRandomPropertiesfmt, "dbc_itemrandomproperties"); +SQLStorage sDBCItemRandomSuffix(ItemRandomSuffixfmt, "dbc_itemrandomsuffix"); +SQLStorage sDBCItemSet(ItemSetfmt, "dbc_itemset"); +SQLStorage sDBCLiquidType(LiquidTypefmt, "dbc_liquidtype"); +SQLStorage sDBCLock(Lockfmt, "dbc_lock"); +SQLStorage sDBCMailTemplate(MailTemplatefmt, "dbc_mailtemplate"); +SQLStorage sDBCMap(Mapfmt, "dbc_map"); +SQLStorage sDBCQuestSort(QuestSortfmt, "dbc_questsort"); +SQLStorage sDBCRandPropPoints(RandPropPointsfmt, "dbc_randproppoints"); +SQLStorage sDBCSkillLine(SkillLinefmt, "dbc_skillline"); +SQLStorage sDBCSkillLineAbility(SkillLineAbilityfmt, "dbc_skilllineability"); +SQLStorage sDBCSkillRaceClassInfo(SkillRaceClassInfofmt, "dbc_skillraceclassinfo"); +SQLStorage sDBCSkillTiers(SkillTiersfmt, "dbc_skilltiers"); +SQLStorage sDBCSoundEntries(SoundEntriesfmt, "dbc_soundentries"); +SQLStorage sDBCSpellCastTimes(SpellCastTimesfmt, "dbc_spellcasttimes"); +SQLStorage sDBCSpellDuration(SpellDurationfmt, "dbc_spellduration"); +SQLStorage sDBCSpellFocusObject(SpellFocusObjectfmt, "dbc_spellfocusobject"); +SQLStorage sDBCSpellItemEnchantment(SpellItemEnchantmentfmt, "dbc_spellitemenchantment"); +SQLStorage sDBCSpellItemEnchantmentCondition(SpellItemEnchantmentConditionfmt, "dbc_spellitemenchantmentcondition"); +SQLStorage sDBCSpellRadius(SpellRadiusfmt, "dbc_spellradius"); +SQLStorage sDBCSpellRange(SpellRangefmt, "dbc_spellrange"); +SQLStorage sDBCSpellShapeshiftForm(SpellShapeshiftFormfmt, "dbc_spellshapeshiftform"); +SQLStorage sDBCSpellVisual(SpellVisualfmt, "dbc_spellvisual"); +SQLStorage sDBCStableSlotPrices(StableSlotPricesfmt, "dbc_stableslotprices"); +SQLStorage sDBCSummonProperties(SummonPropertiesfmt, "dbc_summonproperties"); +SQLStorage sDBCTalent(Talentfmt, "dbc_talent"); +SQLStorage sDBCTalentTab(TalentTabfmt, "dbc_talenttab"); +SQLStorage sDBCTaxiNodes(TaxiNodesfmt, "dbc_taxinodes"); +SQLStorage sDBCTaxiPath(TaxiPathfmt, "dbc_taxipath"); +SQLStorage sDBCTaxiPathNode(TaxiPathNodefmt, "dbc_taxipathnode"); +SQLStorage sDBCTransportAnimation(TransportAnimationfmt, "dbc_transportanimation"); +SQLStorage sDBCTotemCategory(TotemCategoryfmt, "dbc_totemcategory"); +SQLStorage sDBCWorldMapArea(WorldMapAreafmt, "dbc_worldmaparea"); +SQLStorage sDBCWMOAreaTable(WMOAreaTablefmt, "dbc_wmoareatable"); AreaFlagByAreaID sAreaFlagByAreaID; AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files From c0042e61fa96f62091b55a293b4560adb5593f98 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 11:57:51 +0100 Subject: [PATCH 13/28] Convert some more loop of sDBCAreaTable --- src/game/Chat/Level1.cpp | 58 ++++++++++++++++++--------------------- src/game/Loot/LootMgr.cpp | 7 ++--- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/game/Chat/Level1.cpp b/src/game/Chat/Level1.cpp index 12692f60379..fc10f77c3f4 100644 --- a/src/game/Chat/Level1.cpp +++ b/src/game/Chat/Level1.cpp @@ -1331,46 +1331,42 @@ bool ChatHandler::HandleLookupAreaCommand(char* args) wstrToLower(wnamepart); // Search in AreaTable.dbc - for (uint32 areaflag = 0; areaflag < sDBCAreaTable.GetNumRows(); ++areaflag) + for (auto areaEntry : sDBCAreaTable) { - AreaTableEntry const* areaEntry = sDBCAreaTable.LookupEntry(areaflag); - if (areaEntry) - { - int loc = GetSessionDbcLocale(); - std::string name = areaEntry->area_name[loc]; - if (name.empty()) - continue; + int loc = GetSessionDbcLocale(); + std::string name = areaEntry->area_name[loc]; + if (name.empty()) + continue; - if (!Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) { - loc = 0; - for (; loc < MAX_LOCALE; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; + if (loc == GetSessionDbcLocale()) + continue; - name = areaEntry->area_name[loc]; - if (name.empty()) - continue; + name = areaEntry->area_name[loc]; + if (name.empty()) + continue; - if (Utf8FitTo(name, wnamepart)) - break; - } + if (Utf8FitTo(name, wnamepart)) + break; } + } - if (loc < MAX_LOCALE) - { - // send area in "id - [name]" format - std::ostringstream ss; - if (m_session) - ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc] << "]|h|r"; - else - ss << areaEntry->ID << " - " << name << " " << localeNames[loc]; + if (loc < MAX_LOCALE) + { + // send area in "id - [name]" format + std::ostringstream ss; + if (m_session) + ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc] << "]|h|r"; + else + ss << areaEntry->ID << " - " << name << " " << localeNames[loc]; - SendSysMessage(ss.str().c_str()); + SendSysMessage(ss.str().c_str()); - ++counter; - } + ++counter; } } diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index 95c62e763ba..845cbd4e630 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -2679,11 +2679,10 @@ void LoadLootTemplates_Fishing() LootTemplates_Fishing.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (uint32 i = 1; i < sDBCAreaTable.GetNumRows(); ++i) + for (auto areaEntry : sDBCAreaTable) { - if (AreaTableEntry const* areaEntry = sDBCAreaTable.LookupEntry(i)) - if (ids_set.find(areaEntry->ID) != ids_set.end()) - ids_set.erase(areaEntry->ID); + if (ids_set.find(areaEntry->ID) != ids_set.end()) + ids_set.erase(areaEntry->ID); } // by default (look config options) fishing at fail provide junk loot, entry 0 use for store this loot From ae932f4596b713e5b4738523f4316c0287c21aaa Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 12:08:24 +0100 Subject: [PATCH 14/28] sDBCAreaTrigger --- src/game/AI/ScriptDevAI/ScriptDevAIMgr.cpp | 2 +- src/game/Chat/Chat.cpp | 4 ++-- src/game/Chat/Level2.cpp | 28 +++++----------------- src/game/Entities/MiscHandler.cpp | 4 ++-- src/game/Entities/Player.cpp | 2 +- src/game/Globals/ObjectMgr.cpp | 8 +++---- src/game/Server/DBCStores.cpp | 4 ++-- src/game/Server/DBCStores.h | 2 +- 8 files changed, 19 insertions(+), 35 deletions(-) diff --git a/src/game/AI/ScriptDevAI/ScriptDevAIMgr.cpp b/src/game/AI/ScriptDevAI/ScriptDevAIMgr.cpp index 2762f7ecc8b..a030cc90fd1 100644 --- a/src/game/AI/ScriptDevAI/ScriptDevAIMgr.cpp +++ b/src/game/AI/ScriptDevAI/ScriptDevAIMgr.cpp @@ -597,7 +597,7 @@ void ScriptDevAIMgr::LoadAreaTriggerScripts() uint32 triggerId = fields[0].GetUInt32(); const char* scriptName = fields[1].GetString(); - if (!sAreaTriggerStore.LookupEntry(triggerId)) + if (!sDBCAreaTrigger.LookupEntry(triggerId)) { sLog.outErrorDb("Table `scripted_areatrigger` has area trigger (ID: %u) not listed in `AreaTrigger.dbc`.", triggerId); continue; diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp index be1f841b4a0..1301492100a 100644 --- a/src/game/Chat/Chat.cpp +++ b/src/game/Chat/Chat.cpp @@ -3140,7 +3140,7 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x, if (!ExtractUInt32(&idS, id)) return false; - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(id); + AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(id); if (!atEntry) { PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, id); @@ -3160,7 +3160,7 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x, if (!ExtractUInt32(&idS, id)) return false; - if (!sAreaTriggerStore.LookupEntry(id)) + if (!sDBCAreaTrigger.LookupEntry(id)) { PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, id); SetSentErrorMessage(true); diff --git a/src/game/Chat/Level2.cpp b/src/game/Chat/Level2.cpp index 6e1a835d0de..19f4e9e0bae 100644 --- a/src/game/Chat/Level2.cpp +++ b/src/game/Chat/Level2.cpp @@ -224,7 +224,7 @@ bool ChatHandler::HandleTriggerCommand(char* args) if (!atId) return false; - atEntry = sAreaTriggerStore.LookupEntry(atId); + atEntry = sDBCAreaTrigger.LookupEntry(atId); if (!atEntry) { @@ -242,12 +242,8 @@ bool ChatHandler::HandleTriggerCommand(char* args) float dist2 = MAP_SIZE * MAP_SIZE; // Search triggers - for (uint32 id = 0; id < sAreaTriggerStore.GetNumRows(); ++id) + for (auto atTestEntry : sDBCAreaTrigger) { - AreaTriggerEntry const* atTestEntry = sAreaTriggerStore.LookupEntry(id); - if (!atTestEntry) - continue; - if (atTestEntry->mapid != m_session->GetPlayer()->GetMapId()) continue; @@ -324,12 +320,8 @@ bool ChatHandler::HandleTriggerActiveCommand(char* /*args*/) Player* pl = m_session->GetPlayer(); // Search in AreaTable.dbc - for (uint32 id = 0; id < sAreaTriggerStore.GetNumRows(); ++id) + for (auto atEntry : sDBCAreaTrigger) { - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(id); - if (!atEntry) - continue; - if (!IsPointInAreaTriggerZone(atEntry, pl->GetMapId(), pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ())) continue; @@ -353,12 +345,8 @@ bool ChatHandler::HandleTriggerNearCommand(char* args) Player* pl = m_session->GetPlayer(); // Search triggers - for (uint32 id = 0; id < sAreaTriggerStore.GetNumRows(); ++id) + for (auto atEntry : sDBCAreaTrigger) { - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(id); - if (!atEntry) - continue; - if (atEntry->mapid != m_session->GetPlayer()->GetMapId()) continue; @@ -374,12 +362,8 @@ bool ChatHandler::HandleTriggerNearCommand(char* args) } // Search trigger targets - for (uint32 id = 0; id < sAreaTriggerStore.GetNumRows(); ++id) + for (auto atEntry : sDBCAreaTrigger) { - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(id); - if (!atEntry) - continue; - AreaTrigger const* at = sObjectMgr.GetAreaTrigger(atEntry->id); if (!at) continue; @@ -429,7 +413,7 @@ bool ChatHandler::HandleGoTriggerCommand(char* args) if (!atId) return false; - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(atId); + AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(atId); if (!atEntry) { PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, atId); diff --git a/src/game/Entities/MiscHandler.cpp b/src/game/Entities/MiscHandler.cpp index a70a4a02cf9..006735a78a6 100644 --- a/src/game/Entities/MiscHandler.cpp +++ b/src/game/Entities/MiscHandler.cpp @@ -392,7 +392,7 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket& recv_data) _player->SetSelectionGuid(guid); - if (Unit* mover = _player->GetMover()) // when player has a mover and the mover is a + if (Unit* mover = _player->GetMover()) // when player has a mover and the mover is a if (mover != _player) mover->SetSelectionGuid(guid); @@ -703,7 +703,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) return; } - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); + AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(Trigger_ID); if (!atEntry) { DEBUG_LOG("Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID: %u", player->GetName(), player->GetGUIDLow(), Trigger_ID); diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index 930894d1429..dba81e138a8 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -6418,7 +6418,7 @@ void Player::CheckAreaExploreAndOutdoor() { if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && GetRestType() == REST_TYPE_IN_TAVERN) { - AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(inn_trigger_id); + AreaTriggerEntry const* at = sDBCAreaTrigger.LookupEntry(inn_trigger_id); if (!at || !IsPointInAreaTriggerZone(at, GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ())) { // Player left inn (REST_TYPE_IN_CITY overrides REST_TYPE_IN_TAVERN, so just clear rest) diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index d1d166a4d28..f4c0264a9f5 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -5675,7 +5675,7 @@ void ObjectMgr::LoadQuestAreaTriggers() uint32 trigger_ID = fields[0].GetUInt32(); uint32 quest_ID = fields[1].GetUInt32(); - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(trigger_ID); + AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(trigger_ID); if (!atEntry) { sLog.outErrorDb("Table `areatrigger_involvedrelation` has area trigger (ID: %u) not listed in `AreaTrigger.dbc`.", trigger_ID); @@ -5737,7 +5737,7 @@ void ObjectMgr::LoadTavernAreaTriggers() uint32 Trigger_ID = fields[0].GetUInt32(); - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); + AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(Trigger_ID); if (!atEntry) { sLog.outErrorDb("Table `areatrigger_tavern` has area trigger (ID:%u) not listed in `AreaTrigger.dbc`.", Trigger_ID); @@ -6323,7 +6323,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() at.conditionId = fields[13].GetUInt32(); at.status_failed_text = fields[14].GetCppString(); - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(at.entry); + AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(at.entry); if (!atEntry) { sLog.outErrorDb("Table `areatrigger_teleport` has area trigger (ID:%u) not listed in `AreaTrigger.dbc`.", at.entry); @@ -6438,7 +6438,7 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const { ghostTrigger.push_back(&mAreaTrigger.second); // First run, only consider AreaTrigger that teleport in the proper map - if ((!compareTrigger || mAreaTrigger.second.IsLessOrEqualThan(compareTrigger)) && sAreaTriggerStore.LookupEntry(mAreaTrigger.first)->mapid == map_id) + if ((!compareTrigger || mAreaTrigger.second.IsLessOrEqualThan(compareTrigger)) && sDBCAreaTrigger.LookupEntry(mAreaTrigger.first)->mapid == map_id) { if (mAreaTrigger.second.IsMinimal()) return &mAreaTrigger.second; diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 0bd3fcbd869..9721aa89df1 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -57,7 +57,7 @@ // // static WMOAreaInfoByTripple sWMOAreaInfoByTripple; -DBCStorage sAreaTriggerStore(AreaTriggerEntryfmt); +//DBCStorage sDBCAreaTrigger(AreaTriggerEntryfmt); DBCStorage sAuctionHouseStore(AuctionHouseEntryfmt); DBCStorage sBankBagSlotPricesStore(BankBagSlotPricesEntryfmt); DBCStorage sBattlemasterListStore(BattlemasterListEntryfmt); @@ -266,7 +266,7 @@ void LoadDBCStores(const std::string& dataPath) // } // } - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sAreaTriggerStore, dbcPath, "AreaTrigger.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAreaTrigger, dbcPath, "AreaTrigger.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sAuctionHouseStore, dbcPath, "AuctionHouse.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sBankBagSlotPricesStore, dbcPath, "BankBagSlotPrices.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sBattlemasterListStore, dbcPath, "BattlemasterList.dbc"); diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index 8a69a8ca5dc..6763d3cd888 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -68,7 +68,7 @@ bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, flo uint32 GetCreatureModelRace(uint32 model_id); //extern DBCStorage sDBCAreaTable;// recommend access using functions -extern DBCStorage sAreaTriggerStore; +//extern DBCStorage sDBCAreaTrigger; extern DBCStorage sAuctionHouseStore; extern DBCStorage sBankBagSlotPricesStore; extern DBCStorage sBattlemasterListStore; From 43db956b83baba4d7ee360af8c02e627aed8338f Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 12:13:51 +0100 Subject: [PATCH 15/28] sDBCAuctionHouse --- src/game/AuctionHouse/AuctionHouseMgr.cpp | 6 +++--- src/game/AuctionHouseBot/AuctionHouseBot.cpp | 2 +- src/game/Chat/Level3.cpp | 2 +- src/game/PlayerBot/Base/PlayerbotAI.cpp | 2 +- src/game/Server/DBCStores.cpp | 4 ++-- src/game/Server/DBCStores.h | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/game/AuctionHouse/AuctionHouseMgr.cpp b/src/game/AuctionHouse/AuctionHouseMgr.cpp index 0bda7c7ae0c..60d80f4011e 100644 --- a/src/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouse/AuctionHouseMgr.cpp @@ -430,12 +430,12 @@ void AuctionHouseMgr::LoadAuctions() auction->itemTemplate, auction->itemCount, auction->itemRandomPropertyId, auction->itemGuidLow); } - auction->auctionHouseEntry = sAuctionHouseStore.LookupEntry(houseid); + auction->auctionHouseEntry = sDBCAuctionHouse.LookupEntry(houseid); if (!auction->auctionHouseEntry) { // need for send mail, use goblin auctionhouse - auction->auctionHouseEntry = sAuctionHouseStore.LookupEntry(7); + auction->auctionHouseEntry = sDBCAuctionHouse.LookupEntry(7); // Attempt send item back to owner std::ostringstream msgAuctionCanceledOwner; @@ -566,7 +566,7 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit) } } - return sAuctionHouseStore.LookupEntry(houseid); + return sDBCAuctionHouse.LookupEntry(houseid); } void AuctionHouseObject::Update() diff --git a/src/game/AuctionHouseBot/AuctionHouseBot.cpp b/src/game/AuctionHouseBot/AuctionHouseBot.cpp index 8ef64a66800..87edaec3e38 100644 --- a/src/game/AuctionHouseBot/AuctionHouseBot.cpp +++ b/src/game/AuctionHouseBot/AuctionHouseBot.cpp @@ -225,7 +225,7 @@ void AuctionHouseBot::Update() continue; // don't put up items we don't know the value of uint32 bidPrice = buyoutPrice * (urand(m_auctionBidMin, m_auctionBidMax)) / 100; if (item) - auctionHouse->AddAuction(sAuctionHouseStore.LookupEntry(houseType == AUCTION_HOUSE_ALLIANCE ? 1 : (houseType == AUCTION_HOUSE_HORDE ? 6 : 7)), item, urand(m_auctionTimeMin, m_auctionTimeMax) * HOUR, bidPrice, buyoutPrice); + auctionHouse->AddAuction(sDBCAuctionHouse.LookupEntry(houseType == AUCTION_HOUSE_ALLIANCE ? 1 : (houseType == AUCTION_HOUSE_HORDE ? 6 : 7)), item, urand(m_auctionTimeMin, m_auctionTimeMax) * HOUR, bidPrice, buyoutPrice); } } } else if (m_houseAction >= MAX_AUCTION_HOUSE_TYPE && urand(0, 99) < m_chanceBuy) diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp index 96fe4588890..2d9a858bd11 100644 --- a/src/game/Chat/Level3.cpp +++ b/src/game/Chat/Level3.cpp @@ -3858,7 +3858,7 @@ bool ChatHandler::HandleAuctionItemCommand(char* args) return false; } - AuctionHouseEntry const* auctionHouseEntry = sAuctionHouseStore.LookupEntry(houseid); + AuctionHouseEntry const* auctionHouseEntry = sDBCAuctionHouse.LookupEntry(houseid); AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry); if (!item_id) diff --git a/src/game/PlayerBot/Base/PlayerbotAI.cpp b/src/game/PlayerBot/Base/PlayerbotAI.cpp index ad855a7e71a..0f15ae862e5 100644 --- a/src/game/PlayerBot/Base/PlayerbotAI.cpp +++ b/src/game/PlayerBot/Base/PlayerbotAI.cpp @@ -7682,7 +7682,7 @@ bool PlayerbotAI::RemoveAuction(const uint32 auctionid) return false; } - auction->auctionHouseEntry = sAuctionHouseStore.LookupEntry(houseid); + auction->auctionHouseEntry = sDBCAuctionHouse.LookupEntry(houseid); // Attempt send item back to owner std::ostringstream msgAuctionCanceledOwner; diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 9721aa89df1..e62177a6827 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -58,7 +58,7 @@ // static WMOAreaInfoByTripple sWMOAreaInfoByTripple; //DBCStorage sDBCAreaTrigger(AreaTriggerEntryfmt); -DBCStorage sAuctionHouseStore(AuctionHouseEntryfmt); +//DBCStorage sDBCAuctionHouse(AuctionHouseEntryfmt); DBCStorage sBankBagSlotPricesStore(BankBagSlotPricesEntryfmt); DBCStorage sBattlemasterListStore(BattlemasterListEntryfmt); DBCStorage sCharStartOutfitStore(CharStartOutfitEntryfmt); @@ -267,7 +267,7 @@ void LoadDBCStores(const std::string& dataPath) // } // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAreaTrigger, dbcPath, "AreaTrigger.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sAuctionHouseStore, dbcPath, "AuctionHouse.dbc"); + LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAuctionHouse, dbcPath, "AuctionHouse.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sBankBagSlotPricesStore, dbcPath, "BankBagSlotPrices.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sBattlemasterListStore, dbcPath, "BattlemasterList.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCharStartOutfitStore, dbcPath, "CharStartOutfit.dbc"); diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index 6763d3cd888..5b6c359ae1b 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -69,7 +69,7 @@ uint32 GetCreatureModelRace(uint32 model_id); //extern DBCStorage sDBCAreaTable;// recommend access using functions //extern DBCStorage sDBCAreaTrigger; -extern DBCStorage sAuctionHouseStore; +//extern DBCStorage sDBCAuctionHouse; extern DBCStorage sBankBagSlotPricesStore; extern DBCStorage sBattlemasterListStore; // extern DBCStorage sChatChannelsStore; -- accessed using function, no usable index From 589948017a59341dd22e4ae72c4020582a8694d9 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 12:15:45 +0100 Subject: [PATCH 16/28] sDBCBankBagSlotPrices --- src/game/Entities/ItemHandler.cpp | 2 +- src/game/Server/DBCStores.cpp | 4 ++-- src/game/Server/DBCStores.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/Entities/ItemHandler.cpp b/src/game/Entities/ItemHandler.cpp index b7ab4c242c1..be6e624ae83 100644 --- a/src/game/Entities/ItemHandler.cpp +++ b/src/game/Entities/ItemHandler.cpp @@ -893,7 +893,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) DETAIL_LOG("PLAYER: Buy bank bag slot, slot number = %u", slot); - BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot); + BankBagSlotPricesEntry const* slotEntry = sDBCBankBagSlotPrices.LookupEntry(slot); WorldPacket data(SMSG_BUY_BANK_SLOT_RESULT, 4); diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index e62177a6827..3f103bc4c37 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -59,7 +59,7 @@ //DBCStorage sDBCAreaTrigger(AreaTriggerEntryfmt); //DBCStorage sDBCAuctionHouse(AuctionHouseEntryfmt); -DBCStorage sBankBagSlotPricesStore(BankBagSlotPricesEntryfmt); +//DBCStorage sDBCBankBagSlotPrices(BankBagSlotPricesEntryfmt); DBCStorage sBattlemasterListStore(BattlemasterListEntryfmt); DBCStorage sCharStartOutfitStore(CharStartOutfitEntryfmt); DBCStorage sCharTitlesStore(CharTitlesEntryfmt); @@ -268,7 +268,7 @@ void LoadDBCStores(const std::string& dataPath) // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAreaTrigger, dbcPath, "AreaTrigger.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAuctionHouse, dbcPath, "AuctionHouse.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sBankBagSlotPricesStore, dbcPath, "BankBagSlotPrices.dbc"); + LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBankBagSlotPrices, dbcPath, "BankBagSlotPrices.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sBattlemasterListStore, dbcPath, "BattlemasterList.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCharStartOutfitStore, dbcPath, "CharStartOutfit.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCharTitlesStore, dbcPath, "CharTitles.dbc"); diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index 5b6c359ae1b..f9ed9706401 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -70,7 +70,7 @@ uint32 GetCreatureModelRace(uint32 model_id); //extern DBCStorage sDBCAreaTable;// recommend access using functions //extern DBCStorage sDBCAreaTrigger; //extern DBCStorage sDBCAuctionHouse; -extern DBCStorage sBankBagSlotPricesStore; +//extern DBCStorage sDBCBankBagSlotPrices; extern DBCStorage sBattlemasterListStore; // extern DBCStorage sChatChannelsStore; -- accessed using function, no usable index extern DBCStorage sCharStartOutfitStore; From 92156aa9fe61cb4d68bf8e24a1a4b14408983dc4 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 12:17:41 +0100 Subject: [PATCH 17/28] sDBCBattlemasterList --- src/game/BattleGround/BattleGroundHandler.cpp | 6 +++--- src/game/BattleGround/BattleGroundMgr.cpp | 4 ++-- src/game/Server/DBCStores.cpp | 4 ++-- src/game/Server/DBCStores.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/game/BattleGround/BattleGroundHandler.cpp b/src/game/BattleGround/BattleGroundHandler.cpp index 43c910735e4..41da0f6b695 100644 --- a/src/game/BattleGround/BattleGroundHandler.cpp +++ b/src/game/BattleGround/BattleGroundHandler.cpp @@ -96,7 +96,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data) recv_data >> instanceId; // instance id, 0 if First Available selected recv_data >> joinAsGroup; // join as group - if (!sBattlemasterListStore.LookupEntry(receivedBgTypeId)) + if (!sDBCBattlemasterList.LookupEntry(receivedBgTypeId)) { sLog.outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", receivedBgTypeId, _player->GetGUIDLow()); return; @@ -329,7 +329,7 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket& recv_data) uint32 bgTypeId; recv_data >> bgTypeId; // id from DBC - BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId); + BattlemasterListEntry const* bl = sDBCBattlemasterList.LookupEntry(bgTypeId); if (!bl) { sLog.outError("Battleground: invalid bgtype received."); @@ -354,7 +354,7 @@ void WorldSession::HandleBattlefieldPortOpcode(WorldPacket& recv_data) recv_data >> type >> unk2 >> receivedBgTypeId >> unk >> action; - if (!sBattlemasterListStore.LookupEntry(receivedBgTypeId)) + if (!sDBCBattlemasterList.LookupEntry(receivedBgTypeId)) { sLog.outError("BattlegroundHandler: invalid bgtype (%u) received.", receivedBgTypeId); return; diff --git a/src/game/BattleGround/BattleGroundMgr.cpp b/src/game/BattleGround/BattleGroundMgr.cpp index cd7ad945d6d..199ae1cc6b3 100644 --- a/src/game/BattleGround/BattleGroundMgr.cpp +++ b/src/game/BattleGround/BattleGroundMgr.cpp @@ -1838,7 +1838,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() uint32 resultedBgTypeId = fields[0].GetUInt32(); // can be overwrite by values from DB - BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(resultedBgTypeId); + BattlemasterListEntry const* bl = sDBCBattlemasterList.LookupEntry(resultedBgTypeId); if (!bl) { sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", resultedBgTypeId); @@ -2541,7 +2541,7 @@ void BattleGroundMgr::LoadBattleMastersEntry() uint32 entry = fields[0].GetUInt32(); uint32 bgTypeId = fields[1].GetUInt32(); - if (!sBattlemasterListStore.LookupEntry(bgTypeId)) + if (!sDBCBattlemasterList.LookupEntry(bgTypeId)) { sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for nonexistent battleground type %u, ignored.", entry, bgTypeId); continue; diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 3f103bc4c37..a4459fbcb2f 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -60,7 +60,7 @@ //DBCStorage sDBCAreaTrigger(AreaTriggerEntryfmt); //DBCStorage sDBCAuctionHouse(AuctionHouseEntryfmt); //DBCStorage sDBCBankBagSlotPrices(BankBagSlotPricesEntryfmt); -DBCStorage sBattlemasterListStore(BattlemasterListEntryfmt); +//DBCStorage sDBCBattlemasterList(BattlemasterListEntryfmt); DBCStorage sCharStartOutfitStore(CharStartOutfitEntryfmt); DBCStorage sCharTitlesStore(CharTitlesEntryfmt); DBCStorage sChatChannelsStore(ChatChannelsEntryfmt); @@ -269,7 +269,7 @@ void LoadDBCStores(const std::string& dataPath) // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAreaTrigger, dbcPath, "AreaTrigger.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAuctionHouse, dbcPath, "AuctionHouse.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBankBagSlotPrices, dbcPath, "BankBagSlotPrices.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sBattlemasterListStore, dbcPath, "BattlemasterList.dbc"); + LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBattlemasterList, dbcPath, "BattlemasterList.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCharStartOutfitStore, dbcPath, "CharStartOutfit.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCharTitlesStore, dbcPath, "CharTitles.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChatChannelsStore, dbcPath, "ChatChannels.dbc"); diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index f9ed9706401..1dc0e2c5d08 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -71,7 +71,7 @@ uint32 GetCreatureModelRace(uint32 model_id); //extern DBCStorage sDBCAreaTrigger; //extern DBCStorage sDBCAuctionHouse; //extern DBCStorage sDBCBankBagSlotPrices; -extern DBCStorage sBattlemasterListStore; +//extern DBCStorage sDBCBattlemasterList; // extern DBCStorage sChatChannelsStore; -- accessed using function, no usable index extern DBCStorage sCharStartOutfitStore; extern DBCStorage sCharTitlesStore; From 58f61e41d19b669d0f6458f5aad8675a9a800029 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 12:21:43 +0100 Subject: [PATCH 18/28] sDBCCharStartOutfit --- src/game/Entities/Player.cpp | 11 ++++------- src/game/Globals/ObjectMgr.cpp | 6 +----- src/game/Server/DBCStores.cpp | 4 ++-- src/game/Server/DBCStores.h | 2 +- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index dba81e138a8..c5334c0abfd 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -832,15 +832,12 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c uint32 raceClassGender = GetUInt32Value(UNIT_FIELD_BYTES_0) & 0x00FFFFFF; CharStartOutfitEntry const* oEntry = nullptr; - for (uint32 i = 1; i < sCharStartOutfitStore.GetNumRows(); ++i) + for (auto entry : sDBCCharStartOutfit) { - if (CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(i)) + if (entry->RaceClassGender == raceClassGender) { - if (entry->RaceClassGender == raceClassGender) - { - oEntry = entry; - break; - } + oEntry = entry; + break; } } diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index f4c0264a9f5..b68b7d27f4a 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -2452,12 +2452,8 @@ void ObjectMgr::LoadItemPrototypes() // check some dbc referenced items (avoid duplicate reports) std::set notFoundOutfit; - for (uint32 i = 1; i < sCharStartOutfitStore.GetNumRows(); ++i) + for (auto entry : sDBCCharStartOutfit) { - CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(i); - if (!entry) - continue; - for (int j : entry->ItemId) { if (j <= 0) diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index a4459fbcb2f..a9d96e24cb4 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -61,7 +61,7 @@ //DBCStorage sDBCAuctionHouse(AuctionHouseEntryfmt); //DBCStorage sDBCBankBagSlotPrices(BankBagSlotPricesEntryfmt); //DBCStorage sDBCBattlemasterList(BattlemasterListEntryfmt); -DBCStorage sCharStartOutfitStore(CharStartOutfitEntryfmt); +//DBCStorage sDBCCharStartOutfit(CharStartOutfitEntryfmt); DBCStorage sCharTitlesStore(CharTitlesEntryfmt); DBCStorage sChatChannelsStore(ChatChannelsEntryfmt); DBCStorage sChrClassesStore(ChrClassesEntryfmt); @@ -270,7 +270,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAuctionHouse, dbcPath, "AuctionHouse.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBankBagSlotPrices, dbcPath, "BankBagSlotPrices.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBattlemasterList, dbcPath, "BattlemasterList.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCharStartOutfitStore, dbcPath, "CharStartOutfit.dbc"); + LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharStartOutfit, dbcPath, "CharStartOutfit.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCharTitlesStore, dbcPath, "CharTitles.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChatChannelsStore, dbcPath, "ChatChannels.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChrClassesStore, dbcPath, "ChrClasses.dbc"); diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index 1dc0e2c5d08..a8ccd84a972 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -73,7 +73,7 @@ uint32 GetCreatureModelRace(uint32 model_id); //extern DBCStorage sDBCBankBagSlotPrices; //extern DBCStorage sDBCBattlemasterList; // extern DBCStorage sChatChannelsStore; -- accessed using function, no usable index -extern DBCStorage sCharStartOutfitStore; +//extern DBCStorage sDBCCharStartOutfit; extern DBCStorage sCharTitlesStore; extern DBCStorage sChatChannelsStore; extern DBCStorage sChrClassesStore; From 7f60374853a8b913254218999309d60fab215bb2 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 12:28:54 +0100 Subject: [PATCH 19/28] sDBCCharTitles --- src/game/BattleGround/BattleGroundMgr.cpp | 2 +- src/game/Chat/Level2.cpp | 90 +++++++++++------------ src/game/Entities/Player.cpp | 10 +-- src/game/Globals/ObjectMgr.cpp | 2 +- src/game/Quests/QuestDef.cpp | 2 +- src/game/Server/DBCStores.cpp | 6 +- src/game/Server/DBCStores.h | 2 +- 7 files changed, 54 insertions(+), 60 deletions(-) diff --git a/src/game/BattleGround/BattleGroundMgr.cpp b/src/game/BattleGround/BattleGroundMgr.cpp index 199ae1cc6b3..21dbc250dfd 100644 --- a/src/game/BattleGround/BattleGroundMgr.cpp +++ b/src/game/BattleGround/BattleGroundMgr.cpp @@ -2168,7 +2168,7 @@ void BattleGroundMgr::RewardArenaSeason(uint32 seasonId) } CharTitlesEntry const* titleEntries[5]; // optimization for (uint32 i = 0; i < 5; ++i) - titleEntries[i] = sCharTitlesStore.LookupEntry(titles[i]); + titleEntries[i] = sDBCCharTitles.LookupEntry(titles[i]); // Remove titles from online players // Only Rank 1 titles are permanent diff --git a/src/game/Chat/Level2.cpp b/src/game/Chat/Level2.cpp index 19f4e9e0bae..d8504b13873 100644 --- a/src/game/Chat/Level2.cpp +++ b/src/game/Chat/Level2.cpp @@ -4453,52 +4453,48 @@ bool ChatHandler::HandleLookupTitleCommand(char* args) uint32 counter = 0; // Counter for figure out that we found smth. // Search in CharTitles.dbc - for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); ++id) + for (auto titleInfo : sDBCCharTitles) { - CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); - if (titleInfo) - { - int loc = GetSessionDbcLocale(); - std::string name = titleInfo->name[loc]; - if (name.empty()) - continue; + int loc = GetSessionDbcLocale(); + std::string name = titleInfo->name[loc]; + if (name.empty()) + continue; - if (!Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) { - loc = 0; - for (; loc < MAX_LOCALE; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; + if (loc == GetSessionDbcLocale()) + continue; - name = titleInfo->name[loc]; - if (name.empty()) - continue; + name = titleInfo->name[loc]; + if (name.empty()) + continue; - if (Utf8FitTo(name, wnamepart)) - break; - } + if (Utf8FitTo(name, wnamepart)) + break; } + } - if (loc < MAX_LOCALE) - { - char const* knownStr = target && target->HasTitle(titleInfo) ? GetMangosString(LANG_KNOWN) : ""; + if (loc < MAX_LOCALE) + { + char const* knownStr = target && target->HasTitle(titleInfo) ? GetMangosString(LANG_KNOWN) : ""; - char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index - ? GetMangosString(LANG_ACTIVE) - : ""; + char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index + ? GetMangosString(LANG_ACTIVE) + : ""; - char titleNameStr[80]; - snprintf(titleNameStr, 80, name.c_str(), targetName); + char titleNameStr[80]; + snprintf(titleNameStr, 80, name.c_str(), targetName); - // send title in "id (idx:idx) - [namedlink locale]" format - if (m_session) - PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr); - else - PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[loc], knownStr, activeStr); + // send title in "id (idx:idx) - [namedlink locale]" format + if (m_session) + PSendSysMessage(LANG_TITLE_LIST_CHAT, titleInfo->ID, titleInfo->bit_index, titleInfo->ID, titleNameStr, localeNames[loc], knownStr, activeStr); + else + PSendSysMessage(LANG_TITLE_LIST_CONSOLE, titleInfo->ID, titleInfo->bit_index, titleNameStr, localeNames[loc], knownStr, activeStr); - ++counter; - } + ++counter; } } if (counter == 0) // if counter == 0 then we found nth @@ -4532,7 +4528,7 @@ bool ChatHandler::HandleTitlesAddCommand(char* args) if (HasLowerSecurity(target)) return false; - CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); + CharTitlesEntry const* titleInfo = sDBCCharTitles.LookupEntry(id); if (!titleInfo) { PSendSysMessage(LANG_INVALID_TITLE_ID, id); @@ -4578,7 +4574,7 @@ bool ChatHandler::HandleTitlesRemoveCommand(char* args) if (HasLowerSecurity(target)) return false; - CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); + CharTitlesEntry const* titleInfo = sDBCCharTitles.LookupEntry(id); if (!titleInfo) { PSendSysMessage(LANG_INVALID_TITLE_ID, id); @@ -4629,9 +4625,8 @@ bool ChatHandler::HandleTitlesSetMaskCommand(char* args) uint64 titles2 = titles; - for (uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i) - if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i)) - titles2 &= ~(uint64(1) << tEntry->bit_index); + for (auto tEntry : sDBCCharTitles) + titles2 &= ~(uint64(1) << tEntry->bit_index); titles &= ~titles2; // remove nonexistent titles @@ -4666,13 +4661,13 @@ bool ChatHandler::HandleTitlesSwapCommand(char* /*args*/) if (!foundTitle) return false; - if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(foundTitle)) + if (CharTitlesEntry const* tEntry = sDBCCharTitles.LookupEntry(foundTitle)) target->SetTitle(tEntry, true); if (foundTitle > 14) foundTitle -= 14; else foundTitle += 14; - if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(foundTitle)) + if (CharTitlesEntry const* tEntry = sDBCCharTitles.LookupEntry(foundTitle)) target->SetTitle(tEntry, false); return true; @@ -4689,10 +4684,9 @@ bool ChatHandler::HandleCharacterTitlesCommand(char* args) char const* knownStr = GetMangosString(LANG_KNOWN); // Search in CharTitles.dbc - for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); ++id) + for (auto titleInfo : sDBCCharTitles) { - CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); - if (titleInfo && target->HasTitle(titleInfo)) + if (target->HasTitle(titleInfo)) { std::string name = titleInfo->name[loc]; if (name.empty()) @@ -4707,9 +4701,9 @@ bool ChatHandler::HandleCharacterTitlesCommand(char* args) // send title in "id (idx:idx) - [namedlink locale]" format if (m_session) - PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr); + PSendSysMessage(LANG_TITLE_LIST_CHAT, titleInfo->ID, titleInfo->bit_index, titleInfo->ID, titleNameStr, localeNames[loc], knownStr, activeStr); else - PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr); + PSendSysMessage(LANG_TITLE_LIST_CONSOLE, titleInfo->ID, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr); } } return true; @@ -4741,7 +4735,7 @@ bool ChatHandler::HandleTitlesCurrentCommand(char* args) if (HasLowerSecurity(target)) return false; - CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); + CharTitlesEntry const* titleInfo = sDBCCharTitles.LookupEntry(id); if (!titleInfo) { PSendSysMessage(LANG_INVALID_TITLE_ID, id); diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index c5334c0abfd..676ff653747 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -13358,7 +13358,7 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver, // title reward if (pQuest->GetCharTitleId()) { - if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId())) + if (CharTitlesEntry const* titleEntry = sDBCCharTitles.LookupEntry(pQuest->GetCharTitleId())) SetTitle(titleEntry); } @@ -14879,13 +14879,13 @@ void Player::_LoadIntoDataField(const char* data, uint32 startOffset, uint32 cou if (foundTitle > 14 && (raceMask & RACEMASK_HORDE) != 0) return; - if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(foundTitle)) + if (CharTitlesEntry const* tEntry = sDBCCharTitles.LookupEntry(foundTitle)) SetTitle(tEntry, true, false); if (foundTitle > 14) foundTitle -= 14; else foundTitle += 14; - if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(foundTitle)) + if (CharTitlesEntry const* tEntry = sDBCCharTitles.LookupEntry(foundTitle)) SetTitle(tEntry, false, false); } @@ -16068,7 +16068,7 @@ void Player::_LoadQuestStatus(QueryResult* result) // set rewarded title if any if (pQuest->GetCharTitleId()) { - if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId())) + if (CharTitlesEntry const* titleEntry = sDBCCharTitles.LookupEntry(pQuest->GetCharTitleId())) SetTitle(titleEntry); } } @@ -20758,7 +20758,7 @@ bool Player::HasTitle(uint32 bitIndex) const void Player::SetTitle(uint32 titleId, bool lost) { - if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId)) + if (CharTitlesEntry const* titleEntry = sDBCCharTitles.LookupEntry(titleId)) SetTitle(titleEntry, lost); } diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index b68b7d27f4a..cd0efc4db38 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -3978,7 +3978,7 @@ void ObjectMgr::LoadQuests() // warning } - if (qinfo->CharTitleId && !sCharTitlesStore.LookupEntry(qinfo->CharTitleId)) + if (qinfo->CharTitleId && !sDBCCharTitles.LookupEntry(qinfo->CharTitleId)) { sLog.outErrorDb("Quest %u has `CharTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId()); diff --git a/src/game/Quests/QuestDef.cpp b/src/game/Quests/QuestDef.cpp index 0032b26ecac..d83328f6362 100644 --- a/src/game/Quests/QuestDef.cpp +++ b/src/game/Quests/QuestDef.cpp @@ -230,7 +230,7 @@ uint32 Quest::GetCharTitleBitIndex() const { if (!CharTitleId) return 0; - CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(CharTitleId); + CharTitlesEntry const* titleEntry = sDBCCharTitles.LookupEntry(CharTitleId); return titleEntry ? titleEntry->bit_index : 0; } diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index a9d96e24cb4..2a12499b644 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -62,7 +62,7 @@ //DBCStorage sDBCBankBagSlotPrices(BankBagSlotPricesEntryfmt); //DBCStorage sDBCBattlemasterList(BattlemasterListEntryfmt); //DBCStorage sDBCCharStartOutfit(CharStartOutfitEntryfmt); -DBCStorage sCharTitlesStore(CharTitlesEntryfmt); +//DBCStorage sDBCCharTitles(CharTitlesEntryfmt); DBCStorage sChatChannelsStore(ChatChannelsEntryfmt); DBCStorage sChrClassesStore(ChrClassesEntryfmt); DBCStorage sChrRacesStore(ChrRacesEntryfmt); @@ -271,7 +271,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBankBagSlotPrices, dbcPath, "BankBagSlotPrices.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBattlemasterList, dbcPath, "BattlemasterList.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharStartOutfit, dbcPath, "CharStartOutfit.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCharTitlesStore, dbcPath, "CharTitles.dbc"); + LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharTitles, dbcPath, "CharTitles.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChatChannelsStore, dbcPath, "ChatChannels.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChrClassesStore, dbcPath, "ChrClasses.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChrRacesStore, dbcPath, "ChrRaces.dbc"); @@ -573,7 +573,7 @@ void LoadDBCStores(const std::string& dataPath) !sMapStore.LookupEntry(598) || !sGemPropertiesStore.LookupEntry(1127) || !sItemExtendedCostStore.LookupEntry(2425) || - !sCharTitlesStore.LookupEntry(71) || + !sDBCCharTitles.LookupEntry(71) || !sDBCAreaTable.LookupEntry(1768)) { sLog.outError("\nYou have _outdated_ DBC files. Please re-extract DBC files for one from client build: %s", AcceptableClientBuildsListStr().c_str()); diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index a8ccd84a972..e4b4358e576 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -74,7 +74,7 @@ uint32 GetCreatureModelRace(uint32 model_id); //extern DBCStorage sDBCBattlemasterList; // extern DBCStorage sChatChannelsStore; -- accessed using function, no usable index //extern DBCStorage sDBCCharStartOutfit; -extern DBCStorage sCharTitlesStore; +//extern DBCStorage sDBCCharTitles; extern DBCStorage sChatChannelsStore; extern DBCStorage sChrClassesStore; extern DBCStorage sChrRacesStore; From 0aaaf81ee35ec8f0fafb6ce6a480ce19357d9980 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 12:31:46 +0100 Subject: [PATCH 20/28] sDBCChatChannels --- src/game/Server/DBCStores.cpp | 51 +++++++++++++++++------------------ src/game/Server/DBCStores.h | 2 +- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 2a12499b644..f06aec45ef3 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -63,7 +63,7 @@ //DBCStorage sDBCBattlemasterList(BattlemasterListEntryfmt); //DBCStorage sDBCCharStartOutfit(CharStartOutfitEntryfmt); //DBCStorage sDBCCharTitles(CharTitlesEntryfmt); -DBCStorage sChatChannelsStore(ChatChannelsEntryfmt); +//DBCStorage sDBCChatChannels(ChatChannelsEntryfmt); DBCStorage sChrClassesStore(ChrClassesEntryfmt); DBCStorage sChrRacesStore(ChrRacesEntryfmt); DBCStorage sCinematicCameraStore(CinematicCameraEntryfmt); @@ -272,7 +272,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBattlemasterList, dbcPath, "BattlemasterList.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharStartOutfit, dbcPath, "CharStartOutfit.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharTitles, dbcPath, "CharTitles.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChatChannelsStore, dbcPath, "ChatChannels.dbc"); + LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChatChannels, dbcPath, "ChatChannels.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChrClassesStore, dbcPath, "ChrClasses.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChrRacesStore, dbcPath, "ChrRaces.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCinematicCameraStore, dbcPath, "CinematicCamera.dbc"); @@ -657,42 +657,39 @@ ChatChannelsEntry const* GetChatChannelsEntryFor(const std::string& name, uint32 return nullptr; // not sorted, numbering index from 0 - for (uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i) + for (auto entry : sDBCChatChannels) { - if (ChatChannelsEntry const* entry = sChatChannelsStore.LookupEntry(i)) - { - std::wstring wpattern; + std::wstring wpattern; - // try to match by name first, avoid creating custom channels with same name - if (!wname.empty()) + // try to match by name first, avoid creating custom channels with same name + if (!wname.empty()) + { + for (uint32 i = 0; i < MAX_LOCALE; ++i) { - for (uint32 i = 0; i < MAX_LOCALE; ++i) - { - Utf8toWStr(entry->pattern[i], wpattern); + Utf8toWStr(entry->pattern[i], wpattern); - if (wpattern.empty()) - continue; + if (wpattern.empty()) + continue; - size_t argpos = wpattern.find(L"%s"); + size_t argpos = wpattern.find(L"%s"); - // formatting arg present: strip and attempt partial match - if (argpos != std::wstring::npos) - { - wpattern.replace(argpos, 2, L""); + // formatting arg present: strip and attempt partial match + if (argpos != std::wstring::npos) + { + wpattern.replace(argpos, 2, L""); - if (wname.find(wpattern) != std::wstring::npos) - return entry; - } - // attempt full match - else if (wname.compare(wpattern) == 0) + if (wname.find(wpattern) != std::wstring::npos) return entry; } + // attempt full match + else if (wname.compare(wpattern) == 0) + return entry; } - - // name still not found, but channel id is provided: possibly no dbc data for client locale - if (channel_id && channel_id == entry->ChannelID) - return entry; } + + // name still not found, but channel id is provided: possibly no dbc data for client locale + if (channel_id && channel_id == entry->ChannelID) + return entry; } return nullptr; } diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index e4b4358e576..5cb43fe64e0 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -75,7 +75,7 @@ uint32 GetCreatureModelRace(uint32 model_id); // extern DBCStorage sChatChannelsStore; -- accessed using function, no usable index //extern DBCStorage sDBCCharStartOutfit; //extern DBCStorage sDBCCharTitles; -extern DBCStorage sChatChannelsStore; +//extern DBCStorage sDBCChatChannels; extern DBCStorage sChrClassesStore; extern DBCStorage sChrRacesStore; extern DBCStorage sCinematicCameraStore; From 685c42ad640ac4e3ff34201225f174abb38bfc72 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 12:34:20 +0100 Subject: [PATCH 21/28] fix build --- src/game/Server/DBCStores.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index f06aec45ef3..c3e8b91b2f1 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -267,12 +267,12 @@ void LoadDBCStores(const std::string& dataPath) // } // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAreaTrigger, dbcPath, "AreaTrigger.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAuctionHouse, dbcPath, "AuctionHouse.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBankBagSlotPrices, dbcPath, "BankBagSlotPrices.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBattlemasterList, dbcPath, "BattlemasterList.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharStartOutfit, dbcPath, "CharStartOutfit.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharTitles, dbcPath, "CharTitles.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChatChannels, dbcPath, "ChatChannels.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAuctionHouse, dbcPath, "AuctionHouse.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBankBagSlotPrices, dbcPath, "BankBagSlotPrices.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBattlemasterList, dbcPath, "BattlemasterList.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharStartOutfit, dbcPath, "CharStartOutfit.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharTitles, dbcPath, "CharTitles.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChatChannels, dbcPath, "ChatChannels.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChrClassesStore, dbcPath, "ChrClasses.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChrRacesStore, dbcPath, "ChrRaces.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCinematicCameraStore, dbcPath, "CinematicCamera.dbc"); From 773afe073ffc40b24a7130e656fd2838e1a0304d Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 12:46:42 +0100 Subject: [PATCH 22/28] sDBCChrClasses --- src/game/Chat/Level3.cpp | 6 +++--- src/game/Entities/CharacterHandler.cpp | 2 +- src/game/Entities/Player.cpp | 4 ++-- src/game/Globals/ObjectMgr.cpp | 14 +++++++------- src/game/Server/DBCStores.cpp | 4 ++-- src/game/Server/DBCStores.h | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp index 2d9a858bd11..bf1b98bb6ae 100644 --- a/src/game/Chat/Level3.cpp +++ b/src/game/Chat/Level3.cpp @@ -1519,7 +1519,7 @@ bool ChatHandler::HandleLearnAllMyClassCommand(char* /*args*/) bool ChatHandler::HandleLearnAllMySpellsCommand(char* /*args*/) { Player* player = m_session->GetPlayer(); - ChrClassesEntry const* clsEntry = sChrClassesStore.LookupEntry(player->getClass()); + ChrClassesEntry const* clsEntry = sDBCChrClasses.LookupEntry(player->getClass()); if (!clsEntry) return true; uint32 family = clsEntry->spellfamily; @@ -4157,7 +4157,7 @@ bool ChatHandler::HandleResetHonorCommand(char* args) static bool HandleResetStatsOrLevelHelper(Player* player) { - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(player->getClass()); + ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(player->getClass()); if (!cEntry) { sLog.outError("Class %u not found in DBC (Wrong DBC files?)", player->getClass()); @@ -5940,7 +5940,7 @@ bool ChatHandler::ShowPlayerListHelper(QueryResult* result, uint32* limit, bool uint32 level = fields[4].GetUInt32(); ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race); - ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_); + ChrClassesEntry const* classEntry = sDBCChrClasses.LookupEntry(class_); char const* race_name = raceEntry ? raceEntry->name[GetSessionDbcLocale()] : ""; char const* class_name = classEntry ? classEntry->name[GetSessionDbcLocale()] : ""; diff --git a/src/game/Entities/CharacterHandler.cpp b/src/game/Entities/CharacterHandler.cpp index 8a3abf6c60c..8c20b0a2ce1 100644 --- a/src/game/Entities/CharacterHandler.cpp +++ b/src/game/Entities/CharacterHandler.cpp @@ -251,7 +251,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recv_data) } } - ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_); + ChrClassesEntry const* classEntry = sDBCChrClasses.LookupEntry(class_); ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_); if (!classEntry || !raceEntry) diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index 676ff653747..b9f5b7ce07c 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -726,7 +726,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c return false; } - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(class_); + ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(class_); if (!cEntry) { sLog.outError("Class %u not found in DBC (Wrong DBC files?)", class_); @@ -18542,7 +18542,7 @@ void Player::InitDataForForm(bool reapplyMods) } default: // 0, for example { - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(getClass()); + ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(getClass()); if (cEntry && cEntry->powerType < MAX_POWERS && uint32(GetPowerType()) != cEntry->powerType) SetPowerType(Powers(cEntry->powerType)); break; diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index cd0efc4db38..17a622e3cc8 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -2729,7 +2729,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); + ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(current_class); if (!cEntry || !((1 << (current_class - 1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.", current_class); @@ -2806,7 +2806,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); + ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(current_class); if (!cEntry || !((1 << (current_class - 1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class); @@ -2988,7 +2988,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); + ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(current_class); if (!cEntry || !((1 << (current_class - 1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class); @@ -3050,7 +3050,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); + ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(current_class); if (!cEntry || !((1 << (current_class - 1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class); @@ -3153,7 +3153,7 @@ void ObjectMgr::LoadPlayerInfo() for (int class_ = 0; class_ < MAX_CLASSES; ++class_) { // skip nonexistent classes - if (!sChrClassesStore.LookupEntry(class_)) + if (!sDBCChrClasses.LookupEntry(class_)) continue; PlayerClassInfo* pClassInfo = &playerClassInfo[class_]; @@ -3211,7 +3211,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); + ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(current_class); if (!cEntry || !((1 << (current_class - 1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.", current_class); @@ -3262,7 +3262,7 @@ void ObjectMgr::LoadPlayerInfo() for (int class_ = 1; class_ < MAX_CLASSES; ++class_) { // skip nonexistent classes - if (!((1 << (class_ - 1)) & CLASSMASK_ALL_PLAYABLE) || !sChrClassesStore.LookupEntry(class_)) + if (!((1 << (class_ - 1)) & CLASSMASK_ALL_PLAYABLE) || !sDBCChrClasses.LookupEntry(class_)) continue; PlayerInfo* pInfo = &playerInfo[race][class_]; diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index c3e8b91b2f1..c92a31f70bb 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -64,7 +64,7 @@ //DBCStorage sDBCCharStartOutfit(CharStartOutfitEntryfmt); //DBCStorage sDBCCharTitles(CharTitlesEntryfmt); //DBCStorage sDBCChatChannels(ChatChannelsEntryfmt); -DBCStorage sChrClassesStore(ChrClassesEntryfmt); +//DBCStorage sDBCChrClasses(ChrClassesEntryfmt); DBCStorage sChrRacesStore(ChrRacesEntryfmt); DBCStorage sCinematicCameraStore(CinematicCameraEntryfmt); DBCStorage sCinematicSequencesStore(CinematicSequencesEntryfmt); @@ -273,7 +273,7 @@ void LoadDBCStores(const std::string& dataPath) // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharStartOutfit, dbcPath, "CharStartOutfit.dbc"); // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharTitles, dbcPath, "CharTitles.dbc"); // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChatChannels, dbcPath, "ChatChannels.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChrClassesStore, dbcPath, "ChrClasses.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChrClasses, dbcPath, "ChrClasses.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChrRacesStore, dbcPath, "ChrRaces.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCinematicCameraStore, dbcPath, "CinematicCamera.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCinematicSequencesStore, dbcPath, "CinematicSequences.dbc"); diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index 5cb43fe64e0..0a8e195bdc4 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -76,7 +76,7 @@ uint32 GetCreatureModelRace(uint32 model_id); //extern DBCStorage sDBCCharStartOutfit; //extern DBCStorage sDBCCharTitles; //extern DBCStorage sDBCChatChannels; -extern DBCStorage sChrClassesStore; +//extern DBCStorage sDBCChrClasses; extern DBCStorage sChrRacesStore; extern DBCStorage sCinematicCameraStore; extern DBCStorage sCinematicSequencesStore; From f58ff97a55a43555c000df65c41debe13d508aee Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 16:40:25 +0100 Subject: [PATCH 23/28] Batch of dbc store convertion from file to db --- src/game/AI/BaseAI/TotemAI.cpp | 2 +- src/game/AI/EventAI/CreatureEventAI.cpp | 12 +- src/game/AI/EventAI/CreatureEventAIMgr.cpp | 26 +- src/game/AI/ScriptDevAI/base/CombatAI.cpp | 2 +- .../AI/ScriptDevAI/include/sc_creature.cpp | 10 +- .../eastern_kingdoms/karazhan/chess_event.cpp | 8 +- .../caverns_of_time/hyjal/hyjalScripts.cpp | 4 +- .../scripts/outland/blades_edge_mountains.cpp | 18 +- src/game/AuctionHouse/AuctionHouseMgr.cpp | 2 +- src/game/Chat/Chat.cpp | 12 +- src/game/Chat/ChatHandler.cpp | 2 +- src/game/Chat/Level1.cpp | 10 +- src/game/Chat/Level2.cpp | 26 +- src/game/Chat/Level3.cpp | 212 ++++----- src/game/Chat/TicketCommands.cpp | 4 +- src/game/Chat/debugcmds.cpp | 8 +- src/game/Cinematics/M2Stores.cpp | 109 +++-- src/game/DBScripts/ScriptMgr.cpp | 18 +- src/game/Entities/CharacterHandler.cpp | 6 +- src/game/Entities/Corpse.cpp | 2 +- src/game/Entities/Creature.cpp | 12 +- src/game/Entities/CreatureLinkingMgr.cpp | 6 +- src/game/Entities/GameObject.cpp | 8 +- src/game/Entities/Item.cpp | 20 +- src/game/Entities/ItemEnchantmentMgr.cpp | 2 +- src/game/Entities/ItemHandler.cpp | 6 +- src/game/Entities/MiscHandler.cpp | 10 +- src/game/Entities/NPCHandler.cpp | 2 +- src/game/Entities/Object.cpp | 4 +- src/game/Entities/Pet.cpp | 12 +- src/game/Entities/PetHandler.cpp | 2 +- src/game/Entities/Player.cpp | 138 +++--- src/game/Entities/QueryHandler.cpp | 2 +- src/game/Entities/Relations.cpp | 12 +- src/game/Entities/Taxi.cpp | 6 +- src/game/Entities/Transports.cpp | 4 +- src/game/Entities/Unit.cpp | 42 +- src/game/GMTickets/GMTicketHandler.cpp | 4 +- src/game/GMTickets/GMTicketMgr.cpp | 4 +- src/game/GameEvents/GameEventMgr.cpp | 4 +- src/game/Globals/Conditions.cpp | 2 +- src/game/Globals/ObjectMgr.cpp | 133 +++--- src/game/Groups/Group.cpp | 8 +- src/game/Loot/LootMgr.cpp | 9 +- src/game/Mails/MailHandler.cpp | 2 +- src/game/Maps/GridMap.cpp | 10 +- src/game/Maps/Map.cpp | 2 +- src/game/Maps/MapManager.cpp | 8 +- src/game/Maps/MapPersistentStateMgr.cpp | 25 +- src/game/Maps/MapPersistentStateMgr.h | 2 +- src/game/Maps/TransportMgr.cpp | 9 +- src/game/MotionGenerators/MovementHandler.cpp | 2 +- .../TargetedMovementGenerator.cpp | 4 +- src/game/PlayerBot/Base/PlayerbotAI.cpp | 66 +-- src/game/PlayerBot/Base/PlayerbotClassAI.cpp | 4 +- src/game/PlayerBot/Base/PlayerbotMgr.cpp | 6 +- src/game/Pools/PoolManager.cpp | 2 +- src/game/Server/DBCStores.cpp | 429 +++++++++--------- src/game/Server/DBCStores.h | 164 +++---- src/game/Server/DBCStructure.h | 2 +- src/game/Server/SQLStorages.cpp | 10 +- src/game/Server/SQLStorages.h | 2 +- src/game/Spells/Spell.cpp | 36 +- src/game/Spells/Spell.h | 2 +- src/game/Spells/SpellAuras.cpp | 22 +- src/game/Spells/SpellEffects.cpp | 34 +- src/game/Spells/SpellHandler.cpp | 2 +- src/game/Spells/SpellMgr.cpp | 37 +- src/game/Spells/SpellMgr.h | 2 +- src/game/Spells/UnitAuraProcHandler.cpp | 10 +- src/game/Tools/CharacterDatabaseCleaner.cpp | 2 +- src/game/World/World.cpp | 2 +- src/game/vmap/GameObjectModel.cpp | 2 +- 73 files changed, 885 insertions(+), 960 deletions(-) diff --git a/src/game/AI/BaseAI/TotemAI.cpp b/src/game/AI/BaseAI/TotemAI.cpp index b606ff05a65..ebc9bae6f6c 100644 --- a/src/game/AI/BaseAI/TotemAI.cpp +++ b/src/game/AI/BaseAI/TotemAI.cpp @@ -75,7 +75,7 @@ void TotemAI::UpdateAI(const uint32 diff) return; // Get spell rangy - SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); + SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); float maxRange = GetSpellMaxRange(srange); // SPELLMOD_RANGE not applied in this place just because nonexistent range mods for attacking totems diff --git a/src/game/AI/EventAI/CreatureEventAI.cpp b/src/game/AI/EventAI/CreatureEventAI.cpp index 2ac8a50d0e4..d4f8798382e 100644 --- a/src/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/game/AI/EventAI/CreatureEventAI.cpp @@ -192,7 +192,7 @@ void CreatureEventAI::InitAI() m_mainSpellId = i.action[actionIdx].cast.spellId; SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_mainSpellId); m_mainSpellCost = Spell::CalculatePowerCost(spellInfo, m_creature); - m_mainSpellMinRange = GetSpellMinRange(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex)); + m_mainSpellMinRange = GetSpellMinRange(sDBCSpellRange.LookupEntry(spellInfo->rangeIndex)); m_mainAttackMask = SpellSchoolMask(m_mainAttackMask + spellInfo->SchoolMask); m_mainSpellInfo = spellInfo; } @@ -465,18 +465,18 @@ bool CreatureEventAI::CheckEvent(CreatureEventAIHolder& holder, Unit* actionInvo { if (!m_creature->IsInCombat()) return false; - + DoFindFriendlyMissingBuff(pList, (float)event.friendly_buff.radius, event.friendly_buff.spellId, false); } - else if (event.friendly_buff.inCombat == 1) - DoFindFriendlyMissingBuff(pList, (float)event.friendly_buff.radius, event.friendly_buff.spellId, true); + else if (event.friendly_buff.inCombat == 1) + DoFindFriendlyMissingBuff(pList, (float)event.friendly_buff.radius, event.friendly_buff.spellId, true); else if (event.friendly_buff.inCombat == 2) { if (m_creature->IsInCombat()) return false; - + DoFindFriendlyMissingBuff(pList, (float)event.friendly_buff.radius, event.friendly_buff.spellId, true); - } + } // List is empty if (pList.empty()) diff --git a/src/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/game/AI/EventAI/CreatureEventAIMgr.cpp index 5df97b7c674..6ad03c26bf3 100644 --- a/src/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -384,7 +384,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case SPAWNED_EVENT_ALWAY: break; case SPAWNED_EVENT_MAP: - if (!sMapStore.LookupEntry(temp.spawned.conditionValue1)) + if (!sDBCMap.LookupEntry(temp.spawned.conditionValue1)) sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'map specific' but map (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); break; case SPAWNED_EVENT_ZONE: @@ -473,7 +473,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_RECEIVE_EMOTE: { - if (!sEmotesTextStore.LookupEntry(temp.receive_emote.emoteId)) + if (!sDBCEmotesText.LookupEntry(temp.receive_emote.emoteId)) { sLog.outErrorEventAI("Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.", temp.creature_id, i, temp.receive_emote.emoteId); continue; @@ -646,7 +646,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; } case ACTION_T_SET_FACTION: - if (action.set_faction.factionId != 0 && !sFactionTemplateStore.LookupEntry(action.set_faction.factionId)) + if (action.set_faction.factionId != 0 && !sDBCFactionTemplate.LookupEntry(action.set_faction.factionId)) { sLog.outErrorEventAI("Event %u Action %u uses nonexistent FactionId %u.", i, j + 1, action.set_faction.factionId); action.set_faction.factionId = 0; @@ -668,7 +668,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorEventAI("Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j + 1, action.morph.modelId, action.morph.creatureId); action.morph.modelId = 0; } - else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId)) + else if (!sDBCCreatureDisplayInfo.LookupEntry(action.morph.modelId)) { sLog.outErrorEventAI("Event %u Action %u uses nonexistent ModelId %u.", i, j + 1, action.morph.modelId); action.morph.modelId = 0; @@ -677,27 +677,27 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } break; case ACTION_T_SOUND: - if (!sSoundEntriesStore.LookupEntry(action.sound.soundId)) + if (!sDBCSoundEntries.LookupEntry(action.sound.soundId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent SoundID %u.", i, j + 1, action.sound.soundId); break; case ACTION_T_EMOTE: - if (!sEmotesStore.LookupEntry(action.emote.emoteId)) + if (!sDBCEmotes.LookupEntry(action.emote.emoteId)) sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.emote.emoteId); break; case ACTION_T_RANDOM_SOUND: - if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1)) + if (!sDBCSoundEntries.LookupEntry(action.random_sound.soundId1)) sLog.outErrorEventAI("Event %u Action %u param1 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId1); - if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2)) + if (action.random_sound.soundId2 >= 0 && !sDBCSoundEntries.LookupEntry(action.random_sound.soundId2)) sLog.outErrorEventAI("Event %u Action %u param2 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId2); - if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3)) + if (action.random_sound.soundId3 >= 0 && !sDBCSoundEntries.LookupEntry(action.random_sound.soundId3)) sLog.outErrorEventAI("Event %u Action %u param3 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId3); break; case ACTION_T_RANDOM_EMOTE: - if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1)) + if (!sDBCEmotes.LookupEntry(action.random_emote.emoteId1)) sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId1); - if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2)) + if (action.random_emote.emoteId2 >= 0 && !sDBCEmotes.LookupEntry(action.random_emote.emoteId2)) sLog.outErrorEventAI("Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId2); - if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3)) + if (action.random_emote.emoteId3 >= 0 && !sDBCEmotes.LookupEntry(action.random_emote.emoteId3)) sLog.outErrorEventAI("Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId3); break; case ACTION_T_CAST: @@ -908,7 +908,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorEventAI("Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j + 1, action.mount.modelId, action.mount.creatureId); action.mount.modelId = 0; } - else if (!sCreatureDisplayInfoStore.LookupEntry(action.mount.modelId)) + else if (!sDBCCreatureDisplayInfo.LookupEntry(action.mount.modelId)) { sLog.outErrorEventAI("Event %u Action %u uses nonexistent ModelId %u.", i, j + 1, action.mount.modelId); action.mount.modelId = 0; diff --git a/src/game/AI/ScriptDevAI/base/CombatAI.cpp b/src/game/AI/ScriptDevAI/base/CombatAI.cpp index 567cdd5f7a2..5bd3b7418eb 100644 --- a/src/game/AI/ScriptDevAI/base/CombatAI.cpp +++ b/src/game/AI/ScriptDevAI/base/CombatAI.cpp @@ -100,7 +100,7 @@ void RangedCombatAI::AddMainSpell(uint32 spellId) m_mainSpellId = spellId; SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_mainSpellId); m_mainSpellCost = Spell::CalculatePowerCost(spellInfo, m_creature); - m_mainSpellMinRange = GetSpellMinRange(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex)); + m_mainSpellMinRange = GetSpellMinRange(sDBCSpellRange.LookupEntry(spellInfo->rangeIndex)); m_mainAttackMask = SpellSchoolMask(m_mainAttackMask + spellInfo->SchoolMask); m_mainSpellInfo = spellInfo; } diff --git a/src/game/AI/ScriptDevAI/include/sc_creature.cpp b/src/game/AI/ScriptDevAI/include/sc_creature.cpp index 55888e60020..3f3d92437c2 100644 --- a/src/game/AI/ScriptDevAI/include/sc_creature.cpp +++ b/src/game/AI/ScriptDevAI/include/sc_creature.cpp @@ -102,7 +102,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId) if (!source) return; - if (!GetSoundEntriesStore()->LookupEntry(soundId)) + if (!sDBCSoundEntries.LookupEntry(soundId)) { script_error_log("Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow()); return; @@ -165,7 +165,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, int32 school, int32 mech continue; // Get the Range - SpellRangeEntry const* tempRange = GetSpellRangeStore()->LookupEntry(tempSpellInfo->rangeIndex); + SpellRangeEntry const* tempRange = sDBCSpellRange.LookupEntry(tempSpellInfo->rangeIndex); // Spell has invalid range store so we can't use it if (!tempRange) @@ -208,7 +208,7 @@ bool ScriptedAI::CanCast(Unit* target, SpellEntry const* spellInfo, bool trigger if (!triggered && m_creature->GetPower((Powers)spellInfo->powerType) < spellInfo->manaCost) return false; - SpellRangeEntry const* tempRange = GetSpellRangeStore()->LookupEntry(spellInfo->rangeIndex); + SpellRangeEntry const* tempRange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); // Spell has invalid range store so we can't use it if (!tempRange) @@ -333,7 +333,7 @@ CreatureList ScriptedAI::DoFindFriendlyCC(float range) CreatureList ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 spellId, bool inCombat) { CreatureList creatureList; - + if (inCombat == false) { MaNGOS::FriendlyMissingBuffInRangeInCombatCheck u_check(m_creature, range, spellId); @@ -346,7 +346,7 @@ CreatureList ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 spellId, MaNGOS::CreatureListSearcher searcher(creatureList, u_check); Cell::VisitGridObjects(m_creature, searcher, range); - } + } return creatureList; } diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp index 874f30fbc97..2cc4a5f72a0 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp @@ -401,7 +401,7 @@ struct npc_chess_piece_genericAI : public Scripted_NoMovementAI { m_creature->SetFacingTo(m_fCurrentOrientation); } - + } void SpellHit(Unit* pCaster, const SpellEntry* pSpell) override @@ -486,7 +486,7 @@ struct npc_chess_piece_genericAI : public Scripted_NoMovementAI else ++itr; } - + if (lSquaresList.empty()) return nullptr; @@ -654,7 +654,7 @@ bool EffectDummyCreature_npc_chess_generic(Unit* pCaster, uint32 uiSpellId, Spel case NPC_ORC_WOLF: uiMeleeSpell = SPELL_MELEE_WOLF; break; case NPC_SUMMONED_DAEMON: uiMeleeSpell = SPELL_MELEE_DAEMON; break; } - + pCreatureTarget->CastSpell(pCreatureTarget, uiMeleeSpell, TRIGGERED_OLD_TRIGGERED); return true; } @@ -1745,7 +1745,7 @@ struct go_chessboard : public GameObjectAI break; } } - bool isCloseEnough = player->GetDistance(x, y, z, DIST_CALC_COMBAT_REACH) < GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[EFFECT_INDEX_0])); + bool isCloseEnough = player->GetDistance(x, y, z, DIST_CALC_COMBAT_REACH) < GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[EFFECT_INDEX_0])); if (!myHolder) { if (isCloseEnough) diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalScripts.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalScripts.cpp index 530b16be960..338f993f257 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalScripts.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalScripts.cpp @@ -223,7 +223,7 @@ struct npc_building_triggerAI : public ScriptedAI { npc_building_triggerAI(Creature* creature) : ScriptedAI(creature){} - void Reset() override + void Reset() override { m_creature->AI()->SetReactState(REACT_PASSIVE); } @@ -307,7 +307,7 @@ struct RaiseDeadHyjal : public SpellScript { if (strict) { - float radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(spell->m_spellInfo->rangeIndex)); + float radius = GetSpellMaxRange(sDBCSpellRange.LookupEntry(spell->m_spellInfo->rangeIndex)); UnitList tempUnitList; GameObjectList tempGOList; return spell->CheckScriptTargeting(EFFECT_INDEX_0, 1, radius, TARGET_LOCATION_SCRIPT_NEAR_CASTER, tempUnitList, tempGOList); diff --git a/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp b/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp index ae37895cc32..2f33e81cda8 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp @@ -1024,7 +1024,7 @@ struct npc_obelisk_triggerAI : public ScriptedAI else m_uiCheckTimer -= uiDiff; } - + if (m_uiActiveObelisk == 5) { if (m_uiActivateTimer) @@ -1644,7 +1644,7 @@ bool AreaTrigger_at_raven_prophecy(Player* pPlayer, AreaTriggerEntry const* pAt) { DoScriptText(prophecy.text, whisper, pPlayer); - //giving credit for the game object automatically negates the id, so we don't have to negate it + //giving credit for the game object automatically negates the id, so we don't have to negate it pPlayer->KilledMonsterCredit(prophecy.creature); } } @@ -1705,7 +1705,7 @@ struct go_aura_generator_000AI : public GameObjectAI break; } } - bool isCloseEnough = player->GetDistance(x, y, z, DIST_CALC_COMBAT_REACH) < GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[EFFECT_INDEX_0])); + bool isCloseEnough = player->GetDistance(x, y, z, DIST_CALC_COMBAT_REACH) < GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[EFFECT_INDEX_0])); if (!myHolder) { if (isCloseEnough) @@ -1828,7 +1828,7 @@ struct npc_fel_cannon : public Scripted_NoMovementAI uint32 m_uiCannonBlastTimer; bool m_bMCed; - + void Reset() override { m_uiCannonBlastTimer = 1000; @@ -1869,7 +1869,7 @@ struct npc_fel_cannon : public Scripted_NoMovementAI void UpdateAI(const uint32 uiDiff) override { if (m_bMCed && !m_creature->HasCharmer()) - { + { Scripted_NoMovementAI::EnterEvadeMode(); m_creature->FixateTarget(nullptr); return; @@ -1900,7 +1900,7 @@ UnitAI* GetAI_npc_fel_cannon(Creature* pCreature) ## npc_warp_gate ######*/ -static float impSpawns[2][4] = +static float impSpawns[2][4] = { { 2188.340f, 5476.629f, 155.069f, 5.259f }, // north { 1981.730f, 5315.390f, 156.600f, 0.262f} // south @@ -1936,7 +1936,7 @@ struct npc_warp_gate : public Scripted_NoMovementAI ObjectGuid m_guidSmoke; std::vector m_vImpGuids; - + void Reset() override { m_uiHitCounter = 0; @@ -1972,7 +1972,7 @@ struct npc_warp_gate : public Scripted_NoMovementAI } m_guidFelCannon = pCaster->GetObjectGuid(); } - + uint32 spellId; switch (m_uiHitCounter) @@ -2332,7 +2332,7 @@ struct npc_soulgrinderAI : public ScriptedAI for (ObjectGuid& guid : m_ogreSpirits) if (Creature* spirit = m_creature->GetMap()->GetCreature(guid)) spirit->ForcedDespawn(); - + m_creature->CastSpell(nullptr, SPELL_SCARE_SOULGRINDER_GHOST, TRIGGERED_NONE); if (Creature* gronn = m_creature->GetMap()->GetCreature(m_skullocSoulgrinder)) { diff --git a/src/game/AuctionHouse/AuctionHouseMgr.cpp b/src/game/AuctionHouse/AuctionHouseMgr.cpp index 60d80f4011e..1e19fddba92 100644 --- a/src/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouse/AuctionHouseMgr.cpp @@ -536,7 +536,7 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit) case 1638: houseid = 2; break; // exodar, alliance default: // for unknown case { - FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId); + FactionTemplateEntry const* u_entry = sDBCFactionTemplate.LookupEntry(factionTemplateId); if (!u_entry) houseid = 7; // goblin auction house else if (u_entry->factionGroupMask & FACTION_GROUP_MASK_ALLIANCE) diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp index 1301492100a..b276ec6cc2c 100644 --- a/src/game/Chat/Chat.cpp +++ b/src/game/Chat/Chat.cpp @@ -1804,13 +1804,13 @@ bool ChatHandler::CheckEscapeSequences(const char* message) if (propertyId > 0) { - itemProperty = sItemRandomPropertiesStore.LookupEntry(propertyId); + itemProperty = sDBCItemRandomProperties.LookupEntry(propertyId); if (!itemProperty) return false; } else if (propertyId < 0) { - itemSuffix = sItemRandomSuffixStore.LookupEntry(-propertyId); + itemSuffix = sDBCItemRandomSuffix.LookupEntry(-propertyId); if (!itemSuffix) return false; } @@ -1885,7 +1885,7 @@ bool ChatHandler::CheckEscapeSequences(const char* message) if (reader.eof()) // : must be return false; - TalentEntry const* talentInfo = sTalentStore.LookupEntry(atoi(buffer)); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(atoi(buffer)); if (!talentInfo) return false; @@ -1979,7 +1979,7 @@ bool ChatHandler::CheckEscapeSequences(const char* message) return false; } - SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId); + SkillLineEntry const* skillLine = sDBCSkillLine.LookupEntry(skillInfo->skillId); if (!skillLine) { return false; @@ -2851,7 +2851,7 @@ uint32 ChatHandler::ExtractSpellIdFromLink(char** text) case SPELL_LINK_TALENT: { // talent - TalentEntry const* talentEntry = sTalentStore.LookupEntry(id); + TalentEntry const* talentEntry = sDBCTalent.LookupEntry(id); if (!talentEntry) return 0; @@ -3045,7 +3045,7 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x, if (!ExtractUInt32(&idS, id)) return false; - TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id); + TaxiNodesEntry const* node = sDBCTaxiNodes.LookupEntry(id); if (!node) return false; mapid = node->map_id; diff --git a/src/game/Chat/ChatHandler.cpp b/src/game/Chat/ChatHandler.cpp index 8ccbe2b8e2c..cceb665ffb6 100644 --- a/src/game/Chat/ChatHandler.cpp +++ b/src/game/Chat/ChatHandler.cpp @@ -624,7 +624,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data) recv_data >> emoteNum; recv_data >> guid; - EmotesTextEntry const* em = sEmotesTextStore.LookupEntry(text_emote); + EmotesTextEntry const* em = sDBCEmotesText.LookupEntry(text_emote); if (!em) return; diff --git a/src/game/Chat/Level1.cpp b/src/game/Chat/Level1.cpp index fc10f77c3f4..e275d91e0f9 100644 --- a/src/game/Chat/Level1.cpp +++ b/src/game/Chat/Level1.cpp @@ -212,7 +212,7 @@ bool ChatHandler::HandleGMMountUpCommand(char* args) if (ExtractUInt32(&args, displayid)) { - if (sCreatureDisplayInfoStore.LookupEntry(displayid)) + if (sDBCCreatureDisplayInfo.LookupEntry(displayid)) { m_session->GetPlayer()->Mount(displayid); return true; @@ -300,7 +300,7 @@ bool ChatHandler::HandleGPSCommand(char* args) uint32 zone_id, area_id; obj->GetZoneAndAreaId(zone_id, area_id); - MapEntry const* mapEntry = sMapStore.LookupEntry(obj->GetMapId()); + MapEntry const* mapEntry = sDBCMap.LookupEntry(obj->GetMapId()); AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id); AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id); @@ -850,7 +850,7 @@ bool ChatHandler::HandleModifyFactionCommand(char* args) if (!ExtractUint32KeyFromLink(&args, "Hfaction", factionid)) return false; - if (!sFactionTemplateStore.LookupEntry(factionid)) + if (!sDBCFactionTemplate.LookupEntry(factionid)) { PSendSysMessage(LANG_WRONG_FACTION, factionid); SetSentErrorMessage(true); @@ -1750,7 +1750,7 @@ bool ChatHandler::HandleGoTaxinodeCommand(char* args) if (!ExtractUint32KeyFromLink(&args, "Htaxinode", nodeId)) return false; - TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(nodeId); + TaxiNodesEntry const* node = sDBCTaxiNodes.LookupEntry(nodeId); if (!node) { PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND, nodeId); @@ -1888,7 +1888,7 @@ bool ChatHandler::HandleGoZoneXYCommand(char* args) // update to parent zone if exist (client map show only zones without parents) AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry; - MapEntry const* mapEntry = sMapStore.LookupEntry(zoneEntry->mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(zoneEntry->mapid); if (mapEntry->Instanceable()) { diff --git a/src/game/Chat/Level2.cpp b/src/game/Chat/Level2.cpp index d8504b13873..73e78746d42 100644 --- a/src/game/Chat/Level2.cpp +++ b/src/game/Chat/Level2.cpp @@ -1117,7 +1117,7 @@ bool ChatHandler::HandleGameObjectAddCommand(char* args) return false; } - if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) + if (gInfo->displayId && !sDBCGameObjectDisplayInfo.LookupEntry(gInfo->displayId)) { // report to DB errors log as in loading case sLog.outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", id, gInfo->type, gInfo->displayId); @@ -2051,7 +2051,7 @@ bool ChatHandler::HandleNpcFactionIdCommand(char* args) uint32 factionId = (uint32) atoi(args); - if (!sFactionTemplateStore.LookupEntry(factionId)) + if (!sDBCFactionTemplate.LookupEntry(factionId)) { PSendSysMessage(LANG_WRONG_FACTION, factionId); SetSentErrorMessage(true); @@ -2432,7 +2432,7 @@ bool ChatHandler::HandleModifyMorphCommand(char* args) uint32 display_id = (uint32)atoi(args); - CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(display_id); + CreatureDisplayInfoEntry const* displayEntry = sDBCCreatureDisplayInfo.LookupEntry(display_id); if (!displayEntry) { SendSysMessage(LANG_BAD_VALUE); @@ -3432,7 +3432,7 @@ bool ChatHandler::HandleModifyStandStateCommand(char* args) if (!ExtractUInt32(&args, anim_id)) return false; - if (!sEmotesStore.LookupEntry(anim_id)) + if (!sDBCEmotes.LookupEntry(anim_id)) return false; m_session->GetPlayer()->HandleEmoteState(anim_id); @@ -3740,12 +3740,8 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id) { uint32 classmask = player->getClassMask(); - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + for (auto skillLine : sDBCSkillLineAbility) { - SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j); - if (!skillLine) - continue; - // wrong skill if (skillLine->skillId != skill_id) continue; @@ -3772,12 +3768,8 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id) bool ChatHandler::HandleLearnAllCraftsCommand(char* /*args*/) { - for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) + for (auto skillInfo : sDBCSkillLine) { - SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i); - if (!skillInfo) - continue; - if (skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY) { HandleLearnSkillRecipesHelper(m_session->GetPlayer(), skillInfo->id); @@ -3814,12 +3806,8 @@ bool ChatHandler::HandleLearnAllRecipesCommand(char* args) std::string name; SkillLineEntry const* targetSkillInfo = nullptr; - for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i) + for (auto skillInfo : sDBCSkillLine) { - SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i); - if (!skillInfo) - continue; - if (skillInfo->categoryId != SKILL_CATEGORY_PROFESSION && skillInfo->categoryId != SKILL_CATEGORY_SECONDARY) continue; diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp index bf1b98bb6ae..86f4e2caecb 100644 --- a/src/game/Chat/Level3.cpp +++ b/src/game/Chat/Level3.cpp @@ -1250,7 +1250,7 @@ bool ChatHandler::HandleSetSkillCommand(char* args) return false; } - SkillLineEntry const* sl = sSkillLineStore.LookupEntry(skill); + SkillLineEntry const* sl = sDBCSkillLine.LookupEntry(skill); if (!sl) { PSendSysMessage(LANG_INVALID_SKILL_ID, skill); @@ -1524,12 +1524,8 @@ bool ChatHandler::HandleLearnAllMySpellsCommand(char* /*args*/) return true; uint32 family = clsEntry->spellfamily; - for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i) + for (auto entry : sDBCSkillLineAbility) { - SkillLineAbilityEntry const* entry = sSkillLineAbilityStore.LookupEntry(i); - if (!entry) - continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(entry->spellId); if (!spellInfo) continue; @@ -1567,13 +1563,13 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(char* /*args*/) Player* player = m_session->GetPlayer(); uint32 classMask = player->getClassMask(); - for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) + for (uint32 i = 0; i < sDBCTalent.GetNumRows(); ++i) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); if (!talentInfo) continue; - TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -2263,42 +2259,38 @@ bool ChatHandler::HandleLookupItemSetCommand(char* args) uint32 counter = 0; // Counter for figure out that we found smth. // Search in ItemSet.dbc - for (uint32 id = 0; id < sItemSetStore.GetNumRows(); ++id) + for (auto set : sDBCItemSet) { - ItemSetEntry const* set = sItemSetStore.LookupEntry(id); - if (set) - { - int loc = GetSessionDbcLocale(); - std::string name = set->name[loc]; - if (name.empty()) - continue; + int loc = GetSessionDbcLocale(); + std::string name = set->name[loc]; + if (name.empty()) + continue; - if (!Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) { - loc = 0; - for (; loc < MAX_LOCALE; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; + if (loc == GetSessionDbcLocale()) + continue; - name = set->name[loc]; - if (name.empty()) - continue; + name = set->name[loc]; + if (name.empty()) + continue; - if (Utf8FitTo(name, wnamepart)) - break; - } + if (Utf8FitTo(name, wnamepart)) + break; } + } - if (loc < MAX_LOCALE) - { - // send item set in "id - [namedlink locale]" format - if (m_session) - PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[loc]); - else - PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[loc]); - ++counter; - } + if (loc < MAX_LOCALE) + { + // send item set in "id - [namedlink locale]" format + if (m_session) + PSendSysMessage(LANG_ITEMSET_LIST_CHAT, set->id, set->id, name.c_str(), localeNames[loc]); + else + PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, set->id, name.c_str(), localeNames[loc]); + ++counter; } } if (counter == 0) // if counter == 0 then we found nth @@ -2326,57 +2318,53 @@ bool ChatHandler::HandleLookupSkillCommand(char* args) uint32 counter = 0; // Counter for figure out that we found smth. // Search in SkillLine.dbc - for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); ++id) + for (auto skillInfo : sDBCSkillLine) { - SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id); - if (skillInfo) - { - int loc = GetSessionDbcLocale(); - std::string name = skillInfo->name[loc]; - if (name.empty()) - continue; + int loc = GetSessionDbcLocale(); + std::string name = skillInfo->name[loc]; + if (name.empty()) + continue; - if (!Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) { - loc = 0; - for (; loc < MAX_LOCALE; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; + if (loc == GetSessionDbcLocale()) + continue; - name = skillInfo->name[loc]; - if (name.empty()) - continue; + name = skillInfo->name[loc]; + if (name.empty()) + continue; - if (Utf8FitTo(name, wnamepart)) - break; - } + if (Utf8FitTo(name, wnamepart)) + break; } + } - if (loc < MAX_LOCALE) + if (loc < MAX_LOCALE) + { + char valStr[50] = ""; + char const* knownStr = ""; + if (target && target->HasSkill(skillInfo->id)) { - char valStr[50] = ""; - char const* knownStr = ""; - if (target && target->HasSkill(id)) - { - knownStr = GetMangosString(LANG_KNOWN); - uint32 curValue = target->GetSkillValuePure(id); - uint32 maxValue = target->GetSkillMaxPure(id); - uint32 permValue = target->GetSkillBonusPermanent(id); - uint32 tempValue = target->GetSkillBonusTemporary(id); - - char const* valFormat = GetMangosString(LANG_SKILL_VALUES); - snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue); - } + knownStr = GetMangosString(LANG_KNOWN); + uint32 curValue = target->GetSkillValuePure(skillInfo->id); + uint32 maxValue = target->GetSkillMaxPure(skillInfo->id); + uint32 permValue = target->GetSkillBonusPermanent(skillInfo->id); + uint32 tempValue = target->GetSkillBonusTemporary(skillInfo->id); + + char const* valFormat = GetMangosString(LANG_SKILL_VALUES); + snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue); + } - // send skill in "id - [namedlink locale]" format - if (m_session) - PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[loc], knownStr, valStr); - else - PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[loc], knownStr, valStr); + // send skill in "id - [namedlink locale]" format + if (m_session) + PSendSysMessage(LANG_SKILL_LIST_CHAT, skillInfo->id, skillInfo->id, name.c_str(), localeNames[loc], knownStr, valStr); + else + PSendSysMessage(LANG_SKILL_LIST_CONSOLE, skillInfo->id, name.c_str(), localeNames[loc], knownStr, valStr); - ++counter; - } + ++counter; } } if (counter == 0) // if counter == 0 then we found nth @@ -2682,44 +2670,40 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(char* args) uint32 counter = 0; // Counter for figure out that we found smth. // Search in TaxiNodes.dbc - for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); ++id) + for (auto nodeEntry : sDBCTaxiNodes) { - TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id); - if (nodeEntry) - { - int loc = GetSessionDbcLocale(); - std::string name = nodeEntry->name[loc]; - if (name.empty()) - continue; + int loc = GetSessionDbcLocale(); + std::string name = nodeEntry->name[loc]; + if (name.empty()) + continue; - if (!Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) { - loc = 0; - for (; loc < MAX_LOCALE; ++loc) - { - if (loc == GetSessionDbcLocale()) - continue; + if (loc == GetSessionDbcLocale()) + continue; - name = nodeEntry->name[loc]; - if (name.empty()) - continue; + name = nodeEntry->name[loc]; + if (name.empty()) + continue; - if (Utf8FitTo(name, wnamepart)) - break; - } + if (Utf8FitTo(name, wnamepart)) + break; } + } - if (loc < MAX_LOCALE) - { - // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format - if (m_session) - PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[loc], - nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); - else - PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc], - nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); - ++counter; - } + if (loc < MAX_LOCALE) + { + // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format + if (m_session) + PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, nodeEntry->ID, nodeEntry->ID, name.c_str(), localeNames[loc], + nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); + else + PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, nodeEntry->ID, name.c_str(), localeNames[loc], + nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); + ++counter; } } if (counter == 0) // if counter == 0 then we found nth @@ -5737,7 +5721,7 @@ bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/) { DungeonPersistentState* state = itr->second.state; std::string timeleft = secsToTimeString(state->GetResetTime() - time(nullptr), true); - if (const MapEntry* entry = sMapStore.LookupEntry(itr->first)) + if (const MapEntry* entry = sDBCMap.LookupEntry(itr->first)) { PSendSysMessage("map: %d (%s) inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, entry->name[GetSessionDbcLocale()], state->GetInstanceId(), itr->second.perm ? "yes" : "no", @@ -5760,7 +5744,7 @@ bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/) { DungeonPersistentState* state = itr->second.state; std::string timeleft = secsToTimeString(state->GetResetTime() - time(nullptr), true); - if (const MapEntry* entry = sMapStore.LookupEntry(itr->first)) + if (const MapEntry* entry = sDBCMap.LookupEntry(itr->first)) { PSendSysMessage("map: %d (%s) inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, entry->name[GetSessionDbcLocale()], state->GetInstanceId(), itr->second.perm ? "yes" : "no", @@ -5813,7 +5797,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(char* args) DungeonPersistentState* save = itr->second.state; std::string timeleft = secsToTimeString(save->GetResetTime() - time(nullptr), true); - if (const MapEntry* entry = sMapStore.LookupEntry(itr->first)) + if (const MapEntry* entry = sDBCMap.LookupEntry(itr->first)) { PSendSysMessage("unbinding map: %d (%s) inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, entry->name[GetSessionDbcLocale()], save->GetInstanceId(), itr->second.perm ? "yes" : "no", @@ -5939,7 +5923,7 @@ bool ChatHandler::ShowPlayerListHelper(QueryResult* result, uint32* limit, bool uint8 class_ = fields[3].GetUInt8(); uint32 level = fields[4].GetUInt32(); - ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race); + ChrRacesEntry const* raceEntry = sDBCChrRaces.LookupEntry(race); ChrClassesEntry const* classEntry = sDBCChrClasses.LookupEntry(class_); char const* race_name = raceEntry ? raceEntry->name[GetSessionDbcLocale()] : ""; diff --git a/src/game/Chat/TicketCommands.cpp b/src/game/Chat/TicketCommands.cpp index 19641068c63..fe7446acd15 100644 --- a/src/game/Chat/TicketCommands.cpp +++ b/src/game/Chat/TicketCommands.cpp @@ -199,7 +199,7 @@ bool ChatHandler::HandleTicketSortCommand(char* args) if (!ExtractUInt32(&args, categoryId)) return false; - if (GMTicketCategoryEntry const* category = sGMTicketCategoryStore.LookupEntry(categoryId)) + if (GMTicketCategoryEntry const* category = sDBCGMTicketCategory.LookupEntry(categoryId)) { if (!HandleTicketMgrCommandResult(*this, ticketId, sTicketMgr.Sort(sTicketMgr.GetTicketById(ticketId), *category, m_session))) { @@ -265,7 +265,7 @@ bool ChatHandler::HandleTicketsListCommand(char* args) max = arg1; else { - category = sGMTicketCategoryStore.LookupEntry(arg1); + category = sDBCGMTicketCategory.LookupEntry(arg1); if (!category) { diff --git a/src/game/Chat/debugcmds.cpp b/src/game/Chat/debugcmds.cpp index a5110a2afac..e57e1e4fd26 100644 --- a/src/game/Chat/debugcmds.cpp +++ b/src/game/Chat/debugcmds.cpp @@ -223,7 +223,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(char* args) if (!ExtractUInt32(&args, dwId)) return false; - if (!sCinematicSequencesStore.LookupEntry(dwId)) + if (!sDBCCinematicSequences.LookupEntry(dwId)) { PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, dwId); SetSentErrorMessage(true); @@ -231,7 +231,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(char* args) } // Dump camera locations - if (CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(dwId)) + if (CinematicSequencesEntry const* cineSeq = sDBCCinematicSequences.LookupEntry(dwId)) { std::unordered_map::const_iterator itr = sFlyByCameraStore.find(cineSeq->cinematicCamera); if (itr != sFlyByCameraStore.end()) @@ -260,7 +260,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args) if (!ExtractUInt32(&args, dwSoundId)) return false; - if (!sSoundEntriesStore.LookupEntry(dwSoundId)) + if (!sDBCSoundEntries.LookupEntry(dwSoundId)) { PSendSysMessage(LANG_SOUND_NOT_EXIST, dwSoundId); SetSentErrorMessage(true); @@ -293,7 +293,7 @@ bool ChatHandler::HandleDebugPlayMusicCommand(char* args) if (!ExtractUInt32(&args, dwMusicId)) return false; - if (!sSoundEntriesStore.LookupEntry(dwMusicId)) + if (!sDBCSoundEntries.LookupEntry(dwMusicId)) { PSendSysMessage(LANG_SOUND_NOT_EXIST, dwMusicId); SetSentErrorMessage(true); diff --git a/src/game/Cinematics/M2Stores.cpp b/src/game/Cinematics/M2Stores.cpp index 1774a7d1986..df394f9f87c 100644 --- a/src/game/Cinematics/M2Stores.cpp +++ b/src/game/Cinematics/M2Stores.cpp @@ -165,75 +165,72 @@ void LoadM2Cameras(std::string const& dataPath) sFlyByCameraStore.clear(); uint32 oldMSTime = WorldTimer::getMSTime(); - for (uint32 i = 0; i < sCinematicCameraStore.GetNumRows(); ++i) + for (auto dbcentry : sDBCCinematicCamera) { - if (CinematicCameraEntry const* dbcentry = sCinematicCameraStore.LookupEntry(i)) - { - std::string filename = dataPath; - filename.append(dbcentry->Model); + std::string filename = dataPath; + filename.append(dbcentry->Model); - // Replace slashes - std::replace(filename.begin(), filename.end(), '\\', '/'); + // Replace slashes + std::replace(filename.begin(), filename.end(), '\\', '/'); - // Replace mdx to .m2 - size_t loc = filename.find(".mdx"); - if (loc != std::string::npos) - filename.replace(loc, 4, ".m2"); + // Replace mdx to .m2 + size_t loc = filename.find(".mdx"); + if (loc != std::string::npos) + filename.replace(loc, 4, ".m2"); - std::ifstream m2file(filename.c_str(), std::ios::in | std::ios::binary); - if (!m2file.is_open()) - continue; + std::ifstream m2file(filename.c_str(), std::ios::in | std::ios::binary); + if (!m2file.is_open()) + continue; - // Get file size - m2file.seekg(0, std::ios::end); - std::streamoff const fileSize = m2file.tellg(); + // Get file size + m2file.seekg(0, std::ios::end); + std::streamoff const fileSize = m2file.tellg(); - // Reject if not at least the size of the header - if (static_cast(fileSize) < sizeof(M2Header)) - { - sLog.outError("Camera file %s is damaged. File is smaller than header size", filename.c_str()); - m2file.close(); - continue; - } - - // Read 4 bytes (signature) - m2file.seekg(0, std::ios::beg); - char fileCheck[5]; - m2file.read(fileCheck, 4); - fileCheck[4] = 0; + // Reject if not at least the size of the header + if (static_cast(fileSize) < sizeof(M2Header)) + { + sLog.outError("Camera file %s is damaged. File is smaller than header size", filename.c_str()); + m2file.close(); + continue; + } - // Check file has correct magic (MD20) - if (strcmp(fileCheck, "MD20")) - { - sLog.outError("Camera file %s is damaged. File identifier not found", filename.c_str()); - m2file.close(); - continue; - } + // Read 4 bytes (signature) + m2file.seekg(0, std::ios::beg); + char fileCheck[5]; + m2file.read(fileCheck, 4); + fileCheck[4] = 0; - // Now we have a good file, read it all into a vector of char's, then close the file. - std::vector buffer(fileSize); - m2file.seekg(0, std::ios::beg); - if (!m2file.read(buffer.data(), fileSize)) - { - m2file.close(); - continue; - } + // Check file has correct magic (MD20) + if (strcmp(fileCheck, "MD20")) + { + sLog.outError("Camera file %s is damaged. File identifier not found", filename.c_str()); m2file.close(); + continue; + } - // Read header - M2Header const* header = reinterpret_cast(buffer.data()); + // Now we have a good file, read it all into a vector of char's, then close the file. + std::vector buffer(fileSize); + m2file.seekg(0, std::ios::beg); + if (!m2file.read(buffer.data(), fileSize)) + { + m2file.close(); + continue; + } + m2file.close(); - if (header->ofsCameras + sizeof(M2Camera) > static_cast(fileSize)) - { - sLog.outError("Camera file %s is damaged. Camera references position beyond file end (header)", filename.c_str()); - continue; - } + // Read header + M2Header const* header = reinterpret_cast(buffer.data()); - // Get camera(s) - Main header, then dump them. - M2Camera const* cam = reinterpret_cast(buffer.data() + header->ofsCameras); - if (!readCamera(cam, fileSize, header, dbcentry)) - sLog.outError("Camera file %s is damaged. Camera references position beyond file end (camera)", filename.c_str()); + if (header->ofsCameras + sizeof(M2Camera) > static_cast(fileSize)) + { + sLog.outError("Camera file %s is damaged. Camera references position beyond file end (header)", filename.c_str()); + continue; } + + // Get camera(s) - Main header, then dump them. + M2Camera const* cam = reinterpret_cast(buffer.data() + header->ofsCameras); + if (!readCamera(cam, fileSize, header, dbcentry)) + sLog.outError("Camera file %s is damaged. Camera references position beyond file end (camera)", filename.c_str()); } sLog.outString(">> Loaded %u cinematic waypoint sets in %u ms", static_cast(sFlyByCameraStore.size()), WorldTimer::getMSTimeDiff(oldMSTime, WorldTimer::getMSTime())); sLog.outString(); diff --git a/src/game/DBScripts/ScriptMgr.cpp b/src/game/DBScripts/ScriptMgr.cpp index c5610b16f94..2133d1dbf4e 100644 --- a/src/game/DBScripts/ScriptMgr.cpp +++ b/src/game/DBScripts/ScriptMgr.cpp @@ -269,14 +269,14 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_EMOTE: // 1 { - if (!sEmotesStore.LookupEntry(tmp.emote.emoteId)) + if (!sDBCEmotes.LookupEntry(tmp.emote.emoteId)) { sLog.outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", tablename, tmp.emote.emoteId, tmp.id); continue; } for (int i = 0; i < MAX_TEXT_ID; ++i) { - if (tmp.textId[i] && !sEmotesStore.LookupEntry(tmp.textId[i])) + if (tmp.textId[i] && !sDBCEmotes.LookupEntry(tmp.textId[i])) { sLog.outErrorDb("Table `%s` has invalid emote id (text_id%u = %u) in SCRIPT_COMMAND_EMOTE for script id %u", tablename, i + 1, tmp.textId[i], tmp.id); } @@ -290,7 +290,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) break; case SCRIPT_COMMAND_TELEPORT_TO: // 6 { - if (!sMapStore.LookupEntry(tmp.teleportTo.mapId)) + if (!sDBCMap.LookupEntry(tmp.teleportTo.mapId)) { sLog.outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", tablename, tmp.teleportTo.mapId, tmp.id); continue; @@ -483,7 +483,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_PLAY_SOUND: // 16 { - if (!sSoundEntriesStore.LookupEntry(tmp.playSound.soundId)) + if (!sDBCSoundEntries.LookupEntry(tmp.playSound.soundId)) { sLog.outErrorDb("Table `%s` using nonexistent sound (id: %u) in SCRIPT_COMMAND_PLAY_SOUND for script id %u", tablename, tmp.playSound.soundId, tmp.id); @@ -538,7 +538,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) break; case SCRIPT_COMMAND_SET_FACTION: // 22 { - if (tmp.faction.factionId && !sFactionTemplateStore.LookupEntry(tmp.faction.factionId)) + if (tmp.faction.factionId && !sDBCFactionTemplate.LookupEntry(tmp.faction.factionId)) { sLog.outErrorDb("Table `%s` has datalong = %u in SCRIPT_COMMAND_SET_FACTION for script id %u, but this faction-template does not exist.", tablename, tmp.faction.factionId, tmp.id); continue; @@ -550,7 +550,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) { if (tmp.data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) { - if (tmp.morph.creatureOrModelEntry && !sCreatureDisplayInfoStore.LookupEntry(tmp.morph.creatureOrModelEntry)) + if (tmp.morph.creatureOrModelEntry && !sDBCCreatureDisplayInfo.LookupEntry(tmp.morph.creatureOrModelEntry)) { sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL for script id %u, but this model does not exist.", tablename, tmp.morph.creatureOrModelEntry, tmp.id); continue; @@ -571,7 +571,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) { if (tmp.data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) { - if (tmp.mount.creatureOrModelEntry && !sCreatureDisplayInfoStore.LookupEntry(tmp.mount.creatureOrModelEntry)) + if (tmp.mount.creatureOrModelEntry && !sDBCCreatureDisplayInfo.LookupEntry(tmp.mount.creatureOrModelEntry)) { sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL for script id %u, but this model does not exist.", tablename, tmp.mount.creatureOrModelEntry, tmp.id); continue; @@ -624,7 +624,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_SEND_TAXI_PATH: // 30 { - if (!sTaxiPathStore.LookupEntry(tmp.sendTaxiPath.taxiPathId)) + if (!sDBCTaxiPath.LookupEntry(tmp.sendTaxiPath.taxiPathId)) { sLog.outErrorDb("Table `%s` has datalong = %u in SCRIPT_COMMAND_SEND_TAXI_PATH for script id %u, but this taxi path does not exist.", tablename, tmp.sendTaxiPath.taxiPathId, tmp.id); continue; @@ -702,7 +702,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_SEND_MAIL: // 38 { - if (!sMailTemplateStore.LookupEntry(tmp.sendMail.mailTemplateId)) + if (!sDBCMailTemplate.LookupEntry(tmp.sendMail.mailTemplateId)) { sLog.outErrorDb("Table `%s` has invalid mailTemplateId (datalong = %u) in SCRIPT_COMMAND_SEND_MAIL for script id %u", tablename, tmp.sendMail.mailTemplateId, tmp.id); continue; diff --git a/src/game/Entities/CharacterHandler.cpp b/src/game/Entities/CharacterHandler.cpp index 8c20b0a2ce1..67523f0bcb1 100644 --- a/src/game/Entities/CharacterHandler.cpp +++ b/src/game/Entities/CharacterHandler.cpp @@ -252,7 +252,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recv_data) } ChrClassesEntry const* classEntry = sDBCChrClasses.LookupEntry(class_); - ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_); + ChrRacesEntry const* raceEntry = sDBCChrRaces.LookupEntry(race_); if (!classEntry || !raceEntry) { @@ -681,7 +681,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) { pCurrChar->setCinematic(1); - if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace())) + if (ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(pCurrChar->getRace())) pCurrChar->SendCinematicStart(rEntry->CinematicSequence); } @@ -692,7 +692,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) else { // Some basic checks in case of a map without areatrigger - MapEntry const* mapEntry = sMapStore.LookupEntry(pCurrChar->GetMapId()); + MapEntry const* mapEntry = sDBCMap.LookupEntry(pCurrChar->GetMapId()); if (!mapEntry) lockStatus = AREA_LOCKSTATUS_UNKNOWN_ERROR; else if (pCurrChar->GetSession()->GetExpansion() < mapEntry->Expansion()) diff --git a/src/game/Entities/Corpse.cpp b/src/game/Entities/Corpse.cpp index 86bdd5484c0..b3ea9bd0807 100644 --- a/src/game/Entities/Corpse.cpp +++ b/src/game/Entities/Corpse.cpp @@ -255,7 +255,7 @@ uint32 Corpse::getFaction() const { if (const uint8 race = getRace()) { - if (const ChrRacesEntry* raceEntry = sChrRacesStore.LookupEntry(race)) + if (const ChrRacesEntry* raceEntry = sDBCChrRaces.LookupEntry(race)) return raceEntry->FactionID; } return 0; diff --git a/src/game/Entities/Creature.cpp b/src/game/Entities/Creature.cpp index ed0915b81dd..71bf0f5d863 100644 --- a/src/game/Entities/Creature.cpp +++ b/src/game/Entities/Creature.cpp @@ -399,7 +399,7 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=nullptr*/, Ga LoadEquipment(data->spawnTemplate->equipmentId); } else if (data->equipmentId != -1) - LoadEquipment(data->equipmentId); + LoadEquipment(data->equipmentId); } if (eventData && eventData->vendor_id) @@ -542,7 +542,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data /*=nullptr*/, faction = data->spawnTemplate->faction; // checked and error show at loading templates - if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(faction)) + if (FactionTemplateEntry const* factionTemplate = sDBCFactionTemplate.LookupEntry(faction)) { if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP) { @@ -1882,7 +1882,7 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim) if (spellInfo->manaCost > GetPower(POWER_MANA)) continue; - SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); + SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRange(srange); float minrange = GetSpellMinRange(srange); @@ -1931,7 +1931,7 @@ SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim) if (spellInfo->manaCost > GetPower(POWER_MANA)) continue; - SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); + SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRange(srange); float minrange = GetSpellMinRange(srange); @@ -2281,14 +2281,14 @@ bool Creature::MeetsSelectAttackingRequirement(Unit* pTarget, SpellEntry const* if (selectFlags & SELECT_FLAG_USE_EFFECT_RADIUS) { - SpellRadiusEntry const* srange = sSpellRadiusStore.LookupEntry(pSpellInfo->EffectRadiusIndex[0]); + SpellRadiusEntry const* srange = sDBCSpellRadius.LookupEntry(pSpellInfo->EffectRadiusIndex[0]); float max_range = GetSpellRadius(srange); float dist = pTarget->GetDistance(GetPositionX(), GetPositionY(), GetPositionZ(), DIST_CALC_COMBAT_REACH); return dist < max_range; } else { - SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(pSpellInfo->rangeIndex); + SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(pSpellInfo->rangeIndex); float max_range = GetSpellMaxRange(srange); float min_range = GetSpellMinRange(srange); float dist = GetDistance(pTarget, true, DIST_CALC_COMBAT_REACH); diff --git a/src/game/Entities/CreatureLinkingMgr.cpp b/src/game/Entities/CreatureLinkingMgr.cpp index 73bac5b4491..df50ca149b3 100644 --- a/src/game/Entities/CreatureLinkingMgr.cpp +++ b/src/game/Entities/CreatureLinkingMgr.cpp @@ -191,7 +191,7 @@ bool CreatureLinkingMgr::IsLinkingEntryValid(uint32 slaveEntry, CreatureLinkingI sLog.outErrorDb("`creature_linking_template` has a non existing master_entry (slave: %u, master %u), skipped", slaveEntry, pTmp->masterId); return false; } - if (pTmp->mapId && !sMapStore.LookupEntry(pTmp->mapId)) + if (pTmp->mapId && !sDBCMap.LookupEntry(pTmp->mapId)) { sLog.outErrorDb("`creature_linking_template` has a non existing map %u (slave %u, master %u), skipped", pTmp->mapId, slaveEntry, pTmp->masterId); return false; @@ -461,7 +461,7 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp { Creature* pMaster = nullptr; if (pInfo->mapId != INVALID_MAP_ID) // entry case - { + { BossGuidMapBounds finds = m_masterGuid.equal_range(pInfo->masterId); for (BossGuidMap::const_iterator itr = finds.first; itr != finds.second; ++itr) { @@ -494,7 +494,7 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp pEnemy->AddThreat(pMaster); pEnemy->SetInCombatWith(pMaster); pEnemy->GetCombatManager().TriggerCombatTimer(pMaster); - } + } else pMaster->AI()->AttackStart(pEnemy); break; diff --git a/src/game/Entities/GameObject.cpp b/src/game/Entities/GameObject.cpp index b2d6a305704..d8f18ea09cc 100644 --- a/src/game/Entities/GameObject.cpp +++ b/src/game/Entities/GameObject.cpp @@ -1922,7 +1922,7 @@ void GameObject::SetGoState(GOState state) void GameObject::SetDisplayId(uint32 modelId) { SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId); - m_displayInfo = sGameObjectDisplayInfoStore.LookupEntry(modelId); + m_displayInfo = sDBCGameObjectDisplayInfo.LookupEntry(modelId); UpdateModel(); } @@ -2439,14 +2439,14 @@ bool GameObject::IsAtInteractDistance(Player const* player, uint32 maxRange) con { if (maxRange == 0.f) { - SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); + SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); maxRange = GetSpellMaxRange(srange); } if (GetGoType() == GAMEOBJECT_TYPE_SPELL_FOCUS) return maxRange * maxRange >= GetDistance(player, true, DIST_CALC_NONE); - if (sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId)) + if (sDBCGameObjectDisplayInfo.LookupEntry(GetGOInfo()->displayId)) return IsAtInteractDistance(player->GetPosition(), maxRange); } @@ -2499,7 +2499,7 @@ SpellEntry const* GameObject::GetSpellForLock(Player const* player) const if (!lockId) return nullptr; - LockEntry const* lock = sLockStore.LookupEntry(lockId); + LockEntry const* lock = sDBCLock.LookupEntry(lockId); if (!lock) return nullptr; diff --git a/src/game/Entities/Item.cpp b/src/game/Entities/Item.cpp index 3d07bbeff8d..d06f47dc8ed 100644 --- a/src/game/Entities/Item.cpp +++ b/src/game/Entities/Item.cpp @@ -31,7 +31,7 @@ void AddItemsSetItem(Player* player, Item* item) ItemPrototype const* proto = item->GetProto(); uint32 setid = proto->ItemSet; - ItemSetEntry const* set = sItemSetStore.LookupEntry(setid); + ItemSetEntry const* set = sDBCItemSet.LookupEntry(setid); if (!set) { @@ -113,7 +113,7 @@ void RemoveItemsSetItem(Player* player, ItemPrototype const* proto) { uint32 setid = proto->ItemSet; - ItemSetEntry const* set = sItemSetStore.LookupEntry(setid); + ItemSetEntry const* set = sDBCItemSet.LookupEntry(setid); if (!set) { @@ -693,7 +693,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) if (itemProto->RandomProperty) { uint32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty); - ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId); + ItemRandomPropertiesEntry const* random_id = sDBCItemRandomProperties.LookupEntry(randomPropId); if (!random_id) { sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId); @@ -704,7 +704,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) } // Random Suffix case uint32 randomPropId = GetItemEnchantMod(itemProto->RandomSuffix); - ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId); + ItemRandomSuffixEntry const* random_id = sDBCItemRandomSuffix.LookupEntry(randomPropId); if (!random_id) { sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId); @@ -721,7 +721,7 @@ void Item::SetItemRandomProperties(int32 randomPropId) if (randomPropId > 0) { - ItemRandomPropertiesEntry const* item_rand = sItemRandomPropertiesStore.LookupEntry(randomPropId); + ItemRandomPropertiesEntry const* item_rand = sDBCItemRandomProperties.LookupEntry(randomPropId); if (item_rand) { if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != int32(item_rand->ID)) @@ -735,7 +735,7 @@ void Item::SetItemRandomProperties(int32 randomPropId) } else { - ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId); + ItemRandomSuffixEntry const* item_rand = sDBCItemRandomSuffix.LookupEntry(-randomPropId); if (item_rand) { if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != -int32(item_rand->ID) || @@ -893,7 +893,7 @@ bool Item::IsBoundByEnchant() const if (!enchant_id) continue; - SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!enchantEntry) continue; @@ -1012,7 +1012,7 @@ bool Item::GemsFitSockets() const continue; } - SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!enchantEntry) { if (SocketColor) fits &= false; @@ -1027,7 +1027,7 @@ bool Item::GemsFitSockets() const ItemPrototype const* gemProto = sItemStorage.LookupEntry(gemid); if (gemProto) { - GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties); + GemPropertiesEntry const* gemProperty = sDBCGemProperties.LookupEntry(gemProto->GemProperties); if (gemProperty) GemColor = gemProperty->color; } @@ -1047,7 +1047,7 @@ uint8 Item::GetGemCountWithID(uint32 GemID) const if (!enchant_id) continue; - SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!enchantEntry) continue; diff --git a/src/game/Entities/ItemEnchantmentMgr.cpp b/src/game/Entities/ItemEnchantmentMgr.cpp index 09bf9855e2f..d558e153aaf 100644 --- a/src/game/Entities/ItemEnchantmentMgr.cpp +++ b/src/game/Entities/ItemEnchantmentMgr.cpp @@ -126,7 +126,7 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id) if (!itemProto->RandomSuffix) return 0; - RandomPropertiesPointsEntry const* randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel); + RandomPropertiesPointsEntry const* randomProperty = sDBCRandPropPoints.LookupEntry(itemProto->ItemLevel); if (!randomProperty) return 0; diff --git a/src/game/Entities/ItemHandler.cpp b/src/game/Entities/ItemHandler.cpp index be6e624ae83..c013bcb5ff2 100644 --- a/src/game/Entities/ItemHandler.cpp +++ b/src/game/Entities/ItemHandler.cpp @@ -1045,7 +1045,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recv_data) else { // listed in dbc or not expected to exist unknown item - if (sItemStore.LookupEntry(itemid)) + if (sDBCItem.LookupEntry(itemid)) sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (item listed in Item.dbc but not exist in DB)", itemid); else sLog.outError("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item, not listed in Item.dbc)", itemid); @@ -1212,7 +1212,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS]; for (int i = 0; i < MAX_GEM_SOCKETS; ++i) // get geminfo from dbc storage - GemProps[i] = (Gems[i]) ? sGemPropertiesStore.LookupEntry(Gems[i]->GetProto()->GemProperties) : nullptr; + GemProps[i] = (Gems[i]) ? sDBCGemProperties.LookupEntry(Gems[i]->GetProto()->GemProperties) : nullptr; for (int i = 0; i < MAX_GEM_SOCKETS; ++i) // check for hack maybe { @@ -1267,7 +1267,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) } else if (OldEnchants[j]) { - if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j])) + if (SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(OldEnchants[j])) { if (iGemProto->ItemId == enchantEntry->GemID) { diff --git a/src/game/Entities/MiscHandler.cpp b/src/game/Entities/MiscHandler.cpp index 006735a78a6..2787aa00044 100644 --- a/src/game/Entities/MiscHandler.cpp +++ b/src/game/Entities/MiscHandler.cpp @@ -381,7 +381,7 @@ void WorldSession::HandleSetTargetOpcode(WorldPacket& recv_data) if (!unit) return; - if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction())) + if (FactionTemplateEntry const* factionTemplateEntry = sDBCFactionTemplate.LookupEntry(unit->getFaction())) _player->GetReputationMgr().SetVisible(factionTemplateEntry); } @@ -401,7 +401,7 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket& recv_data) if (!unit) return; - if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction())) + if (FactionTemplateEntry const* factionTemplateEntry = sDBCFactionTemplate.LookupEntry(unit->getFaction())) _player->GetReputationMgr().SetVisible(factionTemplateEntry); } @@ -759,7 +759,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) if (!at) return; - MapEntry const* targetMapEntry = sMapStore.LookupEntry(at->target_mapId); + MapEntry const* targetMapEntry = sDBCMap.LookupEntry(at->target_mapId); if (!targetMapEntry) return; @@ -1065,9 +1065,9 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) uint32 talentTabId = talentTabIds[i]; // fill by real data - for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId) + for (uint32 talentId = 0; talentId < sDBCTalent.GetNumRows(); ++talentId) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(talentId); if (!talentInfo) continue; diff --git a/src/game/Entities/NPCHandler.cpp b/src/game/Entities/NPCHandler.cpp index 3868b1e5389..fb4fa0daad0 100644 --- a/src/game/Entities/NPCHandler.cpp +++ b/src/game/Entities/NPCHandler.cpp @@ -839,7 +839,7 @@ void WorldSession::HandleBuyStableSlot(WorldPacket& recv_data) if (GetPlayer()->m_stableSlots < MAX_PET_STABLES) { - StableSlotPricesEntry const* SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots + 1); + StableSlotPricesEntry const* SlotPrice = sDBCStableSlotPrices.LookupEntry(GetPlayer()->m_stableSlots + 1); if (_player->GetMoney() >= SlotPrice->Price) { ++GetPlayer()->m_stableSlots; diff --git a/src/game/Entities/Object.cpp b/src/game/Entities/Object.cpp index 5be4f056ef6..a99292bd759 100644 --- a/src/game/Entities/Object.cpp +++ b/src/game/Entities/Object.cpp @@ -2916,8 +2916,8 @@ int32 WorldObject::CalculateSpellEffectValue(Unit const* target, SpellEntry cons if (damage) { - GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(spellProto->spellLevel - 1); - GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(unitCaster->getLevel() - 1); + GtNPCManaCostScalerEntry const* spellScaler = sDBCgtNPCManaCostScaler.LookupEntry(spellProto->spellLevel - 1); + GtNPCManaCostScalerEntry const* casterScaler = sDBCgtNPCManaCostScaler.LookupEntry(unitCaster->getLevel() - 1); if (spellScaler && casterScaler) value *= casterScaler->ratio / spellScaler->ratio; } diff --git a/src/game/Entities/Pet.cpp b/src/game/Entities/Pet.cpp index b938695726c..c017ff886ab 100644 --- a/src/game/Entities/Pet.cpp +++ b/src/game/Entities/Pet.cpp @@ -650,7 +650,7 @@ void Pet::SetDeathState(DeathState s) // overwrite virtual if (getPetType() != SUMMON_PET) { // lose happiness when died and not in BG/Arena - MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId()); + MapEntry const* mapEntry = sDBCMap.LookupEntry(GetMapId()); if (!mapEntry || (mapEntry->map_type != MAP_ARENA && mapEntry->map_type != MAP_BATTLEGROUND)) ModifyPower(POWER_HAPPINESS, -HAPPINESS_LEVEL_SIZE); } @@ -1195,7 +1195,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForPetLevel(creature->getLevel())); SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - if (CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family)) + if (CreatureFamilyEntry const* cFamily = sDBCCreatureFamily.LookupEntry(cInfo->Family)) SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]); else SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDbc2StorageLocaleIndex())); @@ -1258,7 +1258,7 @@ void Pet::InitStatsForLevel(uint32 petlevel) { case HUNTER_PET: { - CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family); + CreatureFamilyEntry const* cFamily = sDBCCreatureFamily.LookupEntry(cInfo->Family); if (cFamily && cFamily->minScale > 0.0f) { @@ -1527,7 +1527,7 @@ bool Pet::HaveInDiet(ItemPrototype const* item) const if (!cInfo) return false; - CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family); + CreatureFamilyEntry const* cFamily = sDBCCreatureFamily.LookupEntry(cInfo->Family); if (!cFamily) return false; @@ -2089,7 +2089,7 @@ void Pet::InitPetCreateSpells() addSpell(petspellid); - SkillLineAbilityEntry const* skla = sSkillLineAbilityStore.LookupEntry(learn_spellproto->EffectTriggerSpell[0]); + SkillLineAbilityEntry const* skla = sDBCSkillLineAbility.LookupEntry(learn_spellproto->EffectTriggerSpell[0]); if (skla) usedtrainpoints += skla->reqtrainpoints; } @@ -2248,7 +2248,7 @@ void Pet::LearnPetPassives() if (!cInfo) return; - CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family); + CreatureFamilyEntry const* cFamily = sDBCCreatureFamily.LookupEntry(cInfo->Family); if (!cFamily) return; diff --git a/src/game/Entities/PetHandler.cpp b/src/game/Entities/PetHandler.cpp index 25bbe478183..4a3092e686f 100644 --- a/src/game/Entities/PetHandler.cpp +++ b/src/game/Entities/PetHandler.cpp @@ -323,7 +323,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) if (!petUnit->hasUnitState(UNIT_STAT_POSSESSED)) flags |= TRIGGERED_PET_CAST; - const SpellRangeEntry* sRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); + const SpellRangeEntry* sRange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); if (!IsSpellRequireTarget(spellInfo)) unit_target = nullptr; diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index b9f5b7ce07c..6446b1ae747 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -1751,7 +1751,7 @@ bool Player::BuildEnumData(QueryResult* result, WorldPacket& p_data) if (!enchantId) continue; - enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId); + enchant = sDBCSpellItemEnchantment.LookupEntry(enchantId); if (enchant) break; } @@ -1873,7 +1873,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return false; } - MapEntry const* mEntry = sMapStore.LookupEntry(mapid); // Validity checked in IsValidMapCoord + MapEntry const* mEntry = sDBCMap.LookupEntry(mapid); // Validity checked in IsValidMapCoord #ifdef BUILD_PLAYERBOT // If this user has bots, tell them to stop following master @@ -3254,7 +3254,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen // talent: unlearn all lower talent ranks if (talentPos) { - if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) + if (TalentEntry const* talentInfo = sDBCTalent.LookupEntry(talentPos->talent_id)) { for (unsigned int rankSpellId : talentInfo->RankID) { @@ -3274,12 +3274,12 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen { // Check if a spell is learned by a talent first bool talent = false; - for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) + for (uint32 i = 0; i < sDBCTalent.GetNumRows(); ++i) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); if (!talentInfo) continue; - TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo || !(getClassMask() & talentTabInfo->ClassMask)) continue; uint32 parent = 0; @@ -3784,14 +3784,14 @@ bool Player::resetTalents(bool no_cost) } } - for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) + for (unsigned int i = 0; i < sDBCTalent.GetNumRows(); ++i) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); if (!talentInfo) continue; - TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -4632,7 +4632,7 @@ std::pair Player::CheckAndRevivePlayerOnDungeonEnter(M if (AreaTrigger const* corpseAt = sObjectMgr.GetMapEntranceTrigger(corpseMapId)) { resultingAt = corpseAt; - targetMapEntry = sMapStore.LookupEntry(targetMapId); + targetMapEntry = sDBCMap.LookupEntry(targetMapId); if (!targetMapEntry) return { false, nullptr }; } @@ -4652,7 +4652,7 @@ void Player::KillPlayer() // SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP ); SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); - ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable()); + ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sDBCMap.LookupEntry(GetMapId())->Instanceable()); // 6 minutes until repop at graveyard m_deathTimer = 6 * MINUTE * IN_MILLISECONDS; @@ -4880,7 +4880,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g { ItemPrototype const* ditemProto = item->GetProto(); - DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); + DurabilityCostsEntry const* dcost = sDBCDurabilityCosts.LookupEntry(ditemProto->ItemLevel); if (!dcost) { sLog.outError("RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); @@ -4888,7 +4888,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g } uint32 dQualitymodEntryId = (ditemProto->Quality + 1) * 2; - DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); + DurabilityQualityEntry const* dQualitymodEntry = sDBCDurabilityQuality.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { sLog.outError("RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); @@ -5168,8 +5168,8 @@ float Player::GetMeleeCritFromAgility() const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtChanceToMeleeCritBaseEntry const* critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass - 1); - GtChanceToMeleeCritEntry const* critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); + GtChanceToMeleeCritBaseEntry const* critBase = sDBCgtChanceToMeleeCritBase.LookupEntry(pclass - 1); + GtChanceToMeleeCritEntry const* critRatio = sDBCgtChanceToMeleeCrit.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); if (critBase == nullptr || critRatio == nullptr) return 0.0f; @@ -5203,7 +5203,7 @@ float Player::GetDodgeFromAgility(float amount) const const uint32 index = ((pclass - 1) * GT_MAX_LEVEL) + (level - 1); // Dodge per agility is proportional to crit per agility, which is available from DBC files - const GtChanceToMeleeCritEntry* entry = sGtChanceToMeleeCritStore.LookupEntry(index); + const GtChanceToMeleeCritEntry* entry = sDBCgtChanceToMeleeCrit.LookupEntry(index); if (!entry) return 0.0f; return (100.0f * amount * entry->ratio * PLAYER_AGI_TO_CRIT_TO_DODGE[pclass]); @@ -5216,8 +5216,8 @@ float Player::GetSpellCritFromIntellect() const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtChanceToSpellCritBaseEntry const* critBase = sGtChanceToSpellCritBaseStore.LookupEntry(pclass - 1); - GtChanceToSpellCritEntry const* critRatio = sGtChanceToSpellCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); + GtChanceToSpellCritBaseEntry const* critBase = sDBCgtChanceToSpellCritBase.LookupEntry(pclass - 1); + GtChanceToSpellCritEntry const* critRatio = sDBCgtChanceToSpellCrit.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); if (critBase == nullptr || critRatio == nullptr) return 0.0f; @@ -5231,7 +5231,7 @@ float Player::GetRatingMultiplier(CombatRating cr) const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtCombatRatingsEntry const* Rating = sGtCombatRatingsStore.LookupEntry(cr * GT_MAX_LEVEL + level - 1); + GtCombatRatingsEntry const* Rating = sDBCgtCombatRatings.LookupEntry(cr * GT_MAX_LEVEL + level - 1); if (!Rating) return 1.0f; // By default use minimum coefficient (not must be called) @@ -5713,7 +5713,7 @@ void Player::SetSkill(uint16 id, uint16 value, uint16 max, uint16 step/* = 0*/) { if (!exists) { - SkillLineEntry const* entry = sSkillLineStore.LookupEntry(id); + SkillLineEntry const* entry = sDBCSkillLine.LookupEntry(id); if (!entry) { sLog.outError("Skill not found in SkillLineStore: skill #%u", id); @@ -5802,7 +5802,7 @@ void Player::SetSkillStep(uint16 id, uint16 step) { if (entry.skillTierId) { - if (SkillTiersEntry const* steps = sSkillTiersStore.LookupEntry(entry.skillTierId)) + if (SkillTiersEntry const* steps = sDBCSkillTiers.LookupEntry(entry.skillTierId)) { val = uint16(steps->skillValue[(step - 1)]); max = uint16(steps->maxSkillValue[(step - 1)]); @@ -5903,7 +5903,7 @@ void Player::UpdateSkillsForLevel(bool maximize/* = false*/) uint16 skillId = uint16(pair.first); - SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skillId); + SkillLineEntry const* pSkill = sDBCSkillLine.LookupEntry(skillId); if (!pSkill) continue; @@ -6010,7 +6010,7 @@ void Player::UpdateSpellTrainedSkills(uint32 spellId, bool apply) { SkillLineAbilityEntry const* info = itr->second; - SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(info->skillId); + SkillLineEntry const* pSkill = sDBCSkillLine.LookupEntry(info->skillId); if (!pSkill) continue; @@ -6093,7 +6093,7 @@ void Player::LearnDefaultSkills() uint16 max = 0; uint16 step = 0; - if (SkillLineEntry const* entry = sSkillLineStore.LookupEntry(tskill.SkillId)) + if (SkillLineEntry const* entry = sDBCSkillLine.LookupEntry(tskill.SkillId)) { switch (GetSkillRangeType(entry, false)) { @@ -6115,7 +6115,7 @@ void Player::LearnDefaultSkills() { if (entry.skillTierId) { - if (SkillTiersEntry const* steps = sSkillTiersStore.LookupEntry(entry.skillTierId)) + if (SkillTiersEntry const* steps = sDBCSkillTiers.LookupEntry(entry.skillTierId)) { value = 1; max = uint16(steps->maxSkillValue[stepIndex]); @@ -6392,7 +6392,7 @@ void Player::SendCinematicStart(uint32 CinematicSequenceId) data << uint32(CinematicSequenceId); SendDirectMessage(data); - if (CinematicSequencesEntry const* sequence = sCinematicSequencesStore.LookupEntry(CinematicSequenceId)) + if (CinematicSequencesEntry const* sequence = sDBCCinematicSequences.LookupEntry(CinematicSequenceId)) { // we can start server side dynamic follow m_cinematicMgr.reset(new CinematicMgr(this)); @@ -6501,7 +6501,7 @@ void Player::CheckAreaExploreAndOutdoor() Team Player::TeamForRace(uint8 race) { - ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race); + ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(race); if (!rEntry) { sLog.outError("Race %u not found in DBC: wrong DBC files?", uint32(race)); @@ -6520,7 +6520,7 @@ Team Player::TeamForRace(uint8 race) uint32 Player::getFactionForRace(uint8 race) { - ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race); + ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(race); if (!rEntry) { sLog.outError("Race %u not found in DBC: wrong DBC files?", uint32(race)); @@ -7789,7 +7789,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType, bool sp for (int e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot) { uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot)); - SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!pEnchant) continue; for (int s = 0; s < 3; ++s) { @@ -11815,7 +11815,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool if (!enchant_id) return; - SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!pEnchant) return; @@ -11867,7 +11867,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool // Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor) if (item->GetItemRandomPropertyId()) { - ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand = sDBCItemRandomSuffix.LookupEntry(abs(item->GetItemRandomPropertyId())); if (item_rand) { // Search enchant_amount @@ -11895,7 +11895,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool case ITEM_ENCHANTMENT_TYPE_RESISTANCE: if (!enchant_amount) { - ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand = sDBCItemRandomSuffix.LookupEntry(abs(item->GetItemRandomPropertyId())); if (item_rand) { for (int k = 0; k < 3; ++k) @@ -11915,7 +11915,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool { if (!enchant_amount) { - ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand_suffix = sDBCItemRandomSuffix.LookupEntry(abs(item->GetItemRandomPropertyId())); if (item_rand_suffix) { for (int k = 0; k < 3; ++k) @@ -15099,7 +15099,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) } else { - MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId()); + MapEntry const* mapEntry = sDBCMap.LookupEntry(GetMapId()); // if server restart after player save in BG or area // player can have current coordinates in to BG/Arena map, fix this if (!mapEntry || mapEntry->IsBattleGroundOrArena()) @@ -15166,7 +15166,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) } if (transport) { - MapEntry const* transMapEntry = sMapStore.LookupEntry(transport->GetMapId()); + MapEntry const* transMapEntry = sDBCMap.LookupEntry(transport->GetMapId()); // client without expansion support if (GetSession()->GetExpansion() < transMapEntry->Expansion()) DEBUG_LOG("Player %s using client without required expansion tried login at transport at non accessible map %u", GetName(), transport->GetMapId()); @@ -15194,7 +15194,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) } else // not transport case { - MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId()); + MapEntry const* mapEntry = sDBCMap.LookupEntry(GetMapId()); // client without expansion support if (GetSession()->GetExpansion() < mapEntry->Expansion()) { @@ -15374,7 +15374,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) if (!m_taxiTracker.Load(taxi_nodes, destOrphan)) { // problems with taxi path loading - TaxiNodesEntry const* nodeEntry = (destOrphan ? sTaxiNodesStore.LookupEntry(destOrphan) : nullptr); + TaxiNodesEntry const* nodeEntry = (destOrphan ? sDBCTaxiNodes.LookupEntry(destOrphan) : nullptr); if (!nodeEntry) // don't know taxi start node, to homebind { @@ -15405,7 +15405,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) // save source node as recall coord to prevent recall and fall from sky if (uint32 destSource = m_taxiTracker.GetRoute().destStart) { - TaxiNodesEntry const* destination = sTaxiNodesStore.LookupEntry(destSource); + TaxiNodesEntry const* destination = sDBCTaxiNodes.LookupEntry(destSource); MANGOS_ASSERT(destination); m_recallMap = destination->map_id; m_recallX = destination->x; @@ -15653,7 +15653,7 @@ void Player::LoadCorpse() { if (Corpse* corpse = GetCorpse()) { - ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER, corpse && !sMapStore.LookupEntry(corpse->GetMapId())->Instanceable()); + ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER, corpse && !sDBCMap.LookupEntry(corpse->GetMapId())->Instanceable()); // [XFACTION]: Alter values update if detected crossfaction group interaction: if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetGroup()) @@ -15941,7 +15941,7 @@ void Player::_LoadMails(QueryResult* result) m->mailTemplateId = fields[12].GetInt16(); m->has_items = fields[13].GetBool(); // true, if mail have items or mail have template and items generated (maybe none) - if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId)) + if (m->mailTemplateId && !sDBCMailTemplate.LookupEntry(m->mailTemplateId)) { sLog.outError("Player::_LoadMail - Mail (%u) have nonexistent MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); m->mailTemplateId = 0; @@ -16266,7 +16266,7 @@ void Player::_LoadBoundInstances(QueryResult* result) // so the value read from the DB may be wrong here but only if the InstanceSave is loaded // and in that case it is not used - MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapId); if (!mapEntry || !mapEntry->IsDungeon()) { sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent or not dungeon map %d", GetName(), GetGUIDLow(), mapId); @@ -16302,7 +16302,7 @@ void Player::_LoadBoundInstances(QueryResult* result) InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, Difficulty difficulty) { // some instances only have one difficulty - const MapEntry* entry = sMapStore.LookupEntry(mapid); + const MapEntry* entry = sDBCMap.LookupEntry(mapid); if (!entry || !entry->SupportsHeroicMode()) difficulty = DUNGEON_DIFFICULTY_NORMAL; @@ -16372,7 +16372,7 @@ InstancePlayerBind* Player::BindToInstance(DungeonPersistentState* state, bool p DungeonPersistentState* Player::GetBoundInstanceSaveForSelfOrGroup(uint32 mapid) { - MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); if (!mapEntry) return nullptr; @@ -16538,7 +16538,7 @@ bool Player::_LoadHomeBind(QueryResult* result) m_homebindZ = fields[4].GetFloat(); delete result; - MapEntry const* bindMapEntry = sMapStore.LookupEntry(m_homebindMapId); + MapEntry const* bindMapEntry = sDBCMap.LookupEntry(m_homebindMapId); // accept saved data only for valid position (and non instanceable), and accessable if (MapManager::IsValidMapCoord(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ) && @@ -17465,7 +17465,7 @@ void Player::ResetInstances(InstanceResetMethod method) for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { DungeonPersistentState* state = itr->second.state; - const MapEntry* entry = sMapStore.LookupEntry(itr->first); + const MapEntry* entry = sDBCMap.LookupEntry(itr->first); if (!entry || !state->CanReset()) { ++itr; @@ -18185,7 +18185,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc uint32 sourcenode = nodes[0]; // starting node too far away (cheat?) - TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(sourcenode); + TaxiNodesEntry const* node = sDBCTaxiNodes.LookupEntry(sourcenode); if (!node) { GetSession()->SendActivateTaxiReply(ERR_TAXINOSUCHPATH); @@ -18251,7 +18251,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc bool Player::ActivateTaxiPathTo(uint32 path_id, uint32 spellid /*= 0*/) { - TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(path_id); + TaxiPathEntry const* entry = sDBCTaxiPath.LookupEntry(path_id); if (!entry) return false; @@ -18308,7 +18308,7 @@ void Player::OnTaxiFlightStart(const TaxiPathEntry* /*path*/) void Player::OnTaxiFlightEnd(const TaxiPathEntry* path) { // Final destination - if (const TaxiNodesEntry* destination = sTaxiNodesStore.LookupEntry(path->to)) + if (const TaxiNodesEntry* destination = sDBCTaxiNodes.LookupEntry(path->to)) TeleportTo(GetMap()->GetId(), destination->x, destination->y, destination->z, GetOrientation()); if (pvpInfo.inPvPEnforcedArea) @@ -18400,7 +18400,7 @@ void Player::OnTaxiFlightSplineStart(const TaxiPathNodeEntry* node) if (m_taxiTracker.GetState() == Taxi::TRACKER_TRANSFER) UpdateClientControl(this, false); - if (sTaxiPathStore.LookupEntry(node->path)) + if (sDBCTaxiPath.LookupEntry(node->path)) Mount(m_taxiTracker.GetMountDisplayId()); getHostileRefManager().updateOnlineOfflineState(false); @@ -18470,7 +18470,7 @@ void Player::OnTaxiFlightRouteStart(uint32 pathID, bool initial) { ModifyMoney(-int32(m_taxiTracker.GetCost())); - if (const TaxiPathEntry* path = sTaxiPathStore.LookupEntry(pathID)) + if (const TaxiPathEntry* path = sDBCTaxiPath.LookupEntry(pathID)) OnTaxiFlightStart(path); } } @@ -18479,7 +18479,7 @@ void Player::OnTaxiFlightRouteEnd(uint32 pathID, bool final) { if (final) { - if (const TaxiPathEntry* path = sTaxiPathStore.LookupEntry(pathID)) + if (const TaxiPathEntry* path = sDBCTaxiPath.LookupEntry(pathID)) OnTaxiFlightEnd(path); } else @@ -18515,7 +18515,7 @@ void Player::InitDataForForm(bool reapplyMods) { ShapeshiftForm form = GetShapeshiftForm(); - SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form); + SpellShapeshiftFormEntry const* ssEntry = sDBCSpellShapeshiftForm.LookupEntry(form); if (ssEntry && ssEntry->attackSpeed) { SetAttackTime(BASE_ATTACK, ssEntry->attackSpeed); @@ -18587,7 +18587,7 @@ void Player::InitDisplayIds() void Player::TakeExtendedCost(uint32 extendedCostId, uint32 count) { - ItemExtendedCostEntry const* extendedCost = sItemExtendedCostStore.LookupEntry(extendedCostId); + ItemExtendedCostEntry const* extendedCost = sDBCItemExtendedCost.LookupEntry(extendedCostId); if (extendedCost->reqhonorpoints) ModifyHonorPoints(-int32(extendedCost->reqhonorpoints * count)); @@ -18673,7 +18673,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, if (uint32 extendedCostId = crItem->ExtendedCost) { - ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCostId); + ItemExtendedCostEntry const* iece = sDBCItemExtendedCost.LookupEntry(extendedCostId); if (!iece) { sLog.outError("Item %u have wrong ExtendedCost field value %u", pProto->ItemId, extendedCostId); @@ -18931,7 +18931,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) if (!enchantmentcondition) return true; - SpellItemEnchantmentConditionEntry const* Condition = sSpellItemEnchantmentConditionStore.LookupEntry(enchantmentcondition); + SpellItemEnchantmentConditionEntry const* Condition = sDBCSpellItemEnchantmentCondition.LookupEntry(enchantmentcondition); if (!Condition) return true; @@ -18952,7 +18952,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) if (!enchant_id) continue; - SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!enchantEntry) continue; @@ -18964,7 +18964,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) if (!gemProto) continue; - GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties); + GemPropertiesEntry const* gemProperty = sDBCGemProperties.LookupEntry(gemProto->GemProperties); if (!gemProperty) continue; @@ -19030,7 +19030,7 @@ void Player::CorrectMetaGemEnchants(uint8 exceptslot, bool apply) if (!enchant_id) continue; - SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!enchantEntry) continue; @@ -19073,7 +19073,7 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply) if (!enchant_id) // if no enchant go to next enchant(slot) continue; - SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!enchantEntry) continue; @@ -20641,7 +20641,7 @@ void Player::UpdateTerainEnvironmentFlags(Map* m, float x, float y, float z) if (uint32 liqEntry = liquid_status.entry) { - LiquidTypeEntry const* liquid = sLiquidTypeStore.LookupEntry(liqEntry); + LiquidTypeEntry const* liquid = sDBCLiquidType.LookupEntry(liqEntry); if (m_lastLiquid && m_lastLiquid->SpellId && m_lastLiquid->Id != liqEntry) RemoveAurasDueToSpell(m_lastLiquid->SpellId); @@ -20922,7 +20922,7 @@ void Player::_LoadSkills(QueryResult* result) uint16 value = fields[1].GetUInt16(); uint16 max = fields[2].GetUInt16(); - SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); + SkillLineEntry const* pSkill = sDBCSkillLine.LookupEntry(skill); if (!pSkill) { sLog.outError("Character %u has skill %u that does not exist.", GetGUIDLow(), skill); @@ -20973,7 +20973,7 @@ void Player::_LoadSkills(QueryResult* result) if (entry->flags & SKILL_FLAG_MAXIMIZED) value = max = GetSkillMaxForLevel(); - if (SkillTiersEntry const* steps = sSkillTiersStore.LookupEntry(entry->skillTierId)) + if (SkillTiersEntry const* steps = sDBCSkillTiers.LookupEntry(entry->skillTierId)) { for (uint16 i = 0; (i < MAX_SKILL_STEP && !step && steps->maxSkillValue[i]); ++i) { @@ -21023,7 +21023,7 @@ InventoryResult Player::CanEquipUniqueItem(Item* pItem, uint8 eslot) const uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot)); if (!enchant_id) continue; - SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!enchantEntry) continue; @@ -21105,12 +21105,12 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) if (talentRank >= MAX_TALENT_RANK) return; - TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(talentId); if (!talentInfo) return; - TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) return; @@ -21141,7 +21141,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) // Check if it requires another talent if (talentInfo->DependsOn > 0) { - if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) + if (TalentEntry const* depTalentInfo = sDBCTalent.LookupEntry(talentInfo->DependsOn)) { bool hasEnoughRank = false; for (int i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; ++i) @@ -21166,11 +21166,11 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) uint32 tTab = talentInfo->TalentTab; if (talentInfo->Row > 0) { - unsigned int numRows = sTalentStore.GetNumRows(); + unsigned int numRows = sDBCTalent.GetNumRows(); for (unsigned int i = 0; i < numRows; ++i) // Loop through all talents. { // Someday, someone needs to revamp - const TalentEntry* tmpTalent = sTalentStore.LookupEntry(i); + const TalentEntry* tmpTalent = sDBCTalent.LookupEntry(i); if (tmpTalent) // the way talents are tracked { if (tmpTalent->TalentTab == tTab) @@ -21454,7 +21454,7 @@ AreaLockStatus Player::GetAreaTriggerLockStatus(AreaTrigger const* at, uint32& m if (!at) return AREA_LOCKSTATUS_UNKNOWN_ERROR; - MapEntry const* mapEntry = sMapStore.LookupEntry(at->target_mapId); + MapEntry const* mapEntry = sDBCMap.LookupEntry(at->target_mapId); if (!mapEntry) return AREA_LOCKSTATUS_UNKNOWN_ERROR; diff --git a/src/game/Entities/QueryHandler.cpp b/src/game/Entities/QueryHandler.cpp index 58aec182311..5935f46e7a6 100644 --- a/src/game/Entities/QueryHandler.cpp +++ b/src/game/Entities/QueryHandler.cpp @@ -299,7 +299,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recv_data*/) if (corpsemapid != _player->GetMapId()) { // search entrance map for proper show entrance - if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(corpsemapid)) + if (MapEntry const* corpseMapEntry = sDBCMap.LookupEntry(corpsemapid)) { if (corpseMapEntry->IsDungeon() && corpseMapEntry->ghost_entrance_map >= 0) { diff --git a/src/game/Entities/Relations.cpp b/src/game/Entities/Relations.cpp index 2044a79cd8b..a7d8cd6b597 100644 --- a/src/game/Entities/Relations.cpp +++ b/src/game/Entities/Relations.cpp @@ -296,7 +296,7 @@ ReputationRank Unit::GetReactionTo(const Corpse* corpse) const { if (const uint32 corpseTemplateId = corpse->getFaction()) { - if (const FactionTemplateEntry* corpseTemplate = sFactionTemplateStore.LookupEntry(corpseTemplateId)) + if (const FactionTemplateEntry* corpseTemplate = sDBCFactionTemplate.LookupEntry(corpseTemplateId)) return GetFactionReaction(thisTemplate, corpseTemplate); } } @@ -321,7 +321,7 @@ ReputationRank GameObject::GetReactionTo(Unit const* unit) const if (const uint32 faction = GetUInt32Value(GAMEOBJECT_FACTION)) { - if (const FactionTemplateEntry* factionTemplate = sFactionTemplateStore.LookupEntry(faction)) + if (const FactionTemplateEntry* factionTemplate = sDBCFactionTemplate.LookupEntry(faction)) return GetFactionReaction(factionTemplate, unit); } @@ -692,7 +692,7 @@ bool Unit::CanInteractNow(const Unit* unit) const // We can't interact with anyone while being shapeshifted, unless form flags allow us to do so if (IsShapeShifted()) { - if (SpellShapeshiftFormEntry const* formEntry = sSpellShapeshiftFormStore.LookupEntry(GetShapeshiftForm())) + if (SpellShapeshiftFormEntry const* formEntry = sDBCSpellShapeshiftForm.LookupEntry(GetShapeshiftForm())) { if (!(formEntry->flags1 & SHAPESHIFT_FORM_FLAG_ALLOW_NPC_INTERACT)) return false; @@ -872,7 +872,7 @@ bool GameObject::IsEnemy(Unit const* unit) const if (const uint32 faction = GetUInt32Value(GAMEOBJECT_FACTION)) { - if (const FactionTemplateEntry* factionTemplate = sFactionTemplateStore.LookupEntry(faction)) + if (const FactionTemplateEntry* factionTemplate = sDBCFactionTemplate.LookupEntry(faction)) return (GetFactionReaction(factionTemplate, unit) < REP_UNFRIENDLY); } @@ -896,7 +896,7 @@ bool GameObject::IsFriend(Unit const* unit) const if (const uint32 faction = GetUInt32Value(GAMEOBJECT_FACTION)) { - if (const FactionTemplateEntry* factionTemplate = sFactionTemplateStore.LookupEntry(faction)) + if (const FactionTemplateEntry* factionTemplate = sDBCFactionTemplate.LookupEntry(faction)) return (GetFactionReaction(factionTemplate, unit) > REP_NEUTRAL); } @@ -1021,7 +1021,7 @@ ReputationRank Player::GetReactionTo(const Corpse* corpse) const if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInGroup(corpseOwner)) { uint32 id = (GetTeam() == ALLIANCE ? 1054 : 1495); - return GetFactionReaction(GetFactionTemplateEntry(), sFactionTemplateStore.LookupEntry(id)); + return GetFactionReaction(GetFactionTemplateEntry(), sDBCFactionTemplate.LookupEntry(id)); } } } diff --git a/src/game/Entities/Taxi.cpp b/src/game/Entities/Taxi.cpp index ac7a8641488..65fdf873554 100644 --- a/src/game/Entities/Taxi.cpp +++ b/src/game/Entities/Taxi.cpp @@ -171,7 +171,7 @@ bool Tracker::AddRoute(PathID pathID, float discountMulti /*= 0.0f*/, bool requi if (m_state > TRACKER_STAGING) return false; - TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(pathID); + TaxiPathEntry const* entry = sDBCTaxiPath.LookupEntry(pathID); return (entry && AddRoute(entry, discountMulti, requireModel)); } @@ -273,7 +273,7 @@ bool Tracker::Prepare(Index nodeResume /*= 0*/) if (prev && (*j)->mapid != prev->mapid) { // Detect map change and advance atlas by adding a new map - if (sMapStore.LookupEntry((*j)->mapid)) + if (sDBCMap.LookupEntry((*j)->mapid)) { // Bugcheck: latest finished map spline is suspiciously short MANGOS_ASSERT(m_atlas.back().size() > 2); @@ -416,7 +416,7 @@ bool Tracker::Trim(Route& first, Route& second) // Try to trim dynamically if data is not available or incomplete TaxiPathNodeList const& waypoints1 = sTaxiPathNodesByPath[first.pathID]; TaxiPathNodeList const& waypoints2 = sTaxiPathNodesByPath[second.pathID]; - TaxiNodesEntry const* destination = sTaxiNodesStore.LookupEntry(first.destEnd); + TaxiNodesEntry const* destination = sDBCTaxiNodes.LookupEntry(first.destEnd); if (destination && waypoints1 != waypoints2) { diff --git a/src/game/Entities/Transports.cpp b/src/game/Entities/Transports.cpp index 3ee1c0c9269..573759a737c 100644 --- a/src/game/Entities/Transports.cpp +++ b/src/game/Entities/Transports.cpp @@ -83,7 +83,7 @@ void MapManager::LoadTransports() continue; } - const MapEntry* pMapInfo = sMapStore.LookupEntry(transportTemplate->keyFrames.begin()->Node->mapid); + const MapEntry* pMapInfo = sDBCMap.LookupEntry(transportTemplate->keyFrames.begin()->Node->mapid); if (!pMapInfo) continue; @@ -189,7 +189,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, SetDisplayId(goinfo->displayId); SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); - m_displayInfo = sGameObjectDisplayInfoStore.LookupEntry(goinfo->displayId); + m_displayInfo = sDBCGameObjectDisplayInfo.LookupEntry(goinfo->displayId); SetGoState(GO_STATE_READY); SetGoType(GameobjectTypes(goinfo->type)); diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index 3710c33c883..6aaf508b7d9 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -857,7 +857,7 @@ uint32 Unit::DealDamage(Unit* dealer, Unit* victim, uint32 damage, CleanDamage c } } } - + if (!damage) { // Rage from physical damage received - extend to all units @@ -1184,7 +1184,7 @@ void Unit::HandleDamageDealt(Unit* dealer, Unit* victim, uint32& damage, CleanDa for (auto aura : cleanupHolder) victim->RemoveAurasDueToSpell(aura); } - + if (dealer) dealer->InterruptOrDelaySpell(victim, damagetype); @@ -2207,7 +2207,7 @@ void Unit::HandleEmote(uint32 emote_id) { if (!emote_id) HandleEmoteState(0); - else if (EmotesEntry const* emoteEntry = sEmotesStore.LookupEntry(emote_id)) + else if (EmotesEntry const* emoteEntry = sDBCEmotes.LookupEntry(emote_id)) { if (emoteEntry->EmoteType) // 1,2 states, 0 command HandleEmoteState(emote_id); @@ -6173,7 +6173,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* calcDamageInfo) const SendMessageToSet(data, true); } -void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, SpellSchoolMask damageSchoolMask, uint32 Damage, +void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, int32 Resist, VictimState TargetState, uint32 BlockedAmount) { CalcDamageInfo dmgInfo; @@ -6232,7 +6232,7 @@ void Unit::SetPowerType(Powers new_powertype) FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const { - FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(getFaction()); + FactionTemplateEntry const* entry = sDBCFactionTemplate.LookupEntry(getFaction()); if (!entry) { static ObjectGuid guid; // prevent repeating spam same faction problem @@ -6242,7 +6242,7 @@ FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const guid = GetObjectGuid(); if (guid.GetHigh() == HIGHGUID_PET) - sLog.outError("%s (base creature entry %u) have invalid faction template id %u, owner %s", + sLog.outError("%s (base creature entry %u) have invalid faction template id %u, owner %s", GetGuidStr().c_str(), GetEntry(), getFaction(), ((Pet*)this)->GetOwnerGuid().GetString().c_str()); else sLog.outError("%s have invalid faction template id %u", GetGuidStr().c_str(), getFaction()); @@ -7627,7 +7627,7 @@ bool Unit::IsImmuneToSpell(SpellEntry const* spellInfo, bool /*castOnSelf*/, uin return true; { - if (!spellInfo->HasAttribute(SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) && + if (!spellInfo->HasAttribute(SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) && !spellInfo->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)) { bool isPositive = IsPositiveEffectMask(spellInfo, effectMask); @@ -9258,7 +9258,7 @@ uint32 Unit::GetCreatureType() const { if (GetTypeId() == TYPEID_PLAYER) { - SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(GetShapeshiftForm()); + SpellShapeshiftFormEntry const* ssEntry = sDBCSpellShapeshiftForm.LookupEntry(GetShapeshiftForm()); if (ssEntry && ssEntry->creatureType > 0) return ssEntry->creatureType; return CREATURE_TYPE_HUMANOID; @@ -9922,7 +9922,7 @@ void CharmInfo::InitCharmCreateSpells() m_charmspells[x].SetActionAndType(spellId, ACT_DISABLED); ActiveStates newstate; - bool onlyselfcast = true; + bool onlyselfcast = true; for (uint32 i = 0; i < 3 && onlyselfcast; ++i) // nonexistent spell will not make any problems as onlyselfcast would be false -> break right away { @@ -11191,7 +11191,7 @@ bool Unit::IsShapeShifted() const // Mirroring clientside gameplay logic if (ShapeshiftForm form = GetShapeshiftForm()) { - if (SpellShapeshiftFormEntry const* entry = sSpellShapeshiftFormStore.LookupEntry(form)) + if (SpellShapeshiftFormEntry const* entry = sDBCSpellShapeshiftForm.LookupEntry(form)) return !(entry->flags1 & SHAPESHIFT_FORM_FLAG_ALLOW_ACTIVITY); } return false; @@ -11879,7 +11879,7 @@ void Unit::Uncharm(Unit* charmed, uint32 spellId) // if charm expires mid evade clear evade since movement is also cleared // TODO: maybe should be done on HomeMovementGenerator::MovementExpires - charmed->GetCombatManager().SetEvadeState(EVADE_NONE); + charmed->GetCombatManager().SetEvadeState(EVADE_NONE); if (charmed->GetTypeId() == TYPEID_UNIT) { @@ -11987,7 +11987,7 @@ void Unit::Uncharm(Unit* charmed, uint32 spellId) Position const& pos = charmInfo->GetCharmStartPosition(); if (!pos.IsEmpty()) static_cast(charmed)->SetCombatStartPosition(pos); - } + } } } else @@ -12135,8 +12135,8 @@ float Unit::OCTRegenHPPerSpirit() const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtOCTRegenHPEntry const* baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); - GtRegenHPPerSptEntry const* moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); + GtOCTRegenHPEntry const* baseRatio = sDBCgtOCTRegenHP.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); + GtRegenHPPerSptEntry const* moreRatio = sDBCgtRegenHPPerSpt.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); if (baseRatio == nullptr || moreRatio == nullptr) return 0.0f; @@ -12157,7 +12157,7 @@ float Unit::OCTRegenMPPerSpirit() const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; // GtOCTRegenMPEntry const *baseRatio = sGtOCTRegenMPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); - GtRegenMPPerSptEntry const* moreRatio = sGtRegenMPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); + GtRegenMPPerSptEntry const* moreRatio = sDBCgtRegenMPPerSpt.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); if (moreRatio == nullptr) return 0.0f; @@ -12173,13 +12173,13 @@ float Unit::GetCollisionHeight() const if (IsMounted()) { - if (CreatureDisplayInfoEntry const* mountDisplayInfo = sCreatureDisplayInfoStore.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID))) + if (CreatureDisplayInfoEntry const* mountDisplayInfo = sDBCCreatureDisplayInfo.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID))) { - if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId)) + if (CreatureModelDataEntry const* mountModelData = sDBCCreatureModelData.LookupEntry(mountDisplayInfo->ModelId)) { - CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()); + CreatureDisplayInfoEntry const* displayInfo = sDBCCreatureDisplayInfo.LookupEntry(GetNativeDisplayId()); MANGOS_ASSERT(displayInfo); - CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId); + CreatureModelDataEntry const* modelData = sDBCCreatureModelData.LookupEntry(displayInfo->ModelId); MANGOS_ASSERT(modelData); float const collisionHeight = scaleMod * (mountModelData->MountHeight + modelData->CollisionHeight * modelData->Scale * displayInfo->scale * 0.5f); return collisionHeight == 0.0f ? DEFAULT_COLLISION_HEIGHT : collisionHeight; @@ -12188,9 +12188,9 @@ float Unit::GetCollisionHeight() const } //! Dismounting case - use basic default model data - CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()); + CreatureDisplayInfoEntry const* displayInfo = sDBCCreatureDisplayInfo.LookupEntry(GetNativeDisplayId()); MANGOS_ASSERT(displayInfo); - CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId); + CreatureModelDataEntry const* modelData = sDBCCreatureModelData.LookupEntry(displayInfo->ModelId); MANGOS_ASSERT(modelData); float const collisionHeight = scaleMod * modelData->CollisionHeight * modelData->Scale * displayInfo->scale; diff --git a/src/game/GMTickets/GMTicketHandler.cpp b/src/game/GMTickets/GMTicketHandler.cpp index 50efb9d8b46..159c2cb7fc0 100644 --- a/src/game/GMTickets/GMTicketHandler.cpp +++ b/src/game/GMTickets/GMTicketHandler.cpp @@ -231,13 +231,13 @@ void WorldSession::HandleGMSurveySubmitOpcode(WorldPacket& recv_data) // Perform some sanity checks on the input: - GMSurveyCurrentSurveyEntry const* currentSurvey = sGMSurveyCurrentSurveyStore.LookupEntry(uint32(m_sessionDbcLocale)); + GMSurveyCurrentSurveyEntry const* currentSurvey = sDBCGMSurveyCurrentSurvey.LookupEntry(uint32(m_sessionDbcLocale)); // Check if survey id is correct if (!currentSurvey || currentSurvey->surveyID != surveyId) return; - GMSurveyEntry const* survey = sGMSurveySurveysStore.LookupEntry(surveyId); + GMSurveyEntry const* survey = sDBCGMSurveySurveys.LookupEntry(surveyId); // Check if survey entry with provided id exists if (!survey) diff --git a/src/game/GMTickets/GMTicketMgr.cpp b/src/game/GMTickets/GMTicketMgr.cpp index e1b0107c190..8796739d8c5 100644 --- a/src/game/GMTickets/GMTicketMgr.cpp +++ b/src/game/GMTickets/GMTicketMgr.cpp @@ -350,7 +350,7 @@ void GMTicketMgr::LoadGMTickets() } BarGoLink bar(result->GetRowCount()); - + do { bar.step(); @@ -455,7 +455,7 @@ const std::string GMTicketMgr::PrintMailResponse(GMTicket const& ticket, bool re const char* GMTicketMgr::PrintTicketCategory(GMTicket const& ticket, LocaleConstant locale/* = LOCALE_DEFAULT*/) { - if (GMTicketCategoryEntry const* entry = sGMTicketCategoryStore.LookupEntry(ticket.GetCategory())) + if (GMTicketCategoryEntry const* entry = sDBCGMTicketCategory.LookupEntry(ticket.GetCategory())) { if (!std::string(entry->name[locale]).empty()) return entry->name[locale]; diff --git a/src/game/GameEvents/GameEventMgr.cpp b/src/game/GameEvents/GameEventMgr.cpp index 5d7c3088fd3..19f7ed04e3f 100644 --- a/src/game/GameEvents/GameEventMgr.cpp +++ b/src/game/GameEvents/GameEventMgr.cpp @@ -164,7 +164,7 @@ void GameEventMgr::LoadFromDB() gameEvent.start = time_t(FAR_FUTURE); gameEvent.occurence = gameEvent.length; } - + if (gameEvent.length == 0 && gameEvent.scheduleType != GAME_EVENT_SCHEDULE_SERVERSIDE) // length>0 is validity check { sLog.outErrorDb("`game_event` game event id (%i) have length 0 and can't be used.", event_id); @@ -608,7 +608,7 @@ void GameEventMgr::LoadFromDB() continue; } - if (!sMailTemplateStore.LookupEntry(mail.mailTemplateId)) + if (!sDBCMailTemplate.LookupEntry(mail.mailTemplateId)) { sLog.outErrorDb("Table `game_event_mail` have invalid mailTemplateId (%u) for game event %i that invalid not include any player races, ignoring.", mail.mailTemplateId, event_id); continue; diff --git a/src/game/Globals/Conditions.cpp b/src/game/Globals/Conditions.cpp index f06c96568be..baa8b73abda 100644 --- a/src/game/Globals/Conditions.cpp +++ b/src/game/Globals/Conditions.cpp @@ -707,7 +707,7 @@ bool ConditionEntry::IsValid() const case CONDITION_SKILL: case CONDITION_SKILL_BELOW: { - SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(m_value1); + SkillLineEntry const* pSkill = sDBCSkillLine.LookupEntry(m_value1); if (!pSkill) { sLog.outErrorDb("Skill condition (entry %u, type %u) specifies non-existing skill (%u), skipped", m_entry, m_condition, m_value1); diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index 17a622e3cc8..d171d38e3be 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -518,7 +518,7 @@ void ObjectMgr::LoadCreatureTemplates() heroicEntries.insert(cInfo->HeroicEntry); } - FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->Faction); + FactionTemplateEntry const* factionTemplate = sDBCFactionTemplate.LookupEntry(cInfo->Faction); if (!factionTemplate) sLog.outErrorDb("Creature (Entry: %u) has nonexistent faction_A template (%u)", cInfo->Entry, cInfo->Faction); @@ -541,7 +541,7 @@ void ObjectMgr::LoadCreatureTemplates() { if (cInfo->ModelId[j]) { - CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->ModelId[j]); + CreatureDisplayInfoEntry const* displayEntry = sDBCCreatureDisplayInfo.LookupEntry(cInfo->ModelId[j]); if (!displayEntry) { sLog.outErrorDb("Creature (Entry: %u) has nonexistent modelid_%d (%u), can crash client", cInfo->Entry, j + 1, cInfo->ModelId[j]); @@ -625,14 +625,14 @@ void ObjectMgr::LoadCreatureTemplates() if ((cInfo->NpcFlags & UNIT_NPC_FLAG_TRAINER) && cInfo->TrainerType >= MAX_TRAINER_TYPE) sLog.outErrorDb("Creature (Entry: %u) has wrong trainer type %u", cInfo->Entry, cInfo->TrainerType); - if (cInfo->CreatureType && !sCreatureTypeStore.LookupEntry(cInfo->CreatureType)) + if (cInfo->CreatureType && !sDBCCreatureType.LookupEntry(cInfo->CreatureType)) { sLog.outErrorDb("Creature (Entry: %u) has invalid creature type (%u) in `type`", cInfo->Entry, cInfo->CreatureType); const_cast(cInfo)->CreatureType = CREATURE_TYPE_HUMANOID; } // must exist or used hidden but used in data horse case - if (cInfo->Family && !sCreatureFamilyStore.LookupEntry(cInfo->Family) && cInfo->Family != CREATURE_FAMILY_HORSE_CUSTOM) + if (cInfo->Family && !sDBCCreatureFamily.LookupEntry(cInfo->Family) && cInfo->Family != CREATURE_FAMILY_HORSE_CUSTOM) { sLog.outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`", cInfo->Entry, cInfo->Family); const_cast(cInfo)->Family = 0; @@ -646,7 +646,7 @@ void ObjectMgr::LoadCreatureTemplates() if (cInfo->PetSpellDataId) { - CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId); + CreatureSpellDataEntry const* spellDataId = sDBCCreatureSpellData.LookupEntry(cInfo->PetSpellDataId); if (!spellDataId) sLog.outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u)", cInfo->Entry, cInfo->PetSpellDataId); } @@ -747,7 +747,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* continue; } - if (SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(AdditionalSpellInfo->CastingTimeIndex)) + if (SpellCastTimesEntry const* spellCastTimeEntry = sDBCSpellCastTimes.LookupEntry(AdditionalSpellInfo->CastingTimeIndex)) { if (spellCastTimeEntry->CastTime > 0) { @@ -789,7 +789,7 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons if (addon->mount) { - if (!sCreatureDisplayInfoStore.LookupEntry(addon->mount)) + if (!sDBCCreatureDisplayInfo.LookupEntry(addon->mount)) { sLog.outErrorDb("Creature (%s %u) have invalid displayInfoId for mount (%u) defined in `%s`.", entryName, addon->guidOrEntry, addon->mount, creatureaddons.GetTableName()); const_cast(addon)->mount = 0; @@ -799,7 +799,7 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons if (addon->sheath_state > SHEATH_STATE_RANGED) sLog.outErrorDb("Creature (%s %u) has unknown sheath state (%u) defined in `%s`.", entryName, addon->guidOrEntry, addon->sheath_state, creatureaddons.GetTableName()); - if (!sEmotesStore.LookupEntry(addon->emote)) + if (!sDBCEmotes.LookupEntry(addon->emote)) { sLog.outErrorDb("Creature (%s %u) have invalid emote (%u) defined in `%s`.", entryName, addon->guidOrEntry, addon->emote, creatureaddons.GetTableName()); const_cast(addon)->emote = 0; @@ -1028,7 +1028,7 @@ void ObjectMgr::LoadCreatureModelInfo() // post processing for (auto minfo : sCreatureModelStorage) { - if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid)) + if (!sDBCCreatureDisplayInfo.LookupEntry(minfo->modelid)) sLog.outErrorDb("Table `creature_model_info` has model for nonexistent model id (%u).", minfo->modelid); if (minfo->gender >= MAX_GENDER) @@ -1044,7 +1044,7 @@ void ObjectMgr::LoadCreatureModelInfo() sLog.outErrorDb("Table `creature_model_info` has redundant modelid_other_gender model (%u) defined for model id %u.", minfo->modelid_other_gender, minfo->modelid); const_cast(minfo)->modelid_other_gender = 0; } - else if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_other_gender)) + else if (!sDBCCreatureDisplayInfo.LookupEntry(minfo->modelid_other_gender)) { sLog.outErrorDb("Table `creature_model_info` has nonexistent modelid_other_gender model (%u) defined for model id %u.", minfo->modelid_other_gender, minfo->modelid); const_cast(minfo)->modelid_other_gender = 0; @@ -1058,7 +1058,7 @@ void ObjectMgr::LoadCreatureModelInfo() sLog.outErrorDb("Table `creature_model_info` has redundant modelid_alternative model (%u) defined for model id %u.", minfo->modelid_alternative, minfo->modelid); const_cast(minfo)->modelid_alternative = 0; } - else if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_alternative)) + else if (!sDBCCreatureDisplayInfo.LookupEntry(minfo->modelid_alternative)) { sLog.outErrorDb("Table `creature_model_info` has nonexistent modelid_alternative model (%u) defined for model id %u.", minfo->modelid_alternative, minfo->modelid); const_cast(minfo)->modelid_alternative = 0; @@ -1067,9 +1067,9 @@ void ObjectMgr::LoadCreatureModelInfo() } // character races expected have model info data in table - for (uint32 race = 1; race < sChrRacesStore.GetNumRows(); ++race) + for (uint32 race = 1; race < sDBCChrRaces.GetNumRows(); ++race) { - ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race); + ChrRacesEntry const* raceEntry = sDBCChrRaces.LookupEntry(race); if (!raceEntry) continue; @@ -1150,7 +1150,7 @@ void ObjectMgr::LoadCreatureModelRace() raceData.creature_entry = fields[2].GetUInt32(); raceData.modelid_racial = fields[3].GetUInt32(); - if (!sCreatureDisplayInfoStore.LookupEntry(raceData.modelid)) + if (!sDBCCreatureDisplayInfo.LookupEntry(raceData.modelid)) { sLog.outErrorDb("Table `creature_model_race` has model for nonexistent model id (%u), skipping", raceData.modelid); continue; @@ -1202,7 +1202,7 @@ void ObjectMgr::LoadCreatureModelRace() } else if (raceData.modelid_racial) { - if (!sCreatureDisplayInfoStore.LookupEntry(raceData.modelid_racial)) + if (!sDBCCreatureDisplayInfo.LookupEntry(raceData.modelid_racial)) { sLog.outErrorDb("Table `creature_model_race` modelid %u has modelid_racial for nonexistent model id (%u), skipping", raceData.modelid, raceData.modelid_racial); continue; @@ -1452,7 +1452,7 @@ void ObjectMgr::LoadCreatures() data.spawnTemplate = GetCreatureSpawnTemplate(0); uint32 spawnDataEntry = fields[21].GetUInt32(); - MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(data.mapid); if (!mapEntry) { sLog.outErrorDb("Table `creature` have creature (GUID: %u) that spawned at nonexistent map (Id: %u), skipped.", guid, data.mapid); @@ -1489,7 +1489,7 @@ void ObjectMgr::LoadCreatures() continue; } - if (data.modelid_override > 0 && !sCreatureDisplayInfoStore.LookupEntry(data.modelid_override)) + if (data.modelid_override > 0 && !sDBCCreatureDisplayInfo.LookupEntry(data.modelid_override)) { sLog.outErrorDb("Table `creature` GUID %u (entry %u) has model for nonexistent model id (%u), set to 0.", guid, data.id, data.modelid_override); data.modelid_override = 0; @@ -1651,7 +1651,7 @@ void ObjectMgr::LoadGameObjects() continue; } - if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) + if (gInfo->displayId && !sDBCGameObjectDisplayInfo.LookupEntry(gInfo->displayId)) { sLog.outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) have invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); continue; @@ -1678,7 +1678,7 @@ void ObjectMgr::LoadGameObjects() data.GuidPoolId = fields[17].GetInt16(); data.EntryPoolId = fields[18].GetInt16(); - MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(data.mapid); if (!mapEntry) { sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) that spawned at nonexistent map (Id: %u), skip", guid, data.id, data.mapid); @@ -2010,7 +2010,7 @@ void ObjectMgr::LoadItemPrototypes() // check data correctness for (auto proto : sItemStorage) { - ItemEntry const* dbcitem = sItemStore.LookupEntry(proto->ItemId); + ItemEntry const* dbcitem = sDBCItem.LookupEntry(proto->ItemId); if (!proto) { /* to many errors, and possible not all items really used in game @@ -2307,7 +2307,7 @@ void ObjectMgr::LoadItemPrototypes() sLog.outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", proto->ItemId, proto->PageText); } - if (proto->LockID && !sLockStore.LookupEntry(proto->LockID)) + if (proto->LockID && !sDBCLock.LookupEntry(proto->LockID)) sLog.outErrorDb("Item (Entry: %u) has wrong LockID (%u)", proto->ItemId, proto->LockID); if (proto->Sheath >= MAX_SHEATHETYPE) @@ -2316,13 +2316,13 @@ void ObjectMgr::LoadItemPrototypes() const_cast(proto)->Sheath = SHEATHETYPE_NONE; } - if (proto->RandomProperty && !sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(proto->RandomProperty))) + if (proto->RandomProperty && !sDBCItemRandomProperties.LookupEntry(GetItemEnchantMod(proto->RandomProperty))) { sLog.outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", proto->ItemId, proto->RandomProperty); const_cast(proto)->RandomProperty = 0; } - if (proto->RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(proto->RandomSuffix))) + if (proto->RandomSuffix && !sDBCItemRandomSuffix.LookupEntry(GetItemEnchantMod(proto->RandomSuffix))) { sLog.outErrorDb("Item (Entry: %u) has wrong RandomSuffix (%u)", proto->ItemId, proto->RandomSuffix); const_cast(proto)->RandomSuffix = 0; @@ -2336,7 +2336,7 @@ void ObjectMgr::LoadItemPrototypes() const_cast(proto)->RandomSuffix = 0; } - if (proto->ItemSet && !sItemSetStore.LookupEntry(proto->ItemSet)) + if (proto->ItemSet && !sDBCItemSet.LookupEntry(proto->ItemSet)) { sLog.outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", proto->ItemId, proto->ItemSet); const_cast(proto)->ItemSet = 0; @@ -2345,7 +2345,7 @@ void ObjectMgr::LoadItemPrototypes() if (proto->Area && !GetAreaEntryByAreaID(proto->Area)) sLog.outErrorDb("Item (Entry: %u) has wrong Area (%u)", proto->ItemId, proto->Area); - if (proto->Map && !sMapStore.LookupEntry(proto->Map)) + if (proto->Map && !sDBCMap.LookupEntry(proto->Map)) sLog.outErrorDb("Item (Entry: %u) has wrong Map (%u)", proto->ItemId, proto->Map); if (proto->BagFamily) @@ -2357,7 +2357,7 @@ void ObjectMgr::LoadItemPrototypes() if (!(proto->BagFamily & mask)) continue; - ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j + 1); + ItemBagFamilyEntry const* bf = sDBCItemBagFamily.LookupEntry(j + 1); if (!bf) { sLog.outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", proto->ItemId); @@ -2366,7 +2366,7 @@ void ObjectMgr::LoadItemPrototypes() } } - if (proto->TotemCategory && !sTotemCategoryStore.LookupEntry(proto->TotemCategory)) + if (proto->TotemCategory && !sDBCTotemCategory.LookupEntry(proto->TotemCategory)) sLog.outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", proto->ItemId, proto->TotemCategory); for (int j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j) @@ -2378,7 +2378,7 @@ void ObjectMgr::LoadItemPrototypes() } } - if (proto->GemProperties && !sGemPropertiesStore.LookupEntry(proto->GemProperties)) + if (proto->GemProperties && !sDBCGemProperties.LookupEntry(proto->GemProperties)) sLog.outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", proto->ItemId, proto->GemProperties); if (proto->RequiredDisenchantSkill < -1) @@ -2722,7 +2722,7 @@ void ObjectMgr::LoadPlayerInfo() float positionZ = fields[6].GetFloat(); float orientation = fields[7].GetFloat(); - ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); + ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.", current_race); @@ -2743,7 +2743,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - if (sMapStore.LookupEntry(mapId)->Instanceable()) + if (sDBCMap.LookupEntry(mapId)->Instanceable()) { sLog.outErrorDb("Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); continue; @@ -2799,7 +2799,7 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt32(); uint32 current_class = fields[1].GetUInt32(); - ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); + ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race); @@ -2891,7 +2891,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - if (!sSkillLineStore.LookupEntry(skill.SkillId)) + if (!sDBCSkillLine.LookupEntry(skill.SkillId)) { sLog.outErrorDb("Non existing skill %u in `playercreateinfo_skills` table, ignoring.", skill.SkillId); continue; @@ -2924,7 +2924,7 @@ void ObjectMgr::LoadPlayerInfo() if (skill.Step) { const uint32 stepIndex = (skill.Step - 1); - SkillTiersEntry const* steps = sSkillTiersStore.LookupEntry(entry->skillTierId); + SkillTiersEntry const* steps = sDBCSkillTiers.LookupEntry(entry->skillTierId); if (!steps || !steps->maxSkillValue[stepIndex]) continue; @@ -2981,7 +2981,7 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt32(); uint32 current_class = fields[1].GetUInt32(); - ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); + ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race); @@ -3043,7 +3043,7 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt32(); uint32 current_class = fields[1].GetUInt32(); - ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); + ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race); @@ -3204,7 +3204,7 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt32(); uint32 current_class = fields[1].GetUInt32(); - ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); + ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.", current_race); @@ -3256,7 +3256,7 @@ void ObjectMgr::LoadPlayerInfo() for (int race = 1; race < MAX_RACES; ++race) { // skip nonexistent races - if (!((1 << (race - 1)) & RACEMASK_ALL_PLAYABLE) || !sChrRacesStore.LookupEntry(race)) + if (!((1 << (race - 1)) & RACEMASK_ALL_PLAYABLE) || !sDBCChrRaces.LookupEntry(race)) continue; for (int class_ = 1; class_ < MAX_CLASSES; ++class_) @@ -3693,7 +3693,7 @@ void ObjectMgr::LoadGroups() } } - MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapId); if (!mapEntry || !mapEntry->IsDungeon()) { sLog.outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", mapId); @@ -3872,7 +3872,7 @@ void ObjectMgr::LoadQuests() // client quest log visual (sort case) if (qinfo->ZoneOrSort < 0) { - QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort)); + QuestSortEntry const* qSort = sDBCQuestSort.LookupEntry(-int32(qinfo->ZoneOrSort)); if (!qSort) { sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", @@ -3904,7 +3904,7 @@ void ObjectMgr::LoadQuests() // RequiredSkill, can be 0 if (qinfo->RequiredSkill) { - if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkill)) + if (!sDBCSkillLine.LookupEntry(qinfo->RequiredSkill)) { sLog.outErrorDb("Quest %u has `RequiredSkill` = %u but this skill does not exist", qinfo->GetQuestId(), qinfo->RequiredSkill); @@ -4294,7 +4294,7 @@ void ObjectMgr::LoadQuests() if (qinfo->RewMailTemplateId) { - if (!sMailTemplateStore.LookupEntry(qinfo->RewMailTemplateId)) + if (!sDBCMailTemplate.LookupEntry(qinfo->RewMailTemplateId)) { sLog.outErrorDb("Quest %u has `RewMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", qinfo->GetQuestId(), qinfo->RewMailTemplateId, qinfo->RewMailTemplateId); @@ -4571,7 +4571,7 @@ void ObjectMgr::LoadPetCreateSpells() continue; } - if (CreatureSpellDataEntry const* petSpellEntry = cInfo->PetSpellDataId ? sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId) : nullptr) + if (CreatureSpellDataEntry const* petSpellEntry = cInfo->PetSpellDataId ? sDBCCreatureSpellData.LookupEntry(cInfo->PetSpellDataId) : nullptr) { sLog.outErrorDb("Creature id %u listed in `petcreateinfo_spell` have set `PetSpellDataId` field and will use its instead, skip.", creature_id); continue; @@ -4634,7 +4634,7 @@ void ObjectMgr::LoadPetCreateSpells() uint32 dcount = 0; for (auto cInfo : sCreatureStorage) { - CreatureSpellDataEntry const* petSpellEntry = cInfo->PetSpellDataId ? sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId) : nullptr; + CreatureSpellDataEntry const* petSpellEntry = cInfo->PetSpellDataId ? sDBCCreatureSpellData.LookupEntry(cInfo->PetSpellDataId) : nullptr; if (!petSpellEntry) continue; @@ -4877,7 +4877,7 @@ void ObjectMgr::LoadInstanceTemplate() for (auto temp : sInstanceTemplate) { - MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map); + MapEntry const* mapEntry = sDBCMap.LookupEntry(temp->map); if (!mapEntry) { sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", temp->map); @@ -4895,7 +4895,7 @@ void ObjectMgr::LoadInstanceTemplate() if (temp->parent > 0) { // check existence - MapEntry const* parentEntry = sMapStore.LookupEntry(temp->parent); + MapEntry const* parentEntry = sDBCMap.LookupEntry(temp->parent); if (!parentEntry) { sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad parent map id %u for instance template %d template!", @@ -4952,7 +4952,7 @@ void ObjectMgr::LoadWorldTemplate() for (auto temp : sWorldTemplate) { - MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map); + MapEntry const* mapEntry = sDBCMap.LookupEntry(temp->map); if (!mapEntry) { sLog.outErrorDb("ObjectMgr::LoadWorldTemplate: bad mapid %d for template!", temp->map); @@ -5276,7 +5276,7 @@ void ObjectMgr::LoadQuestgiverGreeting() continue; } - if (!sEmotesStore.LookupEntry(emoteId)) + if (!sDBCEmotes.LookupEntry(emoteId)) { sLog.outErrorEventAI("Table questgiver_greeting entry %u type %u uses invalid emote %u. Skipping.", entry, type, emoteId); continue; @@ -5810,7 +5810,7 @@ void ObjectMgr::LoadTaxiShortcuts() uint32 takeoff = fields[1].GetUInt32(); uint32 landing = fields[2].GetUInt32(); - TaxiPathEntry const* path = sTaxiPathStore.LookupEntry(pathid); + TaxiPathEntry const* path = sDBCTaxiPath.LookupEntry(pathid); if (!path) { sLog.outErrorDb("Table `taxi_shortcuts` has a record for non-existent taxi path id %u, skipped.", pathid); @@ -5849,14 +5849,13 @@ uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, Te float dist = std::numeric_limits::max(); uint32 id = 0; - for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i) + for (auto node : sDBCTaxiNodes) { - TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i); - if (!node || node->map_id != mapid || !node->MountCreatureID[team == ALLIANCE ? 1 : 0]) + if (node->map_id != mapid || !node->MountCreatureID[team == ALLIANCE ? 1 : 0]) continue; - uint8 field = (uint8)((i - 1) / 32); - uint32 submask = 1 << ((i - 1) % 32); + uint8 field = (uint8)((node->ID - 1) / 32); + uint32 submask = 1 << ((node->ID - 1) % 32); // skip not taxi network nodes if ((sTaxiNodesMask[field] & submask) == 0) @@ -5868,14 +5867,14 @@ uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, Te if (dist2 < dist) { dist = dist2; - id = i; + id = node->ID; } } else { found = true; dist = dist2; - id = i; + id = node->ID; } } @@ -5911,7 +5910,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, Team team) const uint16 mount_entry = 0; // select mount creature id - TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id); + TaxiNodesEntry const* node = sDBCTaxiNodes.LookupEntry(id); if (node) { if (team == ALLIANCE) @@ -6000,7 +5999,7 @@ void ObjectMgr::LoadGraveyardZones() continue; } - if (linkKind == GRAVEYARD_MAPLINK && sMapStore.LookupEntry(locId) == nullptr) + if (linkKind == GRAVEYARD_MAPLINK && sDBCMap.LookupEntry(locId) == nullptr) { sLog.outErrorDb("Table `game_graveyard_zone` has record for nonexistent map id (%u), skipped.", locId); continue; @@ -6051,7 +6050,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyardHelper( // some where other WorldSafeLocsEntry const* entryFar = nullptr; - MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapId); for (GraveYardMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) { @@ -6393,7 +6392,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() sLog.outErrorDb("Table `areatrigger_teleport` entry %u has `ConditionId` = %u but does not exist.", at.entry, at.conditionId); } - MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId); + MapEntry const* mapEntry = sDBCMap.LookupEntry(at.target_mapId); if (!mapEntry) { sLog.outErrorDb("Table `areatrigger_teleport` has nonexistent target map (ID: %u) for Area trigger (ID:%u).", at.target_mapId, at.entry); @@ -6421,7 +6420,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() */ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const { - const MapEntry* mapEntry = sMapStore.LookupEntry(map_id); + const MapEntry* mapEntry = sDBCMap.LookupEntry(map_id); if (!mapEntry || mapEntry->ghost_entrance_map < 0) return nullptr; @@ -6467,7 +6466,7 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const AreaTrigger const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const { AreaTrigger const* compareTrigger = nullptr; - MapEntry const* mEntry = sMapStore.LookupEntry(Map); + MapEntry const* mEntry = sDBCMap.LookupEntry(Map); for (const auto& mAreaTrigger : mAreaTriggers) { @@ -6746,7 +6745,7 @@ struct SQLGameObjectLoader : public SQLStorageLoaderBase ObjectMgr::LoadGameobjectInfo() { if (goInfo->spellFocus.focusId) { - if (!sSpellFocusObjectStore.LookupEntry(goInfo->spellFocus.focusId)) + if (!sDBCSpellFocusObject.LookupEntry(goInfo->spellFocus.focusId)) sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.", goInfo->id, goInfo->type, goInfo->spellFocus.focusId, goInfo->spellFocus.focusId); } @@ -8308,7 +8307,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min data.Emote = fields[13].GetUInt32(); uint32 broadcastTextId = fields[14].GetUInt32(); - if (data.SoundId && !sSoundEntriesStore.LookupEntry(data.SoundId)) + if (data.SoundId && !sDBCSoundEntries.LookupEntry(data.SoundId)) { _DoStringError(entry, "Entry %i in table `%s` has soundId %u but sound does not exist.", entry, table, data.SoundId); data.SoundId = 0; @@ -8326,7 +8325,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min data.Type = CHAT_TYPE_SAY; } - if (data.Emote && !sEmotesStore.LookupEntry(data.Emote)) + if (data.Emote && !sDBCEmotes.LookupEntry(data.Emote)) { _DoStringError(entry, "Entry %i in table `%s` has Emote %u but emote does not exist.", entry, table, data.Emote); data.Emote = EMOTE_ONESHOT_NONE; @@ -8648,7 +8647,7 @@ void ObjectMgr::LoadMailLevelRewards() continue; } - if (!sMailTemplateStore.LookupEntry(mailTemplateId)) + if (!sDBCMailTemplate.LookupEntry(mailTemplateId)) { sLog.outErrorDb("Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level); continue; @@ -9386,7 +9385,7 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32 return false; } - if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost)) + if (ExtendedCost && !sDBCItemExtendedCost.LookupEntry(ExtendedCost)) { if (pl) ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost); diff --git a/src/game/Groups/Group.cpp b/src/game/Groups/Group.cpp index 036470e54fe..22ec998db8e 100644 --- a/src/game/Groups/Group.cpp +++ b/src/game/Groups/Group.cpp @@ -1259,7 +1259,7 @@ void Group::ResetInstances(InstanceResetMethod method, Player* SendMsgTo) for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { DungeonPersistentState* state = itr->second.state; - const MapEntry* entry = sMapStore.LookupEntry(itr->first); + const MapEntry* entry = sDBCMap.LookupEntry(itr->first); if (!entry || (!state->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)) { ++itr; @@ -1329,7 +1329,7 @@ void Group::ResetInstances(InstanceResetMethod method, Player* SendMsgTo) InstanceGroupBind* Group::GetBoundInstance(uint32 mapid) { - MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); if (!mapEntry) return nullptr; @@ -1486,8 +1486,8 @@ void Group::RewardGroupAtKill(Unit* pVictim, Player* player_tap) uint32 xp = (PvP || !not_gray_member_with_max_level || pVictim->GetTypeId() != TYPEID_UNIT) ? 0 : MaNGOS::XP::Gain(not_gray_member_with_max_level, static_cast(pVictim)); /// skip in check PvP case (for speed, not used) - bool is_raid = PvP ? false : sMapStore.LookupEntry(pVictim->GetMapId())->IsRaid() && isRaidGroup(); - bool is_dungeon = PvP ? false : sMapStore.LookupEntry(pVictim->GetMapId())->IsDungeon(); + bool is_raid = PvP ? false : sDBCMap.LookupEntry(pVictim->GetMapId())->IsRaid() && isRaidGroup(); + bool is_dungeon = PvP ? false : sDBCMap.LookupEntry(pVictim->GetMapId())->IsDungeon(); float group_rate = MaNGOS::XP::xp_in_group_rate(count, is_raid); for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index 845cbd4e630..7778cdcd705 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -1211,7 +1211,7 @@ void Loot::Release(Player* player) float chance_rate = sWorld.getConfig(CONFIG_FLOAT_RATE_MINING_NEXT); int32 ReqValue = 175; - LockEntry const* lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId); + LockEntry const* lockInfo = sDBCLock.LookupEntry(go->GetGOInfo()->chest.lockId); if (lockInfo) ReqValue = lockInfo->Skill[0]; float skill = float(player->GetSkillValue(SKILL_MINING)) / (ReqValue + 25); @@ -2786,10 +2786,9 @@ void LoadLootTemplates_Mail() LootTemplates_Mail.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i) - if (sMailTemplateStore.LookupEntry(i)) - if (ids_set.find(i) != ids_set.end()) - ids_set.erase(i); + for (auto mailEntry : sDBCMailTemplate) + if (ids_set.find(mailEntry->ID) != ids_set.end()) + ids_set.erase(mailEntry->ID); // output error for any still listed (not referenced from appropriate table) ids LootTemplates_Mail.ReportUnusedIds(ids_set); diff --git a/src/game/Mails/MailHandler.cpp b/src/game/Mails/MailHandler.cpp index 1021180ce8e..c64644ab788 100644 --- a/src/game/Mails/MailHandler.cpp +++ b/src/game/Mails/MailHandler.cpp @@ -728,7 +728,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recv_data) // in mail template case we need create new item text if (!itemTextId) { - MailTemplateEntry const* mailTemplateEntry = sMailTemplateStore.LookupEntry(m->mailTemplateId); + MailTemplateEntry const* mailTemplateEntry = sDBCMailTemplate.LookupEntry(m->mailTemplateId); if (!mailTemplateEntry) { pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR); diff --git a/src/game/Maps/GridMap.cpp b/src/game/Maps/GridMap.cpp index 7596b032816..267338d7f1f 100644 --- a/src/game/Maps/GridMap.cpp +++ b/src/game/Maps/GridMap.cpp @@ -558,7 +558,7 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re int idx = (x_int >> 3) * 16 + (y_int >> 3); uint8 type = m_liquidFlags ? m_liquidFlags[idx] : m_liquidGlobalFlags; uint32 entry = m_liquidEntry ? m_liquidEntry[idx] : m_liquidGlobalEntry; - if (LiquidTypeEntry const* liquidEntry = sLiquidTypeStore.LookupEntry(entry)) + if (LiquidTypeEntry const* liquidEntry = sDBCLiquidType.LookupEntry(entry)) { entry = liquidEntry->Id; type &= MAP_LIQUID_TYPE_DEEP_WATER; @@ -575,7 +575,7 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re overrideLiquid = area->LiquidTypeOverride[entry - 1]; } - if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid)) + if (LiquidTypeEntry const* liq = sDBCLiquidType.LookupEntry(overrideLiquid)) { entry = overrideLiquid; liqTypeIdx = liq->Type; @@ -992,7 +992,7 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint if (data) { uint32 liquidFlagType = 0; - if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquid_type)) + if (LiquidTypeEntry const* liq = sDBCLiquidType.LookupEntry(liquid_type)) liquidFlagType = liq->Type; if (liquid_type && liquid_type < 21) @@ -1007,7 +1007,7 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint overrideLiquid = area->LiquidTypeOverride[liquid_type - 1]; } - if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid)) + if (LiquidTypeEntry const* liq = sDBCLiquidType.LookupEntry(overrideLiquid)) { liquid_type = overrideLiquid; liquidFlagType = liq->Type; @@ -1190,7 +1190,7 @@ GridMap* TerrainInfo::LoadMapAndVMap(const uint32 x, const uint32 y, bool mapOnl if (!VMAP::VMapFactory::createOrGetVMapManager()->IsTileLoaded(m_mapId, x, y)) { // load VMAPs for current map/grid... - const MapEntry* i_mapEntry = sMapStore.LookupEntry(m_mapId); + const MapEntry* i_mapEntry = sDBCMap.LookupEntry(m_mapId); const char* mapName = i_mapEntry ? i_mapEntry->name[sWorld.GetDefaultDbcLocale()] : "UNNAMEDMAP\x0"; int vmapLoadResult = VMAP::VMapFactory::createOrGetVMapManager()->loadMap((sWorld.GetDataPath() + "vmaps").c_str(), m_mapId, x, y); diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index c76c19f2210..e1a4fb829e3 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -143,7 +143,7 @@ void Map::LoadMapAndVMap(int gx, int gy) } Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode) - : i_mapEntry(sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), + : i_mapEntry(sDBCMap.LookupEntry(id)), i_spawnMode(SpawnMode), i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0), m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE), m_persistentState(nullptr), m_activeNonPlayersIter(m_activeNonPlayers.end()), m_onEventNotifiedIter(m_onEventNotifiedObjects.end()), diff --git a/src/game/Maps/MapManager.cpp b/src/game/Maps/MapManager.cpp index 62bd659387f..7e2ace4c109 100644 --- a/src/game/Maps/MapManager.cpp +++ b/src/game/Maps/MapManager.cpp @@ -114,7 +114,7 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj) Map* m = nullptr; - const MapEntry* entry = sMapStore.LookupEntry(id); + const MapEntry* entry = sDBCMap.LookupEntry(id); if (!entry) return nullptr; @@ -242,7 +242,7 @@ bool MapManager::ExistMapAndVMap(uint32 mapid, float x, float y) bool MapManager::IsValidMAP(uint32 mapid) { - MapEntry const* mEntry = sMapStore.LookupEntry(mapid); + MapEntry const* mEntry = sDBCMap.LookupEntry(mapid); return mEntry && (!mEntry->IsDungeon() || ObjectMgr::GetInstanceTemplate(mapid)); // TODO: add check for battleground template } @@ -310,7 +310,7 @@ Map* MapManager::CreateInstance(uint32 id, Player* player) Map* map = nullptr; Map* pNewMap = nullptr; uint32 NewInstanceId = 0; // instanceId of the resulting map - const MapEntry* entry = sMapStore.LookupEntry(id); + const MapEntry* entry = sDBCMap.LookupEntry(id); if (entry->IsBattleGroundOrArena()) { @@ -352,7 +352,7 @@ Map* MapManager::CreateInstance(uint32 id, Player* player) DungeonMap* MapManager::CreateDungeonMap(uint32 id, uint32 InstanceId, Difficulty difficulty, DungeonPersistentState* save) { // make sure we have a valid map id - const MapEntry* entry = sMapStore.LookupEntry(id); + const MapEntry* entry = sDBCMap.LookupEntry(id); if (!entry) { sLog.outError("CreateDungeonMap: no entry for map %d", id); diff --git a/src/game/Maps/MapPersistentStateMgr.cpp b/src/game/Maps/MapPersistentStateMgr.cpp index 100040c50ed..9c340f82e28 100644 --- a/src/game/Maps/MapPersistentStateMgr.cpp +++ b/src/game/Maps/MapPersistentStateMgr.cpp @@ -56,7 +56,7 @@ MapPersistentState::~MapPersistentState() MapEntry const* MapPersistentState::GetMapEntry() const { - return sMapStore.LookupEntry(m_mapid); + return sDBCMap.LookupEntry(m_mapid); } /* true if the instance state is still valid */ @@ -281,7 +281,7 @@ InstanceTemplate const* DungeonPersistentState::GetTemplate() const time_t DungeonPersistentState::GetResetTimeForDB() const { // only state the reset time for normal instances - const MapEntry* entry = sMapStore.LookupEntry(GetMapId()); + const MapEntry* entry = sDBCMap.LookupEntry(GetMapId()); if (!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC) return 0; return GetResetTime(); @@ -362,7 +362,7 @@ void DungeonResetScheduler::LoadResetTimes() uint32 id = (*result)[0].GetUInt32(); uint32 mapid = (*result)[1].GetUInt32(); - MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); if (!mapEntry || !mapEntry->IsDungeon()) { @@ -406,7 +406,7 @@ void DungeonResetScheduler::LoadResetTimes() // load the global respawn times for raid/heroic instances uint32 diff = sWorld.getConfig(CONFIG_UINT32_INSTANCE_RESET_TIME_HOUR) * HOUR; - m_resetTimeByMapId.resize(sMapStore.GetNumRows() + 1); + m_resetTimeByMapId.resize(sDBCMap.GetNumRows() + 1); result = CharacterDatabase.Query("SELECT mapid, resettime FROM instance_reset"); if (result) { @@ -416,7 +416,7 @@ void DungeonResetScheduler::LoadResetTimes() uint32 mapid = fields[0].GetUInt32(); - MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); if (!mapEntry || !mapEntry->IsDungeon() || !ObjectMgr::GetInstanceTemplate(mapid)) { @@ -450,7 +450,7 @@ void DungeonResetScheduler::LoadResetTimes() continue; // only raid/heroic maps have a global reset time - MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map); + MapEntry const* mapEntry = sDBCMap.LookupEntry(temp->map); if (!mapEntry || !mapEntry->IsDungeon() || !mapEntry->HasResetTime()) continue; @@ -898,7 +898,7 @@ struct MapPersistantStateWarnWorker void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLeft) { // global reset for all instances of the given map - MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); if (!mapEntry->IsDungeon()) return; @@ -976,10 +976,9 @@ void MapPersistentStateManager::_CleanupExpiredInstancesAtTime(time_t t) void MapPersistentStateManager::InitWorldMaps() { MapPersistentState* state = nullptr; // need any from created for shared pool state - for (uint32 mapid = 0; mapid < sMapStore.GetNumRows(); ++mapid) - if (MapEntry const* entry = sMapStore.LookupEntry(mapid)) - if (!entry->Instanceable()) - state = AddPersistentState(entry, 0, REGULAR_DIFFICULTY, 0, false, false); + for (auto entry : sDBCMap) + if (!entry->Instanceable()) + state = AddPersistentState(entry, 0, REGULAR_DIFFICULTY, 0, false, false); } void MapPersistentStateManager::LoadCreatureRespawnTimes() @@ -1019,7 +1018,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes() if (!data) continue; - MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(data->mapid); if (!mapEntry) continue; @@ -1091,7 +1090,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes() if (!data) continue; - MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(data->mapid); if (!mapEntry) continue; diff --git a/src/game/Maps/MapPersistentStateMgr.h b/src/game/Maps/MapPersistentStateMgr.h index 525bfd62374..2d48c11b7c5 100644 --- a/src/game/Maps/MapPersistentStateMgr.h +++ b/src/game/Maps/MapPersistentStateMgr.h @@ -378,7 +378,7 @@ class MapPersistentStateManager : public MaNGOS::Singleton inline void MapPersistentStateManager::DoForAllStatesWithMapId(uint32 mapId, Do& _do) { - MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapId); if (!mapEntry) return; diff --git a/src/game/Maps/TransportMgr.cpp b/src/game/Maps/TransportMgr.cpp index cdd0796a64b..4e6eafa3291 100644 --- a/src/game/Maps/TransportMgr.cpp +++ b/src/game/Maps/TransportMgr.cpp @@ -27,9 +27,8 @@ void TransportMgr::LoadTransportAnimationAndRotation() { - for (uint32 i = 0; i < sTransportAnimationStore.GetNumRows(); ++i) - if (TransportAnimationEntry const* anim = sTransportAnimationStore.LookupEntry(i)) - AddPathNodeToTransport(anim->TransportEntry, anim->TimeSeg, anim); + for (auto anim : sDBCTransportAnimation) + AddPathNodeToTransport(anim->TransportEntry, anim->TimeSeg, anim); } TransportTemplate* TransportMgr::GetTransportTemplate(uint32 entry) @@ -127,12 +126,12 @@ bool TransportMgr::GenerateWaypoints(GameObjectInfo const* goinfo, TransportTemp if (transportTemplate.mapsUsed.size() > 1) { for (const auto itr : transportTemplate.mapsUsed) - MANGOS_ASSERT(!sMapStore.LookupEntry(itr)->Instanceable()); + MANGOS_ASSERT(!sDBCMap.LookupEntry(itr)->Instanceable()); transportTemplate.inInstance = false; } else - transportTemplate.inInstance = sMapStore.LookupEntry(*transportTemplate.mapsUsed.begin())->Instanceable(); + transportTemplate.inInstance = sDBCMap.LookupEntry(*transportTemplate.mapsUsed.begin())->Instanceable(); // last to first is always "teleport", even for closed paths keyFrames.back().Teleport = true; diff --git a/src/game/MotionGenerators/MovementHandler.cpp b/src/game/MotionGenerators/MovementHandler.cpp index 739479d267a..590a59e7eee 100644 --- a/src/game/MotionGenerators/MovementHandler.cpp +++ b/src/game/MotionGenerators/MovementHandler.cpp @@ -67,7 +67,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() } // get the destination map entry, not the current one, this will fix homebind and reset greeting - MapEntry const* mEntry = sMapStore.LookupEntry(loc.mapid); + MapEntry const* mEntry = sDBCMap.LookupEntry(loc.mapid); Map* map = nullptr; diff --git a/src/game/MotionGenerators/TargetedMovementGenerator.cpp b/src/game/MotionGenerators/TargetedMovementGenerator.cpp index dda20bbd151..47fce262c42 100644 --- a/src/game/MotionGenerators/TargetedMovementGenerator.cpp +++ b/src/game/MotionGenerators/TargetedMovementGenerator.cpp @@ -92,7 +92,7 @@ bool TargetedMovementGeneratorMedium::Update(T& owner, const uint32& time_ HandleTargetedMovement(owner, time_diff); - if (owner.movespline->Finalized() && !i_targetReached) + if (owner.movespline->Finalized() && !i_targetReached) HandleFinalizedMovement(owner); return true; @@ -728,7 +728,7 @@ bool FollowMovementGenerator::IsBoostAllowed(Unit& owner) const return false; // Do not allow speed boosting when in pvp instances - if (const MapEntry* map = sMapStore.LookupEntry(owner.GetMapId())) + if (const MapEntry* map = sDBCMap.LookupEntry(owner.GetMapId())) if (map->IsBattleGroundOrArena()) return false; diff --git a/src/game/PlayerBot/Base/PlayerbotAI.cpp b/src/game/PlayerBot/Base/PlayerbotAI.cpp index 0f15ae862e5..94eed4365f4 100644 --- a/src/game/PlayerBot/Base/PlayerbotAI.cpp +++ b/src/game/PlayerBot/Base/PlayerbotAI.cpp @@ -367,7 +367,7 @@ uint32 PlayerbotAI::initSpell(uint32 spellId) // Add spell to spellrange map Spell* spell = new Spell(m_bot, pSpellInfo, false); - SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(pSpellInfo->rangeIndex); + SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(pSpellInfo->rangeIndex); float range = GetSpellMaxRange(srange); if (Player* modOwner = m_bot->GetSpellModOwner()) modOwner->ApplySpellMod(pSpellInfo->Id, SPELLMOD_RANGE, range, spell); @@ -3962,7 +3962,7 @@ void PlayerbotAI::DoLoot() // check skill or lock on object uint32 lockId = go->GetGOInfo()->GetLockId(); - LockEntry const* lockInfo = sLockStore.LookupEntry(lockId); + LockEntry const* lockInfo = sDBCLock.LookupEntry(lockId); if (lockInfo) for (int i = 0; i < 8; ++i) { @@ -4503,7 +4503,7 @@ uint32 PlayerbotAI::EstRepair(uint16 pos) { ItemPrototype const* ditemProto = item->GetProto(); - DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); + DurabilityCostsEntry const* dcost = sDBCDurabilityCosts.LookupEntry(ditemProto->ItemLevel); if (!dcost) { sLog.outError("RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); @@ -4511,7 +4511,7 @@ uint32 PlayerbotAI::EstRepair(uint16 pos) } uint32 dQualitymodEntryId = (ditemProto->Quality + 1) * 2; - DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); + DurabilityQualityEntry const* dQualitymodEntry = sDBCDurabilityQuality.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { sLog.outError("RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); @@ -5423,7 +5423,7 @@ bool PlayerbotAI::In_Range(Unit* Target, uint32 spellId) if (!pSpellInfo) return false; - SpellRangeEntry const* TempRange = GetSpellRangeStore()->LookupEntry(pSpellInfo->rangeIndex); + SpellRangeEntry const* TempRange = sDBCSpellRange.LookupEntry(pSpellInfo->rangeIndex); //Spell has invalid range store so we can't use it if (!TempRange) @@ -5534,7 +5534,7 @@ SpellCastResult PlayerbotAI::CastSpell(uint32 spellId) float CastTime = 0.0f; // stop movement to prevent cancel spell casting - SpellCastTimesEntry const* castTimeEntry = sSpellCastTimesStore.LookupEntry(pSpellInfo->CastingTimeIndex); + SpellCastTimesEntry const* castTimeEntry = sDBCSpellCastTimes.LookupEntry(pSpellInfo->CastingTimeIndex); // stop movement to prevent cancel spell casting if (castTimeEntry && castTimeEntry->CastTime) { @@ -6319,7 +6319,7 @@ void PlayerbotAI::MakeItemLink(const Item* item, std::ostringstream& out, bool I uint32 eId = item->GetEnchantmentId(EnchantmentSlot(slot)); if (!eId) continue; - SpellItemEnchantmentEntry const* entry = sSpellItemEnchantmentStore.LookupEntry(eId); + SpellItemEnchantmentEntry const* entry = sDBCSpellItemEnchantment.LookupEntry(eId); if (!entry) continue; switch (slot - SOCK_ENCHANTMENT_SLOT) @@ -7142,7 +7142,7 @@ void PlayerbotAI::UseItem(Item* item, uint32 targetFlag, ObjectGuid targetGUID) return; } - SpellCastTimesEntry const* castingTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex); + SpellCastTimesEntry const* castingTimeEntry = sDBCSpellCastTimes.LookupEntry(spellInfo->CastingTimeIndex); if (!castingTimeEntry) { TellMaster("Can't find casting time entry for spell %u with index %u", spellId, spellInfo->CastingTimeIndex); @@ -9505,13 +9505,13 @@ void PlayerbotAI::_HandleCommandTalent(std::string& text, Player& fromPlayer) uint32 talentTabId = talentTabIds[i]; uint32 classMask = m_bot->getClassMask(); - for (uint32 ts = 0; ts < sTalentStore.GetNumRows(); ++ts) + for (uint32 ts = 0; ts < sDBCTalent.GetNumRows(); ++ts) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(ts); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(ts); if (!talentInfo) continue; - TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -9536,7 +9536,7 @@ void PlayerbotAI::_HandleCommandTalent(std::string& text, Player& fromPlayer) // Check if it requires another previous talent if (talentInfo->DependsOn > 0) { - if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) + if (TalentEntry const* depTalentInfo = sDBCTalent.LookupEntry(talentInfo->DependsOn)) { bool hasEnoughRank = false; for (int dor = talentInfo->DependsOnRank; dor < MAX_TALENT_RANK; ++dor) @@ -9561,11 +9561,11 @@ void PlayerbotAI::_HandleCommandTalent(std::string& text, Player& fromPlayer) uint32 tTab = talentInfo->TalentTab; if (talentInfo->Row > 0) { - unsigned int numRows = sTalentStore.GetNumRows(); + unsigned int numRows = sDBCTalent.GetNumRows(); for (unsigned int i = 0; i < numRows; ++i) // Loop through all talents. { // Someday, someone needs to revamp - const TalentEntry* tmpTalent = sTalentStore.LookupEntry(i); + const TalentEntry* tmpTalent = sDBCTalent.LookupEntry(i); if (tmpTalent) // the way talents are tracked { if (tmpTalent->TalentTab == tTab) @@ -10018,16 +10018,12 @@ void PlayerbotAI::_HandleCommandEnchant(std::string& text, Player& fromPlayer) ChatHandler ch(&fromPlayer); for (std::list::iterator it = m_spellsToLearn.begin(); it != m_spellsToLearn.end(); ++it) { - SkillLineEntry const* SkillLine = sSkillLineStore.LookupEntry(*it); + SkillLineEntry const* SkillLine = sDBCSkillLine.LookupEntry(*it); if (SkillLine->categoryId == SKILL_CATEGORY_PROFESSION && *it == SKILL_ENCHANTING) { - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + for (auto SkillAbility : sDBCSkillLineAbility) { - SkillLineAbilityEntry const* SkillAbility = sSkillLineAbilityStore.LookupEntry(j); - if (!SkillAbility) - continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SkillAbility->spellId); if (!spellInfo) continue; @@ -10216,28 +10212,24 @@ void PlayerbotAI::_HandleCommandCraft(std::string& text, Player& fromPlayer) ChatHandler ch(&fromPlayer); for (std::list::iterator it = m_spellsToLearn.begin(); it != m_spellsToLearn.end(); ++it) { - SkillLineEntry const* SkillLine = sSkillLineStore.LookupEntry(*it); + SkillLineEntry const* skillLine = sDBCSkillLine.LookupEntry(*it); - if (SkillLine->categoryId == category && *it == skill) + if (skillLine->categoryId == category && *it == skill) { - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + for (auto skillAbility : sDBCSkillLineAbility) { - SkillLineAbilityEntry const* SkillAbility = sSkillLineAbilityStore.LookupEntry(j); - if (!SkillAbility) - continue; - - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SkillAbility->spellId); + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillAbility->spellId); if (!spellInfo) continue; if (IsPrimaryProfessionSkill(*it) && spellInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_CREATE_ITEM) continue; - if (SkillAbility->skillId == *it && m_bot->HasSpell(SkillAbility->spellId) && SkillAbility->forward_spellid == 0 && ((SkillAbility->classmask & m_bot->getClassMask()) == 0)) + if (skillAbility->skillId == *it && m_bot->HasSpell(skillAbility->spellId) && skillAbility->forward_spellid == 0 && ((skillAbility->classmask & m_bot->getClassMask()) == 0)) { MakeSpellLink(spellInfo, msg); ++linkcount; - if ((charges = GetSpellCharges(SkillAbility->spellId)) > 0) + if ((charges = GetSpellCharges(skillAbility->spellId)) > 0) msg << "[" << charges << "]"; if (linkcount >= 10) { @@ -10947,12 +10939,8 @@ void PlayerbotAI::_HandleCommandSkill(std::string& text, Player& fromPlayer) for (std::list::iterator it = m_spellsToLearn.begin(); it != m_spellsToLearn.end(); ++it) { if (IsPrimaryProfessionSkill(*it)) - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + for (auto skillLine : sDBCSkillLineAbility) { - SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j); - if (!skillLine) - continue; - // has skill if (skillLine->skillId == *it && skillLine->learnOnGetSkill == 0) { @@ -10977,16 +10965,12 @@ void PlayerbotAI::_HandleCommandSkill(std::string& text, Player& fromPlayer) msg << "\nMy Weapon skills: "; for (std::list::iterator it = m_spellsToLearn.begin(); it != m_spellsToLearn.end(); ++it) { - SkillLineEntry const* SkillLine = sSkillLineStore.LookupEntry(*it); + SkillLineEntry const* SkillLine = sDBCSkillLine.LookupEntry(*it); // has weapon skill if (SkillLine->categoryId == SKILL_CATEGORY_WEAPON) { - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + for (auto skillLine : sDBCSkillLineAbility) { - SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j); - if (!skillLine) - continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); if (!spellInfo) continue; diff --git a/src/game/PlayerBot/Base/PlayerbotClassAI.cpp b/src/game/PlayerBot/Base/PlayerbotClassAI.cpp index 7dba41f0e60..615f1a289f0 100644 --- a/src/game/PlayerBot/Base/PlayerbotClassAI.cpp +++ b/src/game/PlayerBot/Base/PlayerbotClassAI.cpp @@ -404,7 +404,7 @@ bool PlayerbotClassAI::FleeFromAoEIfCan(uint32 spellId, Unit* pTarget) float radius = 0; SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); if (spellproto) - radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[EFFECT_INDEX_0])); + radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spellproto->EffectRadiusIndex[EFFECT_INDEX_0])); // Step 2: Get current bot position to move from it float curr_x, curr_y, curr_z; @@ -465,7 +465,7 @@ bool PlayerbotClassAI::FleeFromNpcWithAuraIfCan(uint32 NpcEntry, uint32 spellId, float radius = 0; SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); if (spellproto) - radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[EFFECT_INDEX_0])); + radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spellproto->EffectRadiusIndex[EFFECT_INDEX_0])); if (radius == 0) return false; diff --git a/src/game/PlayerBot/Base/PlayerbotMgr.cpp b/src/game/PlayerBot/Base/PlayerbotMgr.cpp index 17b4d7a0921..3e65f44e028 100644 --- a/src/game/PlayerBot/Base/PlayerbotMgr.cpp +++ b/src/game/PlayerBot/Base/PlayerbotMgr.cpp @@ -995,14 +995,14 @@ uint32 Player::GetSpec() Player* player = m_session->GetPlayer(); uint32 classMask = player->getClassMask(); - for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) + for (unsigned int i = 0; i < sDBCTalent.GetNumRows(); ++i) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); if (!talentInfo) continue; - TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; diff --git a/src/game/Pools/PoolManager.cpp b/src/game/Pools/PoolManager.cpp index 01cc9f00016..58d9c84073c 100644 --- a/src/game/Pools/PoolManager.cpp +++ b/src/game/Pools/PoolManager.cpp @@ -567,7 +567,7 @@ struct PoolMapChecker bool CheckAndRemember(uint32 mapid, uint32 pool_id, char const* tableName, char const* elementName) { - MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); if (!mapEntry) return false; diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index c92a31f70bb..6eeca81fbc3 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -65,88 +65,88 @@ //DBCStorage sDBCCharTitles(CharTitlesEntryfmt); //DBCStorage sDBCChatChannels(ChatChannelsEntryfmt); //DBCStorage sDBCChrClasses(ChrClassesEntryfmt); -DBCStorage sChrRacesStore(ChrRacesEntryfmt); -DBCStorage sCinematicCameraStore(CinematicCameraEntryfmt); -DBCStorage sCinematicSequencesStore(CinematicSequencesEntryfmt); -DBCStorage sCreatureDisplayInfoStore(CreatureDisplayInfofmt); -DBCStorage sCreatureDisplayInfoExtraStore(CreatureDisplayInfoExtrafmt); -DBCStorage sCreatureFamilyStore(CreatureFamilyfmt); -DBCStorage sCreatureModelDataStore(CreatureModelDatafmt); -DBCStorage sCreatureSpellDataStore(CreatureSpellDatafmt); -DBCStorage sCreatureTypeStore(CreatureTypefmt); - -DBCStorage sDurabilityQualityStore(DurabilityQualityfmt); -DBCStorage sDurabilityCostsStore(DurabilityCostsfmt); - -DBCStorage sEmotesStore(EmotesEntryfmt); -DBCStorage sEmotesTextStore(EmotesTextEntryfmt); +//DBCStorage sDBCChrRaces(ChrRacesEntryfmt); +//DBCStorage sDBCCinematicCamera(CinematicCameraEntryfmt); +//DBCStorage sDBCCinematicSequences(CinematicSequencesEntryfmt); +//DBCStorage sDBCCreatureDisplayInfo(CreatureDisplayInfofmt); +//DBCStorage sDBCCreatureDisplayInfoExtra(CreatureDisplayInfoExtrafmt); +//DBCStorage sDBCCreatureFamily(CreatureFamilyfmt); +//DBCStorage sDBCCreatureModelData(CreatureModelDatafmt); +//DBCStorage sDBCCreatureSpellData(CreatureSpellDatafmt); +//DBCStorage sDBCCreatureType(CreatureTypefmt); + +//DBCStorage sDBCDurabilityCosts(DurabilityQualityfmt); +//DBCStorage sDBCDurabilityQuality(DurabilityCostsfmt); + +//DBCStorage sDBCEmotes(EmotesEntryfmt); +//DBCStorage sDBCEmotesText(EmotesTextEntryfmt); //DBCStorage sFactionStore(FactionEntryfmt); -DBCStorage sFactionTemplateStore(FactionTemplateEntryfmt); - -DBCStorage sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt); -DBCStorage sGemPropertiesStore(GemPropertiesEntryfmt); - -DBCStorage sGMSurveyCurrentSurveyStore(GMSurveyCurrentSurveyfmt); -DBCStorage sGMSurveyQuestionsStore(GMSurveyQuestionsfmt); -DBCStorage sGMSurveySurveysStore(GMSurveySurveysfmt); -DBCStorage sGMTicketCategoryStore(GMTicketCategoryfmt); - -DBCStorage sGtCombatRatingsStore(GtCombatRatingsfmt); -DBCStorage sGtChanceToMeleeCritBaseStore(GtChanceToMeleeCritBasefmt); -DBCStorage sGtChanceToMeleeCritStore(GtChanceToMeleeCritfmt); -DBCStorage sGtChanceToSpellCritBaseStore(GtChanceToSpellCritBasefmt); -DBCStorage sGtChanceToSpellCritStore(GtChanceToSpellCritfmt); -DBCStorage sGtOCTRegenHPStore(GtOCTRegenHPfmt); -DBCStorage sGtNPCManaCostScalerStore(GtNPCManaCostScalerfmt); +//DBCStorage sDBCFactionTemplate(FactionTemplateEntryfmt); + +//DBCStorage sDBCGameObjectDisplayInfo(GameObjectDisplayInfofmt); +//DBCStorage sDBCGemProperties(GemPropertiesEntryfmt); + +//DBCStorage sDBCGMSurveyCurrentSurvey(GMSurveyCurrentSurveyfmt); +//DBCStorage sDBCGMSurveyQuestions(GMSurveyQuestionsfmt); +//DBCStorage sDBCGMSurveySurveys(GMSurveySurveysfmt); +//DBCStorage sDBCGMTicketCategory(GMTicketCategoryfmt); + +//DBCStorage sDBCgtCombatRatings(GtCombatRatingsfmt); +//DBCStorage sDBCgtChanceToMeleeCritBase(GtChanceToMeleeCritBasefmt); +//DBCStorage sDBCgtChanceToMeleeCrit(GtChanceToMeleeCritfmt); +//DBCStorage sDBCgtChanceToSpellCritBase(GtChanceToSpellCritBasefmt); +//DBCStorage sDBCgtChanceToSpellCrit(GtChanceToSpellCritfmt); +//DBCStorage sDBCgtOCTRegenHP(GtOCTRegenHPfmt); +//DBCStorage sDBCgtNPCManaCostScaler(GtNPCManaCostScalerfmt); // DBCStorage sGtOCTRegenMPStore(GtOCTRegenMPfmt); -- not used currently -DBCStorage sGtRegenHPPerSptStore(GtRegenHPPerSptfmt); -DBCStorage sGtRegenMPPerSptStore(GtRegenMPPerSptfmt); +//DBCStorage sDBCgtRegenHPPerSpt(GtRegenHPPerSptfmt); +//DBCStorage sDBCgtRegenMPPerSpt(GtRegenMPPerSptfmt); -DBCStorage sItemStore(Itemfmt); -DBCStorage sItemBagFamilyStore(ItemBagFamilyfmt); -DBCStorage sItemClassStore(ItemClassfmt); +//DBCStorage sDBCItem(Itemfmt); +//DBCStorage sDBCItemBagFamily(ItemBagFamilyfmt); +//DBCStorage sDBCItemClass(ItemClassfmt); // DBCStorage sItemCondExtCostsStore(ItemCondExtCostsEntryfmt); // DBCStorage sItemDisplayInfoStore(ItemDisplayTemplateEntryfmt); -- not used currently -DBCStorage sItemExtendedCostStore(ItemExtendedCostEntryfmt); -DBCStorage sItemRandomPropertiesStore(ItemRandomPropertiesfmt); -DBCStorage sItemRandomSuffixStore(ItemRandomSuffixfmt); -DBCStorage sItemSetStore(ItemSetEntryfmt); -DBCStorage sLiquidTypeStore(LiquidTypefmt); -DBCStorage sLockStore(LockEntryfmt); +//DBCStorage sDBCItemExtendedCost(ItemExtendedCostEntryfmt); +//DBCStorage sDBCItemRandomProperties(ItemRandomPropertiesfmt); +//DBCStorage sDBCItemRandomSuffix(ItemRandomSuffixfmt); +//DBCStorage sDBCItemSet(ItemSetEntryfmt); +//DBCStorage sDBCLiquidType(LiquidTypefmt); +//DBCStorage sDBCLock(LockEntryfmt); -DBCStorage sMailTemplateStore(MailTemplateEntryfmt); -DBCStorage sMapStore(MapEntryfmt); +//DBCStorage sDBCMailTemplate(MailTemplateEntryfmt); +//DBCStorage sDBCMap(MapEntryfmt); -DBCStorage sQuestSortStore(QuestSortEntryfmt); +//DBCStorage sDBCQuestSort(QuestSortEntryfmt); -DBCStorage sRandomPropertiesPointsStore(RandomPropertiesPointsfmt); +//DBCStorage sDBCRandPropPoints(RandomPropertiesPointsfmt); -DBCStorage sSkillLineStore(SkillLinefmt); -DBCStorage sSkillLineAbilityStore(SkillLineAbilityfmt); -DBCStorage sSkillRaceClassInfoStore(SkillRaceClassInfofmt); -DBCStorage sSkillTiersStore(SkillTiersfmt); +//DBCStorage sDBCSkillLine(SkillLinefmt); +//DBCStorage sDBCSkillLineAbility(SkillLineAbilityfmt); +//DBCStorage sDBCSkillRaceClassInfo(SkillRaceClassInfofmt); +//DBCStorage sDBCSkillTiers(SkillTiersfmt); -DBCStorage sSoundEntriesStore(SoundEntriesfmt); +//DBCStorage sDBCSoundEntries(SoundEntriesfmt); -DBCStorage sSpellItemEnchantmentStore(SpellItemEnchantmentfmt); -DBCStorage sSpellItemEnchantmentConditionStore(SpellItemEnchantmentConditionfmt); -DBCStorage sSpellVisualStore(SpellVisualfmt); +//DBCStorage sDBCSpellItemEnchantment(SpellItemEnchantmentfmt); +//DBCStorage sDBCSpellItemEnchantmentCondition(SpellItemEnchantmentConditionfmt); +//DBCStorage sDBCSpellVisual(SpellVisualfmt); SpellCategoryStore sSpellCategoryStore; ItemSpellCategoryStore sItemSpellCategoryStore; PetFamilySpellsStore sPetFamilySpellsStore; -DBCStorage sSpellCastTimesStore(SpellCastTimefmt); -DBCStorage sSpellDurationStore(SpellDurationfmt); -DBCStorage sSpellFocusObjectStore(SpellFocusObjectfmt); -DBCStorage sSpellRadiusStore(SpellRadiusfmt); -DBCStorage sSpellRangeStore(SpellRangefmt); -DBCStorage sSpellShapeshiftFormStore(SpellShapeshiftfmt); -DBCStorage sStableSlotPricesStore(StableSlotPricesfmt); -DBCStorage sSummonPropertiesStore(SummonPropertiesfmt); -DBCStorage sTalentStore(TalentEntryfmt); +//DBCStorage sDBCSpellCastTimes(SpellCastTimefmt); +//DBCStorage sDBCSpellDuration(SpellDurationfmt); +//DBCStorage sDBCSpellFocusObject(SpellFocusObjectfmt); +//DBCStorage sDBCSpellRadius(SpellRadiusfmt); +//DBCStorage sDBCSpellRange(SpellRangefmt); +//DBCStorage sDBCSpellShapeshiftForm(SpellShapeshiftfmt); +//DBCStorage sDBCStableSlotPrices(StableSlotPricesfmt); +//DBCStorage sDBCSummonProperties(SummonPropertiesfmt); +//DBCStorage sDBCTalent(TalentEntryfmt); TalentSpellPosMap sTalentSpellPosMap; -DBCStorage sTalentTabStore(TalentTabEntryfmt); +//DBCStorage sDBCTalentTab(TalentTabEntryfmt); // store absolute bit position for first rank for talent inspect typedef std::map TalentInspectMap; @@ -154,22 +154,22 @@ static TalentInspectMap sTalentPosInInspect; static TalentInspectMap sTalentTabSizeInInspect; static uint32 sTalentTabPages[12/*MAX_CLASSES*/][3]; -DBCStorage sTaxiNodesStore(TaxiNodesEntryfmt); +//DBCStorage sDBCTaxiNodes(TaxiNodesEntryfmt); TaxiMask sTaxiNodesMask; // DBC used only for initialization sTaxiPathSetBySource at startup. TaxiPathSetBySource sTaxiPathSetBySource; -DBCStorage sTaxiPathStore(TaxiPathEntryfmt); +//DBCStorage sDBCTaxiPath(TaxiPathEntryfmt); // DBC store data but sTaxiPathNodesByPath used for fast access to entries (it's not owner pointed data). TaxiPathNodesByPath sTaxiPathNodesByPath; -static DBCStorage sTaxiPathNodeStore(TaxiPathNodeEntryfmt); +//static DBCStorage sDBCTaxiPathNode(TaxiPathNodeEntryfmt); -DBCStorage sTransportAnimationStore(TransportAnimationfmt); +//DBCStorage sDBCTransportAnimation(TransportAnimationfmt); -DBCStorage sTotemCategoryStore(TotemCategoryEntryfmt); -DBCStorage sWMOAreaTableStore(WMOAreaTableEntryfmt); -DBCStorage sWorldMapAreaStore(WorldMapAreaEntryfmt); +//DBCStorage sDBCTotemCategory(TotemCategoryEntryfmt); +//DBCStorage sDBCWMOAreaTable(WMOAreaTableEntryfmt); +//DBCStorage sDBCWorldMapArea(WorldMapAreaEntryfmt); // DBCStorage sWorldMapOverlayStore(WorldMapOverlayEntryfmt); typedef std::list StoreProblemList; @@ -274,100 +274,91 @@ void LoadDBCStores(const std::string& dataPath) // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharTitles, dbcPath, "CharTitles.dbc"); // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChatChannels, dbcPath, "ChatChannels.dbc"); // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChrClasses, dbcPath, "ChrClasses.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sChrRacesStore, dbcPath, "ChrRaces.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCinematicCameraStore, dbcPath, "CinematicCamera.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCinematicSequencesStore, dbcPath, "CinematicSequences.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureDisplayInfoStore, dbcPath, "CreatureDisplayInfo.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureDisplayInfoExtraStore, dbcPath, "CreatureDisplayInfoExtra.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureFamilyStore, dbcPath, "CreatureFamily.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureModelDataStore, dbcPath, "CreatureModelData.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureSpellDataStore, dbcPath, "CreatureSpellData.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureTypeStore, dbcPath, "CreatureType.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDurabilityCostsStore, dbcPath, "DurabilityCosts.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDurabilityQualityStore, dbcPath, "DurabilityQuality.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sEmotesStore, dbcPath, "Emotes.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sEmotesTextStore, dbcPath, "EmotesText.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChrRaces, dbcPath, "ChrRaces.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCinematicCameraStore, dbcPath, "CinematicCamera.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCinematicSequencesStore, dbcPath, "CinematicSequences.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureDisplayInfoStore, dbcPath, "CreatureDisplayInfo.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureDisplayInfoExtraStore, dbcPath, "CreatureDisplayInfoExtra.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureFamilyStore, dbcPath, "CreatureFamily.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureModelDataStore, dbcPath, "CreatureModelData.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureSpellDataStore, dbcPath, "CreatureSpellData.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureTypeStore, dbcPath, "CreatureType.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDurabilityCostsStore, dbcPath, "DurabilityCosts.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDurabilityQualityStore, dbcPath, "DurabilityQuality.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sEmotesStore, dbcPath, "Emotes.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sEmotesTextStore, dbcPath, "EmotesText.dbc"); // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sFactionStore, dbcPath, "Faction.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sFactionTemplateStore, dbcPath, "FactionTemplate.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGameObjectDisplayInfoStore, dbcPath, "GameObjectDisplayInfo.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGemPropertiesStore, dbcPath, "GemProperties.dbc"); - - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMSurveyCurrentSurveyStore, dbcPath, "GMSurveyCurrentSurvey.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMSurveyQuestionsStore, dbcPath, "GMSurveyQuestions.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMSurveySurveysStore, dbcPath, "GMSurveySurveys.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMTicketCategoryStore, dbcPath, "GMTicketCategory.dbc"); - - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtCombatRatingsStore, dbcPath, "gtCombatRatings.dbc"); - - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToMeleeCritBaseStore, dbcPath, "gtChanceToMeleeCritBase.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToMeleeCritStore, dbcPath, "gtChanceToMeleeCrit.dbc"); - - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToSpellCritBaseStore, dbcPath, "gtChanceToSpellCritBase.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToSpellCritStore, dbcPath, "gtChanceToSpellCrit.dbc"); - - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtOCTRegenHPStore, dbcPath, "gtOCTRegenHP.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtNPCManaCostScalerStore, dbcPath, "gtNPCManaCostScaler.dbc"); - // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtOCTRegenMPStore, dbcPath,"gtOCTRegenMP.dbc"); -- not used currently - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtRegenHPPerSptStore, dbcPath, "gtRegenHPPerSpt.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtRegenMPPerSptStore, dbcPath, "gtRegenMPPerSpt.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemStore, dbcPath, "Item.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemBagFamilyStore, dbcPath, "ItemBagFamily.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemClassStore, dbcPath, "ItemClass.dbc"); - // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemDisplayInfoStore, dbcPath,"ItemDisplayInfo.dbc"); -- not used currently - // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemCondExtCostsStore, dbcPath,"ItemCondExtCosts.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemExtendedCostStore, dbcPath, "ItemExtendedCost.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemRandomPropertiesStore, dbcPath, "ItemRandomProperties.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemRandomSuffixStore, dbcPath, "ItemRandomSuffix.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemSetStore, dbcPath, "ItemSet.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sLiquidTypeStore, dbcPath, "LiquidType.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sLockStore, dbcPath, "Lock.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMailTemplateStore, dbcPath, "MailTemplate.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMapStore, dbcPath, "Map.dbc"); - { - // repairs entry for netherstorm - should be moved to SQL - MapEntry const* mEntry = sMapStore.LookupEntry(550); - MapEntry* tempestKeepMap = new MapEntry(*mEntry); - tempestKeepMap->ghost_entrance_map = 530; - sMapStore.EraseEntry(550); - sMapStore.InsertEntry(tempestKeepMap, 550); - } - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sQuestSortStore, dbcPath, "QuestSort.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sRandomPropertiesPointsStore, dbcPath, "RandPropPoints.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillLineStore, dbcPath, "SkillLine.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillLineAbilityStore, dbcPath, "SkillLineAbility.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillRaceClassInfoStore, dbcPath, "SkillRaceClassInfo.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillTiersStore, dbcPath, "SkillTiers.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSoundEntriesStore, dbcPath, "SoundEntries.dbc"); - - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sFactionTemplateStore, dbcPath, "FactionTemplate.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGameObjectDisplayInfoStore, dbcPath, "GameObjectDisplayInfo.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGemPropertiesStore, dbcPath, "GemProperties.dbc"); +// +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMSurveyCurrentSurveyStore, dbcPath, "GMSurveyCurrentSurvey.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMSurveyQuestionsStore, dbcPath, "GMSurveyQuestions.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMSurveySurveysStore, dbcPath, "GMSurveySurveys.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMTicketCategoryStore, dbcPath, "GMTicketCategory.dbc"); +// +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtCombatRatingsStore, dbcPath, "gtCombatRatings.dbc"); +// +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToMeleeCritBaseStore, dbcPath, "gtChanceToMeleeCritBase.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToMeleeCritStore, dbcPath, "gtChanceToMeleeCrit.dbc"); +// +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToSpellCritBaseStore, dbcPath, "gtChanceToSpellCritBase.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToSpellCritStore, dbcPath, "gtChanceToSpellCrit.dbc"); +// +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtOCTRegenHPStore, dbcPath, "gtOCTRegenHP.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtNPCManaCostScalerStore, dbcPath, "gtNPCManaCostScaler.dbc"); +// // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtOCTRegenMPStore, dbcPath,"gtOCTRegenMP.dbc"); -- not used currently +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtRegenHPPerSptStore, dbcPath, "gtRegenHPPerSpt.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtRegenMPPerSptStore, dbcPath, "gtRegenMPPerSpt.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemStore, dbcPath, "Item.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemBagFamilyStore, dbcPath, "ItemBagFamily.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemClassStore, dbcPath, "ItemClass.dbc"); +// // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemDisplayInfoStore, dbcPath,"ItemDisplayInfo.dbc"); -- not used currently +// // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemCondExtCostsStore, dbcPath,"ItemCondExtCosts.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemExtendedCostStore, dbcPath, "ItemExtendedCost.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemRandomPropertiesStore, dbcPath, "ItemRandomProperties.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemRandomSuffixStore, dbcPath, "ItemRandomSuffix.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemSetStore, dbcPath, "ItemSet.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sLiquidTypeStore, dbcPath, "LiquidType.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sLockStore, dbcPath, "Lock.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMailTemplateStore, dbcPath, "MailTemplate.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMapStore, dbcPath, "Map.dbc"); + //{ + // // repairs entry for netherstorm - should be moved to SQL + // MapEntry const* mEntry = sDBCMap.LookupEntry(550); + // MapEntry* tempestKeepMap = new MapEntry(*mEntry); + // tempestKeepMap->ghost_entrance_map = 530; + // sDBCMap.EraseEntry(550); + // sDBCMap.InsertEntry(tempestKeepMap, 550); + //} +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sQuestSortStore, dbcPath, "QuestSort.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sRandomPropertiesPointsStore, dbcPath, "RandPropPoints.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillLineStore, dbcPath, "SkillLine.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillLineAbilityStore, dbcPath, "SkillLineAbility.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillRaceClassInfoStore, dbcPath, "SkillRaceClassInfo.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillTiersStore, dbcPath, "SkillTiers.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSoundEntriesStore, dbcPath, "SoundEntries.dbc"); + + for (auto skillLine : sDBCSkillLineAbility) { - SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j); - - if (!skillLine) - continue; - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); if (spellInfo && (spellInfo->Attributes & (SPELL_ATTR_ABILITY | SPELL_ATTR_PASSIVE | SPELL_ATTR_HIDDEN_CLIENTSIDE | SPELL_ATTR_HIDE_IN_COMBAT_LOG)) == (SPELL_ATTR_ABILITY | SPELL_ATTR_PASSIVE | SPELL_ATTR_HIDDEN_CLIENTSIDE | SPELL_ATTR_HIDE_IN_COMBAT_LOG)) { - for (unsigned int i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i) + for (auto cFamily : sDBCCreatureFamily) { - CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i); - if (!cFamily) - continue; - if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1]) continue; - sPetFamilySpellsStore[i].insert(spellInfo->Id); + sPetFamilySpellsStore[cFamily->ID].insert(spellInfo->Id); } } } - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellCastTimesStore, dbcPath, "SpellCastTimes.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellDurationStore, dbcPath, "SpellDuration.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellFocusObjectStore, dbcPath, "SpellFocusObject.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellItemEnchantmentStore, dbcPath, "SpellItemEnchantment.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellCastTimesStore, dbcPath, "SpellCastTimes.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellDurationStore, dbcPath, "SpellDuration.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellFocusObjectStore, dbcPath, "SpellFocusObject.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellItemEnchantmentStore, dbcPath, "SpellItemEnchantment.dbc"); //for (uint32 i = 0; i < sSpellItemEnchantmentStore.GetNumRows(); ++i) //{ // SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(i); @@ -380,26 +371,24 @@ void LoadDBCStores(const std::string& dataPath) // sLog.outErrorDb("Spell ID %u found in spell item enchant %u does not exist.", enchantEntry->spellid[k], i); // } //} - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellItemEnchantmentConditionStore, dbcPath, "SpellItemEnchantmentCondition.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellRadiusStore, dbcPath, "SpellRadius.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellRangeStore, dbcPath, "SpellRange.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellShapeshiftFormStore, dbcPath, "SpellShapeshiftForm.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellVisualStore, dbcPath, "SpellVisual.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sStableSlotPricesStore, dbcPath, "StableSlotPrices.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSummonPropertiesStore, dbcPath, "SummonProperties.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTalentStore, dbcPath, "Talent.dbc"); + // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellItemEnchantmentConditionStore, dbcPath, "SpellItemEnchantmentCondition.dbc"); + // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellRadiusStore, dbcPath, "SpellRadius.dbc"); + // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellRangeStore, dbcPath, "SpellRange.dbc"); + // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellShapeshiftFormStore, dbcPath, "SpellShapeshiftForm.dbc"); + // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellVisualStore, dbcPath, "SpellVisual.dbc"); + // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sStableSlotPricesStore, dbcPath, "StableSlotPrices.dbc"); + // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSummonPropertiesStore, dbcPath, "SummonProperties.dbc"); + // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTalentStore, dbcPath, "Talent.dbc"); // create talent spells set - for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) + for (auto talentInfo : sDBCTalent) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); - if (!talentInfo) continue; for (int j = 0; j < 5; ++j) if (talentInfo->RankID[j]) - sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j); + sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(talentInfo->TalentID, j); } - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTalentTabStore, dbcPath, "TalentTab.dbc"); + // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTalentTabStore, dbcPath, "TalentTab.dbc"); // prepare fast data access to bit pos of talent ranks for use at inspecting { @@ -407,12 +396,12 @@ void LoadDBCStores(const std::string& dataPath) // store in with (row,col,talent)->size key for correct sorting by (row,col) typedef std::map TalentBitSize; TalentBitSize sTalentBitSize; - for (uint32 i = 1; i < sTalentStore.GetNumRows(); ++i) + for (uint32 i = 1; i < sDBCTalent.GetNumRows(); ++i) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); if (!talentInfo) continue; - TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -432,9 +421,9 @@ void LoadDBCStores(const std::string& dataPath) } // now have all max ranks (and then bit amount used for store talent ranks in inspect) - for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId) + for (uint32 talentTabId = 1; talentTabId < sDBCTalentTab.GetNumRows(); ++talentTabId) { - TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId); + TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentTabId); if (!talentTabInfo) continue; @@ -453,7 +442,7 @@ void LoadDBCStores(const std::string& dataPath) for (TalentBitSize::iterator itr = sTalentBitSize.begin(); itr != sTalentBitSize.end(); ++itr) { uint32 talentId = itr->first & 0xFFFF; - TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(talentId); if (!talentInfo) continue; @@ -466,33 +455,30 @@ void LoadDBCStores(const std::string& dataPath) } } - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiNodesStore, dbcPath, "TaxiNodes.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiNodesStore, dbcPath, "TaxiNodes.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathStore, dbcPath, "TaxiPath.dbc"); - for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i) - if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i)) - sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price); - uint32 pathCount = sTaxiPathStore.GetNumRows(); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathStore, dbcPath, "TaxiPath.dbc"); + for (auto entry : sDBCTaxiPath) + sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price); + uint32 pathCount = sDBCTaxiPath.GetNumRows(); //## TaxiPathNode.dbc ## Loaded only for initialization different structures - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathNodeStore, dbcPath, "TaxiPathNode.dbc"); + // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathNodeStore, dbcPath, "TaxiPathNode.dbc"); // Calculate path nodes count std::vector pathLength; pathLength.resize(pathCount); // 0 and some other indexes not used - for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i) - if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i)) - { - if (pathLength[entry->path] < entry->index + 1) - pathLength[entry->path] = entry->index + 1; - } + for (auto entry : sDBCTaxiPathNode) + { + if (pathLength[entry->path] < entry->index + 1) + pathLength[entry->path] = entry->index + 1; + } // Set path length sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i) sTaxiPathNodesByPath[i].resize(pathLength[i]); // fill data (pointers to sTaxiPathNodeStore elements - for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i) - if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i)) - sTaxiPathNodesByPath[entry->path].set(entry->index, entry); + for (auto entry : sDBCTaxiPathNode) + sTaxiPathNodesByPath[entry->path].set(entry->index, entry); // Initialize global taxinodes mask // include existing nodes that have at least single not spell base (scripted) path @@ -504,13 +490,9 @@ void LoadDBCStores(const std::string& dataPath) spellPaths.insert(sInfo->EffectMiscValue[j]); memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask)); - for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i) + for (auto node : sDBCTaxiNodes) { - TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i); - if (!node) - continue; - - TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i); + TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(node->ID); if (src_i != sTaxiPathSetBySource.end() && !src_i->second.empty()) { bool ok = false; @@ -529,23 +511,20 @@ void LoadDBCStores(const std::string& dataPath) } // valid taxi network node - uint8 field = (uint8)((i - 1) / 32); - uint32 submask = 1 << ((i - 1) % 32); + uint8 field = (uint8)((node->ID - 1) / 32); + uint32 submask = 1 << ((node->ID - 1) % 32); sTaxiNodesMask[field] |= submask; } } - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTransportAnimationStore, dbcPath, "TransportAnimation.dbc"); - - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTotemCategoryStore, dbcPath, "TotemCategory.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sWorldMapAreaStore, dbcPath, "WorldMapArea.dbc"); - LoadDBC(availableDbcLocales, bar, bad_dbc_files, sWMOAreaTableStore, dbcPath, "WMOAreaTable.dbc"); - for (uint32 i = 0; i < sWMOAreaTableStore.GetNumRows(); ++i) +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTransportAnimationStore, dbcPath, "TransportAnimation.dbc"); +// +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTotemCategoryStore, dbcPath, "TotemCategory.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sWorldMapAreaStore, dbcPath, "WorldMapArea.dbc"); +// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sWMOAreaTableStore, dbcPath, "WMOAreaTable.dbc"); + for (auto entry : sDBCWMOAreaTable) { - if (WMOAreaTableEntry const* entry = sWMOAreaTableStore.LookupEntry(i)) - { - sWMOAreaInfoByTripple[WMOAreaTableTripple(entry->rootId, entry->adtId, entry->groupId)].push_back(entry); - } + sWMOAreaInfoByTripple[WMOAreaTableTripple(entry->rootId, entry->adtId, entry->groupId)].push_back(entry); } // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapOverlayStore, dbcPath,"WorldMapOverlay.dbc"); // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sWorldSafeLocsStore, dbcPath, "WorldSafeLocs.dbc"); @@ -569,10 +548,10 @@ void LoadDBCStores(const std::string& dataPath) } // Check loaded DBC files proper version - if (!sSkillLineAbilityStore.LookupEntry(17514) || - !sMapStore.LookupEntry(598) || - !sGemPropertiesStore.LookupEntry(1127) || - !sItemExtendedCostStore.LookupEntry(2425) || + if (!sDBCSkillLineAbility.LookupEntry(17514) || + !sDBCMap.LookupEntry(598) || + !sDBCGemProperties.LookupEntry(1127) || + !sDBCItemExtendedCost.LookupEntry(2425) || !sDBCCharTitles.LookupEntry(71) || !sDBCAreaTable.LookupEntry(1768)) { @@ -589,7 +568,7 @@ char const* GetPetName(uint32 petfamily, uint32 dbclang) { if (!petfamily) return nullptr; - CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(petfamily); + CreatureFamilyEntry const* pet_family = sDBCCreatureFamily.LookupEntry(petfamily); if (!pet_family) return nullptr; return pet_family->Name[dbclang] ? pet_family->Name[dbclang] : nullptr; @@ -624,7 +603,7 @@ uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId) if (mapid != 530) // speed for most cases return mapid; - if (WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId)) + if (WorldMapAreaEntry const* wma = sDBCWorldMapArea.LookupEntry(zoneId)) return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id; return mapid; @@ -636,7 +615,7 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) if (mapid < 2) return CONTENT_1_60; - MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); if (!mapEntry) return CONTENT_1_60; @@ -701,10 +680,10 @@ bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredT if (itemTotemCategoryId == 0) return false; - TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId); + TotemCategoryEntry const* itemEntry = sDBCTotemCategory.LookupEntry(itemTotemCategoryId); if (!itemEntry) return false; - TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId); + TotemCategoryEntry const* reqEntry = sDBCTotemCategory.LookupEntry(requiredTotemCategoryId); if (!reqEntry) return false; @@ -716,7 +695,7 @@ bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredT bool MapCoordinateVsZoneCheck(float x, float y, uint32 mapid, uint32 zone) { - WorldMapAreaEntry const* WmaEntry = sWorldMapAreaStore.LookupEntry(zone); + WorldMapAreaEntry const* WmaEntry = sDBCWorldMapArea.LookupEntry(zone); if (WmaEntry && mapid == WmaEntry->map_id && x >= WmaEntry->x2 && x <= WmaEntry->x1 && y >= WmaEntry->y2 && y <= WmaEntry->y1) return true; @@ -725,7 +704,7 @@ bool MapCoordinateVsZoneCheck(float x, float y, uint32 mapid, uint32 zone) bool Zone2MapCoordinates(float& x, float& y, uint32 zone) { - WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); + WorldMapAreaEntry const* maEntry = sDBCWorldMapArea.LookupEntry(zone); // if not listed then map coordinates (instance) if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1) @@ -740,7 +719,7 @@ bool Zone2MapCoordinates(float& x, float& y, uint32 zone) bool Map2ZoneCoordinates(float& x, float& y, uint32 zone) { - WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); + WorldMapAreaEntry const* maEntry = sDBCWorldMapArea.LookupEntry(zone); // if not listed then map coordinates (instance) if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1) @@ -823,18 +802,18 @@ bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, flo uint32 GetCreatureModelRace(uint32 model_id) { - CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(model_id); + CreatureDisplayInfoEntry const* displayEntry = sDBCCreatureDisplayInfo.LookupEntry(model_id); if (!displayEntry) return 0; - CreatureDisplayInfoExtraEntry const* extraEntry = sCreatureDisplayInfoExtraStore.LookupEntry(displayEntry->ExtendedDisplayInfoID); + CreatureDisplayInfoExtraEntry const* extraEntry = sDBCCreatureDisplayInfoExtra.LookupEntry(displayEntry->ExtendedDisplayInfoID); return extraEntry ? extraEntry->Race : 0; } // script support functions -DBCStorage const* GetSoundEntriesStore() { return &sSoundEntriesStore; } -DBCStorage const* GetSpellRangeStore() { return &sSpellRangeStore; } +//DBCStorage const* GetSoundEntriesStore() { return &sDBCSoundEntries; } +//DBCStorage const* GetSpellRangeStore() { return &sDBCSpellRange; } // DBCStorage const* GetFactionStore() { return &sFactionStore; } -DBCStorage const* GetItemDisplayStore() { return &sItemStore; } -DBCStorage const* GetCreatureDisplayStore() { return &sCreatureDisplayInfoStore; } -DBCStorage const* GetEmotesStore() { return &sEmotesStore; } -DBCStorage const* GetEmotesTextStore() { return &sEmotesTextStore; } +//DBCStorage const* GetItemDisplayStore() { return &sDBCItem; } +//DBCStorage const* GetCreatureDisplayStore() { return &sDBCCreatureDisplayInfo; } +//DBCStorage const* GetEmotesStore() { return &sDBCEmotes; } +//DBCStorage const* GetEmotesTextStore() { return &sDBCEmotesText; } diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index 0a8e195bdc4..e2f06d0f3f8 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -77,93 +77,93 @@ uint32 GetCreatureModelRace(uint32 model_id); //extern DBCStorage sDBCCharTitles; //extern DBCStorage sDBCChatChannels; //extern DBCStorage sDBCChrClasses; -extern DBCStorage sChrRacesStore; -extern DBCStorage sCinematicCameraStore; -extern DBCStorage sCinematicSequencesStore; -extern DBCStorage sCreatureDisplayInfoStore; -extern DBCStorage sCreatureDisplayInfoExtraStore; -extern DBCStorage sCreatureFamilyStore; -extern DBCStorage sCreatureModelDataStore; -extern DBCStorage sCreatureSpellDataStore; -extern DBCStorage sCreatureTypeStore; -extern DBCStorage sDurabilityCostsStore; -extern DBCStorage sDurabilityQualityStore; -extern DBCStorage sEmotesStore; -extern DBCStorage sEmotesTextStore; -//extern DBCStorage sFactionStore; -extern DBCStorage sFactionTemplateStore; -extern DBCStorage sGameObjectDisplayInfoStore; -extern DBCStorage sGemPropertiesStore; - -extern DBCStorage sGMSurveyCurrentSurveyStore; -extern DBCStorage sGMSurveyQuestionsStore; -extern DBCStorage sGMSurveySurveysStore; -extern DBCStorage sGMTicketCategoryStore; - -extern DBCStorage sGtCombatRatingsStore; -extern DBCStorage sGtChanceToMeleeCritBaseStore; -extern DBCStorage sGtChanceToMeleeCritStore; -extern DBCStorage sGtChanceToSpellCritBaseStore; -extern DBCStorage sGtChanceToSpellCritStore; -extern DBCStorage sGtOCTRegenHPStore; -extern DBCStorage sGtNPCManaCostScalerStore; -// extern DBCStorage sGtOCTRegenMPStore; -- not used currently -extern DBCStorage sGtRegenHPPerSptStore; -extern DBCStorage sGtRegenMPPerSptStore; -extern DBCStorage sItemStore; -extern DBCStorage sItemBagFamilyStore; -extern DBCStorage sItemClassStore; -// extern DBCStorage sItemDisplayInfoStore; -- not used currently -extern DBCStorage sItemExtendedCostStore; -extern DBCStorage sItemRandomPropertiesStore; -extern DBCStorage sItemRandomSuffixStore; -extern DBCStorage sItemSetStore; -extern DBCStorage sLiquidTypeStore; -extern DBCStorage sLockStore; -extern DBCStorage sMailTemplateStore; -extern DBCStorage sMapStore; -extern DBCStorage sQuestSortStore; -extern DBCStorage sRandomPropertiesPointsStore; -extern DBCStorage sSkillLineStore; -extern DBCStorage sSkillLineAbilityStore; -extern DBCStorage sSkillRaceClassInfoStore; -extern DBCStorage sSkillTiersStore; -extern DBCStorage sSoundEntriesStore; -extern DBCStorage sSpellCastTimesStore; -extern DBCStorage sSpellDurationStore; -extern DBCStorage sSpellFocusObjectStore; -extern DBCStorage sSpellItemEnchantmentStore; -extern DBCStorage sSpellItemEnchantmentConditionStore; +//extern DBCStorage sDBCChrRaces; +//extern DBCStorage sDBCCinematicCamera; +//extern DBCStorage sCinematicSequencesStore; +//extern DBCStorage sCreatureDisplayInfoStore; +//extern DBCStorage sCreatureDisplayInfoExtraStore; +//extern DBCStorage sCreatureFamilyStore; +//extern DBCStorage sCreatureModelDataStore; +//extern DBCStorage sCreatureSpellDataStore; +//extern DBCStorage sCreatureTypeStore; +//extern DBCStorage sDurabilityCostsStore; +//extern DBCStorage sDurabilityQualityStore; +//extern DBCStorage sEmotesStore; +//extern DBCStorage sEmotesTextStore; +////extern DBCStorage sFactionStore; +//extern DBCStorage sFactionTemplateStore; +//extern DBCStorage sGameObjectDisplayInfoStore; +//extern DBCStorage sGemPropertiesStore; +// +//extern DBCStorage sGMSurveyCurrentSurveyStore; +//extern DBCStorage sGMSurveyQuestionsStore; +//extern DBCStorage sGMSurveySurveysStore; +//extern DBCStorage sGMTicketCategoryStore; +// +//extern DBCStorage sGtCombatRatingsStore; +//extern DBCStorage sGtChanceToMeleeCritBaseStore; +//extern DBCStorage sGtChanceToMeleeCritStore; +//extern DBCStorage sGtChanceToSpellCritBaseStore; +//extern DBCStorage sGtChanceToSpellCritStore; +//extern DBCStorage sGtOCTRegenHPStore; +//extern DBCStorage sGtNPCManaCostScalerStore; +//// extern DBCStorage sGtOCTRegenMPStore; -- not used currently +//extern DBCStorage sGtRegenHPPerSptStore; +//extern DBCStorage sGtRegenMPPerSptStore; +//extern DBCStorage sItemStore; +//extern DBCStorage sItemBagFamilyStore; +//extern DBCStorage sItemClassStore; +//// extern DBCStorage sItemDisplayInfoStore; -- not used currently +//extern DBCStorage sItemExtendedCostStore; +//extern DBCStorage sItemRandomPropertiesStore; +//extern DBCStorage sItemRandomSuffixStore; +//extern DBCStorage sItemSetStore; +//extern DBCStorage sLiquidTypeStore; +//extern DBCStorage sLockStore; +//extern DBCStorage sMailTemplateStore; +//extern DBCStorage sMapStore; +//extern DBCStorage sQuestSortStore; +//extern DBCStorage sRandomPropertiesPointsStore; +//extern DBCStorage sSkillLineStore; +//extern DBCStorage sSkillLineAbilityStore; +//extern DBCStorage sSkillRaceClassInfoStore; +//extern DBCStorage sSkillTiersStore; +//extern DBCStorage sSoundEntriesStore; +//extern DBCStorage sSpellCastTimesStore; +//extern DBCStorage sSpellDurationStore; +//extern DBCStorage sSpellFocusObjectStore; +//extern DBCStorage sSpellItemEnchantmentStore; +//extern DBCStorage sSpellItemEnchantmentConditionStore; extern SpellCategoryStore sSpellCategoryStore; extern ItemSpellCategoryStore sItemSpellCategoryStore; extern PetFamilySpellsStore sPetFamilySpellsStore; -extern DBCStorage sSpellRadiusStore; -extern DBCStorage sSpellRangeStore; -extern DBCStorage sSpellShapeshiftFormStore; -extern DBCStorage sSpellVisualStore; -extern DBCStorage sStableSlotPricesStore; -extern DBCStorage sSummonPropertiesStore; -extern DBCStorage sTalentStore; -extern DBCStorage sTalentTabStore; -extern DBCStorage sTaxiNodesStore; -extern DBCStorage sTaxiPathStore; +//extern DBCStorage sSpellRadiusStore; +//extern DBCStorage sSpellRangeStore; +//extern DBCStorage sSpellShapeshiftFormStore; +//extern DBCStorage sSpellVisualStore; +//extern DBCStorage sStableSlotPricesStore; +//extern DBCStorage sSummonPropertiesStore; +//extern DBCStorage sTalentStore; +//extern DBCStorage sTalentTabStore; +//extern DBCStorage sTaxiNodesStore; +//extern DBCStorage sTaxiPathStore; extern TaxiMask sTaxiNodesMask; extern TaxiPathSetBySource sTaxiPathSetBySource; extern TaxiPathNodesByPath sTaxiPathNodesByPath; -extern DBCStorage sTransportAnimationStore; -extern DBCStorage sTotemCategoryStore; -extern DBCStorage sWMOAreaTableStore; -// extern DBCStorage sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates -// extern DBCStorage sWorldMapOverlayStore; -- not used currently - +//extern DBCStorage sTransportAnimationStore; +//extern DBCStorage sTotemCategoryStore; +//extern DBCStorage sWMOAreaTableStore; +//// extern DBCStorage sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates +//// extern DBCStorage sWorldMapOverlayStore; -- not used currently +// void LoadDBCStores(const std::string& dataPath); - -// script support functions -DBCStorage const* GetSoundEntriesStore(); -DBCStorage const* GetSpellRangeStore(); -DBCStorage const* GetFactionStore(); -DBCStorage const* GetItemDisplayStore(); -DBCStorage const* GetCreatureDisplayStore(); -DBCStorage const* GetEmotesStore(); -DBCStorage const* GetEmotesTextStore(); +// +//// script support functions +//DBCStorage const* GetSoundEntriesStore(); +//DBCStorage const* GetSpellRangeStore(); +//DBCStorage const* GetFactionStore(); +//DBCStorage const* GetItemDisplayStore(); +//DBCStorage const* GetCreatureDisplayStore(); +//DBCStorage const* GetEmotesStore(); +//DBCStorage const* GetEmotesTextStore(); #endif diff --git a/src/game/Server/DBCStructure.h b/src/game/Server/DBCStructure.h index 590e722d09b..e458388bb81 100644 --- a/src/game/Server/DBCStructure.h +++ b/src/game/Server/DBCStructure.h @@ -620,7 +620,7 @@ struct ItemRandomSuffixEntry struct ItemSetEntry { - // uint32 id // 0 m_ID + uint32 id; // 0 m_ID char* name[16]; // 1-16 m_name_lang // 17 string flags // uint32 itemId[17]; // 18-34 m_itemID diff --git a/src/game/Server/SQLStorages.cpp b/src/game/Server/SQLStorages.cpp index 6ec3901b5e7..27bd5437f90 100644 --- a/src/game/Server/SQLStorages.cpp +++ b/src/game/Server/SQLStorages.cpp @@ -115,7 +115,7 @@ const char ItemClassfmt[] = "nxxssssssssssssssssx"; const char ItemExtendedCostfmt[] = "niiiiiiiiiiiii"; const char ItemRandomPropertiesfmt[] = "nxiiixxssssssssssssssssx"; const char ItemRandomSuffixfmt[] = "nssssssssssssssssxxiiiiii"; -const char ItemSetfmt[] = "dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii"; +const char ItemSetfmt[] = "nssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii"; const char LiquidTypefmt[] = "niii"; const char Lockfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; const char MailTemplatefmt[] = "nxxxxxxxxxxxxxxxxxssssssssssssssssx"; @@ -142,8 +142,8 @@ const char Talentfmt[] = "niiiiiiiixxxxixxixxxi"; const char TalentTabfmt[] = "nxxxxxxxxxxxxxxxxxxxiix"; const char TaxiNodesfmt[] = "nifffssssssssssssssssxii"; const char TaxiPathfmt[] = "niii"; -const char TaxiPathNodefmt[] = "niiifffiiii"; -const char TransportAnimationfmt[] = "niifffx"; +const char TaxiPathNodefmt[] = "diiifffiiii"; +const char TransportAnimationfmt[] = "diifffx"; const char TotemCategoryfmt[] = "nxxxxxxxxxxxxxxxxxii"; const char WorldMapAreafmt[] = "diixffffi"; const char WMOAreaTablefmt[] = "niiixxxxxiixxxxxxxxxxxxxxxxx"; @@ -264,8 +264,8 @@ void LoadDBCTables() sDBCCreatureModelData.Load(); sDBCCreatureSpellData.Load(); sDBCCreatureType.Load(); - sDBCDurabilityCosts.Load(); sDBCDurabilityQuality.Load(); + sDBCDurabilityCosts.Load(); sDBCEmotes.Load(); sDBCEmotesText.Load(); sDBCFactionTemplate.Load(); @@ -373,7 +373,7 @@ AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_ if (area_flag) return sDBCAreaTable.LookupEntry(area_flag); - if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id)) + if (MapEntry const* mapEntry = sDBCMap.LookupEntry(map_id)) return GetAreaEntryByAreaID(mapEntry->linked_zone); return nullptr; diff --git a/src/game/Server/SQLStorages.h b/src/game/Server/SQLStorages.h index b2e85d89995..cc906e09ba4 100644 --- a/src/game/Server/SQLStorages.h +++ b/src/game/Server/SQLStorages.h @@ -63,7 +63,7 @@ extern SQLStorage sDBCCreatureDisplayInfo; extern SQLStorage sDBCCreatureDisplayInfoExtra; extern SQLStorage sDBCCreatureFamily; extern SQLStorage sDBCCreatureModelData; -extern SQLStorage sDBCCreatureSpellData; +extern SQLStorage sDBCCreatureSpellData; // todo not used? extern SQLStorage sDBCCreatureType; extern SQLStorage sDBCDurabilityCosts; extern SQLStorage sDBCDurabilityQuality; diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 369cc96bd35..6352562ee1b 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -421,7 +421,7 @@ template WorldObject* Spell::FindCorpseUsing() { // non-standard target selection - SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); + SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex); float max_range = GetSpellMaxRange(srange); WorldObject* result = nullptr; @@ -1761,7 +1761,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targ } case TARGET_LOCATION_CASTER_FRONT_LEAP: { - float dist = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex])); + float dist = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex])); const float IN_OR_UNDER_LIQUID_RANGE = 0.8f; // range to make player under liquid or on liquid surface from liquid level G3D::Vector3 prevPos, nextPos; @@ -1925,8 +1925,8 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targ float x, y, z; // special code for fishing bobber (TARGET_LOCATION_CASTER_FISHING_SPOT), should not try to avoid objects // nor try to find ground level, but randomly vary in angle - float min_dis = GetSpellMinRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); - float max_dis = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); + float min_dis = GetSpellMinRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); + float max_dis = GetSpellMaxRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); float dis = rand_norm_f() * (max_dis - min_dis) + min_dis; // calculate angle variation for roughly equal dimensions of target area float max_angle = (max_dis - min_dis) / (max_dis + m_caster->GetObjectBoundingRadius()); @@ -4917,7 +4917,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_targets.m_targetMask & (TARGET_FLAG_DEST_LOCATION | TARGET_FLAG_SOURCE_LOCATION)) { UnitList targetsCombat; - float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); + float radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); FillAreaTargets(targetsCombat, radius, 0.f, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_ATTACKABLE); @@ -5112,7 +5112,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (Unit* target = m_targets.getUnitTarget()) { - float range = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); + float range = GetSpellMaxRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); Position pos; target->GetFirstCollisionPosition(pos, target->GetCombatReach(), target->GetAngle(m_caster)); @@ -5276,7 +5276,7 @@ SpellCastResult Spell::CheckCast(bool strict) // These won't show up in m_caster->GetPetGUID() case SPELL_EFFECT_SUMMON: { - if (SummonPropertiesEntry const* summon_prop = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i])) + if (SummonPropertiesEntry const* summon_prop = sDBCSummonProperties.LookupEntry(m_spellInfo->EffectMiscValueB[i])) { if (summon_prop->Group == SUMMON_PROP_GROUP_PETS) { @@ -5348,7 +5348,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_BAD_TARGETS; uint32 mapId = m_caster->GetMapId(); - const MapEntry* map = sMapStore.LookupEntry(mapId); + const MapEntry* map = sDBCMap.LookupEntry(mapId); if (map->IsDungeon()) { // pre 2.4 - could not summon to instance @@ -5371,7 +5371,7 @@ SpellCastResult Spell::CheckCast(bool strict) // check if our map is dungeon uint32 mapId = m_caster->GetMapId(); - const MapEntry* map = sMapStore.LookupEntry(mapId); + const MapEntry* map = sDBCMap.LookupEntry(mapId); if (map->IsDungeon()) { // pre 2.4 - could not summon to instance @@ -5915,7 +5915,7 @@ std::pair Spell::GetMinMaxRange(bool strict) Unit* caster = dynamic_cast(m_caster); // preparation for GO casting - SpellRangeEntry const* spellRange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); + SpellRangeEntry const* spellRange = sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex); if (spellRange) { Unit* target = m_targets.getUnitTarget(); @@ -5977,7 +5977,7 @@ SpellCastResult Spell::CheckRange(bool strict) std::tie(minRange, maxRange) = GetMinMaxRange(strict); // non strict spell tolerance - if (SpellRangeEntry const* spellRange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)) + if (SpellRangeEntry const* spellRange = sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)) if ((spellRange->Flags & SPELL_RANGE_FLAG_MELEE) == 0 && !strict) maxRange += std::min(3.f, maxRange * 0.1f); // 10% but no more than MAX_SPELL_RANGE_TOLERANCE @@ -6111,8 +6111,8 @@ uint32 Spell::CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spel if (spellInfo->HasAttribute(SPELL_ATTR_LEVEL_DAMAGE_CALCULATION)) { - GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(spellInfo->spellLevel - 1); - GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(caster->getLevel() - 1); + GtNPCManaCostScalerEntry const* spellScaler = sDBCgtNPCManaCostScaler.LookupEntry(spellInfo->spellLevel - 1); + GtNPCManaCostScalerEntry const* casterScaler = sDBCgtNPCManaCostScaler.LookupEntry(caster->getLevel() - 1); if (spellScaler && casterScaler) powerCost *= casterScaler->ratio / spellScaler->ratio; } @@ -6389,7 +6389,7 @@ SpellCastResult Spell::CheckItems() if (targetItem->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; - SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!pEnchant) return SPELL_FAILED_ERROR; if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND) @@ -6406,7 +6406,7 @@ SpellCastResult Spell::CheckItems() if (item->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; - SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!pEnchant) return SPELL_FAILED_ERROR; if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND) @@ -6967,7 +6967,7 @@ SpellCastResult Spell::CanOpenLock(SpellEffectIndex effIndex, uint32 lockId, Ski return SPELL_CAST_OK; // Get LockInfo - LockEntry const* lockInfo = sLockStore.LookupEntry(lockId); + LockEntry const* lockInfo = sDBCLock.LookupEntry(lockId); if (!lockInfo) return SPELL_FAILED_BAD_TARGETS; @@ -7269,9 +7269,9 @@ void Spell::ClearCastItem() void Spell::GetSpellRangeAndRadius(SpellEffectIndex effIndex, float& radius, bool targetB, uint32& EffectChainTarget) { if (m_spellInfo->EffectRadiusIndex[effIndex]) - radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex])); + radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex])); else - radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); + radius = GetSpellMaxRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); uint32 targetMode; if (!targetB) diff --git a/src/game/Spells/Spell.h b/src/game/Spells/Spell.h index afb8ecb4e11..af18f4548f1 100644 --- a/src/game/Spells/Spell.h +++ b/src/game/Spells/Spell.h @@ -515,7 +515,7 @@ class Spell return true; if (m_spellInfo->speed > 0.0f) - if (SpellVisualEntry const* spellVisual = sSpellVisualStore.LookupEntry(m_spellInfo->SpellVisual)) + if (SpellVisualEntry const* spellVisual = sDBCSpellVisual.LookupEntry(m_spellInfo->SpellVisual)) if (spellVisual->HasMissile) if (spellVisual->MissileModel == -4 || spellVisual->MissileModel == -5) return true; diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index 3476a8a934c..9a97c8f3f57 100755 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -343,12 +343,12 @@ Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 const* curr { if (!damage && castItem && castItem->GetItemSuffixFactor()) { - ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand_suffix = sDBCItemRandomSuffix.LookupEntry(abs(castItem->GetItemRandomPropertyId())); if (item_rand_suffix) { for (int k = 0; k < 3; ++k) { - SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]); + SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(item_rand_suffix->enchant_id[k]); if (pEnchant) { for (unsigned int t : pEnchant->spellid) @@ -434,7 +434,7 @@ AreaAura::AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 con // caster==nullptr in constructor args if target==caster in fact Unit* caster_ptr = caster ? caster : target; - m_radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[m_effIndex])); + m_radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spellproto->EffectRadiusIndex[m_effIndex])); if (Player* modOwner = caster_ptr->GetSpellModOwner()) modOwner->ApplySpellMod(spellproto->Id, SPELLMOD_RADIUS, m_radius); @@ -1528,7 +1528,7 @@ void Aura::TriggerSpell() break; } // // They Must Burn Bomb Aura -// case 36344: break; +// case 36344: break; case 36350: // They Must Burn Bomb Aura (self) trigger_spell_id = 36325; // They Must Burn Bomb Drop (DND) break; @@ -1895,7 +1895,7 @@ void Aura::TriggerSpell() // Reget trigger spell proto triggeredSpellInfo = sSpellTemplate.LookupEntry(trigger_spell_id); } - else + else { // for channeled spell cast applied from aura owner to channel target (persistent aura affects already applied to true target) // come periodic casts applied to targets, so need select proper caster (ex. 15790) @@ -3339,7 +3339,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) ShapeshiftForm form = ShapeshiftForm(m_modifier.m_miscvalue); - SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form); + SpellShapeshiftFormEntry const* ssEntry = sDBCSpellShapeshiftForm.LookupEntry(form); if (!ssEntry) { sLog.outError("Unknown shapeshift form %u in spell %u", form, GetId()); @@ -6812,7 +6812,7 @@ void Aura::HandleSpiritOfRedemption(bool apply, bool Real) if (target->IsNonMeleeSpellCasted(false)) target->InterruptNonMeleeSpells(false); - // set health and mana to maximum + // set health and mana to maximum target->SetPower(POWER_MANA, target->GetMaxPower(POWER_MANA)); } // die at aura end @@ -7536,7 +7536,7 @@ void Aura::PeriodicDummyTick() case 23487: // Separation Anxiety (Garr) if (Unit* caster = GetCaster()) { - float m_radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spell->EffectRadiusIndex[m_effIndex])); + float m_radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spell->EffectRadiusIndex[m_effIndex])); if (caster->IsAlive() && !caster->IsWithinDistInMap(target, m_radius)) target->CastSpell(target, (spell->Id == 21094 ? 21095 : 23492), TRIGGERED_OLD_TRIGGERED, nullptr); // Spell 21095: Separation Anxiety for Majordomo Executus' adds, 23492: Separation Anxiety for Garr's adds } @@ -7554,7 +7554,7 @@ void Aura::PeriodicDummyTick() case 37025: // Coilfang Water if (target->IsInSwimmableWater()) target->CastSpell(target, 37026, TRIGGERED_OLD_TRIGGERED, nullptr, this); - return; + return; case 39993: // Simon Game START timer, (DND) target->AI()->SendAIEvent(AI_EVENT_CUSTOM_A, target, target); break; @@ -7915,7 +7915,7 @@ void Aura::HandleFactionOverride(bool apply, bool Real) return; Unit* target = GetTarget(); - if (!target || !sFactionTemplateStore.LookupEntry(GetMiscValue())) + if (!target || !sDBCFactionTemplate.LookupEntry(GetMiscValue())) return; if (apply) @@ -8908,7 +8908,7 @@ GameObjectAura::GameObjectAura(SpellEntry const* spellproto, SpellEffectIndex ef } GameObjectAura::~GameObjectAura() -{ +{ } void GameObjectAura::Update(uint32 diff) diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index bf76deb81d4..dbfd2338b97 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -1702,7 +1702,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { if (unitTarget->IsAlive()) { - float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); + float radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); unitTarget->GetMotionMaster()->MoveFollow(m_caster, radius, 0); } return; @@ -3037,7 +3037,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // all poison enchantments is temporary if (uint32 enchant_id = item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)) { - SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!pEnchant) return; @@ -3421,11 +3421,11 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex) // special cases switch (triggered_spell_id) { - case 23209: // Terrordale Haunting Spirit + case 23209: // Terrordale Haunting Spirit if (urand(1, 100) > 55) return; break; - case 23253: // Terrordale Haunting Spirit + case 23253: // Terrordale Haunting Spirit if (urand(1, 100) > 35) return; break; @@ -3581,7 +3581,7 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) // TODO - Use target else orientation = unitTarget->GetOrientation(); } - + // Teleport if (m_targets.m_mapId == UINT32_MAX || m_targets.m_mapId == unitTarget->GetMapId()) { @@ -3594,7 +3594,7 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) // TODO - Use target else if (unitTarget->GetTypeId() == TYPEID_PLAYER) { Player* player = static_cast(unitTarget); - MapEntry const* targetMapEntry = sMapStore.LookupEntry(m_targets.m_mapId); + MapEntry const* targetMapEntry = sDBCMap.LookupEntry(m_targets.m_mapId); if (!targetMapEntry) return; if (!player->IsAlive() && targetMapEntry->IsDungeon()) @@ -4141,7 +4141,7 @@ void Spell::EffectPersistentAA(SpellEffectIndex eff_idx) if (!caster) caster = m_caster; - float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); + float radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); if (Player* modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this); @@ -4502,7 +4502,7 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx) // TODO add script for 35679 and 34877 uint32 prop_id = m_spellInfo->EffectMiscValueB[eff_idx]; - SummonPropertiesEntry const* summon_prop = sSummonPropertiesStore.LookupEntry(prop_id); + SummonPropertiesEntry const* summon_prop = sDBCSummonProperties.LookupEntry(prop_id); if (!summon_prop) { sLog.outError("EffectSummonType: Unhandled summon type %u", prop_id); @@ -4614,7 +4614,7 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx) } // Set summon positions - float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); + float radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); CreatureSummonPositions::iterator itr = summonPositions.begin(); for (++itr; itr != summonPositions.end(); ++itr) // In case of multiple summons around position for not-fist positions { @@ -5440,7 +5440,7 @@ void Spell::EffectEnchantItemPerm(SpellEffectIndex eff_idx) if (!enchant_id) return; - SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!pEnchant) return; @@ -5537,7 +5537,7 @@ void Spell::EffectEnchantItemTmp(SpellEffectIndex eff_idx) return; } - SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!pEnchant) { sLog.outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have nonexistent enchanting id %u ", m_spellInfo->Id, eff_idx, enchant_id); @@ -8445,7 +8445,7 @@ void Spell::EffectEnchantHeldItem(SpellEffectIndex eff_idx) if (!duration) duration = 10; // 10 seconds for enchants which don't have listed duration - SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); if (!pEnchant) return; @@ -9199,13 +9199,13 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx) // FIXME: this can be better check for most objects but still hack else if (m_spellInfo->EffectRadiusIndex[eff_idx] && m_spellInfo->speed == 0) { - float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); + float dis = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } else { - float min_dis = GetSpellMinRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); - float max_dis = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); + float min_dis = GetSpellMinRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); + float max_dis = GetSpellMaxRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); float dis = rand_norm_f() * (max_dis - min_dis) + min_dis; // special code for fishing bobber (TARGET_LOCATION_CASTER_FISHING_SPOT), should not try to avoid objects @@ -9478,7 +9478,7 @@ void Spell::EffectPlaySound(SpellEffectIndex eff_idx) return; uint32 soundId = m_spellInfo->EffectMiscValue[eff_idx]; - if (!sSoundEntriesStore.LookupEntry(soundId)) + if (!sDBCSoundEntries.LookupEntry(soundId)) { sLog.outError("EffectPlaySound: Sound (Id: %u) in spell %u does not exist.", soundId, m_spellInfo->Id); return; @@ -9493,7 +9493,7 @@ void Spell::EffectPlayMusic(SpellEffectIndex eff_idx) return; uint32 soundId = m_spellInfo->EffectMiscValue[eff_idx]; - if (!sSoundEntriesStore.LookupEntry(soundId)) + if (!sDBCSoundEntries.LookupEntry(soundId)) { sLog.outError("EffectPlayMusic: Sound (Id: %u) in spell %u does not exist.", soundId, m_spellInfo->Id); return; diff --git a/src/game/Spells/SpellHandler.cpp b/src/game/Spells/SpellHandler.cpp index 2064ee9c6ce..c3740a7b6f2 100644 --- a/src/game/Spells/SpellHandler.cpp +++ b/src/game/Spells/SpellHandler.cpp @@ -210,7 +210,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) uint32 lockId = proto->LockID; if (lockId && !pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_UNLOCKED)) { - LockEntry const* lockInfo = sLockStore.LookupEntry(lockId); + LockEntry const* lockInfo = sDBCLock.LookupEntry(lockId); if (!lockInfo) { diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index 98d2eaa68ef..76f409f399e 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -29,7 +29,7 @@ bool IsPrimaryProfessionSkill(uint32 skill) { - SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); + SkillLineEntry const* pSkill = sDBCSkillLine.LookupEntry(skill); if (!pSkill) return false; @@ -57,7 +57,7 @@ int32 GetSpellDuration(SpellEntry const* spellInfo) { if (!spellInfo) return 0; - SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex); + SpellDurationEntry const* du = sDBCSpellDuration.LookupEntry(spellInfo->DurationIndex); if (!du) return 0; return (du->Duration[0] == -1) ? -1 : abs(du->Duration[0]); @@ -67,7 +67,7 @@ int32 GetSpellMaxDuration(SpellEntry const* spellInfo) { if (!spellInfo) return 0; - SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex); + SpellDurationEntry const* du = sDBCSpellDuration.LookupEntry(spellInfo->DurationIndex); if (!du) return 0; return (du->Duration[2] == -1) ? -1 : abs(du->Duration[2]); @@ -136,7 +136,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, WorldObject* caster, Spell* return 0; } - SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex); + SpellCastTimesEntry const* spellCastTimeEntry = sDBCSpellCastTimes.LookupEntry(spellInfo->CastingTimeIndex); // not all spells have cast time index and this is all is passive abilities if (!spellCastTimeEntry) @@ -519,7 +519,7 @@ SpellCastResult GetErrorAtShapeshiftedCast(SpellEntry const* spellInfo, uint32 f bool actAsShifted = false; if (form > 0) { - SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form); + SpellShapeshiftFormEntry const* shapeInfo = sDBCSpellShapeshiftForm.LookupEntry(form); if (!shapeInfo) { sLog.outError("GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); @@ -580,7 +580,7 @@ void SpellMgr::LoadSpellTargetPositions() st.target_Z = fields[4].GetFloat(); st.target_Orientation = fields[5].GetFloat(); - MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId); + MapEntry const* mapEntry = sDBCMap.LookupEntry(st.target_mapId); if (!mapEntry) { sLog.outErrorDb("Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId); @@ -1521,9 +1521,9 @@ void SpellMgr::LoadSpellChains() mSpellChainsNext.clear(); // need for reload case // load known data for talents - for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) + for (unsigned int i = 0; i < sDBCTalent.GetNumRows(); ++i) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); if (!talentInfo) continue; @@ -1750,7 +1750,7 @@ void SpellMgr::LoadSpellChains() continue; } - if (TalentEntry const* talentEntry = sTalentStore.LookupEntry(pos->talent_id)) + if (TalentEntry const* talentEntry = sDBCTalent.LookupEntry(pos->talent_id)) { if (node.first != talentEntry->RankID[0]) { @@ -2520,7 +2520,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const* spell if (spellInfo->HasAttribute(SPELL_ATTR_EX4_CAST_ONLY_IN_OUTLAND) && !(player && player->IsGameMaster())) { uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id); - MapEntry const* mapEntry = sMapStore.LookupEntry(v_map); + MapEntry const* mapEntry = sDBCMap.LookupEntry(v_map); if (!mapEntry || mapEntry->addon < 1 || !mapEntry->IsContinent()) return SPELL_FAILED_REQUIRES_AREA; } @@ -2528,7 +2528,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const* spell // raid instance limitation if (spellInfo->HasAttribute(SPELL_ATTR_EX6_NOT_IN_RAID_INSTANCE)) { - MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); + MapEntry const* mapEntry = sDBCMap.LookupEntry(map_id); if (!mapEntry || mapEntry->IsRaid()) return SPELL_FAILED_REQUIRES_AREA; } @@ -2584,7 +2584,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const* spell case 24171: // Resurrection Impact Visual case 44535: // Spirit Heal (mana) { - MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); + MapEntry const* mapEntry = sDBCMap.LookupEntry(map_id); if (!mapEntry) return SPELL_FAILED_REQUIRES_AREA; return mapEntry->IsBattleGround() ? SPELL_CAST_OK : SPELL_FAILED_ONLY_BATTLEGROUNDS; @@ -2624,14 +2624,14 @@ void SpellMgr::LoadSkillLineAbilityMaps() mSkillLineAbilityMapBySpellId.clear(); mSkillLineAbilityMapBySkillId.clear(); - const uint32 rows = sSkillLineAbilityStore.GetNumRows(); + const uint32 rows = sDBCSkillLineAbility.GetNumRows(); uint32 count = 0; BarGoLink bar(rows); for (uint32 row = 0; row < rows; ++row) { bar.step(); - if (SkillLineAbilityEntry const* entry = sSkillLineAbilityStore.LookupEntry(row)) + if (SkillLineAbilityEntry const* entry = sDBCSkillLineAbility.LookupEntry(row)) { mSkillLineAbilityMapBySpellId.insert(SkillLineAbilityMap::value_type(entry->spellId, entry)); mSkillLineAbilityMapBySkillId.insert(SkillLineAbilityMap::value_type(entry->skillId, entry)); @@ -2647,18 +2647,15 @@ void SpellMgr::LoadSkillRaceClassInfoMap() { mSkillRaceClassInfoMap.clear(); - BarGoLink bar(sSkillRaceClassInfoStore.GetNumRows()); + BarGoLink bar(sDBCSkillRaceClassInfo.GetNumRows()); uint32 count = 0; - for (uint32 i = 0; i < sSkillRaceClassInfoStore.GetNumRows(); ++i) + for (auto skillRCInfo : sDBCSkillRaceClassInfo) { bar.step(); - SkillRaceClassInfoEntry const* skillRCInfo = sSkillRaceClassInfoStore.LookupEntry(i); - if (!skillRCInfo) - continue; // not all skills really listed in ability skills list - if (!sSkillLineStore.LookupEntry(skillRCInfo->skillId)) + if (!sDBCSkillLine.LookupEntry(skillRCInfo->skillId)) continue; mSkillRaceClassInfoMap.insert(SkillRaceClassInfoMap::value_type(skillRCInfo->skillId, skillRCInfo)); diff --git a/src/game/Spells/SpellMgr.h b/src/game/Spells/SpellMgr.h index 19babd60442..129cd814e75 100644 --- a/src/game/Spells/SpellMgr.h +++ b/src/game/Spells/SpellMgr.h @@ -1306,7 +1306,7 @@ inline bool IsPositiveSpell(uint32 spellId, const WorldObject* caster = nullptr, inline void GetChainJumpRange(SpellEntry const* spellInfo, SpellEffectIndex effIdx, float& minSearchRangeCaster, float& maxSearchRangeTarget) { - const SpellRangeEntry* range = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); + const SpellRangeEntry* range = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE) maxSearchRangeTarget = range->maxRange; else diff --git a/src/game/Spells/UnitAuraProcHandler.cpp b/src/game/Spells/UnitAuraProcHandler.cpp index e1636e8aa41..5aa1ea109da 100644 --- a/src/game/Spells/UnitAuraProcHandler.cpp +++ b/src/game/Spells/UnitAuraProcHandler.cpp @@ -2797,7 +2797,7 @@ SpellAuraProcResult Unit::HandleOverrideClassScriptAuraProc(ProcExecutionData& d triggered_spell_id = 28750; // Blessing of the Claw break; case 5497: // Improved Mana Gems (Serpent-Coil Braid) - CastSpell(pVictim, 37445, TRIGGERED_NONE); // Mana Surge + CastSpell(pVictim, 37445, TRIGGERED_NONE); // Mana Surge return SPELL_AURA_PROC_OK; case 5510: // Flexibility - T4 Holy Priest bonus RemoveAurasDueToSpell(37565); @@ -2844,9 +2844,9 @@ SpellAuraProcResult Unit::HandleRaidProcFromChargeAuraProc(ProcExecutionData& da { float radius; if (spellProto->EffectRadiusIndex[effIdx]) - radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); + radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); else - radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(spellProto->rangeIndex)); + radius = GetSpellMaxRange(sDBCSpellRange.LookupEntry(spellProto->rangeIndex)); if (Unit* caster = triggeredByAura->GetCaster()) { @@ -2918,9 +2918,9 @@ SpellAuraProcResult Unit::HandleRaidProcFromChargeWithValueAuraProc(ProcExecutio { float radius; if (spellProto->EffectRadiusIndex[effIdx]) - radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); + radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); else - radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(spellProto->rangeIndex)); + radius = GetSpellMaxRange(sDBCSpellRange.LookupEntry(spellProto->rangeIndex)); if (Player* caster = static_cast(triggeredByAura->GetCaster())) { diff --git a/src/game/Tools/CharacterDatabaseCleaner.cpp b/src/game/Tools/CharacterDatabaseCleaner.cpp index b094b7e2901..cd1c175d039 100644 --- a/src/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/game/Tools/CharacterDatabaseCleaner.cpp @@ -91,7 +91,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table bool CharacterDatabaseCleaner::SkillCheck(uint32 skill) { - return sSkillLineStore.LookupEntry(skill) != nullptr; + return sDBCSkillLine.LookupEntry(skill) != nullptr; } void CharacterDatabaseCleaner::CleanCharacterSkills() diff --git a/src/game/World/World.cpp b/src/game/World/World.cpp index 6c3ee56bd14..cfc9c2a7b73 100644 --- a/src/game/World/World.cpp +++ b/src/game/World/World.cpp @@ -1409,7 +1409,7 @@ void World::DetectDBCLang() m_lang_confid = DEFAULT_LOCALE; } - ChrRacesEntry const* race = sChrRacesStore.LookupEntry(RACE_HUMAN); + ChrRacesEntry const* race = sDBCChrRaces.LookupEntry(RACE_HUMAN); MANGOS_ASSERT(race); std::string availableLocalsStr; diff --git a/src/game/vmap/GameObjectModel.cpp b/src/game/vmap/GameObjectModel.cpp index 0068fc47818..7c14628006f 100644 --- a/src/game/vmap/GameObjectModel.cpp +++ b/src/game/vmap/GameObjectModel.cpp @@ -126,7 +126,7 @@ bool GameObjectModel::initialize(const GameObject* const pGo, const GameObjectDi GameObjectModel* GameObjectModel::construct(const GameObject* const pGo) { - const GameObjectDisplayInfoEntry* info = sGameObjectDisplayInfoStore.LookupEntry(pGo->GetDisplayId()); + const GameObjectDisplayInfoEntry* info = sDBCGameObjectDisplayInfo.LookupEntry(pGo->GetDisplayId()); if (!info) return nullptr; From 84ba747ecbc7c82d016daf90bca437fda2e0a76a Mon Sep 17 00:00:00 2001 From: Cyberium Date: Tue, 9 Mar 2021 23:02:24 +0100 Subject: [PATCH 24/28] Some fixes to make it run again. --- src/game/Maps/MapPersistentStateMgr.cpp | 8 +- src/game/Server/DBCStores.cpp | 2 +- src/game/Server/SQLStorages.cpp | 98 ++++++++++++------------- src/shared/Database/DBCFileLoader.h | 1 + src/shared/Database/SQLStorageImpl.h | 4 +- 5 files changed, 56 insertions(+), 57 deletions(-) diff --git a/src/game/Maps/MapPersistentStateMgr.cpp b/src/game/Maps/MapPersistentStateMgr.cpp index 9c340f82e28..c38f2394b74 100644 --- a/src/game/Maps/MapPersistentStateMgr.cpp +++ b/src/game/Maps/MapPersistentStateMgr.cpp @@ -406,7 +406,7 @@ void DungeonResetScheduler::LoadResetTimes() // load the global respawn times for raid/heroic instances uint32 diff = sWorld.getConfig(CONFIG_UINT32_INSTANCE_RESET_TIME_HOUR) * HOUR; - m_resetTimeByMapId.resize(sDBCMap.GetNumRows() + 1); + m_resetTimeByMapId.resize(sDBCMap.GetMaxEntry()); result = CharacterDatabase.Query("SELECT mapid, resettime FROM instance_reset"); if (result) { @@ -443,12 +443,8 @@ void DungeonResetScheduler::LoadResetTimes() // calculate new global reset times for expired instances and those that have never been reset yet // add the global reset times to the priority queue - for (uint32 i = 0; i < sInstanceTemplate.GetMaxEntry(); i++) + for (auto temp : sInstanceTemplate) { - InstanceTemplate const* temp = ObjectMgr::GetInstanceTemplate(i); - if (!temp) - continue; - // only raid/heroic maps have a global reset time MapEntry const* mapEntry = sDBCMap.LookupEntry(temp->map); if (!mapEntry || !mapEntry->IsDungeon() || !mapEntry->HasResetTime()) diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 6eeca81fbc3..6cb7ef420b4 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -460,7 +460,7 @@ void LoadDBCStores(const std::string& dataPath) // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathStore, dbcPath, "TaxiPath.dbc"); for (auto entry : sDBCTaxiPath) sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price); - uint32 pathCount = sDBCTaxiPath.GetNumRows(); + uint32 pathCount = sDBCTaxiPath.GetMaxEntry(); //## TaxiPathNode.dbc ## Loaded only for initialization different structures // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathNodeStore, dbcPath, "TaxiPathNode.dbc"); diff --git a/src/game/Server/SQLStorages.cpp b/src/game/Server/SQLStorages.cpp index 27bd5437f90..57c4ec8e48c 100644 --- a/src/game/Server/SQLStorages.cpp +++ b/src/game/Server/SQLStorages.cpp @@ -71,35 +71,35 @@ SQLStorage const* GetSpellStore() { return &sSpellTemplate; } // DBC store in database -const char AreaTablefmt[] = "iiinixxxxxissssssssssssssssxiiiiixx"; +const char AreaTablefmt[] = "iiiniwwwwwisssssssssssssssswiiiiiww"; const char AreaTriggerfmt[] = "niffffffff"; -const char AuctionHousefmt[] = "niiixxxxxxxxxxxxxxxxx"; +const char AuctionHousefmt[] = "niiiwwwwwwwwwwwwwwwww"; const char BankBagSlotPricesfmt[] = "ni"; -const char BattlemasterListfmt[] = "niiiiiiiiiiiixxssssssssssssssssxx"; -const char CharStartOutfitsrcfmt[] = "dbbbbiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxx"; const char CharStartOutfitdstfmt[] = "diiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxx"; -const char CharTitlesfmt[] = "nxssssssssssssssssxxxxxxxxxxxxxxxxxxi"; -const char ChatChannelsfmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxx"; -const char ChrClassesfmt[] = "nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix"; -const char ChrRacesfmt[] = "nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; +const char BattlemasterListfmt[] = "niiiiiiiiiiiiwwssssssssssssssssww"; +const char CharStartOutfitfmt[] = "dbbbbiiiiiiiiiiiiwwwwwwwwwwwwwwwwwwwwwwww"; +const char CharTitlesfmt[] = "nwsssssssssssssssswwwwwwwwwwwwwwwwwwi"; +const char ChatChannelsfmt[] = "niwsssssssssssssssswwwwwwwwwwwwwwwwww"; +const char ChrClassesfmt[] = "nwiwsssssssssssssssswwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwiw"; +const char ChrRacesfmt[] = "nwiwiiwwiwwwwisssssssssssssssswwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwi"; const char CinematicCamerafmt[] = "nsiffff"; -const char CinematicSequencesfmt[] = "nxixxxxxxx"; -const char CreatureDisplayInfofmt[] = "nixifxxxxxxxxx"; -const char CreatureDisplayInfoExtrafmt[] = "nixxxxxxxxxxxxxxxxxxx"; -const char CreatureFamilyfmt[] = "nfifiiiissssssssssssssssxx"; -const char CreatureModelDatafmt[] = "nixxfxxxxxxxxxxffxxxxxxx"; -const char CreatureSpellDatafmt[] = "niiiixxxx"; -const char CreatureTypefmt[] = "nxxxxxxxxxxxxxxxxxx"; +const char CinematicSequencesfmt[] = "nwiwwwwwww"; +const char CreatureDisplayInfofmt[] = "niwifwwwwwwwww"; +const char CreatureDisplayInfoExtrafmt[] = "niwwwwwwwwwwwwwwwwwww"; +const char CreatureFamilyfmt[] = "nfifiiiissssssssssssssssww"; +const char CreatureModelDatafmt[] = "niwwfwwwwwwwwwwffwwwwwww"; +const char CreatureSpellDatafmt[] = "niiiiwwww"; +const char CreatureTypefmt[] = "nwwwwwwwwwwwwwwwwww"; const char DurabilityCostsfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiii"; const char DurabilityQualityfmt[] = "nf"; -const char Emotesfmt[] = "nxxiiix"; -const char EmotesTextfmt[] = "nxixxxxxxxxxxxxxxxx"; +const char Emotesfmt[] = "nwwiiiw"; +const char EmotesTextfmt[] = "nwiwwwwwwwwwwwwwwww"; const char FactionTemplatefmt[] = "niiiiiiiiiiiii"; -const char GameObjectDisplayInfofmt[] = "nsxxxxxxxxxxffffff"; -const char GemPropertiesfmt[] = "nixxi"; +const char GameObjectDisplayInfofmt[] = "nswwwwwwwwwwffffff"; +const char GemPropertiesfmt[] = "niwwi"; const char GMSurveyCurrentSurveyfmt[] = "ni"; -const char GMSurveyQuestionsfmt[] = "nssssssssssssssssx"; +const char GMSurveyQuestionsfmt[] = "nssssssssssssssssw"; const char GMSurveySurveysfmt[] = "niiiiiiiiii"; -const char GMTicketCategoryfmt[] = "nssssssssssssssssx"; +const char GMTicketCategoryfmt[] = "nssssssssssssssssw"; const char gtCombatRatingsfmt[] = "f"; const char gtChanceToMeleeCritBasefmt[] = "f"; const char gtChanceToMeleeCritfmt[] = "f"; @@ -110,50 +110,50 @@ const char gtNPCManaCostScalerfmt[] = "f"; const char gtRegenHPPerSptfmt[] = "f"; const char gtRegenMPPerSptfmt[] = "f"; const char Itemfmt[] = "niii"; -const char ItemBagFamilyfmt[] = "nxxxxxxxxxxxxxxxxx"; -const char ItemClassfmt[] = "nxxssssssssssssssssx"; +const char ItemBagFamilyfmt[] = "nwwwwwwwwwwwwwwwww"; +const char ItemClassfmt[] = "nwwssssssssssssssssw"; const char ItemExtendedCostfmt[] = "niiiiiiiiiiiii"; -const char ItemRandomPropertiesfmt[] = "nxiiixxssssssssssssssssx"; -const char ItemRandomSuffixfmt[] = "nssssssssssssssssxxiiiiii"; -const char ItemSetfmt[] = "nssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii"; +const char ItemRandomPropertiesfmt[] = "nwiiiwwssssssssssssssssw"; +const char ItemRandomSuffixfmt[] = "nsssssssssssssssswwiiiiii"; +const char ItemSetfmt[] = "nsssssssssssssssswwwwwwwwwwwwwwwwwwiiiiiiiiiiiiiiiiii"; const char LiquidTypefmt[] = "niii"; -const char Lockfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; -const char MailTemplatefmt[] = "nxxxxxxxxxxxxxxxxxssssssssssssssssx"; -const char Mapfmt[] = "nxixssssssssssssssssxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiffiixxi"; -const char QuestSortfmt[] = "nxxxxxxxxxxxxxxxxx"; +const char Lockfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiwwwwwwww"; +const char MailTemplatefmt[] = "nwwwwwwwwwwwwwwwwwssssssssssssssssw"; +const char Mapfmt[] = "nwiwsssssssssssssssswwwwwwwiwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwiwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwiffiiwwi"; +const char QuestSortfmt[] = "nwwwwwwwwwwwwwwwww"; const char RandPropPointsfmt[] = "niiiiiiiiiiiiiii"; -const char SkillLinefmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxxi"; -const char SkillLineAbilityfmt[] = "niiiixxiiiiixxi"; -const char SkillRaceClassInfofmt[] = "xiiiiiix"; +const char SkillLinefmt[] = "niwsssssssssssssssswwwwwwwwwwwwwwwwwwi"; +const char SkillLineAbilityfmt[] = "niiiiwwiiiiiwwi"; +const char SkillRaceClassInfofmt[] = "wiiiiiiw"; const char SkillTiersfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; -const char SoundEntriesfmt[] = "nxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; +const char SoundEntriesfmt[] = "nwwwwwwwwwwwwwwwwwwwwwwwwwwww"; const char SpellCastTimesfmt[] = "niii"; const char SpellDurationfmt[] = "niii"; -const char SpellFocusObjectfmt[] = "nxxxxxxxxxxxxxxxxx"; -const char SpellItemEnchantmentfmt[] = "niiiiiixxxiiissssssssssssssssxiiii"; -const char SpellItemEnchantmentConditionfmt[] = "nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; -const char SpellRadiusfmt[] = "nfxx"; -const char SpellRangefmt[] = "nffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; -const char SpellShapeshiftFormfmt[] = "nxxxxxxxxxxxxxxxxxxiixiixxxiiiiiiii"; -const char SpellVisualfmt[] = "nxxxxxiixxxxxxxxxxxxxxxxx"; +const char SpellFocusObjectfmt[] = "nwwwwwwwwwwwwwwwww"; +const char SpellItemEnchantmentfmt[] = "niiiiiiwwwiiisssssssssssssssswiiii"; +const char SpellItemEnchantmentConditionfmt[] = "nbbbbbwwwwwbbbbbbbbbbiiiiiwwwww"; +const char SpellRadiusfmt[] = "nfww"; +const char SpellRangefmt[] = "nffiwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"; +const char SpellShapeshiftFormfmt[] = "nwwwwwwwwwwwwwwwwwwiiwiiwwwiiiiiiii"; +const char SpellVisualfmt[] = "nwwwwwiiwwwwwwwwwwwwwwwww"; const char StableSlotPricesfmt[] = "ni"; const char SummonPropertiesfmt[] = "niiiii"; -const char Talentfmt[] = "niiiiiiiixxxxixxixxxi"; -const char TalentTabfmt[] = "nxxxxxxxxxxxxxxxxxxxiix"; -const char TaxiNodesfmt[] = "nifffssssssssssssssssxii"; +const char Talentfmt[] = "niiiiiiiiwwwwiwwiwwwi"; +const char TalentTabfmt[] = "nwwwwwwwwwwwwwwwwwwwiiw"; +const char TaxiNodesfmt[] = "nifffsssssssssssssssswii"; const char TaxiPathfmt[] = "niii"; const char TaxiPathNodefmt[] = "diiifffiiii"; -const char TransportAnimationfmt[] = "diifffx"; -const char TotemCategoryfmt[] = "nxxxxxxxxxxxxxxxxxii"; -const char WorldMapAreafmt[] = "diixffffi"; -const char WMOAreaTablefmt[] = "niiixxxxxiixxxxxxxxxxxxxxxxx"; +const char TransportAnimationfmt[] = "diifffw"; +const char TotemCategoryfmt[] = "nwwwwwwwwwwwwwwwwwii"; +const char WorldMapAreafmt[] = "diiwffffi"; +const char WMOAreaTablefmt[] = "niiiwwwwwiiwwwwwwwwwwwwwwwww"; SQLStorage sDBCAreaTable(AreaTablefmt, "dbc_areatable"); SQLStorage sDBCAreaTrigger(AreaTriggerfmt, "dbc_areatrigger"); SQLStorage sDBCAuctionHouse(AuctionHousefmt, "dbc_auctionhouse"); SQLStorage sDBCBankBagSlotPrices(BankBagSlotPricesfmt, "dbc_bankbagslotprices"); SQLStorage sDBCBattlemasterList(BattlemasterListfmt, "dbc_battlemasterlist"); -SQLStorage sDBCCharStartOutfit(CharStartOutfitsrcfmt, CharStartOutfitdstfmt, "", "dbc_charstartoutfit"); +SQLStorage sDBCCharStartOutfit(CharStartOutfitfmt, "dbc_charstartoutfit"); SQLStorage sDBCCharTitles(CharTitlesfmt, "dbc_chartitles"); SQLStorage sDBCChatChannels(ChatChannelsfmt, "dbc_chatchannels"); SQLStorage sDBCChrClasses(ChrClassesfmt, "dbc_chrclasses"); diff --git a/src/shared/Database/DBCFileLoader.h b/src/shared/Database/DBCFileLoader.h index 3c013e70cac..17f18aa21a7 100644 --- a/src/shared/Database/DBCFileLoader.h +++ b/src/shared/Database/DBCFileLoader.h @@ -25,6 +25,7 @@ enum FieldFormat { FT_NA = 'x', // ignore/ default, 4 byte size, in Source String means field is ignored, in Dest String means field is filled with default value + FT_NA2 = 'w', // ignore 4 byte size, in Source and in Dest String FT_NA_BYTE = 'X', // ignore/ default, 1 byte size, see above FT_NA_FLOAT = 'F', // ignore/ default, float size, see above FT_NA_POINTER = 'p', // fill default value into dest, pointer size, Use this only with static data (otherwise mem-leak) diff --git a/src/shared/Database/SQLStorageImpl.h b/src/shared/Database/SQLStorageImpl.h index dba56d2a8d6..77206f1773a 100644 --- a/src/shared/Database/SQLStorageImpl.h +++ b/src/shared/Database/SQLStorageImpl.h @@ -159,7 +159,7 @@ void SQLStorageLoaderBase::storeValue(V value, Stor offset += sizeof(uint64); break; case FT_SORT: - assert(false && "SQL storage not have sort field types"); + case FT_NA2: break; default: assert(false && "unknown format character"); @@ -360,6 +360,7 @@ void SQLStorageLoaderBase::Load(StorageClass& store case FT_64BITINT: recordsize += sizeof(uint64); break; case FT_SORT: + case FT_NA2: break; default: assert(false && "unknown format character"); @@ -417,6 +418,7 @@ void SQLStorageLoaderBase::Load(StorageClass& store case FT_STRING: storeValue((char const*)fields[y].GetString(), store, record, x, offset); ++x; break; case FT_64BITINT: storeValue(fields[y].GetUInt64(), store, record, x, offset); ++x; break; case FT_SORT: + case FT_NA2: ++x; break; From 413b280c51eb70ac51d3730f829295cff9207aaf Mon Sep 17 00:00:00 2001 From: Cyberium Date: Wed, 10 Mar 2021 00:27:56 +0100 Subject: [PATCH 25/28] More loop convertion --- src/game/Chat/Level3.cpp | 6 +---- src/game/Entities/MiscHandler.cpp | 8 ++----- src/game/Entities/Player.cpp | 29 +++++++----------------- src/game/Globals/ObjectMgr.cpp | 24 ++++++++------------ src/game/PlayerBot/Base/PlayerbotAI.cpp | 23 ++++++------------- src/game/PlayerBot/Base/PlayerbotMgr.cpp | 7 +----- src/game/Server/DBCStores.cpp | 15 ++++-------- src/game/Spells/SpellMgr.cpp | 20 +++++----------- 8 files changed, 39 insertions(+), 93 deletions(-) diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp index 86f4e2caecb..b6badb93a66 100644 --- a/src/game/Chat/Level3.cpp +++ b/src/game/Chat/Level3.cpp @@ -1563,12 +1563,8 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(char* /*args*/) Player* player = m_session->GetPlayer(); uint32 classMask = player->getClassMask(); - for (uint32 i = 0; i < sDBCTalent.GetNumRows(); ++i) + for (auto talentInfo : sDBCTalent) { - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); - if (!talentInfo) - continue; - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; diff --git a/src/game/Entities/MiscHandler.cpp b/src/game/Entities/MiscHandler.cpp index 2787aa00044..5ee3d28bb7d 100644 --- a/src/game/Entities/MiscHandler.cpp +++ b/src/game/Entities/MiscHandler.cpp @@ -1065,12 +1065,8 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) uint32 talentTabId = talentTabIds[i]; // fill by real data - for (uint32 talentId = 0; talentId < sDBCTalent.GetNumRows(); ++talentId) + for (auto talentInfo : sDBCTalent) { - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(talentId); - if (!talentInfo) - continue; - // skip another tab talents if (talentInfo->TalentTab != talentTabId) continue; @@ -1091,7 +1087,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) continue; // 1 rank talent bit index - uint32 curtalent_index = talentTabPos + GetTalentInspectBitPosInTab(talentId); + uint32 curtalent_index = talentTabPos + GetTalentInspectBitPosInTab(talentInfo->TalentID); uint32 curtalent_rank_index = curtalent_index + curtalent_maxrank - 1; diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index 6446b1ae747..b3ffe5f272e 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -3274,11 +3274,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen { // Check if a spell is learned by a talent first bool talent = false; - for (uint32 i = 0; i < sDBCTalent.GetNumRows(); ++i) + for (auto talentInfo : sDBCTalent) { - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); - if (!talentInfo) - continue; TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo || !(getClassMask() & talentTabInfo->ClassMask)) continue; @@ -3784,13 +3781,8 @@ bool Player::resetTalents(bool no_cost) } } - for (unsigned int i = 0; i < sDBCTalent.GetNumRows(); ++i) + for (auto talentInfo : sDBCTalent) { - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); - - if (!talentInfo) - continue; - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) @@ -21166,23 +21158,18 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) uint32 tTab = talentInfo->TalentTab; if (talentInfo->Row > 0) { - unsigned int numRows = sDBCTalent.GetNumRows(); - for (unsigned int i = 0; i < numRows; ++i) // Loop through all talents. + for (auto tmpTalent : sDBCTalent) // Loop through all talents. { // Someday, someone needs to revamp - const TalentEntry* tmpTalent = sDBCTalent.LookupEntry(i); - if (tmpTalent) // the way talents are tracked + if (tmpTalent->TalentTab == tTab) { - if (tmpTalent->TalentTab == tTab) + for (int j = 0; j < MAX_TALENT_RANK; ++j) { - for (int j = 0; j < MAX_TALENT_RANK; ++j) + if (tmpTalent->RankID[j] != 0) { - if (tmpTalent->RankID[j] != 0) + if (HasSpell(tmpTalent->RankID[j])) { - if (HasSpell(tmpTalent->RankID[j])) - { - spentPoints += j + 1; - } + spentPoints += j + 1; } } } diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index d171d38e3be..a115c92c644 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -1067,48 +1067,44 @@ void ObjectMgr::LoadCreatureModelInfo() } // character races expected have model info data in table - for (uint32 race = 1; race < sDBCChrRaces.GetNumRows(); ++race) + for (auto raceEntry : sDBCChrRaces) { - ChrRacesEntry const* raceEntry = sDBCChrRaces.LookupEntry(race); - if (!raceEntry) - continue; - - if (!((1 << (race - 1)) & RACEMASK_ALL_PLAYABLE)) + if (!((1 << (raceEntry->RaceID - 1)) & RACEMASK_ALL_PLAYABLE)) continue; if (CreatureModelInfo const* minfo = GetCreatureModelInfo(raceEntry->model_f)) { if (minfo->gender != GENDER_FEMALE) - sLog.outErrorDb("Table `creature_model_info` have wrong gender %u for character race %u female model id %u", minfo->gender, race, raceEntry->model_f); + sLog.outErrorDb("Table `creature_model_info` have wrong gender %u for character race %u female model id %u", minfo->gender, raceEntry->RaceID, raceEntry->model_f); if (minfo->modelid_other_gender != raceEntry->model_m) - sLog.outErrorDb("Table `creature_model_info` have wrong other gender model id %u for character race %u female model id %u", minfo->modelid_other_gender, race, raceEntry->model_f); + sLog.outErrorDb("Table `creature_model_info` have wrong other gender model id %u for character race %u female model id %u", minfo->modelid_other_gender, raceEntry->RaceID, raceEntry->model_f); if (minfo->bounding_radius <= 0.0f) { - sLog.outErrorDb("Table `creature_model_info` have wrong bounding_radius %f for character race %u female model id %u, use %f instead", minfo->bounding_radius, race, raceEntry->model_f, DEFAULT_WORLD_OBJECT_SIZE); + sLog.outErrorDb("Table `creature_model_info` have wrong bounding_radius %f for character race %u female model id %u, use %f instead", minfo->bounding_radius, raceEntry->RaceID, raceEntry->model_f, DEFAULT_WORLD_OBJECT_SIZE); const_cast(minfo)->bounding_radius = DEFAULT_WORLD_OBJECT_SIZE; } } else - sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f); + sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", raceEntry->RaceID, raceEntry->model_f); if (CreatureModelInfo const* minfo = GetCreatureModelInfo(raceEntry->model_m)) { if (minfo->gender != GENDER_MALE) - sLog.outErrorDb("Table `creature_model_info` have wrong gender %u for character race %u male model id %u", minfo->gender, race, raceEntry->model_m); + sLog.outErrorDb("Table `creature_model_info` have wrong gender %u for character race %u male model id %u", minfo->gender, raceEntry->RaceID, raceEntry->model_m); if (minfo->modelid_other_gender != raceEntry->model_f) - sLog.outErrorDb("Table `creature_model_info` have wrong other gender model id %u for character race %u male model id %u", minfo->modelid_other_gender, race, raceEntry->model_m); + sLog.outErrorDb("Table `creature_model_info` have wrong other gender model id %u for character race %u male model id %u", minfo->modelid_other_gender, raceEntry->RaceID, raceEntry->model_m); if (minfo->bounding_radius <= 0.0f) { - sLog.outErrorDb("Table `creature_model_info` have wrong bounding_radius %f for character race %u male model id %u, use %f instead", minfo->bounding_radius, race, raceEntry->model_f, DEFAULT_WORLD_OBJECT_SIZE); + sLog.outErrorDb("Table `creature_model_info` have wrong bounding_radius %f for character race %u male model id %u, use %f instead", minfo->bounding_radius, raceEntry->RaceID, raceEntry->model_f, DEFAULT_WORLD_OBJECT_SIZE); const_cast(minfo)->bounding_radius = DEFAULT_WORLD_OBJECT_SIZE; } } else - sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m); + sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", raceEntry->RaceID, raceEntry->model_m); } sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.GetNumRows()); diff --git a/src/game/PlayerBot/Base/PlayerbotAI.cpp b/src/game/PlayerBot/Base/PlayerbotAI.cpp index 94eed4365f4..8401aeb3a75 100644 --- a/src/game/PlayerBot/Base/PlayerbotAI.cpp +++ b/src/game/PlayerBot/Base/PlayerbotAI.cpp @@ -9505,12 +9505,8 @@ void PlayerbotAI::_HandleCommandTalent(std::string& text, Player& fromPlayer) uint32 talentTabId = talentTabIds[i]; uint32 classMask = m_bot->getClassMask(); - for (uint32 ts = 0; ts < sDBCTalent.GetNumRows(); ++ts) + for (auto talentInfo : sDBCTalent) { - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(ts); - if (!talentInfo) - continue; - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -9561,22 +9557,17 @@ void PlayerbotAI::_HandleCommandTalent(std::string& text, Player& fromPlayer) uint32 tTab = talentInfo->TalentTab; if (talentInfo->Row > 0) { - unsigned int numRows = sDBCTalent.GetNumRows(); - for (unsigned int i = 0; i < numRows; ++i) // Loop through all talents. + for (auto tmpTalent : sDBCTalent) // Loop through all talents. { // Someday, someone needs to revamp - const TalentEntry* tmpTalent = sDBCTalent.LookupEntry(i); - if (tmpTalent) // the way talents are tracked + if (tmpTalent->TalentTab == tTab) { - if (tmpTalent->TalentTab == tTab) + for (int j = 0; j < MAX_TALENT_RANK; ++j) { - for (int j = 0; j < MAX_TALENT_RANK; ++j) + if (tmpTalent->RankID[j] != 0) { - if (tmpTalent->RankID[j] != 0) - { - if (m_bot->HasSpell(tmpTalent->RankID[j])) - spentPoints += j + 1; - } + if (m_bot->HasSpell(tmpTalent->RankID[j])) + spentPoints += j + 1; } } } diff --git a/src/game/PlayerBot/Base/PlayerbotMgr.cpp b/src/game/PlayerBot/Base/PlayerbotMgr.cpp index 3e65f44e028..039a5de8ce1 100644 --- a/src/game/PlayerBot/Base/PlayerbotMgr.cpp +++ b/src/game/PlayerBot/Base/PlayerbotMgr.cpp @@ -995,13 +995,8 @@ uint32 Player::GetSpec() Player* player = m_session->GetPlayer(); uint32 classMask = player->getClassMask(); - for (unsigned int i = 0; i < sDBCTalent.GetNumRows(); ++i) + for (auto talentInfo : sDBCTalent) { - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); - - if (!talentInfo) - continue; - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 6cb7ef420b4..1d03ae18de9 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -396,11 +396,8 @@ void LoadDBCStores(const std::string& dataPath) // store in with (row,col,talent)->size key for correct sorting by (row,col) typedef std::map TalentBitSize; TalentBitSize sTalentBitSize; - for (uint32 i = 1; i < sDBCTalent.GetNumRows(); ++i) + for (auto talentInfo : sDBCTalent) { - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); - if (!talentInfo) continue; - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -421,12 +418,8 @@ void LoadDBCStores(const std::string& dataPath) } // now have all max ranks (and then bit amount used for store talent ranks in inspect) - for (uint32 talentTabId = 1; talentTabId < sDBCTalentTab.GetNumRows(); ++talentTabId) + for (auto talentTabInfo : sDBCTalentTab) { - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentTabId); - if (!talentTabInfo) - continue; - // prevent memory corruption; otherwise cls will become 12 below if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0) continue; @@ -435,7 +428,7 @@ void LoadDBCStores(const std::string& dataPath) uint32 cls = 1; for (uint32 m = 1; !(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES; m <<= 1, ++cls) {} - sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId; + sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabInfo->TalentTabID; // add total amount bits for first rank starting from talent tab first talent rank pos. uint32 pos = 0; @@ -446,7 +439,7 @@ void LoadDBCStores(const std::string& dataPath) if (!talentInfo) continue; - if (talentInfo->TalentTab != talentTabId) + if (talentInfo->TalentTab != talentTabInfo->TalentTabID) continue; sTalentPosInInspect[talentId] = pos; diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index 76f409f399e..f2925b69835 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -1521,12 +1521,8 @@ void SpellMgr::LoadSpellChains() mSpellChainsNext.clear(); // need for reload case // load known data for talents - for (unsigned int i = 0; i < sDBCTalent.GetNumRows(); ++i) + for (auto talentInfo : sDBCTalent) { - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(i); - if (!talentInfo) - continue; - // not add ranks for 1 ranks talents (if exist non ranks spells then it will included in table data) if (!talentInfo->RankID[1]) continue; @@ -2624,19 +2620,15 @@ void SpellMgr::LoadSkillLineAbilityMaps() mSkillLineAbilityMapBySpellId.clear(); mSkillLineAbilityMapBySkillId.clear(); - const uint32 rows = sDBCSkillLineAbility.GetNumRows(); uint32 count = 0; - BarGoLink bar(rows); - for (uint32 row = 0; row < rows; ++row) + BarGoLink bar(sDBCSkillLineAbility.GetNumRows()); + for (auto entry : sDBCSkillLineAbility) { bar.step(); - if (SkillLineAbilityEntry const* entry = sDBCSkillLineAbility.LookupEntry(row)) - { - mSkillLineAbilityMapBySpellId.insert(SkillLineAbilityMap::value_type(entry->spellId, entry)); - mSkillLineAbilityMapBySkillId.insert(SkillLineAbilityMap::value_type(entry->skillId, entry)); - ++count; - } + mSkillLineAbilityMapBySpellId.insert(SkillLineAbilityMap::value_type(entry->spellId, entry)); + mSkillLineAbilityMapBySkillId.insert(SkillLineAbilityMap::value_type(entry->skillId, entry)); + ++count; } sLog.outString(">> Loaded %u SkillLineAbility MultiMaps Data", count); From 0f8dc64e0be659a661daf07034aa132c37ecd165 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Wed, 10 Mar 2021 19:24:30 +0100 Subject: [PATCH 26/28] Moving code and removing DBCStore code --- src/game/AI/EventAI/CreatureEventAIMgr.cpp | 2 +- .../scripts/world/npcs_special.cpp | 2 +- src/game/Chat/Channel.cpp | 47 ++ src/game/Chat/Channel.h | 4 + src/game/Chat/Level1.cpp | 12 +- src/game/Chat/Level2.cpp | 2 +- src/game/Chat/Level3.cpp | 18 +- src/game/Entities/Creature.cpp | 11 +- src/game/Entities/Creature.h | 1 + src/game/Entities/MiscHandler.cpp | 12 +- src/game/Entities/Player.cpp | 47 +- src/game/Entities/Player.h | 1 + src/game/Entities/Unit.cpp | 2 +- src/game/Globals/Conditions.cpp | 4 +- src/game/Globals/ObjectMgr.cpp | 63 +- src/game/Globals/ObjectMgr.h | 9 + src/game/Globals/SharedDefines.h | 6 + src/game/Maps/GridMap.cpp | 70 +- src/game/Maps/GridMap.h | 9 + src/game/Maps/Map.cpp | 112 +++ src/game/Maps/Map.h | 7 + src/game/PlayerBot/Base/PlayerbotAI.cpp | 2 +- src/game/Server/DBCStores.cpp | 793 ------------------ src/game/Server/DBCStores.h | 147 ---- src/game/Server/SQLStorages.cpp | 226 +++-- src/game/Server/SQLStorages.h | 15 +- src/game/Server/WorldSocket.cpp | 2 +- src/game/Spells/SpellEffects.cpp | 4 +- src/game/Spells/SpellMgr.cpp | 12 +- src/game/Tools/Formulas.h | 3 +- src/game/World/World.cpp | 21 +- src/game/World/World.h | 4 + src/mangosd/Master.cpp | 2 +- 33 files changed, 610 insertions(+), 1062 deletions(-) diff --git a/src/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/game/AI/EventAI/CreatureEventAIMgr.cpp index 6ad03c26bf3..fd6c1c3ca18 100644 --- a/src/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -388,7 +388,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'map specific' but map (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); break; case SPAWNED_EVENT_ZONE: - if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1)) + if (!TerrainManager::GetAreaEntryByAreaID(temp.spawned.conditionValue1)) sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'area specific' but area (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); break; default: diff --git a/src/game/AI/ScriptDevAI/scripts/world/npcs_special.cpp b/src/game/AI/ScriptDevAI/scripts/world/npcs_special.cpp index 9f447e29a75..2580378ea74 100644 --- a/src/game/AI/ScriptDevAI/scripts/world/npcs_special.cpp +++ b/src/game/AI/ScriptDevAI/scripts/world/npcs_special.cpp @@ -1091,7 +1091,7 @@ bool GossipHello_npc_innkeeper(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TRICK_OR_TREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); // Should only apply to innkeeper close to start areas. - if (AreaTableEntry const* pAreaEntry = GetAreaEntryByAreaID(pCreature->GetAreaId())) + if (AreaTableEntry const* pAreaEntry = TerrainManager::GetAreaEntryByAreaID(pCreature->GetAreaId())) { if (pAreaEntry->flags & AREA_FLAG_LOWLEVEL) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WHAT_TO_DO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); diff --git a/src/game/Chat/Channel.cpp b/src/game/Chat/Channel.cpp index 51aa31c8bd3..2cb48dc7dbd 100644 --- a/src/game/Chat/Channel.cpp +++ b/src/game/Chat/Channel.cpp @@ -1134,3 +1134,50 @@ bool Channel::SetStatic(bool state, bool command/* = false*/) return true; } + +ChatChannelsEntry const* Channel::GetChatChannelsEntryFor(const std::string& name, uint32 channel_id/* = 0*/) +{ + std::wstring wname; + + Utf8toWStr(name, wname); + + if (!channel_id && wname.empty()) + return nullptr; + + // not sorted, numbering index from 0 + for (auto entry : sDBCChatChannels) + { + std::wstring wpattern; + + // try to match by name first, avoid creating custom channels with same name + if (!wname.empty()) + { + for (uint32 i = 0; i < MAX_LOCALE; ++i) + { + Utf8toWStr(entry->pattern[i], wpattern); + + if (wpattern.empty()) + continue; + + size_t argpos = wpattern.find(L"%s"); + + // formatting arg present: strip and attempt partial match + if (argpos != std::wstring::npos) + { + wpattern.replace(argpos, 2, L""); + + if (wname.find(wpattern) != std::wstring::npos) + return entry; + } + // attempt full match + else if (wname.compare(wpattern) == 0) + return entry; + } + } + + // name still not found, but channel id is provided: possibly no dbc data for client locale + if (channel_id && channel_id == entry->ChannelID) + return entry; + } + return nullptr; +} diff --git a/src/game/Chat/Channel.h b/src/game/Chat/Channel.h index eb8bfbde08a..c7beb759970 100644 --- a/src/game/Chat/Channel.h +++ b/src/game/Chat/Channel.h @@ -26,6 +26,8 @@ #include +struct ChatChannelsEntry; + enum ChatNotify : uint8 { CHAT_JOINED_NOTICE = 0x00, //+ "%s joined channel."; @@ -211,6 +213,8 @@ class Channel // Make a custom channel acquire global-like properties bool SetStatic(bool state, bool command = false); + static ChatChannelsEntry const* GetChatChannelsEntryFor(const std::string& name, uint32 channel_id = 0); + private: void SendToOne(WorldPacket const& data, ObjectGuid receiver) const; void SendToAll(WorldPacket const& data) const; diff --git a/src/game/Chat/Level1.cpp b/src/game/Chat/Level1.cpp index e275d91e0f9..9f88156e44d 100644 --- a/src/game/Chat/Level1.cpp +++ b/src/game/Chat/Level1.cpp @@ -301,13 +301,13 @@ bool ChatHandler::HandleGPSCommand(char* args) obj->GetZoneAndAreaId(zone_id, area_id); MapEntry const* mapEntry = sDBCMap.LookupEntry(obj->GetMapId()); - AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id); - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id); + AreaTableEntry const* zoneEntry = TerrainManager::GetAreaEntryByAreaID(zone_id); + AreaTableEntry const* areaEntry = TerrainManager::GetAreaEntryByAreaID(area_id); float zone_x = obj->GetPositionX(); float zone_y = obj->GetPositionY(); - if (!Map2ZoneCoordinates(zone_x, zone_y, zone_id)) + if (!Map::Map2ZoneCoordinates(zone_x, zone_y, zone_id)) { zone_x = 0; zone_y = 0; @@ -1876,7 +1876,7 @@ bool ChatHandler::HandleGoZoneXYCommand(char* args) else areaid = _player->GetZoneId(); - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid); + AreaTableEntry const* areaEntry = TerrainManager::GetAreaEntryByAreaID(areaid); if (x < 0 || x > 100 || y < 0 || y > 100 || !areaEntry) { @@ -1886,7 +1886,7 @@ bool ChatHandler::HandleGoZoneXYCommand(char* args) } // update to parent zone if exist (client map show only zones without parents) - AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry; + AreaTableEntry const* zoneEntry = areaEntry->zone ? TerrainManager::GetAreaEntryByAreaID(areaEntry->zone) : areaEntry; MapEntry const* mapEntry = sDBCMap.LookupEntry(zoneEntry->mapid); @@ -1898,7 +1898,7 @@ bool ChatHandler::HandleGoZoneXYCommand(char* args) return false; } - if (!Zone2MapCoordinates(x, y, zoneEntry->ID)) + if (!Map::Zone2MapCoordinates(x, y, zoneEntry->ID)) { PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->area_name[GetSessionDbcLocale()], mapEntry->MapID, mapEntry->name[GetSessionDbcLocale()]); diff --git a/src/game/Chat/Level2.cpp b/src/game/Chat/Level2.cpp index 73e78746d42..847e73ff3dd 100644 --- a/src/game/Chat/Level2.cpp +++ b/src/game/Chat/Level2.cpp @@ -322,7 +322,7 @@ bool ChatHandler::HandleTriggerActiveCommand(char* /*args*/) // Search in AreaTable.dbc for (auto atEntry : sDBCAreaTrigger) { - if (!IsPointInAreaTriggerZone(atEntry, pl->GetMapId(), pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ())) + if (!Map::IsPointInAreaTriggerZone(atEntry, pl->GetMapId(), pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ())) continue; ShowTriggerListHelper(atEntry); diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp index b6badb93a66..eaa9509b911 100644 --- a/src/game/Chat/Level3.cpp +++ b/src/game/Chat/Level3.cpp @@ -1426,7 +1426,7 @@ bool ChatHandler::HandleLearnAllCommand(char* /*args*/) // skip spells with first rank learned as talent (and all talents then also) uint32 firstRankId = sSpellMgr.GetFirstSpellInChain(spellId); - if (GetTalentSpellCost(firstRankId) > 0) + if (ObjectMgr::GetTalentSpellCost(firstRankId) > 0) continue; if (!IsSpellHaveEffect(newSpell, SPELL_EFFECT_PROFICIENCY)) @@ -1544,7 +1544,7 @@ bool ChatHandler::HandleLearnAllMySpellsCommand(char* /*args*/) // skip spells with first rank learned as talent (and all talents then also) uint32 first_rank = sSpellMgr.GetFirstSpellInChain(spellInfo->Id); - if (GetTalentSpellCost(first_rank) > 0) + if (ObjectMgr::GetTalentSpellCost(first_rank) > 0) continue; // skip broken spells @@ -2375,7 +2375,7 @@ void ChatHandler::ShowSpellListHelper(Player* target, SpellEntry const* spellInf bool known = target && target->HasSpell(id); bool learn = (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_LEARN_SPELL); - uint32 talentCost = GetTalentSpellCost(id); + uint32 talentCost = ObjectMgr::GetTalentSpellCost(id); bool talent = (talentCost > 0); bool passive = IsPassiveSpell(spellInfo); @@ -3202,7 +3202,7 @@ bool ChatHandler::HandleLinkGraveCommand(char* args) uint32 zoneId = player->GetZoneId(); - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); + AreaTableEntry const* areaEntry = TerrainManager::GetAreaEntryByAreaID(zoneId); if (!areaEntry || areaEntry->zone != 0) { PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, g_id, zoneId); @@ -3711,7 +3711,7 @@ bool ChatHandler::HandleShowAreaCommand(char* args) return false; } - int area = GetAreaFlagByAreaID(atoi(args)); + int area = TerrainManager::GetAreaFlagByAreaID(atoi(args)); int offset = area / 32; uint32 val = (uint32)(1 << (area % 32)); @@ -3742,7 +3742,7 @@ bool ChatHandler::HandleHideAreaCommand(char* args) return false; } - int area = GetAreaFlagByAreaID(atoi(args)); + int area = TerrainManager::GetAreaFlagByAreaID(atoi(args)); int offset = area / 32; uint32 val = (uint32)(1 << (area % 32)); @@ -4018,7 +4018,7 @@ bool ChatHandler::HandleListAurasCommand(char* args) PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, uAuras.size()); for (Unit::SpellAuraHolderMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr) { - bool talent = GetTalentSpellCost(itr->second->GetId()) > 0; + bool talent = ObjectMgr::GetTalentSpellCost(itr->second->GetId()) > 0; SpellAuraHolder* holder = itr->second; char const* name = holder->GetSpellProto()->SpellName[GetSessionDbcLocale()]; @@ -4060,7 +4060,7 @@ bool ChatHandler::HandleListAurasCommand(char* args) PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i); for (Unit::AuraList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr) { - bool talent = GetTalentSpellCost((*itr)->GetId()) > 0; + bool talent = ObjectMgr::GetTalentSpellCost((*itr)->GetId()) > 0; char const* name = (*itr)->GetSpellProto()->SpellName[GetSessionDbcLocale()]; @@ -4103,7 +4103,7 @@ bool ChatHandler::HandleListTalentsCommand(char* /*args*/) if (uSpell.second.state == PLAYERSPELL_REMOVED || uSpell.second.disabled) continue; - uint32 cost_itr = GetTalentSpellCost(uSpell.first); + uint32 cost_itr = ObjectMgr::GetTalentSpellCost(uSpell.first); if (cost_itr == 0) continue; diff --git a/src/game/Entities/Creature.cpp b/src/game/Entities/Creature.cpp index 71bf0f5d863..f886c292eb6 100644 --- a/src/game/Entities/Creature.cpp +++ b/src/game/Entities/Creature.cpp @@ -546,7 +546,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data /*=nullptr*/, { if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP) { - const AreaTableEntry* zone = GetAreaEntryByAreaID(GetAreaId()); + const AreaTableEntry* zone = TerrainManager::GetAreaEntryByAreaID(GetAreaId()); const bool sanctuary = (zone && (zone->flags & AREA_FLAG_SANCTUARY)); SetPvP(!sanctuary); } @@ -644,6 +644,15 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData* return display_id; } +uint32 Creature::GetCreatureModelRace(uint32 model_id) +{ + CreatureDisplayInfoEntry const* displayEntry = sDBCCreatureDisplayInfo.LookupEntry(model_id); + if (!displayEntry) + return 0; + CreatureDisplayInfoExtraEntry const* extraEntry = sDBCCreatureDisplayInfoExtra.LookupEntry(displayEntry->ExtendedDisplayInfoID); + return extraEntry ? extraEntry->Race : 0; +} + void Creature::Update(const uint32 diff) { switch (m_deathState) diff --git a/src/game/Entities/Creature.h b/src/game/Entities/Creature.h index eb0ea62c5be..9e2a3b67ec3 100644 --- a/src/game/Entities/Creature.h +++ b/src/game/Entities/Creature.h @@ -471,6 +471,7 @@ class Creature : public Unit CreatureDataAddon const* GetCreatureAddon() const; static uint32 ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData* data = nullptr, GameEventCreatureData const* eventData = nullptr); + static uint32 GetCreatureModelRace(uint32 model_id); std::string GetAIName() const; std::string GetScriptName() const; diff --git a/src/game/Entities/MiscHandler.cpp b/src/game/Entities/MiscHandler.cpp index 5ee3d28bb7d..8b5e9c8e396 100644 --- a/src/game/Entities/MiscHandler.cpp +++ b/src/game/Entities/MiscHandler.cpp @@ -223,7 +223,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recv_data) continue; std::string aname; - if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(pzoneid)) + if (AreaTableEntry const* areaEntry = TerrainManager::GetAreaEntryByAreaID(pzoneid)) aname = areaEntry->area_name[GetSessionDbcLocale()]; bool s_show = true; @@ -330,7 +330,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket& /*recv_data*/) void WorldSession::HandleTogglePvP(WorldPacket& recv_data) { uint32 zoneId = GetPlayer()->GetZoneId(); - if (AreaTableEntry const* zone = GetAreaEntryByAreaID(zoneId)) + if (AreaTableEntry const* zone = TerrainManager::GetAreaEntryByAreaID(zoneId)) { if (zone->flags & AREA_FLAG_SANCTUARY) return; @@ -714,7 +714,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) const float delta = 5.0f; // check if player in the range of areatrigger - if (!IsPointInAreaTriggerZone(atEntry, player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), delta)) + if (!Map::IsPointInAreaTriggerZone(atEntry, player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), delta)) { DEBUG_LOG("Player '%s' (GUID: %u) too far, ignore Area Trigger ID: %u", player->GetName(), player->GetGUIDLow(), Trigger_ID); return; @@ -1057,7 +1057,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) if (sWorld.getConfig(CONFIG_BOOL_TALENTS_INSPECTING) || _player->IsGameMaster()) { // find class talent tabs (all players have 3 talent tabs) - uint32 const* talentTabIds = GetTalentTabPages(plr->getClass()); + uint32 const* talentTabIds = ObjectMgr::GetTalentTabPages(plr->getClass()); uint32 talentTabPos = 0; // pos of first talent rank in tab including all prev tabs for (uint32 i = 0; i < 3; ++i) @@ -1087,7 +1087,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) continue; // 1 rank talent bit index - uint32 curtalent_index = talentTabPos + GetTalentInspectBitPosInTab(talentInfo->TalentID); + uint32 curtalent_index = talentTabPos + ObjectMgr::GetTalentInspectBitPosInTab(talentInfo->TalentID); uint32 curtalent_rank_index = curtalent_index + curtalent_maxrank - 1; @@ -1108,7 +1108,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) data.put(guid_size + 4 + curtalent_rank_slot, val & 0xFF); } - talentTabPos += GetTalentTabInspectBitSize(talentTabId); + talentTabPos += ObjectMgr::GetTalentTabInspectBitSize(talentTabId); } } diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index b3ffe5f272e..669052504b4 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -58,7 +58,6 @@ #include "DBScripts/ScriptMgr.h" #include "Social/SocialMgr.h" #include "Mails/Mail.h" -#include "Server/DBCStores.h" #include "Server/SQLStorages.h" #include "Loot/LootMgr.h" #include "World/WorldStateDefines.h" @@ -3247,7 +3246,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen } } - TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id); + TalentSpellPos const* talentPos = ObjectMgr::GetTalentSpellPos(spell_id); if (!disabled_case) // skip new spell adding if spell already known (disabled spells case) { @@ -3374,7 +3373,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen if (talentPos) { // update used talent points count - m_usedTalentCount += GetTalentSpellCost(talentPos); + m_usedTalentCount += ObjectMgr::GetTalentSpellCost(talentPos); UpdateFreeTalentPoints(false); } @@ -3493,13 +3492,13 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo if (playerSpell.state == PLAYERSPELL_REMOVED || (disabled && playerSpell.disabled)) return; - if (disabled && GetTalentSpellPos(spell_id)) + if (disabled && ObjectMgr::GetTalentSpellPos(spell_id)) disabled = false; // talents should never be marked as disabled // unlearn non talent higher ranks (recursive) SpellChainMapNext const& nextMap = sSpellMgr.GetSpellChainNext(); for (SpellChainMapNext::const_iterator itr2 = nextMap.lower_bound(spell_id); itr2 != nextMap.upper_bound(spell_id); ++itr2) - if (HasSpell(itr2->second) && !GetTalentSpellPos(itr2->second)) + if (HasSpell(itr2->second) && !ObjectMgr::GetTalentSpellPos(itr2->second)) removeSpell(itr2->second, !IsPassiveSpell(itr2->second), false, sendUpdate); // re-search, it can be corrupted in prev loop @@ -3531,11 +3530,11 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo if (PetAura const* petSpell = sSpellMgr.GetPetAura(spell_id)) RemovePetAura(petSpell); - TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id); + TalentSpellPos const* talentPos = ObjectMgr::GetTalentSpellPos(spell_id); if (talentPos) { // free talent points - uint32 talentCosts = GetTalentSpellCost(talentPos); + uint32 talentCosts = ObjectMgr::GetTalentSpellCost(talentPos); if (talentCosts < m_usedTalentCount) m_usedTalentCount -= talentCosts; @@ -4952,7 +4951,7 @@ void Player::RepopAtGraveyard() // note: this can be called also when the player is alive // for example from WorldSession::HandleMovementOpcodes - AreaTableEntry const* zone = GetAreaEntryByAreaID(GetAreaId()); + AreaTableEntry const* zone = TerrainManager::GetAreaEntryByAreaID(GetAreaId()); // Such zones are considered unreachable as a ghost and the player must be automatically revived if ((!IsAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport()) @@ -5015,7 +5014,7 @@ void Player::UpdateLocalChannels(uint32 newZone) if (m_channels.empty()) return; - AreaTableEntry const* current_zone = GetAreaEntryByAreaID(newZone); + AreaTableEntry const* current_zone = TerrainManager::GetAreaEntryByAreaID(newZone); if (!current_zone) return; @@ -6408,7 +6407,7 @@ void Player::CheckAreaExploreAndOutdoor() if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && GetRestType() == REST_TYPE_IN_TAVERN) { AreaTriggerEntry const* at = sDBCAreaTrigger.LookupEntry(inn_trigger_id); - if (!at || !IsPointInAreaTriggerZone(at, GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ())) + if (!at || !Map::IsPointInAreaTriggerZone(at, GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ())) { // Player left inn (REST_TYPE_IN_CITY overrides REST_TYPE_IN_TAVERN, so just clear rest) SetRestType(REST_TYPE_NO); @@ -6448,7 +6447,7 @@ void Player::CheckAreaExploreAndOutdoor() { SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields | val)); - AreaTableEntry const* p = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId()); + AreaTableEntry const* p = TerrainManager::GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId()); if (!p) { sLog.outError("PLAYER: Player %u discovered unknown area (x: %f y: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetMapId()); @@ -6979,7 +6978,7 @@ void Player::UpdateArea(uint32 newArea) { m_areaUpdateId = newArea; - AreaTableEntry const* area = GetAreaEntryByAreaID(newArea); + AreaTableEntry const* area = TerrainManager::GetAreaEntryByAreaID(newArea); // FFA_PVP flags are area and not zone id dependent // so apply them accordingly @@ -7012,7 +7011,7 @@ bool Player::CanUseCapturePoint() const void Player::UpdateZone(uint32 newZone, uint32 newArea, bool force) { - AreaTableEntry const* zone = GetAreaEntryByAreaID(newZone); + AreaTableEntry const* zone = TerrainManager::GetAreaEntryByAreaID(newZone); if (!zone) return; @@ -9006,6 +9005,26 @@ InventoryResult Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Ite return EQUIP_ERR_OK; } +bool Player::IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId) +{ + if (requiredTotemCategoryId == 0) + return true; + if (itemTotemCategoryId == 0) + return false; + + TotemCategoryEntry const* itemEntry = sDBCTotemCategory.LookupEntry(itemTotemCategoryId); + if (!itemEntry) + return false; + TotemCategoryEntry const* reqEntry = sDBCTotemCategory.LookupEntry(requiredTotemCategoryId); + if (!reqEntry) + return false; + + if (itemEntry->categoryType != reqEntry->categoryType) + return false; + + return (itemEntry->categoryMask & reqEntry->categoryMask) == reqEntry->categoryMask; +} + bool Player::HasItemTotemCategory(uint32 TotemCategory) const { Item* pItem; @@ -16191,7 +16210,7 @@ void Player::_LoadSpells(QueryResult* result) uint32 spell_id = fields[0].GetUInt32(); bool active = fields[1].GetBool(); bool disabled = fields[2].GetBool(); - TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id); + TalentSpellPos const* talentPos = ObjectMgr::GetTalentSpellPos(spell_id); if (!talentPos) spells.push_back(std::tuple{ spell_id, active, disabled }); else diff --git a/src/game/Entities/Player.h b/src/game/Entities/Player.h index d3a4b22b216..68013bbc4bc 100644 --- a/src/game/Entities/Player.h +++ b/src/game/Entities/Player.h @@ -1133,6 +1133,7 @@ class Player : public Unit InventoryResult CanUnequipItem(uint16 pos, bool swap) const; InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading = true) const; InventoryResult CanUseItem(Item* pItem, bool direct_action = true) const; + static bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId); bool HasItemTotemCategory(uint32 TotemCategory) const; InventoryResult CanUseItem(ItemPrototype const* pProto) const; InventoryResult CanUseAmmo(uint32 item) const; diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index 6aaf508b7d9..7d44f51866e 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -11238,7 +11238,7 @@ bool Unit::IsAllowedDamageInArea(Unit* pVictim) const return true; // can't damage player controlled unit by player controlled unit in sanctuary - AreaTableEntry const* area = GetAreaEntryByAreaID(pVictim->GetAreaId()); + AreaTableEntry const* area = TerrainManager::GetAreaEntryByAreaID(pVictim->GetAreaId()); return !(area && area->flags & AREA_FLAG_SANCTUARY); } diff --git a/src/game/Globals/Conditions.cpp b/src/game/Globals/Conditions.cpp index baa8b73abda..c662634da9e 100644 --- a/src/game/Globals/Conditions.cpp +++ b/src/game/Globals/Conditions.cpp @@ -221,7 +221,7 @@ bool inline ConditionEntry::Evaluate(WorldObject const* target, Map const* map, case CONDITION_AREA_FLAG: { WorldObject const* searcher = source ? source : target; - if (AreaTableEntry const* pAreaEntry = GetAreaEntryByAreaID(searcher->GetAreaId())) + if (AreaTableEntry const* pAreaEntry = TerrainManager::GetAreaEntryByAreaID(searcher->GetAreaId())) { if ((!m_value1 || (pAreaEntry->flags & m_value1)) && (!m_value2 || !(pAreaEntry->flags & m_value2))) return true; @@ -664,7 +664,7 @@ bool ConditionEntry::IsValid() const } case CONDITION_AREAID: { - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(m_value1); + AreaTableEntry const* areaEntry = TerrainManager::GetAreaEntryByAreaID(m_value1); if (!areaEntry) { sLog.outErrorDb("Zone condition (entry %u, type %u) requires to be in non existing area (%u), skipped", m_entry, m_condition, m_value1); diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index a115c92c644..ec7d6751458 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -2338,7 +2338,7 @@ void ObjectMgr::LoadItemPrototypes() const_cast(proto)->ItemSet = 0; } - if (proto->Area && !GetAreaEntryByAreaID(proto->Area)) + if (proto->Area && !TerrainManager::GetAreaEntryByAreaID(proto->Area)) sLog.outErrorDb("Item (Entry: %u) has wrong Area (%u)", proto->ItemId, proto->Area); if (proto->Map && !sDBCMap.LookupEntry(proto->Map)) @@ -3858,7 +3858,7 @@ void ObjectMgr::LoadQuests() // client quest log visual (area case) if (qinfo->ZoneOrSort > 0) { - if (!GetAreaEntryByAreaID(qinfo->ZoneOrSort)) + if (!TerrainManager::GetAreaEntryByAreaID(qinfo->ZoneOrSort)) { sLog.outErrorDb("Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.", qinfo->GetQuestId(), qinfo->ZoneOrSort); @@ -5989,7 +5989,7 @@ void ObjectMgr::LoadGraveyardZones() continue; } - if (linkKind == GRAVEYARD_AREALINK && GetAreaEntryByAreaID(locId) == nullptr) + if (linkKind == GRAVEYARD_AREALINK && TerrainManager::GetAreaEntryByAreaID(locId) == nullptr) { sLog.outErrorDb("Table `game_graveyard_zone` has record for nonexistent area id (%u), skipped.", locId); continue; @@ -8393,7 +8393,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() uint32 entry = fields[0].GetUInt32(); int32 skill = fields[1].GetInt32(); - AreaTableEntry const* fArea = GetAreaEntryByAreaID(entry); + AreaTableEntry const* fArea = TerrainManager::GetAreaEntryByAreaID(entry); if (!fArea) { sLog.outErrorDb("AreaId %u defined in `skill_fishing_base_level` does not exist", entry); @@ -9878,3 +9878,58 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=nullp source->MonsterText(data, target); return true; } + +TalentSpellPos const* ObjectMgr::GetTalentSpellPos(uint32 spellId) +{ + TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId); + if (itr == sTalentSpellPosMap.end()) + return nullptr; + + return &itr->second; +} + +uint32 ObjectMgr::GetTalentSpellCost(TalentSpellPos const* pos) +{ + if (pos) + return pos->rank + 1; + + return 0; +} + +uint32 ObjectMgr::GetTalentSpellCost(uint32 spellId) +{ + return GetTalentSpellCost(GetTalentSpellPos(spellId)); +} + +uint32 ObjectMgr::GetTalentInspectBitPosInTab(uint32 talentId) +{ + TalentInspectMap::const_iterator itr = sTalentPosInInspect.find(talentId); + if (itr == sTalentPosInInspect.end()) + return 0; + + return itr->second; +} + +uint32 ObjectMgr::GetTalentTabInspectBitSize(uint32 talentTabId) +{ + TalentInspectMap::const_iterator itr = sTalentTabSizeInInspect.find(talentTabId); + if (itr == sTalentTabSizeInInspect.end()) + return 0; + + return itr->second; +} + +uint32 const* ObjectMgr::GetTalentTabPages(uint32 cls) +{ + return sTalentTabPages[cls]; +} + +char const* ObjectMgr::GetPetName(uint32 petfamily, uint32 dbclang) +{ + if (!petfamily) + return nullptr; + CreatureFamilyEntry const* pet_family = sDBCCreatureFamily.LookupEntry(petfamily); + if (!pet_family) + return nullptr; + return pet_family->Name[dbclang] ? pet_family->Name[dbclang] : nullptr; +} \ No newline at end of file diff --git a/src/game/Globals/ObjectMgr.h b/src/game/Globals/ObjectMgr.h index 70f112b8e56..4026b70fc05 100644 --- a/src/game/Globals/ObjectMgr.h +++ b/src/game/Globals/ObjectMgr.h @@ -1171,6 +1171,15 @@ class ObjectMgr * Qualifier: const **/ CreatureClassLvlStats const* GetCreatureClassLvlStats(uint32 level, uint32 unitClass, int32 expansion) const; + + static uint32 GetTalentSpellCost(uint32 spellId); + static uint32 GetTalentSpellCost(TalentSpellPos const* pos); + static TalentSpellPos const* GetTalentSpellPos(uint32 spellId); + static uint32 GetTalentInspectBitPosInTab(uint32 talentId); + static uint32 GetTalentTabInspectBitSize(uint32 talentTabId); + static uint32 const* /*[3]*/ GetTalentTabPages(uint32 cls); + static char const* GetPetName(uint32 petfamily, uint32 dbclang); + protected: // current locale settings diff --git a/src/game/Globals/SharedDefines.h b/src/game/Globals/SharedDefines.h index 8f5c5d2f5a3..3f6ee76bbde 100644 --- a/src/game/Globals/SharedDefines.h +++ b/src/game/Globals/SharedDefines.h @@ -2605,4 +2605,10 @@ enum SplineFlags SPLINEFLAG_FLYING = 0x0000200, }; +enum ContentLevels +{ + CONTENT_1_60 = 0, + CONTENT_61_70 +}; + #endif diff --git a/src/game/Maps/GridMap.cpp b/src/game/Maps/GridMap.cpp index 267338d7f1f..d1535d26a5d 100644 --- a/src/game/Maps/GridMap.cpp +++ b/src/game/Maps/GridMap.cpp @@ -570,7 +570,7 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re uint32 overrideLiquid = area->LiquidTypeOverride[entry - 1]; if (!overrideLiquid && area->zone) { - area = GetAreaEntryByAreaID(area->zone); + area = TerrainManager::GetAreaEntryByAreaID(area->zone); if (area) overrideLiquid = area->LiquidTypeOverride[entry - 1]; } @@ -919,10 +919,10 @@ uint16 TerrainInfo::GetAreaFlag(float x, float y, float z, bool* isOutdoors) con if (GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId)) { haveAreaInfo = true; - auto wmoEntries = GetWMOAreaTableEntriesByTripple(rootId, adtId, groupId); + auto wmoEntries = TerrainManager::GetWMOAreaTableEntriesByTripple(rootId, adtId, groupId); for (auto wmoEntry : wmoEntries) { - auto areaEntry = GetAreaEntryByAreaID(wmoEntry->areaId); + auto areaEntry = TerrainManager::GetAreaEntryByAreaID(wmoEntry->areaId); if (areaEntry && areaEntry->mapid == GetMapId()) { atEntry = areaEntry; @@ -939,7 +939,7 @@ uint16 TerrainInfo::GetAreaFlag(float x, float y, float z, bool* isOutdoors) con areaflag = gmap->getArea(x, y); // this used while not all *.map files generated (instances) else - areaflag = GetAreaFlagByMapId(GetMapId()); + areaflag = TerrainManager::GetAreaFlagByMapId(GetMapId()); } if (isOutdoors) @@ -997,12 +997,12 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint if (liquid_type && liquid_type < 21) { - if (AreaTableEntry const* area = GetAreaEntryByAreaFlagAndMap(GetAreaFlag(x, y, z), GetMapId())) + if (AreaTableEntry const* area = TerrainManager::GetAreaEntryByAreaFlagAndMap(GetAreaFlag(x, y, z), GetMapId())) { uint32 overrideLiquid = area->LiquidTypeOverride[liquid_type - 1]; if (!overrideLiquid && area->zone) { - area = GetAreaEntryByAreaID(area->zone); + area = TerrainManager::GetAreaEntryByAreaID(area->zone); if (area) overrideLiquid = area->LiquidTypeOverride[liquid_type - 1]; } @@ -1331,3 +1331,61 @@ void TerrainManager::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, areaid = entry ? entry->ID : 0; zoneid = entry ? ((entry->zone != 0) ? entry->zone : entry->ID) : 0; } + +int32 TerrainManager::GetAreaFlagByAreaID(uint32 area_id) +{ + AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id); + if (i == sAreaFlagByAreaID.end()) + return -1; + + return i->second; +} + +uint32 TerrainManager::GetAreaIdByLocalizedName(const std::string& name) +{ + for (auto areaEntry : sDBCAreaTable) + { + for (uint32 i = 0; i < MAX_LOCALE; ++i) + { + std::string area_name(areaEntry->area_name[i]); + if (area_name.size() > 0 && name.find(" - " + area_name) != std::string::npos) + { + return areaEntry->ID; + } + } + } + return 0; +} + +std::vector& TerrainManager::GetWMOAreaTableEntriesByTripple(int32 rootid, int32 adtid, int32 groupid) +{ + return sWMOAreaInfoByTripple[WMOAreaTableTripple(rootid, adtid, groupid)]; +} + +AreaTableEntry const* TerrainManager::GetAreaEntryByAreaID(uint32 area_id) +{ + int32 areaflag = GetAreaFlagByAreaID(area_id); + if (areaflag < 0) + return nullptr; + + return sDBCAreaTable.LookupEntry(areaflag); +} + +AreaTableEntry const* TerrainManager::GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id) +{ + if (area_flag) + return sDBCAreaTable.LookupEntry(area_flag); + + if (MapEntry const* mapEntry = sDBCMap.LookupEntry(map_id)) + return GetAreaEntryByAreaID(mapEntry->linked_zone); + + return nullptr; +} + +uint32 TerrainManager::GetAreaFlagByMapId(uint32 mapid) +{ + AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid); + if (i == sAreaFlagByMapID.end()) + return 0; + return i->second; +} diff --git a/src/game/Maps/GridMap.h b/src/game/Maps/GridMap.h index a550c8d09c5..86106771231 100644 --- a/src/game/Maps/GridMap.h +++ b/src/game/Maps/GridMap.h @@ -36,6 +36,8 @@ class InstanceData; class Group; class BattleGround; class Map; +struct AreaTableEntry; +struct WMOAreaTableEntry; class GridMap { @@ -234,6 +236,13 @@ class TerrainManager : public MaNGOS::Singleton& GetWMOAreaTableEntriesByTripple(int32 rootid, int32 adtid, int32 groupid); + static AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id); + static AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id); + private: TerrainManager(); ~TerrainManager(); diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index e1a4fb829e3..e7190b315b1 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -2597,3 +2597,115 @@ void Map::RemoveFromSpawnCount(const ObjectGuid& guid) { m_spawnedCount[guid.GetEntry()].erase(guid); } + +bool Map::MapCoordinateVsZoneCheck(float x, float y, uint32 mapid, uint32 zone) +{ + WorldMapAreaEntry const* WmaEntry = sDBCWorldMapArea.LookupEntry(zone); + if (WmaEntry && mapid == WmaEntry->map_id && + x >= WmaEntry->x2 && x <= WmaEntry->x1 && y >= WmaEntry->y2 && y <= WmaEntry->y1) + return true; + return false; +} + +bool Map::Zone2MapCoordinates(float& x, float& y, uint32 zone) +{ + WorldMapAreaEntry const* maEntry = sDBCWorldMapArea.LookupEntry(zone); + + // if not listed then map coordinates (instance) + if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1) + 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; +} + +bool Map::Map2ZoneCoordinates(float& x, float& y, uint32 zone) +{ + WorldMapAreaEntry const* maEntry = sDBCWorldMapArea.LookupEntry(zone); + + // if not listed then map coordinates (instance) + if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1) + return false; + + x = (x - maEntry->x1) / ((maEntry->x2 - maEntry->x1) / 100); + y = (y - maEntry->y1) / ((maEntry->y2 - maEntry->y1) / 100); // client y coord from top to down + std::swap(x, y); // client have map coords swapped + + return true; +} + +bool Map::IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, float x, float y, float z, float delta) +{ + if (mapid != atEntry->mapid) + return false; + + if (atEntry->radius > 0) + { + // if we have radius check it + float dist2 = (x - atEntry->x) * (x - atEntry->x) + (y - atEntry->y) * (y - atEntry->y) + (z - atEntry->z) * (z - atEntry->z); + if (dist2 > (atEntry->radius + delta) * (atEntry->radius + delta)) + return false; + } + else + { + // we have only extent + + // rotate the players position instead of rotating the whole cube, that way we can make a simplified + // is-in-cube check and we have to calculate only one point instead of 4 + + // 2PI = 360, keep in mind that ingame orientation is counter-clockwise + double rotation = 2 * M_PI - atEntry->box_orientation; + double sinVal = sin(rotation); + double cosVal = cos(rotation); + + float playerBoxDistX = x - atEntry->x; + float playerBoxDistY = y - atEntry->y; + + float rotPlayerX = float(atEntry->x + playerBoxDistX * cosVal - playerBoxDistY * sinVal); + float rotPlayerY = float(atEntry->y + playerBoxDistY * cosVal + playerBoxDistX * sinVal); + + // box edges are parallel to coordiante axis, so we can treat every dimension independently :D + float dz = z - atEntry->z; + float dx = rotPlayerX - atEntry->x; + float dy = rotPlayerY - atEntry->y; + if ((fabs(dx) > atEntry->box_x / 2 + delta) || + (fabs(dy) > atEntry->box_y / 2 + delta) || + (fabs(dz) > atEntry->box_z / 2 + delta)) + { + return false; + } + } + + return true; +} + +uint32 Map::GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId) +{ + if (mapid != 530) // speed for most cases + return mapid; + + if (WorldMapAreaEntry const* wma = sDBCWorldMapArea.LookupEntry(zoneId)) + return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id; + + return mapid; +} + +ContentLevels Map::GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) +{ + mapid = GetVirtualMapForMapAndZone(mapid, zoneId); + if (mapid < 2) + return CONTENT_1_60; + + MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); + if (!mapEntry) + return CONTENT_1_60; + + switch (mapEntry->Expansion()) + { + default: return CONTENT_1_60; + case 1: return CONTENT_61_70; + } +} diff --git a/src/game/Maps/Map.h b/src/game/Maps/Map.h index a197f8d7efd..019a19f913b 100644 --- a/src/game/Maps/Map.h +++ b/src/game/Maps/Map.h @@ -330,6 +330,13 @@ class Map : public GridRefManager bool CanSpawn(TypeID typeId, uint32 dbGuid); + static bool MapCoordinateVsZoneCheck(float x, float y, uint32 mapid, uint32 zone); + static bool Zone2MapCoordinates(float& x, float& y, uint32 zone); + static bool Map2ZoneCoordinates(float& x, float& y, uint32 zone); + static bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, float x, float y, float z, float delta = 0.0f); + static uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId); + static ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId); + private: void LoadMapAndVMap(int gx, int gy); diff --git a/src/game/PlayerBot/Base/PlayerbotAI.cpp b/src/game/PlayerBot/Base/PlayerbotAI.cpp index 8401aeb3a75..daa2af2acf6 100644 --- a/src/game/PlayerBot/Base/PlayerbotAI.cpp +++ b/src/game/PlayerBot/Base/PlayerbotAI.cpp @@ -9498,7 +9498,7 @@ void PlayerbotAI::_HandleCommandTalent(std::string& text, Player& fromPlayer) out << "The talents I can learn:\r"; // find class talent tabs (all players have 3 talent tabs) - uint32 const* talentTabIds = GetTalentTabPages(m_bot->getClass()); + uint32 const* talentTabIds = ObjectMgr::GetTalentTabPages(m_bot->getClass()); for (uint32 i = 0; i < 3; ++i) { diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 1d03ae18de9..f826d56e1f4 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -16,797 +16,4 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "Server/DBCStores.h" -#include "Policies/Singleton.h" -#include "Log.h" -#include "ProgressBar.h" -#include "Util.h" -#include "Globals/Locales.h" -#include "Globals/SharedDefines.h" -#include "Server/SQLStorages.h" -#include "DBCfmt.h" - -#include - -// typedef std::map AreaFlagByAreaID; -// typedef std::map AreaFlagByMapID; -// -// struct WMOAreaTableTripple -// { -// WMOAreaTableTripple(int32 r, int32 a, int32 g) : groupId(g), rootId(r), adtId(a) -// { -// } -// -// bool operator <(const WMOAreaTableTripple& b) const -// { -// return memcmp(this, &b, sizeof(WMOAreaTableTripple)) < 0; -// } -// -// // ordered by entropy; that way memcmp will have a minimal medium runtime -// int32 groupId; -// int32 rootId; -// int32 adtId; -// }; -// -// typedef std::map> WMOAreaInfoByTripple; -// -// DBCStorage sDBCAreaTable(AreaTableEntryfmt); -// static AreaFlagByAreaID sAreaFlagByAreaID; -// static AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files -// -// static WMOAreaInfoByTripple sWMOAreaInfoByTripple; - -//DBCStorage sDBCAreaTrigger(AreaTriggerEntryfmt); -//DBCStorage sDBCAuctionHouse(AuctionHouseEntryfmt); -//DBCStorage sDBCBankBagSlotPrices(BankBagSlotPricesEntryfmt); -//DBCStorage sDBCBattlemasterList(BattlemasterListEntryfmt); -//DBCStorage sDBCCharStartOutfit(CharStartOutfitEntryfmt); -//DBCStorage sDBCCharTitles(CharTitlesEntryfmt); -//DBCStorage sDBCChatChannels(ChatChannelsEntryfmt); -//DBCStorage sDBCChrClasses(ChrClassesEntryfmt); -//DBCStorage sDBCChrRaces(ChrRacesEntryfmt); -//DBCStorage sDBCCinematicCamera(CinematicCameraEntryfmt); -//DBCStorage sDBCCinematicSequences(CinematicSequencesEntryfmt); -//DBCStorage sDBCCreatureDisplayInfo(CreatureDisplayInfofmt); -//DBCStorage sDBCCreatureDisplayInfoExtra(CreatureDisplayInfoExtrafmt); -//DBCStorage sDBCCreatureFamily(CreatureFamilyfmt); -//DBCStorage sDBCCreatureModelData(CreatureModelDatafmt); -//DBCStorage sDBCCreatureSpellData(CreatureSpellDatafmt); -//DBCStorage sDBCCreatureType(CreatureTypefmt); - -//DBCStorage sDBCDurabilityCosts(DurabilityQualityfmt); -//DBCStorage sDBCDurabilityQuality(DurabilityCostsfmt); - -//DBCStorage sDBCEmotes(EmotesEntryfmt); -//DBCStorage sDBCEmotesText(EmotesTextEntryfmt); - -//DBCStorage sFactionStore(FactionEntryfmt); -//DBCStorage sDBCFactionTemplate(FactionTemplateEntryfmt); - -//DBCStorage sDBCGameObjectDisplayInfo(GameObjectDisplayInfofmt); -//DBCStorage sDBCGemProperties(GemPropertiesEntryfmt); - -//DBCStorage sDBCGMSurveyCurrentSurvey(GMSurveyCurrentSurveyfmt); -//DBCStorage sDBCGMSurveyQuestions(GMSurveyQuestionsfmt); -//DBCStorage sDBCGMSurveySurveys(GMSurveySurveysfmt); -//DBCStorage sDBCGMTicketCategory(GMTicketCategoryfmt); - -//DBCStorage sDBCgtCombatRatings(GtCombatRatingsfmt); -//DBCStorage sDBCgtChanceToMeleeCritBase(GtChanceToMeleeCritBasefmt); -//DBCStorage sDBCgtChanceToMeleeCrit(GtChanceToMeleeCritfmt); -//DBCStorage sDBCgtChanceToSpellCritBase(GtChanceToSpellCritBasefmt); -//DBCStorage sDBCgtChanceToSpellCrit(GtChanceToSpellCritfmt); -//DBCStorage sDBCgtOCTRegenHP(GtOCTRegenHPfmt); -//DBCStorage sDBCgtNPCManaCostScaler(GtNPCManaCostScalerfmt); -// DBCStorage sGtOCTRegenMPStore(GtOCTRegenMPfmt); -- not used currently -//DBCStorage sDBCgtRegenHPPerSpt(GtRegenHPPerSptfmt); -//DBCStorage sDBCgtRegenMPPerSpt(GtRegenMPPerSptfmt); - -//DBCStorage sDBCItem(Itemfmt); -//DBCStorage sDBCItemBagFamily(ItemBagFamilyfmt); -//DBCStorage sDBCItemClass(ItemClassfmt); -// DBCStorage sItemCondExtCostsStore(ItemCondExtCostsEntryfmt); -// DBCStorage sItemDisplayInfoStore(ItemDisplayTemplateEntryfmt); -- not used currently -//DBCStorage sDBCItemExtendedCost(ItemExtendedCostEntryfmt); -//DBCStorage sDBCItemRandomProperties(ItemRandomPropertiesfmt); -//DBCStorage sDBCItemRandomSuffix(ItemRandomSuffixfmt); -//DBCStorage sDBCItemSet(ItemSetEntryfmt); -//DBCStorage sDBCLiquidType(LiquidTypefmt); -//DBCStorage sDBCLock(LockEntryfmt); - -//DBCStorage sDBCMailTemplate(MailTemplateEntryfmt); -//DBCStorage sDBCMap(MapEntryfmt); - -//DBCStorage sDBCQuestSort(QuestSortEntryfmt); - -//DBCStorage sDBCRandPropPoints(RandomPropertiesPointsfmt); - -//DBCStorage sDBCSkillLine(SkillLinefmt); -//DBCStorage sDBCSkillLineAbility(SkillLineAbilityfmt); -//DBCStorage sDBCSkillRaceClassInfo(SkillRaceClassInfofmt); -//DBCStorage sDBCSkillTiers(SkillTiersfmt); - -//DBCStorage sDBCSoundEntries(SoundEntriesfmt); - -//DBCStorage sDBCSpellItemEnchantment(SpellItemEnchantmentfmt); -//DBCStorage sDBCSpellItemEnchantmentCondition(SpellItemEnchantmentConditionfmt); -//DBCStorage sDBCSpellVisual(SpellVisualfmt); -SpellCategoryStore sSpellCategoryStore; -ItemSpellCategoryStore sItemSpellCategoryStore; -PetFamilySpellsStore sPetFamilySpellsStore; - -//DBCStorage sDBCSpellCastTimes(SpellCastTimefmt); -//DBCStorage sDBCSpellDuration(SpellDurationfmt); -//DBCStorage sDBCSpellFocusObject(SpellFocusObjectfmt); -//DBCStorage sDBCSpellRadius(SpellRadiusfmt); -//DBCStorage sDBCSpellRange(SpellRangefmt); -//DBCStorage sDBCSpellShapeshiftForm(SpellShapeshiftfmt); -//DBCStorage sDBCStableSlotPrices(StableSlotPricesfmt); -//DBCStorage sDBCSummonProperties(SummonPropertiesfmt); -//DBCStorage sDBCTalent(TalentEntryfmt); -TalentSpellPosMap sTalentSpellPosMap; -//DBCStorage sDBCTalentTab(TalentTabEntryfmt); - -// store absolute bit position for first rank for talent inspect -typedef std::map TalentInspectMap; -static TalentInspectMap sTalentPosInInspect; -static TalentInspectMap sTalentTabSizeInInspect; -static uint32 sTalentTabPages[12/*MAX_CLASSES*/][3]; - -//DBCStorage sDBCTaxiNodes(TaxiNodesEntryfmt); -TaxiMask sTaxiNodesMask; - -// DBC used only for initialization sTaxiPathSetBySource at startup. -TaxiPathSetBySource sTaxiPathSetBySource; -//DBCStorage sDBCTaxiPath(TaxiPathEntryfmt); - -// DBC store data but sTaxiPathNodesByPath used for fast access to entries (it's not owner pointed data). -TaxiPathNodesByPath sTaxiPathNodesByPath; -//static DBCStorage sDBCTaxiPathNode(TaxiPathNodeEntryfmt); - -//DBCStorage sDBCTransportAnimation(TransportAnimationfmt); - -//DBCStorage sDBCTotemCategory(TotemCategoryEntryfmt); -//DBCStorage sDBCWMOAreaTable(WMOAreaTableEntryfmt); -//DBCStorage sDBCWorldMapArea(WorldMapAreaEntryfmt); -// DBCStorage sWorldMapOverlayStore(WorldMapOverlayEntryfmt); - -typedef std::list StoreProblemList; - -bool IsAcceptableClientBuild(uint32 build) -{ - int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD; - for (int i = 0; accepted_versions[i]; ++i) - if (int(build) == accepted_versions[i]) - return true; - - return false; -} - -std::string AcceptableClientBuildsListStr() -{ - std::ostringstream data; - int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD; - for (int i = 0; accepted_versions[i]; ++i) - data << accepted_versions[i] << " "; - return data.str(); -} - -static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, const std::string& filename) -{ - sLog.outError("Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize); - - // ASSERT must fail after function call - return false; -} - -template -inline void LoadDBC(uint32& availableDbcLocales, BarGoLink& bar, StoreProblemList& errlist, DBCStorage& storage, const std::string& dbc_path, const std::string& filename) -{ - // compatibility format and C++ structure sizes - MANGOS_ASSERT(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename)); - - std::string dbc_filename = dbc_path + filename; - if (storage.Load(dbc_filename.c_str())) - { - bar.step(); - for (uint8 i = 0; fullLocaleNameList[i].name; ++i) - { - if (!(availableDbcLocales & (1 << i))) - continue; - - std::string dbc_filename_loc = dbc_path + fullLocaleNameList[i].name + "/" + filename; - if (!storage.LoadStringsFrom(dbc_filename_loc.c_str())) - availableDbcLocales &= ~(1 << i); // mark as not available for speedup next checks - } - } - else - { - // sort problematic dbc to (1) non compatible and (2) nonexistent - FILE* f = fopen(dbc_filename.c_str(), "rb"); - if (f) - { - char buf[100]; - snprintf(buf, 100, " (exist, but have %u fields instead " SIZEFMTD ") Wrong client version DBC file?", storage.GetFieldCount(), strlen(storage.GetFormat())); - errlist.push_back(dbc_filename + buf); - fclose(f); - } - else - errlist.push_back(dbc_filename); - } -} - -void LoadDBCStores(const std::string& dataPath) -{ - std::string dbcPath = dataPath + "dbc/"; - - const uint32 DBCFilesCount = 66; - - BarGoLink bar(DBCFilesCount); - - StoreProblemList bad_dbc_files; - - // bitmask for index of fullLocaleNameList - uint32 availableDbcLocales = 0xFFFFFFFF; - -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAreaTable, dbcPath, "AreaTable.dbc"); -// -// // must be after sAreaStore loading -// for (uint32 i = 0; i < sDBCAreaTable.GetNumRows(); ++i) // areaflag numbered from 0 -// { -// if (AreaTableEntry const* area = sDBCAreaTable.LookupEntry(i)) -// { -// // fill AreaId->DBC records -// sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID), area->exploreFlag)); -// -// // fill MapId->DBC records ( skip sub zones and continents ) -// if (area->zone == 0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530) -// sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid, area->exploreFlag)); -// } -// } - -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAreaTrigger, dbcPath, "AreaTrigger.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCAuctionHouse, dbcPath, "AuctionHouse.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBankBagSlotPrices, dbcPath, "BankBagSlotPrices.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCBattlemasterList, dbcPath, "BattlemasterList.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharStartOutfit, dbcPath, "CharStartOutfit.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCCharTitles, dbcPath, "CharTitles.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChatChannels, dbcPath, "ChatChannels.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChrClasses, dbcPath, "ChrClasses.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDBCChrRaces, dbcPath, "ChrRaces.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCinematicCameraStore, dbcPath, "CinematicCamera.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCinematicSequencesStore, dbcPath, "CinematicSequences.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureDisplayInfoStore, dbcPath, "CreatureDisplayInfo.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureDisplayInfoExtraStore, dbcPath, "CreatureDisplayInfoExtra.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureFamilyStore, dbcPath, "CreatureFamily.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureModelDataStore, dbcPath, "CreatureModelData.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureSpellDataStore, dbcPath, "CreatureSpellData.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sCreatureTypeStore, dbcPath, "CreatureType.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDurabilityCostsStore, dbcPath, "DurabilityCosts.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sDurabilityQualityStore, dbcPath, "DurabilityQuality.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sEmotesStore, dbcPath, "Emotes.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sEmotesTextStore, dbcPath, "EmotesText.dbc"); - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sFactionStore, dbcPath, "Faction.dbc"); - -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sFactionTemplateStore, dbcPath, "FactionTemplate.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGameObjectDisplayInfoStore, dbcPath, "GameObjectDisplayInfo.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGemPropertiesStore, dbcPath, "GemProperties.dbc"); -// -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMSurveyCurrentSurveyStore, dbcPath, "GMSurveyCurrentSurvey.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMSurveyQuestionsStore, dbcPath, "GMSurveyQuestions.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMSurveySurveysStore, dbcPath, "GMSurveySurveys.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGMTicketCategoryStore, dbcPath, "GMTicketCategory.dbc"); -// -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtCombatRatingsStore, dbcPath, "gtCombatRatings.dbc"); -// -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToMeleeCritBaseStore, dbcPath, "gtChanceToMeleeCritBase.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToMeleeCritStore, dbcPath, "gtChanceToMeleeCrit.dbc"); -// -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToSpellCritBaseStore, dbcPath, "gtChanceToSpellCritBase.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtChanceToSpellCritStore, dbcPath, "gtChanceToSpellCrit.dbc"); -// -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtOCTRegenHPStore, dbcPath, "gtOCTRegenHP.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtNPCManaCostScalerStore, dbcPath, "gtNPCManaCostScaler.dbc"); -// // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtOCTRegenMPStore, dbcPath,"gtOCTRegenMP.dbc"); -- not used currently -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtRegenHPPerSptStore, dbcPath, "gtRegenHPPerSpt.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sGtRegenMPPerSptStore, dbcPath, "gtRegenMPPerSpt.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemStore, dbcPath, "Item.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemBagFamilyStore, dbcPath, "ItemBagFamily.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemClassStore, dbcPath, "ItemClass.dbc"); -// // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemDisplayInfoStore, dbcPath,"ItemDisplayInfo.dbc"); -- not used currently -// // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemCondExtCostsStore, dbcPath,"ItemCondExtCosts.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemExtendedCostStore, dbcPath, "ItemExtendedCost.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemRandomPropertiesStore, dbcPath, "ItemRandomProperties.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemRandomSuffixStore, dbcPath, "ItemRandomSuffix.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sItemSetStore, dbcPath, "ItemSet.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sLiquidTypeStore, dbcPath, "LiquidType.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sLockStore, dbcPath, "Lock.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMailTemplateStore, dbcPath, "MailTemplate.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMapStore, dbcPath, "Map.dbc"); - //{ - // // repairs entry for netherstorm - should be moved to SQL - // MapEntry const* mEntry = sDBCMap.LookupEntry(550); - // MapEntry* tempestKeepMap = new MapEntry(*mEntry); - // tempestKeepMap->ghost_entrance_map = 530; - // sDBCMap.EraseEntry(550); - // sDBCMap.InsertEntry(tempestKeepMap, 550); - //} -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sQuestSortStore, dbcPath, "QuestSort.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sRandomPropertiesPointsStore, dbcPath, "RandPropPoints.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillLineStore, dbcPath, "SkillLine.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillLineAbilityStore, dbcPath, "SkillLineAbility.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillRaceClassInfoStore, dbcPath, "SkillRaceClassInfo.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSkillTiersStore, dbcPath, "SkillTiers.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSoundEntriesStore, dbcPath, "SoundEntries.dbc"); - - for (auto skillLine : sDBCSkillLineAbility) - { - SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); - if (spellInfo && (spellInfo->Attributes & (SPELL_ATTR_ABILITY | SPELL_ATTR_PASSIVE | SPELL_ATTR_HIDDEN_CLIENTSIDE | SPELL_ATTR_HIDE_IN_COMBAT_LOG)) == (SPELL_ATTR_ABILITY | SPELL_ATTR_PASSIVE | SPELL_ATTR_HIDDEN_CLIENTSIDE | SPELL_ATTR_HIDE_IN_COMBAT_LOG)) - { - for (auto cFamily : sDBCCreatureFamily) - { - if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1]) - continue; - - sPetFamilySpellsStore[cFamily->ID].insert(spellInfo->Id); - } - } - } - -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellCastTimesStore, dbcPath, "SpellCastTimes.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellDurationStore, dbcPath, "SpellDuration.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellFocusObjectStore, dbcPath, "SpellFocusObject.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellItemEnchantmentStore, dbcPath, "SpellItemEnchantment.dbc"); - //for (uint32 i = 0; i < sSpellItemEnchantmentStore.GetNumRows(); ++i) - //{ - // SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(i); - // if (!enchantEntry) - // continue; - // for (uint32 k = 0; k < 3; ++k) - // { - // if (enchantEntry->spellid[k]) - // if (!sSpellTemplate.LookupEntry(enchantEntry->spellid[k])) - // sLog.outErrorDb("Spell ID %u found in spell item enchant %u does not exist.", enchantEntry->spellid[k], i); - // } - //} - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellItemEnchantmentConditionStore, dbcPath, "SpellItemEnchantmentCondition.dbc"); - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellRadiusStore, dbcPath, "SpellRadius.dbc"); - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellRangeStore, dbcPath, "SpellRange.dbc"); - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellShapeshiftFormStore, dbcPath, "SpellShapeshiftForm.dbc"); - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSpellVisualStore, dbcPath, "SpellVisual.dbc"); - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sStableSlotPricesStore, dbcPath, "StableSlotPrices.dbc"); - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sSummonPropertiesStore, dbcPath, "SummonProperties.dbc"); - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTalentStore, dbcPath, "Talent.dbc"); - - // create talent spells set - for (auto talentInfo : sDBCTalent) - { - for (int j = 0; j < 5; ++j) - if (talentInfo->RankID[j]) - sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(talentInfo->TalentID, j); - } - - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTalentTabStore, dbcPath, "TalentTab.dbc"); - - // prepare fast data access to bit pos of talent ranks for use at inspecting - { - // fill table by amount of talent ranks and fill sTalentTabBitSizeInInspect - // store in with (row,col,talent)->size key for correct sorting by (row,col) - typedef std::map TalentBitSize; - TalentBitSize sTalentBitSize; - for (auto talentInfo : sDBCTalent) - { - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); - if (!talentTabInfo) - continue; - - // find talent rank - uint32 curtalent_maxrank = 0; - for (uint32 k = 5; k > 0; --k) - { - if (talentInfo->RankID[k - 1]) - { - curtalent_maxrank = k; - break; - } - } - - sTalentBitSize[(talentInfo->Row << 24) + (talentInfo->Col << 16) + talentInfo->TalentID] = curtalent_maxrank; - sTalentTabSizeInInspect[talentInfo->TalentTab] += curtalent_maxrank; - } - - // now have all max ranks (and then bit amount used for store talent ranks in inspect) - for (auto talentTabInfo : sDBCTalentTab) - { - // prevent memory corruption; otherwise cls will become 12 below - if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0) - continue; - - // store class talent tab pages - uint32 cls = 1; - for (uint32 m = 1; !(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES; m <<= 1, ++cls) {} - - sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabInfo->TalentTabID; - - // add total amount bits for first rank starting from talent tab first talent rank pos. - uint32 pos = 0; - for (TalentBitSize::iterator itr = sTalentBitSize.begin(); itr != sTalentBitSize.end(); ++itr) - { - uint32 talentId = itr->first & 0xFFFF; - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(talentId); - if (!talentInfo) - continue; - - if (talentInfo->TalentTab != talentTabInfo->TalentTabID) - continue; - - sTalentPosInInspect[talentId] = pos; - pos += itr->second; - } - } - } - -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiNodesStore, dbcPath, "TaxiNodes.dbc"); - -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathStore, dbcPath, "TaxiPath.dbc"); - for (auto entry : sDBCTaxiPath) - sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price); - uint32 pathCount = sDBCTaxiPath.GetMaxEntry(); - - //## TaxiPathNode.dbc ## Loaded only for initialization different structures - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathNodeStore, dbcPath, "TaxiPathNode.dbc"); - // Calculate path nodes count - std::vector pathLength; - pathLength.resize(pathCount); // 0 and some other indexes not used - for (auto entry : sDBCTaxiPathNode) - { - if (pathLength[entry->path] < entry->index + 1) - pathLength[entry->path] = entry->index + 1; - } - // Set path length - sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used - for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i) - sTaxiPathNodesByPath[i].resize(pathLength[i]); - // fill data (pointers to sTaxiPathNodeStore elements - for (auto entry : sDBCTaxiPathNode) - sTaxiPathNodesByPath[entry->path].set(entry->index, entry); - - // Initialize global taxinodes mask - // include existing nodes that have at least single not spell base (scripted) path - { - std::set spellPaths; - for (auto sInfo : sSpellTemplate) - for (int j = 0; j < MAX_EFFECT_INDEX; ++j) - if (sInfo->Effect[j] == 123 /*SPELL_EFFECT_SEND_TAXI*/) - spellPaths.insert(sInfo->EffectMiscValue[j]); - - memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask)); - for (auto node : sDBCTaxiNodes) - { - TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(node->ID); - if (src_i != sTaxiPathSetBySource.end() && !src_i->second.empty()) - { - bool ok = false; - for (const auto& dest_i : src_i->second) - { - // not spell path - if (spellPaths.find(dest_i.second.ID) == spellPaths.end()) - { - ok = true; - break; - } - } - - if (!ok) - continue; - } - - // valid taxi network node - uint8 field = (uint8)((node->ID - 1) / 32); - uint32 submask = 1 << ((node->ID - 1) % 32); - sTaxiNodesMask[field] |= submask; - } - } - -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTransportAnimationStore, dbcPath, "TransportAnimation.dbc"); -// -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTotemCategoryStore, dbcPath, "TotemCategory.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sWorldMapAreaStore, dbcPath, "WorldMapArea.dbc"); -// LoadDBC(availableDbcLocales, bar, bad_dbc_files, sWMOAreaTableStore, dbcPath, "WMOAreaTable.dbc"); - for (auto entry : sDBCWMOAreaTable) - { - sWMOAreaInfoByTripple[WMOAreaTableTripple(entry->rootId, entry->adtId, entry->groupId)].push_back(entry); - } - // LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapOverlayStore, dbcPath,"WorldMapOverlay.dbc"); - // LoadDBC(availableDbcLocales, bar, bad_dbc_files, sWorldSafeLocsStore, dbcPath, "WorldSafeLocs.dbc"); - - // error checks - if (bad_dbc_files.size() >= DBCFilesCount) - { - sLog.outError("\nIncorrect DataDir value in mangosd.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFilesCount, dataPath.c_str()); - Log::WaitBeforeContinueIfNeed(); - exit(1); - } - if (!bad_dbc_files.empty()) - { - std::string str; - for (auto& bad_dbc_file : bad_dbc_files) - str += bad_dbc_file + "\n"; - - sLog.outError("\nSome required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFilesCount, str.c_str()); - Log::WaitBeforeContinueIfNeed(); - exit(1); - } - - // Check loaded DBC files proper version - if (!sDBCSkillLineAbility.LookupEntry(17514) || - !sDBCMap.LookupEntry(598) || - !sDBCGemProperties.LookupEntry(1127) || - !sDBCItemExtendedCost.LookupEntry(2425) || - !sDBCCharTitles.LookupEntry(71) || - !sDBCAreaTable.LookupEntry(1768)) - { - sLog.outError("\nYou have _outdated_ DBC files. Please re-extract DBC files for one from client build: %s", AcceptableClientBuildsListStr().c_str()); - Log::WaitBeforeContinueIfNeed(); - exit(1); - } - - sLog.outString(">> Initialized %d data stores", DBCFilesCount); - sLog.outString(); -} - -char const* GetPetName(uint32 petfamily, uint32 dbclang) -{ - if (!petfamily) - return nullptr; - CreatureFamilyEntry const* pet_family = sDBCCreatureFamily.LookupEntry(petfamily); - if (!pet_family) - return nullptr; - return pet_family->Name[dbclang] ? pet_family->Name[dbclang] : nullptr; -} - -TalentSpellPos const* GetTalentSpellPos(uint32 spellId) -{ - TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId); - if (itr == sTalentSpellPosMap.end()) - return nullptr; - - return &itr->second; -} - -uint32 GetTalentSpellCost(TalentSpellPos const* pos) -{ - if (pos) - return pos->rank + 1; - - return 0; -} - -uint32 GetTalentSpellCost(uint32 spellId) -{ - return GetTalentSpellCost(GetTalentSpellPos(spellId)); -} - - - -uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId) -{ - if (mapid != 530) // speed for most cases - return mapid; - - if (WorldMapAreaEntry const* wma = sDBCWorldMapArea.LookupEntry(zoneId)) - return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id; - - return mapid; -} - -ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) -{ - mapid = GetVirtualMapForMapAndZone(mapid, zoneId); - if (mapid < 2) - return CONTENT_1_60; - - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); - if (!mapEntry) - return CONTENT_1_60; - - switch (mapEntry->Expansion()) - { - default: return CONTENT_1_60; - case 1: return CONTENT_61_70; - } -} - -ChatChannelsEntry const* GetChatChannelsEntryFor(const std::string& name, uint32 channel_id/* = 0*/) -{ - std::wstring wname; - - Utf8toWStr(name, wname); - - if (!channel_id && wname.empty()) - return nullptr; - - // not sorted, numbering index from 0 - for (auto entry : sDBCChatChannels) - { - std::wstring wpattern; - - // try to match by name first, avoid creating custom channels with same name - if (!wname.empty()) - { - for (uint32 i = 0; i < MAX_LOCALE; ++i) - { - Utf8toWStr(entry->pattern[i], wpattern); - - if (wpattern.empty()) - continue; - - size_t argpos = wpattern.find(L"%s"); - - // formatting arg present: strip and attempt partial match - if (argpos != std::wstring::npos) - { - wpattern.replace(argpos, 2, L""); - - if (wname.find(wpattern) != std::wstring::npos) - return entry; - } - // attempt full match - else if (wname.compare(wpattern) == 0) - return entry; - } - } - - // name still not found, but channel id is provided: possibly no dbc data for client locale - if (channel_id && channel_id == entry->ChannelID) - return entry; - } - return nullptr; -} - -bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId) -{ - if (requiredTotemCategoryId == 0) - return true; - if (itemTotemCategoryId == 0) - return false; - - TotemCategoryEntry const* itemEntry = sDBCTotemCategory.LookupEntry(itemTotemCategoryId); - if (!itemEntry) - return false; - TotemCategoryEntry const* reqEntry = sDBCTotemCategory.LookupEntry(requiredTotemCategoryId); - if (!reqEntry) - return false; - - if (itemEntry->categoryType != reqEntry->categoryType) - return false; - - return (itemEntry->categoryMask & reqEntry->categoryMask) == reqEntry->categoryMask; -} - -bool MapCoordinateVsZoneCheck(float x, float y, uint32 mapid, uint32 zone) -{ - WorldMapAreaEntry const* WmaEntry = sDBCWorldMapArea.LookupEntry(zone); - if (WmaEntry && mapid == WmaEntry->map_id && - x >= WmaEntry->x2 && x <= WmaEntry->x1 && y >= WmaEntry->y2 && y <= WmaEntry->y1) - return true; - return false; -} - -bool Zone2MapCoordinates(float& x, float& y, uint32 zone) -{ - WorldMapAreaEntry const* maEntry = sDBCWorldMapArea.LookupEntry(zone); - - // if not listed then map coordinates (instance) - if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1) - 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; -} - -bool Map2ZoneCoordinates(float& x, float& y, uint32 zone) -{ - WorldMapAreaEntry const* maEntry = sDBCWorldMapArea.LookupEntry(zone); - - // if not listed then map coordinates (instance) - if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1) - return false; - - x = (x - maEntry->x1) / ((maEntry->x2 - maEntry->x1) / 100); - y = (y - maEntry->y1) / ((maEntry->y2 - maEntry->y1) / 100); // client y coord from top to down - std::swap(x, y); // client have map coords swapped - - return true; -} - -uint32 GetTalentInspectBitPosInTab(uint32 talentId) -{ - TalentInspectMap::const_iterator itr = sTalentPosInInspect.find(talentId); - if (itr == sTalentPosInInspect.end()) - return 0; - - return itr->second; -} - -uint32 GetTalentTabInspectBitSize(uint32 talentTabId) -{ - TalentInspectMap::const_iterator itr = sTalentTabSizeInInspect.find(talentTabId); - if (itr == sTalentTabSizeInInspect.end()) - return 0; - - return itr->second; -} - -uint32 const* GetTalentTabPages(uint32 cls) -{ - return sTalentTabPages[cls]; -} - -bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, float x, float y, float z, float delta) -{ - if (mapid != atEntry->mapid) - return false; - - if (atEntry->radius > 0) - { - // if we have radius check it - float dist2 = (x - atEntry->x) * (x - atEntry->x) + (y - atEntry->y) * (y - atEntry->y) + (z - atEntry->z) * (z - atEntry->z); - if (dist2 > (atEntry->radius + delta) * (atEntry->radius + delta)) - return false; - } - else - { - // we have only extent - - // rotate the players position instead of rotating the whole cube, that way we can make a simplified - // is-in-cube check and we have to calculate only one point instead of 4 - - // 2PI = 360, keep in mind that ingame orientation is counter-clockwise - double rotation = 2 * M_PI - atEntry->box_orientation; - double sinVal = sin(rotation); - double cosVal = cos(rotation); - - float playerBoxDistX = x - atEntry->x; - float playerBoxDistY = y - atEntry->y; - - float rotPlayerX = float(atEntry->x + playerBoxDistX * cosVal - playerBoxDistY * sinVal); - float rotPlayerY = float(atEntry->y + playerBoxDistY * cosVal + playerBoxDistX * sinVal); - - // box edges are parallel to coordiante axis, so we can treat every dimension independently :D - float dz = z - atEntry->z; - float dx = rotPlayerX - atEntry->x; - float dy = rotPlayerY - atEntry->y; - if ((fabs(dx) > atEntry->box_x / 2 + delta) || - (fabs(dy) > atEntry->box_y / 2 + delta) || - (fabs(dz) > atEntry->box_z / 2 + delta)) - { - return false; - } - } - - return true; -} - -uint32 GetCreatureModelRace(uint32 model_id) -{ - CreatureDisplayInfoEntry const* displayEntry = sDBCCreatureDisplayInfo.LookupEntry(model_id); - if (!displayEntry) - return 0; - CreatureDisplayInfoExtraEntry const* extraEntry = sDBCCreatureDisplayInfoExtra.LookupEntry(displayEntry->ExtendedDisplayInfoID); - return extraEntry ? extraEntry->Race : 0; -} - -// script support functions -//DBCStorage const* GetSoundEntriesStore() { return &sDBCSoundEntries; } -//DBCStorage const* GetSpellRangeStore() { return &sDBCSpellRange; } -// DBCStorage const* GetFactionStore() { return &sFactionStore; } -//DBCStorage const* GetItemDisplayStore() { return &sDBCItem; } -//DBCStorage const* GetCreatureDisplayStore() { return &sDBCCreatureDisplayInfo; } -//DBCStorage const* GetEmotesStore() { return &sDBCEmotes; } -//DBCStorage const* GetEmotesTextStore() { return &sDBCEmotesText; } diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index e2f06d0f3f8..5d1ee6a5170 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -19,151 +19,4 @@ #ifndef MANGOS_DBCSTORES_H #define MANGOS_DBCSTORES_H -#include "Common.h" -#include "Database/DBCStore.h" -#include "Server/DBCStructure.h" - -#include -#include - -bool IsAcceptableClientBuild(uint32 build); -std::string AcceptableClientBuildsListStr(); - -char const* GetPetName(uint32 petfamily, uint32 dbclang); -uint32 GetTalentSpellCost(uint32 spellId); -uint32 GetTalentSpellCost(TalentSpellPos const* pos); -TalentSpellPos const* GetTalentSpellPos(uint32 spellId); - -int32 GetAreaFlagByAreaID(uint32 area_id); // -1 if not found -uint32 GetAreaFlagByMapId(uint32 mapid); - -std::vector& GetWMOAreaTableEntriesByTripple(int32 rootid, int32 adtid, int32 groupid); - -AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id); -AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id); - -uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId); - -enum ContentLevels -{ - CONTENT_1_60 = 0, - CONTENT_61_70 -}; -ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId); - -ChatChannelsEntry const* GetChatChannelsEntryFor(const std::string& name, uint32 channel_id = 0); - -bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId); - -bool MapCoordinateVsZoneCheck(float x, float y, uint32 mapid, uint32 zone); -bool Zone2MapCoordinates(float& x, float& y, uint32 zone); -bool Map2ZoneCoordinates(float& x, float& y, uint32 zone); - -uint32 GetTalentInspectBitPosInTab(uint32 talentId); -uint32 GetTalentTabInspectBitSize(uint32 talentTabId); -uint32 const* /*[3]*/ GetTalentTabPages(uint32 cls); - -bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, float x, float y, float z, float delta = 0.0f); - -uint32 GetCreatureModelRace(uint32 model_id); - -//extern DBCStorage sDBCAreaTable;// recommend access using functions -//extern DBCStorage sDBCAreaTrigger; -//extern DBCStorage sDBCAuctionHouse; -//extern DBCStorage sDBCBankBagSlotPrices; -//extern DBCStorage sDBCBattlemasterList; -// extern DBCStorage sChatChannelsStore; -- accessed using function, no usable index -//extern DBCStorage sDBCCharStartOutfit; -//extern DBCStorage sDBCCharTitles; -//extern DBCStorage sDBCChatChannels; -//extern DBCStorage sDBCChrClasses; -//extern DBCStorage sDBCChrRaces; -//extern DBCStorage sDBCCinematicCamera; -//extern DBCStorage sCinematicSequencesStore; -//extern DBCStorage sCreatureDisplayInfoStore; -//extern DBCStorage sCreatureDisplayInfoExtraStore; -//extern DBCStorage sCreatureFamilyStore; -//extern DBCStorage sCreatureModelDataStore; -//extern DBCStorage sCreatureSpellDataStore; -//extern DBCStorage sCreatureTypeStore; -//extern DBCStorage sDurabilityCostsStore; -//extern DBCStorage sDurabilityQualityStore; -//extern DBCStorage sEmotesStore; -//extern DBCStorage sEmotesTextStore; -////extern DBCStorage sFactionStore; -//extern DBCStorage sFactionTemplateStore; -//extern DBCStorage sGameObjectDisplayInfoStore; -//extern DBCStorage sGemPropertiesStore; -// -//extern DBCStorage sGMSurveyCurrentSurveyStore; -//extern DBCStorage sGMSurveyQuestionsStore; -//extern DBCStorage sGMSurveySurveysStore; -//extern DBCStorage sGMTicketCategoryStore; -// -//extern DBCStorage sGtCombatRatingsStore; -//extern DBCStorage sGtChanceToMeleeCritBaseStore; -//extern DBCStorage sGtChanceToMeleeCritStore; -//extern DBCStorage sGtChanceToSpellCritBaseStore; -//extern DBCStorage sGtChanceToSpellCritStore; -//extern DBCStorage sGtOCTRegenHPStore; -//extern DBCStorage sGtNPCManaCostScalerStore; -//// extern DBCStorage sGtOCTRegenMPStore; -- not used currently -//extern DBCStorage sGtRegenHPPerSptStore; -//extern DBCStorage sGtRegenMPPerSptStore; -//extern DBCStorage sItemStore; -//extern DBCStorage sItemBagFamilyStore; -//extern DBCStorage sItemClassStore; -//// extern DBCStorage sItemDisplayInfoStore; -- not used currently -//extern DBCStorage sItemExtendedCostStore; -//extern DBCStorage sItemRandomPropertiesStore; -//extern DBCStorage sItemRandomSuffixStore; -//extern DBCStorage sItemSetStore; -//extern DBCStorage sLiquidTypeStore; -//extern DBCStorage sLockStore; -//extern DBCStorage sMailTemplateStore; -//extern DBCStorage sMapStore; -//extern DBCStorage sQuestSortStore; -//extern DBCStorage sRandomPropertiesPointsStore; -//extern DBCStorage sSkillLineStore; -//extern DBCStorage sSkillLineAbilityStore; -//extern DBCStorage sSkillRaceClassInfoStore; -//extern DBCStorage sSkillTiersStore; -//extern DBCStorage sSoundEntriesStore; -//extern DBCStorage sSpellCastTimesStore; -//extern DBCStorage sSpellDurationStore; -//extern DBCStorage sSpellFocusObjectStore; -//extern DBCStorage sSpellItemEnchantmentStore; -//extern DBCStorage sSpellItemEnchantmentConditionStore; -extern SpellCategoryStore sSpellCategoryStore; -extern ItemSpellCategoryStore sItemSpellCategoryStore; -extern PetFamilySpellsStore sPetFamilySpellsStore; -//extern DBCStorage sSpellRadiusStore; -//extern DBCStorage sSpellRangeStore; -//extern DBCStorage sSpellShapeshiftFormStore; -//extern DBCStorage sSpellVisualStore; -//extern DBCStorage sStableSlotPricesStore; -//extern DBCStorage sSummonPropertiesStore; -//extern DBCStorage sTalentStore; -//extern DBCStorage sTalentTabStore; -//extern DBCStorage sTaxiNodesStore; -//extern DBCStorage sTaxiPathStore; -extern TaxiMask sTaxiNodesMask; -extern TaxiPathSetBySource sTaxiPathSetBySource; -extern TaxiPathNodesByPath sTaxiPathNodesByPath; -//extern DBCStorage sTransportAnimationStore; -//extern DBCStorage sTotemCategoryStore; -//extern DBCStorage sWMOAreaTableStore; -//// extern DBCStorage sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates -//// extern DBCStorage sWorldMapOverlayStore; -- not used currently -// -void LoadDBCStores(const std::string& dataPath); -// -//// script support functions -//DBCStorage const* GetSoundEntriesStore(); -//DBCStorage const* GetSpellRangeStore(); -//DBCStorage const* GetFactionStore(); -//DBCStorage const* GetItemDisplayStore(); -//DBCStorage const* GetCreatureDisplayStore(); -//DBCStorage const* GetEmotesStore(); -//DBCStorage const* GetEmotesTextStore(); #endif diff --git a/src/game/Server/SQLStorages.cpp b/src/game/Server/SQLStorages.cpp index 57c4ec8e48c..fc2eac7bdb7 100644 --- a/src/game/Server/SQLStorages.cpp +++ b/src/game/Server/SQLStorages.cpp @@ -18,6 +18,7 @@ #include "Server/SQLStorages.h" #include "DBCStructure.h" +#include "World/World.h" const char CreatureInfosrcfmt[] = "nsssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiss"; const char CreatureInfodstfmt[] = "nsssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisi"; @@ -230,6 +231,20 @@ AreaFlagByMapID sAreaFlagByMapID; // for instances without ge WMOAreaInfoByTripple sWMOAreaInfoByTripple; +SpellCategoryStore sSpellCategoryStore; +ItemSpellCategoryStore sItemSpellCategoryStore; +PetFamilySpellsStore sPetFamilySpellsStore; + +// store absolute bit position for first rank for talent inspect +TalentInspectMap sTalentPosInInspect; +TalentInspectMap sTalentTabSizeInInspect; +uint32 sTalentTabPages[12/*MAX_CLASSES*/][3]; +TalentSpellPosMap sTalentSpellPosMap; + +TaxiMask sTaxiNodesMask; +TaxiPathSetBySource sTaxiPathSetBySource; +TaxiPathNodesByPath sTaxiPathNodesByPath;// DBC store data but sTaxiPathNodesByPath used for fast access to entries (it's not owner pointed data). + void InitializeDBC() { // must be after sAreaStore loading @@ -242,6 +257,161 @@ void InitializeDBC() if (areaEntry->zone == 0 && areaEntry->mapid != 0 && areaEntry->mapid != 1 && areaEntry->mapid != 530) sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(areaEntry->mapid, areaEntry->exploreFlag)); } + + for (auto skillLine : sDBCSkillLineAbility) + { + SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); + if (spellInfo && (spellInfo->Attributes & (SPELL_ATTR_ABILITY | SPELL_ATTR_PASSIVE | SPELL_ATTR_HIDDEN_CLIENTSIDE | SPELL_ATTR_HIDE_IN_COMBAT_LOG)) == (SPELL_ATTR_ABILITY | SPELL_ATTR_PASSIVE | SPELL_ATTR_HIDDEN_CLIENTSIDE | SPELL_ATTR_HIDE_IN_COMBAT_LOG)) + { + for (auto cFamily : sDBCCreatureFamily) + { + if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1]) + continue; + + sPetFamilySpellsStore[cFamily->ID].insert(spellInfo->Id); + } + } + } + + // create talent spells set + for (auto talentInfo : sDBCTalent) + { + for (int j = 0; j < 5; ++j) + if (talentInfo->RankID[j]) + sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(talentInfo->TalentID, j); + } + + // prepare fast data access to bit pos of talent ranks for use at inspecting + { + // fill table by amount of talent ranks and fill sTalentTabBitSizeInInspect + // store in with (row,col,talent)->size key for correct sorting by (row,col) + typedef std::map TalentBitSize; + TalentBitSize sTalentBitSize; + for (auto talentInfo : sDBCTalent) + { + TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); + if (!talentTabInfo) + continue; + + // find talent rank + uint32 curtalent_maxrank = 0; + for (uint32 k = 5; k > 0; --k) + { + if (talentInfo->RankID[k - 1]) + { + curtalent_maxrank = k; + break; + } + } + + sTalentBitSize[(talentInfo->Row << 24) + (talentInfo->Col << 16) + talentInfo->TalentID] = curtalent_maxrank; + sTalentTabSizeInInspect[talentInfo->TalentTab] += curtalent_maxrank; + } + + // now have all max ranks (and then bit amount used for store talent ranks in inspect) + for (auto talentTabInfo : sDBCTalentTab) + { + // prevent memory corruption; otherwise cls will become 12 below + if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0) + continue; + + // store class talent tab pages + uint32 cls = 1; + for (uint32 m = 1; !(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES; m <<= 1, ++cls) {} + + sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabInfo->TalentTabID; + + // add total amount bits for first rank starting from talent tab first talent rank pos. + uint32 pos = 0; + for (TalentBitSize::iterator itr = sTalentBitSize.begin(); itr != sTalentBitSize.end(); ++itr) + { + uint32 talentId = itr->first & 0xFFFF; + TalentEntry const* talentInfo = sDBCTalent.LookupEntry(talentId); + if (!talentInfo) + continue; + + if (talentInfo->TalentTab != talentTabInfo->TalentTabID) + continue; + + sTalentPosInInspect[talentId] = pos; + pos += itr->second; + } + } + } + + for (auto entry : sDBCTaxiPath) + sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price); + uint32 pathCount = sDBCTaxiPath.GetMaxEntry(); + + std::vector pathLength; + pathLength.resize(pathCount); // 0 and some other indexes not used + for (auto entry : sDBCTaxiPathNode) + { + if (pathLength[entry->path] < entry->index + 1) + pathLength[entry->path] = entry->index + 1; + } + // Set path length + sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used + for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i) + sTaxiPathNodesByPath[i].resize(pathLength[i]); + // fill data (pointers to sTaxiPathNodeStore elements + for (auto entry : sDBCTaxiPathNode) + sTaxiPathNodesByPath[entry->path].set(entry->index, entry); + + // Initialize global taxinodes mask + // include existing nodes that have at least single not spell base (scripted) path + { + std::set spellPaths; + for (auto sInfo : sSpellTemplate) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) + if (sInfo->Effect[j] == 123 /*SPELL_EFFECT_SEND_TAXI*/) + spellPaths.insert(sInfo->EffectMiscValue[j]); + + memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask)); + for (auto node : sDBCTaxiNodes) + { + TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(node->ID); + if (src_i != sTaxiPathSetBySource.end() && !src_i->second.empty()) + { + bool ok = false; + for (const auto& dest_i : src_i->second) + { + // not spell path + if (spellPaths.find(dest_i.second.ID) == spellPaths.end()) + { + ok = true; + break; + } + } + + if (!ok) + continue; + } + + // valid taxi network node + uint8 field = (uint8)((node->ID - 1) / 32); + uint32 submask = 1 << ((node->ID - 1) % 32); + sTaxiNodesMask[field] |= submask; + } + } + + for (auto entry : sDBCWMOAreaTable) + { + sWMOAreaInfoByTripple[WMOAreaTableTripple(entry->rootId, entry->adtId, entry->groupId)].push_back(entry); + } + + // Check loaded DBC files proper version + if (!sDBCSkillLineAbility.LookupEntry(17514) || + !sDBCMap.LookupEntry(598) || + !sDBCGemProperties.LookupEntry(1127) || + !sDBCItemExtendedCost.LookupEntry(2425) || + !sDBCCharTitles.LookupEntry(71) || + !sDBCAreaTable.LookupEntry(1768)) + { + sLog.outError("\nYou have _outdated_ DBC files. Please re-extract DBC files for one from client build: %s", World::AcceptableClientBuildsListStr().c_str()); + Log::WaitBeforeContinueIfNeed(); + exit(1); + } } void LoadDBCTables() @@ -329,60 +499,4 @@ void LoadDBCTables() sLog.outString(); } -int32 GetAreaFlagByAreaID(uint32 area_id) -{ - AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id); - if (i == sAreaFlagByAreaID.end()) - return -1; - - return i->second; -} -uint32 GetAreaIdByLocalizedName(const std::string& name) -{ - for (auto areaEntry : sDBCAreaTable) - { - for (uint32 i = 0; i < MAX_LOCALE; ++i) - { - std::string area_name(areaEntry->area_name[i]); - if (area_name.size() > 0 && name.find(" - " + area_name) != std::string::npos) - { - return areaEntry->ID; - } - } - } - return 0; -} - -std::vector& GetWMOAreaTableEntriesByTripple(int32 rootid, int32 adtid, int32 groupid) -{ - return sWMOAreaInfoByTripple[WMOAreaTableTripple(rootid, adtid, groupid)]; -} - -AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id) -{ - int32 areaflag = GetAreaFlagByAreaID(area_id); - if (areaflag < 0) - return nullptr; - - return sDBCAreaTable.LookupEntry(areaflag); -} - -AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id) -{ - if (area_flag) - return sDBCAreaTable.LookupEntry(area_flag); - - if (MapEntry const* mapEntry = sDBCMap.LookupEntry(map_id)) - return GetAreaEntryByAreaID(mapEntry->linked_zone); - - return nullptr; -} - -uint32 GetAreaFlagByMapId(uint32 mapid) -{ - AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid); - if (i == sAreaFlagByMapID.end()) - return 0; - return i->second; -} diff --git a/src/game/Server/SQLStorages.h b/src/game/Server/SQLStorages.h index cc906e09ba4..5ca95c9bf51 100644 --- a/src/game/Server/SQLStorages.h +++ b/src/game/Server/SQLStorages.h @@ -46,7 +46,7 @@ extern SQLHashStorage sGOStorage; extern SQLMultiStorage sSpellScriptTargetStorage; -// DBC stores in <>db +// DBC stores in db extern SQLStorage sDBCAreaTable; extern SQLStorage sDBCAreaTrigger; extern SQLStorage sDBCAuctionHouse; @@ -151,6 +151,19 @@ extern AreaFlagByMapID sAreaFlagByMapID; // for instances wit extern WMOAreaInfoByTripple sWMOAreaInfoByTripple; +extern SpellCategoryStore sSpellCategoryStore; +extern ItemSpellCategoryStore sItemSpellCategoryStore; +extern PetFamilySpellsStore sPetFamilySpellsStore; +extern TaxiMask sTaxiNodesMask; +extern TaxiPathSetBySource sTaxiPathSetBySource; +extern TaxiPathNodesByPath sTaxiPathNodesByPath; + +typedef std::map TalentInspectMap; +extern TalentInspectMap sTalentPosInInspect; +extern TalentInspectMap sTalentTabSizeInInspect; +extern uint32 sTalentTabPages[12/*MAX_CLASSES*/][3]; +extern TalentSpellPosMap sTalentSpellPosMap; + void LoadDBCTables(); diff --git a/src/game/Server/WorldSocket.cpp b/src/game/Server/WorldSocket.cpp index b92e36181ff..d53362369ce 100644 --- a/src/game/Server/WorldSocket.cpp +++ b/src/game/Server/WorldSocket.cpp @@ -304,7 +304,7 @@ bool WorldSocket::HandleAuthSession(WorldPacket& recvPacket) clientSeed); // Check the version of client trying to connect - if (!IsAcceptableClientBuild(ClientBuild)) + if (!World::IsAcceptableClientBuild(ClientBuild)) { packet.Initialize(SMSG_AUTH_RESPONSE, 1); packet << uint8(AUTH_VERSION_MISMATCH); diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index dbfd2338b97..085f32ffaa0 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -8002,14 +8002,14 @@ void Spell::EffectDuel(SpellEffectIndex eff_idx) return; // Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities) - AreaTableEntry const* casterAreaEntry = GetAreaEntryByAreaID(caster->GetAreaId()); + AreaTableEntry const* casterAreaEntry = TerrainManager::GetAreaEntryByAreaID(caster->GetAreaId()); if (casterAreaEntry && !(casterAreaEntry->flags & AREA_FLAG_DUEL)) { SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here return; } - AreaTableEntry const* targetAreaEntry = GetAreaEntryByAreaID(target->GetAreaId()); + AreaTableEntry const* targetAreaEntry = TerrainManager::GetAreaEntryByAreaID(target->GetAreaId()); if (targetAreaEntry && !(targetAreaEntry->flags & AREA_FLAG_DUEL)) { SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index f2925b69835..98c3bb27334 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -504,7 +504,7 @@ SpellCastResult GetErrorAtShapeshiftedCast(SpellEntry const* spellInfo, uint32 f { // talents that learn spells can have stance requirements that need ignore // (this requirement only for client-side stance show in talent description) - if (GetTalentSpellCost(spellInfo->Id) > 0 && + if (ObjectMgr::GetTalentSpellCost(spellInfo->Id) > 0 && (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_LEARN_SPELL)) return SPELL_CAST_OK; @@ -1737,7 +1737,7 @@ void SpellMgr::LoadSpellChains() } // talents not required data in spell chain for work, but must be checked if present for integrity - if (TalentSpellPos const* pos = GetTalentSpellPos(spell_id)) + if (TalentSpellPos const* pos = ObjectMgr::GetTalentSpellPos(spell_id)) { if (node.rank != pos->rank + 1) { @@ -1936,7 +1936,7 @@ void SpellMgr::LoadSpellLearnSpells() continue; } - if (GetTalentSpellCost(node.spell)) + if (ObjectMgr::GetTalentSpellCost(node.spell)) { sLog.outErrorDb("Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell); continue; @@ -1974,7 +1974,7 @@ void SpellMgr::LoadSpellLearnSpells() // talent or passive spells or skill-step spells auto-casted and not need dependent learning, // pet teaching spells don't must be dependent learning (casted) // other required explicit dependent learning - dbc_node.autoLearned = entry->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER_PET || GetTalentSpellCost(spell) > 0 || IsPassiveSpell(entry) || IsSpellHaveEffect(entry, SPELL_EFFECT_SKILL_STEP); + dbc_node.autoLearned = entry->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER_PET || ObjectMgr::GetTalentSpellCost(spell) > 0 || IsPassiveSpell(entry) || IsSpellHaveEffect(entry, SPELL_EFFECT_SKILL_STEP); SpellLearnSpellMapBounds db_node_bounds = GetSpellLearnSpellMapBounds(spell); @@ -2368,7 +2368,7 @@ void SpellMgr::LoadSpellAreas() } } - if (spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId)) + if (spellArea.areaId && !TerrainManager::GetAreaEntryByAreaID(spellArea.areaId)) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId); continue; @@ -2515,7 +2515,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const* spell // continent limitation (virtual continent), ignore for GM if (spellInfo->HasAttribute(SPELL_ATTR_EX4_CAST_ONLY_IN_OUTLAND) && !(player && player->IsGameMaster())) { - uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id); + uint32 v_map = Map::GetVirtualMapForMapAndZone(map_id, zone_id); MapEntry const* mapEntry = sDBCMap.LookupEntry(v_map); if (!mapEntry || mapEntry->addon < 1 || !mapEntry->IsContinent()) return SPELL_FAILED_REQUIRES_AREA; diff --git a/src/game/Tools/Formulas.h b/src/game/Tools/Formulas.h index de1e6eb05cb..989f47c1016 100644 --- a/src/game/Tools/Formulas.h +++ b/src/game/Tools/Formulas.h @@ -20,6 +20,7 @@ #define MANGOS_FORMULAS_H #include "World/World.h" +#include "Maps/Map.h" namespace MaNGOS { @@ -134,7 +135,7 @@ namespace MaNGOS if (target->IsTotem() || target->IsPet() || target->IsNoXp() || target->IsCritter()) return 0; - uint32 xp_gain = BaseGain(unit->getLevel(), target->getLevel(), GetContentLevelsForMapAndZone(unit->GetMapId(), unit->GetZoneId())); + uint32 xp_gain = BaseGain(unit->getLevel(), target->getLevel(), Map::GetContentLevelsForMapAndZone(unit->GetMapId(), unit->GetZoneId())); if (xp_gain == 0.0f) return 0; diff --git a/src/game/World/World.cpp b/src/game/World/World.cpp index cfc9c2a7b73..91834b937ca 100644 --- a/src/game/World/World.cpp +++ b/src/game/World/World.cpp @@ -895,7 +895,7 @@ void World::SetInitialWorldSettings() ///- Load the DBC files sLog.outString("Initialize DBC data stores..."); LoadDBCTables(); - LoadDBCStores(m_dataPath); + //LoadDBCStores(m_dataPath); DetectDBCLang(); sObjectMgr.SetDbc2StorageLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) @@ -2624,3 +2624,22 @@ void World::GeneratePacketMetrics() meas_players.add_field("warlock", std::to_string(GetOnlineClassPlayers(CLASS_WARLOCK))); meas_players.add_field("druid", std::to_string(GetOnlineClassPlayers(CLASS_DRUID))); } + +bool World::IsAcceptableClientBuild(uint32 build) +{ + int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD; + for (int i = 0; accepted_versions[i]; ++i) + if (int(build) == accepted_versions[i]) + return true; + + return false; +} + +std::string World::AcceptableClientBuildsListStr() +{ + std::ostringstream data; + int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD; + for (int i = 0; accepted_versions[i]; ++i) + data << accepted_versions[i] << " "; + return data.str(); +} \ No newline at end of file diff --git a/src/game/World/World.h b/src/game/World/World.h index baad5e9d005..47cd9caf295 100644 --- a/src/game/World/World.h +++ b/src/game/World/World.h @@ -640,6 +640,10 @@ class World Messager& GetMessager() { return m_messager; } void IncrementOpcodeCounter(uint32 opcodeId); // thread safe due to atomics + + static bool IsAcceptableClientBuild(uint32 build); + static std::string AcceptableClientBuildsListStr(); + protected: void _UpdateGameTime(); // callback for UpdateRealmCharacters diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index 351e6991156..7e23feac983 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -143,7 +143,7 @@ int Master::Run() // set realmbuilds depend on mangosd expected builds, and set server online { - std::string builds = AcceptableClientBuildsListStr(); + std::string builds = World::AcceptableClientBuildsListStr(); LoginDatabase.escape_string(builds); LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags & ~(%u), population = 0, realmbuilds = '%s' WHERE id = '%u'", REALM_FLAG_OFFLINE, builds.c_str(), realmID); } From 946a96977adc0049a1a00bf7346132e8e259acec Mon Sep 17 00:00:00 2001 From: Cyberium Date: Wed, 10 Mar 2021 20:24:57 +0100 Subject: [PATCH 27/28] Just some allignements --- src/game/Server/SQLStorages.cpp | 98 +++++++------- src/game/Server/SQLStorages.h | 222 ++++++++++++++++---------------- 2 files changed, 157 insertions(+), 163 deletions(-) diff --git a/src/game/Server/SQLStorages.cpp b/src/game/Server/SQLStorages.cpp index fc2eac7bdb7..e75fd59fb6a 100644 --- a/src/game/Server/SQLStorages.cpp +++ b/src/game/Server/SQLStorages.cpp @@ -20,55 +20,54 @@ #include "DBCStructure.h" #include "World/World.h" -const char CreatureInfosrcfmt[] = "nsssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiss"; -const char CreatureInfodstfmt[] = "nsssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisi"; -const char CreatureDataAddonInfofmt[] = "niibbiis"; -const char CreatureConditionalSpawnSrcFmt[] = "niix"; -const char CreatureConditionalSpawnDstFmt[] = "nii"; -const char CreatureModelfmt[] = "nffffbii"; -const char CreatureInfoAddonInfofmt[] = "niibbiis"; -const char EquipmentInfofmt[] = "niii"; -const char EquipmentInfoRawfmt[] = "niiiiiiiii"; -const char GameObjectInfosrcfmt[] = "niisssiiifiiiiiiiiiiiiiiiiiiiiiiiiiiis"; -const char GameObjectInfodstfmt[] = "niisssiiifiiiiiiiiiiiiiiiiiiiiiiiiiiii"; -const char ItemPrototypesrcfmt[] = "niiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifsiiiiii"; -const char ItemPrototypedstfmt[] = "niiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiii"; -const char PageTextfmt[] = "nsi"; -const char InstanceTemplatesrcfmt[] = "niiiiisl"; -const char InstanceTemplatedstfmt[] = "niiiiiil"; -const char WorldTemplatesrcfmt[] = "ns"; -const char WorldTemplatedstfmt[] = "ni"; -const char ConditionsFmt[] = "niiiiiix"; -const char SpellScriptTargetFmt[] = "niii"; -const char SpellEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiissssssssssssssssssssssssssssssssiiiiiLiiiifffiiiiiiiii"; -const char SpellConefmt[] = "ni"; -const char DungeonEncounterFmt[] = "niiiissssssssssssssssii"; -const char FactionEntryfmt[] = "niiiiiiiiiiiiiiiiiiffiissssssssssssssss"; -const char WorldSafeLocsFmt[] = "niffffs"; - -SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "", "creature_template"); -SQLStorage sCreatureDataAddonStorage(CreatureDataAddonInfofmt, "creature_addon"); -SQLStorage sCreatureInfoAddonStorage(CreatureInfoAddonInfofmt, "creature_template_addon"); -SQLStorage sCreatureModelStorage(CreatureModelfmt, "creature_model_info"); -SQLStorage sEquipmentStorage(EquipmentInfofmt, "creature_equip_template"); -SQLStorage sEquipmentStorageRaw(EquipmentInfoRawfmt, "creature_equip_template_raw"); -SQLStorage sPageTextStore(PageTextfmt, "page_text"); -SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "", "item_template"); -SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "", "instance_template"); -SQLStorage sWorldTemplate(WorldTemplatesrcfmt, WorldTemplatedstfmt, "", "world_template"); -SQLStorage sConditionStorage(ConditionsFmt, "conditions"); -SQLStorage sSpellTemplate(SpellEntryfmt, "spell_template"); -SQLStorage sSpellCones(SpellConefmt, "spell_cone"); -SQLStorage sDungeonEncounterStore(DungeonEncounterFmt, "instance_dungeon_encounters"); -SQLStorage sFactionStore(FactionEntryfmt, "faction_store"); -SQLStorage sCreatureConditionalSpawnStore(CreatureConditionalSpawnSrcFmt, CreatureConditionalSpawnDstFmt, "", "creature_conditional_spawn"); -SQLStorage sWorldSafeLocsStore(WorldSafeLocsFmt, "world_safe_locs"); - -SQLHashStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry", "gameobject_template"); - -SQLMultiStorage sSpellScriptTargetStorage(SpellScriptTargetFmt, "entry", "spell_script_target"); - -SQLStorage const* GetSpellStore() { return &sSpellTemplate; } +const char CreatureInfosrcfmt[] = "nsssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiss"; +const char CreatureInfodstfmt[] = "nsssiiiiiiiifiiiiliiiiiffiiiiiiiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisi"; +const char CreatureDataAddonInfofmt[] = "niibbiis"; +const char CreatureConditionalSpawnSrcFmt[] = "niix"; +const char CreatureConditionalSpawnDstFmt[] = "nii"; +const char CreatureModelfmt[] = "nffffbii"; +const char CreatureInfoAddonInfofmt[] = "niibbiis"; +const char EquipmentInfofmt[] = "niii"; +const char EquipmentInfoRawfmt[] = "niiiiiiiii"; +const char GameObjectInfosrcfmt[] = "niisssiiifiiiiiiiiiiiiiiiiiiiiiiiiiiis"; +const char GameObjectInfodstfmt[] = "niisssiiifiiiiiiiiiiiiiiiiiiiiiiiiiiii"; +const char ItemPrototypesrcfmt[] = "niiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifsiiiiii"; +const char ItemPrototypedstfmt[] = "niiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiii"; +const char PageTextfmt[] = "nsi"; +const char InstanceTemplatesrcfmt[] = "niiiiisl"; +const char InstanceTemplatedstfmt[] = "niiiiiil"; +const char WorldTemplatesrcfmt[] = "ns"; +const char WorldTemplatedstfmt[] = "ni"; +const char ConditionsFmt[] = "niiiiiix"; +const char SpellScriptTargetFmt[] = "niii"; +const char SpellEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiissssssssssssssssssssssssssssssssiiiiiLiiiifffiiiiiiiii"; +const char SpellConefmt[] = "ni"; +const char DungeonEncounterFmt[] = "niiiissssssssssssssssii"; +const char FactionEntryfmt[] = "niiiiiiiiiiiiiiiiiiffiissssssssssssssss"; +const char WorldSafeLocsFmt[] = "niffffs"; + +SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "", "creature_template"); +SQLStorage sCreatureDataAddonStorage(CreatureDataAddonInfofmt, "creature_addon"); +SQLStorage sCreatureInfoAddonStorage(CreatureInfoAddonInfofmt, "creature_template_addon"); +SQLStorage sCreatureModelStorage(CreatureModelfmt, "creature_model_info"); +SQLStorage sEquipmentStorage(EquipmentInfofmt, "creature_equip_template"); +SQLStorage sEquipmentStorageRaw(EquipmentInfoRawfmt, "creature_equip_template_raw"); +SQLStorage sPageTextStore(PageTextfmt, "page_text"); +SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "", "item_template"); +SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "", "instance_template"); +SQLStorage sWorldTemplate(WorldTemplatesrcfmt, WorldTemplatedstfmt, "", "world_template"); +SQLStorage sConditionStorage(ConditionsFmt, "conditions"); +SQLStorage sSpellTemplate(SpellEntryfmt, "spell_template"); +SQLStorage sSpellCones(SpellConefmt, "spell_cone"); +SQLStorage sDungeonEncounterStore(DungeonEncounterFmt, "instance_dungeon_encounters"); +SQLStorage sFactionStore(FactionEntryfmt, "faction_store"); +SQLStorage sCreatureConditionalSpawnStore(CreatureConditionalSpawnSrcFmt, CreatureConditionalSpawnDstFmt, "", "creature_conditional_spawn"); +SQLStorage sWorldSafeLocsStore(WorldSafeLocsFmt, "world_safe_locs"); + +SQLHashStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry", "gameobject_template"); +SQLMultiStorage sSpellScriptTargetStorage(SpellScriptTargetFmt, "entry", "spell_script_target"); + +SQLStorage const* GetSpellStore() { return &sSpellTemplate; } // DBC store in database @@ -499,4 +498,3 @@ void LoadDBCTables() sLog.outString(); } - diff --git a/src/game/Server/SQLStorages.h b/src/game/Server/SQLStorages.h index 5ca95c9bf51..fce8e3b1d96 100644 --- a/src/game/Server/SQLStorages.h +++ b/src/game/Server/SQLStorages.h @@ -22,108 +22,106 @@ #include "Database/SQLStorage.h" #include "DBCStructure.h" -extern SQLStorage sCreatureStorage; -extern SQLStorage sCreatureDataAddonStorage; -extern SQLStorage sCreatureInfoAddonStorage; -extern SQLStorage sCreatureModelStorage; -extern SQLStorage sEquipmentStorage; -extern SQLStorage sEquipmentStorageRaw; -extern SQLStorage sPageTextStore; -extern SQLStorage sItemStorage; -extern SQLStorage sInstanceTemplate; -extern SQLStorage sWorldTemplate; -extern SQLStorage sConditionStorage; -extern SQLStorage sSpellTemplate; -extern SQLStorage sSpellCones; -extern SQLStorage sDungeonEncounterStore; -extern SQLStorage sFactionStore; -extern SQLStorage sCreatureConditionalSpawnStore; -extern SQLStorage sWorldSafeLocsStore; - - -extern SQLHashStorage sGOStorage; - -extern SQLMultiStorage sSpellScriptTargetStorage; - +extern SQLStorage sCreatureStorage; +extern SQLStorage sCreatureDataAddonStorage; +extern SQLStorage sCreatureInfoAddonStorage; +extern SQLStorage sCreatureModelStorage; +extern SQLStorage sEquipmentStorage; +extern SQLStorage sEquipmentStorageRaw; +extern SQLStorage sPageTextStore; +extern SQLStorage sItemStorage; +extern SQLStorage sInstanceTemplate; +extern SQLStorage sWorldTemplate; +extern SQLStorage sConditionStorage; +extern SQLStorage sSpellTemplate; +extern SQLStorage sSpellCones; +extern SQLStorage sDungeonEncounterStore; +extern SQLStorage sFactionStore; +extern SQLStorage sCreatureConditionalSpawnStore; +extern SQLStorage sWorldSafeLocsStore; + +extern SQLHashStorage sGOStorage; +extern SQLMultiStorage sSpellScriptTargetStorage; // DBC stores in db -extern SQLStorage sDBCAreaTable; -extern SQLStorage sDBCAreaTrigger; -extern SQLStorage sDBCAuctionHouse; -extern SQLStorage sDBCBankBagSlotPrices; -extern SQLStorage sDBCBattlemasterList; -extern SQLStorage sDBCCharStartOutfit; -extern SQLStorage sDBCCharTitles; -extern SQLStorage sDBCChatChannels; -extern SQLStorage sDBCChrClasses; -extern SQLStorage sDBCChrRaces; -extern SQLStorage sDBCCinematicCamera; -extern SQLStorage sDBCCinematicSequences; -extern SQLStorage sDBCCreatureDisplayInfo; -extern SQLStorage sDBCCreatureDisplayInfoExtra; -extern SQLStorage sDBCCreatureFamily; -extern SQLStorage sDBCCreatureModelData; -extern SQLStorage sDBCCreatureSpellData; // todo not used? -extern SQLStorage sDBCCreatureType; -extern SQLStorage sDBCDurabilityCosts; -extern SQLStorage sDBCDurabilityQuality; -extern SQLStorage sDBCEmotes; -extern SQLStorage sDBCEmotesText; -extern SQLStorage sDBCFactionTemplate; -extern SQLStorage sDBCGameObjectDisplayInfo; -extern SQLStorage sDBCGemProperties; -extern SQLStorage sDBCGMSurveyCurrentSurvey; -extern SQLStorage sDBCGMSurveyQuestions; -extern SQLStorage sDBCGMSurveySurveys; -extern SQLStorage sDBCGMTicketCategory; -extern SQLStorage sDBCgtCombatRatings; -extern SQLStorage sDBCgtChanceToMeleeCritBase; -extern SQLStorage sDBCgtChanceToMeleeCrit; -extern SQLStorage sDBCgtChanceToSpellCritBase; -extern SQLStorage sDBCgtChanceToSpellCrit; -extern SQLStorage sDBCgtOCTRegenHP; -extern SQLStorage sDBCgtNPCManaCostScaler; -extern SQLStorage sDBCgtRegenHPPerSpt; -extern SQLStorage sDBCgtRegenMPPerSpt; -extern SQLStorage sDBCItem; -extern SQLStorage sDBCItemBagFamily; -extern SQLStorage sDBCItemClass; -extern SQLStorage sDBCItemExtendedCost; -extern SQLStorage sDBCItemRandomProperties; -extern SQLStorage sDBCItemRandomSuffix; -extern SQLStorage sDBCItemSet; -extern SQLStorage sDBCLiquidType; -extern SQLStorage sDBCLock; -extern SQLStorage sDBCMailTemplate; -extern SQLStorage sDBCMap; -extern SQLStorage sDBCQuestSort; -extern SQLStorage sDBCRandPropPoints; -extern SQLStorage sDBCSkillLine; -extern SQLStorage sDBCSkillLineAbility; -extern SQLStorage sDBCSkillRaceClassInfo; -extern SQLStorage sDBCSkillTiers; -extern SQLStorage sDBCSoundEntries; -extern SQLStorage sDBCSpellCastTimes; -extern SQLStorage sDBCSpellDuration; -extern SQLStorage sDBCSpellFocusObject; -extern SQLStorage sDBCSpellItemEnchantment; +extern SQLStorage sDBCAreaTable; +extern SQLStorage sDBCAreaTrigger; +extern SQLStorage sDBCAuctionHouse; +extern SQLStorage sDBCBankBagSlotPrices; +extern SQLStorage sDBCBattlemasterList; +extern SQLStorage sDBCCharStartOutfit; +extern SQLStorage sDBCCharTitles; +extern SQLStorage sDBCChatChannels; +extern SQLStorage sDBCChrClasses; +extern SQLStorage sDBCChrRaces; +extern SQLStorage sDBCCinematicCamera; +extern SQLStorage sDBCCinematicSequences; +extern SQLStorage sDBCCreatureDisplayInfo; +extern SQLStorage sDBCCreatureDisplayInfoExtra; +extern SQLStorage sDBCCreatureFamily; +extern SQLStorage sDBCCreatureModelData; +extern SQLStorage sDBCCreatureSpellData; // todo not used? +extern SQLStorage sDBCCreatureType; +extern SQLStorage sDBCDurabilityCosts; +extern SQLStorage sDBCDurabilityQuality; +extern SQLStorage sDBCEmotes; +extern SQLStorage sDBCEmotesText; +extern SQLStorage sDBCFactionTemplate; +extern SQLStorage sDBCGameObjectDisplayInfo; +extern SQLStorage sDBCGemProperties; +extern SQLStorage sDBCGMSurveyCurrentSurvey; +extern SQLStorage sDBCGMSurveyQuestions; +extern SQLStorage sDBCGMSurveySurveys; +extern SQLStorage sDBCGMTicketCategory; +extern SQLStorage sDBCgtCombatRatings; +extern SQLStorage sDBCgtChanceToMeleeCritBase; +extern SQLStorage sDBCgtChanceToMeleeCrit; +extern SQLStorage sDBCgtChanceToSpellCritBase; +extern SQLStorage sDBCgtChanceToSpellCrit; +extern SQLStorage sDBCgtOCTRegenHP; +extern SQLStorage sDBCgtNPCManaCostScaler; +extern SQLStorage sDBCgtRegenHPPerSpt; +extern SQLStorage sDBCgtRegenMPPerSpt; +extern SQLStorage sDBCItem; +extern SQLStorage sDBCItemBagFamily; +extern SQLStorage sDBCItemClass; +extern SQLStorage sDBCItemExtendedCost; +extern SQLStorage sDBCItemRandomProperties; +extern SQLStorage sDBCItemRandomSuffix; +extern SQLStorage sDBCItemSet; +extern SQLStorage sDBCLiquidType; +extern SQLStorage sDBCLock; +extern SQLStorage sDBCMailTemplate; +extern SQLStorage sDBCMap; +extern SQLStorage sDBCQuestSort; +extern SQLStorage sDBCRandPropPoints; +extern SQLStorage sDBCSkillLine; +extern SQLStorage sDBCSkillLineAbility; +extern SQLStorage sDBCSkillRaceClassInfo; +extern SQLStorage sDBCSkillTiers; +extern SQLStorage sDBCSoundEntries; +extern SQLStorage sDBCSpellCastTimes; +extern SQLStorage sDBCSpellDuration; +extern SQLStorage sDBCSpellFocusObject; +extern SQLStorage sDBCSpellItemEnchantment; extern SQLStorage sDBCSpellItemEnchantmentCondition; -extern SQLStorage sDBCSpellRadius; -extern SQLStorage sDBCSpellRange; -extern SQLStorage sDBCSpellShapeshiftForm; -extern SQLStorage sDBCSpellVisual; -extern SQLStorage sDBCStableSlotPrices; -extern SQLStorage sDBCSummonProperties; -extern SQLStorage sDBCTalent; -extern SQLStorage sDBCTalentTab; -extern SQLStorage sDBCTaxiNodes; -extern SQLStorage sDBCTaxiPath; -extern SQLStorage sDBCTaxiPathNode; -extern SQLStorage sDBCTransportAnimation; -extern SQLStorage sDBCTotemCategory; -extern SQLStorage sDBCWorldMapArea; -extern SQLStorage sDBCWMOAreaTable; - +extern SQLStorage sDBCSpellRadius; +extern SQLStorage sDBCSpellRange; +extern SQLStorage sDBCSpellShapeshiftForm; +extern SQLStorage sDBCSpellVisual; +extern SQLStorage sDBCStableSlotPrices; +extern SQLStorage sDBCSummonProperties; +extern SQLStorage sDBCTalent; +extern SQLStorage sDBCTalentTab; +extern SQLStorage sDBCTaxiNodes; +extern SQLStorage sDBCTaxiPath; +extern SQLStorage sDBCTaxiPathNode; +extern SQLStorage sDBCTransportAnimation; +extern SQLStorage sDBCTotemCategory; +extern SQLStorage sDBCWorldMapArea; +extern SQLStorage sDBCWMOAreaTable; + +// following are mostly helper store to get fast lookup of some other stores typedef std::map AreaFlagByAreaID; typedef std::map AreaFlagByMapID; @@ -146,28 +144,26 @@ struct WMOAreaTableTripple typedef std::map> WMOAreaInfoByTripple; -extern AreaFlagByAreaID sAreaFlagByAreaID; -extern AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files +extern AreaFlagByAreaID sAreaFlagByAreaID; +extern AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files -extern WMOAreaInfoByTripple sWMOAreaInfoByTripple; +extern WMOAreaInfoByTripple sWMOAreaInfoByTripple; -extern SpellCategoryStore sSpellCategoryStore; -extern ItemSpellCategoryStore sItemSpellCategoryStore; -extern PetFamilySpellsStore sPetFamilySpellsStore; -extern TaxiMask sTaxiNodesMask; -extern TaxiPathSetBySource sTaxiPathSetBySource; -extern TaxiPathNodesByPath sTaxiPathNodesByPath; +extern SpellCategoryStore sSpellCategoryStore; +extern ItemSpellCategoryStore sItemSpellCategoryStore; +extern PetFamilySpellsStore sPetFamilySpellsStore; +extern TaxiMask sTaxiNodesMask; +extern TaxiPathSetBySource sTaxiPathSetBySource; +extern TaxiPathNodesByPath sTaxiPathNodesByPath; typedef std::map TalentInspectMap; -extern TalentInspectMap sTalentPosInInspect; -extern TalentInspectMap sTalentTabSizeInInspect; +extern TalentInspectMap sTalentTabSizeInInspect; +extern TalentInspectMap sTalentPosInInspect; extern uint32 sTalentTabPages[12/*MAX_CLASSES*/][3]; -extern TalentSpellPosMap sTalentSpellPosMap; +extern TalentSpellPosMap sTalentSpellPosMap; void LoadDBCTables(); - - SQLStorage const* GetSpellStore(); #endif From cc47b148ea98c92bd374e18cfc3a5549a78d5f04 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Wed, 10 Mar 2021 23:27:00 +0100 Subject: [PATCH 28/28] Store renaming --- src/game/AI/BaseAI/TotemAI.cpp | 2 +- src/game/AI/EventAI/CreatureEventAI.cpp | 2 +- src/game/AI/EventAI/CreatureEventAIMgr.cpp | 26 +- src/game/AI/ScriptDevAI/ScriptDevAIMgr.cpp | 2 +- src/game/AI/ScriptDevAI/base/CombatAI.cpp | 2 +- .../AI/ScriptDevAI/include/sc_creature.cpp | 6 +- .../eastern_kingdoms/karazhan/chess_event.cpp | 2 +- .../caverns_of_time/hyjal/hyjalScripts.cpp | 2 +- .../scripts/outland/blades_edge_mountains.cpp | 2 +- src/game/AuctionHouse/AuctionHouseMgr.cpp | 8 +- src/game/AuctionHouseBot/AuctionHouseBot.cpp | 2 +- src/game/BattleGround/BattleGroundHandler.cpp | 6 +- src/game/BattleGround/BattleGroundMgr.cpp | 6 +- src/game/Chat/Channel.cpp | 2 +- src/game/Chat/Chat.cpp | 16 +- src/game/Chat/ChatHandler.cpp | 2 +- src/game/Chat/Level1.cpp | 12 +- src/game/Chat/Level2.cpp | 42 +-- src/game/Chat/Level3.cpp | 30 +- src/game/Chat/TicketCommands.cpp | 4 +- src/game/Chat/debugcmds.cpp | 8 +- src/game/Cinematics/M2Stores.cpp | 2 +- src/game/DBScripts/ScriptMgr.cpp | 18 +- src/game/Entities/CharacterHandler.cpp | 8 +- src/game/Entities/Corpse.cpp | 2 +- src/game/Entities/Creature.cpp | 14 +- src/game/Entities/CreatureLinkingMgr.cpp | 2 +- src/game/Entities/GameObject.cpp | 8 +- src/game/Entities/Item.cpp | 20 +- src/game/Entities/ItemEnchantmentMgr.cpp | 2 +- src/game/Entities/ItemHandler.cpp | 8 +- src/game/Entities/MiscHandler.cpp | 10 +- src/game/Entities/NPCHandler.cpp | 2 +- src/game/Entities/Object.cpp | 4 +- src/game/Entities/Pet.cpp | 12 +- src/game/Entities/PetHandler.cpp | 2 +- src/game/Entities/Player.cpp | 154 ++++---- src/game/Entities/QueryHandler.cpp | 2 +- src/game/Entities/Relations.cpp | 12 +- src/game/Entities/Taxi.cpp | 6 +- src/game/Entities/Transports.cpp | 4 +- src/game/Entities/Unit.cpp | 26 +- src/game/GMTickets/GMTicketHandler.cpp | 4 +- src/game/GMTickets/GMTicketMgr.cpp | 2 +- src/game/GameEvents/GameEventMgr.cpp | 2 +- src/game/Globals/Conditions.cpp | 2 +- src/game/Globals/ObjectMgr.cpp | 148 ++++---- src/game/Groups/Group.cpp | 8 +- src/game/Loot/LootMgr.cpp | 6 +- src/game/Mails/MailHandler.cpp | 2 +- src/game/Maps/GridMap.cpp | 20 +- src/game/Maps/Map.cpp | 12 +- src/game/Maps/MapManager.cpp | 8 +- src/game/Maps/MapPersistentStateMgr.cpp | 20 +- src/game/Maps/MapPersistentStateMgr.h | 2 +- src/game/Maps/TransportMgr.cpp | 6 +- src/game/MotionGenerators/MovementHandler.cpp | 2 +- .../TargetedMovementGenerator.cpp | 2 +- src/game/PlayerBot/Base/PlayerbotAI.cpp | 40 +- src/game/PlayerBot/Base/PlayerbotClassAI.cpp | 4 +- src/game/PlayerBot/Base/PlayerbotMgr.cpp | 4 +- src/game/Pools/PoolManager.cpp | 2 +- src/game/Quests/QuestDef.cpp | 2 +- src/game/Server/SQLStorages.cpp | 344 +++++++++--------- src/game/Server/SQLStorages.h | 152 ++++---- src/game/Spells/Spell.cpp | 36 +- src/game/Spells/Spell.h | 2 +- src/game/Spells/SpellAuras.cpp | 12 +- src/game/Spells/SpellEffects.cpp | 28 +- src/game/Spells/SpellHandler.cpp | 2 +- src/game/Spells/SpellMgr.cpp | 32 +- src/game/Spells/SpellMgr.h | 2 +- src/game/Spells/UnitAuraProcHandler.cpp | 8 +- src/game/Tools/CharacterDatabaseCleaner.cpp | 2 +- src/game/World/World.cpp | 2 +- src/game/vmap/GameObjectModel.cpp | 2 +- 76 files changed, 712 insertions(+), 712 deletions(-) diff --git a/src/game/AI/BaseAI/TotemAI.cpp b/src/game/AI/BaseAI/TotemAI.cpp index ebc9bae6f6c..b606ff05a65 100644 --- a/src/game/AI/BaseAI/TotemAI.cpp +++ b/src/game/AI/BaseAI/TotemAI.cpp @@ -75,7 +75,7 @@ void TotemAI::UpdateAI(const uint32 diff) return; // Get spell rangy - SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); + SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float maxRange = GetSpellMaxRange(srange); // SPELLMOD_RANGE not applied in this place just because nonexistent range mods for attacking totems diff --git a/src/game/AI/EventAI/CreatureEventAI.cpp b/src/game/AI/EventAI/CreatureEventAI.cpp index d4f8798382e..61b7ca70a68 100644 --- a/src/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/game/AI/EventAI/CreatureEventAI.cpp @@ -192,7 +192,7 @@ void CreatureEventAI::InitAI() m_mainSpellId = i.action[actionIdx].cast.spellId; SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_mainSpellId); m_mainSpellCost = Spell::CalculatePowerCost(spellInfo, m_creature); - m_mainSpellMinRange = GetSpellMinRange(sDBCSpellRange.LookupEntry(spellInfo->rangeIndex)); + m_mainSpellMinRange = GetSpellMinRange(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex)); m_mainAttackMask = SpellSchoolMask(m_mainAttackMask + spellInfo->SchoolMask); m_mainSpellInfo = spellInfo; } diff --git a/src/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/game/AI/EventAI/CreatureEventAIMgr.cpp index fd6c1c3ca18..569195e421a 100644 --- a/src/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -384,7 +384,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case SPAWNED_EVENT_ALWAY: break; case SPAWNED_EVENT_MAP: - if (!sDBCMap.LookupEntry(temp.spawned.conditionValue1)) + if (!sMapStore.LookupEntry(temp.spawned.conditionValue1)) sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'map specific' but map (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); break; case SPAWNED_EVENT_ZONE: @@ -473,7 +473,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case EVENT_T_RECEIVE_EMOTE: { - if (!sDBCEmotesText.LookupEntry(temp.receive_emote.emoteId)) + if (!sEmotesTextStore.LookupEntry(temp.receive_emote.emoteId)) { sLog.outErrorEventAI("Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.", temp.creature_id, i, temp.receive_emote.emoteId); continue; @@ -646,7 +646,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; } case ACTION_T_SET_FACTION: - if (action.set_faction.factionId != 0 && !sDBCFactionTemplate.LookupEntry(action.set_faction.factionId)) + if (action.set_faction.factionId != 0 && !sFactionTemplateStore.LookupEntry(action.set_faction.factionId)) { sLog.outErrorEventAI("Event %u Action %u uses nonexistent FactionId %u.", i, j + 1, action.set_faction.factionId); action.set_faction.factionId = 0; @@ -668,7 +668,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorEventAI("Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j + 1, action.morph.modelId, action.morph.creatureId); action.morph.modelId = 0; } - else if (!sDBCCreatureDisplayInfo.LookupEntry(action.morph.modelId)) + else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId)) { sLog.outErrorEventAI("Event %u Action %u uses nonexistent ModelId %u.", i, j + 1, action.morph.modelId); action.morph.modelId = 0; @@ -677,27 +677,27 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } break; case ACTION_T_SOUND: - if (!sDBCSoundEntries.LookupEntry(action.sound.soundId)) + if (!sSoundEntriesStore.LookupEntry(action.sound.soundId)) sLog.outErrorEventAI("Event %u Action %u uses nonexistent SoundID %u.", i, j + 1, action.sound.soundId); break; case ACTION_T_EMOTE: - if (!sDBCEmotes.LookupEntry(action.emote.emoteId)) + if (!sEmotesStore.LookupEntry(action.emote.emoteId)) sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.emote.emoteId); break; case ACTION_T_RANDOM_SOUND: - if (!sDBCSoundEntries.LookupEntry(action.random_sound.soundId1)) + if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1)) sLog.outErrorEventAI("Event %u Action %u param1 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId1); - if (action.random_sound.soundId2 >= 0 && !sDBCSoundEntries.LookupEntry(action.random_sound.soundId2)) + if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2)) sLog.outErrorEventAI("Event %u Action %u param2 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId2); - if (action.random_sound.soundId3 >= 0 && !sDBCSoundEntries.LookupEntry(action.random_sound.soundId3)) + if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3)) sLog.outErrorEventAI("Event %u Action %u param3 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId3); break; case ACTION_T_RANDOM_EMOTE: - if (!sDBCEmotes.LookupEntry(action.random_emote.emoteId1)) + if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1)) sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId1); - if (action.random_emote.emoteId2 >= 0 && !sDBCEmotes.LookupEntry(action.random_emote.emoteId2)) + if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2)) sLog.outErrorEventAI("Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId2); - if (action.random_emote.emoteId3 >= 0 && !sDBCEmotes.LookupEntry(action.random_emote.emoteId3)) + if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3)) sLog.outErrorEventAI("Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId3); break; case ACTION_T_CAST: @@ -908,7 +908,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog.outErrorEventAI("Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j + 1, action.mount.modelId, action.mount.creatureId); action.mount.modelId = 0; } - else if (!sDBCCreatureDisplayInfo.LookupEntry(action.mount.modelId)) + else if (!sCreatureDisplayInfoStore.LookupEntry(action.mount.modelId)) { sLog.outErrorEventAI("Event %u Action %u uses nonexistent ModelId %u.", i, j + 1, action.mount.modelId); action.mount.modelId = 0; diff --git a/src/game/AI/ScriptDevAI/ScriptDevAIMgr.cpp b/src/game/AI/ScriptDevAI/ScriptDevAIMgr.cpp index a030cc90fd1..2762f7ecc8b 100644 --- a/src/game/AI/ScriptDevAI/ScriptDevAIMgr.cpp +++ b/src/game/AI/ScriptDevAI/ScriptDevAIMgr.cpp @@ -597,7 +597,7 @@ void ScriptDevAIMgr::LoadAreaTriggerScripts() uint32 triggerId = fields[0].GetUInt32(); const char* scriptName = fields[1].GetString(); - if (!sDBCAreaTrigger.LookupEntry(triggerId)) + if (!sAreaTriggerStore.LookupEntry(triggerId)) { sLog.outErrorDb("Table `scripted_areatrigger` has area trigger (ID: %u) not listed in `AreaTrigger.dbc`.", triggerId); continue; diff --git a/src/game/AI/ScriptDevAI/base/CombatAI.cpp b/src/game/AI/ScriptDevAI/base/CombatAI.cpp index 5bd3b7418eb..567cdd5f7a2 100644 --- a/src/game/AI/ScriptDevAI/base/CombatAI.cpp +++ b/src/game/AI/ScriptDevAI/base/CombatAI.cpp @@ -100,7 +100,7 @@ void RangedCombatAI::AddMainSpell(uint32 spellId) m_mainSpellId = spellId; SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(m_mainSpellId); m_mainSpellCost = Spell::CalculatePowerCost(spellInfo, m_creature); - m_mainSpellMinRange = GetSpellMinRange(sDBCSpellRange.LookupEntry(spellInfo->rangeIndex)); + m_mainSpellMinRange = GetSpellMinRange(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex)); m_mainAttackMask = SpellSchoolMask(m_mainAttackMask + spellInfo->SchoolMask); m_mainSpellInfo = spellInfo; } diff --git a/src/game/AI/ScriptDevAI/include/sc_creature.cpp b/src/game/AI/ScriptDevAI/include/sc_creature.cpp index 3f3d92437c2..2679abb7321 100644 --- a/src/game/AI/ScriptDevAI/include/sc_creature.cpp +++ b/src/game/AI/ScriptDevAI/include/sc_creature.cpp @@ -102,7 +102,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId) if (!source) return; - if (!sDBCSoundEntries.LookupEntry(soundId)) + if (!sSoundEntriesStore.LookupEntry(soundId)) { script_error_log("Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow()); return; @@ -165,7 +165,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, int32 school, int32 mech continue; // Get the Range - SpellRangeEntry const* tempRange = sDBCSpellRange.LookupEntry(tempSpellInfo->rangeIndex); + SpellRangeEntry const* tempRange = sSpellRangeStore.LookupEntry(tempSpellInfo->rangeIndex); // Spell has invalid range store so we can't use it if (!tempRange) @@ -208,7 +208,7 @@ bool ScriptedAI::CanCast(Unit* target, SpellEntry const* spellInfo, bool trigger if (!triggered && m_creature->GetPower((Powers)spellInfo->powerType) < spellInfo->manaCost) return false; - SpellRangeEntry const* tempRange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); + SpellRangeEntry const* tempRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); // Spell has invalid range store so we can't use it if (!tempRange) diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp index 2cc4a5f72a0..6ba5a00ef53 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/karazhan/chess_event.cpp @@ -1745,7 +1745,7 @@ struct go_chessboard : public GameObjectAI break; } } - bool isCloseEnough = player->GetDistance(x, y, z, DIST_CALC_COMBAT_REACH) < GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[EFFECT_INDEX_0])); + bool isCloseEnough = player->GetDistance(x, y, z, DIST_CALC_COMBAT_REACH) < GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[EFFECT_INDEX_0])); if (!myHolder) { if (isCloseEnough) diff --git a/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalScripts.cpp b/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalScripts.cpp index 338f993f257..1d90e2b241a 100644 --- a/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalScripts.cpp +++ b/src/game/AI/ScriptDevAI/scripts/kalimdor/caverns_of_time/hyjal/hyjalScripts.cpp @@ -307,7 +307,7 @@ struct RaiseDeadHyjal : public SpellScript { if (strict) { - float radius = GetSpellMaxRange(sDBCSpellRange.LookupEntry(spell->m_spellInfo->rangeIndex)); + float radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(spell->m_spellInfo->rangeIndex)); UnitList tempUnitList; GameObjectList tempGOList; return spell->CheckScriptTargeting(EFFECT_INDEX_0, 1, radius, TARGET_LOCATION_SCRIPT_NEAR_CASTER, tempUnitList, tempGOList); diff --git a/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp b/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp index 2f33e81cda8..0ccb03ea191 100644 --- a/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp +++ b/src/game/AI/ScriptDevAI/scripts/outland/blades_edge_mountains.cpp @@ -1705,7 +1705,7 @@ struct go_aura_generator_000AI : public GameObjectAI break; } } - bool isCloseEnough = player->GetDistance(x, y, z, DIST_CALC_COMBAT_REACH) < GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[EFFECT_INDEX_0])); + bool isCloseEnough = player->GetDistance(x, y, z, DIST_CALC_COMBAT_REACH) < GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[EFFECT_INDEX_0])); if (!myHolder) { if (isCloseEnough) diff --git a/src/game/AuctionHouse/AuctionHouseMgr.cpp b/src/game/AuctionHouse/AuctionHouseMgr.cpp index 1e19fddba92..0bda7c7ae0c 100644 --- a/src/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouse/AuctionHouseMgr.cpp @@ -430,12 +430,12 @@ void AuctionHouseMgr::LoadAuctions() auction->itemTemplate, auction->itemCount, auction->itemRandomPropertyId, auction->itemGuidLow); } - auction->auctionHouseEntry = sDBCAuctionHouse.LookupEntry(houseid); + auction->auctionHouseEntry = sAuctionHouseStore.LookupEntry(houseid); if (!auction->auctionHouseEntry) { // need for send mail, use goblin auctionhouse - auction->auctionHouseEntry = sDBCAuctionHouse.LookupEntry(7); + auction->auctionHouseEntry = sAuctionHouseStore.LookupEntry(7); // Attempt send item back to owner std::ostringstream msgAuctionCanceledOwner; @@ -536,7 +536,7 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit) case 1638: houseid = 2; break; // exodar, alliance default: // for unknown case { - FactionTemplateEntry const* u_entry = sDBCFactionTemplate.LookupEntry(factionTemplateId); + FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId); if (!u_entry) houseid = 7; // goblin auction house else if (u_entry->factionGroupMask & FACTION_GROUP_MASK_ALLIANCE) @@ -566,7 +566,7 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit) } } - return sDBCAuctionHouse.LookupEntry(houseid); + return sAuctionHouseStore.LookupEntry(houseid); } void AuctionHouseObject::Update() diff --git a/src/game/AuctionHouseBot/AuctionHouseBot.cpp b/src/game/AuctionHouseBot/AuctionHouseBot.cpp index 87edaec3e38..8ef64a66800 100644 --- a/src/game/AuctionHouseBot/AuctionHouseBot.cpp +++ b/src/game/AuctionHouseBot/AuctionHouseBot.cpp @@ -225,7 +225,7 @@ void AuctionHouseBot::Update() continue; // don't put up items we don't know the value of uint32 bidPrice = buyoutPrice * (urand(m_auctionBidMin, m_auctionBidMax)) / 100; if (item) - auctionHouse->AddAuction(sDBCAuctionHouse.LookupEntry(houseType == AUCTION_HOUSE_ALLIANCE ? 1 : (houseType == AUCTION_HOUSE_HORDE ? 6 : 7)), item, urand(m_auctionTimeMin, m_auctionTimeMax) * HOUR, bidPrice, buyoutPrice); + auctionHouse->AddAuction(sAuctionHouseStore.LookupEntry(houseType == AUCTION_HOUSE_ALLIANCE ? 1 : (houseType == AUCTION_HOUSE_HORDE ? 6 : 7)), item, urand(m_auctionTimeMin, m_auctionTimeMax) * HOUR, bidPrice, buyoutPrice); } } } else if (m_houseAction >= MAX_AUCTION_HOUSE_TYPE && urand(0, 99) < m_chanceBuy) diff --git a/src/game/BattleGround/BattleGroundHandler.cpp b/src/game/BattleGround/BattleGroundHandler.cpp index 41da0f6b695..43c910735e4 100644 --- a/src/game/BattleGround/BattleGroundHandler.cpp +++ b/src/game/BattleGround/BattleGroundHandler.cpp @@ -96,7 +96,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data) recv_data >> instanceId; // instance id, 0 if First Available selected recv_data >> joinAsGroup; // join as group - if (!sDBCBattlemasterList.LookupEntry(receivedBgTypeId)) + if (!sBattlemasterListStore.LookupEntry(receivedBgTypeId)) { sLog.outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", receivedBgTypeId, _player->GetGUIDLow()); return; @@ -329,7 +329,7 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket& recv_data) uint32 bgTypeId; recv_data >> bgTypeId; // id from DBC - BattlemasterListEntry const* bl = sDBCBattlemasterList.LookupEntry(bgTypeId); + BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId); if (!bl) { sLog.outError("Battleground: invalid bgtype received."); @@ -354,7 +354,7 @@ void WorldSession::HandleBattlefieldPortOpcode(WorldPacket& recv_data) recv_data >> type >> unk2 >> receivedBgTypeId >> unk >> action; - if (!sDBCBattlemasterList.LookupEntry(receivedBgTypeId)) + if (!sBattlemasterListStore.LookupEntry(receivedBgTypeId)) { sLog.outError("BattlegroundHandler: invalid bgtype (%u) received.", receivedBgTypeId); return; diff --git a/src/game/BattleGround/BattleGroundMgr.cpp b/src/game/BattleGround/BattleGroundMgr.cpp index 21dbc250dfd..cd7ad945d6d 100644 --- a/src/game/BattleGround/BattleGroundMgr.cpp +++ b/src/game/BattleGround/BattleGroundMgr.cpp @@ -1838,7 +1838,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() uint32 resultedBgTypeId = fields[0].GetUInt32(); // can be overwrite by values from DB - BattlemasterListEntry const* bl = sDBCBattlemasterList.LookupEntry(resultedBgTypeId); + BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(resultedBgTypeId); if (!bl) { sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", resultedBgTypeId); @@ -2168,7 +2168,7 @@ void BattleGroundMgr::RewardArenaSeason(uint32 seasonId) } CharTitlesEntry const* titleEntries[5]; // optimization for (uint32 i = 0; i < 5; ++i) - titleEntries[i] = sDBCCharTitles.LookupEntry(titles[i]); + titleEntries[i] = sCharTitlesStore.LookupEntry(titles[i]); // Remove titles from online players // Only Rank 1 titles are permanent @@ -2541,7 +2541,7 @@ void BattleGroundMgr::LoadBattleMastersEntry() uint32 entry = fields[0].GetUInt32(); uint32 bgTypeId = fields[1].GetUInt32(); - if (!sDBCBattlemasterList.LookupEntry(bgTypeId)) + if (!sBattlemasterListStore.LookupEntry(bgTypeId)) { sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for nonexistent battleground type %u, ignored.", entry, bgTypeId); continue; diff --git a/src/game/Chat/Channel.cpp b/src/game/Chat/Channel.cpp index 2cb48dc7dbd..ab2fee5ec84 100644 --- a/src/game/Chat/Channel.cpp +++ b/src/game/Chat/Channel.cpp @@ -1145,7 +1145,7 @@ ChatChannelsEntry const* Channel::GetChatChannelsEntryFor(const std::string& nam return nullptr; // not sorted, numbering index from 0 - for (auto entry : sDBCChatChannels) + for (auto entry : sChatChannelsStore) { std::wstring wpattern; diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp index b276ec6cc2c..be1f841b4a0 100644 --- a/src/game/Chat/Chat.cpp +++ b/src/game/Chat/Chat.cpp @@ -1804,13 +1804,13 @@ bool ChatHandler::CheckEscapeSequences(const char* message) if (propertyId > 0) { - itemProperty = sDBCItemRandomProperties.LookupEntry(propertyId); + itemProperty = sItemRandomPropertiesStore.LookupEntry(propertyId); if (!itemProperty) return false; } else if (propertyId < 0) { - itemSuffix = sDBCItemRandomSuffix.LookupEntry(-propertyId); + itemSuffix = sItemRandomSuffixStore.LookupEntry(-propertyId); if (!itemSuffix) return false; } @@ -1885,7 +1885,7 @@ bool ChatHandler::CheckEscapeSequences(const char* message) if (reader.eof()) // : must be return false; - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(atoi(buffer)); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(atoi(buffer)); if (!talentInfo) return false; @@ -1979,7 +1979,7 @@ bool ChatHandler::CheckEscapeSequences(const char* message) return false; } - SkillLineEntry const* skillLine = sDBCSkillLine.LookupEntry(skillInfo->skillId); + SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId); if (!skillLine) { return false; @@ -2851,7 +2851,7 @@ uint32 ChatHandler::ExtractSpellIdFromLink(char** text) case SPELL_LINK_TALENT: { // talent - TalentEntry const* talentEntry = sDBCTalent.LookupEntry(id); + TalentEntry const* talentEntry = sTalentStore.LookupEntry(id); if (!talentEntry) return 0; @@ -3045,7 +3045,7 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x, if (!ExtractUInt32(&idS, id)) return false; - TaxiNodesEntry const* node = sDBCTaxiNodes.LookupEntry(id); + TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id); if (!node) return false; mapid = node->map_id; @@ -3140,7 +3140,7 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x, if (!ExtractUInt32(&idS, id)) return false; - AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(id); + AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(id); if (!atEntry) { PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, id); @@ -3160,7 +3160,7 @@ bool ChatHandler::ExtractLocationFromLink(char** text, uint32& mapid, float& x, if (!ExtractUInt32(&idS, id)) return false; - if (!sDBCAreaTrigger.LookupEntry(id)) + if (!sAreaTriggerStore.LookupEntry(id)) { PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, id); SetSentErrorMessage(true); diff --git a/src/game/Chat/ChatHandler.cpp b/src/game/Chat/ChatHandler.cpp index cceb665ffb6..8ccbe2b8e2c 100644 --- a/src/game/Chat/ChatHandler.cpp +++ b/src/game/Chat/ChatHandler.cpp @@ -624,7 +624,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data) recv_data >> emoteNum; recv_data >> guid; - EmotesTextEntry const* em = sDBCEmotesText.LookupEntry(text_emote); + EmotesTextEntry const* em = sEmotesTextStore.LookupEntry(text_emote); if (!em) return; diff --git a/src/game/Chat/Level1.cpp b/src/game/Chat/Level1.cpp index 9f88156e44d..a5408fbc546 100644 --- a/src/game/Chat/Level1.cpp +++ b/src/game/Chat/Level1.cpp @@ -212,7 +212,7 @@ bool ChatHandler::HandleGMMountUpCommand(char* args) if (ExtractUInt32(&args, displayid)) { - if (sDBCCreatureDisplayInfo.LookupEntry(displayid)) + if (sCreatureDisplayInfoStore.LookupEntry(displayid)) { m_session->GetPlayer()->Mount(displayid); return true; @@ -300,7 +300,7 @@ bool ChatHandler::HandleGPSCommand(char* args) uint32 zone_id, area_id; obj->GetZoneAndAreaId(zone_id, area_id); - MapEntry const* mapEntry = sDBCMap.LookupEntry(obj->GetMapId()); + MapEntry const* mapEntry = sMapStore.LookupEntry(obj->GetMapId()); AreaTableEntry const* zoneEntry = TerrainManager::GetAreaEntryByAreaID(zone_id); AreaTableEntry const* areaEntry = TerrainManager::GetAreaEntryByAreaID(area_id); @@ -850,7 +850,7 @@ bool ChatHandler::HandleModifyFactionCommand(char* args) if (!ExtractUint32KeyFromLink(&args, "Hfaction", factionid)) return false; - if (!sDBCFactionTemplate.LookupEntry(factionid)) + if (!sFactionTemplateStore.LookupEntry(factionid)) { PSendSysMessage(LANG_WRONG_FACTION, factionid); SetSentErrorMessage(true); @@ -1331,7 +1331,7 @@ bool ChatHandler::HandleLookupAreaCommand(char* args) wstrToLower(wnamepart); // Search in AreaTable.dbc - for (auto areaEntry : sDBCAreaTable) + for (auto areaEntry : sAreaTableStore) { int loc = GetSessionDbcLocale(); std::string name = areaEntry->area_name[loc]; @@ -1750,7 +1750,7 @@ bool ChatHandler::HandleGoTaxinodeCommand(char* args) if (!ExtractUint32KeyFromLink(&args, "Htaxinode", nodeId)) return false; - TaxiNodesEntry const* node = sDBCTaxiNodes.LookupEntry(nodeId); + TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(nodeId); if (!node) { PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND, nodeId); @@ -1888,7 +1888,7 @@ bool ChatHandler::HandleGoZoneXYCommand(char* args) // update to parent zone if exist (client map show only zones without parents) AreaTableEntry const* zoneEntry = areaEntry->zone ? TerrainManager::GetAreaEntryByAreaID(areaEntry->zone) : areaEntry; - MapEntry const* mapEntry = sDBCMap.LookupEntry(zoneEntry->mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(zoneEntry->mapid); if (mapEntry->Instanceable()) { diff --git a/src/game/Chat/Level2.cpp b/src/game/Chat/Level2.cpp index 847e73ff3dd..1ebda003d6f 100644 --- a/src/game/Chat/Level2.cpp +++ b/src/game/Chat/Level2.cpp @@ -224,7 +224,7 @@ bool ChatHandler::HandleTriggerCommand(char* args) if (!atId) return false; - atEntry = sDBCAreaTrigger.LookupEntry(atId); + atEntry = sAreaTriggerStore.LookupEntry(atId); if (!atEntry) { @@ -242,7 +242,7 @@ bool ChatHandler::HandleTriggerCommand(char* args) float dist2 = MAP_SIZE * MAP_SIZE; // Search triggers - for (auto atTestEntry : sDBCAreaTrigger) + for (auto atTestEntry : sAreaTriggerStore) { if (atTestEntry->mapid != m_session->GetPlayer()->GetMapId()) continue; @@ -320,7 +320,7 @@ bool ChatHandler::HandleTriggerActiveCommand(char* /*args*/) Player* pl = m_session->GetPlayer(); // Search in AreaTable.dbc - for (auto atEntry : sDBCAreaTrigger) + for (auto atEntry : sAreaTriggerStore) { if (!Map::IsPointInAreaTriggerZone(atEntry, pl->GetMapId(), pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ())) continue; @@ -345,7 +345,7 @@ bool ChatHandler::HandleTriggerNearCommand(char* args) Player* pl = m_session->GetPlayer(); // Search triggers - for (auto atEntry : sDBCAreaTrigger) + for (auto atEntry : sAreaTriggerStore) { if (atEntry->mapid != m_session->GetPlayer()->GetMapId()) continue; @@ -362,7 +362,7 @@ bool ChatHandler::HandleTriggerNearCommand(char* args) } // Search trigger targets - for (auto atEntry : sDBCAreaTrigger) + for (auto atEntry : sAreaTriggerStore) { AreaTrigger const* at = sObjectMgr.GetAreaTrigger(atEntry->id); if (!at) @@ -413,7 +413,7 @@ bool ChatHandler::HandleGoTriggerCommand(char* args) if (!atId) return false; - AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(atId); + AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(atId); if (!atEntry) { PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, atId); @@ -1117,7 +1117,7 @@ bool ChatHandler::HandleGameObjectAddCommand(char* args) return false; } - if (gInfo->displayId && !sDBCGameObjectDisplayInfo.LookupEntry(gInfo->displayId)) + if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) { // report to DB errors log as in loading case sLog.outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", id, gInfo->type, gInfo->displayId); @@ -2051,7 +2051,7 @@ bool ChatHandler::HandleNpcFactionIdCommand(char* args) uint32 factionId = (uint32) atoi(args); - if (!sDBCFactionTemplate.LookupEntry(factionId)) + if (!sFactionTemplateStore.LookupEntry(factionId)) { PSendSysMessage(LANG_WRONG_FACTION, factionId); SetSentErrorMessage(true); @@ -2432,7 +2432,7 @@ bool ChatHandler::HandleModifyMorphCommand(char* args) uint32 display_id = (uint32)atoi(args); - CreatureDisplayInfoEntry const* displayEntry = sDBCCreatureDisplayInfo.LookupEntry(display_id); + CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(display_id); if (!displayEntry) { SendSysMessage(LANG_BAD_VALUE); @@ -3432,7 +3432,7 @@ bool ChatHandler::HandleModifyStandStateCommand(char* args) if (!ExtractUInt32(&args, anim_id)) return false; - if (!sDBCEmotes.LookupEntry(anim_id)) + if (!sEmotesStore.LookupEntry(anim_id)) return false; m_session->GetPlayer()->HandleEmoteState(anim_id); @@ -3740,7 +3740,7 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id) { uint32 classmask = player->getClassMask(); - for (auto skillLine : sDBCSkillLineAbility) + for (auto skillLine : sSkillLineAbilityStore) { // wrong skill if (skillLine->skillId != skill_id) @@ -3768,7 +3768,7 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id) bool ChatHandler::HandleLearnAllCraftsCommand(char* /*args*/) { - for (auto skillInfo : sDBCSkillLine) + for (auto skillInfo : sSkillLineStore) { if (skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY) { @@ -3806,7 +3806,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(char* args) std::string name; SkillLineEntry const* targetSkillInfo = nullptr; - for (auto skillInfo : sDBCSkillLine) + for (auto skillInfo : sSkillLineStore) { if (skillInfo->categoryId != SKILL_CATEGORY_PROFESSION && skillInfo->categoryId != SKILL_CATEGORY_SECONDARY) @@ -4441,7 +4441,7 @@ bool ChatHandler::HandleLookupTitleCommand(char* args) uint32 counter = 0; // Counter for figure out that we found smth. // Search in CharTitles.dbc - for (auto titleInfo : sDBCCharTitles) + for (auto titleInfo : sCharTitlesStore) { int loc = GetSessionDbcLocale(); std::string name = titleInfo->name[loc]; @@ -4516,7 +4516,7 @@ bool ChatHandler::HandleTitlesAddCommand(char* args) if (HasLowerSecurity(target)) return false; - CharTitlesEntry const* titleInfo = sDBCCharTitles.LookupEntry(id); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); if (!titleInfo) { PSendSysMessage(LANG_INVALID_TITLE_ID, id); @@ -4562,7 +4562,7 @@ bool ChatHandler::HandleTitlesRemoveCommand(char* args) if (HasLowerSecurity(target)) return false; - CharTitlesEntry const* titleInfo = sDBCCharTitles.LookupEntry(id); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); if (!titleInfo) { PSendSysMessage(LANG_INVALID_TITLE_ID, id); @@ -4613,7 +4613,7 @@ bool ChatHandler::HandleTitlesSetMaskCommand(char* args) uint64 titles2 = titles; - for (auto tEntry : sDBCCharTitles) + for (auto tEntry : sCharTitlesStore) titles2 &= ~(uint64(1) << tEntry->bit_index); titles &= ~titles2; // remove nonexistent titles @@ -4649,13 +4649,13 @@ bool ChatHandler::HandleTitlesSwapCommand(char* /*args*/) if (!foundTitle) return false; - if (CharTitlesEntry const* tEntry = sDBCCharTitles.LookupEntry(foundTitle)) + if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(foundTitle)) target->SetTitle(tEntry, true); if (foundTitle > 14) foundTitle -= 14; else foundTitle += 14; - if (CharTitlesEntry const* tEntry = sDBCCharTitles.LookupEntry(foundTitle)) + if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(foundTitle)) target->SetTitle(tEntry, false); return true; @@ -4672,7 +4672,7 @@ bool ChatHandler::HandleCharacterTitlesCommand(char* args) char const* knownStr = GetMangosString(LANG_KNOWN); // Search in CharTitles.dbc - for (auto titleInfo : sDBCCharTitles) + for (auto titleInfo : sCharTitlesStore) { if (target->HasTitle(titleInfo)) { @@ -4723,7 +4723,7 @@ bool ChatHandler::HandleTitlesCurrentCommand(char* args) if (HasLowerSecurity(target)) return false; - CharTitlesEntry const* titleInfo = sDBCCharTitles.LookupEntry(id); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); if (!titleInfo) { PSendSysMessage(LANG_INVALID_TITLE_ID, id); diff --git a/src/game/Chat/Level3.cpp b/src/game/Chat/Level3.cpp index eaa9509b911..3b9504305a4 100644 --- a/src/game/Chat/Level3.cpp +++ b/src/game/Chat/Level3.cpp @@ -1250,7 +1250,7 @@ bool ChatHandler::HandleSetSkillCommand(char* args) return false; } - SkillLineEntry const* sl = sDBCSkillLine.LookupEntry(skill); + SkillLineEntry const* sl = sSkillLineStore.LookupEntry(skill); if (!sl) { PSendSysMessage(LANG_INVALID_SKILL_ID, skill); @@ -1519,12 +1519,12 @@ bool ChatHandler::HandleLearnAllMyClassCommand(char* /*args*/) bool ChatHandler::HandleLearnAllMySpellsCommand(char* /*args*/) { Player* player = m_session->GetPlayer(); - ChrClassesEntry const* clsEntry = sDBCChrClasses.LookupEntry(player->getClass()); + ChrClassesEntry const* clsEntry = sChrClassesStore.LookupEntry(player->getClass()); if (!clsEntry) return true; uint32 family = clsEntry->spellfamily; - for (auto entry : sDBCSkillLineAbility) + for (auto entry : sSkillLineAbilityStore) { SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(entry->spellId); if (!spellInfo) @@ -1563,9 +1563,9 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(char* /*args*/) Player* player = m_session->GetPlayer(); uint32 classMask = player->getClassMask(); - for (auto talentInfo : sDBCTalent) + for (auto talentInfo : sTalentStore) { - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -2255,7 +2255,7 @@ bool ChatHandler::HandleLookupItemSetCommand(char* args) uint32 counter = 0; // Counter for figure out that we found smth. // Search in ItemSet.dbc - for (auto set : sDBCItemSet) + for (auto set : sItemSetStore) { int loc = GetSessionDbcLocale(); std::string name = set->name[loc]; @@ -2314,7 +2314,7 @@ bool ChatHandler::HandleLookupSkillCommand(char* args) uint32 counter = 0; // Counter for figure out that we found smth. // Search in SkillLine.dbc - for (auto skillInfo : sDBCSkillLine) + for (auto skillInfo : sSkillLineStore) { int loc = GetSessionDbcLocale(); std::string name = skillInfo->name[loc]; @@ -2666,7 +2666,7 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(char* args) uint32 counter = 0; // Counter for figure out that we found smth. // Search in TaxiNodes.dbc - for (auto nodeEntry : sDBCTaxiNodes) + for (auto nodeEntry : sTaxiNodesStore) { int loc = GetSessionDbcLocale(); std::string name = nodeEntry->name[loc]; @@ -3838,7 +3838,7 @@ bool ChatHandler::HandleAuctionItemCommand(char* args) return false; } - AuctionHouseEntry const* auctionHouseEntry = sDBCAuctionHouse.LookupEntry(houseid); + AuctionHouseEntry const* auctionHouseEntry = sAuctionHouseStore.LookupEntry(houseid); AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry); if (!item_id) @@ -4137,7 +4137,7 @@ bool ChatHandler::HandleResetHonorCommand(char* args) static bool HandleResetStatsOrLevelHelper(Player* player) { - ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(player->getClass()); + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(player->getClass()); if (!cEntry) { sLog.outError("Class %u not found in DBC (Wrong DBC files?)", player->getClass()); @@ -5717,7 +5717,7 @@ bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/) { DungeonPersistentState* state = itr->second.state; std::string timeleft = secsToTimeString(state->GetResetTime() - time(nullptr), true); - if (const MapEntry* entry = sDBCMap.LookupEntry(itr->first)) + if (const MapEntry* entry = sMapStore.LookupEntry(itr->first)) { PSendSysMessage("map: %d (%s) inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, entry->name[GetSessionDbcLocale()], state->GetInstanceId(), itr->second.perm ? "yes" : "no", @@ -5740,7 +5740,7 @@ bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/) { DungeonPersistentState* state = itr->second.state; std::string timeleft = secsToTimeString(state->GetResetTime() - time(nullptr), true); - if (const MapEntry* entry = sDBCMap.LookupEntry(itr->first)) + if (const MapEntry* entry = sMapStore.LookupEntry(itr->first)) { PSendSysMessage("map: %d (%s) inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, entry->name[GetSessionDbcLocale()], state->GetInstanceId(), itr->second.perm ? "yes" : "no", @@ -5793,7 +5793,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(char* args) DungeonPersistentState* save = itr->second.state; std::string timeleft = secsToTimeString(save->GetResetTime() - time(nullptr), true); - if (const MapEntry* entry = sDBCMap.LookupEntry(itr->first)) + if (const MapEntry* entry = sMapStore.LookupEntry(itr->first)) { PSendSysMessage("unbinding map: %d (%s) inst: %d perm: %s diff: %s canReset: %s TTR: %s", itr->first, entry->name[GetSessionDbcLocale()], save->GetInstanceId(), itr->second.perm ? "yes" : "no", @@ -5919,8 +5919,8 @@ bool ChatHandler::ShowPlayerListHelper(QueryResult* result, uint32* limit, bool uint8 class_ = fields[3].GetUInt8(); uint32 level = fields[4].GetUInt32(); - ChrRacesEntry const* raceEntry = sDBCChrRaces.LookupEntry(race); - ChrClassesEntry const* classEntry = sDBCChrClasses.LookupEntry(class_); + ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race); + ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_); char const* race_name = raceEntry ? raceEntry->name[GetSessionDbcLocale()] : ""; char const* class_name = classEntry ? classEntry->name[GetSessionDbcLocale()] : ""; diff --git a/src/game/Chat/TicketCommands.cpp b/src/game/Chat/TicketCommands.cpp index fe7446acd15..19641068c63 100644 --- a/src/game/Chat/TicketCommands.cpp +++ b/src/game/Chat/TicketCommands.cpp @@ -199,7 +199,7 @@ bool ChatHandler::HandleTicketSortCommand(char* args) if (!ExtractUInt32(&args, categoryId)) return false; - if (GMTicketCategoryEntry const* category = sDBCGMTicketCategory.LookupEntry(categoryId)) + if (GMTicketCategoryEntry const* category = sGMTicketCategoryStore.LookupEntry(categoryId)) { if (!HandleTicketMgrCommandResult(*this, ticketId, sTicketMgr.Sort(sTicketMgr.GetTicketById(ticketId), *category, m_session))) { @@ -265,7 +265,7 @@ bool ChatHandler::HandleTicketsListCommand(char* args) max = arg1; else { - category = sDBCGMTicketCategory.LookupEntry(arg1); + category = sGMTicketCategoryStore.LookupEntry(arg1); if (!category) { diff --git a/src/game/Chat/debugcmds.cpp b/src/game/Chat/debugcmds.cpp index e57e1e4fd26..a5110a2afac 100644 --- a/src/game/Chat/debugcmds.cpp +++ b/src/game/Chat/debugcmds.cpp @@ -223,7 +223,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(char* args) if (!ExtractUInt32(&args, dwId)) return false; - if (!sDBCCinematicSequences.LookupEntry(dwId)) + if (!sCinematicSequencesStore.LookupEntry(dwId)) { PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, dwId); SetSentErrorMessage(true); @@ -231,7 +231,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(char* args) } // Dump camera locations - if (CinematicSequencesEntry const* cineSeq = sDBCCinematicSequences.LookupEntry(dwId)) + if (CinematicSequencesEntry const* cineSeq = sCinematicSequencesStore.LookupEntry(dwId)) { std::unordered_map::const_iterator itr = sFlyByCameraStore.find(cineSeq->cinematicCamera); if (itr != sFlyByCameraStore.end()) @@ -260,7 +260,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args) if (!ExtractUInt32(&args, dwSoundId)) return false; - if (!sDBCSoundEntries.LookupEntry(dwSoundId)) + if (!sSoundEntriesStore.LookupEntry(dwSoundId)) { PSendSysMessage(LANG_SOUND_NOT_EXIST, dwSoundId); SetSentErrorMessage(true); @@ -293,7 +293,7 @@ bool ChatHandler::HandleDebugPlayMusicCommand(char* args) if (!ExtractUInt32(&args, dwMusicId)) return false; - if (!sDBCSoundEntries.LookupEntry(dwMusicId)) + if (!sSoundEntriesStore.LookupEntry(dwMusicId)) { PSendSysMessage(LANG_SOUND_NOT_EXIST, dwMusicId); SetSentErrorMessage(true); diff --git a/src/game/Cinematics/M2Stores.cpp b/src/game/Cinematics/M2Stores.cpp index df394f9f87c..9ea63f94da3 100644 --- a/src/game/Cinematics/M2Stores.cpp +++ b/src/game/Cinematics/M2Stores.cpp @@ -165,7 +165,7 @@ void LoadM2Cameras(std::string const& dataPath) sFlyByCameraStore.clear(); uint32 oldMSTime = WorldTimer::getMSTime(); - for (auto dbcentry : sDBCCinematicCamera) + for (auto dbcentry : sCinematicCameraStore) { std::string filename = dataPath; filename.append(dbcentry->Model); diff --git a/src/game/DBScripts/ScriptMgr.cpp b/src/game/DBScripts/ScriptMgr.cpp index 2133d1dbf4e..c5610b16f94 100644 --- a/src/game/DBScripts/ScriptMgr.cpp +++ b/src/game/DBScripts/ScriptMgr.cpp @@ -269,14 +269,14 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_EMOTE: // 1 { - if (!sDBCEmotes.LookupEntry(tmp.emote.emoteId)) + if (!sEmotesStore.LookupEntry(tmp.emote.emoteId)) { sLog.outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", tablename, tmp.emote.emoteId, tmp.id); continue; } for (int i = 0; i < MAX_TEXT_ID; ++i) { - if (tmp.textId[i] && !sDBCEmotes.LookupEntry(tmp.textId[i])) + if (tmp.textId[i] && !sEmotesStore.LookupEntry(tmp.textId[i])) { sLog.outErrorDb("Table `%s` has invalid emote id (text_id%u = %u) in SCRIPT_COMMAND_EMOTE for script id %u", tablename, i + 1, tmp.textId[i], tmp.id); } @@ -290,7 +290,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) break; case SCRIPT_COMMAND_TELEPORT_TO: // 6 { - if (!sDBCMap.LookupEntry(tmp.teleportTo.mapId)) + if (!sMapStore.LookupEntry(tmp.teleportTo.mapId)) { sLog.outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", tablename, tmp.teleportTo.mapId, tmp.id); continue; @@ -483,7 +483,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_PLAY_SOUND: // 16 { - if (!sDBCSoundEntries.LookupEntry(tmp.playSound.soundId)) + if (!sSoundEntriesStore.LookupEntry(tmp.playSound.soundId)) { sLog.outErrorDb("Table `%s` using nonexistent sound (id: %u) in SCRIPT_COMMAND_PLAY_SOUND for script id %u", tablename, tmp.playSound.soundId, tmp.id); @@ -538,7 +538,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) break; case SCRIPT_COMMAND_SET_FACTION: // 22 { - if (tmp.faction.factionId && !sDBCFactionTemplate.LookupEntry(tmp.faction.factionId)) + if (tmp.faction.factionId && !sFactionTemplateStore.LookupEntry(tmp.faction.factionId)) { sLog.outErrorDb("Table `%s` has datalong = %u in SCRIPT_COMMAND_SET_FACTION for script id %u, but this faction-template does not exist.", tablename, tmp.faction.factionId, tmp.id); continue; @@ -550,7 +550,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) { if (tmp.data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) { - if (tmp.morph.creatureOrModelEntry && !sDBCCreatureDisplayInfo.LookupEntry(tmp.morph.creatureOrModelEntry)) + if (tmp.morph.creatureOrModelEntry && !sCreatureDisplayInfoStore.LookupEntry(tmp.morph.creatureOrModelEntry)) { sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL for script id %u, but this model does not exist.", tablename, tmp.morph.creatureOrModelEntry, tmp.id); continue; @@ -571,7 +571,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) { if (tmp.data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) { - if (tmp.mount.creatureOrModelEntry && !sDBCCreatureDisplayInfo.LookupEntry(tmp.mount.creatureOrModelEntry)) + if (tmp.mount.creatureOrModelEntry && !sCreatureDisplayInfoStore.LookupEntry(tmp.mount.creatureOrModelEntry)) { sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL for script id %u, but this model does not exist.", tablename, tmp.mount.creatureOrModelEntry, tmp.id); continue; @@ -624,7 +624,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_SEND_TAXI_PATH: // 30 { - if (!sDBCTaxiPath.LookupEntry(tmp.sendTaxiPath.taxiPathId)) + if (!sTaxiPathStore.LookupEntry(tmp.sendTaxiPath.taxiPathId)) { sLog.outErrorDb("Table `%s` has datalong = %u in SCRIPT_COMMAND_SEND_TAXI_PATH for script id %u, but this taxi path does not exist.", tablename, tmp.sendTaxiPath.taxiPathId, tmp.id); continue; @@ -702,7 +702,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_SEND_MAIL: // 38 { - if (!sDBCMailTemplate.LookupEntry(tmp.sendMail.mailTemplateId)) + if (!sMailTemplateStore.LookupEntry(tmp.sendMail.mailTemplateId)) { sLog.outErrorDb("Table `%s` has invalid mailTemplateId (datalong = %u) in SCRIPT_COMMAND_SEND_MAIL for script id %u", tablename, tmp.sendMail.mailTemplateId, tmp.id); continue; diff --git a/src/game/Entities/CharacterHandler.cpp b/src/game/Entities/CharacterHandler.cpp index 67523f0bcb1..8a3abf6c60c 100644 --- a/src/game/Entities/CharacterHandler.cpp +++ b/src/game/Entities/CharacterHandler.cpp @@ -251,8 +251,8 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recv_data) } } - ChrClassesEntry const* classEntry = sDBCChrClasses.LookupEntry(class_); - ChrRacesEntry const* raceEntry = sDBCChrRaces.LookupEntry(race_); + ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_); + ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_); if (!classEntry || !raceEntry) { @@ -681,7 +681,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) { pCurrChar->setCinematic(1); - if (ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(pCurrChar->getRace())) + if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace())) pCurrChar->SendCinematicStart(rEntry->CinematicSequence); } @@ -692,7 +692,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) else { // Some basic checks in case of a map without areatrigger - MapEntry const* mapEntry = sDBCMap.LookupEntry(pCurrChar->GetMapId()); + MapEntry const* mapEntry = sMapStore.LookupEntry(pCurrChar->GetMapId()); if (!mapEntry) lockStatus = AREA_LOCKSTATUS_UNKNOWN_ERROR; else if (pCurrChar->GetSession()->GetExpansion() < mapEntry->Expansion()) diff --git a/src/game/Entities/Corpse.cpp b/src/game/Entities/Corpse.cpp index b3ea9bd0807..86bdd5484c0 100644 --- a/src/game/Entities/Corpse.cpp +++ b/src/game/Entities/Corpse.cpp @@ -255,7 +255,7 @@ uint32 Corpse::getFaction() const { if (const uint8 race = getRace()) { - if (const ChrRacesEntry* raceEntry = sDBCChrRaces.LookupEntry(race)) + if (const ChrRacesEntry* raceEntry = sChrRacesStore.LookupEntry(race)) return raceEntry->FactionID; } return 0; diff --git a/src/game/Entities/Creature.cpp b/src/game/Entities/Creature.cpp index f886c292eb6..c1e40a1dd49 100644 --- a/src/game/Entities/Creature.cpp +++ b/src/game/Entities/Creature.cpp @@ -542,7 +542,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data /*=nullptr*/, faction = data->spawnTemplate->faction; // checked and error show at loading templates - if (FactionTemplateEntry const* factionTemplate = sDBCFactionTemplate.LookupEntry(faction)) + if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(faction)) { if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP) { @@ -646,10 +646,10 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData* uint32 Creature::GetCreatureModelRace(uint32 model_id) { - CreatureDisplayInfoEntry const* displayEntry = sDBCCreatureDisplayInfo.LookupEntry(model_id); + CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(model_id); if (!displayEntry) return 0; - CreatureDisplayInfoExtraEntry const* extraEntry = sDBCCreatureDisplayInfoExtra.LookupEntry(displayEntry->ExtendedDisplayInfoID); + CreatureDisplayInfoExtraEntry const* extraEntry = sCreatureDisplayInfoExtraStore.LookupEntry(displayEntry->ExtendedDisplayInfoID); return extraEntry ? extraEntry->Race : 0; } @@ -1891,7 +1891,7 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim) if (spellInfo->manaCost > GetPower(POWER_MANA)) continue; - SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); + SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRange(srange); float minrange = GetSpellMinRange(srange); @@ -1940,7 +1940,7 @@ SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim) if (spellInfo->manaCost > GetPower(POWER_MANA)) continue; - SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); + SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRange(srange); float minrange = GetSpellMinRange(srange); @@ -2290,14 +2290,14 @@ bool Creature::MeetsSelectAttackingRequirement(Unit* pTarget, SpellEntry const* if (selectFlags & SELECT_FLAG_USE_EFFECT_RADIUS) { - SpellRadiusEntry const* srange = sDBCSpellRadius.LookupEntry(pSpellInfo->EffectRadiusIndex[0]); + SpellRadiusEntry const* srange = sSpellRadiusStore.LookupEntry(pSpellInfo->EffectRadiusIndex[0]); float max_range = GetSpellRadius(srange); float dist = pTarget->GetDistance(GetPositionX(), GetPositionY(), GetPositionZ(), DIST_CALC_COMBAT_REACH); return dist < max_range; } else { - SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(pSpellInfo->rangeIndex); + SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(pSpellInfo->rangeIndex); float max_range = GetSpellMaxRange(srange); float min_range = GetSpellMinRange(srange); float dist = GetDistance(pTarget, true, DIST_CALC_COMBAT_REACH); diff --git a/src/game/Entities/CreatureLinkingMgr.cpp b/src/game/Entities/CreatureLinkingMgr.cpp index df50ca149b3..680afd43937 100644 --- a/src/game/Entities/CreatureLinkingMgr.cpp +++ b/src/game/Entities/CreatureLinkingMgr.cpp @@ -191,7 +191,7 @@ bool CreatureLinkingMgr::IsLinkingEntryValid(uint32 slaveEntry, CreatureLinkingI sLog.outErrorDb("`creature_linking_template` has a non existing master_entry (slave: %u, master %u), skipped", slaveEntry, pTmp->masterId); return false; } - if (pTmp->mapId && !sDBCMap.LookupEntry(pTmp->mapId)) + if (pTmp->mapId && !sMapStore.LookupEntry(pTmp->mapId)) { sLog.outErrorDb("`creature_linking_template` has a non existing map %u (slave %u, master %u), skipped", pTmp->mapId, slaveEntry, pTmp->masterId); return false; diff --git a/src/game/Entities/GameObject.cpp b/src/game/Entities/GameObject.cpp index d8f18ea09cc..b2d6a305704 100644 --- a/src/game/Entities/GameObject.cpp +++ b/src/game/Entities/GameObject.cpp @@ -1922,7 +1922,7 @@ void GameObject::SetGoState(GOState state) void GameObject::SetDisplayId(uint32 modelId) { SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId); - m_displayInfo = sDBCGameObjectDisplayInfo.LookupEntry(modelId); + m_displayInfo = sGameObjectDisplayInfoStore.LookupEntry(modelId); UpdateModel(); } @@ -2439,14 +2439,14 @@ bool GameObject::IsAtInteractDistance(Player const* player, uint32 maxRange) con { if (maxRange == 0.f) { - SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); + SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); maxRange = GetSpellMaxRange(srange); } if (GetGoType() == GAMEOBJECT_TYPE_SPELL_FOCUS) return maxRange * maxRange >= GetDistance(player, true, DIST_CALC_NONE); - if (sDBCGameObjectDisplayInfo.LookupEntry(GetGOInfo()->displayId)) + if (sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId)) return IsAtInteractDistance(player->GetPosition(), maxRange); } @@ -2499,7 +2499,7 @@ SpellEntry const* GameObject::GetSpellForLock(Player const* player) const if (!lockId) return nullptr; - LockEntry const* lock = sDBCLock.LookupEntry(lockId); + LockEntry const* lock = sLockStore.LookupEntry(lockId); if (!lock) return nullptr; diff --git a/src/game/Entities/Item.cpp b/src/game/Entities/Item.cpp index d06f47dc8ed..3d07bbeff8d 100644 --- a/src/game/Entities/Item.cpp +++ b/src/game/Entities/Item.cpp @@ -31,7 +31,7 @@ void AddItemsSetItem(Player* player, Item* item) ItemPrototype const* proto = item->GetProto(); uint32 setid = proto->ItemSet; - ItemSetEntry const* set = sDBCItemSet.LookupEntry(setid); + ItemSetEntry const* set = sItemSetStore.LookupEntry(setid); if (!set) { @@ -113,7 +113,7 @@ void RemoveItemsSetItem(Player* player, ItemPrototype const* proto) { uint32 setid = proto->ItemSet; - ItemSetEntry const* set = sDBCItemSet.LookupEntry(setid); + ItemSetEntry const* set = sItemSetStore.LookupEntry(setid); if (!set) { @@ -693,7 +693,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) if (itemProto->RandomProperty) { uint32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty); - ItemRandomPropertiesEntry const* random_id = sDBCItemRandomProperties.LookupEntry(randomPropId); + ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId); if (!random_id) { sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId); @@ -704,7 +704,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) } // Random Suffix case uint32 randomPropId = GetItemEnchantMod(itemProto->RandomSuffix); - ItemRandomSuffixEntry const* random_id = sDBCItemRandomSuffix.LookupEntry(randomPropId); + ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId); if (!random_id) { sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId); @@ -721,7 +721,7 @@ void Item::SetItemRandomProperties(int32 randomPropId) if (randomPropId > 0) { - ItemRandomPropertiesEntry const* item_rand = sDBCItemRandomProperties.LookupEntry(randomPropId); + ItemRandomPropertiesEntry const* item_rand = sItemRandomPropertiesStore.LookupEntry(randomPropId); if (item_rand) { if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != int32(item_rand->ID)) @@ -735,7 +735,7 @@ void Item::SetItemRandomProperties(int32 randomPropId) } else { - ItemRandomSuffixEntry const* item_rand = sDBCItemRandomSuffix.LookupEntry(-randomPropId); + ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId); if (item_rand) { if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != -int32(item_rand->ID) || @@ -893,7 +893,7 @@ bool Item::IsBoundByEnchant() const if (!enchant_id) continue; - SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!enchantEntry) continue; @@ -1012,7 +1012,7 @@ bool Item::GemsFitSockets() const continue; } - SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!enchantEntry) { if (SocketColor) fits &= false; @@ -1027,7 +1027,7 @@ bool Item::GemsFitSockets() const ItemPrototype const* gemProto = sItemStorage.LookupEntry(gemid); if (gemProto) { - GemPropertiesEntry const* gemProperty = sDBCGemProperties.LookupEntry(gemProto->GemProperties); + GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties); if (gemProperty) GemColor = gemProperty->color; } @@ -1047,7 +1047,7 @@ uint8 Item::GetGemCountWithID(uint32 GemID) const if (!enchant_id) continue; - SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!enchantEntry) continue; diff --git a/src/game/Entities/ItemEnchantmentMgr.cpp b/src/game/Entities/ItemEnchantmentMgr.cpp index d558e153aaf..d70e7629dac 100644 --- a/src/game/Entities/ItemEnchantmentMgr.cpp +++ b/src/game/Entities/ItemEnchantmentMgr.cpp @@ -126,7 +126,7 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id) if (!itemProto->RandomSuffix) return 0; - RandomPropertiesPointsEntry const* randomProperty = sDBCRandPropPoints.LookupEntry(itemProto->ItemLevel); + RandomPropertiesPointsEntry const* randomProperty = sRandPropPointsStore.LookupEntry(itemProto->ItemLevel); if (!randomProperty) return 0; diff --git a/src/game/Entities/ItemHandler.cpp b/src/game/Entities/ItemHandler.cpp index c013bcb5ff2..b7ab4c242c1 100644 --- a/src/game/Entities/ItemHandler.cpp +++ b/src/game/Entities/ItemHandler.cpp @@ -893,7 +893,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) DETAIL_LOG("PLAYER: Buy bank bag slot, slot number = %u", slot); - BankBagSlotPricesEntry const* slotEntry = sDBCBankBagSlotPrices.LookupEntry(slot); + BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot); WorldPacket data(SMSG_BUY_BANK_SLOT_RESULT, 4); @@ -1045,7 +1045,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recv_data) else { // listed in dbc or not expected to exist unknown item - if (sDBCItem.LookupEntry(itemid)) + if (sItemStore.LookupEntry(itemid)) sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (item listed in Item.dbc but not exist in DB)", itemid); else sLog.outError("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item, not listed in Item.dbc)", itemid); @@ -1212,7 +1212,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS]; for (int i = 0; i < MAX_GEM_SOCKETS; ++i) // get geminfo from dbc storage - GemProps[i] = (Gems[i]) ? sDBCGemProperties.LookupEntry(Gems[i]->GetProto()->GemProperties) : nullptr; + GemProps[i] = (Gems[i]) ? sGemPropertiesStore.LookupEntry(Gems[i]->GetProto()->GemProperties) : nullptr; for (int i = 0; i < MAX_GEM_SOCKETS; ++i) // check for hack maybe { @@ -1267,7 +1267,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) } else if (OldEnchants[j]) { - if (SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(OldEnchants[j])) + if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j])) { if (iGemProto->ItemId == enchantEntry->GemID) { diff --git a/src/game/Entities/MiscHandler.cpp b/src/game/Entities/MiscHandler.cpp index 8b5e9c8e396..d649c93afe9 100644 --- a/src/game/Entities/MiscHandler.cpp +++ b/src/game/Entities/MiscHandler.cpp @@ -381,7 +381,7 @@ void WorldSession::HandleSetTargetOpcode(WorldPacket& recv_data) if (!unit) return; - if (FactionTemplateEntry const* factionTemplateEntry = sDBCFactionTemplate.LookupEntry(unit->getFaction())) + if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction())) _player->GetReputationMgr().SetVisible(factionTemplateEntry); } @@ -401,7 +401,7 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket& recv_data) if (!unit) return; - if (FactionTemplateEntry const* factionTemplateEntry = sDBCFactionTemplate.LookupEntry(unit->getFaction())) + if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction())) _player->GetReputationMgr().SetVisible(factionTemplateEntry); } @@ -703,7 +703,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) return; } - AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(Trigger_ID); + AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); if (!atEntry) { DEBUG_LOG("Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID: %u", player->GetName(), player->GetGUIDLow(), Trigger_ID); @@ -759,7 +759,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) if (!at) return; - MapEntry const* targetMapEntry = sDBCMap.LookupEntry(at->target_mapId); + MapEntry const* targetMapEntry = sMapStore.LookupEntry(at->target_mapId); if (!targetMapEntry) return; @@ -1065,7 +1065,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) uint32 talentTabId = talentTabIds[i]; // fill by real data - for (auto talentInfo : sDBCTalent) + for (auto talentInfo : sTalentStore) { // skip another tab talents if (talentInfo->TalentTab != talentTabId) diff --git a/src/game/Entities/NPCHandler.cpp b/src/game/Entities/NPCHandler.cpp index fb4fa0daad0..3868b1e5389 100644 --- a/src/game/Entities/NPCHandler.cpp +++ b/src/game/Entities/NPCHandler.cpp @@ -839,7 +839,7 @@ void WorldSession::HandleBuyStableSlot(WorldPacket& recv_data) if (GetPlayer()->m_stableSlots < MAX_PET_STABLES) { - StableSlotPricesEntry const* SlotPrice = sDBCStableSlotPrices.LookupEntry(GetPlayer()->m_stableSlots + 1); + StableSlotPricesEntry const* SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots + 1); if (_player->GetMoney() >= SlotPrice->Price) { ++GetPlayer()->m_stableSlots; diff --git a/src/game/Entities/Object.cpp b/src/game/Entities/Object.cpp index a99292bd759..3a9ed4ab32b 100644 --- a/src/game/Entities/Object.cpp +++ b/src/game/Entities/Object.cpp @@ -2916,8 +2916,8 @@ int32 WorldObject::CalculateSpellEffectValue(Unit const* target, SpellEntry cons if (damage) { - GtNPCManaCostScalerEntry const* spellScaler = sDBCgtNPCManaCostScaler.LookupEntry(spellProto->spellLevel - 1); - GtNPCManaCostScalerEntry const* casterScaler = sDBCgtNPCManaCostScaler.LookupEntry(unitCaster->getLevel() - 1); + GtNPCManaCostScalerEntry const* spellScaler = sgtNPCManaCostScalerStore.LookupEntry(spellProto->spellLevel - 1); + GtNPCManaCostScalerEntry const* casterScaler = sgtNPCManaCostScalerStore.LookupEntry(unitCaster->getLevel() - 1); if (spellScaler && casterScaler) value *= casterScaler->ratio / spellScaler->ratio; } diff --git a/src/game/Entities/Pet.cpp b/src/game/Entities/Pet.cpp index c017ff886ab..b938695726c 100644 --- a/src/game/Entities/Pet.cpp +++ b/src/game/Entities/Pet.cpp @@ -650,7 +650,7 @@ void Pet::SetDeathState(DeathState s) // overwrite virtual if (getPetType() != SUMMON_PET) { // lose happiness when died and not in BG/Arena - MapEntry const* mapEntry = sDBCMap.LookupEntry(GetMapId()); + MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId()); if (!mapEntry || (mapEntry->map_type != MAP_ARENA && mapEntry->map_type != MAP_BATTLEGROUND)) ModifyPower(POWER_HAPPINESS, -HAPPINESS_LEVEL_SIZE); } @@ -1195,7 +1195,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForPetLevel(creature->getLevel())); SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - if (CreatureFamilyEntry const* cFamily = sDBCCreatureFamily.LookupEntry(cInfo->Family)) + if (CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family)) SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]); else SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDbc2StorageLocaleIndex())); @@ -1258,7 +1258,7 @@ void Pet::InitStatsForLevel(uint32 petlevel) { case HUNTER_PET: { - CreatureFamilyEntry const* cFamily = sDBCCreatureFamily.LookupEntry(cInfo->Family); + CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family); if (cFamily && cFamily->minScale > 0.0f) { @@ -1527,7 +1527,7 @@ bool Pet::HaveInDiet(ItemPrototype const* item) const if (!cInfo) return false; - CreatureFamilyEntry const* cFamily = sDBCCreatureFamily.LookupEntry(cInfo->Family); + CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family); if (!cFamily) return false; @@ -2089,7 +2089,7 @@ void Pet::InitPetCreateSpells() addSpell(petspellid); - SkillLineAbilityEntry const* skla = sDBCSkillLineAbility.LookupEntry(learn_spellproto->EffectTriggerSpell[0]); + SkillLineAbilityEntry const* skla = sSkillLineAbilityStore.LookupEntry(learn_spellproto->EffectTriggerSpell[0]); if (skla) usedtrainpoints += skla->reqtrainpoints; } @@ -2248,7 +2248,7 @@ void Pet::LearnPetPassives() if (!cInfo) return; - CreatureFamilyEntry const* cFamily = sDBCCreatureFamily.LookupEntry(cInfo->Family); + CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family); if (!cFamily) return; diff --git a/src/game/Entities/PetHandler.cpp b/src/game/Entities/PetHandler.cpp index 4a3092e686f..25bbe478183 100644 --- a/src/game/Entities/PetHandler.cpp +++ b/src/game/Entities/PetHandler.cpp @@ -323,7 +323,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) if (!petUnit->hasUnitState(UNIT_STAT_POSSESSED)) flags |= TRIGGERED_PET_CAST; - const SpellRangeEntry* sRange = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); + const SpellRangeEntry* sRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); if (!IsSpellRequireTarget(spellInfo)) unit_target = nullptr; diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index 669052504b4..b99e814e152 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -725,7 +725,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c return false; } - ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(class_); + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(class_); if (!cEntry) { sLog.outError("Class %u not found in DBC (Wrong DBC files?)", class_); @@ -831,7 +831,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c uint32 raceClassGender = GetUInt32Value(UNIT_FIELD_BYTES_0) & 0x00FFFFFF; CharStartOutfitEntry const* oEntry = nullptr; - for (auto entry : sDBCCharStartOutfit) + for (auto entry : sCharStartOutfitStore) { if (entry->RaceClassGender == raceClassGender) { @@ -1750,7 +1750,7 @@ bool Player::BuildEnumData(QueryResult* result, WorldPacket& p_data) if (!enchantId) continue; - enchant = sDBCSpellItemEnchantment.LookupEntry(enchantId); + enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId); if (enchant) break; } @@ -1872,7 +1872,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return false; } - MapEntry const* mEntry = sDBCMap.LookupEntry(mapid); // Validity checked in IsValidMapCoord + MapEntry const* mEntry = sMapStore.LookupEntry(mapid); // Validity checked in IsValidMapCoord #ifdef BUILD_PLAYERBOT // If this user has bots, tell them to stop following master @@ -3253,7 +3253,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen // talent: unlearn all lower talent ranks if (talentPos) { - if (TalentEntry const* talentInfo = sDBCTalent.LookupEntry(talentPos->talent_id)) + if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) { for (unsigned int rankSpellId : talentInfo->RankID) { @@ -3273,9 +3273,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen { // Check if a spell is learned by a talent first bool talent = false; - for (auto talentInfo : sDBCTalent) + for (auto talentInfo : sTalentStore) { - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo || !(getClassMask() & talentTabInfo->ClassMask)) continue; uint32 parent = 0; @@ -3780,9 +3780,9 @@ bool Player::resetTalents(bool no_cost) } } - for (auto talentInfo : sDBCTalent) + for (auto talentInfo : sTalentStore) { - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -4623,7 +4623,7 @@ std::pair Player::CheckAndRevivePlayerOnDungeonEnter(M if (AreaTrigger const* corpseAt = sObjectMgr.GetMapEntranceTrigger(corpseMapId)) { resultingAt = corpseAt; - targetMapEntry = sDBCMap.LookupEntry(targetMapId); + targetMapEntry = sMapStore.LookupEntry(targetMapId); if (!targetMapEntry) return { false, nullptr }; } @@ -4643,7 +4643,7 @@ void Player::KillPlayer() // SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP ); SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); - ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sDBCMap.LookupEntry(GetMapId())->Instanceable()); + ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable()); // 6 minutes until repop at graveyard m_deathTimer = 6 * MINUTE * IN_MILLISECONDS; @@ -4871,7 +4871,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g { ItemPrototype const* ditemProto = item->GetProto(); - DurabilityCostsEntry const* dcost = sDBCDurabilityCosts.LookupEntry(ditemProto->ItemLevel); + DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); if (!dcost) { sLog.outError("RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); @@ -4879,7 +4879,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g } uint32 dQualitymodEntryId = (ditemProto->Quality + 1) * 2; - DurabilityQualityEntry const* dQualitymodEntry = sDBCDurabilityQuality.LookupEntry(dQualitymodEntryId); + DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { sLog.outError("RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); @@ -5159,8 +5159,8 @@ float Player::GetMeleeCritFromAgility() const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtChanceToMeleeCritBaseEntry const* critBase = sDBCgtChanceToMeleeCritBase.LookupEntry(pclass - 1); - GtChanceToMeleeCritEntry const* critRatio = sDBCgtChanceToMeleeCrit.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); + GtChanceToMeleeCritBaseEntry const* critBase = sgtChanceToMeleeCritBaseStore.LookupEntry(pclass - 1); + GtChanceToMeleeCritEntry const* critRatio = sgtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); if (critBase == nullptr || critRatio == nullptr) return 0.0f; @@ -5194,7 +5194,7 @@ float Player::GetDodgeFromAgility(float amount) const const uint32 index = ((pclass - 1) * GT_MAX_LEVEL) + (level - 1); // Dodge per agility is proportional to crit per agility, which is available from DBC files - const GtChanceToMeleeCritEntry* entry = sDBCgtChanceToMeleeCrit.LookupEntry(index); + const GtChanceToMeleeCritEntry* entry = sgtChanceToMeleeCritStore.LookupEntry(index); if (!entry) return 0.0f; return (100.0f * amount * entry->ratio * PLAYER_AGI_TO_CRIT_TO_DODGE[pclass]); @@ -5207,8 +5207,8 @@ float Player::GetSpellCritFromIntellect() const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtChanceToSpellCritBaseEntry const* critBase = sDBCgtChanceToSpellCritBase.LookupEntry(pclass - 1); - GtChanceToSpellCritEntry const* critRatio = sDBCgtChanceToSpellCrit.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); + GtChanceToSpellCritBaseEntry const* critBase = sgtChanceToSpellCritBaseStore.LookupEntry(pclass - 1); + GtChanceToSpellCritEntry const* critRatio = sgtChanceToSpellCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); if (critBase == nullptr || critRatio == nullptr) return 0.0f; @@ -5222,7 +5222,7 @@ float Player::GetRatingMultiplier(CombatRating cr) const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtCombatRatingsEntry const* Rating = sDBCgtCombatRatings.LookupEntry(cr * GT_MAX_LEVEL + level - 1); + GtCombatRatingsEntry const* Rating = sgtCombatRatingsStore.LookupEntry(cr * GT_MAX_LEVEL + level - 1); if (!Rating) return 1.0f; // By default use minimum coefficient (not must be called) @@ -5704,7 +5704,7 @@ void Player::SetSkill(uint16 id, uint16 value, uint16 max, uint16 step/* = 0*/) { if (!exists) { - SkillLineEntry const* entry = sDBCSkillLine.LookupEntry(id); + SkillLineEntry const* entry = sSkillLineStore.LookupEntry(id); if (!entry) { sLog.outError("Skill not found in SkillLineStore: skill #%u", id); @@ -5793,7 +5793,7 @@ void Player::SetSkillStep(uint16 id, uint16 step) { if (entry.skillTierId) { - if (SkillTiersEntry const* steps = sDBCSkillTiers.LookupEntry(entry.skillTierId)) + if (SkillTiersEntry const* steps = sSkillTiersStore.LookupEntry(entry.skillTierId)) { val = uint16(steps->skillValue[(step - 1)]); max = uint16(steps->maxSkillValue[(step - 1)]); @@ -5894,7 +5894,7 @@ void Player::UpdateSkillsForLevel(bool maximize/* = false*/) uint16 skillId = uint16(pair.first); - SkillLineEntry const* pSkill = sDBCSkillLine.LookupEntry(skillId); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skillId); if (!pSkill) continue; @@ -6001,7 +6001,7 @@ void Player::UpdateSpellTrainedSkills(uint32 spellId, bool apply) { SkillLineAbilityEntry const* info = itr->second; - SkillLineEntry const* pSkill = sDBCSkillLine.LookupEntry(info->skillId); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(info->skillId); if (!pSkill) continue; @@ -6084,7 +6084,7 @@ void Player::LearnDefaultSkills() uint16 max = 0; uint16 step = 0; - if (SkillLineEntry const* entry = sDBCSkillLine.LookupEntry(tskill.SkillId)) + if (SkillLineEntry const* entry = sSkillLineStore.LookupEntry(tskill.SkillId)) { switch (GetSkillRangeType(entry, false)) { @@ -6106,7 +6106,7 @@ void Player::LearnDefaultSkills() { if (entry.skillTierId) { - if (SkillTiersEntry const* steps = sDBCSkillTiers.LookupEntry(entry.skillTierId)) + if (SkillTiersEntry const* steps = sSkillTiersStore.LookupEntry(entry.skillTierId)) { value = 1; max = uint16(steps->maxSkillValue[stepIndex]); @@ -6383,7 +6383,7 @@ void Player::SendCinematicStart(uint32 CinematicSequenceId) data << uint32(CinematicSequenceId); SendDirectMessage(data); - if (CinematicSequencesEntry const* sequence = sDBCCinematicSequences.LookupEntry(CinematicSequenceId)) + if (CinematicSequencesEntry const* sequence = sCinematicSequencesStore.LookupEntry(CinematicSequenceId)) { // we can start server side dynamic follow m_cinematicMgr.reset(new CinematicMgr(this)); @@ -6406,7 +6406,7 @@ void Player::CheckAreaExploreAndOutdoor() { if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && GetRestType() == REST_TYPE_IN_TAVERN) { - AreaTriggerEntry const* at = sDBCAreaTrigger.LookupEntry(inn_trigger_id); + AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(inn_trigger_id); if (!at || !Map::IsPointInAreaTriggerZone(at, GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ())) { // Player left inn (REST_TYPE_IN_CITY overrides REST_TYPE_IN_TAVERN, so just clear rest) @@ -6492,7 +6492,7 @@ void Player::CheckAreaExploreAndOutdoor() Team Player::TeamForRace(uint8 race) { - ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(race); + ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race); if (!rEntry) { sLog.outError("Race %u not found in DBC: wrong DBC files?", uint32(race)); @@ -6511,7 +6511,7 @@ Team Player::TeamForRace(uint8 race) uint32 Player::getFactionForRace(uint8 race) { - ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(race); + ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race); if (!rEntry) { sLog.outError("Race %u not found in DBC: wrong DBC files?", uint32(race)); @@ -7780,7 +7780,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType, bool sp for (int e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot) { uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot)); - SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) continue; for (int s = 0; s < 3; ++s) { @@ -9012,10 +9012,10 @@ bool Player::IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 r if (itemTotemCategoryId == 0) return false; - TotemCategoryEntry const* itemEntry = sDBCTotemCategory.LookupEntry(itemTotemCategoryId); + TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId); if (!itemEntry) return false; - TotemCategoryEntry const* reqEntry = sDBCTotemCategory.LookupEntry(requiredTotemCategoryId); + TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId); if (!reqEntry) return false; @@ -11826,7 +11826,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool if (!enchant_id) return; - SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; @@ -11878,7 +11878,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool // Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor) if (item->GetItemRandomPropertyId()) { - ItemRandomSuffixEntry const* item_rand = sDBCItemRandomSuffix.LookupEntry(abs(item->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); if (item_rand) { // Search enchant_amount @@ -11906,7 +11906,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool case ITEM_ENCHANTMENT_TYPE_RESISTANCE: if (!enchant_amount) { - ItemRandomSuffixEntry const* item_rand = sDBCItemRandomSuffix.LookupEntry(abs(item->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); if (item_rand) { for (int k = 0; k < 3; ++k) @@ -11926,7 +11926,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool { if (!enchant_amount) { - ItemRandomSuffixEntry const* item_rand_suffix = sDBCItemRandomSuffix.LookupEntry(abs(item->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); if (item_rand_suffix) { for (int k = 0; k < 3; ++k) @@ -13369,7 +13369,7 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver, // title reward if (pQuest->GetCharTitleId()) { - if (CharTitlesEntry const* titleEntry = sDBCCharTitles.LookupEntry(pQuest->GetCharTitleId())) + if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId())) SetTitle(titleEntry); } @@ -14890,13 +14890,13 @@ void Player::_LoadIntoDataField(const char* data, uint32 startOffset, uint32 cou if (foundTitle > 14 && (raceMask & RACEMASK_HORDE) != 0) return; - if (CharTitlesEntry const* tEntry = sDBCCharTitles.LookupEntry(foundTitle)) + if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(foundTitle)) SetTitle(tEntry, true, false); if (foundTitle > 14) foundTitle -= 14; else foundTitle += 14; - if (CharTitlesEntry const* tEntry = sDBCCharTitles.LookupEntry(foundTitle)) + if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(foundTitle)) SetTitle(tEntry, false, false); } @@ -15110,7 +15110,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) } else { - MapEntry const* mapEntry = sDBCMap.LookupEntry(GetMapId()); + MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId()); // if server restart after player save in BG or area // player can have current coordinates in to BG/Arena map, fix this if (!mapEntry || mapEntry->IsBattleGroundOrArena()) @@ -15177,7 +15177,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) } if (transport) { - MapEntry const* transMapEntry = sDBCMap.LookupEntry(transport->GetMapId()); + MapEntry const* transMapEntry = sMapStore.LookupEntry(transport->GetMapId()); // client without expansion support if (GetSession()->GetExpansion() < transMapEntry->Expansion()) DEBUG_LOG("Player %s using client without required expansion tried login at transport at non accessible map %u", GetName(), transport->GetMapId()); @@ -15205,7 +15205,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) } else // not transport case { - MapEntry const* mapEntry = sDBCMap.LookupEntry(GetMapId()); + MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId()); // client without expansion support if (GetSession()->GetExpansion() < mapEntry->Expansion()) { @@ -15385,7 +15385,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) if (!m_taxiTracker.Load(taxi_nodes, destOrphan)) { // problems with taxi path loading - TaxiNodesEntry const* nodeEntry = (destOrphan ? sDBCTaxiNodes.LookupEntry(destOrphan) : nullptr); + TaxiNodesEntry const* nodeEntry = (destOrphan ? sTaxiNodesStore.LookupEntry(destOrphan) : nullptr); if (!nodeEntry) // don't know taxi start node, to homebind { @@ -15416,7 +15416,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) // save source node as recall coord to prevent recall and fall from sky if (uint32 destSource = m_taxiTracker.GetRoute().destStart) { - TaxiNodesEntry const* destination = sDBCTaxiNodes.LookupEntry(destSource); + TaxiNodesEntry const* destination = sTaxiNodesStore.LookupEntry(destSource); MANGOS_ASSERT(destination); m_recallMap = destination->map_id; m_recallX = destination->x; @@ -15664,7 +15664,7 @@ void Player::LoadCorpse() { if (Corpse* corpse = GetCorpse()) { - ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER, corpse && !sDBCMap.LookupEntry(corpse->GetMapId())->Instanceable()); + ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER, corpse && !sMapStore.LookupEntry(corpse->GetMapId())->Instanceable()); // [XFACTION]: Alter values update if detected crossfaction group interaction: if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetGroup()) @@ -15952,7 +15952,7 @@ void Player::_LoadMails(QueryResult* result) m->mailTemplateId = fields[12].GetInt16(); m->has_items = fields[13].GetBool(); // true, if mail have items or mail have template and items generated (maybe none) - if (m->mailTemplateId && !sDBCMailTemplate.LookupEntry(m->mailTemplateId)) + if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId)) { sLog.outError("Player::_LoadMail - Mail (%u) have nonexistent MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); m->mailTemplateId = 0; @@ -16079,7 +16079,7 @@ void Player::_LoadQuestStatus(QueryResult* result) // set rewarded title if any if (pQuest->GetCharTitleId()) { - if (CharTitlesEntry const* titleEntry = sDBCCharTitles.LookupEntry(pQuest->GetCharTitleId())) + if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId())) SetTitle(titleEntry); } } @@ -16277,7 +16277,7 @@ void Player::_LoadBoundInstances(QueryResult* result) // so the value read from the DB may be wrong here but only if the InstanceSave is loaded // and in that case it is not used - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapId); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); if (!mapEntry || !mapEntry->IsDungeon()) { sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent or not dungeon map %d", GetName(), GetGUIDLow(), mapId); @@ -16313,7 +16313,7 @@ void Player::_LoadBoundInstances(QueryResult* result) InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, Difficulty difficulty) { // some instances only have one difficulty - const MapEntry* entry = sDBCMap.LookupEntry(mapid); + const MapEntry* entry = sMapStore.LookupEntry(mapid); if (!entry || !entry->SupportsHeroicMode()) difficulty = DUNGEON_DIFFICULTY_NORMAL; @@ -16383,7 +16383,7 @@ InstancePlayerBind* Player::BindToInstance(DungeonPersistentState* state, bool p DungeonPersistentState* Player::GetBoundInstanceSaveForSelfOrGroup(uint32 mapid) { - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); if (!mapEntry) return nullptr; @@ -16549,7 +16549,7 @@ bool Player::_LoadHomeBind(QueryResult* result) m_homebindZ = fields[4].GetFloat(); delete result; - MapEntry const* bindMapEntry = sDBCMap.LookupEntry(m_homebindMapId); + MapEntry const* bindMapEntry = sMapStore.LookupEntry(m_homebindMapId); // accept saved data only for valid position (and non instanceable), and accessable if (MapManager::IsValidMapCoord(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ) && @@ -17476,7 +17476,7 @@ void Player::ResetInstances(InstanceResetMethod method) for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { DungeonPersistentState* state = itr->second.state; - const MapEntry* entry = sDBCMap.LookupEntry(itr->first); + const MapEntry* entry = sMapStore.LookupEntry(itr->first); if (!entry || !state->CanReset()) { ++itr; @@ -18196,7 +18196,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc uint32 sourcenode = nodes[0]; // starting node too far away (cheat?) - TaxiNodesEntry const* node = sDBCTaxiNodes.LookupEntry(sourcenode); + TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(sourcenode); if (!node) { GetSession()->SendActivateTaxiReply(ERR_TAXINOSUCHPATH); @@ -18262,7 +18262,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc bool Player::ActivateTaxiPathTo(uint32 path_id, uint32 spellid /*= 0*/) { - TaxiPathEntry const* entry = sDBCTaxiPath.LookupEntry(path_id); + TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(path_id); if (!entry) return false; @@ -18319,7 +18319,7 @@ void Player::OnTaxiFlightStart(const TaxiPathEntry* /*path*/) void Player::OnTaxiFlightEnd(const TaxiPathEntry* path) { // Final destination - if (const TaxiNodesEntry* destination = sDBCTaxiNodes.LookupEntry(path->to)) + if (const TaxiNodesEntry* destination = sTaxiNodesStore.LookupEntry(path->to)) TeleportTo(GetMap()->GetId(), destination->x, destination->y, destination->z, GetOrientation()); if (pvpInfo.inPvPEnforcedArea) @@ -18411,7 +18411,7 @@ void Player::OnTaxiFlightSplineStart(const TaxiPathNodeEntry* node) if (m_taxiTracker.GetState() == Taxi::TRACKER_TRANSFER) UpdateClientControl(this, false); - if (sDBCTaxiPath.LookupEntry(node->path)) + if (sTaxiPathStore.LookupEntry(node->path)) Mount(m_taxiTracker.GetMountDisplayId()); getHostileRefManager().updateOnlineOfflineState(false); @@ -18481,7 +18481,7 @@ void Player::OnTaxiFlightRouteStart(uint32 pathID, bool initial) { ModifyMoney(-int32(m_taxiTracker.GetCost())); - if (const TaxiPathEntry* path = sDBCTaxiPath.LookupEntry(pathID)) + if (const TaxiPathEntry* path = sTaxiPathStore.LookupEntry(pathID)) OnTaxiFlightStart(path); } } @@ -18490,7 +18490,7 @@ void Player::OnTaxiFlightRouteEnd(uint32 pathID, bool final) { if (final) { - if (const TaxiPathEntry* path = sDBCTaxiPath.LookupEntry(pathID)) + if (const TaxiPathEntry* path = sTaxiPathStore.LookupEntry(pathID)) OnTaxiFlightEnd(path); } else @@ -18526,7 +18526,7 @@ void Player::InitDataForForm(bool reapplyMods) { ShapeshiftForm form = GetShapeshiftForm(); - SpellShapeshiftFormEntry const* ssEntry = sDBCSpellShapeshiftForm.LookupEntry(form); + SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form); if (ssEntry && ssEntry->attackSpeed) { SetAttackTime(BASE_ATTACK, ssEntry->attackSpeed); @@ -18553,7 +18553,7 @@ void Player::InitDataForForm(bool reapplyMods) } default: // 0, for example { - ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(getClass()); + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(getClass()); if (cEntry && cEntry->powerType < MAX_POWERS && uint32(GetPowerType()) != cEntry->powerType) SetPowerType(Powers(cEntry->powerType)); break; @@ -18598,7 +18598,7 @@ void Player::InitDisplayIds() void Player::TakeExtendedCost(uint32 extendedCostId, uint32 count) { - ItemExtendedCostEntry const* extendedCost = sDBCItemExtendedCost.LookupEntry(extendedCostId); + ItemExtendedCostEntry const* extendedCost = sItemExtendedCostStore.LookupEntry(extendedCostId); if (extendedCost->reqhonorpoints) ModifyHonorPoints(-int32(extendedCost->reqhonorpoints * count)); @@ -18684,7 +18684,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, if (uint32 extendedCostId = crItem->ExtendedCost) { - ItemExtendedCostEntry const* iece = sDBCItemExtendedCost.LookupEntry(extendedCostId); + ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCostId); if (!iece) { sLog.outError("Item %u have wrong ExtendedCost field value %u", pProto->ItemId, extendedCostId); @@ -18942,7 +18942,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) if (!enchantmentcondition) return true; - SpellItemEnchantmentConditionEntry const* Condition = sDBCSpellItemEnchantmentCondition.LookupEntry(enchantmentcondition); + SpellItemEnchantmentConditionEntry const* Condition = sSpellItemEnchantmentConditionStore.LookupEntry(enchantmentcondition); if (!Condition) return true; @@ -18963,7 +18963,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) if (!enchant_id) continue; - SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!enchantEntry) continue; @@ -18975,7 +18975,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) if (!gemProto) continue; - GemPropertiesEntry const* gemProperty = sDBCGemProperties.LookupEntry(gemProto->GemProperties); + GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties); if (!gemProperty) continue; @@ -19041,7 +19041,7 @@ void Player::CorrectMetaGemEnchants(uint8 exceptslot, bool apply) if (!enchant_id) continue; - SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!enchantEntry) continue; @@ -19084,7 +19084,7 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply) if (!enchant_id) // if no enchant go to next enchant(slot) continue; - SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!enchantEntry) continue; @@ -20652,7 +20652,7 @@ void Player::UpdateTerainEnvironmentFlags(Map* m, float x, float y, float z) if (uint32 liqEntry = liquid_status.entry) { - LiquidTypeEntry const* liquid = sDBCLiquidType.LookupEntry(liqEntry); + LiquidTypeEntry const* liquid = sLiquidTypeStore.LookupEntry(liqEntry); if (m_lastLiquid && m_lastLiquid->SpellId && m_lastLiquid->Id != liqEntry) RemoveAurasDueToSpell(m_lastLiquid->SpellId); @@ -20769,7 +20769,7 @@ bool Player::HasTitle(uint32 bitIndex) const void Player::SetTitle(uint32 titleId, bool lost) { - if (CharTitlesEntry const* titleEntry = sDBCCharTitles.LookupEntry(titleId)) + if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId)) SetTitle(titleEntry, lost); } @@ -20933,7 +20933,7 @@ void Player::_LoadSkills(QueryResult* result) uint16 value = fields[1].GetUInt16(); uint16 max = fields[2].GetUInt16(); - SkillLineEntry const* pSkill = sDBCSkillLine.LookupEntry(skill); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); if (!pSkill) { sLog.outError("Character %u has skill %u that does not exist.", GetGUIDLow(), skill); @@ -20984,7 +20984,7 @@ void Player::_LoadSkills(QueryResult* result) if (entry->flags & SKILL_FLAG_MAXIMIZED) value = max = GetSkillMaxForLevel(); - if (SkillTiersEntry const* steps = sDBCSkillTiers.LookupEntry(entry->skillTierId)) + if (SkillTiersEntry const* steps = sSkillTiersStore.LookupEntry(entry->skillTierId)) { for (uint16 i = 0; (i < MAX_SKILL_STEP && !step && steps->maxSkillValue[i]); ++i) { @@ -21034,7 +21034,7 @@ InventoryResult Player::CanEquipUniqueItem(Item* pItem, uint8 eslot) const uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot)); if (!enchant_id) continue; - SpellItemEnchantmentEntry const* enchantEntry = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!enchantEntry) continue; @@ -21116,12 +21116,12 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) if (talentRank >= MAX_TALENT_RANK) return; - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(talentId); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); if (!talentInfo) return; - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) return; @@ -21152,7 +21152,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) // Check if it requires another talent if (talentInfo->DependsOn > 0) { - if (TalentEntry const* depTalentInfo = sDBCTalent.LookupEntry(talentInfo->DependsOn)) + if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) { bool hasEnoughRank = false; for (int i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; ++i) @@ -21177,7 +21177,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) uint32 tTab = talentInfo->TalentTab; if (talentInfo->Row > 0) { - for (auto tmpTalent : sDBCTalent) // Loop through all talents. + for (auto tmpTalent : sTalentStore) // Loop through all talents. { // Someday, someone needs to revamp if (tmpTalent->TalentTab == tTab) @@ -21460,7 +21460,7 @@ AreaLockStatus Player::GetAreaTriggerLockStatus(AreaTrigger const* at, uint32& m if (!at) return AREA_LOCKSTATUS_UNKNOWN_ERROR; - MapEntry const* mapEntry = sDBCMap.LookupEntry(at->target_mapId); + MapEntry const* mapEntry = sMapStore.LookupEntry(at->target_mapId); if (!mapEntry) return AREA_LOCKSTATUS_UNKNOWN_ERROR; diff --git a/src/game/Entities/QueryHandler.cpp b/src/game/Entities/QueryHandler.cpp index 5935f46e7a6..58aec182311 100644 --- a/src/game/Entities/QueryHandler.cpp +++ b/src/game/Entities/QueryHandler.cpp @@ -299,7 +299,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recv_data*/) if (corpsemapid != _player->GetMapId()) { // search entrance map for proper show entrance - if (MapEntry const* corpseMapEntry = sDBCMap.LookupEntry(corpsemapid)) + if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(corpsemapid)) { if (corpseMapEntry->IsDungeon() && corpseMapEntry->ghost_entrance_map >= 0) { diff --git a/src/game/Entities/Relations.cpp b/src/game/Entities/Relations.cpp index a7d8cd6b597..2044a79cd8b 100644 --- a/src/game/Entities/Relations.cpp +++ b/src/game/Entities/Relations.cpp @@ -296,7 +296,7 @@ ReputationRank Unit::GetReactionTo(const Corpse* corpse) const { if (const uint32 corpseTemplateId = corpse->getFaction()) { - if (const FactionTemplateEntry* corpseTemplate = sDBCFactionTemplate.LookupEntry(corpseTemplateId)) + if (const FactionTemplateEntry* corpseTemplate = sFactionTemplateStore.LookupEntry(corpseTemplateId)) return GetFactionReaction(thisTemplate, corpseTemplate); } } @@ -321,7 +321,7 @@ ReputationRank GameObject::GetReactionTo(Unit const* unit) const if (const uint32 faction = GetUInt32Value(GAMEOBJECT_FACTION)) { - if (const FactionTemplateEntry* factionTemplate = sDBCFactionTemplate.LookupEntry(faction)) + if (const FactionTemplateEntry* factionTemplate = sFactionTemplateStore.LookupEntry(faction)) return GetFactionReaction(factionTemplate, unit); } @@ -692,7 +692,7 @@ bool Unit::CanInteractNow(const Unit* unit) const // We can't interact with anyone while being shapeshifted, unless form flags allow us to do so if (IsShapeShifted()) { - if (SpellShapeshiftFormEntry const* formEntry = sDBCSpellShapeshiftForm.LookupEntry(GetShapeshiftForm())) + if (SpellShapeshiftFormEntry const* formEntry = sSpellShapeshiftFormStore.LookupEntry(GetShapeshiftForm())) { if (!(formEntry->flags1 & SHAPESHIFT_FORM_FLAG_ALLOW_NPC_INTERACT)) return false; @@ -872,7 +872,7 @@ bool GameObject::IsEnemy(Unit const* unit) const if (const uint32 faction = GetUInt32Value(GAMEOBJECT_FACTION)) { - if (const FactionTemplateEntry* factionTemplate = sDBCFactionTemplate.LookupEntry(faction)) + if (const FactionTemplateEntry* factionTemplate = sFactionTemplateStore.LookupEntry(faction)) return (GetFactionReaction(factionTemplate, unit) < REP_UNFRIENDLY); } @@ -896,7 +896,7 @@ bool GameObject::IsFriend(Unit const* unit) const if (const uint32 faction = GetUInt32Value(GAMEOBJECT_FACTION)) { - if (const FactionTemplateEntry* factionTemplate = sDBCFactionTemplate.LookupEntry(faction)) + if (const FactionTemplateEntry* factionTemplate = sFactionTemplateStore.LookupEntry(faction)) return (GetFactionReaction(factionTemplate, unit) > REP_NEUTRAL); } @@ -1021,7 +1021,7 @@ ReputationRank Player::GetReactionTo(const Corpse* corpse) const if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInGroup(corpseOwner)) { uint32 id = (GetTeam() == ALLIANCE ? 1054 : 1495); - return GetFactionReaction(GetFactionTemplateEntry(), sDBCFactionTemplate.LookupEntry(id)); + return GetFactionReaction(GetFactionTemplateEntry(), sFactionTemplateStore.LookupEntry(id)); } } } diff --git a/src/game/Entities/Taxi.cpp b/src/game/Entities/Taxi.cpp index 65fdf873554..ac7a8641488 100644 --- a/src/game/Entities/Taxi.cpp +++ b/src/game/Entities/Taxi.cpp @@ -171,7 +171,7 @@ bool Tracker::AddRoute(PathID pathID, float discountMulti /*= 0.0f*/, bool requi if (m_state > TRACKER_STAGING) return false; - TaxiPathEntry const* entry = sDBCTaxiPath.LookupEntry(pathID); + TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(pathID); return (entry && AddRoute(entry, discountMulti, requireModel)); } @@ -273,7 +273,7 @@ bool Tracker::Prepare(Index nodeResume /*= 0*/) if (prev && (*j)->mapid != prev->mapid) { // Detect map change and advance atlas by adding a new map - if (sDBCMap.LookupEntry((*j)->mapid)) + if (sMapStore.LookupEntry((*j)->mapid)) { // Bugcheck: latest finished map spline is suspiciously short MANGOS_ASSERT(m_atlas.back().size() > 2); @@ -416,7 +416,7 @@ bool Tracker::Trim(Route& first, Route& second) // Try to trim dynamically if data is not available or incomplete TaxiPathNodeList const& waypoints1 = sTaxiPathNodesByPath[first.pathID]; TaxiPathNodeList const& waypoints2 = sTaxiPathNodesByPath[second.pathID]; - TaxiNodesEntry const* destination = sDBCTaxiNodes.LookupEntry(first.destEnd); + TaxiNodesEntry const* destination = sTaxiNodesStore.LookupEntry(first.destEnd); if (destination && waypoints1 != waypoints2) { diff --git a/src/game/Entities/Transports.cpp b/src/game/Entities/Transports.cpp index 573759a737c..3ee1c0c9269 100644 --- a/src/game/Entities/Transports.cpp +++ b/src/game/Entities/Transports.cpp @@ -83,7 +83,7 @@ void MapManager::LoadTransports() continue; } - const MapEntry* pMapInfo = sDBCMap.LookupEntry(transportTemplate->keyFrames.begin()->Node->mapid); + const MapEntry* pMapInfo = sMapStore.LookupEntry(transportTemplate->keyFrames.begin()->Node->mapid); if (!pMapInfo) continue; @@ -189,7 +189,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, SetDisplayId(goinfo->displayId); SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); - m_displayInfo = sDBCGameObjectDisplayInfo.LookupEntry(goinfo->displayId); + m_displayInfo = sGameObjectDisplayInfoStore.LookupEntry(goinfo->displayId); SetGoState(GO_STATE_READY); SetGoType(GameobjectTypes(goinfo->type)); diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index 7d44f51866e..c9dbb8053eb 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -2207,7 +2207,7 @@ void Unit::HandleEmote(uint32 emote_id) { if (!emote_id) HandleEmoteState(0); - else if (EmotesEntry const* emoteEntry = sDBCEmotes.LookupEntry(emote_id)) + else if (EmotesEntry const* emoteEntry = sEmotesStore.LookupEntry(emote_id)) { if (emoteEntry->EmoteType) // 1,2 states, 0 command HandleEmoteState(emote_id); @@ -6232,7 +6232,7 @@ void Unit::SetPowerType(Powers new_powertype) FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const { - FactionTemplateEntry const* entry = sDBCFactionTemplate.LookupEntry(getFaction()); + FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(getFaction()); if (!entry) { static ObjectGuid guid; // prevent repeating spam same faction problem @@ -9258,7 +9258,7 @@ uint32 Unit::GetCreatureType() const { if (GetTypeId() == TYPEID_PLAYER) { - SpellShapeshiftFormEntry const* ssEntry = sDBCSpellShapeshiftForm.LookupEntry(GetShapeshiftForm()); + SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(GetShapeshiftForm()); if (ssEntry && ssEntry->creatureType > 0) return ssEntry->creatureType; return CREATURE_TYPE_HUMANOID; @@ -11191,7 +11191,7 @@ bool Unit::IsShapeShifted() const // Mirroring clientside gameplay logic if (ShapeshiftForm form = GetShapeshiftForm()) { - if (SpellShapeshiftFormEntry const* entry = sDBCSpellShapeshiftForm.LookupEntry(form)) + if (SpellShapeshiftFormEntry const* entry = sSpellShapeshiftFormStore.LookupEntry(form)) return !(entry->flags1 & SHAPESHIFT_FORM_FLAG_ALLOW_ACTIVITY); } return false; @@ -12135,8 +12135,8 @@ float Unit::OCTRegenHPPerSpirit() const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtOCTRegenHPEntry const* baseRatio = sDBCgtOCTRegenHP.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); - GtRegenHPPerSptEntry const* moreRatio = sDBCgtRegenHPPerSpt.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); + GtOCTRegenHPEntry const* baseRatio = sgtOCTRegenHPStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); + GtRegenHPPerSptEntry const* moreRatio = sgtRegenHPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); if (baseRatio == nullptr || moreRatio == nullptr) return 0.0f; @@ -12157,7 +12157,7 @@ float Unit::OCTRegenMPPerSpirit() const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; // GtOCTRegenMPEntry const *baseRatio = sGtOCTRegenMPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); - GtRegenMPPerSptEntry const* moreRatio = sDBCgtRegenMPPerSpt.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); + GtRegenMPPerSptEntry const* moreRatio = sgtRegenMPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); if (moreRatio == nullptr) return 0.0f; @@ -12173,13 +12173,13 @@ float Unit::GetCollisionHeight() const if (IsMounted()) { - if (CreatureDisplayInfoEntry const* mountDisplayInfo = sDBCCreatureDisplayInfo.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID))) + if (CreatureDisplayInfoEntry const* mountDisplayInfo = sCreatureDisplayInfoStore.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID))) { - if (CreatureModelDataEntry const* mountModelData = sDBCCreatureModelData.LookupEntry(mountDisplayInfo->ModelId)) + if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId)) { - CreatureDisplayInfoEntry const* displayInfo = sDBCCreatureDisplayInfo.LookupEntry(GetNativeDisplayId()); + CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()); MANGOS_ASSERT(displayInfo); - CreatureModelDataEntry const* modelData = sDBCCreatureModelData.LookupEntry(displayInfo->ModelId); + CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId); MANGOS_ASSERT(modelData); float const collisionHeight = scaleMod * (mountModelData->MountHeight + modelData->CollisionHeight * modelData->Scale * displayInfo->scale * 0.5f); return collisionHeight == 0.0f ? DEFAULT_COLLISION_HEIGHT : collisionHeight; @@ -12188,9 +12188,9 @@ float Unit::GetCollisionHeight() const } //! Dismounting case - use basic default model data - CreatureDisplayInfoEntry const* displayInfo = sDBCCreatureDisplayInfo.LookupEntry(GetNativeDisplayId()); + CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId()); MANGOS_ASSERT(displayInfo); - CreatureModelDataEntry const* modelData = sDBCCreatureModelData.LookupEntry(displayInfo->ModelId); + CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId); MANGOS_ASSERT(modelData); float const collisionHeight = scaleMod * modelData->CollisionHeight * modelData->Scale * displayInfo->scale; diff --git a/src/game/GMTickets/GMTicketHandler.cpp b/src/game/GMTickets/GMTicketHandler.cpp index 159c2cb7fc0..50efb9d8b46 100644 --- a/src/game/GMTickets/GMTicketHandler.cpp +++ b/src/game/GMTickets/GMTicketHandler.cpp @@ -231,13 +231,13 @@ void WorldSession::HandleGMSurveySubmitOpcode(WorldPacket& recv_data) // Perform some sanity checks on the input: - GMSurveyCurrentSurveyEntry const* currentSurvey = sDBCGMSurveyCurrentSurvey.LookupEntry(uint32(m_sessionDbcLocale)); + GMSurveyCurrentSurveyEntry const* currentSurvey = sGMSurveyCurrentSurveyStore.LookupEntry(uint32(m_sessionDbcLocale)); // Check if survey id is correct if (!currentSurvey || currentSurvey->surveyID != surveyId) return; - GMSurveyEntry const* survey = sDBCGMSurveySurveys.LookupEntry(surveyId); + GMSurveyEntry const* survey = sGMSurveySurveysStore.LookupEntry(surveyId); // Check if survey entry with provided id exists if (!survey) diff --git a/src/game/GMTickets/GMTicketMgr.cpp b/src/game/GMTickets/GMTicketMgr.cpp index 8796739d8c5..9cc3cd7cfa7 100644 --- a/src/game/GMTickets/GMTicketMgr.cpp +++ b/src/game/GMTickets/GMTicketMgr.cpp @@ -455,7 +455,7 @@ const std::string GMTicketMgr::PrintMailResponse(GMTicket const& ticket, bool re const char* GMTicketMgr::PrintTicketCategory(GMTicket const& ticket, LocaleConstant locale/* = LOCALE_DEFAULT*/) { - if (GMTicketCategoryEntry const* entry = sDBCGMTicketCategory.LookupEntry(ticket.GetCategory())) + if (GMTicketCategoryEntry const* entry = sGMTicketCategoryStore.LookupEntry(ticket.GetCategory())) { if (!std::string(entry->name[locale]).empty()) return entry->name[locale]; diff --git a/src/game/GameEvents/GameEventMgr.cpp b/src/game/GameEvents/GameEventMgr.cpp index 19f7ed04e3f..adc385db9fa 100644 --- a/src/game/GameEvents/GameEventMgr.cpp +++ b/src/game/GameEvents/GameEventMgr.cpp @@ -608,7 +608,7 @@ void GameEventMgr::LoadFromDB() continue; } - if (!sDBCMailTemplate.LookupEntry(mail.mailTemplateId)) + if (!sMailTemplateStore.LookupEntry(mail.mailTemplateId)) { sLog.outErrorDb("Table `game_event_mail` have invalid mailTemplateId (%u) for game event %i that invalid not include any player races, ignoring.", mail.mailTemplateId, event_id); continue; diff --git a/src/game/Globals/Conditions.cpp b/src/game/Globals/Conditions.cpp index c662634da9e..b70ae06efa2 100644 --- a/src/game/Globals/Conditions.cpp +++ b/src/game/Globals/Conditions.cpp @@ -707,7 +707,7 @@ bool ConditionEntry::IsValid() const case CONDITION_SKILL: case CONDITION_SKILL_BELOW: { - SkillLineEntry const* pSkill = sDBCSkillLine.LookupEntry(m_value1); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(m_value1); if (!pSkill) { sLog.outErrorDb("Skill condition (entry %u, type %u) specifies non-existing skill (%u), skipped", m_entry, m_condition, m_value1); diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index ec7d6751458..d38c0ffa983 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -518,7 +518,7 @@ void ObjectMgr::LoadCreatureTemplates() heroicEntries.insert(cInfo->HeroicEntry); } - FactionTemplateEntry const* factionTemplate = sDBCFactionTemplate.LookupEntry(cInfo->Faction); + FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->Faction); if (!factionTemplate) sLog.outErrorDb("Creature (Entry: %u) has nonexistent faction_A template (%u)", cInfo->Entry, cInfo->Faction); @@ -541,7 +541,7 @@ void ObjectMgr::LoadCreatureTemplates() { if (cInfo->ModelId[j]) { - CreatureDisplayInfoEntry const* displayEntry = sDBCCreatureDisplayInfo.LookupEntry(cInfo->ModelId[j]); + CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->ModelId[j]); if (!displayEntry) { sLog.outErrorDb("Creature (Entry: %u) has nonexistent modelid_%d (%u), can crash client", cInfo->Entry, j + 1, cInfo->ModelId[j]); @@ -625,14 +625,14 @@ void ObjectMgr::LoadCreatureTemplates() if ((cInfo->NpcFlags & UNIT_NPC_FLAG_TRAINER) && cInfo->TrainerType >= MAX_TRAINER_TYPE) sLog.outErrorDb("Creature (Entry: %u) has wrong trainer type %u", cInfo->Entry, cInfo->TrainerType); - if (cInfo->CreatureType && !sDBCCreatureType.LookupEntry(cInfo->CreatureType)) + if (cInfo->CreatureType && !sCreatureTypeStore.LookupEntry(cInfo->CreatureType)) { sLog.outErrorDb("Creature (Entry: %u) has invalid creature type (%u) in `type`", cInfo->Entry, cInfo->CreatureType); const_cast(cInfo)->CreatureType = CREATURE_TYPE_HUMANOID; } // must exist or used hidden but used in data horse case - if (cInfo->Family && !sDBCCreatureFamily.LookupEntry(cInfo->Family) && cInfo->Family != CREATURE_FAMILY_HORSE_CUSTOM) + if (cInfo->Family && !sCreatureFamilyStore.LookupEntry(cInfo->Family) && cInfo->Family != CREATURE_FAMILY_HORSE_CUSTOM) { sLog.outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`", cInfo->Entry, cInfo->Family); const_cast(cInfo)->Family = 0; @@ -646,7 +646,7 @@ void ObjectMgr::LoadCreatureTemplates() if (cInfo->PetSpellDataId) { - CreatureSpellDataEntry const* spellDataId = sDBCCreatureSpellData.LookupEntry(cInfo->PetSpellDataId); + CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId); if (!spellDataId) sLog.outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u)", cInfo->Entry, cInfo->PetSpellDataId); } @@ -747,7 +747,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* continue; } - if (SpellCastTimesEntry const* spellCastTimeEntry = sDBCSpellCastTimes.LookupEntry(AdditionalSpellInfo->CastingTimeIndex)) + if (SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(AdditionalSpellInfo->CastingTimeIndex)) { if (spellCastTimeEntry->CastTime > 0) { @@ -789,7 +789,7 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons if (addon->mount) { - if (!sDBCCreatureDisplayInfo.LookupEntry(addon->mount)) + if (!sCreatureDisplayInfoStore.LookupEntry(addon->mount)) { sLog.outErrorDb("Creature (%s %u) have invalid displayInfoId for mount (%u) defined in `%s`.", entryName, addon->guidOrEntry, addon->mount, creatureaddons.GetTableName()); const_cast(addon)->mount = 0; @@ -799,7 +799,7 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons if (addon->sheath_state > SHEATH_STATE_RANGED) sLog.outErrorDb("Creature (%s %u) has unknown sheath state (%u) defined in `%s`.", entryName, addon->guidOrEntry, addon->sheath_state, creatureaddons.GetTableName()); - if (!sDBCEmotes.LookupEntry(addon->emote)) + if (!sEmotesStore.LookupEntry(addon->emote)) { sLog.outErrorDb("Creature (%s %u) have invalid emote (%u) defined in `%s`.", entryName, addon->guidOrEntry, addon->emote, creatureaddons.GetTableName()); const_cast(addon)->emote = 0; @@ -1028,7 +1028,7 @@ void ObjectMgr::LoadCreatureModelInfo() // post processing for (auto minfo : sCreatureModelStorage) { - if (!sDBCCreatureDisplayInfo.LookupEntry(minfo->modelid)) + if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid)) sLog.outErrorDb("Table `creature_model_info` has model for nonexistent model id (%u).", minfo->modelid); if (minfo->gender >= MAX_GENDER) @@ -1044,7 +1044,7 @@ void ObjectMgr::LoadCreatureModelInfo() sLog.outErrorDb("Table `creature_model_info` has redundant modelid_other_gender model (%u) defined for model id %u.", minfo->modelid_other_gender, minfo->modelid); const_cast(minfo)->modelid_other_gender = 0; } - else if (!sDBCCreatureDisplayInfo.LookupEntry(minfo->modelid_other_gender)) + else if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_other_gender)) { sLog.outErrorDb("Table `creature_model_info` has nonexistent modelid_other_gender model (%u) defined for model id %u.", minfo->modelid_other_gender, minfo->modelid); const_cast(minfo)->modelid_other_gender = 0; @@ -1058,7 +1058,7 @@ void ObjectMgr::LoadCreatureModelInfo() sLog.outErrorDb("Table `creature_model_info` has redundant modelid_alternative model (%u) defined for model id %u.", minfo->modelid_alternative, minfo->modelid); const_cast(minfo)->modelid_alternative = 0; } - else if (!sDBCCreatureDisplayInfo.LookupEntry(minfo->modelid_alternative)) + else if (!sCreatureDisplayInfoStore.LookupEntry(minfo->modelid_alternative)) { sLog.outErrorDb("Table `creature_model_info` has nonexistent modelid_alternative model (%u) defined for model id %u.", minfo->modelid_alternative, minfo->modelid); const_cast(minfo)->modelid_alternative = 0; @@ -1067,7 +1067,7 @@ void ObjectMgr::LoadCreatureModelInfo() } // character races expected have model info data in table - for (auto raceEntry : sDBCChrRaces) + for (auto raceEntry : sChrRacesStore) { if (!((1 << (raceEntry->RaceID - 1)) & RACEMASK_ALL_PLAYABLE)) continue; @@ -1146,7 +1146,7 @@ void ObjectMgr::LoadCreatureModelRace() raceData.creature_entry = fields[2].GetUInt32(); raceData.modelid_racial = fields[3].GetUInt32(); - if (!sDBCCreatureDisplayInfo.LookupEntry(raceData.modelid)) + if (!sCreatureDisplayInfoStore.LookupEntry(raceData.modelid)) { sLog.outErrorDb("Table `creature_model_race` has model for nonexistent model id (%u), skipping", raceData.modelid); continue; @@ -1198,7 +1198,7 @@ void ObjectMgr::LoadCreatureModelRace() } else if (raceData.modelid_racial) { - if (!sDBCCreatureDisplayInfo.LookupEntry(raceData.modelid_racial)) + if (!sCreatureDisplayInfoStore.LookupEntry(raceData.modelid_racial)) { sLog.outErrorDb("Table `creature_model_race` modelid %u has modelid_racial for nonexistent model id (%u), skipping", raceData.modelid, raceData.modelid_racial); continue; @@ -1448,7 +1448,7 @@ void ObjectMgr::LoadCreatures() data.spawnTemplate = GetCreatureSpawnTemplate(0); uint32 spawnDataEntry = fields[21].GetUInt32(); - MapEntry const* mapEntry = sDBCMap.LookupEntry(data.mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) { sLog.outErrorDb("Table `creature` have creature (GUID: %u) that spawned at nonexistent map (Id: %u), skipped.", guid, data.mapid); @@ -1485,7 +1485,7 @@ void ObjectMgr::LoadCreatures() continue; } - if (data.modelid_override > 0 && !sDBCCreatureDisplayInfo.LookupEntry(data.modelid_override)) + if (data.modelid_override > 0 && !sCreatureDisplayInfoStore.LookupEntry(data.modelid_override)) { sLog.outErrorDb("Table `creature` GUID %u (entry %u) has model for nonexistent model id (%u), set to 0.", guid, data.id, data.modelid_override); data.modelid_override = 0; @@ -1647,7 +1647,7 @@ void ObjectMgr::LoadGameObjects() continue; } - if (gInfo->displayId && !sDBCGameObjectDisplayInfo.LookupEntry(gInfo->displayId)) + if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) { sLog.outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) have invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); continue; @@ -1674,7 +1674,7 @@ void ObjectMgr::LoadGameObjects() data.GuidPoolId = fields[17].GetInt16(); data.EntryPoolId = fields[18].GetInt16(); - MapEntry const* mapEntry = sDBCMap.LookupEntry(data.mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) { sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) that spawned at nonexistent map (Id: %u), skip", guid, data.id, data.mapid); @@ -2006,7 +2006,7 @@ void ObjectMgr::LoadItemPrototypes() // check data correctness for (auto proto : sItemStorage) { - ItemEntry const* dbcitem = sDBCItem.LookupEntry(proto->ItemId); + ItemEntry const* dbcitem = sItemStore.LookupEntry(proto->ItemId); if (!proto) { /* to many errors, and possible not all items really used in game @@ -2303,7 +2303,7 @@ void ObjectMgr::LoadItemPrototypes() sLog.outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", proto->ItemId, proto->PageText); } - if (proto->LockID && !sDBCLock.LookupEntry(proto->LockID)) + if (proto->LockID && !sLockStore.LookupEntry(proto->LockID)) sLog.outErrorDb("Item (Entry: %u) has wrong LockID (%u)", proto->ItemId, proto->LockID); if (proto->Sheath >= MAX_SHEATHETYPE) @@ -2312,13 +2312,13 @@ void ObjectMgr::LoadItemPrototypes() const_cast(proto)->Sheath = SHEATHETYPE_NONE; } - if (proto->RandomProperty && !sDBCItemRandomProperties.LookupEntry(GetItemEnchantMod(proto->RandomProperty))) + if (proto->RandomProperty && !sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(proto->RandomProperty))) { sLog.outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", proto->ItemId, proto->RandomProperty); const_cast(proto)->RandomProperty = 0; } - if (proto->RandomSuffix && !sDBCItemRandomSuffix.LookupEntry(GetItemEnchantMod(proto->RandomSuffix))) + if (proto->RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(proto->RandomSuffix))) { sLog.outErrorDb("Item (Entry: %u) has wrong RandomSuffix (%u)", proto->ItemId, proto->RandomSuffix); const_cast(proto)->RandomSuffix = 0; @@ -2332,7 +2332,7 @@ void ObjectMgr::LoadItemPrototypes() const_cast(proto)->RandomSuffix = 0; } - if (proto->ItemSet && !sDBCItemSet.LookupEntry(proto->ItemSet)) + if (proto->ItemSet && !sItemSetStore.LookupEntry(proto->ItemSet)) { sLog.outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", proto->ItemId, proto->ItemSet); const_cast(proto)->ItemSet = 0; @@ -2341,7 +2341,7 @@ void ObjectMgr::LoadItemPrototypes() if (proto->Area && !TerrainManager::GetAreaEntryByAreaID(proto->Area)) sLog.outErrorDb("Item (Entry: %u) has wrong Area (%u)", proto->ItemId, proto->Area); - if (proto->Map && !sDBCMap.LookupEntry(proto->Map)) + if (proto->Map && !sMapStore.LookupEntry(proto->Map)) sLog.outErrorDb("Item (Entry: %u) has wrong Map (%u)", proto->ItemId, proto->Map); if (proto->BagFamily) @@ -2353,7 +2353,7 @@ void ObjectMgr::LoadItemPrototypes() if (!(proto->BagFamily & mask)) continue; - ItemBagFamilyEntry const* bf = sDBCItemBagFamily.LookupEntry(j + 1); + ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j + 1); if (!bf) { sLog.outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", proto->ItemId); @@ -2362,7 +2362,7 @@ void ObjectMgr::LoadItemPrototypes() } } - if (proto->TotemCategory && !sDBCTotemCategory.LookupEntry(proto->TotemCategory)) + if (proto->TotemCategory && !sTotemCategoryStore.LookupEntry(proto->TotemCategory)) sLog.outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", proto->ItemId, proto->TotemCategory); for (int j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j) @@ -2374,7 +2374,7 @@ void ObjectMgr::LoadItemPrototypes() } } - if (proto->GemProperties && !sDBCGemProperties.LookupEntry(proto->GemProperties)) + if (proto->GemProperties && !sGemPropertiesStore.LookupEntry(proto->GemProperties)) sLog.outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", proto->ItemId, proto->GemProperties); if (proto->RequiredDisenchantSkill < -1) @@ -2448,7 +2448,7 @@ void ObjectMgr::LoadItemPrototypes() // check some dbc referenced items (avoid duplicate reports) std::set notFoundOutfit; - for (auto entry : sDBCCharStartOutfit) + for (auto entry : sCharStartOutfitStore) { for (int j : entry->ItemId) { @@ -2718,14 +2718,14 @@ void ObjectMgr::LoadPlayerInfo() float positionZ = fields[6].GetFloat(); float orientation = fields[7].GetFloat(); - ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(current_race); + ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.", current_race); continue; } - ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(current_class); + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); if (!cEntry || !((1 << (current_class - 1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.", current_class); @@ -2739,7 +2739,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - if (sDBCMap.LookupEntry(mapId)->Instanceable()) + if (sMapStore.LookupEntry(mapId)->Instanceable()) { sLog.outErrorDb("Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); continue; @@ -2795,14 +2795,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt32(); uint32 current_class = fields[1].GetUInt32(); - ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(current_race); + ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race); continue; } - ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(current_class); + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); if (!cEntry || !((1 << (current_class - 1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class); @@ -2887,7 +2887,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - if (!sDBCSkillLine.LookupEntry(skill.SkillId)) + if (!sSkillLineStore.LookupEntry(skill.SkillId)) { sLog.outErrorDb("Non existing skill %u in `playercreateinfo_skills` table, ignoring.", skill.SkillId); continue; @@ -2920,7 +2920,7 @@ void ObjectMgr::LoadPlayerInfo() if (skill.Step) { const uint32 stepIndex = (skill.Step - 1); - SkillTiersEntry const* steps = sDBCSkillTiers.LookupEntry(entry->skillTierId); + SkillTiersEntry const* steps = sSkillTiersStore.LookupEntry(entry->skillTierId); if (!steps || !steps->maxSkillValue[stepIndex]) continue; @@ -2977,14 +2977,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt32(); uint32 current_class = fields[1].GetUInt32(); - ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(current_race); + ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race); continue; } - ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(current_class); + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); if (!cEntry || !((1 << (current_class - 1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class); @@ -3039,14 +3039,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt32(); uint32 current_class = fields[1].GetUInt32(); - ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(current_race); + ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race); continue; } - ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(current_class); + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); if (!cEntry || !((1 << (current_class - 1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class); @@ -3149,7 +3149,7 @@ void ObjectMgr::LoadPlayerInfo() for (int class_ = 0; class_ < MAX_CLASSES; ++class_) { // skip nonexistent classes - if (!sDBCChrClasses.LookupEntry(class_)) + if (!sChrClassesStore.LookupEntry(class_)) continue; PlayerClassInfo* pClassInfo = &playerClassInfo[class_]; @@ -3200,14 +3200,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt32(); uint32 current_class = fields[1].GetUInt32(); - ChrRacesEntry const* rEntry = sDBCChrRaces.LookupEntry(current_race); + ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); if (!rEntry || !((1 << (current_race - 1)) & RACEMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.", current_race); continue; } - ChrClassesEntry const* cEntry = sDBCChrClasses.LookupEntry(current_class); + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(current_class); if (!cEntry || !((1 << (current_class - 1)) & CLASSMASK_ALL_PLAYABLE)) { sLog.outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.", current_class); @@ -3252,13 +3252,13 @@ void ObjectMgr::LoadPlayerInfo() for (int race = 1; race < MAX_RACES; ++race) { // skip nonexistent races - if (!((1 << (race - 1)) & RACEMASK_ALL_PLAYABLE) || !sDBCChrRaces.LookupEntry(race)) + if (!((1 << (race - 1)) & RACEMASK_ALL_PLAYABLE) || !sChrRacesStore.LookupEntry(race)) continue; for (int class_ = 1; class_ < MAX_CLASSES; ++class_) { // skip nonexistent classes - if (!((1 << (class_ - 1)) & CLASSMASK_ALL_PLAYABLE) || !sDBCChrClasses.LookupEntry(class_)) + if (!((1 << (class_ - 1)) & CLASSMASK_ALL_PLAYABLE) || !sChrClassesStore.LookupEntry(class_)) continue; PlayerInfo* pInfo = &playerInfo[race][class_]; @@ -3689,7 +3689,7 @@ void ObjectMgr::LoadGroups() } } - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapId); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); if (!mapEntry || !mapEntry->IsDungeon()) { sLog.outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", mapId); @@ -3868,7 +3868,7 @@ void ObjectMgr::LoadQuests() // client quest log visual (sort case) if (qinfo->ZoneOrSort < 0) { - QuestSortEntry const* qSort = sDBCQuestSort.LookupEntry(-int32(qinfo->ZoneOrSort)); + QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort)); if (!qSort) { sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", @@ -3900,7 +3900,7 @@ void ObjectMgr::LoadQuests() // RequiredSkill, can be 0 if (qinfo->RequiredSkill) { - if (!sDBCSkillLine.LookupEntry(qinfo->RequiredSkill)) + if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkill)) { sLog.outErrorDb("Quest %u has `RequiredSkill` = %u but this skill does not exist", qinfo->GetQuestId(), qinfo->RequiredSkill); @@ -3974,7 +3974,7 @@ void ObjectMgr::LoadQuests() // warning } - if (qinfo->CharTitleId && !sDBCCharTitles.LookupEntry(qinfo->CharTitleId)) + if (qinfo->CharTitleId && !sCharTitlesStore.LookupEntry(qinfo->CharTitleId)) { sLog.outErrorDb("Quest %u has `CharTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId()); @@ -4290,7 +4290,7 @@ void ObjectMgr::LoadQuests() if (qinfo->RewMailTemplateId) { - if (!sDBCMailTemplate.LookupEntry(qinfo->RewMailTemplateId)) + if (!sMailTemplateStore.LookupEntry(qinfo->RewMailTemplateId)) { sLog.outErrorDb("Quest %u has `RewMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", qinfo->GetQuestId(), qinfo->RewMailTemplateId, qinfo->RewMailTemplateId); @@ -4567,7 +4567,7 @@ void ObjectMgr::LoadPetCreateSpells() continue; } - if (CreatureSpellDataEntry const* petSpellEntry = cInfo->PetSpellDataId ? sDBCCreatureSpellData.LookupEntry(cInfo->PetSpellDataId) : nullptr) + if (CreatureSpellDataEntry const* petSpellEntry = cInfo->PetSpellDataId ? sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId) : nullptr) { sLog.outErrorDb("Creature id %u listed in `petcreateinfo_spell` have set `PetSpellDataId` field and will use its instead, skip.", creature_id); continue; @@ -4630,7 +4630,7 @@ void ObjectMgr::LoadPetCreateSpells() uint32 dcount = 0; for (auto cInfo : sCreatureStorage) { - CreatureSpellDataEntry const* petSpellEntry = cInfo->PetSpellDataId ? sDBCCreatureSpellData.LookupEntry(cInfo->PetSpellDataId) : nullptr; + CreatureSpellDataEntry const* petSpellEntry = cInfo->PetSpellDataId ? sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId) : nullptr; if (!petSpellEntry) continue; @@ -4873,7 +4873,7 @@ void ObjectMgr::LoadInstanceTemplate() for (auto temp : sInstanceTemplate) { - MapEntry const* mapEntry = sDBCMap.LookupEntry(temp->map); + MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map); if (!mapEntry) { sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", temp->map); @@ -4891,7 +4891,7 @@ void ObjectMgr::LoadInstanceTemplate() if (temp->parent > 0) { // check existence - MapEntry const* parentEntry = sDBCMap.LookupEntry(temp->parent); + MapEntry const* parentEntry = sMapStore.LookupEntry(temp->parent); if (!parentEntry) { sLog.outErrorDb("ObjectMgr::LoadInstanceTemplate: bad parent map id %u for instance template %d template!", @@ -4948,7 +4948,7 @@ void ObjectMgr::LoadWorldTemplate() for (auto temp : sWorldTemplate) { - MapEntry const* mapEntry = sDBCMap.LookupEntry(temp->map); + MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map); if (!mapEntry) { sLog.outErrorDb("ObjectMgr::LoadWorldTemplate: bad mapid %d for template!", temp->map); @@ -5272,7 +5272,7 @@ void ObjectMgr::LoadQuestgiverGreeting() continue; } - if (!sDBCEmotes.LookupEntry(emoteId)) + if (!sEmotesStore.LookupEntry(emoteId)) { sLog.outErrorEventAI("Table questgiver_greeting entry %u type %u uses invalid emote %u. Skipping.", entry, type, emoteId); continue; @@ -5667,7 +5667,7 @@ void ObjectMgr::LoadQuestAreaTriggers() uint32 trigger_ID = fields[0].GetUInt32(); uint32 quest_ID = fields[1].GetUInt32(); - AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(trigger_ID); + AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(trigger_ID); if (!atEntry) { sLog.outErrorDb("Table `areatrigger_involvedrelation` has area trigger (ID: %u) not listed in `AreaTrigger.dbc`.", trigger_ID); @@ -5729,7 +5729,7 @@ void ObjectMgr::LoadTavernAreaTriggers() uint32 Trigger_ID = fields[0].GetUInt32(); - AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(Trigger_ID); + AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); if (!atEntry) { sLog.outErrorDb("Table `areatrigger_tavern` has area trigger (ID:%u) not listed in `AreaTrigger.dbc`.", Trigger_ID); @@ -5806,7 +5806,7 @@ void ObjectMgr::LoadTaxiShortcuts() uint32 takeoff = fields[1].GetUInt32(); uint32 landing = fields[2].GetUInt32(); - TaxiPathEntry const* path = sDBCTaxiPath.LookupEntry(pathid); + TaxiPathEntry const* path = sTaxiPathStore.LookupEntry(pathid); if (!path) { sLog.outErrorDb("Table `taxi_shortcuts` has a record for non-existent taxi path id %u, skipped.", pathid); @@ -5845,7 +5845,7 @@ uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, Te float dist = std::numeric_limits::max(); uint32 id = 0; - for (auto node : sDBCTaxiNodes) + for (auto node : sTaxiNodesStore) { if (node->map_id != mapid || !node->MountCreatureID[team == ALLIANCE ? 1 : 0]) continue; @@ -5906,7 +5906,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, Team team) const uint16 mount_entry = 0; // select mount creature id - TaxiNodesEntry const* node = sDBCTaxiNodes.LookupEntry(id); + TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id); if (node) { if (team == ALLIANCE) @@ -5995,7 +5995,7 @@ void ObjectMgr::LoadGraveyardZones() continue; } - if (linkKind == GRAVEYARD_MAPLINK && sDBCMap.LookupEntry(locId) == nullptr) + if (linkKind == GRAVEYARD_MAPLINK && sMapStore.LookupEntry(locId) == nullptr) { sLog.outErrorDb("Table `game_graveyard_zone` has record for nonexistent map id (%u), skipped.", locId); continue; @@ -6046,7 +6046,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyardHelper( // some where other WorldSafeLocsEntry const* entryFar = nullptr; - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapId); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); for (GraveYardMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) { @@ -6314,7 +6314,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() at.conditionId = fields[13].GetUInt32(); at.status_failed_text = fields[14].GetCppString(); - AreaTriggerEntry const* atEntry = sDBCAreaTrigger.LookupEntry(at.entry); + AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(at.entry); if (!atEntry) { sLog.outErrorDb("Table `areatrigger_teleport` has area trigger (ID:%u) not listed in `AreaTrigger.dbc`.", at.entry); @@ -6388,7 +6388,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() sLog.outErrorDb("Table `areatrigger_teleport` entry %u has `ConditionId` = %u but does not exist.", at.entry, at.conditionId); } - MapEntry const* mapEntry = sDBCMap.LookupEntry(at.target_mapId); + MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId); if (!mapEntry) { sLog.outErrorDb("Table `areatrigger_teleport` has nonexistent target map (ID: %u) for Area trigger (ID:%u).", at.target_mapId, at.entry); @@ -6416,7 +6416,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() */ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const { - const MapEntry* mapEntry = sDBCMap.LookupEntry(map_id); + const MapEntry* mapEntry = sMapStore.LookupEntry(map_id); if (!mapEntry || mapEntry->ghost_entrance_map < 0) return nullptr; @@ -6429,7 +6429,7 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const { ghostTrigger.push_back(&mAreaTrigger.second); // First run, only consider AreaTrigger that teleport in the proper map - if ((!compareTrigger || mAreaTrigger.second.IsLessOrEqualThan(compareTrigger)) && sDBCAreaTrigger.LookupEntry(mAreaTrigger.first)->mapid == map_id) + if ((!compareTrigger || mAreaTrigger.second.IsLessOrEqualThan(compareTrigger)) && sAreaTriggerStore.LookupEntry(mAreaTrigger.first)->mapid == map_id) { if (mAreaTrigger.second.IsMinimal()) return &mAreaTrigger.second; @@ -6462,7 +6462,7 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const AreaTrigger const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const { AreaTrigger const* compareTrigger = nullptr; - MapEntry const* mEntry = sDBCMap.LookupEntry(Map); + MapEntry const* mEntry = sMapStore.LookupEntry(Map); for (const auto& mAreaTrigger : mAreaTriggers) { @@ -6741,7 +6741,7 @@ struct SQLGameObjectLoader : public SQLStorageLoaderBase ObjectMgr::LoadGameobjectInfo() { if (goInfo->spellFocus.focusId) { - if (!sDBCSpellFocusObject.LookupEntry(goInfo->spellFocus.focusId)) + if (!sSpellFocusObjectStore.LookupEntry(goInfo->spellFocus.focusId)) sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.", goInfo->id, goInfo->type, goInfo->spellFocus.focusId, goInfo->spellFocus.focusId); } @@ -8303,7 +8303,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min data.Emote = fields[13].GetUInt32(); uint32 broadcastTextId = fields[14].GetUInt32(); - if (data.SoundId && !sDBCSoundEntries.LookupEntry(data.SoundId)) + if (data.SoundId && !sSoundEntriesStore.LookupEntry(data.SoundId)) { _DoStringError(entry, "Entry %i in table `%s` has soundId %u but sound does not exist.", entry, table, data.SoundId); data.SoundId = 0; @@ -8321,7 +8321,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min data.Type = CHAT_TYPE_SAY; } - if (data.Emote && !sDBCEmotes.LookupEntry(data.Emote)) + if (data.Emote && !sEmotesStore.LookupEntry(data.Emote)) { _DoStringError(entry, "Entry %i in table `%s` has Emote %u but emote does not exist.", entry, table, data.Emote); data.Emote = EMOTE_ONESHOT_NONE; @@ -8643,7 +8643,7 @@ void ObjectMgr::LoadMailLevelRewards() continue; } - if (!sDBCMailTemplate.LookupEntry(mailTemplateId)) + if (!sMailTemplateStore.LookupEntry(mailTemplateId)) { sLog.outErrorDb("Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level); continue; @@ -9381,7 +9381,7 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32 return false; } - if (ExtendedCost && !sDBCItemExtendedCost.LookupEntry(ExtendedCost)) + if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost)) { if (pl) ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost); @@ -9928,7 +9928,7 @@ char const* ObjectMgr::GetPetName(uint32 petfamily, uint32 dbclang) { if (!petfamily) return nullptr; - CreatureFamilyEntry const* pet_family = sDBCCreatureFamily.LookupEntry(petfamily); + CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(petfamily); if (!pet_family) return nullptr; return pet_family->Name[dbclang] ? pet_family->Name[dbclang] : nullptr; diff --git a/src/game/Groups/Group.cpp b/src/game/Groups/Group.cpp index 22ec998db8e..036470e54fe 100644 --- a/src/game/Groups/Group.cpp +++ b/src/game/Groups/Group.cpp @@ -1259,7 +1259,7 @@ void Group::ResetInstances(InstanceResetMethod method, Player* SendMsgTo) for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { DungeonPersistentState* state = itr->second.state; - const MapEntry* entry = sDBCMap.LookupEntry(itr->first); + const MapEntry* entry = sMapStore.LookupEntry(itr->first); if (!entry || (!state->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)) { ++itr; @@ -1329,7 +1329,7 @@ void Group::ResetInstances(InstanceResetMethod method, Player* SendMsgTo) InstanceGroupBind* Group::GetBoundInstance(uint32 mapid) { - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); if (!mapEntry) return nullptr; @@ -1486,8 +1486,8 @@ void Group::RewardGroupAtKill(Unit* pVictim, Player* player_tap) uint32 xp = (PvP || !not_gray_member_with_max_level || pVictim->GetTypeId() != TYPEID_UNIT) ? 0 : MaNGOS::XP::Gain(not_gray_member_with_max_level, static_cast(pVictim)); /// skip in check PvP case (for speed, not used) - bool is_raid = PvP ? false : sDBCMap.LookupEntry(pVictim->GetMapId())->IsRaid() && isRaidGroup(); - bool is_dungeon = PvP ? false : sDBCMap.LookupEntry(pVictim->GetMapId())->IsDungeon(); + bool is_raid = PvP ? false : sMapStore.LookupEntry(pVictim->GetMapId())->IsRaid() && isRaidGroup(); + bool is_dungeon = PvP ? false : sMapStore.LookupEntry(pVictim->GetMapId())->IsDungeon(); float group_rate = MaNGOS::XP::xp_in_group_rate(count, is_raid); for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index 7778cdcd705..7901ae1e6c0 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -1211,7 +1211,7 @@ void Loot::Release(Player* player) float chance_rate = sWorld.getConfig(CONFIG_FLOAT_RATE_MINING_NEXT); int32 ReqValue = 175; - LockEntry const* lockInfo = sDBCLock.LookupEntry(go->GetGOInfo()->chest.lockId); + LockEntry const* lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId); if (lockInfo) ReqValue = lockInfo->Skill[0]; float skill = float(player->GetSkillValue(SKILL_MINING)) / (ReqValue + 25); @@ -2679,7 +2679,7 @@ void LoadLootTemplates_Fishing() LootTemplates_Fishing.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (auto areaEntry : sDBCAreaTable) + for (auto areaEntry : sAreaTableStore) { if (ids_set.find(areaEntry->ID) != ids_set.end()) ids_set.erase(areaEntry->ID); @@ -2786,7 +2786,7 @@ void LoadLootTemplates_Mail() LootTemplates_Mail.LoadAndCollectLootIds(ids_set); // remove real entries and check existence loot - for (auto mailEntry : sDBCMailTemplate) + for (auto mailEntry : sMailTemplateStore) if (ids_set.find(mailEntry->ID) != ids_set.end()) ids_set.erase(mailEntry->ID); diff --git a/src/game/Mails/MailHandler.cpp b/src/game/Mails/MailHandler.cpp index c64644ab788..1021180ce8e 100644 --- a/src/game/Mails/MailHandler.cpp +++ b/src/game/Mails/MailHandler.cpp @@ -728,7 +728,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recv_data) // in mail template case we need create new item text if (!itemTextId) { - MailTemplateEntry const* mailTemplateEntry = sDBCMailTemplate.LookupEntry(m->mailTemplateId); + MailTemplateEntry const* mailTemplateEntry = sMailTemplateStore.LookupEntry(m->mailTemplateId); if (!mailTemplateEntry) { pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR); diff --git a/src/game/Maps/GridMap.cpp b/src/game/Maps/GridMap.cpp index d1535d26a5d..958711b3eac 100644 --- a/src/game/Maps/GridMap.cpp +++ b/src/game/Maps/GridMap.cpp @@ -558,14 +558,14 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re int idx = (x_int >> 3) * 16 + (y_int >> 3); uint8 type = m_liquidFlags ? m_liquidFlags[idx] : m_liquidGlobalFlags; uint32 entry = m_liquidEntry ? m_liquidEntry[idx] : m_liquidGlobalEntry; - if (LiquidTypeEntry const* liquidEntry = sDBCLiquidType.LookupEntry(entry)) + if (LiquidTypeEntry const* liquidEntry = sLiquidTypeStore.LookupEntry(entry)) { entry = liquidEntry->Id; type &= MAP_LIQUID_TYPE_DEEP_WATER; uint32 liqTypeIdx = liquidEntry->Type; if (entry < 21) { - if (AreaTableEntry const* area = sDBCAreaTable.LookupEntry(getArea(x, y))) + if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(getArea(x, y))) { uint32 overrideLiquid = area->LiquidTypeOverride[entry - 1]; if (!overrideLiquid && area->zone) @@ -575,7 +575,7 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re overrideLiquid = area->LiquidTypeOverride[entry - 1]; } - if (LiquidTypeEntry const* liq = sDBCLiquidType.LookupEntry(overrideLiquid)) + if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid)) { entry = overrideLiquid; liqTypeIdx = liq->Type; @@ -992,7 +992,7 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint if (data) { uint32 liquidFlagType = 0; - if (LiquidTypeEntry const* liq = sDBCLiquidType.LookupEntry(liquid_type)) + if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquid_type)) liquidFlagType = liq->Type; if (liquid_type && liquid_type < 21) @@ -1007,7 +1007,7 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint overrideLiquid = area->LiquidTypeOverride[liquid_type - 1]; } - if (LiquidTypeEntry const* liq = sDBCLiquidType.LookupEntry(overrideLiquid)) + if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid)) { liquid_type = overrideLiquid; liquidFlagType = liq->Type; @@ -1190,7 +1190,7 @@ GridMap* TerrainInfo::LoadMapAndVMap(const uint32 x, const uint32 y, bool mapOnl if (!VMAP::VMapFactory::createOrGetVMapManager()->IsTileLoaded(m_mapId, x, y)) { // load VMAPs for current map/grid... - const MapEntry* i_mapEntry = sDBCMap.LookupEntry(m_mapId); + const MapEntry* i_mapEntry = sMapStore.LookupEntry(m_mapId); const char* mapName = i_mapEntry ? i_mapEntry->name[sWorld.GetDefaultDbcLocale()] : "UNNAMEDMAP\x0"; int vmapLoadResult = VMAP::VMapFactory::createOrGetVMapManager()->loadMap((sWorld.GetDataPath() + "vmaps").c_str(), m_mapId, x, y); @@ -1343,7 +1343,7 @@ int32 TerrainManager::GetAreaFlagByAreaID(uint32 area_id) uint32 TerrainManager::GetAreaIdByLocalizedName(const std::string& name) { - for (auto areaEntry : sDBCAreaTable) + for (auto areaEntry : sAreaTableStore) { for (uint32 i = 0; i < MAX_LOCALE; ++i) { @@ -1368,15 +1368,15 @@ AreaTableEntry const* TerrainManager::GetAreaEntryByAreaID(uint32 area_id) if (areaflag < 0) return nullptr; - return sDBCAreaTable.LookupEntry(areaflag); + return sAreaTableStore.LookupEntry(areaflag); } AreaTableEntry const* TerrainManager::GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id) { if (area_flag) - return sDBCAreaTable.LookupEntry(area_flag); + return sAreaTableStore.LookupEntry(area_flag); - if (MapEntry const* mapEntry = sDBCMap.LookupEntry(map_id)) + if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id)) return GetAreaEntryByAreaID(mapEntry->linked_zone); return nullptr; diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index e7190b315b1..fcb38ab4b73 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -143,7 +143,7 @@ void Map::LoadMapAndVMap(int gx, int gy) } Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode) - : i_mapEntry(sDBCMap.LookupEntry(id)), i_spawnMode(SpawnMode), + : i_mapEntry(sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0), m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE), m_persistentState(nullptr), m_activeNonPlayersIter(m_activeNonPlayers.end()), m_onEventNotifiedIter(m_onEventNotifiedObjects.end()), @@ -2600,7 +2600,7 @@ void Map::RemoveFromSpawnCount(const ObjectGuid& guid) bool Map::MapCoordinateVsZoneCheck(float x, float y, uint32 mapid, uint32 zone) { - WorldMapAreaEntry const* WmaEntry = sDBCWorldMapArea.LookupEntry(zone); + WorldMapAreaEntry const* WmaEntry = sWorldMapAreaStore.LookupEntry(zone); if (WmaEntry && mapid == WmaEntry->map_id && x >= WmaEntry->x2 && x <= WmaEntry->x1 && y >= WmaEntry->y2 && y <= WmaEntry->y1) return true; @@ -2609,7 +2609,7 @@ bool Map::MapCoordinateVsZoneCheck(float x, float y, uint32 mapid, uint32 zone) bool Map::Zone2MapCoordinates(float& x, float& y, uint32 zone) { - WorldMapAreaEntry const* maEntry = sDBCWorldMapArea.LookupEntry(zone); + WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); // if not listed then map coordinates (instance) if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1) @@ -2624,7 +2624,7 @@ bool Map::Zone2MapCoordinates(float& x, float& y, uint32 zone) bool Map::Map2ZoneCoordinates(float& x, float& y, uint32 zone) { - WorldMapAreaEntry const* maEntry = sDBCWorldMapArea.LookupEntry(zone); + WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); // if not listed then map coordinates (instance) if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1) @@ -2687,7 +2687,7 @@ uint32 Map::GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId) if (mapid != 530) // speed for most cases return mapid; - if (WorldMapAreaEntry const* wma = sDBCWorldMapArea.LookupEntry(zoneId)) + if (WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId)) return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id; return mapid; @@ -2699,7 +2699,7 @@ ContentLevels Map::GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) if (mapid < 2) return CONTENT_1_60; - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); if (!mapEntry) return CONTENT_1_60; diff --git a/src/game/Maps/MapManager.cpp b/src/game/Maps/MapManager.cpp index 7e2ace4c109..62bd659387f 100644 --- a/src/game/Maps/MapManager.cpp +++ b/src/game/Maps/MapManager.cpp @@ -114,7 +114,7 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj) Map* m = nullptr; - const MapEntry* entry = sDBCMap.LookupEntry(id); + const MapEntry* entry = sMapStore.LookupEntry(id); if (!entry) return nullptr; @@ -242,7 +242,7 @@ bool MapManager::ExistMapAndVMap(uint32 mapid, float x, float y) bool MapManager::IsValidMAP(uint32 mapid) { - MapEntry const* mEntry = sDBCMap.LookupEntry(mapid); + MapEntry const* mEntry = sMapStore.LookupEntry(mapid); return mEntry && (!mEntry->IsDungeon() || ObjectMgr::GetInstanceTemplate(mapid)); // TODO: add check for battleground template } @@ -310,7 +310,7 @@ Map* MapManager::CreateInstance(uint32 id, Player* player) Map* map = nullptr; Map* pNewMap = nullptr; uint32 NewInstanceId = 0; // instanceId of the resulting map - const MapEntry* entry = sDBCMap.LookupEntry(id); + const MapEntry* entry = sMapStore.LookupEntry(id); if (entry->IsBattleGroundOrArena()) { @@ -352,7 +352,7 @@ Map* MapManager::CreateInstance(uint32 id, Player* player) DungeonMap* MapManager::CreateDungeonMap(uint32 id, uint32 InstanceId, Difficulty difficulty, DungeonPersistentState* save) { // make sure we have a valid map id - const MapEntry* entry = sDBCMap.LookupEntry(id); + const MapEntry* entry = sMapStore.LookupEntry(id); if (!entry) { sLog.outError("CreateDungeonMap: no entry for map %d", id); diff --git a/src/game/Maps/MapPersistentStateMgr.cpp b/src/game/Maps/MapPersistentStateMgr.cpp index c38f2394b74..4fc3c4b49b2 100644 --- a/src/game/Maps/MapPersistentStateMgr.cpp +++ b/src/game/Maps/MapPersistentStateMgr.cpp @@ -56,7 +56,7 @@ MapPersistentState::~MapPersistentState() MapEntry const* MapPersistentState::GetMapEntry() const { - return sDBCMap.LookupEntry(m_mapid); + return sMapStore.LookupEntry(m_mapid); } /* true if the instance state is still valid */ @@ -281,7 +281,7 @@ InstanceTemplate const* DungeonPersistentState::GetTemplate() const time_t DungeonPersistentState::GetResetTimeForDB() const { // only state the reset time for normal instances - const MapEntry* entry = sDBCMap.LookupEntry(GetMapId()); + const MapEntry* entry = sMapStore.LookupEntry(GetMapId()); if (!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC) return 0; return GetResetTime(); @@ -362,7 +362,7 @@ void DungeonResetScheduler::LoadResetTimes() uint32 id = (*result)[0].GetUInt32(); uint32 mapid = (*result)[1].GetUInt32(); - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); if (!mapEntry || !mapEntry->IsDungeon()) { @@ -406,7 +406,7 @@ void DungeonResetScheduler::LoadResetTimes() // load the global respawn times for raid/heroic instances uint32 diff = sWorld.getConfig(CONFIG_UINT32_INSTANCE_RESET_TIME_HOUR) * HOUR; - m_resetTimeByMapId.resize(sDBCMap.GetMaxEntry()); + m_resetTimeByMapId.resize(sMapStore.GetMaxEntry()); result = CharacterDatabase.Query("SELECT mapid, resettime FROM instance_reset"); if (result) { @@ -416,7 +416,7 @@ void DungeonResetScheduler::LoadResetTimes() uint32 mapid = fields[0].GetUInt32(); - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); if (!mapEntry || !mapEntry->IsDungeon() || !ObjectMgr::GetInstanceTemplate(mapid)) { @@ -446,7 +446,7 @@ void DungeonResetScheduler::LoadResetTimes() for (auto temp : sInstanceTemplate) { // only raid/heroic maps have a global reset time - MapEntry const* mapEntry = sDBCMap.LookupEntry(temp->map); + MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map); if (!mapEntry || !mapEntry->IsDungeon() || !mapEntry->HasResetTime()) continue; @@ -894,7 +894,7 @@ struct MapPersistantStateWarnWorker void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLeft) { // global reset for all instances of the given map - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); if (!mapEntry->IsDungeon()) return; @@ -972,7 +972,7 @@ void MapPersistentStateManager::_CleanupExpiredInstancesAtTime(time_t t) void MapPersistentStateManager::InitWorldMaps() { MapPersistentState* state = nullptr; // need any from created for shared pool state - for (auto entry : sDBCMap) + for (auto entry : sMapStore) if (!entry->Instanceable()) state = AddPersistentState(entry, 0, REGULAR_DIFFICULTY, 0, false, false); } @@ -1014,7 +1014,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes() if (!data) continue; - MapEntry const* mapEntry = sDBCMap.LookupEntry(data->mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid); if (!mapEntry) continue; @@ -1086,7 +1086,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes() if (!data) continue; - MapEntry const* mapEntry = sDBCMap.LookupEntry(data->mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid); if (!mapEntry) continue; diff --git a/src/game/Maps/MapPersistentStateMgr.h b/src/game/Maps/MapPersistentStateMgr.h index 2d48c11b7c5..525bfd62374 100644 --- a/src/game/Maps/MapPersistentStateMgr.h +++ b/src/game/Maps/MapPersistentStateMgr.h @@ -378,7 +378,7 @@ class MapPersistentStateManager : public MaNGOS::Singleton inline void MapPersistentStateManager::DoForAllStatesWithMapId(uint32 mapId, Do& _do) { - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapId); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); if (!mapEntry) return; diff --git a/src/game/Maps/TransportMgr.cpp b/src/game/Maps/TransportMgr.cpp index 4e6eafa3291..48d34caf860 100644 --- a/src/game/Maps/TransportMgr.cpp +++ b/src/game/Maps/TransportMgr.cpp @@ -27,7 +27,7 @@ void TransportMgr::LoadTransportAnimationAndRotation() { - for (auto anim : sDBCTransportAnimation) + for (auto anim : sTransportAnimationStore) AddPathNodeToTransport(anim->TransportEntry, anim->TimeSeg, anim); } @@ -126,12 +126,12 @@ bool TransportMgr::GenerateWaypoints(GameObjectInfo const* goinfo, TransportTemp if (transportTemplate.mapsUsed.size() > 1) { for (const auto itr : transportTemplate.mapsUsed) - MANGOS_ASSERT(!sDBCMap.LookupEntry(itr)->Instanceable()); + MANGOS_ASSERT(!sMapStore.LookupEntry(itr)->Instanceable()); transportTemplate.inInstance = false; } else - transportTemplate.inInstance = sDBCMap.LookupEntry(*transportTemplate.mapsUsed.begin())->Instanceable(); + transportTemplate.inInstance = sMapStore.LookupEntry(*transportTemplate.mapsUsed.begin())->Instanceable(); // last to first is always "teleport", even for closed paths keyFrames.back().Teleport = true; diff --git a/src/game/MotionGenerators/MovementHandler.cpp b/src/game/MotionGenerators/MovementHandler.cpp index 590a59e7eee..739479d267a 100644 --- a/src/game/MotionGenerators/MovementHandler.cpp +++ b/src/game/MotionGenerators/MovementHandler.cpp @@ -67,7 +67,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() } // get the destination map entry, not the current one, this will fix homebind and reset greeting - MapEntry const* mEntry = sDBCMap.LookupEntry(loc.mapid); + MapEntry const* mEntry = sMapStore.LookupEntry(loc.mapid); Map* map = nullptr; diff --git a/src/game/MotionGenerators/TargetedMovementGenerator.cpp b/src/game/MotionGenerators/TargetedMovementGenerator.cpp index 47fce262c42..7fac4b5c169 100644 --- a/src/game/MotionGenerators/TargetedMovementGenerator.cpp +++ b/src/game/MotionGenerators/TargetedMovementGenerator.cpp @@ -728,7 +728,7 @@ bool FollowMovementGenerator::IsBoostAllowed(Unit& owner) const return false; // Do not allow speed boosting when in pvp instances - if (const MapEntry* map = sDBCMap.LookupEntry(owner.GetMapId())) + if (const MapEntry* map = sMapStore.LookupEntry(owner.GetMapId())) if (map->IsBattleGroundOrArena()) return false; diff --git a/src/game/PlayerBot/Base/PlayerbotAI.cpp b/src/game/PlayerBot/Base/PlayerbotAI.cpp index daa2af2acf6..4b0a7cabb7a 100644 --- a/src/game/PlayerBot/Base/PlayerbotAI.cpp +++ b/src/game/PlayerBot/Base/PlayerbotAI.cpp @@ -367,7 +367,7 @@ uint32 PlayerbotAI::initSpell(uint32 spellId) // Add spell to spellrange map Spell* spell = new Spell(m_bot, pSpellInfo, false); - SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(pSpellInfo->rangeIndex); + SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(pSpellInfo->rangeIndex); float range = GetSpellMaxRange(srange); if (Player* modOwner = m_bot->GetSpellModOwner()) modOwner->ApplySpellMod(pSpellInfo->Id, SPELLMOD_RANGE, range, spell); @@ -3962,7 +3962,7 @@ void PlayerbotAI::DoLoot() // check skill or lock on object uint32 lockId = go->GetGOInfo()->GetLockId(); - LockEntry const* lockInfo = sDBCLock.LookupEntry(lockId); + LockEntry const* lockInfo = sLockStore.LookupEntry(lockId); if (lockInfo) for (int i = 0; i < 8; ++i) { @@ -4503,7 +4503,7 @@ uint32 PlayerbotAI::EstRepair(uint16 pos) { ItemPrototype const* ditemProto = item->GetProto(); - DurabilityCostsEntry const* dcost = sDBCDurabilityCosts.LookupEntry(ditemProto->ItemLevel); + DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); if (!dcost) { sLog.outError("RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); @@ -4511,7 +4511,7 @@ uint32 PlayerbotAI::EstRepair(uint16 pos) } uint32 dQualitymodEntryId = (ditemProto->Quality + 1) * 2; - DurabilityQualityEntry const* dQualitymodEntry = sDBCDurabilityQuality.LookupEntry(dQualitymodEntryId); + DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { sLog.outError("RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); @@ -5423,7 +5423,7 @@ bool PlayerbotAI::In_Range(Unit* Target, uint32 spellId) if (!pSpellInfo) return false; - SpellRangeEntry const* TempRange = sDBCSpellRange.LookupEntry(pSpellInfo->rangeIndex); + SpellRangeEntry const* TempRange = sSpellRangeStore.LookupEntry(pSpellInfo->rangeIndex); //Spell has invalid range store so we can't use it if (!TempRange) @@ -5534,7 +5534,7 @@ SpellCastResult PlayerbotAI::CastSpell(uint32 spellId) float CastTime = 0.0f; // stop movement to prevent cancel spell casting - SpellCastTimesEntry const* castTimeEntry = sDBCSpellCastTimes.LookupEntry(pSpellInfo->CastingTimeIndex); + SpellCastTimesEntry const* castTimeEntry = sSpellCastTimesStore.LookupEntry(pSpellInfo->CastingTimeIndex); // stop movement to prevent cancel spell casting if (castTimeEntry && castTimeEntry->CastTime) { @@ -6319,7 +6319,7 @@ void PlayerbotAI::MakeItemLink(const Item* item, std::ostringstream& out, bool I uint32 eId = item->GetEnchantmentId(EnchantmentSlot(slot)); if (!eId) continue; - SpellItemEnchantmentEntry const* entry = sDBCSpellItemEnchantment.LookupEntry(eId); + SpellItemEnchantmentEntry const* entry = sSpellItemEnchantmentStore.LookupEntry(eId); if (!entry) continue; switch (slot - SOCK_ENCHANTMENT_SLOT) @@ -7142,7 +7142,7 @@ void PlayerbotAI::UseItem(Item* item, uint32 targetFlag, ObjectGuid targetGUID) return; } - SpellCastTimesEntry const* castingTimeEntry = sDBCSpellCastTimes.LookupEntry(spellInfo->CastingTimeIndex); + SpellCastTimesEntry const* castingTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex); if (!castingTimeEntry) { TellMaster("Can't find casting time entry for spell %u with index %u", spellId, spellInfo->CastingTimeIndex); @@ -7682,7 +7682,7 @@ bool PlayerbotAI::RemoveAuction(const uint32 auctionid) return false; } - auction->auctionHouseEntry = sDBCAuctionHouse.LookupEntry(houseid); + auction->auctionHouseEntry = sAuctionHouseStore.LookupEntry(houseid); // Attempt send item back to owner std::ostringstream msgAuctionCanceledOwner; @@ -9505,9 +9505,9 @@ void PlayerbotAI::_HandleCommandTalent(std::string& text, Player& fromPlayer) uint32 talentTabId = talentTabIds[i]; uint32 classMask = m_bot->getClassMask(); - for (auto talentInfo : sDBCTalent) + for (auto talentInfo : sTalentStore) { - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -9532,7 +9532,7 @@ void PlayerbotAI::_HandleCommandTalent(std::string& text, Player& fromPlayer) // Check if it requires another previous talent if (talentInfo->DependsOn > 0) { - if (TalentEntry const* depTalentInfo = sDBCTalent.LookupEntry(talentInfo->DependsOn)) + if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) { bool hasEnoughRank = false; for (int dor = talentInfo->DependsOnRank; dor < MAX_TALENT_RANK; ++dor) @@ -9557,7 +9557,7 @@ void PlayerbotAI::_HandleCommandTalent(std::string& text, Player& fromPlayer) uint32 tTab = talentInfo->TalentTab; if (talentInfo->Row > 0) { - for (auto tmpTalent : sDBCTalent) // Loop through all talents. + for (auto tmpTalent : sTalentStore) // Loop through all talents. { // Someday, someone needs to revamp if (tmpTalent->TalentTab == tTab) @@ -10009,11 +10009,11 @@ void PlayerbotAI::_HandleCommandEnchant(std::string& text, Player& fromPlayer) ChatHandler ch(&fromPlayer); for (std::list::iterator it = m_spellsToLearn.begin(); it != m_spellsToLearn.end(); ++it) { - SkillLineEntry const* SkillLine = sDBCSkillLine.LookupEntry(*it); + SkillLineEntry const* SkillLine = sSkillLineStore.LookupEntry(*it); if (SkillLine->categoryId == SKILL_CATEGORY_PROFESSION && *it == SKILL_ENCHANTING) { - for (auto SkillAbility : sDBCSkillLineAbility) + for (auto SkillAbility : sSkillLineAbilityStore) { SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(SkillAbility->spellId); if (!spellInfo) @@ -10203,11 +10203,11 @@ void PlayerbotAI::_HandleCommandCraft(std::string& text, Player& fromPlayer) ChatHandler ch(&fromPlayer); for (std::list::iterator it = m_spellsToLearn.begin(); it != m_spellsToLearn.end(); ++it) { - SkillLineEntry const* skillLine = sDBCSkillLine.LookupEntry(*it); + SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(*it); if (skillLine->categoryId == category && *it == skill) { - for (auto skillAbility : sDBCSkillLineAbility) + for (auto skillAbility : sSkillLineAbilityStore) { SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillAbility->spellId); if (!spellInfo) @@ -10930,7 +10930,7 @@ void PlayerbotAI::_HandleCommandSkill(std::string& text, Player& fromPlayer) for (std::list::iterator it = m_spellsToLearn.begin(); it != m_spellsToLearn.end(); ++it) { if (IsPrimaryProfessionSkill(*it)) - for (auto skillLine : sDBCSkillLineAbility) + for (auto skillLine : sSkillLineAbilityStore) { // has skill if (skillLine->skillId == *it && skillLine->learnOnGetSkill == 0) @@ -10956,11 +10956,11 @@ void PlayerbotAI::_HandleCommandSkill(std::string& text, Player& fromPlayer) msg << "\nMy Weapon skills: "; for (std::list::iterator it = m_spellsToLearn.begin(); it != m_spellsToLearn.end(); ++it) { - SkillLineEntry const* SkillLine = sDBCSkillLine.LookupEntry(*it); + SkillLineEntry const* SkillLine = sSkillLineStore.LookupEntry(*it); // has weapon skill if (SkillLine->categoryId == SKILL_CATEGORY_WEAPON) { - for (auto skillLine : sDBCSkillLineAbility) + for (auto skillLine : sSkillLineAbilityStore) { SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); if (!spellInfo) diff --git a/src/game/PlayerBot/Base/PlayerbotClassAI.cpp b/src/game/PlayerBot/Base/PlayerbotClassAI.cpp index 615f1a289f0..7dba41f0e60 100644 --- a/src/game/PlayerBot/Base/PlayerbotClassAI.cpp +++ b/src/game/PlayerBot/Base/PlayerbotClassAI.cpp @@ -404,7 +404,7 @@ bool PlayerbotClassAI::FleeFromAoEIfCan(uint32 spellId, Unit* pTarget) float radius = 0; SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); if (spellproto) - radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spellproto->EffectRadiusIndex[EFFECT_INDEX_0])); + radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[EFFECT_INDEX_0])); // Step 2: Get current bot position to move from it float curr_x, curr_y, curr_z; @@ -465,7 +465,7 @@ bool PlayerbotClassAI::FleeFromNpcWithAuraIfCan(uint32 NpcEntry, uint32 spellId, float radius = 0; SpellEntry const* spellproto = sSpellTemplate.LookupEntry(spellId); if (spellproto) - radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spellproto->EffectRadiusIndex[EFFECT_INDEX_0])); + radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[EFFECT_INDEX_0])); if (radius == 0) return false; diff --git a/src/game/PlayerBot/Base/PlayerbotMgr.cpp b/src/game/PlayerBot/Base/PlayerbotMgr.cpp index 039a5de8ce1..062a0f0de4d 100644 --- a/src/game/PlayerBot/Base/PlayerbotMgr.cpp +++ b/src/game/PlayerBot/Base/PlayerbotMgr.cpp @@ -995,9 +995,9 @@ uint32 Player::GetSpec() Player* player = m_session->GetPlayer(); uint32 classMask = player->getClassMask(); - for (auto talentInfo : sDBCTalent) + for (auto talentInfo : sTalentStore) { - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; diff --git a/src/game/Pools/PoolManager.cpp b/src/game/Pools/PoolManager.cpp index 58d9c84073c..01cc9f00016 100644 --- a/src/game/Pools/PoolManager.cpp +++ b/src/game/Pools/PoolManager.cpp @@ -567,7 +567,7 @@ struct PoolMapChecker bool CheckAndRemember(uint32 mapid, uint32 pool_id, char const* tableName, char const* elementName) { - MapEntry const* mapEntry = sDBCMap.LookupEntry(mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); if (!mapEntry) return false; diff --git a/src/game/Quests/QuestDef.cpp b/src/game/Quests/QuestDef.cpp index d83328f6362..0032b26ecac 100644 --- a/src/game/Quests/QuestDef.cpp +++ b/src/game/Quests/QuestDef.cpp @@ -230,7 +230,7 @@ uint32 Quest::GetCharTitleBitIndex() const { if (!CharTitleId) return 0; - CharTitlesEntry const* titleEntry = sDBCCharTitles.LookupEntry(CharTitleId); + CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(CharTitleId); return titleEntry ? titleEntry->bit_index : 0; } diff --git a/src/game/Server/SQLStorages.cpp b/src/game/Server/SQLStorages.cpp index e75fd59fb6a..7dd36aa8e05 100644 --- a/src/game/Server/SQLStorages.cpp +++ b/src/game/Server/SQLStorages.cpp @@ -148,82 +148,82 @@ const char TotemCategoryfmt[] = "nwwwwwwwwwwwwwwwwwii"; const char WorldMapAreafmt[] = "diiwffffi"; const char WMOAreaTablefmt[] = "niiiwwwwwiiwwwwwwwwwwwwwwwww"; -SQLStorage sDBCAreaTable(AreaTablefmt, "dbc_areatable"); -SQLStorage sDBCAreaTrigger(AreaTriggerfmt, "dbc_areatrigger"); -SQLStorage sDBCAuctionHouse(AuctionHousefmt, "dbc_auctionhouse"); -SQLStorage sDBCBankBagSlotPrices(BankBagSlotPricesfmt, "dbc_bankbagslotprices"); -SQLStorage sDBCBattlemasterList(BattlemasterListfmt, "dbc_battlemasterlist"); -SQLStorage sDBCCharStartOutfit(CharStartOutfitfmt, "dbc_charstartoutfit"); -SQLStorage sDBCCharTitles(CharTitlesfmt, "dbc_chartitles"); -SQLStorage sDBCChatChannels(ChatChannelsfmt, "dbc_chatchannels"); -SQLStorage sDBCChrClasses(ChrClassesfmt, "dbc_chrclasses"); -SQLStorage sDBCChrRaces(ChrRacesfmt, "dbc_chrraces"); -SQLStorage sDBCCinematicCamera(CinematicCamerafmt, "dbc_cinematiccamera"); -SQLStorage sDBCCinematicSequences(CinematicSequencesfmt, "dbc_cinematicsequences"); -SQLStorage sDBCCreatureDisplayInfo(CreatureDisplayInfofmt, "dbc_creaturedisplayinfo"); -SQLStorage sDBCCreatureDisplayInfoExtra(CreatureDisplayInfoExtrafmt, "dbc_creaturedisplayinfoextra"); -SQLStorage sDBCCreatureFamily(CreatureFamilyfmt, "dbc_creaturefamily"); -SQLStorage sDBCCreatureModelData(CreatureModelDatafmt, "dbc_creaturemodeldata"); -SQLStorage sDBCCreatureSpellData(CreatureSpellDatafmt, "dbc_creaturespelldata"); -SQLStorage sDBCCreatureType(CreatureTypefmt, "dbc_creaturetype"); -SQLStorage sDBCDurabilityCosts(DurabilityCostsfmt, "dbc_durabilitycosts"); -SQLStorage sDBCDurabilityQuality(DurabilityQualityfmt, "dbc_durabilityquality"); -SQLStorage sDBCEmotes(Emotesfmt, "dbc_emotes"); -SQLStorage sDBCEmotesText(EmotesTextfmt, "dbc_emotestext"); -SQLStorage sDBCFactionTemplate(FactionTemplatefmt, "dbc_factiontemplate"); -SQLStorage sDBCGameObjectDisplayInfo(GameObjectDisplayInfofmt, "dbc_gameobjectdisplayinfo"); -SQLStorage sDBCGemProperties(GemPropertiesfmt, "dbc_gemproperties"); -SQLStorage sDBCGMSurveyCurrentSurvey(GMSurveyCurrentSurveyfmt, "dbc_gmsurveycurrentsurvey"); -SQLStorage sDBCGMSurveyQuestions(GMSurveyQuestionsfmt, "dbc_gmsurveyquestions"); -SQLStorage sDBCGMSurveySurveys(GMSurveySurveysfmt, "dbc_gmsurveysurveys"); -SQLStorage sDBCGMTicketCategory(GMTicketCategoryfmt, "dbc_gmticketcategory"); -SQLStorage sDBCgtCombatRatings(gtCombatRatingsfmt, "dbc_gtcombatratings"); -SQLStorage sDBCgtChanceToMeleeCritBase(gtChanceToMeleeCritBasefmt, "dbc_gtchancetomeleecritbase"); -SQLStorage sDBCgtChanceToMeleeCrit(gtChanceToMeleeCritfmt, "dbc_gtchancetomeleecrit"); -SQLStorage sDBCgtChanceToSpellCritBase(gtChanceToSpellCritBasefmt, "dbc_gtchancetospellcritbase"); -SQLStorage sDBCgtChanceToSpellCrit(gtChanceToSpellCritfmt, "dbc_gtchancetospellcrit"); -SQLStorage sDBCgtOCTRegenHP(gtOCTRegenHPfmt, "dbc_gtoctregenhp"); -SQLStorage sDBCgtNPCManaCostScaler(gtNPCManaCostScalerfmt, "dbc_gtnpcmanacostscaler"); -SQLStorage sDBCgtRegenHPPerSpt(gtRegenHPPerSptfmt, "dbc_gtregenhpperspt"); -SQLStorage sDBCgtRegenMPPerSpt(gtRegenMPPerSptfmt, "dbc_gtregenmpperspt"); -SQLStorage sDBCItem(Itemfmt, "dbc_item"); -SQLStorage sDBCItemBagFamily(ItemBagFamilyfmt, "dbc_itembagfamily"); -SQLStorage sDBCItemClass(ItemClassfmt, "dbc_itemclass"); -SQLStorage sDBCItemExtendedCost(ItemExtendedCostfmt, "dbc_itemextendedcost"); -SQLStorage sDBCItemRandomProperties(ItemRandomPropertiesfmt, "dbc_itemrandomproperties"); -SQLStorage sDBCItemRandomSuffix(ItemRandomSuffixfmt, "dbc_itemrandomsuffix"); -SQLStorage sDBCItemSet(ItemSetfmt, "dbc_itemset"); -SQLStorage sDBCLiquidType(LiquidTypefmt, "dbc_liquidtype"); -SQLStorage sDBCLock(Lockfmt, "dbc_lock"); -SQLStorage sDBCMailTemplate(MailTemplatefmt, "dbc_mailtemplate"); -SQLStorage sDBCMap(Mapfmt, "dbc_map"); -SQLStorage sDBCQuestSort(QuestSortfmt, "dbc_questsort"); -SQLStorage sDBCRandPropPoints(RandPropPointsfmt, "dbc_randproppoints"); -SQLStorage sDBCSkillLine(SkillLinefmt, "dbc_skillline"); -SQLStorage sDBCSkillLineAbility(SkillLineAbilityfmt, "dbc_skilllineability"); -SQLStorage sDBCSkillRaceClassInfo(SkillRaceClassInfofmt, "dbc_skillraceclassinfo"); -SQLStorage sDBCSkillTiers(SkillTiersfmt, "dbc_skilltiers"); -SQLStorage sDBCSoundEntries(SoundEntriesfmt, "dbc_soundentries"); -SQLStorage sDBCSpellCastTimes(SpellCastTimesfmt, "dbc_spellcasttimes"); -SQLStorage sDBCSpellDuration(SpellDurationfmt, "dbc_spellduration"); -SQLStorage sDBCSpellFocusObject(SpellFocusObjectfmt, "dbc_spellfocusobject"); -SQLStorage sDBCSpellItemEnchantment(SpellItemEnchantmentfmt, "dbc_spellitemenchantment"); -SQLStorage sDBCSpellItemEnchantmentCondition(SpellItemEnchantmentConditionfmt, "dbc_spellitemenchantmentcondition"); -SQLStorage sDBCSpellRadius(SpellRadiusfmt, "dbc_spellradius"); -SQLStorage sDBCSpellRange(SpellRangefmt, "dbc_spellrange"); -SQLStorage sDBCSpellShapeshiftForm(SpellShapeshiftFormfmt, "dbc_spellshapeshiftform"); -SQLStorage sDBCSpellVisual(SpellVisualfmt, "dbc_spellvisual"); -SQLStorage sDBCStableSlotPrices(StableSlotPricesfmt, "dbc_stableslotprices"); -SQLStorage sDBCSummonProperties(SummonPropertiesfmt, "dbc_summonproperties"); -SQLStorage sDBCTalent(Talentfmt, "dbc_talent"); -SQLStorage sDBCTalentTab(TalentTabfmt, "dbc_talenttab"); -SQLStorage sDBCTaxiNodes(TaxiNodesfmt, "dbc_taxinodes"); -SQLStorage sDBCTaxiPath(TaxiPathfmt, "dbc_taxipath"); -SQLStorage sDBCTaxiPathNode(TaxiPathNodefmt, "dbc_taxipathnode"); -SQLStorage sDBCTransportAnimation(TransportAnimationfmt, "dbc_transportanimation"); -SQLStorage sDBCTotemCategory(TotemCategoryfmt, "dbc_totemcategory"); -SQLStorage sDBCWorldMapArea(WorldMapAreafmt, "dbc_worldmaparea"); -SQLStorage sDBCWMOAreaTable(WMOAreaTablefmt, "dbc_wmoareatable"); +SQLStorage sAreaTableStore(AreaTablefmt, "areatable_store"); +SQLStorage sAreaTriggerStore(AreaTriggerfmt, "areatrigger_store"); +SQLStorage sAuctionHouseStore(AuctionHousefmt, "auctionhouse_store"); +SQLStorage sBankBagSlotPricesStore(BankBagSlotPricesfmt, "bankbagslotprices_store"); +SQLStorage sBattlemasterListStore(BattlemasterListfmt, "battlemasterlist_store"); +SQLStorage sCharStartOutfitStore(CharStartOutfitfmt, "charstartoutfit_store"); +SQLStorage sCharTitlesStore(CharTitlesfmt, "chartitles_store"); +SQLStorage sChatChannelsStore(ChatChannelsfmt, "chatchannels_store"); +SQLStorage sChrClassesStore(ChrClassesfmt, "chrclasses_store"); +SQLStorage sChrRacesStore(ChrRacesfmt, "chrraces_store"); +SQLStorage sCinematicCameraStore(CinematicCamerafmt, "cinematiccamera_store"); +SQLStorage sCinematicSequencesStore(CinematicSequencesfmt, "cinematicsequences_store"); +SQLStorage sCreatureDisplayInfoStore(CreatureDisplayInfofmt, "creaturedisplayinfo_store"); +SQLStorage sCreatureDisplayInfoExtraStore(CreatureDisplayInfoExtrafmt, "creaturedisplayinfoextra_store"); +SQLStorage sCreatureFamilyStore(CreatureFamilyfmt, "creaturefamily_store"); +SQLStorage sCreatureModelDataStore(CreatureModelDatafmt, "creaturemodeldata_store"); +SQLStorage sCreatureSpellDataStore(CreatureSpellDatafmt, "creaturespelldata_store"); +SQLStorage sCreatureTypeStore(CreatureTypefmt, "creaturetype_store"); +SQLStorage sDurabilityCostsStore(DurabilityCostsfmt, "durabilitycosts_store"); +SQLStorage sDurabilityQualityStore(DurabilityQualityfmt, "durabilityquality_store"); +SQLStorage sEmotesStore(Emotesfmt, "emotes_store"); +SQLStorage sEmotesTextStore(EmotesTextfmt, "emotestext_store"); +SQLStorage sFactionTemplateStore(FactionTemplatefmt, "factiontemplate_store"); +SQLStorage sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt, "gameobjectdisplayinfo_store"); +SQLStorage sGemPropertiesStore(GemPropertiesfmt, "gemproperties_store"); +SQLStorage sGMSurveyCurrentSurveyStore(GMSurveyCurrentSurveyfmt, "gmsurveycurrentsurvey_store"); +SQLStorage sGMSurveyQuestionsStore(GMSurveyQuestionsfmt, "gmsurveyquestions_store"); +SQLStorage sGMSurveySurveysStore(GMSurveySurveysfmt, "gmsurveysurveys_store"); +SQLStorage sGMTicketCategoryStore(GMTicketCategoryfmt, "gmticketcategory_store"); +SQLStorage sgtCombatRatingsStore(gtCombatRatingsfmt, "gtcombatratings_store"); +SQLStorage sgtChanceToMeleeCritBaseStore(gtChanceToMeleeCritBasefmt, "gtchancetomeleecritbase_store"); +SQLStorage sgtChanceToMeleeCritStore(gtChanceToMeleeCritfmt, "gtchancetomeleecrit_store"); +SQLStorage sgtChanceToSpellCritBaseStore(gtChanceToSpellCritBasefmt, "gtchancetospellcritbase_store"); +SQLStorage sgtChanceToSpellCritStore(gtChanceToSpellCritfmt, "gtchancetospellcrit_store"); +SQLStorage sgtOCTRegenHPStore(gtOCTRegenHPfmt, "gtoctregenhp_store"); +SQLStorage sgtNPCManaCostScalerStore(gtNPCManaCostScalerfmt, "gtnpcmanacostscaler_store"); +SQLStorage sgtRegenHPPerSptStore(gtRegenHPPerSptfmt, "gtregenhpperspt_store"); +SQLStorage sgtRegenMPPerSptStore(gtRegenMPPerSptfmt, "gtregenmpperspt_store"); +SQLStorage sItemStore(Itemfmt, "item_store"); +SQLStorage sItemBagFamilyStore(ItemBagFamilyfmt, "itembagfamily_store"); +SQLStorage sItemClassStore(ItemClassfmt, "itemclass_store"); +SQLStorage sItemExtendedCostStore(ItemExtendedCostfmt, "itemextendedcost_store"); +SQLStorage sItemRandomPropertiesStore(ItemRandomPropertiesfmt, "itemrandomproperties_store"); +SQLStorage sItemRandomSuffixStore(ItemRandomSuffixfmt, "itemrandomsuffix_store"); +SQLStorage sItemSetStore(ItemSetfmt, "itemset_store"); +SQLStorage sLiquidTypeStore(LiquidTypefmt, "liquidtype_store"); +SQLStorage sLockStore(Lockfmt, "lock_store"); +SQLStorage sMailTemplateStore(MailTemplatefmt, "mailtemplate_store"); +SQLStorage sMapStore(Mapfmt, "map_store"); +SQLStorage sQuestSortStore(QuestSortfmt, "questsort_store"); +SQLStorage sRandPropPointsStore(RandPropPointsfmt, "randproppoints_store"); +SQLStorage sSkillLineStore(SkillLinefmt, "skillline_store"); +SQLStorage sSkillLineAbilityStore(SkillLineAbilityfmt, "skilllineability_store"); +SQLStorage sSkillRaceClassInfoStore(SkillRaceClassInfofmt, "skillraceclassinfo_store"); +SQLStorage sSkillTiersStore(SkillTiersfmt, "skilltiers_store"); +SQLStorage sSoundEntriesStore(SoundEntriesfmt, "soundentries_store"); +SQLStorage sSpellCastTimesStore(SpellCastTimesfmt, "spellcasttimes_store"); +SQLStorage sSpellDurationStore(SpellDurationfmt, "spellduration_store"); +SQLStorage sSpellFocusObjectStore(SpellFocusObjectfmt, "spellfocusobject_store"); +SQLStorage sSpellItemEnchantmentStore(SpellItemEnchantmentfmt, "spellitemenchantment_store"); +SQLStorage sSpellItemEnchantmentConditionStore(SpellItemEnchantmentConditionfmt, "spellitemenchantmentcondition_store"); +SQLStorage sSpellRadiusStore(SpellRadiusfmt, "spellradius_store"); +SQLStorage sSpellRangeStore(SpellRangefmt, "spellrange_store"); +SQLStorage sSpellShapeshiftFormStore(SpellShapeshiftFormfmt, "spellshapeshiftform_store"); +SQLStorage sSpellVisualStore(SpellVisualfmt, "spellvisual_store"); +SQLStorage sStableSlotPricesStore(StableSlotPricesfmt, "stableslotprices_store"); +SQLStorage sSummonPropertiesStore(SummonPropertiesfmt, "summonproperties_store"); +SQLStorage sTalentStore(Talentfmt, "talent_store"); +SQLStorage sTalentTabStore(TalentTabfmt, "talenttab_store"); +SQLStorage sTaxiNodesStore(TaxiNodesfmt, "taxinodes_store"); +SQLStorage sTaxiPathStore(TaxiPathfmt, "taxipath_store"); +SQLStorage sTaxiPathNodeStore(TaxiPathNodefmt, "taxipathnode_store"); +SQLStorage sTransportAnimationStore(TransportAnimationfmt, "transportanimation_store"); +SQLStorage sTotemCategoryStore(TotemCategoryfmt, "totemcategory_store"); +SQLStorage sWorldMapAreaStore(WorldMapAreafmt, "worldmaparea_store"); +SQLStorage sWMOAreaTableStore(WMOAreaTablefmt, "wmoareatable_store"); AreaFlagByAreaID sAreaFlagByAreaID; AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files @@ -247,7 +247,7 @@ TaxiPathNodesByPath sTaxiPathNodesByPath;// DBC store data but sTaxiPathNodesByP void InitializeDBC() { // must be after sAreaStore loading - for (auto areaEntry : sDBCAreaTable) // areaflag numbered from 0 + for (auto areaEntry : sAreaTableStore) // areaflag numbered from 0 { // fill AreaId->DBC records sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(areaEntry->ID), areaEntry->exploreFlag)); @@ -257,12 +257,12 @@ void InitializeDBC() sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(areaEntry->mapid, areaEntry->exploreFlag)); } - for (auto skillLine : sDBCSkillLineAbility) + for (auto skillLine : sSkillLineAbilityStore) { SpellEntry const* spellInfo = sSpellTemplate.LookupEntry(skillLine->spellId); if (spellInfo && (spellInfo->Attributes & (SPELL_ATTR_ABILITY | SPELL_ATTR_PASSIVE | SPELL_ATTR_HIDDEN_CLIENTSIDE | SPELL_ATTR_HIDE_IN_COMBAT_LOG)) == (SPELL_ATTR_ABILITY | SPELL_ATTR_PASSIVE | SPELL_ATTR_HIDDEN_CLIENTSIDE | SPELL_ATTR_HIDE_IN_COMBAT_LOG)) { - for (auto cFamily : sDBCCreatureFamily) + for (auto cFamily : sCreatureFamilyStore) { if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1]) continue; @@ -273,7 +273,7 @@ void InitializeDBC() } // create talent spells set - for (auto talentInfo : sDBCTalent) + for (auto talentInfo : sTalentStore) { for (int j = 0; j < 5; ++j) if (talentInfo->RankID[j]) @@ -286,9 +286,9 @@ void InitializeDBC() // store in with (row,col,talent)->size key for correct sorting by (row,col) typedef std::map TalentBitSize; TalentBitSize sTalentBitSize; - for (auto talentInfo : sDBCTalent) + for (auto talentInfo : sTalentStore) { - TalentTabEntry const* talentTabInfo = sDBCTalentTab.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -308,7 +308,7 @@ void InitializeDBC() } // now have all max ranks (and then bit amount used for store talent ranks in inspect) - for (auto talentTabInfo : sDBCTalentTab) + for (auto talentTabInfo : sTalentTabStore) { // prevent memory corruption; otherwise cls will become 12 below if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0) @@ -325,7 +325,7 @@ void InitializeDBC() for (TalentBitSize::iterator itr = sTalentBitSize.begin(); itr != sTalentBitSize.end(); ++itr) { uint32 talentId = itr->first & 0xFFFF; - TalentEntry const* talentInfo = sDBCTalent.LookupEntry(talentId); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); if (!talentInfo) continue; @@ -338,13 +338,13 @@ void InitializeDBC() } } - for (auto entry : sDBCTaxiPath) + for (auto entry : sTaxiPathStore) sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price); - uint32 pathCount = sDBCTaxiPath.GetMaxEntry(); + uint32 pathCount = sTaxiPathStore.GetMaxEntry(); std::vector pathLength; pathLength.resize(pathCount); // 0 and some other indexes not used - for (auto entry : sDBCTaxiPathNode) + for (auto entry : sTaxiPathNodeStore) { if (pathLength[entry->path] < entry->index + 1) pathLength[entry->path] = entry->index + 1; @@ -354,7 +354,7 @@ void InitializeDBC() for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i) sTaxiPathNodesByPath[i].resize(pathLength[i]); // fill data (pointers to sTaxiPathNodeStore elements - for (auto entry : sDBCTaxiPathNode) + for (auto entry : sTaxiPathNodeStore) sTaxiPathNodesByPath[entry->path].set(entry->index, entry); // Initialize global taxinodes mask @@ -367,7 +367,7 @@ void InitializeDBC() spellPaths.insert(sInfo->EffectMiscValue[j]); memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask)); - for (auto node : sDBCTaxiNodes) + for (auto node : sTaxiNodesStore) { TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(node->ID); if (src_i != sTaxiPathSetBySource.end() && !src_i->second.empty()) @@ -394,18 +394,18 @@ void InitializeDBC() } } - for (auto entry : sDBCWMOAreaTable) + for (auto entry : sWMOAreaTableStore) { sWMOAreaInfoByTripple[WMOAreaTableTripple(entry->rootId, entry->adtId, entry->groupId)].push_back(entry); } // Check loaded DBC files proper version - if (!sDBCSkillLineAbility.LookupEntry(17514) || - !sDBCMap.LookupEntry(598) || - !sDBCGemProperties.LookupEntry(1127) || - !sDBCItemExtendedCost.LookupEntry(2425) || - !sDBCCharTitles.LookupEntry(71) || - !sDBCAreaTable.LookupEntry(1768)) + if (!sSkillLineAbilityStore.LookupEntry(17514) || + !sMapStore.LookupEntry(598) || + !sGemPropertiesStore.LookupEntry(1127) || + !sItemExtendedCostStore.LookupEntry(2425) || + !sCharTitlesStore.LookupEntry(71) || + !sAreaTableStore.LookupEntry(1768)) { sLog.outError("\nYou have _outdated_ DBC files. Please re-extract DBC files for one from client build: %s", World::AcceptableClientBuildsListStr().c_str()); Log::WaitBeforeContinueIfNeed(); @@ -415,82 +415,82 @@ void InitializeDBC() void LoadDBCTables() { - sDBCAreaTable.Load(); - sDBCAreaTrigger.Load(); - sDBCAuctionHouse.Load(); - sDBCBankBagSlotPrices.Load(); - sDBCBattlemasterList.Load(); - sDBCCharStartOutfit.Load(); - sDBCCharTitles.Load(); - sDBCChatChannels.Load(); - sDBCChrClasses.Load(); - sDBCChrRaces.Load(); - sDBCCinematicCamera.Load(); - sDBCCinematicSequences.Load(); - sDBCCreatureDisplayInfo.Load(); - sDBCCreatureDisplayInfoExtra.Load(); - sDBCCreatureFamily.Load(); - sDBCCreatureModelData.Load(); - sDBCCreatureSpellData.Load(); - sDBCCreatureType.Load(); - sDBCDurabilityQuality.Load(); - sDBCDurabilityCosts.Load(); - sDBCEmotes.Load(); - sDBCEmotesText.Load(); - sDBCFactionTemplate.Load(); - sDBCGameObjectDisplayInfo.Load(); - sDBCGemProperties.Load(); - sDBCGMSurveyCurrentSurvey.Load(); - sDBCGMSurveyQuestions.Load(); - sDBCGMSurveySurveys.Load(); - sDBCGMTicketCategory.Load(); - sDBCgtCombatRatings.Load(); - sDBCgtChanceToMeleeCritBase.Load(); - sDBCgtChanceToMeleeCrit.Load(); - sDBCgtChanceToSpellCritBase.Load(); - sDBCgtChanceToSpellCrit.Load(); - sDBCgtOCTRegenHP.Load(); - sDBCgtNPCManaCostScaler.Load(); - sDBCgtRegenHPPerSpt.Load(); - sDBCgtRegenMPPerSpt.Load(); - sDBCItem.Load(); - sDBCItemBagFamily.Load(); - sDBCItemClass.Load(); - sDBCItemExtendedCost.Load(); - sDBCItemRandomProperties.Load(); - sDBCItemRandomSuffix.Load(); - sDBCItemSet.Load(); - sDBCLiquidType.Load(); - sDBCLock.Load(); - sDBCMailTemplate.Load(); - sDBCMap.Load(); - sDBCQuestSort.Load(); - sDBCRandPropPoints.Load(); - sDBCSkillLine.Load(); - sDBCSkillLineAbility.Load(); - sDBCSkillRaceClassInfo.Load(); - sDBCSkillTiers.Load(); - sDBCSoundEntries.Load(); - sDBCSpellCastTimes.Load(); - sDBCSpellDuration.Load(); - sDBCSpellFocusObject.Load(); - sDBCSpellItemEnchantment.Load(); - sDBCSpellItemEnchantmentCondition.Load(); - sDBCSpellRadius.Load(); - sDBCSpellRange.Load(); - sDBCSpellShapeshiftForm.Load(); - sDBCSpellVisual.Load(); - sDBCStableSlotPrices.Load(); - sDBCSummonProperties.Load(); - sDBCTalent.Load(); - sDBCTalentTab.Load(); - sDBCTaxiNodes.Load(); - sDBCTaxiPath.Load(); - sDBCTaxiPathNode.Load(); - sDBCTransportAnimation.Load(); - sDBCTotemCategory.Load(); - sDBCWorldMapArea.Load(); - sDBCWMOAreaTable.Load(); + sAreaTableStore.Load(); + sAreaTriggerStore.Load(); + sAuctionHouseStore.Load(); + sBankBagSlotPricesStore.Load(); + sBattlemasterListStore.Load(); + sCharStartOutfitStore.Load(); + sCharTitlesStore.Load(); + sChatChannelsStore.Load(); + sChrClassesStore.Load(); + sChrRacesStore.Load(); + sCinematicCameraStore.Load(); + sCinematicSequencesStore.Load(); + sCreatureDisplayInfoStore.Load(); + sCreatureDisplayInfoExtraStore.Load(); + sCreatureFamilyStore.Load(); + sCreatureModelDataStore.Load(); + sCreatureSpellDataStore.Load(); + sCreatureTypeStore.Load(); + sDurabilityQualityStore.Load(); + sDurabilityCostsStore.Load(); + sEmotesStore.Load(); + sEmotesTextStore.Load(); + sFactionTemplateStore.Load(); + sGameObjectDisplayInfoStore.Load(); + sGemPropertiesStore.Load(); + sGMSurveyCurrentSurveyStore.Load(); + sGMSurveyQuestionsStore.Load(); + sGMSurveySurveysStore.Load(); + sGMTicketCategoryStore.Load(); + sgtCombatRatingsStore.Load(); + sgtChanceToMeleeCritBaseStore.Load(); + sgtChanceToMeleeCritStore.Load(); + sgtChanceToSpellCritBaseStore.Load(); + sgtChanceToSpellCritStore.Load(); + sgtOCTRegenHPStore.Load(); + sgtNPCManaCostScalerStore.Load(); + sgtRegenHPPerSptStore.Load(); + sgtRegenMPPerSptStore.Load(); + sItemStore.Load(); + sItemBagFamilyStore.Load(); + sItemClassStore.Load(); + sItemExtendedCostStore.Load(); + sItemRandomPropertiesStore.Load(); + sItemRandomSuffixStore.Load(); + sItemSetStore.Load(); + sLiquidTypeStore.Load(); + sLockStore.Load(); + sMailTemplateStore.Load(); + sMapStore.Load(); + sQuestSortStore.Load(); + sRandPropPointsStore.Load(); + sSkillLineStore.Load(); + sSkillLineAbilityStore.Load(); + sSkillRaceClassInfoStore.Load(); + sSkillTiersStore.Load(); + sSoundEntriesStore.Load(); + sSpellCastTimesStore.Load(); + sSpellDurationStore.Load(); + sSpellFocusObjectStore.Load(); + sSpellItemEnchantmentStore.Load(); + sSpellItemEnchantmentConditionStore.Load(); + sSpellRadiusStore.Load(); + sSpellRangeStore.Load(); + sSpellShapeshiftFormStore.Load(); + sSpellVisualStore.Load(); + sStableSlotPricesStore.Load(); + sSummonPropertiesStore.Load(); + sTalentStore.Load(); + sTalentTabStore.Load(); + sTaxiNodesStore.Load(); + sTaxiPathStore.Load(); + sTaxiPathNodeStore.Load(); + sTransportAnimationStore.Load(); + sTotemCategoryStore.Load(); + sWorldMapAreaStore.Load(); + sWMOAreaTableStore.Load(); InitializeDBC(); diff --git a/src/game/Server/SQLStorages.h b/src/game/Server/SQLStorages.h index fce8e3b1d96..2752270df24 100644 --- a/src/game/Server/SQLStorages.h +++ b/src/game/Server/SQLStorages.h @@ -44,82 +44,82 @@ extern SQLHashStorage sGOStorage; extern SQLMultiStorage sSpellScriptTargetStorage; // DBC stores in db -extern SQLStorage sDBCAreaTable; -extern SQLStorage sDBCAreaTrigger; -extern SQLStorage sDBCAuctionHouse; -extern SQLStorage sDBCBankBagSlotPrices; -extern SQLStorage sDBCBattlemasterList; -extern SQLStorage sDBCCharStartOutfit; -extern SQLStorage sDBCCharTitles; -extern SQLStorage sDBCChatChannels; -extern SQLStorage sDBCChrClasses; -extern SQLStorage sDBCChrRaces; -extern SQLStorage sDBCCinematicCamera; -extern SQLStorage sDBCCinematicSequences; -extern SQLStorage sDBCCreatureDisplayInfo; -extern SQLStorage sDBCCreatureDisplayInfoExtra; -extern SQLStorage sDBCCreatureFamily; -extern SQLStorage sDBCCreatureModelData; -extern SQLStorage sDBCCreatureSpellData; // todo not used? -extern SQLStorage sDBCCreatureType; -extern SQLStorage sDBCDurabilityCosts; -extern SQLStorage sDBCDurabilityQuality; -extern SQLStorage sDBCEmotes; -extern SQLStorage sDBCEmotesText; -extern SQLStorage sDBCFactionTemplate; -extern SQLStorage sDBCGameObjectDisplayInfo; -extern SQLStorage sDBCGemProperties; -extern SQLStorage sDBCGMSurveyCurrentSurvey; -extern SQLStorage sDBCGMSurveyQuestions; -extern SQLStorage sDBCGMSurveySurveys; -extern SQLStorage sDBCGMTicketCategory; -extern SQLStorage sDBCgtCombatRatings; -extern SQLStorage sDBCgtChanceToMeleeCritBase; -extern SQLStorage sDBCgtChanceToMeleeCrit; -extern SQLStorage sDBCgtChanceToSpellCritBase; -extern SQLStorage sDBCgtChanceToSpellCrit; -extern SQLStorage sDBCgtOCTRegenHP; -extern SQLStorage sDBCgtNPCManaCostScaler; -extern SQLStorage sDBCgtRegenHPPerSpt; -extern SQLStorage sDBCgtRegenMPPerSpt; -extern SQLStorage sDBCItem; -extern SQLStorage sDBCItemBagFamily; -extern SQLStorage sDBCItemClass; -extern SQLStorage sDBCItemExtendedCost; -extern SQLStorage sDBCItemRandomProperties; -extern SQLStorage sDBCItemRandomSuffix; -extern SQLStorage sDBCItemSet; -extern SQLStorage sDBCLiquidType; -extern SQLStorage sDBCLock; -extern SQLStorage sDBCMailTemplate; -extern SQLStorage sDBCMap; -extern SQLStorage sDBCQuestSort; -extern SQLStorage sDBCRandPropPoints; -extern SQLStorage sDBCSkillLine; -extern SQLStorage sDBCSkillLineAbility; -extern SQLStorage sDBCSkillRaceClassInfo; -extern SQLStorage sDBCSkillTiers; -extern SQLStorage sDBCSoundEntries; -extern SQLStorage sDBCSpellCastTimes; -extern SQLStorage sDBCSpellDuration; -extern SQLStorage sDBCSpellFocusObject; -extern SQLStorage sDBCSpellItemEnchantment; -extern SQLStorage sDBCSpellItemEnchantmentCondition; -extern SQLStorage sDBCSpellRadius; -extern SQLStorage sDBCSpellRange; -extern SQLStorage sDBCSpellShapeshiftForm; -extern SQLStorage sDBCSpellVisual; -extern SQLStorage sDBCStableSlotPrices; -extern SQLStorage sDBCSummonProperties; -extern SQLStorage sDBCTalent; -extern SQLStorage sDBCTalentTab; -extern SQLStorage sDBCTaxiNodes; -extern SQLStorage sDBCTaxiPath; -extern SQLStorage sDBCTaxiPathNode; -extern SQLStorage sDBCTransportAnimation; -extern SQLStorage sDBCTotemCategory; -extern SQLStorage sDBCWorldMapArea; -extern SQLStorage sDBCWMOAreaTable; +extern SQLStorage sAreaTableStore; +extern SQLStorage sAreaTriggerStore; +extern SQLStorage sAuctionHouseStore; +extern SQLStorage sBankBagSlotPricesStore; +extern SQLStorage sBattlemasterListStore; +extern SQLStorage sCharStartOutfitStore; +extern SQLStorage sCharTitlesStore; +extern SQLStorage sChatChannelsStore; +extern SQLStorage sChrClassesStore; +extern SQLStorage sChrRacesStore; +extern SQLStorage sCinematicCameraStore; +extern SQLStorage sCinematicSequencesStore; +extern SQLStorage sCreatureDisplayInfoStore; +extern SQLStorage sCreatureDisplayInfoExtraStore; +extern SQLStorage sCreatureFamilyStore; +extern SQLStorage sCreatureModelDataStore; +extern SQLStorage sCreatureSpellDataStore; // todo not used? +extern SQLStorage sCreatureTypeStore; +extern SQLStorage sDurabilityCostsStore; +extern SQLStorage sDurabilityQualityStore; +extern SQLStorage sEmotesStore; +extern SQLStorage sEmotesTextStore; +extern SQLStorage sFactionTemplateStore; +extern SQLStorage sGameObjectDisplayInfoStore; +extern SQLStorage sGemPropertiesStore; +extern SQLStorage sGMSurveyCurrentSurveyStore; +extern SQLStorage sGMSurveyQuestionsStore; +extern SQLStorage sGMSurveySurveysStore; +extern SQLStorage sGMTicketCategoryStore; +extern SQLStorage sgtCombatRatingsStore; +extern SQLStorage sgtChanceToMeleeCritBaseStore; +extern SQLStorage sgtChanceToMeleeCritStore; +extern SQLStorage sgtChanceToSpellCritBaseStore; +extern SQLStorage sgtChanceToSpellCritStore; +extern SQLStorage sgtOCTRegenHPStore; +extern SQLStorage sgtNPCManaCostScalerStore; +extern SQLStorage sgtRegenHPPerSptStore; +extern SQLStorage sgtRegenMPPerSptStore; +extern SQLStorage sItemStore; +extern SQLStorage sItemBagFamilyStore; +extern SQLStorage sItemClassStore; +extern SQLStorage sItemExtendedCostStore; +extern SQLStorage sItemRandomPropertiesStore; +extern SQLStorage sItemRandomSuffixStore; +extern SQLStorage sItemSetStore; +extern SQLStorage sLiquidTypeStore; +extern SQLStorage sLockStore; +extern SQLStorage sMailTemplateStore; +extern SQLStorage sMapStore; +extern SQLStorage sQuestSortStore; +extern SQLStorage sRandPropPointsStore; +extern SQLStorage sSkillLineStore; +extern SQLStorage sSkillLineAbilityStore; +extern SQLStorage sSkillRaceClassInfoStore; +extern SQLStorage sSkillTiersStore; +extern SQLStorage sSoundEntriesStore; +extern SQLStorage sSpellCastTimesStore; +extern SQLStorage sSpellDurationStore; +extern SQLStorage sSpellFocusObjectStore; +extern SQLStorage sSpellItemEnchantmentStore; +extern SQLStorage sSpellItemEnchantmentConditionStore; +extern SQLStorage sSpellRadiusStore; +extern SQLStorage sSpellRangeStore; +extern SQLStorage sSpellShapeshiftFormStore; +extern SQLStorage sSpellVisualStore; +extern SQLStorage sStableSlotPricesStore; +extern SQLStorage sSummonPropertiesStore; +extern SQLStorage sTalentStore; +extern SQLStorage sTalentTabStore; +extern SQLStorage sTaxiNodesStore; +extern SQLStorage sTaxiPathStore; +extern SQLStorage sTaxiPathNodeStore; +extern SQLStorage sTransportAnimationStore; +extern SQLStorage sTotemCategoryStore; +extern SQLStorage sWorldMapAreaStore; +extern SQLStorage sWMOAreaTableStore; // following are mostly helper store to get fast lookup of some other stores typedef std::map AreaFlagByAreaID; diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 6352562ee1b..9eb78b2bcd6 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -421,7 +421,7 @@ template WorldObject* Spell::FindCorpseUsing() { // non-standard target selection - SpellRangeEntry const* srange = sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex); + SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); float max_range = GetSpellMaxRange(srange); WorldObject* result = nullptr; @@ -1761,7 +1761,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targ } case TARGET_LOCATION_CASTER_FRONT_LEAP: { - float dist = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex])); + float dist = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex])); const float IN_OR_UNDER_LIQUID_RANGE = 0.8f; // range to make player under liquid or on liquid surface from liquid level G3D::Vector3 prevPos, nextPos; @@ -1925,8 +1925,8 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, bool targ float x, y, z; // special code for fishing bobber (TARGET_LOCATION_CASTER_FISHING_SPOT), should not try to avoid objects // nor try to find ground level, but randomly vary in angle - float min_dis = GetSpellMinRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); - float max_dis = GetSpellMaxRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); + float min_dis = GetSpellMinRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); + float max_dis = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); float dis = rand_norm_f() * (max_dis - min_dis) + min_dis; // calculate angle variation for roughly equal dimensions of target area float max_angle = (max_dis - min_dis) / (max_dis + m_caster->GetObjectBoundingRadius()); @@ -4917,7 +4917,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_targets.m_targetMask & (TARGET_FLAG_DEST_LOCATION | TARGET_FLAG_SOURCE_LOCATION)) { UnitList targetsCombat; - float radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); + float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); FillAreaTargets(targetsCombat, radius, 0.f, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_ATTACKABLE); @@ -5112,7 +5112,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (Unit* target = m_targets.getUnitTarget()) { - float range = GetSpellMaxRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); + float range = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); Position pos; target->GetFirstCollisionPosition(pos, target->GetCombatReach(), target->GetAngle(m_caster)); @@ -5276,7 +5276,7 @@ SpellCastResult Spell::CheckCast(bool strict) // These won't show up in m_caster->GetPetGUID() case SPELL_EFFECT_SUMMON: { - if (SummonPropertiesEntry const* summon_prop = sDBCSummonProperties.LookupEntry(m_spellInfo->EffectMiscValueB[i])) + if (SummonPropertiesEntry const* summon_prop = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i])) { if (summon_prop->Group == SUMMON_PROP_GROUP_PETS) { @@ -5348,7 +5348,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_BAD_TARGETS; uint32 mapId = m_caster->GetMapId(); - const MapEntry* map = sDBCMap.LookupEntry(mapId); + const MapEntry* map = sMapStore.LookupEntry(mapId); if (map->IsDungeon()) { // pre 2.4 - could not summon to instance @@ -5371,7 +5371,7 @@ SpellCastResult Spell::CheckCast(bool strict) // check if our map is dungeon uint32 mapId = m_caster->GetMapId(); - const MapEntry* map = sDBCMap.LookupEntry(mapId); + const MapEntry* map = sMapStore.LookupEntry(mapId); if (map->IsDungeon()) { // pre 2.4 - could not summon to instance @@ -5915,7 +5915,7 @@ std::pair Spell::GetMinMaxRange(bool strict) Unit* caster = dynamic_cast(m_caster); // preparation for GO casting - SpellRangeEntry const* spellRange = sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex); + SpellRangeEntry const* spellRange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); if (spellRange) { Unit* target = m_targets.getUnitTarget(); @@ -5977,7 +5977,7 @@ SpellCastResult Spell::CheckRange(bool strict) std::tie(minRange, maxRange) = GetMinMaxRange(strict); // non strict spell tolerance - if (SpellRangeEntry const* spellRange = sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)) + if (SpellRangeEntry const* spellRange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)) if ((spellRange->Flags & SPELL_RANGE_FLAG_MELEE) == 0 && !strict) maxRange += std::min(3.f, maxRange * 0.1f); // 10% but no more than MAX_SPELL_RANGE_TOLERANCE @@ -6111,8 +6111,8 @@ uint32 Spell::CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spel if (spellInfo->HasAttribute(SPELL_ATTR_LEVEL_DAMAGE_CALCULATION)) { - GtNPCManaCostScalerEntry const* spellScaler = sDBCgtNPCManaCostScaler.LookupEntry(spellInfo->spellLevel - 1); - GtNPCManaCostScalerEntry const* casterScaler = sDBCgtNPCManaCostScaler.LookupEntry(caster->getLevel() - 1); + GtNPCManaCostScalerEntry const* spellScaler = sgtNPCManaCostScalerStore.LookupEntry(spellInfo->spellLevel - 1); + GtNPCManaCostScalerEntry const* casterScaler = sgtNPCManaCostScalerStore.LookupEntry(caster->getLevel() - 1); if (spellScaler && casterScaler) powerCost *= casterScaler->ratio / spellScaler->ratio; } @@ -6389,7 +6389,7 @@ SpellCastResult Spell::CheckItems() if (targetItem->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; - SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return SPELL_FAILED_ERROR; if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND) @@ -6406,7 +6406,7 @@ SpellCastResult Spell::CheckItems() if (item->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; - SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return SPELL_FAILED_ERROR; if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND) @@ -6967,7 +6967,7 @@ SpellCastResult Spell::CanOpenLock(SpellEffectIndex effIndex, uint32 lockId, Ski return SPELL_CAST_OK; // Get LockInfo - LockEntry const* lockInfo = sDBCLock.LookupEntry(lockId); + LockEntry const* lockInfo = sLockStore.LookupEntry(lockId); if (!lockInfo) return SPELL_FAILED_BAD_TARGETS; @@ -7269,9 +7269,9 @@ void Spell::ClearCastItem() void Spell::GetSpellRangeAndRadius(SpellEffectIndex effIndex, float& radius, bool targetB, uint32& EffectChainTarget) { if (m_spellInfo->EffectRadiusIndex[effIndex]) - radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex])); + radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex])); else - radius = GetSpellMaxRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); + radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); uint32 targetMode; if (!targetB) diff --git a/src/game/Spells/Spell.h b/src/game/Spells/Spell.h index af18f4548f1..afb8ecb4e11 100644 --- a/src/game/Spells/Spell.h +++ b/src/game/Spells/Spell.h @@ -515,7 +515,7 @@ class Spell return true; if (m_spellInfo->speed > 0.0f) - if (SpellVisualEntry const* spellVisual = sDBCSpellVisual.LookupEntry(m_spellInfo->SpellVisual)) + if (SpellVisualEntry const* spellVisual = sSpellVisualStore.LookupEntry(m_spellInfo->SpellVisual)) if (spellVisual->HasMissile) if (spellVisual->MissileModel == -4 || spellVisual->MissileModel == -5) return true; diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index 9a97c8f3f57..c7e0af797d7 100755 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -343,12 +343,12 @@ Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 const* curr { if (!damage && castItem && castItem->GetItemSuffixFactor()) { - ItemRandomSuffixEntry const* item_rand_suffix = sDBCItemRandomSuffix.LookupEntry(abs(castItem->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId())); if (item_rand_suffix) { for (int k = 0; k < 3; ++k) { - SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(item_rand_suffix->enchant_id[k]); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]); if (pEnchant) { for (unsigned int t : pEnchant->spellid) @@ -434,7 +434,7 @@ AreaAura::AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 con // caster==nullptr in constructor args if target==caster in fact Unit* caster_ptr = caster ? caster : target; - m_radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spellproto->EffectRadiusIndex[m_effIndex])); + m_radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[m_effIndex])); if (Player* modOwner = caster_ptr->GetSpellModOwner()) modOwner->ApplySpellMod(spellproto->Id, SPELLMOD_RADIUS, m_radius); @@ -3339,7 +3339,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) ShapeshiftForm form = ShapeshiftForm(m_modifier.m_miscvalue); - SpellShapeshiftFormEntry const* ssEntry = sDBCSpellShapeshiftForm.LookupEntry(form); + SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form); if (!ssEntry) { sLog.outError("Unknown shapeshift form %u in spell %u", form, GetId()); @@ -7536,7 +7536,7 @@ void Aura::PeriodicDummyTick() case 23487: // Separation Anxiety (Garr) if (Unit* caster = GetCaster()) { - float m_radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spell->EffectRadiusIndex[m_effIndex])); + float m_radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spell->EffectRadiusIndex[m_effIndex])); if (caster->IsAlive() && !caster->IsWithinDistInMap(target, m_radius)) target->CastSpell(target, (spell->Id == 21094 ? 21095 : 23492), TRIGGERED_OLD_TRIGGERED, nullptr); // Spell 21095: Separation Anxiety for Majordomo Executus' adds, 23492: Separation Anxiety for Garr's adds } @@ -7915,7 +7915,7 @@ void Aura::HandleFactionOverride(bool apply, bool Real) return; Unit* target = GetTarget(); - if (!target || !sDBCFactionTemplate.LookupEntry(GetMiscValue())) + if (!target || !sFactionTemplateStore.LookupEntry(GetMiscValue())) return; if (apply) diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 085f32ffaa0..33e8ccdfdce 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -1702,7 +1702,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { if (unitTarget->IsAlive()) { - float radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); + float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); unitTarget->GetMotionMaster()->MoveFollow(m_caster, radius, 0); } return; @@ -3037,7 +3037,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // all poison enchantments is temporary if (uint32 enchant_id = item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)) { - SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; @@ -3594,7 +3594,7 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) // TODO - Use target else if (unitTarget->GetTypeId() == TYPEID_PLAYER) { Player* player = static_cast(unitTarget); - MapEntry const* targetMapEntry = sDBCMap.LookupEntry(m_targets.m_mapId); + MapEntry const* targetMapEntry = sMapStore.LookupEntry(m_targets.m_mapId); if (!targetMapEntry) return; if (!player->IsAlive() && targetMapEntry->IsDungeon()) @@ -4141,7 +4141,7 @@ void Spell::EffectPersistentAA(SpellEffectIndex eff_idx) if (!caster) caster = m_caster; - float radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); + float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); if (Player* modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this); @@ -4502,7 +4502,7 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx) // TODO add script for 35679 and 34877 uint32 prop_id = m_spellInfo->EffectMiscValueB[eff_idx]; - SummonPropertiesEntry const* summon_prop = sDBCSummonProperties.LookupEntry(prop_id); + SummonPropertiesEntry const* summon_prop = sSummonPropertiesStore.LookupEntry(prop_id); if (!summon_prop) { sLog.outError("EffectSummonType: Unhandled summon type %u", prop_id); @@ -4614,7 +4614,7 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx) } // Set summon positions - float radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); + float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); CreatureSummonPositions::iterator itr = summonPositions.begin(); for (++itr; itr != summonPositions.end(); ++itr) // In case of multiple summons around position for not-fist positions { @@ -5440,7 +5440,7 @@ void Spell::EffectEnchantItemPerm(SpellEffectIndex eff_idx) if (!enchant_id) return; - SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; @@ -5537,7 +5537,7 @@ void Spell::EffectEnchantItemTmp(SpellEffectIndex eff_idx) return; } - SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) { sLog.outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have nonexistent enchanting id %u ", m_spellInfo->Id, eff_idx, enchant_id); @@ -8445,7 +8445,7 @@ void Spell::EffectEnchantHeldItem(SpellEffectIndex eff_idx) if (!duration) duration = 10; // 10 seconds for enchants which don't have listed duration - SpellItemEnchantmentEntry const* pEnchant = sDBCSpellItemEnchantment.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; @@ -9199,13 +9199,13 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx) // FIXME: this can be better check for most objects but still hack else if (m_spellInfo->EffectRadiusIndex[eff_idx] && m_spellInfo->speed == 0) { - float dis = GetSpellRadius(sDBCSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); + float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } else { - float min_dis = GetSpellMinRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); - float max_dis = GetSpellMaxRange(sDBCSpellRange.LookupEntry(m_spellInfo->rangeIndex)); + float min_dis = GetSpellMinRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); + float max_dis = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); float dis = rand_norm_f() * (max_dis - min_dis) + min_dis; // special code for fishing bobber (TARGET_LOCATION_CASTER_FISHING_SPOT), should not try to avoid objects @@ -9478,7 +9478,7 @@ void Spell::EffectPlaySound(SpellEffectIndex eff_idx) return; uint32 soundId = m_spellInfo->EffectMiscValue[eff_idx]; - if (!sDBCSoundEntries.LookupEntry(soundId)) + if (!sSoundEntriesStore.LookupEntry(soundId)) { sLog.outError("EffectPlaySound: Sound (Id: %u) in spell %u does not exist.", soundId, m_spellInfo->Id); return; @@ -9493,7 +9493,7 @@ void Spell::EffectPlayMusic(SpellEffectIndex eff_idx) return; uint32 soundId = m_spellInfo->EffectMiscValue[eff_idx]; - if (!sDBCSoundEntries.LookupEntry(soundId)) + if (!sSoundEntriesStore.LookupEntry(soundId)) { sLog.outError("EffectPlayMusic: Sound (Id: %u) in spell %u does not exist.", soundId, m_spellInfo->Id); return; diff --git a/src/game/Spells/SpellHandler.cpp b/src/game/Spells/SpellHandler.cpp index c3740a7b6f2..2064ee9c6ce 100644 --- a/src/game/Spells/SpellHandler.cpp +++ b/src/game/Spells/SpellHandler.cpp @@ -210,7 +210,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) uint32 lockId = proto->LockID; if (lockId && !pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_UNLOCKED)) { - LockEntry const* lockInfo = sDBCLock.LookupEntry(lockId); + LockEntry const* lockInfo = sLockStore.LookupEntry(lockId); if (!lockInfo) { diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index 98c3bb27334..2a687d508ac 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -29,7 +29,7 @@ bool IsPrimaryProfessionSkill(uint32 skill) { - SkillLineEntry const* pSkill = sDBCSkillLine.LookupEntry(skill); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); if (!pSkill) return false; @@ -57,7 +57,7 @@ int32 GetSpellDuration(SpellEntry const* spellInfo) { if (!spellInfo) return 0; - SpellDurationEntry const* du = sDBCSpellDuration.LookupEntry(spellInfo->DurationIndex); + SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex); if (!du) return 0; return (du->Duration[0] == -1) ? -1 : abs(du->Duration[0]); @@ -67,7 +67,7 @@ int32 GetSpellMaxDuration(SpellEntry const* spellInfo) { if (!spellInfo) return 0; - SpellDurationEntry const* du = sDBCSpellDuration.LookupEntry(spellInfo->DurationIndex); + SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex); if (!du) return 0; return (du->Duration[2] == -1) ? -1 : abs(du->Duration[2]); @@ -136,7 +136,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, WorldObject* caster, Spell* return 0; } - SpellCastTimesEntry const* spellCastTimeEntry = sDBCSpellCastTimes.LookupEntry(spellInfo->CastingTimeIndex); + SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex); // not all spells have cast time index and this is all is passive abilities if (!spellCastTimeEntry) @@ -519,7 +519,7 @@ SpellCastResult GetErrorAtShapeshiftedCast(SpellEntry const* spellInfo, uint32 f bool actAsShifted = false; if (form > 0) { - SpellShapeshiftFormEntry const* shapeInfo = sDBCSpellShapeshiftForm.LookupEntry(form); + SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form); if (!shapeInfo) { sLog.outError("GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); @@ -580,7 +580,7 @@ void SpellMgr::LoadSpellTargetPositions() st.target_Z = fields[4].GetFloat(); st.target_Orientation = fields[5].GetFloat(); - MapEntry const* mapEntry = sDBCMap.LookupEntry(st.target_mapId); + MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId); if (!mapEntry) { sLog.outErrorDb("Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId); @@ -1521,7 +1521,7 @@ void SpellMgr::LoadSpellChains() mSpellChainsNext.clear(); // need for reload case // load known data for talents - for (auto talentInfo : sDBCTalent) + for (auto talentInfo : sTalentStore) { // not add ranks for 1 ranks talents (if exist non ranks spells then it will included in table data) if (!talentInfo->RankID[1]) @@ -1746,7 +1746,7 @@ void SpellMgr::LoadSpellChains() continue; } - if (TalentEntry const* talentEntry = sDBCTalent.LookupEntry(pos->talent_id)) + if (TalentEntry const* talentEntry = sTalentStore.LookupEntry(pos->talent_id)) { if (node.first != talentEntry->RankID[0]) { @@ -2516,7 +2516,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const* spell if (spellInfo->HasAttribute(SPELL_ATTR_EX4_CAST_ONLY_IN_OUTLAND) && !(player && player->IsGameMaster())) { uint32 v_map = Map::GetVirtualMapForMapAndZone(map_id, zone_id); - MapEntry const* mapEntry = sDBCMap.LookupEntry(v_map); + MapEntry const* mapEntry = sMapStore.LookupEntry(v_map); if (!mapEntry || mapEntry->addon < 1 || !mapEntry->IsContinent()) return SPELL_FAILED_REQUIRES_AREA; } @@ -2524,7 +2524,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const* spell // raid instance limitation if (spellInfo->HasAttribute(SPELL_ATTR_EX6_NOT_IN_RAID_INSTANCE)) { - MapEntry const* mapEntry = sDBCMap.LookupEntry(map_id); + MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); if (!mapEntry || mapEntry->IsRaid()) return SPELL_FAILED_REQUIRES_AREA; } @@ -2580,7 +2580,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const* spell case 24171: // Resurrection Impact Visual case 44535: // Spirit Heal (mana) { - MapEntry const* mapEntry = sDBCMap.LookupEntry(map_id); + MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); if (!mapEntry) return SPELL_FAILED_REQUIRES_AREA; return mapEntry->IsBattleGround() ? SPELL_CAST_OK : SPELL_FAILED_ONLY_BATTLEGROUNDS; @@ -2622,8 +2622,8 @@ void SpellMgr::LoadSkillLineAbilityMaps() uint32 count = 0; - BarGoLink bar(sDBCSkillLineAbility.GetNumRows()); - for (auto entry : sDBCSkillLineAbility) + BarGoLink bar(sSkillLineAbilityStore.GetNumRows()); + for (auto entry : sSkillLineAbilityStore) { bar.step(); mSkillLineAbilityMapBySpellId.insert(SkillLineAbilityMap::value_type(entry->spellId, entry)); @@ -2639,15 +2639,15 @@ void SpellMgr::LoadSkillRaceClassInfoMap() { mSkillRaceClassInfoMap.clear(); - BarGoLink bar(sDBCSkillRaceClassInfo.GetNumRows()); + BarGoLink bar(sSkillRaceClassInfoStore.GetNumRows()); uint32 count = 0; - for (auto skillRCInfo : sDBCSkillRaceClassInfo) + for (auto skillRCInfo : sSkillRaceClassInfoStore) { bar.step(); // not all skills really listed in ability skills list - if (!sDBCSkillLine.LookupEntry(skillRCInfo->skillId)) + if (!sSkillLineStore.LookupEntry(skillRCInfo->skillId)) continue; mSkillRaceClassInfoMap.insert(SkillRaceClassInfoMap::value_type(skillRCInfo->skillId, skillRCInfo)); diff --git a/src/game/Spells/SpellMgr.h b/src/game/Spells/SpellMgr.h index 129cd814e75..19babd60442 100644 --- a/src/game/Spells/SpellMgr.h +++ b/src/game/Spells/SpellMgr.h @@ -1306,7 +1306,7 @@ inline bool IsPositiveSpell(uint32 spellId, const WorldObject* caster = nullptr, inline void GetChainJumpRange(SpellEntry const* spellInfo, SpellEffectIndex effIdx, float& minSearchRangeCaster, float& maxSearchRangeTarget) { - const SpellRangeEntry* range = sDBCSpellRange.LookupEntry(spellInfo->rangeIndex); + const SpellRangeEntry* range = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE) maxSearchRangeTarget = range->maxRange; else diff --git a/src/game/Spells/UnitAuraProcHandler.cpp b/src/game/Spells/UnitAuraProcHandler.cpp index 5aa1ea109da..9bc0d7d7a13 100644 --- a/src/game/Spells/UnitAuraProcHandler.cpp +++ b/src/game/Spells/UnitAuraProcHandler.cpp @@ -2844,9 +2844,9 @@ SpellAuraProcResult Unit::HandleRaidProcFromChargeAuraProc(ProcExecutionData& da { float radius; if (spellProto->EffectRadiusIndex[effIdx]) - radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); + radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); else - radius = GetSpellMaxRange(sDBCSpellRange.LookupEntry(spellProto->rangeIndex)); + radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(spellProto->rangeIndex)); if (Unit* caster = triggeredByAura->GetCaster()) { @@ -2918,9 +2918,9 @@ SpellAuraProcResult Unit::HandleRaidProcFromChargeWithValueAuraProc(ProcExecutio { float radius; if (spellProto->EffectRadiusIndex[effIdx]) - radius = GetSpellRadius(sDBCSpellRadius.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); + radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); else - radius = GetSpellMaxRange(sDBCSpellRange.LookupEntry(spellProto->rangeIndex)); + radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(spellProto->rangeIndex)); if (Player* caster = static_cast(triggeredByAura->GetCaster())) { diff --git a/src/game/Tools/CharacterDatabaseCleaner.cpp b/src/game/Tools/CharacterDatabaseCleaner.cpp index cd1c175d039..b094b7e2901 100644 --- a/src/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/game/Tools/CharacterDatabaseCleaner.cpp @@ -91,7 +91,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table bool CharacterDatabaseCleaner::SkillCheck(uint32 skill) { - return sDBCSkillLine.LookupEntry(skill) != nullptr; + return sSkillLineStore.LookupEntry(skill) != nullptr; } void CharacterDatabaseCleaner::CleanCharacterSkills() diff --git a/src/game/World/World.cpp b/src/game/World/World.cpp index 91834b937ca..7122e2124ad 100644 --- a/src/game/World/World.cpp +++ b/src/game/World/World.cpp @@ -1409,7 +1409,7 @@ void World::DetectDBCLang() m_lang_confid = DEFAULT_LOCALE; } - ChrRacesEntry const* race = sDBCChrRaces.LookupEntry(RACE_HUMAN); + ChrRacesEntry const* race = sChrRacesStore.LookupEntry(RACE_HUMAN); MANGOS_ASSERT(race); std::string availableLocalsStr; diff --git a/src/game/vmap/GameObjectModel.cpp b/src/game/vmap/GameObjectModel.cpp index 7c14628006f..0068fc47818 100644 --- a/src/game/vmap/GameObjectModel.cpp +++ b/src/game/vmap/GameObjectModel.cpp @@ -126,7 +126,7 @@ bool GameObjectModel::initialize(const GameObject* const pGo, const GameObjectDi GameObjectModel* GameObjectModel::construct(const GameObject* const pGo) { - const GameObjectDisplayInfoEntry* info = sDBCGameObjectDisplayInfo.LookupEntry(pGo->GetDisplayId()); + const GameObjectDisplayInfoEntry* info = sGameObjectDisplayInfoStore.LookupEntry(pGo->GetDisplayId()); if (!info) return nullptr;