Beispiel #1
0
 private static void CommandCost(ClientInfo _cInfo, string _waypoint, EntityPlayer _player)
 {
     if (Wallet.IsEnabled && Command_Cost >= 1)
     {
         int _currentCoins = Wallet.GetcurrentCoins(_cInfo);
         if (_currentCoins >= Command_Cost)
         {
             Exec(_cInfo, _waypoint, _player);
         }
         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 + _phrase814 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     else
     {
         Exec(_cInfo, _waypoint, _player);
     }
 }
Beispiel #2
0
        public static void CommandCost(ClientInfo _cInfo, bool _announce)
        {
            int _currentCoins = Wallet.GetcurrentCoins(_cInfo);

            if (_currentCoins >= Command_Cost)
            {
                GiveAnimals(_cInfo, _announce);
            }
            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);
                if (_announce)
                {
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase814 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                }
                else
                {
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase814 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
            }
        }
Beispiel #3
0
 public static void EnterLotto(ClientInfo _cInfo)
 {
     if (OpenLotto)
     {
         int _currentCoins = Wallet.GetcurrentCoins(_cInfo);
         if (_currentCoins >= 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, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase541 + "[-]", _cInfo.entityId, 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, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase542 + "[-]", _cInfo.entityId, 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, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase540 + "[-]", _cInfo.entityId, 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, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase535 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Beispiel #4
0
        public static void WalletDeposit(ClientInfo _cInfo, string _amount)
        {
            int _coinAmount;

            if (int.TryParse(_amount, out _coinAmount))
            {
                int _currentCoins = Wallet.GetcurrentCoins(_cInfo);
                if (_currentCoins >= _coinAmount)
                {
                    string    _sql    = string.Format("SELECT bank, playerSpentCoins FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                    DataTable _result = SQL.TQuery(_sql);
                    int       _bank;
                    int       _playerSpentCoins;
                    int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _bank);
                    int.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _playerSpentCoins);
                    _result.Dispose();
                    double _percent  = _coinAmount * 0.05;
                    int    _newCoin  = _coinAmount - (int)_percent;
                    double _newLimit = Limit + (Limit * 0.05);
                    if (_bank + _coinAmount <= (int)_newLimit)
                    {
                        _sql = string.Format("UPDATE Players SET bank = {0}, playerSpentCoins = {1} WHERE steamid = '{2}'", _bank + _newCoin, _playerSpentCoins - _coinAmount, _cInfo.playerId);
                        SQL.FastQuery(_sql);
                        string _message = "deposited {Value} {Name} from your wallet to your bank account. 5% fee was applied.";
                        _message = _message.Replace("{Value}", _coinAmount.ToString());
                        _message = _message.Replace("{Name}", Wallet.Coin_Name);
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, 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, _newCoin));
                            sw.WriteLine();
                            sw.Flush();
                            sw.Close();
                        }
                    }
                    else
                    {
                        string _message = "your bank can not hold this much. The bank can hold {Limit} total. You currently have {Value}.";
                        _message = _message.Replace("{Limit}", Limit.ToString());
                        _message = _message.Replace("{Value}", _bank.ToString());
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
                else
                {
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", your wallet does not have enough to deposit that value.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
            }
            else
            {
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you input an invalid integer. Type " + ChatHook.Command_Private + Command97 + " #.", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Beispiel #5
0
        public static void Walletcheck(ClientInfo _cInfo, string _playerName, 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, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase620 + "[-]", _cInfo.entityId, 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);
                            int _newAmount    = _integerValues[2] * _count;
                            if (_currentCoins >= _newAmount)
                            {
                                int _newCount = _integerValues[0] * _count;
                                ShopPurchase(_cInfo, _stringValues[0], _newCount, _integerValues[1], _newAmount, _playerName, _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, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase621 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                            }
                        }
                    }
                }
            }
        }
Beispiel #6
0
        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);
                }
            }
        }
Beispiel #7
0
        public static void WalletCheck(ClientInfo _cInfo, int _purchase)
        {
            string    _sql    = string.Format("SELECT itemPrice FROM Auction WHERE auctionid = {0}", _purchase);
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                int _coinValue;
                int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _coinValue);
                int _currentCoins = Wallet.GetcurrentCoins(_cInfo);
                if (_currentCoins >= _coinValue)
                {
                    BuyAuction(_cInfo, _purchase);
                }
                else
                {
                    int _missing;
                    if (_currentCoins >= 0)
                    {
                        _missing = _coinValue - _currentCoins;
                    }
                    else
                    {
                        _missing = _coinValue + _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, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
            }
            else
            {
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", this # could not be found. Please check the auction list by typing /auction.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            _result.Dispose();
        }
Beispiel #8
0
 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);
         }
     }
 }
