Ejemplo n.º 1
0
 private static void SavePlayerData(ClientInfo _cInfo, PlayerDataFile _playerDataFile)
 {
     try
     {
         if (_cInfo != null && _playerDataFile != null)
         {
             if (HighPingKicker.IsEnabled)
             {
                 HighPingKicker.Exec(_cInfo);
             }
             if (InventoryCheck.IsEnabled || InventoryCheck.Announce_Invalid_Stack)
             {
                 InventoryCheck.CheckInv(_cInfo, _playerDataFile);
             }
             if (DupeLog.IsEnabled)
             {
                 DupeLog.Exec(_cInfo, _playerDataFile);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.SavePlayerData: {0}.", e.Message));
     }
 }
Ejemplo n.º 2
0
 public override void SavePlayerData(ClientInfo _cInfo, PlayerDataFile _playerDataFile)
 {
     if (HighPingKicker.IsEnabled)
     {
         HighPingKicker.CheckPing(_cInfo);
     }
     if (InventoryCheck.IsEnabled)
     {
         InventoryCheck.CheckInv(_cInfo, _playerDataFile);
     }
 }
Ejemplo n.º 3
0
 public override void SavePlayerData(ClientInfo _cInfo, PlayerDataFile _playerDataFile)
 {
     if (HighPingKicker.IsEnabled)
     {
         HighPingKicker.CheckPing(_cInfo);
     }
     if (InventoryCheck.IsEnabled || InventoryCheck.AnounceInvalidStack)
     {
         InventoryCheck.CheckInv(_cInfo, _playerDataFile);
     }
     if (Watchlist.IsEnabled)
     {
         Watchlist.CheckWatchlist(_cInfo);
     }
 }
Ejemplo n.º 4
0
 public void SavePlayerData(ClientInfo _cInfo, PlayerDataFile _playerDataFile)
 {
     if (_cInfo != null)
     {
         if (HighPingKicker.IsEnabled)
         {
             HighPingKicker.CheckPing(_cInfo);
         }
         if (InventoryCheck.IsEnabled || InventoryCheck.Anounce_Invalid_Stack)
         {
             InventoryCheck.CheckInv(_cInfo, _playerDataFile);
         }
         if (DupeLog.IsEnabled)
         {
             DupeLog.Exec(_cInfo, _playerDataFile);
         }
     }
 }
Ejemplo n.º 5
0
 public static void Load()
 {
     if (!RunTimePatch.Applied)
     {
         RunTimePatch.PatchAll();
     }
     if (!Timers.IsRunning)
     {
         Timers.TimerStart();
     }
     if (!LoadTriggers.IsRunning)
     {
         LoadTriggers.Load();
     }
     if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen)
     {
         Poll.CheckTime();
     }
     if (!ClanManager.IsEnabled)
     {
         ClanManager.Clans.Clear();
         ClanManager.ClanMember.Clear();
     }
     if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
     {
         InfoTicker.Unload();
     }
     if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
     {
         InfoTicker.Load();
     }
     if (Gimme.IsRunning && !Gimme.IsEnabled)
     {
         Gimme.Unload();
     }
     if (!Gimme.IsRunning && Gimme.IsEnabled)
     {
         Gimme.Load();
     }
     if (Badwords.IsRunning && !Badwords.IsEnabled)
     {
         Badwords.Unload();
     }
     if (!Badwords.IsRunning && Badwords.IsEnabled)
     {
         Badwords.Load();
     }
     if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
     {
         LoginNotice.Load();
     }
     if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
     {
         LoginNotice.Unload();
     }
     if (!Zones.IsRunning && Zones.IsEnabled)
     {
         Zones.Load();
     }
     if (Zones.IsRunning && !Zones.IsEnabled)
     {
         Zones.Unload();
     }
     if (!VoteReward.IsRunning && VoteReward.IsEnabled)
     {
         VoteReward.Load();
     }
     if (VoteReward.IsRunning && !VoteReward.IsEnabled)
     {
         VoteReward.Unload();
     }
     if (!Watchlist.IsRunning && Watchlist.IsEnabled)
     {
         Watchlist.Load();
     }
     if (Watchlist.IsRunning && !Watchlist.IsEnabled)
     {
         Watchlist.Unload();
     }
     if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
     {
         ReservedSlots.Load();
     }
     if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
     {
         ReservedSlots.Unload();
     }
     if (!StartingItems.IsRunning && StartingItems.IsEnabled)
     {
         StartingItems.Load();
     }
     if (StartingItems.IsRunning && !StartingItems.IsEnabled)
     {
         StartingItems.Unload();
     }
     if (!Travel.IsRunning && Travel.IsEnabled)
     {
         Travel.Load();
     }
     if (Travel.IsRunning && !Travel.IsEnabled)
     {
         Travel.Unload();
     }
     if (!Shop.IsRunning && Shop.IsEnabled)
     {
         Shop.Load();
     }
     if (Shop.IsRunning && !Shop.IsEnabled)
     {
         Shop.Unload();
     }
     if (!Motd.IsRunning && Motd.IsEnabled)
     {
         Motd.Load();
     }
     if (Motd.IsRunning && !Motd.IsEnabled)
     {
         Motd.Unload();
     }
     if (InvalidItems.IsRunning && !InvalidItems.IsEnabled)
     {
         InvalidItems.Unload();
     }
     if (!InvalidItems.IsRunning && InvalidItems.IsEnabled)
     {
         InvalidItems.Load();
     }
     if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled)
     {
         HighPingKicker.Unload();
     }
     if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled)
     {
         HighPingKicker.Load();
     }
     if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
     {
         CredentialCheck.Unload();
     }
     if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
     {
         CredentialCheck.Load();
     }
     if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
     {
         CustomCommands.Unload();
     }
     if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
     {
         CustomCommands.Load();
     }
     if (DupeLog.IsRunning && !DupeLog.IsEnabled)
     {
         DupeLog.Unload();
     }
     if (!DupeLog.IsRunning && DupeLog.IsEnabled)
     {
         DupeLog.Load();
     }
     if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
     {
         ChatColorPrefix.Unload();
     }
     if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
     {
         ChatColorPrefix.Load();
     }
     if (KillNotice.IsRunning && !KillNotice.IsEnabled)
     {
         KillNotice.Unload();
     }
     if (!KillNotice.IsRunning && KillNotice.IsEnabled)
     {
         KillNotice.Load();
     }
     if (Prayer.IsRunning && !Prayer.IsEnabled)
     {
         Prayer.Unload();
     }
     if (!Prayer.IsRunning && Prayer.IsEnabled)
     {
         Prayer.Load();
     }
     if (BloodmoonWarrior.IsRunning && !BloodmoonWarrior.IsEnabled)
     {
         BloodmoonWarrior.Unload();
     }
     if (!BloodmoonWarrior.IsRunning && BloodmoonWarrior.IsEnabled)
     {
         BloodmoonWarrior.Load();
     }
     if (ProtectedSpaces.IsRunning && !ProtectedSpaces.IsEnabled)
     {
         ProtectedSpaces.Unload();
     }
     if (!ProtectedSpaces.IsRunning && ProtectedSpaces.IsEnabled)
     {
         ProtectedSpaces.Load();
     }
     if (ClanManager.IsEnabled)
     {
         ClanManager.ClanList();
     }
     if (Auction.IsEnabled)
     {
         Auction.AuctionList();
     }
     if (Mute.IsEnabled)
     {
         Mute.ClientMuteList();
         Mute.MuteList();
     }
     if (Jail.IsEnabled)
     {
         Jail.JailList();
     }
     //always load the website last
     if (WebsiteServer.IsEnabled && !WebsiteServer.DirFound)
     {
         WebsiteServer.CheckDir();
     }
     if (WebsiteServer.IsRunning && !WebsiteServer.IsEnabled)
     {
         WebsiteServer.Unload();
     }
     if (!WebsiteServer.IsRunning && WebsiteServer.IsEnabled && WebsiteServer.DirFound)
     {
         WebsiteServer.Load();
     }
 }
 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 to 3, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count != 2 && _params.Count != 3)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2 or 3, found {0}.", _params.Count));
                 return;
             }
             if (HighPingKicker._whiteListPlayers.ContainsKey(_params[1]))
             {
                 SdtdConsole.Instance.Output(string.Format("Can not add SteamId. {0} is already in the Ping Immunity list.", _params[1]));
                 return;
             }
             if (_params.Count == 2)
             {
                 HighPingKicker._whiteListPlayers.Add(_params[1], null);
                 SdtdConsole.Instance.Output(string.Format("Added SteamId {0} to the Ping Immunity list.", _params[1]));
             }
             else
             {
                 HighPingKicker._whiteListPlayers.Add(_params[1], _params[2]);
                 SdtdConsole.Instance.Output(string.Format("Added SteamId {0} with the name {1} the Ping Immunity list.", _params[1], _params[2]));
             }
             HighPingKicker.UpdateXml();
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             if (!HighPingKicker._whiteListPlayers.ContainsKey(_params[1]))
             {
                 SdtdConsole.Instance.Output(string.Format("SteamId {0} was not found.", _params[1]));
                 return;
             }
             HighPingKicker._whiteListPlayers.Remove(_params[1]);
             SdtdConsole.Instance.Output(string.Format("Removed SteamId {0} from Ping Immunity list.", _params[1]));
             HighPingKicker.UpdateXml();
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}.", _params.Count));
                 return;
             }
             if (HighPingKicker.SteamId.Count < 1)
             {
                 SdtdConsole.Instance.Output("There are no steamIds on the Ping Immunity list.");
                 return;
             }
             foreach (string _steamid in HighPingKicker.SteamId)
             {
                 SdtdConsole.Instance.Output(_steamid);
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("Error in PingImmunityCommand.Run: {0}.", e));
     }
 }
