Some cleanups. (might break build for scripts as they are a WIP)
This commit is contained in:
@@ -53,7 +53,7 @@ namespace Game
|
||||
public void Dispose()
|
||||
{
|
||||
// unload player if not unloaded
|
||||
if (_player)
|
||||
if (_player != null)
|
||||
LogoutPlayer(true);
|
||||
|
||||
// - If have unclosed socket, close it
|
||||
@@ -78,13 +78,13 @@ namespace Game
|
||||
return;
|
||||
|
||||
// finish pending transfers before starting the logout
|
||||
while (_player && _player.IsBeingTeleportedFar())
|
||||
while (_player != null && _player.IsBeingTeleportedFar())
|
||||
HandleMoveWorldportAck();
|
||||
|
||||
m_playerLogout = true;
|
||||
m_playerSave = save;
|
||||
|
||||
if (_player)
|
||||
if (_player != null)
|
||||
{
|
||||
if (!_player.GetLootGUID().IsEmpty())
|
||||
DoLootReleaseAll();
|
||||
@@ -113,7 +113,7 @@ namespace Game
|
||||
|
||||
//drop a flag if player is carrying it
|
||||
Battleground bg = GetPlayer().GetBattleground();
|
||||
if (bg)
|
||||
if (bg != null)
|
||||
bg.EventPlayerLoggedOut(GetPlayer());
|
||||
|
||||
// Teleport to home if the player is in an invalid instance
|
||||
@@ -140,7 +140,7 @@ namespace Game
|
||||
|
||||
// If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
|
||||
Guild guild = Global.GuildMgr.GetGuildById(_player.GetGuildId());
|
||||
if (guild)
|
||||
if (guild != null)
|
||||
guild.HandleMemberLogout(this);
|
||||
|
||||
// Remove pet
|
||||
@@ -250,7 +250,7 @@ namespace Game
|
||||
switch (handler.sessionStatus)
|
||||
{
|
||||
case SessionStatus.Loggedin:
|
||||
if (!_player)
|
||||
if (_player == null)
|
||||
{
|
||||
if (!m_playerRecentlyLogout)
|
||||
{
|
||||
@@ -266,13 +266,13 @@ namespace Game
|
||||
handler.Invoke(this, packet);
|
||||
break;
|
||||
case SessionStatus.LoggedinOrRecentlyLogout:
|
||||
if (!_player && !m_playerRecentlyLogout && !m_playerLogout)
|
||||
if (_player == null && !m_playerRecentlyLogout && !m_playerLogout)
|
||||
LogUnexpectedOpcode(packet, handler.sessionStatus, "the player has not logged in yet and not recently logout");
|
||||
else if (AntiDOS.EvaluateOpcode(packet, currentTime))
|
||||
handler.Invoke(this, packet);
|
||||
break;
|
||||
case SessionStatus.Transfer:
|
||||
if (!_player)
|
||||
if (_player == null)
|
||||
LogUnexpectedOpcode(packet, handler.sessionStatus, "the player has not logged in yet");
|
||||
else if (_player.IsInWorld)
|
||||
LogUnexpectedOpcode(packet, handler.sessionStatus, "the player is still in world");
|
||||
@@ -345,7 +345,7 @@ namespace Game
|
||||
_warden.Update(diff);
|
||||
|
||||
expireTime -= expireTime > diff ? diff : expireTime;
|
||||
if (expireTime < diff || forceExit || !GetPlayer())
|
||||
if (expireTime < diff || forceExit || GetPlayer() == null)
|
||||
{
|
||||
if (m_Socket[(int)ConnectionType.Realm] != null)
|
||||
{
|
||||
@@ -408,7 +408,7 @@ namespace Game
|
||||
|
||||
public void KickPlayer(string reason)
|
||||
{
|
||||
Log.outInfo(LogFilter.Network, $"Account: {GetAccountId()} Character: '{(_player ? _player.GetName() : "<none>")}' {(_player ? _player.GetGUID() : "")} kicked with reason: {reason}");
|
||||
Log.outInfo(LogFilter.Network, $"Account: {GetAccountId()} Character: '{(_player != null ? _player.GetName() : "<none>")}' {(_player != null ? _player.GetGUID() : "")} kicked with reason: {reason}");
|
||||
|
||||
for (byte i = 0; i < 2; ++i)
|
||||
{
|
||||
@@ -621,7 +621,7 @@ namespace Game
|
||||
{
|
||||
_player = pl;
|
||||
|
||||
if (_player)
|
||||
if (_player != null)
|
||||
m_GUIDLow = _player.GetGUID().GetCounter();
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ namespace Game
|
||||
ss.Append("[Player: ");
|
||||
if (!m_playerLoading.IsEmpty())
|
||||
ss.AppendFormat("Logging in: {0}, ", m_playerLoading.ToString());
|
||||
else if (_player)
|
||||
else if (_player != null)
|
||||
ss.AppendFormat("{0} {1}, ", _player.GetName(), _player.GetGUID().ToString());
|
||||
|
||||
ss.AppendFormat("Account: {0}]", GetAccountId());
|
||||
@@ -901,7 +901,7 @@ namespace Game
|
||||
public void SetLatency(uint latency) { m_latency = latency; }
|
||||
public void ResetTimeOutTime(bool onlyActive)
|
||||
{
|
||||
if (GetPlayer())
|
||||
if (GetPlayer() != null)
|
||||
m_timeOutTime = GameTime.GetGameTime() + WorldConfig.GetIntValue(WorldCfg.SocketTimeoutTimeActive);
|
||||
else if (!onlyActive)
|
||||
m_timeOutTime = GameTime.GetGameTime() + WorldConfig.GetIntValue(WorldCfg.SocketTimeoutTime);
|
||||
@@ -927,11 +927,6 @@ namespace Game
|
||||
void SetRealmListSecret(Array<byte> secret) { _realmListSecret = secret; }
|
||||
public Dictionary<uint, byte> GetRealmCharacterCounts() { return _realmCharacterCounts; }
|
||||
|
||||
public static implicit operator bool(WorldSession session)
|
||||
{
|
||||
return session != null;
|
||||
}
|
||||
|
||||
#region Fields
|
||||
List<ObjectGuid> _legitCharacters = new();
|
||||
ulong m_GUIDLow;
|
||||
|
||||
Reference in New Issue
Block a user