Example #1
0
        public static void LeaveClan(ClientInfo _cInfo)
        {
            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 _phrase126;
                if (!Phrases.Dict.TryGetValue(126, out _phrase126))
                {
                    _phrase126 = "you can not leave the clan because you are the owner. You can only delete the clan.";
                }
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase126 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
            }
            else
            {
                if (_clanname == "Unknown")
                {
                    string _phrase127;
                    if (!Phrases.Dict.TryGetValue(127, out _phrase127))
                    {
                        _phrase127 = "you do not belong to any clans.";
                    }
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase127 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                }
                else
                {
                    ClanMember.Remove(_cInfo.playerId);
                    string _phrase121;
                    if (!Phrases.Dict.TryGetValue(121, out _phrase121))
                    {
                        _phrase121 = "you have been removed from the clan {ClanName}.";
                    }
                    _phrase121 = _phrase121.Replace("{ClanName}", _clanname);
                    _sql       = string.Format("UPDATE Players SET clanname = 'Unknown', isclanofficer = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                    SQL.FastQuery(_sql);
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase121 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                }
            }
        }
 public static void StartingItemCheck(ClientInfo _cInfo)
 {
     if (startItemList.Count > 0)
     {
         string    _sql    = string.Format("SELECT startingItems FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
         DataTable _result = SQL.TQuery(_sql);
         bool      _startingItems;
         bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _startingItems);
         _result.Dispose();
         if (!_startingItems)
         {
             Exec(_cInfo);
         }
     }
     else
     {
         Log.Out("[SERVERTOOLS] Starting items list empty. No items found in the file have been added.");
     }
 }
Example #3
0
        public static void Check()
        {
            string    _sql    = "SELECT pollTime, pollHours, pollMessage, pollYes, pollNo FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                DateTime _pollTime;
                DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _pollTime);
                int _pollHours;
                int.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _pollHours);
                string _pollMessage = _result.Rows[0].ItemArray.GetValue(2).ToString();
                int    _pollYes;
                int.TryParse(_result.Rows[0].ItemArray.GetValue(3).ToString(), out _pollYes);
                int _pollNo;
                int.TryParse(_result.Rows[0].ItemArray.GetValue(4).ToString(), out _pollNo);
                TimeSpan varTime         = DateTime.Now - _pollTime;
                double   fractionalHours = varTime.TotalHours;
                int      _timepassed     = (int)fractionalHours;
                if (_timepassed >= _pollHours)
                {
                    string _phrase925;
                    if (!Phrases.Dict.TryGetValue(925, out _phrase925))
                    {
                        _phrase925 = "Poll results: Yes {YesVote} / No {NoVote}";
                    }
                    _phrase925 = _phrase925.Replace("{YesVote}", _pollYes.ToString());
                    _phrase925 = _phrase925.Replace("{NoVote}", _pollNo.ToString());
                    _sql       = "UPDATE Polls SET pollOpen = 'false' WHERE pollOpen = 'true'";
                    SQL.FastQuery(_sql);
                    using (StreamWriter sw = new StreamWriter(_filepath, true))
                    {
                        sw.WriteLine(string.Format("{0}  Poll {1} ... has completed. The final results were yes {2} / no {3}", DateTime.Now, _pollMessage, _pollYes, _pollNo));
                        sw.WriteLine();
                        sw.Flush();
                        sw.Close();
                    }
                }
            }
            _result.Dispose();
        }
Example #4
0
        public static void BountyList(ClientInfo _cInfo, string _playerName)
        {
            List <ClientInfo> _cInfoList = ConnectionManager.Instance.Clients.List.ToList();

            for (int i = 0; i < _cInfoList.Count; i++)
            {
                ClientInfo _cInfo1 = _cInfoList[i];
                if (_cInfo1 != null)
                {
                    EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo1.entityId];
                    string       _sql    = string.Format("SELECT bounty FROM Players WHERE steamid = '{0}'", _cInfo1.playerId);
                    DataTable    _result = SQL.TQuery(_sql);
                    int          _currentbounty;
                    int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _currentbounty);
                    _result.Dispose();
                    if (_currentbounty > 0)
                    {
                        string _phrase911;
                        if (!Phrases.Dict.TryGetValue(911, out _phrase911))
                        {
                            _phrase911 = "{PlayerName}, # {EntityId}. Current bounty: {CurrentBounty}. Minimum bounty is {Minimum} {CoinName}.";
                        }
                        _phrase911 = _phrase911.Replace("{PlayerName}", _cInfo1.playerName);
                        _phrase911 = _phrase911.Replace("{EntityId}", _cInfo1.entityId.ToString());
                        _phrase911 = _phrase911.Replace("{CurrentBounty}", _currentbounty.ToString());
                        _phrase911 = _phrase911.Replace("{Minimum}", Minimum_Bounty.ToString());
                        _phrase911 = _phrase911.Replace("{CoinName}", Wallet.Coin_Name);
                        ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase911 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
            }
            string _phrase910;

            if (!Phrases.Dict.TryGetValue(910, out _phrase910))
            {
                _phrase910 = "Type {CommandPrivate}{Command83} Id# Value or {CommandPrivate}{Command83} Id# for the minimum bounty against this player.";
            }
            _phrase910 = _phrase910.Replace("{CommandPrivate}", ChatHook.Command_Private);
            _phrase910 = _phrase910.Replace("{Command83}", Command83);
            ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase910 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
        }
