Some cleanups. (might break build for scripts as they are a WIP)
This commit is contained in:
@@ -50,7 +50,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
Global.BattlegroundMgr.RemoveBattleground(GetTypeID(), GetInstanceID());
|
||||
// unload map
|
||||
if (m_Map)
|
||||
if (m_Map != null)
|
||||
{
|
||||
m_Map.UnloadAll(); // unload all objects (they may hold a reference to bg in their ZoneScript pointer)
|
||||
m_Map.SetUnload(); // mark for deletion by MapManager
|
||||
@@ -152,7 +152,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var guid in GetPlayers().Keys)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
if (player.IsGameMaster())
|
||||
continue;
|
||||
@@ -273,7 +273,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var guid in GetPlayers().Keys)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
player.ResetAllPowers();
|
||||
}
|
||||
}
|
||||
@@ -291,7 +291,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var guid in GetPlayers().Keys)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
player.SendPacket(timer);
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace Game.BattleGrounds
|
||||
{
|
||||
m_Events |= BattlegroundEventFlags.Event1;
|
||||
|
||||
if (!FindBgMap())
|
||||
if (FindBgMap() == null)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, $"Battleground._ProcessJoin: map (map id: {GetMapId()}, instance id: {m_InstanceID}) is not created!");
|
||||
EndNow();
|
||||
@@ -364,7 +364,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var guid in GetPlayers().Keys)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
// Correctly display EnemyUnitFrame
|
||||
player.SetArenaFaction((byte)player.GetBGTeam());
|
||||
@@ -393,7 +393,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var guid in GetPlayers().Keys)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
player.RemoveAurasDueToSpell(BattlegroundConst.SpellPreparation);
|
||||
player.ResetAllPowers();
|
||||
@@ -433,7 +433,7 @@ namespace Game.BattleGrounds
|
||||
if (!offlineRemove)
|
||||
{
|
||||
player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (!player)
|
||||
if (player == null)
|
||||
Log.outError(LogFilter.Battleground, $"Battleground.{context}: player ({guid}) not found for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||
}
|
||||
return player;
|
||||
@@ -447,7 +447,7 @@ namespace Game.BattleGrounds
|
||||
Player _GetPlayerForTeam(Team teamId, KeyValuePair<ObjectGuid, BattlegroundPlayer> pair, string context)
|
||||
{
|
||||
Player player = _GetPlayer(pair, context);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
Team team = pair.Value.Team;
|
||||
if (team == 0)
|
||||
@@ -460,7 +460,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
public BattlegroundMap GetBgMap()
|
||||
{
|
||||
Cypher.Assert(m_Map);
|
||||
Cypher.Assert(m_Map != null);
|
||||
return m_Map;
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var pair in m_Players)
|
||||
{
|
||||
Player player = _GetPlayer(pair, "SendPacketToAll");
|
||||
if (player)
|
||||
if (player != null)
|
||||
player.SendPacket(packet);
|
||||
}
|
||||
}
|
||||
@@ -490,7 +490,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var pair in m_Players)
|
||||
{
|
||||
Player player = _GetPlayerForTeam(team, pair, "SendPacketToTeam");
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
if (player != except)
|
||||
player.SendPacket(packet);
|
||||
@@ -531,7 +531,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var pair in m_Players)
|
||||
{
|
||||
Player player = _GetPlayerForTeam(team, pair, "CastSpellOnTeam");
|
||||
if (player)
|
||||
if (player != null)
|
||||
player.CastSpell(player, SpellID, true);
|
||||
}
|
||||
}
|
||||
@@ -541,7 +541,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var pair in m_Players)
|
||||
{
|
||||
Player player = _GetPlayerForTeam(team, pair, "RemoveAuraOnTeam");
|
||||
if (player)
|
||||
if (player != null)
|
||||
player.RemoveAura(SpellID);
|
||||
}
|
||||
}
|
||||
@@ -551,7 +551,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var pair in m_Players)
|
||||
{
|
||||
Player player = _GetPlayerForTeam(team, pair, "RewardHonorToTeam");
|
||||
if (player)
|
||||
if (player != null)
|
||||
UpdatePlayerScore(player, ScoreType.BonusHonor, Honor);
|
||||
}
|
||||
}
|
||||
@@ -565,7 +565,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var pair in m_Players)
|
||||
{
|
||||
Player player = _GetPlayerForTeam(team, pair, "RewardReputationToTeam");
|
||||
if (!player)
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
if (player.HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode))
|
||||
@@ -648,7 +648,7 @@ namespace Game.BattleGrounds
|
||||
Team team = pair.Value.Team;
|
||||
|
||||
Player player = _GetPlayer(pair, "EndBattleground");
|
||||
if (!player)
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
// should remove spirit of redemption
|
||||
@@ -726,7 +726,7 @@ namespace Game.BattleGrounds
|
||||
if (guildId != 0)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildById(guildId);
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.UpdateCriteria(CriteriaType.WinBattleground, player.GetMapId(), 0, 0, null, player);
|
||||
}
|
||||
}
|
||||
@@ -791,7 +791,7 @@ namespace Game.BattleGrounds
|
||||
PlayerScores.Remove(guid);
|
||||
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
// should remove spirit of redemption
|
||||
if (player.HasAuraType(AuraType.SpiritOfRedemption))
|
||||
@@ -822,7 +822,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
if (participant) // if the player was a match participant, remove auras, calc rating, update queue
|
||||
{
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
player.ClearAfkReports();
|
||||
|
||||
@@ -847,7 +847,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
// remove from raid group if player is member
|
||||
Group group = GetBgRaid(team);
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
if (!group.RemoveMember(guid)) // group was disbanded
|
||||
SetBgRaid(team, null);
|
||||
@@ -866,7 +866,7 @@ namespace Game.BattleGrounds
|
||||
SendPacketToTeam(team, playerLeft, player);
|
||||
}
|
||||
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
// Do next only if found in Battleground
|
||||
player.SetBattlegroundId(0, BattlegroundTypeId.None); // We're not in BG.
|
||||
@@ -1055,7 +1055,7 @@ namespace Game.BattleGrounds
|
||||
{
|
||||
ObjectGuid playerGuid = player.GetGUID();
|
||||
Group group = GetBgRaid(team);
|
||||
if (!group) // first player joined
|
||||
if (group == null) // first player joined
|
||||
{
|
||||
group = new Group();
|
||||
SetBgRaid(team, group);
|
||||
@@ -1072,12 +1072,14 @@ namespace Game.BattleGrounds
|
||||
{
|
||||
group.AddMember(player);
|
||||
Group originalGroup = player.GetOriginalGroup();
|
||||
if (originalGroup)
|
||||
if (originalGroup != null)
|
||||
{
|
||||
if (originalGroup.IsLeader(playerGuid))
|
||||
{
|
||||
group.ChangeLeader(playerGuid);
|
||||
group.SendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1235,7 +1237,7 @@ namespace Game.BattleGrounds
|
||||
score.Value.BuildPvPLogPlayerDataPacket(out playerData);
|
||||
|
||||
Player player = Global.ObjAccessor.GetPlayer(GetBgMap(), playerData.PlayerGUID);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
playerData.IsInWorld = true;
|
||||
playerData.PrimaryTalentTree = (int)player.GetPrimarySpecialization();
|
||||
@@ -1269,7 +1271,7 @@ namespace Game.BattleGrounds
|
||||
public bool AddObject(int type, uint entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint respawnTime = 0, GameObjectState goState = GameObjectState.Ready)
|
||||
{
|
||||
Map map = FindBgMap();
|
||||
if (!map)
|
||||
if (map == null)
|
||||
return false;
|
||||
|
||||
Quaternion rotation = new(rotation0, rotation1, rotation2, rotation3);
|
||||
@@ -1286,7 +1288,7 @@ namespace Game.BattleGrounds
|
||||
// and when loading it (in go.LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
|
||||
// So we must create it specific for this instance
|
||||
GameObject go = GameObject.CreateGameObject(entry, GetBgMap(), new Position(x, y, z, o), rotation, 255, goState);
|
||||
if (!go)
|
||||
if (go == null)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, $"Battleground.AddObject: cannot create gameobject (entry: {entry}) for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||
return false;
|
||||
@@ -1310,7 +1312,7 @@ namespace Game.BattleGrounds
|
||||
public void DoorClose(int type)
|
||||
{
|
||||
GameObject obj = GetBgMap().GetGameObject(BgObjects[type]);
|
||||
if (obj)
|
||||
if (obj != null)
|
||||
{
|
||||
// If doors are open, close it
|
||||
if (obj.GetLootState() == LootState.Activated && obj.GetGoState() != GameObjectState.Ready)
|
||||
@@ -1326,7 +1328,7 @@ namespace Game.BattleGrounds
|
||||
public void DoorOpen(int type)
|
||||
{
|
||||
GameObject obj = GetBgMap().GetGameObject(BgObjects[type]);
|
||||
if (obj)
|
||||
if (obj != null)
|
||||
{
|
||||
obj.SetLootState(LootState.Activated);
|
||||
obj.SetGoState(GameObjectState.Active);
|
||||
@@ -1341,7 +1343,7 @@ namespace Game.BattleGrounds
|
||||
return null;
|
||||
|
||||
GameObject obj = GetBgMap().GetGameObject(BgObjects[type]);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
Log.outError(LogFilter.Battleground, $"Battleground.GetBGObject: gameobject (type: {type}, {BgObjects[type]}) not found for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||
|
||||
return obj;
|
||||
@@ -1353,7 +1355,7 @@ namespace Game.BattleGrounds
|
||||
return null;
|
||||
|
||||
Creature creature = GetBgMap().GetCreature(BgCreatures[type]);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
Log.outError(LogFilter.Battleground, $"Battleground.GetBGCreature: creature (type: {type}, {BgCreatures[type]}) not found for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||
|
||||
return creature;
|
||||
@@ -1370,7 +1372,7 @@ namespace Game.BattleGrounds
|
||||
if (map != null)
|
||||
{
|
||||
GameObject obj = map.GetGameObject(BgObjects[type]);
|
||||
if (obj)
|
||||
if (obj != null)
|
||||
{
|
||||
if (respawntime != 0)
|
||||
{
|
||||
@@ -1400,7 +1402,7 @@ namespace Game.BattleGrounds
|
||||
public virtual Creature AddCreature(uint entry, int type, float x, float y, float z, float o, int teamIndex = TeamId.Neutral, uint respawntime = 0, Transport transport = null)
|
||||
{
|
||||
Map map = FindBgMap();
|
||||
if (!map)
|
||||
if (map == null)
|
||||
return null;
|
||||
|
||||
if (Global.ObjectMgr.GetCreatureTemplate(entry) == null)
|
||||
@@ -1410,10 +1412,10 @@ namespace Game.BattleGrounds
|
||||
}
|
||||
|
||||
|
||||
if (transport)
|
||||
if (transport != null)
|
||||
{
|
||||
Creature transCreature = transport.SummonPassenger(entry, new Position(x, y, z, o), TempSummonType.ManualDespawn);
|
||||
if (transCreature)
|
||||
if (transCreature != null)
|
||||
{
|
||||
BgCreatures[type] = transCreature.GetGUID();
|
||||
return transCreature;
|
||||
@@ -1425,7 +1427,7 @@ namespace Game.BattleGrounds
|
||||
Position pos = new(x, y, z, o);
|
||||
|
||||
Creature creature = Creature.CreateCreature(entry, map, pos);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, $"Battleground.AddCreature: cannot create creature (entry: {entry}) for BG (map: {GetMapId()}, instance id: {m_InstanceID})!");
|
||||
return null;
|
||||
@@ -1455,7 +1457,7 @@ namespace Game.BattleGrounds
|
||||
return true;
|
||||
|
||||
Creature creature = GetBgMap().GetCreature(BgCreatures[type]);
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
{
|
||||
creature.AddObjectToRemoveList();
|
||||
BgCreatures[type].Clear();
|
||||
@@ -1473,7 +1475,7 @@ namespace Game.BattleGrounds
|
||||
return true;
|
||||
|
||||
GameObject obj = GetBgMap().GetGameObject(BgObjects[type]);
|
||||
if (obj)
|
||||
if (obj != null)
|
||||
{
|
||||
obj.SetRespawnTime(0); // not save respawn time
|
||||
obj.Delete();
|
||||
@@ -1562,7 +1564,7 @@ namespace Game.BattleGrounds
|
||||
// Add +1 deaths
|
||||
UpdatePlayerScore(victim, ScoreType.Deaths, 1);
|
||||
// Add +1 kills to group and +1 killing_blows to killer
|
||||
if (killer)
|
||||
if (killer != null)
|
||||
{
|
||||
// Don't reward credit for killing ourselves, like fall damage of hellfire (warlock)
|
||||
if (killer == victim)
|
||||
@@ -1576,7 +1578,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var (guid, player) in m_Players)
|
||||
{
|
||||
Player creditedPlayer = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (!creditedPlayer || creditedPlayer == killer)
|
||||
if (creditedPlayer == null || creditedPlayer == killer)
|
||||
continue;
|
||||
|
||||
if (player.Team == killerTeam && creditedPlayer.IsAtGroupRewardDistance(victim))
|
||||
@@ -1650,7 +1652,7 @@ namespace Game.BattleGrounds
|
||||
if (pair.Value.Team == Team)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player && player.IsAlive())
|
||||
if (player != null && player.IsAlive())
|
||||
++count;
|
||||
}
|
||||
}
|
||||
@@ -1669,9 +1671,9 @@ namespace Game.BattleGrounds
|
||||
void SetBgRaid(Team team, Group bg_raid)
|
||||
{
|
||||
Group old_raid = m_BgRaids[GetTeamIndexByTeamId(team)];
|
||||
if (old_raid)
|
||||
if (old_raid != null)
|
||||
old_raid.SetBattlegroundGroup(null);
|
||||
if (bg_raid)
|
||||
if (bg_raid != null)
|
||||
bg_raid.SetBattlegroundGroup(this);
|
||||
m_BgRaids[GetTeamIndexByTeamId(team)] = bg_raid;
|
||||
}
|
||||
@@ -1688,7 +1690,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var guid in GetPlayers().Keys)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
GameEvents.TriggerForPlayer(gameEventId, player);
|
||||
}
|
||||
}
|
||||
@@ -1700,7 +1702,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
void RewardXPAtKill(Player killer, Player victim)
|
||||
{
|
||||
if (WorldConfig.GetBoolValue(WorldCfg.BgXpForKill) && killer && victim)
|
||||
if (WorldConfig.GetBoolValue(WorldCfg.BgXpForKill) && killer != null && victim != null)
|
||||
new KillRewarder(new[] { killer }, victim, true).Reward();
|
||||
}
|
||||
|
||||
@@ -1911,16 +1913,11 @@ namespace Game.BattleGrounds
|
||||
foreach (var pair in m_Players)
|
||||
{
|
||||
Player player = _GetPlayer(pair, "BroadcastWorker");
|
||||
if (player)
|
||||
if (player != null)
|
||||
_do.Invoke(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static implicit operator bool (Battleground bg)
|
||||
{
|
||||
return bg != null;
|
||||
}
|
||||
|
||||
#region Fields
|
||||
protected Dictionary<ObjectGuid, BattlegroundScore> PlayerScores = new(); // Player scores
|
||||
// Player lists, those need to be accessible by inherited classes
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace Game.BattleGrounds
|
||||
{
|
||||
var bgs = it.Value.m_Battlegrounds;
|
||||
var bg = bgs.LookupByKey(instanceId);
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
return bg;
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ namespace Game.BattleGrounds
|
||||
public void SendToBattleground(Player player, uint instanceId, BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
Battleground bg = GetBattleground(instanceId, bgTypeId);
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
{
|
||||
uint mapid = bg.GetMapId();
|
||||
Team team = player.GetBGTeam();
|
||||
@@ -676,7 +676,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
public void AddBattleground(Battleground bg)
|
||||
{
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
bgDataStore[bg.GetTypeID()].m_Battlegrounds[bg.GetInstanceID()] = bg;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,12 +80,12 @@ namespace Game.BattleGrounds
|
||||
}
|
||||
|
||||
//add players from group to ginfo
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player member = refe.GetSource();
|
||||
if (!member)
|
||||
if (member == null)
|
||||
continue; // this should never happen
|
||||
|
||||
PlayerQueueInfo pl_info = new();
|
||||
@@ -210,7 +210,7 @@ namespace Game.BattleGrounds
|
||||
{
|
||||
string playerName = "Unknown";
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
playerName = player.GetName();
|
||||
Log.outDebug(LogFilter.Battleground, "BattlegroundQueue: couldn't find player {0} ({1})", playerName, guid.ToString());
|
||||
return;
|
||||
@@ -264,7 +264,7 @@ namespace Game.BattleGrounds
|
||||
if (decreaseInvitedCount && group.IsInvitedToBGInstanceGUID != 0)
|
||||
{
|
||||
Battleground bg = Global.BattlegroundMgr.GetBattleground(group.IsInvitedToBGInstanceGUID, (BattlegroundTypeId)m_queueId.BattlemasterListId);
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
bg.DecreaseInvitedCount(group.Team);
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace Game.BattleGrounds
|
||||
{
|
||||
Log.outDebug(LogFilter.Battleground, "UPDATING memberLost's personal arena rating for {0} by opponents rating: {1}", guid.ToString(), group.OpponentsTeamRating);
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
at.MemberLost(player, group.OpponentsMatchmakerRating);
|
||||
else
|
||||
at.OfflineMemberLost(guid, group.OpponentsMatchmakerRating);
|
||||
@@ -310,7 +310,7 @@ namespace Game.BattleGrounds
|
||||
// remove next player, this is recursive
|
||||
// first send removal information
|
||||
Player plr2 = Global.ObjAccessor.FindConnectedPlayer(group.Players.FirstOrDefault().Key);
|
||||
if (plr2)
|
||||
if (plr2 != null)
|
||||
{
|
||||
uint queueSlot = plr2.GetBattlegroundQueueIndex(m_queueId);
|
||||
|
||||
@@ -378,7 +378,7 @@ namespace Game.BattleGrounds
|
||||
// get the player
|
||||
Player player = Global.ObjAccessor.FindPlayer(guid);
|
||||
// if offline, skip him, this should not happen - player is removed from queue when he logs out
|
||||
if (!player)
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
// invite the player
|
||||
@@ -911,7 +911,7 @@ namespace Game.BattleGrounds
|
||||
GroupQueueInfo aTeam = queueArray[TeamId.Alliance];
|
||||
GroupQueueInfo hTeam = queueArray[TeamId.Horde];
|
||||
Battleground arena = Global.BattlegroundMgr.CreateNewBattleground(m_queueId, bracket_id);
|
||||
if (!arena)
|
||||
if (arena == null)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, "BattlegroundQueue.Update couldn't create arena instance for rated arena match!");
|
||||
return;
|
||||
@@ -1156,7 +1156,7 @@ namespace Game.BattleGrounds
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(m_PlayerGuid);
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return true;
|
||||
|
||||
Battleground bg = Global.BattlegroundMgr.GetBattleground(m_BgInstanceGUID, m_BgTypeId);
|
||||
@@ -1206,7 +1206,7 @@ namespace Game.BattleGrounds
|
||||
public override bool Execute(ulong e_time, uint p_time)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(m_PlayerGuid);
|
||||
if (!player)
|
||||
if (player == null)
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
return true;
|
||||
|
||||
@@ -1226,7 +1226,7 @@ namespace Game.BattleGrounds
|
||||
player.RemoveBattlegroundQueueId(m_BgQueueTypeId);
|
||||
bgQueue.RemovePlayer(m_PlayerGuid, true);
|
||||
//update queues if Battleground isn't ended
|
||||
if (bg && bg.IsBattleground() && bg.GetStatus() != BattlegroundStatus.WaitLeave)
|
||||
if (bg != null && bg.IsBattleground() && bg.GetStatus() != BattlegroundStatus.WaitLeave)
|
||||
Global.BattlegroundMgr.ScheduleQueueUpdate(0, m_BgQueueTypeId, bg.GetBracketId());
|
||||
|
||||
BattlefieldStatusNone battlefieldStatus;
|
||||
|
||||
@@ -354,13 +354,13 @@ namespace Game.BattleGrounds.Zones
|
||||
CastSpellOnTeam(BattlegroundConst.AbQuestReward4Bases, team);
|
||||
|
||||
Creature trigger = !BgCreatures[node + 7].IsEmpty() ? GetBGCreature(node + 7) : null; // 0-6 spirit guides
|
||||
if (!trigger)
|
||||
if (trigger == null)
|
||||
trigger = AddCreature(SharedConst.WorldTrigger, node + 7, NodePositions[node], GetTeamIndexByTeamId(team));
|
||||
|
||||
//add bonus honor aura trigger creature when node is accupied
|
||||
//cast bonus aura (+50% honor in 25yards)
|
||||
//aura should only apply to players who have accupied the node, set correct faction for trigger
|
||||
if (trigger)
|
||||
if (trigger != null)
|
||||
{
|
||||
trigger.SetFaction(team == Team.Alliance ? 84u : 83u);
|
||||
trigger.CastSpell(trigger, BattlegroundConst.SpellHonorableDefender25y, false);
|
||||
@@ -389,7 +389,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
byte node = ABBattlegroundNodes.NodeStables;
|
||||
GameObject obj = GetBgMap().GetGameObject(BgObjects[node * 8 + 7]);
|
||||
while ((node < ABBattlegroundNodes.DynamicNodesCount) && ((!obj) || (!source.IsWithinDistInMap(obj, 10))))
|
||||
while ((node < ABBattlegroundNodes.DynamicNodesCount) && ((obj == null) || (!source.IsWithinDistInMap(obj, 10))))
|
||||
{
|
||||
++node;
|
||||
obj = GetBgMap().GetGameObject(BgObjects[node * 8 + ABObjectTypes.AuraContested]);
|
||||
|
||||
@@ -153,13 +153,13 @@ namespace Game.BattleGrounds.Zones
|
||||
for (byte i = 0; i < EotSPoints.PointsMax; ++i)
|
||||
{
|
||||
obj = GetBgMap().GetGameObject(BgObjects[EotSObjectTypes.TowerCapFelReaver + i]);
|
||||
if (obj)
|
||||
if (obj != null)
|
||||
{
|
||||
byte j = 0;
|
||||
while (j < m_PlayersNearPoint[EotSPoints.PointsMax].Count)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(m_PlayersNearPoint[EotSPoints.PointsMax][j]);
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, "BattlegroundEY:CheckSomeoneJoinedPoint: Player ({0}) could not be found!", m_PlayersNearPoint[EotSPoints.PointsMax][j].ToString());
|
||||
++j;
|
||||
@@ -194,13 +194,13 @@ namespace Game.BattleGrounds.Zones
|
||||
for (byte i = 0; i < EotSPoints.PointsMax; ++i)
|
||||
{
|
||||
obj = GetBgMap().GetGameObject(BgObjects[EotSObjectTypes.TowerCapFelReaver + i]);
|
||||
if (obj)
|
||||
if (obj != null)
|
||||
{
|
||||
byte j = 0;
|
||||
while (j < m_PlayersNearPoint[i].Count)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(m_PlayersNearPoint[i][j]);
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, "BattlegroundEY:CheckSomeoneLeftPoint Player ({0}) could not be found!", m_PlayersNearPoint[i][j].ToString());
|
||||
//move non-existing players to "free space" - this will cause many errors showing in log, but it is a very important bug
|
||||
@@ -256,7 +256,7 @@ namespace Game.BattleGrounds.Zones
|
||||
for (byte i = 0; i < m_PlayersNearPoint[point].Count; ++i)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(m_PlayersNearPoint[point][i]);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
player.SendUpdateWorldState(EotSWorldStateIds.ProgressBarStatus, (uint)m_PointBarStatus[point]);
|
||||
Team team = GetPlayerTeam(player.GetGUID());
|
||||
@@ -375,7 +375,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
if (m_FlagKeeper == guid)
|
||||
{
|
||||
if (player)
|
||||
if (player != null)
|
||||
EventPlayerDroppedFlag(player);
|
||||
else
|
||||
{
|
||||
@@ -578,7 +578,7 @@ namespace Game.BattleGrounds.Zones
|
||||
RespawnFlag(true);
|
||||
|
||||
GameObject obj = GetBgMap().GetGameObject(GetDroppedFlagGUID());
|
||||
if (obj)
|
||||
if (obj != null)
|
||||
obj.Delete();
|
||||
else
|
||||
Log.outError(LogFilter.Battleground, "BattlegroundEY: Unknown dropped flag ({0}).", GetDroppedFlagGUID().ToString());
|
||||
@@ -764,13 +764,13 @@ namespace Game.BattleGrounds.Zones
|
||||
return;
|
||||
|
||||
Creature trigger = GetBGCreature(Point + 6);//0-5 spirit guides
|
||||
if (!trigger)
|
||||
if (trigger == null)
|
||||
trigger = AddCreature(SharedConst.WorldTrigger, Point + 6, EotSMisc.TriggerPositions[Point], GetTeamIndexByTeamId(Team));
|
||||
|
||||
//add bonus honor aura trigger creature when node is accupied
|
||||
//cast bonus aura (+50% honor in 25yards)
|
||||
//aura should only apply to players who have accupied the node, set correct faction for trigger
|
||||
if (trigger)
|
||||
if (trigger != null)
|
||||
{
|
||||
trigger.SetFaction(Team == Team.Alliance ? 84u : 83);
|
||||
trigger.CastSpell(trigger, BattlegroundConst.SpellHonorableDefender25y, false);
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Game.BattleGrounds.Zones
|
||||
foreach (var pair in GetPlayers())
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player)
|
||||
if (player != null)
|
||||
SendTransportsRemove(player);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Game.BattleGrounds.Zones
|
||||
for (byte i = 0; i < GateStatus.Length; ++i)
|
||||
GateStatus[i] = Attackers == TeamId.Horde ? SAGateState.AllianceGateOk : SAGateState.HordeGateOk;
|
||||
|
||||
if (!AddCreature(SAMiscConst.NpcEntries[SACreatureTypes.Kanrethad], SACreatureTypes.Kanrethad, SAMiscConst.NpcSpawnlocs[SACreatureTypes.Kanrethad]))
|
||||
if (AddCreature(SAMiscConst.NpcEntries[SACreatureTypes.Kanrethad], SACreatureTypes.Kanrethad, SAMiscConst.NpcSpawnlocs[SACreatureTypes.Kanrethad]) == null)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn Kanrethad, aborted. Entry: {SAMiscConst.NpcEntries[SACreatureTypes.Kanrethad]}");
|
||||
return false;
|
||||
@@ -135,7 +135,7 @@ namespace Game.BattleGrounds.Zones
|
||||
//By capturing GYs.
|
||||
for (byte i = 0; i < SACreatureTypes.Demolisher5; i++)
|
||||
{
|
||||
if (!AddCreature(SAMiscConst.NpcEntries[i], i, SAMiscConst.NpcSpawnlocs[i], Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance, 600))
|
||||
if (AddCreature(SAMiscConst.NpcEntries[i], i, SAMiscConst.NpcSpawnlocs[i], Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance, 600) == null)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn Cannon or demolisher, Entry: {SAMiscConst.NpcEntries[i]}, Attackers: {(Attackers == TeamId.Alliance ? "Horde(1)" : "Alliance(0)")}");
|
||||
continue;
|
||||
@@ -252,7 +252,7 @@ namespace Game.BattleGrounds.Zones
|
||||
foreach (var pair in GetPlayers())
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player)
|
||||
if (player != null)
|
||||
SendTransportInit(player);
|
||||
}
|
||||
}
|
||||
@@ -276,15 +276,15 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
foreach (var pair in GetPlayers())
|
||||
{
|
||||
Player p = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (p)
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player != null)
|
||||
{
|
||||
UpdateData data = new(p.GetMapId());
|
||||
GetBGObject(i).BuildValuesUpdateBlockForPlayer(data, p);
|
||||
UpdateData data = new(player.GetMapId());
|
||||
GetBGObject(i).BuildValuesUpdateBlockForPlayer(data, player);
|
||||
|
||||
UpdateObject pkt;
|
||||
data.BuildPacket(out pkt);
|
||||
p.SendPacket(pkt);
|
||||
player.SendPacket(pkt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,9 +318,9 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdateWorldState(SAWorldStateIds.Timer, (int)(GameTime.GetGameTime() + EndRoundTimer));
|
||||
if (TotalTime >= SATimers.WarmupLength)
|
||||
{
|
||||
Creature c = GetBGCreature(SACreatureTypes.Kanrethad);
|
||||
if (c)
|
||||
SendChatMessage(c, SATextIds.RoundStarted);
|
||||
Creature creature = GetBGCreature(SACreatureTypes.Kanrethad);
|
||||
if (creature != null)
|
||||
SendChatMessage(creature, SATextIds.RoundStarted);
|
||||
|
||||
TotalTime = 0;
|
||||
ToggleTimer();
|
||||
@@ -342,9 +342,9 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdateWorldState(SAWorldStateIds.Timer, (int)(GameTime.GetGameTime() + EndRoundTimer));
|
||||
if (TotalTime >= 60000)
|
||||
{
|
||||
Creature c = GetBGCreature(SACreatureTypes.Kanrethad);
|
||||
if (c)
|
||||
SendChatMessage(c, SATextIds.RoundStarted);
|
||||
Creature creature = GetBGCreature(SACreatureTypes.Kanrethad);
|
||||
if (creature != null)
|
||||
SendChatMessage(creature, SATextIds.RoundStarted);
|
||||
|
||||
TotalTime = 0;
|
||||
ToggleTimer();
|
||||
@@ -355,9 +355,9 @@ namespace Game.BattleGrounds.Zones
|
||||
SetStatus(BattlegroundStatus.InProgress);
|
||||
foreach (var pair in GetPlayers())
|
||||
{
|
||||
Player p = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (p)
|
||||
p.RemoveAurasDueToSpell(BattlegroundConst.SpellPreparation);
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player != null)
|
||||
player.RemoveAurasDueToSpell(BattlegroundConst.SpellPreparation);
|
||||
}
|
||||
}
|
||||
if (TotalTime >= 30000)
|
||||
@@ -443,7 +443,7 @@ namespace Game.BattleGrounds.Zones
|
||||
foreach (var pair in GetPlayers())
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
// should remove spirit of redemption
|
||||
if (player.HasAuraType(AuraType.SpiritOfRedemption))
|
||||
@@ -488,12 +488,12 @@ namespace Game.BattleGrounds.Zones
|
||||
public override void ProcessEvent(WorldObject obj, uint eventId, WorldObject invoker = null)
|
||||
{
|
||||
GameObject go = obj.ToGameObject();
|
||||
if (go)
|
||||
if (go != null)
|
||||
{
|
||||
switch (go.GetGoType())
|
||||
{
|
||||
case GameObjectTypes.Goober:
|
||||
if (invoker)
|
||||
if (invoker != null)
|
||||
if (eventId == (uint)SAEventIds.BG_SA_EVENT_TITAN_RELIC_ACTIVATED)
|
||||
TitanRelicActivated(invoker.ToPlayer());
|
||||
break;
|
||||
@@ -509,9 +509,9 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
GateStatus[gateId] = Attackers == TeamId.Horde ? SAGateState.AllianceGateDamaged : SAGateState.HordeGateDamaged;
|
||||
|
||||
Creature c = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, (byte)gate.DamagedText, invoker);
|
||||
Creature creature = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (creature != null)
|
||||
SendChatMessage(creature, (byte)gate.DamagedText, invoker);
|
||||
|
||||
PlaySoundToAll(Attackers == TeamId.Alliance ? SASoundIds.WallAttackedAlliance : SASoundIds.WallAttackedHorde);
|
||||
}
|
||||
@@ -523,9 +523,9 @@ namespace Game.BattleGrounds.Zones
|
||||
if (gateId < 5)
|
||||
DelObject((int)gateId + 14);
|
||||
|
||||
Creature c = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, (byte)gate.DestroyedText, invoker);
|
||||
Creature creature = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (creature != null)
|
||||
SendChatMessage(creature, (byte)gate.DestroyedText, invoker);
|
||||
|
||||
PlaySoundToAll(Attackers == TeamId.Alliance ? SASoundIds.WallDestroyedAlliance : SASoundIds.WallDestroyedHorde);
|
||||
|
||||
@@ -552,13 +552,13 @@ namespace Game.BattleGrounds.Zones
|
||||
break;
|
||||
}
|
||||
|
||||
if (invoker)
|
||||
if (invoker != null)
|
||||
{
|
||||
Unit unit = invoker.ToUnit();
|
||||
if (unit)
|
||||
if (unit != null)
|
||||
{
|
||||
Player player = unit.GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
UpdatePlayerScore(player, ScoreType.DestroyedWall, 1);
|
||||
if (rewardHonor)
|
||||
@@ -605,14 +605,14 @@ namespace Game.BattleGrounds.Zones
|
||||
for (byte i = SACreatureTypes.Gun1; i <= SACreatureTypes.Gun10; i++)
|
||||
{
|
||||
Creature gun = GetBGCreature(i);
|
||||
if (gun)
|
||||
if (gun != null)
|
||||
gun.SetFaction(SAMiscConst.Factions[Attackers != 0 ? TeamId.Alliance : TeamId.Horde]);
|
||||
}
|
||||
|
||||
for (byte i = SACreatureTypes.Demolisher1; i <= SACreatureTypes.Demolisher4; i++)
|
||||
{
|
||||
Creature dem = GetBGCreature(i);
|
||||
if (dem)
|
||||
if (dem != null)
|
||||
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
||||
}
|
||||
}
|
||||
@@ -626,7 +626,7 @@ namespace Game.BattleGrounds.Zones
|
||||
for (byte i = SACreatureTypes.Demolisher1; i <= SACreatureTypes.Demolisher4; i++)
|
||||
{
|
||||
Creature dem = GetBGCreature(i);
|
||||
if (dem)
|
||||
if (dem != null)
|
||||
{
|
||||
if (start)
|
||||
{
|
||||
@@ -704,7 +704,7 @@ namespace Game.BattleGrounds.Zones
|
||||
void UpdateObjectInteractionFlags(uint objectId)
|
||||
{
|
||||
GameObject go = GetBGObject((int)objectId);
|
||||
if (go)
|
||||
if (go != null)
|
||||
{
|
||||
if (CanInteractWithObject(objectId))
|
||||
go.RemoveFlag(GameObjectFlags.NotSelectable);
|
||||
@@ -774,23 +774,23 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
npc = SACreatureTypes.Rigspark;
|
||||
Creature rigspark = AddCreature(SAMiscConst.NpcEntries[npc], (int)npc, SAMiscConst.NpcSpawnlocs[npc], Attackers);
|
||||
if (rigspark)
|
||||
if (rigspark != null)
|
||||
rigspark.GetAI().Talk(SATextIds.SparklightRigsparkSpawn);
|
||||
|
||||
for (byte j = SACreatureTypes.Demolisher7; j <= SACreatureTypes.Demolisher8; j++)
|
||||
{
|
||||
AddCreature(SAMiscConst.NpcEntries[j], j, SAMiscConst.NpcSpawnlocs[j], (Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance), 600);
|
||||
Creature dem = GetBGCreature(j);
|
||||
if (dem)
|
||||
if (dem != null)
|
||||
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
||||
}
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[i] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
||||
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, source);
|
||||
Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (creature != null)
|
||||
SendChatMessage(creature, teamId == TeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
case SAGraveyards.RightCapturableGy:
|
||||
@@ -802,7 +802,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
npc = SACreatureTypes.Sparklight;
|
||||
Creature sparklight = AddCreature(SAMiscConst.NpcEntries[npc], (int)npc, SAMiscConst.NpcSpawnlocs[npc], Attackers);
|
||||
if (sparklight)
|
||||
if (sparklight != null)
|
||||
sparklight.GetAI().Talk(SATextIds.SparklightRigsparkSpawn);
|
||||
|
||||
for (byte j = SACreatureTypes.Demolisher5; j <= SACreatureTypes.Demolisher6; j++)
|
||||
@@ -810,16 +810,16 @@ namespace Game.BattleGrounds.Zones
|
||||
AddCreature(SAMiscConst.NpcEntries[j], j, SAMiscConst.NpcSpawnlocs[j], Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance, 600);
|
||||
|
||||
Creature dem = GetBGCreature(j);
|
||||
if (dem)
|
||||
if (dem != null)
|
||||
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
||||
}
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[i] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
||||
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, source);
|
||||
Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (creature != null)
|
||||
SendChatMessage(creature, teamId == TeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
case SAGraveyards.CentralCapturableGy:
|
||||
@@ -832,9 +832,9 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[i] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
||||
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source);
|
||||
Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (creature != null)
|
||||
SendChatMessage(creature, teamId == TeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -845,7 +845,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
void TitanRelicActivated(Player clicker)
|
||||
{
|
||||
if (!clicker)
|
||||
if (clicker == null)
|
||||
return;
|
||||
|
||||
if (CanInteractWithObject(SAObjectTypes.TitanRelic))
|
||||
@@ -866,7 +866,7 @@ namespace Game.BattleGrounds.Zones
|
||||
foreach (var pair in GetPlayers())
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player)
|
||||
if (player != null)
|
||||
if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers)
|
||||
player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246);
|
||||
}
|
||||
@@ -876,9 +876,9 @@ namespace Game.BattleGrounds.Zones
|
||||
TotalTime = 0;
|
||||
ToggleTimer();
|
||||
|
||||
Creature c = GetBGCreature(SACreatureTypes.Kanrethad);
|
||||
if (c)
|
||||
SendChatMessage(c, SATextIds.Round1Finished);
|
||||
Creature creature = GetBGCreature(SACreatureTypes.Kanrethad);
|
||||
if (creature != null)
|
||||
SendChatMessage(creature, SATextIds.Round1Finished);
|
||||
|
||||
UpdateWaitTimer = 5000;
|
||||
SignaledRoundTwo = false;
|
||||
@@ -898,7 +898,7 @@ namespace Game.BattleGrounds.Zones
|
||||
foreach (var pair in GetPlayers())
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player)
|
||||
if (player != null)
|
||||
if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers && RoundScores[1].winner == Attackers)
|
||||
player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246);
|
||||
}
|
||||
@@ -941,10 +941,10 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
if (!BgCreatures[i].IsEmpty())
|
||||
{
|
||||
Creature Demolisher = GetBGCreature(i);
|
||||
if (Demolisher)
|
||||
Creature demolisher = GetBGCreature(i);
|
||||
if (demolisher != null)
|
||||
{
|
||||
if (Demolisher.IsDead())
|
||||
if (demolisher.IsDead())
|
||||
{
|
||||
// Demolisher is not in list
|
||||
if (!DemoliserRespawnList.ContainsKey(i))
|
||||
@@ -955,8 +955,8 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
if (DemoliserRespawnList[i] < GameTime.GetGameTimeMS())
|
||||
{
|
||||
Demolisher.Relocate(SAMiscConst.NpcSpawnlocs[i]);
|
||||
Demolisher.Respawn();
|
||||
demolisher.Relocate(SAMiscConst.NpcSpawnlocs[i]);
|
||||
demolisher.Respawn();
|
||||
DemoliserRespawnList.Remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,11 +97,11 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
// Apply Stage 1 (Focused Assault)
|
||||
Player player = Global.ObjAccessor.FindPlayer(m_FlagKeepers[0]);
|
||||
if (player)
|
||||
if (player != null)
|
||||
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
||||
|
||||
player = Global.ObjAccessor.FindPlayer(m_FlagKeepers[1]);
|
||||
if (player)
|
||||
if (player != null)
|
||||
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
||||
|
||||
_flagDebuffState = 1;
|
||||
@@ -110,14 +110,14 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
// Apply Stage 2 (Brutal Assault)
|
||||
Player player = Global.ObjAccessor.FindPlayer(m_FlagKeepers[0]);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
||||
player.CastSpell(player, WSGSpellId.BrutalAssault, true);
|
||||
}
|
||||
|
||||
player = Global.ObjAccessor.FindPlayer(m_FlagKeepers[1]);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
||||
player.CastSpell(player, WSGSpellId.BrutalAssault, true);
|
||||
@@ -132,14 +132,14 @@ namespace Game.BattleGrounds.Zones
|
||||
// Remove assault debuffs, reset timers
|
||||
|
||||
Player player = Global.ObjAccessor.FindPlayer(m_FlagKeepers[0]);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||
}
|
||||
|
||||
player = Global.ObjAccessor.FindPlayer(m_FlagKeepers[1]);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||
@@ -231,7 +231,7 @@ namespace Game.BattleGrounds.Zones
|
||||
PlaySoundToAll(WSGSound.FlagsRespawned);
|
||||
|
||||
GameObject obj = GetBgMap().GetGameObject(GetDroppedFlagGUID(team));
|
||||
if (obj)
|
||||
if (obj != null)
|
||||
obj.Delete();
|
||||
else
|
||||
Log.outError(LogFilter.Battleground, "unknown droped flag ({0})", GetDroppedFlagGUID(team).ToString());
|
||||
@@ -547,7 +547,7 @@ namespace Game.BattleGrounds.Zones
|
||||
// sometimes flag aura not removed :(
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[TeamId.Alliance] == guid)
|
||||
{
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, "BattlegroundWS: Removing offline player who has the FLAG!!");
|
||||
SetAllianceFlagPicker(ObjectGuid.Empty);
|
||||
@@ -558,7 +558,7 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
if (IsHordeFlagPickedup() && m_FlagKeepers[TeamId.Horde] == guid)
|
||||
{
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, "BattlegroundWS: Removing offline player who has the FLAG!!");
|
||||
SetHordeFlagPicker(ObjectGuid.Empty);
|
||||
|
||||
Reference in New Issue
Block a user