diff --git a/Source/BNetServer/Networking/Session.cs b/Source/BNetServer/Networking/Session.cs index b358d295a..6d8a4d004 100644 --- a/Source/BNetServer/Networking/Session.cs +++ b/Source/BNetServer/Networking/Session.cs @@ -31,7 +31,7 @@ using System.Net.Sockets; namespace BNetServer.Networking { - public partial class Session : SSLSocket + public class Session : SSLSocket { public Session(Socket socket) : base(socket) { diff --git a/Source/Framework/Collections/BitSet.cs b/Source/Framework/Collections/BitSet.cs index 04320eee0..07f0c7552 100644 --- a/Source/Framework/Collections/BitSet.cs +++ b/Source/Framework/Collections/BitSet.cs @@ -369,7 +369,7 @@ namespace System.Collections return MemberwiseClone(); } - public virtual bool MoveNext() + public bool MoveNext() { //if (version != bitarray._version) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion)); if (index < (bitarray.Count - 1)) diff --git a/Source/Framework/Configuration/ConfigManager.cs b/Source/Framework/Configuration/ConfigManager.cs index bafb53040..320014248 100644 --- a/Source/Framework/Configuration/ConfigManager.cs +++ b/Source/Framework/Configuration/ConfigManager.cs @@ -40,7 +40,6 @@ namespace Framework.Configuration int lineCounter = 0; try { - string name = string.Empty; foreach (var line in ConfigContent) { lineCounter++; diff --git a/Source/Framework/Constants/AchievementConst.cs b/Source/Framework/Constants/AchievementConst.cs index 25e0b43fa..e908e9a72 100644 --- a/Source/Framework/Constants/AchievementConst.cs +++ b/Source/Framework/Constants/AchievementConst.cs @@ -13,7 +13,9 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - */ + */ + +using System; namespace Framework.Constants { @@ -46,6 +48,7 @@ namespace Framework.Constants SumChildrenWeight = 9 } + [Flags] public enum AchievementFlags { Counter = 0x01, @@ -71,6 +74,7 @@ namespace Framework.Constants TrackingFlag = 0x00100000 } + [Flags] public enum CriteriaFlagsCu { Player = 0x1, diff --git a/Source/Framework/Constants/CliDBConst.cs b/Source/Framework/Constants/CliDBConst.cs index 9ba1cb4a0..b442c808c 100644 --- a/Source/Framework/Constants/CliDBConst.cs +++ b/Source/Framework/Constants/CliDBConst.cs @@ -849,7 +849,7 @@ namespace Framework.Constants FlyWarriorChargeEnd = 821 } - public enum AreaFlags : int + public enum AreaFlags { Snow = 0x01, // Snow (Only Dun Morogh, Naxxramas, Razorfen Downs And Winterspring) Unk1 = 0x02, // Razorfen Downs, Naxxramas And Acherus: The Ebon Hold (3.3.5a) diff --git a/Source/Framework/Constants/GuildConst.cs b/Source/Framework/Constants/GuildConst.cs index 2e86d63f6..8044b2d20 100644 --- a/Source/Framework/Constants/GuildConst.cs +++ b/Source/Framework/Constants/GuildConst.cs @@ -191,7 +191,7 @@ namespace Framework.Constants InvalidVendor = 5 } - public enum GuildBankRights : int + public enum GuildBankRights { ViewTab = 0x01, PutItem = 0x02, diff --git a/Source/Framework/Constants/Language.cs b/Source/Framework/Constants/Language.cs index 12d779ec6..dc9a3d626 100644 --- a/Source/Framework/Constants/Language.cs +++ b/Source/Framework/Constants/Language.cs @@ -17,7 +17,7 @@ namespace Framework.Constants { - public enum Language : int + public enum Language { Universal = 0, Orcish = 1, diff --git a/Source/Framework/Constants/PlayerConst.cs b/Source/Framework/Constants/PlayerConst.cs index 77ff5c229..050347d0f 100644 --- a/Source/Framework/Constants/PlayerConst.cs +++ b/Source/Framework/Constants/PlayerConst.cs @@ -32,7 +32,7 @@ namespace Framework.Constants public const int ReqPrimaryTreeTalents = 31; public const int ExploredZonesSize = 320; - public const ulong MaxMoneyAmount = ulong.MaxValue; + public const ulong MaxMoneyAmount = 99999999999UL; public const int MaxActionButtons = 132; public const int MaxActionButtonActionValue = 0x00FFFFFF + 1; diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index 97030c82e..3091f335e 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -267,7 +267,7 @@ namespace Framework.Constants } // Spell mechanics - public enum Mechanics : int + public enum Mechanics { None = 0, Charm = 1, @@ -277,7 +277,7 @@ namespace Framework.Constants Fear = 5, Grip = 6, Root = 7, - Slow_Attack = 8, + SlowAttack = 8, Silence = 9, Sleep = 10, Snare = 11, diff --git a/Source/Framework/Constants/UnitConst.cs b/Source/Framework/Constants/UnitConst.cs index 98bba59ae..81053459f 100644 --- a/Source/Framework/Constants/UnitConst.cs +++ b/Source/Framework/Constants/UnitConst.cs @@ -450,6 +450,8 @@ namespace Framework.Constants Dead = 3, JustRespawned = 4 } + + [Flags] public enum UnitState : uint { Died = 0x01, // Player Has Fake Death Aura diff --git a/Source/Framework/Cryptography/ShaHmac.cs b/Source/Framework/Cryptography/ShaHmac.cs index bd57a138a..00bed655f 100644 --- a/Source/Framework/Cryptography/ShaHmac.cs +++ b/Source/Framework/Cryptography/ShaHmac.cs @@ -114,11 +114,6 @@ namespace Framework.Cryptography public class HmacSha256 : HMACSHA256 { - public HmacSha256() : base() - { - Initialize(); - } - public HmacSha256(byte[] key) : base(key) { Initialize(); diff --git a/Source/Framework/Database/QueryCallback.cs b/Source/Framework/Database/QueryCallback.cs index 0402a18a6..e90bce63f 100644 --- a/Source/Framework/Database/QueryCallback.cs +++ b/Source/Framework/Database/QueryCallback.cs @@ -54,8 +54,7 @@ namespace Framework.Database { QueryCallbackData callback = _callbacks.Dequeue(); - bool hasNext = true; - while (hasNext) + while (true) { if (_result != null && _result.Wait(0)) { @@ -65,7 +64,7 @@ namespace Framework.Database cb(this, f.Result); - hasNext = _result != null; + bool hasNext = _result != null; if (_callbacks.Count == 0) { Contract.Assert(!hasNext); @@ -81,8 +80,6 @@ namespace Framework.Database else return QueryCallbackStatus.NotReady; } - - return QueryCallbackStatus.Completed; } Task _result; diff --git a/Source/Framework/Dynamic/FlagArray.cs b/Source/Framework/Dynamic/FlagArray.cs index 9b6be1e44..ef03c8963 100644 --- a/Source/Framework/Dynamic/FlagArray.cs +++ b/Source/Framework/Dynamic/FlagArray.cs @@ -28,16 +28,6 @@ namespace Framework.Dynamic _values[i] = parts[i]; } - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override bool Equals(object obj) - { - return base.Equals(obj); - } - public bool IsEqual(params uint[] parts) { for (var i = 0; i < _values.Length; ++i) diff --git a/Source/Framework/IO/ByteBuffer.cs b/Source/Framework/IO/ByteBuffer.cs index 9106efca8..de7211998 100644 --- a/Source/Framework/IO/ByteBuffer.cs +++ b/Source/Framework/IO/ByteBuffer.cs @@ -266,7 +266,7 @@ namespace Framework.IO /// /// Writes a string to the packet with a null terminated (0) /// - /// + /// public void WriteCString(string str) { if (string.IsNullOrEmpty(str)) @@ -281,6 +281,9 @@ namespace Framework.IO public void WriteString(string str) { + if (str.IsEmpty()) + return; + byte[] sBytes = Encoding.UTF8.GetBytes(str); WriteBytes(sBytes); } diff --git a/Source/Framework/Logging/Appender.cs b/Source/Framework/Logging/Appender.cs index 7229caf5b..fb657130e 100644 --- a/Source/Framework/Logging/Appender.cs +++ b/Source/Framework/Logging/Appender.cs @@ -100,9 +100,9 @@ class FileAppender : Appender, IDisposable } #region IDisposable Support - private bool disposedValue = false; + private bool disposedValue; - protected virtual void Dispose(bool disposing) + private void Dispose(bool disposing) { if (!disposedValue) { diff --git a/Source/Framework/Networking/NetworkThread.cs b/Source/Framework/Networking/NetworkThread.cs index 174b426ff..1740d3ff7 100644 --- a/Source/Framework/Networking/NetworkThread.cs +++ b/Source/Framework/Networking/NetworkThread.cs @@ -21,7 +21,7 @@ using System.Threading; namespace Framework.Networking { - public class NetworkThread where SocketType : ISocket + public class NetworkThread where TSocketType : ISocket { public void Stop() { @@ -43,15 +43,15 @@ namespace Framework.Networking return _connections; } - public virtual void AddSocket(SocketType sock) + public virtual void AddSocket(TSocketType sock) { Interlocked.Increment(ref _connections); _newSockets.Add(sock); SocketAdded(sock); } - public virtual void SocketAdded(SocketType sock) { } - public virtual void SocketRemoved(SocketType sock) { } + protected virtual void SocketAdded(TSocketType sock) { } + protected virtual void SocketRemoved(TSocketType sock) { } void AddNewSockets() { @@ -78,12 +78,11 @@ namespace Framework.Networking Log.outDebug(LogFilter.Network, "Network Thread Starting"); int sleepTime = 10; - uint tickStart = 0, diff = 0; while (!_stopped) { Thread.Sleep(sleepTime); - tickStart = Time.GetMSTime(); + uint tickStart = Time.GetMSTime(); AddNewSockets(); @@ -101,7 +100,7 @@ namespace Framework.Networking } } - diff = Time.GetMSTimeDiffToNow(tickStart); + uint diff = Time.GetMSTimeDiffToNow(tickStart); sleepTime = (int)(diff > 10 ? 0 : 10 - diff); } @@ -110,12 +109,12 @@ namespace Framework.Networking _Sockets.Clear(); } - volatile int _connections; + int _connections; volatile bool _stopped; Thread _thread; - List _Sockets = new List(); - List _newSockets = new List(); + List _Sockets = new List(); + List _newSockets = new List(); } } diff --git a/Source/Framework/Networking/SocketManager.cs b/Source/Framework/Networking/SocketManager.cs index e000599f9..2ea8d7c7d 100644 --- a/Source/Framework/Networking/SocketManager.cs +++ b/Source/Framework/Networking/SocketManager.cs @@ -21,7 +21,7 @@ using System.Net.Sockets; namespace Framework.Networking { - public class SocketManager where SocketType : ISocket + public class SocketManager where TSocketType : ISocket { public virtual bool StartNetwork(string bindIp, int port, int threadCount = 1) { @@ -30,11 +30,11 @@ namespace Framework.Networking Acceptor = new AsyncAcceptor(bindIp, port); _threadCount = threadCount; - _threads = new NetworkThread[GetNetworkThreadCount()]; + _threads = new NetworkThread[GetNetworkThreadCount()]; for (int i = 0; i < _threadCount; ++i) { - _threads[i] = new NetworkThread(); + _threads[i] = new NetworkThread(); _threads[i].Start(); } @@ -69,7 +69,7 @@ namespace Framework.Networking { try { - SocketType newSocket = (SocketType)Activator.CreateInstance(typeof(SocketType), sock); + TSocketType newSocket = (TSocketType)Activator.CreateInstance(typeof(TSocketType), sock); newSocket.Start(); _threads[SelectThreadWithMinConnections()].AddSocket(newSocket); @@ -94,7 +94,7 @@ namespace Framework.Networking } public AsyncAcceptor Acceptor; - NetworkThread[] _threads; + NetworkThread[] _threads; int _threadCount; } } diff --git a/Source/Framework/RecastDetour/Detour/DetourNavMeshQuery.cs b/Source/Framework/RecastDetour/Detour/DetourNavMeshQuery.cs index 63ba2bf65..babef10a7 100644 --- a/Source/Framework/RecastDetour/Detour/DetourNavMeshQuery.cs +++ b/Source/Framework/RecastDetour/Detour/DetourNavMeshQuery.cs @@ -168,13 +168,13 @@ public static partial class Detour private class dtQueryData { public dtStatus status; - public dtNode lastBestNode = null; + public dtNode lastBestNode; public float lastBestNodeCost; public dtPolyRef startRef; public dtPolyRef endRef; public float[] startPos = new float[3]; public float[] endPos = new float[3]; - public dtQueryFilter filter = null; + public dtQueryFilter filter; public void dtcsClear() { diff --git a/Source/Framework/Util/Extensions.cs b/Source/Framework/Util/Extensions.cs index 70d07d863..2cb55d38b 100644 --- a/Source/Framework/Util/Extensions.cs +++ b/Source/Framework/Util/Extensions.cs @@ -289,6 +289,9 @@ namespace System public static int GetByteCount(this string str) { + if (str.IsEmpty()) + return 0; + return Encoding.UTF8.GetByteCount(str); } #endregion diff --git a/Source/Game/BattleGrounds/Zones/StrandofAncients.cs b/Source/Game/BattleGrounds/Zones/StrandofAncients.cs index 0bf23b624..e2b1d772e 100644 --- a/Source/Game/BattleGrounds/Zones/StrandofAncients.cs +++ b/Source/Game/BattleGrounds/Zones/StrandofAncients.cs @@ -703,28 +703,22 @@ namespace Game.BattleGrounds.Zones public override WorldSafeLocsRecord GetClosestGraveYard(Player player) { uint safeloc = 0; - WorldSafeLocsRecord ret; - WorldSafeLocsRecord closest; - float dist, nearest; - float x, y, z; - - player.GetPosition(out x, out y, out z); if (player.GetTeamId() == Attackers) safeloc = SAMiscConst.GYEntries[SAGraveyards.BeachGy]; else safeloc = SAMiscConst.GYEntries[SAGraveyards.DefenderLastGy]; - closest = CliDB.WorldSafeLocsStorage.LookupByKey(safeloc); - nearest = player.GetExactDistSq(closest.Loc.X, closest.Loc.Y, closest.Loc.Z); + WorldSafeLocsRecord closest = CliDB.WorldSafeLocsStorage.LookupByKey(safeloc); + float nearest = player.GetExactDistSq(closest.Loc.X, closest.Loc.Y, closest.Loc.Z); for (byte i = SAGraveyards.RightCapturableGy; i < SAGraveyards.Max; i++) { if (GraveyardStatus[i] != player.GetTeamId()) continue; - ret = CliDB.WorldSafeLocsStorage.LookupByKey(SAMiscConst.GYEntries[i]); - dist = player.GetExactDistSq(ret.Loc.X, ret.Loc.Y, ret.Loc.Z); + WorldSafeLocsRecord ret = CliDB.WorldSafeLocsStorage.LookupByKey(SAMiscConst.GYEntries[i]); + float dist = player.GetExactDistSq(ret.Loc.X, ret.Loc.Y, ret.Loc.Z); if (dist < nearest) { closest = ret; diff --git a/Source/Game/Chat/Commands/CheatCommands.cs b/Source/Game/Chat/Commands/CheatCommands.cs index e6ebbe2bb..27fb224ce 100644 --- a/Source/Game/Chat/Commands/CheatCommands.cs +++ b/Source/Game/Chat/Commands/CheatCommands.cs @@ -27,7 +27,7 @@ namespace Game.Chat.Commands [Command("god", RBACPermissions.CommandCheatGod)] static bool HandleGodModeCheat(StringArguments args, CommandHandler handler) { - if (handler.GetSession() == null || handler.GetSession().GetPlayer()) + if (handler.GetSession() == null || !handler.GetSession().GetPlayer()) return false; string argstr = args.NextString(); diff --git a/Source/Game/Chat/Commands/DisableCommands.cs b/Source/Game/Chat/Commands/DisableCommands.cs index 60bb49d41..76be61997 100644 --- a/Source/Game/Chat/Commands/DisableCommands.cs +++ b/Source/Game/Chat/Commands/DisableCommands.cs @@ -34,7 +34,6 @@ namespace Game.Chat.Commands if (entry == 0) return false; - string flagsStr = args.NextString(); uint flags = args.NextUInt32(); string disableComment = args.NextString(""); diff --git a/Source/Game/Chat/Commands/GoCommands.cs b/Source/Game/Chat/Commands/GoCommands.cs index cc4b93eb7..1e5d4e86b 100644 --- a/Source/Game/Chat/Commands/GoCommands.cs +++ b/Source/Game/Chat/Commands/GoCommands.cs @@ -570,7 +570,6 @@ namespace Game.Chat.Commands string goX = args.NextString(); string goY = args.NextString(); string goZ = args.NextString(); - string id = args.NextString(); string port = args.NextString(); float x, y, z, o; diff --git a/Source/Game/Chat/Commands/ListCommands.cs b/Source/Game/Chat/Commands/ListCommands.cs index 8fc09ccba..c9b63f003 100644 --- a/Source/Game/Chat/Commands/ListCommands.cs +++ b/Source/Game/Chat/Commands/ListCommands.cs @@ -98,7 +98,6 @@ namespace Game.Chat.Commands return false; } - string countStr = args.NextString(); if (!uint.TryParse(args.NextString(), out uint count)) count = 10; diff --git a/Source/Game/Chat/Commands/ModifyCommands.cs b/Source/Game/Chat/Commands/ModifyCommands.cs index 3b50b8a81..735efb778 100644 --- a/Source/Game/Chat/Commands/ModifyCommands.cs +++ b/Source/Game/Chat/Commands/ModifyCommands.cs @@ -277,7 +277,7 @@ namespace Game.Chat if (moneyToAdd < 0) { - ulong newmoney = (targetMoney + (ulong)moneyToAdd); + long newmoney = (long)targetMoney + moneyToAdd; Log.outDebug(LogFilter.ChatSystem, Global.ObjectMgr.GetCypherString(CypherStrings.CurrentMoney), targetMoney, moneyToAdd, newmoney); if (newmoney <= 0) @@ -291,13 +291,13 @@ namespace Game.Chat else { ulong moneyToAddMsg = (ulong)(moneyToAdd * -1); - if (newmoney > PlayerConst.MaxMoneyAmount) - newmoney = PlayerConst.MaxMoneyAmount; + if (newmoney > (long)PlayerConst.MaxMoneyAmount) + newmoney = (long)PlayerConst.MaxMoneyAmount; - handler.SendSysMessage(CypherStrings.YouTakeMoney, Math.Abs(moneyToAdd), handler.GetNameLink(target)); + handler.SendSysMessage(CypherStrings.YouTakeMoney, moneyToAddMsg, handler.GetNameLink(target)); if (handler.needReportToTarget(target)) - target.SendSysMessage(CypherStrings.YoursMoneyTaken, handler.GetNameLink(), Math.Abs(moneyToAdd)); - target.SetMoney(newmoney); + target.SendSysMessage(CypherStrings.YoursMoneyTaken, handler.GetNameLink(), moneyToAddMsg); + target.SetMoney((ulong)newmoney); } } else diff --git a/Source/Game/Chat/Commands/ServerCommands.cs b/Source/Game/Chat/Commands/ServerCommands.cs index 4594b246c..32a576ac7 100644 --- a/Source/Game/Chat/Commands/ServerCommands.cs +++ b/Source/Game/Chat/Commands/ServerCommands.cs @@ -83,8 +83,6 @@ namespace Game.Chat if (string.IsNullOrEmpty(paramStr)) return false; - int limit = paramStr.Length; - switch (paramStr.ToLower()) { case "player": diff --git a/Source/Game/Chat/Commands/WPCommands.cs b/Source/Game/Chat/Commands/WPCommands.cs index b70e34edb..e2410f86d 100644 --- a/Source/Game/Chat/Commands/WPCommands.cs +++ b/Source/Game/Chat/Commands/WPCommands.cs @@ -314,7 +314,7 @@ namespace Game.Chat.Commands return false; stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Z); - stmt.AddValue(0, args); + stmt.AddValue(0, arg3); stmt.AddValue(1, id); DB.World.Execute(stmt); diff --git a/Source/Game/Collision/Models/WorldModel.cs b/Source/Game/Collision/Models/WorldModel.cs index bf3d2ea1c..0175ba27b 100644 --- a/Source/Game/Collision/Models/WorldModel.cs +++ b/Source/Game/Collision/Models/WorldModel.cs @@ -265,7 +265,7 @@ namespace Game.Collision z_dist = 0f; if (triangles.Empty() || !iBound.contains(pos)) return false; - GModelRayCallback callback = new GModelRayCallback(triangles, vertices); + Vector3 rPos = pos - 0.1f * down; float dist = float.PositiveInfinity; Ray ray = new Ray(rPos, down); @@ -379,7 +379,7 @@ namespace Game.Collision if (reader.ReadStringFromChars(4) != "WMOD") return false; - uint chunkSize = reader.ReadUInt32(); + reader.ReadUInt32(); //chunkSize notused RootWMOID = reader.ReadUInt32(); // read group models diff --git a/Source/Game/DataStorage/ClientReader/GameTables.cs b/Source/Game/DataStorage/ClientReader/GameTables.cs index 09b4753ca..44639f666 100644 --- a/Source/Game/DataStorage/ClientReader/GameTables.cs +++ b/Source/Game/DataStorage/ClientReader/GameTables.cs @@ -42,8 +42,6 @@ namespace Game.DataStorage return storage; } - var columnDefs = new StringArray(headers, '\t'); - List data = new List(); data.Add(new T()); // row id 0, unused diff --git a/Source/Game/DataStorage/M2Storage.cs b/Source/Game/DataStorage/M2Storage.cs index 0e6bf32f5..fcdb1c41f 100644 --- a/Source/Game/DataStorage/M2Storage.cs +++ b/Source/Game/DataStorage/M2Storage.cs @@ -187,7 +187,7 @@ namespace Game.DataStorage continue; } - var unknownSize = m2file.ReadUInt32(); //unknown size + m2file.ReadUInt32(); //unknown size // Read header M2Header header = m2file.Read(); diff --git a/Source/Game/Entities/Creature/CreatureGroups.cs b/Source/Game/Entities/Creature/CreatureGroups.cs index 80b592e88..513961053 100644 --- a/Source/Game/Entities/Creature/CreatureGroups.cs +++ b/Source/Game/Entities/Creature/CreatureGroups.cs @@ -25,8 +25,6 @@ namespace Game.Entities { public class FormationMgr { - public FormationMgr() { } - public static void AddCreatureToGroup(uint groupId, Creature member) { Map map = member.GetMap(); diff --git a/Source/Game/Entities/Creature/Gossip.cs b/Source/Game/Entities/Creature/Gossip.cs index f03810f6a..fdaa9fee3 100644 --- a/Source/Game/Entities/Creature/Gossip.cs +++ b/Source/Game/Entities/Creature/Gossip.cs @@ -764,8 +764,6 @@ namespace Game.Misc public class QuestMenu { - public QuestMenu() { } - public void AddMenuItem(uint QuestId, byte Icon) { if (Global.ObjectMgr.GetQuestTemplate(QuestId) == null) diff --git a/Source/Game/Entities/Item/Bag.cs b/Source/Game/Entities/Item/Bag.cs index abc0bb4d0..b36b174e0 100644 --- a/Source/Game/Entities/Item/Bag.cs +++ b/Source/Game/Entities/Item/Bag.cs @@ -105,12 +105,6 @@ namespace Game.Entities return true; } - public override void SaveToDB(SQLTransaction trans) - { - base.SaveToDB(trans); - - } - public override bool LoadFromDB(ulong guid, ObjectGuid owner_guid, SQLFields fields, uint entry) { if (!base.LoadFromDB(guid, owner_guid, fields, entry)) diff --git a/Source/Game/Entities/Object/ObjectGuid.cs b/Source/Game/Entities/Object/ObjectGuid.cs index 81112beec..79f112fdf 100644 --- a/Source/Game/Entities/Object/ObjectGuid.cs +++ b/Source/Game/Entities/Object/ObjectGuid.cs @@ -180,12 +180,6 @@ namespace Game.Entities public static bool operator ==(ObjectGuid first, ObjectGuid other) { - if (ReferenceEquals(first, other)) - return true; - - if ((object)first == null || (object)other == null) - return false; - return first.Equals(other); } diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 3932bc7cb..3b9215046 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -2444,10 +2444,9 @@ namespace Game.Entities public bool IsInMap(WorldObject obj) { - var m = GetMap().GetId(); - var b = obj.GetMap().GetId(); if (obj != null) - return IsInWorld && obj.IsInWorld && m == b; + return IsInWorld && obj.IsInWorld && GetMap().GetId() == obj.GetMap().GetId(); + return false; } diff --git a/Source/Game/Entities/Player/Player.Map.cs b/Source/Game/Entities/Player/Player.Map.cs index 43abec31a..9dc365fc8 100644 --- a/Source/Game/Entities/Player/Player.Map.cs +++ b/Source/Game/Entities/Player/Player.Map.cs @@ -30,11 +30,6 @@ namespace Game.Entities { public partial class Player { - public override void SetMap(Map map) - { - base.SetMap(map); - } - public Difficulty GetDifficultyID(MapRecord mapEntry) { if (!mapEntry.IsRaid()) diff --git a/Source/Game/Entities/Player/Player.Quest.cs b/Source/Game/Entities/Player/Player.Quest.cs index 40520267d..ed677abe4 100644 --- a/Source/Game/Entities/Player/Player.Quest.cs +++ b/Source/Game/Entities/Player/Player.Quest.cs @@ -1683,9 +1683,12 @@ namespace Game.Entities } bool destroyItem = true; - foreach (QuestObjective obj in quest.Objectives) - if (obj.Type == QuestObjectiveType.Item && srcItemId == obj.ObjectID) - destroyItem = false; + if (item.GetStartQuest() == questId) + { + foreach (QuestObjective obj in quest.Objectives) + if (obj.Type == QuestObjectiveType.Item && srcItemId == obj.ObjectID) + destroyItem = false; + } if (destroyItem) DestroyItemCount(srcItemId, count, true, true); diff --git a/Source/Game/Entities/Unit/Unit.Combat.cs b/Source/Game/Entities/Unit/Unit.Combat.cs index 7b824b85a..5c3cc24ad 100644 --- a/Source/Game/Entities/Unit/Unit.Combat.cs +++ b/Source/Game/Entities/Unit/Unit.Combat.cs @@ -145,8 +145,6 @@ namespace Game.Entities { if (!GetThreatManager().isThreatListEmpty()) { - int count = GetThreatManager().getThreatList().Count; - ThreatUpdate packet = new ThreatUpdate(); packet.UnitGUID = GetGUID(); var tlist = GetThreatManager().getThreatList(); diff --git a/Source/Game/Entities/Unit/Unit.Pets.cs b/Source/Game/Entities/Unit/Unit.Pets.cs index c0e05fdb3..7fa9fe429 100644 --- a/Source/Game/Entities/Unit/Unit.Pets.cs +++ b/Source/Game/Entities/Unit/Unit.Pets.cs @@ -370,30 +370,32 @@ namespace Game.Entities // Set charmed charmer.SetCharm(this, true); - Player player; if (IsTypeId(TypeId.Unit)) { ToCreature().GetAI().OnCharmed(true); GetMotionMaster().MoveIdle(); } - else if (player = ToPlayer()) + else { - if (player.isAFK()) - player.ToggleAFK(); - - Creature creatureCharmer = charmer.ToCreature(); - if (charmer.IsTypeId(TypeId.Unit)) // we are charmed by a creature + Player player = ToPlayer(); + if (player) { - // change AI to charmed AI on next Update tick - NeedChangeAI = true; - if (IsAIEnabled) - { - IsAIEnabled = false; - player.GetAI().OnCharmed(true); - } - } + if (player.isAFK()) + player.ToggleAFK(); - player.SetClientControl(this, false); + if (charmer.IsTypeId(TypeId.Unit)) // we are charmed by a creature + { + // change AI to charmed AI on next Update tick + NeedChangeAI = true; + if (IsAIEnabled) + { + IsAIEnabled = false; + player.GetAI().OnCharmed(true); + } + } + + player.SetClientControl(this, false); + } } // charm is set by aura, and aura effect remove handler was called during apply handler execution diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 1e6a9bcdb..cb7191ec2 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -3128,9 +3128,9 @@ namespace Game.Entities return null; } - public List GetDispellableAuraList(Unit caster, uint dispelMask) + public List GetDispellableAuraList(Unit caster, uint dispelMask, bool isReflect = false) { - List dispelList = new List(); + List dispelList = new List(); var auras = GetOwnedAuras(); foreach (var pair in auras) @@ -3147,8 +3147,14 @@ namespace Game.Entities if (Convert.ToBoolean(aura.GetSpellInfo().GetDispelMask() & dispelMask)) { // do not remove positive auras if friendly target - // negative auras if non-friendly target - if (aurApp.IsPositive() == IsFriendlyTo(caster)) + // negative auras if non-friendly + // unless we're reflecting (dispeller eliminates one of it's benefitial buffs) + if (isReflect != (aurApp.IsPositive() == IsFriendlyTo(caster))) + continue; + + // 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance." + int chance = aura.CalcDispelChance(this, !IsFriendlyTo(caster)); + if (chance == 0) continue; // The charges / stack amounts don't count towards the total number of auras that can be dispelled. @@ -3157,7 +3163,7 @@ namespace Game.Entities bool dispelCharges = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelCharges); byte charges = dispelCharges ? aura.GetCharges() : aura.GetStackAmount(); if (charges > 0) - dispelList.Add(new DispelCharges(aura, charges)); + dispelList.Add(new DispelableAura(aura, chance, charges)); } } diff --git a/Source/Game/Entities/Vehicle.cs b/Source/Game/Entities/Vehicle.cs index 30b541c7c..ffb8bd716 100644 --- a/Source/Game/Entities/Vehicle.cs +++ b/Source/Game/Entities/Vehicle.cs @@ -61,9 +61,9 @@ namespace Game.Entities InitMovementInfoForBase(); } - public virtual void Dispose() + public void Dispose() { - /// @Uninstall must be called before this. + // @Uninstall must be called before this. Contract.Assert(_status == Status.UnInstalling); foreach (var pair in Seats) Contract.Assert(pair.Value.IsEmpty()); diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index e34d49afc..d49a95fec 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -589,7 +589,6 @@ namespace Game public Dictionary GetClassExpansionRequirements() { return _classExpansionRequirementStorage; } public Expansion GetClassExpansionRequirement(Class class_) { - var exp = _classExpansionRequirementStorage.LookupByKey(class_); if (_classExpansionRequirementStorage.ContainsKey((byte)class_)) return (Expansion)_classExpansionRequirementStorage[(byte)class_]; return Expansion.Classic; @@ -7804,6 +7803,8 @@ namespace Game AddLocaleString(result.Read(5), locale, data.TitleAlt); } while (result.NextRow()); + + Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creature locale strings in {1} ms", _creatureLocaleStorage.Count, Time.GetMSTimeDiffToNow(oldMSTime)); } public void LoadGameObjectLocales() { @@ -8093,6 +8094,8 @@ namespace Game AddLocaleString(result.Read(2), locale, data.Name); } while (result.NextRow()); + + Log.outInfo(LogFilter.ServerLoading, "Loaded {0} points_of_interest locale strings in {1} ms", _pointOfInterestLocaleStorage.Count, Time.GetMSTimeDiffToNow(oldMSTime)); } public CreatureLocale GetCreatureLocale(uint entry) diff --git a/Source/Game/Groups/Group.cs b/Source/Game/Groups/Group.cs index 08903fc56..59e1a3430 100644 --- a/Source/Game/Groups/Group.cs +++ b/Source/Game/Groups/Group.cs @@ -92,21 +92,21 @@ namespace Game.Groups stmt.AddValue(index++, m_dbStoreId); stmt.AddValue(index++, m_leaderGuid.GetCounter()); - stmt.AddValue(index++, m_lootMethod); + stmt.AddValue(index++, (byte)m_lootMethod); stmt.AddValue(index++, m_looterGuid.GetCounter()); - stmt.AddValue(index++, m_lootThreshold); - stmt.AddValue(index++, m_targetIcons[0]); - stmt.AddValue(index++, m_targetIcons[1]); - stmt.AddValue(index++, m_targetIcons[2]); - stmt.AddValue(index++, m_targetIcons[3]); - stmt.AddValue(index++, m_targetIcons[4]); - stmt.AddValue(index++, m_targetIcons[5]); - stmt.AddValue(index++, m_targetIcons[6]); - stmt.AddValue(index++, m_targetIcons[7]); - stmt.AddValue(index++, m_groupFlags); - stmt.AddValue(index++, m_dungeonDifficulty); - stmt.AddValue(index++, m_raidDifficulty); - stmt.AddValue(index++, m_legacyRaidDifficulty); + stmt.AddValue(index++, (byte)m_lootThreshold); + stmt.AddValue(index++, m_targetIcons[0].GetRawValue()); + stmt.AddValue(index++, m_targetIcons[1].GetRawValue()); + stmt.AddValue(index++, m_targetIcons[2].GetRawValue()); + stmt.AddValue(index++, m_targetIcons[3].GetRawValue()); + stmt.AddValue(index++, m_targetIcons[4].GetRawValue()); + stmt.AddValue(index++, m_targetIcons[5].GetRawValue()); + stmt.AddValue(index++, m_targetIcons[6].GetRawValue()); + stmt.AddValue(index++, m_targetIcons[7].GetRawValue()); + stmt.AddValue(index++, (byte)m_groupFlags); + stmt.AddValue(index++, (byte)m_dungeonDifficulty); + stmt.AddValue(index++, (byte)m_raidDifficulty); + stmt.AddValue(index++, (byte)m_legacyRaidDifficulty); stmt.AddValue(index++, m_masterLooterGuid.GetCounter()); DB.Characters.Execute(stmt); diff --git a/Source/Game/Guilds/GuildFinderManager.cs b/Source/Game/Guilds/GuildFinderManager.cs index be923ef67..2ad902cf3 100644 --- a/Source/Game/Guilds/GuildFinderManager.cs +++ b/Source/Game/Guilds/GuildFinderManager.cs @@ -22,6 +22,7 @@ using Game.Entities; using Game.Network.Packets; using System; using System.Collections.Generic; +using System.Linq; namespace Game.Guilds { @@ -104,10 +105,11 @@ namespace Game.Guilds if (!_membershipRequestsByGuild.ContainsKey(guildId)) _membershipRequestsByGuild[guildId] = new Dictionary(); + _membershipRequestsByGuild[guildId][playerId] = request; + if (!_membershipRequestsByPlayer.ContainsKey(playerId)) _membershipRequestsByPlayer[playerId] = new Dictionary(); - _membershipRequestsByGuild[guildId][playerId] = request; _membershipRequestsByPlayer[playerId][guildId] = request; ++count; @@ -118,13 +120,18 @@ namespace Game.Guilds public void AddMembershipRequest(ObjectGuid guildGuid, MembershipRequest request) { + if (!_membershipRequestsByGuild.ContainsKey(guildGuid)) + _membershipRequestsByGuild[guildGuid] = new Dictionary(); _membershipRequestsByGuild[guildGuid][request.GetPlayerGUID()] = request; + + if (!_membershipRequestsByPlayer.ContainsKey(request.GetPlayerGUID())) + _membershipRequestsByPlayer[request.GetPlayerGUID()] = new Dictionary(); _membershipRequestsByPlayer[request.GetPlayerGUID()][guildGuid] = request; SQLTransaction trans = new SQLTransaction(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GUILD_FINDER_APPLICANT); - stmt.AddValue(0, request.GetGuildGuid()); - stmt.AddValue(1, request.GetPlayerGUID()); + stmt.AddValue(0, request.GetGuildGuid().GetCounter()); + stmt.AddValue(1, request.GetPlayerGUID().GetCounter()); stmt.AddValue(2, request.GetAvailability()); stmt.AddValue(3, request.GetClassRoles()); stmt.AddValue(4, request.GetInterests()); @@ -179,7 +186,6 @@ namespace Game.Guilds public void RemoveMembershipRequest(ObjectGuid playerId, ObjectGuid guildId) { - if (_membershipRequestsByGuild.ContainsKey(guildId)) { var guildDic = _membershipRequestsByGuild[guildId]; @@ -278,7 +284,7 @@ namespace Game.Guilds SQLTransaction trans = new SQLTransaction(); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GUILD_FINDER_GUILD_SETTINGS); - stmt.AddValue(0, settings.GetGUID()); + stmt.AddValue(0, settings.GetGUID().GetCounter()); stmt.AddValue(1, settings.GetAvailability()); stmt.AddValue(2, settings.GetClassRoles()); stmt.AddValue(3, settings.GetInterests()); diff --git a/Source/Game/Handlers/BattleFieldHandler.cs b/Source/Game/Handlers/BattleFieldHandler.cs index 84b664785..5e9603987 100644 --- a/Source/Game/Handlers/BattleFieldHandler.cs +++ b/Source/Game/Handlers/BattleFieldHandler.cs @@ -90,7 +90,6 @@ namespace Game /// This is call when player leave battlefield zone. /// /// The queue id of Bf - /// The queue id of Bf /// Battlefield status /// Whether player is added to Bf on the spot or teleported from queue /// Reason why player left battlefield diff --git a/Source/Game/Handlers/CalendarHandler.cs b/Source/Game/Handlers/CalendarHandler.cs index 6ffb3f3ad..5a8cc9821 100644 --- a/Source/Game/Handlers/CalendarHandler.cs +++ b/Source/Game/Handlers/CalendarHandler.cs @@ -509,7 +509,6 @@ namespace Game if (save == null) return; - ObjectGuid guid = GetPlayer().GetGUID(); long currTime = Time.UnixTime; CalendarRaidLockoutUpdated packet = new CalendarRaidLockoutUpdated(); diff --git a/Source/Game/Handlers/MiscHandler.cs b/Source/Game/Handlers/MiscHandler.cs index 6bbafe451..2cc254aa7 100644 --- a/Source/Game/Handlers/MiscHandler.cs +++ b/Source/Game/Handlers/MiscHandler.cs @@ -745,7 +745,7 @@ namespace Game if (_warden == null || packet.Data.GetSize() == 0) return; - var unpacked = new ByteBuffer(_warden.DecryptData(packet.Data.GetData())); + _warden.DecryptData(packet.Data.GetData()); WardenOpcodes opcode = (WardenOpcodes)packet.Data.ReadUInt8(); switch (opcode) diff --git a/Source/Game/Handlers/MovementHandler.cs b/Source/Game/Handlers/MovementHandler.cs index f9e27abf2..9cb0bfc92 100644 --- a/Source/Game/Handlers/MovementHandler.cs +++ b/Source/Game/Handlers/MovementHandler.cs @@ -287,7 +287,6 @@ namespace Game // only add to bg group and object, if the player was invited (else he entered through command) if (GetPlayer().InBattleground()) { - Battleground bg; // cleanup setting if outdated if (!mapEntry.IsBattlegroundOrArena()) { @@ -297,10 +296,14 @@ namespace Game GetPlayer().SetBGTeam(0); } // join to bg case - else if (bg = GetPlayer().GetBattleground()) + else { - if (GetPlayer().IsInvitedForBattlegroundInstance(GetPlayer().GetBattlegroundId())) - bg.AddPlayer(GetPlayer()); + Battleground bg = GetPlayer().GetBattleground(); + if (bg) + { + if (GetPlayer().IsInvitedForBattlegroundInstance(GetPlayer().GetBattlegroundId())) + bg.AddPlayer(GetPlayer()); + } } } diff --git a/Source/Game/Handlers/PetitionsHandler.cs b/Source/Game/Handlers/PetitionsHandler.cs index 9e021b466..0eeb951ee 100644 --- a/Source/Game/Handlers/PetitionsHandler.cs +++ b/Source/Game/Handlers/PetitionsHandler.cs @@ -255,7 +255,7 @@ namespace Game } ObjectGuid ownerGuid = ObjectGuid.Create(HighGuid.Player, result.Read(0)); - ulong signs = result.Read(1); + //ulong signs = result.Read(1); if (ownerGuid == GetPlayer().GetGUID()) return; @@ -267,7 +267,6 @@ namespace Game return; } - if (GetPlayer().GetGuildId() != 0) { Guild.SendCommandResult(this, GuildCommandType.InvitePlayer, GuildCommandError.AlreadyInGuild_S, GetPlayer().GetName()); diff --git a/Source/Game/Handlers/VehicleHandler.cs b/Source/Game/Handlers/VehicleHandler.cs index ab961ed83..ffb24756c 100644 --- a/Source/Game/Handlers/VehicleHandler.cs +++ b/Source/Game/Handlers/VehicleHandler.cs @@ -97,15 +97,18 @@ namespace Game vehicle_base.m_movementInfo = packet.Status; - Unit vehUnit; if (packet.DstVehicle.IsEmpty()) GetPlayer().ChangeSeat(-1, packet.DstSeatIndex != 255); - else if (vehUnit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.DstVehicle)) + else { - Vehicle vehicle = vehUnit.GetVehicleKit(); - if (vehicle) - if (vehicle.HasEmptySeat((sbyte)packet.DstSeatIndex)) - vehUnit.HandleSpellClick(GetPlayer(), (sbyte)packet.DstSeatIndex); + Unit vehUnit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.DstVehicle); + if (vehUnit) + { + Vehicle vehicle = vehUnit.GetVehicleKit(); + if (vehicle) + if (vehicle.HasEmptySeat((sbyte) packet.DstSeatIndex)) + vehUnit.HandleSpellClick(GetPlayer(), (sbyte) packet.DstSeatIndex); + } } } @@ -123,15 +126,19 @@ namespace Game GetPlayer().GetGUID().ToString(), seat.Flags); return; } - Unit vehUnit; + if (vehicle_base.GetGUID() == packet.Vehicle) GetPlayer().ChangeSeat((sbyte)packet.SeatIndex); - else if (vehUnit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Vehicle)) + else { - Vehicle vehicle = vehUnit.GetVehicleKit(); - if (vehicle) - if (vehicle.HasEmptySeat((sbyte)packet.SeatIndex)) - vehUnit.HandleSpellClick(GetPlayer(), (sbyte)packet.SeatIndex); + Unit vehUnit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Vehicle); + if (vehUnit) + { + Vehicle vehicle = vehUnit.GetVehicleKit(); + if (vehicle) + if (vehicle.HasEmptySeat((sbyte) packet.SeatIndex)) + vehUnit.HandleSpellClick(GetPlayer(), (sbyte) packet.SeatIndex); + } } } diff --git a/Source/Game/Maps/GridDefines.cs b/Source/Game/Maps/GridDefines.cs index c1d4d7c34..c97e21be6 100644 --- a/Source/Game/Maps/GridDefines.cs +++ b/Source/Game/Maps/GridDefines.cs @@ -156,18 +156,23 @@ namespace Game.Maps { return (p1.x_coord == p2.x_coord && p1.y_coord == p2.y_coord); } + public static bool operator !=(CellCoord p1, CellCoord p2) { return !(p1 == p2); } + public override bool Equals(object obj) { - return base.Equals(obj); + if (obj is CellCoord) + return (CellCoord)obj == this; + + return false; } public override int GetHashCode() { - return base.GetHashCode(); + return x_coord.GetHashCode() ^ y_coord.GetHashCode(); } public uint x_coord { get; set; } diff --git a/Source/Game/Maps/GridMap.cs b/Source/Game/Maps/GridMap.cs index 82a9332e5..b72021cd7 100644 --- a/Source/Game/Maps/GridMap.cs +++ b/Source/Game/Maps/GridMap.cs @@ -160,15 +160,15 @@ namespace Game.Maps float[][] boundGridCoords = { - new float[] { 0.0f, 0.0f }, - new float[] { 0.0f, -266.66666f }, - new float[] { 0.0f, -533.33331f }, - new float[] { -266.66666f, 0.0f }, - new float[] { -266.66666f, -266.66666f }, - new float[] { -266.66666f, -533.33331f }, - new float[] { -533.33331f, 0.0f }, - new float[] { -533.33331f, -266.66666f }, - new float[] { -533.33331f, -533.33331f } + new [] { 0.0f, 0.0f }, + new [] { 0.0f, -266.66666f }, + new [] { 0.0f, -533.33331f }, + new [] { -266.66666f, 0.0f }, + new [] { -266.66666f, -266.66666f }, + new [] { -266.66666f, -533.33331f }, + new [] { -533.33331f, 0.0f }, + new [] { -533.33331f, -266.66666f }, + new [] { -533.33331f, -533.33331f } }; _minHeightPlanes = new Plane[8]; diff --git a/Source/Game/Maps/Instances/InstanceScript.cs b/Source/Game/Maps/Instances/InstanceScript.cs index 769b7ebca..78f654f0a 100644 --- a/Source/Game/Maps/Instances/InstanceScript.cs +++ b/Source/Game/Maps/Instances/InstanceScript.cs @@ -398,15 +398,14 @@ namespace Game.Maps void ReadSaveDataBossStates(StringArguments data) { - uint bossId = 0; - foreach (var i in bosses) + foreach (var pair in bosses) { EncounterState buff = (EncounterState)data.NextUInt32(); if (buff == EncounterState.InProgress || buff == EncounterState.Fail || buff == EncounterState.Special) buff = EncounterState.NotStarted; if (buff < EncounterState.ToBeDecided) - SetBossState(bossId++, buff); + SetBossState(pair.Key, buff); } } diff --git a/Source/Game/Movement/Generators/RandomMovement.cs b/Source/Game/Movement/Generators/RandomMovement.cs index b17330c69..39cbfa041 100644 --- a/Source/Game/Movement/Generators/RandomMovement.cs +++ b/Source/Game/Movement/Generators/RandomMovement.cs @@ -84,7 +84,7 @@ namespace Game.Movement return true; } - public void _setRandomLocation(Creature creature) + void _setRandomLocation(Creature creature) { if (creature.IsMovementPreventedByCasting()) { diff --git a/Source/Game/Movement/Generators/WaypointMovement.cs b/Source/Game/Movement/Generators/WaypointMovement.cs index b4939ce54..8185d175d 100644 --- a/Source/Game/Movement/Generators/WaypointMovement.cs +++ b/Source/Game/Movement/Generators/WaypointMovement.cs @@ -372,8 +372,6 @@ namespace Game.Movement public class FlightPathMovementGenerator : MovementGeneratorMedium { - public FlightPathMovementGenerator() { } - public void LoadPath(Player player, uint startNode = 0) { i_path.Clear(); diff --git a/Source/Game/Movement/MotionMaster.cs b/Source/Game/Movement/MotionMaster.cs index ceffb60cf..51d451691 100644 --- a/Source/Game/Movement/MotionMaster.cs +++ b/Source/Game/Movement/MotionMaster.cs @@ -758,10 +758,10 @@ namespace Game.Movement return (movement == staticIdleMovement); } - static uint splineId = 0; + static uint splineId; - public Unit _owner { get; private set; } - protected IMovementGenerator[] _slot = new IMovementGenerator[(int)MovementSlot.Max]; + Unit _owner { get; } + IMovementGenerator[] _slot = new IMovementGenerator[(int)MovementSlot.Max]; MMCleanFlag _cleanFlag; bool[] _initialize = new bool[(int)MovementSlot.Max]; int _top; diff --git a/Source/Game/Network/Packets/BattleGroundPackets.cs b/Source/Game/Network/Packets/BattleGroundPackets.cs index 80f4fcac1..c9bfb3409 100644 --- a/Source/Game/Network/Packets/BattleGroundPackets.cs +++ b/Source/Game/Network/Packets/BattleGroundPackets.cs @@ -302,9 +302,9 @@ namespace Game.Network.Packets JoinAsGroup = _worldPacket.HasBit(); } - public bool JoinAsGroup = false; - public byte Roles = 0; - public ulong QueueID = 0; + public bool JoinAsGroup; + public byte Roles; + public ulong QueueID; public int[] BlacklistMap = new int[2]; } diff --git a/Source/Game/Network/Packets/CharacterPackets.cs b/Source/Game/Network/Packets/CharacterPackets.cs index 794db81f5..0af044e7b 100644 --- a/Source/Game/Network/Packets/CharacterPackets.cs +++ b/Source/Game/Network/Packets/CharacterPackets.cs @@ -627,7 +627,7 @@ namespace Game.Network.Packets } public ObjectGuid Guid; // Guid of the player that is logging in - float FarClip = 0.0f; // Visibility distance (for terrain) + float FarClip; // Visibility distance (for terrain) } public class LoginVerifyWorld : ServerPacket @@ -1036,13 +1036,13 @@ namespace Game.Network.Packets public Race RaceId = Race.None; public Class ClassId = Class.None; public Gender Sex = Gender.None; - public byte Skin = 0; - public byte Face = 0; - public byte HairStyle = 0; - public byte HairColor = 0; - public byte FacialHairStyle = 0; + public byte Skin; + public byte Face; + public byte HairStyle; + public byte HairColor; + public byte FacialHairStyle; public Array CustomDisplay = new Array(PlayerConst.CustomDisplaySize); - public byte OutfitId = 0; + public byte OutfitId; public Optional TemplateSet = new Optional(); public string Name; @@ -1058,14 +1058,14 @@ namespace Game.Network.Packets public class CharCustomizeInfo { - public byte HairStyleID = 0; - public byte FaceID = 0; + public byte HairStyleID; + public byte FaceID; public ObjectGuid CharGUID; public Gender SexID = Gender.None; public string CharName; - public byte HairColorID = 0; - public byte FacialHairStyleID = 0; - public byte SkinID = 0; + public byte HairColorID; + public byte FacialHairStyleID; + public byte SkinID; public Array CustomDisplay = new Array(PlayerConst.CustomDisplaySize); } @@ -1077,7 +1077,7 @@ namespace Game.Network.Packets public byte SkinID; public byte FacialHairStyleID; public ObjectGuid Guid; - public bool FactionChange = false; + public bool FactionChange; public string Name; public byte FaceID; public byte HairStyleID; diff --git a/Source/Game/Network/Packets/ChatPackets.cs b/Source/Game/Network/Packets/ChatPackets.cs index 717ea210c..da3e2be5f 100644 --- a/Source/Game/Network/Packets/ChatPackets.cs +++ b/Source/Game/Network/Packets/ChatPackets.cs @@ -276,7 +276,7 @@ namespace Game.Network.Packets public string Prefix = ""; public string Channel = ""; public string ChatText = ""; - public uint AchievementID = 0; + public uint AchievementID; public ChatFlags _ChatFlags = 0; public float DisplayTime = 0.0f; public bool HideChatLog = false; diff --git a/Source/Game/Network/Packets/ClientConfigPackets.cs b/Source/Game/Network/Packets/ClientConfigPackets.cs index dc0b1c8dd..0ee41eb63 100644 --- a/Source/Game/Network/Packets/ClientConfigPackets.cs +++ b/Source/Game/Network/Packets/ClientConfigPackets.cs @@ -106,8 +106,8 @@ namespace Game.Network.Packets } public ObjectGuid PlayerGuid; - public uint Time = 0; // UnixTime - public uint Size = 0; // decompressed size + public uint Time; // UnixTime + public uint Size; // decompressed size public AccountDataTypes DataType = 0; public ByteBuffer CompressedData; } diff --git a/Source/Game/Network/Packets/CombatPackets.cs b/Source/Game/Network/Packets/CombatPackets.cs index 5e94cfcf4..33ed7aa7b 100644 --- a/Source/Game/Network/Packets/CombatPackets.cs +++ b/Source/Game/Network/Packets/CombatPackets.cs @@ -92,7 +92,7 @@ namespace Game.Network.Packets public ObjectGuid Attacker; public ObjectGuid Victim; - public bool NowDead = false; + public bool NowDead; } public class ThreatUpdate : ServerPacket diff --git a/Source/Game/Network/Packets/InspectPackets.cs b/Source/Game/Network/Packets/InspectPackets.cs index a94f8384a..add7954f7 100644 --- a/Source/Game/Network/Packets/InspectPackets.cs +++ b/Source/Game/Network/Packets/InspectPackets.cs @@ -138,7 +138,7 @@ namespace Game.Network.Packets Bracket.ForEach(p => p.Write(_worldPacket)); } - public List Bracket; + public List Bracket = new List(); public ObjectGuid ClientGUID; } diff --git a/Source/Game/Network/Packets/MovementPackets.cs b/Source/Game/Network/Packets/MovementPackets.cs index 997ee7edd..11ed6acee 100644 --- a/Source/Game/Network/Packets/MovementPackets.cs +++ b/Source/Game/Network/Packets/MovementPackets.cs @@ -91,7 +91,7 @@ namespace Game.Network.Packets for (uint i = 0; i < removeMovementForcesCount; ++i) { - ObjectGuid guid = data.ReadPackedGuid(); + data.ReadPackedGuid(); } // ResetBitReader @@ -676,8 +676,8 @@ namespace Game.Network.Packets } public ObjectGuid MoverGUID; - int AckIndex = 0; - int MoveTime = 0; + int AckIndex; + int MoveTime; } public class MovementAckMessage : ClientPacket diff --git a/Source/Game/Network/Packets/PetitionPackets.cs b/Source/Game/Network/Packets/PetitionPackets.cs index 7cf0bf7ac..d31250325 100644 --- a/Source/Game/Network/Packets/PetitionPackets.cs +++ b/Source/Game/Network/Packets/PetitionPackets.cs @@ -34,7 +34,7 @@ namespace Game.Network.Packets } public ObjectGuid ItemGUID; - public uint PetitionID = 0; + public uint PetitionID; } public class QueryPetitionResponse : ServerPacket @@ -156,7 +156,7 @@ namespace Game.Network.Packets } public ObjectGuid PetitionGUID; - public byte Choice = 0; + public byte Choice; } public class PetitionSignResults : ServerPacket diff --git a/Source/Game/Network/Packets/SpellPackets.cs b/Source/Game/Network/Packets/SpellPackets.cs index f6d0d7a5d..d11963180 100644 --- a/Source/Game/Network/Packets/SpellPackets.cs +++ b/Source/Game/Network/Packets/SpellPackets.cs @@ -104,8 +104,8 @@ namespace Game.Network.Packets ModCooldown = cooldown; } - public uint Category = 0; // SpellCategory Id - public int ModCooldown = 0; // Reduced Cooldown in ms + public uint Category; // SpellCategory Id + public int ModCooldown; // Reduced Cooldown in ms } } diff --git a/Source/Game/Network/Packets/TaxiPackets.cs b/Source/Game/Network/Packets/TaxiPackets.cs index bfe204987..b52dd9f05 100644 --- a/Source/Game/Network/Packets/TaxiPackets.cs +++ b/Source/Game/Network/Packets/TaxiPackets.cs @@ -116,8 +116,8 @@ namespace Game.Network.Packets public ObjectGuid Vendor; public uint Node; - public uint GroundMountID = 0; - public uint FlyingMountID = 0; + public uint GroundMountID; + public uint FlyingMountID; } class NewTaxiPath : ServerPacket diff --git a/Source/Game/Phasing/PhaseShift.cs b/Source/Game/Phasing/PhaseShift.cs index 919c20f43..4eb2b7f0a 100644 --- a/Source/Game/Phasing/PhaseShift.cs +++ b/Source/Game/Phasing/PhaseShift.cs @@ -249,11 +249,15 @@ namespace Game public override bool Equals(object obj) { - return base.Equals(obj); + if (obj is PhaseRef) + return (PhaseRef)obj == this; + + return false; } + public override int GetHashCode() { - return base.GetHashCode(); + return Id.GetHashCode() ^ Flags.GetHashCode() ^ References.GetHashCode() ^ AreaConditions.GetHashCode(); } } diff --git a/Source/Game/Phasing/PhasingHandler.cs b/Source/Game/Phasing/PhasingHandler.cs index 44186c002..6a5080c7a 100644 --- a/Source/Game/Phasing/PhasingHandler.cs +++ b/Source/Game/Phasing/PhasingHandler.cs @@ -337,7 +337,6 @@ namespace Game foreach (AuraEffect aurEff in unit.GetAuraEffectsByType(AuraType.Phase)) { uint phaseId = (uint)aurEff.GetMiscValueB(); - var eraseResult = newSuppressions.RemovePhase(phaseId); // if condition was met previously there is nothing to erase if (newSuppressions.RemovePhase(phaseId)) phaseShift.AddPhase(phaseId, GetPhaseFlags(phaseId), null);//todo needs checked diff --git a/Source/Game/Server/WorldConfig.cs b/Source/Game/Server/WorldConfig.cs index 0753beebc..641d094cf 100644 --- a/Source/Game/Server/WorldConfig.cs +++ b/Source/Game/Server/WorldConfig.cs @@ -40,7 +40,7 @@ namespace Game Values[WorldCfg.EnableSinfoLogin] = GetDefaultValue("Server.LoginInfo", 0); // Read all rates from the config file - Action setRegenRate = (WorldCfg rate, string configKey) => + Action setRegenRate = (rate, configKey) => { Values[rate] = GetDefaultValue(configKey, 1.0f); if ((float)Values[rate] < 0.0f) diff --git a/Source/Game/Server/WorldSession.cs b/Source/Game/Server/WorldSession.cs index 4033b8c81..5ee5f5023 100644 --- a/Source/Game/Server/WorldSession.cs +++ b/Source/Game/Server/WorldSession.cs @@ -984,8 +984,6 @@ namespace Game class AccountInfoQueryHolderPerRealm : SQLQueryHolder { - public AccountInfoQueryHolderPerRealm() { } - public void Initialize(uint accountId, uint battlenetAccountId) { PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ACCOUNT_DATA); @@ -1000,8 +998,6 @@ namespace Game class AccountInfoQueryHolder : SQLQueryHolder { - public AccountInfoQueryHolder() { } - public void Initialize(uint accountId, uint battlenetAccountId) { PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_TOYS); diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index e3a2a8a5f..072ea4d61 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -5999,7 +5999,7 @@ namespace Game.Spells if (apply) { - AreaTrigger areaTrigger = AreaTrigger.CreateAreaTrigger((uint)GetMiscValue(), GetCaster(), target, GetSpellInfo(), target, GetBase().GetDuration(), GetBase().GetSpellXSpellVisualId(), ObjectGuid.Empty, this); + AreaTrigger.CreateAreaTrigger((uint)GetMiscValue(), GetCaster(), target, GetSpellInfo(), target, GetBase().GetDuration(), GetBase().GetSpellXSpellVisualId(), ObjectGuid.Empty, this); } else { @@ -6029,8 +6029,6 @@ namespace Game.Spells class AbsorbAuraOrderPred : Comparer { - public AbsorbAuraOrderPred() { } - public override int Compare(AuraEffect aurEffA, AuraEffect aurEffB) { SpellInfo spellProtoA = aurEffA.GetSpellInfo(); diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 98938e24a..ff1d9b2c7 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -1854,6 +1854,7 @@ namespace Game.Spells // Need init unitTarget by default unit (can changed in code on reflect) // Or on missInfo != SPELL_MISS_NONE unitTarget undefined (but need in trigger subsystem) unitTarget = unit; + targetMissInfo = missInfo; // Reset damage/healing counter m_damage = target.damage; @@ -2416,7 +2417,6 @@ namespace Game.Spells { if (Convert.ToBoolean(channelAuraMask & ihit.effectMask)) { - var b = unit.GetGUID(); AuraApplication aurApp = unit.GetAuraApplication(m_spellInfo.Id, m_originalCasterGUID); if (aurApp != null) { @@ -7282,6 +7282,7 @@ namespace Game.Spells public GameObject gameObjTarget; public WorldLocation destTarget; public int damage; + SpellMissInfo targetMissInfo; float variance; SpellEffectHandleMode effectHandleMode; public SpellEffectInfo effectInfo; diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 8e0d6040b..feff69991 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -1904,12 +1904,15 @@ namespace Game.Spells uint dispel_type = (uint)effectInfo.MiscValue; uint dispelMask = SpellInfo.GetDispelMask((DispelType)dispel_type); - List dispel_list = unitTarget.GetDispellableAuraList(m_caster, dispelMask); - if (dispel_list.Empty()) + List dispelList = unitTarget.GetDispellableAuraList(m_caster, dispelMask, targetMissInfo == SpellMissInfo.Reflect); + if (dispelList.Empty()) return; + int remaining = dispelList.Count(); + // Ok if exist some buffs for dispel try dispel it - List success_list = new List(); + uint failCount = 0; + List successList = new List(); DispelFailed dispelFailed = new DispelFailed(); dispelFailed.CasterGUID = m_caster.GetGUID(); @@ -1917,49 +1920,44 @@ namespace Game.Spells dispelFailed.SpellID = m_spellInfo.Id; // dispel N = damage buffs (or while exist buffs for dispel) - for (int count = 0; count < damage && !dispel_list.Empty();) + for (int count = 0; count < damage && remaining > 0;) { // Random select buff for dispel - var pair = dispel_list[RandomHelper.IRand(0, dispel_list.Count - 1)]; + var dispelableAura = dispelList[RandomHelper.IRand(0, dispelList.Count - 1)]; - int chance = pair.aura.CalcDispelChance(unitTarget, !unitTarget.IsFriendlyTo(m_caster)); - // 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance." - if (chance == 0) + if (dispelableAura.RollDispel()) { - dispel_list.Remove(pair); - continue; + var successItr = successList.Find(dispelAura => + { + if (dispelAura.GetAura().GetId() == dispelableAura.GetAura().GetId()) + return true; + + return false; + }); + + if (successItr == null) + successList.Add(new DispelableAura(dispelableAura.GetAura(), 0, 1)); + else + successItr.IncrementCharges(); + + if (!dispelableAura.DecrementCharge()) + { + --remaining; + dispelList[remaining] = dispelableAura; + } } else { - if (RandomHelper.randChance(chance)) - { - bool alreadyListed = false; - foreach (var successPair in success_list) - { - var successValue = successPair.value; - if (successPair.aura.GetId() == pair.aura.GetId()) - { - ++successPair.value; - alreadyListed = true; - } - } - if (!alreadyListed) - success_list.Add(new DispelCharges(pair.aura, 1)); - --pair.value; - if (pair.value <= 0) - dispel_list.Remove(pair); - } - else - dispelFailed.FailedSpells.Add(pair.aura.GetId()); - - ++count; + ++failCount; + dispelFailed.FailedSpells.Add(dispelableAura.GetAura().GetId()); } + ++count; } if (!dispelFailed.FailedSpells.Empty()) m_caster.SendMessageToSet(dispelFailed, true); - if (success_list.Empty()) + if (successList.Empty()) return; SpellDispellLog spellDispellLog = new SpellDispellLog(); @@ -1970,15 +1968,15 @@ namespace Game.Spells spellDispellLog.CasterGUID = m_caster.GetGUID(); spellDispellLog.DispelledBySpellID = m_spellInfo.Id; - foreach (var dispellCharge in success_list) + foreach (var dispelableAura in successList) { var dispellData = new SpellDispellData(); - dispellData.SpellID = dispellCharge.aura.GetId(); + dispellData.SpellID = dispelableAura.GetAura().GetId(); dispellData.Harmful = false; // TODO: use me //dispellData.Rolled = none; // TODO: use me //dispellData.Needed = none; // TODO: use me - unitTarget.RemoveAurasDueToSpellByDispel(dispellCharge.aura.GetId(), m_spellInfo.Id, dispellCharge.aura.GetCasterGUID(), m_caster, dispellCharge.value); + unitTarget.RemoveAurasDueToSpellByDispel(dispelableAura.GetAura().GetId(), m_spellInfo.Id, dispelableAura.GetAura().GetCasterGUID(), m_caster, dispelableAura.GetDispelCharges()); spellDispellLog.DispellData.Add(dispellData); } @@ -5056,7 +5054,7 @@ namespace Game.Spells float radius = 5.0f; int duration = m_spellInfo.CalcDuration(m_originalCaster); - TempSummonType summonType = (duration == 0) ? TempSummonType.DeadDespawn : TempSummonType.TimedDespawn; + //TempSummonType summonType = (duration == 0) ? TempSummonType.DeadDespawn : TempSummonType.TimedDespawn; Map map = caster.GetMap(); for (uint count = 0; count < numGuardians; ++count) @@ -5389,9 +5387,6 @@ namespace Game.Spells if (!m_targets.HasDst()) return; - // trigger entry/miscvalue relation is currently unknown, for now use MiscValue as trigger entry - uint triggerEntry = (uint)effectInfo.MiscValue; - int duration = GetSpellInfo().CalcDuration(GetCaster()); AreaTrigger.CreateAreaTrigger((uint)effectInfo.MiscValue, GetCaster(), null, GetSpellInfo(), destTarget.GetPosition(), duration, m_SpellVisual, m_castId); } @@ -5752,15 +5747,46 @@ namespace Game.Spells } } - public class DispelCharges + public class DispelableAura { - public DispelCharges(Aura _aura, byte _value) + public DispelableAura(Aura aura, int dispelChance, byte dispelCharges) { - aura = _aura; - value = _value; + _aura = aura; + _chance = dispelChance; + _charges = dispelCharges; } - public Aura aura; - public byte value; + public bool RollDispel() + { + return RandomHelper.randChance(_chance); + } + + public Aura GetAura() + { + return _aura; + } + + public byte GetDispelCharges() + { + return _charges; + } + + public void IncrementCharges() + { + ++_charges; + } + + public bool DecrementCharge() + { + if (_charges == 0) + return false; + + --_charges; + return _charges > 0; + } + + Aura _aura; + int _chance; + byte _charges; } } diff --git a/Source/Game/SupportSystem/SupportTickets.cs b/Source/Game/SupportSystem/SupportTickets.cs index b02f1bb32..c360140d8 100644 --- a/Source/Game/SupportSystem/SupportTickets.cs +++ b/Source/Game/SupportSystem/SupportTickets.cs @@ -117,7 +117,7 @@ namespace Game.SupportSystem string _note; - public BugTicket() : base() + public BugTicket() { _note = ""; } @@ -217,7 +217,7 @@ namespace Game.SupportSystem SupportTicketSubmitComplaint.SupportTicketChatLog _chatLog; string _note; - public ComplaintTicket() : base() + public ComplaintTicket() { _note = ""; } @@ -359,7 +359,7 @@ namespace Game.SupportSystem float _facing; string _note; - public SuggestionTicket() : base() + public SuggestionTicket() { _note = ""; } diff --git a/Source/Game/Warden/Warden.cs b/Source/Game/Warden/Warden.cs index ccce49fde..bf7bea085 100644 --- a/Source/Game/Warden/Warden.cs +++ b/Source/Game/Warden/Warden.cs @@ -119,10 +119,9 @@ namespace Game } } - public byte[] DecryptData(byte[] buffer) + public void DecryptData(byte[] buffer) { _inputCrypto.ProcessBuffer(buffer, buffer.Length); - return buffer; } public ByteBuffer EncryptData(byte[] buffer) diff --git a/Source/Scripts/Kalimdor/ZoneAshenvale.cs b/Source/Scripts/Kalimdor/ZoneAshenvale.cs index 11d4eaab7..a047893b7 100644 --- a/Source/Scripts/Kalimdor/ZoneAshenvale.cs +++ b/Source/Scripts/Kalimdor/ZoneAshenvale.cs @@ -167,11 +167,6 @@ namespace Scripts.Kalimdor.ZoneAshenvale break; } } - - public override void UpdateAI(uint diff) - { - base.UpdateAI(diff); - } } [Script] diff --git a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs index c9badaa2e..b6c033d3d 100644 --- a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs +++ b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs @@ -823,7 +823,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Nadronox [Script("spell_hadronox_periodic_summon_necromancer", SpellIds.SummonNecromancerTop, SpellIds.SummonNecromancerBottom)] class spell_hadronox_periodic_summon_template : AuraScript { - public spell_hadronox_periodic_summon_template(uint topSpellId, uint bottomSpellId) : base() + public spell_hadronox_periodic_summon_template(uint topSpellId, uint bottomSpellId) { _topSpellId = topSpellId; _bottomSpellId = bottomSpellId; diff --git a/Source/Scripts/Spells/Holiday.cs b/Source/Scripts/Spells/Holiday.cs index 9abe6118a..dfddced02 100644 --- a/Source/Scripts/Spells/Holiday.cs +++ b/Source/Scripts/Spells/Holiday.cs @@ -368,7 +368,7 @@ namespace Scripts.Spells.Holiday [Script("spell_gen_candied_sweet_potato", SpellIds.WellFedHasteTrigger)] class spell_pilgrims_bounty_buff_food : AuraScript { - public spell_pilgrims_bounty_buff_food(uint triggeredSpellId) : base() + public spell_pilgrims_bounty_buff_food(uint triggeredSpellId) { _triggeredSpellId = triggeredSpellId; _handled = false; diff --git a/Source/Scripts/Spells/Mage.cs b/Source/Scripts/Spells/Mage.cs index bb22b3bee..9bbd959f1 100644 --- a/Source/Scripts/Spells/Mage.cs +++ b/Source/Scripts/Spells/Mage.cs @@ -522,7 +522,7 @@ namespace Scripts.Spells.Mage if (!unit) return true; - return unit.HasAura(SpellIds.RingOfFrostDummy) || unit.HasAura(SpellIds.RingOfFrostFreeze) || unit.GetExactDist(GetExplTargetDest()) > outRadius || unit.GetExactDist(GetExplTargetDest()) < inRadius; + return unit.HasAura(SpellIds.RingOfFrostDummy) || unit.HasAura(SpellIds.RingOfFrostFreeze) || unit.GetExactDist(dest) > outRadius || unit.GetExactDist(dest) < inRadius; }); } diff --git a/Source/Scripts/Spells/Shaman.cs b/Source/Scripts/Spells/Shaman.cs index 0649604fd..4d51fcb8c 100644 --- a/Source/Scripts/Spells/Shaman.cs +++ b/Source/Scripts/Spells/Shaman.cs @@ -182,7 +182,7 @@ namespace Scripts.Spells.Shaman AfterCast.Add(new CastHandler(TriggerCleaveBuff)); } - int _targetsHit = 0; + int _targetsHit; } [Script] // 204288 - Earth Shield diff --git a/Source/Scripts/Spells/Warlock.cs b/Source/Scripts/Spells/Warlock.cs index 21c85d58b..867781d23 100644 --- a/Source/Scripts/Spells/Warlock.cs +++ b/Source/Scripts/Spells/Warlock.cs @@ -831,7 +831,7 @@ namespace Scripts.Spells.Warlock List _dotList = new List(); - Unit _swapCaster = null; + Unit _swapCaster; } [Script] //! Soul Swap Copy Spells - 92795 - Simply copies spell IDs. diff --git a/Source/Scripts/Spells/Warrior.cs b/Source/Scripts/Spells/Warrior.cs index 215a81c44..7408179c8 100644 --- a/Source/Scripts/Spells/Warrior.cs +++ b/Source/Scripts/Spells/Warrior.cs @@ -697,7 +697,7 @@ namespace Scripts.Spells.Warrior AfterCast.Add(new CastHandler(HandleAfterCast)); } - uint _targetCount = 0; + uint _targetCount; } [Script] // 107570 - Storm Bolt diff --git a/Source/Scripts/World/GameObjects.cs b/Source/Scripts/World/GameObjects.cs index 3219cffaf..22fd2d0ca 100644 --- a/Source/Scripts/World/GameObjects.cs +++ b/Source/Scripts/World/GameObjects.cs @@ -1081,7 +1081,7 @@ namespace Scripts.World }); } - uint rnd = 0; + uint rnd; uint musicTime = 1000; }