Example #5
0
        public static void InviteAccept(ClientInfo _cInfo)
        {
            string    _sql           = string.Format("SELECT invitedtoclan FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result        = SQL.TQuery(_sql);
            string    _invitedtoclan = _result.Rows[0].ItemArray.GetValue(0).ToString();

            _result.Dispose();
            if (_invitedtoclan == "Unknown")
            {
                string _phrase113;
                if (!Phrases.Dict.TryGetValue(113, out _phrase113))
                {
                    _phrase113 = "you have not been invited to any clans.";
                }
                _phrase113 = _phrase113.Replace("{PlayerName}", _cInfo.playerName);
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase113 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
            }
            else
            {
                ClanMember.Add(_cInfo.playerId);
                _sql = string.Format("UPDATE Players SET clanname= '{0}', invitedtoclan = 'Unknown' WHERE steamid = '{1}'", _invitedtoclan, _cInfo.playerId);
                SQL.FastQuery(_sql);
                _sql = string.Format("SELECT steamid FROM Players WHERE clanname = '{0}'", _invitedtoclan);
                DataTable _result1 = SQL.TQuery(_sql);
                foreach (DataRow row in _result1.Rows)
                {
                    ClientInfo _cInfo1 = ConsoleHelper.ParseParamIdOrName(row[0].ToString());
                    if (_cInfo1 != null)
                    {
                        string _phrase115;
                        if (!Phrases.Dict.TryGetValue(115, out _phrase115))
                        {
                            _phrase115 = "{PlayerName} has joined the clan.";
                        }
                        _phrase115 = _phrase115.Replace("{PlayerName}", _cInfo.playerName);
                        ChatHook.ChatMessage(_cInfo1, LoadConfig.Chat_Response_Color + _phrase115 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                    }
                }
                _result1.Dispose();
            }
        }
        public static void firstClaim(ClientInfo _cInfo)
        {
            string    _sql    = string.Format("SELECT firstClaim FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result = SQL.TQuery(_sql);
            bool      _firstClaim;

            bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _firstClaim);
            _result.Dispose();
            if (!_firstClaim)
            {
                World     world      = GameManager.Instance.World;
                string    claimBlock = "keystoneBlock";
                ItemValue itemValue;
                itemValue = new ItemValue(ItemClass.GetItem(claimBlock).type, 1, 1, true);

                if (Equals(itemValue, ItemValue.None))
                {
                    SdtdConsole.Instance.Output(string.Format("Unable to find block {0} for /claim command", claimBlock));
                }
                var entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData
                {
                    entityClass     = EntityClass.FromString("item"),
                    id              = EntityFactory.nextEntityID++,
                    itemStack       = new ItemStack(itemValue, 1),
                    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);
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", claim block has been added to your inventory or if inventory is full, it dropped at your feet.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                _sql = string.Format("UPDATE Players SET firstClaim = 'true' WHERE steamid = '{0}'", _cInfo.playerId);
                SQL.FastQuery(_sql);
            }
            else
            {
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you have already received your first claim block. Contact an administrator if you require help.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
            }
        }
Example #7
0
        public static void JailList()
        {
            string    _sql    = "SELECT steamid, jailTime, jailDate FROM Players WHERE jailTime > 0 OR jailTime = -1";
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                int      _jailTime;
                DateTime _jailDate;
                foreach (DataRow row in _result.Rows)
                {
                    int.TryParse(row[1].ToString(), out _jailTime);
                    if (_jailTime > 0 || _jailTime == -1)
                    {
                        if (_jailTime == -1)
                        {
                            Jailed.Add(row[0].ToString());
                            break;
                        }
                        else
                        {
                            DateTime.TryParse(row[2].ToString(), out _jailDate);
                            TimeSpan varTime           = DateTime.Now - _jailDate;
                            double   fractionalMinutes = varTime.TotalMinutes;
                            int      _timepassed       = (int)fractionalMinutes;
                            if (_timepassed < _jailTime)
                            {
                                Jailed.Add(row[0].ToString());
                            }
                            else
                            {
                                _sql = string.Format("UPDATE Players SET jailTime = 0 WHERE steamid = '{0}'", row[0].ToString());
                                SQL.FastQuery(_sql);
                            }
                        }
                    }
                }
            }
            _result.Dispose();
        }
Example #8
0
        public static void Check(ClientInfo _cInfo)
        {
            string    _sql    = string.Format("SELECT bank FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result = SQL.TQuery(_sql);
            int       _bank;

            int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _bank);
            _result.Dispose();
            if (TransferId.ContainsKey(_cInfo.playerId))
            {
                int _id;
                TransferId.TryGetValue(_cInfo.playerId, out _id);
                string _message = " your bank account is worth {Value}. Transfer Id is {Id}.";
                _message = _message.Replace("{Value}", _bank.ToString());
                _message = _message.Replace("{Id}", _id.ToString());
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            else
            {
                AddId(_cInfo);
            }
        }
Example #9
0
        public static void WalletWithdraw(ClientInfo _cInfo, string _amount)
        {
            int _coinAmount;

            if (int.TryParse(_amount, out _coinAmount))
            {
                string    _sql    = string.Format("SELECT bank, playerSpentCoins FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                DataTable _result = SQL.TQuery(_sql);
                int       _bank;
                int       _playerSpentCoins;
                int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _bank);
                int.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _playerSpentCoins);
                _result.Dispose();
                if (_bank >= _coinAmount)
                {
                    _sql = string.Format("UPDATE Players SET bank = {0}, playerSpentCoins = {1} WHERE steamid = '{2}'", _bank - _coinAmount, _playerSpentCoins + _coinAmount, _cInfo.playerId);
                    SQL.FastQuery(_sql);
                    string _message = "you have received your {Name}. It has gone to your wallet.";
                    _message = _message.Replace("{Name}", Wallet.Coin_Name);
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    using (StreamWriter sw = new StreamWriter(filepath, true))
                    {
                        sw.WriteLine(string.Format("{0}: {1} has removed {2} from their bank account into their wallet.", DateTime.Now, _cInfo.playerName, _coinAmount));
                        sw.WriteLine();
                        sw.Flush();
                        sw.Close();
                    }
                }
                else
                {
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", your bank account does not have enough to withdraw that value.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
            }
            else
            {
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you input an invalid integer. Type " + ChatHook.Command_Private + Command98 + " #.", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Example #10
0
        public static int GetcurrentCoins(ClientInfo _cInfo)
        {
            World        world   = GameManager.Instance.World;
            EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
            string       _sql    = string.Format("SELECT playerSpentCoins FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable    _result = SQL.TQuery(_sql);
            int          _playerSpentCoins;

            int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _playerSpentCoins);
            _result.Dispose();
            int _currentCoins = 0;
            int gameMode      = world.GetGameMode();

            if (gameMode == 7)
            {
                _currentCoins = (_player.KilledZombies * Zombie_Kills) + (_player.KilledPlayers * Player_Kills) - (XUiM_Player.GetDeaths(_player) * Deaths) + _playerSpentCoins;
            }
            else
            {
                _currentCoins = (_player.KilledZombies * Zombie_Kills) - (XUiM_Player.GetDeaths(_player) * Deaths) + _playerSpentCoins;
            }
            return(_currentCoins);
        }
Example #11
0
        public static void WalletCheck(ClientInfo _cInfo, int _purchase)
        {
            string    _sql    = string.Format("SELECT itemPrice FROM Auction WHERE auctionid = {0}", _purchase);
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                int _coinValue;
                int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _coinValue);
                int _currentCoins = Wallet.GetcurrentCoins(_cInfo);
                if (_currentCoins >= _coinValue)
                {
                    BuyAuction(_cInfo, _purchase);
                }
                else
                {
                    int _missing;
                    if (_currentCoins >= 0)
                    {
                        _missing = _coinValue - _currentCoins;
                    }
                    else
                    {
                        _missing = _coinValue + _currentCoins;
                    }
                    string _message = "you can not make this purchase. You need {Value} more {Name}.";
                    _message = _message.Replace("{Value}", _missing.ToString());
                    _message = _message.Replace("{Name}", Wallet.Coin_Name);
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
            }
            else
            {
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", this # could not be found. Please check the auction list by typing /auction.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            _result.Dispose();
        }
Example #12
0
        public static void Clan(ClientInfo _cInfo, string _message)
        {
            string    _sql      = string.Format("SELECT clanname FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result   = SQL.TQuery(_sql);
            string    _clanname = _result.Rows[0].ItemArray.GetValue(0).ToString();

            _result.Dispose();
            _sql = string.Format("SELECT steamid FROM Players WHERE clanname = '{0}'", _clanname);
            DataTable _result1 = SQL.TQuery(_sql);

            foreach (DataRow row in _result1.Rows)
            {
                ClientInfo _cInfo1 = ConsoleHelper.ParseParamIdOrName(row[0].ToString());
                if (_cInfo1 != null)
                {
                    ChatHook.ChatMessage(_cInfo1, Private_Chat_Color + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                    if (ChatLog.IsEnabled)
                    {
                        ChatLog.Log(_message, _cInfo.playerName);
                    }
                }
            }
            _result1.Dispose();
        }
Example #13
0
        public static void Died(ClientInfo _cInfo)
        {
            EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
            int          _team;

            if (PlayersTeam.TryGetValue(_cInfo.playerId, out _team))
            {
                string    _sql     = string.Format("SELECT eventid FROM Events WHERE eventActive = 'true'");
                DataTable _result1 = SQL.TQuery(_sql);
                int       _eventid;
                int.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _eventid);
                _result1.Dispose();
                _sql = string.Format("SELECT eventRespawn FROM EventSpawns WHERE eventid = {0} AND eventTeam = {1}", _eventid, _team);
                DataTable _result2    = SQL.TQuery(_sql);
                string    _respawnPos = _result2.Rows[1].ItemArray.GetValue(0).ToString();
                _result2.Dispose();
                int      _x, _y, _z;
                string[] _cords = _respawnPos.Split(',');
                int.TryParse(_cords[0], out _x);
                int.TryParse(_cords[1], out _y);
                int.TryParse(_cords[2], out _z);
                _cInfo.SendPackage(new NetPackageTeleportPlayer(new Vector3(_x, _y, _z), null, false));
            }
        }
Example #14
0
 public static void FDelay(ClientInfo _cInfo, string _waypoint)
 {
     if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId))
     {
         bool _donator = false;
         if (Delay_Between_Uses < 1)
         {
             FClaimCheck(_cInfo, _waypoint);
         }
         else
         {
             string    _sql    = string.Format("SELECT lastWaypoint FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
             DataTable _result = SQL.TQuery(_sql);
             DateTime  _lastWaypoint;
             DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastWaypoint);
             _result.Dispose();
             if (_lastWaypoint.ToString() == "10/29/2000 7:30:00 AM")
             {
                 FClaimCheck(_cInfo, _waypoint);
             }
             else
             {
                 TimeSpan varTime           = DateTime.Now - _lastWaypoint;
                 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)
                             {
                                 FClaimCheck(_cInfo, _waypoint);
                             }
                             else
                             {
                                 int    _timeleft = _newDelay - _timepassed;
                                 string _phrase575;
                                 if (!Phrases.Dict.TryGetValue(575, out _phrase575))
                                 {
                                     _phrase575 = " you can only use waypoints once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
                                 }
                                 _phrase575 = _phrase575.Replace("{DelayBetweenUses}", _newDelay.ToString());
                                 _phrase575 = _phrase575.Replace("{TimeRemaining}", _timeleft.ToString());
                                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase575 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                             }
                         }
                     }
                 }
                 if (!_donator)
                 {
                     if (_timepassed >= Delay_Between_Uses)
                     {
                         FClaimCheck(_cInfo, _waypoint);
                     }
                     else
                     {
                         int    _timeleft = Delay_Between_Uses - _timepassed;
                         string _phrase575;
                         if (!Phrases.Dict.TryGetValue(575, out _phrase575))
                         {
                             _phrase575 = " you can only use waypoints once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
                         }
                         _phrase575 = _phrase575.Replace("{DelayBetweenUses}", Delay_Between_Uses.ToString());
                         _phrase575 = _phrase575.Replace("{TimeRemaining}", _timeleft.ToString());
                         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase575 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     }
                 }
             }
         }
     }
     else
     {
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you can not use waypoint commands while signed up for or in an event.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }
Example #15
0
        private static void Entity(ClientInfo _cInfo)
        {
            Entityspawn(_cInfo);
            string _sql2 = string.Format("UPDATE Players SET lastVoteReward = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);

            SQL.FastQuery(_sql2, "VoteReward");
            if (Weekly_Votes > 0)
            {
                string    _sql    = string.Format("SELECT lastVoteWeekly FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                DataTable _result = SQL.TQuery(_sql);
                DateTime  _lastVoteWeekly;
                DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastVoteWeekly);
                _result.Dispose();
                TimeSpan varTime        = DateTime.Now - _lastVoteWeekly;
                double   fractionalDays = varTime.TotalDays;
                int      _timepassed    = (int)fractionalDays;
                if (_timepassed < 7)
                {
                    _sql = string.Format("SELECT weeklyVoteCount FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                    DataTable _result2 = SQL.TQuery(_sql);
                    int       _weeklyVoteCount;
                    int.TryParse(_result2.Rows[0].ItemArray.GetValue(0).ToString(), out _weeklyVoteCount);
                    _result2.Dispose();
                    if (_weeklyVoteCount + 1 == Weekly_Votes)
                    {
                        _sql = string.Format("UPDATE Players SET weeklyVoteCount = 1, lastVoteWeekly = {0} WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
                        SQL.FastQuery(_sql, "VoteReward");
                        Entityspawn(_cInfo);
                        string _phrase704;
                        if (!Phrases.Dict.TryGetValue(704, out _phrase704))
                        {
                            _phrase704 = " you have reached the votes needed in a week. Thank you! Sent you an extra reward and reset your weekly votes to 1.";
                        }
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase704 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                    else
                    {
                        _sql = string.Format("UPDATE Players SET weeklyVoteCount = {0} WHERE steamid = '{1}'", _weeklyVoteCount + 1, _cInfo.playerId);
                        SQL.FastQuery(_sql, "VoteReward");
                        int      _remainingVotes = Weekly_Votes - _weeklyVoteCount + 1;
                        DateTime _date2          = _lastVoteWeekly.AddDays(7);
                        string   _phrase705;
                        if (!Phrases.Dict.TryGetValue(705, out _phrase705))
                        {
                            _phrase705 = " you have voted {Votes} time since {Date}. You need {Count} more votes before {Date2} to reach the bonus.";
                        }
                        _phrase705 = _phrase705.Replace("{Votes}", _weeklyVoteCount + 1.ToString());
                        _phrase705 = _phrase705.Replace("{Date}", _lastVoteWeekly.ToString());
                        _phrase705 = _phrase705.Replace("{Count}", _remainingVotes.ToString());
                        _phrase705 = _phrase705.Replace("{Date2}", _date2.ToString());
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase705 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
                else
                {
                    _sql = string.Format("UPDATE Players SET weeklyVoteCount = 1, lastVoteWeekly = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
                    SQL.FastQuery(_sql, "VoteReward");
                    int      _remainingVotes = Weekly_Votes - 1;
                    DateTime _date2          = DateTime.Now.AddDays(7);
                    string   _phrase705;
                    if (!Phrases.Dict.TryGetValue(705, out _phrase705))
                    {
                        _phrase705 = " you have voted 1 time since {Date}. You need {Count} more votes before {Date2} to reach the bonus.";
                    }
                    _phrase705 = _phrase705.Replace("{Date}", DateTime.Now.ToString());
                    _phrase705 = _phrase705.Replace("{Count}", _remainingVotes.ToString());
                    _phrase705 = _phrase705.Replace("{Date2}", _date2.ToString());
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase705 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
            }
            string _phrase701;

            if (!Phrases.Dict.TryGetValue(701, out _phrase701))
            {
                _phrase701 = "Thank you for your vote {PlayerName}. You can vote and receive another reward in {VoteDelay} hours.";
            }
            _phrase701 = _phrase701.Replace("{PlayerName}", _cInfo.playerName);
            _phrase701 = _phrase701.Replace("{VoteDelay}", Delay_Between_Uses.ToString());
            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase701 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
        }
Example #16
0
        public static void List(ClientInfo _cInfo)
        {
            string    _sql    = string.Format("SELECT steamid FROM Waypoints WHERE steamid = '{0}' LIMIT 1", _cInfo.playerId);
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                if (ReservedSlots.IsEnabled && ReservedSlots.Dict.ContainsKey(_cInfo.playerId))
                {
                    DateTime _dt;
                    ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt);
                    if (DateTime.Now < _dt)
                    {
                        _sql = string.Format("SELECT steamid, wayPointName, position FROM Waypoints WHERE steamid = '{0}' LIMIT {1}", _cInfo.playerId, Donator_Max_Waypoints);
                        DataTable _result1 = SQL.TQuery(_sql);
                        foreach (DataRow row in _result1.Rows)
                        {
                            string   _name = row[1].ToString();
                            int      x, y, z;
                            string[] _cords = row[2].ToString().Split(',');
                            int.TryParse(_cords[0], out x);
                            int.TryParse(_cords[1], out y);
                            int.TryParse(_cords[2], out z);
                            string _message = "Waypoint {Name} @ {X} {Y} {Z}";
                            _message = _message.Replace("{Name}", _name);
                            _message = _message.Replace("{X}", x.ToString());
                            _message = _message.Replace("{Y}", y.ToString());
                            _message = _message.Replace("{Z}", z.ToString());
                            ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        }
                        _result1.Dispose();
                    }
                    else
                    {
                        _sql = string.Format("SELECT steamid, wayPointName, position FROM Waypoints WHERE steamid = '{0}' LIMIT {1}", _cInfo.playerId, Max_Waypoints);
                        DataTable _result1 = SQL.TQuery(_sql);
                        foreach (DataRow row in _result1.Rows)
                        {
                            string   _name = row[1].ToString();
                            int      x, y, z;
                            string[] _cords = row[2].ToString().Split(',');
                            int.TryParse(_cords[0], out x);
                            int.TryParse(_cords[1], out y);
                            int.TryParse(_cords[2], out z);
                            string _message = "Waypoint {Name} @ {X} {Y} {Z}";
                            _message = _message.Replace("{Name}", _name);
                            _message = _message.Replace("{X}", x.ToString());
                            _message = _message.Replace("{Y}", y.ToString());
                            _message = _message.Replace("{Z}", z.ToString());
                            ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        }
                        _result1.Dispose();
                    }
                }
                else
                {
                    _sql = string.Format("SELECT steamid, wayPointName, position FROM Waypoints WHERE steamid = '{0}' LIMIT {1}", _cInfo.playerId, Max_Waypoints);
                    DataTable _result1 = SQL.TQuery(_sql);
                    foreach (DataRow row in _result1.Rows)
                    {
                        string   _name = row[1].ToString();
                        int      x, y, z;
                        string[] _cords = row[2].ToString().Split(',');
                        int.TryParse(_cords[0], out x);
                        int.TryParse(_cords[1], out y);
                        int.TryParse(_cords[2], out z);
                        string _message = "Waypoint {Name} @ {X} {Y} {Z}";
                        _message = _message.Replace("{Name}", _name);
                        _message = _message.Replace("{X}", x.ToString());
                        _message = _message.Replace("{Y}", y.ToString());
                        _message = _message.Replace("{Z}", z.ToString());
                        ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                    _result1.Dispose();
                }
            }
            else
            {
                string _phrase585;
                if (!Phrases.Dict.TryGetValue(585, out _phrase585))
                {
                    _phrase585 = " you have no waypoints saved to list.";
                }
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase585 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            _result.Dispose();
        }
Example #17
0
        private static void SetPoint(ClientInfo _cInfo, string _waypoint)
        {
            string    _sql    = string.Format("SELECT steamid FROM Waypoints WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                if (ReservedSlots.IsEnabled && ReservedSlots.Dict.ContainsKey(_cInfo.playerId))
                {
                    DateTime _dt;
                    ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt);
                    if (DateTime.Now < _dt)
                    {
                        if (_result.Rows.Count < Donator_Max_Waypoints && Donator_Max_Waypoints > 0)
                        {
                            EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                            Vector3      _position  = _player.GetPosition();
                            int          x          = (int)_position.x;
                            int          y          = (int)_position.y;
                            int          z          = (int)_position.z;
                            string       _wposition = x + "," + y + "," + z;
                            _waypoint = SQL.EscapeString(_waypoint);
                            _sql      = string.Format("INSERT INTO Waypoints (steamid, wayPointName, position) VALUES ('{0}', '{1}', '{2}')", _cInfo.playerId, _waypoint, _wposition);
                            SQL.FastQuery(_sql, "Waypoints");
                            string _message = " saved waypoint name as {Name} to {X} {Y} {Z}.";
                            _message = _message.Replace("{Name}", _waypoint);
                            _message = _message.Replace("{X}", x.ToString());
                            _message = _message.Replace("{Y}", y.ToString());
                            _message = _message.Replace("{Z}", z.ToString());
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        }
                        else
                        {
                            string _phrase581;
                            if (!Phrases.Dict.TryGetValue(581, out _phrase581))
                            {
                                _phrase581 = " you have a maximum {Count} waypoints.";
                            }
                            _phrase581 = _phrase581.Replace("{Count}", Donator_Max_Waypoints.ToString());
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase581 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        }
                    }
                }
                else
                {
                    if (_result.Rows.Count < Max_Waypoints && Max_Waypoints > 0)
                    {
                        EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                        Vector3      _position  = _player.GetPosition();
                        int          x          = (int)_position.x;
                        int          y          = (int)_position.y;
                        int          z          = (int)_position.z;
                        string       _wposition = x + "," + y + "," + z;
                        _waypoint = SQL.EscapeString(_waypoint);
                        _sql      = string.Format("INSERT INTO Waypoints (steamid, wayPointName, position) VALUES ('{0}', '{1}', '{2}')", _cInfo.playerId, _waypoint, _wposition);
                        SQL.FastQuery(_sql, "Waypoints");
                        string _message = " saved waypoint name as {Name} to {X} {Y} {Z}.";
                        _message = _message.Replace("{Name}", _waypoint);
                        _message = _message.Replace("{X}", x.ToString());
                        _message = _message.Replace("{Y}", y.ToString());
                        _message = _message.Replace("{Z}", z.ToString());
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                    else
                    {
                        string _phrase582;
                        if (!Phrases.Dict.TryGetValue(582, out _phrase582))
                        {
                            _phrase582 = " you have a maximum {Count} waypoints.";
                        }
                        _phrase582 = _phrase582.Replace("{Count}", Max_Waypoints.ToString());
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase582 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
            }
            else
            {
                if (ReservedSlots.IsEnabled && ReservedSlots.Dict.ContainsKey(_cInfo.playerId))
                {
                    DateTime _dt;
                    ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt);
                    if (DateTime.Now < _dt)
                    {
                        if (Donator_Max_Waypoints > 0)
                        {
                            EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                            Vector3      _position  = _player.GetPosition();
                            int          x          = (int)_position.x;
                            int          y          = (int)_position.y;
                            int          z          = (int)_position.z;
                            string       _wposition = x + "," + y + "," + z;
                            _waypoint = SQL.EscapeString(_waypoint);
                            _sql      = string.Format("INSERT INTO Waypoints (steamid, wayPointName, position) VALUES ('{0}', '{1}', '{2}')", _cInfo.playerId, _waypoint, _wposition);
                            SQL.FastQuery(_sql, "Waypoints");
                            string _message = " saved waypoint name as {Name} to {X} {Y} {Z}.";
                            _message = _message.Replace("{Name}", _waypoint);
                            _message = _message.Replace("{X}", x.ToString());
                            _message = _message.Replace("{Y}", y.ToString());
                            _message = _message.Replace("{Z}", z.ToString());
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        }
                        else
                        {
                            string _phrase581;
                            if (!Phrases.Dict.TryGetValue(581, out _phrase581))
                            {
                                _phrase581 = " you have a maximum {Count} waypoints.";
                            }
                            _phrase581 = _phrase581.Replace("{Count}", Donator_Max_Waypoints.ToString());
                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase581 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                        }
                    }
                    else
                    {
                        string _phrase582;
                        if (!Phrases.Dict.TryGetValue(582, out _phrase582))
                        {
                            _phrase582 = " you have a maximum {Count} waypoints.";
                        }
                        _phrase582 = _phrase582.Replace("{Count}", Max_Waypoints.ToString());
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase582 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
                else
                {
                    if (Max_Waypoints > 0)
                    {
                        EntityPlayer _player    = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                        Vector3      _position  = _player.GetPosition();
                        int          x          = (int)_position.x;
                        int          y          = (int)_position.y;
                        int          z          = (int)_position.z;
                        string       _wposition = x + "," + y + "," + z;
                        _waypoint = SQL.EscapeString(_waypoint);
                        _sql      = string.Format("INSERT INTO Waypoints (steamid, wayPointName, position) VALUES ('{0}', '{1}', '{2}')", _cInfo.playerId, _waypoint, _wposition);
                        SQL.FastQuery(_sql, "Waypoints");
                        string _message = " saved waypoint name as {Name} to {X} {Y} {Z}.";
                        _message = _message.Replace("{Name}", _waypoint);
                        _message = _message.Replace("{X}", x.ToString());
                        _message = _message.Replace("{Y}", y.ToString());
                        _message = _message.Replace("{Z}", z.ToString());
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                    else
                    {
                        string _phrase582;
                        if (!Phrases.Dict.TryGetValue(582, out _phrase582))
                        {
                            _phrase582 = " you have a maximum {Count} waypoints.";
                        }
                        _phrase582 = _phrase582.Replace("{Count}", Max_Waypoints.ToString());
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase582 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
            }
            _result.Dispose();
        }
Example #18
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}.", _params.Count));
                 return;
             }
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo != null)
             {
                 string    _sql              = string.Format("SELECT countryban FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                 DataTable _result           = SQL.TQuery(_sql);
                 bool      _countrybanImmune = false;
                 if (_result.Rows.Count > 0)
                 {
                     bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _countrybanImmune);
                 }
                 if (_countrybanImmune)
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not add Id. {0} is already in the Country Ban Immunity list.", _params[1]));
                 }
                 else
                 {
                     if (_result.Rows.Count > 0)
                     {
                         _sql = string.Format("UPDATE Players SET countryban = 'true' WHERE steamid = '{0}'", _cInfo.playerId);
                     }
                     else
                     {
                         _sql = string.Format("INSERT INTO Players (steamid, countryban) VALUES ('{0}', 'true')", _cInfo.playerId);
                     }
                     SQL.FastQuery(_sql);
                     SdtdConsole.Instance.Output(string.Format("Added Id {0} to the Country Ban Immunity list.", _params[1]));
                 }
                 _result.Dispose();
             }
             else
             {
                 if (_params[1].Length != 17)
                 {
                     SdtdConsole.Instance.Output(string.Format("You can only use a player id or their name if online. Can not add Id: Invalid Id {0}", _params[1]));
                     return;
                 }
                 else
                 {
                     string    _id               = SQL.EscapeString(_params[1]);
                     string    _sql              = string.Format("SELECT countryban FROM Players WHERE steamid = '{0}'", _id);
                     DataTable _result           = SQL.TQuery(_sql);
                     bool      _countrybanImmune = false;
                     if (_result.Rows.Count > 0)
                     {
                         bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _countrybanImmune);
                     }
                     if (_countrybanImmune)
                     {
                         SdtdConsole.Instance.Output(string.Format("Can not add Id. {0} is already in the Country Ban Immunity list.", _params[1]));
                     }
                     else
                     {
                         if (_result.Rows.Count > 0)
                         {
                             _sql = string.Format("UPDATE Players SET countryban = 'true' WHERE steamid = '{0}'", _id);
                         }
                         else
                         {
                             _sql = string.Format("INSERT INTO Players (steamid, countryban) VALUES ('{0}', 'true')", _id);
                         }
                         SQL.FastQuery(_sql);
                         SdtdConsole.Instance.Output(string.Format("Added Id {0} to the Country Ban Immunity list.", _params[1]));
                     }
                     _result.Dispose();
                 }
             }
         }
         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;
             }
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo != null)
             {
                 string    _sql    = string.Format("SELECT countryban FROM Players WHERE steamid = '{0}' AND countryban = 'true'", _cInfo.playerId);
                 DataTable _result = SQL.TQuery(_sql);
                 if (_result.Rows.Count > 0)
                 {
                     _sql = string.Format("UPDATE Players SET countryban = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                     SQL.FastQuery(_sql);
                     SdtdConsole.Instance.Output(string.Format("Removed Id {0} from Country Ban Immunity list.", _params[1]));
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Id {0} was not found.", _params[1]));
                 }
                 _result.Dispose();
             }
             else
             {
                 if (_params[1].Length != 17)
                 {
                     SdtdConsole.Instance.Output(string.Format("You can only use a player id or their name if online. Can not remove Id: Invalid Id {0}", _params[1]));
                 }
                 else
                 {
                     string    _id     = SQL.EscapeString(_params[1]);
                     string    _sql    = string.Format("SELECT countryban FROM Players WHERE steamid = '{0}' AND countryban = 'true'", _id);
                     DataTable _result = SQL.TQuery(_sql);
                     if (_result.Rows.Count > 0)
                     {
                         _sql = string.Format("UPDATE Players SET countryban = 'false' WHERE steamid = '{0}'", _id);
                         SQL.FastQuery(_sql);
                         SdtdConsole.Instance.Output(string.Format("Removed Id {0} from the Country Ban Immunity list.", _params[1]));
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Id {0} was not found.", _params[1]));
                     }
                     _result.Dispose();
                 }
             }
         }
         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;
             }
             string    _sql    = "SELECT countryban FROM Players WHERE countryban = 'true'";
             DataTable _result = SQL.TQuery(_sql);
             if (_result.Rows.Count < 1)
             {
                 SdtdConsole.Instance.Output("There are no Ids on the Country Ban Immunity list.");
             }
             else
             {
                 foreach (DataRow row in _result.Rows)
                 {
                     SdtdConsole.Instance.Output(string.Format("{0}", row[0]));
                 }
                 SdtdConsole.Instance.Output(string.Format("Total: {0}", _result.Rows.Count.ToString()));
             }
             _result.Dispose();
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in CountryBanImmunityCommandConsole.Run: {0}.", e));
     }
 }
Example #19
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params[0] == "new")
         {
             if (_params.Count < 3)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected at least 3, found {0}", _params.Count));
                 return;
             }
             else
             {
                 int _hours;
                 if (!int.TryParse(_params[1], out _hours))
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid integer {0}", _params[1]));
                     return;
                 }
                 _params.RemoveRange(0, 2);
                 string    _message = string.Join(" ", _params.ToArray());
                 string    _sql     = "SELECT pollTime, pollHours, pollMessage FROM Polls WHERE pollOpen = 'true'";
                 DataTable _result  = SQL.TQuery(_sql);
                 if (_result.Rows.Count > 0)
                 {
                     DateTime _pollTime;
                     DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _pollTime);
                     int _pollHours;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _pollHours);
                     string   _pollMessage    = _result.Rows[0].ItemArray.GetValue(2).ToString();
                     TimeSpan varTime         = DateTime.Now - _pollTime;
                     double   fractionalHours = varTime.TotalHours;
                     int      _timepassed     = (int)fractionalHours;
                     if (_timepassed >= _pollHours)
                     {
                         SdtdConsole.Instance.Output("There is a poll open but the time has expired.");
                         SdtdConsole.Instance.Output(string.Format("Poll: {0}", _pollMessage));
                         SdtdConsole.Instance.Output("You need to close the above poll before making a new one.");
                     }
                     else
                     {
                         int _timeleft = _pollHours - _timepassed;
                         SdtdConsole.Instance.Output("There is a poll open. Let it finish or close it");
                         SdtdConsole.Instance.Output(string.Format("Poll: {0}", _pollMessage));
                         SdtdConsole.Instance.Output(string.Format("Time Remaining: {0} hours", _timeleft));
                     }
                 }
                 else
                 {
                     _sql = string.Format("INSERT INTO Polls (pollOpen, pollTime, pollHours, pollMessage) VALUES ('true', '{0}', {1}, '{2}')", DateTime.Now, _hours, _message);
                     SQL.FastQuery(_sql);
                     string _phrase926;
                     if (!Phrases.Dict.TryGetValue(926, out _phrase926))
                     {
                         _phrase926 = "Poll: {Message}";
                     }
                     _phrase926 = _phrase926.Replace("{Message}", _message);
                     string _phrase927;
                     if (!Phrases.Dict.TryGetValue(927, out _phrase927))
                     {
                         _phrase927 = "Type /pollyes or /pollno to vote.";
                     }
                     ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase926, -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                     ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase927, -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                     SdtdConsole.Instance.Output(string.Format("Opened a new poll for {0} hours.", _hours));
                     using (StreamWriter sw = new StreamWriter(_filepath, true))
                     {
                         sw.WriteLine(string.Format("{0}  New poll {1} ... The poll will be open for {2} hours", DateTime.Now, _message, _hours));
                         sw.WriteLine();
                         sw.Flush();
                         sw.Close();
                     }
                 }
                 _result.Dispose();
             }
         }
         else if (_params[0] == "close")
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             bool _announce = false;
             if (!bool.TryParse(_params[1], out _announce))
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid true/false argument: {0}", _params[1]));
                 return;
             }
             else
             {
                 string    _sql    = "SELECT pollMessage, pollYes, pollNo FROM Polls WHERE pollOpen = 'true'";
                 DataTable _result = SQL.TQuery(_sql);
                 if (_result.Rows.Count > 0)
                 {
                     int _pollYes;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _pollYes);
                     int _pollNo;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(2).ToString(), out _pollNo);
                     if (_announce)
                     {
                         string _phrase925;
                         if (!Phrases.Dict.TryGetValue(925, out _phrase925))
                         {
                             _phrase925 = "Poll results: Yes {YesVote} / No {NoVote}";
                         }
                         _phrase925 = _phrase925.Replace("{YesVote}", _pollYes.ToString());
                         _phrase925 = _phrase925.Replace("{NoVote}", _pollNo.ToString());
                         ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase925, -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                     }
                     using (StreamWriter sw = new StreamWriter(_filepath, true))
                     {
                         string _pollMessage = _result.Rows[0].ItemArray.GetValue(0).ToString();
                         sw.WriteLine(string.Format("{0}  Poll {1} ... has completed. The final results were yes {2} / no {3}", DateTime.Now, _pollMessage, _pollYes, _pollNo));
                         sw.WriteLine();
                         sw.Flush();
                         sw.Close();
                     }
                     _sql = "SELECT pollMessage, pollYes, pollNo FROM Polls WHERE pollOpen = 'false'";
                     DataTable _result1 = SQL.TQuery(_sql);
                     if (_result1.Rows.Count > 0)
                     {
                         _sql = "DELETE FROM Polls WHERE pollOpen = 'false'";
                         SQL.FastQuery(_sql);
                     }
                     _result1.Dispose();
                     _sql = "UPDATE Polls SET pollOpen = 'false' WHERE pollOpen = 'true'";
                     SQL.FastQuery(_sql);
                     PolledYes.Clear();
                     PolledNo.Clear();
                     SdtdConsole.Instance.Output("Closed the open poll.");
                 }
                 else
                 {
                     SdtdConsole.Instance.Output("No poll is open");
                 }
                 _result.Dispose();
             }
         }
         else if (_params[0] == "last")
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             else
             {
                 string    _sql    = "SELECT pollHours, pollMessage, pollYes, pollNo FROM Polls WHERE pollOpen = 'false'";
                 DataTable _result = SQL.TQuery(_sql);
                 if (_result.Rows.Count > 0)
                 {
                     int _pollHours;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _pollHours);
                     string _pollMessage = _result.Rows[0].ItemArray.GetValue(1).ToString();
                     int    _pollYes;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(2).ToString(), out _pollYes);
                     int _pollNo;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(3).ToString(), out _pollNo);
                     SdtdConsole.Instance.Output(string.Format("The last poll message: {0}", _pollMessage));
                     SdtdConsole.Instance.Output(string.Format("Last poll results: Yes {0} / No {1}", _pollYes, _pollNo));
                     SdtdConsole.Instance.Output(string.Format("Poll was open for {0} hours", _pollHours));
                 }
                 else
                 {
                     SdtdConsole.Instance.Output("There are no saved prior poll results");
                 }
                 _result.Dispose();
             }
         }
         else if (_params[0] == "reopen")
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             string    _sql    = "SELECT pollTime, pollHours, pollMessage FROM Polls WHERE pollOpen = 'true'";
             DataTable _result = SQL.TQuery(_sql);
             if (_result.Rows.Count > 0)
             {
                 SdtdConsole.Instance.Output("A poll is open. Can not open a new poll until it is closed");
             }
             else
             {
                 _sql = "SELECT pollTime, pollHours, pollMessage FROM Polls WHERE pollOpen = 'false'";
                 DataTable _result1 = SQL.TQuery(_sql);
                 if (_result1.Rows.Count > 0)
                 {
                     int _hours;
                     int.TryParse(_params[1], out _hours);
                     _sql = string.Format("UPDATE Polls SET pollOpen = 'true', pollTime = '{0}', pollHours = {1} WHERE pollOpen = 'false'", DateTime.Now, _hours);
                     SQL.FastQuery(_sql);
                 }
                 else
                 {
                     SdtdConsole.Instance.Output("You have no previous poll");
                 }
                 _result1.Dispose();
             }
             _result.Dispose();
         }
         else if (_params[0] == "check")
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             string    _sql    = "SELECT pollTime, pollHours, pollMessage, pollYes, pollNo FROM Polls WHERE pollOpen = 'true'";
             DataTable _result = SQL.TQuery(_sql);
             if (_result.Rows.Count > 0)
             {
                 DateTime _pollTime;
                 DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _pollTime);
                 int _pollHours;
                 int.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _pollHours);
                 string _pollMessage = _result.Rows[0].ItemArray.GetValue(2).ToString();
                 int    _pollYes;
                 int.TryParse(_result.Rows[0].ItemArray.GetValue(3).ToString(), out _pollYes);
                 int _pollNo;
                 int.TryParse(_result.Rows[0].ItemArray.GetValue(4).ToString(), out _pollNo);
                 TimeSpan varTime         = DateTime.Now - _pollTime;
                 double   fractionalHours = varTime.TotalHours;
                 int      _timepassed     = (int)fractionalHours;
                 if (_timepassed >= _pollHours)
                 {
                     SdtdConsole.Instance.Output("There is a poll open but the time has expired.");
                     SdtdConsole.Instance.Output(string.Format("Poll: {0}", _pollMessage));
                     SdtdConsole.Instance.Output(string.Format("Current poll results: Yes votes {0} / No votes {1}", _pollYes, _pollNo));
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Poll: {0}", _pollMessage));
                     SdtdConsole.Instance.Output(string.Format("Current poll results: Yes votes {0} / No votes {1}", _pollYes, _pollNo));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output("No poll is open");
             }
             _result.Dispose();
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in PollConsole.Run: {0}.", e));
     }
 }
        public static void Exec()
        {
            foreach (string _id in PersistentContainer.Instance.Players.SteamIDs)
            {
                string    _sql    = string.Format("SELECT steamid FROM Players WHERE steamid = '{0}'", _id);
                DataTable _result = SQL.TQuery(_sql);
                if (_result.Rows.Count == 0)
                {
                    Player   p = PersistentContainer.Instance.Players[_id, false];
                    DateTime _last_gimme;
                    DateTime _lastkillme;
                    int      _bank                = p.Bank;
                    int      _wallet              = p.Wallet;
                    int      _playerSpentCoins    = p.PlayerSpentCoins;
                    int      _hardcoreSessionTime = p.HardcoreSessionTime;
                    int      _hardcoreKills       = p.HardcoreKills;
                    int      _hardcoreZKills      = p.HardcoreZKills;
                    int      _hardcoreScore       = p.HardcoreScore;
                    int      _hardcoreDeaths      = p.HardcoreDeaths;
                    string   _hardcoreName        = "Unknown";
                    int      _bounty              = p.Bounty;
                    int      _bountyHunter        = p.BountyHunter;
                    int      _sessionTime         = p.SessionTime;
                    int      _bikeId              = p.BikeId;
                    DateTime _lastBike;
                    int      _jailTime = p.JailTime;
                    string   _jailName = "Unknown";
                    DateTime _jailDate;
                    int      _muteTime = p.MuteTime;
                    string   _muteName = "Unknown";
                    DateTime _muteDate;
                    int      _zkills        = p.ZKills;
                    int      _kills         = p.Kills;
                    int      _deaths        = p.Deaths;
                    string   _eventReturn   = "Unknown";
                    string   _marketReturn  = "Unknown";
                    string   _lobbyReturn   = "Unknown";
                    string   _newTeleSpawn  = "Unknown";
                    string   _homeposition  = "Unknown";
                    string   _homeposition2 = "Unknown";
                    DateTime _lastsethome;
                    string   _lastwhisper = "Unknown";
                    DateTime _lastWaypoint;
                    DateTime _lastMarket;
                    DateTime _lastStuck;
                    DateTime _lastLobby;
                    DateTime _lastLog;
                    DateTime _lastDied;
                    DateTime _lastFriendTele;
                    DateTime _respawnTime;
                    DateTime _lastTravel;
                    DateTime _lastAnimals;
                    DateTime _lastVoteReward;
                    string   _firstClaim    = "false";
                    string   _ismuted       = "false";
                    string   _isjailed      = "false";
                    string   _startingItems = "false";
                    string   _clanname      = "Unknown";
                    string   _invitedtoclan = "Unknown";
                    string   _isclanowner   = "false";
                    string   _isclanofficer = "false";
                    DateTime _customCommand1;
                    DateTime _customCommand2;
                    DateTime _customCommand3;
                    DateTime _customCommand4;
                    DateTime _customCommand5;
                    DateTime _customCommand6;
                    DateTime _customCommand7;
                    DateTime _customCommand8;
                    DateTime _customCommand9;
                    DateTime _customCommand10;
                    if (p.LastGimme != null)
                    {
                        _last_gimme = p.LastGimme;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _last_gimme);
                    }
                    if (p.LastKillme != null)
                    {
                        _lastkillme = p.LastKillme;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastkillme);
                    }
                    if (p.HardcoreName != null)
                    {
                        _hardcoreName = p.HardcoreName;
                    }
                    if (p.LastBike != null)
                    {
                        _lastBike = p.LastBike;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastBike);
                    }
                    if (p.JailName != null)
                    {
                        _jailName = p.JailName;
                    }
                    if (p.JailDate != null)
                    {
                        _jailDate = p.JailDate;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _jailDate);
                    }
                    if (p.MuteName != null)
                    {
                        _muteName = p.MuteName;
                    }
                    if (p.MuteDate != null)
                    {
                        _muteDate = p.MuteDate;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _muteDate);
                    }
                    if (p.EventReturn != null)
                    {
                        _eventReturn = p.EventReturn;
                    }
                    if (p.MarketReturn != null)
                    {
                        _marketReturn = p.MarketReturn;
                    }
                    if (p.LobbyReturn != null)
                    {
                        _lobbyReturn = p.LobbyReturn;
                    }
                    if (p.NewTeleSpawn != null)
                    {
                        _newTeleSpawn = p.NewTeleSpawn;
                    }
                    if (p.HomePosition != null)
                    {
                        _homeposition = p.HomePosition;
                    }
                    if (p.HomePosition2 != null)
                    {
                        _homeposition2 = p.HomePosition2;
                    }
                    if (p.LastSetHome != null)
                    {
                        _lastsethome = p.LastSetHome;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastsethome);
                    }
                    if (p.LastWhisper != null)
                    {
                        _lastwhisper = p.LastWhisper;
                    }
                    if (p.LastWaypoint != null)
                    {
                        _lastWaypoint = p.LastWaypoint;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastWaypoint);
                    }
                    if (p.LastMarket != null)
                    {
                        _lastMarket = p.LastMarket;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastMarket);
                    }
                    if (p.LastStuck != null)
                    {
                        _lastStuck = p.LastStuck;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastStuck);
                    }
                    if (p.LastLobby != null)
                    {
                        _lastLobby = p.LastLobby;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastLobby);
                    }
                    if (p.Log != null)
                    {
                        _lastLog = p.Log;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastLog);
                    }
                    if (p.LastDied != null)
                    {
                        _lastDied = p.LastDied;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastDied);
                    }
                    if (p.LastFriendTele != null)
                    {
                        _lastFriendTele = p.LastFriendTele;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastFriendTele);
                    }
                    if (p.RespawnTime != null)
                    {
                        _respawnTime = p.RespawnTime;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _respawnTime);
                    }
                    if (p.LastTravel != null)
                    {
                        _lastTravel = p.LastTravel;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastTravel);
                    }
                    if (p.LastAnimals != null)
                    {
                        _lastAnimals = p.LastAnimals;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastAnimals);
                    }
                    if (p.LastVoteReward != null)
                    {
                        _lastVoteReward = p.LastVoteReward;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _lastVoteReward);
                    }
                    if (p.FirstClaim)
                    {
                        _firstClaim = "true";
                    }
                    if (p.IsMuted)
                    {
                        _ismuted = "true";
                    }
                    if (p.IsJailed)
                    {
                        _isjailed = "true";
                    }
                    if (p.StartingItems)
                    {
                        _startingItems = "true";
                    }
                    if (p.ClanName != null)
                    {
                        _clanname = p.ClanName;
                    }
                    if (p.InvitedToClan != null)
                    {
                        _invitedtoclan = p.InvitedToClan;
                    }
                    if (p.IsClanOwner)
                    {
                        _isclanowner = "true";
                    }
                    if (p.IsClanOfficer)
                    {
                        _isclanofficer = "true";
                    }
                    if (p.CustomCommand1 != null)
                    {
                        _customCommand1 = p.CustomCommand1;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _customCommand1);
                    }
                    if (p.CustomCommand2 != null)
                    {
                        _customCommand2 = p.CustomCommand2;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _customCommand2);
                    }
                    if (p.CustomCommand3 != null)
                    {
                        _customCommand3 = p.CustomCommand3;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _customCommand3);
                    }
                    if (p.CustomCommand4 != null)
                    {
                        _customCommand4 = p.CustomCommand4;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _customCommand4);
                    }
                    if (p.CustomCommand5 != null)
                    {
                        _customCommand5 = p.CustomCommand5;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _customCommand5);
                    }
                    if (p.CustomCommand6 != null)
                    {
                        _customCommand6 = p.CustomCommand6;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _customCommand6);
                    }
                    if (p.CustomCommand7 != null)
                    {
                        _customCommand7 = p.CustomCommand7;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _customCommand7);
                    }
                    if (p.CustomCommand8 != null)
                    {
                        _customCommand8 = p.CustomCommand8;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _customCommand8);
                    }
                    if (p.CustomCommand9 != null)
                    {
                        _customCommand9 = p.CustomCommand9;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _customCommand9);
                    }
                    if (p.CustomCommand10 != null)
                    {
                        _customCommand10 = p.CustomCommand10;
                    }
                    else
                    {
                        DateTime.TryParse("10/29/2000 7:30:00 AM", out _customCommand10);
                    }
                    _hardcoreName = SQL.EscapeString(_hardcoreName);
                    _jailName     = SQL.EscapeString(_jailName);
                    _muteName     = SQL.EscapeString(_muteName);
                    _clanname     = SQL.EscapeString(_clanname);
                    _sql          = string.Format("INSERT INTO Players (steamid, last_gimme, lastkillme, bank, wallet, playerSpentCoins, hardcoreSessionTime, hardcoreKills, hardcoreZKills, hardcoreScore, hardcoreDeaths, hardcoreName, bounty, bountyHunter, sessionTime, bikeId, lastBike, jailTime, jailName, jailDate, muteTime, muteName, muteDate, zkills, kills, deaths, eventReturn, marketReturn, lobbyReturn, newTeleSpawn, homeposition, homeposition2, lastsethome, lastwhisper, lastWaypoint, lastMarket, lastStuck, lastLobby, lastLog, lastDied, lastFriendTele, respawnTime, lastTravel, lastAnimals, lastVoteReward, firstClaim, ismuted, isjailed, startingItems, clanname, invitedtoclan, isclanowner, isclanofficer, customCommand1, customCommand2, customCommand3, customCommand4, customCommand5, customCommand6, customCommand7, customCommand8, customCommand9, customCommand10) VALUES ('{0}', '{1}', '{2}', {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, '{11}', {12}, {13}, {14}, {15}, '{16}', {17}, '{18}', '{19}', {20}, '{21}', '{22}', {23}, {24}, {25}, '{26}', '{27}', '{28}', '{29}', '{30}', '{31}', '{32}', '{33}', '{34}', '{35}', '{36}', '{37}', '{38}', '{39}', '{40}', '{41}', '{42}', '{43}', '{44}', '{45}', '{46}', '{47}', '{48}', '{49}', '{50}', '{51}', '{52}', '{53}', '{54}', '{55}', '{56}', '{57}', '{58}', '{59}', '{60}', '{61}', '{62}')", _id, _last_gimme, _lastkillme, _bank, _wallet, _playerSpentCoins, _hardcoreSessionTime, _hardcoreKills, _hardcoreZKills, _hardcoreScore, _hardcoreDeaths, _hardcoreName, _bounty, _bountyHunter, _sessionTime, _bikeId, _lastBike, _jailTime, _jailName, _jailDate, _muteTime, _muteName, _muteDate, _zkills, _kills, _deaths, _eventReturn, _marketReturn, _lobbyReturn, _newTeleSpawn, _homeposition, _homeposition2, _lastsethome, _lastwhisper, _lastWaypoint, _lastMarket, _lastStuck, _lastLobby, _lastLog, _lastDied, _lastFriendTele, _respawnTime, _lastTravel, _lastAnimals, _lastVoteReward, _firstClaim, _ismuted, _isjailed, _startingItems, _clanname, _invitedtoclan, _isclanowner, _isclanofficer, _customCommand1, _customCommand2, _customCommand3, _customCommand4, _customCommand5, _customCommand6, _customCommand7, _customCommand8, _customCommand9, _customCommand10);
                    SQL.FastQuery(_sql);
                    if (p.AuctionItem != null)
                    {
                        string   _itemName = p.AuctionItem[1];
                        int      _itemCount;
                        int      _itemQuality;
                        int      _itemPrice;
                        DateTime _cancelTime = p.CancelTime;
                        int.TryParse(p.AuctionItem[0], out _itemCount);
                        int.TryParse(p.AuctionItem[2], out _itemQuality);
                        int.TryParse(p.AuctionItem[3], out _itemPrice);
                        _sql = string.Format("INSERT INTO Auction (steamid, itemName, itemCount, itemQuality, itemPrice, cancelTime) VALUES ('{0}', '{1}', {2}, {3}, {4}, '{5}')", _id, _itemName, _itemCount, _itemQuality, _itemPrice, _cancelTime);
                        SQL.FastQuery(_sql);
                    }
                }
                _result.Dispose();
            }
            string _binpath = string.Format("{0}/ServerTools.bin", GameUtils.GetSaveGameDir());

            File.Delete(_binpath);
            LoadProcess.Load(4);
        }