Beispiel #9
0
 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);
         }
     }
 }
Beispiel #10
0
        public static void Walletcheck(ClientInfo _cInfo, string _playerName, string _item)
        {
            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 = " the item or amount # you are trying to buy is not an integer. Please input /buy 1 2 for example.";
                    }
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase620 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
                else
                {
                    int _amount;
                    if (!int.TryParse(_idAmount[1], out _amount))
                    {
                        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 /buy 1 2 for example.";
                        }
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase620 + "[-]", _cInfo.entityId, 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);
                                    int _newAmount    = _integerValues[2] * _amount;
                                    if (_currentCoins >= _newAmount)
                                    {
                                        int _newCount = _integerValues[0] * _amount;
                                        ShopPurchase(_cInfo, _stringValues[0], _newCount, _integerValues[1], _newAmount, _playerName, _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, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase621 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            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))
                            {
                                int _currentCoins = Wallet.GetcurrentCoins(_cInfo);
                                if (_currentCoins >= _integerValues[2])
                                {
                                    ShopPurchase(_cInfo, _stringValues[0], _integerValues[0], _integerValues[1], _integerValues[2], _playerName, _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, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase621 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                }
                            }
                        }
                    }
                }
                else
                {
                    string _phrase622;
                    if (!Phrases.Dict.TryGetValue(622, out _phrase622))
                    {
                        _phrase622 = " there was no item # matching the shop. Check the shop category again.";
                    }
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase622 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
            }
        }
 public static void PlayerCheck()
 {
     if (!IsRunning2)
     {
         IsRunning2 = true;
         if (ConnectionManager.Instance.ClientCount() > 0)
         {
             List <EntityPlayer> EntityPlayerList = GameManager.Instance.World.Players.list;
             for (int i = 0; i < EntityPlayerList.Count; i++)
             {
                 EntityPlayer _player = EntityPlayerList[i];
                 if (_player != null)
                 {
                     ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForEntityId(_player.entityId);
                     if (_cInfo != null)
                     {
                         if (!_player.IsDead() && _player.Spawned)
                         {
                             if (Zones.IsEnabled)
                             {
                                 Zones.ZoneCheck(_cInfo, _player);
                             }
                             if (GodModeFlight.IsEnabled)
                             {
                                 GodModeFlight.GodFlightCheck(_cInfo);
                             }
                         }
                         else if (_player.IsDead())
                         {
                             if (!Died.Contains(_player.entityId))
                             {
                                 Died.Add(_player.entityId);
                                 if (KillNotice.IsEnabled || Bounties.IsEnabled || Zones.IsEnabled)
                                 {
                                     for (int j = 0; j < EntityPlayerList.Count; j++)
                                     {
                                         EntityPlayer _player2 = EntityPlayerList[j];
                                         if (_player != _player2)
                                         {
                                             ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForEntityId(_player2.entityId);
                                             if (_cInfo2 != null)
                                             {
                                                 Entity _target = _player2.GetDamagedTarget();
                                                 if (_player == _target)
                                                 {
                                                     if (KillNotice.IsEnabled)
                                                     {
                                                         string    _holdingItem = _player2.inventory.holdingItem.Name;
                                                         ItemValue _itemValue   = ItemClass.GetItem(_holdingItem, true);
                                                         if (_itemValue.type != ItemValue.None.type)
                                                         {
                                                             _holdingItem = _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.Name;
                                                         }
                                                         KillNotice.Notice(_cInfo, _cInfo2, _holdingItem);
                                                     }
                                                     if (Bounties.IsEnabled)
                                                     {
                                                         Bounties.PlayerKilled(_player, _player2, _cInfo, _cInfo2);
                                                     }
                                                     if (Zones.IsEnabled)
                                                     {
                                                         Zones.Check(_cInfo, _cInfo2);
                                                     }
                                                     break;
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 if (DeathSpot.IsEnabled)
                                 {
                                     DeathSpot.PlayerKilled(_player);
                                 }
                                 if (Wallet.IsEnabled && Wallet.Lose_On_Death)
                                 {
                                     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 = Wallet.GetcurrentCoins(_cInfo);
                                     if (_currentCoins >= 1)
                                     {
                                         _sql = string.Format("UPDATE Players SET playerSpentCoins = {0} WHERE steamid = '{1}'", _playerSpentCoins - _currentCoins, _cInfo.playerId);
                                         SQL.FastQuery(_sql, "Players");
                                     }
                                 }
                                 if (Event.Open && Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                                 {
                                     string _sql = string.Format("UPDATE Players SET eventReturn = 'true' WHERE steamid = '{0}'", _cInfo.playerId);
                                     SQL.FastQuery(_sql, "Players");
                                 }
                             }
                         }
                     }
                 }
             }
         }
         IsRunning2 = false;
     }
 }
Beispiel #12
0
        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.Clients.ForEntityId(_id);
                        if (_cInfo1 != null)
                        {
                            EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo1.entityId];
                            if (_cost < Minimum_Bounty)
                            {
                                _cost = Minimum_Bounty;
                            }
                            int _currentCoins = Wallet.GetcurrentCoins(_cInfo);
                            if (_currentCoins >= _cost)
                            {
                                Wallet.SubtractCoinsFromWallet(_cInfo.playerId, _cost);
                                string    _sql    = string.Format("SELECT bounty FROM Players WHERE steamid = '{0}'", _cInfo1.playerId);
                                DataTable _result = SQL.TQuery(_sql);
                                int       _bounty;
                                int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _bounty);
                                _result.Dispose();
                                _sql = string.Format("UPDATE Players SET bounty = {0} WHERE steamid = '{1}'", _bounty + _cost, _cInfo1.playerId);
                                SQL.FastQuery(_sql);
                                string _message1 = " you have added {Value} bounty to {PlayerName}.[-]";
                                _message1 = _message1.Replace("{Value}", _cost.ToString());
                                _message1 = _message1.Replace("{PlayerName}", _cInfo1.playerName);
                                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message1 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                            }
                            else
                            {
                                string _message1 = " you do not have enough in your wallet for this bounty: {Value}.[-]";
                                _message1 = _message1.Replace("{Value}", _cost.ToString());
                                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message1 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                            }
                        }
                    }
                    else
                    {
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", to add a custom bounty value, type " + ChatHook.Command_Private + Command83 + " Id# Value, or the minimum with " + ChatHook.Command_Private + Command83 + " Id#.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
            }
            else
            {
                if (int.TryParse(_message, out _id))
                {
                    ClientInfo _cInfo1 = ConnectionManager.Instance.Clients.ForEntityId(_id);
                    if (_cInfo1 != null)
                    {
                        EntityPlayer _player       = GameManager.Instance.World.Players.dict[_cInfo1.entityId];
                        int          _currentCoins = Wallet.GetcurrentCoins(_cInfo);
                        if (_currentCoins >= Minimum_Bounty)
                        {
                            Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Minimum_Bounty);
                            string    _sql    = string.Format("SELECT bounty FROM Players WHERE steamid = '{0}'", _cInfo1.playerId);
                            DataTable _result = SQL.TQuery(_sql);
                            int       _bounty;
                            int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _bounty);
                            _result.Dispose();
                            _sql = string.Format("UPDATE Players SET bounty = {0} WHERE steamid = '{1}'", _bounty + Minimum_Bounty, _cInfo1.playerId);
                            SQL.FastQuery(_sql);
                            string _message1 = " you have added {Value} bounty to {PlayerName}.[-]";
                            _message1 = _message1.Replace("{Value}", Minimum_Bounty.ToString());
                            _message1 = _message1.Replace("{PlayerName}", _cInfo1.playerName);
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message1 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        }
                        else
                        {
                            string _message1 = " you do not have enough in your wallet for this bounty: {Value}.[-]";
                            _message1 = _message1.Replace("{Value}", Minimum_Bounty.ToString());
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message1 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        }
                    }
                }
            }
        }
