diff --git a/Source/Framework/Constants/Update/UpdateType.cs b/Source/Framework/Constants/Update/UpdateType.cs index 0c3827a53..d82dbd0f5 100644 --- a/Source/Framework/Constants/Update/UpdateType.cs +++ b/Source/Framework/Constants/Update/UpdateType.cs @@ -13,7 +13,8 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - */ + */ +using System; namespace Framework.Constants { @@ -25,6 +26,7 @@ namespace Framework.Constants OutOfRangeObjects = 3, } + [Flags] public enum UpdateFieldFlag { None = 0, diff --git a/Source/Game/Chat/Commands/NPCCommands.cs b/Source/Game/Chat/Commands/NPCCommands.cs index 561d19937..5d0a0f45d 100644 --- a/Source/Game/Chat/Commands/NPCCommands.cs +++ b/Source/Game/Chat/Commands/NPCCommands.cs @@ -1245,7 +1245,6 @@ namespace Game.Chat if (string.IsNullOrEmpty(guid_str)) return false; - ulong lowguid; Creature creature = null; if (!string.IsNullOrEmpty(dontdel_str)) @@ -1279,11 +1278,10 @@ namespace Game.Chat creature = handler.GetSelectedCreature(); if (!creature || creature.IsPet()) return false; - lowguid = creature.GetSpawnId(); } else // case .setmovetype #creature_guid $move_type (with selected creature) { - if (!ulong.TryParse(guid_str, out lowguid) || lowguid != 0) + if (!ulong.TryParse(guid_str, out ulong lowguid) || lowguid != 0) creature = handler.GetCreatureFromPlayerMapByDbGuid(lowguid); // attempt check creature existence by DB data @@ -1296,10 +1294,6 @@ namespace Game.Chat return false; } } - else - { - lowguid = creature.GetSpawnId(); - } } // now lowguid is low guid really existed creature @@ -1331,7 +1325,7 @@ namespace Game.Chat } creature.SaveToDB(); } - if (doNotDelete == false) + if (!doNotDelete) { handler.SendSysMessage(CypherStrings.MoveTypeSet, type); } diff --git a/Source/Game/Conditions/ConditionManager.cs b/Source/Game/Conditions/ConditionManager.cs index 209362433..8b92413b5 100644 --- a/Source/Game/Conditions/ConditionManager.cs +++ b/Source/Game/Conditions/ConditionManager.cs @@ -463,7 +463,6 @@ namespace Game SpellClickEventConditionStore[cond.SourceGroup] = new MultiMap(); SpellClickEventConditionStore[cond.SourceGroup].Add((uint)cond.SourceEntry, cond); - valid = true; ++count; continue; // do not add to m_AllocatedMemory to avoid double deleting } @@ -476,7 +475,6 @@ namespace Game VehicleSpellConditionStore[cond.SourceGroup] = new MultiMap(); VehicleSpellConditionStore[cond.SourceGroup].Add((uint)cond.SourceEntry, cond); - valid = true; ++count; continue; // do not add to m_AllocatedMemory to avoid double deleting } @@ -488,7 +486,6 @@ namespace Game SmartEventConditionStore[key] = new MultiMap(); SmartEventConditionStore[key].Add(cond.SourceGroup, cond); - valid = true; ++count; continue; } @@ -498,7 +495,6 @@ namespace Game NpcVendorConditionContainerStore[cond.SourceGroup] = new MultiMap(); NpcVendorConditionContainerStore[cond.SourceGroup].Add((uint)cond.SourceEntry, cond); - valid = true; ++count; continue; } diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 8dfa80fc4..8b51b19e8 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -137,7 +137,6 @@ namespace Game.Entities UpdateType updateType = UpdateType.CreateObject; TypeId tempObjectType = ObjectTypeId; - TypeMask tempObjectTypeMask = ObjectTypeMask; CreateObjectBits flags = m_updateFlag; if (target == this) @@ -145,7 +144,6 @@ namespace Game.Entities flags.ThisIsYou = true; flags.ActivePlayer = true; tempObjectType = TypeId.ActivePlayer; - tempObjectTypeMask |= TypeMask.ActivePlayer; } switch (GetGUID().GetHigh()) diff --git a/Source/Game/Entities/StatSystem.cs b/Source/Game/Entities/StatSystem.cs index 0bb5c259d..abf8ee968 100644 --- a/Source/Game/Entities/StatSystem.cs +++ b/Source/Game/Entities/StatSystem.cs @@ -1257,7 +1257,7 @@ namespace Game.Entities public override void UpdateAttackPowerAndDamage(bool ranged = false) { - float val2 = 0.0f; + float val2; float level = GetLevel(); var entry = CliDB.ChrClassesStorage.LookupByKey(GetClass()); @@ -2114,7 +2114,7 @@ namespace Game.Entities public override void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, out float minDamage, out float maxDamage) { - float variance = 1.0f; + float variance; UnitMods unitMod; switch (attType) { diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 71c0bc6cf..0918f9b86 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -3021,8 +3021,8 @@ namespace Game.Maps // also not allow unloading spawn grid to prevent creating creature clone at load if (!c.IsPet() && c.GetSpawnId() != 0) { - float x, y, z; - c.GetRespawnPosition(out x, out y, out z); + float x, y; + c.GetRespawnPosition(out x, out y, out _); GridCoord p = GridDefines.ComputeGridCoord(x, y); if (GetGrid(p.X_coord, p.Y_coord) != null) GetGrid(p.X_coord, p.Y_coord).IncUnloadActiveLock(); @@ -3052,8 +3052,8 @@ namespace Game.Maps // also allow unloading spawn grid if (!c.IsPet() && c.GetSpawnId() != 0) { - float x, y, z; - c.GetRespawnPosition(out x, out y, out z); + float x, y; + c.GetRespawnPosition(out x, out y, out _); GridCoord p = GridDefines.ComputeGridCoord(x, y); if (GetGrid(p.X_coord, p.Y_coord) != null) GetGrid(p.X_coord, p.Y_coord).DecUnloadActiveLock(); diff --git a/Source/Game/Server/WorldManager.cs b/Source/Game/Server/WorldManager.cs index 742a3d6b5..b618cb1ae 100644 --- a/Source/Game/Server/WorldManager.cs +++ b/Source/Game/Server/WorldManager.cs @@ -2318,6 +2318,8 @@ namespace Game public bool IsShuttingDown() { return m_ShutdownTimer > 0; } public uint GetShutDownTimeLeft() { return m_ShutdownTimer; } + public int GetExitCode() { return (int)m_ExitCode; } + public void StopNow(ShutdownExitCode exitcode = ShutdownExitCode.Error) { IsStopped = true; m_ExitCode = exitcode; } public bool IsPvPRealm() diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index d51b41492..7a33141bd 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -1699,7 +1699,6 @@ namespace Game.Spells DamageInfo damageInfo = eventInfo.GetDamageInfo(); if (damageInfo != null) { - WeaponAttackType attType = damageInfo.GetAttackType(); if (damageInfo.GetAttackType() != WeaponAttackType.OffAttack) item = target.ToPlayer().GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand); else diff --git a/Source/WorldServer/Server.cs b/Source/WorldServer/Server.cs index 50cc81a67..6e3497728 100644 --- a/Source/WorldServer/Server.cs +++ b/Source/WorldServer/Server.cs @@ -210,7 +210,7 @@ namespace WorldServer { Log.outInfo(LogFilter.Server, "Halting process..."); Thread.Sleep(5000); - Environment.Exit(-1); + Environment.Exit(Global.WorldMgr.GetExitCode()); } } } \ No newline at end of file