Some cleanups. (might break build for scripts as they are a WIP)
This commit is contained in:
@@ -40,7 +40,7 @@ namespace Game.Entities
|
||||
if (_unit.IsTypeId(TypeId.Unit))
|
||||
{
|
||||
Creature creature = _unit.ToCreature();
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
creature.SetReactState(_oldReactState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace Game.Entities
|
||||
if (creature.IsInEvadeMode())
|
||||
return false;
|
||||
|
||||
if (!creature.CanMelee())
|
||||
if (creature.CanMelee())
|
||||
meleeAttack = false;
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ namespace Game.Entities
|
||||
{
|
||||
SendMessageToSet(new SAttackStop(this, victim), true);
|
||||
|
||||
if (victim)
|
||||
if (victim != null)
|
||||
Log.outInfo(LogFilter.Unit, "{0} {1} stopped attacking {2} {3}", (IsTypeId(TypeId.Player) ? "Player" : "Creature"), GetGUID().ToString(),
|
||||
(victim.IsTypeId(TypeId.Player) ? "player" : "creature"), victim.GetGUID().ToString());
|
||||
else
|
||||
@@ -448,13 +448,13 @@ namespace Game.Entities
|
||||
if (mgr.HasPvPCombat())
|
||||
return mgr.GetPvPCombatRefs().First().Value.GetOther(this);
|
||||
|
||||
if (owner && (owner.GetCombatManager().HasPvPCombat()))
|
||||
if (owner != null && (owner.GetCombatManager().HasPvPCombat()))
|
||||
return owner.GetCombatManager().GetPvPCombatRefs().First().Value.GetOther(owner);
|
||||
|
||||
if (mgr.HasPvECombat())
|
||||
return mgr.GetPvECombatRefs().First().Value.GetOther(this);
|
||||
|
||||
if (owner && (owner.GetCombatManager().HasPvECombat()))
|
||||
if (owner != null && (owner.GetCombatManager().HasPvECombat()))
|
||||
return owner.GetCombatManager().GetPvECombatRefs().First().Value.GetOther(owner);
|
||||
|
||||
return null;
|
||||
@@ -676,7 +676,7 @@ namespace Game.Entities
|
||||
|
||||
Player myPlayerOwner = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
Player targetPlayerOwner = target.GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (myPlayerOwner && targetPlayerOwner && !(myPlayerOwner.duel != null && myPlayerOwner.duel.Opponent == targetPlayerOwner))
|
||||
if (myPlayerOwner != null && targetPlayerOwner != null && !(myPlayerOwner.duel != null && myPlayerOwner.duel.Opponent == targetPlayerOwner))
|
||||
{
|
||||
myPlayerOwner.UpdatePvP(true);
|
||||
myPlayerOwner.SetContestedPvP(targetPlayerOwner);
|
||||
@@ -720,7 +720,7 @@ namespace Game.Entities
|
||||
isRewardAllowed = isRewardAllowed && !creature.GetTapList().Empty();
|
||||
|
||||
List<Player> tappers = new();
|
||||
if (isRewardAllowed && creature)
|
||||
if (isRewardAllowed && creature != null)
|
||||
{
|
||||
foreach (ObjectGuid tapperGuid in creature.GetTapList())
|
||||
{
|
||||
@@ -729,12 +729,12 @@ namespace Game.Entities
|
||||
tappers.Add(tapper);
|
||||
}
|
||||
|
||||
if (!creature.CanHaveLoot())
|
||||
if (creature.CanHaveLoot())
|
||||
isRewardAllowed = false;
|
||||
}
|
||||
|
||||
// Exploit fix
|
||||
if (creature && creature.IsPet() && creature.GetOwnerGUID().IsPlayer())
|
||||
if (creature != null && creature.IsPet() && creature.GetOwnerGUID().IsPlayer())
|
||||
isRewardAllowed = false;
|
||||
|
||||
// Reward player, his pets, and group/raid members
|
||||
@@ -750,13 +750,13 @@ namespace Game.Entities
|
||||
if (groups.Add(tapperGroup))
|
||||
{
|
||||
PartyKillLog partyKillLog = new();
|
||||
partyKillLog.Player = player && tapperGroup.IsMember(player.GetGUID()) ? player.GetGUID() : tapper.GetGUID();
|
||||
partyKillLog.Player = player != null && tapperGroup.IsMember(player.GetGUID()) ? player.GetGUID() : tapper.GetGUID();
|
||||
partyKillLog.Victim = victim.GetGUID();
|
||||
partyKillLog.Write();
|
||||
|
||||
tapperGroup.BroadcastPacket(partyKillLog, tapperGroup.GetMemberGroup(tapper.GetGUID()) != 0);
|
||||
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
tapperGroup.UpdateLooterGuid(creature, true);
|
||||
}
|
||||
}
|
||||
@@ -770,7 +770,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// Generate loot before updating looter
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
{
|
||||
DungeonEncounterRecord dungeonEncounter = null;
|
||||
InstanceScript instance = creature.GetInstanceScript();
|
||||
@@ -788,7 +788,7 @@ namespace Game.Entities
|
||||
else if (!tappers.Empty())
|
||||
{
|
||||
Group group = !groups.Empty() ? groups.First() : null;
|
||||
Player looter = group ? Global.ObjAccessor.GetPlayer(creature, group.GetLooterGuid()) : tappers[0];
|
||||
Player looter = group != null ? Global.ObjAccessor.GetPlayer(creature, group.GetLooterGuid()) : tappers[0];
|
||||
|
||||
Loot loot = new(creature.GetMap(), creature.GetGUID(), LootType.Corpse, dungeonEncounter != null ? group : null);
|
||||
|
||||
@@ -799,7 +799,7 @@ namespace Game.Entities
|
||||
if (creature.GetLootMode() > 0)
|
||||
loot.GenerateMoneyLoot(creature.GetCreatureDifficulty().GoldMin, creature.GetCreatureDifficulty().GoldMax);
|
||||
|
||||
if (group)
|
||||
if (group != null)
|
||||
loot.NotifyLootList(creature.GetMap());
|
||||
|
||||
creature.m_personalLoot[looter.GetGUID()] = loot; // trash mob loot is personal, generated with round robin rules
|
||||
@@ -920,10 +920,10 @@ namespace Game.Entities
|
||||
{
|
||||
Log.outDebug(LogFilter.Unit, "DealDamageNotPlayer");
|
||||
|
||||
if (!creature.IsPet())
|
||||
if (creature.IsPet())
|
||||
{
|
||||
// must be after setDeathState which resets dynamic flags
|
||||
if (!creature.IsFullyLooted())
|
||||
if (creature.IsFullyLooted())
|
||||
creature.SetDynamicFlag(UnitDynFlags.Lootable);
|
||||
else
|
||||
creature.AllLootRemovedFromCorpse();
|
||||
@@ -978,10 +978,10 @@ namespace Game.Entities
|
||||
if (player != null && player.InBattleground())
|
||||
{
|
||||
Battleground bg = player.GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
{
|
||||
Player playerVictim = victim.ToPlayer();
|
||||
if (playerVictim)
|
||||
if (playerVictim != null)
|
||||
bg.HandleKillPlayer(playerVictim, player);
|
||||
else
|
||||
bg.HandleKillUnit(victim.ToCreature(), player);
|
||||
@@ -1418,7 +1418,7 @@ namespace Game.Entities
|
||||
return GetBaseAttackTime(attType) / 1000.0f;
|
||||
|
||||
Item weapon = ToPlayer().GetWeaponForAttack(attType, true);
|
||||
if (!weapon)
|
||||
if (weapon == null)
|
||||
return 2.0f;
|
||||
|
||||
if (!normalized)
|
||||
@@ -1484,7 +1484,7 @@ namespace Game.Entities
|
||||
|
||||
public bool IsWithinMeleeRangeAt(Position pos, Unit obj)
|
||||
{
|
||||
if (!obj || !IsInMap(obj) || !InSamePhase(obj))
|
||||
if (obj == null || !IsInMap(obj) || !InSamePhase(obj))
|
||||
return false;
|
||||
|
||||
float dx = pos.GetPositionX() - obj.GetPositionX();
|
||||
|
||||
@@ -105,13 +105,13 @@ namespace Game.Entities
|
||||
if (!IsInCombat())
|
||||
{
|
||||
Pet pet = ToPlayer().GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.SetSpeedRate(mtype, m_speed_rate[(int)mtype]);
|
||||
}
|
||||
}
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer(); // unit controlled by a player.
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
// Send notification to self
|
||||
MoveSetSpeed selfpacket = new(moveTypeToOpcode[(int)mtype, 1]);
|
||||
@@ -248,18 +248,18 @@ namespace Game.Entities
|
||||
public void KnockbackFrom(Position origin, float speedXY, float speedZ, SpellEffectExtraData spellEffectExtraData = null)
|
||||
{
|
||||
Player player = ToPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
Unit charmer = GetCharmer();
|
||||
if (charmer)
|
||||
if (charmer != null)
|
||||
{
|
||||
player = charmer.ToPlayer();
|
||||
if (player && player.GetUnitBeingMoved() != this)
|
||||
if (player != null && player.GetUnitBeingMoved() != this)
|
||||
player = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!player)
|
||||
if (player == null)
|
||||
GetMotionMaster().MoveKnockbackFrom(origin, speedXY, speedZ, spellEffectExtraData);
|
||||
else
|
||||
{
|
||||
@@ -298,7 +298,7 @@ namespace Game.Entities
|
||||
RemoveUnitMovementFlag(MovementFlag.DisableCollision);
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
MoveSetFlag packet = new(disable ? ServerOpcodes.MoveSplineEnableCollision : ServerOpcodes.MoveEnableCollision);
|
||||
packet.MoverGUID = GetGUID();
|
||||
@@ -333,7 +333,7 @@ namespace Game.Entities
|
||||
RemoveUnitMovementFlag2(MovementFlag2.CanSwimToFlyTrans);
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
MoveSetFlag packet = new(enable ? ServerOpcodes.MoveEnableTransitionBetweenSwimAndFly : ServerOpcodes.MoveDisableTransitionBetweenSwimAndFly);
|
||||
packet.MoverGUID = GetGUID();
|
||||
@@ -360,7 +360,7 @@ namespace Game.Entities
|
||||
RemoveUnitMovementFlag2(MovementFlag2.CanTurnWhileFalling);
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
MoveSetFlag packet = new(enable ? ServerOpcodes.MoveSetCanTurnWhileFalling : ServerOpcodes.MoveUnsetCanTurnWhileFalling);
|
||||
packet.MoverGUID = GetGUID();
|
||||
@@ -386,7 +386,7 @@ namespace Game.Entities
|
||||
RemoveUnitMovementFlag2(MovementFlag2.CanDoubleJump);
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
MoveSetFlag packet = new(enable ? ServerOpcodes.MoveEnableDoubleJump : ServerOpcodes.MoveDisableDoubleJump);
|
||||
packet.MoverGUID = GetGUID();
|
||||
@@ -543,7 +543,7 @@ namespace Game.Entities
|
||||
if (normalization != 0)
|
||||
{
|
||||
Creature creature1 = ToCreature();
|
||||
if (creature1)
|
||||
if (creature1 != null)
|
||||
{
|
||||
ulong immuneMask = creature1.GetCreatureTemplate().MechanicImmuneMask;
|
||||
if (Convert.ToBoolean(immuneMask & (1 << ((int)Mechanics.Snare - 1))) || Convert.ToBoolean(immuneMask & (1 << ((int)Mechanics.Daze - 1))))
|
||||
@@ -683,7 +683,7 @@ namespace Game.Entities
|
||||
|
||||
public bool IsWithinBoundaryRadius(Unit obj)
|
||||
{
|
||||
if (!obj || !IsInMap(obj) || !InSamePhase(obj))
|
||||
if (obj == null || !IsInMap(obj) || !InSamePhase(obj))
|
||||
return false;
|
||||
|
||||
float objBoundaryRadius = Math.Max(obj.GetBoundingRadius(), SharedConst.MinMeleeReach);
|
||||
@@ -706,7 +706,7 @@ namespace Game.Entities
|
||||
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
MoveSetFlag packet = new(disable ? ServerOpcodes.MoveDisableGravity : ServerOpcodes.MoveEnableGravity);
|
||||
packet.MoverGUID = GetGUID();
|
||||
@@ -892,7 +892,7 @@ namespace Game.Entities
|
||||
// Set _lastLiquid before casting liquid spell to avoid infinite loops
|
||||
_lastLiquid = curLiquid;
|
||||
|
||||
if (curLiquid != null && curLiquid.SpellID != 0 && (!player || !player.IsGameMaster()))
|
||||
if (curLiquid != null && curLiquid.SpellID != 0 && (player == null || !player.IsGameMaster()))
|
||||
CastSpell(this, curLiquid.SpellID, true);
|
||||
}
|
||||
|
||||
@@ -967,7 +967,7 @@ namespace Game.Entities
|
||||
ToPlayer().SetFallInformation(0, GetPositionZ());
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
MoveSetFlag packet = new(enable ? ServerOpcodes.MoveSetCanFly : ServerOpcodes.MoveUnsetCanFly);
|
||||
packet.MoverGUID = GetGUID();
|
||||
@@ -1000,7 +1000,7 @@ namespace Game.Entities
|
||||
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
MoveSetFlag packet = new(enable ? ServerOpcodes.MoveSetWaterWalk : ServerOpcodes.MoveSetLandWalk);
|
||||
packet.MoverGUID = GetGUID();
|
||||
@@ -1033,7 +1033,7 @@ namespace Game.Entities
|
||||
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
MoveSetFlag packet = new(enable ? ServerOpcodes.MoveSetFeatherFall : ServerOpcodes.MoveSetNormalFall);
|
||||
packet.MoverGUID = GetGUID();
|
||||
@@ -1081,7 +1081,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
MoveSetFlag packet = new(enable ? ServerOpcodes.MoveSetHovering : ServerOpcodes.MoveUnsetHovering);
|
||||
packet.MoverGUID = GetGUID();
|
||||
@@ -1114,7 +1114,7 @@ namespace Game.Entities
|
||||
|
||||
public bool IsWithinCombatRange(Unit obj, float dist2compare)
|
||||
{
|
||||
if (!obj || !IsInMap(obj) || !InSamePhase(obj))
|
||||
if (obj == null || !IsInMap(obj) || !InSamePhase(obj))
|
||||
return false;
|
||||
|
||||
float dx = GetPositionX() - obj.GetPositionX();
|
||||
@@ -1321,7 +1321,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();// unit controlled by a player.
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
MoveSetFlag packet = new(apply ? ServerOpcodes.MoveRoot : ServerOpcodes.MoveUnroot);
|
||||
packet.MoverGUID = GetGUID();
|
||||
@@ -1369,7 +1369,7 @@ namespace Game.Entities
|
||||
// block / allow control to real player in control (eg charmer)
|
||||
if (IsPlayer())
|
||||
{
|
||||
if (m_playerMovingMe)
|
||||
if (m_playerMovingMe != null)
|
||||
m_playerMovingMe.SetClientControl(this, !apply);
|
||||
}
|
||||
}
|
||||
@@ -1394,7 +1394,7 @@ namespace Game.Entities
|
||||
// block / allow control to real player in control (eg charmer)
|
||||
if (IsPlayer())
|
||||
{
|
||||
if (m_playerMovingMe)
|
||||
if (m_playerMovingMe != null)
|
||||
m_playerMovingMe.SetClientControl(this, !apply);
|
||||
}
|
||||
}
|
||||
@@ -1509,7 +1509,7 @@ namespace Game.Entities
|
||||
void SendSetVehicleRecId(uint vehicleId)
|
||||
{
|
||||
Player player = ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
MoveSetVehicleRecID moveSetVehicleRec = new();
|
||||
moveSetVehicleRec.MoverGUID = GetGUID();
|
||||
@@ -1673,11 +1673,7 @@ namespace Game.Entities
|
||||
|
||||
Player GetPlayerBeingMoved()
|
||||
{
|
||||
Unit mover = GetUnitBeingMoved();
|
||||
if (mover)
|
||||
return mover.ToPlayer();
|
||||
|
||||
return null;
|
||||
return GetUnitBeingMoved()?.ToPlayer();
|
||||
}
|
||||
|
||||
public Player GetPlayerMovingMe() { return m_playerMovingMe; }
|
||||
@@ -1801,7 +1797,7 @@ namespace Game.Entities
|
||||
if (_positionUpdateInfo.Turned)
|
||||
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Turning);
|
||||
|
||||
if (_positionUpdateInfo.Relocated && !GetVehicle())
|
||||
if (_positionUpdateInfo.Relocated && GetVehicle() == null)
|
||||
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Moving);
|
||||
}
|
||||
|
||||
@@ -1836,7 +1832,7 @@ namespace Game.Entities
|
||||
|
||||
// should this really be the unit _being_ moved? not the unit doing the moving?
|
||||
Player playerMover = GetUnitBeingMoved()?.ToPlayer();
|
||||
if (playerMover)
|
||||
if (playerMover != null)
|
||||
{
|
||||
float x, y, z, o;
|
||||
pos.GetPosition(out x, out y, out z, out o);
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Game.Entities
|
||||
if (minion.IsGuardianPet())
|
||||
{
|
||||
Guardian oldPet = GetGuardianPet();
|
||||
if (oldPet)
|
||||
if (oldPet != null)
|
||||
{
|
||||
if (oldPet != minion && (oldPet.IsPet() || minion.IsPet() || oldPet.GetEntry() != minion.GetEntry()))
|
||||
{
|
||||
@@ -257,7 +257,7 @@ namespace Game.Entities
|
||||
|
||||
public bool SetCharmedBy(Unit charmer, CharmType type, AuraApplication aurApp = null)
|
||||
{
|
||||
if (!charmer)
|
||||
if (charmer == null)
|
||||
return false;
|
||||
|
||||
// dismount players when charmed
|
||||
@@ -268,7 +268,7 @@ namespace Game.Entities
|
||||
charmer.RemoveAurasByType(AuraType.Mounted);
|
||||
|
||||
Cypher.Assert(type != CharmType.Possess || charmer.IsTypeId(TypeId.Player));
|
||||
Cypher.Assert((type == CharmType.Vehicle) == (GetVehicleKit() && GetVehicleKit().IsControllableVehicle()));
|
||||
Cypher.Assert((type == CharmType.Vehicle) == (GetVehicleKit() != null && GetVehicleKit().IsControllableVehicle()));
|
||||
|
||||
Log.outDebug(LogFilter.Unit, "SetCharmedBy: charmer {0} (GUID {1}), charmed {2} (GUID {3}), type {4}.", charmer.GetEntry(), charmer.GetGUID().ToString(), GetEntry(), GetGUID().ToString(), type);
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace Game.Entities
|
||||
Player playerCharmer = charmer.ToPlayer();
|
||||
|
||||
// Charmer stop charming
|
||||
if (playerCharmer)
|
||||
if (playerCharmer != null)
|
||||
{
|
||||
playerCharmer.StopCastingCharm();
|
||||
playerCharmer.StopCastingBindSight();
|
||||
@@ -340,7 +340,7 @@ namespace Game.Entities
|
||||
charmer.SetCharm(this, true);
|
||||
|
||||
Player player = ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
if (player.IsAFK())
|
||||
player.ToggleAFK();
|
||||
@@ -369,7 +369,7 @@ namespace Game.Entities
|
||||
GetCharmInfo().InitCharmCreateSpells();
|
||||
}
|
||||
|
||||
if (playerCharmer)
|
||||
if (playerCharmer != null)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -433,12 +433,12 @@ namespace Game.Entities
|
||||
if (!IsCharmed())
|
||||
return;
|
||||
|
||||
if (charmer)
|
||||
if (charmer != null)
|
||||
Cypher.Assert(charmer == GetCharmer());
|
||||
else
|
||||
charmer = GetCharmer();
|
||||
|
||||
Cypher.Assert(charmer);
|
||||
Cypher.Assert(charmer != null);
|
||||
|
||||
CharmType type;
|
||||
if (HasUnitState(UnitState.Possessed))
|
||||
@@ -473,7 +473,7 @@ namespace Game.Entities
|
||||
m_combatManager.RevalidateCombat();
|
||||
|
||||
Player playerCharmer = charmer.ToPlayer();
|
||||
if (playerCharmer)
|
||||
if (playerCharmer != null)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -512,7 +512,7 @@ namespace Game.Entities
|
||||
if (player != null)
|
||||
player.SetClientControl(this, true);
|
||||
|
||||
if (playerCharmer && this != charmer.GetFirstControlled())
|
||||
if (playerCharmer != null && this != charmer.GetFirstControlled())
|
||||
playerCharmer.SendRemoveControlBar();
|
||||
|
||||
// a guardian should always have charminfo
|
||||
@@ -607,7 +607,7 @@ namespace Game.Entities
|
||||
charm.SetUnitFlag(UnitFlags.PlayerControlled);
|
||||
charm.ToPlayer().UpdatePvPState();
|
||||
}
|
||||
else if (player)
|
||||
else if (player != null)
|
||||
{
|
||||
charm.m_ControlledByPlayer = true;
|
||||
charm.SetUnitFlag(UnitFlags.PlayerControlled);
|
||||
@@ -637,7 +637,7 @@ namespace Game.Entities
|
||||
{
|
||||
// Sequence: charmed, pet, other guardians
|
||||
Unit unit = GetCharmed();
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
ObjectGuid guid = GetMinionGUID();
|
||||
if (!guid.IsEmpty())
|
||||
@@ -685,7 +685,7 @@ namespace Game.Entities
|
||||
public void SendPetActionFeedback(PetActionFeedback msg, uint spellId)
|
||||
{
|
||||
Unit owner = GetOwner();
|
||||
if (!owner || !owner.IsTypeId(TypeId.Player))
|
||||
if (owner == null || !owner.IsTypeId(TypeId.Player))
|
||||
return;
|
||||
|
||||
PetActionFeedbackPacket petActionFeedback = new();
|
||||
@@ -697,7 +697,7 @@ namespace Game.Entities
|
||||
public void SendPetTalk(PetTalk pettalk)
|
||||
{
|
||||
Unit owner = GetOwner();
|
||||
if (!owner || !owner.IsTypeId(TypeId.Player))
|
||||
if (owner == null || !owner.IsTypeId(TypeId.Player))
|
||||
return;
|
||||
|
||||
PetActionSound petActionSound = new();
|
||||
@@ -709,7 +709,7 @@ namespace Game.Entities
|
||||
public void SendPetAIReaction(ObjectGuid guid)
|
||||
{
|
||||
Unit owner = GetOwner();
|
||||
if (!owner || !owner.IsTypeId(TypeId.Player))
|
||||
if (owner == null || !owner.IsTypeId(TypeId.Player))
|
||||
return;
|
||||
|
||||
AIReaction packet = new();
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Game.Entities
|
||||
public int SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
|
||||
{
|
||||
Player thisPlayer = ToPlayer();
|
||||
if (thisPlayer)
|
||||
if (thisPlayer != null)
|
||||
{
|
||||
float overrideSP = thisPlayer.m_activePlayerData.OverrideSpellPowerByAPPercent;
|
||||
if (overrideSP > 0.0f)
|
||||
@@ -105,7 +105,7 @@ namespace Game.Entities
|
||||
{
|
||||
float ApCoeffMod = spellEffectInfo.BonusCoefficientFromAP;
|
||||
Player modOwner = GetSpellModOwner();
|
||||
if (modOwner)
|
||||
if (modOwner != null)
|
||||
{
|
||||
ApCoeffMod *= 100.0f;
|
||||
modOwner.ApplySpellMod(spellProto, SpellModOp.BonusCoefficient, ref ApCoeffMod);
|
||||
@@ -129,7 +129,7 @@ namespace Game.Entities
|
||||
{
|
||||
float coeff = spellEffectInfo.BonusCoefficient;
|
||||
Player modOwner1 = GetSpellModOwner();
|
||||
if (modOwner1)
|
||||
if (modOwner1 != null)
|
||||
{
|
||||
coeff *= 100.0f;
|
||||
modOwner1.ApplySpellMod(spellProto, SpellModOp.BonusCoefficient, ref coeff);
|
||||
@@ -152,7 +152,7 @@ namespace Game.Entities
|
||||
|
||||
public float SpellDamagePctDone(Unit victim, SpellInfo spellProto, DamageEffectType damagetype, SpellEffectInfo spellEffectInfo)
|
||||
{
|
||||
if (spellProto == null || !victim || damagetype == DamageEffectType.Direct)
|
||||
if (spellProto == null || victim == null || damagetype == DamageEffectType.Direct)
|
||||
return 1.0f;
|
||||
|
||||
// Some spells don't benefit from done mods
|
||||
@@ -180,12 +180,12 @@ namespace Game.Entities
|
||||
|
||||
// Versatility
|
||||
Player modOwner = GetSpellModOwner();
|
||||
if (modOwner)
|
||||
if (modOwner != null)
|
||||
MathFunctions.AddPct(ref DoneTotalMod, modOwner.GetRatingBonusValue(CombatRating.VersatilityDamageDone) + modOwner.GetTotalAuraModifier(AuraType.ModVersatility));
|
||||
|
||||
float maxModDamagePercentSchool = 0.0f;
|
||||
Player thisPlayer = ToPlayer();
|
||||
if (thisPlayer)
|
||||
if (thisPlayer != null)
|
||||
{
|
||||
for (int i = 0; i < (int)SpellSchools.Max; ++i)
|
||||
{
|
||||
@@ -282,7 +282,7 @@ namespace Game.Entities
|
||||
{
|
||||
// Versatility
|
||||
Player modOwner = GetSpellModOwner();
|
||||
if (modOwner)
|
||||
if (modOwner != null)
|
||||
{
|
||||
// only 50% of SPELL_AURA_MOD_VERSATILITY for damage reduction
|
||||
float versaBonus = modOwner.GetTotalAuraModifier(AuraType.ModVersatility) / 2.0f;
|
||||
@@ -402,7 +402,7 @@ namespace Game.Entities
|
||||
if (IsTypeId(TypeId.Unit) && IsTotem())
|
||||
{
|
||||
Unit owner = GetOwner();
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
return owner.SpellHealingBonusDone(victim, spellProto, healamount, damagetype, spellEffectInfo, stack, spell, aurEff);
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ namespace Game.Entities
|
||||
{
|
||||
float coeff = spellEffectInfo.BonusCoefficient;
|
||||
Player modOwner = GetSpellModOwner();
|
||||
if (modOwner)
|
||||
if (modOwner != null)
|
||||
{
|
||||
coeff *= 100.0f;
|
||||
modOwner.ApplySpellMod(spellProto, SpellModOp.BonusCoefficient, ref coeff);
|
||||
@@ -489,7 +489,7 @@ namespace Game.Entities
|
||||
|
||||
// apply spellmod to Done amount
|
||||
Player _modOwner = GetSpellModOwner();
|
||||
if (_modOwner)
|
||||
if (_modOwner != null)
|
||||
_modOwner.ApplySpellMod(spellProto, damagetype == DamageEffectType.DOT ? SpellModOp.PeriodicHealingAndDamage : SpellModOp.HealingAndDamage, ref heal);
|
||||
|
||||
return (int)Math.Max(heal, 0.0f);
|
||||
@@ -582,7 +582,7 @@ namespace Game.Entities
|
||||
MathFunctions.AddPct(ref TakenTotalMod, maxval_hot);
|
||||
}
|
||||
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
{
|
||||
TakenTotalMod *= GetTotalAuraMultiplier(AuraType.ModHealingReceived, aurEff =>
|
||||
{
|
||||
@@ -605,7 +605,7 @@ namespace Game.Entities
|
||||
{
|
||||
SpellInfo spellInfo = spell != null ? spell.GetSpellInfo() : aurEff.GetSpellInfo();
|
||||
//! Mobs can't crit with spells. (Except player controlled)
|
||||
if (IsCreature() && !GetSpellModOwner())
|
||||
if (IsCreature() && GetSpellModOwner() == null)
|
||||
return 0.0f;
|
||||
|
||||
// not critting spell
|
||||
@@ -663,7 +663,7 @@ namespace Game.Entities
|
||||
crit_chance += GetTotalAuraModifier(AuraType.ModAttackerSpellAndWeaponCritChance);
|
||||
}
|
||||
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
{
|
||||
// scripted (increase crit chance ... against ... target by x%
|
||||
var mOverrideClassScript = caster.GetAuraEffectsByType(AuraType.OverrideClassScripts);
|
||||
@@ -1419,7 +1419,7 @@ namespace Game.Entities
|
||||
var immuneAuraApply = GetAuraEffectsByType(AuraType.ModImmuneAuraApplySchool);
|
||||
foreach (var auraEffect in immuneAuraApply)
|
||||
if (Convert.ToBoolean(auraEffect.GetMiscValue() & (int)spellInfo.GetSchoolMask()) && // Check school
|
||||
((caster && !IsFriendlyTo(caster)) || !spellInfo.IsPositiveEffect(spellEffectInfo.EffectIndex))) // Harmful
|
||||
((caster != null && !IsFriendlyTo(caster)) || !spellInfo.IsPositiveEffect(spellEffectInfo.EffectIndex))) // Harmful
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1508,7 +1508,7 @@ namespace Game.Entities
|
||||
if (typeMaskActor && actor != null)
|
||||
actor.ProcSkillsAndReactives(false, actionTarget, typeMaskActor, hitMask, attType);
|
||||
|
||||
if (typeMaskActionTarget && actionTarget)
|
||||
if (typeMaskActionTarget && actionTarget != null)
|
||||
actionTarget.ProcSkillsAndReactives(true, actor, typeMaskActionTarget, hitMask, attType);
|
||||
|
||||
if (actor != null)
|
||||
@@ -1522,7 +1522,7 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
// For melee/ranged based attack need update skills and set some Aura states if victim present
|
||||
if (typeMask.HasFlag(ProcFlags.MeleeBasedTriggerMask) && procTarget)
|
||||
if (typeMask.HasFlag(ProcFlags.MeleeBasedTriggerMask) && procTarget != null)
|
||||
{
|
||||
// If exist crit/parry/dodge/block need update aura state (for victim and attacker)
|
||||
if (hitMask.HasAnyFlag(ProcFlagsHit.Critical | ProcFlagsHit.Parry | ProcFlagsHit.Dodge | ProcFlagsHit.Block))
|
||||
@@ -1618,7 +1618,7 @@ namespace Game.Entities
|
||||
|
||||
// needed for example for Cobra Strikes, pet does the attack, but aura is on owner
|
||||
Player modOwner = GetSpellModOwner();
|
||||
if (modOwner)
|
||||
if (modOwner != null)
|
||||
{
|
||||
if (modOwner != this && spell != null)
|
||||
{
|
||||
@@ -1636,12 +1636,12 @@ namespace Game.Entities
|
||||
// prepare data for target trigger
|
||||
ProcEventInfo targetProcEventInfo = new(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
|
||||
List<Tuple<uint, AuraApplication>> targetAurasTriggeringProc = new();
|
||||
if (typeMaskActionTarget && actionTarget)
|
||||
if (typeMaskActionTarget && actionTarget != null)
|
||||
actionTarget.GetProcAurasTriggeredOnEvent(targetAurasTriggeringProc, targetProcAuras, targetProcEventInfo);
|
||||
|
||||
TriggerAurasProcOnEvent(myProcEventInfo, myAurasTriggeringProc);
|
||||
|
||||
if (typeMaskActionTarget && actionTarget)
|
||||
if (typeMaskActionTarget != null && actionTarget != null)
|
||||
actionTarget.TriggerAurasProcOnEvent(targetProcEventInfo, targetAurasTriggeringProc);
|
||||
}
|
||||
|
||||
@@ -1892,13 +1892,13 @@ namespace Game.Entities
|
||||
if (healer != null && healer.IsCreature() && healer.IsTotem())
|
||||
unit = healer.GetOwner();
|
||||
|
||||
if (unit)
|
||||
if (unit != null)
|
||||
{
|
||||
Player bgPlayer = unit.ToPlayer();
|
||||
if (bgPlayer != null)
|
||||
{
|
||||
Battleground bg = bgPlayer.GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
bg.UpdatePlayerScore(bgPlayer, ScoreType.HealingDone, (uint)gain);
|
||||
|
||||
// use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
|
||||
@@ -2174,7 +2174,7 @@ namespace Game.Entities
|
||||
|
||||
ContentTuningParams contentTuningParams = new();
|
||||
Unit caster = Global.ObjAccessor.GetUnit(this, aura.GetCasterGUID());
|
||||
if (caster && contentTuningParams.GenerateDataForUnits(caster, this))
|
||||
if (caster != null && contentTuningParams.GenerateDataForUnits(caster, this))
|
||||
spellLogEffect.ContentTuning = contentTuningParams;
|
||||
|
||||
data.Effects.Add(spellLogEffect);
|
||||
@@ -2205,7 +2205,7 @@ namespace Game.Entities
|
||||
{
|
||||
SpellInstakillLog spellInstakillLog = new();
|
||||
spellInstakillLog.Caster = caster.GetGUID();
|
||||
spellInstakillLog.Target = target ? target.GetGUID() : caster.GetGUID();
|
||||
spellInstakillLog.Target = target != null ? target.GetGUID() : caster.GetGUID();
|
||||
spellInstakillLog.SpellID = spellId;
|
||||
SendMessageToSet(spellInstakillLog, false);
|
||||
}
|
||||
@@ -2379,7 +2379,7 @@ namespace Game.Entities
|
||||
case DiminishingGroup.AOEKnockback:
|
||||
if (auraSpellInfo.GetDiminishingReturnsGroupType() == DiminishingReturnsType.All ||
|
||||
(auraSpellInfo.GetDiminishingReturnsGroupType() == DiminishingReturnsType.Player &&
|
||||
(targetOwner ? targetOwner.IsAffectedByDiminishingReturns() : IsAffectedByDiminishingReturns())))
|
||||
(targetOwner != null ? targetOwner.IsAffectedByDiminishingReturns() : IsAffectedByDiminishingReturns())))
|
||||
{
|
||||
DiminishingLevels diminish = previousLevel;
|
||||
switch (diminish)
|
||||
@@ -2397,7 +2397,7 @@ namespace Game.Entities
|
||||
default:
|
||||
if (auraSpellInfo.GetDiminishingReturnsGroupType() == DiminishingReturnsType.All ||
|
||||
(auraSpellInfo.GetDiminishingReturnsGroupType() == DiminishingReturnsType.Player &&
|
||||
(targetOwner ? targetOwner.IsAffectedByDiminishingReturns() : IsAffectedByDiminishingReturns())))
|
||||
(targetOwner != null ? targetOwner.IsAffectedByDiminishingReturns() : IsAffectedByDiminishingReturns())))
|
||||
{
|
||||
DiminishingLevels diminish = previousLevel;
|
||||
switch (diminish)
|
||||
@@ -2578,7 +2578,7 @@ namespace Game.Entities
|
||||
bool spellClickHandled = false;
|
||||
|
||||
uint spellClickEntry = GetVehicleKit() != null ? GetVehicleKit().GetCreatureEntry() : GetEntry();
|
||||
TriggerCastFlags flags = GetVehicleKit() ? TriggerCastFlags.IgnoreCasterMountedOrOnVehicle : TriggerCastFlags.None;
|
||||
TriggerCastFlags flags = GetVehicleKit() != null ? TriggerCastFlags.IgnoreCasterMountedOrOnVehicle : TriggerCastFlags.None;
|
||||
|
||||
var clickBounds = Global.ObjectMgr.GetSpellClickInfoMapBounds(spellClickEntry);
|
||||
foreach (var clickInfo in clickBounds)
|
||||
@@ -2659,7 +2659,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
Creature creature = ToCreature();
|
||||
if (creature && creature.IsAIEnabled())
|
||||
if (creature != null && creature.IsAIEnabled())
|
||||
creature.GetAI().OnSpellClick(clicker, ref spellClickHandled);
|
||||
}
|
||||
|
||||
@@ -3136,7 +3136,7 @@ namespace Game.Entities
|
||||
else
|
||||
{
|
||||
Unit caster = aura.GetCaster();
|
||||
if (!caster || !caster.InSamePhase(this))
|
||||
if (caster == null || !caster.InSamePhase(this))
|
||||
RemoveOwnedAura(pair);
|
||||
}
|
||||
}
|
||||
@@ -4013,7 +4013,7 @@ namespace Game.Entities
|
||||
|
||||
public Aura _TryStackingOrRefreshingExistingAura(AuraCreateInfo createInfo)
|
||||
{
|
||||
Cypher.Assert(!createInfo.CasterGUID.IsEmpty() || createInfo.Caster);
|
||||
Cypher.Assert(!createInfo.CasterGUID.IsEmpty() || createInfo.Caster != null);
|
||||
|
||||
// Check if these can stack anyway
|
||||
if (createInfo.CasterGUID.IsEmpty() && !createInfo.GetSpellInfo().IsStackableOnOneSlotWithDifferentCasters())
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (pair.Value != null && pair.Value.IsExpired())
|
||||
RemoveOwnedAura(pair, AuraRemoveMode.Expire);
|
||||
else if (pair.Value.GetSpellInfo().IsChanneled() && pair.Value.GetCasterGUID() != GetGUID() && !Global.ObjAccessor.GetWorldObject(this, pair.Value.GetCasterGUID()))
|
||||
else if (pair.Value.GetSpellInfo().IsChanneled() && pair.Value.GetCasterGUID() != GetGUID() && Global.ObjAccessor.GetWorldObject(this, pair.Value.GetCasterGUID()) == null)
|
||||
RemoveOwnedAura(pair, AuraRemoveMode.Cancel); // remove channeled auras when caster is not on the same map
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ namespace Game.Entities
|
||||
|
||||
public virtual void Whisper(string text, Language language, Player target, bool isBossWhisper = false)
|
||||
{
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
Locale locale = target.GetSession().GetSessionDbLocaleIndex();
|
||||
@@ -420,7 +420,7 @@ namespace Game.Entities
|
||||
|
||||
public virtual void Whisper(uint textId, Player target, bool isBossWhisper = false)
|
||||
{
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
BroadcastTextRecord bct = CliDB.BroadcastTextStorage.LookupByKey(textId);
|
||||
@@ -558,12 +558,12 @@ namespace Game.Entities
|
||||
{
|
||||
Unit vehicleRoot = GetVehicleBase();
|
||||
|
||||
if (!vehicleRoot)
|
||||
if (vehicleRoot == null)
|
||||
return null;
|
||||
|
||||
for (; ; )
|
||||
{
|
||||
if (!vehicleRoot.GetVehicleBase())
|
||||
if (vehicleRoot.GetVehicleBase() == null)
|
||||
return vehicleRoot;
|
||||
|
||||
vehicleRoot = vehicleRoot.GetVehicleBase();
|
||||
@@ -964,10 +964,10 @@ namespace Game.Entities
|
||||
Cell.VisitAllObjects(this, searcher, dist);
|
||||
|
||||
// remove current target
|
||||
if (GetVictim())
|
||||
if (GetVictim() != null)
|
||||
targets.Remove(GetVictim());
|
||||
|
||||
if (exclude)
|
||||
if (exclude != null)
|
||||
targets.Remove(exclude);
|
||||
|
||||
// remove not LoS targets
|
||||
@@ -1037,7 +1037,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
Cypher.Assert(!m_vehicle);
|
||||
Cypher.Assert(m_vehicle == null);
|
||||
vehicle.AddVehiclePassenger(this, seatId);
|
||||
}
|
||||
|
||||
@@ -1113,7 +1113,7 @@ namespace Game.Entities
|
||||
Player player = ToPlayer();
|
||||
|
||||
// If the player is on mounted duel and exits the mount, he should immediatly lose the duel
|
||||
if (player && player.duel != null && player.duel.IsMounted)
|
||||
if (player != null && player.duel != null && player.duel.IsMounted)
|
||||
player.DuelComplete(DuelCompleteType.Fled);
|
||||
|
||||
SetControlled(false, UnitState.Root); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
|
||||
@@ -1728,7 +1728,7 @@ namespace Game.Entities
|
||||
displayPower = cEntry.DisplayPower;
|
||||
|
||||
Vehicle vehicle = GetVehicleKit();
|
||||
if (vehicle)
|
||||
if (vehicle != null)
|
||||
{
|
||||
PowerDisplayRecord powerDisplay = CliDB.PowerDisplayStorage.LookupByKey(vehicle.GetVehicleInfo().PowerDisplayID[0]);
|
||||
if (powerDisplay != null)
|
||||
@@ -1737,7 +1737,7 @@ namespace Game.Entities
|
||||
else
|
||||
{
|
||||
Pet pet = ToPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
{
|
||||
if (pet.GetPetType() == PetType.Hunter) // Hunter pets have focus
|
||||
displayPower = PowerType.Focus;
|
||||
@@ -1895,7 +1895,7 @@ namespace Game.Entities
|
||||
Player player = ToPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
if (player.GetGroup())
|
||||
if (player.GetGroup() != null)
|
||||
player.SetGroupUpdateFlag(GroupUpdateFlags.Level);
|
||||
|
||||
Global.CharacterCacheStorage.UpdateCharacterLevel(ToPlayer().GetGUID(), (byte)lvl);
|
||||
@@ -2252,7 +2252,7 @@ namespace Game.Entities
|
||||
if (owner != null)
|
||||
{
|
||||
Player ownerPlayer = owner.ToPlayer();
|
||||
if (ownerPlayer)
|
||||
if (ownerPlayer != null)
|
||||
if (ownerPlayer.IsGroupVisibleFor(seerPlayer))
|
||||
return true;
|
||||
}
|
||||
@@ -2279,7 +2279,7 @@ namespace Game.Entities
|
||||
if (HasUnitTypeMask(UnitTypeMask.Minion))
|
||||
{
|
||||
Unit owner = GetOwner();
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
{
|
||||
SetFaction(owner.GetFaction());
|
||||
return;
|
||||
@@ -2588,7 +2588,7 @@ namespace Game.Entities
|
||||
// if any script modified damage, we need to also apply the same modification to unscaled damage value
|
||||
if (tmpDamage != damageTaken)
|
||||
{
|
||||
if (attacker)
|
||||
if (attacker != null)
|
||||
damageDone = (uint)(tmpDamage * victim.GetHealthMultiplierForTarget(attacker));
|
||||
else
|
||||
damageDone = tmpDamage;
|
||||
@@ -2686,7 +2686,7 @@ namespace Game.Entities
|
||||
bool duel_wasMounted = false;
|
||||
if (victim.IsPlayer() && victim.ToPlayer().duel != null && damageTaken >= (health - 1))
|
||||
{
|
||||
if (!attacker)
|
||||
if (attacker == null)
|
||||
return 0;
|
||||
|
||||
// prevent kill only if killed in duel and killed by opponent or opponent controlled creature
|
||||
@@ -2708,7 +2708,7 @@ namespace Game.Entities
|
||||
Player victimRider = victim.GetCharmer().ToPlayer();
|
||||
if (victimRider != null && victimRider.duel != null && victimRider.duel.IsMounted)
|
||||
{
|
||||
if (!attacker)
|
||||
if (attacker == null)
|
||||
return 0;
|
||||
|
||||
// prevent kill only if killed in duel and killed by opponent or opponent controlled creature
|
||||
@@ -2923,7 +2923,7 @@ namespace Game.Entities
|
||||
{
|
||||
Player he = duel_wasMounted ? victim.GetCharmer().ToPlayer() : victim.ToPlayer();
|
||||
|
||||
Cypher.Assert(he && he.duel != null);
|
||||
Cypher.Assert(he != null && he.duel != null);
|
||||
|
||||
if (duel_wasMounted) // In this case victim==mount
|
||||
victim.SetHealth(1);
|
||||
@@ -3046,7 +3046,7 @@ namespace Game.Entities
|
||||
|
||||
uint damage = (uint)dmgShield.GetAmount();
|
||||
Unit caster = dmgShield.GetCaster();
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
{
|
||||
damage = (uint)caster.SpellDamageBonusDone(this, spellInfo, (int)damage, DamageEffectType.SpellDirect, dmgShield.GetSpellEffectInfo());
|
||||
damage = (uint)SpellDamageBonusTaken(caster, spellInfo, (int)damage, DamageEffectType.SpellDirect);
|
||||
@@ -3111,7 +3111,7 @@ namespace Game.Entities
|
||||
packet.Health = (long)GetHealth();
|
||||
|
||||
Player player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (player)
|
||||
if (player != null)
|
||||
player.SendPacket(packet);
|
||||
}
|
||||
|
||||
@@ -3328,7 +3328,7 @@ namespace Game.Entities
|
||||
return null;
|
||||
Group group = player.GetGroup();
|
||||
// When there is no group check pet presence
|
||||
if (!group)
|
||||
if (group == null)
|
||||
{
|
||||
// We are pet now, return owner
|
||||
if (player != this)
|
||||
@@ -3347,7 +3347,7 @@ namespace Game.Entities
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player target = refe.GetSource();
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
// IsHostileTo check duel and controlled by enemy
|
||||
if (target != this && IsWithinDistInMap(target, radius) && target.IsAlive() && !IsHostileTo(target))
|
||||
@@ -3355,7 +3355,7 @@ namespace Game.Entities
|
||||
|
||||
// Push player's pet to vector
|
||||
Unit pet = target.GetGuardianPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
if (pet != this && IsWithinDistInMap(pet, radius) && pet.IsAlive() && !IsHostileTo(pet))
|
||||
nearMembers.Add(pet);
|
||||
}
|
||||
@@ -3484,7 +3484,7 @@ namespace Game.Entities
|
||||
|
||||
uint bossLevel = 83;
|
||||
float bossResistanceConstant = 510.0f;
|
||||
uint level = caster ? victim.GetLevelForTarget(caster) : victim.GetLevel();
|
||||
uint level = caster != null ? victim.GetLevelForTarget(caster) : victim.GetLevel();
|
||||
float resistanceConstant;
|
||||
|
||||
if (level == bossLevel)
|
||||
@@ -3497,7 +3497,7 @@ namespace Game.Entities
|
||||
|
||||
public static void CalcAbsorbResist(DamageInfo damageInfo, Spell spell = null)
|
||||
{
|
||||
if (!damageInfo.GetVictim() || !damageInfo.GetVictim().IsAlive() || damageInfo.GetDamage() == 0)
|
||||
if (damageInfo.GetVictim() == null || !damageInfo.GetVictim().IsAlive() || damageInfo.GetDamage() == 0)
|
||||
return;
|
||||
|
||||
uint resistedDamage = CalcSpellResistedDamage(damageInfo.GetAttacker(), damageInfo.GetVictim(), damageInfo.GetDamage(), damageInfo.GetSchoolMask(), damageInfo.GetSpellInfo());
|
||||
@@ -3691,7 +3691,7 @@ namespace Game.Entities
|
||||
|
||||
// Damage can be splitted only if aura has an alive caster
|
||||
Unit caster = itr.GetCaster();
|
||||
if (!caster || (caster == damageInfo.GetVictim()) || !caster.IsInWorld || !caster.IsAlive())
|
||||
if (caster == null || (caster == damageInfo.GetVictim()) || !caster.IsInWorld || !caster.IsAlive())
|
||||
continue;
|
||||
|
||||
uint splitDamage = MathFunctions.CalculatePct(damageInfo.GetDamage(), itr.GetAmount());
|
||||
@@ -3789,7 +3789,7 @@ namespace Game.Entities
|
||||
if (currentAbsorb != 0)
|
||||
{
|
||||
SpellHealAbsorbLog absorbLog = new();
|
||||
absorbLog.Healer = healInfo.GetHealer() ? healInfo.GetHealer().GetGUID() : ObjectGuid.Empty;
|
||||
absorbLog.Healer = healInfo.GetHealer() != null ? healInfo.GetHealer().GetGUID() : ObjectGuid.Empty;
|
||||
absorbLog.Target = healInfo.GetTarget().GetGUID();
|
||||
absorbLog.AbsorbCaster = absorbAurEff.GetBase().GetCasterGUID();
|
||||
absorbLog.AbsorbedSpellID = (int)(healInfo.GetSpellInfo() != null ? healInfo.GetSpellInfo().Id : 0);
|
||||
@@ -4070,7 +4070,7 @@ namespace Game.Entities
|
||||
|
||||
// Versatility
|
||||
Player modOwner = GetSpellModOwner();
|
||||
if (modOwner)
|
||||
if (modOwner != null)
|
||||
{
|
||||
// only 50% of SPELL_AURA_MOD_VERSATILITY for damage reduction
|
||||
float versaBonus = modOwner.GetTotalAuraModifier(AuraType.ModVersatility) / 2.0f;
|
||||
|
||||
Reference in New Issue
Block a user