Example #21
0
 public void PlayerSpawning(ClientInfo _cInfo, int _chunkViewDim, PlayerProfile _playerProfile)
 {
     if (_cInfo != null)
     {
         if (CountryBan.IsEnabled && _cInfo.ip != "127.0.0.1" && !_cInfo.ip.StartsWith("192.168"))
         {
             if (CountryBan.IsCountryBanned(_cInfo))
             {
                 return;
             }
         }
         string    _sql    = string.Format("SELECT steamid FROM Players WHERE steamid = '{0}'", _cInfo.playerId);;
         DataTable _result = SQL.TQuery(_sql);
         string    _name   = SQL.EscapeString(_cInfo.playerName);
         if (_result.Rows.Count == 0)
         {
             _sql = string.Format("INSERT INTO Players (steamid, playername, last_joined) VALUES ('{0}', '{1}', '{2}')", _cInfo.playerId, _name, DateTime.Now);
         }
         else
         {
             _sql = string.Format("UPDATE Players SET playername = '{0}', last_joined = '{1}' WHERE steamid = '{2}'", _name, DateTime.Now, _cInfo.playerId);
         }
         _result.Dispose();
         SQL.FastQuery(_sql);
         if (StopServer.NoEntry)
         {
             int    _seconds = (60 - Timers._sSCD);
             string _phrase452;
             if (!Phrases.Dict.TryGetValue(452, out _phrase452))
             {
                 _phrase452 = "Shutdown is in {Minutes} minutes {Seconds} seconds. Please come back after the server restarts.";
             }
             _phrase452 = _phrase452.Replace("{Minutes}", Timers._sSC.ToString());
             _phrase452 = _phrase452.Replace("{Seconds}", _seconds.ToString());
             SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.entityId, _phrase452), (ClientInfo)null);
         }
         if (ReservedSlots.IsEnabled)
         {
             if (ReservedSlots.Kicked.ContainsKey(_cInfo.playerName))
             {
                 DateTime _dateTime;
                 ReservedSlots.Kicked.TryGetValue(_cInfo.playerId, out _dateTime);
                 TimeSpan varTime           = DateTime.Now - _dateTime;
                 double   fractionalMinutes = varTime.TotalMinutes;
                 int      _timepassed       = (int)fractionalMinutes;
                 if (_timepassed >= 5)
                 {
                     int    _timeleft = 5 - _timepassed;
                     string _phrase22;
                     if (!Phrases.Dict.TryGetValue(22, out _phrase22))
                     {
                         _phrase22 = "Sorry {PlayerName} you have reached the max session time. Please wait {TimeRemaining} minutes before rejoining.";
                     }
                     _phrase22 = _phrase22.Replace("{PlayerName}", _cInfo.playerName);
                     _phrase22 = _phrase22.Replace("{TimeRemaining}", _timeleft.ToString());
                     SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.playerId, _phrase22), (ClientInfo)null);
                 }
                 else
                 {
                     ReservedSlots.CheckReservedSlot(_cInfo);
                 }
             }
             else
             {
                 ReservedSlots.CheckReservedSlot(_cInfo);
             }
         }
         if (CredentialCheck.IsEnabled)
         {
             CredentialCheck.AccCheck(_cInfo);
         }
         if (Motd.IsEnabled && !Motd.Show_On_Respawn)
         {
             Motd.Send(_cInfo);
         }
         if (AutoShutdown.IsEnabled)
         {
             if (AutoShutdown.Alert_On_Login)
             {
                 AutoShutdown.CheckNextShutdown(_cInfo, false);
             }
         }
         if (Bloodmoon.Show_On_Login && !Bloodmoon.Show_On_Respawn)
         {
             Bloodmoon.GetBloodmoon(_cInfo, false);
         }
         if (LoginNotice.IsEnabled)
         {
             LoginNotice.PlayerCheck(_cInfo);
         }
         Players.SessionTime(_cInfo);
     }
 }
