diff --git a/Source/BNetServer/Managers/LoginServiceManager.cs b/Source/BNetServer/Managers/LoginServiceManager.cs index 047bbdd49..6f533a295 100644 --- a/Source/BNetServer/Managers/LoginServiceManager.cs +++ b/Source/BNetServer/Managers/LoginServiceManager.cs @@ -23,7 +23,7 @@ namespace BNetServer public void Initialize() { - certificate = new X509Certificate2(ConfigMgr.GetDefaultValue("CertificatesFile", "./BNetServer.pfx")); + certificate = X509CertificateLoader.LoadPkcs12FromFile(ConfigMgr.GetDefaultValue("CertificatesFile", "./BNetServer.pfx"), null); Assembly currentAsm = Assembly.GetExecutingAssembly(); foreach (var type in currentAsm.GetTypes()) diff --git a/Source/Framework/Constants/Network/Opcodes.cs b/Source/Framework/Constants/Network/Opcodes.cs index 123d91942..a5c84f05a 100644 --- a/Source/Framework/Constants/Network/Opcodes.cs +++ b/Source/Framework/Constants/Network/Opcodes.cs @@ -2137,8 +2137,8 @@ namespace Framework.Constants // Opcodes That Are Not Generated Automatically AccountHeirloomUpdate = AccountToyUpdate + 1, // No Client Handler - CompressedPacket = 0x3E000A, - MultiplePackets = 0x3E0009, + CompressedPacket = AuthChallenge + 0xA, + MultiplePackets = AuthChallenge + 0x9, Unknown = 0xbadd, None = 0 diff --git a/Source/Framework/Cryptography/SessionKeyGeneration.cs b/Source/Framework/Cryptography/SessionKeyGeneration.cs index 26dfe86ed..3d5bd2a9d 100644 --- a/Source/Framework/Cryptography/SessionKeyGeneration.cs +++ b/Source/Framework/Cryptography/SessionKeyGeneration.cs @@ -29,7 +29,7 @@ namespace Framework.Cryptography { for (uint i = 0; i < sz; ++i) { - if (taken == 32) + if (taken == 64) FillUp(); buf[i] = o0[taken]; @@ -40,9 +40,9 @@ namespace Framework.Cryptography void FillUp() { sh.Initialize(); - sh.TransformBlock(o1, 0, 32, o1, 0); - sh.TransformBlock(o0, 0, 32, o0, 0); - sh.TransformFinalBlock(o2, 0, 32); + sh.TransformBlock(o1, 0, 64, o1, 0); + sh.TransformBlock(o0, 0, 64, o0, 0); + sh.TransformFinalBlock(o2, 0, 64); o0 = sh.Hash; taken = 0; @@ -50,9 +50,9 @@ namespace Framework.Cryptography SHA512 sh; uint taken; - byte[] o0 = new byte[32]; - byte[] o1 = new byte[32]; - byte[] o2 = new byte[32]; + byte[] o0 = new byte[64]; + byte[] o1 = new byte[64]; + byte[] o2 = new byte[64]; } public class SessionKeyGenerator diff --git a/Source/Game/DataStorage/Structs/T_Records.cs b/Source/Game/DataStorage/Structs/T_Records.cs index ec4e4691c..619d6ad50 100644 --- a/Source/Game/DataStorage/Structs/T_Records.cs +++ b/Source/Game/DataStorage/Structs/T_Records.cs @@ -27,9 +27,9 @@ namespace Game.DataStorage public uint OverridesSpellID; public uint RequiredSpellID; public int[] CategoryMask = new int[2]; - public uint[] SpellRank = new uint[2]; - public uint[] PrereqTalent = new uint[2]; - public byte[] PrereqRank = new byte[2]; + public uint[] SpellRank = new uint[9]; + public uint[] PrereqTalent = new uint[3]; + public byte[] PrereqRank = new byte[3]; } public sealed class TaxiNodesRecord diff --git a/Source/Game/Entities/Object/Update/UpdateField.cs b/Source/Game/Entities/Object/Update/UpdateField.cs index 0dfe5604c..1ae4f2df9 100644 --- a/Source/Game/Entities/Object/Update/UpdateField.cs +++ b/Source/Game/Entities/Object/Update/UpdateField.cs @@ -384,7 +384,7 @@ namespace Game.Entities public abstract class HasChangesMask : IHasChangesMask { - public static int ChangeMaskLength; + public int ChangeMaskLength; public UpdateMask _changesMask; public int _blockBit; diff --git a/Source/Game/Entities/Object/Update/UpdateFields.cs b/Source/Game/Entities/Object/Update/UpdateFields.cs index e23128db7..6b1758954 100644 --- a/Source/Game/Entities/Object/Update/UpdateFields.cs +++ b/Source/Game/Entities/Object/Update/UpdateFields.cs @@ -164,7 +164,7 @@ namespace Game.Entities dynFlags |= (uint)GameObjectDynamicLowFlags.NoInterract; var data = Global.ObjectMgr.GetSpawnMetadata(SpawnObjectType.GameObject, gameObject.GetSpawnId()); - if (data.spawnTrackingData != null && !data.spawnTrackingQuestObjectives.Empty()) + if (data != null && data.spawnTrackingData != null && !data.spawnTrackingQuestObjectives.Empty()) if (receiver.GetSpawnTrackingStateByObjectives(data.spawnTrackingData.SpawnTrackingId, data.spawnTrackingQuestObjectives) != SpawnTrackingState.Active) dynFlags &= ~(uint)GameObjectDynamicLowFlags.Activate; } @@ -3352,14 +3352,14 @@ namespace Game.Entities public void FilterDisallowedFieldsMaskForFlag(UpdateMask changesMask, UpdateFieldFlag fieldVisibilityFlags) { - UpdateMask allowedMaskForTarget = new(324, [0xFFFFFFDDu, 0x0007FFFFu, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0xFFFFFFF8u, 0xFFFFFFFFu, 0xFFFFFFFFu, 0x0000000Fu]); + UpdateMask allowedMaskForTarget = new(ChangeMaskLength, [0xFFFFFFDDu, 0x0007FFFFu, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0xFFFFFFF8u, 0xFFFFFFFFu, 0xFFFFFFFFu, 0x0000000Fu]); PlayerDataAppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags); changesMask.AND(allowedMaskForTarget); } public void WriteUpdate(WorldPacket data, UpdateFieldFlag fieldVisibilityFlags, Player owner, Player receiver) { - UpdateMask allowedMaskForTarget = new(324, [0xFFFFFFDDu, 0x0007FFFFu, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0xFFFFFFF8u, 0xFFFFFFFFu, 0xFFFFFFFFu, 0x0000000Fu]); + UpdateMask allowedMaskForTarget = new(ChangeMaskLength, [0xFFFFFFDDu, 0x0007FFFFu, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0xFFFFFFF8u, 0xFFFFFFFFu, 0xFFFFFFFFu, 0x0000000Fu]); PlayerDataAppendAllowedFieldsMaskForFlag(allowedMaskForTarget, fieldVisibilityFlags); WriteUpdate(data, _changesMask & allowedMaskForTarget, false, owner, receiver); } diff --git a/Source/Game/Entities/Object/Update/UpdateMask.cs b/Source/Game/Entities/Object/Update/UpdateMask.cs index 43d82bfea..fadf6754c 100644 --- a/Source/Game/Entities/Object/Update/UpdateMask.cs +++ b/Source/Game/Entities/Object/Update/UpdateMask.cs @@ -24,12 +24,11 @@ namespace Game.Entities if (input != null) { int block = 0; - for (; block < input.Length; ++block) + for (; block < _blockCount; ++block) if ((_blocks[block] = input[block]) != 0) _blocksMask[GetBlockIndex(block)] |= (uint)GetBlockFlag(block); - - for (; block < _blockCount; ++block) - _blocks[block] = 0; + else + _blocksMask[GetBlockIndex(block)] &= ~(uint)GetBlockFlag(block); } } @@ -100,7 +99,7 @@ namespace Game.Entities for (int i = 0; i < _blockCount; ++i) { - if (!Convert.ToBoolean(_blocks[i] &= right._blocks[i])) + if ((_blocks[i] &= right._blocks[i]) == 0) _blocksMask[GetBlockIndex(i)] &= ~(uint)GetBlockFlag(i); } } diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index ecd4d9866..af139280f 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -4153,6 +4153,9 @@ namespace Game.Entities public void ClearChangesMask(HasChangesMask updateData) { + if (updateData == null) + return; + _owner.m_entityFragments.ContentsChangedMask &= (byte)~_owner.m_entityFragments.GetUpdateMaskFor((EntityFragment)updateData._blockBit); if ((EntityFragment)updateData._blockBit == EntityFragment.CGObject) { diff --git a/Source/Game/Entities/StatSystem.cs b/Source/Game/Entities/StatSystem.cs index f9f2e77ec..0f1bd1c83 100644 --- a/Source/Game/Entities/StatSystem.cs +++ b/Source/Game/Entities/StatSystem.cs @@ -1645,7 +1645,7 @@ namespace Game.Entities if (aura.GetCasterGUID() == GetGUID() && aura.GetSpellInfo().HasAttribute(SpellAttr8.MasteryAffectsPoints)) { foreach (var auraEff in aura.GetAuraEffects()) - if (MathFunctions.fuzzyEq(auraEff.GetSpellEffectInfo().BonusCoefficient, 0.0f)) + if (auraEff != null && MathFunctions.fuzzyEq(auraEff.GetSpellEffectInfo().BonusCoefficient, 0.0f)) auraEff.RecalculateAmount(this); } } diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 8dc1aaf92..ea1ff2751 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -3204,6 +3204,9 @@ namespace Game.Entities Unit caster = aura.GetCaster(); foreach (AuraEffect aurEff in aura.GetAuraEffects()) { + if (aurEff == null) + continue; + int i = (int)aurEff.GetEffIndex(); baseDamage[i] = aurEff.GetBaseAmount(); damage[i] = aurEff.GetAmount(); @@ -3475,7 +3478,7 @@ namespace Game.Entities // remove remaining effects of an aura foreach (AuraEffect aurEff in aurApp.GetBase().GetAuraEffects()) { - if (aurApp.HasEffect(aurEff.GetEffIndex())) + if (aurEff != null && aurApp.HasEffect(aurEff.GetEffIndex())) aurApp._HandleEffect(aurEff.GetEffIndex(), false); } return; @@ -3899,7 +3902,7 @@ namespace Game.Entities // remove effects of the spell - needs to be done after removing aura from lists foreach (AuraEffect aurEff in aura.GetAuraEffects()) - if (aurApp.HasEffect(aurEff.GetEffIndex())) + if (aurEff != null && aurApp.HasEffect(aurEff.GetEffIndex())) aurApp._HandleEffect(aurEff.GetEffIndex(), false); // all effect mustn't be applied @@ -4147,7 +4150,7 @@ namespace Game.Entities // apply effects of the aura foreach (AuraEffect aurEff in aura.GetAuraEffects()) { - if ((effMask & 1 << (int)aurEff.GetEffIndex()) != 0) + if (aurEff != null && (effMask & 1 << (int)aurEff.GetEffIndex()) != 0) { aurApp._HandleEffect(aurEff.GetEffIndex(), true); if (aurApp.GetRemoveMode() != 0) diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index 47f785f03..5d7ec7648 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -1747,7 +1747,7 @@ namespace Game } public uint GetScriptId(string name, bool isDatabaseBound = true) { - return _scriptNamesStorage.Insert(name, isDatabaseBound); + return _scriptNamesStorage.Insert(name ?? "", isDatabaseBound); } public uint GetAreaTriggerScriptId(uint triggerid) { diff --git a/Source/Game/Networking/Packet.cs b/Source/Game/Networking/Packet.cs index 184b5bc3c..dd9530da5 100644 --- a/Source/Game/Networking/Packet.cs +++ b/Source/Game/Networking/Packet.cs @@ -222,7 +222,7 @@ namespace Game.Networking public bool IsValidOpcode() { int opcodeArrayIndex = GetOpcodeArrayIndex(opcode); - return opcodeArrayIndex >= 0 && opcodeArrayIndex < 1699; + return opcodeArrayIndex >= 0 && opcodeArrayIndex < 1735; } int GetOpcodeArrayIndex(uint opcode) @@ -230,33 +230,33 @@ namespace Game.Networking int idInGroup = (int)(opcode & 0xFFFF); switch (opcode >> 16) { - case 0x2A: return idInGroup < 26 ? idInGroup + 0 : -1; - case 0x2C: return idInGroup < 47 ? idInGroup + 26 : -1; - case 0x2D: return idInGroup < 3 ? idInGroup + 73 : -1; - case 0x2E: return idInGroup < 33 ? idInGroup + 76 : -1; - case 0x30: return idInGroup < 739 ? idInGroup + 109 : -1; - case 0x31: return idInGroup < 298 ? idInGroup + 848 : -1; - case 0x32: return idInGroup < 12 ? idInGroup + 1146 : -1; - case 0x33: return idInGroup < 130 ? idInGroup + 1158 : -1; - case 0x35: return idInGroup < 396 ? idInGroup + 1288 : -1; - case 0x36: return idInGroup < 15 ? idInGroup + 1684 : -1; - case 0x37: return idInGroup < 831 ? idInGroup + 0 : -1; - case 0x38: return idInGroup < 10 ? idInGroup + 831 : -1; - case 0x3B: return idInGroup < 18 ? idInGroup + 841 : -1; - case 0x3C: return idInGroup < 33 ? idInGroup + 859 : -1; - case 0x3D: return idInGroup < 49 ? idInGroup + 892 : -1; - case 0x3E: return idInGroup < 11 ? idInGroup + 941 : -1; - case 0x3F: return idInGroup < 12 ? idInGroup + 952 : -1; - case 0x41: return idInGroup < 82 ? idInGroup + 964 : -1; - case 0x43: return idInGroup < 67 ? idInGroup + 1046 : -1; - case 0x45: return idInGroup < 32 ? idInGroup + 1113 : -1; - case 0x47: return idInGroup < 1 ? idInGroup + 1145 : -1; - case 0x48: return idInGroup < 118 ? idInGroup + 1146 : -1; - case 0x4A: return idInGroup < 46 ? idInGroup + 1264 : -1; - case 0x4B: return idInGroup < 41 ? idInGroup + 1310 : -1; - case 0x4D: return idInGroup < 85 ? idInGroup + 1351 : -1; - case 0x4E: return idInGroup < 8 ? idInGroup + 1436 : -1; - case 0x50: return idInGroup < 1 ? idInGroup + 1444 : -1; + case 0x29: return idInGroup < 31 ? idInGroup + 0 : -1; + case 0x2B: return idInGroup < 51 ? idInGroup + 31 : -1; + case 0x2C: return idInGroup < 3 ? idInGroup + 82 : -1; + case 0x2D: return idInGroup < 37 ? idInGroup + 85 : -1; + case 0x2F: return idInGroup < 751 ? idInGroup + 122 : -1; + case 0x30: return idInGroup < 301 ? idInGroup + 873 : -1; + case 0x31: return idInGroup < 10 ? idInGroup + 1174 : -1; + case 0x32: return idInGroup < 132 ? idInGroup + 1184 : -1; + case 0x34: return idInGroup < 404 ? idInGroup + 1316 : -1; + case 0x35: return idInGroup < 15 ? idInGroup + 1720 : -1; + case 0x36: return idInGroup < 857 ? idInGroup + 0 : -1; + case 0x37: return idInGroup < 5 ? idInGroup + 857 : -1; + case 0x3A: return idInGroup < 18 ? idInGroup + 862 : -1; + case 0x3B: return idInGroup < 36 ? idInGroup + 880 : -1; + case 0x3C: return idInGroup < 49 ? idInGroup + 916 : -1; + case 0x3D: return idInGroup < 11 ? idInGroup + 965 : -1; + case 0x3E: return idInGroup < 12 ? idInGroup + 976 : -1; + case 0x40: return idInGroup < 82 ? idInGroup + 988 : -1; + case 0x42: return idInGroup < 71 ? idInGroup + 1070 : -1; + case 0x44: return idInGroup < 33 ? idInGroup + 1141 : -1; + case 0x46: return idInGroup < 1 ? idInGroup + 1174 : -1; + case 0x48: return idInGroup < 120 ? idInGroup + 1175 : -1; + case 0x4A: return idInGroup < 49 ? idInGroup + 1295 : -1; + case 0x4B: return idInGroup < 41 ? idInGroup + 1344 : -1; + case 0x4D: return idInGroup < 85 ? idInGroup + 1385 : -1; + case 0x4E: return idInGroup < 8 ? idInGroup + 1470 : -1; + case 0x50: return idInGroup < 1 ? idInGroup + 1478 : -1; default: return -1; } } diff --git a/Source/Game/Networking/Packets/AuthenticationPackets.cs b/Source/Game/Networking/Packets/AuthenticationPackets.cs index 3393a90f5..dd93e4705 100644 --- a/Source/Game/Networking/Packets/AuthenticationPackets.cs +++ b/Source/Game/Networking/Packets/AuthenticationPackets.cs @@ -133,7 +133,7 @@ namespace Game.Networking.Packets _worldPacket.WriteBit(SuccessInfo.NumPlayersHorde.HasValue); _worldPacket.WriteBit(SuccessInfo.NumPlayersAlliance.HasValue); _worldPacket.WriteBit(SuccessInfo.ExpansionTrialExpiration.HasValue); - _worldPacket.WriteBit(SuccessInfo.NewBuildKeys != null); + _worldPacket.WriteBit(SuccessInfo.CurrentBuild != null); _worldPacket.FlushBits(); { @@ -155,12 +155,12 @@ namespace Game.Networking.Packets if (SuccessInfo.ExpansionTrialExpiration.HasValue) _worldPacket.WriteInt64(SuccessInfo.ExpansionTrialExpiration.Value); - if (SuccessInfo.NewBuildKeys != null) + if (SuccessInfo.CurrentBuild != null) { for (int i = 0; i < 16; ++i) { - _worldPacket.WriteUInt8(SuccessInfo.NewBuildKeys.NewBuildKey[i]); - _worldPacket.WriteUInt8(SuccessInfo.NewBuildKeys.SomeKey[i]); + _worldPacket.WriteUInt8(SuccessInfo.CurrentBuild.BuildKey[i]); + _worldPacket.WriteUInt8(SuccessInfo.CurrentBuild.ConfigKey[i]); } } @@ -217,7 +217,7 @@ namespace Game.Networking.Packets public ushort? NumPlayersHorde; // number of horde players in this realm. @todo implement public ushort? NumPlayersAlliance; // number of alliance players in this realm. @todo implement public long? ExpansionTrialExpiration; // expansion trial expiration unix timestamp - public NewBuild NewBuildKeys; + public BaseBuildKey CurrentBuild; public struct GameTime { @@ -229,10 +229,10 @@ namespace Game.Networking.Packets public bool IsCAISEnabled; } - public class NewBuild + public class BaseBuildKey { - public Array NewBuildKey = new Array(16); - public Array SomeKey = new Array(16); + public Array BuildKey = new Array(16); + public Array ConfigKey = new Array(16); } } } @@ -337,7 +337,7 @@ namespace Game.Networking.Packets { DosResponse = _worldPacket.ReadUInt64(); Key = _worldPacket.ReadUInt64(); - LocalChallenge = _worldPacket.ReadBytes(16); + LocalChallenge = _worldPacket.ReadBytes(32); Digest = _worldPacket.ReadBytes(24); } @@ -402,7 +402,7 @@ namespace Game.Networking.Packets { HmacSha512 toSign = new(EncryptionKey); toSign.Process(BitConverter.GetBytes(Enabled), 1); - toSign.Finish(EnableEncryptionSeed, 16); + toSign.Finish(EnableEncryptionSeed, 32); _worldPacket.WriteInt32(RegionGroup); _worldPacket.WriteBytes(Ed25519.Sign(toSign.Digest, expandedPrivateKey, 0, EnableEncryptionContext)); diff --git a/Source/Game/Networking/Packets/QueryPackets.cs b/Source/Game/Networking/Packets/QueryPackets.cs index 1f4019a37..fba14677a 100644 --- a/Source/Game/Networking/Packets/QueryPackets.cs +++ b/Source/Game/Networking/Packets/QueryPackets.cs @@ -84,7 +84,7 @@ namespace Game.Networking.Packets _worldPacket.WriteCString(Stats.NameAlt[i]); } - for (var i = 0; i < 2; ++i) + for (var i = 0; i < Stats.Flags.Length; ++i) _worldPacket.WriteUInt32(Stats.Flags[i]); _worldPacket.WriteInt8(Stats.CreatureType); diff --git a/Source/Game/Networking/Packets/SpellPackets.cs b/Source/Game/Networking/Packets/SpellPackets.cs index 4a63ad901..75631fc9f 100644 --- a/Source/Game/Networking/Packets/SpellPackets.cs +++ b/Source/Game/Networking/Packets/SpellPackets.cs @@ -347,13 +347,13 @@ namespace Game.Networking.Packets Visual.Write(_worldPacket); - _worldPacket.WriteUInt16(Reason); + _worldPacket.WriteUInt8(Reason); } public ObjectGuid CasterUnit; public uint SpellID; public SpellCastVisual Visual; - public ushort Reason; + public byte Reason; public ObjectGuid CastID; } diff --git a/Source/Game/Networking/Packets/SystemPackets.cs b/Source/Game/Networking/Packets/SystemPackets.cs index 584e7b669..fd1ec0d6f 100644 --- a/Source/Game/Networking/Packets/SystemPackets.cs +++ b/Source/Game/Networking/Packets/SystemPackets.cs @@ -332,6 +332,7 @@ namespace Game.Networking.Packets _worldPacket.WriteBit(PlayerIdentityOptionsEnabled); _worldPacket.WriteBit(AccountExportEnabled); _worldPacket.WriteBit(AccountLockedPostExport); + _worldPacket.WriteBits(RealmHiddenAlert.GetByteCount() + 1, 11); _worldPacket.WriteBit(BNSendWhisperUseV2Services); @@ -372,7 +373,7 @@ namespace Game.Networking.Packets _worldPacket.WriteInt32(LaunchDurationETA.Value); if (!RealmHiddenAlert.IsEmpty()) - _worldPacket.WriteString(RealmHiddenAlert); + _worldPacket.WriteCString(RealmHiddenAlert); foreach (var sourceRegion in LiveRegionCharacterCopySourceRegions) _worldPacket.WriteInt32(sourceRegion); diff --git a/Source/Game/Networking/WorldSocket.cs b/Source/Game/Networking/WorldSocket.cs index 768464444..6cc16a6dd 100644 --- a/Source/Game/Networking/WorldSocket.cs +++ b/Source/Game/Networking/WorldSocket.cs @@ -536,7 +536,7 @@ namespace Game.Networking sessionKeyHmac.Finish(SessionKeySeed, SessionKeySeed.Length); _sessionKey = new byte[40]; - var sessionKeyGenerator = new SessionKeyGenerator512(sessionKeyHmac.Digest, 32); + var sessionKeyGenerator = new SessionKeyGenerator512(sessionKeyHmac.Digest); sessionKeyGenerator.Generate(_sessionKey, 40); HmacSha512 encryptKeyGen = new(_sessionKey); diff --git a/Source/Game/Server/WorldSession.cs b/Source/Game/Server/WorldSession.cs index 723ee2911..b844c85b2 100644 --- a/Source/Game/Server/WorldSession.cs +++ b/Source/Game/Server/WorldSession.cs @@ -410,7 +410,7 @@ namespace Game if (!packet.IsValidOpcode()) { string specialName = packet.GetOpcode() == ServerOpcodes.Unknown ? "UNKNOWN_OPCODE" : "INVALID_OPCODE"; - Log.outError(LogFilter.Network, $"Prevented sending of {specialName} (0x{packet.GetOpcode():04X}) to {GetPlayerInfo()}"); + Log.outError(LogFilter.Network, $"Prevented sending of {specialName} (0x{(int)packet.GetOpcode():04X}) to {GetPlayerInfo()}"); return; } diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index dae50b7e3..a8bbd0b41 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -863,7 +863,7 @@ namespace Game.Spells Unit caster = GetCaster(); foreach (AuraEffect aurEff in GetAuraEffects()) - aurEff.CalculatePeriodic(caster, resetPeriodicTimer, false); + aurEff?.CalculatePeriodic(caster, resetPeriodicTimer, false); } public void SetCharges(int charges) @@ -1806,7 +1806,7 @@ namespace Game.Spells // At least one effect has to pass checks to proc aura uint procEffectMask = aurApp.GetEffectMask(); foreach (AuraEffect aurEff in GetAuraEffects()) - if ((procEffectMask & (1u << (int)aurEff.GetEffIndex())) != 0) + if (aurEff != null && (procEffectMask & (1u << (int)aurEff.GetEffIndex())) != 0) if ((procEntry.DisableEffectsMask & (1u << (int)aurEff.GetEffIndex())) != 0 || !GetEffect(aurEff.GetEffIndex()).CheckEffectProc(aurApp, eventInfo)) procEffectMask &= ~(1u << (int)aurEff.GetEffIndex()); diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 044d4a784..647d9b8e3 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -505,7 +505,7 @@ namespace Game.Spells else { foreach (AuraEffect aurEff in aura.GetAuraEffects()) - if (aurEff != triggeredBy) + if (aurEff != null && aurEff != triggeredBy) aurEff.RecalculateAmount(triggeredBy); } }