Some cleanups. (might break build for scripts as they are a WIP)

This commit is contained in:
hondacrx
2023-10-08 10:35:31 -04:00
parent fa10b981bd
commit cda53c8e7f
208 changed files with 2266 additions and 2329 deletions
+15 -15
View File
@@ -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();
}
}