Пример #1
0
 public static void HalfTime()
 {
     Phrases.Dict.TryGetValue(780, out string _phrase780);
     ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase780 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
 }
Пример #2
0
 public static void OldPlayerJoined(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         string id = _cInfo.CrossplatformId.CombinedString;
         if (Hardcore.IsEnabled && PersistentContainer.Instance.Players[id] != null)
         {
             if (Hardcore.Optional)
             {
                 if (PersistentContainer.Instance.Players[id].HardcoreEnabled)
                 {
                     Hardcore.Check(_cInfo, _player);
                 }
             }
             else if (!PersistentContainer.Instance.Players[id].HardcoreEnabled)
             {
                 string[] hardcoreStats = { _cInfo.playerName, "0", "0" };
                 PersistentContainer.Instance.Players[id].HardcoreStats   = hardcoreStats;
                 PersistentContainer.Instance.Players[id].HardcoreEnabled = true;
                 PersistentContainer.DataChange = true;
                 Hardcore.Check(_cInfo, _player);
             }
         }
         if (LoginNotice.IsEnabled && LoginNotice.Dict1.ContainsKey(_cInfo.PlatformId.CombinedString) || LoginNotice.Dict1.ContainsKey(id))
         {
             LoginNotice.PlayerNotice(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (Shutdown.IsEnabled && Shutdown.Alert_On_Login)
         {
             Shutdown.NextShutdown(_cInfo);
         }
         if (ExitCommand.IsEnabled)
         {
             ExitCommand.AlertPlayer(_cInfo);
         }
         if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(id))
         {
             Poll.Message(_cInfo);
         }
         if (ClanManager.IsEnabled && PersistentContainer.Instance.Players[id] != null)
         {
             Dictionary <string, string> clanRequests = PersistentContainer.Instance.Players[id].ClanRequestToJoin;
             if (clanRequests != null && clanRequests.Count > 0)
             {
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + "New clan requests from:[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 foreach (var request in clanRequests)
                 {
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + request.Value + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
         }
         if (PersistentContainer.Instance.Players[id] != null)
         {
             if (PersistentContainer.Instance.Players[id].EventSpawn)
             {
                 PersistentContainer.Instance.Players[id].EventSpawn = false;
                 PersistentContainer.DataChange = true;
             }
             if (Wallet.IsEnabled && PersistentContainer.Instance.Players[id].PlayerWallet > 0)
             {
                 Wallet.AddCurrency(id, PersistentContainer.Instance.Players[id].PlayerWallet);
                 PersistentContainer.Instance.Players[id].PlayerWallet = 0;
                 PersistentContainer.DataChange = true;
             }
             if (PersistentContainer.Instance.Players[id].JailRelease)
             {
                 PersistentContainer.Instance.Players[id].JailRelease = false;
                 PersistentContainer.DataChange = true;
                 Vector3[] _pos = GameManager.Instance.World.GetRandomSpawnPointPositions(1);
                 _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_pos[0].x, _pos[0].y + 1, _pos[0].z), null, false));
                 Phrases.Dict.TryGetValue("Jail2", out string phrase);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
         }
         if (AutoPartyInvite.IsEnabled)
         {
             AutoPartyInvite.Exec(_cInfo, _player);
         }
         if (Event.Open && Event.Teams.ContainsKey(id) && PersistentContainer.Instance.Players[id] != null && PersistentContainer.Instance.Players[id].EventSpawn)
         {
             Event.Spawn(_cInfo);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.OldPlayerJoined: {0}", e.Message));
     }
 }
Пример #3
0
        public static void Delay(ClientInfo _cInfo, string _playerName, bool _announce)
        {
            bool _donator = false;

            if (Delay_Between_Uses < 1)
            {
                if (Wallet.IsEnabled && Command_Cost >= 1)
                {
                    CommandCost(_cInfo, _playerName);
                }
                else
                {
                    Exec(_cInfo, _playerName);
                }
            }
            else
            {
                string    _sql    = string.Format("SELECT lastMarket FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                DataTable _result = SQL.TQuery(_sql);
                DateTime  _lastMarket;
                DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastMarket);
                _result.Dispose();
                if (_lastMarket.ToString() == "10/29/2000 7:30:00 AM")
                {
                    if (Wallet.IsEnabled && Command_Cost >= 1)
                    {
                        CommandCost(_cInfo, _playerName);
                    }
                    else
                    {
                        Exec(_cInfo, _playerName);
                    }
                }
                else
                {
                    TimeSpan varTime           = DateTime.Now - _lastMarket;
                    double   fractionalMinutes = varTime.TotalMinutes;
                    int      _timepassed       = (int)fractionalMinutes;
                    if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay)
                    {
                        if (ReservedSlots.Dict.ContainsKey(_cInfo.playerId))
                        {
                            DateTime _dt;
                            ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt);
                            if (DateTime.Now < _dt)
                            {
                                _donator = true;
                                int _newDelay = Delay_Between_Uses / 2;
                                if (_timepassed >= _newDelay)
                                {
                                    if (Wallet.IsEnabled && Command_Cost >= 1)
                                    {
                                        CommandCost(_cInfo, _playerName);
                                    }
                                    else
                                    {
                                        Exec(_cInfo, _playerName);
                                    }
                                }
                                else
                                {
                                    int    _timeleft = _newDelay - _timepassed;
                                    string _phrase560;
                                    if (!Phrases.Dict.TryGetValue(560, out _phrase560))
                                    {
                                        _phrase560 = "you can only use /market once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
                                    }
                                    _phrase560 = _phrase560.Replace("{DelayBetweenUses}", _newDelay.ToString());
                                    _phrase560 = _phrase560.Replace("{TimeRemaining}", _timeleft.ToString());
                                    if (_announce)
                                    {
                                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase560 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                    }
                                    else
                                    {
                                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase560 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                    }
                                }
                            }
                        }
                    }
                    if (!_donator)
                    {
                        if (_timepassed >= Delay_Between_Uses)
                        {
                            if (Wallet.IsEnabled && Command_Cost >= 1)
                            {
                                CommandCost(_cInfo, _playerName);
                            }
                            else
                            {
                                Exec(_cInfo, _playerName);
                            }
                        }
                        else
                        {
                            int    _timeleft = Delay_Between_Uses - _timepassed;
                            string _phrase560;
                            if (!Phrases.Dict.TryGetValue(560, out _phrase560))
                            {
                                _phrase560 = "{PlayerName} you can only use /market once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
                            }
                            _phrase560 = _phrase560.Replace("{PlayerName}", _playerName);
                            _phrase560 = _phrase560.Replace("{DelayBetweenUses}", Delay_Between_Uses.ToString());
                            _phrase560 = _phrase560.Replace("{TimeRemaining}", _timeleft.ToString());
                            if (_announce)
                            {
                                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase560 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                            }
                            else
                            {
                                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase560 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                            }
                        }
                    }
                }
            }
        }
Пример #4
0
        private static void Kill(ClientInfo _cInfo)
        {
            EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];

            if (PvP_Check)
            {
                List <ClientInfo> ClientInfoList = ConnectionManager.Instance.Clients.List.ToList();
                for (int i = 0; i < ClientInfoList.Count; i++)
                {
                    ClientInfo _cInfo2 = ClientInfoList[i];
                    if (_cInfo2 != null)
                    {
                        EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo2.entityId];
                        if (_player2 != null)
                        {
                            Vector3 _pos2 = _player2.GetPosition();
                            if (((int)_player.position.x - (int)_pos2.x) * ((int)_player.position.x - (int)_pos2.x) + ((int)_player.position.z - (int)_pos2.z) * ((int)_player.position.z - (int)_pos2.z) <= 25 * 25)
                            {
                                if (!_player.IsFriendsWith(_player2))
                                {
                                    string _phrase819;
                                    if (!Phrases.Dict.TryGetValue(819, out _phrase819))
                                    {
                                        _phrase819 = " you are too close to a player that is not a friend. Command unavailable.";
                                    }
                                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase819 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                    return;
                                }
                            }
                        }
                    }
                }
            }
            if (Zombie_Check)
            {
                List <Entity> Entities = GameManager.Instance.World.Entities.list;
                for (int i = 0; i < Entities.Count; i++)
                {
                    Entity _entity = Entities[i];
                    if (_entity != null)
                    {
                        EntityType _type = _entity.entityType;
                        if (_type == EntityType.Zombie)
                        {
                            Vector3 _pos2 = _entity.GetPosition();
                            if (((int)_player.position.x - (int)_pos2.x) * ((int)_player.position.x - (int)_pos2.x) + ((int)_player.position.z - (int)_pos2.z) * ((int)_player.position.z - (int)_pos2.z) <= 10 * 10)
                            {
                                string _phrase820;
                                if (!Phrases.Dict.TryGetValue(820, out _phrase820))
                                {
                                    _phrase820 = " you are too close to a zombie. Command unavailable.";
                                }
                                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase820 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                return;
                            }
                        }
                    }
                }
            }
            SdtdConsole.Instance.ExecuteSync(string.Format("kill {0}", _cInfo.playerId), (ClientInfo)null);
            string _sql = string.Format("UPDATE Players SET lastkillme = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);

            SQL.FastQuery(_sql, "Suicide");
        }