Example #22
0
 public void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)
 {
     if (_cInfo != null)
     {
         string _name = SQL.EscapeString(_cInfo.playerName);
         if (Motd.IsEnabled & Motd.Show_On_Respawn)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.Show_On_Login && Bloodmoon.Show_On_Respawn)
         {
             Bloodmoon.GetBloodmoon(_cInfo, false);
         }
         if (_respawnReason == RespawnType.EnterMultiplayer)
         {
             if (NewPlayer.IsEnabled)
             {
                 NewPlayer.Exec(_cInfo);
             }
             if (NewSpawnTele.IsEnabled)
             {
                 NewSpawnTele.TeleNewSpawn(_cInfo);
             }
             if (StartingItems.IsEnabled)
             {
                 if (!NewSpawnTele.IsEnabled)
                 {
                     StartingItems.StartingItemCheck(_cInfo);
                 }
                 else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position != "0,0,0")
                 {
                     StartingItems.Que.Add(_cInfo.playerId);
                 }
                 else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position == "0,0,0")
                 {
                     StartingItems.StartingItemCheck(_cInfo);
                 }
             }
             string    _sql     = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
             DataTable _result1 = SQL.TQuery(_sql);
             if (_result1.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId))
             {
                 PollConsole.Message(_cInfo);
             }
             _result1.Dispose();
             if (Hardcore.IsEnabled)
             {
                 Hardcore.Announce(_cInfo);
             }
             _sql = string.Format("UPDATE Players SET playername = '{0}', wallet = 0, playerSpentCoins = 0, sessionTime = 0, zkills = 0, kills = 0, deaths = 0 WHERE steamid = '{1}'", _name, _cInfo.playerId);
             SQL.FastQuery(_sql);
         }
         if (_respawnReason == RespawnType.JoinMultiplayer)
         {
             EntityPlayer _player     = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             int          _zCount     = XUiM_Player.GetZombieKills(_player);
             int          _deathCount = XUiM_Player.GetDeaths(_player);
             int          _killCount  = XUiM_Player.GetPlayerKills(_player);
             string       _sql        = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
             DataTable    _result     = SQL.TQuery(_sql);
             if (_result.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId))
             {
                 PollConsole.Message(_cInfo);
             }
             _result.Dispose();
             if (Event.Open)
             {
                 if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                 {
                     if (Hardcore.IsEnabled)
                     {
                         Hardcore.Check(_cInfo);
                     }
                 }
                 else
                 {
                     _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     DataTable _result1 = SQL.TQuery(_sql);
                     bool      _eventRespawn;
                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn);
                     _result1.Dispose();
                     if (_eventRespawn)
                     {
                         Event.Died(_cInfo);
                     }
                     else
                     {
                         _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                         DataTable _result2 = SQL.TQuery(_sql);
                         bool      _return1 = false, _return2 = false;
                         bool.TryParse(_result2.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                         bool.TryParse(_result2.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                         _result2.Dispose();
                         if (_return1)
                         {
                             if (_return2)
                             {
                                 _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                 SQL.FastQuery(_sql);
                             }
                             _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                             SQL.FastQuery(_sql);
                             Event.EventReturn(_cInfo);
                         }
                         else if (_return2)
                         {
                             Event.EventSpawn(_cInfo);
                         }
                     }
                 }
             }
             else
             {
                 if (Hardcore.IsEnabled)
                 {
                     Hardcore.Check(_cInfo);
                 }
             }
             _sql = string.Format("UPDATE Players SET playername = '{0}', zkills = {1}, kills = {2}, deaths = {3} WHERE steamid = '{4}'", _name, _zCount, _killCount, _deathCount, _cInfo.playerId);
             SQL.FastQuery(_sql);
             if (Mogul.IsEnabled)
             {
                 if (Wallet.IsEnabled)
                 {
                     int currentCoins = Wallet.GetcurrentCoins(_cInfo);
                     _sql = string.Format("UPDATE Players SET wallet = {0} WHERE steamid = '{1}'", currentCoins, _cInfo.playerId);
                     SQL.FastQuery(_sql);
                 }
             }
         }
         if (_respawnReason == RespawnType.Died)
         {
             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (Event.Open)
             {
                 if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                 {
                     if (Wallet.Lose_On_Death)
                     {
                         Wallet.ClearWallet(_cInfo);
                     }
                     if (Hardcore.IsEnabled)
                     {
                         Hardcore.Check(_cInfo);
                     }
                     string    _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     DataTable _result1 = SQL.TQuery(_sql);
                     bool      _return1 = false, _return2 = false;
                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                     _result1.Dispose();
                     if (_return1)
                     {
                         if (_return2)
                         {
                             _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                             SQL.FastQuery(_sql);
                         }
                         _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                         SQL.FastQuery(_sql);
                         Event.EventReturn(_cInfo);
                     }
                 }
                 else
                 {
                     string    _sql    = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     DataTable _result = SQL.TQuery(_sql);
                     bool      _eventRespawn;
                     bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn);
                     _result.Dispose();
                     if (_eventRespawn)
                     {
                         Event.Died(_cInfo);
                     }
                     else
                     {
                         _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                         DataTable _result1 = SQL.TQuery(_sql);
                         bool      _return1 = false, _return2 = false;
                         bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                         bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                         _result1.Dispose();
                         if (_return1)
                         {
                             if (_return2)
                             {
                                 _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                 SQL.FastQuery(_sql);
                             }
                             _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                             SQL.FastQuery(_sql);
                             Event.EventReturn(_cInfo);
                         }
                         else if (_return2)
                         {
                             Event.EventSpawn(_cInfo);
                         }
                     }
                 }
             }
             else
             {
                 if (Wallet.Lose_On_Death)
                 {
                     Wallet.ClearWallet(_cInfo);
                 }
                 if (Hardcore.IsEnabled)
                 {
                     Hardcore.Check(_cInfo);
                 }
                 string    _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                 DataTable _result1 = SQL.TQuery(_sql);
                 bool      _return1 = false, _return2 = false;
                 bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                 bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                 _result1.Dispose();
                 if (_return1)
                 {
                     if (_return2)
                     {
                         _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                         SQL.FastQuery(_sql);
                     }
                     _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                     SQL.FastQuery(_sql);
                     Event.EventReturn(_cInfo);
                 }
             }
             string _sql2 = string.Format("UPDATE Players SET deaths = {0} WHERE steamid = '{1}'", XUiM_Player.GetDeaths(_player), _cInfo.playerId);
             SQL.FastQuery(_sql2);
             if (Zones.IsEnabled && Players.Victim.ContainsKey(_cInfo.entityId))
             {
                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + ", type /return to teleport back to your death position. There is a time limit.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 _sql2 = string.Format("UPDATE Players SET respawnTime = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
                 SQL.FastQuery(_sql2);
                 if (Players.Forgive.ContainsKey(_cInfo.entityId))
                 {
                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + ", type /forgive to release your killer from jail.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
             if (Mogul.IsEnabled)
             {
                 if (Wallet.IsEnabled)
                 {
                     int currentCoins = Wallet.GetcurrentCoins(_cInfo);
                     _sql2 = string.Format("UPDATE Players SET wallet = {0} WHERE steamid = '{1}'", currentCoins, _cInfo.playerId);
                     SQL.FastQuery(_sql2);
                 }
             }
         }
         if (_respawnReason == RespawnType.Teleport)
         {
             if (StartingItems.IsEnabled && StartingItems.Que.Contains(_cInfo.playerId))
             {
                 StartingItems.StartingItemCheck(_cInfo);
                 StartingItems.Que.Remove(_cInfo.playerId);
             }
             if (Players.NoFlight.Contains(_cInfo.entityId))
             {
                 Players.NoFlight.Remove(_cInfo.entityId);
             }
             if (HatchElevator.IsEnabled)
             {
                 HatchElevator.LastPositionY.Remove(_cInfo.entityId);
             }
         }
         if (Players.Dead.Contains(_cInfo.entityId))
         {
             Players.Dead.Remove(_cInfo.entityId);
         }
     }
 }
