Some cleanups. (might break build for scripts as they are a WIP)
This commit is contained in:
@@ -60,7 +60,7 @@ namespace Game.Entities
|
||||
_isRemoved = true;
|
||||
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
caster._UnregisterAreaTrigger(this);
|
||||
|
||||
_ai.OnRemove();
|
||||
@@ -78,7 +78,7 @@ namespace Game.Entities
|
||||
|
||||
bool Create(uint areaTriggerCreatePropertiesId, Unit caster, Unit target, SpellInfo spellInfo, Position pos, int duration, SpellCastVisualField spellVisual, Spell spell, AuraEffect aurEff)
|
||||
{
|
||||
_targetGuid = target ? target.GetGUID() : ObjectGuid.Empty;
|
||||
_targetGuid = target != null ? target.GetGUID() : ObjectGuid.Empty;
|
||||
_aurEff = aurEff;
|
||||
|
||||
SetMap(caster.GetMap());
|
||||
@@ -138,7 +138,7 @@ namespace Game.Entities
|
||||
|
||||
PhasingHandler.InheritPhaseShift(this, caster);
|
||||
|
||||
if (target && GetTemplate() != null && GetTemplate().HasFlag(AreaTriggerFlags.HasAttached))
|
||||
if (target != null && GetTemplate() != null && GetTemplate().HasFlag(AreaTriggerFlags.HasAttached))
|
||||
{
|
||||
m_movementInfo.transport.guid = target.GetGUID();
|
||||
}
|
||||
@@ -153,7 +153,7 @@ namespace Game.Entities
|
||||
if (GetCreateProperties().OrbitInfo != null)
|
||||
{
|
||||
AreaTriggerOrbitInfo orbit = GetCreateProperties().OrbitInfo;
|
||||
if (target && GetTemplate() != null && GetTemplate().HasFlag(AreaTriggerFlags.HasAttached))
|
||||
if (target != null && GetTemplate() != null && GetTemplate().HasFlag(AreaTriggerFlags.HasAttached))
|
||||
orbit.PathTarget = target.GetGUID();
|
||||
else
|
||||
orbit.Center = new(pos.posX, pos.posY, pos.posZ);
|
||||
@@ -297,7 +297,7 @@ namespace Game.Entities
|
||||
else if (GetTemplate() != null && GetTemplate().HasFlag(AreaTriggerFlags.HasAttached))
|
||||
{
|
||||
Unit target = GetTarget();
|
||||
if (target)
|
||||
if (target != null)
|
||||
GetMap().AreaTriggerRelocation(this, target.GetPositionX(), target.GetPositionY(), target.GetPositionZ(), target.GetOrientation());
|
||||
}
|
||||
else
|
||||
@@ -607,7 +607,7 @@ namespace Game.Entities
|
||||
foreach (Unit unit in enteringUnits)
|
||||
{
|
||||
Player player = unit.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
if (player.IsDebugAreaTriggers)
|
||||
player.SendSysMessage(CypherStrings.DebugAreatriggerEntered, GetEntry());
|
||||
@@ -623,10 +623,10 @@ namespace Game.Entities
|
||||
foreach (ObjectGuid exitUnitGuid in exitUnits)
|
||||
{
|
||||
Unit leavingUnit = Global.ObjAccessor.GetUnit(this, exitUnitGuid);
|
||||
if (leavingUnit)
|
||||
if (leavingUnit != null)
|
||||
{
|
||||
Player player = leavingUnit.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
if (player.IsDebugAreaTriggers)
|
||||
player.SendSysMessage(CypherStrings.DebugAreatriggerLeft, GetEntry());
|
||||
@@ -673,7 +673,7 @@ namespace Game.Entities
|
||||
public override uint GetFaction()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
return caster.GetFaction();
|
||||
|
||||
return 0;
|
||||
@@ -958,7 +958,7 @@ namespace Game.Entities
|
||||
if (_orbitInfo.PathTarget.HasValue)
|
||||
{
|
||||
WorldObject center = Global.ObjAccessor.GetWorldObject(this, _orbitInfo.PathTarget.Value);
|
||||
if (center)
|
||||
if (center != null)
|
||||
return center;
|
||||
}
|
||||
|
||||
@@ -1188,10 +1188,10 @@ namespace Game.Entities
|
||||
void DebugVisualizePosition()
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
{
|
||||
Player player = caster.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
if (player.IsDebugAreaTriggers)
|
||||
player.SummonCreature(1, this, TempSummonType.TimedDespawn, TimeSpan.FromMilliseconds(GetTimeToTarget()));
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace Game.Entities
|
||||
break;
|
||||
}
|
||||
|
||||
if (bestFit)
|
||||
if (bestFit != null)
|
||||
_conversation.AddActor(_actor.Id, _actor.Index, bestFit.GetGUID());
|
||||
}
|
||||
|
||||
|
||||
@@ -682,7 +682,7 @@ namespace Game.Entities
|
||||
|
||||
public void DoFleeToGetAssistance()
|
||||
{
|
||||
if (!GetVictim())
|
||||
if (GetVictim() == null)
|
||||
return;
|
||||
|
||||
if (HasAuraType(AuraType.PreventsFleeing))
|
||||
@@ -699,7 +699,7 @@ namespace Game.Entities
|
||||
|
||||
SetNoSearchAssistance(true);
|
||||
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
SetControlled(true, UnitState.Fleeing);
|
||||
else
|
||||
GetMotionMaster().MoveSeekAssistance(creature.GetPositionX(), creature.GetPositionY(), creature.GetPositionZ());
|
||||
@@ -757,7 +757,7 @@ namespace Game.Entities
|
||||
lowGuid = map.GenerateLowGuid(HighGuid.Creature);
|
||||
|
||||
Creature creature = new();
|
||||
if (!creature.Create(lowGuid, map, entry, pos, null, vehId))
|
||||
if (creature.Create(lowGuid, map, entry, pos, null, vehId))
|
||||
return null;
|
||||
|
||||
return creature;
|
||||
@@ -766,7 +766,7 @@ namespace Game.Entities
|
||||
public static Creature CreateCreatureFromDB(ulong spawnId, Map map, bool addToMap = true, bool allowDuplicate = false)
|
||||
{
|
||||
Creature creature = new();
|
||||
if (!creature.LoadFromDB(spawnId, map, addToMap, allowDuplicate))
|
||||
if (creature.LoadFromDB(spawnId, map, addToMap, allowDuplicate))
|
||||
return null;
|
||||
|
||||
return creature;
|
||||
@@ -882,21 +882,21 @@ namespace Game.Entities
|
||||
{
|
||||
// We're a player pet, probably
|
||||
target = GetAttackerForHelper();
|
||||
if (!target && IsSummon())
|
||||
if (target == null && IsSummon())
|
||||
{
|
||||
Unit owner = ToTempSummon().GetOwner();
|
||||
if (owner != null)
|
||||
{
|
||||
if (owner.IsInCombat())
|
||||
target = owner.GetAttackerForHelper();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
foreach (var itr in owner.m_Controlled)
|
||||
{
|
||||
if (itr.IsInCombat())
|
||||
{
|
||||
target = itr.GetAttackerForHelper();
|
||||
if (target)
|
||||
if (target != null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -907,7 +907,7 @@ namespace Game.Entities
|
||||
else
|
||||
return null;
|
||||
|
||||
if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target))
|
||||
if (target != null && _IsTargetAcceptable(target) && CanCreatureAttack(target))
|
||||
{
|
||||
if (!HasSpellFocus())
|
||||
SetInFront(target);
|
||||
@@ -915,7 +915,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
/// @todo a vehicle may eat some mob, so mob should not evade
|
||||
if (GetVehicle())
|
||||
if (GetVehicle() != null)
|
||||
return null;
|
||||
|
||||
var iAuras = GetAuraEffectsByType(AuraType.ModInvisibility);
|
||||
@@ -1619,7 +1619,7 @@ namespace Game.Entities
|
||||
if (GetSparringHealthPct() == 0)
|
||||
return false;
|
||||
|
||||
if (!attacker)
|
||||
if (attacker == null)
|
||||
return false;
|
||||
|
||||
if (!attacker.IsCreature())
|
||||
@@ -2786,7 +2786,7 @@ namespace Game.Entities
|
||||
public override uint GetLevelForTarget(WorldObject target)
|
||||
{
|
||||
Unit unitTarget = target.ToUnit();
|
||||
if (unitTarget)
|
||||
if (unitTarget != null)
|
||||
{
|
||||
if (IsWorldBoss())
|
||||
{
|
||||
@@ -3161,7 +3161,7 @@ namespace Game.Entities
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Target), newTarget);
|
||||
|
||||
// If we are not allowed to turn during cast but have a focus target, face the target
|
||||
if (!turnDisabled && noTurnDuringCast && target)
|
||||
if (!turnDisabled && noTurnDuringCast && target != null)
|
||||
SetFacingToObject(target, false);
|
||||
|
||||
if (!noTurnDuringCast)
|
||||
@@ -3222,7 +3222,7 @@ namespace Game.Entities
|
||||
if (!_spellFocusInfo.Target.IsEmpty())
|
||||
{
|
||||
WorldObject objTarget = Global.ObjAccessor.GetWorldObject(this, _spellFocusInfo.Target);
|
||||
if (objTarget)
|
||||
if (objTarget != null)
|
||||
SetFacingToObject(objTarget, false);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -545,7 +545,7 @@ namespace Game.Misc
|
||||
|
||||
// Is there a better way? what about game objects?
|
||||
Creature creature = ObjectAccessor.GetCreature(_session.GetPlayer(), npcGUID);
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
{
|
||||
packet.QuestGiverCreatureID = creature.GetEntry();
|
||||
offer.QuestGiverCreatureID = creature.GetCreatureTemplate().Entry;
|
||||
@@ -612,7 +612,7 @@ namespace Game.Misc
|
||||
|
||||
// Is there a better way? what about game objects?
|
||||
Creature creature = ObjectAccessor.GetCreature(_session.GetPlayer(), npcGUID);
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
packet.QuestGiverCreatureID = creature.GetCreatureTemplate().Entry;
|
||||
|
||||
packet.QuestID = quest.Id;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Game.Entities
|
||||
{
|
||||
// make sure all references were properly removed
|
||||
Cypher.Assert(_aura == null);
|
||||
Cypher.Assert(!_caster);
|
||||
Cypher.Assert(_caster == null);
|
||||
Cypher.Assert(!_isViewpoint);
|
||||
_removedAura = null;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
Unit owner = Global.ObjAccessor.GetUnit(this, ownerGUID);
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
{
|
||||
owner.RemoveGameObject(this, false);
|
||||
Cypher.Assert(GetOwnerGUID().IsEmpty());
|
||||
@@ -114,7 +114,7 @@ namespace Game.Entities
|
||||
if (m_model != null)
|
||||
{
|
||||
Transport trans = ToTransport();
|
||||
if (trans)
|
||||
if (trans != null)
|
||||
trans.SetDelayedAddModelToMap();
|
||||
else
|
||||
GetMap().InsertGameObjectModel(m_model);
|
||||
@@ -175,7 +175,7 @@ namespace Game.Entities
|
||||
|
||||
bool Create(uint entry, Map map, Position pos, Quaternion rotation, uint animProgress, GameObjectState goState, uint artKit, bool dynamic, ulong spawnid)
|
||||
{
|
||||
Cypher.Assert(map);
|
||||
Cypher.Assert(map != null);
|
||||
SetMap(map);
|
||||
|
||||
Relocate(pos);
|
||||
@@ -439,7 +439,7 @@ namespace Game.Entities
|
||||
|
||||
m_perPlayerState.Remove(guid);
|
||||
|
||||
if (seer)
|
||||
if (seer != null)
|
||||
{
|
||||
if (despawned)
|
||||
{
|
||||
@@ -475,7 +475,7 @@ namespace Game.Entities
|
||||
Unit owner = GetOwner();
|
||||
if (goInfo.Trap.charges == 2)
|
||||
m_cooldownTime = GameTime.GetGameTimeMS() + 10 * Time.InMilliseconds; // Hardcoded tooltip value
|
||||
else if (owner)
|
||||
else if (owner != null)
|
||||
{
|
||||
if (owner.IsInCombat())
|
||||
m_cooldownTime = GameTime.GetGameTimeMS() + goInfo.Trap.startDelay * Time.InMilliseconds;
|
||||
@@ -632,7 +632,7 @@ namespace Game.Entities
|
||||
target = searcher.GetTarget();
|
||||
}
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
SetLootState(LootState.Activated, target);
|
||||
}
|
||||
else if (goInfo.type == GameObjectTypes.CapturePoint)
|
||||
@@ -738,7 +738,7 @@ namespace Game.Entities
|
||||
CastSpell(null, goInfo.Trap.spell);
|
||||
SetLootState(LootState.JustDeactivated);
|
||||
}
|
||||
else if (target)
|
||||
else if (target != null)
|
||||
{
|
||||
// Some traps do not have a spell but should be triggered
|
||||
CastSpellExtraArgs args = new();
|
||||
@@ -765,7 +765,7 @@ namespace Game.Entities
|
||||
{
|
||||
// If nearby linked trap exists, despawn it
|
||||
GameObject linkedTrap = GetLinkedTrap();
|
||||
if (linkedTrap)
|
||||
if (linkedTrap != null)
|
||||
linkedTrap.DespawnOrUnsummon();
|
||||
|
||||
//if Gameobject should cast spell, then this, but some GOs (type = 10) should be destroyed
|
||||
@@ -1384,7 +1384,7 @@ namespace Game.Entities
|
||||
|| LootStorage.Gameobject.HaveQuestLootForPlayer(GetGoInfo().Chest.chestPushLoot, target))
|
||||
{
|
||||
Battleground bg = target.GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
return bg.CanActivateGO((int)GetEntry(), (uint)bg.GetPlayerTeam(target.GetGUID()));
|
||||
return true;
|
||||
}
|
||||
@@ -1419,7 +1419,7 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
GameObject trapGO = GetLinkedTrap();
|
||||
if (trapGO)
|
||||
if (trapGO != null)
|
||||
trapGO.CastSpell(target, trapSpell.Id);
|
||||
}
|
||||
|
||||
@@ -1460,7 +1460,7 @@ namespace Game.Entities
|
||||
|
||||
public void ActivateObject(GameObjectActions action, int param, WorldObject spellCaster = null, uint spellId = 0, int effectIndex = -1)
|
||||
{
|
||||
Unit unitCaster = spellCaster ? spellCaster.ToUnit() : null;
|
||||
Unit unitCaster = spellCaster != null ? spellCaster.ToUnit() : null;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
@@ -1474,7 +1474,7 @@ namespace Game.Entities
|
||||
SendCustomAnim((uint)(action - GameObjectActions.AnimateCustom0));
|
||||
break;
|
||||
case GameObjectActions.Disturb: // What's the difference with Open?
|
||||
if (unitCaster)
|
||||
if (unitCaster != null)
|
||||
Use(unitCaster);
|
||||
break;
|
||||
case GameObjectActions.Unlock:
|
||||
@@ -1484,11 +1484,11 @@ namespace Game.Entities
|
||||
SetFlag(GameObjectFlags.Locked);
|
||||
break;
|
||||
case GameObjectActions.Open:
|
||||
if (unitCaster)
|
||||
if (unitCaster != null)
|
||||
Use(unitCaster);
|
||||
break;
|
||||
case GameObjectActions.OpenAndUnlock:
|
||||
if (unitCaster)
|
||||
if (unitCaster != null)
|
||||
UseDoorOrButton(0, false, unitCaster);
|
||||
RemoveFlag(GameObjectFlags.Locked);
|
||||
break;
|
||||
@@ -1499,7 +1499,7 @@ namespace Game.Entities
|
||||
// No use cases, implementation unknown
|
||||
break;
|
||||
case GameObjectActions.Destroy:
|
||||
if (unitCaster)
|
||||
if (unitCaster != null)
|
||||
UseDoorOrButton(0, true, unitCaster);
|
||||
break;
|
||||
case GameObjectActions.Rebuild:
|
||||
@@ -1561,7 +1561,7 @@ namespace Game.Entities
|
||||
SetAnimKitId((ushort)param, false);
|
||||
break;
|
||||
case GameObjectActions.OpenAndPlayAnimKit:
|
||||
if (unitCaster)
|
||||
if (unitCaster != null)
|
||||
UseDoorOrButton(0, false, unitCaster);
|
||||
SetAnimKitId((ushort)param, false);
|
||||
break;
|
||||
@@ -1576,7 +1576,7 @@ namespace Game.Entities
|
||||
SetAnimKitId(0, false);
|
||||
break;
|
||||
case GameObjectActions.OpenAndStopAnimKit:
|
||||
if (unitCaster)
|
||||
if (unitCaster != null)
|
||||
UseDoorOrButton(0, false, unitCaster);
|
||||
SetAnimKitId(0, false);
|
||||
break;
|
||||
@@ -1684,7 +1684,7 @@ namespace Game.Entities
|
||||
case GameObjectTypes.Chest: //3
|
||||
{
|
||||
Player player = user.ToPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Battleground bg = player.GetBattleground();
|
||||
@@ -1922,12 +1922,12 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
Group group = player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player member = refe.GetSource();
|
||||
if (member)
|
||||
if (member != null)
|
||||
if (member.IsAtGroupRewardDistance(this))
|
||||
member.KillCreditGO(info.entry, GetGUID());
|
||||
}
|
||||
@@ -2044,14 +2044,14 @@ namespace Game.Entities
|
||||
|
||||
// If fishing skill is high enough, or if fishing on a pool, send correct loot.
|
||||
// Fishing pools have no skill requirement as of patch 3.3.0 (undocumented change).
|
||||
if (chance >= roll || fishingPool)
|
||||
if (chance >= roll || fishingPool != null)
|
||||
{
|
||||
// @todo I do not understand this hack. Need some explanation.
|
||||
// prevent removing GO at spell cancel
|
||||
RemoveFromOwner();
|
||||
SetOwnerGUID(player.GetGUID());
|
||||
|
||||
if (fishingPool)
|
||||
if (fishingPool != null)
|
||||
{
|
||||
fishingPool.Use(player);
|
||||
SetLootState(LootState.JustDeactivated);
|
||||
@@ -2248,7 +2248,7 @@ namespace Game.Entities
|
||||
{
|
||||
// in Battlegroundcheck
|
||||
Battleground bg = player.GetBattleground();
|
||||
if (!bg)
|
||||
if (bg == null)
|
||||
return;
|
||||
|
||||
if (player.GetVehicle() != null)
|
||||
@@ -2296,7 +2296,7 @@ namespace Game.Entities
|
||||
{
|
||||
// in Battlegroundcheck
|
||||
Battleground bg = player.GetBattleground();
|
||||
if (!bg)
|
||||
if (bg == null)
|
||||
return;
|
||||
|
||||
if (player.GetVehicle() != null)
|
||||
@@ -2452,7 +2452,7 @@ namespace Game.Entities
|
||||
|
||||
Aura artifactAura = player.GetAura(PlayerConst.ArtifactsAllWeaponsGeneralWeaponEquippedPassive);
|
||||
Item item = artifactAura != null ? player.GetItemByGuid(artifactAura.GetCastItemGUID()) : null;
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
player.SendPacket(new DisplayGameError(GameError.MustEquipArtifact));
|
||||
return;
|
||||
@@ -2467,7 +2467,7 @@ namespace Game.Entities
|
||||
case 2: // Heart Forge
|
||||
{
|
||||
Item item = player.GetItemByEntry(PlayerConst.ItemIdHeartOfAzeroth, ItemSearchLocation.Everywhere);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
GameObjectInteraction openHeartForge = new();
|
||||
@@ -2484,7 +2484,7 @@ namespace Game.Entities
|
||||
case GameObjectTypes.UILink:
|
||||
{
|
||||
Player player = user.ToPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
GameObjectInteraction gameObjectUILink = new();
|
||||
@@ -2587,7 +2587,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
Player player1 = user.ToPlayer();
|
||||
if (player1)
|
||||
if (player1 != null)
|
||||
Global.OutdoorPvPMgr.HandleCustomSpell(player1, spellId, this);
|
||||
|
||||
if (spellCaster != null)
|
||||
@@ -2794,7 +2794,7 @@ namespace Game.Entities
|
||||
|
||||
public SpellInfo GetSpellForLock(Player player)
|
||||
{
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return null;
|
||||
|
||||
uint lockId = GetGoInfo().GetLockId();
|
||||
@@ -2937,7 +2937,7 @@ namespace Game.Entities
|
||||
GetAI().Destroyed(attackerOrHealer, m_goInfo.DestructibleBuilding.DestroyedEvent);
|
||||
|
||||
Player player = attackerOrHealer != null ? attackerOrHealer.GetCharmerOrOwnerPlayerOrPlayerItself() : null;
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
Battleground bg = player.GetBattleground();
|
||||
if (bg != null)
|
||||
@@ -2990,7 +2990,7 @@ namespace Game.Entities
|
||||
public void SetLootState(LootState state, Unit unit = null)
|
||||
{
|
||||
m_lootState = state;
|
||||
m_lootStateUnitGUID = unit ? unit.GetGUID() : ObjectGuid.Empty;
|
||||
m_lootStateUnitGUID = unit != null ? unit.GetGUID() : ObjectGuid.Empty;
|
||||
GetAI().OnLootStateChanged((uint)state, unit);
|
||||
|
||||
// Start restock timer if the chest is partially looted or not looted at all
|
||||
@@ -3437,7 +3437,7 @@ namespace Game.Entities
|
||||
battleground = bg;
|
||||
}
|
||||
|
||||
if (!battleground)
|
||||
if (battleground == null)
|
||||
return;
|
||||
|
||||
// Cancel current timer
|
||||
@@ -4414,7 +4414,7 @@ namespace Game.Entities
|
||||
FlagState oldState = _state;
|
||||
_state = newState;
|
||||
|
||||
if (player && newState == FlagState.Taken)
|
||||
if (player != null && newState == FlagState.Taken)
|
||||
_carrierGUID = player.GetGUID();
|
||||
else
|
||||
_carrierGUID = ObjectGuid.Empty;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Game.Entities
|
||||
for (byte i = 0; i < ItemConst.MaxBagSize; ++i)
|
||||
{
|
||||
Item item = m_bagslot[i];
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
if (item.IsInWorld)
|
||||
{
|
||||
@@ -72,7 +72,7 @@ namespace Game.Entities
|
||||
SetEntry(itemid);
|
||||
SetObjectScale(1.0f);
|
||||
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
{
|
||||
SetOwnerGUID(owner.GetGUID());
|
||||
SetContainedIn(owner.GetGUID());
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Game.Entities
|
||||
SetEntry(itemId);
|
||||
SetObjectScale(1.0f);
|
||||
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
{
|
||||
SetOwnerGUID(owner.GetGUID());
|
||||
SetContainedIn(owner.GetGUID());
|
||||
@@ -74,7 +74,7 @@ namespace Game.Entities
|
||||
|
||||
PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(artifactAppearance.UnlockPlayerConditionID);
|
||||
if (playerCondition != null)
|
||||
if (!owner || !ConditionManager.IsPlayerMeetingCondition(owner, playerCondition))
|
||||
if (owner == null || !ConditionManager.IsPlayerMeetingCondition(owner, playerCondition))
|
||||
continue;
|
||||
|
||||
SetModifier(ItemModifier.ArtifactAppearanceId, artifactAppearance.Id);
|
||||
@@ -624,7 +624,7 @@ namespace Game.Entities
|
||||
|
||||
public void CheckArtifactRelicSlotUnlock(Player owner)
|
||||
{
|
||||
if (!owner)
|
||||
if (owner == null)
|
||||
return;
|
||||
|
||||
byte artifactId = GetTemplate().GetArtifactID();
|
||||
@@ -718,7 +718,7 @@ namespace Game.Entities
|
||||
if (uState == ItemUpdateState.New && state == ItemUpdateState.Removed)
|
||||
{
|
||||
// pretend the item never existed
|
||||
if (forplayer)
|
||||
if (forplayer != null)
|
||||
{
|
||||
RemoveItemFromUpdateQueueOf(this, forplayer);
|
||||
forplayer.DeleteRefundReference(GetGUID());
|
||||
@@ -731,7 +731,7 @@ namespace Game.Entities
|
||||
if (uState != ItemUpdateState.New)
|
||||
uState = state;
|
||||
|
||||
if (forplayer)
|
||||
if (forplayer != null)
|
||||
AddItemToUpdateQueueOf(this, forplayer);
|
||||
}
|
||||
else
|
||||
@@ -825,7 +825,7 @@ namespace Game.Entities
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_itemData).ModifyValue(m_itemData.StackCount), value);
|
||||
|
||||
Player player = GetOwner();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
TradeData tradeData = player.GetTradeData();
|
||||
if (tradeData != null)
|
||||
@@ -1351,7 +1351,7 @@ namespace Game.Entities
|
||||
public override bool AddToObjectUpdate()
|
||||
{
|
||||
Player owner = GetOwner();
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
{
|
||||
owner.GetMap().AddUpdateObject(this);
|
||||
return true;
|
||||
@@ -1363,7 +1363,7 @@ namespace Game.Entities
|
||||
public override void RemoveFromObjectUpdate()
|
||||
{
|
||||
Player owner = GetOwner();
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
owner.GetMap().RemoveUpdateObject(this);
|
||||
}
|
||||
|
||||
@@ -1509,7 +1509,7 @@ namespace Game.Entities
|
||||
Player owner = GetOwner();
|
||||
for (byte i = 0; i < ItemConst.MaxStats; ++i)
|
||||
{
|
||||
if ((owner ? GetItemStatValue(i, owner) : proto.GetStatPercentEditor(i)) != 0)
|
||||
if ((owner != null ? GetItemStatValue(i, owner) : proto.GetStatPercentEditor(i)) != 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2331,7 +2331,7 @@ namespace Game.Entities
|
||||
public void GiveArtifactXp(ulong amount, Item sourceItem, ArtifactCategory artifactCategoryId)
|
||||
{
|
||||
Player owner = GetOwner();
|
||||
if (!owner)
|
||||
if (owner == null)
|
||||
return;
|
||||
|
||||
if (artifactCategoryId != 0)
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
bool meetsPlayerCondition = false;
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
var playerCondition = CliDB.PlayerConditionStorage.LookupByKey(itemContextPickerEntry.PlayerConditionID);
|
||||
if (playerCondition != null)
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Game.Entities
|
||||
public virtual void Dispose()
|
||||
{
|
||||
// this may happen because there are many !create/delete
|
||||
if (IsWorldObject() && _currMap)
|
||||
if (IsWorldObject() && _currMap != null)
|
||||
{
|
||||
if (IsTypeId(TypeId.Corpse))
|
||||
{
|
||||
@@ -124,7 +124,7 @@ namespace Game.Entities
|
||||
|
||||
public virtual void BuildCreateUpdateBlockForPlayer(UpdateData data, Player target)
|
||||
{
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
UpdateType updateType = _isNewObject ? UpdateType.CreateObject2 : UpdateType.CreateObject;
|
||||
@@ -148,10 +148,10 @@ namespace Game.Entities
|
||||
flags.SmoothPhasing = true;
|
||||
|
||||
Unit unit = ToUnit();
|
||||
if (unit)
|
||||
if (unit != null)
|
||||
{
|
||||
flags.PlayHoverAnim = unit.IsPlayingHoverAnim();
|
||||
if (unit.GetVictim())
|
||||
if (unit.GetVictim() != null)
|
||||
flags.CombatVictim = true;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ namespace Game.Entities
|
||||
|
||||
public void SendOutOfRangeForPlayer(Player target)
|
||||
{
|
||||
Cypher.Assert(target);
|
||||
Cypher.Assert(target != null);
|
||||
|
||||
UpdateData updateData = new(target.GetMapId());
|
||||
BuildOutOfRangeUpdateBlock(updateData);
|
||||
@@ -235,7 +235,7 @@ namespace Game.Entities
|
||||
{
|
||||
List<uint> PauseTimes = null;
|
||||
GameObject go = ToGameObject();
|
||||
if (go)
|
||||
if (go != null)
|
||||
PauseTimes = go.GetPauseTimes();
|
||||
|
||||
data.WriteBit(flags.NoBirthAnim);
|
||||
@@ -1205,11 +1205,11 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
Unit target = obj.ToUnit();
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
// Don't allow to detect vehicle accessories if you can't see vehicle
|
||||
Unit vehicle = target.GetVehicleBase();
|
||||
if (vehicle)
|
||||
if (vehicle != null)
|
||||
if (!thisPlayer.HaveAtClient(vehicle))
|
||||
return false;
|
||||
}
|
||||
@@ -1352,7 +1352,7 @@ namespace Game.Entities
|
||||
return true;
|
||||
|
||||
// Only check back for units, it does not make sense for gameobjects
|
||||
if (unit && !HasInArc(MathF.PI, obj))
|
||||
if (unit != null && !HasInArc(MathF.PI, obj))
|
||||
return false;
|
||||
|
||||
// Traps should detect stealth always
|
||||
@@ -1393,7 +1393,7 @@ namespace Game.Entities
|
||||
float visibilityRange = detectionValue * 0.3f + combatReach;
|
||||
|
||||
// If this unit is an NPC then player detect range doesn't apply
|
||||
if (unit && unit.IsTypeId(TypeId.Player) && visibilityRange > SharedConst.MaxPlayerStealthDetectRange)
|
||||
if (unit != null && unit.IsTypeId(TypeId.Player) && visibilityRange > SharedConst.MaxPlayerStealthDetectRange)
|
||||
visibilityRange = SharedConst.MaxPlayerStealthDetectRange;
|
||||
|
||||
// When checking for alert state, look 8% further, and then 1.5 yards more than that.
|
||||
@@ -1402,7 +1402,7 @@ namespace Game.Entities
|
||||
|
||||
// If checking for alert, and creature's visibility range is greater than aggro distance, No alert
|
||||
Unit tunit = obj.ToUnit();
|
||||
if (checkAlert && unit && unit.ToCreature() && visibilityRange >= unit.ToCreature().GetAttackDistance(tunit) + unit.ToCreature().m_CombatDistance)
|
||||
if (checkAlert && unit != null && unit.ToCreature() != null && visibilityRange >= unit.ToCreature().GetAttackDistance(tunit) + unit.ToCreature().m_CombatDistance)
|
||||
return false;
|
||||
|
||||
if (distance > visibilityRange)
|
||||
@@ -1597,7 +1597,7 @@ namespace Game.Entities
|
||||
|
||||
Map map = GetMap();
|
||||
GameObject go = GameObject.CreateGameObject(entry, map, pos, rotation, 255, GameObjectState.Ready);
|
||||
if (!go)
|
||||
if (go == null)
|
||||
return null;
|
||||
|
||||
PhasingHandler.InheritPhaseShift(go, this);
|
||||
@@ -1649,7 +1649,7 @@ namespace Game.Entities
|
||||
foreach (var tempSummonData in data)
|
||||
{
|
||||
TempSummon summon = SummonCreature(tempSummonData.entry, tempSummonData.pos, tempSummonData.type, tempSummonData.time);
|
||||
if (summon)
|
||||
if (summon != null)
|
||||
list.Add(summon);
|
||||
}
|
||||
}
|
||||
@@ -1827,7 +1827,7 @@ namespace Game.Entities
|
||||
if (spellInfo.RangeEntry.RangeMax[0] == spellInfo.RangeEntry.RangeMax[1])
|
||||
return spellInfo.GetMaxRange();
|
||||
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return spellInfo.GetMaxRange(true);
|
||||
|
||||
return spellInfo.GetMaxRange(!IsHostileTo(target));
|
||||
@@ -1841,7 +1841,7 @@ namespace Game.Entities
|
||||
if (spellInfo.RangeEntry.RangeMin[0] == spellInfo.RangeEntry.RangeMin[1])
|
||||
return spellInfo.GetMinRange();
|
||||
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return spellInfo.GetMinRange(true);
|
||||
|
||||
return spellInfo.GetMinRange(!IsHostileTo(target));
|
||||
@@ -1922,7 +1922,7 @@ namespace Game.Entities
|
||||
|
||||
// cut duration only of negative effects
|
||||
Unit unitTarget = target.ToUnit();
|
||||
if (!unitTarget)
|
||||
if (unitTarget == null)
|
||||
return duration;
|
||||
|
||||
if (!positive)
|
||||
@@ -1986,7 +1986,7 @@ namespace Game.Entities
|
||||
modOwner.ApplySpellMod(spellInfo, SpellModOp.ChangeCastTime, ref castTime, spell);
|
||||
|
||||
Unit unitCaster = ToUnit();
|
||||
if (!unitCaster)
|
||||
if (unitCaster == null)
|
||||
return;
|
||||
|
||||
if (unitCaster.IsPlayer() && unitCaster.ToPlayer().GetCommandStatus(PlayerCommandStates.Casttime))
|
||||
@@ -2013,7 +2013,7 @@ namespace Game.Entities
|
||||
modOwner.ApplySpellMod(spellInfo, SpellModOp.ChangeCastTime, ref duration, spell);
|
||||
|
||||
Unit unitCaster = ToUnit();
|
||||
if (!unitCaster)
|
||||
if (unitCaster == null)
|
||||
return;
|
||||
|
||||
if (!(spellInfo.HasAttribute(SpellAttr0.IsAbility) || spellInfo.HasAttribute(SpellAttr0.IsTradeskill) || spellInfo.HasAttribute(SpellAttr3.IgnoreCasterModifiers)) &&
|
||||
@@ -2227,7 +2227,7 @@ namespace Game.Entities
|
||||
|
||||
bool isAttackableBySummoner(Unit me, ObjectGuid targetGuid)
|
||||
{
|
||||
if (!me)
|
||||
if (me == null)
|
||||
return false;
|
||||
|
||||
TempSummon tempSummon = me.ToTempSummon();
|
||||
@@ -2252,7 +2252,7 @@ namespace Game.Entities
|
||||
Player targetPlayerOwner = target.GetAffectingPlayer();
|
||||
|
||||
// check forced reputation to support SPELL_AURA_FORCE_REACTION
|
||||
if (selfPlayerOwner)
|
||||
if (selfPlayerOwner != null)
|
||||
{
|
||||
var targetFactionTemplateEntry = target.GetFactionTemplateEntry();
|
||||
if (targetFactionTemplateEntry != null)
|
||||
@@ -2262,7 +2262,7 @@ namespace Game.Entities
|
||||
return repRank;
|
||||
}
|
||||
}
|
||||
else if (targetPlayerOwner)
|
||||
else if (targetPlayerOwner != null)
|
||||
{
|
||||
var selfFactionTemplateEntry = GetFactionTemplateEntry();
|
||||
if (selfFactionTemplateEntry != null)
|
||||
@@ -2275,11 +2275,11 @@ namespace Game.Entities
|
||||
|
||||
Unit unit = ToUnit() ?? selfPlayerOwner;
|
||||
Unit targetUnit = target.ToUnit() ?? targetPlayerOwner;
|
||||
if (unit && unit.HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
if (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
{
|
||||
if (targetUnit && targetUnit.HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
if (targetUnit != null && targetUnit.HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
{
|
||||
if (selfPlayerOwner && targetPlayerOwner)
|
||||
if (selfPlayerOwner != null && targetPlayerOwner != null)
|
||||
{
|
||||
// always friendly to other unit controlled by player, or to the player himself
|
||||
if (selfPlayerOwner == targetPlayerOwner)
|
||||
@@ -2300,7 +2300,7 @@ namespace Game.Entities
|
||||
if (unit.IsFFAPvP() && targetUnit.IsFFAPvP())
|
||||
return ReputationRank.Hostile;
|
||||
|
||||
if (selfPlayerOwner)
|
||||
if (selfPlayerOwner != null)
|
||||
{
|
||||
var targetFactionTemplateEntry = targetUnit.GetFactionTemplateEntry();
|
||||
if (targetFactionTemplateEntry != null)
|
||||
@@ -2605,7 +2605,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// CvC case - can attack each other only when one of them is hostile
|
||||
if (unit && !unit.HasUnitFlag(UnitFlags.PlayerControlled) && unitTarget != null && !unitTarget.HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
if (unit != null && !unit.HasUnitFlag(UnitFlags.PlayerControlled) && unitTarget != null && !unitTarget.HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
return IsHostileTo(unitTarget) || unitTarget.IsHostileTo(this);
|
||||
|
||||
// Traps without owner or with NPC owner versus Creature case - can attack to creature only when one of them is hostile
|
||||
@@ -2613,7 +2613,7 @@ namespace Game.Entities
|
||||
{
|
||||
Unit goOwner = go.GetOwner();
|
||||
if (goOwner == null || !goOwner.HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
if (unitTarget && !unitTarget.HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
if (unitTarget != null && !unitTarget.HasUnitFlag(UnitFlags.PlayerControlled))
|
||||
return IsHostileTo(unitTarget) || unitTarget.IsHostileTo(this);
|
||||
}
|
||||
|
||||
@@ -2630,10 +2630,10 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
// Not all neutral creatures can be attacked (even some unfriendly faction does not react aggresive to you, like Sporaggar)
|
||||
if ((playerAffectingAttacker && !playerAffectingTarget) || (!playerAffectingAttacker && playerAffectingTarget))
|
||||
if ((playerAffectingAttacker != null && playerAffectingTarget == null) || (playerAffectingAttacker == null && playerAffectingTarget != null))
|
||||
{
|
||||
Player player = playerAffectingAttacker ? playerAffectingAttacker : playerAffectingTarget;
|
||||
Unit creature = playerAffectingAttacker ? unitTarget : unit;
|
||||
Player player = playerAffectingAttacker != null ? playerAffectingAttacker : playerAffectingTarget;
|
||||
Unit creature = playerAffectingAttacker != null ? unitTarget : unit;
|
||||
if (creature != null)
|
||||
{
|
||||
if (creature.IsContestedGuard() && player.HasPlayerFlag(PlayerFlags.ContestedPVP))
|
||||
@@ -2658,7 +2658,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
if (playerAffectingAttacker && playerAffectingTarget)
|
||||
if (playerAffectingAttacker != null && playerAffectingTarget != null)
|
||||
if (playerAffectingAttacker.duel != null && playerAffectingAttacker.duel.Opponent == playerAffectingTarget && playerAffectingAttacker.duel.State == DuelState.InProgress)
|
||||
return true;
|
||||
|
||||
@@ -2668,7 +2668,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
// additional checks - only PvP case
|
||||
if (playerAffectingAttacker && playerAffectingTarget)
|
||||
if (playerAffectingAttacker != null && playerAffectingTarget != null)
|
||||
{
|
||||
if (playerAffectingTarget.IsPvP() || (bySpell != null && bySpell.HasAttribute(SpellAttr5.IgnoreAreaEffectPvpCheck)))
|
||||
return true;
|
||||
@@ -2686,7 +2686,7 @@ namespace Game.Entities
|
||||
// function based on function Unit::CanAssist from 13850 client
|
||||
public bool IsValidAssistTarget(WorldObject target, SpellInfo bySpell = null, bool spellCheck = true)
|
||||
{
|
||||
Cypher.Assert(target);
|
||||
Cypher.Assert(target != null);
|
||||
|
||||
// some negative spells can be casted at friendly target
|
||||
bool isNegativeSpell = bySpell != null && !bySpell.IsPositive();
|
||||
@@ -2697,7 +2697,7 @@ namespace Game.Entities
|
||||
|
||||
// can't assist unattackable units
|
||||
Unit unitTarget = target.ToUnit();
|
||||
if (unitTarget && unitTarget.HasUnitState(UnitState.Unattackable))
|
||||
if (unitTarget != null && unitTarget.HasUnitState(UnitState.Unattackable))
|
||||
return false;
|
||||
|
||||
// can't assist GMs
|
||||
@@ -2706,7 +2706,7 @@ namespace Game.Entities
|
||||
|
||||
// can't assist own vehicle or passenger
|
||||
Unit unit = ToUnit();
|
||||
if (unit && unitTarget && unit.GetVehicle())
|
||||
if (unit != null && unitTarget != null && unit.GetVehicle() != null)
|
||||
{
|
||||
if (unit.IsOnVehicle(unitTarget))
|
||||
return false;
|
||||
@@ -2720,7 +2720,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
// can't assist dead
|
||||
if ((bySpell == null || !bySpell.IsAllowingDeadTarget()) && unitTarget && !unitTarget.IsAlive())
|
||||
if ((bySpell == null || !bySpell.IsAllowingDeadTarget()) && unitTarget != null && !unitTarget.IsAlive())
|
||||
return false;
|
||||
|
||||
// can't assist untargetable
|
||||
@@ -2750,7 +2750,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// can't assist non-friendly targets
|
||||
if (GetReactionTo(target) < ReputationRank.Neutral && target.GetReactionTo(this) < ReputationRank.Neutral && (!ToCreature() || !ToCreature().HasFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells)))
|
||||
if (GetReactionTo(target) < ReputationRank.Neutral && target.GetReactionTo(this) < ReputationRank.Neutral && (!IsCreature() || !ToCreature().HasFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells)))
|
||||
return false;
|
||||
|
||||
// PvP case
|
||||
@@ -2934,7 +2934,7 @@ namespace Game.Entities
|
||||
public void PlayDirectSound(uint soundId, Player target = null, uint broadcastTextId = 0)
|
||||
{
|
||||
PlaySound sound = new(GetGUID(), soundId, broadcastTextId);
|
||||
if (target)
|
||||
if (target != null)
|
||||
target.SendPacket(sound);
|
||||
else
|
||||
SendMessageToSet(sound, true);
|
||||
@@ -2942,7 +2942,7 @@ namespace Game.Entities
|
||||
|
||||
public void PlayDirectMusic(uint musicId, Player target = null)
|
||||
{
|
||||
if (target)
|
||||
if (target != null)
|
||||
target.SendPacket(new PlayMusic(musicId));
|
||||
else
|
||||
SendMessageToSet(new PlayMusic(musicId), true);
|
||||
@@ -2957,7 +2957,7 @@ namespace Game.Entities
|
||||
pkt.Position = GetPosition();
|
||||
pkt.BroadcastTextID = broadcastTextId;
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
target.SendPacket(pkt);
|
||||
else
|
||||
SendMessageToSet(pkt, true);
|
||||
@@ -3232,7 +3232,7 @@ namespace Game.Entities
|
||||
|
||||
public bool IsWithinDistInMap(WorldObject obj, float dist2compare, bool is3D = true, bool incOwnRadius = true, bool incTargetRadius = true)
|
||||
{
|
||||
return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D, incOwnRadius, incTargetRadius);
|
||||
return obj != null && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D, incOwnRadius, incTargetRadius);
|
||||
}
|
||||
|
||||
public bool IsWithinLOS(float ox, float oy, float oz, LineOfSightChecks checks = LineOfSightChecks.All, ModelIgnoreFlags ignoreFlags = ModelIgnoreFlags.Nothing)
|
||||
@@ -3348,7 +3348,7 @@ namespace Game.Entities
|
||||
|
||||
public bool IsInBetween(WorldObject obj1, WorldObject obj2, float size = 0)
|
||||
{
|
||||
return obj1 && obj2 && IsInBetween(obj1.GetPosition(), obj2.GetPosition(), size);
|
||||
return obj1 != null && obj2 != null && IsInBetween(obj1.GetPosition(), obj2.GetPosition(), size);
|
||||
}
|
||||
|
||||
public bool IsInBetween(Position pos1, Position pos2, float size)
|
||||
@@ -3480,7 +3480,7 @@ namespace Game.Entities
|
||||
{
|
||||
float effectiveReach = GetCombatReach();
|
||||
|
||||
if (searcher)
|
||||
if (searcher != null)
|
||||
{
|
||||
effectiveReach += searcher.GetCombatReach();
|
||||
|
||||
@@ -3796,11 +3796,6 @@ namespace Game.Entities
|
||||
public FlaggedArray32<ServerSideVisibilityType> m_serverSideVisibility = new(2);
|
||||
public FlaggedArray32<ServerSideVisibilityType> m_serverSideVisibilityDetect = new(2);
|
||||
#endregion
|
||||
|
||||
public static implicit operator bool(WorldObject obj)
|
||||
{
|
||||
return obj != null;
|
||||
}
|
||||
}
|
||||
|
||||
public class MovementInfo
|
||||
|
||||
@@ -709,7 +709,7 @@ namespace Game.Entities
|
||||
|
||||
public bool CreateBaseAtCreature(Creature creature)
|
||||
{
|
||||
Cypher.Assert(creature);
|
||||
Cypher.Assert(creature != null);
|
||||
|
||||
if (!CreateBaseAtTamed(creature.GetCreatureTemplate(), creature.GetMap()))
|
||||
return false;
|
||||
@@ -1251,7 +1251,7 @@ namespace Game.Entities
|
||||
{
|
||||
// need update action bar for last removed rank
|
||||
Unit owner = GetOwner();
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
if (owner.IsTypeId(TypeId.Player))
|
||||
owner.ToPlayer().PetSpellInitialize();
|
||||
}
|
||||
@@ -1356,7 +1356,7 @@ namespace Game.Entities
|
||||
|
||||
public bool Create(ulong guidlow, Map map, uint entry, uint petNumber)
|
||||
{
|
||||
Cypher.Assert(map);
|
||||
Cypher.Assert(map != null);
|
||||
SetMap(map);
|
||||
|
||||
// TODO: counter should be constructed as (summon_count << 32) | petNumber
|
||||
@@ -1458,7 +1458,7 @@ namespace Game.Entities
|
||||
public void SynchronizeLevelWithOwner()
|
||||
{
|
||||
Unit owner = GetOwner();
|
||||
if (!owner || !owner.IsTypeId(TypeId.Player))
|
||||
if (owner == null || !owner.IsTypeId(TypeId.Player))
|
||||
return;
|
||||
|
||||
switch (GetPetType())
|
||||
@@ -1534,7 +1534,7 @@ namespace Game.Entities
|
||||
public GroupUpdatePetFlags GetGroupUpdateFlag() { return m_groupUpdateMask; }
|
||||
public void SetGroupUpdateFlag(GroupUpdatePetFlags flag)
|
||||
{
|
||||
if (GetOwner().GetGroup())
|
||||
if (GetOwner().GetGroup() != null)
|
||||
{
|
||||
m_groupUpdateMask |= flag;
|
||||
GetOwner().SetGroupUpdateFlag(GroupUpdateFlags.Pet);
|
||||
@@ -1543,7 +1543,7 @@ namespace Game.Entities
|
||||
public void ResetGroupUpdateFlag()
|
||||
{
|
||||
m_groupUpdateMask = GroupUpdatePetFlags.None;
|
||||
if (GetOwner().GetGroup())
|
||||
if (GetOwner().GetGroup() != null)
|
||||
GetOwner().RemoveGroupUpdateFlag(GroupUpdateFlags.Pet);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Game.Entities
|
||||
|
||||
player.GetMap().LoadGridForActiveObject(pos.GetPositionX(), pos.GetPositionY(), player);
|
||||
m_CinematicObject = player.SummonCreature(1, pos.posX, pos.posY, pos.posZ, 0.0f, TempSummonType.TimedDespawn, TimeSpan.FromMinutes(5));
|
||||
if (m_CinematicObject)
|
||||
if (m_CinematicObject != null)
|
||||
{
|
||||
m_CinematicObject.SetActive(true);
|
||||
player.SetViewpoint(m_CinematicObject, true);
|
||||
@@ -89,10 +89,10 @@ namespace Game.Entities
|
||||
m_cinematicCamera = null;
|
||||
m_activeCinematic = null;
|
||||
m_activeCinematicCameraIndex = -1;
|
||||
if (m_CinematicObject)
|
||||
if (m_CinematicObject != null)
|
||||
{
|
||||
WorldObject vpObject = player.GetViewpoint();
|
||||
if (vpObject)
|
||||
if (vpObject != null)
|
||||
if (vpObject == m_CinematicObject)
|
||||
player.SetViewpoint(m_CinematicObject, false);
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace Game.Entities
|
||||
|
||||
// Advance (at speed) to this position. The remote sight object is used
|
||||
// to send update information to player in cinematic
|
||||
if (m_CinematicObject && interPosition.IsPositionValid())
|
||||
if (m_CinematicObject != null && interPosition.IsPositionValid())
|
||||
m_CinematicObject.MonsterMoveWithSpeed(interPosition.posX, interPosition.posY, interPosition.posZ, 500.0f, false, true);
|
||||
|
||||
// If we never received an end packet 10 seconds after the final timestamp then force an end
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Game.Entities
|
||||
public void UpgradeHeirloom(uint itemId, uint castItem)
|
||||
{
|
||||
Player player = _owner.GetPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
HeirloomRecord heirloom = Global.DB2Mgr.GetHeirloomByItemId(itemId);
|
||||
@@ -275,7 +275,7 @@ namespace Game.Entities
|
||||
public void CheckHeirloomUpgrades(Item item)
|
||||
{
|
||||
Player player = _owner.GetPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
// Check already owned heirloom for upgrade kits
|
||||
@@ -292,7 +292,7 @@ namespace Game.Entities
|
||||
HeirloomRecord heirloomDiff;
|
||||
while ((heirloomDiff = Global.DB2Mgr.GetHeirloomByItemId(heirloomItemId)) != null)
|
||||
{
|
||||
if (player.GetItemByEntry(heirloomDiff.ItemID))
|
||||
if (player.GetItemByEntry(heirloomDiff.ItemID) != null)
|
||||
newItemId = heirloomDiff.ItemID;
|
||||
|
||||
HeirloomRecord heirloomSub = Global.DB2Mgr.GetHeirloomByItemId(heirloomDiff.StaticUpgradedItemID);
|
||||
@@ -372,7 +372,7 @@ namespace Game.Entities
|
||||
public bool AddMount(uint spellId, MountStatusFlags flags, bool factionMount = false, bool learned = false)
|
||||
{
|
||||
Player player = _owner.GetPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
MountRecord mount = Global.DB2Mgr.GetMount(spellId);
|
||||
@@ -420,7 +420,7 @@ namespace Game.Entities
|
||||
void SendSingleMountUpdate(uint spellId, MountStatusFlags mountStatusFlags)
|
||||
{
|
||||
Player player = _owner.GetPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
AccountMountUpdate mountUpdate = new();
|
||||
@@ -592,7 +592,7 @@ namespace Game.Entities
|
||||
if (itemTemplate == null)
|
||||
return false;
|
||||
|
||||
if (!_owner.GetPlayer())
|
||||
if (_owner.GetPlayer() == null)
|
||||
return false;
|
||||
|
||||
if (_owner.GetPlayer().CanUseItem(itemTemplate) != InventoryResult.Ok)
|
||||
|
||||
@@ -129,14 +129,14 @@ namespace Game.Entities
|
||||
// 2.4. _maxNotGrayMember - maximum level of alive group member within reward distance,
|
||||
// for whom victim is not gray;
|
||||
uint grayLevel = Formulas.GetGrayLevel(lvl);
|
||||
if (_victim.GetLevelForTarget(member) > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember.GetLevel() < lvl))
|
||||
if (_victim.GetLevelForTarget(member) > grayLevel && (_maxNotGrayMember == null || _maxNotGrayMember.GetLevel() < lvl))
|
||||
_maxNotGrayMember = member;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 2.5. _isFullXP - flag identifying that for all group members victim is not gray,
|
||||
// so 100% XP will be rewarded (50% otherwise).
|
||||
_isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember.GetLevel());
|
||||
_isFullXP = _maxNotGrayMember != null && (_maxLevel == _maxNotGrayMember.GetLevel());
|
||||
}
|
||||
else
|
||||
_count = 1;
|
||||
@@ -185,7 +185,7 @@ namespace Game.Entities
|
||||
// 4.2.3. Give XP to player.
|
||||
player.GiveXP(xp, _victim, _groupRate);
|
||||
Pet pet = player.GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
// 4.2.4. If player has pet, reward pet with XP (100% for single player, 50% for group case).
|
||||
pet.GivePetXP(player.GetGroup() != null ? xp / 2 : xp);
|
||||
}
|
||||
@@ -264,7 +264,7 @@ namespace Game.Entities
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player member = refe.GetSource();
|
||||
if (member)
|
||||
if (member != null)
|
||||
{
|
||||
// Killer may not be at reward distance, check directly
|
||||
if (killer == member || member.IsAtGroupRewardDistance(_victim))
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Game.Entities
|
||||
scenario.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, refe, this);
|
||||
|
||||
Guild guild = Global.GuildMgr.GetGuildById(GetGuildId());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.UpdateCriteria(type, miscValue1, miscValue2, miscValue3, refe, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,19 +38,19 @@ namespace Game.Entities
|
||||
|
||||
// prepare data for near group iteration
|
||||
Group group = GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player player = refe.GetSource();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
if (!player.IsAtGroupRewardDistance(pRewardSource))
|
||||
continue; // member (alive or dead) or his corpse at req. distance
|
||||
|
||||
// quest objectives updated only for alive group member or dead but with not released body
|
||||
if (player.IsAlive() || !player.GetCorpse())
|
||||
if (player.IsAlive() || player.GetCorpse() == null)
|
||||
player.KilledMonsterCredit(creature_id, creature_guid);
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ namespace Game.Entities
|
||||
bool IsTwoHandUsed()
|
||||
{
|
||||
Item mainItem = GetItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand);
|
||||
if (!mainItem)
|
||||
if (mainItem == null)
|
||||
return false;
|
||||
|
||||
ItemTemplate itemTemplate = mainItem.GetTemplate();
|
||||
@@ -259,14 +259,14 @@ namespace Game.Entities
|
||||
bool IsUsingTwoHandedWeaponInOneHand()
|
||||
{
|
||||
Item offItem = GetItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand);
|
||||
if (offItem && offItem.GetTemplate().GetInventoryType() == InventoryType.Weapon2Hand)
|
||||
if (offItem != null && offItem.GetTemplate().GetInventoryType() == InventoryType.Weapon2Hand)
|
||||
return true;
|
||||
|
||||
Item mainItem = GetItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand);
|
||||
if (!mainItem || mainItem.GetTemplate().GetInventoryType() == InventoryType.Weapon2Hand)
|
||||
if (mainItem == null || mainItem.GetTemplate().GetInventoryType() == InventoryType.Weapon2Hand)
|
||||
return false;
|
||||
|
||||
if (!offItem)
|
||||
if (offItem == null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -390,7 +390,7 @@ namespace Game.Entities
|
||||
|
||||
ObjectGuid duelFlagGUID = m_playerData.DuelArbiter;
|
||||
GameObject obj = GetMap().GetGameObject(duelFlagGUID);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
return;
|
||||
|
||||
if (duel.OutOfBoundsTime == 0)
|
||||
@@ -494,7 +494,7 @@ namespace Game.Entities
|
||||
|
||||
//Remove Duel Flag object
|
||||
GameObject obj = GetMap().GetGameObject(m_playerData.DuelArbiter);
|
||||
if (obj)
|
||||
if (obj != null)
|
||||
duel.Initiator.RemoveGameObject(obj, true);
|
||||
|
||||
//remove auras
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Game.Entities
|
||||
if (item.HasItemFlag(ItemFieldFlags.Child))
|
||||
{
|
||||
Item parent = GetItemByGuid(item.GetCreator());
|
||||
if (parent)
|
||||
if (parent != null)
|
||||
{
|
||||
parent.SetChildItem(item.GetGUID());
|
||||
item.CopyArtifactDataFromParent(parent);
|
||||
@@ -1468,7 +1468,7 @@ namespace Game.Entities
|
||||
if (!result.IsEmpty())
|
||||
{
|
||||
Group group = Global.GroupMgr.GetGroupByDbStoreId(result.Read<uint>(0));
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
if (group.IsLeader(GetGUID()))
|
||||
SetPlayerFlag(PlayerFlags.GroupLeader);
|
||||
@@ -1485,7 +1485,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
if (!GetGroup() || !GetGroup().IsLeader(GetGUID()))
|
||||
if (GetGroup() == null || !GetGroup().IsLeader(GetGUID()))
|
||||
RemovePlayerFlag(PlayerFlags.GroupLeader);
|
||||
}
|
||||
void _LoadInstanceTimeRestrictions(SQLResult result)
|
||||
@@ -1777,7 +1777,7 @@ namespace Game.Entities
|
||||
case ItemUpdateState.Changed:
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_INVENTORY_ITEM);
|
||||
stmt.AddValue(0, GetGUID().GetCounter());
|
||||
stmt.AddValue(1, container ? container.GetGUID().GetCounter() : 0);
|
||||
stmt.AddValue(1, container != null ? container.GetGUID().GetCounter() : 0);
|
||||
stmt.AddValue(2, item.GetSlot());
|
||||
stmt.AddValue(3, item.GetGUID().GetCounter());
|
||||
trans.Append(stmt);
|
||||
@@ -3090,7 +3090,7 @@ namespace Game.Entities
|
||||
mapId = transportOnMap.GetExpectedMapId();
|
||||
instanceId = 0;
|
||||
transportMap = Global.MapMgr.CreateMap(mapId, this);
|
||||
if (transportMap)
|
||||
if (transportMap != null)
|
||||
transport = transportMap.GetTransport(transGUID);
|
||||
}
|
||||
else
|
||||
@@ -3098,7 +3098,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
if (transport)
|
||||
if (transport != null)
|
||||
{
|
||||
float x = trans_x;
|
||||
float y = trans_y;
|
||||
@@ -3201,13 +3201,13 @@ namespace Game.Entities
|
||||
|
||||
// NOW player must have valid map
|
||||
// load the player's map here if it's not already loaded
|
||||
if (!map)
|
||||
if (map == null)
|
||||
map = Global.MapMgr.CreateMap(mapId, this);
|
||||
|
||||
AreaTriggerStruct areaTrigger = null;
|
||||
bool check = false;
|
||||
|
||||
if (!map)
|
||||
if (map == null)
|
||||
{
|
||||
areaTrigger = Global.ObjectMgr.GetGoBackTrigger(mapId);
|
||||
check = true;
|
||||
@@ -3241,11 +3241,11 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
if (!map)
|
||||
if (map == null)
|
||||
{
|
||||
RelocateToHomebind();
|
||||
map = Global.MapMgr.CreateMap(mapId, this);
|
||||
if (!map)
|
||||
if (map == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "Player {0} {1} Map: {2}, {3}. Invalid default map coordinates or instance couldn't be created.", GetName(), guid.ToString(), mapId, GetPosition());
|
||||
return false;
|
||||
@@ -3960,7 +3960,7 @@ namespace Game.Entities
|
||||
|
||||
// save pet (hunter pet level and experience and all type pets health/mana).
|
||||
Pet pet = GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.SavePetToDB(PetSaveMode.AsCurrent);
|
||||
}
|
||||
void DeleteSpellFromAllPlayers(uint spellId)
|
||||
@@ -4060,7 +4060,7 @@ namespace Game.Entities
|
||||
if (guildId != 0)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildById(guildId);
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.DeleteMember(trans, playerGuid, false, false, true);
|
||||
}
|
||||
|
||||
@@ -4075,7 +4075,7 @@ namespace Game.Entities
|
||||
if (!resultGroup.IsEmpty())
|
||||
{
|
||||
Group group = Global.GroupMgr.GetGroupByDbStoreId(resultGroup.Read<uint>(0));
|
||||
if (group)
|
||||
if (group != null)
|
||||
RemoveFromGroup(group, playerGuid);
|
||||
}
|
||||
|
||||
@@ -4215,7 +4215,7 @@ namespace Game.Entities
|
||||
do
|
||||
{
|
||||
Player playerFriend = Global.ObjAccessor.FindPlayer(ObjectGuid.Create(HighGuid.Player, resultFriends.Read<ulong>(0)));
|
||||
if (playerFriend)
|
||||
if (playerFriend != null)
|
||||
{
|
||||
playerFriend.GetSocial().RemoveFromSocialList(playerGuid, SocialFlag.All);
|
||||
Global.SocialMgr.SendFriendStatus(playerFriend, FriendsResult.Removed, playerGuid);
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Game.Entities
|
||||
Player GetNextRandomRaidMember(float radius)
|
||||
{
|
||||
Group group = GetGroup();
|
||||
if (!group)
|
||||
if (group == null)
|
||||
return null;
|
||||
|
||||
List<Player> nearMembers = new();
|
||||
@@ -23,7 +23,7 @@ namespace Game.Entities
|
||||
Player Target = refe.GetSource();
|
||||
|
||||
// IsHostileTo check duel and controlled by enemy
|
||||
if (Target && Target != this && IsWithinDistInMap(Target, radius) &&
|
||||
if (Target != null && Target != this && IsWithinDistInMap(Target, radius) &&
|
||||
!Target.HasInvisibilityAura() && !IsHostileTo(Target))
|
||||
nearMembers.Add(Target);
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace Game.Entities
|
||||
public PartyResult CanUninviteFromGroup(ObjectGuid guidMember, byte? partyIndex)
|
||||
{
|
||||
Group grp = GetGroup(partyIndex);
|
||||
if (!grp)
|
||||
if (grp == null)
|
||||
return PartyResult.NotInGroup;
|
||||
|
||||
if (grp.IsLFGGroup())
|
||||
@@ -63,7 +63,7 @@ namespace Game.Entities
|
||||
|
||||
// @todo Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer.
|
||||
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
if (refe.GetSource() && refe.GetSource().IsInMap(this) && refe.GetSource().IsInCombat())
|
||||
if (refe.GetSource() != null && refe.GetSource().IsInMap(this) && refe.GetSource().IsInCombat())
|
||||
return PartyResult.PartyLfgBootInCombat;
|
||||
|
||||
/* Missing support for these types
|
||||
@@ -117,7 +117,7 @@ namespace Game.Entities
|
||||
//remove existing reference
|
||||
m_group.Unlink();
|
||||
Group group = GetOriginalGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
m_group.Link(group, this);
|
||||
m_group.SetSubGroup(GetOriginalSubGroup());
|
||||
@@ -127,7 +127,7 @@ namespace Game.Entities
|
||||
|
||||
public void SetOriginalGroup(Group group, byte subgroup = 0)
|
||||
{
|
||||
if (!group)
|
||||
if (group == null)
|
||||
m_originalGroup.Unlink();
|
||||
else
|
||||
{
|
||||
@@ -162,7 +162,7 @@ namespace Game.Entities
|
||||
return group;
|
||||
|
||||
Group originalGroup = GetOriginalGroup();
|
||||
if (originalGroup && originalGroup.GetGroupCategory() == category)
|
||||
if (originalGroup != null && originalGroup.GetGroupCategory() == category)
|
||||
return originalGroup;
|
||||
|
||||
return null;
|
||||
@@ -170,7 +170,7 @@ namespace Game.Entities
|
||||
|
||||
public void SetGroup(Group group, byte subgroup = 0)
|
||||
{
|
||||
if (!group)
|
||||
if (group == null)
|
||||
m_group.Unlink();
|
||||
else
|
||||
{
|
||||
@@ -207,11 +207,11 @@ namespace Game.Entities
|
||||
|
||||
public bool IsAtGroupRewardDistance(WorldObject pRewardSource)
|
||||
{
|
||||
if (!pRewardSource || !IsInMap(pRewardSource))
|
||||
if (pRewardSource == null || !IsInMap(pRewardSource))
|
||||
return false;
|
||||
|
||||
WorldObject player = GetCorpse();
|
||||
if (!player || IsAlive())
|
||||
if (player == null || IsAlive())
|
||||
player = this;
|
||||
|
||||
if (player.GetMap().IsDungeon())
|
||||
@@ -259,7 +259,7 @@ namespace Game.Entities
|
||||
}
|
||||
public bool IsInSameGroupWith(Player p)
|
||||
{
|
||||
return p == this || (GetGroup() &&
|
||||
return p == this || (GetGroup() != null &&
|
||||
GetGroup() == p.GetGroup() && GetGroup().SameSubGroup(this, p));
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ namespace Game.Entities
|
||||
public void UninviteFromGroup()
|
||||
{
|
||||
Group group = GetGroupInvite();
|
||||
if (!group)
|
||||
if (group == null)
|
||||
return;
|
||||
|
||||
group.RemoveInvite(this);
|
||||
@@ -291,7 +291,7 @@ namespace Game.Entities
|
||||
public void RemoveFromGroup(RemoveMethod method = RemoveMethod.Default) { RemoveFromGroup(GetGroup(), GetGUID(), method); }
|
||||
public static void RemoveFromGroup(Group group, ObjectGuid guid, RemoveMethod method = RemoveMethod.Default, ObjectGuid kicker = default, string reason = null)
|
||||
{
|
||||
if (!group)
|
||||
if (group == null)
|
||||
return;
|
||||
|
||||
group.RemoveMember(guid, method, kicker, reason);
|
||||
@@ -302,13 +302,13 @@ namespace Game.Entities
|
||||
if (m_groupUpdateMask == GroupUpdateFlags.None)
|
||||
return;
|
||||
Group group = GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
group.UpdatePlayerOutOfRange(this);
|
||||
|
||||
m_groupUpdateMask = GroupUpdateFlags.None;
|
||||
|
||||
Pet pet = GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.ResetGroupUpdateFlag();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace Game.Entities
|
||||
foreach (var guid in m_itemSoulboundTradeable.ToList())
|
||||
{
|
||||
Item item = GetItemByGuid(guid);
|
||||
if (!item || item.GetOwnerGUID() != GetGUID() || item.CheckSoulboundTradeExpire())
|
||||
if (item == null || item.GetOwnerGUID() != GetGUID() || item.CheckSoulboundTradeExpire())
|
||||
m_itemSoulboundTradeable.Remove(guid);
|
||||
}
|
||||
}
|
||||
@@ -637,7 +637,7 @@ namespace Game.Entities
|
||||
// search free slot in bag for place to
|
||||
if (bag == InventorySlots.Bag0) // inventory
|
||||
{
|
||||
if (pItem && pItem.HasItemFlag(ItemFieldFlags.Child))
|
||||
if (pItem != null && pItem.HasItemFlag(ItemFieldFlags.Child))
|
||||
{
|
||||
res = CanStoreItem_InInventorySlots(InventorySlots.ChildEquipmentStart, InventorySlots.ChildEquipmentEnd, dest, pProto, ref count, false, pItem, bag, slot);
|
||||
if (res != InventoryResult.Ok)
|
||||
@@ -791,7 +791,7 @@ namespace Game.Entities
|
||||
if (pItem != null && pItem.IsNotEmptyBag())
|
||||
return InventoryResult.BagInBag;
|
||||
|
||||
if (pItem && pItem.HasItemFlag(ItemFieldFlags.Child))
|
||||
if (pItem != null && pItem.HasItemFlag(ItemFieldFlags.Child))
|
||||
{
|
||||
res = CanStoreItem_InInventorySlots(InventorySlots.ChildEquipmentStart, InventorySlots.ChildEquipmentEnd, dest, pProto, ref count, false, pItem, bag, slot);
|
||||
if (res != InventoryResult.Ok)
|
||||
@@ -813,7 +813,7 @@ namespace Game.Entities
|
||||
// search free slot
|
||||
byte searchSlotStart = InventorySlots.ItemStart;
|
||||
// new bags can be directly equipped
|
||||
if (!pItem && pProto.GetClass() == ItemClass.Container && (ItemSubClassContainer)pProto.GetSubClass() == ItemSubClassContainer.Container &&
|
||||
if (pItem == null && pProto.GetClass() == ItemClass.Container && (ItemSubClassContainer)pProto.GetSubClass() == ItemSubClassContainer.Container &&
|
||||
(pProto.GetBonding() == ItemBondingType.None || pProto.GetBonding() == ItemBondingType.OnAcquire))
|
||||
searchSlotStart = InventorySlots.BagStart;
|
||||
|
||||
@@ -874,7 +874,7 @@ namespace Game.Entities
|
||||
{
|
||||
// build items in stock backpack
|
||||
item2 = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (item2 && !item2.IsInTrade())
|
||||
if (item2 != null && !item2.IsInTrade())
|
||||
{
|
||||
inventoryCounts[i - InventorySlots.ItemStart] = item2.GetCount();
|
||||
inventoryPointers[i - InventorySlots.ItemStart] = item2;
|
||||
@@ -884,7 +884,7 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.BagStart; i < InventorySlots.BagEnd; i++)
|
||||
{
|
||||
Bag pBag = GetBagByPos(i);
|
||||
if (pBag)
|
||||
if (pBag != null)
|
||||
{
|
||||
bagCounts[i - InventorySlots.BagStart] = new uint[ItemConst.MaxBagSize];
|
||||
bagPointers[i - InventorySlots.BagStart] = new Item[ItemConst.MaxBagSize];
|
||||
@@ -892,7 +892,7 @@ namespace Game.Entities
|
||||
{
|
||||
// build item counts in equippable bags
|
||||
item2 = GetItemByPos(i, j);
|
||||
if (item2 && !item2.IsInTrade())
|
||||
if (item2 != null && !item2.IsInTrade())
|
||||
{
|
||||
bagCounts[i - InventorySlots.BagStart][j] = item2.GetCount();
|
||||
bagPointers[i - InventorySlots.BagStart][j] = item2;
|
||||
@@ -908,7 +908,7 @@ namespace Game.Entities
|
||||
Item item = items[k];
|
||||
|
||||
// no item
|
||||
if (!item)
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
uint remaining_count = item.GetCount();
|
||||
@@ -942,7 +942,7 @@ namespace Game.Entities
|
||||
for (byte t = InventorySlots.ItemStart; t < inventoryEnd; ++t)
|
||||
{
|
||||
item2 = inventoryPointers[t - InventorySlots.ItemStart];
|
||||
if (item2 && item2.CanBeMergedPartlyWith(pProto) == InventoryResult.Ok && inventoryCounts[t - InventorySlots.ItemStart] < pProto.GetMaxStackSize())
|
||||
if (item2 != null && item2.CanBeMergedPartlyWith(pProto) == InventoryResult.Ok && inventoryCounts[t - InventorySlots.ItemStart] < pProto.GetMaxStackSize())
|
||||
{
|
||||
inventoryCounts[t - InventorySlots.ItemStart] += remaining_count;
|
||||
remaining_count = inventoryCounts[t - InventorySlots.ItemStart] < pProto.GetMaxStackSize() ? 0 : inventoryCounts[t - InventorySlots.ItemStart] - pProto.GetMaxStackSize();
|
||||
@@ -960,7 +960,7 @@ namespace Game.Entities
|
||||
for (byte t = InventorySlots.BagStart; !b_found && t < InventorySlots.BagEnd; ++t)
|
||||
{
|
||||
Bag bag = GetBagByPos(t);
|
||||
if (bag)
|
||||
if (bag != null)
|
||||
{
|
||||
if (!Item.ItemCanGoIntoBag(item.GetTemplate(), bag.GetTemplate()))
|
||||
continue;
|
||||
@@ -968,7 +968,7 @@ namespace Game.Entities
|
||||
for (byte j = 0; j < bag.GetBagSize(); j++)
|
||||
{
|
||||
item2 = bagPointers[t - InventorySlots.BagStart][j];
|
||||
if (item2 && item2.CanBeMergedPartlyWith(pProto) == InventoryResult.Ok && bagCounts[t - InventorySlots.BagStart][j] < pProto.GetMaxStackSize())
|
||||
if (item2 != null && item2.CanBeMergedPartlyWith(pProto) == InventoryResult.Ok && bagCounts[t - InventorySlots.BagStart][j] < pProto.GetMaxStackSize())
|
||||
{
|
||||
// add count to stack so that later items in the list do not double-book
|
||||
bagCounts[t - InventorySlots.BagStart][j] += remaining_count;
|
||||
@@ -994,7 +994,7 @@ namespace Game.Entities
|
||||
for (byte t = InventorySlots.BagStart; !b_found && t < InventorySlots.BagEnd; ++t)
|
||||
{
|
||||
Bag bag = GetBagByPos(t);
|
||||
if (bag)
|
||||
if (bag != null)
|
||||
{
|
||||
pBagProto = bag.GetTemplate();
|
||||
|
||||
@@ -1042,7 +1042,7 @@ namespace Game.Entities
|
||||
for (byte t = InventorySlots.BagStart; !b_found && t < InventorySlots.BagEnd; ++t)
|
||||
{
|
||||
Bag bag = GetBagByPos(t);
|
||||
if (bag)
|
||||
if (bag != null)
|
||||
{
|
||||
pBagProto = bag.GetTemplate();
|
||||
|
||||
@@ -1292,7 +1292,7 @@ namespace Game.Entities
|
||||
List<ItemPosCount> childDest = new();
|
||||
CanStoreItem_InInventorySlots(InventorySlots.ChildEquipmentStart, InventorySlots.ChildEquipmentEnd, childDest, childTemplate, ref count, false, null, ItemConst.NullBag, ItemConst.NullSlot);
|
||||
Item childItem = StoreNewItem(childDest, childTemplate.GetId(), update, 0, null, context, null, addToCollection);
|
||||
if (childItem)
|
||||
if (childItem != null)
|
||||
{
|
||||
childItem.SetCreator(item.GetGUID());
|
||||
childItem.SetItemFlag(ItemFieldFlags.Child);
|
||||
@@ -1644,13 +1644,13 @@ namespace Game.Entities
|
||||
if (itemChildEquipment != null)
|
||||
{
|
||||
Item childItem = GetChildItemByGuid(parentItem.GetChildItem());
|
||||
if (childItem)
|
||||
if (childItem != null)
|
||||
{
|
||||
ushort childDest = (ushort)((InventorySlots.Bag0 << 8) | itemChildEquipment.ChildItemEquipSlot);
|
||||
if (childItem.GetPos() != childDest)
|
||||
{
|
||||
Item dstItem = GetItemByPos(childDest);
|
||||
if (!dstItem) // empty slot, simple case
|
||||
if (dstItem == null) // empty slot, simple case
|
||||
{
|
||||
RemoveItem(childItem.GetBagSlot(), childItem.GetSlot(), true);
|
||||
EquipItem(childDest, childItem, true);
|
||||
@@ -1722,7 +1722,7 @@ namespace Game.Entities
|
||||
if (Global.DB2Mgr.GetItemChildEquipment(parentItem.GetEntry()) != null)
|
||||
{
|
||||
Item childItem = GetChildItemByGuid(parentItem.GetChildItem());
|
||||
if (childItem)
|
||||
if (childItem != null)
|
||||
{
|
||||
if (IsChildEquipmentPos(childItem.GetPos()))
|
||||
return;
|
||||
@@ -1770,10 +1770,10 @@ namespace Game.Entities
|
||||
|
||||
if (msg != InventoryResult.Ok)
|
||||
{
|
||||
if (item1)
|
||||
if (item1 != null)
|
||||
failure.Item[0] = item1.GetGUID();
|
||||
|
||||
if (item2)
|
||||
if (item2 != null)
|
||||
failure.Item[1] = item2.GetGUID();
|
||||
|
||||
failure.ContainerBSlot = 0; // bag equip slot, used with EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM and EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2
|
||||
@@ -1783,7 +1783,7 @@ namespace Game.Entities
|
||||
case InventoryResult.CantEquipLevelI:
|
||||
case InventoryResult.PurchaseLevelTooLow:
|
||||
{
|
||||
failure.Level = (item1 ? item1.GetRequiredLevel() : 0);
|
||||
failure.Level = (item1 != null ? item1.GetRequiredLevel() : 0);
|
||||
break;
|
||||
}
|
||||
case InventoryResult.EventAutoequipBindConfirm: // no idea about this one...
|
||||
@@ -1797,7 +1797,7 @@ namespace Game.Entities
|
||||
case InventoryResult.ItemMaxLimitCategorySocketedExceededIs:
|
||||
case InventoryResult.ItemMaxLimitCategoryEquippedExceededIs:
|
||||
{
|
||||
ItemTemplate proto = item1 ? item1.GetTemplate() : Global.ObjectMgr.GetItemTemplate(itemId);
|
||||
ItemTemplate proto = item1 != null ? item1.GetTemplate() : Global.ObjectMgr.GetItemTemplate(itemId);
|
||||
failure.LimitCategory = (int)(proto != null ? proto.GetItemLimitCategory() : 0u);
|
||||
break;
|
||||
}
|
||||
@@ -1924,7 +1924,7 @@ namespace Game.Entities
|
||||
byte dstslot = (byte)(dst & 255);
|
||||
|
||||
Item pSrcItem = GetItemByPos(srcbag, srcslot);
|
||||
if (!pSrcItem)
|
||||
if (pSrcItem == null)
|
||||
{
|
||||
SendEquipError(InventoryResult.ItemNotFound, pSrcItem);
|
||||
return;
|
||||
@@ -1962,7 +1962,7 @@ namespace Game.Entities
|
||||
|
||||
Log.outDebug(LogFilter.Player, "STORAGE: SplitItem bag = {0}, slot = {1}, item = {2}, count = {3}", dstbag, dstslot, pSrcItem.GetEntry(), count);
|
||||
Item pNewItem = pSrcItem.CloneItem(count, this);
|
||||
if (!pNewItem)
|
||||
if (pNewItem == null)
|
||||
{
|
||||
SendEquipError(InventoryResult.ItemNotFound, pSrcItem);
|
||||
return;
|
||||
@@ -2044,7 +2044,7 @@ namespace Game.Entities
|
||||
if (pSrcItem.HasItemFlag(ItemFieldFlags.Child))
|
||||
{
|
||||
Item parentItem = GetItemByGuid(pSrcItem.m_itemData.Creator);
|
||||
if (parentItem)
|
||||
if (parentItem != null)
|
||||
{
|
||||
if (IsEquipmentPos(src))
|
||||
{
|
||||
@@ -2055,10 +2055,10 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pDstItem && pDstItem.HasItemFlag(ItemFieldFlags.Child))
|
||||
else if (pDstItem != null && pDstItem.HasItemFlag(ItemFieldFlags.Child))
|
||||
{
|
||||
Item parentItem = GetItemByGuid(pDstItem.m_itemData.Creator);
|
||||
if (parentItem)
|
||||
if (parentItem != null)
|
||||
{
|
||||
if (IsEquipmentPos(dst))
|
||||
{
|
||||
@@ -2522,7 +2522,7 @@ namespace Game.Entities
|
||||
packet.IsEncounterLoot = true;
|
||||
}
|
||||
|
||||
if (broadcast && GetGroup() && !item.GetTemplate().HasFlag(ItemFlags3.DontReportLootLogToParty))
|
||||
if (broadcast && GetGroup() != null && !item.GetTemplate().HasFlag(ItemFlags3.DontReportLootLogToParty))
|
||||
GetGroup().BroadcastPacket(packet, true);
|
||||
else
|
||||
SendPacket(packet);
|
||||
@@ -2576,7 +2576,7 @@ namespace Game.Entities
|
||||
|
||||
Item pItem = GetItemByPos(InventorySlots.Bag0, slot);
|
||||
|
||||
if (!pItem || pItem.GetSocketColor(0) == 0) //if item has no sockets or no item is equipped go to next item
|
||||
if (pItem == null || pItem.GetSocketColor(0) == 0) //if item has no sockets or no item is equipped go to next item
|
||||
continue;
|
||||
|
||||
//cycle all (gem)enchants
|
||||
@@ -2675,7 +2675,7 @@ namespace Game.Entities
|
||||
public Item GetUseableItemByPos(byte bag, byte slot)
|
||||
{
|
||||
Item item = GetItemByPos(bag, slot);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
if (!CanUseAttackType(GetAttackBySlot(slot, item.GetTemplate().GetInventoryType())))
|
||||
@@ -2743,7 +2743,7 @@ namespace Game.Entities
|
||||
uint currentCount = 0;
|
||||
return !ForEachItem(location, pItem =>
|
||||
{
|
||||
if (pItem && pItem.GetEntry() == item && !pItem.IsInTrade())
|
||||
if (pItem != null && pItem.GetEntry() == item && !pItem.IsInTrade())
|
||||
{
|
||||
currentCount += pItem.GetCount();
|
||||
if (currentCount >= count)
|
||||
@@ -2879,7 +2879,7 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; i++)
|
||||
{
|
||||
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (pItem)
|
||||
if (pItem != null)
|
||||
{
|
||||
if (pItem.IsConjuredConsumable())
|
||||
DestroyItem(InventorySlots.Bag0, i, update);
|
||||
@@ -2890,12 +2890,12 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.BagStart; i < InventorySlots.BagEnd; i++)
|
||||
{
|
||||
Bag pBag = GetBagByPos(i);
|
||||
if (pBag)
|
||||
if (pBag != null)
|
||||
{
|
||||
for (byte j = 0; j < pBag.GetBagSize(); j++)
|
||||
{
|
||||
Item pItem = pBag.GetItemByPos(j);
|
||||
if (pItem)
|
||||
if (pItem != null)
|
||||
if (pItem.IsConjuredConsumable())
|
||||
DestroyItem(i, j, update);
|
||||
}
|
||||
@@ -2906,7 +2906,7 @@ namespace Game.Entities
|
||||
for (byte i = EquipmentSlot.Start; i < InventorySlots.BagEnd; i++)
|
||||
{
|
||||
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (pItem)
|
||||
if (pItem != null)
|
||||
if (pItem.IsConjuredConsumable())
|
||||
DestroyItem(InventorySlots.Bag0, i, update);
|
||||
}
|
||||
@@ -2920,7 +2920,7 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; i++)
|
||||
{
|
||||
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (pItem)
|
||||
if (pItem != null)
|
||||
if (pItem.IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
|
||||
DestroyItem(InventorySlots.Bag0, i, update);
|
||||
}
|
||||
@@ -2929,12 +2929,12 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.BagStart; i < InventorySlots.BagEnd; i++)
|
||||
{
|
||||
Bag pBag = GetBagByPos(i);
|
||||
if (pBag)
|
||||
if (pBag != null)
|
||||
{
|
||||
for (byte j = 0; j < pBag.GetBagSize(); j++)
|
||||
{
|
||||
Item pItem = pBag.GetItemByPos(j);
|
||||
if (pItem)
|
||||
if (pItem != null)
|
||||
if (pItem.IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
|
||||
DestroyItem(i, j, update);
|
||||
}
|
||||
@@ -2945,7 +2945,7 @@ namespace Game.Entities
|
||||
for (byte i = EquipmentSlot.Start; i < InventorySlots.BagEnd; i++)
|
||||
{
|
||||
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (pItem)
|
||||
if (pItem != null)
|
||||
if (pItem.IsLimitedToAnotherMapOrZone(GetMapId(), new_zone))
|
||||
DestroyItem(InventorySlots.Bag0, i, update);
|
||||
}
|
||||
@@ -2955,7 +2955,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (restrictOnlyLfg)
|
||||
{
|
||||
if (!GetGroup() || !GetGroup().IsLFGGroup())
|
||||
if (GetGroup() == null || !GetGroup().IsLFGGroup())
|
||||
return InventoryResult.Ok; // not in LFG group
|
||||
|
||||
// check if looted object is inside the lfg dungeon
|
||||
@@ -3008,7 +3008,7 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.BuyBackStart + 1; i < InventorySlots.BuyBackEnd; ++i)
|
||||
{
|
||||
// found empty
|
||||
if (!m_items[i])
|
||||
if (m_items[i] == null)
|
||||
{
|
||||
oldest_slot = i;
|
||||
break;
|
||||
@@ -3066,7 +3066,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
Creature creature = GetNPCIfCanInteractWith(vendorGuid, NPCFlags.Vendor, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: BuyCurrencyFromVendorSlot - {0} not found or you can't interact with him.", vendorGuid.ToString());
|
||||
SendBuyError(BuyResult.DistanceTooFar, null, currency);
|
||||
@@ -3233,7 +3233,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
Creature creature = GetNPCIfCanInteractWith(vendorguid, NPCFlags.Vendor, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: BuyItemFromVendor - {0} not found or you can't interact with him.", vendorguid.ToString());
|
||||
SendBuyError(BuyResult.DistanceTooFar, null, item);
|
||||
@@ -3456,7 +3456,7 @@ namespace Game.Entities
|
||||
SQLTransaction trans = new();
|
||||
|
||||
Item item = Item.CreateItem(itemEntry, count, context, null);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
item.SaveToDB(trans);
|
||||
draft.AddItem(item);
|
||||
@@ -3481,7 +3481,7 @@ namespace Game.Entities
|
||||
if (slot >= InventorySlots.BuyBackStart && slot < InventorySlots.BuyBackEnd)
|
||||
{
|
||||
Item pItem = m_items[slot];
|
||||
if (pItem)
|
||||
if (pItem != null)
|
||||
{
|
||||
pItem.RemoveFromWorld();
|
||||
if (del)
|
||||
@@ -3503,7 +3503,7 @@ namespace Game.Entities
|
||||
SetBuybackTimestamp(eslot, 0);
|
||||
|
||||
// if current backslot is filled set to now free slot
|
||||
if (m_items[m_currentBuybackSlot])
|
||||
if (m_items[m_currentBuybackSlot] != null)
|
||||
m_currentBuybackSlot = slot;
|
||||
}
|
||||
}
|
||||
@@ -3518,19 +3518,19 @@ namespace Game.Entities
|
||||
for (byte i = EquipmentSlot.Start; i < inventoryEnd; ++i)
|
||||
{
|
||||
Item item = GetUseableItemByPos(InventorySlots.Bag0, i);
|
||||
if (item && Global.DB2Mgr.IsTotemCategoryCompatibleWith(item.GetTemplate().GetTotemCategory(), TotemCategory))
|
||||
if (item != null && Global.DB2Mgr.IsTotemCategoryCompatibleWith(item.GetTemplate().GetTotemCategory(), TotemCategory))
|
||||
return true;
|
||||
}
|
||||
|
||||
for (byte i = InventorySlots.BagStart; i < InventorySlots.BagEnd; ++i)
|
||||
{
|
||||
Bag bag = GetBagByPos(i);
|
||||
if (bag)
|
||||
if (bag != null)
|
||||
{
|
||||
for (byte j = 0; j < bag.GetBagSize(); ++j)
|
||||
{
|
||||
Item item = GetUseableItemByPos(i, j);
|
||||
if (item && Global.DB2Mgr.IsTotemCategoryCompatibleWith(item.GetTemplate().GetTotemCategory(), TotemCategory))
|
||||
if (item != null && Global.DB2Mgr.IsTotemCategoryCompatibleWith(item.GetTemplate().GetTotemCategory(), TotemCategory))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -3539,7 +3539,7 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.ChildEquipmentStart; i < InventorySlots.ChildEquipmentEnd; ++i)
|
||||
{
|
||||
Item item = GetUseableItemByPos(InventorySlots.Bag0, i);
|
||||
if (item && Global.DB2Mgr.IsTotemCategoryCompatibleWith(item.GetTemplate().GetTotemCategory(), TotemCategory))
|
||||
if (item != null && Global.DB2Mgr.IsTotemCategoryCompatibleWith(item.GetTemplate().GetTotemCategory(), TotemCategory))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4050,7 +4050,7 @@ namespace Game.Entities
|
||||
{
|
||||
for (byte i = 0; i < InventorySlots.BagEnd; ++i)
|
||||
{
|
||||
if (m_items[i])
|
||||
if (m_items[i] != null)
|
||||
{
|
||||
if (!m_items[i].IsAzeriteItem() || m_items[i].IsBroken() || !CanUseAttackType(Player.GetAttackBySlot(i, m_items[i].GetTemplate().GetInventoryType())))
|
||||
continue;
|
||||
@@ -4064,7 +4064,7 @@ namespace Game.Entities
|
||||
{
|
||||
for (byte i = 0; i < InventorySlots.BagEnd; ++i)
|
||||
{
|
||||
if (m_items[i])
|
||||
if (m_items[i] != null)
|
||||
{
|
||||
if (!m_items[i].IsAzeriteEmpoweredItem() || m_items[i].IsBroken() || !CanUseAttackType(Player.GetAttackBySlot(i, m_items[i].GetTemplate().GetInventoryType())))
|
||||
continue;
|
||||
@@ -4170,7 +4170,7 @@ namespace Game.Entities
|
||||
|
||||
uint need_space;
|
||||
|
||||
if (pSrcItem)
|
||||
if (pSrcItem != null)
|
||||
{
|
||||
if (pSrcItem.IsNotEmptyBag() && !IsBagPos((ushort)((ushort)bag << 8 | slot)))
|
||||
return InventoryResult.DestroyNonemptyBag;
|
||||
@@ -4522,7 +4522,7 @@ namespace Game.Entities
|
||||
++freeSlotCount;
|
||||
|
||||
for (byte i = ProfessionSlots.Start; i < ProfessionSlots.End; ++i)
|
||||
if (!GetItemByPos(InventorySlots.Bag0, i))
|
||||
if (GetItemByPos(InventorySlots.Bag0, i) == null)
|
||||
++freeSlotCount;
|
||||
}
|
||||
|
||||
@@ -4650,7 +4650,7 @@ namespace Game.Entities
|
||||
if (pBag == null || pBag == pSrcItem)
|
||||
return InventoryResult.WrongBagType;
|
||||
|
||||
if (pSrcItem)
|
||||
if (pSrcItem != null)
|
||||
{
|
||||
if (pSrcItem.IsNotEmptyBag())
|
||||
return InventoryResult.DestroyNonemptyBag;
|
||||
@@ -4990,7 +4990,7 @@ namespace Game.Entities
|
||||
if (IsInCombat())
|
||||
return InventoryResult.NotInCombat;
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
if (bg.IsArena() && bg.GetStatus() == BattlegroundStatus.InProgress)
|
||||
return InventoryResult.NotDuringArenaMatch;
|
||||
}
|
||||
@@ -5151,7 +5151,7 @@ namespace Game.Entities
|
||||
public InventoryResult CanEquipChildItem(Item parentItem)
|
||||
{
|
||||
Item childItem = GetChildItemByGuid(parentItem.GetChildItem());
|
||||
if (!childItem)
|
||||
if (childItem == null)
|
||||
return InventoryResult.Ok;
|
||||
|
||||
ItemChildEquipmentRecord childEquipement = Global.DB2Mgr.GetItemChildEquipment(parentItem.GetEntry());
|
||||
@@ -5159,7 +5159,7 @@ namespace Game.Entities
|
||||
return InventoryResult.Ok;
|
||||
|
||||
Item dstItem = GetItemByPos(InventorySlots.Bag0, childEquipement.ChildItemEquipSlot);
|
||||
if (!dstItem)
|
||||
if (dstItem == null)
|
||||
return InventoryResult.Ok;
|
||||
|
||||
ushort childDest = (ushort)((InventorySlots.Bag0 << 8) | childEquipement.ChildItemEquipSlot);
|
||||
@@ -5278,7 +5278,7 @@ namespace Game.Entities
|
||||
if (IsInCombat())
|
||||
return InventoryResult.NotInCombat;
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
if (bg.IsArena() && bg.GetStatus() == BattlegroundStatus.InProgress)
|
||||
return InventoryResult.NotDuringArenaMatch;
|
||||
}
|
||||
@@ -5403,9 +5403,9 @@ namespace Game.Entities
|
||||
else
|
||||
{
|
||||
AzeriteEmpoweredItem azeriteEmpoweredItem = item.ToAzeriteEmpoweredItem();
|
||||
if (azeriteEmpoweredItem)
|
||||
if (azeriteEmpoweredItem != null)
|
||||
{
|
||||
if (!apply || GetItemByEntry(PlayerConst.ItemIdHeartOfAzeroth, ItemSearchLocation.Equipment))
|
||||
if (!apply || GetItemByEntry(PlayerConst.ItemIdHeartOfAzeroth, ItemSearchLocation.Equipment) != null)
|
||||
{
|
||||
for (int i = 0; i < SharedConst.MaxAzeriteEmpoweredTier; ++i)
|
||||
{
|
||||
@@ -5884,7 +5884,7 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.BankBagStart; i < InventorySlots.BankBagEnd; i++)
|
||||
{
|
||||
Item item = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
if (item.GetEntry() == itemEntry && !item.IsInTrade())
|
||||
{
|
||||
@@ -5914,7 +5914,7 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.ReagentStart; i < InventorySlots.ReagentEnd; ++i)
|
||||
{
|
||||
Item item = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
if (item.GetEntry() == itemEntry && !item.IsInTrade())
|
||||
{
|
||||
@@ -5943,7 +5943,7 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.ChildEquipmentStart; i < InventorySlots.ChildEquipmentEnd; ++i)
|
||||
{
|
||||
Item item = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
if (item.GetEntry() == itemEntry && !item.IsInTrade())
|
||||
{
|
||||
@@ -6017,7 +6017,7 @@ namespace Game.Entities
|
||||
for (byte slot = (byte)(InventorySlots.ItemStart + slots); slot < InventorySlots.ItemEnd; ++slot)
|
||||
{
|
||||
Item unstorableItem = GetItemByPos(InventorySlots.Bag0, slot);
|
||||
if (unstorableItem)
|
||||
if (unstorableItem != null)
|
||||
unstorableItems.Add(unstorableItem);
|
||||
}
|
||||
|
||||
@@ -6110,7 +6110,7 @@ namespace Game.Entities
|
||||
if (newitem.GetQuality() > ItemQuality.Epic || (newitem.GetQuality() == ItemQuality.Epic && newitem.GetItemLevel(this) >= GuildConst.MinNewsItemLevel))
|
||||
{
|
||||
Guild guild = GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.AddGuildNews(GuildNews.ItemLooted, GetGUID(), 0, item.itemid);
|
||||
}
|
||||
}
|
||||
@@ -6162,7 +6162,7 @@ namespace Game.Entities
|
||||
// We have to convert player corpse to bones, not to be able to resurrect there
|
||||
// SpawnCorpseBones isn't handy, 'cos it saves player while he in BG
|
||||
Corpse bones = GetMap().ConvertCorpseToBones(GetGUID(), true);
|
||||
if (!bones)
|
||||
if (bones == null)
|
||||
return;
|
||||
|
||||
// Now we must make bones lootable, and send player loot
|
||||
|
||||
@@ -156,12 +156,12 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// group update
|
||||
if (GetGroup())
|
||||
if (GetGroup() != null)
|
||||
{
|
||||
SetGroupUpdateFlag(GroupUpdateFlags.Full);
|
||||
|
||||
Pet pet = GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.SetGroupUpdateFlag(GroupUpdatePetFlags.Full);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace Game.Entities
|
||||
Global.BattleFieldMgr.HandlePlayerEnterZone(this, newZone);
|
||||
SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange...
|
||||
Guild guild = GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.UpdateMemberData(this, GuildMemberData.ZoneId, newZone);
|
||||
}
|
||||
}
|
||||
@@ -437,7 +437,7 @@ namespace Game.Entities
|
||||
if (group == null || group.IsRaidGroup())
|
||||
return false;
|
||||
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
// check if player's group is bound to this instance
|
||||
if (group != instance.GetOwningGroup())
|
||||
@@ -495,7 +495,7 @@ namespace Game.Entities
|
||||
{
|
||||
Group group = GetGroup();
|
||||
Difficulty difficulty = group != null ? group.GetDifficultyID(mapEntry) : GetDifficultyID(mapEntry);
|
||||
ObjectGuid instanceOwnerGuid = group ? group.GetRecentInstanceOwner(targetMapId) : GetGUID();
|
||||
ObjectGuid instanceOwnerGuid = group != null ? group.GetRecentInstanceOwner(targetMapId) : GetGUID();
|
||||
|
||||
InstanceLock instanceLock = Global.InstanceLockMgr.FindActiveInstanceLock(instanceOwnerGuid, new MapDb2Entries(mapEntry, Global.DB2Mgr.GetDownscaledMapDifficultyData(targetMapId, ref difficulty)));
|
||||
if (instanceLock != null)
|
||||
@@ -532,7 +532,7 @@ namespace Game.Entities
|
||||
{
|
||||
Map map = Global.MapMgr.FindMap(mapId, instanceId);
|
||||
bool forgetInstance = false;
|
||||
if (map)
|
||||
if (map != null)
|
||||
{
|
||||
InstanceMap instance = map.ToInstanceMap();
|
||||
if (instance != null)
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Game.Entities
|
||||
// do not reward honor in arenas, but enable onkill spellproc
|
||||
if (InArena())
|
||||
{
|
||||
if (!victim || victim == this || !victim.IsTypeId(TypeId.Player))
|
||||
if (victim == null || victim == this || !victim.IsTypeId(TypeId.Player))
|
||||
return false;
|
||||
|
||||
if (GetBGTeam() == victim.ToPlayer().GetBGTeam())
|
||||
@@ -70,7 +70,7 @@ namespace Game.Entities
|
||||
UpdateHonorFields();
|
||||
|
||||
// do not reward honor in arenas, but return true to enable onkill spellproc
|
||||
if (InBattleground() && GetBattleground() && GetBattleground().IsArena())
|
||||
if (InBattleground() && GetBattleground() != null && GetBattleground().IsArena())
|
||||
return true;
|
||||
|
||||
// Promote to float for calculations
|
||||
@@ -78,12 +78,12 @@ namespace Game.Entities
|
||||
|
||||
if (honor_f <= 0)
|
||||
{
|
||||
if (!victim || victim == this || victim.HasAuraType(AuraType.NoPvpCredit))
|
||||
if (victim == null || victim == this || victim.HasAuraType(AuraType.NoPvpCredit))
|
||||
return false;
|
||||
|
||||
victim_guid = victim.GetGUID();
|
||||
Player plrVictim = victim.ToPlayer();
|
||||
if (plrVictim)
|
||||
if (plrVictim != null)
|
||||
{
|
||||
if (GetEffectiveTeam() == plrVictim.GetEffectiveTeam() && !Global.WorldMgr.IsFFAPvPRealm())
|
||||
return false;
|
||||
@@ -179,7 +179,7 @@ namespace Game.Entities
|
||||
|
||||
if (WorldConfig.GetBoolValue(WorldCfg.PvpTokenEnable) && pvptoken)
|
||||
{
|
||||
if (!victim || victim == this || victim.HasAuraType(AuraType.NoPvpCredit))
|
||||
if (victim == null || victim == this || victim.HasAuraType(AuraType.NoPvpCredit))
|
||||
return true;
|
||||
|
||||
if (victim.IsTypeId(TypeId.Player))
|
||||
@@ -511,7 +511,7 @@ namespace Game.Entities
|
||||
public bool CanUseBattlegroundObject(GameObject gameobject)
|
||||
{
|
||||
// It is possible to call this method with a null pointer, only skipping faction check.
|
||||
if (gameobject)
|
||||
if (gameobject != null)
|
||||
{
|
||||
FactionTemplateRecord playerFaction = GetFactionTemplateEntry();
|
||||
FactionTemplateRecord faction = CliDB.FactionTemplateStorage.LookupByKey(gameobject.GetFaction());
|
||||
@@ -592,7 +592,7 @@ namespace Game.Entities
|
||||
public void LeaveBattleground(bool teleportToEntryPoint = true)
|
||||
{
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
{
|
||||
bg.RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true);
|
||||
|
||||
@@ -648,7 +648,7 @@ namespace Game.Entities
|
||||
reportAfkResult.Offender = GetGUID();
|
||||
Battleground bg = GetBattleground();
|
||||
// Battleground also must be in progress!
|
||||
if (!bg || bg != reporter.GetBattleground() || GetEffectiveTeam() != reporter.GetEffectiveTeam() || bg.GetStatus() != BattlegroundStatus.InProgress)
|
||||
if (bg == null || bg != reporter.GetBattleground() || GetEffectiveTeam() != reporter.GetEffectiveTeam() || bg.GetStatus() != BattlegroundStatus.InProgress)
|
||||
{
|
||||
reporter.SendPacket(reportAfkResult);
|
||||
return;
|
||||
|
||||
@@ -707,7 +707,7 @@ namespace Game.Entities
|
||||
if (CanCompleteQuest(quest.Id))
|
||||
CompleteQuest(quest.Id);
|
||||
|
||||
if (!questGiver)
|
||||
if (questGiver == null)
|
||||
return;
|
||||
|
||||
switch (questGiver.GetTypeId())
|
||||
@@ -1190,10 +1190,10 @@ namespace Game.Entities
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(displaySpell.SpellId, GetMap().GetDifficultyID());
|
||||
Unit caster = this;
|
||||
if (questGiver && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
|
||||
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
|
||||
{
|
||||
Unit unit = questGiver.ToUnit();
|
||||
if (unit)
|
||||
if (unit != null)
|
||||
caster = unit;
|
||||
}
|
||||
|
||||
@@ -2326,14 +2326,14 @@ namespace Game.Entities
|
||||
public void GroupEventHappens(uint questId, WorldObject pEventObject)
|
||||
{
|
||||
var group = GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player player = refe.GetSource();
|
||||
|
||||
// for any leave or dead (with not released body) group member at appropriate distance
|
||||
if (player && player.IsAtGroupRewardDistance(pEventObject) && !player.GetCorpse())
|
||||
if (player != null && player.IsAtGroupRewardDistance(pEventObject) && player.GetCorpse() == null)
|
||||
player.AreaExploredOrEventHappens(questId);
|
||||
}
|
||||
}
|
||||
@@ -2450,7 +2450,7 @@ namespace Game.Entities
|
||||
Quest quest = Global.ObjectMgr.GetQuestTemplate(questId);
|
||||
|
||||
if (!QuestObjective.CanAlwaysBeProgressedInRaid(objectiveType))
|
||||
if (GetGroup() && GetGroup().IsRaidGroup() && !quest.IsAllowedInRaid(GetMap().GetDifficultyID()))
|
||||
if (GetGroup() != null && GetGroup().IsRaidGroup() && !quest.IsAllowedInRaid(GetMap().GetDifficultyID()))
|
||||
continue;
|
||||
|
||||
ushort logSlot = objectiveStatusData.QuestStatusPair.Status.Slot;
|
||||
@@ -2595,7 +2595,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
// hide quest if player is in raid-group and quest is no raid quest
|
||||
if (GetGroup() && GetGroup().IsRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))
|
||||
if (GetGroup() != null && GetGroup().IsRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))
|
||||
if (!InBattleground()) //there are two ways.. we can make every bg-quest a raidquest, or add this code here.. i don't know if this can be exploited by other quests, but i think all other quests depend on a specific area.. but keep this in mind, if something strange happens later
|
||||
continue;
|
||||
|
||||
@@ -2611,7 +2611,7 @@ namespace Game.Entities
|
||||
|
||||
Quest qInfo = Global.ObjectMgr.GetQuestTemplate(questStatus.Key);
|
||||
// hide quest if player is in raid-group and quest is no raid quest
|
||||
if (GetGroup() && GetGroup().IsRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))
|
||||
if (GetGroup() != null && GetGroup().IsRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))
|
||||
if (!InBattleground())
|
||||
continue;
|
||||
|
||||
@@ -2855,7 +2855,7 @@ namespace Game.Entities
|
||||
packet.SkillLineIDReward = quest.RewardSkillId;
|
||||
packet.NumSkillUpsReward = quest.RewardSkillPoints;
|
||||
|
||||
if (questGiver)
|
||||
if (questGiver != null)
|
||||
{
|
||||
if (questGiver.IsGossip())
|
||||
packet.LaunchGossip = quest.HasFlag(QuestFlags.LaunchGossipComplete);
|
||||
@@ -2910,7 +2910,7 @@ namespace Game.Entities
|
||||
|
||||
public void SendQuestConfirmAccept(Quest quest, Player receiver)
|
||||
{
|
||||
if (!receiver)
|
||||
if (receiver == null)
|
||||
return;
|
||||
|
||||
QuestConfirmAcceptResponse packet = new();
|
||||
@@ -2998,7 +2998,7 @@ namespace Game.Entities
|
||||
{
|
||||
// need also pet quests case support
|
||||
Creature questgiver = ObjectAccessor.GetCreatureOrPetOrVehicle(this, itr);
|
||||
if (!questgiver || questgiver.IsHostileTo(this))
|
||||
if (questgiver == null || questgiver.IsHostileTo(this))
|
||||
continue;
|
||||
|
||||
if (!questgiver.HasNpcFlag(NPCFlags.QuestGiver))
|
||||
@@ -3009,7 +3009,7 @@ namespace Game.Entities
|
||||
else if (itr.IsGameObject())
|
||||
{
|
||||
GameObject questgiver = GetMap().GetGameObject(itr);
|
||||
if (!questgiver || questgiver.GetGoType() != GameObjectTypes.QuestGiver)
|
||||
if (questgiver == null || questgiver.GetGoType() != GameObjectTypes.QuestGiver)
|
||||
continue;
|
||||
|
||||
response.QuestGiver.Add(new QuestGiverInfo(questgiver.GetGUID(), GetQuestDialogStatus(questgiver)));
|
||||
@@ -3048,7 +3048,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
// hide quest if player is in raid-group and quest is no raid quest
|
||||
if (GetGroup() && GetGroup().IsRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))
|
||||
if (GetGroup() != null && GetGroup().IsRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))
|
||||
if (!InBattleground()) //there are two ways.. we can make every bg-quest a raidquest, or add this code here.. i don't know if this can be exploited by other quests, but i think all other quests depend on a specific area.. but keep this in mind, if something strange happens later
|
||||
continue;
|
||||
|
||||
@@ -3201,7 +3201,7 @@ namespace Game.Entities
|
||||
{
|
||||
case DisplayToastType.NewItem:
|
||||
{
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
displayToast.BonusRoll = isBonusRoll;
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace Game.Entities
|
||||
{
|
||||
Pet pet = GetPet();
|
||||
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
return;
|
||||
|
||||
Log.outDebug(LogFilter.Pet, "Pet Spells Groups");
|
||||
@@ -250,7 +250,7 @@ namespace Game.Entities
|
||||
|
||||
public bool CanSeeSpellClickOn(Creature creature)
|
||||
{
|
||||
if (!creature.HasNpcFlag(NPCFlags.SpellClick))
|
||||
if (creature.HasNpcFlag(NPCFlags.SpellClick))
|
||||
return false;
|
||||
|
||||
var clickBounds = Global.ObjectMgr.GetSpellClickInfoMapBounds(creature.GetEntry());
|
||||
@@ -871,7 +871,7 @@ namespace Game.Entities
|
||||
public void StopCastingBindSight()
|
||||
{
|
||||
WorldObject target = GetViewpoint();
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
if (target.IsTypeMask(TypeMask.Unit))
|
||||
{
|
||||
@@ -950,7 +950,7 @@ namespace Game.Entities
|
||||
var enchantDuration = m_enchantDuration[i];
|
||||
if (enchantDuration.slot == slot)
|
||||
{
|
||||
if (enchantDuration.item && enchantDuration.item.GetEnchantmentId(slot) != 0)
|
||||
if (enchantDuration.item != null && enchantDuration.item.GetEnchantmentId(slot) != 0)
|
||||
{
|
||||
// Poisons and DK runes are enchants which are allowed on arenas
|
||||
if (Global.SpellMgr.IsArenaAllowedEnchancment(enchantDuration.item.GetEnchantmentId(slot)))
|
||||
@@ -973,7 +973,7 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; ++i)
|
||||
{
|
||||
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (pItem && !Global.SpellMgr.IsArenaAllowedEnchancment(pItem.GetEnchantmentId(slot)))
|
||||
if (pItem != null && !Global.SpellMgr.IsArenaAllowedEnchancment(pItem.GetEnchantmentId(slot)))
|
||||
pItem.ClearEnchantment(slot);
|
||||
}
|
||||
|
||||
@@ -981,12 +981,12 @@ namespace Game.Entities
|
||||
for (byte i = InventorySlots.BagStart; i < InventorySlots.BagEnd; ++i)
|
||||
{
|
||||
Bag pBag = GetBagByPos(i);
|
||||
if (pBag)
|
||||
if (pBag != null)
|
||||
{
|
||||
for (byte j = 0; j < pBag.GetBagSize(); j++)
|
||||
{
|
||||
Item pItem = pBag.GetItemByPos(j);
|
||||
if (pItem && !Global.SpellMgr.IsArenaAllowedEnchancment(pItem.GetEnchantmentId(slot)))
|
||||
if (pItem != null && !Global.SpellMgr.IsArenaAllowedEnchancment(pItem.GetEnchantmentId(slot)))
|
||||
pItem.ClearEnchantment(slot);
|
||||
}
|
||||
}
|
||||
@@ -1755,12 +1755,12 @@ namespace Game.Entities
|
||||
case ItemClass.Weapon:
|
||||
{
|
||||
Item item = GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.MainHand);
|
||||
if (item)
|
||||
if (item != null)
|
||||
if (item != ignoreItem && item.IsFitToSpellRequirements(spellInfo))
|
||||
return true;
|
||||
|
||||
item = GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand);
|
||||
if (item)
|
||||
if (item != null)
|
||||
if (item != ignoreItem && item.IsFitToSpellRequirements(spellInfo))
|
||||
return true;
|
||||
break;
|
||||
@@ -1790,7 +1790,7 @@ namespace Game.Entities
|
||||
for (byte i = EquipmentSlot.Start; i < EquipmentSlot.MainHand; ++i)
|
||||
{
|
||||
Item item = GetUseableItemByPos(InventorySlots.Bag0, i);
|
||||
if (item)
|
||||
if (item != null)
|
||||
if (item != ignoreItem && item.IsFitToSpellRequirements(spellInfo))
|
||||
return true;
|
||||
}
|
||||
@@ -1801,7 +1801,7 @@ namespace Game.Entities
|
||||
foreach (byte i in new[] { EquipmentSlot.Head, EquipmentSlot.Shoulders, EquipmentSlot.Chest, EquipmentSlot.Waist, EquipmentSlot.Legs, EquipmentSlot.Feet, EquipmentSlot.Wrist, EquipmentSlot.Hands })
|
||||
{
|
||||
Item item = GetUseableItemByPos(InventorySlots.Bag0, i);
|
||||
if (!item || item == ignoreItem || !item.IsFitToSpellRequirements(spellInfo))
|
||||
if (item == null || item == ignoreItem || !item.IsFitToSpellRequirements(spellInfo))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1834,20 +1834,20 @@ namespace Game.Entities
|
||||
for (byte slot = InventorySlots.ItemStart; slot < inventoryEnd; ++slot)
|
||||
{
|
||||
Item item = GetItemByPos(InventorySlots.Bag0, slot);
|
||||
if (item)
|
||||
if (item != null)
|
||||
ApplyItemObtainSpells(item, true);
|
||||
}
|
||||
|
||||
for (byte i = InventorySlots.BagStart; i < InventorySlots.BagEnd; ++i)
|
||||
{
|
||||
Bag bag = GetBagByPos(i);
|
||||
if (!bag)
|
||||
if (bag == null)
|
||||
continue;
|
||||
|
||||
for (byte slot = 0; slot < bag.GetBagSize(); ++slot)
|
||||
{
|
||||
Item item = bag.GetItemByPos(slot);
|
||||
if (item)
|
||||
if (item != null)
|
||||
ApplyItemObtainSpells(item, true);
|
||||
}
|
||||
}
|
||||
@@ -3234,7 +3234,7 @@ namespace Game.Entities
|
||||
{
|
||||
for (byte i = 0; i < InventorySlots.BagEnd; ++i)
|
||||
{
|
||||
if (m_items[i] && !m_items[i].IsBroken() && CanUseAttackType(GetAttackBySlot(i, m_items[i].GetTemplate().GetInventoryType())))
|
||||
if (m_items[i] != null && !m_items[i].IsBroken() && CanUseAttackType(GetAttackBySlot(i, m_items[i].GetTemplate().GetInventoryType())))
|
||||
{
|
||||
ApplyItemEquipSpell(m_items[i], false, true); // remove spells that not fit to form
|
||||
ApplyItemEquipSpell(m_items[i], true, true); // add spells that fit form but not active
|
||||
@@ -3283,7 +3283,7 @@ namespace Game.Entities
|
||||
if (removeActivePetCooldowns)
|
||||
{
|
||||
Pet pet = GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.GetSpellHistory().ResetAllCooldowns();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace Game.Entities
|
||||
|
||||
// TO-DO: We need more research to know what happens with warlock's reagent
|
||||
Pet pet = GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
RemovePet(pet, PetSaveMode.NotInSlot);
|
||||
|
||||
ClearAllReactives();
|
||||
@@ -428,7 +428,7 @@ namespace Game.Entities
|
||||
for (byte i = EquipmentSlot.Start; i < EquipmentSlot.End; ++i)
|
||||
{
|
||||
Item equippedItem = GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (equippedItem)
|
||||
if (equippedItem != null)
|
||||
SetVisibleItemSlot(i, equippedItem);
|
||||
}
|
||||
|
||||
|
||||
@@ -932,7 +932,7 @@ namespace Game.Entities
|
||||
if (petStable.CurrentPetIndex == (uint)srcPetSlot)
|
||||
{
|
||||
Pet oldPet = GetPet();
|
||||
if (oldPet && !oldPet.IsAlive())
|
||||
if (oldPet != null && !oldPet.IsAlive())
|
||||
{
|
||||
sess.SendPetStableResult(StableResult.InternalError);
|
||||
return;
|
||||
@@ -1109,7 +1109,7 @@ namespace Game.Entities
|
||||
public void UnsummonPetTemporaryIfAny()
|
||||
{
|
||||
Pet pet = GetPet();
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
return;
|
||||
|
||||
if (m_temporaryUnsummonedPetNumber == 0 && pet.IsControlled() && !pet.IsTemporarySummoned())
|
||||
@@ -1179,7 +1179,7 @@ namespace Game.Entities
|
||||
public void StopCastingCharm()
|
||||
{
|
||||
Unit charm = GetCharmed();
|
||||
if (!charm)
|
||||
if (charm == null)
|
||||
return;
|
||||
|
||||
if (charm.IsTypeId(TypeId.Unit))
|
||||
@@ -1219,7 +1219,7 @@ namespace Game.Entities
|
||||
public void CharmSpellInitialize()
|
||||
{
|
||||
Unit charm = GetFirstControlled();
|
||||
if (!charm)
|
||||
if (charm == null)
|
||||
return;
|
||||
|
||||
CharmInfo charmInfo = charm.GetCharmInfo();
|
||||
@@ -1257,7 +1257,7 @@ namespace Game.Entities
|
||||
public void PossessSpellInitialize()
|
||||
{
|
||||
Unit charm = GetCharmed();
|
||||
if (!charm)
|
||||
if (charm == null)
|
||||
return;
|
||||
|
||||
CharmInfo charmInfo = charm.GetCharmInfo();
|
||||
@@ -1281,7 +1281,7 @@ namespace Game.Entities
|
||||
public void VehicleSpellInitialize()
|
||||
{
|
||||
Creature vehicle = GetVehicleCreatureBase();
|
||||
if (!vehicle)
|
||||
if (vehicle == null)
|
||||
return;
|
||||
|
||||
PetSpells petSpells = new();
|
||||
@@ -1843,7 +1843,7 @@ namespace Game.Entities
|
||||
// Calculates how many reputation points player gains in victim's enemy factions
|
||||
public void RewardReputation(Unit victim, float rate)
|
||||
{
|
||||
if (!victim || victim.IsTypeId(TypeId.Player))
|
||||
if (victim == null || victim.IsTypeId(TypeId.Player))
|
||||
return;
|
||||
|
||||
if (victim.ToCreature().IsReputationGainDisabled())
|
||||
@@ -2021,7 +2021,7 @@ namespace Game.Entities
|
||||
// The player was ported to another map and loses the duel immediately.
|
||||
// We have to perform this check before the teleport, otherwise the
|
||||
// ObjectAccessor won't find the flag.
|
||||
if (duel != null && GetMapId() != mapid && GetMap().GetGameObject(m_playerData.DuelArbiter))
|
||||
if (duel != null && GetMapId() != mapid && GetMap().GetGameObject(m_playerData.DuelArbiter) != null)
|
||||
DuelComplete(DuelCompleteType.Fled);
|
||||
|
||||
if (GetMapId() == mapid && (!instanceId.HasValue || GetInstanceId() == instanceId))
|
||||
@@ -2045,7 +2045,7 @@ namespace Game.Entities
|
||||
if (!options.HasAnyFlag(TeleportToOptions.NotUnSummonPet))
|
||||
{
|
||||
//same map, only remove pet if out of range for new position
|
||||
if (pet && !pet.IsWithinDist3d(x, y, z, GetMap().GetVisibilityRange()))
|
||||
if (pet != null && !pet.IsWithinDist3d(x, y, z, GetMap().GetVisibilityRange()))
|
||||
UnsummonPetTemporaryIfAny();
|
||||
}
|
||||
|
||||
@@ -2090,7 +2090,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// Seamless teleport can happen only if cosmetic maps match
|
||||
if (!oldmap || (oldmap.GetEntry().CosmeticParentMapID != mapid && GetMapId() != mEntry.CosmeticParentMapID &&
|
||||
if (oldmap == null || (oldmap.GetEntry().CosmeticParentMapID != mapid && GetMapId() != mEntry.CosmeticParentMapID &&
|
||||
!((oldmap.GetEntry().CosmeticParentMapID != -1) ^ (oldmap.GetEntry().CosmeticParentMapID != mEntry.CosmeticParentMapID))))
|
||||
options &= ~TeleportToOptions.Seamless;
|
||||
|
||||
@@ -2118,7 +2118,7 @@ namespace Game.Entities
|
||||
|
||||
// remove player from Battlegroundon far teleport (when changing maps)
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
{
|
||||
// Note: at Battlegroundjoin Battlegroundid set before teleport
|
||||
// and we already will found "current" Battleground
|
||||
@@ -2132,12 +2132,12 @@ namespace Game.Entities
|
||||
{
|
||||
RemoveArenaSpellCooldowns(true);
|
||||
RemoveArenaAuras();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.RemoveArenaAuras();
|
||||
}
|
||||
|
||||
// remove pet on map change
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
UnsummonPetTemporaryIfAny();
|
||||
|
||||
// remove all dyn objects
|
||||
@@ -2259,7 +2259,7 @@ namespace Game.Entities
|
||||
}
|
||||
});
|
||||
|
||||
if (!m_unitMovedByMe.GetVehicleBase() || !m_unitMovedByMe.GetVehicle().GetVehicleInfo().Flags.HasAnyFlag(VehicleFlags.FixedPosition))
|
||||
if (m_unitMovedByMe.GetVehicleBase() == null || !m_unitMovedByMe.GetVehicle().GetVehicleInfo().Flags.HasAnyFlag(VehicleFlags.FixedPosition))
|
||||
RemoveViolatingFlags(mi.HasMovementFlag(MovementFlag.Root), MovementFlag.Root);
|
||||
|
||||
/*! This must be a packet spoofing attempt. MOVEMENTFLAG_ROOT sent from the client is not valid
|
||||
@@ -2382,7 +2382,7 @@ namespace Game.Entities
|
||||
|
||||
public void SendSummonRequestFrom(Unit summoner)
|
||||
{
|
||||
if (!summoner)
|
||||
if (summoner == null)
|
||||
return;
|
||||
|
||||
// Player already has active summon request
|
||||
@@ -2475,7 +2475,7 @@ namespace Game.Entities
|
||||
// drop flag at summon
|
||||
// this code can be reached only when GM is summoning player who carries flag, because player should be immune to summoning spells when he carries flag
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
bg.EventPlayerDroppedFlag(this);
|
||||
|
||||
m_summon_expire = 0;
|
||||
@@ -2626,7 +2626,7 @@ namespace Game.Entities
|
||||
bool canTalk = true;
|
||||
GameObject go = source.ToGameObject();
|
||||
Creature creature = source.ToCreature();
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
{
|
||||
switch (gossipMenuItem.OptionNpc)
|
||||
{
|
||||
@@ -2639,13 +2639,13 @@ namespace Game.Entities
|
||||
canTalk = false;
|
||||
break;
|
||||
case GossipOptionNpc.Battlemaster:
|
||||
if (!creature.CanInteractWithBattleMaster(this, false))
|
||||
if (creature.CanInteractWithBattleMaster(this, false))
|
||||
canTalk = false;
|
||||
break;
|
||||
case GossipOptionNpc.TalentMaster:
|
||||
case GossipOptionNpc.SpecializationMaster:
|
||||
case GossipOptionNpc.GlyphMaster:
|
||||
if (!creature.CanResetTalents(this))
|
||||
if (creature.CanResetTalents(this))
|
||||
canTalk = false;
|
||||
break;
|
||||
case GossipOptionNpc.Stablemaster:
|
||||
@@ -2705,7 +2705,7 @@ namespace Game.Entities
|
||||
}
|
||||
public void SendPreparedGossip(WorldObject source)
|
||||
{
|
||||
if (!source)
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
if (source.IsTypeId(TypeId.Unit) || source.IsTypeId(TypeId.GameObject))
|
||||
@@ -3450,7 +3450,7 @@ namespace Game.Entities
|
||||
|
||||
public bool IsAllowedToLoot(Creature creature)
|
||||
{
|
||||
if (!creature.IsDead())
|
||||
if (creature.IsDead())
|
||||
return false;
|
||||
|
||||
if (HasPendingBind())
|
||||
@@ -4256,7 +4256,7 @@ namespace Game.Entities
|
||||
if (InBattleground())
|
||||
{
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
bg.HandlePlayerResurrect(this);
|
||||
}
|
||||
|
||||
@@ -4299,14 +4299,14 @@ namespace Game.Entities
|
||||
|
||||
public void SetAreaSpiritHealer(Creature creature)
|
||||
{
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
_areaSpiritHealerGUID = ObjectGuid.Empty;
|
||||
RemoveAurasDueToSpell(BattlegroundConst.SpellWaitingForResurrect);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!creature.IsAreaSpiritHealer())
|
||||
if (creature.IsAreaSpiritHealer())
|
||||
return;
|
||||
|
||||
_areaSpiritHealerGUID = creature.GetGUID();
|
||||
@@ -4434,7 +4434,7 @@ namespace Game.Entities
|
||||
public void SpawnCorpseBones(bool triggerSave = true)
|
||||
{
|
||||
_corpseLocation = new WorldLocation();
|
||||
if (GetMap().ConvertCorpseToBones(GetGUID()))
|
||||
if (GetMap().ConvertCorpseToBones(GetGUID()) != null)
|
||||
if (triggerSave && !GetSession().PlayerLogoutWithSave()) // at logout we will already store the player
|
||||
SaveToDB(); // prevent loading as ghost without corpse
|
||||
}
|
||||
@@ -4460,7 +4460,7 @@ namespace Game.Entities
|
||||
|
||||
// Special handle for Battlegroundmaps
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
closestGrave = bg.GetClosestGraveyard(this);
|
||||
else
|
||||
{
|
||||
@@ -4545,10 +4545,10 @@ namespace Game.Entities
|
||||
int CalculateCorpseReclaimDelay(bool load = false)
|
||||
{
|
||||
Corpse corpse = GetCorpse();
|
||||
if (load && !corpse)
|
||||
if (load && corpse == null)
|
||||
return -1;
|
||||
|
||||
bool pvp = corpse ? corpse.GetCorpseType() == CorpseType.ResurrectablePVP : (m_ExtraFlags & PlayerExtraFlags.PVPDeath) != 0;
|
||||
bool pvp = corpse != null ? corpse.GetCorpseType() == CorpseType.ResurrectablePVP : (m_ExtraFlags & PlayerExtraFlags.PVPDeath) != 0;
|
||||
|
||||
uint delay;
|
||||
if (load)
|
||||
@@ -4696,10 +4696,10 @@ namespace Game.Entities
|
||||
|
||||
public void RemovePet(Pet pet, PetSaveMode mode, bool returnreagent = false)
|
||||
{
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
pet = GetPet();
|
||||
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Pet, "RemovePet {0}, {1}, {2}", pet.GetEntry(), mode, returnreagent);
|
||||
|
||||
@@ -4707,10 +4707,10 @@ namespace Game.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
if (returnreagent && (pet || m_temporaryUnsummonedPetNumber != 0) && !InBattleground())
|
||||
if (returnreagent && (pet != null || m_temporaryUnsummonedPetNumber != 0) && !InBattleground())
|
||||
{
|
||||
//returning of reagents only for players, so best done here
|
||||
uint spellId = pet ? pet.m_unitData.CreatedBySpell : m_oldpetspell;
|
||||
uint spellId = pet != null ? pet.m_unitData.CreatedBySpell : m_oldpetspell;
|
||||
SpellInfo spellInfo = SpellMgr.GetSpellInfo(spellId, GetMap().GetDifficultyID());
|
||||
|
||||
if (spellInfo != null)
|
||||
@@ -4781,7 +4781,7 @@ namespace Game.Entities
|
||||
{
|
||||
SendPacket(new PetSpells());
|
||||
|
||||
if (GetGroup())
|
||||
if (GetGroup() != null)
|
||||
SetGroupUpdateFlag(GroupUpdateFlags.Pet);
|
||||
}
|
||||
}
|
||||
@@ -4814,7 +4814,7 @@ namespace Game.Entities
|
||||
public bool InArena()
|
||||
{
|
||||
Battleground bg = GetBattleground();
|
||||
if (!bg || !bg.IsArena())
|
||||
if (bg == null || !bg.IsArena())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -5341,7 +5341,7 @@ namespace Game.Entities
|
||||
|
||||
// update level to hunter/summon pet
|
||||
Pet pet = GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.SynchronizeLevelWithOwner();
|
||||
|
||||
MailLevelReward mailReward = ObjectMgr.GetMailLevelReward(level, GetRace());
|
||||
@@ -5448,7 +5448,7 @@ namespace Game.Entities
|
||||
return null;
|
||||
|
||||
// alive or spirit healer
|
||||
if (!creature.IsAlive() && !creature.GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.InteractWhileDead))
|
||||
if (creature.IsAlive() && !creature.GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.InteractWhileDead))
|
||||
return null;
|
||||
|
||||
// appropriate npc type
|
||||
@@ -5467,7 +5467,7 @@ namespace Game.Entities
|
||||
return null;
|
||||
|
||||
// not allow interaction under control, but allow with own pets
|
||||
if (!creature.GetCharmerGUID().IsEmpty())
|
||||
if (creature.GetCharmerGUID().IsEmpty())
|
||||
return null;
|
||||
|
||||
// not unfriendly/hostile
|
||||
@@ -5475,7 +5475,7 @@ namespace Game.Entities
|
||||
return null;
|
||||
|
||||
// not too far, taken from CGGameUI::SetInteractTarget
|
||||
if (!creature.IsWithinDistInMap(this, creature.GetCombatReach() + 4.0f))
|
||||
if (creature.IsWithinDistInMap(this, creature.GetCombatReach() + 4.0f))
|
||||
return null;
|
||||
|
||||
return creature;
|
||||
@@ -5510,7 +5510,7 @@ namespace Game.Entities
|
||||
public GameObject GetGameObjectIfCanInteractWith(ObjectGuid guid, GameObjectTypes type)
|
||||
{
|
||||
GameObject go = GetGameObjectIfCanInteractWith(guid);
|
||||
if (!go)
|
||||
if (go == null)
|
||||
return null;
|
||||
|
||||
if (go.GetGoType() != type)
|
||||
@@ -5980,7 +5980,7 @@ namespace Game.Entities
|
||||
|
||||
// update level to hunter/summon pet
|
||||
Pet pet = GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.SynchronizeLevelWithOwner();
|
||||
}
|
||||
public void InitDataForForm(bool reapplyMods = false)
|
||||
@@ -6246,10 +6246,10 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
// group update
|
||||
if (GetGroup())
|
||||
if (GetGroup() != null)
|
||||
SetGroupUpdateFlag(GroupUpdateFlags.Position);
|
||||
|
||||
if (GetTrader() && !IsWithinDistInMap(GetTrader(), SharedConst.InteractionDistance))
|
||||
if (GetTrader() != null && !IsWithinDistInMap(GetTrader(), SharedConst.InteractionDistance))
|
||||
GetSession().SendCancelTrade();
|
||||
|
||||
CheckAreaExploreAndOutdoor();
|
||||
@@ -6441,7 +6441,7 @@ namespace Game.Entities
|
||||
public void SendBuyError(BuyResult msg, Creature creature, uint item)
|
||||
{
|
||||
BuyFailed packet = new();
|
||||
packet.VendorGUID = creature ? creature.GetGUID() : ObjectGuid.Empty;
|
||||
packet.VendorGUID = creature != null ? creature.GetGUID() : ObjectGuid.Empty;
|
||||
packet.Muid = item;
|
||||
packet.Reason = msg;
|
||||
SendPacket(packet);
|
||||
@@ -6449,7 +6449,7 @@ namespace Game.Entities
|
||||
public void SendSellError(SellResult msg, Creature creature, ObjectGuid guid)
|
||||
{
|
||||
SellResponse sellResponse = new();
|
||||
sellResponse.VendorGUID = creature ? creature.GetGUID() : ObjectGuid.Empty;
|
||||
sellResponse.VendorGUID = creature != null ? creature.GetGUID() : ObjectGuid.Empty;
|
||||
sellResponse.ItemGUIDs.Add(guid);
|
||||
sellResponse.Reason = msg;
|
||||
SendPacket(sellResponse);
|
||||
@@ -6553,7 +6553,7 @@ namespace Game.Entities
|
||||
|
||||
public override void Whisper(uint textId, Player target, bool isBossWhisper = false)
|
||||
{
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
BroadcastTextRecord bct = CliDB.BroadcastTextStorage.LookupByKey(textId);
|
||||
@@ -6685,9 +6685,9 @@ namespace Game.Entities
|
||||
bonus_xp = victim != null ? _restMgr.GetRestBonusFor(RestTypes.XP, xp) : 0; // XP resting bonus
|
||||
|
||||
LogXPGain packet = new();
|
||||
packet.Victim = victim ? victim.GetGUID() : ObjectGuid.Empty;
|
||||
packet.Victim = victim != null ? victim.GetGUID() : ObjectGuid.Empty;
|
||||
packet.Original = (int)(xp + bonus_xp);
|
||||
packet.Reason = victim ? PlayerLogXPReason.Kill : PlayerLogXPReason.NoKill;
|
||||
packet.Reason = victim != null ? PlayerLogXPReason.Kill : PlayerLogXPReason.NoKill;
|
||||
packet.Amount = (int)xp;
|
||||
packet.GroupBonus = group_rate;
|
||||
SendPacket(packet);
|
||||
@@ -7154,12 +7154,12 @@ namespace Game.Entities
|
||||
if (GetLevel() <= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel) || !forXP)
|
||||
{
|
||||
Group group = GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player player = refe.GetSource();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
if (!player.IsAtRecruitAFriendDistance(this))
|
||||
@@ -7192,11 +7192,11 @@ namespace Game.Entities
|
||||
|
||||
bool IsAtRecruitAFriendDistance(WorldObject pOther)
|
||||
{
|
||||
if (!pOther || !IsInMap(pOther))
|
||||
if (pOther == null || !IsInMap(pOther))
|
||||
return false;
|
||||
|
||||
WorldObject player = GetCorpse();
|
||||
if (!player || IsAlive())
|
||||
if (player == null || IsAlive())
|
||||
player = this;
|
||||
|
||||
return pOther.GetDistance(player) <= WorldConfig.GetFloatValue(WorldCfg.MaxRecruitAFriendDistance);
|
||||
@@ -7228,7 +7228,7 @@ namespace Game.Entities
|
||||
randomRoll.RollerWowAccount = GetSession().GetAccountGUID();
|
||||
|
||||
Group group = GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
group.BroadcastPacket(randomRoll, false);
|
||||
else
|
||||
SendPacket(randomRoll);
|
||||
@@ -7409,7 +7409,7 @@ namespace Game.Entities
|
||||
public void SetClientControl(Unit target, bool allowMove)
|
||||
{
|
||||
// a player can never client control nothing
|
||||
Cypher.Assert(target);
|
||||
Cypher.Assert(target != null);
|
||||
|
||||
// don't allow possession to be overridden
|
||||
if (target.HasUnitState(UnitState.Charmed) && (GetGUID() != target.GetCharmerGUID()))
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Game.Entities
|
||||
|
||||
public static void GetFriendInfo(Player player, ObjectGuid friendGUID, FriendInfo friendInfo)
|
||||
{
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
friendInfo.Status = FriendStatus.Offline;
|
||||
@@ -31,7 +31,7 @@ namespace Game.Entities
|
||||
friendInfo.Class = 0;
|
||||
|
||||
Player target = Global.ObjAccessor.FindPlayer(friendGUID);
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
var playerFriendInfo = player.GetSocial().PlayerSocialMap.LookupByKey(friendGUID);
|
||||
@@ -84,7 +84,7 @@ namespace Game.Entities
|
||||
|
||||
void BroadcastToFriendListers(Player player, ServerPacket packet)
|
||||
{
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
AccountTypes gmSecLevel = (AccountTypes)WorldConfig.GetIntValue(WorldCfg.GmLevelInWhoList);
|
||||
@@ -94,7 +94,7 @@ namespace Game.Entities
|
||||
if (info != null && info.Flags.HasAnyFlag(SocialFlag.Friend))
|
||||
{
|
||||
Player target = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (!target || !target.IsInWorld)
|
||||
if (target == null || !target.IsInWorld)
|
||||
continue;
|
||||
|
||||
WorldSession session = target.GetSession();
|
||||
@@ -244,7 +244,7 @@ namespace Game.Entities
|
||||
|
||||
public void SendSocialList(Player player, SocialFlag flags)
|
||||
{
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
uint friendsCount = 0;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Game.Entities
|
||||
|
||||
public void SetItem(TradeSlots slot, Item item, bool update = false)
|
||||
{
|
||||
ObjectGuid itemGuid = item ? item.GetGUID() : ObjectGuid.Empty;
|
||||
ObjectGuid itemGuid = item != null ? item.GetGUID() : ObjectGuid.Empty;
|
||||
|
||||
if (m_items[(int)slot] == itemGuid && !update)
|
||||
return;
|
||||
@@ -77,7 +77,7 @@ namespace Game.Entities
|
||||
|
||||
public void SetSpell(uint spell_id, Item castItem = null)
|
||||
{
|
||||
ObjectGuid itemGuid = castItem ? castItem.GetGUID() : ObjectGuid.Empty;
|
||||
ObjectGuid itemGuid = castItem != null ? castItem.GetGUID() : ObjectGuid.Empty;
|
||||
|
||||
if (m_spell == spell_id && m_spellCastItem == itemGuid)
|
||||
return;
|
||||
|
||||
@@ -510,9 +510,9 @@ namespace Game.Entities
|
||||
|
||||
// group update
|
||||
Player player = ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
if (player.GetGroup())
|
||||
if (player.GetGroup() != null)
|
||||
player.SetGroupUpdateFlag(GroupUpdateFlags.CurHp);
|
||||
}
|
||||
else if (IsPet())
|
||||
@@ -536,7 +536,7 @@ namespace Game.Entities
|
||||
// group update
|
||||
if (IsTypeId(TypeId.Player))
|
||||
{
|
||||
if (ToPlayer().GetGroup())
|
||||
if (ToPlayer().GetGroup() != null)
|
||||
ToPlayer().SetGroupUpdateFlag(GroupUpdateFlags.MaxHp);
|
||||
}
|
||||
else if (IsPet())
|
||||
@@ -590,7 +590,7 @@ namespace Game.Entities
|
||||
Player thisPlayer = ToPlayer();
|
||||
if (thisPlayer != null)
|
||||
{
|
||||
if (thisPlayer.GetGroup())
|
||||
if (thisPlayer.GetGroup() != null)
|
||||
thisPlayer.SetGroupUpdateFlag(GroupUpdateFlags.PowerType);
|
||||
}
|
||||
/*else if (IsPet()) TODO 6.x
|
||||
@@ -634,7 +634,7 @@ namespace Game.Entities
|
||||
// group update
|
||||
if (IsTypeId(TypeId.Player))
|
||||
{
|
||||
if (ToPlayer().GetGroup())
|
||||
if (ToPlayer().GetGroup() != null)
|
||||
ToPlayer().SetGroupUpdateFlag(GroupUpdateFlags.MaxPower);
|
||||
}
|
||||
/*else if (IsPet()) TODO 6.x
|
||||
@@ -675,7 +675,7 @@ namespace Game.Entities
|
||||
if (IsTypeId(TypeId.Player))
|
||||
{
|
||||
Player player = ToPlayer();
|
||||
if (player.GetGroup())
|
||||
if (player.GetGroup() != null)
|
||||
player.SetGroupUpdateFlag(GroupUpdateFlags.CurPower);
|
||||
}
|
||||
/*else if (IsPet()) TODO 6.x
|
||||
@@ -788,7 +788,7 @@ namespace Game.Entities
|
||||
target = owner;
|
||||
}
|
||||
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
damage -= (int)target.GetDamageReduction((uint)damage);
|
||||
@@ -809,13 +809,13 @@ namespace Game.Entities
|
||||
float GetCombatRatingReduction(CombatRating cr)
|
||||
{
|
||||
Player player = ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
return player.GetRatingBonusValue(cr);
|
||||
// Player's pet get resilience from owner
|
||||
else if (IsPet() && GetOwner())
|
||||
else if (IsPet() && GetOwner() != null)
|
||||
{
|
||||
Player owner = GetOwner().ToPlayer();
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
return owner.GetRatingBonusValue(cr);
|
||||
}
|
||||
|
||||
@@ -954,7 +954,7 @@ namespace Game.Entities
|
||||
float chance = 0.0f;
|
||||
float levelBonus = 0.0f;
|
||||
Player playerVictim = victim.ToPlayer();
|
||||
if (playerVictim)
|
||||
if (playerVictim != null)
|
||||
chance = playerVictim.m_activePlayerData.DodgePercentage;
|
||||
else
|
||||
{
|
||||
@@ -991,15 +991,15 @@ namespace Game.Entities
|
||||
float chance = 0.0f;
|
||||
float levelBonus = 0.0f;
|
||||
Player playerVictim = victim.ToPlayer();
|
||||
if (playerVictim)
|
||||
if (playerVictim != null)
|
||||
{
|
||||
if (playerVictim.CanParry())
|
||||
{
|
||||
Item tmpitem = playerVictim.GetWeaponForAttack(WeaponAttackType.BaseAttack, true);
|
||||
if (!tmpitem)
|
||||
if (tmpitem == null)
|
||||
tmpitem = playerVictim.GetWeaponForAttack(WeaponAttackType.OffAttack, true);
|
||||
|
||||
if (tmpitem)
|
||||
if (tmpitem != null)
|
||||
chance = playerVictim.m_activePlayerData.ParryPercentage;
|
||||
}
|
||||
}
|
||||
@@ -1039,12 +1039,12 @@ namespace Game.Entities
|
||||
float chance = 0.0f;
|
||||
float levelBonus = 0.0f;
|
||||
Player playerVictim = victim.ToPlayer();
|
||||
if (playerVictim)
|
||||
if (playerVictim != null)
|
||||
{
|
||||
if (playerVictim.CanBlock())
|
||||
{
|
||||
Item tmpitem = playerVictim.GetUseableItemByPos(InventorySlots.Bag0, EquipmentSlot.OffHand);
|
||||
if (tmpitem && !tmpitem.IsBroken() && tmpitem.GetTemplate().GetInventoryType() == InventoryType.Shield)
|
||||
if (tmpitem != null && !tmpitem.IsBroken() && tmpitem.GetTemplate().GetInventoryType() == InventoryType.Shield)
|
||||
chance = playerVictim.m_activePlayerData.BlockPercentage;
|
||||
}
|
||||
}
|
||||
@@ -1391,7 +1391,7 @@ namespace Game.Entities
|
||||
{
|
||||
UpdateDamagePhysical(WeaponAttackType.BaseAttack);
|
||||
Item offhand = GetWeaponForAttack(WeaponAttackType.OffAttack, true);
|
||||
if (offhand)
|
||||
if (offhand != null)
|
||||
if (CanDualWield() || offhand.GetTemplate().HasFlag(ItemFlags3.AlwaysAllowDualWield))
|
||||
UpdateDamagePhysical(WeaponAttackType.OffAttack);
|
||||
|
||||
@@ -1432,7 +1432,7 @@ namespace Game.Entities
|
||||
SetArmor((int)value, (int)(value - baseValue));
|
||||
|
||||
Pet pet = GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.UpdateArmor();
|
||||
|
||||
UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
|
||||
|
||||
@@ -385,7 +385,7 @@ namespace Game.Entities
|
||||
bool IsSharingTotemSlotWith(ObjectGuid objectGuid)
|
||||
{
|
||||
Creature otherSummon = GetMap().GetCreature(objectGuid);
|
||||
if (!otherSummon)
|
||||
if (otherSummon == null)
|
||||
return false;
|
||||
|
||||
SpellInfo mySummonSpell = Global.SpellMgr.GetSpellInfo(m_unitData.CreatedBySpell, Difficulty.None);
|
||||
@@ -456,7 +456,7 @@ namespace Game.Entities
|
||||
: base(properties, owner, isWorldObject)
|
||||
{
|
||||
m_owner = owner;
|
||||
Cypher.Assert(m_owner);
|
||||
Cypher.Assert(m_owner != null);
|
||||
UnitTypeMask |= UnitTypeMask.Minion;
|
||||
m_followAngle = SharedConst.PetFollowAngle;
|
||||
/// @todo: Find correct way
|
||||
@@ -513,7 +513,7 @@ namespace Game.Entities
|
||||
|
||||
public override string GetDebugInfo()
|
||||
{
|
||||
return $"{base.GetDebugInfo()}\nOwner: {(GetOwner() ? GetOwner().GetGUID() : "")}";
|
||||
return $"{base.GetDebugInfo()}\nOwner: {(GetOwner() != null ? GetOwner().GetGUID() : "")}";
|
||||
}
|
||||
|
||||
public override Unit GetOwner() { return m_owner; }
|
||||
@@ -1033,7 +1033,7 @@ namespace Game.Entities
|
||||
else
|
||||
val = 2 * GetStat(Stats.Strength) - 20.0f;
|
||||
|
||||
Player owner = GetOwner() ? GetOwner().ToPlayer() : null;
|
||||
Player owner = GetOwner() != null ? GetOwner().ToPlayer() : null;
|
||||
if (owner != null)
|
||||
{
|
||||
if (IsHunterPet()) //hunter pets benefit from owner's attack power
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Game.Entities
|
||||
{
|
||||
// client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem
|
||||
Player owner = GetOwner().ToPlayer();
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
{
|
||||
int slot = m_Properties.Slot;
|
||||
if (slot == (int)SummonSlot.Any)
|
||||
@@ -121,12 +121,12 @@ namespace Game.Entities
|
||||
GetSpellHistory().SendCooldownEvent(spell, 0, null, false);
|
||||
|
||||
Group group = owner.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player target = refe.GetSource();
|
||||
if (target && target.IsInMap(owner) && group.SameSubGroup(owner, target))
|
||||
if (target != null && target.IsInMap(owner) && group.SameSubGroup(owner, target))
|
||||
target.RemoveAurasDueToSpell(GetSpell(), GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ namespace Game.Entities
|
||||
passenger.m_movementInfo.transport.guid = GetGUID();
|
||||
|
||||
Player player = passenger.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
Global.ScriptMgr.OnAddPassenger(this, player);
|
||||
}
|
||||
}
|
||||
@@ -358,7 +358,7 @@ namespace Game.Entities
|
||||
return null;
|
||||
|
||||
Creature creature = Creature.CreateCreatureFromDB(guid, map, false, true);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
return null;
|
||||
|
||||
float x, y, z, o;
|
||||
@@ -377,7 +377,7 @@ namespace Game.Entities
|
||||
// because the current GameObjectModel cannot be moved without recreating
|
||||
creature.AddUnitState(UnitState.IgnorePathfinding);
|
||||
|
||||
if (!creature.IsPositionValid())
|
||||
if (creature.IsPositionValid())
|
||||
{
|
||||
Log.outError(LogFilter.Transport, "Creature (guidlow {0}, entry {1}) not created. Suggested coordinates aren't valid (X: {2} Y: {3})", creature.GetGUID().ToString(), creature.GetEntry(), creature.GetPositionX(), creature.GetPositionY());
|
||||
return null;
|
||||
@@ -401,7 +401,7 @@ namespace Game.Entities
|
||||
return null;
|
||||
|
||||
GameObject go = CreateGameObjectFromDB(guid, map, false);
|
||||
if (!go)
|
||||
if (go == null)
|
||||
return null;
|
||||
|
||||
float x, y, z, o;
|
||||
@@ -653,7 +653,7 @@ namespace Game.Entities
|
||||
{
|
||||
// will be relocated in UpdatePosition of the vehicle
|
||||
Unit veh = obj.ToUnit().GetVehicleBase();
|
||||
if (veh)
|
||||
if (veh != null)
|
||||
if (veh.GetTransport() == this)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -275,7 +275,7 @@ namespace Game.Entities
|
||||
Log.outDebug(LogFilter.Vehicle, "Vehicle ({0}, Entry {1}): installing accessory (Entry: {2}) on seat: {3}", _me.GetGUID().ToString(), GetCreatureEntry(), entry, seatId);
|
||||
|
||||
TempSummon accessory = _me.SummonCreature(entry, _me, (TempSummonType)type, TimeSpan.FromMilliseconds(summonTime));
|
||||
Cypher.Assert(accessory);
|
||||
Cypher.Assert(accessory != null);
|
||||
|
||||
if (minion)
|
||||
accessory.AddUnitTypeMask(UnitTypeMask.Accessory);
|
||||
@@ -600,11 +600,6 @@ namespace Game.Entities
|
||||
public Dictionary<sbyte, VehicleSeat> Seats = new();
|
||||
public uint UsableSeatNum; //< Number of seats that match VehicleSeatEntry.UsableByPlayer, used for proper display flags
|
||||
|
||||
public static implicit operator bool(Vehicle vehicle)
|
||||
{
|
||||
return vehicle != null;
|
||||
}
|
||||
|
||||
public enum Status
|
||||
{
|
||||
None,
|
||||
@@ -677,7 +672,7 @@ namespace Game.Entities
|
||||
{
|
||||
// drop flag
|
||||
Battleground bg = player.GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
bg.EventPlayerDroppedFlag(player);
|
||||
|
||||
player.StopCastingCharm();
|
||||
|
||||
Reference in New Issue
Block a user