Some cleanups

This commit is contained in:
hondacrx
2021-07-08 13:01:46 -04:00
parent 970ac30730
commit 50fcbd3aaf
9 changed files with 14 additions and 23 deletions
@@ -13,7 +13,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using System;
namespace Framework.Constants namespace Framework.Constants
{ {
@@ -25,6 +26,7 @@ namespace Framework.Constants
OutOfRangeObjects = 3, OutOfRangeObjects = 3,
} }
[Flags]
public enum UpdateFieldFlag public enum UpdateFieldFlag
{ {
None = 0, None = 0,
+2 -8
View File
@@ -1245,7 +1245,6 @@ namespace Game.Chat
if (string.IsNullOrEmpty(guid_str)) if (string.IsNullOrEmpty(guid_str))
return false; return false;
ulong lowguid;
Creature creature = null; Creature creature = null;
if (!string.IsNullOrEmpty(dontdel_str)) if (!string.IsNullOrEmpty(dontdel_str))
@@ -1279,11 +1278,10 @@ namespace Game.Chat
creature = handler.GetSelectedCreature(); creature = handler.GetSelectedCreature();
if (!creature || creature.IsPet()) if (!creature || creature.IsPet())
return false; return false;
lowguid = creature.GetSpawnId();
} }
else // case .setmovetype #creature_guid $move_type (with selected creature) 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); creature = handler.GetCreatureFromPlayerMapByDbGuid(lowguid);
// attempt check creature existence by DB data // attempt check creature existence by DB data
@@ -1296,10 +1294,6 @@ namespace Game.Chat
return false; return false;
} }
} }
else
{
lowguid = creature.GetSpawnId();
}
} }
// now lowguid is low guid really existed creature // now lowguid is low guid really existed creature
@@ -1331,7 +1325,7 @@ namespace Game.Chat
} }
creature.SaveToDB(); creature.SaveToDB();
} }
if (doNotDelete == false) if (!doNotDelete)
{ {
handler.SendSysMessage(CypherStrings.MoveTypeSet, type); handler.SendSysMessage(CypherStrings.MoveTypeSet, type);
} }
@@ -463,7 +463,6 @@ namespace Game
SpellClickEventConditionStore[cond.SourceGroup] = new MultiMap<uint, Condition>(); SpellClickEventConditionStore[cond.SourceGroup] = new MultiMap<uint, Condition>();
SpellClickEventConditionStore[cond.SourceGroup].Add((uint)cond.SourceEntry, cond); SpellClickEventConditionStore[cond.SourceGroup].Add((uint)cond.SourceEntry, cond);
valid = true;
++count; ++count;
continue; // do not add to m_AllocatedMemory to avoid double deleting continue; // do not add to m_AllocatedMemory to avoid double deleting
} }
@@ -476,7 +475,6 @@ namespace Game
VehicleSpellConditionStore[cond.SourceGroup] = new MultiMap<uint, Condition>(); VehicleSpellConditionStore[cond.SourceGroup] = new MultiMap<uint, Condition>();
VehicleSpellConditionStore[cond.SourceGroup].Add((uint)cond.SourceEntry, cond); VehicleSpellConditionStore[cond.SourceGroup].Add((uint)cond.SourceEntry, cond);
valid = true;
++count; ++count;
continue; // do not add to m_AllocatedMemory to avoid double deleting continue; // do not add to m_AllocatedMemory to avoid double deleting
} }
@@ -488,7 +486,6 @@ namespace Game
SmartEventConditionStore[key] = new MultiMap<uint, Condition>(); SmartEventConditionStore[key] = new MultiMap<uint, Condition>();
SmartEventConditionStore[key].Add(cond.SourceGroup, cond); SmartEventConditionStore[key].Add(cond.SourceGroup, cond);
valid = true;
++count; ++count;
continue; continue;
} }
@@ -498,7 +495,6 @@ namespace Game
NpcVendorConditionContainerStore[cond.SourceGroup] = new MultiMap<uint, Condition>(); NpcVendorConditionContainerStore[cond.SourceGroup] = new MultiMap<uint, Condition>();
NpcVendorConditionContainerStore[cond.SourceGroup].Add((uint)cond.SourceEntry, cond); NpcVendorConditionContainerStore[cond.SourceGroup].Add((uint)cond.SourceEntry, cond);
valid = true;
++count; ++count;
continue; continue;
} }
@@ -137,7 +137,6 @@ namespace Game.Entities
UpdateType updateType = UpdateType.CreateObject; UpdateType updateType = UpdateType.CreateObject;
TypeId tempObjectType = ObjectTypeId; TypeId tempObjectType = ObjectTypeId;
TypeMask tempObjectTypeMask = ObjectTypeMask;
CreateObjectBits flags = m_updateFlag; CreateObjectBits flags = m_updateFlag;
if (target == this) if (target == this)
@@ -145,7 +144,6 @@ namespace Game.Entities
flags.ThisIsYou = true; flags.ThisIsYou = true;
flags.ActivePlayer = true; flags.ActivePlayer = true;
tempObjectType = TypeId.ActivePlayer; tempObjectType = TypeId.ActivePlayer;
tempObjectTypeMask |= TypeMask.ActivePlayer;
} }
switch (GetGUID().GetHigh()) switch (GetGUID().GetHigh())
+2 -2
View File
@@ -1257,7 +1257,7 @@ namespace Game.Entities
public override void UpdateAttackPowerAndDamage(bool ranged = false) public override void UpdateAttackPowerAndDamage(bool ranged = false)
{ {
float val2 = 0.0f; float val2;
float level = GetLevel(); float level = GetLevel();
var entry = CliDB.ChrClassesStorage.LookupByKey(GetClass()); 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) public override void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, out float minDamage, out float maxDamage)
{ {
float variance = 1.0f; float variance;
UnitMods unitMod; UnitMods unitMod;
switch (attType) switch (attType)
{ {
+4 -4
View File
@@ -3021,8 +3021,8 @@ namespace Game.Maps
// also not allow unloading spawn grid to prevent creating creature clone at load // also not allow unloading spawn grid to prevent creating creature clone at load
if (!c.IsPet() && c.GetSpawnId() != 0) if (!c.IsPet() && c.GetSpawnId() != 0)
{ {
float x, y, z; float x, y;
c.GetRespawnPosition(out x, out y, out z); c.GetRespawnPosition(out x, out y, out _);
GridCoord p = GridDefines.ComputeGridCoord(x, y); GridCoord p = GridDefines.ComputeGridCoord(x, y);
if (GetGrid(p.X_coord, p.Y_coord) != null) if (GetGrid(p.X_coord, p.Y_coord) != null)
GetGrid(p.X_coord, p.Y_coord).IncUnloadActiveLock(); GetGrid(p.X_coord, p.Y_coord).IncUnloadActiveLock();
@@ -3052,8 +3052,8 @@ namespace Game.Maps
// also allow unloading spawn grid // also allow unloading spawn grid
if (!c.IsPet() && c.GetSpawnId() != 0) if (!c.IsPet() && c.GetSpawnId() != 0)
{ {
float x, y, z; float x, y;
c.GetRespawnPosition(out x, out y, out z); c.GetRespawnPosition(out x, out y, out _);
GridCoord p = GridDefines.ComputeGridCoord(x, y); GridCoord p = GridDefines.ComputeGridCoord(x, y);
if (GetGrid(p.X_coord, p.Y_coord) != null) if (GetGrid(p.X_coord, p.Y_coord) != null)
GetGrid(p.X_coord, p.Y_coord).DecUnloadActiveLock(); GetGrid(p.X_coord, p.Y_coord).DecUnloadActiveLock();
+2
View File
@@ -2318,6 +2318,8 @@ namespace Game
public bool IsShuttingDown() { return m_ShutdownTimer > 0; } public bool IsShuttingDown() { return m_ShutdownTimer > 0; }
public uint GetShutDownTimeLeft() { return m_ShutdownTimer; } 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 void StopNow(ShutdownExitCode exitcode = ShutdownExitCode.Error) { IsStopped = true; m_ExitCode = exitcode; }
public bool IsPvPRealm() public bool IsPvPRealm()
-1
View File
@@ -1699,7 +1699,6 @@ namespace Game.Spells
DamageInfo damageInfo = eventInfo.GetDamageInfo(); DamageInfo damageInfo = eventInfo.GetDamageInfo();
if (damageInfo != null) if (damageInfo != null)
{ {
WeaponAttackType attType = damageInfo.GetAttackType();
if (damageInfo.GetAttackType() != WeaponAttackType.OffAttack) if (damageInfo.GetAttackType() != WeaponAttackType.OffAttack)
item = target.ToPlayer().GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand); item = target.ToPlayer().GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand);
else else
+1 -1
View File
@@ -210,7 +210,7 @@ namespace WorldServer
{ {
Log.outInfo(LogFilter.Server, "Halting process..."); Log.outInfo(LogFilter.Server, "Halting process...");
Thread.Sleep(5000); Thread.Sleep(5000);
Environment.Exit(-1); Environment.Exit(Global.WorldMgr.GetExitCode());
} }
} }
} }