Example #23
0
        public static void TopThree(ClientInfo _cInfo, bool _announce)
        {
            int       _topScore1 = 0, _topScore2 = 0, _topScore3 = 0;
            string    _name1 = "-", _name2 = "-", _name3 = "-";
            string    _sql    = "SELECT playername, bank, wallet FROM Players";
            DataTable _result = SQL.TQuery(_sql);
            int       _bank;
            int       _wallet;

            foreach (DataRow row in _result.Rows)
            {
                int.TryParse(row[0].ToString(), out _bank);
                int.TryParse(row[1].ToString(), out _wallet);
                int _total = 0;
                if (Wallet.IsEnabled && Bank.IsEnabled)
                {
                    _total = _wallet + _bank;
                }
                if (Wallet.IsEnabled && !Bank.IsEnabled)
                {
                    _total = _bank;
                }
                if (!Wallet.IsEnabled && Bank.IsEnabled)
                {
                    _total = _wallet;
                }
                if (_total > _topScore1)
                {
                    _topScore3 = _topScore2;
                    _name3     = _name2;
                    _topScore2 = _topScore1;
                    _name2     = _name1;
                    _topScore1 = _total;
                    _name1     = _result.Rows[0].ItemArray.GetValue(0).ToString();
                }
                else
                {
                    if (_total > _topScore2)
                    {
                        _topScore3 = _topScore2;
                        _name3     = _name2;
                        _topScore2 = _total;
                        _name2     = _result.Rows[0].ItemArray.GetValue(0).ToString();
                    }
                    else
                    {
                        if (_total > _topScore3)
                        {
                            _topScore3 = _total;
                            _name3     = _result.Rows[0].ItemArray.GetValue(0).ToString();
                        }
                    }
                }
            }
            _result.Dispose();
            string _phrase965;

            if (!Phrases.Dict.TryGetValue(965, out _phrase965))
            {
                _phrase965 = "Richest Players:";
            }
            string _phrase966;

            if (!Phrases.Dict.TryGetValue(966, out _phrase966))
            {
                _phrase966 = "{Name1}, valued at {Top1}. {Name2}, valued at {Top2}. {Name3}, valued at {Top3}";
            }
            _phrase966 = _phrase966.Replace("{Name1}", _name1);
            _phrase966 = _phrase966.Replace("{Top1}", _topScore1.ToString());
            _phrase966 = _phrase966.Replace("{Name2}", _name2);
            _phrase966 = _phrase966.Replace("{Top2}", _topScore2.ToString());
            _phrase966 = _phrase966.Replace("{Name3}", _name3);
            _phrase966 = _phrase966.Replace("{Top3}", _topScore3.ToString());
            if (_announce)
            {
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase965 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase966 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null);
            }
            else
            {
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase965 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase966 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
Example #24
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         string _steamId  = _senderInfo.RemoteClientInfo.playerId;
         int    _entityId = _senderInfo.RemoteClientInfo.entityId;
         if (_params[0].ToLower() == ("new"))
         {
             if (_params.Count < 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2 or more, found {0}.", _params.Count));
                 return;
             }
             string    _sql    = string.Format("SELECT eventName FROM Events WHERE eventAdmin = '{0}' AND eventName = '{1}'", _steamId, _params[1]);
             DataTable _result = SQL.TQuery(_sql);
             if (_result.Rows.Count == 0)
             {
                 _result.Dispose();
                 string _name = SQL.EscapeString(_params[1]);
                 _sql = string.Format("INSERT INTO Events (eventAdmin, eventName) VALUES ('{0}', '{1}')", _steamId, _name);
                 SQL.FastQuery(_sql, "EventCommandsConsole");
                 if (Event.SetupStage.ContainsKey(_steamId))
                 {
                     Event.SetupName[_steamId]  = _params[1];
                     Event.SetupStage[_steamId] = 1;
                 }
                 else
                 {
                     Event.SetupName.Add(_steamId, _params[1]);
                     Event.SetupStage.Add(_steamId, 1);
                 }
                 if (Event.Open)
                 {
                     SdtdConsole.Instance.Output(string.Format("There is an event being run by {0}.", Event.Admin));
                 }
                 SdtdConsole.Instance.Output("You have started to open a new event setup.");
                 SdtdConsole.Instance.Output(string.Format("The event name has been set to {0}.", _params[1]));
                 SdtdConsole.Instance.Output("What would you like the invitation for players to say? Type event \"invitation\".");
                 return;
             }
             else
             {
                 _result.Dispose();
                 SdtdConsole.Instance.Output(string.Format("The event name {0} already exists. Use a new name or delete the old event.", _params[1]));
                 return;
             }
         }
         else if (_params[0].ToLower() == ("save"))
         {
             if (Event.SetupStage.ContainsKey(_steamId))
             {
                 int _stage;
                 Event.SetupStage.TryGetValue(_steamId, out _stage);
                 string _eventName;
                 Event.SetupName.TryGetValue(_steamId, out _eventName);
                 if (_stage == 3)
                 {
                     EntityPlayer _player    = GameManager.Instance.World.Players.dict[_entityId];
                     Vector3      _position  = _player.GetPosition();
                     int          x          = (int)_position.x;
                     int          y          = (int)_position.y;
                     int          z          = (int)_position.z;
                     string       _sposition = x + "," + y + "," + z;
                     string       _sql       = string.Format("SELECT eventid, eventTeams FROM Events WHERE eventAdmin = '{0}' AND eventName = '{1}'", _steamId, _eventName);
                     DataTable    _result1   = SQL.TQuery(_sql);
                     int          _eventid;
                     int.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _eventid);
                     int _eventTeams;
                     int.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _eventTeams);
                     _result1.Dispose();
                     _sql = string.Format("SELECT eventSpawn FROM EventSpawns WHERE eventid = {0}", _eventid);
                     DataTable _result2 = SQL.TQuery(_sql);
                     int       _count   = _result2.Rows.Count + 1;
                     _result2.Dispose();
                     string _pos = SQL.EscapeString(_sposition);
                     if (_count == _eventTeams)
                     {
                         _sql = string.Format("INSERT INTO EventSpawns (eventid, eventTeam, eventSpawn) VALUES ({0}, {1}, '{2}')", _eventid, _count, _pos);
                         SQL.FastQuery(_sql, "EventCommandsConsole");
                         Event.SetupStage[_steamId] = 4;
                         SdtdConsole.Instance.Output(string.Format("The spawn position for team {0} has been set to {1} {2} {3}.", _count, x, y, z));
                         SdtdConsole.Instance.Output("Stand where you would like the respawn for team 1 if they die during the event, then type event save.");
                         return;
                     }
                     else
                     {
                         _sql = string.Format("INSERT INTO EventSpawns (eventid, eventTeam, eventSpawn) VALUES ({0}, {1}, '{2}')", _eventid, _count, _pos);
                         SQL.FastQuery(_sql, "EventCommandsConsole");
                         SdtdConsole.Instance.Output(string.Format("The spawn position for team {0} has been set to {1} {2} {3}.", _count, x, y, z));
                         SdtdConsole.Instance.Output(string.Format("Stand where you would like the spawn for team {0} when the event starts and type event save.", _count + 1));
                         return;
                     }
                 }
                 else if (_stage == 4)
                 {
                     EntityPlayer _player    = GameManager.Instance.World.Players.dict[_entityId];
                     Vector3      _position  = _player.GetPosition();
                     int          x          = (int)_position.x;
                     int          y          = (int)_position.y;
                     int          z          = (int)_position.z;
                     string       _sposition = x + "," + y + "," + z;
                     string       _sql       = string.Format("SELECT eventid, eventTeams FROM Events WHERE eventAdmin = '{0}' AND eventName = '{1}'", _steamId, _eventName);
                     DataTable    _result1   = SQL.TQuery(_sql);
                     int          _eventid;
                     int.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _eventid);
                     int _eventTeams;
                     int.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _eventTeams);
                     _result1.Dispose();
                     _sql = string.Format("SELECT eventRespawn FROM EventSpawns WHERE eventid = {0} AND eventRespawn != null", _eventid);
                     DataTable _result2 = SQL.TQuery(_sql);
                     int       _count   = _result2.Rows.Count + 1;
                     _result2.Dispose();
                     string _pos = SQL.EscapeString(_sposition);
                     if (_count == _eventTeams)
                     {
                         _sql = string.Format("INSERT INTO EventSpawns (eventid, eventTeam, eventRespawn) VALUES ({0}, {1}, '{2}')", _eventid, _count, _pos);
                         SQL.FastQuery(_sql, "EventCommandsConsole");
                         Event.SetupStage[_steamId] = 5;
                         SdtdConsole.Instance.Output(string.Format("The respawn position for team {0} has been set to {1} {2} {3}.", _count, x, y, z));
                         SdtdConsole.Instance.Output("Setup is complete. Type event start to send out the invitation to players.");
                         return;
                     }
                     else
                     {
                         _sql = string.Format("INSERT INTO EventSpawns (eventid, eventTeam, eventRespawn) VALUES ({0}, {1}, '{2}')", _eventid, _count, _pos);
                         SQL.FastQuery(_sql, "EventCommandsConsole");
                         SdtdConsole.Instance.Output(string.Format("The respawn position for team {0} has been set to {1} {2} {3}.", _count, x, y, z));
                         SdtdConsole.Instance.Output(string.Format("Stand where you would like the respawn for team {0} when the event starts and type event save.", _count + 1));
                         return;
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output("This command is invalid at this stage of setup.");
                     return;
                 }
             }
         }
         else if (_params[0].ToLower() == ("check"))
         {
             if (Event.Open)
             {
                 if (Event.Admin == _steamId)
                 {
                     string    _sql         = string.Format("SELECT eventName, eventInvite, eventTeams, eventPlayerCount, eventTime FROM Events WHERE eventAdmin = '{0}' AND eventActive = 'true'", Event.Admin);
                     DataTable _result      = SQL.TQuery(_sql);
                     string    _eventName   = _result.Rows[0].ItemArray.GetValue(0).ToString();
                     string    _eventInvite = _result.Rows[0].ItemArray.GetValue(1).ToString();
                     int       _eventTeams;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(2).ToString(), out _eventTeams);
                     int _eventPlayerCount;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(3).ToString(), out _eventPlayerCount);
                     int _eventTime;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(4).ToString(), out _eventTime);
                     _result.Dispose();
                     SdtdConsole.Instance.Output(string.Format("Event: {0}", _eventName));
                     SdtdConsole.Instance.Output(string.Format("Invitation: {0}", _eventInvite));
                     SdtdConsole.Instance.Output(string.Format("Info: Teams {0}, Players {1}, Time {2} minutes.", _eventTeams, _eventPlayerCount, _eventTime));
                     foreach (var _player in Event.PlayersTeam)
                     {
                         ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForPlayerId(_player.Key);
                         if (_cInfo != null)
                         {
                             int _team;
                             Event.PlayersTeam.TryGetValue(_player.Key, out _team);
                             SdtdConsole.Instance.Output(string.Format("Player name {0}, Id {1}, is on team {2}.", _cInfo.playerName, _cInfo.playerId, _team));
                         }
                         else
                         {
                             int _team;
                             Event.PlayersTeam.TryGetValue(_player.Key, out _team);
                             SdtdConsole.Instance.Output(string.Format("Offline player: Player name unknown, Id {0}, is on team {1}.", _player.Key, _team));
                         }
                     }
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("You are not the organizer for this event. Contact {0}.", Event.Admin));
                     return;
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output("There is no event open.");
                 return;
             }
         }
         else if (_params[0].ToLower() == ("cancel"))
         {
             if (Event.Admin == _steamId)
             {
                 if (Event.Open)
                 {
                     if (!Event.Cancel)
                     {
                         Event.Cancel = true;
                         SdtdConsole.Instance.Output("Are you sure you want to cancel the current event? Type event cancel again to stop the event.");
                         return;
                     }
                     else
                     {
                         Event.SetupStage.Remove(_steamId);
                         Event.SetupName.Remove(_steamId);
                         foreach (var _player in Event.PlayersTeam)
                         {
                             ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForPlayerId(_player.Key);
                             if (_cInfo != null)
                             {
                                 EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                 if (_player2.IsSpawned())
                                 {
                                     string    _sql      = string.Format("SELECT eventReturn FROM Players WHERE steamid = '{0}'", _steamId);
                                     DataTable _result   = SQL.TQuery(_sql);
                                     string    _position = _result.Rows[0].ItemArray.GetValue(0).ToString();
                                     _result.Dispose();
                                     int      x, y, z;
                                     string[] _cords = _position.Split(',');
                                     int.TryParse(_cords[0], out x);
                                     int.TryParse(_cords[1], out y);
                                     int.TryParse(_cords[2], out z);
                                     _cInfo.SendPackage(new NetPackageTeleportPlayer(new Vector3(x, y, z), null, false));
                                     Event.PlayersTeam.Remove(_player.Key);
                                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", the event has ended. Thank you for playing.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                 }
                                 else
                                 {
                                     string _sql = string.Format("UPDATE Players SET return = 'true' WHERE steamid = '{0}'", _steamId);
                                     SQL.FastQuery(_sql, "EventCommandsConsole");
                                     Event.PlayersTeam.Remove(_player.Key);
                                     SdtdConsole.Instance.Output(string.Format("Player with Id {0} was not spawned but they have been removed from the event and set to go back to their return point.", _player.Key));
                                 }
                             }
                             else
                             {
                                 string _sql = string.Format("UPDATE Players SET return = 'true' WHERE steamid = '{0}'", _steamId);
                                 SQL.FastQuery(_sql, "EventCommandsConsole");
                                 Event.PlayersTeam.Remove(_player.Key);
                                 SdtdConsole.Instance.Output(string.Format("Player with Id {0} was offline but they have been removed from the event and set to go back to their return point.", _player.Key));
                             }
                         }
                         string _sql2 = string.Format("UPDATE Events SET eventAdmin = null, eventActive = 'false' WHERE eventAdmin = '{0}'", Event.Admin);
                         SQL.FastQuery(_sql2, "EventCommandsConsole");
                         Event.Cancel = false;
                         Event.Open   = false;
                         Event.Admin  = null;
                         SdtdConsole.Instance.Output("The current event has been cancelled and event players have been sent back to their return points.");
                     }
                 }
                 else
                 {
                     if (Event.Invited)
                     {
                         Event.Invited = false;
                         Event.Admin   = null;
                         if (Event.PlayersTeam.Count > 0)
                         {
                             foreach (var _player in Event.PlayersTeam)
                             {
                                 ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForPlayerId(_player.Key);
                                 if (_cInfo != null)
                                 {
                                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", the current event has been cancelled.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                 }
                                 Event.PlayersTeam.Remove(_player.Key);
                             }
                         }
                         SdtdConsole.Instance.Output("The current setup has been cancelled and all signed up players were removed.");
                         return;
                     }
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("You are not the organizer for this event. Contact {0}.", Event.Admin));
                 return;
             }
         }
         else if (_params[0].ToLower() == ("list"))
         {
             string    _sql    = string.Format("SELECT eventid, eventName, eventInvite, eventTeams, eventPlayerCount, eventTime FROM Events WHERE eventAdmin = '{0}'", _steamId);
             DataTable _result = SQL.TQuery(_sql);
             if (_result.Rows.Count > 0)
             {
                 foreach (DataRow row in _result.Rows)
                 {
                     SdtdConsole.Instance.Output(string.Format("Event Id = {0} Event Name = {1}", row[0].ToString(), row[1].ToString()));
                     SdtdConsole.Instance.Output(string.Format("Event Invite = {0}", row[2].ToString()));
                     SdtdConsole.Instance.Output(string.Format("Team Count = {0} Allowed Players = {1} Allowed Time = {2}", row[3].ToString(), row[4].ToString(), row[5].ToString()));
                     SdtdConsole.Instance.Output("-----------------------------------------------------------------------");
                     SdtdConsole.Instance.Output("-----------------------------------------------------------------------");
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output("You have no saved event data.");
             }
             _result.Dispose();
             if (Event.Open || Event.Invited)
             {
                 SdtdConsole.Instance.Output(string.Format("An event is running by admin {0}", Event.Admin));
             }
             else
             {
                 SdtdConsole.Instance.Output("Type event load <eventid> to load that event. After loading, type event start to send the invitation to players.");
             }
         }
         else if (_params[0].ToLower() == ("load"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}.", _params.Count));
                 return;
             }
             int _id;
             if (int.TryParse(_params[1], out _id))
             {
                 string    _sql    = string.Format("SELECT eventName, eventInvite, eventTeams, eventPlayerCount, eventTime FROM Events WHERE eventAdmin = '{0}' AND eventid = {1}", _steamId, _id);
                 DataTable _result = SQL.TQuery(_sql);
                 if (_result.Rows.Count > 0)
                 {
                     string _eventName   = _result.Rows[0].ItemArray.GetValue(0).ToString();
                     string _eventInvite = _result.Rows[0].ItemArray.GetValue(1).ToString();
                     int    _eventTeams;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(2).ToString(), out _eventTeams);
                     int _eventPlayerCount;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(3).ToString(), out _eventPlayerCount);
                     int _eventTime;
                     int.TryParse(_result.Rows[0].ItemArray.GetValue(4).ToString(), out _eventTime);
                     _result.Dispose();
                     SdtdConsole.Instance.Output(string.Format("Event: {0}", _eventName));
                     SdtdConsole.Instance.Output(string.Format("Invitation: {0}", _eventInvite));
                     SdtdConsole.Instance.Output(string.Format("Info: Teams {0}, Players {1}, Time {2} minutes.", _eventTeams, _eventPlayerCount, _eventTime));
                     if (Event.SetupStage.ContainsKey(_steamId))
                     {
                         Event.SetupStage[_steamId] = 5;
                         Event.SetupName[_steamId]  = _eventName;
                     }
                     else
                     {
                         Event.SetupStage.Add(_steamId, 5);
                         Event.SetupName.Add(_steamId, _eventName);
                     }
                     SdtdConsole.Instance.Output(string.Format("Event id: {0} has been loaded. Type event start to send the invitation out to players.", _id));
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Could not find this event id: {0}", _id));
                     return;
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}.", _params[1]));
                 return;
             }
         }
         else if (_params[0].ToLower() == ("extend"))
         {
             if (Event.Admin == _steamId)
             {
                 if (Event.Open)
                 {
                     if (Event.Extend)
                     {
                         Event.Extend = false;
                         int _time;
                         if (int.TryParse(_params[1], out _time))
                         {
                             int _addTime = Timers._eventTime + (_time * 60);
                             Timers._eventTime = _addTime;
                             SdtdConsole.Instance.Output(string.Format("The event time was extended {0} minutes.", _time));
                             return;
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("The event can only be extended while five minutes remain in the event. Wait for an alert before using the command."));
                         return;
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output("There is no event open to extend in time.");
                     return;
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("You are not the organizer for this event. Contact {0}.", Event.Admin));
                 return;
             }
         }
         else if (_params[0].ToLower() == ("remove"))
         {
             if (Event.Admin == _steamId)
             {
                 if (Event.Open)
                 {
                     if (Event.PlayersTeam.ContainsKey(_params[1]))
                     {
                         ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForPlayerId(_params[1]);
                         if (_cInfo != null)
                         {
                             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                             if (_player.IsSpawned())
                             {
                                 string    _sql      = string.Format("SELECT eventReturn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                                 DataTable _result   = SQL.TQuery(_sql);
                                 string    _position = _result.Rows[0].ItemArray.GetValue(0).ToString();
                                 _result.Dispose();
                                 int      x, y, z;
                                 string[] _cords = _position.Split(',');
                                 int.TryParse(_cords[0], out x);
                                 int.TryParse(_cords[1], out y);
                                 int.TryParse(_cords[2], out z);
                                 _cInfo.SendPackage(new NetPackageTeleportPlayer(new Vector3(x, y, z), null, false));
                                 _sql = string.Format("UPDATE Players SET eventReturn = 'Unknown', eventSpawn = 'false', eventRespawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                 SQL.FastQuery(_sql, "EventCommandsConsole");
                                 Event.PlayersTeam.Remove(_params[1]);
                                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you have been removed from the event and sent to your return point.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                 SdtdConsole.Instance.Output(string.Format("Player with Id {0} was removed from the event and sent to their return point.", _params[1]));
                                 return;
                             }
                             else
                             {
                                 string _sql = string.Format("UPDATE Players SET return = 'true', eventSpawn = 'false', eventRespawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                 SQL.FastQuery(_sql, "EventCommandsConsole");
                                 Event.PlayersTeam.Remove(_params[1]);
                                 SdtdConsole.Instance.Output(string.Format("Player with Id {0} was not spawned but they were removed from the event and set to return to their return point.", _params[1]));
                             }
                         }
                         else
                         {
                             string _sql = string.Format("UPDATE Players SET return = 'true', eventSpawn = 'false', eventRespawn = 'false' WHERE steamid = '{0}'", _params[1]);
                             SQL.FastQuery(_sql, "EventCommandsConsole");
                             Event.PlayersTeam.Remove(_params[1]);
                             SdtdConsole.Instance.Output(string.Format("Player with Id {0} was offline but they have been removed from the event and set to return to their return point.", _params[1]));
                             return;
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Invalid Id: {0}. They are not signed up for the event.", _params[1]));
                         return;
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output("There is no event open.");
                     return;
                 }
             }
         }
         else if (_params[0].ToLower() == ("start"))
         {
             if (!Event.Invited)
             {
                 if (Event.SetupStage.ContainsKey(_steamId))
                 {
                     int _stage;
                     if (Event.SetupStage.TryGetValue(_steamId, out _stage))
                     {
                         string _eventName;
                         if (Event.SetupName.TryGetValue(_steamId, out _eventName))
                         {
                             if (_stage == 5)
                             {
                                 if (!Event.Open)
                                 {
                                     Event.Invited = true;
                                     Event.Admin   = _steamId;
                                     Event.SetupStage.Remove(_steamId);
                                     Event.SetupName.Remove(_steamId);
                                     string    _sql    = string.Format("SELECT eventid, eventInvite FROM Events WHERE eventAdmin = '{0}' AND eventName = '{1}'", _steamId, _eventName);
                                     DataTable _result = SQL.TQuery(_sql);
                                     int       _eventid;
                                     int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _eventid);
                                     string _eventInvite = _result.Rows[0].ItemArray.GetValue(1).ToString();
                                     _result.Dispose();
                                     _sql = string.Format("UPDATE Events SET eventActive = 'true' WHERE eventid = {0} AND eventAdmin = '{1}'", _eventid, _steamId);
                                     SQL.FastQuery(_sql, "EventCommandsConsole");
                                     string _msg1 = "Event: {EventName}[-]";
                                     string _msg2 = _eventInvite;
                                     string _msg3 = "Type /event if you want to join the event. You will return to where you are when it ends.[-]";
                                     _msg1 = _msg1.Replace("{EventName}", _eventName);
                                     ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _msg1, -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                     ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _msg2, -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                     ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _msg3, -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                 }
                                 else
                                 {
                                     SdtdConsole.Instance.Output("The event has already started.");
                                     return;
                                 }
                             }
                             else
                             {
                                 SdtdConsole.Instance.Output("This command is invalid at this stage of setup.");
                                 return;
                             }
                         }
                     }
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output("There is an event invitation open already.");
                 return;
             }
         }
         else if (_params[0].ToLower() == ("delete") || _params[0].ToLower() == ("del"))
         {
             int _id;
             if (int.TryParse(_params[1], out _id))
             {
                 string    _sql    = string.Format("SELECT eventid FROM Events WHERE eventAdmin = '{0}'", _steamId);
                 DataTable _result = SQL.TQuery(_sql);
                 if (_result.Rows.Count > 0)
                 {
                     _sql = string.Format("Delete FROM Events WHERE eventid = {0}", _id);
                     SQL.FastQuery(_sql, "EventCommandsConsole");
                     _sql = string.Format("Delete FROM EventSpawns WHERE eventid = {0}", _id);
                     SQL.FastQuery(_sql, "EventCommandsConsole");
                     SdtdConsole.Instance.Output(string.Format("Deleted the event with id: {0}.", _id));
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}. This id is not attached to you. Can not delete it.", _params[1]));
                 }
                 _result.Dispose();
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}.", _params[1]));
                 return;
             }
         }
         else
         {
             if (Event.SetupStage.ContainsKey(_steamId))
             {
                 int _stage;
                 if (Event.SetupStage.TryGetValue(_steamId, out _stage))
                 {
                     string _eventName;
                     if (Event.SetupName.TryGetValue(_steamId, out _eventName))
                     {
                         if (_stage == 1)
                         {
                             string _invite = SQL.EscapeString(_params[0]);
                             string _sql    = string.Format("UPDATE Events SET eventInvite = '{0}' WHERE eventAdmin = '{1}' AND eventName = '{2}'", _invite, _steamId, _eventName);
                             SQL.FastQuery(_sql, "EventCommandsConsole");
                             Event.SetupStage[_steamId] = 2;
                             SdtdConsole.Instance.Output(string.Format("The event invitation has been set to {0}.", _params[0]));
                             SdtdConsole.Instance.Output("How many teams, total players, and time in minutes will the event last? Type event <TeamCount> <TotalPlayers> <TimeInMin>.");
                             return;
                         }
                         else if (_stage == 2)
                         {
                             if (_params.Count == 3)
                             {
                                 int _teamCount;
                                 if (int.TryParse(_params[0], out _teamCount))
                                 {
                                     if (_teamCount < 1)
                                     {
                                         _teamCount = 1;
                                     }
                                     int _playerCount;
                                     if (int.TryParse(_params[1], out _playerCount))
                                     {
                                         if (_playerCount < 1)
                                         {
                                             _playerCount = 1;
                                         }
                                         int _eventTime;
                                         if (int.TryParse(_params[2], out _eventTime))
                                         {
                                             if (_eventTime < 1)
                                             {
                                                 _eventTime = 1;
                                             }
                                             string _sql = string.Format("UPDATE Events SET eventTeams = {0}, eventPlayerCount = {1}, eventTime = {2} WHERE eventAdmin = '{3}' AND eventName = '{4}'", _teamCount, _playerCount, _eventTime, _steamId, _eventName);
                                             SQL.FastQuery(_sql, "EventCommandsConsole");
                                             Event.SetupStage[_steamId] = 3;
                                             SdtdConsole.Instance.Output(string.Format("The event info has been set: team count {0}, total players {1}, event time {2}.", _teamCount, _playerCount, _eventTime));
                                             if (_teamCount == 1)
                                             {
                                                 SdtdConsole.Instance.Output("Stand where you would like players to spawn when the event starts and type event save.");
                                                 return;
                                             }
                                             else
                                             {
                                                 SdtdConsole.Instance.Output("Stand where you would like the team 1 to spawn when the event starts and type event save.");
                                                 return;
                                             }
                                         }
                                     }
                                 }
                             }
                             else
                             {
                                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 3, found {0}.", _params.Count));
                                 return;
                             }
                         }
                     }
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output("You have no event being setup. Setup a new one by typing event new <EventName>.");
                 return;
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in EventCommandsConsole.Run: {0}.", e));
     }
 }
Example #25
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 {CommandPrivate}{Command103} once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
                                    }
                                    _phrase560 = _phrase560.Replace("{DelayBetweenUses}", _newDelay.ToString());
                                    _phrase560 = _phrase560.Replace("{TimeRemaining}", _timeleft.ToString());
                                    _phrase560 = _phrase560.Replace("{CommandPrivate}", ChatHook.Command_Private);
                                    _phrase560 = _phrase560.Replace("{Command103}", MarketChat.Command103);
                                    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 = " you can only use {CommandPrivate}{Command103} once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
                            }
                            _phrase560 = _phrase560.Replace("{DelayBetweenUses}", Delay_Between_Uses.ToString());
                            _phrase560 = _phrase560.Replace("{TimeRemaining}", _timeleft.ToString());
                            _phrase560 = _phrase560.Replace("{CommandPrivate}", ChatHook.Command_Private);
                            _phrase560 = _phrase560.Replace("{Command103}", MarketChat.Command103);
                            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);
                            }
                        }
                    }
                }
            }
        }
