public static void NewPlayerExec3(ClientInfo _cInfo, EntityPlayer _player) { try { if (NewPlayer.IsEnabled) { NewPlayer.Exec(_cInfo); } if (Motd.IsEnabled) { Motd.Send(_cInfo); } if (Bloodmoon.IsEnabled) { Bloodmoon.Exec(_cInfo); } if (BattleLogger.IsEnabled) { BattleLogger.AlertPlayer(_cInfo); } if (PollConsole.IsEnabled) { string _sql = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'"; if (!string.IsNullOrEmpty(_sql)) { DataTable _result = SQL.TypeQuery(_sql); if (_result.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId)) { PollConsole.Message(_cInfo); } _result.Dispose(); } } if (Hardcore.IsEnabled && !Hardcore.Optional) { string _sql = string.Format("SELECT * FROM Hardcore WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TypeQuery(_sql); if (_result.Rows.Count == 0) { int _deaths = XUiM_Player.GetDeaths(_player); string _playerName = SQL.EscapeString(_cInfo.playerName); SQL.FastQuery(string.Format("INSERT INTO Hardcore (steamid, playerName, deaths) VALUES ('{0}', '{1}', {2})", _cInfo.playerId, _playerName, _deaths), null); } else { SQL.FastQuery(_sql = string.Format("UPDATE Hardcore SET deaths = {0} WHERE steamid = '{1}'", 0, _cInfo.playerId), "Hardcore"); } _result.Dispose(); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in API.NewPlayerExec3: {0}.", e.Message)); } PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer = true; PersistentContainer.Instance.Save(); }
public static void NewPlayerExec() { ClientInfo _cInfo = Que[0]; EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_cInfo != null && _player.IsSpawned()) { if (Motd.IsEnabled & Motd.Show_On_Respawn) { Motd.Send(_cInfo); } if (Bloodmoon.Show_On_Login && Bloodmoon.Show_On_Respawn) { Bloodmoon.GetBloodmoon(_cInfo, false); } 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); } string _name = SQL.EscapeString(_cInfo.playerName); _name = Regex.Replace(_name, @"[^\u0000-\u007F]+", string.Empty); _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, "API"); Que.RemoveAt(0); } }
public static void NewPlayerExec3(ClientInfo _cInfo, EntityPlayer _player) { try { if (NewPlayer.IsEnabled) { NewPlayer.Exec(_cInfo); } if (Motd.IsEnabled) { Motd.Send(_cInfo); } if (Bloodmoon.IsEnabled) { Bloodmoon.Exec(_cInfo); } if (BattleLogger.IsEnabled) { BattleLogger.AlertPlayer(_cInfo); } if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.playerId)) { Poll.Message(_cInfo); } if (Hardcore.IsEnabled) { if (Hardcore.Optional) { if (PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled) { Hardcore.Check(_cInfo, _player); } } else if (!PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled) { string[] _hardcoreStats = { _cInfo.playerName, XUiM_Player.GetDeaths(_player).ToString(), "0" }; PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats = _hardcoreStats; PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled = true; Hardcore.Check(_cInfo, _player); } } PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer = true; PersistentContainer.Instance.Save(); } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in API.NewPlayerExec3: {0}", e.Message)); } }
public static void ProcessPlayer(ClientInfo _cInfo, EntityPlayer _player) { try { string id = _cInfo.CrossplatformId.CombinedString; if (NewPlayer.IsEnabled) { NewPlayer.Exec(_cInfo); } if (Motd.IsEnabled) { Motd.Send(_cInfo); } if (Bloodmoon.IsEnabled) { Bloodmoon.Exec(_cInfo); } if (ExitCommand.IsEnabled) { ExitCommand.AlertPlayer(_cInfo); } if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(id)) { Poll.Message(_cInfo); } if (Hardcore.IsEnabled) { if (Hardcore.Optional) { if (PersistentContainer.Instance.Players[id].HardcoreEnabled) { Hardcore.Check(_cInfo, _player); } } else if (!PersistentContainer.Instance.Players[id].HardcoreEnabled) { string[] hardcoreStats = { _cInfo.playerName, "0", "0" }; PersistentContainer.Instance.Players[id].HardcoreStats = hardcoreStats; PersistentContainer.Instance.Players[id].HardcoreEnabled = true; PersistentContainer.DataChange = true; Hardcore.Check(_cInfo, _player); } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in API.ProcessPlayer: {0}", e.Message)); } }
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); } } }