Пример #5
0
 private static void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)//Spawning player
 {
     try
     {
         if (_cInfo != null)
         {
             string       id     = _cInfo.CrossplatformId.CombinedString;
             EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId);
             if (player != null)
             {
                 if (_respawnReason == RespawnType.NewGame)
                 {
                     if (player.distanceWalked < 1 && player.totalTimePlayed <= 1 && !PersistentOperations.NewPlayerQue.Contains(_cInfo))
                     {
                         PersistentOperations.NewPlayerQue.Add(_cInfo);
                     }
                 }
                 else if (_respawnReason == RespawnType.LoadedGame)
                 {
                 }
                 else if (_respawnReason == RespawnType.EnterMultiplayer)
                 {
                     PersistentOperations.SessionTime(_cInfo);
                     PersistentContainer.Instance.Players[id].PlayerName = _cInfo.playerName;
                     PersistentContainer.Instance.Players[id].LastJoined = DateTime.Now;
                     PersistentContainer.DataChange = true;
                     if (player.AttachedToEntity != null)
                     {
                         player.Detach();
                     }
                     if (player.distanceWalked < 1 && player.totalTimePlayed <= 1 && !PersistentOperations.NewPlayerQue.Contains(_cInfo))
                     {
                         PersistentOperations.NewPlayerQue.Add(_cInfo);
                     }
                     else
                     {
                         OldPlayerJoined(_cInfo, player);
                     }
                 }
                 else if (_respawnReason == RespawnType.JoinMultiplayer)
                 {
                     PersistentOperations.SessionTime(_cInfo);
                     PersistentContainer.Instance.Players[id].PlayerName = _cInfo.playerName;
                     PersistentContainer.Instance.Players[id].LastJoined = DateTime.Now;
                     PersistentContainer.DataChange = true;
                     if (player.AttachedToEntity != null)
                     {
                         player.Detach();
                     }
                     if (player.distanceWalked < 1 && player.totalTimePlayed <= 1 && !PersistentOperations.NewPlayerQue.Contains(_cInfo))
                     {
                         PersistentOperations.NewPlayerQue.Add(_cInfo);
                     }
                     else
                     {
                         OldPlayerJoined(_cInfo, player);
                     }
                 }
                 else if (_respawnReason == RespawnType.Died)
                 {
                     if (player.AttachedToEntity != null)
                     {
                         player.Detach();
                     }
                     if (Zones.IsEnabled && Zones.ZonePlayer.ContainsKey(_cInfo.entityId))
                     {
                         Zones.ZonePlayer.TryGetValue(player.entityId, out string[] zone);
                         Zones.ZonePlayer.Remove(player.entityId);
                         Zones.Reminder.Remove(player.entityId);
                         if (zone[9] != PersistentOperations.Player_Killing_Mode.ToString())
                         {
                             _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageConsoleCmdClient>().Setup(string.Format("sgs PlayerKillingMode {0}", PersistentOperations.Player_Killing_Mode), true));
                         }
                         if (Zones.Zone_Message && zone[5] != "")
                         {
                             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + zone[5] + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                         }
                         if (zone[7] != "")
                         {
                             Zones.ProcessCommand(_cInfo, zone[7]);
                         }
                     }
                     if (InfiniteAmmo.IsEnabled && InfiniteAmmo.Dict.ContainsKey(_cInfo.entityId))
                     {
                         InfiniteAmmo.Dict.Remove(_cInfo.entityId);
                     }
                     if (Bloodmoon.IsEnabled && Bloodmoon.Show_On_Respawn)
                     {
                         Bloodmoon.Exec(_cInfo);
                     }
                 }
                 else if (_respawnReason == RespawnType.Teleport)
                 {
                     if (Teleportation.Teleporting.Contains(_cInfo.entityId))
                     {
                         Teleportation.Teleporting.Remove(_cInfo.entityId);
                     }
                 }
                 if (PlayerChecks.TwoSecondMovement.ContainsKey(_cInfo.entityId))
                 {
                     PlayerChecks.TwoSecondMovement.Remove(_cInfo.entityId);
                 }
                 if (FlyingDetector.Flags.ContainsKey(_cInfo.entityId))
                 {
                     FlyingDetector.Flags.Remove(_cInfo.entityId);
                 }
                 if (SpeedDetector.Flags.ContainsKey(_cInfo.entityId))
                 {
                     SpeedDetector.Flags.Remove(_cInfo.entityId);
                 }
             }
             if (ExitCommand.IsEnabled && !ExitCommand.Players.ContainsKey(_cInfo.entityId) && (GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo.PlatformId) > ExitCommand.Admin_Level &&
                                                                                                GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo.CrossplatformId) > ExitCommand.Admin_Level))
             {
                 ExitCommand.Players.Add(_cInfo.entityId, player.position);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerSpawnedInWorld: {0}", e.Message));
     }
 }