Example #26
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count == 3 || _params.Count == 4 || _params.Count > 5)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, 2 or 5, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             Tracking.IsEnabled = false;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Tracking has been set to off"));
             return;
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             Tracking.IsEnabled = true;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Tracking has been set to on"));
             return;
         }
         else if (_params.Count == 2)
         {
             int _hours, _range;
             if (int.TryParse(_params[0], out _hours))
             {
                 if (int.TryParse(_params[1], out _range))
                 {
                     List <string> PlayerId = new List <string>();
                     string        _sql     = string.Format("SELECT * FROM Tracking ORDER BY dateTime DESC");
                     DataTable     _result  = SQL.TQuery(_sql);
                     if (_result.Rows.Count > 0)
                     {
                         EntityPlayer _player = GameManager.Instance.World.Players.dict[_senderInfo.RemoteClientInfo.entityId];
                         SdtdConsole.Instance.Output(string.Format("Tracking results at a range of {0} blocks:", _range));
                         bool _found = false;
                         foreach (DataRow row in _result.Rows)
                         {
                             DateTime _dateTime;
                             DateTime.TryParse(row.ItemArray.GetValue(0).ToString(), out _dateTime);
                             if (_dateTime.AddHours(_hours) >= DateTime.Now)
                             {
                                 string[] _cords = row.ItemArray.GetValue(1).ToString().Split(' ');
                                 int      _x, _y, _z;
                                 int.TryParse(_cords[0], out _x);
                                 int.TryParse(_cords[1], out _y);
                                 int.TryParse(_cords[2], out _z);
                                 Vector3 _trackedVecPos = new Vector3(_x, _y, _z);
                                 if (RangeCheck(_player.position, _trackedVecPos, _range))
                                 {
                                     _found = true;
                                     string _playerId   = row.ItemArray.GetValue(2).ToString();
                                     string _playerName = row.ItemArray.GetValue(3).ToString();
                                     string _itemHeld   = row.ItemArray.GetValue(4).ToString();
                                     if (!PlayerId.Contains(_playerId))
                                     {
                                         PlayerId.Add(_playerId);
                                         SdtdConsole.Instance.Output(string.Format("Player: {0}, SteamId: {1}, Time: {2}, Position: {3} {4} {5}, Item Held: {6}", _playerName, _playerId, _dateTime, _x, _y, _z, _itemHeld));
                                     }
                                 }
                             }
                             else
                             {
                                 break;
                             }
                         }
                         if (!_found)
                         {
                             SdtdConsole.Instance.Output(string.Format("Tracking results found nobody at this time and range inside your current position"));
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("No tracking positions are recorded in the database"));
                     }
                     _result.Dispose();
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[1]));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
             }
             return;
         }
         else if (_params.Count == 5)
         {
             int _hours, _range, _worldX, _worldY, _worldZ;
             if (int.TryParse(_params[0], out _hours))
             {
                 if (int.TryParse(_params[1], out _range))
                 {
                     if (int.TryParse(_params[2], out _worldX))
                     {
                         if (int.TryParse(_params[3], out _worldY))
                         {
                             if (int.TryParse(_params[4], out _worldZ))
                             {
                                 List <string> PlayerId = new List <string>();
                                 string        _sql     = string.Format("SELECT * FROM Tracking ORDER BY dateTime DESC");
                                 DataTable     _result  = SQL.TQuery(_sql);
                                 if (_result.Rows.Count > 0)
                                 {
                                     SdtdConsole.Instance.Output(string.Format("Tracking results at a range of {0} blocks:", _range));
                                     bool _found = false;
                                     foreach (DataRow row in _result.Rows)
                                     {
                                         DateTime _dateTime;
                                         DateTime.TryParse(row.ItemArray.GetValue(0).ToString(), out _dateTime);
                                         if (_dateTime.AddHours(_hours) >= DateTime.Now)
                                         {
                                             string[] _cords = row.ItemArray.GetValue(1).ToString().Split(' ');
                                             int      _x, _y, _z;
                                             int.TryParse(_cords[0], out _x);
                                             int.TryParse(_cords[1], out _y);
                                             int.TryParse(_cords[2], out _z);
                                             Vector3 _worldVecPos   = new Vector3(_worldX, _worldY, _worldZ);
                                             Vector3 _trackedVecPos = new Vector3(_x, _y, _z);
                                             if (RangeCheck(_worldVecPos, _trackedVecPos, _range))
                                             {
                                                 _found = true;
                                                 string _playerId   = row.ItemArray.GetValue(2).ToString();
                                                 string _playerName = row.ItemArray.GetValue(3).ToString();
                                                 string _itemHeld   = row.ItemArray.GetValue(4).ToString();
                                                 if (!PlayerId.Contains(_playerId))
                                                 {
                                                     PlayerId.Add(_playerId);
                                                     SdtdConsole.Instance.Output(string.Format("Player: {0}, SteamId: {1}, Time: {2}, Position: {3} {4} {5}, Item Held: {6}", _playerName, _playerId, _dateTime, _x, _y, _z, _itemHeld));
                                                 }
                                             }
                                         }
                                         else
                                         {
                                             break;
                                         }
                                     }
                                     if (!_found)
                                     {
                                         SdtdConsole.Instance.Output(string.Format("Tracking results found nobody at this time and range inside the specified position"));
                                     }
                                 }
                                 else
                                 {
                                     SdtdConsole.Instance.Output(string.Format("No tracking positions are recorded in the database"));
                                 }
                                 _result.Dispose();
                             }
                             else
                             {
                                 SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[4]));
                             }
                         }
                         else
                         {
                             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[3]));
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[2]));
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[1]));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
             }
             return;
         }
         else
         {
             SdtdConsole.Instance.Output("Invalid arguments.");
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in TrackingConsole.Run: {0}.", e));
     }
 }
