private static void Time(ClientInfo _cInfo, int _timepassed, int _delay)
 {
     if (_timepassed >= _delay)
     {
         if (Wallet.IsEnabled && Command_Cost >= 1)
         {
             CommandCost(_cInfo);
         }
         else
         {
             StartScouting(_cInfo);
         }
     }
     else
     {
         int timeleft = _delay - _timepassed;
         Phrases.Dict.TryGetValue("ScoutPlayer1", out string phrase);
         phrase = phrase.Replace("{DelayBetweenUses}", _delay.ToString());
         phrase = phrase.Replace("{TimeRemaining}", timeleft.ToString());
         phrase = phrase.Replace("{Command_Prefix1}", ChatHook.Chat_Command_Prefix1);
         phrase = phrase.Replace("{Command_scoutplayer}", Command_scoutplayer);
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
     }
 }
        public static void Exec(ClientInfo _cInfo)
        {
            List <ClientInfo> ClientInfoList = PersistentOperations.ClientList();

            if (ClientInfoList != null && ClientInfoList.Count > 0)
            {
                for (int i = 0; i < ClientInfoList.Count; i++)
                {
                    ClientInfo _cInfo1 = ClientInfoList[i];
                    if (_cInfo.entityId != _cInfo1.entityId)
                    {
                        Phrases.Dict.TryGetValue(811, out string _phrase811);
                        _phrase811 = _phrase811.Replace("{PlayerName}", _cInfo1.playerName);
                        _phrase811 = _phrase811.Replace("{EntityId}", _cInfo1.entityId.ToString());
                        ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase811 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
            }
            else
            {
                Phrases.Dict.TryGetValue(812, out string _phrase812);
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase812 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
        private static void StartScouting(ClientInfo _cInfo)
        {
            World world = GameManager.Instance.World;
            List <EntityPlayer> EntityPlayerList = world.Players.list;

            for (int i = 0; i < EntityPlayerList.Count; i++)
            {
                EntityAlive _player2 = EntityPlayerList[i];
                if (_player2 != null && _player2.entityId != _cInfo.entityId && _player2.Spawned && !world.Players.dict[_cInfo.entityId].IsFriendsWith(world.Players.dict[_player2.entityId]))
                {
                    float distanceSq = world.Players.dict[_player2.entityId].GetDistanceSq(world.Players.dict[_cInfo.entityId].position);
                    if (distanceSq <= 200f * 200f)
                    {
                        ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "You have scouted a trail to a hostile player in the area with in " + (int)distanceSq + " blocks" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        PersistentContainer.Instance.Players[_cInfo.playerId].LastScout = DateTime.Now;
                        PersistentContainer.Instance.Save();
                        return;
                    }
                }
            }
            ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "No trails or tracks were detected to a nearby hostile player" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            PersistentContainer.Instance.Players[_cInfo.playerId].LastScout = DateTime.Now;
            PersistentContainer.Instance.Save();
        }
Exemple #4
0
 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
         {
             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);
         }
     }
     else
     {
         Exec(_cInfo, _waypoint, _position, _friends);
     }
 }
        public static void TeleFriend(ClientInfo _cInfo, int _invitingFriend)
        {
            ClientInfo cInfo2 = PersistentOperations.GetClientInfoFromEntityId(_invitingFriend);

            if (cInfo2 != null)
            {
                EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId);
                if (player != null)
                {
                    if (Wallet.IsEnabled && Command_Cost >= 1)
                    {
                        if (Wallet.GetCurrency(cInfo2.CrossplatformId.CombinedString) >= Command_Cost)
                        {
                            Wallet.RemoveCurrency(cInfo2.CrossplatformId.CombinedString, Command_Cost);
                        }
                        else
                        {
                            Phrases.Dict.TryGetValue("FriendTeleport10", out string phrase);
                            phrase = phrase.Replace("{CoinName}", Wallet.Currency_Name);
                            ChatHook.ChatMessage(cInfo2, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                            return;
                        }
                    }
                    Phrases.Dict.TryGetValue("FriendTeleport7", out string phrase1);
                    ChatHook.ChatMessage(cInfo2, Config.Chat_Response_Color + phrase1 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                    cInfo2.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3((int)player.position.x, (int)player.position.y, (int)player.position.z), null, false));
                    PersistentContainer.Instance.Players[cInfo2.CrossplatformId.CombinedString].LastFriendTele = DateTime.Now;
                    PersistentContainer.DataChange = true;
                }
            }
            else
            {
                Phrases.Dict.TryGetValue("FriendTeleport11", out string _phrase);
                ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Exemple #6
0
        public static void BountyList(ClientInfo _cInfo)
        {
            List <ClientInfo> ClientInfoList = ConnectionManager.Instance.Clients.List.ToList();

            for (int i = 0; i < ClientInfoList.Count; i++)
            {
                ClientInfo _cInfo1 = ClientInfoList[i];
                if (_cInfo1 != null)
                {
                    int _currentbounty = PersistentContainer.Instance.Players[_cInfo1.playerId].Bounty;
                    if (_currentbounty > 0)
                    {
                        string _phrase911;
                        if (!Phrases.Dict.TryGetValue(911, out _phrase911))
                        {
                            _phrase911 = "{PlayerName}, # {EntityId}. Current bounty: {CurrentBounty}. Minimum bounty is {Minimum} {CoinName}.";
                        }
                        _phrase911 = _phrase911.Replace("{PlayerName}", _cInfo1.playerName);
                        _phrase911 = _phrase911.Replace("{EntityId}", _cInfo1.entityId.ToString());
                        _phrase911 = _phrase911.Replace("{CurrentBounty}", _currentbounty.ToString());
                        _phrase911 = _phrase911.Replace("{Minimum}", Minimum_Bounty.ToString());
                        _phrase911 = _phrase911.Replace("{CoinName}", Wallet.Coin_Name);
                        ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase911 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
            }
            string _phrase910;

            if (!Phrases.Dict.TryGetValue(910, out _phrase910))
            {
                _phrase910 = "Type {CommandPrivate}{Command83} Id# Value or {CommandPrivate}{Command83} Id# for the minimum bounty against this player.";
            }
            _phrase910 = _phrase910.Replace("{CommandPrivate}", ChatHook.Command_Private);
            _phrase910 = _phrase910.Replace("{Command83}", Command83);
            ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase910 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
        }
Exemple #7
0
 private static void Time(ClientInfo _cInfo, int _timepassed, int _delay)
 {
     if (_timepassed >= _delay)
     {
         Kill(_cInfo);
     }
     else
     {
         int    _timeleft = _delay - _timepassed;
         string _phrase8;
         if (!Phrases.Dict.TryGetValue(8, out _phrase8))
         {
             _phrase8 = " you can only use {CommandPrivate}killme, {CommandPrivate}{Command21}, {CommandPrivate}{Command22}, or {CommandPrivate}{Command23} once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
         }
         _phrase8 = _phrase8.Replace("{DelayBetweenUses}", _delay.ToString());
         _phrase8 = _phrase8.Replace("{TimeRemaining}", _timeleft.ToString());
         _phrase8 = _phrase8.Replace("{CommandPrivate}", ChatHook.Command_Private);
         _phrase8 = _phrase8.Replace("{Command20}", Command20);
         _phrase8 = _phrase8.Replace("{Command21}", Command21);
         _phrase8 = _phrase8.Replace("{Command22}", Command22);
         _phrase8 = _phrase8.Replace("{Command23}", Command23);
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase8 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
 public static void Time(ClientInfo _cInfo, int _timepassed, int _delay)
 {
     if (_timepassed >= _delay)
     {
         if (Wallet.IsEnabled && Command_Cost >= 1)
         {
             CommandCost(_cInfo);
         }
         else
         {
             SetBuff(_cInfo);
         }
     }
     else
     {
         int    _timeleft = _delay - _timepassed;
         string _response = " you can only use {CommandPrivate}{Command126} once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
         _response = _response.Replace("{DelayBetweenUses}", _delay.ToString());
         _response = _response.Replace("{TimeRemaining}", _timeleft.ToString());
         _response = _response.Replace("{CommandPrivate}", ChatHook.Command_Private);
         _response = _response.Replace("{Command126}", Command126);
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _response + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Exemple #9
0
 public static void CheckLocation(ClientInfo _cInfo, string _amount, int _exec)
 {
     if (Inside_Claim)
     {
         EntityPlayer         _player               = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         Vector3              _position             = _player.GetPosition();
         int                  x                     = (int)_position.x;
         int                  y                     = (int)_position.y;
         int                  z                     = (int)_position.z;
         Vector3i             _vec3i                = new Vector3i(x, y, z);
         PersistentPlayerList _persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
         PersistentPlayerData _persistentPlayerData = _persistentPlayerList.GetPlayerDataFromEntityID(_player.entityId);
         EnumLandClaimOwner   _owner                = GameManager.Instance.World.GetLandClaimOwner(_vec3i, _persistentPlayerData);
         if (_owner != EnumLandClaimOwner.Self || _owner != EnumLandClaimOwner.Ally)
         {
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " you can not use this command here. Stand in your own or a friend's claimed space.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             return;
         }
     }
     if (_exec == 1)
     {
         ChestToBankDeposit(_cInfo, _amount);
     }
     else if (_exec == 2)
     {
         BankToPlayerWithdraw(_cInfo, _amount);
     }
     else if (_exec == 3)
     {
         WalletToBankDeposit(_cInfo, _amount);
     }
     else if (_exec == 4)
     {
         BankToWalletWithdraw(_cInfo, _amount);
     }
 }
Exemple #10
0
 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);
     }
 }
 public static void RemoveVehicle(ClientInfo _cInfo, string _vehicleId)
 {
     if (int.TryParse(_vehicleId, out int id))
     {
         if (PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].Vehicles != null && PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].Vehicles.ContainsKey(id))
         {
             PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].Vehicles.Remove(id);
             PersistentContainer.DataChange = true;
             Phrases.Dict.TryGetValue("VehicleRecall15", out string phrase);
             phrase = phrase.Replace("{Id}", _vehicleId);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
         else
         {
             Phrases.Dict.TryGetValue("VehicleRecall13", out string phrase);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     else
     {
         Phrases.Dict.TryGetValue("VehicleRecall3", out string phrase);
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Exemple #12
0
 public static void Reminder()
 {
     try
     {
         foreach (KeyValuePair <int, DateTime> time in reminder)
         {
             ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForEntityId(time.Key);
             if (_cInfo != null)
             {
                 DateTime _dt               = time.Value;
                 TimeSpan varTime           = DateTime.Now - _dt;
                 double   fractionalMinutes = varTime.TotalMinutes;
                 int      _timepassed       = (int)fractionalMinutes;
                 if (_timepassed >= Reminder_Delay)
                 {
                     string _msg;
                     reminderMsg.TryGetValue(_cInfo.entityId, out _msg);
                     if (_msg != "")
                     {
                         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _msg + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                         reminder[_cInfo.entityId] = DateTime.Now;
                     }
                 }
             }
             else
             {
                 reminder.Remove(time.Key);
                 reminderMsg.Remove(time.Key);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Zones.Reminder: {0}.", e.Message));
     }
 }
        public static void Check(ClientInfo _cInfo, string _message)
        {
            DateTime _lastLog          = PersistentContainer.Instance.Players[_cInfo.playerId].LastLog;
            TimeSpan varTime           = DateTime.Now - _lastLog;
            double   fractionalMinutes = varTime.TotalMinutes;
            int      _timepassed       = (int)fractionalMinutes;

            if (_timepassed >= Delay)
            {
                Exec(_cInfo, _message);
            }
            else
            {
                int    _timeleft = Delay - _timepassed;
                string _phrase795;
                if (!Phrases.Dict.TryGetValue(795, out _phrase795))
                {
                    _phrase795 = "You can only make a report once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
                }
                _phrase795 = _phrase795.Replace("{DelayBetweenUses}", Delay.ToString());
                _phrase795 = _phrase795.Replace("{TimeRemaining}", _timeleft.ToString());
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase795 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Exemple #14
0
 public static void CheckLocation(ClientInfo _cInfo, string _amount, int _exec)
 {
     if (Inside_Claim)
     {
         if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId))
         {
             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (_player != null)
             {
                 Vector3  _position = _player.GetPosition();
                 Vector3i _vec3i    = new Vector3i((int)_position.x, (int)_position.y, (int)_position.z);
                 if (!PersistentOperations.ClaimedByAllyOrSelf(_cInfo.playerId, _vec3i))
                 {
                     ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "You can not use this command here. Stand in your own or a friend's claimed space.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     return;
                 }
             }
         }
     }
     if (_exec == 1)
     {
         ChestToBankDeposit(_cInfo, _amount);
     }
     else if (_exec == 2)
     {
         BankToPlayerWithdraw(_cInfo, _amount);
     }
     else if (_exec == 3)
     {
         WalletToBankDeposit(_cInfo, _amount);
     }
     else if (_exec == 4)
     {
         BankToWalletWithdraw(_cInfo, _amount);
     }
 }
Exemple #15
0
 private static void Time(ClientInfo _cInfo, string _homeName, int _timepassed, int _delay, bool _friends)
 {
     try
     {
         if (_timepassed >= _delay)
         {
             Checks(_cInfo, _homeName, _friends);
         }
         else
         {
             int timeleft = _delay - _timepassed;
             Phrases.Dict.TryGetValue("Homes4", out string phrase);
             phrase = phrase.Replace("{Command_Prefix1}", ChatHook.Chat_Command_Prefix1);
             phrase = phrase.Replace("{DelayBetweenUses}", _delay.ToString());
             phrase = phrase.Replace("{Value}", timeleft.ToString());
             phrase = phrase.Replace("{Command_home}", Command_home);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Homes.Time: {0}", e.Message));
     }
 }
Exemple #16
0
 public static void No(ClientInfo _cInfo)
 {
     if (!PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.CrossplatformId.CombinedString))
     {
         Dictionary <string, bool> votes = PersistentContainer.Instance.PollVote;
         votes.Add(_cInfo.CrossplatformId.CombinedString, false);
         PersistentContainer.Instance.PollVote = votes;
         PersistentContainer.DataChange        = true;
         using (StreamWriter sw = new StreamWriter(Filepath, true, Encoding.UTF8))
         {
             sw.WriteLine(string.Format("{0}: Id '{1}' '{2}' named '{3}' has voted no in the poll", DateTime.Now, _cInfo.PlatformId.CombinedString, _cInfo.CrossplatformId.CombinedString, _cInfo.playerName));
             sw.WriteLine();
             sw.Flush();
             sw.Close();
         }
         Phrases.Dict.TryGetValue("Poll5", out string phrase);
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
     }
     else
     {
         Phrases.Dict.TryGetValue("Poll6", out string phrase);
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Exemple #17
0
 public static void FriendHome(ClientInfo _cInfo)
 {
     try
     {
         Invite.TryGetValue(_cInfo.entityId, out DateTime dt);
         {
             TimeSpan varTime           = DateTime.Now - dt;
             double   fractionalMinutes = varTime.TotalMinutes;
             int      timepassed        = (int)fractionalMinutes;
             if (timepassed <= 2)
             {
                 FriendPosition.TryGetValue(_cInfo.entityId, out string pos);
                 {
                     string[] cords = pos.Split(',');
                     int.TryParse(cords[0], out int x);
                     int.TryParse(cords[1], out int y);
                     int.TryParse(cords[2], out int z);
                     _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(x, y, z), null, false));
                     Invite.Remove(_cInfo.entityId);
                     FriendPosition.Remove(_cInfo.entityId);
                 }
             }
             else
             {
                 Invite.Remove(_cInfo.entityId);
                 FriendPosition.Remove(_cInfo.entityId);
                 Phrases.Dict.TryGetValue("Homes16", out string phrase);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Homes.FriendHome: {0}", e.Message));
     }
 }
 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);
     }
 }
Exemple #19
0
        public static void Exec(ClientInfo _cInfo)
        {
            Entity  _player   = GameManager.Instance.World.Players.dict[_cInfo.entityId];
            Vector3 _position = _player.position;
            int     _x        = (int)_position.x;
            int     _y        = (int)_position.y;
            int     _z        = (int)_position.z;
            string  _exit     = "";

            if (Zones.IsEnabled && Zones.ZoneExit.ContainsKey(_cInfo.entityId))
            {
                Zones.ZoneExit.TryGetValue(_cInfo.entityId, out _exit);
                if (_exit != "")
                {
                    string _phrase761;
                    if (!Phrases.Dict.TryGetValue(761, out _phrase761))
                    {
                        _phrase761 = "Your current position is X  {X}, Y  {Y}, Z  {Z}. You are inside a zone.";
                    }
                    _phrase761 = _phrase761.Replace("{X}", _x.ToString());
                    _phrase761 = _phrase761.Replace("{Y}", _y.ToString());
                    _phrase761 = _phrase761.Replace("{Z}", _z.ToString());
                    ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase761 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
            }
            string _phrase760;

            if (!Phrases.Dict.TryGetValue(760, out _phrase760))
            {
                _phrase760 = "Your current position is X  {X}, Y  {Y}, Z  {Z}.";
            }
            _phrase760 = _phrase760.Replace("{X}", _x.ToString());
            _phrase760 = _phrase760.Replace("{Y}", _y.ToString());
            _phrase760 = _phrase760.Replace("{Z}", _z.ToString());
            ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase760 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
        }
Exemple #20
0
 public static void Time(ClientInfo _cInfo, int _timepassed, int _delay)
 {
     if (_timepassed >= _delay)
     {
         if (Wallet.IsEnabled && Command_Cost >= 1)
         {
             CommandCost(_cInfo);
         }
         else
         {
             MarketTele(_cInfo);
         }
     }
     else
     {
         int _timeleft = _delay - _timepassed;
         Phrases.Dict.TryGetValue(251, out string _phrase251);
         _phrase251 = _phrase251.Replace("{DelayBetweenUses}", _delay.ToString());
         _phrase251 = _phrase251.Replace("{TimeRemaining}", _timeleft.ToString());
         _phrase251 = _phrase251.Replace("{CommandPrivate}", ChatHook.Chat_Command_Prefix1);
         _phrase251 = _phrase251.Replace("{Command103}", Market.Command103);
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase251 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Exemple #21
0
        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)
                {
                    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, Config.Chat_Response_Color + _phrase370 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                            return;
                        }
                    }
                    Phrases.Dict.TryGetValue(367, out string _phrase367);
                    ChatHook.ChatMessage(_cInfo2, Config.Chat_Response_Color + _phrase367 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                    _cInfo2.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3((int)_player.position.x, (int)_player.position.y, (int)_player.position.z), null, false));
                    PersistentContainer.Instance.Players[_cInfo2.playerId].LastFriendTele = DateTime.Now;
                    PersistentContainer.DataChange = true;
                }
            }
            else
            {
                Phrases.Dict.TryGetValue(371, out string _phrase371);
                ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase371 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Exemple #22
0
 public static void No(ClientInfo _cInfo)
 {
     if (!PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.playerId))
     {
         Dictionary <string, bool> _votes = PersistentContainer.Instance.PollVote;
         _votes.Add(_cInfo.playerId, false);
         PersistentContainer.Instance.PollVote = _votes;
         PersistentContainer.Instance.Save();
         using (StreamWriter sw = new StreamWriter(Poll.Filepath, true))
         {
             sw.WriteLine(string.Format("{0}: Player {1} {2} has voted no in the poll.", DateTime.Now, _cInfo.playerName, _cInfo.playerId));
             sw.WriteLine();
             sw.Flush();
             sw.Close();
         }
         Phrases.Dict.TryGetValue(565, out string _phrase565);
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase565 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
     else
     {
         Phrases.Dict.TryGetValue(566, out string _phrase566);
         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase566 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Exemple #23
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (Shutdown.IsEnabled)
         {
             if (_senderInfo.RemoteClientInfo != null && _senderInfo.RemoteClientInfo.playerId != null)
             {
                 EventSchedule.Schedule.TryGetValue("Shutdown", out DateTime _timeLeft);
                 TimeSpan varTime           = _timeLeft - DateTime.Now;
                 double   fractionalMinutes = varTime.TotalMinutes;
                 int      _remainingTime    = (int)fractionalMinutes;
                 if (_remainingTime <= 10 && Event.Open)
                 {
                     Phrases.Dict.TryGetValue(422, out string _phrase422);
                     ChatHook.ChatMessage(_senderInfo.RemoteClientInfo, Config.Chat_Response_Color + _phrase422 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                     return;
                 }
                 string TimeLeft;
                 TimeLeft = string.Format("{0:00} H : {1:00} M", _remainingTime / 60, _remainingTime % 60);
                 Phrases.Dict.TryGetValue(421, out string _phrase421);
                 _phrase421 = _phrase421.Replace("{TimeLeft}", TimeLeft);
                 ChatHook.ChatMessage(_senderInfo.RemoteClientInfo, Config.Chat_Response_Color + _phrase421 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
         }
         else
         {
             SdtdConsole.Instance.Output("[SERVERTOOLS] Shutdown is not enabled.");
             return;
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in NextShutdownConsole.Execute: {0}", e.Message));
     }
 }
        public static void Response(ClientInfo _cInfo, bool _announce, string _playerName)
        {
            string _adminList = string.Join(", ", Admins.ToArray());
            string _modList   = string.Join(", ", Mods.ToArray());

            if (_announce)
            {
                string _phrase725;
                if (!Phrases.Dict.TryGetValue(725, out _phrase725))
                {
                    _phrase725 = "Server admins in game: [FF8000]";
                }
                string _phrase726;
                if (!Phrases.Dict.TryGetValue(726, out _phrase726))
                {
                    _phrase726 = "Server moderators in game: [FF8000]";
                }
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase725 + _adminList + ".[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase726 + _modList + ".[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
            }
            else
            {
                string _phrase725;
                if (!Phrases.Dict.TryGetValue(725, out _phrase725))
                {
                    _phrase725 = "Server admins in game: [FF8000]";
                }
                string _phrase726;
                if (!Phrases.Dict.TryGetValue(726, out _phrase726))
                {
                    _phrase726 = "Server moderators in game: [FF8000]";
                }
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase725 + _adminList + ".[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase726 + _modList + ".[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
 public static void Exec()
 {
     try
     {
         if (MsgList.Count > 0 && ConnectionManager.Instance.ClientCount() > 0)
         {
             if (Random)
             {
                 MsgList.RandomizeList();
                 string            message    = MsgList[0];
                 List <ClientInfo> clientList = PersistentOperations.ClientList();
                 if (clientList != null)
                 {
                     for (int i = 0; i < clientList.Count; i++)
                     {
                         ClientInfo cInfo = clientList[i];
                         if (cInfo != null)
                         {
                             if (!ExemptionList.Contains(cInfo.CrossplatformId.CombinedString))
                             {
                                 message = message.Replace("{EntityId}", cInfo.entityId.ToString());
                                 message = message.Replace("{Id}", cInfo.PlatformId.CombinedString);
                                 message = message.Replace("{EOS}", cInfo.CrossplatformId.CombinedString);
                                 message = message.Replace("{PlayerName}", cInfo.playerName);
                                 ChatHook.ChatMessage(cInfo, Config.Chat_Response_Color + message + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                             }
                         }
                     }
                     MsgList.RemoveAt(0);
                     if (MsgList.Count == 0)
                     {
                         BuildList();
                     }
                 }
             }
             else
             {
                 string            message    = MsgList[0];
                 List <ClientInfo> clientList = PersistentOperations.ClientList();
                 if (clientList != null)
                 {
                     for (int i = 0; i < clientList.Count; i++)
                     {
                         ClientInfo cInfo = clientList[i];
                         if (cInfo != null)
                         {
                             if (!ExemptionList.Contains(cInfo.CrossplatformId.CombinedString))
                             {
                                 message = message.Replace("{EntityId}", cInfo.entityId.ToString());
                                 message = message.Replace("{Id}", cInfo.PlatformId.CombinedString);
                                 message = message.Replace("{EOS}", cInfo.CrossplatformId.CombinedString);
                                 message = message.Replace("{PlayerName}", cInfo.playerName);
                                 ChatHook.ChatMessage(cInfo, Config.Chat_Response_Color + message + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                             }
                         }
                     }
                     MsgList.RemoveAt(0);
                     if (MsgList.Count == 0)
                     {
                         BuildList();
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in InfoTicker.Exec: {0}", e.Message));
     }
 }
Exemple #26
0
 private static void TeleportPlayer(ClientInfo _cInfo)
 {
     if (DeathTime.ContainsKey(_cInfo.entityId))
     {
         if (DeathTime.TryGetValue(_cInfo.entityId, out DateTime _time))
         {
             TimeSpan varTime           = DateTime.Now - _time;
             double   fractionalMinutes = varTime.TotalMinutes;
             int      timepassed        = (int)fractionalMinutes;
             if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay)
             {
                 if (ReservedSlots.Dict.ContainsKey(_cInfo.PlatformId.CombinedString) || ReservedSlots.Dict.ContainsKey(_cInfo.CrossplatformId.CombinedString))
                 {
                     if (ReservedSlots.Dict.TryGetValue(_cInfo.PlatformId.CombinedString, out DateTime dt))
                     {
                         if (DateTime.Now < dt)
                         {
                             int newTime = timepassed / 2;
                             timepassed = newTime;
                         }
                     }
                     else if (ReservedSlots.Dict.TryGetValue(_cInfo.CrossplatformId.CombinedString, out dt))
                     {
                         if (DateTime.Now < dt)
                         {
                             int newTime = timepassed / 2;
                             timepassed = newTime;
                         }
                     }
                 }
             }
             if (timepassed < Time)
             {
                 if (LastDeathPos.TryGetValue(_cInfo.entityId, out string _value))
                 {
                     string[] cords = _value.Split(',');
                     int.TryParse(cords[0], out int x);
                     int.TryParse(cords[1], out int y);
                     int.TryParse(cords[2], out int z);
                     _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(x, y, z), null, false));
                     DeathTime.Remove(_cInfo.entityId);
                     LastDeathPos.Remove(_cInfo.entityId);
                     if (Wallet.IsEnabled && Command_Cost >= 1)
                     {
                         Wallet.RemoveCurrency(_cInfo.CrossplatformId.CombinedString, Command_Cost);
                     }
                     PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].LastDied = DateTime.Now;
                 }
             }
             else
             {
                 Phrases.Dict.TryGetValue("Died2", out string phrase);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
         }
     }
     else
     {
         Phrases.Dict.TryGetValue("Died4", out string phrase);
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Exemple #27
0
 public static bool ProcessEntityDamage(EntityAlive __instance, DamageResponse _dmResponse)
 {
     try
     {
         if (__instance != null && _dmResponse.Source != null && _dmResponse.Strength > 1)
         {
             if (__instance is EntityPlayer player)
             {
                 EntityPlayer _player1  = player;
                 int          _sourceId = _dmResponse.Source.getEntityId();
                 if (_sourceId > 0 && _player1.entityId != _sourceId)
                 {
                     ClientInfo _cInfo2 = PersistentOperations.GetClientInfoFromEntityId(_sourceId);
                     if (_cInfo2 != null)
                     {
                         EntityPlayer _player2 = PersistentOperations.GetEntityPlayer(_cInfo2.playerId);
                         if (_player2 != null)
                         {
                             if (IsEnabled)
                             {
                                 ItemValue _itemValue = ItemClass.GetItem(_player2.inventory.holdingItem.Name, false);
                                 if (_itemValue != null)
                                 {
                                     int _distance = (int)_player2.GetDistance(__instance);
                                     using (StreamWriter sw = new StreamWriter(filepath, true, Encoding.UTF8))
                                     {
                                         sw.WriteLine(string.Format("{0}: {1} \"{2}\" hit \"{3}\" with entity id {4} using {5} for {6} damage @ {7}. Distance: {8}", DateTime.Now, _cInfo2.playerId, _cInfo2.playerName, __instance.EntityName, __instance.entityId, _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.GetItemName(), _dmResponse.Strength, __instance.position, _distance));
                                         sw.WriteLine();
                                         sw.Flush();
                                         sw.Close();
                                     }
                                     if (_dmResponse.Strength >= Player_Damage_Limit && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo2) > Admin_Level)
                                     {
                                         Phrases.Dict.TryGetValue(952, out string _phrase952);
                                         SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"{1} {2}\"", _cInfo2.playerId, _phrase952, _dmResponse.Strength), null);
                                         using (StreamWriter sw = new StreamWriter(detectionFilepath, true, Encoding.UTF8))
                                         {
                                             sw.WriteLine(string.Format("Detected \"{0}\" Steam Id {1}, exceeded damage limit @ {2}. Damage: {3}", _cInfo2.playerName, _cInfo2.playerId, __instance.position, _dmResponse.Strength));
                                             sw.WriteLine();
                                             sw.Flush();
                                             sw.Close();
                                         }
                                         Phrases.Dict.TryGetValue(951, out string _phrase951);
                                         _phrase951 = _phrase951.Replace("{PlayerName}", _cInfo2.playerName);
                                         ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase951 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
                                         return(false);
                                     }
                                 }
                             }
                             if (Zones.IsEnabled && (Zones.ZonePvE.Contains(__instance.entityId) || Zones.ZonePvE.Contains(_cInfo2.entityId)))
                             {
                                 Phrases.Dict.TryGetValue(323, out string _phrase323);
                                 ChatHook.ChatMessage(_cInfo2, Config.Chat_Response_Color + _phrase323 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                                 if (!_player1.IsFriendsWith(_player2))
                                 {
                                     if (PersistentOperations.PvEViolations.ContainsKey(_cInfo2.entityId))
                                     {
                                         PersistentOperations.PvEViolations.TryGetValue(_cInfo2.entityId, out int _violations);
                                         _violations++;
                                         PersistentOperations.PvEViolations[_cInfo2.entityId] = _violations;
                                         if (PersistentOperations.Jail_Violation > 0 && _violations == PersistentOperations.Jail_Violation)
                                         {
                                             Jail(_cInfo2, __instance);
                                         }
                                         if (PersistentOperations.Kill_Violation > 0 && _violations == PersistentOperations.Kill_Violation)
                                         {
                                             Kill(_cInfo2);
                                         }
                                         if (PersistentOperations.Kick_Violation > 0 && _violations == PersistentOperations.Kick_Violation)
                                         {
                                             Kick(_cInfo2);
                                         }
                                         if (PersistentOperations.Ban_Violation > 0 && _violations == PersistentOperations.Ban_Violation)
                                         {
                                             Ban(_cInfo2);
                                         }
                                     }
                                     else
                                     {
                                         PersistentOperations.PvEViolations.Add(_cInfo2.entityId, 1);
                                     }
                                 }
                                 return(false);
                             }
                             if ((Lobby.IsEnabled && Lobby.PvE && Lobby.LobbyPlayers.Contains(__instance.entityId)) || (Market.IsEnabled && Market.PvE && Market.MarketPlayers.Contains(__instance.entityId)))
                             {
                                 Phrases.Dict.TryGetValue(260, out string _phrase260);
                                 ChatHook.ChatMessage(_cInfo2, Config.Chat_Response_Color + _phrase260 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                                 if (!_player1.IsFriendsWith(_player2))
                                 {
                                     if (PersistentOperations.PvEViolations.ContainsKey(_cInfo2.entityId))
                                     {
                                         PersistentOperations.PvEViolations.TryGetValue(_cInfo2.entityId, out int _violations);
                                         _violations++;
                                         PersistentOperations.PvEViolations[_cInfo2.entityId] = _violations;
                                         if (PersistentOperations.Jail_Violation > 0 && _violations == PersistentOperations.Jail_Violation)
                                         {
                                             Jail(_cInfo2, __instance);
                                         }
                                         if (PersistentOperations.Kill_Violation > 0 && _violations == PersistentOperations.Kill_Violation)
                                         {
                                             Kill(_cInfo2);
                                         }
                                         if (PersistentOperations.Kick_Violation > 0 && _violations == PersistentOperations.Kick_Violation)
                                         {
                                             Kick(_cInfo2);
                                         }
                                         else if (PersistentOperations.Ban_Violation > 0 && _violations == PersistentOperations.Ban_Violation)
                                         {
                                             Ban(_cInfo2);
                                         }
                                     }
                                     else
                                     {
                                         PersistentOperations.PvEViolations.Add(_cInfo2.entityId, 1);
                                     }
                                 }
                                 return(false);
                             }
                             if (KillNotice.IsEnabled && KillNotice.Show_Damage && KillNotice.PvP)
                             {
                                 if (KillNotice.Damage.ContainsKey(_player1.entityId))
                                 {
                                     KillNotice.Damage[_player1.entityId] = _dmResponse.Strength;
                                 }
                                 else
                                 {
                                     KillNotice.Damage.Add(_player1.entityId, _dmResponse.Strength);
                                 }
                             }
                         }
                     }
                 }
             }
             else if (IsEnabled && __instance is EntityZombie)
             {
                 int _sourceId = _dmResponse.Source.getEntityId();
                 if (_sourceId > 0)
                 {
                     ClientInfo _cInfo = PersistentOperations.GetClientInfoFromEntityId(_sourceId);
                     if (_cInfo != null)
                     {
                         EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId);
                         if (_player != null)
                         {
                             ItemValue _itemValue = ItemClass.GetItem(_player.inventory.holdingItem.Name, false);
                             if (_itemValue != null)
                             {
                                 int _distance = (int)_player.GetDistance(__instance);
                                 using (StreamWriter sw = new StreamWriter(filepath, true, Encoding.UTF8))
                                 {
                                     sw.WriteLine(string.Format("{0}: {1} \"{2}\" hit \"{3}\" with entity id {4} using {5} for {6} damage @ {7}. Distance: {8}", DateTime.Now, _cInfo.playerId, _cInfo.playerName, __instance.EntityName, __instance.entityId, _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.GetItemName(), _dmResponse.Strength, __instance.position, _distance));
                                     sw.WriteLine();
                                     sw.Flush();
                                     sw.Close();
                                 }
                                 if (_dmResponse.Strength >= Entity_Damage_Limit && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > Admin_Level)
                                 {
                                     Phrases.Dict.TryGetValue(952, out string _phrase952);
                                     SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"{1} {2}\"", _cInfo.playerId, _phrase952, _dmResponse.Strength), null);
                                     using (StreamWriter sw = new StreamWriter(detectionFilepath, true, Encoding.UTF8))
                                     {
                                         sw.WriteLine(string.Format("Detected \"{0}\" Steam Id {1}, exceeded damage limit @ {2}. Damage: {3}", _cInfo.playerName, _cInfo.playerId, __instance.position, _dmResponse.Strength));
                                         sw.WriteLine();
                                         sw.Flush();
                                         sw.Close();
                                     }
                                     Phrases.Dict.TryGetValue(951, out string _phrase951);
                                     _phrase951 = _phrase951.Replace("{PlayerName}", _cInfo.playerName);
                                     ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase951 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
                                     return(false);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ProcessDamage.ProcessEntityDamage: {0}", e.Message));
     }
     return(true);
 }
 public static void CheckInv(ClientInfo _cInfo, PlayerDataFile _playerDataFile)
 {
     if (_cInfo != null)
     {
         AdminToolsClientInfo Admin = GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId);
         if (Admin.PermissionLevel > Admin_Level)
         {
             int _bagClean = 0, _invClean = 0, _totalBagCount = 0, _totalInventoryCount = 0;
             for (int i = 0; i < _playerDataFile.inventory.Length; i++)
             {
                 ItemStack _itemStack = new ItemStack();
                 ItemValue _itemValue = new ItemValue();
                 _itemStack = _playerDataFile.inventory[i];
                 _itemValue = _itemStack.itemValue;
                 int _count = _playerDataFile.inventory[i].count;
                 if (_count > 0 && _itemValue != null && !_itemValue.Equals(ItemValue.None) && _cInfo != null)
                 {
                     int    _maxAllowed = ItemClass.list[_itemValue.type].Stacknumber.Value;
                     string _name       = ItemClass.list[_itemValue.type].GetItemName();
                     if (Announce_Invalid_Stack && _count > _maxAllowed)
                     {
                         string _phrase3;
                         if (!Phrases.Dict.TryGetValue(3, out _phrase3))
                         {
                             _phrase3 = " you have a invalid item stack: {ItemName} {ItemCount}. Max per stack: {MaxPerStack}.";
                         }
                         _phrase3 = _phrase3.Replace("{ItemName}", _name);
                         _phrase3 = _phrase3.Replace("{ItemCount}", _count.ToString());
                         _phrase3 = _phrase3.Replace("{MaxPerStack}", _maxAllowed.ToString());
                         ChatHook.ChatMessage(_cInfo, "[FF0000]" + _cInfo.playerName + _phrase3 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                         ChatLog.Log(_phrase3, LoadConfig.Server_Response_Name);
                     }
                     if (IsEnabled && (dict.Contains(_name) || _itemValue.ItemClass.CreativeMode == EnumCreativeMode.Dev || _itemValue.ItemClass.CreativeMode == EnumCreativeMode.None))
                     {
                         if (Ban_Player)
                         {
                             string _phrase4;
                             if (!Phrases.Dict.TryGetValue(4, out _phrase4))
                             {
                                 _phrase4 = "Cheat Detected: Auto banned {PlayerName} for having a invalid item: {ItemName}.";
                             }
                             _phrase4 = _phrase4.Replace("{PlayerName}", _cInfo.playerName);
                             _phrase4 = _phrase4.Replace("{ItemName}", _name);
                             ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase4 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                             SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"Invalid Item {1}\"", _cInfo.entityId, _name), (ClientInfo)null);
                             using (StreamWriter sw = new StreamWriter(_filepath, true))
                             {
                                 sw.WriteLine(string.Format("Detected {0}, Steam Id {1}, with invalid item: {2}. Banned the player.", _cInfo.playerName, _cInfo.playerId, _name));
                                 sw.WriteLine();
                                 sw.Flush();
                                 sw.Close();
                             }
                         }
                         else
                         {
                             if (playerflag.ContainsKey(_cInfo.entityId))
                             {
                                 int _value;
                                 if (playerflag.TryGetValue(_cInfo.entityId, out _value))
                                 {
                                     if (_value == 2)
                                     {
                                         SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Invalid Item: {1}\"", _cInfo.entityId, _name), (ClientInfo)null);
                                         string _phrase5;
                                         if (!Phrases.Dict.TryGetValue(5, out _phrase5))
                                         {
                                             _phrase5 = "Cheat Detected: Auto kicked {PlayerName} for having a invalid item: {ItemName}.";
                                         }
                                         _phrase5 = _phrase5.Replace("{PlayerName}", _cInfo.playerName);
                                         _phrase5 = _phrase5.Replace("{ItemName}", _name);
                                         ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase5 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                         using (StreamWriter sw = new StreamWriter(_filepath, true))
                                         {
                                             sw.WriteLine(string.Format("Detected {0}, Steam Id {1}, with invalid item: {2}. Kicked the player.", _cInfo.playerName, _cInfo.playerId, _name));
                                             sw.WriteLine();
                                             sw.Flush();
                                             sw.Close();
                                         }
                                         playerflag.Remove(_cInfo.entityId);
                                     }
                                     else
                                     {
                                         playerflag[_cInfo.entityId] = 2;
                                         string _phrase799;
                                         if (!Phrases.Dict.TryGetValue(799, out _phrase799))
                                         {
                                             _phrase799 = "Cheat Detected: {PlayerName} you are holding a invalid item: {ItemName}. Final warning, drop it!";
                                         }
                                         _phrase799 = _phrase799.Replace("{PlayerName}", _cInfo.playerName);
                                         _phrase799 = _phrase799.Replace("{ItemName}", _name);
                                         ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase799 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                     }
                                 }
                             }
                             else
                             {
                                 playerflag.Add(_cInfo.entityId, 1);
                                 string _phrase800;
                                 if (!Phrases.Dict.TryGetValue(800, out _phrase800))
                                 {
                                     _phrase800 = "Cheat Detected: {PlayerName} you are holding a invalid item: {ItemName}. You have 30 seconds to drop it.";
                                 }
                                 _phrase800 = _phrase800.Replace("{PlayerName}", _cInfo.playerName);
                                 _phrase800 = _phrase800.Replace("{ItemName}", _name);
                                 ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase800 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                             }
                         }
                     }
                     else if (IsEnabled)
                     {
                         _totalInventoryCount++;
                         if (_totalInventoryCount == _count)
                         {
                             _totalInventoryCount = 0;
                             _invClean            = 1;
                         }
                     }
                 }
             }
             for (int i = 0; i < _playerDataFile.bag.Length; i++)
             {
                 ItemStack _intemStack = new ItemStack();
                 ItemValue _itemValue  = new ItemValue();
                 _intemStack = _playerDataFile.bag[i];
                 _itemValue  = _intemStack.itemValue;
                 int _count = _playerDataFile.bag[i].count;
                 if (_count > 0 && _itemValue != null && !_itemValue.Equals(ItemValue.None) && _cInfo != null)
                 {
                     int    _maxAllowed = ItemClass.list[_itemValue.type].Stacknumber.Value;
                     string _name       = ItemClass.list[_itemValue.type].GetItemName();
                     if (Announce_Invalid_Stack && _count > _maxAllowed)
                     {
                         string _phrase3;
                         if (!Phrases.Dict.TryGetValue(3, out _phrase3))
                         {
                             _phrase3 = " you have a invalid item stack: {ItemName} {ItemCount}. Max per stack: {MaxPerStack}.";
                         }
                         _phrase3 = _phrase3.Replace("{ItemName}", _name);
                         _phrase3 = _phrase3.Replace("{ItemCount}", _count.ToString());
                         _phrase3 = _phrase3.Replace("{MaxPerStack}", _maxAllowed.ToString());
                         ChatLog.Log(_phrase3, LoadConfig.Server_Response_Name);
                         ChatHook.ChatMessage(_cInfo, "[FF0000]" + _cInfo.playerName + _phrase3 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     }
                     if (IsEnabled && (dict.Contains(_name) || _itemValue.ItemClass.CreativeMode == EnumCreativeMode.Dev || _itemValue.ItemClass.CreativeMode == EnumCreativeMode.None))
                     {
                         if (Ban_Player)
                         {
                             SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 5 years \"Invalid Item {1}\"", _cInfo.entityId, _name), (ClientInfo)null);
                             string _phrase4;
                             if (!Phrases.Dict.TryGetValue(4, out _phrase4))
                             {
                                 _phrase4 = "Cheat Detected: Auto banned {PlayerName} for having a invalid item: {ItemName}.";
                             }
                             _phrase4 = _phrase4.Replace("{PlayerName}", _cInfo.playerName);
                             _phrase4 = _phrase4.Replace("{ItemName}", _name);
                             ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase4 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                         }
                         else
                         {
                             if (playerflag.ContainsKey(_cInfo.entityId))
                             {
                                 int _value;
                                 if (playerflag.TryGetValue(_cInfo.entityId, out _value))
                                 {
                                     if (_value == 2)
                                     {
                                         string _phrase5;
                                         if (!Phrases.Dict.TryGetValue(5, out _phrase5))
                                         {
                                             _phrase5 = "Cheat Detected: Auto kicked {PlayerName} for having a invalid item: {ItemName}.";
                                         }
                                         _phrase5 = _phrase5.Replace("{PlayerName}", _cInfo.playerName);
                                         _phrase5 = _phrase5.Replace("{ItemName}", _name);
                                         ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase5 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                         SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Invalid Item: {1}\"", _cInfo.entityId, _name), (ClientInfo)null);
                                         using (StreamWriter sw = new StreamWriter(_filepath, true))
                                         {
                                             sw.WriteLine(string.Format("Detected {0}, Steam Id {1}, with invalid item: {2}. Kicked the player.", _cInfo.playerName, _cInfo.playerId, _name));
                                             sw.WriteLine();
                                             sw.Flush();
                                             sw.Close();
                                         }
                                         playerflag.Remove(_cInfo.entityId);
                                     }
                                     else
                                     {
                                         playerflag[_cInfo.entityId] = 2;
                                         string _phrase799;
                                         if (!Phrases.Dict.TryGetValue(799, out _phrase799))
                                         {
                                             _phrase799 = "Cheat Detected: {PlayerName} you are holding a invalid item: {ItemName}. Final warning, drop it!";
                                         }
                                         _phrase799 = _phrase799.Replace("{PlayerName}", _cInfo.playerName);
                                         _phrase799 = _phrase799.Replace("{ItemName}", _name);
                                         ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase799 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                     }
                                 }
                             }
                             else
                             {
                                 playerflag.Add(_cInfo.entityId, 1);
                                 string _phrase800;
                                 if (!Phrases.Dict.TryGetValue(800, out _phrase800))
                                 {
                                     _phrase800 = "Cheat Detected: {PlayerName} you are holding a invalid item: {ItemName}. You have 30 seconds to drop it.";
                                 }
                                 _phrase800 = _phrase800.Replace("{PlayerName}", _cInfo.playerName);
                                 _phrase800 = _phrase800.Replace("{ItemName}", _name);
                                 ChatHook.ChatMessage(_cInfo, "[FF0000]" + _phrase800 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                             }
                         }
                     }
                     else if (IsEnabled)
                     {
                         _totalBagCount++;
                         if (_totalBagCount == _count)
                         {
                             _totalBagCount = 0;
                             _bagClean      = 1;
                         }
                     }
                 }
             }
             if (_bagClean == 1 && _invClean == 1)
             {
                 _bagClean = 0;
                 _invClean = 0;
                 if (dropCheck.Contains(_cInfo.entityId))
                 {
                     dropCheck.Remove(_cInfo.entityId);
                 }
             }
         }
     }
 }
Exemple #29
0
        public static void TopThree(ClientInfo _cInfo)
        {
            int           _topSession1 = 0, _topSession2 = 0, _topSession3 = 0, _topScore1 = 0, _topScore2 = 0, _topScore3 = 0;
            string        _sessionName1 = "", _sessionName2 = "", _sessionName3 = "", _ScoreName1 = "", _ScoreName2 = "", _ScoreName3 = "";
            List <string> _persistentPlayers = PersistentContainer.Instance.Players.SteamIDs;

            for (int i = 0; i < _persistentPlayers.Count; i++)
            {
                if (PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreSavedStats != null && PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreSavedStats.Count > 0)
                {
                    List <string[]> _hardcoreSavedStats = PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreSavedStats;
                    for (int j = 0; j < _hardcoreSavedStats.Count; j++)
                    {
                        string[] _stats = _hardcoreSavedStats[j];
                        int.TryParse(_stats[1], out int _sessionTime);
                        if (_sessionTime > _topSession1)
                        {
                            _topSession3  = _topSession2;
                            _sessionName3 = _sessionName2;
                            _topSession2  = _topSession1;
                            _sessionName2 = _sessionName1;
                            _topSession1  = _sessionTime;
                            _sessionName1 = _stats[0];
                        }
                        else if (_sessionTime > _topSession2)
                        {
                            _topSession3  = _topSession2;
                            _sessionName3 = _sessionName2;
                            _topSession2  = _sessionTime;
                            _sessionName2 = _stats[0];
                        }
                        else if (_sessionTime > _topSession3)
                        {
                            _topSession3  = _sessionTime;
                            _sessionName3 = _stats[0];
                        }
                        int.TryParse(_stats[4], out int _score);
                        if (_score > _topScore1)
                        {
                            _topScore3  = _topScore2;
                            _ScoreName3 = _ScoreName2;
                            _topScore2  = _topScore1;
                            _ScoreName2 = _ScoreName1;
                            _topScore1  = _score;
                            _ScoreName1 = _stats[0];
                        }
                        else if (_score > _topScore2)
                        {
                            _topScore3  = _topScore2;
                            _ScoreName3 = _ScoreName2;
                            _topScore2  = _score;
                            _ScoreName2 = _stats[0];
                        }
                        else if (_score > _topScore3)
                        {
                            _topScore3  = _score;
                            _ScoreName3 = _stats[0];
                        }
                    }
                }
            }
            if (_sessionName1 != "" || _ScoreName1 != null)
            {
                Phrases.Dict.TryGetValue(591, out string _phrase591);
                ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase591 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                Phrases.Dict.TryGetValue(592, out string _phrase592);
                _phrase592 = _phrase592.Replace("{Name1}", _sessionName1);
                _phrase592 = _phrase592.Replace("{Session1}", _topSession1.ToString());
                _phrase592 = _phrase592.Replace("{Name2}", _sessionName2);
                _phrase592 = _phrase592.Replace("{Session2}", _topSession2.ToString());
                _phrase592 = _phrase592.Replace("{Name3}", _sessionName3);
                _phrase592 = _phrase592.Replace("{Session3}", _topSession3.ToString());
                ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase592 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                Phrases.Dict.TryGetValue(593, out string _phrase593);
                _phrase593 = _phrase593.Replace("{Name1}", _ScoreName1);
                _phrase593 = _phrase593.Replace("{Score1}", _topScore1.ToString());
                _phrase593 = _phrase593.Replace("{Name2}", _ScoreName2);
                _phrase593 = _phrase593.Replace("{Score2}", _topScore2.ToString());
                _phrase593 = _phrase593.Replace("{Name3}", _ScoreName3);
                _phrase593 = _phrase593.Replace("{Score3}", _topScore3.ToString());
                ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase593 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
            }
            else
            {
                Phrases.Dict.TryGetValue(596, out string _phrase596);
                ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase596 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Exemple #30
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);
         }
     }
 }