More Cleanups
This commit is contained in:
@@ -140,7 +140,7 @@ namespace Game.Entities
|
||||
if (GetMiscTemplate().ExtraScale.Raw.Data[5] != 0)
|
||||
SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.ParameterCurve), GetMiscTemplate().ExtraScale.Raw.Data[5]);
|
||||
if (GetMiscTemplate().ExtraScale.Structured.OverrideActive != 0)
|
||||
SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.OverrideActive), GetMiscTemplate().ExtraScale.Structured.OverrideActive != 0 ? true : false);
|
||||
SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.OverrideActive), GetMiscTemplate().ExtraScale.Structured.OverrideActive != 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -921,7 +921,7 @@ namespace Game.Entities
|
||||
|
||||
public Unit SelectVictim()
|
||||
{
|
||||
Unit target = null;
|
||||
Unit target;
|
||||
|
||||
ThreatManager mgr = GetThreatManager();
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Game.Misc
|
||||
continue;
|
||||
|
||||
// Store texts for localization.
|
||||
string strOptionText = "", strBoxText = "";
|
||||
string strOptionText, strBoxText;
|
||||
BroadcastTextRecord optionBroadcastText = CliDB.BroadcastTextStorage.LookupByKey(item.OptionBroadcastTextId);
|
||||
BroadcastTextRecord boxBroadcastText = CliDB.BroadcastTextStorage.LookupByKey(item.BoxBroadcastTextId);
|
||||
|
||||
|
||||
@@ -635,7 +635,7 @@ namespace Game.Entities
|
||||
else
|
||||
radius = goInfo.Trap.radius / 2.0f;
|
||||
|
||||
Unit target = null;
|
||||
Unit target;
|
||||
// @todo this hack with search required until GO casting not implemented
|
||||
Unit owner = GetOwner();
|
||||
if (owner)
|
||||
@@ -1169,7 +1169,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
long thisRespawnTime = forceDelay != 0 ? GameTime.GetGameTime() + forceDelay : m_respawnTime;
|
||||
GetMap().SaveRespawnTime(SpawnObjectType.GameObject, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), GridDefines.ComputeGridCoord(GetPositionX(), GetPositionY()).GetId(), m_goData.dbData ? savetodb : false);
|
||||
GetMap().SaveRespawnTime(SpawnObjectType.GameObject, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), GridDefines.ComputeGridCoord(GetPositionX(), GetPositionY()).GetId(), m_goData.dbData && savetodb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Game.Entities
|
||||
{
|
||||
posX = (float)(posX + (offset.posX * Math.Cos(Orientation) + offset.posY * Math.Sin(Orientation + MathFunctions.PI)));
|
||||
posY = (float)(posY + (offset.posY * Math.Cos(Orientation) + offset.posX * Math.Sin(Orientation)));
|
||||
posZ = posZ + offset.posZ;
|
||||
posZ += offset.posZ;
|
||||
SetOrientation(Orientation + offset.Orientation);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace Game.Entities
|
||||
if (o < 0)
|
||||
{
|
||||
float mod = o * -1;
|
||||
mod = mod % (2.0f * MathFunctions.PI);
|
||||
mod %= (2.0f * MathFunctions.PI);
|
||||
mod = -mod + 2.0f * MathFunctions.PI;
|
||||
return mod;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,8 @@ namespace Game.Entities
|
||||
public class UpdateFieldHolder
|
||||
{
|
||||
UpdateMask _changesMask = new((int)TypeId.Max);
|
||||
WorldObject _owner;
|
||||
|
||||
public UpdateFieldHolder(WorldObject owner) { _owner = owner; }
|
||||
public UpdateFieldHolder(WorldObject owner) { }
|
||||
|
||||
public BaseUpdateData<T> ModifyValue<T>(BaseUpdateData<T> updateData)
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Game.Entities
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.outError(LogFilter.Player, $"Player._LoadInventory: Player '{GetName()}' ({GetGUID().ToString()}) has child item ({item.GetGUID()}, entry: {item.GetEntry()}) which can't be loaded into inventory because parent item was not found (Bag {bagGuid}, slot: {slot}). Item will be sent by mail.");
|
||||
Log.outError(LogFilter.Player, $"Player._LoadInventory: Player '{GetName()}' ({GetGUID()}) has child item ({item.GetGUID()}, entry: {item.GetEntry()}) which can't be loaded into inventory because parent item was not found (Bag {bagGuid}, slot: {slot}). Item will be sent by mail.");
|
||||
item.DeleteFromInventoryDB(trans);
|
||||
problematicItems.Enqueue(item);
|
||||
continue;
|
||||
@@ -1891,7 +1891,7 @@ namespace Game.Entities
|
||||
|
||||
void _SaveActions(SQLTransaction trans)
|
||||
{
|
||||
PreparedStatement stmt = null;
|
||||
PreparedStatement stmt;
|
||||
|
||||
foreach (var pair in m_actionButtons.ToList())
|
||||
{
|
||||
|
||||
@@ -495,8 +495,7 @@ namespace Game.Entities
|
||||
}
|
||||
InventoryResult CanStoreItem(byte bag, byte slot, List<ItemPosCount> dest, uint entry, uint count, Item pItem, bool swap)
|
||||
{
|
||||
uint throwaway;
|
||||
return CanStoreItem(bag, slot, dest, entry, count, pItem, swap, out throwaway);
|
||||
return CanStoreItem(bag, slot, dest, entry, count, pItem, swap, out _);
|
||||
}
|
||||
InventoryResult CanStoreItem(byte bag, byte slot, List<ItemPosCount> dest, uint entry, uint count, Item pItem, bool swap, out uint no_space_count)
|
||||
{
|
||||
|
||||
@@ -1413,13 +1413,13 @@ namespace Game.Entities
|
||||
switch (Condition.Operator[i])
|
||||
{
|
||||
case 2: // requires less <color> than (<value> || <comparecolor>) gems
|
||||
activate &= (_cur_gem < _cmp_gem) ? true : false;
|
||||
activate &= (_cur_gem < _cmp_gem);
|
||||
break;
|
||||
case 3: // requires more <color> than (<value> || <comparecolor>) gems
|
||||
activate &= (_cur_gem > _cmp_gem) ? true : false;
|
||||
activate &= (_cur_gem > _cmp_gem);
|
||||
break;
|
||||
case 5: // requires at least <color> than (<value> || <comparecolor>) gems
|
||||
activate &= (_cur_gem >= _cmp_gem) ? true : false;
|
||||
activate &= (_cur_gem >= _cmp_gem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2039,7 +2039,7 @@ namespace Game.Entities
|
||||
{
|
||||
PlayerSpell spell = m_spells.LookupByKey(spellId);
|
||||
|
||||
bool disabled = (spell != null) ? spell.Disabled : false;
|
||||
bool disabled = (spell != null) && spell.Disabled;
|
||||
bool active = !disabled || spell.Active;
|
||||
|
||||
bool learning = AddSpell(spellId, active, true, dependent, false, false, fromSkill);
|
||||
@@ -2989,7 +2989,7 @@ namespace Game.Entities
|
||||
public void SetRuneCooldown(byte index, uint cooldown)
|
||||
{
|
||||
m_runes.Cooldown[index] = cooldown;
|
||||
m_runes.SetRuneState(index, (cooldown == 0) ? true : false);
|
||||
m_runes.SetRuneState(index, (cooldown == 0));
|
||||
int activeRunes = m_runes.Cooldown.Count(p => p == 0);
|
||||
if (activeRunes != GetPower(PowerType.Runes))
|
||||
SetPower(PowerType.Runes, activeRunes);
|
||||
|
||||
@@ -155,9 +155,8 @@ namespace Game.Entities
|
||||
|
||||
for (int i = 1; i < m_TaxiDestinations.Count; ++i)
|
||||
{
|
||||
uint cost;
|
||||
uint path;
|
||||
Global.ObjectMgr.GetTaxiPath(m_TaxiDestinations[i - 1], m_TaxiDestinations[i], out path, out cost);
|
||||
Global.ObjectMgr.GetTaxiPath(m_TaxiDestinations[i - 1], m_TaxiDestinations[i], out path, out _);
|
||||
if (path == 0)
|
||||
return false;
|
||||
}
|
||||
@@ -189,9 +188,8 @@ namespace Game.Entities
|
||||
return 0;
|
||||
|
||||
uint path;
|
||||
uint cost;
|
||||
|
||||
Global.ObjectMgr.GetTaxiPath(m_TaxiDestinations[0], m_TaxiDestinations[1], out path, out cost);
|
||||
Global.ObjectMgr.GetTaxiPath(m_TaxiDestinations[0], m_TaxiDestinations[1], out path, out _);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -137,8 +137,7 @@ namespace Game.Entities
|
||||
*/
|
||||
|
||||
// Find if we have a direct path
|
||||
uint pathId, goldCost;
|
||||
Global.ObjectMgr.GetTaxiPath(from.Id, to.Id, out pathId, out goldCost);
|
||||
Global.ObjectMgr.GetTaxiPath(from.Id, to.Id, out uint pathId, out _);
|
||||
if (pathId != 0)
|
||||
{
|
||||
shortestPath.Add(from.Id);
|
||||
|
||||
@@ -833,7 +833,7 @@ namespace Game.Entities
|
||||
if (ranged)
|
||||
return;
|
||||
|
||||
float val = 0.0f;
|
||||
float val;
|
||||
float bonusAP = 0.0f;
|
||||
UnitMods unitMod = UnitMods.AttackPower;
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace Game.Entities
|
||||
if (_pendingStop && GetGoState() != GameObjectState.Ready)
|
||||
{
|
||||
SetGoState(GameObjectState.Ready);
|
||||
m_goValue.Transport.PathProgress = (m_goValue.Transport.PathProgress / GetTransportPeriod());
|
||||
m_goValue.Transport.PathProgress /= GetTransportPeriod();
|
||||
m_goValue.Transport.PathProgress *= GetTransportPeriod();
|
||||
m_goValue.Transport.PathProgress += _currentFrame.ArriveTime;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Game.Entities
|
||||
{
|
||||
_charmspells[x].SetActionAndType(spellId, ActiveStates.Disabled);
|
||||
|
||||
ActiveStates newstate = ActiveStates.Passive;
|
||||
ActiveStates newstate;
|
||||
|
||||
if (!spellInfo.IsAutocastable())
|
||||
newstate = ActiveStates.Passive;
|
||||
|
||||
@@ -1337,7 +1337,7 @@ namespace Game.Entities
|
||||
// 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8.
|
||||
// MISS > DODGE > PARRY > GLANCING > BLOCK > CRIT > CRUSHING > HIT
|
||||
|
||||
int sum = 0, tmp = 0;
|
||||
int sum = 0;
|
||||
int roll = RandomHelper.IRand(0, 9999);
|
||||
|
||||
uint attackerLevel = GetLevelForTarget(victim);
|
||||
@@ -1357,7 +1357,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// 1. MISS
|
||||
tmp = miss_chance;
|
||||
int tmp = miss_chance;
|
||||
if (tmp > 0 && roll < (sum += tmp))
|
||||
return MeleeHitOutcome.Miss;
|
||||
|
||||
@@ -1477,9 +1477,9 @@ namespace Game.Entities
|
||||
|
||||
if (minDamage > maxDamage)
|
||||
{
|
||||
minDamage = minDamage + maxDamage;
|
||||
minDamage += maxDamage;
|
||||
maxDamage = minDamage - maxDamage;
|
||||
minDamage = minDamage - maxDamage;
|
||||
minDamage -= maxDamage;
|
||||
}
|
||||
|
||||
if (maxDamage == 0.0f)
|
||||
|
||||
@@ -84,7 +84,6 @@ namespace Game.Entities
|
||||
|
||||
//Spells
|
||||
protected Dictionary<CurrentSpellTypes, Spell> m_currentSpells = new((int)CurrentSpellTypes.Max);
|
||||
Dictionary<SpellValueMod, int> CustomSpellValueMod = new();
|
||||
MultiMap<uint, uint>[] m_spellImmune = new MultiMap<uint, uint>[(int)SpellImmunity.Max];
|
||||
SpellAuraInterruptFlags m_interruptMask;
|
||||
SpellAuraInterruptFlags2 m_interruptMask2;
|
||||
@@ -93,7 +92,6 @@ namespace Game.Entities
|
||||
SpellHistory _spellHistory;
|
||||
|
||||
//Auras
|
||||
List<AuraEffect> AuraEffectList = new();
|
||||
MultiMap<AuraType, AuraEffect> m_modAuras = new();
|
||||
List<Aura> m_removedAuras = new();
|
||||
List<AuraApplication> m_interruptableAuras = new(); // auras which have interrupt mask applied on unit
|
||||
|
||||
@@ -687,8 +687,8 @@ namespace Game.Entities
|
||||
uint areaId = GetAreaId();
|
||||
uint ridingSkill = 5000;
|
||||
AreaMountFlags mountFlags = 0;
|
||||
bool isSubmerged = false;
|
||||
bool isInWater = false;
|
||||
bool isSubmerged;
|
||||
bool isInWater;
|
||||
|
||||
if (IsTypeId(TypeId.Player))
|
||||
ridingSkill = ToPlayer().GetSkillValue(SkillType.Riding);
|
||||
@@ -705,8 +705,7 @@ namespace Game.Entities
|
||||
mountFlags = (AreaMountFlags)areaTable.MountFlags;
|
||||
}
|
||||
|
||||
LiquidData liquid;
|
||||
ZLiquidStatus liquidStatus = GetMap().GetLiquidStatus(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ(), LiquidHeaderTypeFlags.AllLiquids, out liquid);
|
||||
ZLiquidStatus liquidStatus = GetMap().GetLiquidStatus(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ(), LiquidHeaderTypeFlags.AllLiquids, out _);
|
||||
isSubmerged = liquidStatus.HasAnyFlag(ZLiquidStatus.UnderWater) || HasUnitMovementFlag(MovementFlag.Swimming);
|
||||
isInWater = liquidStatus.HasAnyFlag(ZLiquidStatus.InWater | ZLiquidStatus.UnderWater);
|
||||
|
||||
|
||||
@@ -1371,7 +1371,7 @@ namespace Game.Entities
|
||||
|
||||
public bool IsVisible()
|
||||
{
|
||||
return (m_serverSideVisibility.GetValue(ServerSideVisibilityType.GM) > (uint)AccountTypes.Player) ? false : true;
|
||||
return m_serverSideVisibility.GetValue(ServerSideVisibilityType.GM) <= (uint)AccountTypes.Player;
|
||||
}
|
||||
|
||||
public void SetVisible(bool val)
|
||||
|
||||
@@ -527,7 +527,6 @@ namespace Game.Entities
|
||||
|
||||
Unit _me;
|
||||
VehicleRecord _vehicleInfo; //< DBC data for vehicle
|
||||
List<ulong> vehiclePlayers = new();
|
||||
|
||||
uint _creatureEntry; //< Can be different than the entry of _me in case of players
|
||||
Status _status; //< Internal variable for sanity checks
|
||||
|
||||
Reference in New Issue
Block a user