Ejemplo n.º 7
0
        public static void Load()
        {
            Timers.TimerStart();
            if (TeleportCheck.IsEnabled)
            {
                TeleportCheck.DetectionLogsDir();
            }
            if (CountryBan.IsEnabled)
            {
                CountryBan.Load();
            }
            if (FlightCheck.IsEnabled)
            {
                FlightCheck.DetectionLogsDir();
            }
            if (HatchElevator.IsEnabled)
            {
                HatchElevator.DetectionLogsDir();
            }
            if (PlayerLogs.IsEnabled)
            {
                PlayerLogs.PlayerLogsDir();
            }
            if (InventoryCheck.IsEnabled)
            {
                InventoryCheck.PlayerLogsDir();
            }
            if (Report.IsEnabled)
            {
                Report.ReportLogsDir();
            }
            if (PlayerStatCheck.IsEnabled)
            {
                PlayerStatCheck.DetectionLogsDir();
            }
            if (UndergroundCheck.IsEnabled)
            {
                UndergroundCheck.DetectionLogsDir();
            }
            if (Zones.IsEnabled)
            {
                Zones.DetectionLogsDir();
            }
            if (Bank.IsEnabled)
            {
                Bank.CreateFolder();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.CreateFolder();
            }
            if (Bounties.IsEnabled)
            {
                Bounties.CreateFolder();
            }
            if (CredentialCheck.IsEnabled)
            {
                CredentialCheck.CreateFolder();
            }
            if (DupeLog.IsEnabled)
            {
                DupeLog.CreateFolder();
            }
            PollConsole.CreateFolder();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (ClanManager.IsEnabled)
            {
                ClanManager.GetClans();
                ClanManager.BuildList();
            }
            if (!ClanManager.IsEnabled)
            {
                ClanManager.clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (UndergroundCheck.IsRunning && !UndergroundCheck.IsEnabled)
            {
                UndergroundCheck.Unload();
            }
            if (!UndergroundCheck.IsRunning && UndergroundCheck.IsEnabled)
            {
                UndergroundCheck.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled)
            {
                InventoryCheck.Unload();
            }
            if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled)
            {
                InventoryCheck.Load();
            }
            if (HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (MutePlayer.IsEnabled)
            {
                MutePlayer.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            if (Animals.IsEnabled)
            {
                Animals.AnimalList();
            }
            if (AutoShutdown.IsEnabled)
            {
                AutoShutdown.ShutdownTime();
            }
        }
Ejemplo n.º 8
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("[SERVERTOOLS] Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo != null)
             {
                 if (HighPingKicker.Dict.ContainsKey(_cInfo.playerId))
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add Id. {0} is already in the Ping Immunity list", _params[1]));
                 }
                 else
                 {
                     HighPingKicker.Dict.Add(_cInfo.playerId, _cInfo.playerName);
                     HighPingKicker.UpdateXml();
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added Id {0} to the Ping Immunity list", _params[1]));
                 }
             }
             else
             {
                 if (_params[1].Length != 17)
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Player must be online or when offline use their steam Id which must be 17 numbers in length. Can not add Id: {0}", _params[1]));
                     return;
                 }
                 else
                 {
                     PersistentPlayerData _ppd = PersistentOperations.GetPersistentPlayerDataFromSteamId(_params[1]);
                     if (_ppd != null)
                     {
                         if (HighPingKicker.Dict.ContainsKey(_ppd.PlayerId))
                         {
                             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add Id. {0} is already in the Ping Immunity list", _ppd.PlayerId));
                         }
                         else
                         {
                             PlayerDataFile _pdf = PersistentOperations.GetPlayerDataFileFromSteamId(_ppd.PlayerId);
                             if (_pdf != null)
                             {
                                 HighPingKicker.Dict.Add(_ppd.PlayerId, _pdf.ecd.entityName);
                                 HighPingKicker.UpdateXml();
                                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added Id {0}, with player name {1} to the Ping Immunity list", _params[1], _pdf.ecd.entityName));
                             }
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add Id. {0} could not be found", _params[1]));
                     }
                 }
             }
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo != null)
             {
                 if (!HighPingKicker.Dict.ContainsKey(_cInfo.playerId))
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not remove Id. {0} is not in the Ping Immunity list", _params[1]));
                 }
                 else
                 {
                     HighPingKicker.Dict.Remove(_cInfo.playerId);
                     HighPingKicker.UpdateXml();
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Removed Id {0} from the Ping Immunity list", _params[1]));
                 }
             }
             else
             {
                 if (_params[1].Length != 17)
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Player must be online to use their name or entity id. Otherwise you must use their steam Id. Can not remove Id: {0}", _params[1]));
                     return;
                 }
                 else
                 {
                     if (!HighPingKicker.Dict.ContainsKey(_params[1]))
                     {
                         SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not remove Id. {0} is not in the Ping Immunity list", _params[1]));
                     }
                     else
                     {
                         HighPingKicker.Dict.Remove(_params[1]);
                         HighPingKicker.UpdateXml();
                         SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Removed Id {0} from the Ping Immunity list", _params[1]));
                     }
                 }
             }
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             else
             {
                 if (HighPingKicker.Dict.Count == 0)
                 {
                     SdtdConsole.Instance.Output("[SERVERTOOLS] There are no players on the Ping Immunity list.");
                     return;
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] High Ping List:"));
                     foreach (KeyValuePair <string, string> _c in HighPingKicker.Dict)
                     {
                         SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Player Id {0}, player name {1}", _c.Key, _c.Value));
                     }
                 }
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in PingImmunityCommandConsole.Execute: {0}", e.Message));
     }
 }
