Some cleanups. (might break build for scripts as they are a WIP)
This commit is contained in:
@@ -16,11 +16,11 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.ArtifactAddPower, Processing = PacketProcessing.Inplace)]
|
||||
void HandleArtifactAddPower(ArtifactAddPower artifactAddPower)
|
||||
{
|
||||
if (!_player.GetGameObjectIfCanInteractWith(artifactAddPower.ForgeGUID, GameObjectTypes.ItemForge))
|
||||
if (_player.GetGameObjectIfCanInteractWith(artifactAddPower.ForgeGUID, GameObjectTypes.ItemForge) == null)
|
||||
return;
|
||||
|
||||
Item artifact = _player.GetItemByGuid(artifactAddPower.ArtifactGUID);
|
||||
if (!artifact || artifact.IsArtifactDisabled())
|
||||
if (artifact == null || artifact.IsArtifactDisabled())
|
||||
return;
|
||||
|
||||
uint currentArtifactTier = artifact.GetModifier(ItemModifier.ArtifactTier);
|
||||
@@ -146,7 +146,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.ArtifactSetAppearance, Processing = PacketProcessing.Inplace)]
|
||||
void HandleArtifactSetAppearance(ArtifactSetAppearance artifactSetAppearance)
|
||||
{
|
||||
if (!_player.GetGameObjectIfCanInteractWith(artifactSetAppearance.ForgeGUID, GameObjectTypes.ItemForge))
|
||||
if (_player.GetGameObjectIfCanInteractWith(artifactSetAppearance.ForgeGUID, GameObjectTypes.ItemForge) == null)
|
||||
return;
|
||||
|
||||
ArtifactAppearanceRecord artifactAppearance = CliDB.ArtifactAppearanceStorage.LookupByKey(artifactSetAppearance.ArtifactAppearanceID);
|
||||
@@ -154,7 +154,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Item artifact = _player.GetItemByGuid(artifactSetAppearance.ArtifactGUID);
|
||||
if (!artifact)
|
||||
if (artifact == null)
|
||||
return;
|
||||
|
||||
ArtifactAppearanceSetRecord artifactAppearanceSet = CliDB.ArtifactAppearanceSetStorage.LookupByKey(artifactAppearance.ArtifactAppearanceSetID);
|
||||
@@ -170,7 +170,7 @@ namespace Game
|
||||
artifact.SetModifier(ItemModifier.ArtifactAppearanceId, artifactAppearance.Id);
|
||||
artifact.SetState(ItemUpdateState.Changed, _player);
|
||||
Item childItem = _player.GetChildItemByGuid(artifact.GetChildItem());
|
||||
if (childItem)
|
||||
if (childItem != null)
|
||||
{
|
||||
childItem.SetAppearanceModId(artifactAppearance.ItemAppearanceModifierID);
|
||||
childItem.SetState(ItemUpdateState.Changed, _player);
|
||||
@@ -180,7 +180,7 @@ namespace Game
|
||||
{
|
||||
// change weapon appearance
|
||||
_player.SetVisibleItemSlot(artifact.GetSlot(), artifact);
|
||||
if (childItem)
|
||||
if (childItem != null)
|
||||
_player.SetVisibleItemSlot(childItem.GetSlot(), childItem);
|
||||
|
||||
// change druid form appearance
|
||||
@@ -192,11 +192,11 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.ConfirmArtifactRespec)]
|
||||
void HandleConfirmArtifactRespec(ConfirmArtifactRespec confirmArtifactRespec)
|
||||
{
|
||||
if (!_player.GetNPCIfCanInteractWith(confirmArtifactRespec.NpcGUID, NPCFlags.ArtifactPowerRespec, NPCFlags2.None))
|
||||
if (_player.GetNPCIfCanInteractWith(confirmArtifactRespec.NpcGUID, NPCFlags.ArtifactPowerRespec, NPCFlags2.None) == null)
|
||||
return;
|
||||
|
||||
Item artifact = _player.GetItemByGuid(confirmArtifactRespec.ArtifactGUID);
|
||||
if (!artifact || artifact.IsArtifactDisabled())
|
||||
if (artifact == null || artifact.IsArtifactDisabled())
|
||||
return;
|
||||
|
||||
ulong xpCost = 0;
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Game
|
||||
var buyerGuid = _player.GetGUID();
|
||||
AddTransactionCallback(DB.Characters.AsyncCommitTransaction(trans)).AfterComplete(success =>
|
||||
{
|
||||
if (GetPlayer() && GetPlayer().GetGUID() == buyerGuid)
|
||||
if (GetPlayer() != null && GetPlayer().GetGUID() == buyerGuid)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
@@ -138,7 +138,7 @@ namespace Game
|
||||
void HandleAuctionHello(AuctionHelloRequest hello)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(hello.Guid, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionHelloOpcode - {hello.Guid} not found or you can't interact with him.");
|
||||
return;
|
||||
@@ -159,7 +159,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(listBiddedItems.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionListBidderItems - {listBiddedItems.Auctioneer} not found or you can't interact with him.");
|
||||
return;
|
||||
@@ -282,7 +282,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(listOwnedItems.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionListOwnerItems - {listOwnedItems.Auctioneer} not found or you can't interact with him.");
|
||||
return;
|
||||
@@ -309,7 +309,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(placeBid.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionPlaceBid - {placeBid.Auctioneer} not found or you can't interact with him.");
|
||||
return;
|
||||
@@ -423,7 +423,7 @@ namespace Game
|
||||
player.SaveInventoryAndGoldToDB(trans);
|
||||
AddTransactionCallback(DB.Characters.AsyncCommitTransaction(trans)).AfterComplete(success =>
|
||||
{
|
||||
if (GetPlayer() && GetPlayer().GetGUID() == _player.GetGUID())
|
||||
if (GetPlayer() != null && GetPlayer().GetGUID() == _player.GetGUID())
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
@@ -444,7 +444,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(removeItem.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionRemoveItem - {removeItem.Auctioneer} not found or you can't interact with him.");
|
||||
return;
|
||||
@@ -492,7 +492,7 @@ namespace Game
|
||||
auctionHouse.RemoveAuction(trans, auction);
|
||||
AddTransactionCallback(DB.Characters.AsyncCommitTransaction(trans)).AfterComplete(success =>
|
||||
{
|
||||
if (GetPlayer() && GetPlayer().GetGUID() == _player.GetGUID())
|
||||
if (GetPlayer() != null && GetPlayer().GetGUID() == _player.GetGUID())
|
||||
{
|
||||
if (success)
|
||||
SendAuctionCommandResult(auctionIdForClient, AuctionCommand.Cancel, AuctionResult.Ok, throttle.DelayUntilNext); //inform player, that auction is removed
|
||||
@@ -506,7 +506,7 @@ namespace Game
|
||||
void HandleReplicateItems(AuctionReplicateItems replicateItems)
|
||||
{
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(replicateItems.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, $"WORLD: HandleReplicateItems - {replicateItems.Auctioneer} not found or you can't interact with him.");
|
||||
return;
|
||||
@@ -612,7 +612,7 @@ namespace Game
|
||||
foreach (var itemForSale in sellCommodity.Items)
|
||||
{
|
||||
Item item = _player.GetItemByGuid(itemForSale.Guid);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
SendAuctionCommandResult(0, AuctionCommand.SellItem, AuctionResult.ItemNotFound, throttle.DelayUntilNext);
|
||||
return;
|
||||
@@ -632,7 +632,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (Global.AuctionHouseMgr.GetAItem(item.GetGUID()) || !item.CanBeTraded() || item.IsNotEmptyBag() ||
|
||||
if (Global.AuctionHouseMgr.GetAItem(item.GetGUID()) != null || !item.CanBeTraded() || item.IsNotEmptyBag() ||
|
||||
item.GetTemplate().HasFlag(ItemFlags.Conjured) || item.m_itemData.Expiration != 0 ||
|
||||
item.GetCount() < itemForSale.UseCount)
|
||||
{
|
||||
@@ -756,7 +756,7 @@ namespace Game
|
||||
var auctionPlayerGuid = _player.GetGUID();
|
||||
AddTransactionCallback(DB.Characters.AsyncCommitTransaction(trans)).AfterComplete(success =>
|
||||
{
|
||||
if (GetPlayer() && GetPlayer().GetGUID() == auctionPlayerGuid)
|
||||
if (GetPlayer() != null && GetPlayer().GetGUID() == auctionPlayerGuid)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
@@ -803,7 +803,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(sellItem.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, "WORLD: HandleAuctionSellItem - Unit (%s) not found or you can't interact with him.", sellItem.Auctioneer.ToString());
|
||||
return;
|
||||
@@ -832,7 +832,7 @@ namespace Game
|
||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||
|
||||
Item item = _player.GetItemByGuid(sellItem.Items[0].Guid);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
SendAuctionCommandResult(0, AuctionCommand.SellItem, AuctionResult.ItemNotFound, throttle.DelayUntilNext);
|
||||
return;
|
||||
@@ -845,7 +845,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (Global.AuctionHouseMgr.GetAItem(item.GetGUID()) || !item.CanBeTraded() || item.IsNotEmptyBag() ||
|
||||
if (Global.AuctionHouseMgr.GetAItem(item.GetGUID()) != null || !item.CanBeTraded() || item.IsNotEmptyBag() ||
|
||||
item.GetTemplate().HasFlag(ItemFlags.Conjured) || item.m_itemData.Expiration != 0 ||
|
||||
item.GetCount() != 1)
|
||||
{
|
||||
@@ -904,7 +904,7 @@ namespace Game
|
||||
var auctionPlayerGuid = _player.GetGUID();
|
||||
AddTransactionCallback(DB.Characters.AsyncCommitTransaction(trans)).AfterComplete(success =>
|
||||
{
|
||||
if (GetPlayer() && GetPlayer().GetGUID() == auctionPlayerGuid)
|
||||
if (GetPlayer() != null && GetPlayer().GetGUID() == auctionPlayerGuid)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
@@ -954,7 +954,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(getCommodityQuote.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionStartCommoditiesPurchase - {getCommodityQuote.Auctioneer} not found or you can't interact with him.");
|
||||
return;
|
||||
|
||||
@@ -15,15 +15,15 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.AzeriteEssenceUnlockMilestone, Processing = PacketProcessing.Inplace)]
|
||||
void HandleAzeriteEssenceUnlockMilestone(AzeriteEssenceUnlockMilestone azeriteEssenceUnlockMilestone)
|
||||
{
|
||||
if (!AzeriteItem.FindHeartForge(_player))
|
||||
if (AzeriteItem.FindHeartForge(_player) == null)
|
||||
return;
|
||||
|
||||
Item item = _player.GetItemByEntry(PlayerConst.ItemIdHeartOfAzeroth, ItemSearchLocation.Everywhere);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
AzeriteItem azeriteItem = item.ToAzeriteItem();
|
||||
if (!azeriteItem || !azeriteItem.CanUseEssences())
|
||||
if (azeriteItem == null || !azeriteItem.CanUseEssences())
|
||||
return;
|
||||
|
||||
AzeriteItemMilestonePowerRecord milestonePower = CliDB.AzeriteItemMilestonePowerStorage.LookupByKey(azeriteEssenceUnlockMilestone.AzeriteItemMilestonePowerID);
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Item item = GetPlayer().GetItemByPos(packet.Bag, packet.Slot);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
List<ItemPosCount> dest = new();
|
||||
@@ -48,7 +48,7 @@ namespace Game
|
||||
void HandleBankerActivate(Hello packet)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Banker, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, "HandleBankerActivate: {0} not found or you can not interact with him.", packet.Unit.ToString());
|
||||
return;
|
||||
@@ -70,7 +70,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Item item = GetPlayer().GetItemByPos(packet.Bag, packet.Slot);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
if (Player.IsBankPos(packet.Bag, packet.Slot)) // moving from bank to inventory
|
||||
@@ -85,7 +85,7 @@ namespace Game
|
||||
|
||||
GetPlayer().RemoveItem(packet.Bag, packet.Slot, true);
|
||||
Item storedItem = GetPlayer().StoreItem(dest, item, true);
|
||||
if (storedItem)
|
||||
if (storedItem != null)
|
||||
GetPlayer().ItemAddedQuestCheck(storedItem.GetEntry(), storedItem.GetCount());
|
||||
}
|
||||
else // moving from inventory to bank
|
||||
@@ -213,7 +213,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Item item = _player.GetItemByPos(autoBankReagent.PackSlot, autoBankReagent.Slot);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
List<ItemPosCount> dest = new();
|
||||
@@ -250,7 +250,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Item pItem = _player.GetItemByPos(autoStoreBankReagent.Slot, autoStoreBankReagent.PackSlot);
|
||||
if (!pItem)
|
||||
if (pItem == null)
|
||||
return;
|
||||
|
||||
if (Player.IsReagentBankPos(autoStoreBankReagent.Slot, autoStoreBankReagent.PackSlot))
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Game
|
||||
void HandleBattlemasterHello(Hello hello)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(hello.Unit, NPCFlags.BattleMaster, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
return;
|
||||
|
||||
// Stop the npc if moving
|
||||
@@ -198,7 +198,7 @@ namespace Game
|
||||
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player member = refe.GetSource();
|
||||
if (!member)
|
||||
if (member == null)
|
||||
continue; // this should never happen
|
||||
|
||||
if (err != 0)
|
||||
@@ -226,7 +226,7 @@ namespace Game
|
||||
void HandlePVPLogData(PVPLogDataRequest packet)
|
||||
{
|
||||
Battleground bg = GetPlayer().GetBattleground();
|
||||
if (!bg)
|
||||
if (bg == null)
|
||||
return;
|
||||
|
||||
// Prevent players from sending BuildPvpLogDataPacket in an arena except for when sent in Battleground.EndBattleground.
|
||||
@@ -366,7 +366,7 @@ namespace Game
|
||||
// this is still needed here if Battleground"jumping" shouldn't add deserter debuff
|
||||
// also this is required to prevent stuck at old Battlegroundafter SetBattlegroundId set to new
|
||||
Battleground currentBg = GetPlayer().GetBattleground();
|
||||
if (currentBg)
|
||||
if (currentBg != null)
|
||||
currentBg.RemovePlayerAtLeave(GetPlayer().GetGUID(), false, true);
|
||||
|
||||
// set the destination instance id
|
||||
@@ -411,7 +411,7 @@ namespace Game
|
||||
if (GetPlayer().IsInCombat())
|
||||
{
|
||||
Battleground bg = GetPlayer().GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
if (bg.GetStatus() != BattlegroundStatus.WaitLeave)
|
||||
return;
|
||||
}
|
||||
@@ -455,7 +455,7 @@ namespace Game
|
||||
if (ginfo.IsInvitedToBGInstanceGUID != 0)
|
||||
{
|
||||
bg = Global.BattlegroundMgr.GetBattleground(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
|
||||
if (!bg)
|
||||
if (bg == null)
|
||||
continue;
|
||||
|
||||
BattlefieldStatusNeedConfirmation battlefieldStatus;
|
||||
@@ -512,7 +512,7 @@ namespace Game
|
||||
|
||||
Group grp = GetPlayer().GetGroup();
|
||||
// no group found, error
|
||||
if (!grp)
|
||||
if (grp == null)
|
||||
return;
|
||||
if (grp.GetLeaderGUID() != GetPlayer().GetGUID())
|
||||
return;
|
||||
@@ -549,7 +549,7 @@ namespace Game
|
||||
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player member = refe.GetSource();
|
||||
if (!member)
|
||||
if (member == null)
|
||||
continue;
|
||||
|
||||
if (err != 0)
|
||||
@@ -584,7 +584,7 @@ namespace Game
|
||||
void HandleReportPvPAFK(ReportPvPPlayerAFK reportPvPPlayerAFK)
|
||||
{
|
||||
Player reportedPlayer = Global.ObjAccessor.FindPlayer(reportPvPPlayerAFK.Offender);
|
||||
if (!reportedPlayer)
|
||||
if (reportedPlayer == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Battleground, "WorldSession.HandleReportPvPAFK: player not found");
|
||||
return;
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Game
|
||||
response.BattlePetID = queryBattlePetName.BattlePetID;
|
||||
|
||||
Creature summonedBattlePet = ObjectAccessor.GetCreatureOrPetOrVehicle(_player, queryBattlePetName.UnitGUID);
|
||||
if (!summonedBattlePet || !summonedBattlePet.IsSummon())
|
||||
if (summonedBattlePet == null || !summonedBattlePet.IsSummon())
|
||||
{
|
||||
SendPacket(response);
|
||||
return;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Game
|
||||
void HandleBlackMarketOpen(BlackMarketOpen blackMarketOpen)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(blackMarketOpen.Guid, NPCFlags.BlackMarket, NPCFlags2.BlackMarketView);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleBlackMarketHello - {0} not found or you can't interact with him.", blackMarketOpen.Guid.ToString());
|
||||
return;
|
||||
@@ -45,7 +45,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(blackMarketRequestItems.Guid, NPCFlags.BlackMarket, NPCFlags2.BlackMarketView);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleBlackMarketRequestItems - {0} not found or you can't interact with him.", blackMarketRequestItems.Guid.ToString());
|
||||
return;
|
||||
@@ -64,7 +64,7 @@ namespace Game
|
||||
|
||||
Player player = GetPlayer();
|
||||
Creature unit = player.GetNPCIfCanInteractWith(blackMarketBidOnItem.Guid, NPCFlags.BlackMarket, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleBlackMarketBidOnItem - {0} not found or you can't interact with him.", blackMarketBidOnItem.Guid.ToString());
|
||||
return;
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Game
|
||||
void HandleCalendarCommunityInvite(CalendarCommunityInviteRequest calendarCommunityInvite)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildById(GetPlayer().GetGuildId());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.MassInviteToEvent(this, calendarCommunityInvite.MinLevel, calendarCommunityInvite.MaxLevel, (GuildRankOrder)calendarCommunityInvite.MaxRankOrder);
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Player player = Global.ObjAccessor.FindPlayerByName(calendarInvite.Name);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
// Invitee is online
|
||||
inviteeGuid = player.GetGUID();
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace Game
|
||||
|
||||
if (req.QuestID != 0)
|
||||
{
|
||||
if (!_player)
|
||||
if (_player == null)
|
||||
return false;
|
||||
|
||||
if (!_player.IsQuestRewarded((uint)req.QuestID))
|
||||
@@ -647,14 +647,14 @@ namespace Game
|
||||
uint initAccountId = GetAccountId();
|
||||
|
||||
// can't delete loaded character
|
||||
if (Global.ObjAccessor.FindPlayer(charDelete.Guid))
|
||||
if (Global.ObjAccessor.FindPlayer(charDelete.Guid) != null)
|
||||
{
|
||||
Global.ScriptMgr.OnPlayerFailedDelete(charDelete.Guid, initAccountId);
|
||||
return;
|
||||
}
|
||||
|
||||
// is guild leader
|
||||
if (Global.GuildMgr.GetGuildByLeader(charDelete.Guid))
|
||||
if (Global.GuildMgr.GetGuildByLeader(charDelete.Guid) != null)
|
||||
{
|
||||
Global.ScriptMgr.OnPlayerFailedDelete(charDelete.Guid, initAccountId);
|
||||
SendCharDelete(ResponseCodes.CharDeleteFailedGuildLeader);
|
||||
@@ -764,7 +764,7 @@ namespace Game
|
||||
|
||||
public void HandleContinuePlayerLogin()
|
||||
{
|
||||
if (!PlayerLoading() || GetPlayer())
|
||||
if (!PlayerLoading() || GetPlayer() != null)
|
||||
{
|
||||
KickPlayer("WorldSession::HandleContinuePlayerLogin incorrect player state when logging in");
|
||||
return;
|
||||
@@ -834,7 +834,7 @@ namespace Game
|
||||
pCurrChar.SetInGuild(resultGuild.Read<uint>(0));
|
||||
pCurrChar.SetGuildRank(resultGuild.Read<byte>(1));
|
||||
Guild guild = Global.GuildMgr.GetGuildById(pCurrChar.GetGuildId());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
pCurrChar.SetGuildLevel(guild.GetLevel());
|
||||
}
|
||||
else if (pCurrChar.GetGuildId() != 0)
|
||||
@@ -890,7 +890,7 @@ namespace Game
|
||||
if (pCurrChar.GetGuildId() != 0)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildById(pCurrChar.GetGuildId());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.SendLoginInfo(this);
|
||||
else
|
||||
{
|
||||
@@ -917,7 +917,7 @@ namespace Game
|
||||
|
||||
// announce group about member online (must be after add to player list to receive announce to self)
|
||||
Group group = pCurrChar.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
group.SendUpdate();
|
||||
if (group.GetLeaderGUID() == pCurrChar.GetGUID())
|
||||
@@ -1093,7 +1093,7 @@ namespace Game
|
||||
|
||||
public void AbortLogin(LoginFailureReason reason)
|
||||
{
|
||||
if (!PlayerLoading() || GetPlayer())
|
||||
if (!PlayerLoading() || GetPlayer() != null)
|
||||
{
|
||||
KickPlayer("WorldSession::AbortLogin incorrect player state when logging in");
|
||||
return;
|
||||
@@ -1404,7 +1404,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
GameObject go = GetPlayer().FindNearestGameObjectOfType(GameObjectTypes.BarberChair, 5.0f);
|
||||
if (!go)
|
||||
if (go == null)
|
||||
{
|
||||
SendPacket(new BarberShopResult(BarberShopResult.ResultEnum.NotOnChair));
|
||||
return;
|
||||
@@ -1583,7 +1583,7 @@ namespace Game
|
||||
Item item = _player.GetItemByPos(InventorySlots.Bag0, i);
|
||||
|
||||
// cheating check 1 (item equipped but sent empty guid)
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
// cheating check 2 (sent guid does not match equipped item)
|
||||
@@ -1678,10 +1678,10 @@ namespace Game
|
||||
Item item = GetPlayer().GetItemByGuid(useEquipmentSet.Items[i].Item);
|
||||
|
||||
ushort dstPos = (ushort)(i | (InventorySlots.Bag0 << 8));
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
Item uItem = GetPlayer().GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (!uItem)
|
||||
if (uItem == null)
|
||||
continue;
|
||||
|
||||
List<ItemPosCount> itemPosCount = new();
|
||||
@@ -2473,7 +2473,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Corpse corpse = GetPlayer().GetCorpse();
|
||||
if (!corpse)
|
||||
if (corpse == null)
|
||||
return;
|
||||
|
||||
// prevent resurrect before 30-sec delay after body release not finished
|
||||
@@ -2506,7 +2506,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Player ressPlayer = Global.ObjAccessor.GetPlayer(GetPlayer(), packet.Resurrecter);
|
||||
if (ressPlayer)
|
||||
if (ressPlayer != null)
|
||||
{
|
||||
InstanceScript instance = ressPlayer.GetInstanceScript();
|
||||
if (instance != null)
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Player receiver = Global.ObjAccessor.FindPlayerByName(extName.Name);
|
||||
if (!receiver || (lang != Language.Addon && !receiver.IsAcceptWhispers() && receiver.GetSession().HasPermission(RBACPermissions.CanFilterWhispers) && !receiver.IsInWhisperWhiteList(sender.GetGUID())))
|
||||
if (receiver == null || (lang != Language.Addon && !receiver.IsAcceptWhispers() && receiver.GetSession().HasPermission(RBACPermissions.CanFilterWhispers) && !receiver.IsInWhisperWhiteList(sender.GetGUID())))
|
||||
{
|
||||
SendChatPlayerNotfoundNotice(target);
|
||||
return;
|
||||
@@ -251,10 +251,10 @@ namespace Game
|
||||
{
|
||||
// if player is in Battleground, he cannot say to Battlegroundmembers by /p
|
||||
Group group = GetPlayer().GetOriginalGroup();
|
||||
if (!group)
|
||||
if (group == null)
|
||||
{
|
||||
group = GetPlayer().GetGroup();
|
||||
if (!group || group.IsBGGroup())
|
||||
if (group == null || group.IsBGGroup())
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace Game
|
||||
if (GetPlayer().GetGuildId() != 0)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildById(GetPlayer().GetGuildId());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
{
|
||||
Global.ScriptMgr.OnPlayerChat(GetPlayer(), type, lang, msg, guild);
|
||||
|
||||
@@ -284,7 +284,7 @@ namespace Game
|
||||
if (GetPlayer().GetGuildId() != 0)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildById(GetPlayer().GetGuildId());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
{
|
||||
Global.ScriptMgr.OnPlayerChat(GetPlayer(), type, lang, msg, guild);
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace Game
|
||||
case ChatMsg.Raid:
|
||||
{
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (!group || !group.IsRaidGroup() || group.IsBGGroup())
|
||||
if (group == null || !group.IsRaidGroup() || group.IsBGGroup())
|
||||
return;
|
||||
|
||||
if (group.IsLeader(GetPlayer().GetGUID()))
|
||||
@@ -311,7 +311,7 @@ namespace Game
|
||||
case ChatMsg.RaidWarning:
|
||||
{
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (!group || !(group.IsRaidGroup() || WorldConfig.GetBoolValue(WorldCfg.ChatPartyRaidWarnings)) || !(group.IsLeader(GetPlayer().GetGUID()) || group.IsAssistant(GetPlayer().GetGUID())) || group.IsBGGroup())
|
||||
if (group == null || !(group.IsRaidGroup() || WorldConfig.GetBoolValue(WorldCfg.ChatPartyRaidWarnings)) || !(group.IsLeader(GetPlayer().GetGUID()) || group.IsAssistant(GetPlayer().GetGUID())) || group.IsBGGroup())
|
||||
return;
|
||||
|
||||
Global.ScriptMgr.OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
@@ -341,7 +341,7 @@ namespace Game
|
||||
case ChatMsg.InstanceChat:
|
||||
{
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (!group)
|
||||
if (group == null)
|
||||
return;
|
||||
|
||||
if (group.IsLeader(GetPlayer().GetGUID()))
|
||||
@@ -393,7 +393,7 @@ namespace Game
|
||||
if (sender.GetGuildId() != 0)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildById(sender.GetGuildId());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.BroadcastAddonToGuild(this, type == ChatMsg.Officer, text, prefix, isLogged);
|
||||
}
|
||||
break;
|
||||
@@ -405,7 +405,7 @@ namespace Game
|
||||
break;
|
||||
|
||||
Player receiver = Global.ObjAccessor.FindPlayerByName(extName.Name);
|
||||
if (!receiver)
|
||||
if (receiver == null)
|
||||
break;
|
||||
|
||||
sender.WhisperAddon(text, prefix, isLogged, receiver);
|
||||
@@ -420,10 +420,10 @@ namespace Game
|
||||
if (type != ChatMsg.InstanceChat)
|
||||
group = sender.GetOriginalGroup();
|
||||
|
||||
if (!group)
|
||||
if (group == null)
|
||||
{
|
||||
group = sender.GetGroup();
|
||||
if (!group)
|
||||
if (group == null)
|
||||
break;
|
||||
|
||||
if (type == ChatMsg.Party)
|
||||
@@ -586,10 +586,10 @@ namespace Game
|
||||
GetPlayer().UpdateCriteria(CriteriaType.DoEmote, (uint)packet.EmoteID, 0, 0, unit);
|
||||
|
||||
// Send scripted event call
|
||||
if (unit)
|
||||
if (unit != null)
|
||||
{
|
||||
Creature creature = unit.ToCreature();
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
creature.GetAI().ReceiveEmote(GetPlayer(), (TextEmotes)packet.EmoteID);
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ namespace Game
|
||||
void HandleChatIgnoredOpcode(ChatReportIgnored packet)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(packet.IgnoredGUID);
|
||||
if (!player || player.GetSession() == null)
|
||||
if (player == null || player.GetSession() == null)
|
||||
return;
|
||||
|
||||
ChatPkt data = new();
|
||||
@@ -631,7 +631,7 @@ namespace Game
|
||||
|
||||
Player sender = GetPlayer();
|
||||
Player receiver = Global.ObjAccessor.FindConnectedPlayer(canLocalWhisperTargetRequest.WhisperTarget);
|
||||
if (!receiver || (!receiver.IsAcceptWhispers() && receiver.GetSession().HasPermission(RBACPermissions.CanFilterWhispers) && !receiver.IsInWhisperWhiteList(sender.GetGUID())))
|
||||
if (receiver == null || (!receiver.IsAcceptWhispers() && receiver.GetSession().HasPermission(RBACPermissions.CanFilterWhispers) && !receiver.IsInWhisperWhiteList(sender.GetGUID())))
|
||||
status = ChatWhisperTargetStatus.Offline;
|
||||
else
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Game
|
||||
void HandleAttackSwing(AttackSwing packet)
|
||||
{
|
||||
Unit enemy = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Victim);
|
||||
if (!enemy)
|
||||
if (enemy == null)
|
||||
{
|
||||
// stop attack state at client
|
||||
SendAttackStop(null);
|
||||
@@ -33,7 +33,7 @@ namespace Game
|
||||
//! so we'll place the same check here. Note that it might be possible to reuse this snippet
|
||||
//! in other places as well.
|
||||
Vehicle vehicle = GetPlayer().GetVehicle();
|
||||
if (vehicle)
|
||||
if (vehicle != null)
|
||||
{
|
||||
VehicleSeatRecord seat = vehicle.GetSeatForPassenger(GetPlayer());
|
||||
Cypher.Assert(seat != null);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Game
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(packet.TargetGUID);
|
||||
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
CanDuelResult response = new();
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.GarrisonPurchaseBuilding)]
|
||||
void HandleGarrisonPurchaseBuilding(GarrisonPurchaseBuilding garrisonPurchaseBuilding)
|
||||
{
|
||||
if (!_player.GetNPCIfCanInteractWith(garrisonPurchaseBuilding.NpcGUID, NPCFlags.None, NPCFlags2.GarrisonArchitect))
|
||||
if (_player.GetNPCIfCanInteractWith(garrisonPurchaseBuilding.NpcGUID, NPCFlags.None, NPCFlags2.GarrisonArchitect) == null)
|
||||
return;
|
||||
|
||||
Garrison garrison = _player.GetGarrison();
|
||||
@@ -32,7 +32,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.GarrisonCancelConstruction)]
|
||||
void HandleGarrisonCancelConstruction(GarrisonCancelConstruction garrisonCancelConstruction)
|
||||
{
|
||||
if (!_player.GetNPCIfCanInteractWith(garrisonCancelConstruction.NpcGUID, NPCFlags.None, NPCFlags2.GarrisonArchitect))
|
||||
if (_player.GetNPCIfCanInteractWith(garrisonCancelConstruction.NpcGUID, NPCFlags.None, NPCFlags2.GarrisonArchitect) == null)
|
||||
return;
|
||||
|
||||
Garrison garrison = _player.GetGarrison();
|
||||
|
||||
@@ -89,11 +89,11 @@ namespace Game
|
||||
Group group2 = invitedPlayer.GetGroup(packet.PartyIndex);
|
||||
PartyInvite partyInvite;
|
||||
// player already in another group or invited
|
||||
if (group2 || invitedPlayer.GetGroupInvite())
|
||||
if (group2 != null || invitedPlayer.GetGroupInvite() != null)
|
||||
{
|
||||
SendPartyResult(PartyOperation.Invite, invitedPlayer.GetName(), PartyResult.AlreadyInGroupS);
|
||||
|
||||
if (group2)
|
||||
if (group2 != null)
|
||||
{
|
||||
// tell the player that they were invited but it failed as they were already in a group
|
||||
partyInvite = new PartyInvite();
|
||||
@@ -104,7 +104,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
// not have permissions for invite
|
||||
if (!group.IsLeader(invitingPlayer.GetGUID()) && !group.IsAssistant(invitingPlayer.GetGUID()))
|
||||
@@ -185,14 +185,14 @@ namespace Game
|
||||
if (!group.IsCreated())
|
||||
{
|
||||
// This can happen if the leader is zoning. To be removed once delayed actions for zoning are implemented
|
||||
if (!leader)
|
||||
if (leader == null)
|
||||
{
|
||||
group.RemoveAllInvites();
|
||||
return;
|
||||
}
|
||||
|
||||
// If we're about to create a group there really should be a leader present
|
||||
Cypher.Assert(leader);
|
||||
Cypher.Assert(leader != null);
|
||||
group.RemoveInvite(leader);
|
||||
group.Create(leader);
|
||||
Global.GroupMgr.AddGroup(group);
|
||||
@@ -212,7 +212,7 @@ namespace Game
|
||||
// uninvite, group can be deleted
|
||||
GetPlayer().UninviteFromGroup();
|
||||
|
||||
if (!leader || leader.GetSession() == null)
|
||||
if (leader == null || leader.GetSession() == null)
|
||||
return;
|
||||
|
||||
// report
|
||||
@@ -241,7 +241,7 @@ namespace Game
|
||||
|
||||
Group grp = GetPlayer().GetGroup(packet.PartyIndex);
|
||||
// grp is checked already above in CanUninviteFromGroup()
|
||||
Cypher.Assert(grp);
|
||||
Cypher.Assert(grp != null);
|
||||
|
||||
if (grp.IsMember(packet.TargetGUID))
|
||||
{
|
||||
@@ -249,7 +249,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
Player player = grp.GetInvited(packet.TargetGUID);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
player.UninviteFromGroup();
|
||||
return;
|
||||
@@ -264,7 +264,7 @@ namespace Game
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(packet.TargetGUID);
|
||||
Group group = GetPlayer().GetGroup(packet.PartyIndex);
|
||||
|
||||
if (!group || !player)
|
||||
if (group == null || player == null)
|
||||
return;
|
||||
|
||||
if (!group.IsLeader(GetPlayer().GetGUID()) || player.GetGroup() != group)
|
||||
@@ -281,7 +281,7 @@ namespace Game
|
||||
RoleChangedInform roleChangedInform = new();
|
||||
|
||||
Group group = GetPlayer().GetGroup(packet.PartyIndex);
|
||||
byte oldRole = (byte)(group ? group.GetLfgRoles(packet.TargetGUID) : 0);
|
||||
byte oldRole = (byte)(group != null ? group.GetLfgRoles(packet.TargetGUID) : 0);
|
||||
if (oldRole == packet.Role)
|
||||
return;
|
||||
|
||||
@@ -291,7 +291,7 @@ namespace Game
|
||||
roleChangedInform.OldRole = oldRole;
|
||||
roleChangedInform.NewRole = packet.Role;
|
||||
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
group.BroadcastPacket(roleChangedInform, false);
|
||||
group.SetLfgRoles(packet.TargetGUID, (LfgRoles)packet.Role);
|
||||
@@ -336,7 +336,7 @@ namespace Game
|
||||
// not allowed to change
|
||||
/*
|
||||
Group group = GetPlayer().GetGroup(packet.PartyIndex);
|
||||
if (!group)
|
||||
if (group == null)
|
||||
return;
|
||||
|
||||
if (!group.IsLeader(GetPlayer().GetGUID()))
|
||||
@@ -410,7 +410,7 @@ namespace Game
|
||||
if (packet.Target.IsPlayer())
|
||||
{
|
||||
Player target = Global.ObjAccessor.FindConnectedPlayer(packet.Target);
|
||||
if (!target || target.IsHostileTo(GetPlayer()))
|
||||
if (target == null || target.IsHostileTo(GetPlayer()))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ namespace Game
|
||||
void HandleConvertRaid(ConvertRaid packet)
|
||||
{
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (!group)
|
||||
if (group == null)
|
||||
return;
|
||||
|
||||
if (GetPlayer().InBattleground())
|
||||
@@ -559,7 +559,7 @@ namespace Game
|
||||
PartyMemberFullState partyMemberStats = new();
|
||||
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(packet.TargetGUID);
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
partyMemberStats.MemberGuid = packet.TargetGUID;
|
||||
partyMemberStats.MemberStats.Status = GroupMemberOnlineStatus.Offline;
|
||||
@@ -581,7 +581,7 @@ namespace Game
|
||||
void HandleOptOutOfLoot(OptOutOfLoot packet)
|
||||
{
|
||||
// ignore if player not loaded
|
||||
if (!GetPlayer()) // needed because STATUS_AUTHED
|
||||
if (GetPlayer() == null) // needed because STATUS_AUTHED
|
||||
{
|
||||
if (packet.PassOnLoot)
|
||||
Log.outError(LogFilter.Network, "CMSG_OPT_OUT_OF_LOOT value<>0 for not-loaded character!");
|
||||
@@ -643,7 +643,7 @@ namespace Game
|
||||
return false;
|
||||
|
||||
group = player.GetGroup();
|
||||
if (!group)
|
||||
if (group == null)
|
||||
return false;
|
||||
|
||||
if (group.IsRestrictPingsToAssistants() && !group.IsLeader(player.GetGUID()) && !group.IsAssistant(player.GetGUID()))
|
||||
@@ -656,7 +656,7 @@ namespace Game
|
||||
void HandleSetRestrictPingsToAssistants(SetRestrictPingsToAssistants setRestrictPingsToAssistants)
|
||||
{
|
||||
Group group = GetPlayer().GetGroup(setRestrictPingsToAssistants.PartyIndex);
|
||||
if (!group)
|
||||
if (group == null)
|
||||
return;
|
||||
|
||||
if (!group.IsLeader(GetPlayer().GetGUID()))
|
||||
@@ -673,7 +673,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Unit target = Global.ObjAccessor.GetUnit(_player, pingUnit.TargetGUID);
|
||||
if (!target || !_player.HaveAtClient(target))
|
||||
if (target == null || !_player.HaveAtClient(target))
|
||||
return;
|
||||
|
||||
ReceivePingUnit broadcastPingUnit = new();
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Game
|
||||
void HandleGuildQuery(QueryGuildInfo query)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildByGuid(query.GuildGuid);
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
{
|
||||
guild.SendQueryResponse(this);
|
||||
return;
|
||||
@@ -33,7 +33,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleInviteMember(this, packet.Name);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Game
|
||||
void HandleGuildOfficerRemoveMember(GuildOfficerRemoveMember packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleRemoveMember(this, packet.Removee);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Game
|
||||
if (GetPlayer().GetGuildId() == 0)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildById(GetPlayer().GetGuildIdInvited());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleAcceptMember(this);
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ namespace Game
|
||||
void HandleGuildGetRoster(GuildGetRoster packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleRoster(this);
|
||||
else
|
||||
Guild.SendCommandResult(this, GuildCommandType.GetRoster, GuildCommandError.PlayerNotInGuild);
|
||||
@@ -80,7 +80,7 @@ namespace Game
|
||||
void HandleGuildPromoteMember(GuildPromoteMember packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleUpdateMemberRank(this, packet.Promotee, false);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Game
|
||||
void HandleGuildDemoteMember(GuildDemoteMember packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleUpdateMemberRank(this, packet.Demotee, true);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Game
|
||||
ObjectGuid setterGuid = GetPlayer().GetGUID();
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleSetMemberRank(this, packet.Member, setterGuid, (GuildRankOrder)packet.RankOrder);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace Game
|
||||
void HandleGuildLeave(GuildLeave packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleLeaveMember(this);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Game
|
||||
void HandleGuildDisband(GuildDelete packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleDelete(this);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleSetMOTD(this, packet.MotdText);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleSetMemberNote(this, packet.Note, packet.NoteeGUID, packet.IsPublic);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Game
|
||||
void HandleGuildGetRanks(GuildGetRanks packet)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildByGuid(packet.GuildGUID);
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
if (guild.IsMember(GetPlayer().GetGUID()))
|
||||
guild.SendGuildRankInfo(this);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleAddNewRank(this, packet.Name);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace Game
|
||||
void HandleGuildDeleteRank(GuildDeleteRank packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleRemoveRank(this, (GuildRankOrder)packet.RankOrder);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace Game
|
||||
void HandleGuildShiftRank(GuildShiftRank shiftRank)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleShiftRank(this, (GuildRankOrder)shiftRank.RankOrder, shiftRank.ShiftUp);
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleSetInfo(this, packet.InfoText);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace Game
|
||||
Guild.EmblemInfo emblemInfo = new();
|
||||
emblemInfo.ReadPacket(packet);
|
||||
|
||||
if (GetPlayer().GetNPCIfCanInteractWith(packet.Vendor, NPCFlags.TabardDesigner, NPCFlags2.None))
|
||||
if (GetPlayer().GetNPCIfCanInteractWith(packet.Vendor, NPCFlags.TabardDesigner, NPCFlags2.None) != null)
|
||||
{
|
||||
// Remove fake death
|
||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||
@@ -218,7 +218,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleSetEmblem(this, emblemInfo);
|
||||
else
|
||||
Guild.SendSaveEmblemResult(this, GuildEmblemError.NoGuild); // "You are not part of a guild!";
|
||||
@@ -231,7 +231,7 @@ namespace Game
|
||||
void HandleGuildEventLogQuery(GuildEventLogQuery packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.SendEventLog(this);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace Game
|
||||
void HandleGuildBankMoneyWithdrawn(GuildBankRemainingWithdrawMoneyQuery packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.SendMoneyInfo(this);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace Game
|
||||
void HandleGuildPermissionsQuery(GuildPermissionsQuery packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.SendPermissions(this);
|
||||
}
|
||||
|
||||
@@ -271,10 +271,10 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.GuildBankQueryTab)]
|
||||
void HandleGuildBankQueryTab(GuildBankQueryTab packet)
|
||||
{
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(packet.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(packet.Banker, GameObjectTypes.GuildBank) != null)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.SendBankList(this, packet.Tab, true/*packet.FullUpdate*/);
|
||||
// HACK: client doesn't query entire tab content if it had received SMSG_GUILD_BANK_LIST in this session
|
||||
// but we broadcast bank updates to entire guild when *ANYONE* changes anything, incorrectly initializing clients
|
||||
@@ -285,12 +285,12 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.GuildBankDepositMoney)]
|
||||
void HandleGuildBankDepositMoney(GuildBankDepositMoney packet)
|
||||
{
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(packet.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(packet.Banker, GameObjectTypes.GuildBank) != null)
|
||||
{
|
||||
if (packet.Money != 0 && GetPlayer().HasEnoughMoney(packet.Money))
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleMemberDepositMoney(this, packet.Money);
|
||||
}
|
||||
}
|
||||
@@ -299,10 +299,10 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.GuildBankWithdrawMoney)]
|
||||
void HandleGuildBankWithdrawMoney(GuildBankWithdrawMoney packet)
|
||||
{
|
||||
if (packet.Money != 0 && GetPlayer().GetGameObjectIfCanInteractWith(packet.Banker, GameObjectTypes.GuildBank))
|
||||
if (packet.Money != 0 && GetPlayer().GetGameObjectIfCanInteractWith(packet.Banker, GameObjectTypes.GuildBank) != null)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleMemberWithdrawMoney(this, packet.Money);
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.AutoGuildBankItem)]
|
||||
void HandleAutoGuildBankItem(AutoGuildBankItem depositGuildBankItem)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(depositGuildBankItem.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(depositGuildBankItem.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -327,7 +327,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.StoreGuildBankItem)]
|
||||
void HandleStoreGuildBankItem(StoreGuildBankItem storeGuildBankItem)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(storeGuildBankItem.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(storeGuildBankItem.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -344,7 +344,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.SwapItemWithGuildBankItem)]
|
||||
void HandleSwapItemWithGuildBankItem(SwapItemWithGuildBankItem swapItemWithGuildBankItem)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(swapItemWithGuildBankItem.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(swapItemWithGuildBankItem.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -361,7 +361,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.SwapGuildBankItemWithGuildBankItem)]
|
||||
void HandleSwapGuildBankItemWithGuildBankItem(SwapGuildBankItemWithGuildBankItem swapGuildBankItemWithGuildBankItem)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(swapGuildBankItemWithGuildBankItem.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(swapGuildBankItemWithGuildBankItem.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -375,7 +375,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.MoveGuildBankItem)]
|
||||
void HandleMoveGuildBankItem(MoveGuildBankItem moveGuildBankItem)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(moveGuildBankItem.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(moveGuildBankItem.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -388,7 +388,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.MergeItemWithGuildBankItem)]
|
||||
void HandleMergeItemWithGuildBankItem(MergeItemWithGuildBankItem mergeItemWithGuildBankItem)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(mergeItemWithGuildBankItem.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(mergeItemWithGuildBankItem.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -405,7 +405,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.SplitItemToGuildBank)]
|
||||
void HandleSplitItemToGuildBank(SplitItemToGuildBank splitItemToGuildBank)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(splitItemToGuildBank.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(splitItemToGuildBank.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -422,7 +422,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.MergeGuildBankItemWithItem)]
|
||||
void HandleMergeGuildBankItemWithItem(MergeGuildBankItemWithItem mergeGuildBankItemWithItem)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(mergeGuildBankItemWithItem.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(mergeGuildBankItemWithItem.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -439,7 +439,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.SplitGuildBankItemToInventory)]
|
||||
void HandleSplitGuildBankItemToInventory(SplitGuildBankItemToInventory splitGuildBankItemToInventory)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(splitGuildBankItemToInventory.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(splitGuildBankItemToInventory.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -456,7 +456,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.AutoStoreGuildBankItem)]
|
||||
void HandleAutoStoreGuildBankItem(AutoStoreGuildBankItem autoStoreGuildBankItem)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(autoStoreGuildBankItem.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(autoStoreGuildBankItem.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -469,7 +469,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.MergeGuildBankItemWithGuildBankItem)]
|
||||
void HandleMergeGuildBankItemWithGuildBankItem(MergeGuildBankItemWithGuildBankItem mergeGuildBankItemWithGuildBankItem)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(mergeGuildBankItemWithGuildBankItem.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(mergeGuildBankItemWithGuildBankItem.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -483,7 +483,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.SplitGuildBankItem)]
|
||||
void HandleSplitGuildBankItem(SplitGuildBankItem splitGuildBankItem)
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(splitGuildBankItem.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(splitGuildBankItem.Banker, GameObjectTypes.GuildBank) == null)
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
@@ -497,10 +497,10 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.GuildBankBuyTab)]
|
||||
void HandleGuildBankBuyTab(GuildBankBuyTab packet)
|
||||
{
|
||||
if (packet.Banker.IsEmpty() || GetPlayer().GetGameObjectIfCanInteractWith(packet.Banker, GameObjectTypes.GuildBank))
|
||||
if (packet.Banker.IsEmpty() || GetPlayer().GetGameObjectIfCanInteractWith(packet.Banker, GameObjectTypes.GuildBank) != null)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleBuyBankTab(this, packet.BankTab);
|
||||
}
|
||||
}
|
||||
@@ -516,10 +516,10 @@ namespace Game
|
||||
|
||||
if (!string.IsNullOrEmpty(packet.Name) && !string.IsNullOrEmpty(packet.Icon))
|
||||
{
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(packet.Banker, GameObjectTypes.GuildBank))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(packet.Banker, GameObjectTypes.GuildBank) != null)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleSetBankTabInfo(this, packet.BankTab, packet.Name, packet.Icon);
|
||||
}
|
||||
}
|
||||
@@ -529,7 +529,7 @@ namespace Game
|
||||
void HandleGuildBankLogQuery(GuildBankLogQuery packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.SendBankLog(this, (byte)packet.Tab);
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ namespace Game
|
||||
void HandleGuildBankTextQuery(GuildBankTextQuery packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.SendBankTabText(this, (byte)packet.Tab);
|
||||
}
|
||||
|
||||
@@ -551,7 +551,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.SetBankTabText((byte)packet.Tab, packet.TabText);
|
||||
}
|
||||
|
||||
@@ -579,7 +579,7 @@ namespace Game
|
||||
void HandleGuildRequestPartyState(RequestGuildPartyState packet)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildByGuid(packet.GuildGUID);
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleGuildPartyRequest(this);
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ namespace Game
|
||||
void HandleGuildChallengeUpdateRequest(GuildChallengeUpdateRequest packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleGuildRequestChallengeUpdate(this);
|
||||
}
|
||||
|
||||
@@ -603,7 +603,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.RequestGuildRewardsList)]
|
||||
void HandleRequestGuildRewardsList(RequestGuildRewardsList packet)
|
||||
{
|
||||
if (Global.GuildMgr.GetGuildById(GetPlayer().GetGuildId()))
|
||||
if (Global.GuildMgr.GetGuildById(GetPlayer().GetGuildId()) != null)
|
||||
{
|
||||
var rewards = Global.GuildMgr.GetGuildRewards();
|
||||
|
||||
@@ -630,7 +630,7 @@ namespace Game
|
||||
void HandleGuildQueryNews(GuildQueryNews packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
if (guild.GetGUID() == packet.GuildGUID)
|
||||
guild.SendNewsUpdate(this);
|
||||
}
|
||||
@@ -639,7 +639,7 @@ namespace Game
|
||||
void HandleGuildNewsUpdateSticky(GuildNewsUpdateSticky packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleNewsSetSticky(this, (uint)packet.NewsID, packet.Sticky);
|
||||
}
|
||||
|
||||
@@ -647,7 +647,7 @@ namespace Game
|
||||
void HandleGuildReplaceGuildMaster(GuildReplaceGuildMaster replaceGuildMaster)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleSetNewGuildMaster(this, "", true);
|
||||
}
|
||||
|
||||
@@ -655,7 +655,7 @@ namespace Game
|
||||
void HandleGuildSetGuildMaster(GuildSetGuildMaster packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleSetNewGuildMaster(this, packet.NewMasterName, false);
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@ namespace Game
|
||||
void HandleGuildSetAchievementTracking(GuildSetAchievementTracking packet)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleSetAchievementTracking(this, packet.AchievementIDs);
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ namespace Game
|
||||
void HandleGuildGetAchievementMembers(GuildGetAchievementMembers getAchievementMembers)
|
||||
{
|
||||
Guild guild = GetPlayer().GetGuild();
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleGetAchievementMembers(this, getAchievementMembers.AchievementID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Game
|
||||
void HandleInspect(Inspect inspect)
|
||||
{
|
||||
Player player = Global.ObjAccessor.GetPlayer(_player, inspect.Target);
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WorldSession.HandleInspectOpcode: Target {0} not found.", inspect.Target.ToString());
|
||||
return;
|
||||
@@ -51,7 +51,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Guild guild = Global.GuildMgr.GetGuildById(player.GetGuildId());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
{
|
||||
InspectGuildData guildData;
|
||||
guildData.GuildGUID = guild.GetGUID();
|
||||
@@ -83,7 +83,7 @@ namespace Game
|
||||
void HandleQueryInspectAchievements(QueryInspectAchievements inspect)
|
||||
{
|
||||
Player player = Global.ObjAccessor.GetPlayer(_player, inspect.Guid);
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WorldSession.HandleQueryInspectAchievements: [{0}] inspected unknown Player [{1}]", GetPlayer().GetGUID().ToString(), inspect.Guid.ToString());
|
||||
return;
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace Game
|
||||
else
|
||||
{
|
||||
Item parentItem = _player.GetItemByGuid(dstItem.GetCreator());
|
||||
if (parentItem)
|
||||
if (parentItem != null)
|
||||
{
|
||||
if (Player.IsEquipmentPos(dest))
|
||||
{
|
||||
@@ -565,7 +565,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Item item = GetPlayer().GetItemByPos(packet.ContainerSlotA, packet.SlotA);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
if (!GetPlayer().IsValidPos(packet.ContainerSlotB, ItemConst.NullSlot, false)) // can be autostore pos
|
||||
@@ -647,7 +647,7 @@ namespace Game
|
||||
byte itemSlot = packet.Inv.Items[1].Slot;
|
||||
|
||||
Item gift = GetPlayer().GetItemByPos(giftContainerSlot, giftSlot);
|
||||
if (!gift)
|
||||
if (gift == null)
|
||||
{
|
||||
GetPlayer().SendEquipError(InventoryResult.ItemNotFound, gift);
|
||||
return;
|
||||
@@ -660,7 +660,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Item item = GetPlayer().GetItemByPos(itemContainerSlot, itemSlot);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
GetPlayer().SendEquipError(InventoryResult.ItemNotFound, item);
|
||||
return;
|
||||
@@ -770,7 +770,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Item itemTarget = GetPlayer().GetItemByGuid(socketGems.ItemGuid);
|
||||
if (!itemTarget) //missing item to socket
|
||||
if (itemTarget == null) //missing item to socket
|
||||
return;
|
||||
|
||||
ItemTemplate itemProto = itemTarget.GetTemplate();
|
||||
@@ -789,7 +789,7 @@ namespace Game
|
||||
for (int i = 0; i < ItemConst.MaxGemSockets; ++i)
|
||||
{
|
||||
Item gem = _player.GetItemByGuid(socketGems.GemItem[i]);
|
||||
if (gem)
|
||||
if (gem != null)
|
||||
{
|
||||
gems[i] = gem;
|
||||
gemData[i].ItemId = gem.GetEntry();
|
||||
@@ -836,7 +836,7 @@ namespace Game
|
||||
// check unique-equipped conditions
|
||||
for (int i = 0; i < ItemConst.MaxGemSockets; ++i)
|
||||
{
|
||||
if (!gems[i])
|
||||
if (gems[i] == null)
|
||||
continue;
|
||||
|
||||
// continue check for case when attempt add 2 similar unique equipped gems in one item.
|
||||
@@ -850,7 +850,7 @@ namespace Game
|
||||
if (i == j) // skip self
|
||||
continue;
|
||||
|
||||
if (gems[j])
|
||||
if (gems[j] != null)
|
||||
{
|
||||
if (iGemProto.GetId() == gems[j].GetEntry())
|
||||
{
|
||||
@@ -879,7 +879,7 @@ namespace Game
|
||||
// NOTE: limitEntry.mode is not checked because if item has limit then it is applied in equip case
|
||||
for (int j = 0; j < ItemConst.MaxGemSockets; ++j)
|
||||
{
|
||||
if (gems[j])
|
||||
if (gems[j] != null)
|
||||
{
|
||||
// new gem
|
||||
if (iGemProto.GetItemLimitCategory() == gems[j].GetTemplate().GetItemLimitCategory())
|
||||
@@ -926,7 +926,7 @@ namespace Game
|
||||
|
||||
for (ushort i = 0; i < ItemConst.MaxGemSockets; ++i)
|
||||
{
|
||||
if (gems[i])
|
||||
if (gems[i] != null)
|
||||
{
|
||||
uint gemScalingLevel = _player.GetLevel();
|
||||
uint fixedLevel = gems[i].GetModifier(ItemModifier.TimewalkerLevel);
|
||||
@@ -947,7 +947,7 @@ namespace Game
|
||||
_player._ApplyItemMods(itemTarget, itemTarget.GetSlot(), true);
|
||||
|
||||
Item childItem = _player.GetChildItemByGuid(itemTarget.GetChildItem());
|
||||
if (childItem)
|
||||
if (childItem != null)
|
||||
{
|
||||
if (childItem.IsEquipped())
|
||||
_player._ApplyItemMods(childItem, childItem.GetSlot(), false);
|
||||
@@ -981,7 +981,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Item item = GetPlayer().GetItemByPos(InventorySlots.Bag0, (byte)packet.Slot);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
if (item.GetEnchantmentId(EnchantmentSlot.Temp) == 0)
|
||||
@@ -995,7 +995,7 @@ namespace Game
|
||||
void HandleGetItemPurchaseData(GetItemPurchaseData packet)
|
||||
{
|
||||
Item item = GetPlayer().GetItemByGuid(packet.ItemGUID);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "HandleGetItemPurchaseData: Item {0} not found!", packet.ItemGUID.ToString());
|
||||
return;
|
||||
@@ -1008,7 +1008,7 @@ namespace Game
|
||||
void HandleItemRefund(ItemPurchaseRefund packet)
|
||||
{
|
||||
Item item = GetPlayer().GetItemByGuid(packet.ItemGUID);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WorldSession.HandleItemRefund: Item {0} not found!", packet.ItemGUID.ToString());
|
||||
return;
|
||||
@@ -1032,7 +1032,7 @@ namespace Game
|
||||
if (!isUsingBankCommand)
|
||||
{
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(bankerGUID, NPCFlags.Banker, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1043,7 +1043,7 @@ namespace Game
|
||||
void HandleUseCritterItem(UseCritterItem useCritterItem)
|
||||
{
|
||||
Item item = GetPlayer().GetItemByGuid(useCritterItem.ItemGuid);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
foreach (var itemEffect in item.GetEffects())
|
||||
@@ -1087,7 +1087,7 @@ namespace Game
|
||||
void HandleRemoveNewItem(RemoveNewItem removeNewItem)
|
||||
{
|
||||
Item item = _player.GetItemByGuid(removeNewItem.ItemGuid);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, $"WorldSession.HandleRemoveNewItem: Item ({removeNewItem.ItemGuid}) not found for {GetPlayerInfo()}!");
|
||||
return;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Game
|
||||
void HandleLfgJoin(DFJoin dfJoin)
|
||||
{
|
||||
if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser) ||
|
||||
(GetPlayer().GetGroup() && GetPlayer().GetGroup().GetLeaderGUID() != GetPlayer().GetGUID() &&
|
||||
(GetPlayer().GetGroup() != null && GetPlayer().GetGroup().GetLeaderGUID() != GetPlayer().GetGUID() &&
|
||||
(GetPlayer().GetGroup().GetMembersCount() == MapConst.MaxGroupSize || !GetPlayer().GetGroup().IsLFGGroup())))
|
||||
return;
|
||||
|
||||
@@ -47,10 +47,10 @@ namespace Game
|
||||
{
|
||||
Group group = GetPlayer().GetGroup();
|
||||
|
||||
Log.outDebug(LogFilter.Lfg, "CMSG_DF_LEAVE {0} in group: {1} sent guid {2}.", GetPlayerInfo(), group ? 1 : 0, dfLeave.Ticket.RequesterGuid.ToString());
|
||||
Log.outDebug(LogFilter.Lfg, "CMSG_DF_LEAVE {0} in group: {1} sent guid {2}.", GetPlayerInfo(), group != null ? 1 : 0, dfLeave.Ticket.RequesterGuid.ToString());
|
||||
|
||||
// Check cheating - only leader can leave the queue
|
||||
if (!group || group.GetLeaderGUID() == dfLeave.Ticket.RequesterGuid)
|
||||
if (group == null || group.GetLeaderGUID() == dfLeave.Ticket.RequesterGuid)
|
||||
Global.LFGMgr.LeaveLfg(dfLeave.Ticket.RequesterGuid);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Game
|
||||
{
|
||||
ObjectGuid guid = GetPlayer().GetGUID();
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (!group)
|
||||
if (group == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Lfg, "CMSG_DF_SET_ROLES {0} Not in group",
|
||||
GetPlayerInfo());
|
||||
@@ -112,7 +112,7 @@ namespace Game
|
||||
ObjectGuid guid = GetPlayer().GetGUID();
|
||||
LfgUpdateData updateData = Global.LFGMgr.GetLfgStatus(guid);
|
||||
|
||||
if (GetPlayer().GetGroup())
|
||||
if (GetPlayer().GetGroup() != null)
|
||||
{
|
||||
SendLfgUpdateStatus(updateData, true);
|
||||
updateData.dungeons.Clear();
|
||||
@@ -199,7 +199,7 @@ namespace Game
|
||||
{
|
||||
ObjectGuid guid = GetPlayer().GetGUID();
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (!group)
|
||||
if (group == null)
|
||||
return;
|
||||
|
||||
LfgPartyInfo lfgPartyInfo = new();
|
||||
@@ -208,7 +208,7 @@ namespace Game
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player plrg = refe.GetSource();
|
||||
if (!plrg)
|
||||
if (plrg == null)
|
||||
continue;
|
||||
|
||||
ObjectGuid pguid = plrg.GetGUID();
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Game
|
||||
void HandleLogoutCancel(LogoutCancel packet)
|
||||
{
|
||||
// Player have already logged out serverside, too late to cancel
|
||||
if (!GetPlayer())
|
||||
if (GetPlayer() == null)
|
||||
return;
|
||||
|
||||
SetLogoutStartTime(0);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Game
|
||||
GameObject go = player.GetMap().GetGameObject(lguid);
|
||||
|
||||
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
|
||||
if (!go || ((go.GetOwnerGUID() != player.GetGUID() && go.GetGoType() != GameObjectTypes.FishingHole) && !go.IsWithinDistInMap(player)))
|
||||
if (go == null || ((go.GetOwnerGUID() != player.GetGUID() && go.GetGoType() != GameObjectTypes.FishingHole) && !go.IsWithinDistInMap(player)))
|
||||
{
|
||||
player.SendLootRelease(lguid);
|
||||
continue;
|
||||
@@ -53,7 +53,7 @@ namespace Game
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!creature.IsWithinDistInMap(player, AELootCreatureCheck.LootDistance))
|
||||
if (creature.IsWithinDistInMap(player, AELootCreatureCheck.LootDistance))
|
||||
{
|
||||
player.SendLootError(req.Object, lguid, LootError.TooFar);
|
||||
continue;
|
||||
@@ -102,7 +102,7 @@ namespace Game
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player member = refe.GetSource();
|
||||
if (!member)
|
||||
if (member == null)
|
||||
continue;
|
||||
|
||||
if (!loot.HasAllowedLooter(member.GetGUID()))
|
||||
@@ -203,7 +203,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Creature lootTarget = ObjectAccessor.GetCreature(GetPlayer(), packet.Unit);
|
||||
if (!lootTarget)
|
||||
if (lootTarget == null)
|
||||
return;
|
||||
|
||||
AELootCreatureCheck check = new(_player, packet.Unit);
|
||||
@@ -272,7 +272,7 @@ namespace Game
|
||||
GameObject go = player.GetMap().GetGameObject(lguid);
|
||||
|
||||
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
|
||||
if (!go || ((go.GetOwnerGUID() != player.GetGUID() && go.GetGoType() != GameObjectTypes.FishingHole) && !go.IsWithinDistInMap(player)))
|
||||
if (go == null || ((go.GetOwnerGUID() != player.GetGUID() && go.GetGoType() != GameObjectTypes.FishingHole) && !go.IsWithinDistInMap(player)))
|
||||
return;
|
||||
|
||||
if (loot.IsLooted() || go.GetGoType() == GameObjectTypes.FishingNode || go.GetGoType() == GameObjectTypes.FishingHole)
|
||||
@@ -303,7 +303,7 @@ namespace Game
|
||||
else if (lguid.IsCorpse()) // ONLY remove insignia at BG
|
||||
{
|
||||
Corpse corpse = ObjectAccessor.GetCorpse(player, lguid);
|
||||
if (!corpse || !corpse.IsWithinDistInMap(player, SharedConst.InteractionDistance))
|
||||
if (corpse == null || !corpse.IsWithinDistInMap(player, SharedConst.InteractionDistance))
|
||||
return;
|
||||
|
||||
if (loot.IsLooted())
|
||||
@@ -315,7 +315,7 @@ namespace Game
|
||||
else if (lguid.IsItem())
|
||||
{
|
||||
Item pItem = player.GetItemByGuid(lguid);
|
||||
if (!pItem)
|
||||
if (pItem == null)
|
||||
return;
|
||||
|
||||
ItemTemplate proto = pItem.GetTemplate();
|
||||
@@ -355,7 +355,7 @@ namespace Game
|
||||
creature.RemoveDynamicFlag(UnitDynFlags.Lootable);
|
||||
|
||||
// skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
|
||||
if (!creature.IsAlive())
|
||||
if (creature.IsAlive())
|
||||
creature.AllLootRemovedFromCorpse();
|
||||
}
|
||||
}
|
||||
@@ -395,7 +395,7 @@ namespace Game
|
||||
|
||||
// player on other map
|
||||
Player target = Global.ObjAccessor.GetPlayer(_player, masterLootItem.Target);
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
GetPlayer().SendLootError(ObjectGuid.Empty, ObjectGuid.Empty, LootError.PlayerNotFound);
|
||||
return;
|
||||
|
||||
@@ -30,12 +30,12 @@ namespace Game
|
||||
}
|
||||
else if (guid.IsGameObject())
|
||||
{
|
||||
if (!GetPlayer().GetGameObjectIfCanInteractWith(guid, GameObjectTypes.Mailbox))
|
||||
if (GetPlayer().GetGameObjectIfCanInteractWith(guid, GameObjectTypes.Mailbox) == null)
|
||||
return false;
|
||||
}
|
||||
else if (guid.IsAnyTypeCreature())
|
||||
{
|
||||
if (!GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.Mailbox, NPCFlags2.None))
|
||||
if (GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.Mailbox, NPCFlags2.None) == null)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -389,7 +389,7 @@ namespace Game
|
||||
foreach (var itemInfo in m.items)
|
||||
{
|
||||
Item item = player.GetMItem(itemInfo.item_guid);
|
||||
if (item)
|
||||
if (item != null)
|
||||
draft.AddItem(item);
|
||||
player.RemoveMItem(itemInfo.item_guid);
|
||||
}
|
||||
@@ -454,7 +454,7 @@ namespace Game
|
||||
if (HasPermission(RBACPermissions.LogGmTrade))
|
||||
{
|
||||
string sender_name;
|
||||
if (receiver)
|
||||
if (receiver != null)
|
||||
{
|
||||
sender_accId = receiver.GetSession().GetAccountId();
|
||||
sender_name = receiver.GetName();
|
||||
@@ -470,11 +470,11 @@ namespace Game
|
||||
Log.outCommand(GetAccountId(), "GM {0} (Account: {1}) receiver mail item: {2} (Entry: {3} Count: {4}) and send COD money: {5} to player: {6} (Account: {7})",
|
||||
GetPlayerName(), GetAccountId(), it.GetTemplate().GetName(), it.GetEntry(), it.GetCount(), m.COD, sender_name, sender_accId);
|
||||
}
|
||||
else if (!receiver)
|
||||
else if (receiver == null)
|
||||
sender_accId = Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(sender_guid);
|
||||
|
||||
// check player existence
|
||||
if (receiver || sender_accId != 0)
|
||||
if (receiver != null || sender_accId != 0)
|
||||
{
|
||||
new MailDraft(m.subject, "")
|
||||
.AddMoney(m.COD)
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Game
|
||||
AccountData adata = GetAccountData(request.DataType);
|
||||
|
||||
UpdateAccountData data = new();
|
||||
data.Player = GetPlayer() ? GetPlayer().GetGUID() : ObjectGuid.Empty;
|
||||
data.Player = GetPlayer() != null ? GetPlayer().GetGUID() : ObjectGuid.Empty;
|
||||
data.Time = (uint)adata.Time;
|
||||
data.DataType = request.DataType;
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.SetActionBarToggles)]
|
||||
void HandleSetActionBarToggles(SetActionBarToggles packet)
|
||||
{
|
||||
if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
|
||||
if (GetPlayer() == null) // ignore until not logged (check needed because STATUS_AUTHED)
|
||||
{
|
||||
if (packet.Mask != 0)
|
||||
Log.outError(LogFilter.Network, "WorldSession.HandleSetActionBarToggles in not logged state with value: {0}, ignored", packet.Mask);
|
||||
@@ -252,7 +252,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
Battleground bg = player.GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
bg.HandleAreaTrigger(player, packet.AreaTriggerID, packet.Entered);
|
||||
|
||||
OutdoorPvP pvp = player.GetOutdoorPvP();
|
||||
@@ -349,7 +349,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Group group = player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
if (group.IsLFGGroup() && player.GetMap().IsDungeon())
|
||||
teleported = player.TeleportToBGEntryPoint();
|
||||
}
|
||||
@@ -536,7 +536,7 @@ namespace Game
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "Added FarSight {0} to player {1}", GetPlayer().m_activePlayerData.FarsightObject.ToString(), GetPlayer().GetGUID().ToString());
|
||||
WorldObject target = GetPlayer().GetViewpoint();
|
||||
if (target)
|
||||
if (target != null)
|
||||
GetPlayer().SetSeer(target);
|
||||
else
|
||||
Log.outDebug(LogFilter.Network, "Player {0} (GUID: {1}) requests non-existing seer {2}", GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), GetPlayer().m_activePlayerData.FarsightObject.ToString());
|
||||
@@ -573,7 +573,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
if (!group.IsLeader(GetPlayer().GetGUID()))
|
||||
return;
|
||||
@@ -618,7 +618,7 @@ namespace Game
|
||||
|
||||
// cannot reset while in an instance
|
||||
Map map = GetPlayer().GetMap();
|
||||
if (map && map.Instanceable())
|
||||
if (map != null && map.Instanceable())
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WorldSession:HandleSetDungeonDifficulty: player (Name: {0}, {1}) tried to reset the instance while player is inside!",
|
||||
GetPlayer().GetName(), GetPlayer().GetGUID().ToString());
|
||||
@@ -626,7 +626,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
if (!group.IsLeader(_player.GetGUID()))
|
||||
return;
|
||||
@@ -684,7 +684,7 @@ namespace Game
|
||||
|
||||
// cannot reset while in an instance
|
||||
Map map = GetPlayer().GetMap();
|
||||
if (map && map.Instanceable())
|
||||
if (map != null && map.Instanceable())
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WorldSession:HandleSetRaidDifficulty: player (Name: {0}, {1} tried to reset the instance while inside!",
|
||||
GetPlayer().GetName(), GetPlayer().GetGUID().ToString());
|
||||
@@ -692,7 +692,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
if (!group.IsLeader(_player.GetGUID()))
|
||||
return;
|
||||
@@ -732,7 +732,7 @@ namespace Game
|
||||
void HandleGuildSetFocusedAchievement(GuildSetFocusedAchievement setFocusedAchievement)
|
||||
{
|
||||
Guild guild = Global.GuildMgr.GetGuildById(GetPlayer().GetGuildId());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.GetAchievementMgr().SendAchievementInfo(GetPlayer(), setFocusedAchievement.AchievementID);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Game
|
||||
Unit mover = GetPlayer().GetUnitBeingMoved();
|
||||
Player plrMover = mover.ToPlayer();
|
||||
|
||||
if (plrMover && plrMover.IsBeingTeleported())
|
||||
if (plrMover != null && plrMover.IsBeingTeleported())
|
||||
return;
|
||||
|
||||
GetPlayer().ValidateMovementInfo(movementInfo);
|
||||
@@ -78,7 +78,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
// stop some emotes at player move
|
||||
if (plrMover && (plrMover.GetEmoteState() != 0))
|
||||
if (plrMover != null && (plrMover.GetEmoteState() != 0))
|
||||
plrMover.SetEmoteState(Emote.OneshotNone);
|
||||
|
||||
//handle special cases
|
||||
@@ -95,7 +95,7 @@ namespace Game
|
||||
movementInfo.Pos.posZ + movementInfo.transport.pos.posZ, movementInfo.Pos.Orientation + movementInfo.transport.pos.Orientation))
|
||||
return;
|
||||
|
||||
if (plrMover)
|
||||
if (plrMover != null)
|
||||
{
|
||||
if (plrMover.GetTransport() == null)
|
||||
{
|
||||
@@ -124,14 +124,14 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
if (mover.GetTransport() == null && !mover.GetVehicle())
|
||||
if (mover.GetTransport() == null && mover.GetVehicle() == null)
|
||||
movementInfo.transport.Reset();
|
||||
}
|
||||
else if (plrMover && plrMover.GetTransport() != null) // if we were on a transport, leave
|
||||
else if (plrMover != null && plrMover.GetTransport() != null) // if we were on a transport, leave
|
||||
plrMover.GetTransport().RemovePassenger(plrMover);
|
||||
|
||||
// fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).
|
||||
if (opcode == ClientOpcodes.MoveFallLand && plrMover && !plrMover.IsInFlight())
|
||||
if (opcode == ClientOpcodes.MoveFallLand && plrMover != null && !plrMover.IsInFlight())
|
||||
plrMover.HandleFall(movementInfo);
|
||||
|
||||
// interrupt parachutes upon falling or landing in water
|
||||
@@ -147,7 +147,7 @@ namespace Game
|
||||
|
||||
// Some vehicles allow the passenger to turn by himself
|
||||
Vehicle vehicle = mover.GetVehicle();
|
||||
if (vehicle)
|
||||
if (vehicle != null)
|
||||
{
|
||||
VehicleSeatRecord seat = vehicle.GetSeatForPassenger(mover);
|
||||
if (seat != null)
|
||||
@@ -170,7 +170,7 @@ namespace Game
|
||||
moveUpdate.Status = mover.m_movementInfo;
|
||||
mover.SendMessageToSet(moveUpdate, GetPlayer());
|
||||
|
||||
if (plrMover) // nothing is charmed, or player charmed
|
||||
if (plrMover != null) // nothing is charmed, or player charmed
|
||||
{
|
||||
if (plrMover.IsSitState() && movementInfo.HasMovementFlag(MovementFlag.MaskMoving | MovementFlag.MaskTurning))
|
||||
plrMover.SetStandState(UnitStandStateType.Stand);
|
||||
@@ -179,7 +179,7 @@ namespace Game
|
||||
|
||||
if (movementInfo.Pos.posZ < plrMover.GetMap().GetMinHeight(plrMover.GetPhaseShift(), movementInfo.Pos.GetPositionX(), movementInfo.Pos.GetPositionY()))
|
||||
{
|
||||
if (!(plrMover.GetBattleground() && plrMover.GetBattleground().HandlePlayerUnderMap(GetPlayer())))
|
||||
if (!(plrMover.GetBattleground() != null && plrMover.GetBattleground().HandlePlayerUnderMap(GetPlayer())))
|
||||
{
|
||||
// NOTE: this is actually called many times while falling
|
||||
// even after the player has been teleported away
|
||||
@@ -261,7 +261,7 @@ namespace Game
|
||||
// while the player is in transit, for example the map may get full
|
||||
if (newMap == null || newMap.CannotEnter(player) != null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, $"Map {loc.GetMapId()} could not be created for {(newMap ? newMap.GetMapName() : "Unknown")} ({player.GetGUID()}), porting player to homebind");
|
||||
Log.outError(LogFilter.Network, $"Map {loc.GetMapId()} could not be created for {(newMap != null ? newMap.GetMapName() : "Unknown")} ({player.GetGUID()}), porting player to homebind");
|
||||
player.TeleportTo(player.GetHomebind());
|
||||
return;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ namespace Game
|
||||
|
||||
if (!player.GetMap().AddPlayerToMap(player, !seamlessTeleport))
|
||||
{
|
||||
Log.outError(LogFilter.Network, $"WORLD: failed to teleport player {player.GetName()} ({player.GetGUID()}) to map {loc.GetMapId()} ({(newMap ? newMap.GetMapName() : "Unknown")}) because of unknown reason!");
|
||||
Log.outError(LogFilter.Network, $"WORLD: failed to teleport player {player.GetName()} ({player.GetGUID()}) to map {loc.GetMapId()} ({(newMap != null ? newMap.GetMapName() : "Unknown")}) because of unknown reason!");
|
||||
player.ResetMap();
|
||||
player.SetMap(oldMap);
|
||||
player.TeleportTo(player.GetHomebind());
|
||||
@@ -314,7 +314,7 @@ namespace Game
|
||||
else
|
||||
{
|
||||
Battleground bg = player.GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
{
|
||||
if (player.IsInvitedForBattlegroundInstance(player.GetBattlegroundId()))
|
||||
bg.AddPlayer(player, player.m_bgData.queueId);
|
||||
@@ -443,7 +443,7 @@ namespace Game
|
||||
{
|
||||
Player plMover = GetPlayer().GetUnitBeingMoved().ToPlayer();
|
||||
|
||||
if (!plMover || !plMover.IsBeingTeleportedNear())
|
||||
if (plMover == null || !plMover.IsBeingTeleportedNear())
|
||||
return;
|
||||
|
||||
if (packet.MoverGUID != plMover.GetGUID())
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Game
|
||||
void HandleTabardVendorActivate(Hello packet)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.TabardDesigner, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleTabardVendorActivateOpcode - {0} not found or you can not interact with him.", packet.Unit.ToString());
|
||||
return;
|
||||
@@ -46,7 +46,7 @@ namespace Game
|
||||
void HandleTrainerList(Hello packet)
|
||||
{
|
||||
Creature npc = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Trainer, NPCFlags2.None);
|
||||
if (!npc)
|
||||
if (npc == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, $"WorldSession.SendTrainerList - {packet.Unit} not found or you can not interact with him.");
|
||||
return;
|
||||
@@ -193,7 +193,7 @@ namespace Game
|
||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||
|
||||
if ((unit && unit.GetScriptId() != unit.LastUsedScriptID) || (go != null && go.GetScriptId() != go.LastUsedScriptID))
|
||||
if ((unit != null && unit.GetScriptId() != unit.LastUsedScriptID) || (go != null && go.GetScriptId() != go.LastUsedScriptID))
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleGossipSelectOption - Script reloaded while in use, ignoring and set new scipt id");
|
||||
if (unit != null)
|
||||
@@ -236,7 +236,7 @@ namespace Game
|
||||
void HandleSpiritHealerActivate(SpiritHealerActivate packet)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Healer, NPCFlags.SpiritHealer, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleSpiritHealerActivateOpcode - {0} not found or you can not interact with him.", packet.Healer.ToString());
|
||||
return;
|
||||
@@ -283,7 +283,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Innkeeper, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleBinderActivate - {0} not found or you can not interact with him.", packet.Unit.ToString());
|
||||
return;
|
||||
@@ -350,7 +350,7 @@ namespace Game
|
||||
void HandleRepairItem(RepairItem packet)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.NpcGUID, NPCFlags.Repair, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleRepairItemOpcode - {0} not found or you can not interact with him.", packet.NpcGUID.ToString());
|
||||
return;
|
||||
@@ -368,7 +368,7 @@ namespace Game
|
||||
Log.outDebug(LogFilter.Network, "ITEM: Repair {0}, at {1}", packet.ItemGUID.ToString(), packet.NpcGUID.ToString());
|
||||
|
||||
Item item = GetPlayer().GetItemByGuid(packet.ItemGUID);
|
||||
if (item)
|
||||
if (item != null)
|
||||
GetPlayer().DurabilityRepair(item.GetPos(), true, discountMod);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Game
|
||||
void HandleDismissCritter(DismissCritter packet)
|
||||
{
|
||||
Unit pet = ObjectAccessor.GetCreatureOrPetOrVehicle(GetPlayer(), packet.CritterGUID);
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "Critter {0} does not exist - player '{1}' ({2} / account: {3}) attempted to dismiss it (possibly lagged out)",
|
||||
packet.CritterGUID.ToString(), GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), GetAccountId());
|
||||
@@ -51,7 +51,7 @@ namespace Game
|
||||
|
||||
// used also for charmed creature
|
||||
Unit pet = Global.ObjAccessor.GetUnit(GetPlayer(), guid1);
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, "HandlePetAction: {0} doesn't exist for {1}", guid1.ToString(), GetPlayer().GetGUID().ToString());
|
||||
return;
|
||||
@@ -95,7 +95,7 @@ namespace Game
|
||||
void HandlePetStopAttack(PetStopAttack packet)
|
||||
{
|
||||
Unit pet = ObjectAccessor.GetCreatureOrPetOrVehicle(GetPlayer(), packet.PetGUID);
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, "HandlePetStopAttack: {0} does not exist", packet.PetGUID.ToString());
|
||||
return;
|
||||
@@ -163,18 +163,18 @@ namespace Game
|
||||
|
||||
// only place where pet can be player
|
||||
Unit TargetUnit = Global.ObjAccessor.GetUnit(GetPlayer(), guid2);
|
||||
if (!TargetUnit)
|
||||
if (TargetUnit == null)
|
||||
return;
|
||||
|
||||
Unit owner = pet.GetOwner();
|
||||
if (owner)
|
||||
if (owner != null)
|
||||
if (!owner.IsValidAttackTarget(TargetUnit))
|
||||
return;
|
||||
|
||||
// This is true if pet has no target or has target but targets differs.
|
||||
if (pet.GetVictim() != TargetUnit || !pet.GetCharmInfo().IsCommandAttack())
|
||||
{
|
||||
if (pet.GetVictim())
|
||||
if (pet.GetVictim() != null)
|
||||
pet.AttackStop();
|
||||
|
||||
if (!pet.IsTypeId(TypeId.Player) && pet.ToCreature().IsAIEnabled())
|
||||
@@ -308,27 +308,27 @@ namespace Game
|
||||
if (result == SpellCastResult.UnitNotInfront && !pet.IsPossessed() && !pet.IsVehicle())
|
||||
{
|
||||
Unit unit_target2 = spell.m_targets.GetUnitTarget();
|
||||
if (unit_target)
|
||||
if (unit_target != null)
|
||||
{
|
||||
if (!pet.HasSpellFocus())
|
||||
pet.SetInFront(unit_target);
|
||||
Player player = unit_target.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
pet.SendUpdateToPlayer(player);
|
||||
}
|
||||
else if (unit_target2)
|
||||
else if (unit_target2 != null)
|
||||
{
|
||||
if (!pet.HasSpellFocus())
|
||||
pet.SetInFront(unit_target2);
|
||||
Player player = unit_target2.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
pet.SendUpdateToPlayer(player);
|
||||
}
|
||||
Unit powner = pet.GetCharmerOrOwner();
|
||||
if (powner)
|
||||
if (powner != null)
|
||||
{
|
||||
Player player = powner.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
pet.SendUpdateToPlayer(player);
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ namespace Game
|
||||
pet.SendPetAIReaction(guid1);
|
||||
}
|
||||
|
||||
if (unit_target && !GetPlayer().IsFriendlyTo(unit_target) && !pet.IsPossessed() && !pet.IsVehicle())
|
||||
if (unit_target != null && !GetPlayer().IsFriendlyTo(unit_target) && !pet.IsPossessed() && !pet.IsVehicle())
|
||||
{
|
||||
// This is true if pet has no target or has target but targets differs.
|
||||
if (pet.GetVictim() != unit_target)
|
||||
@@ -404,14 +404,14 @@ namespace Game
|
||||
response.UnitGUID = guid;
|
||||
|
||||
Creature unit = ObjectAccessor.GetCreatureOrPetOrVehicle(GetPlayer(), guid);
|
||||
if (unit)
|
||||
if (unit != null)
|
||||
{
|
||||
response.Allow = true;
|
||||
response.Timestamp = unit.m_unitData.PetNameTimestamp;
|
||||
response.Name = unit.GetName();
|
||||
|
||||
Pet pet = unit.ToPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
{
|
||||
DeclinedName names = pet.GetDeclinedNames();
|
||||
if (names != null)
|
||||
@@ -439,7 +439,7 @@ namespace Game
|
||||
// stable master case
|
||||
else
|
||||
{
|
||||
if (!GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.StableMaster, NPCFlags2.None))
|
||||
if (GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.StableMaster, NPCFlags2.None) == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "Stablemaster {0} not found or you can't interact with him.", guid.ToString());
|
||||
return false;
|
||||
@@ -453,7 +453,7 @@ namespace Game
|
||||
{
|
||||
ObjectGuid petguid = packet.PetGUID;
|
||||
Unit pet = Global.ObjAccessor.GetUnit(GetPlayer(), petguid);
|
||||
if (!pet || pet != GetPlayer().GetFirstControlled())
|
||||
if (pet == null || pet != GetPlayer().GetFirstControlled())
|
||||
{
|
||||
Log.outError(LogFilter.Network, "HandlePetSetAction: Unknown {0} or pet owner {1}", petguid.ToString(), GetPlayer().GetGUID().ToString());
|
||||
return;
|
||||
@@ -528,7 +528,7 @@ namespace Game
|
||||
PetStable petStable = _player.GetPetStable();
|
||||
Pet pet = ObjectAccessor.GetPet(GetPlayer(), petguid);
|
||||
// check it!
|
||||
if (!pet || !pet.IsPet() || pet.ToPet().GetPetType() != PetType.Hunter || !pet.HasPetFlag(UnitPetFlags.CanBeRenamed) ||
|
||||
if (pet == null || !pet.IsPet() || pet.ToPet().GetPetType() != PetType.Hunter || !pet.HasPetFlag(UnitPetFlags.CanBeRenamed) ||
|
||||
pet.GetOwnerGUID() != _player.GetGUID() || pet.GetCharmInfo() == null ||
|
||||
petStable == null || petStable.GetCurrentPet() == null || petStable.GetCurrentPet().PetNumber != pet.GetCharmInfo().GetPetNumber())
|
||||
return;
|
||||
@@ -587,7 +587,7 @@ namespace Game
|
||||
{
|
||||
// pet/charmed
|
||||
Creature pet = ObjectAccessor.GetCreatureOrPetOrVehicle(GetPlayer(), packet.Pet);
|
||||
if (pet && pet.ToPet() && pet.ToPet().GetPetType() == PetType.Hunter)
|
||||
if (pet != null && pet.ToPet() != null && pet.ToPet().GetPetType() == PetType.Hunter)
|
||||
{
|
||||
_player.RemovePet((Pet)pet, PetSaveMode.AsDeleted);
|
||||
}
|
||||
@@ -597,7 +597,7 @@ namespace Game
|
||||
void HandlePetSpellAutocast(PetSpellAutocast packet)
|
||||
{
|
||||
Creature pet = ObjectAccessor.GetCreatureOrPetOrVehicle(GetPlayer(), packet.PetGUID);
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, "WorldSession.HandlePetSpellAutocast: {0} not found.", packet.PetGUID.ToString());
|
||||
return;
|
||||
@@ -648,7 +648,7 @@ namespace Game
|
||||
void HandlePetCastSpell(PetCastSpell petCastSpell)
|
||||
{
|
||||
Unit caster = Global.ObjAccessor.GetUnit(GetPlayer(), petCastSpell.PetGUID);
|
||||
if (!caster)
|
||||
if (caster == null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, "WorldSession.HandlePetCastSpell: Caster {0} not found.", petCastSpell.PetGUID.ToString());
|
||||
return;
|
||||
@@ -702,10 +702,10 @@ namespace Game
|
||||
if (result == SpellCastResult.SpellCastOk)
|
||||
{
|
||||
Creature creature = caster.ToCreature();
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
{
|
||||
Pet pet = creature.ToPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
{
|
||||
// 10% chance to play special pet attack talk, else growl
|
||||
// actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
|
||||
@@ -752,7 +752,7 @@ namespace Game
|
||||
// Handle the packet CMSG_REQUEST_PET_INFO - sent when player does ingame /reload command
|
||||
|
||||
// Packet sent when player has a pet
|
||||
if (_player.GetPet())
|
||||
if (_player.GetPet() != null)
|
||||
_player.PetSpellInitialize();
|
||||
else
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Game
|
||||
{
|
||||
// prevent cheating
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Petitioner, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandlePetitionBuyOpcode - {0} not found or you can't interact with him.", packet.Unit.ToString());
|
||||
return;
|
||||
@@ -35,7 +35,7 @@ namespace Game
|
||||
if (GetPlayer().GetGuildId() != 0)
|
||||
return;
|
||||
|
||||
if (Global.GuildMgr.GetGuildByName(packet.Title))
|
||||
if (Global.GuildMgr.GetGuildByName(packet.Title) != null)
|
||||
{
|
||||
Guild.SendCommandResult(this, GuildCommandType.CreateGuild, GuildCommandError.NameExists_S, packet.Title);
|
||||
return;
|
||||
@@ -70,7 +70,7 @@ namespace Game
|
||||
|
||||
GetPlayer().ModifyMoney(-cost);
|
||||
Item charter = GetPlayer().StoreNewItem(dest, charterItemID, true);
|
||||
if (!charter)
|
||||
if (charter == null)
|
||||
return;
|
||||
|
||||
charter.SetPetitionId((uint)charter.GetGUID().GetCounter());
|
||||
@@ -167,7 +167,7 @@ namespace Game
|
||||
void HandlePetitionRenameGuild(PetitionRenameGuild packet)
|
||||
{
|
||||
Item item = GetPlayer().GetItemByGuid(packet.PetitionGuid);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
Petition petition = Global.PetitionMgr.GetPetition(packet.PetitionGuid);
|
||||
@@ -177,7 +177,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (Global.GuildMgr.GetGuildByName(packet.NewGuildName))
|
||||
if (Global.GuildMgr.GetGuildByName(packet.NewGuildName) != null)
|
||||
{
|
||||
Guild.SendCommandResult(this, GuildCommandType.CreateGuild, GuildCommandError.NameExists_S, packet.NewGuildName);
|
||||
return;
|
||||
@@ -274,7 +274,7 @@ namespace Game
|
||||
|
||||
// update for owner if online
|
||||
Player owner1 = Global.ObjAccessor.FindPlayer(ownerGuid);
|
||||
if (owner1)
|
||||
if (owner1 != null)
|
||||
owner1.SendPacket(signResult);
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace Game
|
||||
void HandleOfferPetition(OfferPetition packet)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(packet.TargetPlayer);
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Petition petition = Global.PetitionMgr.GetPetition(packet.ItemGUID);
|
||||
@@ -335,7 +335,7 @@ namespace Game
|
||||
{
|
||||
// Check if player really has the required petition charter
|
||||
Item item = GetPlayer().GetItemByGuid(packet.Item);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
Petition petition = Global.PetitionMgr.GetPetition(packet.Item);
|
||||
@@ -362,7 +362,7 @@ namespace Game
|
||||
}
|
||||
|
||||
// Check if guild name is already taken
|
||||
if (Global.GuildMgr.GetGuildByName(name))
|
||||
if (Global.GuildMgr.GetGuildByName(name) != null)
|
||||
{
|
||||
Guild.SendCommandResult(this, GuildCommandType.CreateGuild, GuildCommandError.NameExists_S, name);
|
||||
return;
|
||||
@@ -419,7 +419,7 @@ namespace Game
|
||||
public void SendPetitionShowList(ObjectGuid guid)
|
||||
{
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.Petitioner, NPCFlags2.None);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandlePetitionShowListOpcode - {0} not found or you can't interact with him.", guid.ToString());
|
||||
return;
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Game
|
||||
{
|
||||
CorpseLocation packet = new();
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(queryCorpseLocation.Player);
|
||||
if (!player || !player.HasCorpse() || !_player.IsInSameRaidWith(player))
|
||||
if (player == null || !player.HasCorpse() || !_player.IsInSameRaidWith(player))
|
||||
{
|
||||
packet.Valid = false; // corpse not found
|
||||
packet.Player = queryCorpseLocation.Player;
|
||||
@@ -240,10 +240,10 @@ namespace Game
|
||||
response.Player = queryCorpseTransport.Player;
|
||||
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(queryCorpseTransport.Player);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
Corpse corpse = player.GetCorpse();
|
||||
if (_player.IsInSameRaidWith(player) && corpse && !corpse.GetTransGUID().IsEmpty() && corpse.GetTransGUID() == queryCorpseTransport.Transport)
|
||||
if (_player.IsInSameRaidWith(player) && corpse != null && !corpse.GetTransGUID().IsEmpty() && corpse.GetTransGUID() == queryCorpseTransport.Transport)
|
||||
{
|
||||
response.Position = new Vector3(corpse.GetTransOffsetX(), corpse.GetTransOffsetY(), corpse.GetTransOffsetZ());
|
||||
response.Facing = corpse.GetTransOffsetO();
|
||||
@@ -315,7 +315,7 @@ namespace Game
|
||||
queryItemTextResponse.Id = packet.Id;
|
||||
|
||||
Item item = GetPlayer().GetItemByGuid(packet.Id);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
queryItemTextResponse.Valid = true;
|
||||
queryItemTextResponse.Text = item.GetText();
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Game
|
||||
QuestGiverStatus questStatus = QuestGiverStatus.None;
|
||||
|
||||
var questgiver = Global.ObjAccessor.GetObjectByTypeMask(GetPlayer(), packet.QuestGiverGUID, TypeMask.Unit | TypeMask.GameObject);
|
||||
if (!questgiver)
|
||||
if (questgiver == null)
|
||||
{
|
||||
Log.outInfo(LogFilter.Network, "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver {0}", packet.QuestGiverGUID.ToString());
|
||||
return;
|
||||
@@ -95,7 +95,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Player playerQuestObject = obj.ToPlayer();
|
||||
if (playerQuestObject)
|
||||
if (playerQuestObject != null)
|
||||
{
|
||||
if ((_player.GetPlayerSharingQuest().IsEmpty() && _player.GetPlayerSharingQuest() != packet.QuestGiverGUID) || !playerQuestObject.CanShareQuest(packet.QuestID))
|
||||
{
|
||||
@@ -151,13 +151,13 @@ namespace Game
|
||||
if (quest.IsPushedToPartyOnAccept())
|
||||
{
|
||||
var group = _player.GetGroup();
|
||||
if (group)
|
||||
if (group != null)
|
||||
{
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player player = refe.GetSource();
|
||||
|
||||
if (!player || player == _player || !player.IsInMap(_player)) // not self and in same map
|
||||
if (player == null || player == _player || !player.IsInMap(_player)) // not self and in same map
|
||||
continue;
|
||||
|
||||
if (player.CanTakeQuest(quest, true))
|
||||
@@ -207,7 +207,7 @@ namespace Game
|
||||
{
|
||||
// Verify that the guid is valid and is a questgiver or involved in the requested quest
|
||||
var obj = Global.ObjAccessor.GetObjectByTypeMask(GetPlayer(), packet.QuestGiverGUID, (TypeMask.Unit | TypeMask.GameObject | TypeMask.Item));
|
||||
if (!obj || (!obj.HasQuest(packet.QuestID) && !obj.HasInvolvedQuest(packet.QuestID)))
|
||||
if (obj == null || (!obj.HasQuest(packet.QuestID) && !obj.HasInvolvedQuest(packet.QuestID)))
|
||||
{
|
||||
GetPlayer().PlayerTalkClass.SendCloseGossip();
|
||||
return;
|
||||
@@ -342,7 +342,7 @@ namespace Game
|
||||
if (!quest.HasFlag(QuestFlags.AutoComplete))
|
||||
{
|
||||
obj = Global.ObjAccessor.GetObjectByTypeMask(GetPlayer(), packet.QuestGiverGUID, TypeMask.Unit | TypeMask.GameObject);
|
||||
if (!obj || !obj.HasInvolvedQuest(packet.QuestID))
|
||||
if (obj == null || !obj.HasInvolvedQuest(packet.QuestID))
|
||||
return;
|
||||
|
||||
// some kind of WPE protection
|
||||
@@ -499,7 +499,7 @@ namespace Game
|
||||
else
|
||||
obj = Global.ObjAccessor.GetObjectByTypeMask(GetPlayer(), packet.QuestGiverGUID, TypeMask.Unit | TypeMask.GameObject);
|
||||
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
return;
|
||||
|
||||
if (!quest.HasFlag(QuestFlags.AutoComplete))
|
||||
@@ -577,7 +577,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Group group = sender.GetGroup();
|
||||
if (!group)
|
||||
if (group == null)
|
||||
{
|
||||
sender.SendPushToPartyResponse(sender, QuestPushReason.NotInParty);
|
||||
return;
|
||||
@@ -587,7 +587,7 @@ namespace Game
|
||||
{
|
||||
Player receiver = refe.GetSource();
|
||||
|
||||
if (!receiver || receiver == sender)
|
||||
if (receiver == null || receiver == sender)
|
||||
continue;
|
||||
|
||||
if (!receiver.GetPlayerSharingQuest().IsEmpty())
|
||||
@@ -718,7 +718,7 @@ namespace Game
|
||||
if (_player.GetPlayerSharingQuest() == packet.SenderGUID)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(_player.GetPlayerSharingQuest());
|
||||
if (player)
|
||||
if (player != null)
|
||||
player.SendPushToPartyResponse(_player, packet.Result);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Player player = Global.ObjAccessor.FindPlayerByName(packet.CharName);
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
SendNotification(CypherStrings.PlayerNotExistOrOffline, packet.CharName);
|
||||
return;
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Item item = player.GetItemByPos(packet.Slot, packet.PackSlot);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
player.SendEquipError(InventoryResult.ItemNotFound);
|
||||
return;
|
||||
@@ -207,11 +207,11 @@ namespace Game
|
||||
|
||||
void HandleOpenWrappedItemCallback(ushort pos, ObjectGuid itemGuid, SQLResult result)
|
||||
{
|
||||
if (!GetPlayer())
|
||||
if (GetPlayer() == null)
|
||||
return;
|
||||
|
||||
Item item = GetPlayer().GetItemByPos(pos);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
if (item.GetGUID() != itemGuid || !item.IsWrapped()) // during getting result, gift was swapped with another item
|
||||
@@ -248,7 +248,7 @@ namespace Game
|
||||
void HandleGameObjectUse(GameObjUse packet)
|
||||
{
|
||||
GameObject obj = GetPlayer().GetGameObjectIfCanInteractWith(packet.Guid);
|
||||
if (obj)
|
||||
if (obj != null)
|
||||
{
|
||||
// ignore for remote control state
|
||||
if (GetPlayer().GetUnitBeingMoved() != GetPlayer())
|
||||
@@ -267,7 +267,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
GameObject go = GetPlayer().GetGameObjectIfCanInteractWith(packet.Guid);
|
||||
if (go)
|
||||
if (go != null)
|
||||
{
|
||||
if (go.GetAI().OnGossipHello(GetPlayer()))
|
||||
return;
|
||||
@@ -571,7 +571,7 @@ namespace Game
|
||||
|
||||
// Get unit for which data is needed by client
|
||||
Unit unit = Global.ObjAccessor.GetUnit(GetPlayer(), guid);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
return;
|
||||
|
||||
if (!unit.HasAuraType(AuraType.CloneCaster))
|
||||
@@ -579,11 +579,11 @@ namespace Game
|
||||
|
||||
// Get creator of the unit (SPELL_AURA_CLONE_CASTER does not stack)
|
||||
Unit creator = unit.GetAuraEffectsByType(AuraType.CloneCaster).FirstOrDefault().GetCaster();
|
||||
if (!creator)
|
||||
if (creator == null)
|
||||
return;
|
||||
|
||||
Player player = creator.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
MirrorImageComponentedData mirrorImageComponentedData = new();
|
||||
mirrorImageComponentedData.UnitGUID = guid;
|
||||
@@ -601,7 +601,7 @@ namespace Game
|
||||
}
|
||||
|
||||
Guild guild = player.GetGuild();
|
||||
mirrorImageComponentedData.GuildGUID = (guild ? guild.GetGUID() : ObjectGuid.Empty);
|
||||
mirrorImageComponentedData.GuildGUID = (guild != null ? guild.GetGUID() : ObjectGuid.Empty);
|
||||
|
||||
byte[] itemSlots =
|
||||
{
|
||||
@@ -671,7 +671,7 @@ namespace Game
|
||||
void HandleUpdateMissileTrajectory(UpdateMissileTrajectory packet)
|
||||
{
|
||||
Unit caster = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Guid);
|
||||
Spell spell = caster ? caster.GetCurrentSpell(CurrentSpellTypes.Generic) : null;
|
||||
Spell spell = caster != null ? caster.GetCurrentSpell(CurrentSpellTypes.Generic) : null;
|
||||
if (spell == null || spell.m_spellInfo.Id != packet.SpellID || spell.m_castId != packet.CastID || !spell.m_targets.HasDst() || !spell.m_targets.HasSrc())
|
||||
return;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Game
|
||||
void HandleEnableTaxiNodeOpcode(EnableTaxiNode enableTaxiNode)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(enableTaxiNode.Unit, NPCFlags.FlightMaster, NPCFlags2.None);
|
||||
if (unit)
|
||||
if (unit != null)
|
||||
SendLearnNewTaxiNode(unit);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Game
|
||||
// cheating checks
|
||||
Player player = GetPlayer();
|
||||
Creature unit = ObjectAccessor.GetCreature(player, guid);
|
||||
if (!unit || unit.IsHostileTo(player) || !unit.HasNpcFlag(NPCFlags.FlightMaster))
|
||||
if (unit == null || unit.IsHostileTo(player) || !unit.HasNpcFlag(NPCFlags.FlightMaster))
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WorldSession.SendTaxiStatus - {0} not found.", guid.ToString());
|
||||
return;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Item item = _player.GetItemByGuid(packet.Guid);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
_player.SendEquipError(InventoryResult.ItemNotFound);
|
||||
return;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Game
|
||||
{
|
||||
info.Clear(); // reuse packet
|
||||
Player trader = GetPlayer().GetTrader();
|
||||
info.PartnerIsSameBnetAccount = trader && trader.GetSession().GetBattlenetAccountId() == GetBattlenetAccountId();
|
||||
info.PartnerIsSameBnetAccount = trader != null && trader.GetSession().GetBattlenetAccountId() == GetBattlenetAccountId();
|
||||
SendPacket(info);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Game
|
||||
for (byte i = 0; i < (byte)TradeSlots.Count; ++i)
|
||||
{
|
||||
Item item = view_trade.GetItem((TradeSlots)i);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
TradeUpdated.TradeItem tradeItem = new();
|
||||
tradeItem.Slot = i;
|
||||
@@ -84,7 +84,7 @@ namespace Game
|
||||
void MoveItems(Item[] myItems, Item[] hisItems)
|
||||
{
|
||||
Player trader = GetPlayer().GetTrader();
|
||||
if (!trader)
|
||||
if (trader == null)
|
||||
return;
|
||||
|
||||
for (byte i = 0; i < (int)TradeSlots.TradedCount; ++i)
|
||||
@@ -98,7 +98,7 @@ namespace Game
|
||||
// Ok, if trade item exists and can be stored
|
||||
// If we trade in both directions we had to check, if the trade will work before we actually do it
|
||||
// A roll back is not possible after we stored it
|
||||
if (myItems[i])
|
||||
if (myItems[i] != null)
|
||||
{
|
||||
// logging
|
||||
Log.outDebug(LogFilter.Network, "partner storing: {0}", myItems[i].GetGUID().ToString());
|
||||
@@ -116,7 +116,7 @@ namespace Game
|
||||
// store
|
||||
trader.MoveItemToInventory(traderDst, myItems[i], true, true);
|
||||
}
|
||||
if (hisItems[i])
|
||||
if (hisItems[i] != null)
|
||||
{
|
||||
// logging
|
||||
Log.outDebug(LogFilter.Network, "player storing: {0}", hisItems[i].GetGUID().ToString());
|
||||
@@ -140,7 +140,7 @@ namespace Game
|
||||
{
|
||||
// in case of fatal error log error message
|
||||
// return the already removed items to the original owner
|
||||
if (myItems[i])
|
||||
if (myItems[i] != null)
|
||||
{
|
||||
if (!traderCanTrade)
|
||||
Log.outError(LogFilter.Network, "trader can't store item: {0}", myItems[i].GetGUID().ToString());
|
||||
@@ -150,7 +150,7 @@ namespace Game
|
||||
Log.outError(LogFilter.Network, "player can't take item back: {0}", myItems[i].GetGUID().ToString());
|
||||
}
|
||||
// return the already removed items to the original owner
|
||||
if (hisItems[i])
|
||||
if (hisItems[i] != null)
|
||||
{
|
||||
if (!playerCanTrade)
|
||||
Log.outError(LogFilter.Network, "player can't store item: {0}", hisItems[i].GetGUID().ToString());
|
||||
@@ -172,7 +172,7 @@ namespace Game
|
||||
for (byte i = 0; i < (int)TradeSlots.Count; ++i)
|
||||
{
|
||||
Item item = myTrade.GetItem((TradeSlots)i);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "player trade item {0} bag: {1} slot: {2}", item.GetGUID().ToString(), item.GetBagSlot(), item.GetSlot());
|
||||
//Can return null
|
||||
@@ -180,7 +180,7 @@ namespace Game
|
||||
myItems[i].SetInTrade();
|
||||
}
|
||||
item = hisTrade.GetItem((TradeSlots)i);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "partner trade item {0} bag: {1} slot: {2}", item.GetGUID().ToString(), item.GetBagSlot(), item.GetSlot());
|
||||
hisItems[i] = item;
|
||||
@@ -200,9 +200,9 @@ namespace Game
|
||||
// clear 'in-trade' flag
|
||||
for (byte i = 0; i < (int)TradeSlots.Count; ++i)
|
||||
{
|
||||
if (myItems[i])
|
||||
if (myItems[i] != null)
|
||||
myItems[i].SetInTrade(false);
|
||||
if (hisItems[i])
|
||||
if (hisItems[i] != null)
|
||||
hisItems[i].SetInTrade(false);
|
||||
}
|
||||
}
|
||||
@@ -285,7 +285,7 @@ namespace Game
|
||||
for (byte i = 0; i < (byte)TradeSlots.Count; ++i)
|
||||
{
|
||||
Item item = my_trade.GetItem((TradeSlots)i);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
if (!item.CanBeTraded(false, true))
|
||||
{
|
||||
@@ -303,7 +303,7 @@ namespace Game
|
||||
}
|
||||
}
|
||||
item = his_trade.GetItem((TradeSlots)i);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
if (!item.CanBeTraded(false, true))
|
||||
{
|
||||
@@ -331,8 +331,8 @@ namespace Game
|
||||
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(my_spell_id, _player.GetMap().GetDifficultyID());
|
||||
Item castItem = my_trade.GetSpellCastItem();
|
||||
|
||||
if (spellEntry == null || !his_trade.GetItem(TradeSlots.NonTraded) ||
|
||||
(my_trade.HasSpellCastItem() && !castItem))
|
||||
if (spellEntry == null || his_trade.GetItem(TradeSlots.NonTraded) == null ||
|
||||
(my_trade.HasSpellCastItem() && castItem == null))
|
||||
{
|
||||
ClearAcceptTradeMode(my_trade, his_trade);
|
||||
ClearAcceptTradeMode(myItems, hisItems);
|
||||
@@ -367,7 +367,7 @@ namespace Game
|
||||
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(his_spell_id, trader.GetMap().GetDifficultyID());
|
||||
Item castItem = his_trade.GetSpellCastItem();
|
||||
|
||||
if (spellEntry == null || !my_trade.GetItem(TradeSlots.NonTraded) || (his_trade.HasSpellCastItem() && !castItem))
|
||||
if (spellEntry == null || my_trade.GetItem(TradeSlots.NonTraded) == null || (his_trade.HasSpellCastItem() && castItem == null))
|
||||
{
|
||||
his_trade.SetSpell(0);
|
||||
|
||||
@@ -438,12 +438,12 @@ namespace Game
|
||||
// execute trade: 1. remove
|
||||
for (byte i = 0; i < (int)TradeSlots.TradedCount; ++i)
|
||||
{
|
||||
if (myItems[i])
|
||||
if (myItems[i] != null)
|
||||
{
|
||||
myItems[i].SetGiftCreator(GetPlayer().GetGUID());
|
||||
GetPlayer().MoveItemFromInventory(myItems[i].GetBagSlot(), myItems[i].GetSlot(), true);
|
||||
}
|
||||
if (hisItems[i])
|
||||
if (hisItems[i] != null)
|
||||
{
|
||||
hisItems[i].SetGiftCreator(trader.GetGUID());
|
||||
trader.MoveItemFromInventory(hisItems[i].GetBagSlot(), hisItems[i].GetSlot(), true);
|
||||
@@ -540,7 +540,7 @@ namespace Game
|
||||
void HandleCancelTrade(CancelTrade cancelTrade)
|
||||
{
|
||||
// sent also after LOGOUT COMPLETE
|
||||
if (GetPlayer()) // needed because STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT
|
||||
if (GetPlayer() != null) // needed because STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT
|
||||
GetPlayer().TradeCancel(true);
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ namespace Game
|
||||
|
||||
|
||||
Player pOther = Global.ObjAccessor.FindPlayer(initiateTrade.Guid);
|
||||
if (!pOther)
|
||||
if (pOther == null)
|
||||
{
|
||||
info.Status = TradeStatus.NoTarget;
|
||||
SendTradeStatus(info);
|
||||
@@ -702,7 +702,7 @@ namespace Game
|
||||
|
||||
// check cheating, can't fail with correct client operations
|
||||
Item item = GetPlayer().GetItemByPos(setTradeItem.PackSlot, setTradeItem.ItemSlotInPack);
|
||||
if (!item || (setTradeItem.TradeSlot != (byte)TradeSlots.NonTraded && !item.CanBeTraded(false, true)))
|
||||
if (item == null || (setTradeItem.TradeSlot != (byte)TradeSlots.NonTraded && !item.CanBeTraded(false, true)))
|
||||
{
|
||||
info.Status = TradeStatus.Cancelled;
|
||||
SendTradeStatus(info);
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player.GetBattleground() && _player.GetBattleground().GetStatus() == BattlegroundStatus.InProgress)
|
||||
if (_player.GetBattleground() != null && _player.GetBattleground().GetStatus() == BattlegroundStatus.InProgress)
|
||||
{
|
||||
SendPacket(new TraitConfigCommitFailed(configId, 0, (int)TalentLearnResult.InPvpMatch));
|
||||
return;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Game
|
||||
Player player = GetPlayer();
|
||||
|
||||
// Validate
|
||||
if (!player.GetNPCIfCanInteractWith(transmogrifyItems.Npc, NPCFlags.Transmogrifier, NPCFlags2.None))
|
||||
if (player.GetNPCIfCanInteractWith(transmogrifyItems.Npc, NPCFlags.Transmogrifier, NPCFlags2.None) == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - Unit (GUID: {0}) not found or player can't interact with it.", transmogrifyItems.ToString());
|
||||
return;
|
||||
@@ -94,7 +94,7 @@ namespace Game
|
||||
|
||||
// transmogrified item
|
||||
Item itemTransmogrified = player.GetItemByPos(InventorySlots.Bag0, (byte)transmogItem.Slot);
|
||||
if (!itemTransmogrified)
|
||||
if (itemTransmogrified == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - Player (GUID: {0}, name: {1}) tried to transmogrify an invalid item in a valid slot (slot: {2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.Slot);
|
||||
return;
|
||||
@@ -316,7 +316,7 @@ namespace Game
|
||||
foreach (ObjectGuid itemGuid in itemsProvidingAppearance)
|
||||
{
|
||||
Item item = player.GetItemByGuid(itemGuid);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
item.SetNotRefundable(player);
|
||||
item.ClearSoulboundTradeable(player);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Game
|
||||
void HandleRequestVehiclePrevSeat(RequestVehiclePrevSeat packet)
|
||||
{
|
||||
Unit vehicle_base = GetPlayer().GetVehicleBase();
|
||||
if (!vehicle_base)
|
||||
if (vehicle_base == null)
|
||||
return;
|
||||
|
||||
VehicleSeatRecord seat = GetPlayer().GetVehicle().GetSeatForPassenger(GetPlayer());
|
||||
@@ -46,7 +46,7 @@ namespace Game
|
||||
void HandleRequestVehicleNextSeat(RequestVehicleNextSeat packet)
|
||||
{
|
||||
Unit vehicle_base = GetPlayer().GetVehicleBase();
|
||||
if (!vehicle_base)
|
||||
if (vehicle_base == null)
|
||||
return;
|
||||
|
||||
VehicleSeatRecord seat = GetPlayer().GetVehicle().GetSeatForPassenger(GetPlayer());
|
||||
@@ -64,7 +64,7 @@ namespace Game
|
||||
void HandleMoveChangeVehicleSeats(MoveChangeVehicleSeats packet)
|
||||
{
|
||||
Unit vehicle_base = GetPlayer().GetVehicleBase();
|
||||
if (!vehicle_base)
|
||||
if (vehicle_base == null)
|
||||
return;
|
||||
|
||||
VehicleSeatRecord seat = GetPlayer().GetVehicle().GetSeatForPassenger(GetPlayer());
|
||||
@@ -87,12 +87,12 @@ namespace Game
|
||||
else
|
||||
{
|
||||
Unit vehUnit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.DstVehicle);
|
||||
if (vehUnit)
|
||||
if (vehUnit != null)
|
||||
{
|
||||
Vehicle vehicle = vehUnit.GetVehicleKit();
|
||||
if (vehicle)
|
||||
if (vehicle.HasEmptySeat((sbyte) packet.DstSeatIndex))
|
||||
vehUnit.HandleSpellClick(GetPlayer(), (sbyte) packet.DstSeatIndex);
|
||||
if (vehicle != null)
|
||||
if (vehicle.HasEmptySeat((sbyte)packet.DstSeatIndex))
|
||||
vehUnit.HandleSpellClick(GetPlayer(), (sbyte)packet.DstSeatIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ namespace Game
|
||||
void HandleRequestVehicleSwitchSeat(RequestVehicleSwitchSeat packet)
|
||||
{
|
||||
Unit vehicle_base = GetPlayer().GetVehicleBase();
|
||||
if (!vehicle_base)
|
||||
if (vehicle_base == null)
|
||||
return;
|
||||
|
||||
VehicleSeatRecord seat = GetPlayer().GetVehicle().GetSeatForPassenger(GetPlayer());
|
||||
@@ -117,12 +117,12 @@ namespace Game
|
||||
else
|
||||
{
|
||||
Unit vehUnit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Vehicle);
|
||||
if (vehUnit)
|
||||
if (vehUnit != null)
|
||||
{
|
||||
Vehicle vehicle = vehUnit.GetVehicleKit();
|
||||
if (vehicle)
|
||||
if (vehicle.HasEmptySeat((sbyte) packet.SeatIndex))
|
||||
vehUnit.HandleSpellClick(GetPlayer(), (sbyte) packet.SeatIndex);
|
||||
if (vehicle != null)
|
||||
if (vehicle.HasEmptySeat((sbyte)packet.SeatIndex))
|
||||
vehUnit.HandleSpellClick(GetPlayer(), (sbyte)packet.SeatIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,16 +131,16 @@ namespace Game
|
||||
void HandleRideVehicleInteract(RideVehicleInteract packet)
|
||||
{
|
||||
Player player = Global.ObjAccessor.GetPlayer(_player, packet.Vehicle);
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
if (!player.GetVehicleKit())
|
||||
if (player.GetVehicleKit() == null)
|
||||
return;
|
||||
if (!player.IsInRaidWith(GetPlayer()))
|
||||
return;
|
||||
if (!player.IsWithinDistInMap(GetPlayer(), SharedConst.InteractionDistance))
|
||||
return;
|
||||
// Dont' allow players to enter player vehicle on arena
|
||||
if (!_player.GetMap() || _player.GetMap().IsBattleArena())
|
||||
if (_player.GetMap() == null || _player.GetMap().IsBattleArena())
|
||||
return;
|
||||
|
||||
GetPlayer().EnterVehicle(player);
|
||||
@@ -151,7 +151,7 @@ namespace Game
|
||||
void HandleEjectPassenger(EjectPassenger packet)
|
||||
{
|
||||
Vehicle vehicle = GetPlayer().GetVehicleKit();
|
||||
if (!vehicle)
|
||||
if (vehicle == null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, "HandleEjectPassenger: {0} is not in a vehicle!", GetPlayer().GetGUID().ToString());
|
||||
return;
|
||||
@@ -160,7 +160,7 @@ namespace Game
|
||||
if (packet.Passenger.IsUnit())
|
||||
{
|
||||
Unit unit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Passenger);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outError(LogFilter.Network, "{0} tried to eject {1} from vehicle, but the latter was not found in world!", GetPlayer().GetGUID().ToString(), packet.Passenger.ToString());
|
||||
return;
|
||||
@@ -188,7 +188,7 @@ namespace Game
|
||||
void HandleRequestVehicleExit(RequestVehicleExit packet)
|
||||
{
|
||||
Vehicle vehicle = GetPlayer().GetVehicle();
|
||||
if (vehicle)
|
||||
if (vehicle != null)
|
||||
{
|
||||
VehicleSeatRecord seat = vehicle.GetSeatForPassenger(GetPlayer());
|
||||
if (seat != null)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Game
|
||||
void HandleVoidStorageUnlock(UnlockVoidStorage unlockVoidStorage)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(unlockVoidStorage.Npc, NPCFlags.VaultKeeper, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleVoidStorageUnlock - {0} not found or player can't interact with it.", unlockVoidStorage.Npc.ToString());
|
||||
return;
|
||||
@@ -42,7 +42,7 @@ namespace Game
|
||||
Player player = GetPlayer();
|
||||
|
||||
Creature unit = player.GetNPCIfCanInteractWith(queryVoidStorage.Npc, NPCFlags.Transmogrifier | NPCFlags.VaultKeeper, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleVoidStorageQuery - {0} not found or player can't interact with it.", queryVoidStorage.Npc.ToString());
|
||||
SendPacket(new VoidStorageFailed());
|
||||
@@ -81,7 +81,7 @@ namespace Game
|
||||
Player player = GetPlayer();
|
||||
|
||||
Creature unit = player.GetNPCIfCanInteractWith(voidStorageTransfer.Npc, NPCFlags.VaultKeeper, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleVoidStorageTransfer - {0} not found or player can't interact with it.", voidStorageTransfer.Npc.ToString());
|
||||
return;
|
||||
@@ -106,13 +106,13 @@ namespace Game
|
||||
for (byte i = InventorySlots.BagStart; i < InventorySlots.BagEnd; i++)
|
||||
{
|
||||
Bag bag = player.GetBagByPos(i);
|
||||
if (bag)
|
||||
if (bag != null)
|
||||
freeBagSlots += bag.GetFreeSlots();
|
||||
}
|
||||
int inventoryEnd = InventorySlots.ItemStart + _player.GetInventorySlotCount();
|
||||
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; i++)
|
||||
{
|
||||
if (!player.GetItemByPos(InventorySlots.Bag0, i))
|
||||
if (player.GetItemByPos(InventorySlots.Bag0, i) == null)
|
||||
++freeBagSlots;
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ namespace Game
|
||||
for (int i = 0; i < voidStorageTransfer.Deposits.Length; ++i)
|
||||
{
|
||||
Item item = player.GetItemByGuid(voidStorageTransfer.Deposits[i]);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleVoidStorageTransfer - {0} {1} wants to deposit an invalid item ({2}).", player.GetGUID().ToString(), player.GetName(), voidStorageTransfer.Deposits[i].ToString());
|
||||
continue;
|
||||
@@ -200,7 +200,7 @@ namespace Game
|
||||
Player player = GetPlayer();
|
||||
|
||||
Creature unit = player.GetNPCIfCanInteractWith(swapVoidItem.Npc, NPCFlags.VaultKeeper, NPCFlags2.None);
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleVoidSwapItem - {0} not found or player can't interact with it.", swapVoidItem.Npc.ToString());
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user