Some cleanups. (might break build for scripts as they are a WIP)
This commit is contained in:
@@ -151,7 +151,7 @@ namespace Game.Chat
|
||||
|
||||
if (HasFlag(ChannelFlags.Lfg) && WorldConfig.GetBoolValue(WorldCfg.RestrictedLfgChannel) &&
|
||||
Global.AccountMgr.IsPlayerAccount(player.GetSession().GetSecurity()) && //FIXME: Move to RBAC
|
||||
player.GetGroup())
|
||||
player.GetGroup() != null)
|
||||
{
|
||||
var builder = new ChannelNameBuilder(this, new NotInLFGAppend());
|
||||
SendToOne(builder, guid);
|
||||
@@ -285,9 +285,9 @@ namespace Game.Chat
|
||||
return;
|
||||
}
|
||||
|
||||
Player bad = Global.ObjAccessor.FindPlayerByName(badname);
|
||||
ObjectGuid victim = bad ? bad.GetGUID() : ObjectGuid.Empty;
|
||||
if (bad == null || victim.IsEmpty() || !IsOn(victim))
|
||||
Player badPlayer = Global.ObjAccessor.FindPlayerByName(badname);
|
||||
ObjectGuid victim = badPlayer != null ? badPlayer.GetGUID() : ObjectGuid.Empty;
|
||||
if (badPlayer == null || victim.IsEmpty() || !IsOn(victim))
|
||||
{
|
||||
ChannelNameBuilder builder = new(this, new PlayerNotFoundAppend(badname));
|
||||
SendToOne(builder, good);
|
||||
@@ -322,7 +322,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
_playersStore.Remove(victim);
|
||||
bad.LeftChannel(this);
|
||||
badPlayer.LeftChannel(this);
|
||||
|
||||
if (changeowner && _ownershipEnabled && !_playersStore.Empty())
|
||||
{
|
||||
@@ -350,8 +350,8 @@ namespace Game.Chat
|
||||
return;
|
||||
}
|
||||
|
||||
Player bad = Global.ObjAccessor.FindPlayerByName(badname);
|
||||
ObjectGuid victim = bad ? bad.GetGUID() : ObjectGuid.Empty;
|
||||
Player badPlayer = Global.ObjAccessor.FindPlayerByName(badname);
|
||||
ObjectGuid victim = badPlayer != null ? badPlayer.GetGUID() : ObjectGuid.Empty;
|
||||
|
||||
if (victim.IsEmpty() || !IsBanned(victim))
|
||||
{
|
||||
@@ -417,13 +417,13 @@ namespace Game.Chat
|
||||
if (guid == _ownerGuid && p2n == player.GetName() && mod)
|
||||
return;
|
||||
|
||||
Player newp = Global.ObjAccessor.FindPlayerByName(p2n);
|
||||
ObjectGuid victim = newp ? newp.GetGUID() : ObjectGuid.Empty;
|
||||
Player newPlayer = Global.ObjAccessor.FindPlayerByName(p2n);
|
||||
ObjectGuid victim = newPlayer != null ? newPlayer.GetGUID() : ObjectGuid.Empty;
|
||||
|
||||
if (newp == null || victim.IsEmpty() || !IsOn(victim) ||
|
||||
(player.GetTeam() != newp.GetTeam() &&
|
||||
if (newPlayer == null || victim.IsEmpty() || !IsOn(victim) ||
|
||||
(player.GetTeam() != newPlayer.GetTeam() &&
|
||||
(!player.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel) ||
|
||||
!newp.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel))))
|
||||
!newPlayer.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel))))
|
||||
{
|
||||
ChannelNameBuilder builder = new(this, new PlayerNotFoundAppend(p2n));
|
||||
SendToOne(builder, guid);
|
||||
@@ -438,9 +438,9 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
if (mod)
|
||||
SetModerator(newp.GetGUID(), set);
|
||||
SetModerator(newPlayer.GetGUID(), set);
|
||||
else
|
||||
SetMute(newp.GetGUID(), set);
|
||||
SetMute(newPlayer.GetGUID(), set);
|
||||
}
|
||||
|
||||
public void SetInvisible(Player player, bool on)
|
||||
@@ -473,13 +473,13 @@ namespace Game.Chat
|
||||
return;
|
||||
}
|
||||
|
||||
Player newp = Global.ObjAccessor.FindPlayerByName(newname);
|
||||
ObjectGuid victim = newp ? newp.GetGUID() : ObjectGuid.Empty;
|
||||
Player newPlayer = Global.ObjAccessor.FindPlayerByName(newname);
|
||||
ObjectGuid victim = newPlayer != null ? newPlayer.GetGUID() : ObjectGuid.Empty;
|
||||
|
||||
if (newp == null || victim.IsEmpty() || !IsOn(victim) ||
|
||||
(player.GetTeam() != newp.GetTeam() &&
|
||||
if (newPlayer == null || victim.IsEmpty() || !IsOn(victim) ||
|
||||
(player.GetTeam() != newPlayer.GetTeam() &&
|
||||
(!player.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel) ||
|
||||
!newp.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel))))
|
||||
!newPlayer.GetSession().HasPermission(RBACPermissions.TwoSideInteractionChannel))))
|
||||
{
|
||||
ChannelNameBuilder builder = new(this, new PlayerNotFoundAppend(newname));
|
||||
SendToOne(builder, guid);
|
||||
@@ -532,7 +532,7 @@ namespace Game.Chat
|
||||
|
||||
// PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
||||
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
|
||||
if (member && (player.GetSession().HasPermission(RBACPermissions.WhoSeeAllSecLevels) ||
|
||||
if (member != null && (player.GetSession().HasPermission(RBACPermissions.WhoSeeAllSecLevels) ||
|
||||
member.GetSession().GetSecurity() <= (AccountTypes)gmLevelInWhoList) &&
|
||||
member.IsVisibleGloballyFor(player))
|
||||
{
|
||||
@@ -603,7 +603,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(guid);
|
||||
SendToAll(new ChannelSayBuilder(this, lang, what, guid, _channelGuid), !playerInfo.IsModerator() ? guid : ObjectGuid.Empty, !playerInfo.IsModerator() && player ? player.GetSession().GetAccountGUID() : ObjectGuid.Empty);
|
||||
SendToAll(new ChannelSayBuilder(this, lang, what, guid, _channelGuid), !playerInfo.IsModerator() ? guid : ObjectGuid.Empty, !playerInfo.IsModerator() && player != null ? player.GetSession().GetAccountGUID() : ObjectGuid.Empty);
|
||||
}
|
||||
|
||||
public void AddonSay(ObjectGuid guid, string prefix, string what, bool isLogged)
|
||||
@@ -630,7 +630,7 @@ namespace Game.Chat
|
||||
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(guid);
|
||||
SendToAllWithAddon(new ChannelWhisperBuilder(this, isLogged ? Language.AddonLogged : Language.Addon, what, prefix, guid), prefix, !playerInfo.IsModerator() ? guid : ObjectGuid.Empty,
|
||||
!playerInfo.IsModerator() && player ? player.GetSession().GetAccountGUID() : ObjectGuid.Empty);
|
||||
!playerInfo.IsModerator() && player != null ? player.GetSession().GetAccountGUID() : ObjectGuid.Empty);
|
||||
}
|
||||
|
||||
public void Invite(Player player, string newname)
|
||||
@@ -645,7 +645,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Player newp = Global.ObjAccessor.FindPlayerByName(newname);
|
||||
if (!newp || !newp.IsGMVisible())
|
||||
if (newp == null || !newp.IsGMVisible())
|
||||
{
|
||||
ChannelNameBuilder builder = new(this, new PlayerNotFoundAppend(newname));
|
||||
SendToOne(builder, guid);
|
||||
@@ -786,7 +786,7 @@ namespace Game.Chat
|
||||
foreach (var pair in _playersStore)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(pair.Key);
|
||||
if (player)
|
||||
if (player != null)
|
||||
if (guid.IsEmpty() || !player.GetSocial().HasIgnore(guid, accountGuid))
|
||||
localizer.Invoke(player);
|
||||
}
|
||||
@@ -801,7 +801,7 @@ namespace Game.Chat
|
||||
if (pair.Key != who)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(pair.Key);
|
||||
if (player)
|
||||
if (player != null)
|
||||
localizer.Invoke(player);
|
||||
}
|
||||
}
|
||||
@@ -812,7 +812,7 @@ namespace Game.Chat
|
||||
LocalizedDo localizer = new(builder);
|
||||
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(who);
|
||||
if (player)
|
||||
if (player != null)
|
||||
localizer.Invoke(player);
|
||||
}
|
||||
|
||||
@@ -823,7 +823,7 @@ namespace Game.Chat
|
||||
foreach (var pair in _playersStore)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(pair.Key);
|
||||
if (player)
|
||||
if (player != null)
|
||||
if (player.GetSession().IsAddonRegistered(addonPrefix) && (guid.IsEmpty() || !player.GetSocial().HasIgnore(guid, accountGuid)))
|
||||
localizer.Invoke(player);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Game.Chat
|
||||
|
||||
PacketSenderOwning<ChatPkt> packet = new();
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(_guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
packet.Data.Initialize(ChatMsg.Channel, _lang, player, player, _what, 0, _source.GetName(localeIdx));
|
||||
else
|
||||
{
|
||||
@@ -143,7 +143,7 @@ namespace Game.Chat
|
||||
|
||||
PacketSenderOwning<ChatPkt> packet = new();
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(_guid);
|
||||
if (player)
|
||||
if (player != null)
|
||||
packet.Data.Initialize(ChatMsg.Channel, _lang, player, player, _what, 0, _source.GetName(localeIdx), Locale.enUS, _prefix);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace Game.Chat
|
||||
return 0;
|
||||
|
||||
Player player = Global.ObjAccessor.FindPlayerByName(idS);
|
||||
if (player)
|
||||
if (player != null)
|
||||
return player.GetGUID().GetCounter();
|
||||
|
||||
ObjectGuid guid = Global.CharacterCacheStorage.GetCharacterGuidByName(idS);
|
||||
@@ -320,7 +320,7 @@ namespace Game.Chat
|
||||
return null;
|
||||
|
||||
Unit selected = _session.GetPlayer().GetSelectedUnit();
|
||||
if (selected)
|
||||
if (selected != null)
|
||||
return selected;
|
||||
|
||||
return _session.GetPlayer();
|
||||
@@ -356,7 +356,7 @@ namespace Game.Chat
|
||||
// first try with selected target
|
||||
Player targetPlayer = Global.ObjAccessor.FindConnectedPlayer(selected);
|
||||
// if the target is not a player, then return self
|
||||
if (!targetPlayer)
|
||||
if (targetPlayer == null)
|
||||
targetPlayer = _session.GetPlayer();
|
||||
|
||||
return targetPlayer;
|
||||
@@ -376,7 +376,7 @@ namespace Game.Chat
|
||||
|
||||
public Creature GetCreatureFromPlayerMapByDbGuid(ulong lowguid)
|
||||
{
|
||||
if (!_session)
|
||||
if (_session == null)
|
||||
return null;
|
||||
|
||||
// Select the first alive creature or a dead one if not found
|
||||
@@ -586,7 +586,7 @@ namespace Game.Chat
|
||||
guid = Global.CharacterCacheStorage.GetCharacterGuidByName(name);
|
||||
}
|
||||
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
group = player.GetGroup();
|
||||
if (guid.IsEmpty() || !offline)
|
||||
@@ -594,7 +594,7 @@ namespace Game.Chat
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetSelectedPlayer())
|
||||
if (GetSelectedPlayer() != null)
|
||||
player = GetSelectedPlayer();
|
||||
else
|
||||
player = _session.GetPlayer();
|
||||
|
||||
@@ -337,8 +337,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Log.outCommand(session.GetAccountId(), $"Command: {cmdStr} [Player: {player.GetName()} ({player.GetGUID()}) (Account: {session.GetAccountId()}) " +
|
||||
$"X: {player.GetPositionX()} Y: {player.GetPositionY()} Z: {player.GetPositionZ()} Map: {player.GetMapId()} ({(player.GetMap() ? player.GetMap().GetMapName() : "Unknown")}) " +
|
||||
$"Area: {areaId} ({areaName}) Zone: {zoneName} Selected: {(player.GetSelectedUnit() ? player.GetSelectedUnit().GetName() : "")} ({targetGuid})]");
|
||||
$"X: {player.GetPositionX()} Y: {player.GetPositionY()} Z: {player.GetPositionZ()} Map: {player.GetMapId()} ({(player.GetMap() != null ? player.GetMap().GetMapName() : "Unknown")}) " +
|
||||
$"Area: {areaId} ({areaName}) Zone: {zoneName} Selected: {(player.GetSelectedUnit() != null ? player.GetSelectedUnit().GetName() : "")} ({targetGuid})]");
|
||||
}
|
||||
|
||||
public void SendCommandHelp(CommandHandler handler)
|
||||
|
||||
@@ -623,7 +623,7 @@ namespace Game.Chat
|
||||
else
|
||||
{
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
accountId = player.GetSession().GetAccountId();
|
||||
@@ -708,7 +708,7 @@ namespace Game.Chat
|
||||
else
|
||||
{
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
accountId = player.GetSession().GetAccountId();
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleAchievementAddCommand(CommandHandler handler, AchievementRecord achievementEntry)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Game.Chat.Commands
|
||||
break;
|
||||
}
|
||||
|
||||
string author = handler.GetSession() ? handler.GetSession().GetPlayerName() : "Server";
|
||||
string author = handler.GetSession() != null ? handler.GetSession().GetPlayerName() : "Server";
|
||||
switch (Global.WorldMgr.BanAccount(mode, nameOrIP, duration, reason, author))
|
||||
{
|
||||
case BanReturn.Success:
|
||||
@@ -180,7 +180,7 @@ namespace Game.Chat.Commands
|
||||
Player target = Global.ObjAccessor.FindPlayerByName(name);
|
||||
ObjectGuid targetGuid;
|
||||
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
targetGuid = Global.CharacterCacheStorage.GetCharacterGuidByName(name);
|
||||
if (targetGuid.IsEmpty())
|
||||
@@ -314,7 +314,7 @@ namespace Game.Chat.Commands
|
||||
handler.SendSysMessage(CypherStrings.BanlistMatchingcharacter);
|
||||
|
||||
// Chat short output
|
||||
if (handler.GetSession())
|
||||
if (handler.GetSession() != null)
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -405,7 +405,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
handler.SendSysMessage(CypherStrings.BanlistMatchingip);
|
||||
// Chat short output
|
||||
if (handler.GetSession())
|
||||
if (handler.GetSession() != null)
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -458,7 +458,7 @@ namespace Game.Chat.Commands
|
||||
handler.SendSysMessage(CypherStrings.BanlistMatchingaccount);
|
||||
|
||||
// Chat short output
|
||||
if (handler.GetSession())
|
||||
if (handler.GetSession() != null)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Game.Chat
|
||||
static bool HandleCastCommand(CommandHandler handler, uint spellId, [OptionalArg] string triggeredStr)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
@@ -37,7 +37,7 @@ namespace Game.Chat
|
||||
static bool HandleCastBackCommand(CommandHandler handler, uint spellId, [OptionalArg] string triggeredStr)
|
||||
{
|
||||
Creature caster = handler.GetSelectedCreature();
|
||||
if (!caster)
|
||||
if (caster == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
@@ -77,7 +77,7 @@ namespace Game.Chat
|
||||
static bool HandleCastSelfCommand(CommandHandler handler, uint spellId, [OptionalArg] string triggeredStr)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
@@ -99,13 +99,13 @@ namespace Game.Chat
|
||||
static bool HandleCastTargetCommad(CommandHandler handler, uint spellId, [OptionalArg] string triggeredStr)
|
||||
{
|
||||
Creature caster = handler.GetSelectedCreature();
|
||||
if (!caster)
|
||||
if (caster == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!caster.GetVictim())
|
||||
if (caster.GetVictim() == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectedTargetNotHaveVictim);
|
||||
return false;
|
||||
@@ -127,7 +127,7 @@ namespace Game.Chat
|
||||
static bool HandleCastDestCommand(CommandHandler handler, uint spellId, float x, float y, float z, [OptionalArg] string triggeredStr)
|
||||
{
|
||||
Unit caster = handler.GetSelectedUnit();
|
||||
if (!caster)
|
||||
if (caster == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Game.Chat
|
||||
if (session != null)
|
||||
{
|
||||
Player sessionPlayer = session.GetPlayer();
|
||||
if (sessionPlayer)
|
||||
if (sessionPlayer != null)
|
||||
Log.outCommand(session.GetAccountId(), "GM {0} (Account: {1}) forced rename {2} to player {3} (Account: {4})", sessionPlayer.GetName(), session.GetAccountId(), newName, sessionPlayer.GetName(), Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(sessionPlayer.GetGUID()));
|
||||
}
|
||||
else
|
||||
@@ -212,7 +212,7 @@ namespace Game.Chat
|
||||
DB.Characters.Execute(stmt);
|
||||
}
|
||||
|
||||
if (!handler.GetSession() || (handler.GetSession().GetPlayer() != player.GetConnectedPlayer())) // including chr == NULL
|
||||
if (handler.GetSession() == null || (handler.GetSession().GetPlayer() != player.GetConnectedPlayer())) // including chr == NULL
|
||||
handler.SendSysMessage(CypherStrings.YouChangeLvl, handler.PlayerLink(player.GetName()), newlevel);
|
||||
|
||||
return true;
|
||||
@@ -602,7 +602,7 @@ namespace Game.Chat
|
||||
{
|
||||
string dateStr = Time.UnixTimeToDateTime(info.deleteDate).ToShortDateString();
|
||||
|
||||
if (!handler.GetSession())
|
||||
if (handler.GetSession() == null)
|
||||
handler.SendSysMessage(CypherStrings.CharacterDeletedListLineConsole,
|
||||
info.guid.ToString(), info.name, info.accountName.IsEmpty() ? "<Not existed>" : info.accountName,
|
||||
info.accountId, dateStr);
|
||||
@@ -612,7 +612,7 @@ namespace Game.Chat
|
||||
info.accountId, dateStr);
|
||||
}
|
||||
|
||||
if (!handler.GetSession())
|
||||
if (handler.GetSession() == null)
|
||||
handler.SendSysMessage(CypherStrings.CharacterDeletedListBar);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleExploreCheatCommand(CommandHandler handler, bool reveal)
|
||||
{
|
||||
Player chr = handler.GetSelectedPlayer();
|
||||
if (!chr)
|
||||
if (chr == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -155,7 +155,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleTaxiCheatCommand(CommandHandler handler, bool? enableArg)
|
||||
{
|
||||
Player chr = handler.GetSelectedPlayer();
|
||||
if (!chr)
|
||||
if (chr == null)
|
||||
chr = handler.GetSession().GetPlayer();
|
||||
else if (handler.HasLowerSecurity(chr, ObjectGuid.Empty)) // check online security
|
||||
return false;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugAnimCommand(CommandHandler handler, Emote emote)
|
||||
{
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (unit)
|
||||
if (unit != null)
|
||||
unit.HandleEmoteCommand(emote);
|
||||
|
||||
handler.SendSysMessage($"Playing emote {emote}");
|
||||
@@ -68,11 +68,11 @@ namespace Game.Chat
|
||||
static bool HandleDebugBoundaryCommand(CommandHandler handler, string fill, uint durationArg)
|
||||
{
|
||||
Player player = handler.GetPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target || !target.IsAIEnabled())
|
||||
if (target == null || !target.IsAIEnabled())
|
||||
return false;
|
||||
|
||||
TimeSpan duration = durationArg != 0 ? TimeSpan.FromSeconds(durationArg) : TimeSpan.Zero;
|
||||
@@ -90,7 +90,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugCombatListCommand(CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
target = handler.GetPlayer();
|
||||
|
||||
handler.SendSysMessage($"Combat refs: (Combat state: {target.IsInCombat()} | Manager state: {target.GetCombatManager().HasCombat()})");
|
||||
@@ -112,7 +112,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugConversationCommand(CommandHandler handler, uint conversationEntry)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -132,7 +132,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugEnterVehicleCommand(CommandHandler handler, uint entry, sbyte seatId = -1)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target || !target.IsVehicle())
|
||||
if (target == null || !target.IsVehicle())
|
||||
return false;
|
||||
|
||||
if (entry == 0)
|
||||
@@ -143,7 +143,7 @@ namespace Game.Chat
|
||||
var searcher = new CreatureSearcher(handler.GetPlayer(), check);
|
||||
Cell.VisitAllObjects(handler.GetPlayer(), searcher, 30.0f);
|
||||
var passenger = searcher.GetTarget();
|
||||
if (!passenger || passenger == target)
|
||||
if (passenger == null || passenger == target)
|
||||
return false;
|
||||
passenger.EnterVehicle(target, seatId);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
player = handler.GetPlayer();
|
||||
|
||||
if (!listQueue && !checkAll)
|
||||
@@ -188,15 +188,15 @@ namespace Game.Chat
|
||||
continue;
|
||||
|
||||
Item item = player.GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (item)
|
||||
if (item != null)
|
||||
{
|
||||
Bag bag = item.ToBag();
|
||||
if (bag)
|
||||
if (bag != null)
|
||||
{
|
||||
for (byte j = 0; j < bag.GetBagSize(); ++j)
|
||||
{
|
||||
Item item2 = bag.GetItemByPos(j);
|
||||
if (item2)
|
||||
if (item2 != null)
|
||||
if (item2.GetState() == state)
|
||||
handler.SendSysMessage("bag: 255 slot: {0} guid: {1} owner: {2}", item2.GetSlot(), item2.GetGUID().ToString(), item2.GetOwnerGUID().ToString());
|
||||
}
|
||||
@@ -213,11 +213,11 @@ namespace Game.Chat
|
||||
for (int i = 0; i < updateQueue.Count; ++i)
|
||||
{
|
||||
Item item = updateQueue[i];
|
||||
if (!item)
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
Bag container = item.GetContainer();
|
||||
byte bagSlot = container ? container.GetSlot() : InventorySlots.Bag0;
|
||||
byte bagSlot = container != null ? container.GetSlot() : InventorySlots.Bag0;
|
||||
|
||||
string st = "";
|
||||
switch (item.GetState())
|
||||
@@ -252,7 +252,7 @@ namespace Game.Chat
|
||||
continue;
|
||||
|
||||
Item item = player.GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (!item)
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
if (item.GetSlot() != i)
|
||||
@@ -270,7 +270,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Bag container = item.GetContainer();
|
||||
if (container)
|
||||
if (container != null)
|
||||
{
|
||||
handler.SendSysMessage("The item with slot {0} and guid {1} has a container (slot: {2}, guid: {3}) but shouldn't!", item.GetSlot(), item.GetGUID().ToString(), container.GetSlot(), container.GetGUID().ToString());
|
||||
error = true;
|
||||
@@ -309,12 +309,12 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Bag bag = item.ToBag();
|
||||
if (bag)
|
||||
if (bag != null)
|
||||
{
|
||||
for (byte j = 0; j < bag.GetBagSize(); ++j)
|
||||
{
|
||||
Item item2 = bag.GetItemByPos(j);
|
||||
if (!item2)
|
||||
if (item2 == null)
|
||||
continue;
|
||||
|
||||
if (item2.GetSlot() != j)
|
||||
@@ -332,7 +332,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Bag container1 = item2.GetContainer();
|
||||
if (!container1)
|
||||
if (container1 == null)
|
||||
{
|
||||
handler.SendSysMessage("The item in bag {0} at slot {1} with guid {2} has no container!", bag.GetSlot(), item2.GetSlot(), item2.GetGUID().ToString());
|
||||
error = true;
|
||||
@@ -383,7 +383,7 @@ namespace Game.Chat
|
||||
for (int i = 0; i < updateQueue.Count; ++i)
|
||||
{
|
||||
Item item = updateQueue[i];
|
||||
if (!item)
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
if (item.GetOwnerGUID() != player.GetGUID())
|
||||
@@ -550,7 +550,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugItemExpireCommand(CommandHandler handler, ulong guid)
|
||||
{
|
||||
Item item = handler.GetPlayer().GetItemByGuid(ObjectGuid.Create(HighGuid.Item, guid));
|
||||
if (!item)
|
||||
if (item == null)
|
||||
return false;
|
||||
|
||||
handler.GetPlayer().DestroyItem(item.GetBagSlot(), item.GetSlot(), true);
|
||||
@@ -580,7 +580,7 @@ namespace Game.Chat
|
||||
|
||||
static bool HandleDebugLoadCellsCommandHelper(CommandHandler handler, Map map, uint? tileX, uint? tileY)
|
||||
{
|
||||
if (!map)
|
||||
if (map == null)
|
||||
return false;
|
||||
|
||||
// Load 1 single tile if specified, otherwise load the whole map
|
||||
@@ -610,7 +610,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugGetLootRecipientCommand(CommandHandler handler)
|
||||
{
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
return false;
|
||||
|
||||
handler.SendSysMessage($"Loot recipients for creature {target.GetName()} ({target.GetGUID()}, SpawnID {target.GetSpawnId()}) are:");
|
||||
@@ -627,7 +627,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugLoSCommand(CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (unit)
|
||||
if (unit != null)
|
||||
{
|
||||
Player player = handler.GetPlayer();
|
||||
handler.SendSysMessage($"Checking LoS {player.GetName()} . {unit.GetName()}:");
|
||||
@@ -643,7 +643,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugMoveflagsCommand(CommandHandler handler, uint? moveFlags, uint? moveFlagsExtra)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
target = handler.GetPlayer();
|
||||
|
||||
if (!moveFlags.HasValue)
|
||||
@@ -684,7 +684,7 @@ namespace Game.Chat
|
||||
if (linked == "linked")
|
||||
{
|
||||
Battleground bg = player.GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
nearestLoc = bg.GetClosestGraveyard(player);
|
||||
else
|
||||
{
|
||||
@@ -763,7 +763,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugPhaseCommand(CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -782,7 +782,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugPlayerConditionCommand(CommandHandler handler, uint playerConditionId)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -900,7 +900,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugSetAuraStateCommand(CommandHandler handler, AuraStateType? state, bool apply)
|
||||
{
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
@@ -925,7 +925,7 @@ namespace Game.Chat
|
||||
handler.GetPlayer().GetClosePoint(out x, out y, out z, handler.GetPlayer().GetCombatReach());
|
||||
|
||||
if (id == 0)
|
||||
return handler.GetPlayer().SummonCreature(entry, x, y, z, o);
|
||||
return handler.GetPlayer().SummonCreature(entry, x, y, z, o) != null;
|
||||
|
||||
CreatureTemplate creatureTemplate = Global.ObjectMgr.GetCreatureTemplate(entry);
|
||||
if (creatureTemplate == null)
|
||||
@@ -939,7 +939,7 @@ namespace Game.Chat
|
||||
Position pos = new(x, y, z, o);
|
||||
|
||||
Creature creature = Creature.CreateCreature(entry, map, pos, id);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
return false;
|
||||
|
||||
map.AddToMap(creature);
|
||||
@@ -1086,7 +1086,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugTransportCommand(CommandHandler handler, string operation)
|
||||
{
|
||||
Transport transport = handler.GetPlayer().GetTransport<Transport>();
|
||||
if (!transport)
|
||||
if (transport == null)
|
||||
return false;
|
||||
|
||||
bool start = false;
|
||||
@@ -1267,7 +1267,7 @@ namespace Game.Chat
|
||||
Player player = handler.GetPlayer();
|
||||
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleDeserterAdd(CommandHandler handler, uint time, bool isInstance)
|
||||
{
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -72,7 +72,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleDeserterRemove(CommandHandler handler, bool isInstance)
|
||||
{
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Game.Chat
|
||||
static bool HandleGameObjectActivateCommand(CommandHandler handler, ulong guidLow)
|
||||
{
|
||||
GameObject obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandObjnotfound, guidLow);
|
||||
return false;
|
||||
@@ -48,7 +48,7 @@ namespace Game.Chat
|
||||
if (!ownerGuid.IsEmpty())
|
||||
{
|
||||
Unit owner = Global.ObjAccessor.GetUnit(player, ownerGuid);
|
||||
if (!owner || !ownerGuid.IsPlayer())
|
||||
if (owner == null || !ownerGuid.IsPlayer())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandDelobjrefercreature, ownerGuid.ToString(), obj.GetGUID().ToString());
|
||||
return false;
|
||||
@@ -189,7 +189,7 @@ namespace Game.Chat
|
||||
static bool HandleGameObjectMoveCommand(CommandHandler handler, ulong guidLow, float[] xyz)
|
||||
{
|
||||
GameObject obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandObjnotfound, guidLow);
|
||||
return false;
|
||||
@@ -227,7 +227,7 @@ namespace Game.Chat
|
||||
obj.Delete();
|
||||
|
||||
obj = GameObject.CreateGameObjectFromDB(guidLow, map);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
return false;
|
||||
|
||||
handler.SendSysMessage(CypherStrings.CommandMoveobjmessage, obj.GetSpawnId(), obj.GetGoInfo().name, obj.GetGUID().ToString());
|
||||
@@ -418,7 +418,7 @@ namespace Game.Chat
|
||||
|
||||
handler.SendSysMessage(CypherStrings.GameobjectDetail, guidLow, objectInfo.name, guidLow, id, x, y, z, mapId, o, phaseId, phaseGroup);
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
int curRespawnDelay = (int)(target.GetRespawnTimeEx() - GameTime.GetGameTime());
|
||||
if (curRespawnDelay < 0)
|
||||
@@ -436,7 +436,7 @@ namespace Game.Chat
|
||||
static bool HandleGameObjectTurnCommand(CommandHandler handler, ulong guidLow, float? oz, float? oy, float? ox)
|
||||
{
|
||||
GameObject obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandObjnotfound, guidLow);
|
||||
return false;
|
||||
@@ -458,7 +458,7 @@ namespace Game.Chat
|
||||
obj.Delete();
|
||||
|
||||
obj = GameObject.CreateGameObjectFromDB(guidLow, map);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
return false;
|
||||
|
||||
handler.SendSysMessage(CypherStrings.CommandTurnobjmessage, obj.GetSpawnId(), obj.GetGoInfo().name, obj.GetGUID().ToString(), obj.GetOrientation());
|
||||
@@ -494,7 +494,7 @@ namespace Game.Chat
|
||||
Map map = player.GetMap();
|
||||
|
||||
GameObject obj = GameObject.CreateGameObject(objectInfo.entry, map, player, Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f)), 255, GameObjectState.Ready);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
return false;
|
||||
|
||||
PhasingHandler.InheritPhaseShift(obj, player);
|
||||
@@ -508,7 +508,7 @@ namespace Game.Chat
|
||||
|
||||
// this will generate a new guid if the object is in an instance
|
||||
obj = GameObject.CreateGameObjectFromDB(spawnId, map);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
return false;
|
||||
|
||||
// TODO: is it really necessary to add both the real and DB table guid here ?
|
||||
@@ -546,7 +546,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
GameObject obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandObjnotfound, guidLow);
|
||||
return false;
|
||||
@@ -570,7 +570,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
GameObject obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandObjnotfound, guidLow);
|
||||
return false;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Game.Chat
|
||||
if (!handler.GetPlayerGroupAndGUIDByName(name, out Player player, out Group group, out _))
|
||||
return false;
|
||||
|
||||
if (!group)
|
||||
if (group == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.GroupNotInGroup, player.GetName());
|
||||
return false;
|
||||
@@ -39,7 +39,7 @@ namespace Game.Chat
|
||||
if (!handler.GetPlayerGroupAndGUIDByName(playerNameGroup, out Player playerSource, out Group groupSource, out _, true))
|
||||
return false;
|
||||
|
||||
if (!groupSource)
|
||||
if (groupSource == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.GroupNotInGroup, playerSource.GetName());
|
||||
return false;
|
||||
@@ -48,7 +48,7 @@ namespace Game.Chat
|
||||
if (!handler.GetPlayerGroupAndGUIDByName(playerName, out Player playerTarget, out Group groupTarget, out _, true))
|
||||
return false;
|
||||
|
||||
if (groupTarget || playerTarget.GetGroup() == groupSource)
|
||||
if (groupTarget != null || playerTarget.GetGroup() == groupSource)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.GroupAlreadyInGroup, playerTarget.GetName());
|
||||
return false;
|
||||
@@ -72,7 +72,7 @@ namespace Game.Chat
|
||||
if (!handler.GetPlayerGroupAndGUIDByName(name, out Player player, out Group group, out ObjectGuid guid))
|
||||
return false;
|
||||
|
||||
if (!group)
|
||||
if (group == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.GroupNotInGroup, player.GetName());
|
||||
return false;
|
||||
@@ -155,7 +155,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
// If both fails, players simply has no party. Return false.
|
||||
if (!groupTarget)
|
||||
if (groupTarget == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.GroupNotInGroup, target.GetName());
|
||||
return false;
|
||||
@@ -194,15 +194,15 @@ namespace Game.Chat
|
||||
flags = "None";
|
||||
|
||||
// Check if iterator is online. If is...
|
||||
Player p = Global.ObjAccessor.FindPlayer(slot.guid);
|
||||
Player player = Global.ObjAccessor.FindPlayer(slot.guid);
|
||||
string phases = "";
|
||||
if (p && p.IsInWorld)
|
||||
if (player != null && player.IsInWorld)
|
||||
{
|
||||
// ... than, it prints information like "is online", where he is, etc...
|
||||
onlineState = "online";
|
||||
phases = PhasingHandler.FormatPhases(p.GetPhaseShift());
|
||||
phases = PhasingHandler.FormatPhases(player.GetPhaseShift());
|
||||
|
||||
AreaTableRecord area = CliDB.AreaTableStorage.LookupByKey(p.GetAreaId());
|
||||
AreaTableRecord area = CliDB.AreaTableStorage.LookupByKey(player.GetAreaId());
|
||||
if (area != null)
|
||||
{
|
||||
AreaTableRecord zone = CliDB.AreaTableStorage.LookupByKey(area.ParentAreaID);
|
||||
@@ -226,7 +226,7 @@ namespace Game.Chat
|
||||
if (!handler.GetPlayerGroupAndGUIDByName(name, out Player player, out Group group, out ObjectGuid guid))
|
||||
return false;
|
||||
|
||||
if (!group)
|
||||
if (group == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.GroupNotInGroup, player.GetName());
|
||||
return false;
|
||||
@@ -273,7 +273,7 @@ namespace Game.Chat
|
||||
for (GroupReference it = groupTarget.GetFirstMember(); it != null; it = it.Next())
|
||||
{
|
||||
Player target = it.GetSource();
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
target.ResurrectPlayer(target.GetSession().HasPermission(RBACPermissions.ResurrectWithFullHps) ? 1.0f : 0.5f);
|
||||
target.SpawnCorpseBones();
|
||||
@@ -302,7 +302,7 @@ namespace Game.Chat
|
||||
|
||||
string nameLink = handler.GetNameLink(target);
|
||||
|
||||
if (!group)
|
||||
if (group == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NotInGroup, nameLink);
|
||||
return false;
|
||||
@@ -319,7 +319,7 @@ namespace Game.Chat
|
||||
if (toInstance)
|
||||
{
|
||||
Player groupLeader = Global.ObjAccessor.GetPlayer(gmMap, group.GetLeaderGUID());
|
||||
if (!groupLeader || (groupLeader.GetMapId() != gmMap.GetId()) || (groupLeader.GetInstanceId() != gmMap.GetInstanceId()))
|
||||
if (groupLeader == null || (groupLeader.GetMapId() != gmMap.GetId()) || (groupLeader.GetInstanceId() != gmMap.GetInstanceId()))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PartialGroupSummon);
|
||||
onlyLocalSummon = true;
|
||||
@@ -330,7 +330,7 @@ namespace Game.Chat
|
||||
{
|
||||
Player player = refe.GetSource();
|
||||
|
||||
if (!player || player == gmPlayer || player.GetSession() == null)
|
||||
if (player == null || player == gmPlayer || player.GetSession() == null)
|
||||
continue;
|
||||
|
||||
// check online security
|
||||
@@ -409,7 +409,7 @@ namespace Game.Chat
|
||||
if (!handler.GetPlayerGroupAndGUIDByName(name, out Player player, out Group group, out ObjectGuid guid))
|
||||
return false;
|
||||
|
||||
if (!group)
|
||||
if (group == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NotInGroup, player.GetName());
|
||||
return false;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Global.GuildMgr.GetGuildByName(guildName))
|
||||
if (Global.GuildMgr.GetGuildByName(guildName) != null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.GuildRenameAlreadyExists);
|
||||
return false;
|
||||
@@ -122,7 +122,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Guild targetGuild = Global.GuildMgr.GetGuildById(guildId);
|
||||
if (!targetGuild)
|
||||
if (targetGuild == null)
|
||||
return false;
|
||||
|
||||
return targetGuild.ChangeMemberRank(null, player.GetGUID(), (GuildRankId)rank);
|
||||
@@ -144,13 +144,13 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Guild guild = Global.GuildMgr.GetGuildByName(oldGuildName);
|
||||
if (!guild)
|
||||
if (guild == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandCouldnotfind, oldGuildName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Global.GuildMgr.GetGuildByName(newGuildName))
|
||||
if (Global.GuildMgr.GetGuildByName(newGuildName) != null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.GuildRenameAlreadyExists, newGuildName);
|
||||
return false;
|
||||
@@ -185,7 +185,7 @@ namespace Game.Chat
|
||||
guild = target.GetConnectedPlayer().GetGuild();
|
||||
}
|
||||
|
||||
if (!guild)
|
||||
if (guild == null)
|
||||
return false;
|
||||
|
||||
// Display Guild Information
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleHonorUpdateCommand(CommandHandler handler)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -35,7 +35,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleHonorAddCommand(CommandHandler handler, int amount)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -53,7 +53,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleHonorAddKillCommand(CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -61,7 +61,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
// check online security
|
||||
Player player = target.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
if (handler.HasLowerSecurity(player, ObjectGuid.Empty))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Game.Chat
|
||||
groupTarget = Global.GroupMgr.GetGroupByDbStoreId(resultGroup.Read<uint>(0));
|
||||
}
|
||||
|
||||
if (!groupTarget)
|
||||
if (groupTarget == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.LfgNotInGroup, player.GetName());
|
||||
return false;
|
||||
@@ -63,9 +63,9 @@ namespace Game.Chat
|
||||
|
||||
foreach (var slot in groupTarget.GetMemberSlots())
|
||||
{
|
||||
Player p = Global.ObjAccessor.FindPlayer(slot.guid);
|
||||
if (p)
|
||||
PrintPlayerInfo(handler, p);
|
||||
Player groupPlayer = Global.ObjAccessor.FindPlayer(slot.guid);
|
||||
if (groupPlayer != null)
|
||||
PrintPlayerInfo(handler, groupPlayer);
|
||||
else
|
||||
handler.SendSysMessage("{0} is offline.", slot.name);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ namespace Game.Chat
|
||||
|
||||
static void PrintPlayerInfo(CommandHandler handler, Player player)
|
||||
{
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
ObjectGuid guid = player.GetGUID();
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleLearnCommand(CommandHandler handler, uint spellId, [OptionalArg] string allRanksStr)
|
||||
{
|
||||
Player targetPlayer = handler.GetSelectedPlayerOrSelf();
|
||||
if (!targetPlayer)
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -141,7 +141,7 @@ namespace Game.Chat.Commands
|
||||
// Example: .learn all_recipes enchanting
|
||||
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -317,7 +317,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleUnLearnCommand(CommandHandler handler, uint spellId, [OptionalArg] string allRanksStr)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Game.Chat.Commands
|
||||
thisMap = handler.GetSession().GetPlayer().GetMap();
|
||||
|
||||
// If map found, try to find active version of this creature
|
||||
if (thisMap)
|
||||
if (thisMap != null)
|
||||
{
|
||||
var creBounds = thisMap.GetCreatureBySpawnIdStore().LookupByKey(guid);
|
||||
foreach (var creature in creBounds)
|
||||
@@ -73,7 +73,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
if (!liveFound)
|
||||
{
|
||||
if (handler.GetSession())
|
||||
if (handler.GetSession() != null)
|
||||
handler.SendSysMessage(CypherStrings.CreatureListChat, guid, guid, cInfo.Name, x, y, z, mapId, "", "");
|
||||
else
|
||||
handler.SendSysMessage(CypherStrings.CreatureListConsole, guid, cInfo.Name, x, y, z, mapId, "", "");
|
||||
@@ -403,7 +403,7 @@ namespace Game.Chat.Commands
|
||||
thisMap = handler.GetSession().GetPlayer().GetMap();
|
||||
|
||||
// If map found, try to find active version of this object
|
||||
if (thisMap)
|
||||
if (thisMap != null)
|
||||
{
|
||||
var goBounds = thisMap.GetGameObjectBySpawnIdStore().LookupByKey(guid);
|
||||
foreach (var go in goBounds)
|
||||
@@ -413,7 +413,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
if (!liveFound)
|
||||
{
|
||||
if (handler.GetSession())
|
||||
if (handler.GetSession() != null)
|
||||
handler.SendSysMessage(CypherStrings.GoListChat, guid, entry, guid, gInfo.name, x, y, z, mapId, "", "");
|
||||
else
|
||||
handler.SendSysMessage(CypherStrings.GoListConsole, guid, gInfo.name, x, y, z, mapId, "", "");
|
||||
@@ -485,10 +485,10 @@ namespace Game.Chat.Commands
|
||||
static bool HandleListScenesCommand(CommandHandler handler)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
target = handler.GetSession().GetPlayer();
|
||||
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -572,7 +572,7 @@ namespace Game.Chat.Commands
|
||||
static bool ListAurasCommand(CommandHandler handler, uint? spellId, string namePart)
|
||||
{
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace Game.Chat
|
||||
|
||||
foreach (var factionEntry in CliDB.FactionStorage.Values)
|
||||
{
|
||||
FactionState factionState = target ? target.GetReputationMgr().GetState(factionEntry) : null;
|
||||
FactionState factionState = target != null ? target.GetReputationMgr().GetState(factionEntry) : null;
|
||||
|
||||
Locale locale = handler.GetSessionDbcLocale();
|
||||
string name = factionEntry.Name[locale];
|
||||
@@ -450,7 +450,7 @@ namespace Game.Chat
|
||||
|
||||
string valStr = "";
|
||||
string knownStr = "";
|
||||
if (target && target.HasSkill((SkillType)skillInfo.Id))
|
||||
if (target != null && target.HasSkill((SkillType)skillInfo.Id))
|
||||
{
|
||||
knownStr = handler.GetCypherString(CypherStrings.Known);
|
||||
uint curValue = target.GetPureSkillValue((SkillType)skillInfo.Id);
|
||||
@@ -564,7 +564,7 @@ namespace Game.Chat
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
|
||||
// title name have single string arg for player name
|
||||
string targetName = target ? target.GetName() : "NAME";
|
||||
string targetName = target != null ? target.GetName() : "NAME";
|
||||
|
||||
uint counter = 0; // Counter for figure out that we found smth.
|
||||
// Search in CharTitles.dbc
|
||||
@@ -572,7 +572,7 @@ namespace Game.Chat
|
||||
{
|
||||
for (Gender gender = Gender.Male; gender <= Gender.Female; ++gender)
|
||||
{
|
||||
if (target && target.GetGender() != gender)
|
||||
if (target != null && target.GetGender() != gender)
|
||||
continue;
|
||||
|
||||
Locale locale = handler.GetSessionDbcLocale();
|
||||
@@ -605,9 +605,9 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
string knownStr = target && target.HasTitle(titleInfo) ? handler.GetCypherString(CypherStrings.Known) : "";
|
||||
string knownStr = target != null && target.HasTitle(titleInfo) ? handler.GetCypherString(CypherStrings.Known) : "";
|
||||
|
||||
string activeStr = target && target.m_playerData.PlayerTitle == titleInfo.MaskID
|
||||
string activeStr = target != null && target.m_playerData.PlayerTitle == titleInfo.MaskID
|
||||
? handler.GetCypherString(CypherStrings.Active) : "";
|
||||
|
||||
string titleNameStr = string.Format(name.ConvertFormatSyntax(), targetName);
|
||||
@@ -684,7 +684,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
if (handler.GetSession())
|
||||
if (handler.GetSession() != null)
|
||||
handler.SendSysMessage(CypherStrings.ItemListChat, id, id, name);
|
||||
else
|
||||
handler.SendSysMessage(CypherStrings.ItemListConsole, id, name);
|
||||
@@ -739,7 +739,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
// send item set in "id - [namedlink locale]" format
|
||||
if (handler.GetSession())
|
||||
if (handler.GetSession() != null)
|
||||
handler.SendSysMessage(CypherStrings.ItemsetListChat, id, id, name, "");
|
||||
else
|
||||
handler.SendSysMessage(CypherStrings.ItemsetListConsole, id, name, "");
|
||||
@@ -774,7 +774,7 @@ namespace Game.Chat
|
||||
if (string.IsNullOrEmpty(name))
|
||||
continue;
|
||||
|
||||
if (!name.Like(namePart) && handler.GetSession())
|
||||
if (!name.Like(namePart) && handler.GetSession() != null)
|
||||
{
|
||||
locale = 0;
|
||||
for (; locale < Locale.Total; ++locale)
|
||||
@@ -839,7 +839,7 @@ namespace Game.Chat
|
||||
var mapInfo = CliDB.MapStorage.LookupByKey(id);
|
||||
if (mapInfo != null)
|
||||
{
|
||||
Locale locale = handler.GetSession() ? handler.GetSession().GetSessionDbcLocale() : Global.WorldMgr.GetDefaultDbcLocale();
|
||||
Locale locale = handler.GetSession() != null ? handler.GetSession().GetSessionDbcLocale() : Global.WorldMgr.GetDefaultDbcLocale();
|
||||
string name = mapInfo.MapName[locale];
|
||||
if (name.IsEmpty())
|
||||
{
|
||||
@@ -891,7 +891,7 @@ namespace Game.Chat
|
||||
if (ip.IsEmpty())
|
||||
{
|
||||
// NULL only if used from console
|
||||
if (!target || target == handler.GetSession().GetPlayer())
|
||||
if (target == null || target == handler.GetSession().GetPlayer())
|
||||
return false;
|
||||
|
||||
ip = target.GetSession().GetRemoteAddress();
|
||||
@@ -1004,7 +1004,7 @@ namespace Game.Chat
|
||||
|
||||
string statusStr = "";
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
switch (target.GetQuestStatus(qInfo.Id))
|
||||
{
|
||||
@@ -1065,7 +1065,7 @@ namespace Game.Chat
|
||||
|
||||
string statusStr = "";
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
QuestStatus status = target.GetQuestStatus(qInfo.Id);
|
||||
|
||||
@@ -1135,7 +1135,7 @@ namespace Game.Chat
|
||||
|
||||
string statusStr = "";
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
switch (target.GetQuestStatus(id))
|
||||
{
|
||||
@@ -1153,7 +1153,7 @@ namespace Game.Chat
|
||||
}
|
||||
}
|
||||
|
||||
if (handler.GetSession())
|
||||
if (handler.GetSession() != null)
|
||||
{
|
||||
int maxLevel = 0;
|
||||
var questLevels = Global.DB2Mgr.GetContentTuningData(quest.ContentTuningId, handler.GetSession().GetPlayer().m_playerData.CtrOptions.GetValue().ContentTuningConditionMask);
|
||||
@@ -1229,14 +1229,14 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
bool known = target && target.HasSpell(spellInfo.Id);
|
||||
bool known = target != null && target.HasSpell(spellInfo.Id);
|
||||
var spellEffectInfo = spellInfo.GetEffects().Find(spelleffectInfo => spelleffectInfo.IsEffect(SpellEffectName.LearnSpell));
|
||||
|
||||
SpellInfo learnSpellInfo = spellEffectInfo != null ? Global.SpellMgr.GetSpellInfo(spellEffectInfo.TriggerSpell, spellInfo.Difficulty) : null;
|
||||
|
||||
bool talent = spellInfo.HasAttribute(SpellCustomAttributes.IsTalent);
|
||||
bool passive = spellInfo.IsPassive();
|
||||
bool active = target && target.HasAura(spellInfo.Id);
|
||||
bool active = target != null && target.HasAura(spellInfo.Id);
|
||||
|
||||
// unit32 used to prevent interpreting public byte as char at output
|
||||
// find rank of learned spell for learning spell, or talent rank
|
||||
@@ -1297,14 +1297,14 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
bool known = target && target.HasSpell(id);
|
||||
bool known = target != null && target.HasSpell(id);
|
||||
var spellEffectInfo = spellInfo.GetEffects().Find(spelleffectInfo => spelleffectInfo.IsEffect(SpellEffectName.LearnSpell));
|
||||
|
||||
SpellInfo learnSpellInfo = Global.SpellMgr.GetSpellInfo(spellEffectInfo.TriggerSpell, Difficulty.None);
|
||||
|
||||
bool talent = spellInfo.HasAttribute(SpellCustomAttributes.IsTalent);
|
||||
bool passive = spellInfo.IsPassive();
|
||||
bool active = target && target.HasAura(id);
|
||||
bool active = target != null && target.HasAura(id);
|
||||
|
||||
// unit32 used to prevent interpreting public byte as char at output
|
||||
// find rank of learned spell for learning spell, or talent rank
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace Game.Chat
|
||||
var go_search = new UnitListSearcher(obj, creatureList, go_check);
|
||||
|
||||
Cell.VisitGridObjects(obj, go_search, radius);
|
||||
if (!creatureList.Empty())
|
||||
if (creatureList.Empty())
|
||||
{
|
||||
handler.SendSysMessage("Found {0} Creatures.", creatureList.Count);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Game.Chat
|
||||
|
||||
string name = "Console";
|
||||
WorldSession session = handler.GetSession();
|
||||
if (session)
|
||||
if (session != null)
|
||||
name = session.GetPlayer().GetName();
|
||||
|
||||
Global.WorldMgr.SendWorldText(CypherStrings.AnnounceColor, name, message);
|
||||
@@ -36,7 +36,7 @@ namespace Game.Chat
|
||||
|
||||
string name = "Console";
|
||||
WorldSession session = handler.GetSession();
|
||||
if (session)
|
||||
if (session != null)
|
||||
name = session.GetPlayer().GetName();
|
||||
|
||||
Global.WorldMgr.SendGMText(CypherStrings.AnnounceColor, name, message);
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
// check online security
|
||||
if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
|
||||
@@ -70,7 +70,7 @@ namespace Game.Chat
|
||||
// we have to go to instance, and can go to player only if:
|
||||
// 1) we are in his group (either as leader or as member)
|
||||
// 2) we are not bound to any group and have GM mode on
|
||||
if (_player.GetGroup())
|
||||
if (_player.GetGroup() != null)
|
||||
{
|
||||
// we are in group, we can go only if we are in the player group
|
||||
if (_player.GetGroup() != target.GetGroup())
|
||||
@@ -153,7 +153,7 @@ namespace Game.Chat
|
||||
static bool HandleBindSightCommand(CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
return false;
|
||||
|
||||
handler.GetSession().GetPlayer().CastSpell(unit, 6277, true);
|
||||
@@ -168,14 +168,14 @@ namespace Game.Chat
|
||||
if (!args.Empty())
|
||||
{
|
||||
target = Global.ObjAccessor.FindPlayerByName(args.NextString());
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
@@ -193,7 +193,7 @@ namespace Game.Chat
|
||||
static bool HandleComeToMeCommand(CommandHandler handler)
|
||||
{
|
||||
Creature caster = handler.GetSelectedCreature();
|
||||
if (!caster)
|
||||
if (caster == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -216,14 +216,14 @@ namespace Game.Chat
|
||||
static bool HandleDamageCommand(CommandHandler handler, uint damage, SpellSchools? school, [OptionalArg]SpellInfo spellInfo)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target || handler.GetSession().GetPlayer().GetTarget().IsEmpty())
|
||||
if (target == null || handler.GetSession().GetPlayer().GetTarget().IsEmpty())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
}
|
||||
Player player_ = target.ToPlayer();
|
||||
if (player_)
|
||||
if (handler.HasLowerSecurity(player_, ObjectGuid.Empty, false))
|
||||
Player player = target.ToPlayer();
|
||||
if (player != null)
|
||||
if (handler.HasLowerSecurity(player, ObjectGuid.Empty, false))
|
||||
return false;
|
||||
|
||||
if (!target.IsAlive())
|
||||
@@ -324,14 +324,14 @@ namespace Game.Chat
|
||||
static bool HandleDieCommand(CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target && handler.GetPlayer().GetTarget().IsEmpty())
|
||||
if (target == null && handler.GetPlayer().GetTarget().IsEmpty())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = target.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
if (handler.HasLowerSecurity(player, ObjectGuid.Empty, false))
|
||||
return false;
|
||||
|
||||
@@ -380,7 +380,7 @@ namespace Game.Chat
|
||||
case HighGuid.Player:
|
||||
{
|
||||
obj = Global.ObjAccessor.FindPlayer(ObjectGuid.Create(HighGuid.Player, guidLow));
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
}
|
||||
@@ -389,7 +389,7 @@ namespace Game.Chat
|
||||
case HighGuid.Creature:
|
||||
{
|
||||
obj = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNocreaturefound);
|
||||
}
|
||||
@@ -398,7 +398,7 @@ namespace Game.Chat
|
||||
case HighGuid.GameObject:
|
||||
{
|
||||
obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNogameobjectfound);
|
||||
}
|
||||
@@ -407,14 +407,14 @@ namespace Game.Chat
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = handler.GetSelectedUnit();
|
||||
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
@@ -486,7 +486,7 @@ namespace Game.Chat
|
||||
// Player and duration retrieval is over
|
||||
if (canApplyFreeze)
|
||||
{
|
||||
if (!player) // can be null if some previous selection failed
|
||||
if (player == null) // can be null if some previous selection failed
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandFreezeWrong);
|
||||
return true;
|
||||
@@ -532,7 +532,7 @@ namespace Game.Chat
|
||||
case HighGuid.Player:
|
||||
{
|
||||
obj = Global.ObjAccessor.FindPlayer(ObjectGuid.Create(HighGuid.Player, guidLow));
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
}
|
||||
@@ -541,7 +541,7 @@ namespace Game.Chat
|
||||
case HighGuid.Creature:
|
||||
{
|
||||
obj = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNocreaturefound);
|
||||
}
|
||||
@@ -550,7 +550,7 @@ namespace Game.Chat
|
||||
case HighGuid.GameObject:
|
||||
{
|
||||
obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNogameobjectfound);
|
||||
}
|
||||
@@ -559,14 +559,14 @@ namespace Game.Chat
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = handler.GetSelectedUnit();
|
||||
|
||||
if (!obj)
|
||||
if (obj == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
return false;
|
||||
@@ -622,7 +622,7 @@ namespace Game.Chat
|
||||
obj.GetPositionX(), obj.GetPositionY(), obj.GetPositionZ(), obj.GetOrientation());
|
||||
|
||||
Transport transport = obj.GetTransport<Transport>();
|
||||
if (transport)
|
||||
if (transport != null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.TransportPosition, transport.GetGoInfo().MoTransport.SpawnMap, obj.GetTransOffsetX(), obj.GetTransOffsetY(), obj.GetTransOffsetZ(), obj.GetTransOffsetO(),
|
||||
transport.GetEntry(), transport.GetName());
|
||||
@@ -671,7 +671,7 @@ namespace Game.Chat
|
||||
static bool HandleHideAreaCommand(CommandHandler handler, uint areaId)
|
||||
{
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
if (playerTarget == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -821,7 +821,7 @@ namespace Game.Chat
|
||||
// Save the frozen player to update remaining time in case of future .listfreeze uses
|
||||
// before the frozen state expires
|
||||
Player frozen = Global.ObjAccessor.FindPlayerByName(player);
|
||||
if (frozen)
|
||||
if (frozen != null)
|
||||
frozen.SaveToDB();
|
||||
// Notify the freeze duration
|
||||
if (remaintime == -1) // Permanent duration
|
||||
@@ -848,7 +848,7 @@ namespace Game.Chat
|
||||
static bool HandleMovegensCommand(CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
|
||||
@@ -948,7 +948,7 @@ namespace Game.Chat
|
||||
uint accountId = target != null ? target.GetSession().GetAccountId() : Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(player.GetGUID());
|
||||
|
||||
// find only player from same account if any
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
WorldSession session = Global.WorldMgr.FindSession(accountId);
|
||||
if (session != null)
|
||||
@@ -967,7 +967,7 @@ namespace Game.Chat
|
||||
else
|
||||
muteBy = handler.GetCypherString(CypherStrings.Console);
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
// Target is online, mute will be in effect right away.
|
||||
long mutedUntil = GameTime.GetGameTime() + muteTime * Time.Minute;
|
||||
@@ -995,7 +995,7 @@ namespace Game.Chat
|
||||
|
||||
if (WorldConfig.GetBoolValue(WorldCfg.ShowMuteInWorld))
|
||||
Global.WorldMgr.SendWorldText(CypherStrings.CommandMutemessageWorld, muteBy, nameLink, muteTime, muteReasonStr);
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
target.SendSysMessage(CypherStrings.YourChatDisabled, muteTime, muteBy, muteReasonStr);
|
||||
handler.SendSysMessage(CypherStrings.YouDisableChat, nameLink, muteTime, muteReasonStr);
|
||||
@@ -1201,7 +1201,7 @@ namespace Game.Chat
|
||||
|
||||
// Mail data print is only defined if you have a mail
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
// check online security
|
||||
if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
|
||||
@@ -1266,7 +1266,7 @@ namespace Game.Chat
|
||||
|
||||
// Only fetch these fields if commander has sufficient rights)
|
||||
if (handler.HasPermission(RBACPermissions.CommandsPinfoCheckPersonalData) && // RBAC Perm. 48, Role 39
|
||||
(!handler.GetSession() || handler.GetSession().GetSecurity() >= (AccountTypes)security))
|
||||
(handler.GetSession() == null || handler.GetSession().GetSecurity() >= (AccountTypes)security))
|
||||
{
|
||||
eMail = result0.Read<string>(2);
|
||||
regMail = result0.Read<string>(3);
|
||||
@@ -1344,10 +1344,10 @@ namespace Game.Chat
|
||||
|
||||
// Initiate output
|
||||
// Output I. LANG_PINFO_PLAYER
|
||||
handler.SendSysMessage(CypherStrings.PinfoPlayer, target ? "" : handler.GetCypherString(CypherStrings.Offline), nameLink, targetGuid.ToString());
|
||||
handler.SendSysMessage(CypherStrings.PinfoPlayer, target != null ? "" : handler.GetCypherString(CypherStrings.Offline), nameLink, targetGuid.ToString());
|
||||
|
||||
// Output II. LANG_PINFO_GM_ACTIVE if character is gamemaster
|
||||
if (target && target.IsGameMaster())
|
||||
if (target != null && target.IsGameMaster())
|
||||
handler.SendSysMessage(CypherStrings.PinfoGmActive);
|
||||
|
||||
// Output III. LANG_PINFO_BANNED if ban exists and is applied
|
||||
@@ -1387,7 +1387,7 @@ namespace Game.Chat
|
||||
handler.SendSysMessage(CypherStrings.PinfoChrAlive, alive);
|
||||
|
||||
// Output XIII. phases
|
||||
if (target)
|
||||
if (target != null)
|
||||
PhasingHandler.PrintToChat(handler, target);
|
||||
|
||||
// Output XIV. LANG_PINFO_CHR_MONEY
|
||||
@@ -1470,7 +1470,7 @@ namespace Game.Chat
|
||||
static bool HandlePossessCommand(CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
return false;
|
||||
|
||||
handler.GetSession().GetPlayer().CastSpell(unit, 530, true);
|
||||
@@ -1559,7 +1559,7 @@ namespace Game.Chat
|
||||
|
||||
// accept only explicitly selected target (not implicitly self targeting case)
|
||||
Creature target = !player.GetTarget().IsEmpty() ? handler.GetSelectedCreature() : null;
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
if (target.IsPet())
|
||||
{
|
||||
@@ -1628,7 +1628,7 @@ namespace Game.Chat
|
||||
if (handler.GetSession().HasPermission(RBACPermissions.CommandsSaveWithoutDelay))
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (target)
|
||||
if (target != null)
|
||||
target.SaveToDB();
|
||||
else
|
||||
player.SaveToDB();
|
||||
@@ -1648,7 +1648,7 @@ namespace Game.Chat
|
||||
static bool HandleShowAreaCommand(CommandHandler handler, uint areaId)
|
||||
{
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
if (playerTarget == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -1699,7 +1699,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
// check online security
|
||||
@@ -1821,11 +1821,11 @@ namespace Game.Chat
|
||||
else // If no name was entered - use target
|
||||
{
|
||||
player = handler.GetSelectedPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
name = player.GetName();
|
||||
}
|
||||
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandUnfreeze, name);
|
||||
|
||||
@@ -1874,10 +1874,10 @@ namespace Game.Chat
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
return false;
|
||||
|
||||
uint accountId = target ? target.GetSession().GetAccountId() : Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(targetGuid);
|
||||
uint accountId = target != null ? target.GetSession().GetAccountId() : Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(targetGuid);
|
||||
|
||||
// find only player from same account if any
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
WorldSession session = Global.WorldMgr.FindSession(accountId);
|
||||
if (session != null)
|
||||
@@ -1888,7 +1888,7 @@ namespace Game.Chat
|
||||
if (handler.HasLowerSecurity(target, targetGuid, true))
|
||||
return false;
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
if (target.GetSession().CanSpeak())
|
||||
{
|
||||
@@ -1906,7 +1906,7 @@ namespace Game.Chat
|
||||
stmt.AddValue(3, accountId);
|
||||
DB.Login.Execute(stmt);
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
target.SendSysMessage(CypherStrings.YourChatEnabled);
|
||||
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
@@ -1920,7 +1920,7 @@ namespace Game.Chat
|
||||
static bool HandleUnPossessCommand(CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
if (unit == null)
|
||||
unit = handler.GetSession().GetPlayer();
|
||||
|
||||
unit.RemoveCharmAuras();
|
||||
@@ -1939,7 +1939,7 @@ namespace Game.Chat
|
||||
{
|
||||
// 7355: "Stuck"
|
||||
var player1 = handler.GetSession().GetPlayer();
|
||||
if (player1)
|
||||
if (player1 != null)
|
||||
player1.CastSpell(player1, SPELL_UNSTUCK_ID, false);
|
||||
return true;
|
||||
}
|
||||
@@ -1957,7 +1957,7 @@ namespace Game.Chat
|
||||
if (!handler.ExtractPlayerTarget(args, out player, out targetGUID))
|
||||
return false;
|
||||
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_HOMEBIND);
|
||||
stmt.AddValue(0, targetGUID.GetCounter());
|
||||
@@ -1978,7 +1978,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player caster = handler.GetSession().GetPlayer();
|
||||
if (caster)
|
||||
if (caster != null)
|
||||
{
|
||||
ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, player.GetMapId(), SPELL_UNSTUCK_ID, player.GetMap().GenerateLowGuid(HighGuid.Cast));
|
||||
Spell.SendCastResult(caster, spellInfo, new Networking.Packets.SpellCastVisual(SPELL_UNSTUCK_VISUAL, 0), castId, SpellCastResult.CantDoThatRightNow);
|
||||
@@ -2105,7 +2105,7 @@ namespace Game.Chat
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
if (playerTarget == null)
|
||||
playerTarget = player;
|
||||
|
||||
ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemId);
|
||||
@@ -2164,12 +2164,12 @@ namespace Game.Chat
|
||||
foreach (var posCount in dest)
|
||||
{
|
||||
Item item1 = player.GetItemByPos(posCount.pos);
|
||||
if (item1)
|
||||
if (item1 != null)
|
||||
item1.SetBinding(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 0 && item)
|
||||
if (count > 0 && item != null)
|
||||
{
|
||||
player.SendNewItem(item, (uint)count, false, true);
|
||||
handler.SendSysMessage(CypherStrings.Additem, itemId, count, handler.GetNameLink(playerTarget));
|
||||
@@ -2212,7 +2212,7 @@ namespace Game.Chat
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
if (playerTarget == null)
|
||||
playerTarget = player;
|
||||
|
||||
Log.outDebug(LogFilter.Server, Global.ObjectMgr.GetCypherString(CypherStrings.Additemset), itemSetId);
|
||||
@@ -2409,7 +2409,7 @@ namespace Game.Chat
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 0 && item)
|
||||
if (count > 0 && item != null)
|
||||
{
|
||||
player.SendNewItem(item, (uint)count, false, true);
|
||||
if (player != playerTarget)
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyFactionCommand(CommandHandler handler, uint? factionid, uint? flag, ulong? npcflag, uint? dyflag)
|
||||
{
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -157,7 +157,7 @@ namespace Game.Chat
|
||||
mark = 65535;
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -211,7 +211,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -235,7 +235,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyMoneyCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -298,7 +298,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -328,7 +328,7 @@ namespace Game.Chat
|
||||
drunklevel = 100;
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (target)
|
||||
if (target != null)
|
||||
target.SetDrunkValue(drunklevel);
|
||||
|
||||
return true;
|
||||
@@ -341,7 +341,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -470,7 +470,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -529,7 +529,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -617,7 +617,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
|
||||
@@ -652,7 +652,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -686,7 +686,7 @@ namespace Game.Chat
|
||||
static bool HandleDeMorphCommand(CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
target = handler.GetSession().GetPlayer();
|
||||
|
||||
// check online security
|
||||
@@ -784,7 +784,7 @@ namespace Game.Chat
|
||||
static void NotifyModification(CommandHandler handler, Unit target, CypherStrings resourceMessage, CypherStrings resourceReportMessage, params object[] args)
|
||||
{
|
||||
Player player = target.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
handler.SendSysMessage(resourceMessage, new object[] { handler.GetNameLink(player) }.Combine(args));
|
||||
if (handler.NeedReportToTarget(player))
|
||||
@@ -806,7 +806,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -826,14 +826,14 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = target.ToPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
// check online security
|
||||
if (handler.HasLowerSecurity(player, ObjectGuid.Empty))
|
||||
|
||||
@@ -50,13 +50,13 @@ namespace Game.Chat
|
||||
static bool HandleNpcEvadeCommand(CommandHandler handler, EvadeReason? why, string force)
|
||||
{
|
||||
Creature creatureTarget = handler.GetSelectedCreature();
|
||||
if (!creatureTarget || creatureTarget.IsPet())
|
||||
if (creatureTarget == null || creatureTarget.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!creatureTarget.IsAIEnabled())
|
||||
if (creatureTarget.IsAIEnabled())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CreatureNotAiEnabled);
|
||||
return false;
|
||||
@@ -73,7 +73,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcInfoCommand(CommandHandler handler)
|
||||
{
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -260,7 +260,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcPlayEmoteCommand(CommandHandler handler, uint emote)
|
||||
{
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -278,7 +278,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -314,7 +314,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Loot loot = creatureTarget._loot;
|
||||
if (!creatureTarget.IsDead() || loot == null || loot.IsLooted())
|
||||
if (creatureTarget.IsDead() || loot == null || loot.IsLooted())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNotDeadOrNoLoot, creatureTarget.GetName());
|
||||
return false;
|
||||
@@ -392,7 +392,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcTameCommand(CommandHandler handler)
|
||||
{
|
||||
Creature creatureTarget = handler.GetSelectedCreature();
|
||||
if (!creatureTarget || creatureTarget.IsPet())
|
||||
if (creatureTarget == null || creatureTarget.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -416,7 +416,7 @@ namespace Game.Chat
|
||||
|
||||
// Everything looks OK, create new pet
|
||||
Pet pet = player.CreateTamedPetFrom(creatureTarget);
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CreatureNonTameable, cInfo.Entry);
|
||||
return false;
|
||||
@@ -455,7 +455,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcTextEmoteCommand(CommandHandler handler, Tail text)
|
||||
{
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -476,7 +476,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -498,7 +498,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -533,7 +533,7 @@ namespace Game.Chat
|
||||
var list = map[key];
|
||||
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(key);
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootSublabel, player ? player.GetName() : $"Offline player (GUID {key})", list.Count);
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootSublabel, player != null ? player.GetName() : $"Offline player (GUID {key})", list.Count);
|
||||
|
||||
foreach (var it in list)
|
||||
{
|
||||
@@ -557,7 +557,7 @@ namespace Game.Chat
|
||||
Map map = chr.GetMap();
|
||||
|
||||
Transport trans = chr.GetTransport<Transport>();
|
||||
if (trans)
|
||||
if (trans != null)
|
||||
{
|
||||
ulong guid = Global.ObjectMgr.GenerateCreatureSpawnId();
|
||||
CreatureData data = Global.ObjectMgr.NewOrExistCreatureData(guid);
|
||||
@@ -577,7 +577,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Creature creature = Creature.CreateCreature(id, map, chr.GetPosition());
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
return false;
|
||||
|
||||
PhasingHandler.InheritPhaseShift(creature, chr);
|
||||
@@ -589,7 +589,7 @@ namespace Game.Chat
|
||||
// current "creature" variable is deleted and created fresh new, otherwise old values might trigger asserts or cause undefined behavior
|
||||
creature.CleanupsBeforeDelete();
|
||||
creature = Creature.CreateCreatureFromDB(db_guid, map, true, true);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
return false;
|
||||
|
||||
Global.ObjectMgr.AddCreatureToGrid(Global.ObjectMgr.GetCreatureData(db_guid));
|
||||
@@ -606,7 +606,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Creature vendor = handler.GetSelectedCreature();
|
||||
if (!vendor)
|
||||
if (vendor == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -674,7 +674,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcAddFormationCommand(CommandHandler handler, ulong leaderGUID)
|
||||
{
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.GetSpawnId() == 0)
|
||||
if (creature == null || creature.GetSpawnId() == 0)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -747,7 +747,7 @@ namespace Game.Chat
|
||||
else
|
||||
{
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.IsPet() || creature.IsTotem())
|
||||
if (creature == null || creature.IsPet() || creature.IsTotem())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -777,7 +777,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcDeleteVendorItemCommand(CommandHandler handler, uint itemId)
|
||||
{
|
||||
Creature vendor = handler.GetSelectedCreature();
|
||||
if (!vendor || !vendor.IsVendor())
|
||||
if (vendor == null || !vendor.IsVendor())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandVendorselection);
|
||||
return false;
|
||||
@@ -807,7 +807,7 @@ namespace Game.Chat
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -826,7 +826,7 @@ namespace Game.Chat
|
||||
Player player = handler.GetPlayer();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -879,7 +879,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcSetDataCommand(CommandHandler handler, uint data_1, uint data_2)
|
||||
{
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -898,7 +898,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit || !unit.IsTypeId(TypeId.Unit))
|
||||
if (unit == null || !unit.IsTypeId(TypeId.Unit))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -922,7 +922,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -953,7 +953,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcSetFlagCommand(CommandHandler handler, NPCFlags npcFlags, NPCFlags2 npcFlags2)
|
||||
{
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -982,7 +982,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.IsPet())
|
||||
if (creature == null || creature.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -1000,7 +1000,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcSetLinkCommand(CommandHandler handler, ulong linkguid)
|
||||
{
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -1026,7 +1026,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcSetModelCommand(CommandHandler handler, uint displayId)
|
||||
{
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.IsPet())
|
||||
if (creature == null || creature.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -1063,7 +1063,7 @@ namespace Game.Chat
|
||||
if (!lowGuid.HasValue) // case .setmovetype $move_type (with selected creature)
|
||||
{
|
||||
creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.IsPet())
|
||||
if (creature == null || creature.IsPet())
|
||||
return false;
|
||||
|
||||
lowguid = creature.GetSpawnId();
|
||||
@@ -1111,7 +1111,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
{
|
||||
// update movement type
|
||||
if (!doNotDelete)
|
||||
@@ -1149,7 +1149,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.IsPet())
|
||||
if (creature == null || creature.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -1172,7 +1172,7 @@ namespace Game.Chat
|
||||
int phaseGroupId = args.NextInt32();
|
||||
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.IsPet())
|
||||
if (creature == null || creature.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -1203,7 +1203,7 @@ namespace Game.Chat
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
ulong guidLow;
|
||||
|
||||
if (creature)
|
||||
if (creature != null)
|
||||
guidLow = creature.GetSpawnId();
|
||||
else
|
||||
return false;
|
||||
@@ -1232,7 +1232,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcSetSpawnTimeCommand(CommandHandler handler, uint spawnTime)
|
||||
{
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
return false;
|
||||
|
||||
PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_SPAWN_TIME_SECS);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Game.Chat
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Creature creatureTarget = handler.GetSelectedCreature();
|
||||
|
||||
if (!creatureTarget || creatureTarget.IsPet() || creatureTarget.IsTypeId(TypeId.Player))
|
||||
if (creatureTarget == null || creatureTarget.IsPet() || creatureTarget.IsTypeId(TypeId.Player))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -65,7 +65,7 @@ namespace Game.Chat
|
||||
static bool HandlePetLearnCommand(CommandHandler handler, SpellInfo spellInfo)
|
||||
{
|
||||
Pet pet = GetSelectedPlayerPetOrOwn(handler);
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectPlayerOrPet);
|
||||
return false;
|
||||
@@ -97,7 +97,7 @@ namespace Game.Chat
|
||||
static bool HandlePetUnlearnCommand(CommandHandler handler, SpellInfo spellInfo)
|
||||
{
|
||||
Pet pet = GetSelectedPlayerPetOrOwn(handler);
|
||||
if (!pet)
|
||||
if (pet == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectPlayerOrPet);
|
||||
return false;
|
||||
@@ -117,8 +117,8 @@ namespace Game.Chat
|
||||
static bool HandlePetLevelCommand(CommandHandler handler, int? level)
|
||||
{
|
||||
Pet pet = GetSelectedPlayerPetOrOwn(handler);
|
||||
Player owner = pet ? pet.GetOwner() : null;
|
||||
if (!pet || !owner)
|
||||
Player owner = pet != null ? pet.GetOwner() : null;
|
||||
if (pet == null || owner == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectPlayerOrPet);
|
||||
return false;
|
||||
@@ -146,7 +146,7 @@ namespace Game.Chat
|
||||
static Pet GetSelectedPlayerPetOrOwn(CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
if (target.IsTypeId(TypeId.Player))
|
||||
return target.ToPlayer().GetPet();
|
||||
@@ -156,7 +156,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
return player ? player.GetPet() : null;
|
||||
return player != null ? player.GetPet() : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Game.Chat
|
||||
static bool HandleQuestAdd(CommandHandler handler, Quest quest)
|
||||
{
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -52,7 +52,7 @@ namespace Game.Chat
|
||||
static bool HandleQuestComplete(CommandHandler handler, Quest quest)
|
||||
{
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -76,7 +76,7 @@ namespace Game.Chat
|
||||
static bool HandleQuestRemove(CommandHandler handler, Quest quest)
|
||||
{
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -125,7 +125,7 @@ namespace Game.Chat
|
||||
static bool HandleQuestReward(CommandHandler handler, Quest quest)
|
||||
{
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -149,7 +149,7 @@ namespace Game.Chat
|
||||
static bool HandleQuestObjectiveComplete(CommandHandler handler, uint objectiveId)
|
||||
{
|
||||
Player player = handler.GetSelectedPlayerOrSelf();
|
||||
if (!player)
|
||||
if (player == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Game.Chat
|
||||
|
||||
// reset level for pet
|
||||
Pet pet = target.GetPet();
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
pet.SynchronizeLevelWithOwner();
|
||||
|
||||
Global.ScriptMgr.OnPlayerLevelChanged(target, oldLevel);
|
||||
@@ -185,7 +185,7 @@ namespace Game.Chat
|
||||
/* TODO: 6.x remove/update pet talents
|
||||
Pet* pet = target.GetPet();
|
||||
Pet.resetTalentsForAllPetsOf(target, pet);
|
||||
if (pet)
|
||||
if (pet != null)
|
||||
target.SendTalentsInfoData(true);
|
||||
*/
|
||||
return true;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Game.Chat
|
||||
static bool HandleCancelSceneCommand(CommandHandler handler, uint sceneScriptPackageId)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -32,7 +32,7 @@ namespace Game.Chat
|
||||
static bool HandleDebugSceneCommand(CommandHandler handler)
|
||||
{
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
if (player)
|
||||
if (player != null)
|
||||
{
|
||||
player.GetSceneMgr().ToggleDebugSceneMode();
|
||||
handler.SendSysMessage(player.GetSceneMgr().IsInDebugSceneMode() ? CypherStrings.CommandSceneDebugOn : CypherStrings.CommandSceneDebugOff);
|
||||
@@ -45,7 +45,7 @@ namespace Game.Chat
|
||||
static bool HandlePlaySceneCommand(CommandHandler handler, uint sceneId)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
@@ -62,7 +62,7 @@ namespace Game.Chat
|
||||
static bool HandlePlayScenePackageCommand(CommandHandler handler, uint sceneScriptPackageId, SceneFlags? flags)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Game.Chat.Commands
|
||||
return false;
|
||||
|
||||
// from console show not existed sender
|
||||
MailSender sender = new(MailMessageType.Normal, handler.GetSession() ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm);
|
||||
MailSender sender = new(MailMessageType.Normal, handler.GetSession() != null ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm);
|
||||
|
||||
// @todo Fix poor design
|
||||
SQLTransaction trans = new();
|
||||
@@ -96,7 +96,7 @@ namespace Game.Chat.Commands
|
||||
}
|
||||
|
||||
// from console show not existed sender
|
||||
MailSender sender = new(MailMessageType.Normal, handler.GetSession() ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm);
|
||||
MailSender sender = new(MailMessageType.Normal, handler.GetSession() != null ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm);
|
||||
|
||||
// fill mail
|
||||
MailDraft draft = new(subject, text);
|
||||
@@ -105,8 +105,8 @@ namespace Game.Chat.Commands
|
||||
|
||||
foreach (var pair in items)
|
||||
{
|
||||
Item item = Item.CreateItem(pair.Key, pair.Value, ItemContext.None, handler.GetSession() ? handler.GetSession().GetPlayer() : null);
|
||||
if (item)
|
||||
Item item = Item.CreateItem(pair.Key, pair.Value, ItemContext.None, handler.GetSession() != null ? handler.GetSession().GetPlayer() : null);
|
||||
if (item != null)
|
||||
{
|
||||
item.SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted
|
||||
draft.AddItem(item);
|
||||
@@ -125,7 +125,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleSendMoneyCommand(CommandHandler handler, PlayerIdentifier receiver, QuotedString subject, QuotedString text, long money)
|
||||
{
|
||||
// from console show not existed sender
|
||||
MailSender sender = new(MailMessageType.Normal, handler.GetSession() ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm);
|
||||
MailSender sender = new(MailMessageType.Normal, handler.GetSession() != null ? handler.GetSession().GetPlayer().GetGUID().GetCounter() : 0, MailStationery.Gm);
|
||||
|
||||
SQLTransaction trans = new();
|
||||
|
||||
|
||||
@@ -134,10 +134,10 @@ namespace Game.Chat
|
||||
static bool IsOnlyUser(WorldSession mySession)
|
||||
{
|
||||
// check if there is any session connected from a different address
|
||||
string myAddr = mySession ? mySession.GetRemoteAddress() : "";
|
||||
string myAddr = mySession != null ? mySession.GetRemoteAddress() : "";
|
||||
var sessions = Global.WorldMgr.GetAllSessions();
|
||||
foreach (var session in sessions)
|
||||
if (session && myAddr != session.GetRemoteAddress())
|
||||
if (session != null && myAddr != session.GetRemoteAddress())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@ namespace Game.Chat
|
||||
static bool HandleCooldownCommand(CommandHandler handler, uint? spellIdArg)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player owner = target.GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (!owner)
|
||||
if (owner == null)
|
||||
{
|
||||
owner = handler.GetSession().GetPlayer();
|
||||
target = owner;
|
||||
@@ -56,7 +56,7 @@ namespace Game.Chat
|
||||
static bool HandleAuraCommand(CommandHandler handler, uint spellId)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Game.Chat
|
||||
static bool HandleUnAuraCommand(CommandHandler handler, uint spellId = 0)
|
||||
{
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Game.Chat
|
||||
static bool HandleSetSkillCommand(CommandHandler handler, uint skillId, uint level, uint? maxSkillArg)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -128,7 +128,7 @@ namespace Game.Chat
|
||||
string nameLink = handler.GetNameLink(target);
|
||||
|
||||
Group grp = target.GetGroup();
|
||||
if (!grp)
|
||||
if (grp == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NotInGroup, nameLink);
|
||||
return false;
|
||||
@@ -137,7 +137,7 @@ namespace Game.Chat
|
||||
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player player = refe.GetSource();
|
||||
if (!player || !player.GetSession())
|
||||
if (player == null || player.GetSession() == null)
|
||||
continue;
|
||||
|
||||
// check online security
|
||||
@@ -234,7 +234,7 @@ namespace Game.Chat
|
||||
|
||||
if (where is string && where.Equals("$home")) // References target's homebind
|
||||
{
|
||||
if (target)
|
||||
if (target != null)
|
||||
target.TeleportTo(target.GetHomebind());
|
||||
else
|
||||
{
|
||||
|
||||
@@ -257,7 +257,7 @@ namespace Game.Chat.Commands
|
||||
// If assigned to different player other than current, leave
|
||||
//! Console can override though
|
||||
Player player = handler.GetSession() != null ? handler.GetSession().GetPlayer() : null;
|
||||
if (player && ticket.IsAssignedNotTo(player.GetGUID()))
|
||||
if (player != null && ticket.IsAssignedNotTo(player.GetGUID()))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandTicketalreadyassigned, ticket.GetId());
|
||||
return true;
|
||||
@@ -284,21 +284,21 @@ namespace Game.Chat.Commands
|
||||
// Ticket should be assigned to the player who tries to close it.
|
||||
// Console can override though
|
||||
Player player = handler.GetSession() != null ? handler.GetSession().GetPlayer() : null;
|
||||
if (player && ticket.IsAssignedNotTo(player.GetGUID()))
|
||||
if (player != null && ticket.IsAssignedNotTo(player.GetGUID()))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandTicketcannotclose, ticket.GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
ObjectGuid closedByGuid = ObjectGuid.Empty;
|
||||
if (player)
|
||||
if (player != null)
|
||||
closedByGuid = player.GetGUID();
|
||||
else
|
||||
closedByGuid.SetRawValue(0, ulong.MaxValue);
|
||||
|
||||
Global.SupportMgr.CloseTicket<T>(ticket.GetId(), closedByGuid);
|
||||
|
||||
string msg = ticket.FormatViewMessageString(handler, player ? player.GetName() : "Console", null, null, null);
|
||||
string msg = ticket.FormatViewMessageString(handler, player != null ? player.GetName() : "Console", null, null, null);
|
||||
handler.SendGlobalGMSysMessage(msg);
|
||||
|
||||
return true;
|
||||
@@ -325,7 +325,7 @@ namespace Game.Chat.Commands
|
||||
// Cannot comment ticket assigned to someone else
|
||||
//! Console excluded
|
||||
Player player = handler.GetSession() != null ? handler.GetSession().GetPlayer() : null;
|
||||
if (player && ticket.IsAssignedNotTo(player.GetGUID()))
|
||||
if (player != null && ticket.IsAssignedNotTo(player.GetGUID()))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandTicketalreadyassigned, ticket.GetId());
|
||||
return true;
|
||||
@@ -336,7 +336,7 @@ namespace Game.Chat.Commands
|
||||
Global.SupportMgr.UpdateLastChange();
|
||||
|
||||
string msg = ticket.FormatViewMessageString(handler, null, ticket.GetAssignedToName(), null, null);
|
||||
msg += string.Format(handler.GetCypherString(CypherStrings.CommandTicketlistaddcomment), player ? player.GetName() : "Console", comment);
|
||||
msg += string.Format(handler.GetCypherString(CypherStrings.CommandTicketlistaddcomment), player != null ? player.GetName() : "Console", comment);
|
||||
handler.SendGlobalGMSysMessage(msg);
|
||||
|
||||
return true;
|
||||
@@ -405,7 +405,7 @@ namespace Game.Chat.Commands
|
||||
// Get security level of player, whom this ticket is assigned to
|
||||
AccountTypes security;
|
||||
Player assignedPlayer = ticket.GetAssignedPlayer();
|
||||
if (assignedPlayer && assignedPlayer.IsInWorld)
|
||||
if (assignedPlayer != null && assignedPlayer.IsInWorld)
|
||||
security = assignedPlayer.GetSession().GetSecurity();
|
||||
else
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleTitlesCurrentCommand(CommandHandler handler, uint titleId)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -48,7 +48,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleTitlesAddCommand(CommandHandler handler, uint titleId)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -79,7 +79,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleTitlesRemoveCommand(CommandHandler handler, uint titleId)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
@@ -120,7 +120,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleTitlesSetMaskCommand(CommandHandler handler, ulong mask)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
if (!optionalPathId.HasValue)
|
||||
{
|
||||
if (target)
|
||||
if (target != null)
|
||||
pathId = target.GetWaypointPath();
|
||||
else
|
||||
{
|
||||
@@ -321,7 +321,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
uint pathId = optionalPathId.Value;
|
||||
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -397,7 +397,7 @@ namespace Game.Chat.Commands
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
|
||||
// User did select a visual waypoint?
|
||||
if (!target || target.GetEntry() != 1)
|
||||
if (target == null || target.GetEntry() != 1)
|
||||
{
|
||||
handler.SendSysMessage("|cffff33ffERROR: You must select a waypoint.|r");
|
||||
return false;
|
||||
@@ -487,7 +487,7 @@ namespace Game.Chat.Commands
|
||||
// What to do:
|
||||
// Move the visual spawnpoint
|
||||
// Respawn the owner of the waypoints
|
||||
if (!Creature.DeleteFromDB(target.GetSpawnId()))
|
||||
if (Creature.DeleteFromDB(target.GetSpawnId()))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, 1);
|
||||
return false;
|
||||
@@ -495,7 +495,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
// re-create
|
||||
Creature creature = Creature.CreateCreature(1, map, chr.GetPosition());
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, 1);
|
||||
return false;
|
||||
@@ -512,7 +512,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
|
||||
creature = Creature.CreateCreatureFromDB(dbGuid, map, true, true);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, 1);
|
||||
return false;
|
||||
@@ -575,7 +575,7 @@ namespace Game.Chat.Commands
|
||||
// No PathID provided
|
||||
// . Player must have selected a creature
|
||||
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
return false;
|
||||
@@ -588,7 +588,7 @@ namespace Game.Chat.Commands
|
||||
// PathID provided
|
||||
// Warn if player also selected a creature
|
||||
// . Creature selection is ignored <-
|
||||
if (target)
|
||||
if (target != null)
|
||||
handler.SendSysMessage(CypherStrings.WaypointCreatselected);
|
||||
|
||||
pathId = optionalPathId.Value;
|
||||
@@ -598,7 +598,7 @@ namespace Game.Chat.Commands
|
||||
if (subCommand == "info")
|
||||
{
|
||||
// Check if the user did specify a visual waypoint
|
||||
if (!target || target.GetEntry() != 1)
|
||||
if (target == null || target.GetEntry() != 1)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointVpSelect);
|
||||
return false;
|
||||
@@ -661,7 +661,7 @@ namespace Game.Chat.Commands
|
||||
{
|
||||
ulong wpguid = result2.Read<ulong>(0);
|
||||
|
||||
if (!Creature.DeleteFromDB(wpguid))
|
||||
if (Creature.DeleteFromDB(wpguid))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointNotremoved, wpguid);
|
||||
hasError = true;
|
||||
@@ -692,7 +692,7 @@ namespace Game.Chat.Commands
|
||||
Map map = chr.GetMap();
|
||||
|
||||
Creature creature = Creature.CreateCreature(id, map, new Position(x, y, z, o));
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, id);
|
||||
return false;
|
||||
@@ -709,13 +709,13 @@ namespace Game.Chat.Commands
|
||||
|
||||
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
|
||||
creature = Creature.CreateCreatureFromDB(dbGuid, map, true, true);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, id);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
creature.SetDisplayId(target.GetDisplayId());
|
||||
creature.SetObjectScale(0.5f);
|
||||
@@ -758,7 +758,7 @@ namespace Game.Chat.Commands
|
||||
Map map = chr.GetMap();
|
||||
|
||||
Creature creature = Creature.CreateCreature(1, map, new Position(x, y, z, 0));
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, 1);
|
||||
return false;
|
||||
@@ -774,13 +774,13 @@ namespace Game.Chat.Commands
|
||||
creature.Dispose();
|
||||
|
||||
creature = Creature.CreateCreatureFromDB(dbGuid, map, true, true);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
creature.SetDisplayId(target.GetDisplayId());
|
||||
creature.SetObjectScale(0.5f);
|
||||
@@ -813,7 +813,7 @@ namespace Game.Chat.Commands
|
||||
Position pos = new(x, y, z, o);
|
||||
|
||||
Creature creature = Creature.CreateCreature(1, map, pos);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointNotcreated, 1);
|
||||
return false;
|
||||
@@ -829,13 +829,13 @@ namespace Game.Chat.Commands
|
||||
creature.Dispose();
|
||||
|
||||
creature = Creature.CreateCreatureFromDB(dbGuid, map, true, true);
|
||||
if (!creature)
|
||||
if (creature == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointNotcreated, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target)
|
||||
if (target != null)
|
||||
{
|
||||
creature.SetDisplayId(target.GetDisplayId());
|
||||
creature.SetObjectScale(0.5f);
|
||||
@@ -860,7 +860,7 @@ namespace Game.Chat.Commands
|
||||
{
|
||||
ulong lowguid = result.Read<ulong>(0);
|
||||
|
||||
if (!Creature.DeleteFromDB(lowguid))
|
||||
if (Creature.DeleteFromDB(lowguid))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointNotremoved, lowguid);
|
||||
hasError = true;
|
||||
@@ -892,7 +892,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleWpUnLoadCommand(CommandHandler handler)
|
||||
{
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target)
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage("|cff33ffffYou must select a target.|r");
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user