Beispiel #13
0
 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 = " a lottery is open for {Value} {CoinName}. Minimum buy in is {BuyIn}. Enter it by typing {CommandPrivate}{Command85}.";
             }
             _phrase536 = _phrase536.Replace("{Value}", _winnings.ToString());
             _phrase536 = _phrase536.Replace("{CoinName}", Wallet.Coin_Name);
             _phrase536 = _phrase536.Replace("{BuyIn}", LottoValue.ToString());
             _phrase536 = _phrase536.Replace("{CommandPrivate}", ChatHook.Command_Private);
             _phrase536 = _phrase536.Replace("{Command85}", Command85);
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase536 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
         else
         {
             int _lottoValue;
             if (int.TryParse(_message, out _lottoValue))
             {
                 if (_lottoValue > 0)
                 {
                     int _currentCoins = Wallet.GetcurrentCoins(_cInfo);
                     if (_currentCoins >= _lottoValue)
                     {
                         OpenLotto  = true;
                         LottoValue = _lottoValue;
                         LottoEntries.Add(_cInfo);
                         Wallet.SubtractCoinsFromWallet(_cInfo.playerId, LottoValue);
                         string _phrase538;
                         if (!Phrases.Dict.TryGetValue(538, out _phrase538))
                         {
                             _phrase538 = " you have opened a new lottery for {Value} {CoinName}.";
                         }
                         _phrase538 = _phrase538.Replace("{Value}", _lottoValue.ToString());
                         _phrase538 = _phrase538.Replace("{CoinName}", Wallet.Coin_Name);
                         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase538 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                         string _phrase539;
                         if (!Phrases.Dict.TryGetValue(539, out _phrase539))
                         {
                             _phrase539 = "A lottery has opened for {Value} {CoinName} and will draw soon. Type {CommandPrivate}{Command85} to join.";
                         }
                         _phrase539 = _phrase539.Replace("{Value}", LottoValue.ToString());
                         _phrase539 = _phrase539.Replace("{CoinName}", Wallet.Coin_Name);
                         _phrase539 = _phrase539.Replace("{CommandPrivate}", ChatHook.Command_Private);
                         _phrase539 = _phrase539.Replace("{Command85}", Command85);
                         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase538 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, 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, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase540 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     }
                 }
                 else
                 {
                     string _phrase537;
                     if (!Phrases.Dict.TryGetValue(537, out _phrase537))
                     {
                         _phrase537 = " you must type a valid integer above zero for the lottery #.";
                     }
                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase537 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
             else
             {
                 string _phrase537;
                 if (!Phrases.Dict.TryGetValue(537, out _phrase537))
                 {
                     _phrase537 = " you must type a valid integer above zero for the lottery #.";
                 }
                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase537 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             }
         }
     }
 }
