public static void CommandCost(ClientInfo _cInfo, string _message) { int _currentCoins = Wallet.GetCurrentCoins(_cInfo.playerId); if (Command_Cost >= 1) { if (_currentCoins >= Command_Cost) { MessageFriend(_cInfo, _message); } else { string _phrase814; if (!Phrases.Dict.TryGetValue(814, out _phrase814)) { _phrase814 = "You do not have enough {WalletCoinName} in your wallet to run this command."; } _phrase814 = _phrase814.Replace("{WalletCoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase814 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { MessageFriend(_cInfo, _message); } }
public static void CommandCost(ClientInfo _cInfo, string _message, int[] _c1) { if (Wallet.IsEnabled && _c1[2] > 0) { int _currentCoins = Wallet.GetCurrentCoins(_cInfo.playerId); if (_currentCoins >= _c1[2]) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _c1[2]); CommandDelay(_cInfo, _message, _c1); } else { string _phrase814; if (!Phrases.Dict.TryGetValue(814, out _phrase814)) { _phrase814 = " you do not have enough {WalletCoinName} in your wallet to run this command."; } _phrase814 = _phrase814.Replace("{WalletCoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase814 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { CommandDelay(_cInfo, _message, _c1); } }
public static void NewLotto(ClientInfo _cInfo, string _message, string _playerName) { if (!ShuttingDown) { if (OpenLotto) { int _winnings = LottoValue * LottoEntries.Count; Phrases.Dict.TryGetValue(222, out string _phrase222); _phrase222 = _phrase222.Replace("{Value}", _winnings.ToString()); _phrase222 = _phrase222.Replace("{CoinName}", Wallet.Coin_Name); _phrase222 = _phrase222.Replace("{BuyIn}", LottoValue.ToString()); _phrase222 = _phrase222.Replace("{CommandPrivate}", ChatHook.Chat_Command_Prefix1); _phrase222 = _phrase222.Replace("{Command85}", Command85); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase222 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } else { int _lottoValue; if (int.TryParse(_message, out _lottoValue)) { if (_lottoValue > 0) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= _lottoValue) { OpenLotto = true; LottoValue = _lottoValue; LottoEntries.Add(_cInfo); Wallet.SubtractCoinsFromWallet(_cInfo.playerId, LottoValue); Phrases.Dict.TryGetValue(224, out string _phrase224); _phrase224 = _phrase224.Replace("{Value}", _lottoValue.ToString()); _phrase224 = _phrase224.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase224 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); Phrases.Dict.TryGetValue(225, out string _phrase225); _phrase225 = _phrase225.Replace("{Value}", LottoValue.ToString()); _phrase225 = _phrase225.Replace("{CoinName}", Wallet.Coin_Name); _phrase225 = _phrase225.Replace("{CommandPrivate}", ChatHook.Chat_Command_Prefix1); _phrase225 = _phrase225.Replace("{Command85}", Command85); ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase225 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null); } else { Phrases.Dict.TryGetValue(226, out string _phrase226); _phrase226 = _phrase226.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase226 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } else { Phrases.Dict.TryGetValue(223, out string _phrase223); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase223 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } else { Phrases.Dict.TryGetValue(223, out string _phrase223); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase223 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } } }
public static void TeleFriend(ClientInfo _cInfo, int _invitingFriend) { ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForEntityId(_invitingFriend); if (_cInfo2 != null) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { _cInfo2.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3((int)_player.position.x, (int)_player.position.y, (int)_player.position.z), null, false)); if (Wallet.IsEnabled && Command_Cost >= 1) { if (Wallet.GetCurrentCoins(_cInfo2.playerId) >= Command_Cost) { Wallet.SubtractCoinsFromWallet(_cInfo2.playerId, Command_Cost); } else { Phrases.Dict.TryGetValue(370, out string _phrase370); _phrase370 = _phrase370.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo2, LoadConfig.Chat_Response_Color + _phrase370 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } PersistentContainer.Instance.Players[_cInfo2.playerId].LastFriendTele = DateTime.Now; PersistentContainer.Instance.Save(); Phrases.Dict.TryGetValue(367, out string _phrase367); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase367 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { Phrases.Dict.TryGetValue(371, out string _phrase371); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase371 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void WalletCheck(ClientInfo _cInfo, int _purchase) { if (AuctionItems.ContainsKey(_purchase)) { if (PersistentContainer.Instance.AuctionPrices != null) { Dictionary <int, int> _auctionPrices = PersistentContainer.Instance.AuctionPrices; int _price = 0; if (_auctionPrices.ContainsKey(_purchase)) { _auctionPrices.TryGetValue(_purchase, out _price); } int _currentCoins = Wallet.GetCurrentCoins(_cInfo.playerId); if (_currentCoins >= _price) { BuyAuction(_cInfo, _purchase, _price); } else { int _missing = _price - _currentCoins; string _message = "You can not make this purchase. You need {Value} more {Name}."; _message = _message.Replace("{Value}", _missing.ToString()); _message = _message.Replace("{Name}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } else { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "This # could not be found. Please check the auction list by typing " + ChatHook.Command_Private + Command71 + ".[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
private static void CommandCost(ClientInfo _cInfo, string _homeName, Vector3 _position, bool _friends) { try { if (Wallet.IsEnabled && Command_Cost >= 1) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { Exec(_cInfo, _homeName, _position, _friends); } else { Phrases.Dict.TryGetValue(736, out string _phrase736); _phrase736 = _phrase736.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase736 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } else { Exec(_cInfo, _homeName, _position, _friends); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Homes.CommandCost: {0}", e.Message)); } }
public static void WalletCheck(ClientInfo _cInfo, int _purchase) { if (AuctionItems.ContainsKey(_purchase)) { if (PersistentContainer.Instance.AuctionPrices != null) { Dictionary <int, int> _auctionPrices = PersistentContainer.Instance.AuctionPrices; int _price = 0; if (_auctionPrices.ContainsKey(_purchase)) { _auctionPrices.TryGetValue(_purchase, out _price); } int _currentCoins = Wallet.GetCurrentCoins(_cInfo.playerId); if (_currentCoins >= _price) { BuyAuction(_cInfo, _purchase, _price); } else { int _missing = _price - _currentCoins; Phrases.Dict.TryGetValue(627, out string _phrase627); _phrase627 = _phrase627.Replace("{Value}", _missing.ToString()); _phrase627 = _phrase627.Replace("{Name}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase627 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } } else { Phrases.Dict.TryGetValue(628, out string _phrase628); _phrase628 = _phrase628.Replace("{CommandPrivate}", ChatHook.Command_Private); _phrase628 = _phrase628.Replace("{Command71}", Command71); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase628 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } }
public static void BuyLife(ClientInfo _cInfo) { try { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { if (Max_Extra_Lives > 0) { if (PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled) { string[] _stats = PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats; int.TryParse(_stats[2], out int _extraLives); if (_extraLives < Max_Extra_Lives) { if (Life_Price < 0) { Life_Price = 0; } int _cost = Life_Price * _extraLives++; if (Wallet.GetCurrentCoins(_cInfo.playerId) >= _cost) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _cost); _stats[2] = (_extraLives + 1).ToString(); PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats = _stats; PersistentContainer.DataChange = true; Phrases.Dict.TryGetValue(597, out string _phrase597); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase597 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } else { Phrases.Dict.TryGetValue(598, out string _phrase598); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase598 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } else { Phrases.Dict.TryGetValue(599, out string _phrase599); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase599 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } else { Phrases.Dict.TryGetValue(600, out string _phrase600); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase600 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } else { Phrases.Dict.TryGetValue(599, out string _phrase599); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase599 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Hardcore.BuyLife: {0}", e.Message)); } }
public static void WalletToBankDeposit(ClientInfo _cInfo, string _amount) { int _value; if (int.TryParse(_amount, out _value)) { int _walletTotal = Wallet.GetCurrentCoins(_cInfo.playerId); if (_walletTotal >= _value) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _value); if (Deposit_Fee_Percent > 0) { int _depositFeePercent = Deposit_Fee_Percent / 100; int _depositFee = (int)_value * _depositFeePercent; int _adjustedDeposit = _value - _depositFee; AddCoinsToBank(_cInfo.playerId, _adjustedDeposit); string _message = " deposited {Value} {Name} from your wallet to your bank account." + " {Percent}" + "% fee was applied."; _message = _message.Replace("{Value}", _value.ToString()); _message = _message.Replace("{Name}", Wallet.Coin_Name); _message = _message.Replace("{Percent}", Deposit_Fee_Percent.ToString()); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); 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, _adjustedDeposit)); sw.WriteLine(); sw.Flush(); sw.Close(); } } else { AddCoinsToBank(_cInfo.playerId, _value); string _message = " deposited {Value} {Name} from your wallet to your bank account."; _message = _message.Replace("{Value}", _value.ToString()); _message = _message.Replace("{Name}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _message + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); 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, _value)); sw.WriteLine(); sw.Flush(); sw.Close(); } } } else { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " your wallet does not have enough to deposit that value.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " you input an invalid integer. Type " + ChatHook.Command_Private + Command97 + " #.", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void EnterLotto(ClientInfo _cInfo) { if (OpenLotto) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= LottoValue) { if (!LottoEntries.Contains(_cInfo)) { LottoEntries.Add(_cInfo); Wallet.SubtractCoinsFromWallet(_cInfo.playerId, LottoValue); string _phrase541; if (!Phrases.Dict.TryGetValue(541, out _phrase541)) { _phrase541 = "You have entered the lottery, good luck in the draw."; } ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase541 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); if (LottoEntries.Count == 10) { StartLotto(); } } else { string _phrase542; if (!Phrases.Dict.TryGetValue(542, out _phrase542)) { _phrase542 = "You are already in the lottery, good luck in the draw."; } ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase542 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { string _phrase540; if (!Phrases.Dict.TryGetValue(540, out _phrase540)) { _phrase540 = "You do not have enough {CoinName}. Earn some more and enter the lottery before it ends."; } _phrase540 = _phrase540.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase540 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { string _phrase535; if (!Phrases.Dict.TryGetValue(535, out _phrase535)) { _phrase535 = "There is no open lottery. Type {CommandPrivate}{Command84} # to open a new lottery at that buy in price. You must have enough in your wallet."; } _phrase535 = _phrase535.Replace("{CommandPrivate}", ChatHook.Command_Private); _phrase535 = _phrase535.Replace("{Command84}", Command84); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase535 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void BuyLife(ClientInfo _cInfo) { try { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { if (Max_Extra_Lives > 0) { if (PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled) { string[] _stats = PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats; int.TryParse(_stats[2], out int _extraLives); if (_extraLives < Max_Extra_Lives) { if (Life_Price < 0) { Life_Price = 0; } int _cost = Life_Price * _extraLives; if (Wallet.GetCurrentCoins(_cInfo.playerId) >= _cost) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _cost); _stats[2] = (_extraLives + 1).ToString(); PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats = _stats; PersistentContainer.Instance.Save(); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "You have bought one extra life." + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "You need a total of " + _cost.ToString() + " " + Wallet.Coin_Name + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "You are at the maximum extra lives." + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "You have not turned on hardcore mode." + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "You are at the maximum extra lives." + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Hardcore.BuyLife: {0}", e.Message)); } }
public static void CommandCost(ClientInfo _cInfo) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { MarketTele(_cInfo); } else { Phrases.Dict.TryGetValue(259, out string _phrase259); _phrase259 = _phrase259.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase259 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void CommandCost(ClientInfo _cInfo, Entity _player, int _vehicle) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { TeleVehicle(_cInfo, _player, _vehicle); } else { Phrases.Dict.TryGetValue(499, out string _phrase499); _phrase499 = _phrase499.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase499 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } }
private static void CommandCost(ClientInfo _cInfo) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { LobbyTele(_cInfo); } else { Phrases.Dict.TryGetValue(244, out string _phrase244); _phrase244 = _phrase244.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase244 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } }
public static void Walletcheck(ClientInfo _cInfo, string _item, int _count) { int _id; if (!int.TryParse(_item, out _id)) { string _phrase620; if (!Phrases.Dict.TryGetValue(620, out _phrase620)) { _phrase620 = "The item or amount # you are trying to buy is not an integer. Please input {CommandPrivate}{Command58} 1 2 for example."; } _phrase620 = _phrase620.Replace("{CommandPrivate}", ChatHook.Command_Private); _phrase620 = _phrase620.Replace("{Command58}", Command58); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase620 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else if (dict.ContainsKey(_id)) { string[] _stringValues; if (dict.TryGetValue(_id, out _stringValues)) { int[] _integerValues; if (dict1.TryGetValue(_id, out _integerValues)) { int _currentCoins = Wallet.GetCurrentCoins(_cInfo.playerId); int _newAmount = _integerValues[2] * _count; if (_currentCoins >= _newAmount) { int _newCount = _integerValues[0] * _count; ShopPurchase(_cInfo, _stringValues[0], _stringValues[2], _newCount, _integerValues[1], _newAmount, _currentCoins); } else { string _phrase621; if (!Phrases.Dict.TryGetValue(621, out _phrase621)) { _phrase621 = "You do not have enough {Name}. Your wallet balance is {Value}."; } _phrase621 = _phrase621.Replace("{Name}", Wallet.Coin_Name); _phrase621 = _phrase621.Replace("{Value}", _currentCoins.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase621 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } else { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "Item not found for shop purchase" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void CommandCost(ClientInfo _cInfo) { int _currentCoins = Wallet.GetCurrentCoins(_cInfo.playerId); if (_currentCoins >= Command_Cost) { TeleportPlayer(_cInfo); } else { Phrases.Dict.TryGetValue(433, out string _phrase433); _phrase433 = _phrase433.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase433 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void CommandCost(ClientInfo _cInfo) { int _currentCoins = Wallet.GetCurrentCoins(_cInfo.playerId); if (_currentCoins >= Command_Cost) { GiveAnimals(_cInfo); } else { Phrases.Dict.TryGetValue(392, out string _phrase392); _phrase392 = _phrase392.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase392 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } }
public static void CommandCost(ClientInfo _cInfo, Entity _player, int _vehicle) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { TeleVehicle(_cInfo, _player, _vehicle); } else { string _phrase814; if (!Phrases.Dict.TryGetValue(814, out _phrase814)) { _phrase814 = "You do not have enough {WalletCoinName} in your wallet to run this command."; } _phrase814 = _phrase814.Replace("{WalletCoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase814 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
private static void FCommandCost(ClientInfo _cInfo, string _waypoint, Vector3 _position) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { FExec(_cInfo, _waypoint, _position); } else { string _phrase814; if (!Phrases.Dict.TryGetValue(814, out _phrase814)) { _phrase814 = " you do not have enough {WalletCoinName} in your wallet to run this command."; } _phrase814 = _phrase814.Replace("{WalletCoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase814 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void BuyLife(ClientInfo _cInfo) { try { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { int _deaths = XUiM_Player.GetDeaths(_player); string _sql = string.Format("SELECT extraLives FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TypeQuery(_sql); if (_result.Rows.Count > 0) { int _extraLives; int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _extraLives); _result.Dispose(); if (_extraLives < Max_Extra_Lives) { if (Life_Price < 0) { Life_Price = 0; } int _cost = Life_Price * _extraLives; if (Wallet.GetCurrentCoins(_cInfo.playerId) >= _cost) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _cost); SQL.FastQuery(_sql = string.Format("UPDATE Players SET extraLives = {0} WHERE steamid = '{1}'", _extraLives + 1, _cInfo.playerId), "Hardcore"); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " you have bought one extra life." + "[-]", -1, 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 + "[-]", -1, 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." + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Hardcore.BuyLife: {0}.", e.Message)); } }
private static void CommandCost(ClientInfo _cInfo, string _waypoint, Vector3 _position, bool _friends) { if (Wallet.IsEnabled && Command_Cost >= 1) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { Exec(_cInfo, _waypoint, _position, _friends); } else { Phrases.Dict.TryGetValue(284, out string _phrase284); _phrase284 = _phrase284.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase284 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { Exec(_cInfo, _waypoint, _position, _friends); } }
private static void CommandCost(ClientInfo _cInfo) { if (Wallet.IsEnabled && Command_Cost > 0) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { StartScouting(_cInfo); } else { Phrases.Dict.TryGetValue(832, out string _phrase832); _phrase832 = _phrase832.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase832 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { StartScouting(_cInfo); } }
public static void CommandCost(ClientInfo _cInfo, ClientInfo _friend) { if (Command_Cost >= 1) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { MessageFriend(_cInfo, _friend); } else { Phrases.Dict.TryGetValue(370, out string _phrase370); _phrase370 = _phrase370.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase370 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { MessageFriend(_cInfo, _friend); } }
public static void FCost2(ClientInfo _cInfo, string _pos) { if (Wallet.IsEnabled && Command_Cost > 0) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { FHome2(_cInfo, _pos); } else { Phrases.Dict.TryGetValue(741, out string _phrase741); _phrase741 = _phrase741.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase741 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { FHome2(_cInfo, _pos); } }
public static void EnterLotto(ClientInfo _cInfo) { if (OpenLotto) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= LottoValue) { if (!LottoEntries.Contains(_cInfo)) { LottoEntries.Add(_cInfo); Wallet.SubtractCoinsFromWallet(_cInfo.playerId, LottoValue); Phrases.Dict.TryGetValue(227, out string _phrase227); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase227 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); if (LottoEntries.Count == 10) { StartLotto(); } } else { Phrases.Dict.TryGetValue(228, out string _phrase228); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase228 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } else { Phrases.Dict.TryGetValue(226, out string _phrase226); _phrase226 = _phrase226.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase226 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } else { Phrases.Dict.TryGetValue(221, out string _phrase221); _phrase221 = _phrase221.Replace("{CommandPrivate}", ChatHook.Chat_Command_Prefix1); _phrase221 = _phrase221.Replace("{Command84}", Command84); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase221 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } }
public static void FCost2(ClientInfo _cInfo, string _pos) { if (Wallet.IsEnabled && Command_Cost > 0) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { FHome2(_cInfo, _pos); } else { string _phrase814; if (!Phrases.Dict.TryGetValue(814, out _phrase814)) { _phrase814 = " you do not have enough {WalletCoinName} in your wallet to run this command."; } _phrase814 = _phrase814.Replace("{WalletCoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase814 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { FHome2(_cInfo, _pos); } }
private static void CommandCost(ClientInfo _cInfo) { if (Wallet.IsEnabled && Command_Cost > 0) { if (Wallet.GetCurrentCoins(_cInfo.playerId) >= Command_Cost) { SetBuff(_cInfo); } else { string _phrase814; if (!Phrases.Dict.TryGetValue(814, out _phrase814)) { _phrase814 = " you do not have enough {Currency} in your wallet to run this command."; } _phrase814 = _phrase814.Replace("{Currency}", TraderInfo.CurrencyItem); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase814 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { SetBuff(_cInfo); } }
public static void NewBounty(ClientInfo _cInfo, string _message) { try { if (_message.Contains(" ")) { string[] _idAndBounty = _message.Split(' ').ToArray(); if (int.TryParse(_idAndBounty[0], out int _id)) { if (int.TryParse(_idAndBounty[1], out int _bounty)) { ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForEntityId(_id); if (_cInfo2 != null) { if (_bounty < Minimum_Bounty) { _bounty = Minimum_Bounty; } int _currentCoins = Wallet.GetCurrentCoins(_cInfo.playerId); if (_currentCoins >= _bounty) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _bounty); int _currentbounty = PersistentContainer.Instance.Players[_cInfo2.playerId].Bounty; PersistentContainer.Instance.Players[_cInfo2.playerId].Bounty = _currentbounty + _bounty; using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: {1} {2} added {3} bounty to {4} {5}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _bounty, _cInfo2.playerId, _cInfo2.playerName)); sw.WriteLine(); sw.Flush(); sw.Close(); } Phrases.Dict.TryGetValue(535, out string _phrase535); _phrase535 = _phrase535.Replace("{Value}", _bounty.ToString()); _phrase535 = _phrase535.Replace("{PlayerName}", _cInfo2.playerName); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase535 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } else { Phrases.Dict.TryGetValue(534, out string _phrase534); _phrase534 = _phrase534.Replace("{Value}", _bounty.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase534 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } } else { Phrases.Dict.TryGetValue(536, out string _phrase536); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase536 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } } else { if (int.TryParse(_message, out int _id)) { ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForEntityId(_id); if (_cInfo2 != null) { int _currentCoins = Wallet.GetCurrentCoins(_cInfo.playerId); if (_currentCoins >= Minimum_Bounty) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Minimum_Bounty); int _currentbounty = PersistentContainer.Instance.Players[_cInfo2.playerId].Bounty; PersistentContainer.Instance.Players[_cInfo2.playerId].Bounty = _currentbounty + Minimum_Bounty; using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: {1} {2} added {3} bounty to {4} {5}.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, Minimum_Bounty, _cInfo2.playerId, _cInfo2.playerName)); sw.WriteLine(); sw.Flush(); sw.Close(); } Phrases.Dict.TryGetValue(535, out string _phrase535); _phrase535 = _phrase535.Replace("{Value}", Minimum_Bounty.ToString()); _phrase535 = _phrase535.Replace("{PlayerName}", _cInfo2.playerName); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase535 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } else { Phrases.Dict.TryGetValue(534, out string _phrase534); _phrase534 = _phrase534.Replace("{Value}", Minimum_Bounty.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase534 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Bounties.NewBounty: {0}", e.Message)); } }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { try { if (_params.Count < 1 || _params.Count > 2) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1 or 2, found {0}", _params.Count)); return; } if (_params[0].ToLower().Equals("off")) { if (Wallet.IsEnabled) { Wallet.IsEnabled = false; Config.WriteXml(); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wallet has been set to off")); return; } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wallet is already off")); return; } } else if (_params[0].ToLower().Equals("on")) { if (!Wallet.IsEnabled) { Wallet.IsEnabled = true; Config.WriteXml(); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wallet has been set to on")); return; } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wallet is already on")); return; } } else if (_params[0].ToLower().Equals("all")) { if (!int.TryParse(_params[1], out int _adjustCoins)) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not adjust wallet. Value {0} is invalid", _params[1])); } else { List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (_cInfo != null) { if (_adjustCoins >= 0) { Wallet.AddCoinsToWallet(_cInfo.playerId, _adjustCoins); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added {0} {1} to player id {2} wallet", _params[1], Wallet.Coin_Name, _params[0])); } else { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _adjustCoins); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Subtracted {0} {1} from player id {2} wallet", _params[1], Wallet.Coin_Name, _params[0])); } } } } } else if (_params.Count == 2) { if (_params[0].Length < 1 || _params[0].Length > 17) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not adjust wallet: Invalid Id {0}", _params[0])); return; } if (_params[1].Length < 1 || _params[1].Length > 5) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not adjust wallet. Value {0} is invalid", _params[1])); return; } if (!int.TryParse(_params[1], out int _adjustCoins)) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not adjust wallet. Value {0} is invalid", _params[1])); } else { PersistentPlayer p = PersistentContainer.Instance.Players[_params[0]]; if (p != null) { Wallet.AddCoinsToWallet(_params[0], _adjustCoins); if (_adjustCoins >= 0) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added {0} {1} to player id {2} wallet", _params[1], Wallet.Coin_Name, _params[0])); } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Subtracted {0} {1} from player id {2} wallet", _params[1], Wallet.Coin_Name, _params[0])); } } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Player id not found: {0}", _params[0])); } } } else if (_params.Count == 1) { if (_params[0].Length < 1 || _params[0].Length > 17) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not check wallet value: Invalid Id {0}", _params[0])); return; } int _currentWallet = Wallet.GetCurrentCoins(_params[0]); string _playerName = PersistentContainer.Instance.Players[_params[0]].PlayerName; if (string.IsNullOrEmpty(_playerName)) { _playerName = "Unknown"; } SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Player with id {0}, named {1}, has a wallet value of: {2}", _params[0], _playerName, _currentWallet)); } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0])); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in WalletConsole.Execute: {0}", e.Message)); } }
public static void WalletToBankDeposit(ClientInfo _cInfo, string _amount) { try { if (int.TryParse(_amount, out int _value)) { int _walletTotal = Wallet.GetCurrentCoins(_cInfo.playerId); if (_walletTotal >= _value) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _value); if (Deposit_Fee_Percent > 0) { float _fee = _value * ((float)Deposit_Fee_Percent / 100); int _adjustedDeposit = _value - (int)_fee; AddCoinsToBank(_cInfo.playerId, _adjustedDeposit); using (StreamWriter sw = new StreamWriter(filepath, true, Encoding.UTF8)) { sw.WriteLine(string.Format("{0}: {1} has added {2} to their bank account from their wallet.", DateTime.Now, _cInfo.playerName, _adjustedDeposit)); sw.WriteLine(); sw.Flush(); sw.Close(); } Phrases.Dict.TryGetValue(653, out string _phrase653); _phrase653 = _phrase653.Replace("{Value}", _value.ToString()); _phrase653 = _phrase653.Replace("{CoinName}", Wallet.Coin_Name); _phrase653 = _phrase653.Replace("{Percent}", Deposit_Fee_Percent.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase653 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } else { AddCoinsToBank(_cInfo.playerId, _value); using (StreamWriter sw = new StreamWriter(filepath, true, Encoding.UTF8)) { sw.WriteLine(string.Format("{0}: {1} {2} has added {3} to their bank account from their wallet.", DateTime.Now, _cInfo.playerId, _cInfo.playerName, _value)); sw.WriteLine(); sw.Flush(); sw.Close(); } Phrases.Dict.TryGetValue(654, out string _phrase654); _phrase654 = _phrase654.Replace("{Value}", _value.ToString()); _phrase654 = _phrase654.Replace("{CoinName}", Wallet.Coin_Name); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase654 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } else { Phrases.Dict.TryGetValue(655, out string _phrase655); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase655 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } else { Phrases.Dict.TryGetValue(656, out string _phrase656); _phrase656 = _phrase656.Replace("{CommandPrivate}", ChatHook.Chat_Command_Prefix1); _phrase656 = _phrase656.Replace("{Command97}", Command97); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase656 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Bank.WalletToBankDeposit: {0}", e.Message)); } }