Ejemplo n.º 9
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 3)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 to 3, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count != 3)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 3, found {0}.", _params.Count));
                 return;
             }
             if (_params[1].Length != 17)
             {
                 SdtdConsole.Instance.Output(string.Format("Can not add SteamId: Invalid SteamId {0}", _params[1]));
                 return;
             }
             if (HighPingKicker.Dict.ContainsKey(_params[1]))
             {
                 SdtdConsole.Instance.Output(string.Format("Can not add SteamId. {0} is already in the Ping Immunity list.", _params[1]));
                 return;
             }
             HighPingKicker.Dict.Add(_params[1], _params[2]);
             SdtdConsole.Instance.Output(string.Format("Added SteamId {0} with the name of {1} the Ping Immunity list.", _params[1], _params[2]));
             HighPingKicker.UpdateXml();
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             if (!HighPingKicker.Dict.ContainsKey(_params[1]))
             {
                 SdtdConsole.Instance.Output(string.Format("SteamId {0} was not found.", _params[1]));
                 return;
             }
             HighPingKicker.Dict.Remove(_params[1]);
             SdtdConsole.Instance.Output(string.Format("Removed SteamId {0} from Ping Immunity list.", _params[1]));
             HighPingKicker.UpdateXml();
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}.", _params.Count));
                 return;
             }
             if (HighPingKicker.Dict.Count < 1)
             {
                 SdtdConsole.Instance.Output("There are no steamIds on the Ping Immunity list.");
                 return;
             }
             foreach (KeyValuePair <string, string> _key in HighPingKicker.Dict)
             {
                 SdtdConsole.Instance.Output(string.Format("{0} {1}", _key.Key, _key.Value));
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in PingImmunityCommand.Run: {0}.", e));
     }
 }