Пример #6
0
 public static void InviteAccept(ClientInfo _cInfo)
 {
     try
     {
         bool _clanOwner = PersistentContainer.Instance.Players[_cInfo.playerId].ClanOwner;
         if (!_clanOwner)
         {
             string _clanInvite = PersistentContainer.Instance.Players[_cInfo.playerId].ClanInvite;
             if (string.IsNullOrEmpty(_clanInvite))
             {
                 Phrases.Dict.TryGetValue(83, out string _phrase83);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase83 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
             else
             {
                 ClanMember.Add(_cInfo.playerId);
                 PersistentContainer.Instance.Players[_cInfo.playerId].ClanInvite = "";
                 PersistentContainer.Instance.Players[_cInfo.playerId].ClanName   = _clanInvite;
                 for (int i = 0; i < ClanMember.Count; i++)
                 {
                     string _clanMember = ClanMember[i];
                     string _clanName   = PersistentContainer.Instance.Players[_clanMember].ClanName;
                     if (!string.IsNullOrEmpty(_clanName) && _clanName == _clanInvite)
                     {
                         ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForPlayerId(_clanMember);
                         if (_cInfo2 != null)
                         {
                             Phrases.Dict.TryGetValue(99, out string _phrase99);
                             _phrase99 = _phrase99.Replace("{PlayerName}", _cInfo.playerName);
                             ChatHook.ChatMessage(_cInfo2, Config.Chat_Response_Color + _phrase99 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                         }
                     }
                 }
             }
         }
         else
         {
             Dictionary <string, string> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin;
             if (_clanRequests != null && _clanRequests.Count > 0)
             {
                 KeyValuePair <string, string> _request = _clanRequests.First();
                 _clanRequests.Remove(_request.Key);
                 string _clanName  = PersistentContainer.Instance.Players[_cInfo.playerId].ClanName;
                 string _clanName1 = PersistentContainer.Instance.Players[_request.Key].ClanName;
                 if (!string.IsNullOrEmpty(_clanName1))
                 {
                     PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin = _clanRequests;
                     Phrases.Dict.TryGetValue(107, out string _phrase107);
                     _phrase107 = _phrase107.Replace("{PlayerName}", _request.Value);
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase107 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                     return;
                 }
                 ClanMember.Add(_request.Key);
                 PersistentContainer.Instance.Players[_request.Key].ClanInvite           = "";
                 PersistentContainer.Instance.Players[_request.Key].ClanName             = _clanName;
                 PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin = _clanRequests;
                 for (int i = 0; i < ClanMember.Count; i++)
                 {
                     string _clanMember = ClanMember[i];
                     string _clanName2  = PersistentContainer.Instance.Players[_clanMember].ClanName;
                     if (!string.IsNullOrEmpty(_clanName2) && _clanName2 == _clanName)
                     {
                         ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForPlayerId(_clanMember);
                         if (_cInfo2 != null)
                         {
                             Phrases.Dict.TryGetValue(99, out string _phrase99);
                             _phrase99 = _phrase99.Replace("{PlayerName}", _cInfo.playerName);
                             ChatHook.ChatMessage(_cInfo2, Config.Chat_Response_Color + _phrase99 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                         }
                     }
                 }
                 if (_clanRequests.Count > 0)
                 {
                     _request = _clanRequests.First();
                     Phrases.Dict.TryGetValue(108, out string _phrase108);
                     _phrase108 = _phrase108.Replace("{PlayerName}", _request.Value);
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase108 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
             else
             {
                 Phrases.Dict.TryGetValue(109, out string _phrase109);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase109 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ClanManager.InviteAccept: {0}", e.Message));
     }
 }
Пример #7
0
 public static void RemoveMember(ClientInfo _cInfo, string _playerName)
 {
     try
     {
         bool _clanOfficer = PersistentContainer.Instance.Players[_cInfo.playerId].ClanOfficer;
         if (!_clanOfficer)
         {
             Phrases.Dict.TryGetValue(77, out string _phrase77);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase77 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
         else
         {
             ClientInfo _PlayertoRemove = ConsoleHelper.ParseParamIdOrName(_playerName);
             if (_PlayertoRemove == null)
             {
                 Phrases.Dict.TryGetValue(78, out string _phrase78);
                 _phrase78 = _phrase78.Replace("{PlayerName}", _playerName);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase78 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 return;
             }
             else
             {
                 string _clanName  = PersistentContainer.Instance.Players[_cInfo.playerId].ClanName;
                 string _clanName2 = PersistentContainer.Instance.Players[_PlayertoRemove.playerId].ClanName;
                 if (_clanName2 == null || _clanName != _clanName2)
                 {
                     Phrases.Dict.TryGetValue(87, out string _phrase87);
                     _phrase87 = _phrase87.Replace("{PlayerName}", _playerName);
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase87 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
                 else
                 {
                     bool _clanOfficer2 = PersistentContainer.Instance.Players[_PlayertoRemove.playerId].ClanOfficer;
                     bool _clanOwner    = PersistentContainer.Instance.Players[_cInfo.playerId].ClanOwner;
                     if (_clanOfficer2 && !_clanOwner)
                     {
                         Phrases.Dict.TryGetValue(88, out string _phrase88);
                         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase88 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                     }
                     else
                     {
                         ClanMember.Remove(_PlayertoRemove.playerId);
                         PersistentContainer.Instance.Players[_PlayertoRemove.playerId].ClanName    = "";
                         PersistentContainer.Instance.Players[_PlayertoRemove.playerId].ClanOfficer = false;
                         Phrases.Dict.TryGetValue(90, out string _phrase90);
                         _phrase90 = _phrase90.Replace("{PlayerName}", _PlayertoRemove.playerName);
                         _phrase90 = _phrase90.Replace("{ClanName}", _clanName);
                         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase90 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                         Phrases.Dict.TryGetValue(91, out string _phrase91);
                         _phrase91 = _phrase91.Replace("{ClanName}", _clanName);
                         ChatHook.ChatMessage(_PlayertoRemove, Config.Chat_Response_Color + _phrase91 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                         for (int i = 0; i < ClanMember.Count; i++)
                         {
                             string _clanMember = ClanMember[i];
                             if (PersistentContainer.Instance.Players[_clanMember].ClanName == _clanName)
                             {
                                 ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForPlayerId(_clanMember);
                                 if (_cInfo2 != null && _cInfo != _cInfo2)
                                 {
                                     Phrases.Dict.TryGetValue(102, out string _phrase102);
                                     _phrase102 = _phrase102.Replace("{PlayerName}", _PlayertoRemove.playerName);
                                     ChatHook.ChatMessage(_cInfo2, Config.Chat_Response_Color + _phrase102 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ClanManager.RemoveMember: {0}", e.Message));
     }
 }
        public static void Exec2(ClientInfo _cInfo, Entity _player, int _vehicle)
        {
            string _sql = "";

            if (_vehicle == 1)
            {
                _sql = string.Format("SELECT bikeId FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
            }
            if (_vehicle == 2)
            {
                _sql = string.Format("SELECT miniBikeId FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
            }
            if (_vehicle == 3)
            {
                _sql = string.Format("SELECT motorBikeId FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
            }
            if (_vehicle == 4)
            {
                _sql = string.Format("SELECT jeepId FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
            }
            if (_vehicle == 5)
            {
                _sql = string.Format("SELECT gyroId FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
            }
            DataTable _result = SQL.TQuery(_sql);
            int       _Id;

            int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _Id);
            _result.Dispose();
            if (_Id != 0)
            {
                List <Entity> Entities = GameManager.Instance.World.Entities.list;
                for (int i = 0; i < Entities.Count; i++)
                {
                    Entity _entity = Entities[i];
                    if (!_entity.IsClientControlled())
                    {
                        if (_entity.entityId == _Id)
                        {
                            if ((_player.position.x - _entity.position.x) * (_player.position.x - _entity.position.x) + (_player.position.z - _entity.position.z) * (_player.position.z - _entity.position.z) <= 50 * 50)
                            {
                                if (_entity.AttachedToEntity == false)
                                {
                                    _entity.SetPosition(_player.position);
                                    string _phrase782;
                                    if (!Phrases.Dict.TryGetValue(782, out _phrase782))
                                    {
                                        _phrase782 = " found your vehicle and sent it to you.";
                                    }
                                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase782 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);

                                    if (Wallet.IsEnabled && Command_Cost >= 1)
                                    {
                                        Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost);
                                    }
                                    if (_vehicle == 1)
                                    {
                                        _sql = string.Format("UPDATE Vehicles SET lastBike = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
                                    }
                                    if (_vehicle == 2)
                                    {
                                        _sql = string.Format("UPDATE Vehicles SET lastMiniBike = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
                                    }
                                    if (_vehicle == 3)
                                    {
                                        _sql = string.Format("UPDATE Vehicles SET lastMotorBike = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
                                    }
                                    if (_vehicle == 4)
                                    {
                                        _sql = string.Format("UPDATE Vehicles SET lastJeep = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
                                    }
                                    if (_vehicle == 5)
                                    {
                                        _sql = string.Format("UPDATE Vehicles SET lastGyro = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
                                    }

                                    SQL.FastQuery(_sql);
                                    return;
                                }
                                else
                                {
                                    string _phrase785;
                                    if (!Phrases.Dict.TryGetValue(785, out _phrase785))
                                    {
                                        _phrase785 = " found your vehicle but someone else is on it.";
                                    }
                                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase785 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                    return;
                                }
                            }
                        }
                    }
                }
                string _phrase784;
                if (!Phrases.Dict.TryGetValue(784, out _phrase784))
                {
                    _phrase784 = " could not find your vehicle near by.";
                }
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase784 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            else
            {
                string _phrase783;
                if (!Phrases.Dict.TryGetValue(783, out _phrase783))
                {
                    _phrase783 = " you do not have this vehicle type saved.";
                }
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase783 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Пример #9
0
 public static void RemoveFromJail(ClientInfo _cInfo, string _playerName)
 {
     if (!GameManager.Instance.adminTools.CommandAllowedFor(_cmd, _cInfo.playerId))
     {
         string _phrase107;
         if (!Phrases.Dict.TryGetValue(107, out _phrase107))
         {
             _phrase107 = " you do not have permissions to use this command.";
         }
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase107 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
     else
     {
         _playerName = _playerName.Replace("unjail ", "");
         ClientInfo _PlayertoUnJail = ConsoleHelper.ParseParamIdOrName(_playerName);
         if (_PlayertoUnJail == null)
         {
             string _phrase201;
             if (!Phrases.Dict.TryGetValue(201, out _phrase201))
             {
                 _phrase201 = " player {PlayerName} was not found online.";
             }
             _phrase201 = _phrase201.Replace("{PlayerName}", _playerName);
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase201 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
         else
         {
             string    _sql    = string.Format("SELECT jailTime FROM Players WHERE steamid = '{0}'", _PlayertoUnJail.playerId);
             DataTable _result = SQL.TQuery(_sql);
             int       _jailTime;
             int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _jailTime);
             _result.Dispose();
             if (_jailTime == 0)
             {
                 string _phrase506;
                 if (!Phrases.Dict.TryGetValue(506, out _phrase506))
                 {
                     _phrase506 = " player {PlayerName} is not in jail.";
                 }
                 _phrase506 = _phrase506.Replace("{PlayerName}", _PlayertoUnJail.playerName);
                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase506 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             }
             else
             {
                 if (!Jailed.Contains(_PlayertoUnJail.playerId))
                 {
                     string _phrase506;
                     if (!Phrases.Dict.TryGetValue(506, out _phrase506))
                     {
                         _phrase506 = " player {PlayerName} is not in jail.";
                     }
                     _phrase506 = _phrase506.Replace("{PlayerName}", _PlayertoUnJail.playerName);
                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase506 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 }
                 else
                 {
                     Jailed.Remove(_PlayertoUnJail.playerId);
                     Players.NoFlight.Add(_PlayertoUnJail.entityId);
                     _sql = string.Format("UPDATE Players SET jailTime = 0 WHERE steamid = '{0}'", _PlayertoUnJail.playerId);
                     SQL.FastQuery(_sql);
                     EntityPlayer _player = GameManager.Instance.World.Players.dict[_PlayertoUnJail.entityId];
                     EntityBedrollPositionList _position = _player.SpawnPoints;
                     if (_position.Count > 0)
                     {
                         _PlayertoUnJail.SendPackage(new NetPackageTeleportPlayer(new Vector3(_position[0].x, _position[0].y + 1, _position[0].z), null, false));
                     }
                     else
                     {
                         Vector3[] _pos = GameManager.Instance.World.GetRandomSpawnPointPositions(1);
                         _PlayertoUnJail.SendPackage(new NetPackageTeleportPlayer(new Vector3(_pos[0].x, _pos[0].y + 1, _pos[0].z), null, false));
                     }
                     string _phrase501;
                     if (!Phrases.Dict.TryGetValue(501, out _phrase501))
                     {
                         _phrase501 = " you have been released from jail.";
                     }
                     ChatHook.ChatMessage(_PlayertoUnJail, LoadConfig.Chat_Response_Color + _PlayertoUnJail.playerName + LoadConfig.Chat_Response_Color + _phrase501 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
         }
     }
 }
        public static void VehicleDelay(ClientInfo _cInfo, string _playerName, int _vehicle)
        {
            string    _sql    = string.Format("SELECT steamid FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count == 0)
            {
                string _steamid = SQL.EscapeString(_cInfo.playerId);
                _sql = string.Format("INSERT INTO Vehicles (steamid) VALUES ('{0}')", _steamid);
                SQL.FastQuery(_sql);
            }
            _result.Dispose();
            Entity _player         = GameManager.Instance.World.Players.dict[_cInfo.entityId];
            Entity _attachedEntity = _player.AttachedToEntity;

            if (_attachedEntity == null)
            {
                bool _donator = false;
                if (Delay_Between_Uses < 1)
                {
                    if (Wallet.IsEnabled && Command_Cost >= 1)
                    {
                        CommandCost(_cInfo, _player, _vehicle);
                    }
                    else
                    {
                        Exec2(_cInfo, _player, _vehicle);
                    }
                }
                else
                {
                    if (_vehicle == 1)
                    {
                        _sql = string.Format("SELECT lastBike FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
                    }
                    if (_vehicle == 2)
                    {
                        _sql = string.Format("SELECT lastMiniBike FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
                    }
                    if (_vehicle == 3)
                    {
                        _sql = string.Format("SELECT lastMotorBike FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
                    }
                    if (_vehicle == 4)
                    {
                        _sql = string.Format("SELECT lastJeep FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
                    }
                    if (_vehicle == 5)
                    {
                        _sql = string.Format("SELECT lastGyro FROM Vehicles WHERE steamid = '{0}'", _cInfo.playerId);
                    }
                    _result = SQL.TQuery(_sql);
                    DateTime _lastVehicle;
                    DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastVehicle);
                    _result.Dispose();
                    TimeSpan varTime           = DateTime.Now - _lastVehicle;
                    double   fractionalMinutes = varTime.TotalMinutes;
                    int      _timepassed       = (int)fractionalMinutes;
                    if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay)
                    {
                        if (ReservedSlots.Dict.ContainsKey(_cInfo.playerId))
                        {
                            DateTime _dt;
                            ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt);
                            if (DateTime.Now < _dt)
                            {
                                _donator = true;
                                int _newDelay = Delay_Between_Uses / 2;
                                if (_timepassed >= _newDelay)
                                {
                                    if (Wallet.IsEnabled && Command_Cost >= 1)
                                    {
                                        CommandCost(_cInfo, _player, _vehicle);
                                    }
                                    else
                                    {
                                        Exec2(_cInfo, _player, _vehicle);
                                    }
                                }
                                else
                                {
                                    int    _timeleft = _newDelay - _timepassed;
                                    string _phrase786;
                                    if (!Phrases.Dict.TryGetValue(786, out _phrase786))
                                    {
                                        _phrase786 = " you can only use vehicle teleport once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
                                    }
                                    _phrase786 = _phrase786.Replace("{DelayBetweenUses}", _newDelay.ToString());
                                    _phrase786 = _phrase786.Replace("{TimeRemaining}", _timeleft.ToString());
                                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase786 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                }
                            }
                        }
                    }
                    if (!_donator)
                    {
                        if (_timepassed >= Delay_Between_Uses)
                        {
                            if (Wallet.IsEnabled && Command_Cost >= 1)
                            {
                                CommandCost(_cInfo, _player, _vehicle);
                            }
                            else
                            {
                                Exec2(_cInfo, _player, _vehicle);
                            }
                        }
                        else
                        {
                            int    _timeleft = Delay_Between_Uses - _timepassed;
                            string _phrase786;
                            if (!Phrases.Dict.TryGetValue(786, out _phrase786))
                            {
                                _phrase786 = " you can only use vehicle teleport once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
                            }
                            _phrase786 = _phrase786.Replace("{DelayBetweenUses}", Delay_Between_Uses.ToString());
                            _phrase786 = _phrase786.Replace("{TimeRemaining}", _timeleft.ToString());
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase786 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        }
                    }
                }
            }
            else
            {
                Log.Out("Attached vehicle");
                Exec1(_cInfo, _player, _vehicle);
            }
        }
 public static void Exec1(ClientInfo _cInfo, Entity _player, int _vehicle)
 {
     if (Inside_Claim)
     {
         World                world                 = GameManager.Instance.World;
         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                = world.GetLandClaimOwner(_vec3i, _persistentPlayerData);
         if (_owner == EnumLandClaimOwner.Self || _owner == EnumLandClaimOwner.Ally)
         {
             string _vehicleName = "";
             string _messageName = "";
             if (_vehicle == 1)
             {
                 _vehicleName = "vehicleBicycle";
                 _messageName = "bike";
             }
             if (_vehicle == 2)
             {
                 _vehicleName = "vehicleMinibike";
                 _messageName = "minibike";
             }
             if (_vehicle == 3)
             {
                 _vehicleName = "vehicleMotorcycle";
                 _messageName = "motorbike";
             }
             if (_vehicle == 4)
             {
                 _vehicleName = "vehicle4x4Truck";
                 _messageName = "jeep";
             }
             if (_vehicle == 5)
             {
                 _vehicleName = "vehicleGyrocopter";
                 _messageName = "gyro";
             }
             if (_player.AttachedToEntity.EntityClass.entityClassName.ToString() == _vehicleName)
             {
                 string _phrase781;
                 if (!Phrases.Dict.TryGetValue(781, out _phrase781))
                 {
                     _phrase781 = " saved your current vehicle for retrieval.";
                 }
                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase781 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 string _sql = "";
                 if (_vehicle == 1)
                 {
                     _sql = string.Format("UPDATE Vehicles SET bikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
                 }
                 if (_vehicle == 2)
                 {
                     _sql = string.Format("UPDATE Vehicles SET miniBikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
                 }
                 if (_vehicle == 3)
                 {
                     _sql = string.Format("UPDATE Vehicles SET motorBikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
                 }
                 if (_vehicle == 4)
                 {
                     _sql = string.Format("UPDATE Vehicles SET jeepId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
                 }
                 if (_vehicle == 5)
                 {
                     _sql = string.Format("UPDATE Vehicles SET gyroId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
                 }
                 SQL.FastQuery(_sql);
             }
             else
             {
                 string _phrase787;
                 if (!Phrases.Dict.TryGetValue(787, out _phrase787))
                 {
                     _phrase787 = " you are on the wrong vehicle to save it with this command. You are using a {Vehicle}.";
                 }
                 _phrase787 = _phrase787.Replace("{Vehicle}", _messageName);
                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase787 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             }
         }
         else
         {
             string _phrase780;
             if (!Phrases.Dict.TryGetValue(780, out _phrase780))
             {
                 _phrase780 = " you have not claimed this space or a friend. You can only save your vehicle inside a claimed space.";
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase780 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     else
     {
         string _vehicleName = "";
         string _messageName = "";
         if (_vehicle == 1)
         {
             _vehicleName = "vehicleBicycle";
             _messageName = "bike";
         }
         if (_vehicle == 2)
         {
             _vehicleName = "vehicleMinibike";
             _messageName = "minibike";
         }
         if (_vehicle == 3)
         {
             _vehicleName = "vehicleMotorcycle";
             _messageName = "motorbike";
         }
         if (_vehicle == 4)
         {
             _vehicleName = "vehicle4x4Truck";
             _messageName = "jeep";
         }
         if (_vehicle == 5)
         {
             _vehicleName = "vehicleGyrocopter";
             _messageName = "gyro";
         }
         if (_player.AttachedToEntity.name == _vehicleName)
         {
             string _phrase781;
             if (!Phrases.Dict.TryGetValue(781, out _phrase781))
             {
                 _phrase781 = " saved your current vehicle for retrieval.";
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase781 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             string _sql = "";
             if (_vehicle == 1)
             {
                 _sql = string.Format("UPDATE Vehicles SET bikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             }
             if (_vehicle == 2)
             {
                 _sql = string.Format("UPDATE Vehicles SET miniBikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             }
             if (_vehicle == 3)
             {
                 _sql = string.Format("UPDATE Vehicles SET motorBikeId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             }
             if (_vehicle == 4)
             {
                 _sql = string.Format("UPDATE Vehicles SET jeepId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             }
             if (_vehicle == 5)
             {
                 _sql = string.Format("UPDATE Vehicles SET gyroId = {0} WHERE steamid = '{1}'", _player.AttachedToEntity.entityId, _cInfo.playerId);
             }
             SQL.FastQuery(_sql);
         }
         else
         {
             string _phrase787;
             if (!Phrases.Dict.TryGetValue(787, out _phrase787))
             {
                 _phrase787 = " you are on the wrong vehicle to save it with this command. You are using a {Vehicle}.";
             }
             _phrase787 = _phrase787.Replace("{Vehicle}", _messageName);
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase787 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
 }
Пример #12
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)
                 {
                     if (Wallet.GetCurrentCoins(_cInfo.playerId) >= _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);
             }
         }
     }
 }
Пример #13
0
        private static void RandomItem(ClientInfo _cInfo, bool _announce)
        {
            string    _randomItem = list.RandomObject();
            ItemValue _itemValue  = ItemClass.GetItem(_randomItem, false);

            _itemValue = new ItemValue(_itemValue.type, false);
            EntityPlayer _player  = GameManager.Instance.World.Players.dict[_cInfo.entityId];
            int          _quality = 1;

            if (_itemValue.HasQuality)
            {
                _quality           = random.Next(1, 7);
                _itemValue.Quality = _quality;
            }
            int[] _counts;
            if (dict.TryGetValue(_randomItem, out _counts))
            {
                int       _count    = random.Next(_counts[0], _counts[1] + 1);
                ItemStack _itemDrop = new ItemStack(_itemValue, _count);
                ItemValue itemValue;
                itemValue = new ItemValue(ItemClass.GetItem(_randomItem).type, _quality, _quality, false, default(FastTags), 1);
                World world      = GameManager.Instance.World;
                var   entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData
                {
                    entityClass     = EntityClass.FromString("item"),
                    id              = EntityFactory.nextEntityID++,
                    itemStack       = new ItemStack(itemValue, _count),
                    pos             = world.Players.dict[_cInfo.entityId].position,
                    rot             = new Vector3(20f, 0f, 20f),
                    lifetime        = 60f,
                    belongsPlayerId = _cInfo.entityId
                });
                world.SpawnEntityInWorld(entityItem);
                _cInfo.SendPackage(new NetPackageEntityCollect(entityItem.entityId, _cInfo.entityId));
                world.RemoveEntity(entityItem.entityId, EnumRemoveEntityReason.Killed);
                string _phrase7;
                if (!Phrases.Dict.TryGetValue(7, out _phrase7))
                {
                    _phrase7 = " received {ItemCount} {ItemName} from gimme.";
                }
                _phrase7 = _phrase7.Replace("{ItemCount}", _count.ToString());
                string _name;
                if (dict1.TryGetValue(_randomItem, out _name))
                {
                    _phrase7 = _phrase7.Replace("{ItemName}", _name);
                }
                if (_announce)
                {
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase7 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                }
                else
                {
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase7 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
                string _sql;
                if (Wallet.IsEnabled && Command_Cost >= 1)
                {
                    Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost);
                }
                _sql = string.Format("UPDATE Players SET last_gimme = '{0}' WHERE steamid = '{1}'", DateTime.Now.ToString(), _cInfo.playerId);
                SQL.FastQuery(_sql, "Gimme");
            }
        }
Пример #14
0
 public static void AddPlayer(ClientInfo _cInfo)
 {
     if (!Teams.ContainsKey(_cInfo.playerId))
     {
         if (Teams.Count >= PlayerCount)
         {
             Phrases.Dict.TryGetValue(773, out string _phrase773);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase773 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             return;
         }
         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         if (_player != null)
         {
             Vector3 _position  = _player.GetPosition();
             int     x          = (int)_position.x;
             int     y          = (int)_position.y;
             int     z          = (int)_position.z;
             string  _sposition = x + "," + y + "," + z;
             PersistentContainer.Instance.Players[_cInfo.playerId].EventReturnPosition = _sposition;
             Phrases.Dict.TryGetValue(774, out string _phrase774);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase774 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
         EventCommandsConsole.Setup.TryGetValue(Operator, out List <string> _setup);
         Teams.Add(_cInfo.playerId, TeamSetup);
         Phrases.Dict.TryGetValue(775, out string _phrase775);
         _phrase775 = _phrase775.Replace("{Value}", TeamSetup.ToString());
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase775 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         TeamSetup--;
         if (TeamSetup == 0)
         {
             TeamSetup = TeamCount;
         }
         if (Teams.Count == PlayerCount)
         {
             Invited = false;
             foreach (var _teamPlayer in Teams)
             {
                 ClientInfo _eventClientInfo = ConnectionManager.Instance.Clients.ForPlayerId(_teamPlayer.Key);
                 if (_eventClientInfo != null)
                 {
                     EntityPlayer _eventPlayer = GameManager.Instance.World.Players.dict[_eventClientInfo.entityId];
                     if (_eventPlayer != null && _eventPlayer.IsAlive())
                     {
                         Teams.TryGetValue(_teamPlayer.Key, out int _teamNumber);
                         string   _spawnPosition = _setup[_teamNumber + 4];
                         int      _x, _y, _z;
                         string[] _cords = _spawnPosition.Split(',');
                         int.TryParse(_cords[0], out _x);
                         int.TryParse(_cords[1], out _y);
                         int.TryParse(_cords[2], out _z);
                         _eventClientInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_x, _y, _z), null, false));
                     }
                     else
                     {
                         PersistentContainer.Instance.Players[_eventClientInfo.playerId].EventSpawn = true;
                     }
                 }
                 else
                 {
                     PersistentContainer.Instance.Players[_eventClientInfo.playerId].EventSpawn = true;
                 }
             }
             int _eventTime = Time * 60;
             Timers._eventTime = _eventTime;
             Open = true;
             Phrases.Dict.TryGetValue(776, out string _phrase776);
             _phrase776 = _phrase776.Replace("{EventName}", TeamSetup.ToString());
             ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase776 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
         }
         else
         {
             Phrases.Dict.TryGetValue(777, out string _phrase777);
             _phrase777 = _phrase777.Replace("{EventName}", TeamSetup.ToString());
             _phrase777 = _phrase777.Replace("{CommandPrivate}", ChatHook.Command_Private);
             _phrase777 = _phrase777.Replace("{Command100}", Command100);
             ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase777 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
             Phrases.Dict.TryGetValue(778, out string _phrase778);
             _phrase778 = _phrase778.Replace("{Value}", Teams.Count.ToString());
             _phrase778 = _phrase778.Replace("{PlayerTotal}", PlayerCount.ToString());
             ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase778 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
         }
     }
     else
     {
         Phrases.Dict.TryGetValue(779, out string _phrase779);
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase779 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Пример #15
0
 private static void RandomItem(ClientInfo _cInfo)
 {
     try
     {
         string    _randomItem = list.RandomObject();
         ItemValue _itemValue  = new ItemValue(ItemClass.GetItem(_randomItem, false).type, false);
         int[]     _itemData;
         if (dict.TryGetValue(_randomItem, out _itemData))
         {
             int _count = 0;
             if (_itemData[0] > _itemData[1])
             {
                 _count = random.Next(_itemData[1], _itemData[0] + 1);
             }
             else
             {
                 _count = random.Next(_itemData[0], _itemData[1] + 1);
             }
             if (_itemValue.HasQuality && _itemData[2] > 0 && _itemData[3] >= _itemData[2])
             {
                 _itemValue.Quality = random.Next(_itemData[2], _itemData[3] + 1);
             }
             World world      = GameManager.Instance.World;
             var   entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData
             {
                 entityClass     = EntityClass.FromString("item"),
                 id              = EntityFactory.nextEntityID++,
                 itemStack       = new ItemStack(_itemValue, _count),
                 pos             = world.Players.dict[_cInfo.entityId].position,
                 rot             = new Vector3(20f, 0f, 20f),
                 lifetime        = 60f,
                 belongsPlayerId = _cInfo.entityId
             });
             world.SpawnEntityInWorld(entityItem);
             _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageEntityCollect>().Setup(entityItem.entityId, _cInfo.entityId));
             world.RemoveEntity(entityItem.entityId, EnumRemoveEntityReason.Killed);
             string _phrase7;
             if (!Phrases.Dict.TryGetValue(7, out _phrase7))
             {
                 _phrase7 = " received {ItemCount} {ItemName} from gimme.";
             }
             _phrase7 = _phrase7.Replace("{ItemCount}", _count.ToString());
             string _name;
             if (dict1.TryGetValue(_randomItem, out _name))
             {
                 _phrase7 = _phrase7.Replace("{ItemName}", _name);
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase7 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             if (Wallet.IsEnabled && Command_Cost >= 1)
             {
                 Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost);
             }
             PersistentContainer.Instance.Players[_cInfo.playerId].LastGimme = DateTime.Now;
             PersistentContainer.Instance.Save();
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Gimme.RandomItem: {0}.", e.Message));
     }
 }
Пример #16
0
 public static void GiveAnimals(ClientInfo _cInfo)
 {
     try
     {
         if (Animal_Ids.Length > 0)
         {
             string[]      animalList = { };
             List <string> animalId   = new List <string>();
             if (Animal_Ids.Contains(","))
             {
                 string[] animals = Animal_Ids.Split(',');
                 for (int i = 0; i < animals.Length; i++)
                 {
                     animalId.Add(animals[i]);
                 }
             }
             else
             {
                 animalId.Add(Animal_Ids);
             }
             int minRad = 0;
             int maxRad = 0;
             if (Maximum_Spawn_Radius < Minimum_Spawn_Radius)
             {
                 minRad = 40;
                 maxRad = 60;
             }
             else
             {
                 minRad = Minimum_Spawn_Radius;
                 maxRad = Maximum_Spawn_Radius;
             }
             int r = new System.Random().Next(1, animalId.Count + 1);
             int.TryParse(animalId[r], out int randomId);
             int nextRadius = new System.Random().Next(minRad, maxRad + 1);
             Dictionary <int, EntityClass> .KeyCollection entityTypesCollection = EntityClass.list.Dict.Keys;
             int counter = 1;
             foreach (int i in entityTypesCollection)
             {
                 EntityClass eClass = EntityClass.list[i];
                 if (!eClass.bAllowUserInstantiate)
                 {
                     continue;
                 }
                 if (randomId == counter)
                 {
                     EntityPlayer entityPlayer = PersistentOperations.GetEntityPlayer(_cInfo.entityId);
                     if (entityPlayer != null)
                     {
                         if (SpawnAnimal(_cInfo, entityPlayer, nextRadius, randomId))
                         {
                             if (Wallet.IsEnabled && Command_Cost >= 1)
                             {
                                 Wallet.RemoveCurrency(_cInfo.CrossplatformId.CombinedString, Command_Cost);
                             }
                             PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].LastAnimal = DateTime.Now;
                             PersistentContainer.DataChange = true;
                             break;
                         }
                     }
                 }
                 counter++;
             }
         }
         else
         {
             Phrases.Dict.TryGetValue("AnimalTracking4", 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 Animals.GiveAnimals: {0}", e.Message));
     }
 }
Пример #17
0
 public static void InviteMember(ClientInfo _cInfo, string _playerName)
 {
     try
     {
         bool _clanOfficer = PersistentContainer.Instance.Players[_cInfo.playerId].ClanOfficer;
         if (!_clanOfficer)
         {
             Phrases.Dict.TryGetValue(77, out string _phrase77);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase77 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
         else
         {
             ClientInfo _newMember = ConsoleHelper.ParseParamIdOrName(_playerName);
             if (_newMember == null)
             {
                 Phrases.Dict.TryGetValue(78, out string _phrase78);
                 _phrase78 = _phrase78.Replace("{PlayerName}", _playerName);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase78 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 return;
             }
             else
             {
                 string _newMemberClanName = PersistentContainer.Instance.Players[_newMember.playerId].ClanName;
                 if (_newMemberClanName != null && _newMemberClanName.Length > 0)
                 {
                     Phrases.Dict.TryGetValue(79, out string _phrase79);
                     _phrase79 = _phrase79.Replace("{PlayerName}", _newMember.playerName);
                     _phrase79 = _phrase79.Replace("{ClanName}", _newMemberClanName);
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase79 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
                 else
                 {
                     string _clanInvite = PersistentContainer.Instance.Players[_newMember.playerId].ClanInvite;
                     if (_clanInvite != null && _clanInvite.Length > 0)
                     {
                         Phrases.Dict.TryGetValue(80, out string _phrase80);
                         _phrase80 = _phrase80.Replace("{PlayerName}", _newMember.playerName);
                         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase80 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                     }
                     else
                     {
                         string _clanName = PersistentContainer.Instance.Players[_cInfo.playerId].ClanName;
                         PersistentContainer.Instance.Players[_newMember.playerId].ClanInvite = _clanName;
                         Phrases.Dict.TryGetValue(81, out string _phrase81);
                         _phrase81 = _phrase81.Replace("{ClanName}", _clanName);
                         _phrase81 = _phrase81.Replace("{CommandPrivate}", ChatHook.Command_Private);
                         _phrase81 = _phrase81.Replace("{Command36}", Command36);
                         _phrase81 = _phrase81.Replace("{Command37}", Command37);
                         ChatHook.ChatMessage(_newMember, Config.Chat_Response_Color + _phrase81 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                         Phrases.Dict.TryGetValue(82, out string _phrase82);
                         _phrase82 = _phrase82.Replace("{PlayerName}", _newMember.playerName);
                         _phrase82 = _phrase82.Replace("{ClanName}", _clanName);
                         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase82 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ClanManager.InviteMember: {0}", e.Message));
     }
 }
Пример #18
0
        public static void ClanRename(ClientInfo _cInfo, string _clanName)
        {
            string    _sql         = string.Format("SELECT clanname, isclanowner FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result      = SQL.TQuery(_sql);
            string    _oldClanName = _result.Rows[0].ItemArray.GetValue(0).ToString();
            bool      _isclanowner;

            bool.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _isclanowner);
            _result.Dispose();
            Player p = PersistentContainer.Instance.Players[_cInfo.playerId, true];

            if (_isclanowner)
            {
                if (!clans.ContainsKey(_clanName))
                {
                    clans.Remove(_oldClanName);
                    clans.Add(_clanName, _cInfo.playerId);
                    _sql = string.Format("UPDATE Players SET clanname = '{0}' WHERE clanname = '{1}'", _clanName, _oldClanName);
                    SQL.FastQuery(_sql);
                    _sql = string.Format("UPDATE Players SET invitedtoclan = '{0}' WHERE invitedtoclan = '{1}'", _clanName, _oldClanName);
                    SQL.FastQuery(_sql);
                    string _phrase130;
                    if (!Phrases.Dict.TryGetValue(130, out _phrase130))
                    {
                        _phrase130 = "you have changed your clan name to {ClanName}.";
                    }
                    _phrase130 = _phrase130.Replace("{ClanName}", _clanName);
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase130 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                    _sql = string.Format("SELECT steamid FROM Players WHERE clanname = '{0}'", _clanName);
                    DataTable _result1 = SQL.TQuery(_sql);
                    foreach (DataRow row in _result1.Rows)
                    {
                        ClientInfo _cInfo1 = ConnectionManager.Instance.Clients.ForPlayerId(row[0].ToString());
                        if (_cInfo1 != null)
                        {
                            string _phrase131;
                            if (!Phrases.Dict.TryGetValue(131, out _phrase131))
                            {
                                _phrase131 = "your clan name has been changed by the owner to {ClanName}.";
                            }
                            _phrase131 = _phrase131.Replace("{ClanName}", _clanName);
                            ChatHook.ChatMessage(_cInfo1, LoadConfig.Chat_Response_Color + _cInfo1.playerName + _phrase130 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        }
                    }
                    _result1.Dispose();
                }
                else
                {
                    string _phrase102;
                    if (!Phrases.Dict.TryGetValue(102, out _phrase102))
                    {
                        _phrase102 = "can not add the clan {ClanName} because it already exist.";
                    }
                    _phrase102 = _phrase102.Replace("{PlayerName}", _cInfo.playerName);
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase102 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                }
            }
            else
            {
                string _phrase105;
                if (!Phrases.Dict.TryGetValue(105, out _phrase105))
                {
                    _phrase105 = "you are not the owner of any clans.";
                }
                _phrase105 = _phrase105.Replace("{PlayerName}", _cInfo.playerName);
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase105 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
            }
        }
Пример #19
0
 public static void InviteDecline(ClientInfo _cInfo)
 {
     try
     {
         bool _clanOwner = PersistentContainer.Instance.Players[_cInfo.playerId].ClanOwner;
         if (!_clanOwner)
         {
             string _clanInvite = PersistentContainer.Instance.Players[_cInfo.playerId].ClanInvite;
             if (string.IsNullOrEmpty(_clanInvite))
             {
                 Phrases.Dict.TryGetValue(83, out string _phrase83);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase83 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
             else
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].ClanInvite = "";
                 Phrases.Dict.TryGetValue(86, out string _phrase86);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase86 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 for (int i = 0; i < ClanMember.Count; i++)
                 {
                     string _clanMember = ClanMember[i];
                     string _clanName   = PersistentContainer.Instance.Players[_clanMember].ClanName;
                     if (string.IsNullOrEmpty(_clanName) && _clanName == _clanInvite)
                     {
                         ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForPlayerId(_clanMember);
                         if (_cInfo2 != null)
                         {
                             Phrases.Dict.TryGetValue(85, out string _phrase85);
                             _phrase85 = _phrase85.Replace("{PlayerName}", _cInfo.playerName);
                             ChatHook.ChatMessage(_cInfo2, Config.Chat_Response_Color + _phrase85 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                         }
                     }
                 }
             }
         }
         else
         {
             Dictionary <string, string> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin;
             if (_clanRequests != null && _clanRequests.Count > 0)
             {
                 KeyValuePair <string, string> _request = _clanRequests.First();
                 _clanRequests.Remove(_request.Key);
                 PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin = _clanRequests;
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + "Removed the request to join the group by player " + _request.Value + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 if (_clanRequests.Count > 0)
                 {
                     _request = _clanRequests.First();
                     Phrases.Dict.TryGetValue(108, out string _phrase108);
                     _phrase108 = _phrase108.Replace("{PlayerName}", _request.Value);
                     _phrase108 = _phrase108.Replace("{CommandPrivate}", ChatHook.Command_Private);
                     _phrase108 = _phrase108.Replace("{Command36}", Command36);
                     _phrase108 = _phrase108.Replace("{Command37}", Command37);
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase108 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
             else
             {
                 Phrases.Dict.TryGetValue(109, out string _phrase109);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase109 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ClanManager.InviteDecline: {0}", e.Message));
     }
 }
Пример #20
0
        public static void InviteMember(ClientInfo _cInfo, string _playerName)
        {
            string    _sql      = string.Format("SELECT clanname, isclanofficer FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result   = SQL.TQuery(_sql);
            string    _clanName = _result.Rows[0].ItemArray.GetValue(0).ToString();
            bool      _isclanofficer;

            bool.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _isclanofficer);
            _result.Dispose();
            if (!_isclanofficer)
            {
                string _phrase107;
                if (!Phrases.Dict.TryGetValue(107, out _phrase107))
                {
                    _phrase107 = "you do not have permissions to use this command.";
                }
                _phrase107 = _phrase107.Replace("{PlayerName}", _cInfo.playerName);
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase107 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
            }
            else
            {
                ClientInfo _newMember = ConsoleHelper.ParseParamIdOrName(_playerName);
                if (_newMember == null)
                {
                    string _phrase108;
                    if (!Phrases.Dict.TryGetValue(108, out _phrase108))
                    {
                        _phrase108 = "the name {PlayerName} was not found.";
                    }
                    _phrase108 = _phrase108.Replace("{PlayerName}", _playerName);
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase108 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                }
                else
                {
                    _sql = string.Format("SELECT clanname , invitedtoclan FROM Players WHERE steamid = '{0}'", _newMember.playerId);
                    DataTable _result1           = SQL.TQuery(_sql);
                    string    _newMemberclanName = _result1.Rows[0].ItemArray.GetValue(0).ToString();
                    string    _invitedtoclan     = _result1.Rows[0].ItemArray.GetValue(1).ToString();
                    _result1.Dispose();
                    if (_newMemberclanName != "Unknown")
                    {
                        string _phrase109;
                        if (!Phrases.Dict.TryGetValue(109, out _phrase109))
                        {
                            _phrase109 = "{PlayerName} is already a member of a clan.";
                        }
                        _phrase109 = _phrase109.Replace("{PlayerName}", _playerName);
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase109 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                    }
                    else
                    {
                        if (_invitedtoclan != "Unknown")
                        {
                            string _phrase110;
                            if (!Phrases.Dict.TryGetValue(110, out _phrase110))
                            {
                                _phrase110 = "{PlayerName} already has pending clan invites.";
                            }
                            _phrase110 = _phrase110.Replace("{PlayerName}", _playerName);
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase110 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        }
                        else
                        {
                            string _phrase111;
                            string _phrase112;
                            if (!Phrases.Dict.TryGetValue(111, out _phrase111))
                            {
                                _phrase111 = "you have been invited to join the clan {ClanName}. Type /clanaccept to join or /clandecline to decline the offer.";
                            }

                            if (!Phrases.Dict.TryGetValue(112, out _phrase112))
                            {
                                _phrase112 = "you have invited {PlayerName} to the clan {ClanName}.";
                            }
                            _phrase111 = _phrase111.Replace("{PlayerName}", _newMember.playerName);
                            _phrase111 = _phrase111.Replace("{ClanName}", _clanName);
                            _phrase112 = _phrase112.Replace("{PlayerName}", _cInfo.playerName);
                            _phrase112 = _phrase112.Replace("{InvitedPlayerName}", _newMember.playerName);
                            _phrase112 = _phrase112.Replace("{ClanName}", _clanName);
                            _sql       = string.Format("UPDATE Players SET invitedtoclan = '{0}' WHERE steamid = '{1}'", _clanName, _newMember.playerId);
                            SQL.FastQuery(_sql);
                            ChatHook.ChatMessage(_newMember, LoadConfig.Chat_Response_Color + _newMember.playerName + _phrase111 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase112 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        }
                    }
                }
            }
        }
Пример #21
0
 public static void CallForVote2()
 {
     if (sun.Count + rain.Count + snow.Count >= Votes_Needed)
     {
         if (sun.Count > rain.Count && sun.Count > snow.Count)
         {
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + "Clear skies ahead.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
             SdtdConsole.Instance.ExecuteSync("weather rain 0", (ClientInfo)null);
             SdtdConsole.Instance.ExecuteSync("weather rainfall 0", (ClientInfo)null);
             SdtdConsole.Instance.ExecuteSync("weather wet 0", (ClientInfo)null);
             SdtdConsole.Instance.ExecuteSync("weather snow 0", (ClientInfo)null);
             SdtdConsole.Instance.ExecuteSync("weather snowfall 0", (ClientInfo)null);
             VoteOpen = false;
             _weather = "sun";
         }
         if (rain.Count > sun.Count && rain.Count > snow.Count)
         {
             Random rnd         = new Random();
             int    _rndWeather = rnd.Next(1, 4);
             if (_rndWeather == 1)
             {
                 ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + "Light rain has started.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                 SdtdConsole.Instance.ExecuteSync("weather rain 0.2", (ClientInfo)null);
             }
             if (_rndWeather == 2)
             {
                 ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + "A rain storm has started.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                 SdtdConsole.Instance.ExecuteSync("weather rain 0.6", (ClientInfo)null);
                 SdtdConsole.Instance.ExecuteSync("weather wet 1", (ClientInfo)null);
             }
             if (_rndWeather == 3)
             {
                 ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + "A heavy rain storm has started.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                 SdtdConsole.Instance.ExecuteSync("weather rain 1", (ClientInfo)null);
                 SdtdConsole.Instance.ExecuteSync("weather wet 1", (ClientInfo)null);
             }
             VoteOpen = false;
             _weather = "rain";
         }
         if (snow.Count > sun.Count && snow.Count > rain.Count)
         {
             Random rnd         = new Random();
             int    _rndWeather = rnd.Next(1, 4);
             if (_rndWeather == 1)
             {
                 ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + "Light snow has started.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                 SdtdConsole.Instance.ExecuteSync("weather snowfall 0.2", (ClientInfo)null);
             }
             if (_rndWeather == 2)
             {
                 ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + "A snow storm has started.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                 SdtdConsole.Instance.ExecuteSync("weather snowfall 0.6", (ClientInfo)null);
                 SdtdConsole.Instance.ExecuteSync("weather snow 0.6", (ClientInfo)null);
             }
             if (_rndWeather == 3)
             {
                 ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + "A heavy snow storm has started.[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                 SdtdConsole.Instance.ExecuteSync("weather snowfall 1", (ClientInfo)null);
                 SdtdConsole.Instance.ExecuteSync("weather snow 1", (ClientInfo)null);
             }
             VoteOpen = false;
             _weather = "snow";
         }
         if (sun.Count == 0 && rain.Count == 0 && snow.Count == 0)
         {
             string _phrase612;
             if (!Phrases.Dict.TryGetValue(612, out _phrase612))
             {
                 _phrase612 = "Weather vote complete, but no votes were cast. No changes were made.";
             }
             ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase612 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
             sun.Clear(); rain.Clear(); snow.Clear();
             VoteOpen = false;
             _weather = "";
         }
         else
         {
             if (_weather != "")
             {
                 string _phrase613;
                 if (!Phrases.Dict.TryGetValue(613, out _phrase613))
                 {
                     _phrase613 = "Weather vote complete. Most votes went to {Weather}.";
                 }
                 _phrase613 = _phrase613.Replace("{Weather}", _weather.ToString());
                 ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase613 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                 sun.Clear(); rain.Clear(); snow.Clear();
             }
             else if (sun.Count > 0 && rain.Count > 0 && snow.Count > 0)
             {
                 string _phrase614;
                 if (!Phrases.Dict.TryGetValue(614, out _phrase614))
                 {
                     _phrase614 = "Weather vote was a tie. No changes were made.";
                 }
                 ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase614 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                 sun.Clear(); rain.Clear(); snow.Clear();
             }
             VoteOpen = false;
             _weather = "";
         }
     }
     else
     {
         VoteOpen = false;
         _weather = "";
         string _phrase805;
         if (!Phrases.Dict.TryGetValue(805, out _phrase805))
         {
             _phrase805 = "Not enough votes were cast in the weather vote. No changes were made.";
         }
         ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase805 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
     }
 }
Пример #22
0
        public static void RemoveMember(ClientInfo _cInfo, string _playerName)
        {
            string    _sql      = string.Format("SELECT clanname, isclanowner, isclanofficer FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result   = SQL.TQuery(_sql);
            string    _clanname = _result.Rows[0].ItemArray.GetValue(0).ToString();
            bool      _isclanowner;

            bool.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _isclanowner);
            bool _isclanofficer;

            bool.TryParse(_result.Rows[0].ItemArray.GetValue(2).ToString(), out _isclanofficer);
            _result.Dispose();
            if (!_isclanofficer)
            {
                string _phrase107;
                if (!Phrases.Dict.TryGetValue(107, out _phrase107))
                {
                    _phrase107 = "you do not have permissions to use this command.";
                }
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase107 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
            }
            else
            {
                string     _steamId;
                ClientInfo _PlayertoRemove = ConsoleHelper.ParseParamIdOrName(_playerName);
                if (_PlayertoRemove != null)
                {
                    _steamId = _PlayertoRemove.playerId;
                }
                else
                {
                    if (ConsoleHelper.ParseParamSteamIdValid(_playerName))
                    {
                        _steamId = _playerName;
                    }
                    else
                    {
                        string _phrase108;
                        if (!Phrases.Dict.TryGetValue(108, out _phrase108))
                        {
                            _phrase108 = "the name {PlayerName} was not found.";
                        }
                        _phrase108 = _phrase108.Replace("{PlayerName}", _playerName);
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase108 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        return;
                    }
                }
                _sql = string.Format("SELECT clanname, isclanowner, isclanofficer FROM Players WHERE steamid = '{0}'", _steamId);
                DataTable _result1   = SQL.TQuery(_sql);
                string    _clanname1 = _result1.Rows[0].ItemArray.GetValue(0).ToString();
                bool      _isclanowner1;
                bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _isclanowner1);
                bool _isclanofficer1;
                bool.TryParse(_result1.Rows[0].ItemArray.GetValue(2).ToString(), out _isclanofficer1);
                _result1.Dispose();
                if (_clanname != _clanname1)
                {
                    string _phrase117;
                    if (!Phrases.Dict.TryGetValue(117, out _phrase117))
                    {
                        _phrase117 = "{PlayerName} is not a member of your clan.";
                    }
                    _phrase117 = _phrase117.Replace("{PlayerName}", _playerName);
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase117 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                }
                else
                {
                    if (_isclanofficer1 && !_isclanowner && !_isclanowner1)
                    {
                        string _phrase118;
                        if (!Phrases.Dict.TryGetValue(118, out _phrase118))
                        {
                            _phrase118 = "only the clan owner can remove officers.";
                        }
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase118 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                    }
                    else
                    {
                        ClanMember.Remove(_steamId);
                        _sql = string.Format("UPDATE Players SET clanname = 'Unknown', isclanofficer = 'false' WHERE steamid = '{0}'", _steamId);
                        SQL.FastQuery(_sql);
                        string _phrase120;
                        string _phrase121;
                        if (!Phrases.Dict.TryGetValue(120, out _phrase120))
                        {
                            _phrase120 = "you have removed {PlayerName} from clan {ClanName}.";
                        }
                        _phrase120 = _phrase120.Replace("{PlayerName}", _playerName);
                        _phrase120 = _phrase120.Replace("{ClanName}", _clanname);
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase120 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        if (_PlayertoRemove != null)
                        {
                            if (!Phrases.Dict.TryGetValue(121, out _phrase121))
                            {
                                _phrase121 = "you have been removed from the clan {ClanName}.";
                            }
                            _phrase121 = _phrase121.Replace("{ClanName}", _clanname);
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase121 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        }
                    }
                }
            }
        }
Пример #23
0
        public static void CheckPlayer(ClientInfo _cInfo, bool _announce)
        {
            bool _donator = false;

            if (Delay_Between_Uses < 1)
            {
                Kill(_cInfo);
            }
            else
            {
                string    _sql    = string.Format("SELECT lastkillme FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                DataTable _result = SQL.TQuery(_sql);
                DateTime  _lastkillme;
                DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastkillme);
                _result.Dispose();
                TimeSpan varTime           = DateTime.Now - _lastkillme;
                double   fractionalMinutes = varTime.TotalMinutes;
                int      _timepassed       = (int)fractionalMinutes;
                if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay)
                {
                    if (ReservedSlots.Dict.ContainsKey(_cInfo.playerId))
                    {
                        DateTime _dt;
                        ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt);
                        if (DateTime.Now < _dt)
                        {
                            _donator = true;
                            int _newDelay = Delay_Between_Uses / 2;
                            if (_timepassed >= _newDelay)
                            {
                                Kill(_cInfo);
                            }
                            else
                            {
                                int    _timeleft = _newDelay - _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}", _newDelay.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);
                                if (_announce)
                                {
                                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase8 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                }
                                else
                                {
                                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase8 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                }
                            }
                        }
                    }
                }
                if (!_donator)
                {
                    if (_timepassed >= Delay_Between_Uses)
                    {
                        Kill(_cInfo);
                    }
                    else
                    {
                        int    _timeleft = Delay_Between_Uses - _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_Between_Uses.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);
                        if (_announce)
                        {
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase8 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        }
                        else
                        {
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase8 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        }
                    }
                }
            }
        }
Пример #24
0
        public static void AddClan(ClientInfo _cInfo, string _clanName)
        {
            string    _sql    = string.Format("SELECT clanname, isclanowner FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result = SQL.TQuery(_sql);
            string    _clan   = _result.Rows[0].ItemArray.GetValue(0).ToString();
            bool      _isclanowner;

            bool.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _isclanowner);
            _result.Dispose();
            if (_isclanowner)
            {
                string _phrase101;
                if (!Phrases.Dict.TryGetValue(101, out _phrase101))
                {
                    _phrase101 = "you have already created the clan {ClanName}.";
                }
                _phrase101 = _phrase101.Replace("{ClanName}", _clan.ToString());
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase101 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
            }
            else
            {
                if (_clan.ToString() != "Unknown")
                {
                    string _phrase103;
                    if (!Phrases.Dict.TryGetValue(103, out _phrase103))
                    {
                        _phrase103 = "you are currently a member of the clan {ClanName}.";
                    }
                    _phrase103 = _phrase103.Replace("{ClanName}", _clan.ToString());
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase103 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                }
                else
                {
                    if (ClanList.Contains(_clanName))
                    {
                        string _phrase102;
                        if (!Phrases.Dict.TryGetValue(102, out _phrase102))
                        {
                            _phrase102 = "can not add the clan {ClanName} because it already exist.";
                        }
                        _phrase102 = _phrase102.Replace("{ClanName}", _clanName);
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase102 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(_clanName) || _clanName.Length < 3)
                        {
                            string _phrase129;
                            if (!Phrases.Dict.TryGetValue(129, out _phrase129))
                            {
                                _phrase129 = "the clanName must be longer than 2 characters.";
                                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase129 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                            }
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase129 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        }
                        else
                        {
                            _sql = string.Format("UPDATE Players SET clanname = '{0}', isclanowner = 'true', isclanofficer = 'true' WHERE steamid = '{1}'", _clanName, _cInfo.playerId);
                            SQL.FastQuery(_sql);
                            ClanMember.Add(_cInfo.playerId);
                            clans.Add(_clanName, _cInfo.playerId);
                            string _phrase104;
                            if (!Phrases.Dict.TryGetValue(104, out _phrase104))
                            {
                                _phrase104 = "you have added the clan {ClanName}.";
                            }
                            _phrase104 = _phrase104.Replace("{ClanName}", _clanName);
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase104 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        }
                    }
                }
            }
        }
Пример #25
0
 private static bool ChatMessage(ClientInfo _cInfo, EChatType _type, int _senderId, string _msg, string _mainName, bool _localizeMain, List <int> _recipientEntityIds)
 {
     return(ChatHook.Hook(_cInfo, _type, _senderId, _msg, _mainName, _recipientEntityIds));
 }
Пример #26
0
        public static void DemoteMember(ClientInfo _cInfo, string _playerName)
        {
            string    _sql      = string.Format("SELECT clanname, isclanowner FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result   = SQL.TQuery(_sql);
            string    _clanname = _result.Rows[0].ItemArray.GetValue(0).ToString();
            bool      _isclanowner;

            bool.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _isclanowner);
            _result.Dispose();
            if (!_isclanowner)
            {
                string _phrase107;
                if (!Phrases.Dict.TryGetValue(107, out _phrase107))
                {
                    _phrase107 = "you do not have permissions to use this command.";
                }
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase107 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
            }
            else
            {
                ClientInfo _membertoDemote = ConsoleHelper.ParseParamIdOrName(_playerName);
                if (_membertoDemote == null)
                {
                    string _phrase108;
                    if (!Phrases.Dict.TryGetValue(108, out _phrase108))
                    {
                        _phrase108 = "the name {PlayerName} was not found.";
                    }
                    _phrase108 = _phrase108.Replace("{PlayerName}", _playerName);
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase108 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                }
                else
                {
                    _sql = string.Format("SELECT clanname, isclanofficer FROM Players WHERE steamid = '{0}'", _membertoDemote.playerId);
                    DataTable _result1   = SQL.TQuery(_sql);
                    string    _clanname1 = _result1.Rows[0].ItemArray.GetValue(0).ToString();
                    bool      _isclanofficer1;
                    bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _isclanofficer1);
                    _result1.Dispose();
                    if (_clanname != _clanname1)
                    {
                        string _phrase117;
                        if (!Phrases.Dict.TryGetValue(117, out _phrase117))
                        {
                            _phrase117 = "{PlayerName} is not a member of your clan.";
                        }
                        _phrase117 = _phrase117.Replace("{PlayerName}", _playerName);
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase117 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                    }
                    else
                    {
                        if (!_isclanofficer1)
                        {
                            string _phrase124;
                            if (!Phrases.Dict.TryGetValue(124, out _phrase124))
                            {
                                _phrase124 = "{PlayerName} is not an officer.";
                            }
                            _phrase124 = _phrase124.Replace("{PlayerName}", _playerName);
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase124 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        }
                        else
                        {
                            _sql = string.Format("UPDATE Players SET isclanofficer = 'false' WHERE steamid = '{0}'", _membertoDemote.playerId);
                            SQL.FastQuery(_sql);
                            string _phrase125;
                            if (!Phrases.Dict.TryGetValue(125, out _phrase125))
                            {
                                _phrase125 = "{PlayerName} has been demoted.";
                            }
                            _phrase125 = _phrase125.Replace("{PlayerName}", _playerName);
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase125 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                        }
                    }
                }
            }
        }
Пример #27
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 3)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 to 3, found {0}.", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (Jail.IsEnabled)
             {
                 Jail.IsEnabled = false;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Jail has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Jail is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!Jail.IsEnabled)
             {
                 Jail.IsEnabled = true;
                 LoadConfig.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("Jail has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Jail is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count != 3)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 3, found {0}.", _params.Count));
                 return;
             }
             if (_params[1].Length < 1 || _params[1].Length > 17)
             {
                 SdtdConsole.Instance.Output(string.Format("Can not add Id: Invalid Id {0}.", _params[1]));
                 return;
             }
             if (Jail.Jailed.Contains(_params[1]))
             {
                 SdtdConsole.Instance.Output(string.Format("Can not add Id. {0} is already in the Jail list.", _params[1]));
                 return;
             }
             int _jailTime;
             if (!int.TryParse(_params[2], out _jailTime))
             {
                 SdtdConsole.Instance.Output(string.Format("Jail time is not valid: {0}", _params[2]));
                 return;
             }
             if (Jail.Jail_Position == "0,0,0" || Jail.Jail_Position == "0 0 0" || Jail.Jail_Position == "")
             {
                 SdtdConsole.Instance.Output(string.Format("Can not put a player in jail: Jail position has not been set."));
                 return;
             }
             else
             {
                 ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
                 if (_cInfo != null)
                 {
                     if (Jail.Jailed.Contains(_cInfo.playerId))
                     {
                         SdtdConsole.Instance.Output(string.Format("Player with Id {0} is already in jail.", _params[1]));
                         return;
                     }
                     else
                     {
                         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                         if (_player != null && _player.IsSpawned())
                         {
                             int      x, y, z;
                             string[] _cords = Jail.Jail_Position.Split(',');
                             int.TryParse(_cords[0], out x);
                             int.TryParse(_cords[1], out y);
                             int.TryParse(_cords[2], out z);
                             _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(x, y, z), null, false));
                         }
                         Jail.Jailed.Add(_cInfo.playerId);
                         PersistentContainer.Instance.Players[_cInfo.playerId].JailTime = _jailTime;
                         PersistentContainer.Instance.Players[_cInfo.playerId].JailName = _cInfo.playerName;
                         PersistentContainer.Instance.Players[_cInfo.playerId].JailDate = DateTime.Now;
                         PersistentContainer.Instance.Save();
                         if (_jailTime > 0)
                         {
                             string _phrase500;
                             if (!Phrases.Dict.TryGetValue(500, out _phrase500))
                             {
                                 _phrase500 = "You have been sent to jail.";
                             }
                             _phrase500 = _phrase500.Replace("{Minutes}", _jailTime.ToString());
                             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase500 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                             SdtdConsole.Instance.Output(string.Format("You have put {0} in jail for {1} minutes.", _cInfo.playerName, _jailTime));
                         }
                         if (_jailTime == -1)
                         {
                             string _phrase500;
                             if (!Phrases.Dict.TryGetValue(500, out _phrase500))
                             {
                                 _phrase500 = "You have been sent to jail.";
                             }
                             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase500 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                             SdtdConsole.Instance.Output(string.Format("You have put {0} in jail for life.", _cInfo.playerName));
                         }
                     }
                 }
                 else
                 {
                     PersistentPlayer p = PersistentContainer.Instance.Players[_params[1]];
                     {
                         if (p != null)
                         {
                             Jail.Jailed.Add(_cInfo.playerId);
                             PersistentContainer.Instance.Players[_params[1]].JailTime = _jailTime;
                             PersistentContainer.Instance.Players[_params[1]].JailName = _cInfo.playerName;
                             PersistentContainer.Instance.Players[_params[1]].JailDate = DateTime.Now;
                             PersistentContainer.Instance.Save();
                             SdtdConsole.Instance.Output(string.Format("Player with Id {0} can not be found online but has been set for jail.", _params[1]));
                             return;
                         }
                     }
                 }
             }
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}.", _params.Count));
                 return;
             }
             if (_params[1].Length != 17)
             {
                 SdtdConsole.Instance.Output(string.Format("Can not remove player Id: Invalid steam Id {0}.", _params[1]));
                 return;
             }
             else
             {
                 if (!Jail.Jailed.Contains(_params[1]))
                 {
                     SdtdConsole.Instance.Output(string.Format("Player with steam Id {0} is not in jail. ", _params[1]));
                     return;
                 }
                 else
                 {
                     ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForPlayerId(_params[1]);
                     if (_cInfo != null)
                     {
                         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                         if (_player != null)
                         {
                             EntityBedrollPositionList _position = _player.SpawnPoints;
                             Jail.Jailed.Remove(_cInfo.playerId);
                             PersistentContainer.Instance.Players[_cInfo.playerId].JailTime = 0;
                             PersistentContainer.Instance.Save();
                             if (_position != null && _position.Count > 0)
                             {
                                 _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_position[0].x, -1, _position[0].z), null, false));
                             }
                             else
                             {
                                 Vector3[] _pos = GameManager.Instance.World.GetRandomSpawnPointPositions(1);
                                 _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_pos[0].x, -1, _pos[0].z), null, false));
                             }
                             SdtdConsole.Instance.Output(string.Format("You have released a player with steam id {0} from jail. ", _params[1]));
                             return;
                         }
                     }
                     else
                     {
                     }
                 }
             }
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}.", _params.Count));
                 return;
             }
             if (Jail.Jailed.Count == 0)
             {
                 SdtdConsole.Instance.Output("There are no Ids on the Jail list.");
                 return;
             }
             else
             {
                 for (int i = 0; i < Jail.Jailed.Count; i++)
                 {
                     string _id       = Jail.Jailed[i];
                     int    _jailTime = PersistentContainer.Instance.Players[_id].JailTime;
                     string _jailName = PersistentContainer.Instance.Players[_id].JailName;
                     if (_jailTime > 0)
                     {
                         DateTime _jailDate         = PersistentContainer.Instance.Players[_id].JailDate;
                         TimeSpan varTime           = DateTime.Now - _jailDate;
                         double   fractionalMinutes = varTime.TotalMinutes;
                         int      _timepassed       = (int)fractionalMinutes;
                         int      _timeleft         = _jailTime - _timepassed;
                         SdtdConsole.Instance.Output(string.Format("Jailed player: steam Id {0} named {1} for {2} more minutes.", _id, _jailName, _timeleft));
                     }
                     else if (_jailTime == -1)
                     {
                         SdtdConsole.Instance.Output(string.Format("Jailed player: steam Id {0} named {1} forever.", _id, _jailName));
                     }
                 }
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in CommandJailConsole.Execute: {0}", e.Message));
     }
 }
Пример #28
0
 public static void BackupExec()
 {
     if (!IsRunning && !StopServer.stopServerCountingDown)
     {
         IsRunning = true;
         try
         {
             using (ZipFile zip = new ZipFile())
             {
                 Log.Out("[SERVERTOOLS] Starting world backup");
                 ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + "Starting world backup..." + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                 string   saveDirectory    = GameUtils.GetSaveGameDir();
                 string[] _files1          = Directory.GetFiles(saveDirectory, "*", SearchOption.AllDirectories);
                 string   _parentDirectory = Directory.GetParent(saveDirectory).FullName;
                 string[] _files2          = { };
                 if (Destination == "")
                 {
                     _files2 = Directory.GetFiles(_parentDirectory, "*.zip");
                 }
                 else
                 {
                     if (!Directory.Exists(Destination))
                     {
                         Directory.CreateDirectory(Destination);
                         Log.Out(string.Format("[SERVERTOOLS] World backup destination folder not found. The folder has been created at {0} and backup resumed", Destination));
                     }
                     else
                     {
                         _files2 = Directory.GetFiles(Destination, "*.zip");
                     }
                 }
                 int _daysBeforeDeleted = (Days_Before_Save_Delete * -1);
                 if (_files2 != null)
                 {
                     foreach (string a in _files2)
                     {
                         FileInfo b = new FileInfo(a);
                         if (b.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                         {
                             Log.Out(string.Format("[SERVERTOOLS] Old backup named {0} was deleted due to its age", b.Name));
                             b.Delete();
                         }
                     }
                 }
                 if (Destination == "")
                 {
                     foreach (var c in _files1)
                     {
                         zip.AddFile(c, Path.GetDirectoryName(c).Replace(_parentDirectory, string.Empty));
                     }
                     zip.Save(Path.ChangeExtension(_parentDirectory + string.Format("_{0}", DateTime.Now.ToString("MM-dd-yy_HH-mm")), ".zip"));
                     Log.Out(string.Format("[SERVERTOOLS] World backup completed successfully. File is located and named {0}", _parentDirectory + "_" + DateTime.Now + ".zip"));
                 }
                 else
                 {
                     foreach (var c in _files1)
                     {
                         zip.AddFile(c, Path.GetDirectoryName(c).Replace(Destination, string.Empty));
                     }
                     zip.Save(Path.ChangeExtension(Destination + string.Format("_{0}", DateTime.Now.ToString("MM-dd-yy_HH-mm")), ".zip"));
                     Log.Out(string.Format("[SERVERTOOLS] World backup completed successfully. File is located and named {0}", Destination + "_" + DateTime.Now + ".zip"));
                 }
                 ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + "World backup completed successfully" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
             }
         }
         catch (Exception e)
         {
             Log.Out(string.Format("[SERVERTOOLS] Error in AutoBackup.Run: {0}.", e));
         }
         IsRunning = false;
     }
 }
Пример #29
0
 public static void Exec(ClientInfo _cInfo, string _playerName)
 {
     if (SetMarket.Market_Position != "0,0,0")
     {
         int    x, y, z;
         string _sql;
         if (Return)
         {
             EntityPlayer _player   = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             Vector3      _position = _player.GetPosition();
             x = (int)_position.x;
             y = (int)_position.y;
             z = (int)_position.z;
             if (PvP_Check)
             {
                 if (Teleportation.PCheck(_cInfo, _player))
                 {
                     return;
                 }
             }
             if (Zombie_Check)
             {
                 if (Teleportation.ZCheck(_cInfo, _player))
                 {
                     return;
                 }
             }
             string _mposition = x + "," + y + "," + z;
             MarketPlayers.Add(_cInfo.entityId);
             _sql = string.Format("UPDATE Players SET marketReturn = '{0}' WHERE steamid = '{1}'", _mposition, _cInfo.playerId);
             SQL.FastQuery(_sql);
             string _phrase561;
             if (!Phrases.Dict.TryGetValue(561, out _phrase561))
             {
                 _phrase561 = "you can go back by typing /marketback when you are ready to leave the market.";
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase561 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
         string[] _cords = SetMarket.Market_Position.Split(',');
         int.TryParse(_cords[0], out x);
         int.TryParse(_cords[1], out y);
         int.TryParse(_cords[2], out z);
         Players.NoFlight.Add(_cInfo.entityId);
         _cInfo.SendPackage(new NetPackageTeleportPlayer(new Vector3(x, y, z), null, false));
         string _phrase562;
         if (!Phrases.Dict.TryGetValue(562, out _phrase562))
         {
             _phrase562 = "sent you to the market.";
         }
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase562 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         if (Wallet.IsEnabled && Command_Cost >= 1)
         {
             Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost);
         }
         _sql = string.Format("UPDATE Players SET lastMarket = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
         SQL.FastQuery(_sql);
     }
     else
     {
         string _phrase563;
         if (!Phrases.Dict.TryGetValue(563, out _phrase563))
         {
             _phrase563 = "the market position is not set.";
         }
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase563 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Пример #30
0
 public static void MarketTele(ClientInfo _cInfo)
 {
     if (Market.Market_Position != "0,0,0" || Market.Market_Position != "0 0 0" || Market.Market_Position != "")
     {
         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         if (Player_Check)
         {
             if (Teleportation.PCheck(_cInfo, _player))
             {
                 return;
             }
         }
         if (Zombie_Check)
         {
             if (Teleportation.ZCheck(_cInfo, _player))
             {
                 return;
             }
         }
         int x, y, z;
         if (Return)
         {
             Vector3 _position = _player.GetPosition();
             x = (int)_position.x;
             y = (int)_position.y;
             z = (int)_position.z;
             string _mposition = x + "," + y + "," + z;
             MarketPlayers.Add(_cInfo.entityId);
             PersistentContainer.Instance.Players[_cInfo.playerId].MarketReturnPos = _mposition;
             string _phrase561;
             if (!Phrases.Dict.TryGetValue(561, out _phrase561))
             {
                 _phrase561 = " you can go back by typing {CommandPrivate}{Command51} when you are ready to leave the market.";
             }
             _phrase561 = _phrase561.Replace("{CommandPrivate}", ChatHook.Command_Private);
             _phrase561 = _phrase561.Replace("{Command51}", Market.Command51);
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase561 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
         string[] _cords = { };
         if (Market.Market_Position.Contains(","))
         {
             if (Market.Market_Position.Contains(" "))
             {
                 Market.Market_Position.Replace(" ", "");
             }
             _cords = Market.Market_Position.Split(',').ToArray();
         }
         else if (Market.Market_Position.Contains(" "))
         {
             _cords = Market.Market_Position.Split(' ').ToArray();
         }
         int.TryParse(_cords[0], out x);
         int.TryParse(_cords[1], out y);
         int.TryParse(_cords[2], out z);
         _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(x, y, z), null, false));
         string _phrase562;
         if (!Phrases.Dict.TryGetValue(562, out _phrase562))
         {
             _phrase562 = " sent you to the market.";
         }
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase562 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         if (Wallet.IsEnabled && Command_Cost >= 1)
         {
             Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost);
         }
         PersistentContainer.Instance.Players[_cInfo.playerId].LastMarket = DateTime.Now;
         PersistentContainer.Instance.Save();
     }
     else
     {
         string _phrase563;
         if (!Phrases.Dict.TryGetValue(563, out _phrase563))
         {
             _phrase563 = " the market position is not set.";
         }
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase563 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }