public static void Check(ClientInfo _cInfo) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { if (_player.IsAlive()) { int _deaths = XUiM_Player.GetDeaths(_player); if (_deaths < Max_Deaths) { int _lives = Max_Deaths - _deaths; string _phrase950; if (!Phrases.Dict.TryGetValue(950, out _phrase950)) { _phrase950 = "Hardcore: Zombie Kills {ZombieKills}, Player Kills {PlayerKills}, Score {Score}, Lives remaining {Lives}..."; } _phrase950 = _phrase950.Replace("{ZombieKills}", _player.KilledZombies.ToString()); _phrase950 = _phrase950.Replace("{PlayerKills}", _player.KilledPlayers.ToString()); _phrase950 = _phrase950.Replace("{Score}", _player.Score.ToString()); _phrase950 = _phrase950.Replace("{Lives}", _lives.ToString()); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase950), Config.Server_Response_Name, false, "ServerTools", false)); } else { EndGame(_cInfo, _player); } } } }
public static void Check(ClientInfo _cInfo) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { if (_player.IsAlive()) { int _deaths = XUiM_Player.GetDeaths(_player); if (_deaths < Max_Deaths) { int _lives = Max_Deaths - _deaths; string _phrase950; if (!Phrases.Dict.TryGetValue(950, out _phrase950)) { _phrase950 = "Hardcore: Zombie Kills {ZombieKills}, Player Kills {PlayerKills}, Score {Score}, Lives remaining {Lives}..."; } _phrase950 = _phrase950.Replace("{ZombieKills}", _player.KilledZombies.ToString()); _phrase950 = _phrase950.Replace("{PlayerKills}", _player.KilledPlayers.ToString()); _phrase950 = _phrase950.Replace("{Score}", _player.Score.ToString()); _phrase950 = _phrase950.Replace("{Lives}", _lives.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase950 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } else { EndGame(_cInfo, _player); } } } }
public static void WalletValue(ClientInfo _cInfo, string _playerName) { World world = GameManager.Instance.World; EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; int currentCoins = 0; if (p != null) { int spentCoins = p.PlayerSpentCoins; int gameMode = world.GetGameMode(); if (gameMode == 7) { currentCoins = (_player.KilledZombies * Zombie_Kills) + (_player.KilledPlayers * Player_Kills) - (XUiM_Player.GetDeaths(_player) * Deaths) + p.PlayerSpentCoins; } else { currentCoins = (_player.KilledZombies * Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Deaths) + p.PlayerSpentCoins; } _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} your wallet contains: {2} {3}.[-]", Config.Chat_Response_Color, _cInfo.playerName, currentCoins, Coin_Name), Config.Server_Response_Name, false, "ServerTools", false)); } else { PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = 0; PersistentContainer.Instance.Save(); WalletValue(_cInfo, _playerName); } }
public static void Check(ClientInfo _cInfo, EntityPlayer _player) { string[] _stats = PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats; if (int.TryParse(_stats[1], out int _deaths)) { if (int.TryParse(_stats[2], out int _extraLives)) { int _lives = Max_Deaths - (XUiM_Player.GetDeaths(_player) - _deaths) + _extraLives; if (_lives > 0) { string _phrase949; if (!Phrases.Dict.TryGetValue(949, out _phrase949)) { _phrase949 = "Hardcore mode is enabled! You have {Lives} lives remaining..."; } _phrase949 = _phrase949.Replace("{Lives}", _lives.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase949 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else { EndGame(_cInfo, _player, _stats); } } } }
public static void Check(ClientInfo _cInfo) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { if (_player.IsAlive()) { int _deaths = XUiM_Player.GetDeaths(_player); if (_deaths < Max_Deaths) { int _lives = Max_Deaths - _deaths; string _phrase950; if (!Phrases.Dict.TryGetValue(950, out _phrase950)) { _phrase950 = "Hardcore: Zombie Kills {ZombieKills}, Player Kills {PlayerKills}, Score {Score}, Lives remaining {Lives}..."; } _phrase950 = _phrase950.Replace("{ZombieKills}", _player.KilledZombies.ToString()); _phrase950 = _phrase950.Replace("{PlayerKills}", _player.KilledPlayers.ToString()); _phrase950 = _phrase950.Replace("{Score}", _player.Score.ToString()); _phrase950 = _phrase950.Replace("{Lives}", _lives.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase950 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } else { if (Max_Extra_Lives > 0) { string _sql = string.Format("SELECT extraLives FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); int _extraLives; int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _extraLives); _result.Dispose(); if (_deaths < Max_Deaths + _extraLives) { int _lives = (Max_Deaths + _extraLives) - _deaths; string _phrase950; if (!Phrases.Dict.TryGetValue(950, out _phrase950)) { _phrase950 = "Hardcore: Zombie Kills {ZombieKills}, Player Kills {PlayerKills}, Score {Score}, Lives remaining {Lives}..."; } _phrase950 = _phrase950.Replace("{ZombieKills}", _player.KilledZombies.ToString()); _phrase950 = _phrase950.Replace("{PlayerKills}", _player.KilledPlayers.ToString()); _phrase950 = _phrase950.Replace("{Score}", _player.Score.ToString()); _phrase950 = _phrase950.Replace("{Lives}", _lives.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase950 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } else { EndGame(_cInfo, _player); } } else { EndGame(_cInfo, _player); } } } } }
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 Exec(ClientInfo _cInfo, string _playerName, EntityPlayer _player) { Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; if (p != null) { World world = GameManager.Instance.World; int spentCoins = p.PlayerSpentCoins; int currentCoins = 0; int gameMode = world.GetGameMode(); if (gameMode == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} your wallet contains: {2} {3}.[-]", Config.Chat_Response_Color, _cInfo.playerName, currentCoins, Wallet.Coin_Name), Config.Server_Response_Name, false, "ServerTools", false)); string _phrase617; if (!Phrases.Dict.TryGetValue(617, out _phrase617)) { _phrase617 = "The shop contains the following:"; } _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase617), Config.Server_Response_Name, false, "ServerTools", false)); foreach (var _sellable in dict) { int[] _values; if (dict1.TryGetValue(_sellable.Key, out _values)) { if (_values[1] > 1) { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}# {1}: {2} {3} {4} quality for {5} {6}[-]", Config.Chat_Response_Color, _sellable.Key, _values[0], _sellable.Value[1], _values[1], _values[2], Wallet.Coin_Name), Config.Server_Response_Name, false, "ServerTools", false)); } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}# {1}: {2} {3} for {4} {5}[-]", Config.Chat_Response_Color, _sellable.Key, _values[0], _sellable.Value[1], _values[2], Wallet.Coin_Name), Config.Server_Response_Name, false, "ServerTools", false)); } } } string _phrase618; if (!Phrases.Dict.TryGetValue(618, out _phrase618)) { _phrase618 = "Type /buy # to purchase the corresponding value from the shop list. Add how many to buy multiple"; } _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase618), Config.Server_Response_Name, false, "ServerTools", false)); } else { PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = 0; PersistentContainer.Instance.Save(); Exec(_cInfo, _playerName, _player); } }
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 BuyLives(ClientInfo _cInfo) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; int _deaths = XUiM_Player.GetDeaths(_player); string _sql = string.Format("SELECT extraLives FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); int _extraLives; int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _extraLives); _result.Dispose(); if (Life_Price > 0) { if (_extraLives < Max_Extra_Lives) { int _currentCoins = Wallet.GetcurrentCoins(_cInfo); int _cost = Life_Price * _extraLives; if (_currentCoins >= _cost) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _cost); _sql = string.Format("UPDATE Players SET extraLives = {0} WHERE steamid = '{1}'", _extraLives + 1, _cInfo.playerId); SQL.FastQuery(_sql, "Hardcore"); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " you have bought one extra life." + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " you need a total of " + _cost.ToString() + " " + Wallet.Coin_Name + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " you are at the maximum extra lives." + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { if (_extraLives < Max_Extra_Lives) { _sql = string.Format("UPDATE Players SET extraLives = {0} WHERE steamid = '{1}'", _extraLives + 1, _cInfo.playerId); SQL.FastQuery(_sql, "Hardcore"); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " you have bought one extra life." + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " you are at the maximum extra lives." + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } }
public static void CommandCost(ClientInfo _cInfo, bool _announce) { World world = GameManager.Instance.World; EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; int currentCoins = 0; if (p != null) { int spentCoins = p.PlayerSpentCoins; int gameMode = world.GetGameMode(); if (gameMode == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } if (currentCoins >= Command_Cost) { GiveAnimals(_cInfo, _announce); } else { string _phrase814; if (!Phrases.Dict.TryGetValue(814, out _phrase814)) { _phrase814 = "{PlayerName} you do not have enough {WalletCoinName} in your wallet to run this command."; } _phrase814 = _phrase814.Replace("{PlayerName}", _cInfo.playerName); _phrase814 = _phrase814.Replace("{WalletCoinName}", Wallet.Coin_Name); if (_announce) { GameManager.Instance.GameMessageServer(null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase814), Config.Server_Response_Name, false, "ServerTools", false); } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase814), Config.Server_Response_Name, false, "ServerTools", false)); } } } }
public static void Check(ClientInfo _cInfo, EntityPlayer _player) { string[] _stats = PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats; if (int.TryParse(_stats[1], out int _deaths)) { if (int.TryParse(_stats[2], out int _extraLives)) { int _lives = Max_Deaths - (XUiM_Player.GetDeaths(_player) - _deaths) + _extraLives; if (_lives > 0) { Phrases.Dict.TryGetValue(595, out string _phrase595); _phrase595 = _phrase595.Replace("{Value}", _lives.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase595 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } else { EndGame(_cInfo, _player, _stats); } } } }
public static int GetcurrentCoins(ClientInfo _cInfo) { World world = GameManager.Instance.World; EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; string _sql = string.Format("SELECT playerSpentCoins FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); int _playerSpentCoins; int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _playerSpentCoins); _result.Dispose(); int _currentCoins = 0; int gameMode = world.GetGameMode(); if (gameMode == 7) { _currentCoins = (_player.KilledZombies * Zombie_Kills) + (_player.KilledPlayers * Player_Kills) - (XUiM_Player.GetDeaths(_player) * Deaths) + _playerSpentCoins; } else { _currentCoins = (_player.KilledZombies * Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Deaths) + _playerSpentCoins; } return(_currentCoins); }
public static void Walletcheck(ClientInfo _cInfo, string _item, string _playerName) { int _id; if (_item.Contains(" ")) { string[] _idAmount = _item.Split(' '); if (!int.TryParse(_idAmount[0], out _id)) { string _phrase620; if (!Phrases.Dict.TryGetValue(620, out _phrase620)) { _phrase620 = "{PlayerName} the item or amount # you are trying to buy is not an integer. Please input /buy 1 2 for example."; } _phrase620 = _phrase620.Replace("{PlayerName}", _playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase620), Config.Server_Response_Name, false, "ServerTools", false)); } else { int _amount; if (!int.TryParse(_idAmount[1], out _amount)) { string _phrase620; if (!Phrases.Dict.TryGetValue(620, out _phrase620)) { _phrase620 = "{PlayerName} the item or amount # you are trying to buy is not an integer. Please input /buy 1 2 for example."; } _phrase620 = _phrase620.Replace("{PlayerName}", _playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase620), Config.Server_Response_Name, false, "ServerTools", false)); } else { if (dict.ContainsKey(_id)) { string[] _stringValues; if (dict.TryGetValue(_id, out _stringValues)) { int[] _integerValues; if (dict1.TryGetValue(_id, out _integerValues)) { World world = GameManager.Instance.World; int currentCoins; EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; int gameMode = world.GetGameMode(); if (gameMode == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } int _newAmount = _integerValues[2] * _amount; if (currentCoins >= _newAmount) { int _newCount = _integerValues[0] * _amount; ShopPurchase(_cInfo, _stringValues[0], _newCount, _integerValues[1], _newAmount, _playerName, currentCoins, p); } else { string _phrase621; if (!Phrases.Dict.TryGetValue(621, out _phrase621)) { _phrase621 = "{PlayerName} you do not have enough {CoinName}. Your wallet balance is {WalletBalance}."; } _phrase621 = _phrase621.Replace("{PlayerName}", _playerName); _phrase621 = _phrase621.Replace("{CoinName}", Wallet.Coin_Name); _phrase621 = _phrase621.Replace("{WalletBalance}", currentCoins.ToString()); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase621), Config.Server_Response_Name, false, "ServerTools", false)); } } } } } } } else { if (int.TryParse(_item, out _id)) { if (dict.ContainsKey(_id)) { string[] _stringValues; if (dict.TryGetValue(_id, out _stringValues)) { int[] _integerValues; if (dict1.TryGetValue(_id, out _integerValues)) { World world = GameManager.Instance.World; int currentCoins; EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; int gameMode = world.GetGameMode(); if (gameMode == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } if (currentCoins >= _integerValues[2]) { ShopPurchase(_cInfo, _stringValues[0], _integerValues[0], _integerValues[1], _integerValues[2], _playerName, currentCoins, p); } else { string _phrase621; if (!Phrases.Dict.TryGetValue(621, out _phrase621)) { _phrase621 = "{PlayerName} you do not have enough {CoinName}. Your wallet balance is {WalletBalance}."; } _phrase621 = _phrase621.Replace("{PlayerName}", _playerName); _phrase621 = _phrase621.Replace("{CoinName}", Wallet.Coin_Name); _phrase621 = _phrase621.Replace("{WalletBalance}", currentCoins.ToString()); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase621), Config.Server_Response_Name, false, "ServerTools", false)); } } } } } else { string _phrase622; if (!Phrases.Dict.TryGetValue(622, out _phrase622)) { _phrase622 = "{PlayerName} there was no item # matching the shop goods. Type /shop to review the list."; } _phrase622 = _phrase622.Replace("{PlayerName}", _playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase622), Config.Server_Response_Name, false, "ServerTools", false)); } } }
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 static void OldPlayerJoined(ClientInfo _cInfo) { if (Hardcore.IsEnabled) { if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId)) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { 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); } } } } if (LoginNotice.IsEnabled && LoginNotice.dict.ContainsKey(_cInfo.playerId)) { LoginNotice.PlayerNotice(_cInfo); } if (Motd.IsEnabled) { Motd.Send(_cInfo); } if (Bloodmoon.IsEnabled) { Bloodmoon.Exec(_cInfo); } if (Shutdown.IsEnabled && Shutdown.Alert_On_Login) { Shutdown.NextShutdown(_cInfo); } if (BattleLogger.IsEnabled) { BattleLogger.AlertPlayer(_cInfo); } if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.playerId)) { Poll.Message(_cInfo); } if (ClanManager.IsEnabled) { Dictionary <string, string> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin; if (_clanRequests != null && _clanRequests.Count > 0) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "New clan requests from:[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); foreach (var _request in _clanRequests) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _request.Value + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } if (Event.Open && Event.Teams.ContainsKey(_cInfo.playerId) && PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn) { Event.Spawn(_cInfo); } else if (PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn) { PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn = false; PersistentContainer.Instance.Save(); } }
private static void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)//Spawning player { try { if (_cInfo != null) { if (_respawnReason == RespawnType.EnterMultiplayer)//New player spawned { PersistentContainer.Instance.Players[_cInfo.playerId].PlayerName = _cInfo.playerName; PersistentContainer.Instance.Save(); PersistentOperations.SessionTime(_cInfo); Timers.NewPlayerExecTimer(_cInfo); } else if (_respawnReason == RespawnType.JoinMultiplayer)//Old player spawned { PersistentContainer.Instance.Players[_cInfo.playerId].PlayerName = _cInfo.playerName; PersistentContainer.Instance.Save(); PersistentOperations.SessionTime(_cInfo); if (!PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer) { Timers.NewPlayerExecTimer(_cInfo); } else { 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) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { 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); } } _result.Dispose(); } if (LoginNotice.IsEnabled && LoginNotice.dict.ContainsKey(_cInfo.playerId)) { LoginNotice.PlayerNotice(_cInfo); } if (Motd.IsEnabled) { Motd.Send(_cInfo); } if (Bloodmoon.IsEnabled) { Bloodmoon.Exec(_cInfo); } if (AutoShutdown.IsEnabled && AutoShutdown.Alert_On_Login) { AutoShutdown.NextShutdown(_cInfo); } if (Hardcore.IsEnabled) { if (!Hardcore.Optional) { Hardcore.Alert(_cInfo); } else if (PersistentContainer.Instance.Players[_cInfo.playerId].Hardcore) { Hardcore.Alert(_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 (Event.Open) { if (Event.PlayersTeam.ContainsKey(_cInfo.playerId)) { string _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); if (!string.IsNullOrEmpty(_sql)) { DataTable _result1 = SQL.TypeQuery(_sql); bool _eventRespawn = false; if (_result1.Rows.Count > 0) { 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.TypeQuery(_sql); bool _return1 = false, _return2 = false; if (_result2.Rows.Count > 0) { 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, "API"); } _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "API"); Event.EventSpawn(_cInfo); } else if (_return2) { Event.EventSpawn(_cInfo); } } } } } if (ClanManager.IsEnabled) { List <string[]> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin; if (_clanRequests != null && _clanRequests.Count > 0) { string[] _request = _clanRequests[0]; string _playerName = _request[1]; ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "There is a request to join the group from " + _playerName + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } else if (_respawnReason == RespawnType.Died)//Player Died { PersistentOperations.SessionTime(_cInfo); if (Bloodmoon.IsEnabled && Bloodmoon.Show_On_Respawn) { Bloodmoon.Exec(_cInfo); } if (BattleLogger.IsEnabled) { BattleLogger.AlertPlayer(_cInfo); } if (Event.Open) { if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId)) { string _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); if (!string.IsNullOrEmpty(_sql)) { DataTable _result1 = SQL.TypeQuery(_sql); bool _return1 = false, _return2 = false; if (_result1.Rows.Count > 0) { 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, "API"); } _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "API"); Event.EventSpawn(_cInfo); return; } } } else { string _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); if (!string.IsNullOrEmpty(_sql)) { DataTable _result = SQL.TypeQuery(_sql); bool _eventRespawn = false; if (_result.Rows.Count > 0) { bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn); } _result.Dispose(); if (_eventRespawn) { Event.Died(_cInfo); return; } else { _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result1 = SQL.TypeQuery(_sql); bool _return1 = false, _return2 = false; if (_result1.Rows.Count > 0) { 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, "API"); } _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "API"); Event.EventSpawn(_cInfo); return; } else if (_return2) { Event.EventSpawn(_cInfo); return; } } } } } else { string _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId); if (!string.IsNullOrEmpty(_sql)) { DataTable _result1 = SQL.TypeQuery(_sql); bool _return1 = false, _return2 = false; if (_result1.Rows.Count > 0) { 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, "API"); } _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "API"); Event.EventSpawn(_cInfo); return; } } } if (Wallet.IsEnabled) { if (Wallet.Lose_On_Death) { Wallet.ClearWallet(_cInfo); } else if (Wallet.Deaths > 0) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Wallet.Deaths); } } if (Hardcore.IsEnabled) { if (!Hardcore.Optional) { Hardcore.Check(_cInfo); } else if (PersistentContainer.Instance.Players[_cInfo.playerId].Hardcore) { Hardcore.Check(_cInfo); } } if (Zones.IsEnabled && Zones.Victim.ContainsKey(_cInfo.entityId)) { string _response = " type {CommandPrivate}{Command50} to teleport back to your death position. There is a time limit."; _response = _response.Replace("{CommandPrivate}", ChatHook.Command_Private); _response = _response.Replace("{Command50}", Zones.Command50); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _response + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); PersistentContainer.Instance.Players[_cInfo.playerId].ZoneDeathTime = DateTime.Now; PersistentContainer.Instance.Save(); if (Zones.Forgive.ContainsKey(_cInfo.entityId)) { string _response2 = " type {CommandPrivate}{Command55} to release your killer from jail."; _response2 = _response2.Replace("{CommandPrivate}", ChatHook.Command_Private); _response2 = _response2.Replace("{Command55}", Jail.Command55); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _response2 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } else if (_respawnReason == RespawnType.Teleport) { } string _ip = _cInfo.ip; if (_ip.Contains(":")) { _ip = _ip.Split(':').First(); } if (!string.IsNullOrEmpty(_ip) && BattleLogger.IsEnabled && BattleLogger.LogFound && !StopServer.StopServerCountingDown && !StopServer.Shutdown && GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId).PermissionLevel > BattleLogger.Admin_Level) { if (!BattleLogger.Players.ContainsKey(_cInfo.playerId)) { BattleLogger.Players.Add(_cInfo.playerId, _cInfo.ip); } else { string _recordedIp; BattleLogger.Players.TryGetValue(_cInfo.playerId, out _recordedIp); if (_recordedIp != _ip) { BattleLogger.Players[_cInfo.playerId] = _ip; } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerSpawnedInWorld: {0}.", e.Message)); } }
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 static void EndGame(ClientInfo _cInfo, EntityPlayer _player) { DateTime _time; Players.Session.TryGetValue(_cInfo.playerId, out _time); TimeSpan varTime = DateTime.Now - _time; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; int _deaths = XUiM_Player.GetDeaths(_player); int _oldSession = PersistentContainer.Instance.Players[_cInfo.playerId, true].SessionTime; int _newSession = _oldSession + _timepassed; PersistentContainer.Instance.Players[_cInfo.playerId, true].HardcoreSessionTime = _newSession; PersistentContainer.Instance.Players[_cInfo.playerId, true].HardcoreZKills = _player.KilledZombies; PersistentContainer.Instance.Players[_cInfo.playerId, true].HardcoreDeaths = _deaths; PersistentContainer.Instance.Players[_cInfo.playerId, true].HardcoreKills = _player.KilledPlayers; PersistentContainer.Instance.Players[_cInfo.playerId, true].HardcoreScore = _player.Score; PersistentContainer.Instance.Players[_cInfo.playerId, true].HardcoreName = _cInfo.playerName; PersistentContainer.Instance.Players[_cInfo.playerId, true].BikeId = 0; PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = 0; PersistentContainer.Instance.Players[_cInfo.playerId, true].SessionTime = 0; PersistentContainer.Instance.Players[_cInfo.playerId, true].AuctionData = 0; PersistentContainer.Instance.Players[_cInfo.playerId, true].StartingItems = false; PersistentContainer.Instance.Players[_cInfo.playerId, true].FirstClaim = false; PersistentContainer.Instance.Players[_cInfo.playerId, true].IsClanOwner = false; PersistentContainer.Instance.Players[_cInfo.playerId, true].IsClanOfficer = false; PersistentContainer.Instance.Players[_cInfo.playerId, true].IsMuted = false; PersistentContainer.Instance.Players[_cInfo.playerId, true].IsJailed = false; PersistentContainer.Instance.Players[_cInfo.playerId, true].LastStuck = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastLobby = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastStuck = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CancelTime = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].SellDate = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].Log = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].JailDate = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].MuteDate = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastBike = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastBackpack = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastStuck = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastFriendTele = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CustomCommand1 = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CustomCommand2 = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CustomCommand3 = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CustomCommand4 = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CustomCommand5 = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CustomCommand6 = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CustomCommand7 = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CustomCommand8 = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CustomCommand9 = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].CustomCommand10 = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].RespawnTime = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastTravel = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastAnimals = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastVoteReward = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastGimme = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastKillme = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LastSetHome = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].RespawnTime = DateTime.Now.AddDays(-5); PersistentContainer.Instance.Players[_cInfo.playerId, true].LobbyReturn = null; PersistentContainer.Instance.Players[_cInfo.playerId, true].NewTeleSpawn = null; PersistentContainer.Instance.Players[_cInfo.playerId, true].JailName = null; PersistentContainer.Instance.Players[_cInfo.playerId, true].MuteName = null; PersistentContainer.Instance.Players[_cInfo.playerId, true].HomePosition = null; PersistentContainer.Instance.Players[_cInfo.playerId, true].HomePosition2 = null; PersistentContainer.Instance.Players[_cInfo.playerId, true].ClanName = null; PersistentContainer.Instance.Players[_cInfo.playerId, true].InvitedToClan = null; PersistentContainer.Instance.Players[_cInfo.playerId, true].LastWhisper = null; PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerName = null; PersistentContainer.Instance.Save(); if (ClanManager.ClanMember.Contains(_cInfo.playerId)) { ClanManager.ClanMember.Remove(_cInfo.playerId); } string _session = string.Format("0:00", _newSession % 60); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Hardcore Game Over: Zombie Kills {1}, Player Kills {2}, Deaths {3}, Score {4}, Playtime {5}\"", _cInfo.playerId, _player.KilledZombies, _player.KilledPlayers, _deaths, _player.Score, _newSession), (ClientInfo)null); Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; if (p != null) { string _filepath = string.Format("{0}/Player/{1}.map", GameUtils.GetSaveGameDir(), _cInfo.playerId); string _filepath1 = string.Format("{0}/Player/{1}.ttp", GameUtils.GetSaveGameDir(), _cInfo.playerId); if (File.Exists(_filepath)) { File.Delete(_filepath); } if (File.Exists(_filepath1)) { File.Delete(_filepath1); } } string _phrase951; if (!Phrases.Dict.TryGetValue(951, out _phrase951)) { _phrase951 = "Hardcore Game Over: Player {PlayerName}, Zombie Kills {ZombieKills}, Player Kills {PlayerKills}, Deaths {Deaths}, Score {Score}, Playtime {Playtime}"; } _phrase951 = _phrase951.Replace("{PlayerName}", _cInfo.playerName); _phrase951 = _phrase951.Replace("{ZombieKills}", _player.KilledZombies.ToString()); _phrase951 = _phrase951.Replace("{PlayerKills}", _player.KilledPlayers.ToString()); _phrase951 = _phrase951.Replace("{Deaths}", _deaths.ToString()); _phrase951 = _phrase951.Replace("{Score}", _player.Score.ToString()); _phrase951 = _phrase951.Replace("{Playtime}", _session); GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase951), Config.Server_Response_Name, false, "ServerTools", false); }
public static void EndGame(ClientInfo _cInfo, EntityPlayer _player) { DateTime _time; Players.Session.TryGetValue(_cInfo.playerId, out _time); TimeSpan varTime = DateTime.Now - _time; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; int _deaths = XUiM_Player.GetDeaths(_player); string _sql = string.Format("SELECT sessionTime FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); int _oldSession; int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _oldSession); _result.Dispose(); int _newSession = _oldSession + _timepassed; string _name = SQL.EscapeString(_cInfo.playerName); _sql = string.Format("UPDATE Hardcore SET sessionTime = {0}, kills = {1}, zKills = {2}, score = {3}, deaths = {4}, playerName = '{5}' WHERE steamid = '{6}'", _newSession, _player.KilledPlayers, _player.KilledZombies, _player.Score, _deaths, _name, _cInfo.playerId); SQL.FastQuery(_sql, "Hardcore"); _sql = string.Format("DELETE FROM Players WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "Hardcore"); _sql = string.Format("DELETE FROM Auction WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "Hardcore"); _sql = string.Format("DELETE FROM Waypoints WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "Hardcore"); _sql = string.Format("DELETE FROM Tracking WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "Hardcore"); _sql = string.Format("DELETE FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "Hardcore"); if (ClanManager.ClanMember.Contains(_cInfo.playerId)) { ClanManager.ClanMember.Remove(_cInfo.playerId); } string _session = string.Format("{0:00}", _newSession % 60); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Hardcore Game Over: Zombie Kills {1}, Player Kills {2}, Deaths {3}, Score {4}, Playtime {5}\"", _cInfo.playerId, _player.KilledZombies, _player.KilledPlayers, _deaths, _player.Score, _newSession), (ClientInfo)null); string _filepath = string.Format("{0}/Player/{1}.map", GameUtils.GetSaveGameDir(), _cInfo.playerId); string _filepath1 = string.Format("{0}/Player/{1}.ttp", GameUtils.GetSaveGameDir(), _cInfo.playerId); if (File.Exists(_filepath)) { File.Delete(_filepath); } if (File.Exists(_filepath1)) { File.Delete(_filepath1); } string _phrase951; if (!Phrases.Dict.TryGetValue(951, out _phrase951)) { _phrase951 = "Hardcore Game Over: Player {PlayerName}, Zombie Kills {ZombieKills}, Player Kills {PlayerKills}, Deaths {Deaths}, Score {Score}, Playtime {Playtime}"; } _phrase951 = _phrase951.Replace("{PlayerName}", _cInfo.playerName); _phrase951 = _phrase951.Replace("{ZombieKills}", _player.KilledZombies.ToString()); _phrase951 = _phrase951.Replace("{PlayerKills}", _player.KilledPlayers.ToString()); _phrase951 = _phrase951.Replace("{Deaths}", _deaths.ToString()); _phrase951 = _phrase951.Replace("{Score}", _player.Score.ToString()); _phrase951 = _phrase951.Replace("{Playtime}", _session); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase951 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); }
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); } } }
public static void TeleHome(ClientInfo _cInfo, string _playerName, bool _announce) { Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; if (p == null || p.HomePosition == null) { string _phrase11; if (!Phrases.Dict.TryGetValue(11, out _phrase11)) { _phrase11 = "{PlayerName} you do not have a home saved."; } _phrase11 = _phrase11.Replace("{PlayerName}", _cInfo.playerName); if (_announce) { GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase11), Config.Server_Response_Name, false, "ServerTools", true); } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase11), Config.Server_Response_Name, false, "ServerTools", false)); } } else { World world = GameManager.Instance.World; EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; int currentCoins = 0; int spentCoins = p.PlayerSpentCoins; int gameMode = world.GetGameMode(); if (gameMode == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } if (currentCoins >= Command_Cost) { bool _donator = false; if (Delay_Between_Uses < 1) { Home(_cInfo, p.HomePosition, _announce); } else { if (p.LastSetHome == null) { Home(_cInfo, p.HomePosition, _announce); } else { TimeSpan varTime = DateTime.Now - p.LastSetHome; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay) { if (ReservedSlots.Dict.ContainsKey(_cInfo.playerId)) { DateTime _dt; ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt); if (DateTime.Now < _dt) { _donator = true; int _newDelay = Delay_Between_Uses / 2; if (_timepassed >= _newDelay) { Home(_cInfo, p.HomePosition, _announce); } else { int _timeleft = _newDelay - _timepassed; string _phrase13; if (!Phrases.Dict.TryGetValue(13, out _phrase13)) { _phrase13 = "{PlayerName} you can only use /home or /home2 once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes."; } _phrase13 = _phrase13.Replace("{PlayerName}", _cInfo.playerName); _phrase13 = _phrase13.Replace("{DelayBetweenUses}", _newDelay.ToString()); _phrase13 = _phrase13.Replace("{TimeRemaining}", _timeleft.ToString()); if (_announce) { GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase13), Config.Server_Response_Name, false, "ServerTools", true); } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase13), Config.Server_Response_Name, false, "ServerTools", false)); } } } } } if (!_donator) { if (_timepassed >= Delay_Between_Uses) { Home(_cInfo, p.HomePosition, _announce); } else { int _timeleft = Delay_Between_Uses - _timepassed; string _phrase13; if (!Phrases.Dict.TryGetValue(13, out _phrase13)) { _phrase13 = "{PlayerName} you can only use /home or /home2 once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes."; } _phrase13 = _phrase13.Replace("{PlayerName}", _cInfo.playerName); _phrase13 = _phrase13.Replace("{DelayBetweenUses}", Delay_Between_Uses.ToString()); _phrase13 = _phrase13.Replace("{TimeRemaining}", _timeleft.ToString()); if (_announce) { GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase13), Config.Server_Response_Name, false, "ServerTools", true); } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase13), Config.Server_Response_Name, false, "ServerTools", false)); } } } } } } else { string _phrase814; if (!Phrases.Dict.TryGetValue(814, out _phrase814)) { _phrase814 = "{PlayerName} you do not have enough {WalletCoinName} in your wallet to run this command."; } _phrase814 = _phrase814.Replace("{PlayerName}", _cInfo.playerName); _phrase814 = _phrase814.Replace("{WalletCoinName}", Wallet.Coin_Name); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase814), Config.Server_Response_Name, false, "ServerTools", false)); } } }
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 static void NewLotto(ClientInfo _cInfo, string _message, string _playerName) { if (!ShuttingDown) { if (OpenLotto) { int _winnings = LottoValue * LottoEntries.Count; string _phrase536; if (!Phrases.Dict.TryGetValue(536, out _phrase536)) { _phrase536 = "{PlayerName} a lottery is open for {Value} {CoinName}. Minimum buy in is {BuyIn}. Enter it by typing /lottery enter."; } _phrase536 = _phrase536.Replace("{PlayerName}", _cInfo.playerName); _phrase536 = _phrase536.Replace("{Value}", _winnings.ToString()); _phrase536 = _phrase536.Replace("{CoinName}", Wallet.Coin_Name); _phrase536 = _phrase536.Replace("{BuyIn}", LottoValue.ToString()); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase536), Config.Server_Response_Name, false, "ServerTools", false)); } else { int _lottoValue; if (int.TryParse(_message, out _lottoValue)) { if (_lottoValue > 0) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; if (p != null) { int currentCoins; if (GameManager.Instance.World.GetGameMode() == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } if (currentCoins >= _lottoValue) { OpenLotto = true; LottoValue = _lottoValue; LottoEntries.Add(_cInfo); int _oldCoins = PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins; PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = _oldCoins - LottoValue; PersistentContainer.Instance.Save(); string _phrase538; if (!Phrases.Dict.TryGetValue(538, out _phrase538)) { _phrase538 = "{PlayerName} you have opened a new lottery for {Value} {CoinName}."; } _phrase538 = _phrase538.Replace("{PlayerName}", _cInfo.playerName); _phrase538 = _phrase538.Replace("{Value}", _lottoValue.ToString()); _phrase538 = _phrase538.Replace("{CoinName}", Wallet.Coin_Name); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase538), Config.Server_Response_Name, false, "ServerTools", false)); string _phrase539; if (!Phrases.Dict.TryGetValue(539, out _phrase539)) { _phrase539 = "A lottery has opened for {Value} {CoinName} and will draw soon. Type /lottery enter to join."; } _phrase539 = _phrase539.Replace("{Value}", LottoValue.ToString()); _phrase539 = _phrase539.Replace("{CoinName}", Wallet.Coin_Name); GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase539), Config.Server_Response_Name, false, "ServerTools", false); } else { string _phrase540; if (!Phrases.Dict.TryGetValue(540, out _phrase540)) { _phrase540 = "{PlayerName} you do not have enough {CoinName}. Earn some more and enter the lottery before it ends."; } _phrase540 = _phrase540.Replace("{PlayerName}", _cInfo.playerName); _phrase540 = _phrase540.Replace("{CoinName}", Wallet.Coin_Name); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase540), Config.Server_Response_Name, false, "ServerTools", false)); } } } else { string _phrase537; if (!Phrases.Dict.TryGetValue(537, out _phrase537)) { _phrase537 = "{PlayerName} you must type a valid integer above zero for the lottery #."; } _phrase537 = _phrase537.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase537), Config.Server_Response_Name, false, "ServerTools", false)); } } else { string _phrase537; if (!Phrases.Dict.TryGetValue(537, out _phrase537)) { _phrase537 = "{PlayerName} you must type a valid integer above zero for the lottery #."; } _phrase537 = _phrase537.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase537), Config.Server_Response_Name, false, "ServerTools", false)); } } } }
public static void EnterLotto(ClientInfo _cInfo) { if (OpenLotto) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; if (p != null) { int spentCoins = p.PlayerSpentCoins; int currentCoins = 0; if (GameManager.Instance.World.GetGameMode() == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } if (currentCoins >= LottoValue) { if (!LottoEntries.Contains(_cInfo)) { LottoEntries.Add(_cInfo); PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = p.PlayerSpentCoins - LottoValue; PersistentContainer.Instance.Save(); string _phrase541; if (!Phrases.Dict.TryGetValue(541, out _phrase541)) { _phrase541 = "{PlayerName} you have entered the lottery, good luck in the draw."; } _phrase541 = _phrase541.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase541), Config.Server_Response_Name, false, "ServerTools", false)); if (LottoEntries.Count == 10) { StartLotto(); } } else { string _phrase542; if (!Phrases.Dict.TryGetValue(542, out _phrase542)) { _phrase542 = "{PlayerName} you are already in the lottery, good luck in the draw."; } _phrase542 = _phrase542.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase542), Config.Server_Response_Name, false, "ServerTools", false)); } } else { string _phrase540; if (!Phrases.Dict.TryGetValue(540, out _phrase540)) { _phrase540 = "{PlayerName} you do not have enough {CoinName}. Earn some more and enter the lottery before it ends."; } _phrase540 = _phrase540.Replace("{PlayerName}", _cInfo.playerName); _phrase540 = _phrase540.Replace("{CoinName}", Wallet.Coin_Name); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase540), Config.Server_Response_Name, false, "ServerTools", false)); } } else { PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = 0; PersistentContainer.Instance.Save(); EnterLotto(_cInfo); } } else { string _phrase535; if (!Phrases.Dict.TryGetValue(535, out _phrase535)) { _phrase535 = "{PlayerName} there is no open lottery. Type /lottery # to open a new lottery at that buy in price. You must have enough in your wallet."; } _phrase535 = _phrase535.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase535), Config.Server_Response_Name, false, "ServerTools", false)); } }
public static void WalletCheck(ClientInfo _cInfo, int _purchase) { if (AuctionItems.ContainsKey(_purchase)) { World world = GameManager.Instance.World; EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; if (p != null) { int spentCoins = p.PlayerSpentCoins; int currentCoins = 0; int gameMode = world.GetGameMode(); if (gameMode == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } List <string> playerlist = PersistentContainer.Instance.Players.SteamIDs; for (int i = 0; i < playerlist.Count; i++) { string _steamId = playerlist[i]; Player _seller = PersistentContainer.Instance.Players[_steamId, false]; if (_seller.AuctionData == _purchase) { string[] _value; if (AuctionItems.TryGetValue(_purchase, out _value)) { int _coinValue; int.TryParse(_value[3], out _coinValue); if (currentCoins >= _coinValue) { BuyAuction(_cInfo, _purchase, _value, _steamId); } else { int _missing; if (currentCoins >= 0) { _missing = _coinValue - currentCoins; } else { _missing = _coinValue + currentCoins; } _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you can not make this purchase. You need {2} more {3}.[-]", Config.Chat_Response_Color, _cInfo.playerName, _missing, Wallet.Coin_Name), Config.Server_Response_Name, false, "ServerTools", false)); } } } } } else { PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = 0; PersistentContainer.Instance.Save(); WalletCheck(_cInfo, _purchase); } } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} this # could not be found. Please check the auction list by typing /auction.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false)); } }
public static void WalletDeposit(ClientInfo _cInfo, string _amount) { Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; { if (p != null) { int _coinAmount; if (int.TryParse(_amount, out _coinAmount)) { World world = GameManager.Instance.World; int spentCoins = p.PlayerSpentCoins; int currentCoins = 0; EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; int gameMode = world.GetGameMode(); if (gameMode == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; } if (currentCoins >= _coinAmount) { PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = spentCoins - _coinAmount; double _percent = _coinAmount * 0.05; int _newCoin = _coinAmount - (int)_percent; PersistentContainer.Instance.Players[_cInfo.playerId, true].Bank = p.Bank + _newCoin; PersistentContainer.Instance.Save(); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} deposited {2} {3} from your wallet to your bank account. 5% fee was applied.[-]", Config.Chat_Response_Color, _cInfo.playerName, _coinAmount, Wallet.Coin_Name), Config.Server_Response_Name, false, "ServerTools", false)); using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: {1} has added {2} to their bank account from their wallet.", DateTime.Now, _cInfo.playerName, _newCoin)); sw.WriteLine(); sw.Flush(); sw.Close(); } } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} your wallet does not have enough to deposit that value.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false)); } } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you input an invalid integer. Type /wallet deposit #.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false)); } } } }
public static void EndGame(ClientInfo _cInfo, EntityPlayer _player) { DateTime _time; Players.Session.TryGetValue(_cInfo.playerId, out _time); TimeSpan varTime = DateTime.Now - _time; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; int _deaths = XUiM_Player.GetDeaths(_player); string _sql = string.Format("SELECT sessionTime FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); int _oldSession; int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _oldSession); _result.Dispose(); int _newSession = _oldSession + _timepassed; _sql = string.Format("SELECT last_gimme FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result1 = SQL.TQuery(_sql); if (_result1.Rows.Count != 0) { string _name = SQL.EscapeString(_cInfo.playerName); _sql = string.Format("UPDATE Players SET " + "playername = 'Unknown', " + "last_gimme = '10/29/2000 7:30:00 AM', " + "lastkillme = '10/29/2000 7:30:00 AM', " + "playerSpentCoins = 0, " + "hardcoreSessionTime = {0}, " + "hardcoreKills = {1}, " + "hardcoreZKills = {2}, " + "hardcoreScore = {3}, " + "hardcoreDeaths = {4}, " + "hardcoreName = '{5}', " + "sessionTime = 0, " + "bikeId = 0, " + "lastBike = '10/29/2000 7:30:00 AM', " + "jailName = 'Unknown', " + "jailDate = '10/29/2000 7:30:00 AM', " + "muteName = 'Unknown', " + "muteDate = '10/29/2000 7:30:00 AM', " + "lobbyReturn = 'Unknown', " + "newTeleSpawn = 'Unknown', " + "homeposition = 'Unknown', " + "homeposition2 = 'Unknown', " + "lastsethome = '10/29/2000 7:30:00 AM', " + "lastwhisper = 'Unknown', " + "lastStuck = '10/29/2000 7:30:00 AM', " + "lastLobby = '10/29/2000 7:30:00 AM', " + "lastLog = '10/29/2000 7:30:00 AM', " + "lastDied = '10/29/2000 7:30:00 AM', " + "lastFriendTele = '10/29/2000 7:30:00 AM', " + "respawnTime = '10/29/2000 7:30:00 AM', " + "lastTravel = '10/29/2000 7:30:00 AM', " + "lastAnimals = '10/29/2000 7:30:00 AM', " + "lastVoteReward = '10/29/2000 7:30:00 AM', " + "firstClaim = 'false', " + "ismuted = 'false', " + "isjailed = 'false', " + "startingItems = 'false', " + "clanname = 'Unknown', " + "invitedtoclan = 'Unknown', " + "isclanowner = 'false', " + "isclanofficer = 'false', " + "customCommand1 = '10/29/2000 7:30:00 AM', " + "customCommand2 = '10/29/2000 7:30:00 AM', " + "customCommand3 = '10/29/2000 7:30:00 AM', " + "customCommand4 = '10/29/2000 7:30:00 AM', " + "customCommand5 = '10/29/2000 7:30:00 AM', " + "customCommand6 = '10/29/2000 7:30:00 AM', " + "customCommand7 = '10/29/2000 7:30:00 AM', " + "customCommand8 = '10/29/2000 7:30:00 AM', " + "customCommand9 = '10/29/2000 7:30:00 AM', " + "customCommand10 = '10/29/2000 7:30:00 AM' " + "WHERE steamid = '{6}'", _newSession, _player.KilledPlayers, _player.KilledZombies, _player.Score, _deaths, _name, _cInfo.playerId); SQL.FastQuery(_sql); _sql = string.Format("SELECT steamid FROM Auction WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result2 = SQL.TQuery(_sql); if (_result2.Rows.Count > 0) { _sql = string.Format("DELETE FROM Auction WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); } _result2.Dispose(); } _result1.Dispose(); if (ClanManager.ClanMember.Contains(_cInfo.playerId)) { ClanManager.ClanMember.Remove(_cInfo.playerId); } string _session = string.Format("0:00", _newSession % 60); SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Hardcore Game Over: Zombie Kills {1}, Player Kills {2}, Deaths {3}, Score {4}, Playtime {5}\"", _cInfo.playerId, _player.KilledZombies, _player.KilledPlayers, _deaths, _player.Score, _newSession), (ClientInfo)null); Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; if (p != null) { string _filepath = string.Format("{0}/Player/{1}.map", GameUtils.GetSaveGameDir(), _cInfo.playerId); string _filepath1 = string.Format("{0}/Player/{1}.ttp", GameUtils.GetSaveGameDir(), _cInfo.playerId); if (File.Exists(_filepath)) { File.Delete(_filepath); } if (File.Exists(_filepath1)) { File.Delete(_filepath1); } } string _phrase951; if (!Phrases.Dict.TryGetValue(951, out _phrase951)) { _phrase951 = "Hardcore Game Over: Player {PlayerName}, Zombie Kills {ZombieKills}, Player Kills {PlayerKills}, Deaths {Deaths}, Score {Score}, Playtime {Playtime}"; } _phrase951 = _phrase951.Replace("{PlayerName}", _cInfo.playerName); _phrase951 = _phrase951.Replace("{ZombieKills}", _player.KilledZombies.ToString()); _phrase951 = _phrase951.Replace("{PlayerKills}", _player.KilledPlayers.ToString()); _phrase951 = _phrase951.Replace("{Deaths}", _deaths.ToString()); _phrase951 = _phrase951.Replace("{Score}", _player.Score.ToString()); _phrase951 = _phrase951.Replace("{Playtime}", _session); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase951 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); }
public static void OldPlayerJoined(ClientInfo _cInfo, EntityPlayer _player) { try { if (Hardcore.IsEnabled) { if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId)) { 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; PersistentContainer.DataChange = true; Hardcore.Check(_cInfo, _player); } } } if (LoginNotice.IsEnabled && LoginNotice.dict.ContainsKey(_cInfo.playerId)) { LoginNotice.PlayerNotice(_cInfo); } if (Motd.IsEnabled) { Motd.Send(_cInfo); } if (Bloodmoon.IsEnabled) { Bloodmoon.Exec(_cInfo); } if (Shutdown.IsEnabled && Shutdown.Alert_On_Login) { Shutdown.NextShutdown(_cInfo); } if (ExitCommand.IsEnabled) { ExitCommand.AlertPlayer(_cInfo); } if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.playerId)) { Poll.Message(_cInfo); } if (ClanManager.IsEnabled) { Dictionary <string, string> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin; if (_clanRequests != null && _clanRequests.Count > 0) { ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + "New clan requests from:[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); foreach (var _request in _clanRequests) { ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _request.Value + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } } //If they are in a clan, check if we should get them into a party ClanManager.checkClanParty(_cInfo, _player); if (Event.Open && Event.Teams.ContainsKey(_cInfo.playerId) && PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn) { Event.Spawn(_cInfo); } else if (PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn) { PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn = false; PersistentContainer.DataChange = true; } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in API.OldPlayerJoined: {0}", e.Message)); } }
public static void NewBounty(ClientInfo _cInfo, string _message, string _playerName) { int _id; string[] _idAndBounty = { }; int _cost; if (_message.Contains(" ")) { _idAndBounty = _message.Split(' ').ToArray(); if (int.TryParse(_idAndBounty[0], out _id)) { if (int.TryParse(_idAndBounty[1], out _cost)) { ClientInfo _cInfo1 = ConnectionManager.Instance.GetClientInfoForEntityId(_id); if (_cInfo1 != null) { Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; if (p != null) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo1.entityId]; int _minimum = _player.Level * Bounty; if (_cost < (_player.Level * Bounty)) { _cost = _minimum; } int spentCoins = p.PlayerSpentCoins; int currentCoins = 0; int gameMode = GameManager.Instance.World.GetGameMode(); if (gameMode == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; if (!Wallet.Negative_Wallet) { if (currentCoins < 0) { currentCoins = 0; } } } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; if (!Wallet.Negative_Wallet) { if (currentCoins < 0) { currentCoins = 0; } } } if (currentCoins >= _cost) { int _newCoins = PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins - _cost; int _newBounty = PersistentContainer.Instance.Players[_cInfo1.playerId, true].Bounty + _cost; PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = _newCoins; PersistentContainer.Instance.Players[_cInfo1.playerId, true].Bounty = _newBounty; PersistentContainer.Instance.Save(); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you have added {2} bounty to {3}.[-]", Config.Chat_Response_Color, _playerName, _cost, _cInfo1.playerName), Config.Server_Response_Name, false, "ServerTools", false)); } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} .[-]", Config.Chat_Response_Color, _playerName), Config.Server_Response_Name, false, "ServerTools", false)); } } } } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} to add a custom bounty type /bounty Id# Value, or minimum with /bounty Id#.[-]", Config.Chat_Response_Color, _playerName), Config.Server_Response_Name, false, "ServerTools", false)); } } } else { if (int.TryParse(_message, out _id)) { ClientInfo _cInfo1 = ConnectionManager.Instance.GetClientInfoForEntityId(_id); if (_cInfo1 != null) { Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; if (p != null) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo1.entityId]; _cost = _player.Level * Bounty; int spentCoins = p.PlayerSpentCoins; int currentCoins = 0; int gameMode = GameManager.Instance.World.GetGameMode(); if (gameMode == 7) { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) + (_player.KilledPlayers * Wallet.Player_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; if (!Wallet.Negative_Wallet) { if (currentCoins < 0) { currentCoins = 0; } } } else { currentCoins = (_player.KilledZombies * Wallet.Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Wallet.Deaths) + p.PlayerSpentCoins; if (!Wallet.Negative_Wallet) { if (currentCoins < 0) { currentCoins = 0; } } } if (currentCoins >= _cost) { int _newCoins = PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins - _cost; int _newBounty = PersistentContainer.Instance.Players[_cInfo1.playerId, true].Bounty + _cost; PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = _newCoins; PersistentContainer.Instance.Players[_cInfo1.playerId, true].Bounty = _newBounty; PersistentContainer.Instance.Save(); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you have added {2} bounty to {3}.[-]", Config.Chat_Response_Color, _playerName, _cost, _cInfo1.playerName), Config.Server_Response_Name, false, "ServerTools", false)); } else { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you do not have enough {2} to the bounty.[-]", Config.Chat_Response_Color, _playerName, Wallet.Coin_Name), Config.Server_Response_Name, false, "ServerTools", false)); } } else { PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = 0; PersistentContainer.Instance.Save(); NewBounty(_cInfo, _message, _playerName); } } } } }