Ejemplo n.º 10
0
        public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
        {
            try
            {
                if (_params[0].ToLower().Equals("add"))
                {
                    if (_params.Count != 2)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found '{0}'", _params.Count));

                        return;
                    }
                    ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
                    if (_cInfo != null)
                    {
                        if (HighPingKicker.Dict.ContainsKey(_cInfo.CrossplatformId.CombinedString))
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not add Id. '{0}' is already in the ping immunity list", _params[1]));
                        }
                        else
                        {
                            HighPingKicker.Dict.Add(_cInfo.CrossplatformId.CombinedString, _cInfo.playerName);
                            HighPingKicker.UpdateXml();
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added Id '{0}' to the ping immunity list", _params[1]));
                        }
                    }
                    else if (_params[1].Contains("_"))
                    {
                        PersistentPlayerData ppd = PersistentOperations.GetPersistentPlayerDataFromId(_params[1]);
                        if (ppd != null)
                        {
                            if (HighPingKicker.Dict.ContainsKey(ppd.UserIdentifier.CombinedString))
                            {
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not add Id. '{0}' named '{1}' is already in the ping immunity list", ppd.UserIdentifier.CombinedString, ppd.PlayerName));
                            }
                            else
                            {
                                HighPingKicker.Dict.Add(ppd.UserIdentifier.CombinedString, ppd.PlayerName);
                                HighPingKicker.UpdateXml();
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added Id '{0}' named '{1}' to the ping immunity list", ppd.UserIdentifier.CombinedString, ppd.PlayerName));
                            }
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not add Id. No data for '{0}' could not be found", _params[1]));
                        }
                    }
                }
                else if (_params[0].ToLower().Equals("remove"))
                {
                    if (_params.Count != 2)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found '{0}'", _params.Count));

                        return;
                    }
                    ClientInfo cInfo = PersistentOperations.GetClientInfoFromNameOrId(_params[1]);
                    if (cInfo != null)
                    {
                        if (!HighPingKicker.Dict.ContainsKey(cInfo.CrossplatformId.CombinedString))
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not remove Id '{0}'. It is not in the ping immunity list", _params[1]));
                        }
                        else
                        {
                            HighPingKicker.Dict.Remove(cInfo.CrossplatformId.CombinedString);
                            HighPingKicker.UpdateXml();
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Removed Id '{0}' from the ping immunity list", _params[1]));
                        }
                    }
                    else if (_params[1].Contains("_"))
                    {
                        PersistentPlayerData ppd = PersistentOperations.GetPersistentPlayerDataFromId(_params[1]);
                        if (ppd != null)
                        {
                            if (!HighPingKicker.Dict.ContainsKey(_params[1]))
                            {
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not remove Id '{0}'. It is not in the ping immunity list", _params[1]));
                            }
                            else
                            {
                                HighPingKicker.Dict.Remove(_params[1]);
                                HighPingKicker.UpdateXml();
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Removed Id {0} from the ping immunity list", _params[1]));
                            }
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not remove Id '{0}'. No data could not be found", _params[1]));
                        }
                    }
                }
                else if (_params[0].ToLower().Equals("list"))
                {
                    if (_params.Count != 1)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, found '{0}'", _params.Count));

                        return;
                    }
                    else
                    {
                        if (HighPingKicker.Dict.Count == 0)
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output("[SERVERTOOLS] There are no players on the ping immunity list");

                            return;
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] High ping immunity list:"));

                            foreach (KeyValuePair <string, string> _c in HighPingKicker.Dict)
                            {
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Id '{0}' named '{1}'", _c.Key, _c.Value));
                            }
                        }
                    }
                }
                else
                {
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid argument '{0}'", _params[0]));
                }
            }
            catch (Exception e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in PingImmunityCommandConsole.Execute: {0}", e.Message));
            }
        }
