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
+8 -8
View File
@@ -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;