Example #27
0
 public void PlayerDisconnected(ClientInfo _cInfo, bool _bShutdown)
 {
     if (_cInfo != null)
     {
         if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId))
         {
             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (_player != null)
             {
                 string _sql = string.Format("UPDATE Players SET zkills = {0}, kills = {1}, deaths = {2} WHERE steamid = '{3}'", XUiM_Player.GetZombieKills(_player), XUiM_Player.GetPlayerKills(_player), XUiM_Player.GetDeaths(_player), _cInfo.playerId);
                 SQL.FastQuery(_sql);
                 if (Wallet.IsEnabled)
                 {
                     int _currentCoins = Wallet.GetcurrentCoins(_cInfo);
                     _sql = string.Format("UPDATE Players SET wallet = {0} WHERE steamid = '{1}'", _currentCoins, _cInfo.playerId);
                     SQL.FastQuery(_sql);
                 }
             }
         }
         if (HatchElevator.LastPositionY.ContainsKey(_cInfo.entityId))
         {
             HatchElevator.LastPositionY.Remove(_cInfo.entityId);
         }
         if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
         {
             FriendTeleport.Dict.Remove(_cInfo.entityId);
             FriendTeleport.Dict1.Remove(_cInfo.entityId);
         }
         if (Players.ZoneExit.ContainsKey(_cInfo.entityId))
         {
             Players.ZoneExit.Remove(_cInfo.entityId);
             Players.Forgive.Remove(_cInfo.entityId);
             Players.Victim.Remove(_cInfo.entityId);
         }
         if (FlightCheck.Flag.ContainsKey(_cInfo.entityId))
         {
             FlightCheck.Flag.Remove(_cInfo.entityId);
         }
         if (FlightCheck.fLastPositionXZ.ContainsKey(_cInfo.entityId))
         {
             FlightCheck.fLastPositionXZ.Remove(_cInfo.entityId);
         }
         if (FlightCheck.fLastPositionY.ContainsKey(_cInfo.entityId))
         {
             FlightCheck.fLastPositionY.Remove(_cInfo.entityId);
         }
         if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
         {
             FriendTeleport.Dict.Remove(_cInfo.entityId);
         }
         if (FriendTeleport.Dict1.ContainsKey(_cInfo.entityId))
         {
             FriendTeleport.Dict1.Remove(_cInfo.entityId);
         }
         if (Travel.Flag.Contains(_cInfo.entityId))
         {
             Travel.Flag.Remove(_cInfo.entityId);
         }
         if (UndergroundCheck.Flag.ContainsKey(_cInfo.entityId))
         {
             UndergroundCheck.Flag.Remove(_cInfo.entityId);
         }
         if (UndergroundCheck.uLastPositionXZ.ContainsKey(_cInfo.entityId))
         {
             UndergroundCheck.uLastPositionXZ.Remove(_cInfo.entityId);
         }
         if (Wallet.IsEnabled)
         {
             string    _sql2    = string.Format("SELECT steamid FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
             DataTable _result2 = SQL.TQuery(_sql2);
             if (_result2.Rows.Count > 0)
             {
                 DateTime _time;
                 if (Players.Session.TryGetValue(_cInfo.playerId, out _time))
                 {
                     TimeSpan varTime           = DateTime.Now - _time;
                     double   fractionalMinutes = varTime.TotalMinutes;
                     int      _timepassed       = (int)fractionalMinutes;
                     if (_timepassed > 60)
                     {
                         int _hours = _timepassed / 60 * 10;
                         Wallet.AddCoinsToWallet(_cInfo.playerId, _hours);
                     }
                     string    _sql1    = string.Format("SELECT sessionTime FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     DataTable _result1 = SQL.TQuery(_sql1);
                     int       _sessionTime;
                     int.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _sessionTime);
                     _result1.Dispose();
                     _sql1 = string.Format("UPDATE Players SET sessionTime = {0} WHERE steamid = '{1}'", _sessionTime + _timepassed, _cInfo.playerId);
                     SQL.FastQuery(_sql1);
                 }
             }
             _result2.Dispose();
         }
         if (Players.Session.ContainsKey(_cInfo.playerId))
         {
             Players.Session.Remove(_cInfo.playerId);
         }
         if (Bank.TransferId.ContainsKey(_cInfo.playerId))
         {
             Bank.TransferId.Remove(_cInfo.playerId);
         }
         if (Zones.reminder.ContainsKey(_cInfo.entityId))
         {
             Zones.reminder.Remove(_cInfo.entityId);
         }
     }
 }