Ejemplo n.º 11
0
        public static void Load()
        {
            Timers.TimerStart();
            Timers.Timer2Start();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TypeQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (!ClanManager.IsEnabled)
            {
                ClanManager.Clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled)
            {
                InventoryCheck.Unload();
            }
            if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled)
            {
                InventoryCheck.Load();
            }
            if (HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (KillNotice.IsRunning && !KillNotice.IsEnabled)
            {
                KillNotice.Unload();
            }
            if (!KillNotice.IsRunning && KillNotice.IsEnabled)
            {
                KillNotice.Load();
            }
            if (!Prayer.IsRunning && Prayer.IsEnabled)
            {
                Prayer.Load();
            }
            if (Prayer.IsRunning && !Prayer.IsEnabled)
            {
                Prayer.Unload();
            }
            if (LoadTriggers.IsRunning)
            {
                LoadTriggers.Unload();
            }
            if (!LoadTriggers.IsRunning)
            {
                LoadTriggers.Load();
            }
            if (ProtectedSpace.IsRunning)
            {
                ProtectedSpace.Unload();
            }
            if (!ProtectedSpace.IsRunning)
            {
                ProtectedSpace.Load();
            }
            if (ClanManager.IsEnabled)
            {
                ClanManager.ClanList();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.AuctionList();
            }
            if (Mute.IsEnabled)
            {
                Mute.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            if (BattleLogger.IsEnabled && !BattleLogger.LogFound && !string.IsNullOrEmpty(Utils.GetApplicationScratchPath()))
            {
                if (!GamePrefs.GetString(EnumGamePrefs.ServerDisabledNetworkProtocols).ToLower().Contains("litenetlib"))
                {
                    BattleLogger.LogDirectory = Utils.GetApplicationScratchPath();
                    BattleLogger.ConfirmLog();
                }
                else
                {
                    Log.Out("--------------------------------------------------------------------------");
                    Log.Out("[SERVERTOOLS] Unable to verify log file. Battle_Loggers has been disabled.");
                    Log.Out("[SERVERTOOLS] Network protocol litenetlib is required for this tool.");
                    Log.Out("--------------------------------------------------------------------");
                }
            }
            PatchTools.ApplyPatches();
        }
Ejemplo n.º 12
0
        public static void Load()
        {
            Confirm.Exec();
            PatchTools.ApplyPatches();
            if (!LoadTriggers.IsRunning)
            {
                LoadTriggers.Load();
            }
            Timers.TimerStart();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TypeQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (!ClanManager.IsEnabled)
            {
                ClanManager.Clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InvalidItems.IsRunning && !InvalidItems.IsEnabled)
            {
                InvalidItems.Unload();
            }
            if (!InvalidItems.IsRunning && InvalidItems.IsEnabled)
            {
                InvalidItems.Load();
            }
            if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled)
            {
                HighPingKicker.Unload();
            }
            if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (KillNotice.IsRunning && !KillNotice.IsEnabled)
            {
                KillNotice.Unload();
            }
            if (!KillNotice.IsRunning && KillNotice.IsEnabled)
            {
                KillNotice.Load();
            }
            if (Prayer.IsRunning && !Prayer.IsEnabled)
            {
                Prayer.Unload();
            }
            if (!Prayer.IsRunning && Prayer.IsEnabled)
            {
                Prayer.Load();
            }
            if (BloodmoonWarrior.IsRunning && !BloodmoonWarrior.IsEnabled)
            {
                BloodmoonWarrior.Unload();
            }
            if (!BloodmoonWarrior.IsRunning && BloodmoonWarrior.IsEnabled)
            {
                BloodmoonWarrior.Load();
            }
            if (ProtectedSpaces.IsRunning && !ProtectedSpaces.IsEnabled)
            {
                ProtectedSpaces.Unload();
            }
            if (!ProtectedSpaces.IsRunning && ProtectedSpaces.IsEnabled)
            {
                ProtectedSpaces.Load();
            }
            if (ClanManager.IsEnabled)
            {
                ClanManager.ClanList();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.AuctionList();
            }
            if (Mute.IsEnabled)
            {
                Mute.ClientMuteList();
                Mute.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            //always load the website last
            if (WebsiteServer.IsEnabled && !WebsiteServer.DirFound)
            {
                WebsiteServer.CheckDir();
            }
            if (WebsiteServer.IsRunning && !WebsiteServer.IsEnabled)
            {
                WebsiteServer.Unload();
            }
            if (!WebsiteServer.IsRunning && WebsiteServer.IsEnabled && WebsiteServer.DirFound)
            {
                WebsiteServer.Load();
            }
        }