Core/DataStores: Updated db2 structures to 8.2.5

Port From (https://github.com/TrinityCore/TrinityCore/commit/3ac790287aba5f7d7c3bccf79e608de9119e461a)
This commit is contained in:
hondacrx
2019-10-29 13:09:23 -04:00
parent c6e53b2ba7
commit e95115dc94
54 changed files with 4589 additions and 349 deletions
-6
View File
@@ -161,7 +161,6 @@ namespace Game.DataStorage
ItemSparseStorage = DBReader.Read<ItemSparseRecord>("ItemSparse.db2", HotfixStatements.SEL_ITEM_SPARSE, HotfixStatements.SEL_ITEM_SPARSE_LOCALE);
ItemSpecStorage = DBReader.Read<ItemSpecRecord>("ItemSpec.db2", HotfixStatements.SEL_ITEM_SPEC);
ItemSpecOverrideStorage = DBReader.Read<ItemSpecOverrideRecord>("ItemSpecOverride.db2", HotfixStatements.SEL_ITEM_SPEC_OVERRIDE);
ItemUpgradeStorage = DBReader.Read<ItemUpgradeRecord>("ItemUpgrade.db2", HotfixStatements.SEL_ITEM_UPGRADE);
ItemXBonusTreeStorage = DBReader.Read<ItemXBonusTreeRecord>("ItemXBonusTree.db2", HotfixStatements.SEL_ITEM_X_BONUS_TREE);
//KeyChainStorage = DBReader.Read<KeyChainRecord>("KeyChain.db2", HotfixStatements.SEL_KEYCHAIN);
LFGDungeonsStorage = DBReader.Read<LFGDungeonsRecord>("LFGDungeons.db2", HotfixStatements.SEL_LFG_DUNGEONS, HotfixStatements.SEL_LFG_DUNGEONS_LOCALE);
@@ -204,7 +203,6 @@ namespace Game.DataStorage
RewardPackStorage = DBReader.Read<RewardPackRecord>("RewardPack.db2", HotfixStatements.SEL_REWARD_PACK);
RewardPackXCurrencyTypeStorage = DBReader.Read<RewardPackXCurrencyTypeRecord>("RewardPackXCurrencyType.db2", HotfixStatements.SEL_REWARD_PACK_X_CURRENCY_TYPE);
RewardPackXItemStorage = DBReader.Read<RewardPackXItemRecord>("RewardPackXItem.db2", HotfixStatements.SEL_REWARD_PACK_X_ITEM);
RulesetItemUpgradeStorage = DBReader.Read<RulesetItemUpgradeRecord>("RulesetItemUpgrade.db2", HotfixStatements.SEL_RULESET_ITEM_UPGRADE);
ScalingStatDistributionStorage = DBReader.Read<ScalingStatDistributionRecord>("ScalingStatDistribution.db2", HotfixStatements.SEL_SCALING_STAT_DISTRIBUTION);
ScenarioStorage = DBReader.Read<ScenarioRecord>("Scenario.db2", HotfixStatements.SEL_SCENARIO, HotfixStatements.SEL_SCENARIO_LOCALE);
ScenarioStepStorage = DBReader.Read<ScenarioStepRecord>("ScenarioStep.db2", HotfixStatements.SEL_SCENARIO_STEP, HotfixStatements.SEL_SCENARIO_STEP_LOCALE);
@@ -274,7 +272,6 @@ namespace Game.DataStorage
WMOAreaTableStorage = DBReader.Read<WMOAreaTableRecord>("WMOAreaTable.db2", HotfixStatements.SEL_WMO_AREA_TABLE, HotfixStatements.SEL_WMO_AREA_TABLE_LOCALE);
WorldEffectStorage = DBReader.Read<WorldEffectRecord>("WorldEffect.db2", HotfixStatements.SEL_WORLD_EFFECT);
WorldMapOverlayStorage = DBReader.Read<WorldMapOverlayRecord>("WorldMapOverlay.db2", HotfixStatements.SEL_WORLD_MAP_OVERLAY);
WorldSafeLocsStorage = DBReader.Read<WorldSafeLocsRecord>("WorldSafeLocs.db2", HotfixStatements.SEL_WORLD_SAFE_LOCS, HotfixStatements.SEL_WORLD_SAFE_LOCS_LOCALE);
WorldStateExpressionStorage = DBReader.Read<WorldStateExpressionRecord>("WorldStateExpression.db2", HotfixStatements.SEL_WORLD_STATE_EXPRESSION);
Global.DB2Mgr.LoadStores();
@@ -507,7 +504,6 @@ namespace Game.DataStorage
public static DB6Storage<ItemSparseRecord> ItemSparseStorage;
public static DB6Storage<ItemSpecRecord> ItemSpecStorage;
public static DB6Storage<ItemSpecOverrideRecord> ItemSpecOverrideStorage;
public static DB6Storage<ItemUpgradeRecord> ItemUpgradeStorage;
public static DB6Storage<ItemXBonusTreeRecord> ItemXBonusTreeStorage;
//public static DB6Storage<KeyChainRecord> KeyChainStorage;
public static DB6Storage<LFGDungeonsRecord> LFGDungeonsStorage;
@@ -550,7 +546,6 @@ namespace Game.DataStorage
public static DB6Storage<RewardPackRecord> RewardPackStorage;
public static DB6Storage<RewardPackXCurrencyTypeRecord> RewardPackXCurrencyTypeStorage;
public static DB6Storage<RewardPackXItemRecord> RewardPackXItemStorage;
public static DB6Storage<RulesetItemUpgradeRecord> RulesetItemUpgradeStorage;
public static DB6Storage<ScalingStatDistributionRecord> ScalingStatDistributionStorage;
public static DB6Storage<ScenarioRecord> ScenarioStorage;
public static DB6Storage<ScenarioStepRecord> ScenarioStepStorage;
@@ -620,7 +615,6 @@ namespace Game.DataStorage
public static DB6Storage<WMOAreaTableRecord> WMOAreaTableStorage;
public static DB6Storage<WorldEffectRecord> WorldEffectStorage;
public static DB6Storage<WorldMapOverlayRecord> WorldMapOverlayStorage;
public static DB6Storage<WorldSafeLocsRecord> WorldSafeLocsStorage;
public static DB6Storage<WorldStateExpressionRecord> WorldStateExpressionStorage;
#endregion
@@ -127,11 +127,13 @@ namespace Game.DataStorage
}
long previousStringTableSize = 0;
long previousRecordCount = 0;
for (int sectionIndex = 0; sectionIndex < Header.SectionsCount; sectionIndex++)
{
if (sections[sectionIndex].TactKeyLookup != 0)// && !hasTactKeyFunc(sections[sectionIndex].TactKeyLookup))
{
previousStringTableSize += sections[sectionIndex].StringTableSize;
previousRecordCount += sections[sectionIndex].NumRecords;
//Console.WriteLine("Detected db2 with encrypted section! HasKey {0}", CASC.HasKey(Sections[sectionIndex].TactKeyLookup));
continue;
}
@@ -150,17 +152,11 @@ namespace Game.DataStorage
// string data
stringsTable = new Dictionary<long, string>();
long stringDataOffset = 0;
if (sectionIndex == 0)
stringDataOffset = (Header.RecordCount - sections[sectionIndex].NumRecords) * Header.RecordSize;
else
stringDataOffset = previousStringTableSize;
for (int i = 0; i < sections[sectionIndex].StringTableSize;)
{
long oldPos = reader.BaseStream.Position;
stringsTable[oldPos + stringDataOffset] = reader.ReadCString();
stringsTable[i + previousStringTableSize] = reader.ReadCString();
i += (int)(reader.BaseStream.Position - oldPos);
}
@@ -238,7 +234,10 @@ namespace Game.DataStorage
bool hasRef = refData.Entries.TryGetValue(i, out int refId);
var rec = new WDC3Row(this, bitReader, sections[sectionIndex].FileOffset, Header.HasIndexTable() ? (isIndexEmpty ? i : indexData[i]) : -1, hasRef ? refId : -1, stringsTable);
long recordIndex = i + previousRecordCount;
long recordOffset = (recordIndex * Header.RecordSize) - (Header.RecordCount * Header.RecordSize);
var rec = new WDC3Row(this, bitReader, (int)recordOffset, Header.HasIndexTable() ? (isIndexEmpty ? i : indexData[i]) : -1, hasRef ? refId : -1, stringsTable);
_records.Add(rec.Id, rec);
}
@@ -250,6 +249,7 @@ namespace Game.DataStorage
}
previousStringTableSize += sections[sectionIndex].StringTableSize;
previousRecordCount += sections[sectionIndex].NumRecords;
}
}
@@ -455,7 +455,7 @@ namespace Game.DataStorage
}
else
{
var pos = _recordsOffset + _data.Offset + (_data.Position >> 3);
var pos = _recordsOffset + (_data.Position >> 3);
int[] strIdx = GetFieldValueArray<int>(fieldIndex, atr.Length);
@@ -522,7 +522,7 @@ namespace Game.DataStorage
}
else
{
var pos = _recordsOffset + _data.Offset + (_data.Position >> 3);
var pos = _recordsOffset + (_data.Position >> 3);
int ofs = GetFieldValue<int>(fieldIndex);
f.SetValue(obj, _stringsTable.LookupByKey(pos + ofs));
}
-11
View File
@@ -397,11 +397,6 @@ namespace Game.DataStorage
CliDB.RewardPackXItemStorage.Clear();
foreach (RulesetItemUpgradeRecord rulesetItemUpgrade in CliDB.RulesetItemUpgradeStorage.Values)
_rulesetItemUpgrade[rulesetItemUpgrade.ItemID] = rulesetItemUpgrade.ItemUpgradeID;
CliDB.RulesetItemUpgradeStorage.Clear();
foreach (SkillLineRecord skill in CliDB.SkillLineStorage.Values)
{
if (skill.ParentSkillLineID != 0)
@@ -1518,11 +1513,6 @@ namespace Game.DataStorage
return _rewardPackItems.LookupByKey(rewardPackID);
}
public uint GetRulesetItemUpgrade(uint itemId)
{
return _rulesetItemUpgrade.LookupByKey(itemId);
}
public List<SkillLineRecord> GetSkillLinesForParentSkill(uint parentSkillId)
{
return _skillLinesByParentSkillLine.LookupByKey(parentSkillId);
@@ -1982,7 +1972,6 @@ namespace Game.DataStorage
Dictionary<uint, Tuple<List<QuestPackageItemRecord>, List<QuestPackageItemRecord>>> _questPackages = new Dictionary<uint, Tuple<List<QuestPackageItemRecord>, List<QuestPackageItemRecord>>>();
MultiMap<uint, RewardPackXCurrencyTypeRecord> _rewardPackCurrencyTypes = new MultiMap<uint, RewardPackXCurrencyTypeRecord>();
MultiMap<uint, RewardPackXItemRecord> _rewardPackItems = new MultiMap<uint, RewardPackXItemRecord>();
Dictionary<uint, uint> _rulesetItemUpgrade = new Dictionary<uint, uint>();
MultiMap<uint, SkillLineRecord> _skillLinesByParentSkillLine = new MultiMap<uint, SkillLineRecord>();
MultiMap<uint, SkillLineAbilityRecord> _skillLineAbilitiesBySkillupSkill = new MultiMap<uint, SkillLineAbilityRecord>();
MultiMap<uint, SkillRaceClassInfoRecord> _skillRaceClassInfoBySkill = new MultiMap<uint, SkillRaceClassInfoRecord>();
+2 -11
View File
@@ -63,6 +63,7 @@ namespace Game.DataStorage
{
public uint Id;
public byte DisplayType;
public int SubclassID;
public uint ItemDisplayInfoID;
public int DefaultIconFileDataID;
public int UiOrder;
@@ -346,7 +347,7 @@ namespace Game.DataStorage
public ushort SocketMatchEnchantmentId;
public ushort TotemCategoryID;
public ushort InstanceBound;
public ushort ZoneBound;
public ushort[] ZoneBound = new ushort[2];
public ushort ItemSet;
public ushort LockID;
public ushort StartQuestID;
@@ -397,16 +398,6 @@ namespace Game.DataStorage
public uint ItemID;
}
public sealed class ItemUpgradeRecord
{
public uint Id;
public byte ItemUpgradePathID;
public byte ItemLevelIncrement;
public ushort PrerequisiteID;
public ushort CurrencyType;
public uint CurrencyAmount;
}
public sealed class ItemXBonusTreeRecord
{
public uint Id;
+1 -1
View File
@@ -129,9 +129,9 @@ namespace Game.DataStorage
public sealed class PowerTypeRecord
{
public uint Id;
public string NameGlobalStringTag;
public string CostGlobalStringTag;
public uint Id;
public PowerType PowerTypeEnum;
public sbyte MinPower;
public short MaxBasePower;
@@ -53,11 +53,4 @@ namespace Game.DataStorage
public uint ItemQuantity;
public uint RewardPackID;
}
public sealed class RulesetItemUpgradeRecord
{
public uint Id;
public uint ItemID;
public ushort ItemUpgradeID;
}
}
+2 -2
View File
@@ -269,12 +269,12 @@ namespace Game.DataStorage
public sealed class SpellEffectRecord
{
public uint Id;
public short EffectAura;
public uint DifficultyID;
public uint EffectIndex;
public uint Effect;
public float EffectAmplitude;
public int EffectAttributes;
public short EffectAura;
public uint EffectAuraPeriod;
public float EffectBonusCoefficient;
public float EffectChainAmplitude;
@@ -382,6 +382,7 @@ namespace Game.DataStorage
public sealed class SpellMiscRecord
{
public uint Id;
public int[] Attributes = new int[14];
public byte DifficultyID;
public ushort CastingTimeIndex;
public ushort DurationIndex;
@@ -393,7 +394,6 @@ namespace Game.DataStorage
public uint SpellIconFileDataID;
public uint ActiveIconFileDataID;
public uint ContentTuningID;
public int[] Attributes = new int[14];
public uint SpellID;
}
@@ -117,6 +117,7 @@ namespace Game.DataStorage
public byte ExpansionID;
public int PatchID;
public short UiOrder;
public uint PlayerConditionID;
}
public sealed class TransmogSetGroupRecord
+1 -1
View File
@@ -79,7 +79,7 @@ namespace Game.DataStorage
public string ToolTip;
public uint MinPower;
public uint MaxPower;
public ushort StartPower;
public uint StartPower;
public byte CenterPower;
public float RegenerationPeace;
public float RegenerationCombat;
@@ -67,15 +67,6 @@ namespace Game.DataStorage
public uint[] AreaID = new uint[SharedConst.MaxWorldMapOverlayArea];
}
public sealed class WorldSafeLocsRecord
{
public uint Id;
public string AreaName;
public Vector3 Loc;
public ushort MapID;
public float Facing;
}
public sealed class WorldStateExpressionRecord
{
public uint Id;