Example #28
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 2)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 or 2, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             VoteReward.IsEnabled = false;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Vote reward has been set to off"));
             return;
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             VoteReward.IsEnabled = true;
             LoadConfig.WriteXml();
             SdtdConsole.Instance.Output(string.Format("Vote reward has been set to on"));
             return;
         }
         else if (_params[0].ToLower().Equals("reset"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             if (_params[1].ToLower().Equals("online"))
             {
                 List <ClientInfo> ClientInfoList = ConnectionManager.Instance.Clients.List.ToList();
                 for (int i = 0; i < ClientInfoList.Count; i++)
                 {
                     ClientInfo _cInfo2 = ClientInfoList[i];
                     if (_cInfo2 != null)
                     {
                         string    _sql    = string.Format("SELECT lastVoteReward FROM Players WHERE steamid = '{0}'", _cInfo2.playerId);
                         DataTable _result = SQL.TQuery(_sql);
                         if (_result.Rows.Count != 0)
                         {
                             DateTime _lastVoteReward;
                             DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastVoteReward);
                             if (_lastVoteReward.ToString() != "10/29/2000 7:30:00 AM")
                             {
                                 _sql = string.Format("UPDATE Players SET lastVoteReward = '10/29/2000 7:30:00 AM' WHERE steamid = '{0}'", _cInfo2.playerId);
                                 SQL.FastQuery(_sql, "VoteConsole");
                                 SdtdConsole.Instance.Output(string.Format("Vote reward delay reset for {0}.", _cInfo2.playerName));
                             }
                             else
                             {
                                 SdtdConsole.Instance.Output(string.Format("Player named {0} does not have a vote reward delay that requires reset.", _cInfo2.playerName));
                             }
                         }
                     }
                 }
                 return;
             }
             if (_params[1].ToLower().Equals("all"))
             {
                 string _sql = string.Format("UPDATE Players SET lastVoteReward = '10/29/2000 7:30:00 AM' WHERE lastVoteReward != '10/29/2000 7:30:00 AM'");
                 SQL.FastQuery(_sql, "VoteConsole");
                 return;
             }
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo != null)
             {
                 string    _sql    = string.Format("SELECT lastVoteReward FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                 DataTable _result = SQL.TQuery(_sql);
                 if (_result.Rows.Count != 0)
                 {
                     DateTime _lastVoteReward;
                     DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastVoteReward);
                     if (_lastVoteReward.ToString() != "10/29/2000 7:30:00 AM")
                     {
                         _sql = string.Format("UPDATE Players SET lastVoteReward = '10/29/2000 7:30:00 AM' WHERE steamid = '{0}'", _cInfo.playerId);
                         SQL.FastQuery(_sql, "VoteConsole");
                         SdtdConsole.Instance.Output("Vote reward delay reset.");
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Player with id {0} does not have a vote reward delay that requires reset.", _params[1]));
                     }
                 }
                 _result.Dispose();
             }
             else
             {
                 if (_params[1].Length != 17)
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not reset Id: Invalid Id {0}", _params[1]));
                     return;
                 }
                 string    _id     = SQL.EscapeString(_params[1]);
                 string    _sql    = string.Format("SELECT lastVoteReward FROM Players WHERE steamid = '{0}'", _id);
                 DataTable _result = SQL.TQuery(_sql);
                 if (_result.Rows.Count != 0)
                 {
                     DateTime _lastVoteReward;
                     DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastVoteReward);
                     if (_lastVoteReward.ToString() != "10/29/2000 7:30:00 AM")
                     {
                         _sql = string.Format("UPDATE Players SET lastVoteReward = '10/29/2000 7:30:00 AM' WHERE steamid = '{0}'", _id);
                         SQL.FastQuery(_sql, "VoteConsole");
                         SdtdConsole.Instance.Output("Vote reward delay reset.");
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Player with id {0} does not have a vote reward delay that requires reset.", _params[1]));
                     }
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("Player with id {0} does not have a vote reward delay to reset.", _params[1]));
                 }
                 _result.Dispose();
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in VotingConsole.Run: {0}.", e));
     }
 }
Example #29
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count));
             return;
         }
         ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[0]);
         if (_cInfo != null)
         {
             string    _filepath  = string.Format("{0}/Player/{1}.map", GameUtils.GetSaveGameDir(), _cInfo.playerId);
             string    _filepath1 = string.Format("{0}/Player/{1}.ttp", GameUtils.GetSaveGameDir(), _cInfo.playerId);
             string    _sql       = string.Format("SELECT steamid FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
             DataTable _result    = SQL.TQuery(_sql);
             if (_result.Rows.Count != 0)
             {
                 string _phrase400;
                 if (!Phrases.Dict.TryGetValue(400, out _phrase400))
                 {
                     _phrase400 = "Reseting players profile.";
                 }
                 SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.entityId, _phrase400), _cInfo);
                 if (!File.Exists(_filepath))
                 {
                     SdtdConsole.Instance.Output(string.Format("Could not find file {0}.map", _params[0]));
                 }
                 else
                 {
                     File.Delete(_filepath);
                 }
                 if (!File.Exists(_filepath1))
                 {
                     SdtdConsole.Instance.Output(string.Format("Could not find file {0}.ttp", _params[0]));
                 }
                 else
                 {
                     File.Delete(_filepath1);
                 }
                 _sql = string.Format("UPDATE Players SET playername = 'Unknown', last_gimme = '10/29/2000 7:30:00 AM', lastkillme = '10/29/2000 7:30:00 AM', playerSpentCoins = 0, sessionTime = 0, bikeId = 0, lastBike = '10/29/2000 7:30:00 AM', jailName = 'Unknown', jailDate = '10/29/2000 7:30:00 AM', muteName = 'Unknown', muteDate = '10/29/2000 7:30:00 AM', lobbyReturn = 'Unknown', newTeleSpawn = 'Unknown', homeposition = 'Unknown', homeposition2 = 'Unknown', lastsethome = '10/29/2000 7:30:00 AM', lastwhisper = 'Unknown', lastStuck = '10/29/2000 7:30:00 AM', lastLobby = '10/29/2000 7:30:00 AM', lastLog = '10/29/2000 7:30:00 AM', lastBackpack = '10/29/2000 7:30:00 AM', lastFriendTele = '10/29/2000 7:30:00 AM', respawnTime = '10/29/2000 7:30:00 AM', lastTravel = '10/29/2000 7:30:00 AM', lastAnimals = '10/29/2000 7:30:00 AM', lastVoteReward = '10/29/2000 7:30:00 AM', firstClaim = 'false', ismuted = 'false', isjailed = 'false', startingItems = 'false', clanname = 'Unknown', invitedtoclan = 'Unknown', isclanowner = 'false', isclanofficer = 'false', customCommand1 = '10/29/2000 7:30:00 AM', customCommand2 = '10/29/2000 7:30:00 AM', customCommand3 = '10/29/2000 7:30:00 AM', customCommand4 = '10/29/2000 7:30:00 AM', customCommand5 = '10/29/2000 7:30:00 AM', customCommand6 = '10/29/2000 7:30:00 AM', customCommand7 = '10/29/2000 7:30:00 AM', customCommand8 = '10/29/2000 7:30:00 AM', customCommand9 = '10/29/2000 7:30:00 AM', customCommand10 = '10/29/2000 7:30:00 AM' WHERE steamid = '{0}'", _cInfo.playerId);
                 SQL.FastQuery(_sql, "ResetPlayerConsole");
                 _sql = string.Format("SELECT * FROM Auction WHERE steamid = '{0}'", _cInfo.playerId);
                 DataTable _result1 = SQL.TQuery(_sql);
                 if (_result1.Rows.Count != 0)
                 {
                     _sql = string.Format("DELETE FROM Auction WHERE steamid = '{0}'", _cInfo.playerId);
                     SQL.FastQuery(_sql, "ResetPlayerConsole");
                 }
                 _result1.Dispose();
             }
             _result.Dispose();
             string _phrase401;
             if (!Phrases.Dict.TryGetValue(401, out _phrase401))
             {
                 _phrase401 = "You have reset the profile for Player {SteamId}.";
             }
             _phrase401 = _phrase401.Replace("{SteamId}", _params[0]);
             SdtdConsole.Instance.Output(string.Format("{0}", _phrase401));
         }
         else if (_params[0].Length == 17)
         {
             string    _steamid   = SQL.EscapeString(_params[0]);
             string    _filepath  = string.Format("{0}/Player/{1}.map", GameUtils.GetSaveGameDir(), _steamid);
             string    _filepath1 = string.Format("{0}/Player/{1}.ttp", GameUtils.GetSaveGameDir(), _steamid);
             string    _sql       = string.Format("SELECT last_gimme FROM Players WHERE steamid = '{0}'", _steamid);
             DataTable _result    = SQL.TQuery(_sql);
             if (_result.Rows.Count != 0)
             {
                 if (!File.Exists(_filepath))
                 {
                     SdtdConsole.Instance.Output(string.Format("Could not find file {0}.map", _params[0]));
                 }
                 else
                 {
                     File.Delete(_filepath);
                 }
                 if (!File.Exists(_filepath1))
                 {
                     SdtdConsole.Instance.Output(string.Format("Could not find file {0}.ttp", _params[0]));
                 }
                 else
                 {
                     File.Delete(_filepath1);
                 }
                 _sql = string.Format("UPDATE Players SET playername = 'Unknown', last_gimme = '10/29/2000 7:30:00 AM', lastkillme = '10/29/2000 7:30:00 AM', playerSpentCoins = 0, sessionTime = 0, bikeId = 0, lastBike = '10/29/2000 7:30:00 AM', jailName = 'Unknown', jailDate = '10/29/2000 7:30:00 AM', muteName = 'Unknown', muteDate = '10/29/2000 7:30:00 AM', lobbyReturn = 'Unknown', newTeleSpawn = 'Unknown', homeposition = 'Unknown', homeposition2 = 'Unknown', lastsethome = '10/29/2000 7:30:00 AM', lastwhisper = 'Unknown', lastStuck = '10/29/2000 7:30:00 AM', lastLobby = '10/29/2000 7:30:00 AM', lastLog = '10/29/2000 7:30:00 AM', lastDied = '10/29/2000 7:30:00 AM', lastFriendTele = '10/29/2000 7:30:00 AM', respawnTime = '10/29/2000 7:30:00 AM', lastTravel = '10/29/2000 7:30:00 AM', lastAnimals = '10/29/2000 7:30:00 AM', lastVoteReward = '10/29/2000 7:30:00 AM', firstClaim = 'false', ismuted = 'false', isjailed = 'false', startingItems = 'false', clanname = 'Unknown', invitedtoclan = 'Unknown', isclanowner = 'false', isclanofficer = 'false', customCommand1 = '10/29/2000 7:30:00 AM', customCommand2 = '10/29/2000 7:30:00 AM', customCommand3 = '10/29/2000 7:30:00 AM', customCommand4 = '10/29/2000 7:30:00 AM', customCommand5 = '10/29/2000 7:30:00 AM', customCommand6 = '10/29/2000 7:30:00 AM', customCommand7 = '10/29/2000 7:30:00 AM', customCommand8 = '10/29/2000 7:30:00 AM', customCommand9 = '10/29/2000 7:30:00 AM', customCommand10 = '10/29/2000 7:30:00 AM' WHERE steamid = '{0}'", _steamid);
                 SQL.FastQuery(_sql, "ResetPlayerConsole");
                 _sql = string.Format("SELECT * FROM Auction WHERE steamid = '{0}'", _steamid);
                 DataTable _result1 = SQL.TQuery(_sql);
                 if (_result1.Rows.Count != 0)
                 {
                     _sql = string.Format("DELETE FROM Auction WHERE steamid = '{0}'", _steamid);
                     SQL.FastQuery(_sql, "ResetPlayerConsole");
                 }
                 _result1.Dispose();
             }
             _result.Dispose();
             string _phrase401;
             if (!Phrases.Dict.TryGetValue(401, out _phrase401))
             {
                 _phrase401 = "You have reset the profile for Player {SteamId}.";
             }
             _phrase401 = _phrase401.Replace("{SteamId}", _params[0]);
             SdtdConsole.Instance.Output(string.Format("{0}", _phrase401));
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Player id {0} is not a valid integer", _params[0]));
             return;
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ResetPlayerConsole.Run: {0}.", e));
     }
 }
Example #30
0
 public static void Remove(ClientInfo _cInfo, string _playerName)
 {
     if (IsEnabled)
     {
         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 + _phrase107 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
         else
         {
             _playerName = _playerName.Replace("unmute ", "");
             ClientInfo _PlayertoUnMute = ConsoleHelper.ParseParamIdOrName(_playerName);
             if (_PlayertoUnMute == 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 + _phrase201 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             }
             else
             {
                 string    _sql    = string.Format("SELECT muteTime FROM Players WHERE steamid = '{0}'", _PlayertoUnMute.playerId);
                 DataTable _result = SQL.TQuery(_sql);
                 int       _muteTime;
                 int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _muteTime);
                 _result.Dispose();
                 if (_muteTime == 0)
                 {
                     string _phrase204;
                     if (!Phrases.Dict.TryGetValue(204, out _phrase204))
                     {
                         _phrase204 = " player {PlayerName} is not muted.";
                     }
                     _phrase204 = _phrase204.Replace("{PlayerName}", _playerName);
                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase204 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 }
                 else
                 {
                     if (!Mutes.Contains(_PlayertoUnMute.playerId))
                     {
                         string _phrase204;
                         if (!Phrases.Dict.TryGetValue(204, out _phrase204))
                         {
                             _phrase204 = " player {PlayerName} is not muted.";
                         }
                         _phrase204 = _phrase204.Replace("{PlayerName}", _playerName);
                         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase204 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     }
                     else
                     {
                         Mutes.Remove(_PlayertoUnMute.playerId);
                         _sql = string.Format("UPDATE Players SET muteTime = 0 WHERE steamid = '{0}'", _PlayertoUnMute.playerId);
                         SQL.FastQuery(_sql);
                         string _phrase205;
                         if (!Phrases.Dict.TryGetValue(205, out _phrase205))
                         {
                             _phrase205 = " you have unmuted {PlayerName}.";
                         }
                         _phrase205 = _phrase205.Replace("{PlayerName}", _playerName);
                         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase205 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     }
                 }
             }
         }
     }
     else
     {
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + " this command is not enabled.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
     }
 }