From 3416f6d8bb030fa4c89fe5356e1d562c72ab9094 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 1 Jul 2017 14:41:48 -0400 Subject: [PATCH] Cleaned up DB2 storage. --- Game/DataStorage/CliDB.cs | 26 ++++---- Game/DataStorage/ClientReader/CliDBReader.cs | 1 + Game/DataStorage/ClientReader/DB6Storage.cs | 2 - Game/DataStorage/DB2Manager.cs | 69 ++++++++++++-------- 4 files changed, 55 insertions(+), 43 deletions(-) diff --git a/Game/DataStorage/CliDB.cs b/Game/DataStorage/CliDB.cs index 0f9fcf18e..aef84f867 100644 --- a/Game/DataStorage/CliDB.cs +++ b/Game/DataStorage/CliDB.cs @@ -49,10 +49,10 @@ namespace Game.DataStorage ArtifactPowerLinkStorage = DB6Reader.Read("ArtifactPowerLink.db2", DB6Metas.ArtifactPowerLinkMeta, HotfixStatements.SEL_ARTIFACT_POWER_LINK); ArtifactPowerPickerStorage = DB6Reader.Read("ArtifactPowerPicker.db2", DB6Metas.ArtifactPowerPickerMeta, HotfixStatements.SEL_ARTIFACT_POWER_PICKER); ArtifactPowerRankStorage = DB6Reader.Read("ArtifactPowerRank.db2", DB6Metas.ArtifactPowerRankMeta, HotfixStatements.SEL_ARTIFACT_POWER_RANK); - ArtifactQuestXPStorage = DB6Reader.Read("ArtifactQuestXP.db2", DB6Metas.ArtifactQuestXPMeta, HotfixStatements.SEL_ARTIFACT_QUEST_XP); + //ArtifactQuestXPStorage = DB6Reader.Read("ArtifactQuestXP.db2", DB6Metas.ArtifactQuestXPMeta, HotfixStatements.SEL_ARTIFACT_QUEST_XP); AuctionHouseStorage = DB6Reader.Read("AuctionHouse.db2", DB6Metas.AuctionHouseMeta, HotfixStatements.SEL_AUCTION_HOUSE, HotfixStatements.SEL_AUCTION_HOUSE_LOCALE); BankBagSlotPricesStorage = DB6Reader.Read("BankBagSlotPrices.db2", DB6Metas.BankBagSlotPricesMeta, HotfixStatements.SEL_BANK_BAG_SLOT_PRICES); - BannedAddOnsStorage = DB6Reader.Read("BannedAddOns.db2", DB6Metas.BannedAddOnsMeta, HotfixStatements.SEL_BANNED_ADDONS); + //BannedAddOnsStorage = DB6Reader.Read("BannedAddOns.db2", DB6Metas.BannedAddOnsMeta, HotfixStatements.SEL_BANNED_ADDONS); BarberShopStyleStorage = DB6Reader.Read("BarberShopStyle.db2", DB6Metas.BarberShopStyleMeta, HotfixStatements.SEL_BARBER_SHOP_STYLE, HotfixStatements.SEL_BARBER_SHOP_STYLE_LOCALE); BattlePetBreedQualityStorage = DB6Reader.Read("BattlePetBreedQuality.db2", DB6Metas.BattlePetBreedQualityMeta, HotfixStatements.SEL_BATTLE_PET_BREED_QUALITY); BattlePetBreedStateStorage = DB6Reader.Read("BattlePetBreedState.db2", DB6Metas.BattlePetBreedStateMeta, HotfixStatements.SEL_BATTLE_PET_BREED_STATE); @@ -122,7 +122,7 @@ namespace Game.DataStorage ItemArmorQualityStorage = DB6Reader.Read("ItemArmorQuality.db2", DB6Metas.ItemArmorQualityMeta, HotfixStatements.SEL_ITEM_ARMOR_QUALITY); ItemArmorShieldStorage = DB6Reader.Read("ItemArmorShield.db2", DB6Metas.ItemArmorShieldMeta, HotfixStatements.SEL_ITEM_ARMOR_SHIELD); ItemArmorTotalStorage = DB6Reader.Read("ItemArmorTotal.db2", DB6Metas.ItemArmorTotalMeta, HotfixStatements.SEL_ITEM_ARMOR_TOTAL); - ItemBagFamilyStorage = DB6Reader.Read("ItemBagFamily.db2", DB6Metas.ItemBagFamilyMeta, HotfixStatements.SEL_ITEM_BAG_FAMILY, HotfixStatements.SEL_ITEM_BAG_FAMILY_LOCALE); + //ItemBagFamilyStorage = DB6Reader.Read("ItemBagFamily.db2", DB6Metas.ItemBagFamilyMeta, HotfixStatements.SEL_ITEM_BAG_FAMILY, HotfixStatements.SEL_ITEM_BAG_FAMILY_LOCALE); ItemBonusStorage = DB6Reader.Read("ItemBonus.db2", DB6Metas.ItemBonusMeta, HotfixStatements.SEL_ITEM_BONUS); ItemBonusListLevelDeltaStorage = DB6Reader.Read("ItemBonusListLevelDelta.db2", DB6Metas.ItemBonusListLevelDeltaMeta, HotfixStatements.SEL_ITEM_BONUS_LIST_LEVEL_DELTA); ItemBonusTreeNodeStorage = DB6Reader.Read("ItemBonusTreeNode.db2", DB6Metas.ItemBonusTreeNodeMeta, HotfixStatements.SEL_ITEM_BONUS_TREE_NODE); @@ -151,7 +151,7 @@ namespace Game.DataStorage ItemSpecOverrideStorage = DB6Reader.Read("ItemSpecOverride.db2", DB6Metas.ItemSpecOverrideMeta, HotfixStatements.SEL_ITEM_SPEC_OVERRIDE); ItemUpgradeStorage = DB6Reader.Read("ItemUpgrade.db2", DB6Metas.ItemUpgradeMeta, HotfixStatements.SEL_ITEM_UPGRADE); ItemXBonusTreeStorage = DB6Reader.Read("ItemXBonusTree.db2", DB6Metas.ItemXBonusTreeMeta, HotfixStatements.SEL_ITEM_X_BONUS_TREE); - KeyChainStorage = DB6Reader.Read("KeyChain.db2", DB6Metas.KeyChainMeta, HotfixStatements.SEL_KEY_CHAIN); + //KeyChainStorage = DB6Reader.Read("KeyChain.db2", DB6Metas.KeyChainMeta, HotfixStatements.SEL_KEY_CHAIN); LfgDungeonsStorage = DB6Reader.Read("LfgDungeons.db2", DB6Metas.LfgDungeonsMeta, HotfixStatements.SEL_LFG_DUNGEONS, HotfixStatements.SEL_LFG_DUNGEONS_LOCALE); LightStorage = DB6Reader.Read("Light.db2", DB6Metas.LightMeta, HotfixStatements.SEL_LIGHT); LiquidTypeStorage = DB6Reader.Read("LiquidType.db2", DB6Metas.LiquidTypeMeta, HotfixStatements.SEL_LIQUID_TYPE, HotfixStatements.SEL_LIQUID_TYPE_LOCALE); @@ -191,7 +191,7 @@ namespace Game.DataStorage ScalingStatDistributionStorage = DB6Reader.Read("ScalingStatDistribution.db2", DB6Metas.ScalingStatDistributionMeta, HotfixStatements.SEL_SCALING_STAT_DISTRIBUTION); ScenarioStorage = DB6Reader.Read("Scenario.db2", DB6Metas.ScenarioMeta, HotfixStatements.SEL_SCENARIO, HotfixStatements.SEL_SCENARIO_LOCALE); ScenarioStepStorage = DB6Reader.Read("ScenarioStep.db2", DB6Metas.ScenarioStepMeta, HotfixStatements.SEL_SCENARIO_STEP, HotfixStatements.SEL_SCENARIO_STEP_LOCALE); - SceneScriptStorage = DB6Reader.Read("SceneScript.db2", DB6Metas.SceneScriptMeta, HotfixStatements.SEL_SCENE_SCRIPT); + //SceneScriptStorage = DB6Reader.Read("SceneScript.db2", DB6Metas.SceneScriptMeta, HotfixStatements.SEL_SCENE_SCRIPT); SceneScriptPackageStorage = DB6Reader.Read("SceneScriptPackage.db2", DB6Metas.SceneScriptPackageMeta, HotfixStatements.SEL_SCENE_SCRIPT_PACKAGE); SkillLineStorage = DB6Reader.Read("SkillLine.db2", DB6Metas.SkillLineMeta, HotfixStatements.SEL_SKILL_LINE, HotfixStatements.SEL_SKILL_LINE_LOCALE); SkillLineAbilityStorage = DB6Reader.Read("SkillLineAbility.db2", DB6Metas.SkillLineAbilityMeta, HotfixStatements.SEL_SKILL_LINE_ABILITY); @@ -232,7 +232,7 @@ namespace Game.DataStorage SpellTotemsStorage = DB6Reader.Read("SpellTotems.db2", DB6Metas.SpellTotemsMeta, HotfixStatements.SEL_SPELL_TOTEMS); SpellXSpellVisualStorage = DB6Reader.Read("SpellXSpellVisual.db2", DB6Metas.SpellXSpellVisualMeta, HotfixStatements.SEL_SPELL_X_SPELL_VISUAL); SummonPropertiesStorage = DB6Reader.Read("SummonProperties.db2", DB6Metas.SummonPropertiesMeta, HotfixStatements.SEL_SUMMON_PROPERTIES); - TactKeyStorage = DB6Reader.Read("TactKey.db2", DB6Metas.TactKeyMeta, HotfixStatements.SEL_TACT_KEY); + //TactKeyStorage = DB6Reader.Read("TactKey.db2", DB6Metas.TactKeyMeta, HotfixStatements.SEL_TACT_KEY); TalentStorage = DB6Reader.Read("Talent.db2", DB6Metas.TalentMeta, HotfixStatements.SEL_TALENT, HotfixStatements.SEL_TALENT_LOCALE); TaxiNodesStorage = DB6Reader.Read("TaxiNodes.db2", DB6Metas.TaxiNodesMeta, HotfixStatements.SEL_TAXI_NODES, HotfixStatements.SEL_TAXI_NODES_LOCALE); TaxiPathStorage = DB6Reader.Read("TaxiPath.db2", DB6Metas.TaxiPathMeta, HotfixStatements.SEL_TAXI_PATH); @@ -273,7 +273,7 @@ namespace Game.DataStorage foreach (var entry in TaxiPathNodeStorage.Values) TaxiPathNodesByPath[entry.PathID][entry.NodeIndex] = entry; - TaxiPathNodeStorage.Clear(); + TaxiPathNodeStorage = null; foreach (var node in TaxiNodesStorage.Values) { @@ -367,10 +367,10 @@ namespace Game.DataStorage public static DB6Storage ArtifactPowerLinkStorage; public static DB6Storage ArtifactPowerPickerStorage; public static DB6Storage ArtifactPowerRankStorage; - public static DB6Storage ArtifactQuestXPStorage; + //public static DB6Storage ArtifactQuestXPStorage; public static DB6Storage AuctionHouseStorage; public static DB6Storage BankBagSlotPricesStorage; - public static DB6Storage BannedAddOnsStorage; + //public static DB6Storage BannedAddOnsStorage; public static DB6Storage BarberShopStyleStorage; public static DB6Storage BattlePetBreedQualityStorage; public static DB6Storage BattlePetBreedStateStorage; @@ -440,7 +440,7 @@ namespace Game.DataStorage public static DB6Storage ItemArmorQualityStorage; public static DB6Storage ItemArmorShieldStorage; public static DB6Storage ItemArmorTotalStorage; - public static DB6Storage ItemBagFamilyStorage; + //public static DB6Storage ItemBagFamilyStorage; public static DB6Storage ItemBonusStorage; public static DB6Storage ItemBonusListLevelDeltaStorage; public static DB6Storage ItemBonusTreeNodeStorage; @@ -469,7 +469,7 @@ namespace Game.DataStorage public static DB6Storage ItemSpecOverrideStorage; public static DB6Storage ItemUpgradeStorage; public static DB6Storage ItemXBonusTreeStorage; - public static DB6Storage KeyChainStorage; + //public static DB6Storage KeyChainStorage; public static DB6Storage LfgDungeonsStorage; public static DB6Storage LightStorage; public static DB6Storage LiquidTypeStorage; @@ -509,7 +509,7 @@ namespace Game.DataStorage public static DB6Storage ScalingStatDistributionStorage; public static DB6Storage ScenarioStorage; public static DB6Storage ScenarioStepStorage; - public static DB6Storage SceneScriptStorage; + //public static DB6Storage SceneScriptStorage; public static DB6Storage SceneScriptPackageStorage; public static DB6Storage SkillLineStorage; public static DB6Storage SkillLineAbilityStorage; @@ -550,7 +550,7 @@ namespace Game.DataStorage public static DB6Storage SpellTotemsStorage; public static DB6Storage SpellXSpellVisualStorage; public static DB6Storage SummonPropertiesStorage; - public static DB6Storage TactKeyStorage; + //public static DB6Storage TactKeyStorage; public static DB6Storage TalentStorage; public static DB6Storage TaxiNodesStorage; public static DB6Storage TaxiPathStorage; diff --git a/Game/DataStorage/ClientReader/CliDBReader.cs b/Game/DataStorage/ClientReader/CliDBReader.cs index d98055c03..810add22d 100644 --- a/Game/DataStorage/ClientReader/CliDBReader.cs +++ b/Game/DataStorage/ClientReader/CliDBReader.cs @@ -140,6 +140,7 @@ namespace Game.DataStorage storage.LoadData(index, fieldsInfo, preparedStatement, preparedStatementLocale); } + Global.DB2Mgr.AddDB2(_header.TableHash, storage); CliDB.LoadedFileCount++; return storage; } diff --git a/Game/DataStorage/ClientReader/DB6Storage.cs b/Game/DataStorage/ClientReader/DB6Storage.cs index 0f82fb114..dc51e5af8 100644 --- a/Game/DataStorage/ClientReader/DB6Storage.cs +++ b/Game/DataStorage/ClientReader/DB6Storage.cs @@ -353,7 +353,5 @@ namespace Game.DataStorage { Remove(id); } - - public uint tableHash; } } diff --git a/Game/DataStorage/DB2Manager.cs b/Game/DataStorage/DB2Manager.cs index 2e89f416e..123b69111 100644 --- a/Game/DataStorage/DB2Manager.cs +++ b/Game/DataStorage/DB2Manager.cs @@ -121,7 +121,6 @@ namespace Game.DataStorage _powersByClass[power.ClassID][power.PowerType] = index; } - CliDB.ChrClassesXPowerTypesStorage.Clear(); foreach (ChrSpecializationRecord chrSpec in CliDB.ChrSpecializationStorage.Values) { @@ -391,31 +390,45 @@ namespace Game.DataStorage void ClearNotUsedTables() { - CliDB.AreaGroupMemberStorage.Clear(); - CliDB.CharSectionsStorage.Clear(); - CliDB.ChrClassesXPowerTypesStorage.Clear(); - CliDB.EmotesTextSoundStorage.Clear(); - CliDB.HeirloomStorage.Clear(); - CliDB.ItemBonusStorage.Clear(); - CliDB.ItemBonusTreeNodeStorage.Clear(); - CliDB.ItemChildEquipmentStorage.Clear(); - CliDB.ItemModifiedAppearanceStorage.Clear(); - CliDB.ItemSetSpellStorage.Clear(); - CliDB.ItemSpecOverrideStorage.Clear(); - CliDB.ItemXBonusTreeStorage.Clear(); - CliDB.CurvePointStorage.Clear(); - CliDB.MountTypeXCapabilityStorage.Clear(); - CliDB.NameGenStorage.Clear(); - CliDB.NamesProfanityStorage.Clear(); - CliDB.NamesReservedStorage.Clear(); - CliDB.NamesReservedLocaleStorage.Clear(); - CliDB.PhaseXPhaseGroupStorage.Clear(); - CliDB.QuestPackageItemStorage.Clear(); - CliDB.SpecializationSpellsStorage.Clear(); - CliDB.SpellPowerDifficultyStorage.Clear(); - CliDB.SpellPowerStorage.Clear(); - CliDB.ToyStorage.Clear(); - CliDB.WMOAreaTableStorage.Clear(); + CliDB.AreaGroupMemberStorage = null; + CliDB.ArtifactPowerLinkStorage = null; + CliDB.ArtifactPowerRankStorage = null; + CliDB.CharSectionsStorage = null; + CliDB.ChrClassesXPowerTypesStorage = null; + CliDB.CurvePointStorage = null; + CliDB.EmotesTextSoundStorage = null; + CliDB.GlyphBindableSpellStorage = null; + CliDB.GlyphRequiredSpecStorage = null; + CliDB.HeirloomStorage = null; + CliDB.ItemBonusStorage = null; + CliDB.ItemBonusListLevelDeltaStorage = null; + CliDB.ItemBonusTreeNodeStorage = null; + CliDB.ItemClassStorage = null; + CliDB.ItemChildEquipmentStorage = null; + CliDB.ItemCurrencyCostStorage = null; + CliDB.ItemSetSpellStorage = null; + CliDB.ItemSpecOverrideStorage = null; + CliDB.ItemXBonusTreeStorage = null; + CliDB.MapDifficultyStorage = null; + CliDB.MountTypeXCapabilityStorage = null; + CliDB.MountXDisplayStorage = null; + CliDB.NameGenStorage = null; + CliDB.NamesProfanityStorage = null; + CliDB.NamesReservedStorage = null; + CliDB.NamesReservedLocaleStorage = null; + CliDB.PhaseXPhaseGroupStorage = null; + CliDB.PowerTypeStorage = null; + CliDB.PvpRewardStorage = null; + CliDB.QuestPackageItemStorage = null; + CliDB.RewardPackXItemStorage = null; + CliDB.RulesetItemUpgradeStorage = null; + CliDB.SpecializationSpellsStorage = null; + CliDB.SpellPowerDifficultyStorage = null; + CliDB.SpellPowerStorage = null; + CliDB.SpellProcsPerMinuteModStorage = null; + CliDB.ToyStorage = null; + CliDB.WMOAreaTableStorage = null; + CliDB.WorldMapAreaStorage = null; } public IDB2Storage GetStorage(uint type) @@ -1274,9 +1287,9 @@ namespace Game.DataStorage public Dictionary> GetMapDifficulties() { return _mapDifficulties; } - public void AddDB2(DB6Storage store) where T : new() + public void AddDB2(uint tableHash, DB6Storage store) where T : new() { - _storage[store.tableHash] = store; + _storage[tableHash] = store; } Dictionary _storage = new Dictionary();