Beispiel #14
0
        public static void Exec()
        {
            DP = false;
            List <EntityPlayer> _playerList = GameManager.Instance.World.Players.list;

            for (int i = 0; i < _playerList.Count; i++)
            {
                EntityPlayer _player = _playerList[i];
                if (_player != null)
                {
                    ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForEntityId(_player.entityId);
                    if (_cInfo != null)
                    {
                        if (_player.IsDead())
                        {
                            DP = true;
                            if (!Dead.Contains(_player.entityId))
                            {
                                Dead.Add(_player.entityId);
                                if (Event.Open && Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                                {
                                    string _sql = string.Format("UPDATE Players SET eventRespawn = 'true' WHERE steamid = '{0}'", _cInfo.playerId);
                                    SQL.FastQuery(_sql);
                                }
                                if (!DeathTime.ContainsKey(_player.entityId))
                                {
                                    Vector3 _position  = _player.GetPosition();
                                    int     x          = (int)_position.x;
                                    int     y          = (int)_position.y;
                                    int     z          = (int)_position.z;
                                    string  _dposition = x + "," + y + "," + z;
                                    DeathTime.Add(_player.entityId, DateTime.Now);
                                    LastDeathPos.Add(_player.entityId, _dposition);
                                }
                                else
                                {
                                    Vector3 _position  = _player.GetPosition();
                                    int     x          = (int)_position.x;
                                    int     y          = (int)_position.y;
                                    int     z          = (int)_position.z;
                                    string  _dposition = x + "," + y + "," + z;
                                    DeathTime[_player.entityId]    = DateTime.Now;
                                    LastDeathPos[_player.entityId] = _dposition;
                                }
                                for (int j = 0; j < _playerList.Count; j++)
                                {
                                    EntityPlayer _player2 = _playerList[j];
                                    Entity       _target  = _player2.GetDamagedTarget();
                                    if (_target == _player && _player != _player2)
                                    {
                                        _player2.ClearDamagedTarget();
                                        ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForEntityId(_player2.entityId);
                                        if (_cInfo != null && _cInfo2 != null)
                                        {
                                            if (KillNotice.IsEnabled)
                                            {
                                                string    _holdingItem = _player2.inventory.holdingItem.Name;
                                                ItemValue _itemValue   = ItemClass.GetItem(_holdingItem, true);
                                                if (_itemValue.type != ItemValue.None.type)
                                                {
                                                    _holdingItem = _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.Name;
                                                }
                                                KillNotice.Notice(_cInfo, _cInfo2, _holdingItem);
                                            }
                                            if (Bounties.IsEnabled)
                                            {
                                                if (!_player.IsFriendsWith(_player2) && !_player2.IsFriendsWith(_player))
                                                {
                                                    if (ClanManager.IsEnabled)
                                                    {
                                                        if (ClanManager.ClanMember.Contains(_cInfo.playerId) && ClanManager.ClanMember.Contains(_cInfo2.playerId))
                                                        {
                                                            string    _sql1     = string.Format("SELECT clanname FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                                                            DataTable _result1  = SQL.TQuery(_sql1);
                                                            string    _clanName = _result1.Rows[0].ItemArray.GetValue(0).ToString();
                                                            _result1.Dispose();
                                                            _sql1 = string.Format("SELECT clanname FROM Players WHERE steamid = '{0}'", _cInfo2.playerId);
                                                            DataTable _result2   = SQL.TQuery(_sql1);
                                                            string    _clanName2 = _result2.Rows[0].ItemArray.GetValue(0).ToString();
                                                            _result2.Dispose();
                                                            Player p2 = PersistentContainer.Instance.Players[_cInfo2.playerId, false];
                                                            if (_clanName != "Unknown" && _clanName2 != "Unknown")
                                                            {
                                                                if (_clanName == _clanName2)
                                                                {
                                                                    return;
                                                                }
                                                            }
                                                        }
                                                    }
                                                    string    _sql    = string.Format("SELECT bounty, bountyHunter FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                                                    DataTable _result = SQL.TQuery(_sql);
                                                    int       _bounty;
                                                    int       _hunterCountVictim;
                                                    int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _bounty);
                                                    int.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _hunterCountVictim);
                                                    _result.Dispose();
                                                    if (_bounty > 0)
                                                    {
                                                        _sql = string.Format("SELECT playerSpentCoins, bountyHunter FROM Players WHERE steamid = '{0}'", _cInfo2.playerId);
                                                        DataTable _result2 = SQL.TQuery(_sql);
                                                        int       _playerSpentCoins;
                                                        int       _hunterCountKiller;
                                                        int.TryParse(_result2.Rows[0].ItemArray.GetValue(0).ToString(), out _playerSpentCoins);
                                                        int.TryParse(_result2.Rows[0].ItemArray.GetValue(1).ToString(), out _hunterCountKiller);
                                                        _result2.Dispose();
                                                        if (Bounties.Bonus > 0 && _hunterCountVictim >= Bounties.Bonus)
                                                        {
                                                            _sql = string.Format("UPDATE Players SET playerSpentCoins = {0}, bountyHunter = {1} WHERE steamid = '{2}'", _playerSpentCoins + _bounty + Bounties.Bonus, _hunterCountKiller + 1, _cInfo2.playerId);
                                                            SQL.FastQuery(_sql);
                                                        }
                                                        else
                                                        {
                                                            _sql = string.Format("UPDATE Players SET playerSpentCoins = {0}, bountyHunter = {1} WHERE steamid = '{2}'", _playerSpentCoins + _bounty, _hunterCountKiller + 1, _cInfo2.playerId);
                                                            SQL.FastQuery(_sql);
                                                        }
                                                        _sql = string.Format("UPDATE Players SET bounty = 0, bountyHunter = 0 WHERE steamid = '{0}'", _cInfo.playerId);
                                                        SQL.FastQuery(_sql);
                                                        string _phrase912;
                                                        if (!Phrases.Dict.TryGetValue(912, out _phrase912))
                                                        {
                                                            _phrase912 = "{PlayerName} is a bounty hunter! {Victim} was snuffed out.";
                                                        }
                                                        _phrase912 = _phrase912.Replace("{PlayerName}", _cInfo2.playerName);
                                                        _phrase912 = _phrase912.Replace("{Victim}", _cInfo.playerName);
                                                        ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase912, -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                                        using (StreamWriter sw = new StreamWriter(filepath, true))
                                                        {
                                                            sw.WriteLine(string.Format("{0}: {1} is a bounty hunter! {2} was snuffed out. Bounty was worth {3}", DateTime.Now, _cInfo2.playerName, _cInfo.playerName, _bounty));
                                                            sw.WriteLine();
                                                            sw.Flush();
                                                            sw.Close();
                                                        }
                                                    }
                                                    if (Bounties.Kill_Streak > 0)
                                                    {
                                                        if (KillStreak.ContainsKey(_cInfo.entityId))
                                                        {
                                                            KillStreak.Remove(_cInfo.entityId);
                                                            using (StreamWriter sw = new StreamWriter(filepath, true))
                                                            {
                                                                sw.WriteLine(string.Format("{0}: Player {1} kill streak has come to an end by {2}.", DateTime.Now, _cInfo.playerName, _cInfo2.playerName));
                                                                sw.WriteLine();
                                                                sw.Flush();
                                                                sw.Close();
                                                            }
                                                        }
                                                        if (KillStreak.ContainsKey(_cInfo2.entityId))
                                                        {
                                                            int _value;
                                                            if (KillStreak.TryGetValue(_cInfo2.entityId, out _value))
                                                            {
                                                                int _newValue = _value + 1;
                                                                KillStreak[_cInfo2.entityId] = _newValue;
                                                                if (_newValue == Bounties.Kill_Streak)
                                                                {
                                                                    string _phrase913;
                                                                    if (!Phrases.Dict.TryGetValue(913, out _phrase913))
                                                                    {
                                                                        _phrase913 = "{PlayerName} is on a kill streak! Their bounty has increased.";
                                                                    }
                                                                    _phrase913 = _phrase913.Replace("{PlayerName}", _cInfo2.playerName);
                                                                    ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase913, -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                                                }
                                                                if (_newValue >= Bounties.Kill_Streak)
                                                                {
                                                                    _sql = string.Format("SELECT bounty FROM Players WHERE steamid = '{0}'", _cInfo2.playerId);
                                                                    DataTable _result3 = SQL.TQuery(_sql);
                                                                    int       _oldBounty;
                                                                    int.TryParse(_result3.Rows[0].ItemArray.GetValue(0).ToString(), out _oldBounty);
                                                                    _result3.Dispose();
                                                                    _sql = string.Format("UPDATE Players SET bounty = {0} WHERE steamid = '{1}'", _oldBounty + Bounties.Bonus, _cInfo.playerId);
                                                                    SQL.FastQuery(_sql);
                                                                    using (StreamWriter sw = new StreamWriter(filepath, true))
                                                                    {
                                                                        sw.WriteLine(string.Format("{0}: {1} is on a kill streak of {2}. Their bounty has increased.", DateTime.Now, _cInfo2.playerName, _newValue));
                                                                        sw.WriteLine();
                                                                        sw.Flush();
                                                                        sw.Close();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            KillStreak.Add(_cInfo2.entityId, 1);
                                                        }
                                                    }
                                                }
                                            }
                                            if (Zones.IsEnabled)
                                            {
                                                Zones.Check(_cInfo2, _cInfo);
                                            }
                                        }
                                    }
                                }
                                if (Wallet.IsEnabled && Wallet.Lose_On_Death)
                                {
                                    World     world   = GameManager.Instance.World;
                                    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 = Wallet.GetcurrentCoins(_cInfo);
                                    if (_currentCoins >= 1)
                                    {
                                        _sql = string.Format("UPDATE Players SET playerSpentCoins = {0} WHERE steamid = '{1}'", _playerSpentCoins - _currentCoins, _cInfo.playerId);
                                        SQL.FastQuery(_sql);
                                    }
                                }
                                if (Event.Open && Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                                {
                                    string _sql = string.Format("UPDATE Players SET eventReturn = 'true' WHERE steamid = '{0}'", _cInfo.playerId);
                                    SQL.FastQuery(_sql);
                                }
                            }
                        }
                        else
                        {
                            if (Zones.IsEnabled)
                            {
                                ZoneCheck(_cInfo, _player);
                            }
                        }
                    }
                }
            }
            if (!DP)
            {
                _counter++;
                if (_counter >= 6)
                {
                    _counter = 0;
                    for (int i = 0; i < _playerList.Count; i++)
                    {
                        EntityPlayer _player = _playerList[i];
                        if (_player != null)
                        {
                            _player.ClearDamagedTarget();
                        }
                    }
                }
            }
            else
            {
                _counter = 0;
            }
        }