diff --git a/Source/Game/DataStorage/ClientReader/DB6Storage.cs b/Source/Game/DataStorage/ClientReader/DB6Storage.cs index 9c04ee182..bc8d37c8b 100644 --- a/Source/Game/DataStorage/ClientReader/DB6Storage.cs +++ b/Source/Game/DataStorage/ClientReader/DB6Storage.cs @@ -34,16 +34,20 @@ namespace Game.DataStorage void WriteRecord(uint id, Locale locale, ByteBuffer buffer); void EraseRecord(uint id); + + string GetName(); } [Serializable] public class DB6Storage : Dictionary, IDB2Storage where T : new() { WDCHeader _header; + string _tableName; public void LoadData(WDCHeader header, BitSet availableDb2Locales, HotfixStatements preparedStatement, HotfixStatements preparedStatementLocale) { _header = header; + _tableName = typeof(T).Name; SQLResult result = DB.Hotfix.Query(DB.Hotfix.GetPreparedStatement(preparedStatement)); if (!result.IsEmpty()) @@ -384,5 +388,10 @@ namespace Game.DataStorage } public uint GetTableHash() { return _header.TableHash; } + + public string GetName() + { + return _tableName; + } } } diff --git a/Source/Game/DataStorage/DB2Manager.cs b/Source/Game/DataStorage/DB2Manager.cs index 67392b0d5..36ca72a7d 100644 --- a/Source/Game/DataStorage/DB2Manager.cs +++ b/Source/Game/DataStorage/DB2Manager.cs @@ -54,8 +54,6 @@ namespace Game.DataStorage foreach (var areaGroupMember in CliDB.AreaGroupMemberStorage.Values) _areaGroupMembers.Add(areaGroupMember.AreaGroupID, areaGroupMember.AreaID); - CliDB.AreaGroupMemberStorage.Clear(); - foreach (ArtifactPowerRecord artifactPower in CliDB.ArtifactPowerStorage.Values) _artifactPowers.Add(artifactPower.ArtifactID, artifactPower); @@ -65,23 +63,15 @@ namespace Game.DataStorage _artifactPowerLinks.Add(artifactPowerLink.PowerB, artifactPowerLink.PowerA); } - CliDB.ArtifactPowerLinkStorage.Clear(); - foreach (ArtifactPowerRankRecord artifactPowerRank in CliDB.ArtifactPowerRankStorage.Values) _artifactPowerRanks[Tuple.Create(artifactPowerRank.ArtifactPowerID, artifactPowerRank.RankIndex)] = artifactPowerRank; - CliDB.ArtifactPowerRankStorage.Clear(); - foreach (AzeriteEmpoweredItemRecord azeriteEmpoweredItem in CliDB.AzeriteEmpoweredItemStorage.Values) _azeriteEmpoweredItems[azeriteEmpoweredItem.ItemID] = azeriteEmpoweredItem; - CliDB.AzeriteEmpoweredItemStorage.Clear(); - foreach (AzeriteEssencePowerRecord azeriteEssencePower in CliDB.AzeriteEssencePowerStorage.Values) _azeriteEssencePowersByIdAndRank[((uint)azeriteEssencePower.AzeriteEssenceID, (uint)azeriteEssencePower.Tier)] = azeriteEssencePower; - CliDB.AzeriteEssencePowerStorage.Clear(); - foreach (AzeriteItemMilestonePowerRecord azeriteItemMilestonePower in CliDB.AzeriteItemMilestonePowerStorage.Values) _azeriteItemMilestonePowers.Add(azeriteItemMilestonePower); @@ -103,8 +93,6 @@ namespace Game.DataStorage if (CliDB.AzeritePowerStorage.ContainsKey(azeritePowerSetMember.AzeritePowerID)) _azeritePowers.Add(azeritePowerSetMember.AzeritePowerSetID, azeritePowerSetMember); - CliDB.AzeritePowerSetMemberStorage.Clear(); - foreach (AzeriteTierUnlockRecord azeriteTierUnlock in CliDB.AzeriteTierUnlockStorage.Values) { var key = (azeriteTierUnlock.AzeriteTierUnlockSetID, (ItemContext)azeriteTierUnlock.ItemCreationContext); @@ -143,8 +131,6 @@ namespace Game.DataStorage foreach (var chrClasses in CliDB.ChrClassesXPowerTypesStorage.Values) powers.Add(chrClasses); - CliDB.ChrClassesXPowerTypesStorage.Clear(); - powers.Sort(new ChrClassesXPowerTypesRecordComparer()); foreach (var power in powers) { @@ -264,21 +250,15 @@ namespace Game.DataStorage _curvePoints.Add(curvePoint.CurveID, curvePoint); } - CliDB.CurvePointStorage.Clear(); - foreach (var key in _curvePoints.Keys.ToList()) _curvePoints[key] = _curvePoints[key].OrderBy(point => point.OrderIndex).ToList(); foreach (EmotesTextSoundRecord emoteTextSound in CliDB.EmotesTextSoundStorage.Values) - _emoteTextSounds[Tuple.Create((uint)emoteTextSound.EmotesTextId, emoteTextSound.RaceId, emoteTextSound.SexId, emoteTextSound.ClassId)] = emoteTextSound; - - CliDB.EmotesTextSoundStorage.Clear(); + _emoteTextSounds[Tuple.Create(emoteTextSound.EmotesTextId, emoteTextSound.RaceId, emoteTextSound.SexId, emoteTextSound.ClassId)] = emoteTextSound; foreach (ExpectedStatRecord expectedStat in CliDB.ExpectedStatStorage.Values) _expectedStatsByLevel[Tuple.Create(expectedStat.Lvl, expectedStat.ExpansionID)] = expectedStat; - CliDB.ExpectedStatStorage.Clear(); - foreach (FactionRecord faction in CliDB.FactionStorage.Values) if (faction.ParentFactionID != 0) _factionTeams.Add(faction.ParentFactionID, faction.Id); @@ -296,41 +276,27 @@ namespace Game.DataStorage foreach (HeirloomRecord heirloom in CliDB.HeirloomStorage.Values) _heirlooms[heirloom.ItemID] = heirloom; - CliDB.HeirloomStorage.Clear(); - foreach (GlyphBindableSpellRecord glyphBindableSpell in CliDB.GlyphBindableSpellStorage.Values) - _glyphBindableSpells.Add((uint)glyphBindableSpell.GlyphPropertiesID, (uint)glyphBindableSpell.SpellID); - - CliDB.GlyphBindableSpellStorage.Clear(); + _glyphBindableSpells.Add(glyphBindableSpell.GlyphPropertiesID, (uint)glyphBindableSpell.SpellID); foreach (GlyphRequiredSpecRecord glyphRequiredSpec in CliDB.GlyphRequiredSpecStorage.Values) _glyphRequiredSpecs.Add(glyphRequiredSpec.GlyphPropertiesID, glyphRequiredSpec.ChrSpecializationID); - CliDB.GlyphRequiredSpecStorage.Clear(); - foreach (var bonus in CliDB.ItemBonusStorage.Values) _itemBonusLists.Add(bonus.ParentItemBonusListID, bonus); - CliDB.ItemBonusStorage.Clear(); - foreach (ItemBonusListLevelDeltaRecord itemBonusListLevelDelta in CliDB.ItemBonusListLevelDeltaStorage.Values) _itemLevelDeltaToBonusListContainer[itemBonusListLevelDelta.ItemLevelDelta] = itemBonusListLevelDelta.Id; - CliDB.ItemBonusListLevelDeltaStorage.Clear(); - foreach (var bonusTreeNode in CliDB.ItemBonusTreeNodeStorage.Values) _itemBonusTrees.Add(bonusTreeNode.ParentItemBonusTreeID, bonusTreeNode); - CliDB.ItemBonusTreeNodeStorage.Clear(); - foreach (ItemChildEquipmentRecord itemChildEquipment in CliDB.ItemChildEquipmentStorage.Values) { //ASSERT(_itemChildEquipment.find(itemChildEquipment.ParentItemID) == _itemChildEquipment.end(), "Item must have max 1 child item."); _itemChildEquipment[itemChildEquipment.ParentItemID] = itemChildEquipment; } - CliDB.ItemChildEquipmentStorage.Clear(); - foreach (ItemClassRecord itemClass in CliDB.ItemClassStorage.Values) { //ASSERT(itemClass.ClassID < _itemClassByOldEnum.size()); @@ -338,20 +304,14 @@ namespace Game.DataStorage _itemClassByOldEnum[itemClass.ClassID] = itemClass; } - CliDB.ItemClassStorage.Clear(); - foreach (ItemCurrencyCostRecord itemCurrencyCost in CliDB.ItemCurrencyCostStorage.Values) _itemsWithCurrencyCost.Add(itemCurrencyCost.ItemID); - CliDB.ItemCurrencyCostStorage.Clear(); - foreach (ItemLimitCategoryConditionRecord condition in CliDB.ItemLimitCategoryConditionStorage.Values) _itemCategoryConditions.Add(condition.ParentItemLimitCategoryID, condition); foreach (ItemLevelSelectorQualityRecord itemLevelSelectorQuality in CliDB.ItemLevelSelectorQualityStorage.Values) - _itemLevelQualitySelectorQualities.Add((uint)itemLevelSelectorQuality.ParentILSQualitySetID, itemLevelSelectorQuality); - - CliDB.ItemLevelSelectorQualityStorage.Clear(); + _itemLevelQualitySelectorQualities.Add(itemLevelSelectorQuality.ParentILSQualitySetID, itemLevelSelectorQuality); foreach (var appearanceMod in CliDB.ItemModifiedAppearanceStorage.Values) { @@ -362,18 +322,12 @@ namespace Game.DataStorage foreach (ItemSetSpellRecord itemSetSpell in CliDB.ItemSetSpellStorage.Values) _itemSetSpells.Add(itemSetSpell.ItemSetID, itemSetSpell); - CliDB.ItemSetSpellStorage.Clear(); - foreach (var itemSpecOverride in CliDB.ItemSpecOverrideStorage.Values) _itemSpecOverrides.Add(itemSpecOverride.ItemID, itemSpecOverride); - CliDB.ItemSpecOverrideStorage.Clear(); - foreach (var itemBonusTreeAssignment in CliDB.ItemXBonusTreeStorage.Values) _itemToBonusTree.Add(itemBonusTreeAssignment.ItemID, itemBonusTreeAssignment.ItemBonusTreeID); - CliDB.ItemXBonusTreeStorage.Clear(); - foreach (var pair in _azeriteEmpoweredItems) LoadAzeriteEmpoweredItemUnlockMappings(azeriteUnlockMappings, pair.Key); @@ -386,8 +340,6 @@ namespace Game.DataStorage } _mapDifficulties[0][0] = _mapDifficulties[1][0]; // map 0 is missing from MapDifficulty.dbc so we cheat a bit - CliDB.MapDifficultyStorage.Clear(); - List mapDifficultyConditions = new(); foreach (var mapDifficultyCondition in CliDB.MapDifficultyXConditionStorage.Values) mapDifficultyConditions.Add(mapDifficultyCondition); @@ -407,16 +359,12 @@ namespace Game.DataStorage foreach (MountTypeXCapabilityRecord mountTypeCapability in CliDB.MountTypeXCapabilityStorage.Values) _mountCapabilitiesByType.Add(mountTypeCapability.MountTypeID, mountTypeCapability); - CliDB.MountTypeXCapabilityStorage.Clear(); - foreach (var key in _mountCapabilitiesByType.Keys) _mountCapabilitiesByType[key].Sort(new MountTypeXCapabilityRecordComparer()); foreach (MountXDisplayRecord mountDisplay in CliDB.MountXDisplayStorage.Values) _mountDisplays.Add(mountDisplay.MountID, mountDisplay); - CliDB.MountXDisplayStorage.Clear(); - foreach (var entry in CliDB.NameGenStorage.Values) { if (!_nameGenData.ContainsKey(entry.RaceID)) @@ -429,8 +377,6 @@ namespace Game.DataStorage _nameGenData[entry.RaceID][entry.Sex].Add(entry); } - CliDB.NameGenStorage.Clear(); - foreach (var namesProfanity in CliDB.NamesProfanityStorage.Values) { Cypher.Assert(namesProfanity.Language < (int)Locale.Total || namesProfanity.Language == -1); @@ -446,13 +392,9 @@ namespace Game.DataStorage } } - CliDB.NamesProfanityStorage.Clear(); - foreach (var namesReserved in CliDB.NamesReservedStorage.Values) _nameValidators[(int)Locale.Total].Add(namesReserved.Name); - CliDB.NamesReservedStorage.Clear(); - foreach (var namesReserved in CliDB.NamesReservedLocaleStorage.Values) { Cypher.Assert(!Convert.ToBoolean(namesReserved.LocaleMask & ~((1 << (int)Locale.Total) - 1))); @@ -465,7 +407,6 @@ namespace Game.DataStorage _nameValidators[i].Add(namesReserved.Name); } } - CliDB.NamesReservedLocaleStorage.Clear(); foreach (var group in CliDB.PhaseXPhaseGroupStorage.Values) { @@ -473,7 +414,6 @@ namespace Game.DataStorage if (phase != null) _phasesByGroup.Add(group.PhaseGroupID, phase.Id); } - CliDB.PhaseXPhaseGroupStorage.Clear(); foreach (PowerTypeRecord powerType in CliDB.PowerTypeStorage.Values) { @@ -509,18 +449,12 @@ namespace Game.DataStorage _questPackages[questPackageItem.PackageID].Item2.Add(questPackageItem); } - CliDB.QuestPackageItemStorage.Clear(); - foreach (RewardPackXCurrencyTypeRecord rewardPackXCurrencyType in CliDB.RewardPackXCurrencyTypeStorage.Values) _rewardPackCurrencyTypes.Add(rewardPackXCurrencyType.RewardPackID, rewardPackXCurrencyType); - CliDB.RewardPackXCurrencyTypeStorage.Clear(); - foreach (RewardPackXItemRecord rewardPackXItem in CliDB.RewardPackXItemStorage.Values) _rewardPackItems.Add(rewardPackXItem.RewardPackID, rewardPackXItem); - CliDB.RewardPackXItemStorage.Clear(); - foreach (SkillLineRecord skill in CliDB.SkillLineStorage.Values) { if (skill.ParentSkillLineID != 0) @@ -539,8 +473,6 @@ namespace Game.DataStorage foreach (var specSpells in CliDB.SpecializationSpellsStorage.Values) _specializationSpellsBySpec.Add(specSpells.SpecID, specSpells); - CliDB.SpecializationSpellsStorage.Clear(); - foreach (SpecSetMemberRecord specSetMember in CliDB.SpecSetMemberStorage.Values) _specsBySpecSet.Add(Tuple.Create((int)specSetMember.SpecSetID, (uint)specSetMember.ChrSpecializationID)); @@ -550,8 +482,6 @@ namespace Game.DataStorage foreach (SpellProcsPerMinuteModRecord ppmMod in CliDB.SpellProcsPerMinuteModStorage.Values) _spellProcsPerMinuteMods.Add(ppmMod.SpellProcsPerMinuteID, ppmMod); - CliDB.SpellProcsPerMinuteModStorage.Clear(); - for (var i = 0; i < (int)Class.Max; ++i) { _talentsByPosition[i] = new List[PlayerConst.MaxTalentTiers][]; @@ -575,8 +505,6 @@ namespace Game.DataStorage foreach (ToyRecord toy in CliDB.ToyStorage.Values) _toys.Add(toy.ItemID); - CliDB.ToyStorage.Clear(); - foreach (TransmogSetItemRecord transmogSetItem in CliDB.TransmogSetItemStorage.Values) { TransmogSetRecord set = CliDB.TransmogSetStorage.LookupByKey(transmogSetItem.TransmogSetID); @@ -587,8 +515,6 @@ namespace Game.DataStorage _transmogSetItemsByTransmogSet.Add(transmogSetItem.TransmogSetID, transmogSetItem); } - CliDB.TransmogSetItemStorage.Clear(); - for (var i = 0; i < (int)UiMapSystem.Max; ++i) { _uiMapAssignmentByMap[i] = new MultiMap(); @@ -696,8 +622,6 @@ namespace Game.DataStorage foreach (WMOAreaTableRecord entry in CliDB.WMOAreaTableStorage.Values) _wmoAreaTableLookup[Tuple.Create((short)entry.WmoID, (sbyte)entry.NameSetID, entry.WmoGroupID)] = entry; - - CliDB.WMOAreaTableStorage.Clear(); } public IDB2Storage GetStorage(uint type) @@ -776,7 +700,7 @@ namespace Game.DataStorage var storeItr = _storage.LookupByKey(tableHash); if (storeItr != null) { - Log.outError(LogFilter.Sql, $"Table hash 0x{tableHash:X} points to a loaded DB2 store {storeItr.GetType().Name}, fill related table instead of hotfix_blob"); + Log.outError(LogFilter.Sql, $"Table hash 0x{tableHash:X} points to a loaded DB2 store {storeItr.GetName()}, fill related table instead of hotfix_blob"); continue; } diff --git a/Source/Game/Entities/Object/Update/UpdateFields.cs b/Source/Game/Entities/Object/Update/UpdateFields.cs index 73bffcd43..cfc2a1d66 100644 --- a/Source/Game/Entities/Object/Update/UpdateFields.cs +++ b/Source/Game/Entities/Object/Update/UpdateFields.cs @@ -3037,7 +3037,7 @@ namespace Game.Entities data.WriteUInt32(Field_14); data.WriteUInt32(Field_18); data.WriteUInt32(PvpTierID); - data.WriteBit(Field_20); + data.WriteBit((bool)Field_20); data.FlushBits(); } diff --git a/Source/Game/Handlers/GuildHandler.cs b/Source/Game/Handlers/GuildHandler.cs index bf107a995..6b3f5e621 100644 --- a/Source/Game/Handlers/GuildHandler.cs +++ b/Source/Game/Handlers/GuildHandler.cs @@ -408,7 +408,7 @@ namespace Game var rewards = Global.GuildMgr.GetGuildRewards(); GuildRewardList rewardList = new(); - rewardList.Version = (uint)Time.UnixTime; + rewardList.Version = Time.UnixTime; for (int i = 0; i < rewards.Count; i++) { diff --git a/Source/Game/Handlers/TimeHandler.cs b/Source/Game/Handlers/TimeHandler.cs index 3158587cc..e214bc687 100644 --- a/Source/Game/Handlers/TimeHandler.cs +++ b/Source/Game/Handlers/TimeHandler.cs @@ -28,7 +28,7 @@ namespace Game void HandleServerTimeOffsetRequest(ServerTimeOffsetRequest packet) { ServerTimeOffset response = new(); - response.Time = (uint)Time.UnixTime; + response.Time = Time.UnixTime; SendPacket(response); } diff --git a/Source/Game/Networking/Packets/AchievementPackets.cs b/Source/Game/Networking/Packets/AchievementPackets.cs index 7ccaa6840..fe2df6d39 100644 --- a/Source/Game/Networking/Packets/AchievementPackets.cs +++ b/Source/Game/Networking/Packets/AchievementPackets.cs @@ -75,7 +75,7 @@ namespace Game.Networking.Packets _worldPacket.WriteUInt32(Flags); _worldPacket.WritePackedTime(CurrentTime); _worldPacket.WriteUInt32(ElapsedTime); - _worldPacket.WriteUInt32(CreationTime); + _worldPacket.WriteInt64(CreationTime); _worldPacket.WriteBit(RafAcceptanceID.HasValue); _worldPacket.FlushBits(); @@ -89,7 +89,7 @@ namespace Game.Networking.Packets public uint Flags; public long CurrentTime; public uint ElapsedTime; - public uint CreationTime; + public long CreationTime; public Optional RafAcceptanceID; } @@ -186,8 +186,8 @@ namespace Game.Networking.Packets foreach (GuildCriteriaProgress progress in Progress) { _worldPacket.WriteUInt32(progress.CriteriaID); - _worldPacket.WriteUInt32(progress.DateCreated); - _worldPacket.WriteUInt32(progress.DateStarted); + _worldPacket.WriteInt64(progress.DateCreated); + _worldPacket.WriteInt64(progress.DateStarted); _worldPacket.WritePackedTime(progress.DateUpdated); _worldPacket.WriteUInt32(0); // this is a hack. this is a packed time written as int64 (progress.DateUpdated) _worldPacket.WriteUInt64(progress.Quantity); @@ -356,8 +356,8 @@ namespace Game.Networking.Packets public struct GuildCriteriaProgress { public uint CriteriaID; - public uint DateCreated; - public uint DateStarted; + public long DateCreated; + public long DateStarted; public long DateUpdated; public ulong Quantity; public ObjectGuid PlayerGUID; diff --git a/Source/Game/Networking/Packets/AuthenticationPackets.cs b/Source/Game/Networking/Packets/AuthenticationPackets.cs index 26b78977a..793c1d45a 100644 --- a/Source/Game/Networking/Packets/AuthenticationPackets.cs +++ b/Source/Game/Networking/Packets/AuthenticationPackets.cs @@ -130,7 +130,7 @@ namespace Game.Networking.Packets _worldPacket.WriteInt32(SuccessInfo.Value.AvailableClasses.Count); _worldPacket.WriteInt32(SuccessInfo.Value.Templates.Count); _worldPacket.WriteUInt32(SuccessInfo.Value.CurrencyID); - _worldPacket.WriteUInt32(SuccessInfo.Value.Time); + _worldPacket.WriteInt64(SuccessInfo.Value.Time); foreach (var raceClassAvailability in SuccessInfo.Value.AvailableClasses) { @@ -211,7 +211,7 @@ namespace Game.Networking.Packets public uint VirtualRealmAddress; // a special identifier made from the Index, BattleGroup and Region. @todo implement public uint TimeSecondsUntilPCKick; // @todo research public uint CurrencyID; // this is probably used for the ingame shop. @todo implement - public uint Time; + public long Time; public GameTime GameTimeInfo; diff --git a/Source/Game/Networking/Packets/BattleGroundPackets.cs b/Source/Game/Networking/Packets/BattleGroundPackets.cs index 5366bb92a..543a1c1a1 100644 --- a/Source/Game/Networking/Packets/BattleGroundPackets.cs +++ b/Source/Game/Networking/Packets/BattleGroundPackets.cs @@ -468,7 +468,7 @@ namespace Game.Networking.Packets { _worldPacket.WriteUInt32(MapID); _worldPacket.WriteUInt8((byte)State); - _worldPacket.WriteInt32((int)StartTime); + _worldPacket.WriteInt64(StartTime); _worldPacket.WriteInt32(Duration); _worldPacket.WriteUInt8(ArenaFaction); _worldPacket.WriteUInt32(BattlemasterListID); diff --git a/Source/Game/Networking/Packets/BlackMarketPackets.cs b/Source/Game/Networking/Packets/BlackMarketPackets.cs index 7615d98c3..c85630ff0 100644 --- a/Source/Game/Networking/Packets/BlackMarketPackets.cs +++ b/Source/Game/Networking/Packets/BlackMarketPackets.cs @@ -55,11 +55,11 @@ namespace Game.Networking.Packets public override void Read() { Guid = _worldPacket.ReadPackedGuid(); - LastUpdateID = _worldPacket.ReadUInt32(); + LastUpdateID = _worldPacket.ReadInt64(); } public ObjectGuid Guid; - public uint LastUpdateID; + public long LastUpdateID; } public class BlackMarketRequestItemsResult : ServerPacket @@ -68,14 +68,14 @@ namespace Game.Networking.Packets public override void Write() { - _worldPacket.WriteInt32(LastUpdateID); + _worldPacket.WriteInt64(LastUpdateID); _worldPacket.WriteInt32(Items.Count); foreach (BlackMarketItem item in Items) item.Write(_worldPacket); } - public int LastUpdateID; + public long LastUpdateID; public List Items = new(); } diff --git a/Source/Game/Networking/Packets/CharacterPackets.cs b/Source/Game/Networking/Packets/CharacterPackets.cs index a98dccba5..0881a2a77 100644 --- a/Source/Game/Networking/Packets/CharacterPackets.cs +++ b/Source/Game/Networking/Packets/CharacterPackets.cs @@ -188,7 +188,7 @@ namespace Game.Networking.Packets foreach (var visualItem in VisualItems) visualItem.Write(data); - data.WriteUInt32((uint)LastPlayedTime); + data.WriteInt64(LastPlayedTime); data.WriteUInt16(SpecID); data.WriteUInt32(Unknown703); data.WriteUInt32(LastLoginVersion); diff --git a/Source/Game/Networking/Packets/ClientConfigPackets.cs b/Source/Game/Networking/Packets/ClientConfigPackets.cs index b258afc10..3fcabdad0 100644 --- a/Source/Game/Networking/Packets/ClientConfigPackets.cs +++ b/Source/Game/Networking/Packets/ClientConfigPackets.cs @@ -29,14 +29,14 @@ namespace Game.Networking.Packets public override void Write() { _worldPacket.WritePackedGuid(PlayerGuid); - _worldPacket.WriteUInt32(ServerTime); + _worldPacket.WriteInt64(ServerTime); foreach (var accounttime in AccountTimes) - _worldPacket.WriteUInt32(accounttime); + _worldPacket.WriteInt64(accounttime); } public ObjectGuid PlayerGuid; - public uint ServerTime = 0; - public Array AccountTimes = new((int)AccountDataTypes.Max); + public long ServerTime; + public Array AccountTimes = new((int)AccountDataTypes.Max); } public class ClientCacheVersion : ServerPacket @@ -72,7 +72,7 @@ namespace Game.Networking.Packets public override void Write() { _worldPacket.WritePackedGuid(Player); - _worldPacket.WriteUInt32(Time); + _worldPacket.WriteInt64(Time); _worldPacket.WriteUInt32(Size); _worldPacket.WriteBits(DataType, 3); @@ -87,8 +87,8 @@ namespace Game.Networking.Packets } public ObjectGuid Player; - public uint Time = 0; // UnixTime - public uint Size = 0; // decompressed size + public long Time; // UnixTime + public uint Size; // decompressed size public AccountDataTypes DataType = 0; public ByteBuffer CompressedData; } @@ -100,7 +100,7 @@ namespace Game.Networking.Packets public override void Read() { PlayerGuid = _worldPacket.ReadPackedGuid(); - Time = _worldPacket.ReadUInt32(); + Time = _worldPacket.ReadInt64(); Size = _worldPacket.ReadUInt32(); DataType = (AccountDataTypes)_worldPacket.ReadBits(3); @@ -112,7 +112,7 @@ namespace Game.Networking.Packets } public ObjectGuid PlayerGuid; - public uint Time; // UnixTime + public long Time; // UnixTime public uint Size; // decompressed size public AccountDataTypes DataType = 0; public ByteBuffer CompressedData; diff --git a/Source/Game/Networking/Packets/GarrisonPackets.cs b/Source/Game/Networking/Packets/GarrisonPackets.cs index 5254cc244..84c8efa9e 100644 --- a/Source/Game/Networking/Packets/GarrisonPackets.cs +++ b/Source/Game/Networking/Packets/GarrisonPackets.cs @@ -338,9 +338,9 @@ namespace Game.Networking.Packets { data.WriteUInt32(GarrPlotInstanceID); data.WriteUInt32(GarrBuildingID); - data.WriteUInt32((uint)TimeBuilt); + data.WriteInt64(TimeBuilt); data.WriteUInt32(CurrentGarSpecID); - data.WriteUInt32((uint)TimeSpecCooldown); + data.WriteInt64(TimeSpecCooldown); data.WriteBit(Active); data.FlushBits(); } @@ -371,8 +371,8 @@ namespace Game.Networking.Packets data.WriteUInt32(ZoneSupportSpellID); data.WriteUInt32(FollowerStatus); data.WriteInt32(Health); - data .WriteInt8(BoardIndex); - data .WriteInt32(HealingTimestamp); + data.WriteInt8(BoardIndex); + data.WriteInt64(HealingTimestamp); AbilityID.ForEach(ability => data.WriteUInt32(ability.Id)); @@ -395,7 +395,7 @@ namespace Game.Networking.Packets public uint ZoneSupportSpellID; public uint FollowerStatus; public int Health; - public int HealingTimestamp; + public long HealingTimestamp; public sbyte BoardIndex; public string CustomName = ""; } @@ -405,9 +405,9 @@ namespace Game.Networking.Packets public void Write(WorldPacket data) { data.WriteUInt64(DbID); - data.WriteUInt32((uint)OfferTime); + data.WriteInt64(OfferTime); data.WriteUInt32(OfferDuration); - data.WriteUInt32((uint)StartTime); + data.WriteInt64(StartTime); data.WriteUInt32(TravelDuration); data.WriteUInt32(MissionDuration); data.WriteUInt32(MissionRecID); @@ -462,7 +462,7 @@ namespace Game.Networking.Packets { public void Write(WorldPacket data) { - data.WriteUInt32((uint)StartTime); + data.WriteInt64(StartTime); data.WriteUInt32(GarrMssnBonusAbilityID); } @@ -488,7 +488,7 @@ namespace Game.Networking.Packets { data.WriteInt32(GarrTalentID); data.WriteInt32(Rank); - data.WriteUInt32((uint)ResearchStartTime); + data.WriteInt64(ResearchStartTime); data.WriteInt32(Flags); data.WriteBit(Socket.HasValue); data.FlushBits(); diff --git a/Source/Game/Networking/Packets/GuildFinderPackets.cs b/Source/Game/Networking/Packets/GuildFinderPackets.cs index 2f4c5344e..345aa15a4 100644 --- a/Source/Game/Networking/Packets/GuildFinderPackets.cs +++ b/Source/Game/Networking/Packets/GuildFinderPackets.cs @@ -152,10 +152,10 @@ namespace Game.Networking.Packets public override void Read() { - LastUpdate = _worldPacket.ReadUInt32(); + LastUpdate = _worldPacket.ReadInt64(); } - public uint LastUpdate; + public long LastUpdate; } class LFGuildRecruits : ServerPacket @@ -165,7 +165,7 @@ namespace Game.Networking.Packets public override void Write() { _worldPacket.WriteInt32(Recruits.Count); - _worldPacket.WriteUInt32((uint)UpdateTime); + _worldPacket.WriteInt64(UpdateTime); foreach (LFGuildRecruitData recruit in Recruits) recruit.Write(_worldPacket); } diff --git a/Source/Game/Networking/Packets/GuildPackets.cs b/Source/Game/Networking/Packets/GuildPackets.cs index 4636e7851..bfb6d2951 100644 --- a/Source/Game/Networking/Packets/GuildPackets.cs +++ b/Source/Game/Networking/Packets/GuildPackets.cs @@ -879,10 +879,10 @@ namespace Game.Networking.Packets public override void Read() { - CurrentVersion = _worldPacket.ReadUInt32(); + CurrentVersion = _worldPacket.ReadInt64(); } - public uint CurrentVersion; + public long CurrentVersion; } public class GuildRewardList : ServerPacket @@ -894,7 +894,7 @@ namespace Game.Networking.Packets public override void Write() { - _worldPacket.WriteUInt32(Version); + _worldPacket.WriteInt64(Version); _worldPacket.WriteInt32(RewardItems.Count); foreach (var item in RewardItems) @@ -902,7 +902,7 @@ namespace Game.Networking.Packets } public List RewardItems; - public uint Version; + public long Version; } public class GuildBankActivate : ClientPacket diff --git a/Source/Game/Networking/Packets/HotfixPackets.cs b/Source/Game/Networking/Packets/HotfixPackets.cs index 85220f4af..9474326a0 100644 --- a/Source/Game/Networking/Packets/HotfixPackets.cs +++ b/Source/Game/Networking/Packets/HotfixPackets.cs @@ -87,10 +87,10 @@ namespace Game.Networking.Packets public override void Write() { _worldPacket.WriteUInt32(VirtualRealmAddress); - _worldPacket.WriteInt32(Hotfixes.Count); + _worldPacket.WriteInt32(Hotfixes.Keys.Count); - foreach (var pair in Hotfixes) - _worldPacket.WriteInt32(pair.Key); + foreach (var key in Hotfixes.Keys) + _worldPacket.WriteInt32(key); } public uint VirtualRealmAddress; diff --git a/Source/Game/Networking/Packets/LFGPackets.cs b/Source/Game/Networking/Packets/LFGPackets.cs index 760df805d..73b9666f3 100644 --- a/Source/Game/Networking/Packets/LFGPackets.cs +++ b/Source/Game/Networking/Packets/LFGPackets.cs @@ -758,7 +758,7 @@ namespace Game.Networking.Packets RequesterGuid = data.ReadPackedGuid(); Id = data.ReadUInt32(); Type = (RideType)data.ReadUInt32(); - Time = data.ReadInt32(); + Time = data.ReadInt64(); } public void Write(WorldPacket data) @@ -766,13 +766,13 @@ namespace Game.Networking.Packets data.WritePackedGuid(RequesterGuid); data.WriteUInt32(Id); data.WriteUInt32((uint)Type); - data.WriteInt32(Time); + data.WriteInt64(Time); } public ObjectGuid RequesterGuid; public uint Id; public RideType Type; - public int Time; + public long Time; } public enum RideType diff --git a/Source/Game/Networking/Packets/MiscPackets.cs b/Source/Game/Networking/Packets/MiscPackets.cs index a8029e88f..d2f649014 100644 --- a/Source/Game/Networking/Packets/MiscPackets.cs +++ b/Source/Game/Networking/Packets/MiscPackets.cs @@ -316,10 +316,10 @@ namespace Game.Networking.Packets public override void Write() { - _worldPacket.WriteUInt32(Time); + _worldPacket.WriteInt64(Time); } - public uint Time; + public long Time; } public class TutorialFlags : ServerPacket diff --git a/Source/Game/Networking/Packets/QueryPackets.cs b/Source/Game/Networking/Packets/QueryPackets.cs index 935890eac..aea847727 100644 --- a/Source/Game/Networking/Packets/QueryPackets.cs +++ b/Source/Game/Networking/Packets/QueryPackets.cs @@ -390,7 +390,7 @@ namespace Game.Networking.Packets public override void Write() { - _worldPacket.WriteUInt32((uint)CurrentTime); + _worldPacket.WriteInt64(CurrentTime); } public long CurrentTime; @@ -503,7 +503,7 @@ namespace Game.Networking.Packets for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; ++i) _worldPacket.WriteString(DeclinedNames.name[i]); - _worldPacket.WriteUInt32(Timestamp); + _worldPacket.WriteInt64(Timestamp); _worldPacket.WriteString(Name); } @@ -515,7 +515,7 @@ namespace Game.Networking.Packets public bool HasDeclined; public DeclinedName DeclinedNames = new(); - public uint Timestamp; + public long Timestamp; public string Name = ""; } diff --git a/Source/Game/Networking/Packets/QuestPackets.cs b/Source/Game/Networking/Packets/QuestPackets.cs index 610398013..48d51ac61 100644 --- a/Source/Game/Networking/Packets/QuestPackets.cs +++ b/Source/Game/Networking/Packets/QuestPackets.cs @@ -817,7 +817,7 @@ namespace Game.Networking.Packets foreach (WorldQuestUpdateInfo worldQuestUpdate in WorldQuestUpdates) { - _worldPacket.WriteInt32(worldQuestUpdate.LastUpdate); + _worldPacket.WriteInt64(worldQuestUpdate.LastUpdate); _worldPacket.WriteUInt32(worldQuestUpdate.QuestID); _worldPacket.WriteUInt32(worldQuestUpdate.Timer); _worldPacket.WriteInt32(worldQuestUpdate.VariableID); @@ -1183,7 +1183,7 @@ namespace Game.Networking.Packets struct WorldQuestUpdateInfo { - public WorldQuestUpdateInfo(int lastUpdate, uint questID, uint timer, int variableID, int value) + public WorldQuestUpdateInfo(long lastUpdate, uint questID, uint timer, int variableID, int value) { LastUpdate = lastUpdate; QuestID = questID; @@ -1192,7 +1192,7 @@ namespace Game.Networking.Packets Value = value; } - public int LastUpdate; + public long LastUpdate; public uint QuestID; public uint Timer; // WorldState diff --git a/Source/Game/Networking/Packets/TicketPackets.cs b/Source/Game/Networking/Packets/TicketPackets.cs index f6672bf49..9c19e6dc4 100644 --- a/Source/Game/Networking/Packets/TicketPackets.cs +++ b/Source/Game/Networking/Packets/TicketPackets.cs @@ -61,7 +61,7 @@ namespace Game.Networking.Packets foreach (var c in Cases) { _worldPacket.WriteInt32(c.CaseID); - _worldPacket.WriteUInt32(c.CaseOpened); + _worldPacket.WriteInt64(c.CaseOpened); _worldPacket.WriteInt32(c.CaseStatus); _worldPacket.WriteUInt16(c.CfgRealmID); _worldPacket.WriteUInt64(c.CharacterID); @@ -80,7 +80,7 @@ namespace Game.Networking.Packets public struct GMTicketCase { public int CaseID; - public uint CaseOpened; + public long CaseOpened; public int CaseStatus; public ushort CfgRealmID; public ulong CharacterID; @@ -215,18 +215,18 @@ namespace Game.Networking.Packets public struct SupportTicketChatLine { - public uint Timestamp; + public long Timestamp; public string Text; public SupportTicketChatLine(WorldPacket data) { - Timestamp = data.ReadUInt32(); + Timestamp = data.ReadInt64(); Text = data.ReadString(data.ReadBits(12)); } public SupportTicketChatLine(long timestamp, string text) { - Timestamp = (uint)timestamp; + Timestamp = timestamp; Text = text; } @@ -260,7 +260,7 @@ namespace Game.Networking.Packets { public void Read(WorldPacket data) { - Timestamp = data.ReadInt32(); + Timestamp = data.ReadInt64(); AuthorGUID = data.ReadPackedGuid(); bool hasClubID = data.HasBit(); @@ -305,7 +305,7 @@ namespace Game.Networking.Packets public byte field_6; } - public int Timestamp; + public long Timestamp; public ObjectGuid AuthorGUID; public Optional ClubID; public Optional ChannelGUID; diff --git a/Source/Game/Networking/Packets/TokenPackets.cs b/Source/Game/Networking/Packets/TokenPackets.cs index 32df635c5..0aed48949 100644 --- a/Source/Game/Networking/Packets/TokenPackets.cs +++ b/Source/Game/Networking/Packets/TokenPackets.cs @@ -45,7 +45,7 @@ namespace Game.Networking.Packets foreach (AuctionableTokenInfo auctionableTokenAuctionable in AuctionableTokenAuctionableList) { _worldPacket.WriteUInt64(auctionableTokenAuctionable.UnkInt1); - _worldPacket.WriteUInt32(auctionableTokenAuctionable.UnkInt2); + _worldPacket.WriteInt64(auctionableTokenAuctionable.UnkInt2); _worldPacket.WriteUInt64(auctionableTokenAuctionable.BuyoutPrice); _worldPacket.WriteUInt32(auctionableTokenAuctionable.Owner); _worldPacket.WriteUInt32(auctionableTokenAuctionable.DurationLeft); @@ -59,7 +59,7 @@ namespace Game.Networking.Packets struct AuctionableTokenInfo { public ulong UnkInt1; - public uint UnkInt2; + public long UnkInt2; public uint Owner; public ulong BuyoutPrice; public uint DurationLeft; diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index e525de897..6958b4476 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -2193,43 +2193,27 @@ namespace Game.Entities foreach (SpellAuraOptionsRecord auraOptions in CliDB.SpellAuraOptionsStorage.Values) GetLoadHelper(auraOptions.SpellID, auraOptions.DifficultyID).AuraOptions = auraOptions; - CliDB.SpellAuraOptionsStorage.Clear(); - foreach (SpellAuraRestrictionsRecord auraRestrictions in CliDB.SpellAuraRestrictionsStorage.Values) GetLoadHelper(auraRestrictions.SpellID, auraRestrictions.DifficultyID).AuraRestrictions = auraRestrictions; - CliDB.SpellAuraRestrictionsStorage.Clear(); - foreach (SpellCastingRequirementsRecord castingRequirements in CliDB.SpellCastingRequirementsStorage.Values) GetLoadHelper(castingRequirements.SpellID, 0).CastingRequirements = castingRequirements; - CliDB.SpellCastingRequirementsStorage.Clear(); - foreach (SpellCategoriesRecord categories in CliDB.SpellCategoriesStorage.Values) GetLoadHelper(categories.SpellID, categories.DifficultyID).Categories = categories; - CliDB.SpellCategoriesStorage.Clear(); - foreach (SpellClassOptionsRecord classOptions in CliDB.SpellClassOptionsStorage.Values) GetLoadHelper(classOptions.SpellID, 0).ClassOptions = classOptions; - CliDB.SpellClassOptionsStorage.Clear(); - foreach (SpellCooldownsRecord cooldowns in CliDB.SpellCooldownsStorage.Values) GetLoadHelper(cooldowns.SpellID, cooldowns.DifficultyID).Cooldowns = cooldowns; - CliDB.SpellCooldownsStorage.Clear(); - foreach (SpellEquippedItemsRecord equippedItems in CliDB.SpellEquippedItemsStorage.Values) GetLoadHelper(equippedItems.SpellID, 0).EquippedItems = equippedItems; - CliDB.SpellEquippedItemsStorage.Clear(); - foreach (SpellInterruptsRecord interrupts in CliDB.SpellInterruptsStorage.Values) GetLoadHelper(interrupts.SpellID, interrupts.DifficultyID).Interrupts = interrupts; - CliDB.SpellInterruptsStorage.Clear(); - foreach (SpellLevelsRecord levels in CliDB.SpellLevelsStorage.Values) GetLoadHelper(levels.SpellID, levels.DifficultyID).Levels = levels; @@ -2255,28 +2239,18 @@ namespace Game.Entities foreach (SpellReagentsRecord reagents in CliDB.SpellReagentsStorage.Values) GetLoadHelper(reagents.SpellID, 0).Reagents = reagents; - CliDB.SpellReagentsStorage.Clear(); - foreach (SpellScalingRecord scaling in CliDB.SpellScalingStorage.Values) GetLoadHelper(scaling.SpellID, 0).Scaling = scaling; - CliDB.SpellScalingStorage.Clear(); - foreach (SpellShapeshiftRecord shapeshift in CliDB.SpellShapeshiftStorage.Values) GetLoadHelper(shapeshift.SpellID, 0).Shapeshift = shapeshift; - CliDB.SpellShapeshiftStorage.Clear(); - foreach (SpellTargetRestrictionsRecord targetRestrictions in CliDB.SpellTargetRestrictionsStorage.Values) GetLoadHelper(targetRestrictions.SpellID, targetRestrictions.DifficultyID).TargetRestrictions = targetRestrictions; - CliDB.SpellTargetRestrictionsStorage.Clear(); - foreach (SpellTotemsRecord totems in CliDB.SpellTotemsStorage.Values) GetLoadHelper(totems.SpellID, 0).Totems = totems; - CliDB.SpellTotemsStorage.Clear(); - foreach (var visual in CliDB.SpellXSpellVisualStorage.Values) { var visuals = GetLoadHelper(visual.SpellID, visual.DifficultyID).Visuals;