public void PlayerDisconnected(ClientInfo _cInfo, bool _bShutdown) { if (_cInfo != null) { if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId)) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { string _sql = string.Format("UPDATE Players SET zkills = {0}, kills = {1}, deaths = {2} WHERE steamid = '{3}'", XUiM_Player.GetZombieKills(_player), XUiM_Player.GetPlayerKills(_player), XUiM_Player.GetDeaths(_player), _cInfo.playerId); SQL.FastQuery(_sql); if (Wallet.IsEnabled) { int _currentCoins = Wallet.GetcurrentCoins(_cInfo); _sql = string.Format("UPDATE Players SET wallet = {0} WHERE steamid = '{1}'", _currentCoins, _cInfo.playerId); SQL.FastQuery(_sql); } } } if (HatchElevator.LastPositionY.ContainsKey(_cInfo.entityId)) { HatchElevator.LastPositionY.Remove(_cInfo.entityId); } if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId)) { FriendTeleport.Dict.Remove(_cInfo.entityId); FriendTeleport.Dict1.Remove(_cInfo.entityId); } if (Players.ZoneExit.ContainsKey(_cInfo.entityId)) { Players.ZoneExit.Remove(_cInfo.entityId); Players.Forgive.Remove(_cInfo.entityId); Players.Victim.Remove(_cInfo.entityId); } if (FlightCheck.Flag.ContainsKey(_cInfo.entityId)) { FlightCheck.Flag.Remove(_cInfo.entityId); } if (FlightCheck.fLastPositionXZ.ContainsKey(_cInfo.entityId)) { FlightCheck.fLastPositionXZ.Remove(_cInfo.entityId); } if (FlightCheck.fLastPositionY.ContainsKey(_cInfo.entityId)) { FlightCheck.fLastPositionY.Remove(_cInfo.entityId); } if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId)) { FriendTeleport.Dict.Remove(_cInfo.entityId); } if (FriendTeleport.Dict1.ContainsKey(_cInfo.entityId)) { FriendTeleport.Dict1.Remove(_cInfo.entityId); } if (Travel.Flag.Contains(_cInfo.entityId)) { Travel.Flag.Remove(_cInfo.entityId); } if (UndergroundCheck.Flag.ContainsKey(_cInfo.entityId)) { UndergroundCheck.Flag.Remove(_cInfo.entityId); } if (UndergroundCheck.uLastPositionXZ.ContainsKey(_cInfo.entityId)) { UndergroundCheck.uLastPositionXZ.Remove(_cInfo.entityId); } if (Wallet.IsEnabled) { string _sql2 = string.Format("SELECT steamid FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result2 = SQL.TQuery(_sql2); if (_result2.Rows.Count > 0) { DateTime _time; if (Players.Session.TryGetValue(_cInfo.playerId, out _time)) { TimeSpan varTime = DateTime.Now - _time; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; if (_timepassed > 60) { int _hours = _timepassed / 60 * 10; Wallet.AddCoinsToWallet(_cInfo.playerId, _hours); } string _sql1 = string.Format("SELECT sessionTime FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result1 = SQL.TQuery(_sql1); int _sessionTime; int.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _sessionTime); _result1.Dispose(); _sql1 = string.Format("UPDATE Players SET sessionTime = {0} WHERE steamid = '{1}'", _sessionTime + _timepassed, _cInfo.playerId); SQL.FastQuery(_sql1); } } _result2.Dispose(); } if (Players.Session.ContainsKey(_cInfo.playerId)) { Players.Session.Remove(_cInfo.playerId); } if (Bank.TransferId.ContainsKey(_cInfo.playerId)) { Bank.TransferId.Remove(_cInfo.playerId); } if (Zones.reminder.ContainsKey(_cInfo.entityId)) { Zones.reminder.Remove(_cInfo.entityId); } } }
public override void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos) { if (Motd.IsEnabled & Motd.Show_On_Respawn) { Motd.Send(_cInfo); } if (Bloodmoon.Show_On_Login && Bloodmoon.Show_On_Respawn) { Bloodmoon.GetBloodmoon(_cInfo, false); } if (_respawnReason == RespawnType.EnterMultiplayer) { if (NewSpawnTele.IsEnabled) { NewSpawnTele.TeleNewSpawn(_cInfo); } if (StartingItems.IsEnabled) { if (!NewSpawnTele.IsEnabled) { StartingItems.StartingItemCheck(_cInfo); } else if (NewSpawnTele.New_Spawn_Tele_Position != "0,0,0") { StartingItems.Que.Add(_cInfo.playerId); } else { StartingItems.StartingItemCheck(_cInfo); } } if (PersistentContainer.Instance.PollOpen && !Poll.PolledYes.Contains(_cInfo.entityId) && !Poll.PolledNo.Contains(_cInfo.entityId)) { Poll.Message(_cInfo); } if (Hardcore.IsEnabled) { Hardcore.Announce(_cInfo); } PersistentContainer.Instance.Players[_cInfo.playerId, true].SessionTime = 0; PersistentContainer.Instance.Players[_cInfo.playerId, true].ZKills = 0; PersistentContainer.Instance.Players[_cInfo.playerId, true].Deaths = 0; PersistentContainer.Instance.Players[_cInfo.playerId, true].Kills = 0; PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = 0; PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerName = _cInfo.playerName; PersistentContainer.Instance.Save(); } if (_respawnReason == RespawnType.JoinMultiplayer) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; int _zCount = XUiM_Player.GetZombieKills(_player); int _deathCount = XUiM_Player.GetDeaths(_player); int _killCount = XUiM_Player.GetPlayerKills(_player); Players.FriendList(_cInfo); if (PersistentContainer.Instance.PollOpen && !Poll.PolledYes.Contains(_cInfo.entityId) && !Poll.PolledNo.Contains(_cInfo.entityId)) { Poll.Message(_cInfo); } if (Hardcore.IsEnabled) { Hardcore.Check(_cInfo); } if (PersistentContainer.Instance.Players[_cInfo.playerId, true].EventReturn != null) { Event.OfflineReturn(_cInfo); } PersistentContainer.Instance.Players[_cInfo.playerId, true].ZKills = _zCount; PersistentContainer.Instance.Players[_cInfo.playerId, true].Deaths = _deathCount; PersistentContainer.Instance.Players[_cInfo.playerId, true].Kills = _killCount; PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerName = _cInfo.playerName; PersistentContainer.Instance.Save(); } if (_respawnReason == RespawnType.Died) { if (Hardcore.IsEnabled) { Hardcore.Check(_cInfo); } EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; PersistentContainer.Instance.Players[_cInfo.playerId, true].Deaths = XUiM_Player.GetDeaths(_player); PersistentContainer.Instance.Save(); if (Event.Open && Event.SpawnList.Contains(_cInfo.entityId)) { Event.Died(_cInfo); } if (Zones.IsEnabled && Players.Victim.ContainsKey(_cInfo.entityId)) { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Type /return to teleport back to your death position. There is a time limit.[-]", Config.Chat_Response_Color), Config.Server_Response_Name, false, "ServerTools", false)); PersistentContainer.Instance.Players[_cInfo.playerId, true].RespawnTime = DateTime.Now; PersistentContainer.Instance.Save(); if (Players.Forgive.ContainsKey(_cInfo.entityId)) { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Type /forgive to release your killer from jail.[-]", Config.Chat_Response_Color), Config.Server_Response_Name, false, "ServerTools", false)); } } } if (_respawnReason == RespawnType.Teleport) { if (StartingItems.IsEnabled && StartingItems.Que.Contains(_cInfo.playerId)) { StartingItems.StartingItemCheck(_cInfo); StartingItems.Que.Remove(_cInfo.playerId); } if (Players.NoFlight.Contains(_cInfo.entityId)) { Players.NoFlight.Remove(_cInfo.entityId); } if (HatchElevator.IsEnabled) { HatchElevator.LastPositionY.Remove(_cInfo.entityId); } } if (Players.Dead.Contains(_cInfo.entityId)) { Players.Dead.Remove(_cInfo.entityId); } }
public void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos) { if (_cInfo != null) { string _name = SQL.EscapeString(_cInfo.playerName); if (Motd.IsEnabled & Motd.Show_On_Respawn) { Motd.Send(_cInfo); } if (Bloodmoon.Show_On_Login && Bloodmoon.Show_On_Respawn) { Bloodmoon.GetBloodmoon(_cInfo, false); } if (_respawnReason == RespawnType.EnterMultiplayer) { if (NewPlayer.IsEnabled) { NewPlayer.Exec(_cInfo); } if (NewSpawnTele.IsEnabled) { NewSpawnTele.TeleNewSpawn(_cInfo); } if (StartingItems.IsEnabled) { if (!NewSpawnTele.IsEnabled) { StartingItems.StartingItemCheck(_cInfo); } else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position != "0,0,0") { StartingItems.Que.Add(_cInfo.playerId); } else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position == "0,0,0") { StartingItems.StartingItemCheck(_cInfo); } } string _sql = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'"; DataTable _result1 = SQL.TQuery(_sql); if (_result1.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId)) { PollConsole.Message(_cInfo); } _result1.Dispose(); if (Hardcore.IsEnabled) { Hardcore.Announce(_cInfo); } _sql = string.Format("UPDATE Players SET playername = '{0}', wallet = 0, playerSpentCoins = 0, sessionTime = 0, zkills = 0, kills = 0, deaths = 0 WHERE steamid = '{1}'", _name, _cInfo.playerId); SQL.FastQuery(_sql); } if (_respawnReason == RespawnType.JoinMultiplayer) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; int _zCount = XUiM_Player.GetZombieKills(_player); int _deathCount = XUiM_Player.GetDeaths(_player); int _killCount = XUiM_Player.GetPlayerKills(_player); string _sql = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'"; DataTable _result = SQL.TQuery(_sql); if (_result.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId)) { PollConsole.Message(_cInfo); } _result.Dispose(); if (Event.Open) { if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId)) { if (Hardcore.IsEnabled) { Hardcore.Check(_cInfo); } } else { _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result1 = SQL.TQuery(_sql); bool _eventRespawn; bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn); _result1.Dispose(); if (_eventRespawn) { Event.Died(_cInfo); } else { _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result2 = SQL.TQuery(_sql); bool _return1 = false, _return2 = false; bool.TryParse(_result2.Rows[0].ItemArray.GetValue(0).ToString(), out _return1); bool.TryParse(_result2.Rows[0].ItemArray.GetValue(1).ToString(), out _return2); _result2.Dispose(); if (_return1) { if (_return2) { _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); } _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); Event.EventReturn(_cInfo); } else if (_return2) { Event.EventSpawn(_cInfo); } } } } else { if (Hardcore.IsEnabled) { Hardcore.Check(_cInfo); } } _sql = string.Format("UPDATE Players SET playername = '{0}', zkills = {1}, kills = {2}, deaths = {3} WHERE steamid = '{4}'", _name, _zCount, _killCount, _deathCount, _cInfo.playerId); SQL.FastQuery(_sql); if (Mogul.IsEnabled) { if (Wallet.IsEnabled) { int currentCoins = Wallet.GetcurrentCoins(_cInfo); _sql = string.Format("UPDATE Players SET wallet = {0} WHERE steamid = '{1}'", currentCoins, _cInfo.playerId); SQL.FastQuery(_sql); } } } if (_respawnReason == RespawnType.Died) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (Event.Open) { if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId)) { if (Wallet.Lose_On_Death) { Wallet.ClearWallet(_cInfo); } if (Hardcore.IsEnabled) { Hardcore.Check(_cInfo); } string _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result1 = SQL.TQuery(_sql); bool _return1 = false, _return2 = false; bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1); bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2); _result1.Dispose(); if (_return1) { if (_return2) { _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); } _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); Event.EventReturn(_cInfo); } } else { string _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); bool _eventRespawn; bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn); _result.Dispose(); if (_eventRespawn) { Event.Died(_cInfo); } else { _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result1 = SQL.TQuery(_sql); bool _return1 = false, _return2 = false; bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1); bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2); _result1.Dispose(); if (_return1) { if (_return2) { _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); } _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); Event.EventReturn(_cInfo); } else if (_return2) { Event.EventSpawn(_cInfo); } } } } else { if (Wallet.Lose_On_Death) { Wallet.ClearWallet(_cInfo); } if (Hardcore.IsEnabled) { Hardcore.Check(_cInfo); } string _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result1 = SQL.TQuery(_sql); bool _return1 = false, _return2 = false; bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1); bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2); _result1.Dispose(); if (_return1) { if (_return2) { _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); } _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); Event.EventReturn(_cInfo); } } string _sql2 = string.Format("UPDATE Players SET deaths = {0} WHERE steamid = '{1}'", XUiM_Player.GetDeaths(_player), _cInfo.playerId); SQL.FastQuery(_sql2); if (Zones.IsEnabled && Players.Victim.ContainsKey(_cInfo.entityId)) { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + ", type /return to teleport back to your death position. There is a time limit.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); _sql2 = string.Format("UPDATE Players SET respawnTime = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId); SQL.FastQuery(_sql2); if (Players.Forgive.ContainsKey(_cInfo.entityId)) { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + ", type /forgive to release your killer from jail.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } if (Mogul.IsEnabled) { if (Wallet.IsEnabled) { int currentCoins = Wallet.GetcurrentCoins(_cInfo); _sql2 = string.Format("UPDATE Players SET wallet = {0} WHERE steamid = '{1}'", currentCoins, _cInfo.playerId); SQL.FastQuery(_sql2); } } } if (_respawnReason == RespawnType.Teleport) { if (StartingItems.IsEnabled && StartingItems.Que.Contains(_cInfo.playerId)) { StartingItems.StartingItemCheck(_cInfo); StartingItems.Que.Remove(_cInfo.playerId); } if (Players.NoFlight.Contains(_cInfo.entityId)) { Players.NoFlight.Remove(_cInfo.entityId); } if (HatchElevator.IsEnabled) { HatchElevator.LastPositionY.Remove(_cInfo.entityId); } } if (Players.Dead.Contains(_cInfo.entityId)) { Players.Dead.Remove(_cInfo.entityId); } } }
public override void PlayerDisconnected(ClientInfo _cInfo, bool _bShutdown) { if (_cInfo != null) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { if (_player.IsAlive()) { PersistentContainer.Instance.Players[_cInfo.playerId, true].ZKills = XUiM_Player.GetZombieKills(_player); PersistentContainer.Instance.Players[_cInfo.playerId, true].Deaths = XUiM_Player.GetDeaths(_player); PersistentContainer.Instance.Players[_cInfo.playerId, true].Kills = XUiM_Player.GetPlayerKills(_player); PersistentContainer.Instance.Save(); } } if (HatchElevator.LastPositionY.ContainsKey(_cInfo.entityId)) { HatchElevator.LastPositionY.Remove(_cInfo.entityId); } if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId)) { FriendTeleport.Dict.Remove(_cInfo.entityId); FriendTeleport.Dict1.Remove(_cInfo.entityId); } if (Players.ZoneExit.ContainsKey(_cInfo.entityId)) { Players.ZoneExit.Remove(_cInfo.entityId); Players.Forgive.Remove(_cInfo.entityId); Players.Victim.Remove(_cInfo.entityId); } if (FlightCheck.Flag.ContainsKey(_cInfo.entityId)) { FlightCheck.Flag.Remove(_cInfo.entityId); } if (FlightCheck.fLastPositionXZ.ContainsKey(_cInfo.entityId)) { FlightCheck.fLastPositionXZ.Remove(_cInfo.entityId); } if (FlightCheck.fLastPositionY.ContainsKey(_cInfo.entityId)) { FlightCheck.fLastPositionY.Remove(_cInfo.entityId); } if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId)) { FriendTeleport.Dict.Remove(_cInfo.entityId); } if (FriendTeleport.Dict1.ContainsKey(_cInfo.entityId)) { FriendTeleport.Dict1.Remove(_cInfo.entityId); } if (Travel.Flag.Contains(_cInfo.entityId)) { Travel.Flag.Remove(_cInfo.entityId); } if (UndergroundCheck.Flag.ContainsKey(_cInfo.entityId)) { UndergroundCheck.Flag.Remove(_cInfo.entityId); } if (UndergroundCheck.uLastPositionXZ.ContainsKey(_cInfo.entityId)) { UndergroundCheck.uLastPositionXZ.Remove(_cInfo.entityId); } if (PersistentContainer.Instance.Players[_cInfo.playerId, false] != null) { DateTime _time; if (Players.Session.TryGetValue(_cInfo.playerId, out _time)) { TimeSpan varTime = DateTime.Now - _time; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; if (_timepassed > 60) { int _hours = _timepassed / 60 * 10; int _oldCoin = PersistentContainer.Instance.Players[_cInfo.playerId, false].PlayerSpentCoins; PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = _oldCoin + _hours; } int _oldSession = PersistentContainer.Instance.Players[_cInfo.playerId, false].SessionTime; PersistentContainer.Instance.Players[_cInfo.playerId, true].SessionTime = _oldSession + _timepassed; PersistentContainer.Instance.Save(); } } if (Players.Session.ContainsKey(_cInfo.playerId)) { Players.Session.Remove(_cInfo.playerId); } if (Bank.TransferId.ContainsKey(_cInfo.playerId)) { Bank.TransferId.Remove(_cInfo.playerId); } } }