public static void Init(object sender, ElapsedEventArgs e) { if (FlightCheck.IsEnabled) { if ((int)GameManager.Instance.fps.Counter > 5) { FlightCheck.AutoFlightCheck(); } } if (HatchElevator.IsEnabled) { HatchElevator.AutoHatchCheck(); } if (UndergroundCheck.IsEnabled) { if ((int)GameManager.Instance.fps.Counter > 5) { UndergroundCheck.AutoUndergroundCheck(); } } if (Jail.IsEnabled) { Jail.StatusCheck(); } if (Bounties.IsEnabled || KillNotice.IsEnabled || DeathSpot.IsEnabled || Zones.IsEnabled || Event.Open) { Players.Exec(); } if (Jail.Jailed.Count > 0) { _jR++; if (_jR >= 60) { _jR = 0; Jail.Clear(); } } else { _jR = 0; } if (WeatherVote.IsEnabled) { if (WeatherVote.VoteOpen) { _wV++; if (_wV >= 30) { _wV = 0; WeatherVote.CallForVote2(); } } } else { _wV = 0; } if (MutePlayer.IsEnabled && MutePlayer.Mutes.Count > 0) { _mC++; if (_mC >= 60) { _mC = 0; MutePlayer.Clear(); } } else { _mC = 0; } if (RealWorldTime.IsEnabled) { _rWT++; if (_rWT >= Real_Time_Delay * 60) { _rWT = 0; RealWorldTime.Time(); } } else { _rWT = 0; } if (Lottery.IsEnabled && Lottery.OpenLotto) { _l++; if (_l == 3300) { Lottery.Alert(); } if (_l >= 3600) { _l = 0; Lottery.StartLotto(); } } else { _l = 0; } if (RestartVote.IsEnabled) { if (RestartVote.VoteOpen) { _rV++; if (_rV >= 30) { _rV = 0; RestartVote.CallForVote2(); } } } else { _rV = 0; } if (NightVote.IsEnabled) { if (NightVote.VoteOpen) { _nV++; if (_nV >= 30) { _nV = 0; NightVote.VoteCount(); } } } else { _nV = 0; } if (MuteVote.IsEnabled) { if (MuteVote.VoteOpen) { _mV++; if (_mV >= 30) { _mV = 0; MuteVote.VoteCount(); } } } else { _mV = 0; } if (KickVote.IsEnabled) { if (KickVote.VoteOpen) { _kV++; if (_kV >= 30) { _kV = 0; KickVote.VoteCount(); } } } else { _kV = 0; } if (Hordes.IsEnabled) { _h++; if (_h >= 1200) { _h = 0; Hordes.Exec(); } } else { _h = 0; } if (EntityCleanup.IsEnabled && (EntityCleanup.BlockIsEnabled || EntityCleanup.FallingTreeEnabled || EntityCleanup.Underground || EntityCleanup.Bikes)) { _eC++; if (_eC >= 10) { _eC = 0; EntityCleanup.EntityCheck(); } } else { _eC = 0; } if (Zones.IsEnabled) { _rE++; if (_rE >= 5) { _rE = 0; EntityCleanup.ZombieCheck(); } } else { _rE = 0; } if (NightAlert.IsEnabled) { _nA++; if (_nA >= Night_Time_Delay * 60) { _nA = 0; NightAlert.Exec(); } } else { _nA = 0; } if (Watchlist.IsEnabled) { _wL++; if (_wL >= Alert_Delay * 60) { _wL = 0; Watchlist.CheckWatchlist(); } } else { _wL = 0; } if (PlayerStatCheck.IsEnabled) { _pSC++; if (_pSC >= 2) { _pSC = 0; PlayerStatCheck.PlayerStat(); } } else { _pSC = 0; } if (ReservedSlots.IsEnabled) { _rS++; if (_rS >= 120) { _rS = 0; int _playerCount = ConnectionManager.Instance.ClientCount(); if (_playerCount >= API.MaxPlayers - ReservedSlots.Admin_Slots) { ReservedSlots.OpenSlot(); } } } else { _rS = 0; } if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show) { if (Auto_Show_Bloodmoon_Delay > 0) { _b++; if (_b >= Auto_Show_Bloodmoon_Delay * 60) { _b = 0; Bloodmoon.StatusCheck(); } } } else { _b = 0; } if (PlayerLogs.IsEnabled & Player_Log_Interval > 0) { _pL++; if (_pL >= Player_Log_Interval) { _pL = 0; PlayerLogs.Exec(); } } else { _pL = 0; } if (StopServer.stopServerCountingDown) { _sSCD++; if (_sSCD == 60) { _sSCD = 0; _sSC--; } if (_sSC == 0) { _sSCD = 0; StopServer.stopServerCountingDown = false; StopServer.Stop(); } if (_sSC == 1 && _sSCD == 0) { StopServer.StartShutdown3(); } if (_sSC > 1 && _sSCD == 0) { StopServer.StartShutdown2(_sSC); } if (StopServer.Kick_30_Seconds) { if (_sSC == 1 && _sSCD == 30) { StopServer.Kick30(); } } if (StopServer.Ten_Second_Countdown) { if (_sSC == 1 && _sSCD == 50) { StopServer.StartShutdown4(); } if (_sSC == 1 && _sSCD == 55) { StopServer.StartShutdown5(); } if (_sSC == 1 && _sSCD == 56) { StopServer.StartShutdown6(); } if (_sSC == 1 && _sSCD == 57) { StopServer.StartShutdown7(); } if (_sSC == 1 && _sSCD == 58) { StopServer.StartShutdown8(); } if (_sSC == 1 && _sSCD == 59) { StopServer.StartShutdown9(); } } } else { _sSCD = 0; _sSC = 0; } if (AutoSaveWorld.IsEnabled & Delay_Between_World_Saves > 0) { _wSD++; if (_wSD >= Delay_Between_World_Saves * 60) { _wSD = 0; AutoSaveWorld.Save(); } } else { _wSD = 0; } if (AutoShutdown.IsEnabled && !AutoShutdown.Bloodmoon && !StopServer.stopServerCountingDown) { _sD++; if (!Event.Open && _sD >= Shutdown_Delay * 60) { _sD = 0; AutoShutdown.CheckBloodmoon(); } } else { _sD = 0; } if (AutoShutdown.Bloodmoon) { _aSB++; if (_aSB >= 1800) { _aSB = 0; AutoShutdown.CheckBloodmoon(); } } else { _aSB = 0; } if (InfoTicker.IsEnabled) { _iT++; if (_iT >= Infoticker_Delay * 60) { _iT = 0; InfoTicker.StatusCheck(); } } else { _iT = 0; } if (WorldRadius.IsEnabled) { _wR++; if (_wR >= 2) { _wR = 0; WorldRadius.Exec(); } } else { _wR = 0; } if (VoteReward.IsEnabled && VoteReward.QueOpen) { _vR++; if (_vR >= 60) { _vR = 0; VoteReward.que.Clear(); VoteReward.QueOpen = false; VoteReward.RewardOpen = true; } } else { _vR = 0; } if (Event.Invited) { _eI++; if (_eI >= 900) { _eI = 0; Event.Invited = false; Event.CheckOpen(); } } else { _eI = 0; } if (Event.Open) { _eO++; if (_eO == _eventTime / 2) { Event.HalfTime(); } if (_eO == _eventTime - 300) { Event.FiveMin(); } if (_eO >= _eventTime) { _eO = 0; Event.EndEvent(); } } else { _eO = 0; } if (RestartVote.Startup) { _rVS++; if (_rVS >= 1800) { RestartVote.Startup = false; } } else { _rVS = 0; } if (Zones.IsEnabled & Zones.reminder.Count > 0) { _zR++; if (_zR >= Zones.Reminder_Delay) { _zR = 0; Zones.Reminder(); } } else { _zR = 0; } }
public static void PlayerCheck() { if (!IsRunning2) { IsRunning2 = true; if (ConnectionManager.Instance.ClientCount() > 0) { List <EntityPlayer> EntityPlayerList = GameManager.Instance.World.Players.list; for (int i = 0; i < EntityPlayerList.Count; i++) { EntityPlayer _player = EntityPlayerList[i]; if (_player != null) { ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForEntityId(_player.entityId); if (_cInfo != null) { if (!_player.IsDead() && _player.Spawned) { if (Zones.IsEnabled) { Zones.ZoneCheck(_cInfo, _player); } if (GodModeFlight.IsEnabled) { GodModeFlight.GodFlightCheck(_cInfo); } } else if (_player.IsDead()) { if (!Died.Contains(_player.entityId)) { Died.Add(_player.entityId); if (KillNotice.IsEnabled || Bounties.IsEnabled || Zones.IsEnabled) { for (int j = 0; j < EntityPlayerList.Count; j++) { EntityPlayer _player2 = EntityPlayerList[j]; if (_player != _player2) { ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForEntityId(_player2.entityId); if (_cInfo2 != null) { Entity _target = _player2.GetDamagedTarget(); if (_player == _target) { if (KillNotice.IsEnabled) { string _holdingItem = _player2.inventory.holdingItem.Name; ItemValue _itemValue = ItemClass.GetItem(_holdingItem, true); if (_itemValue.type != ItemValue.None.type) { _holdingItem = _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.Name; } KillNotice.Notice(_cInfo, _cInfo2, _holdingItem); } if (Bounties.IsEnabled) { Bounties.PlayerKilled(_player, _player2, _cInfo, _cInfo2); } if (Zones.IsEnabled) { Zones.Check(_cInfo, _cInfo2); } break; } } } } } if (DeathSpot.IsEnabled) { DeathSpot.PlayerKilled(_player); } if (Wallet.IsEnabled && Wallet.Lose_On_Death) { string _sql = string.Format("SELECT playerSpentCoins FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); int _playerSpentCoins; int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _playerSpentCoins); _result.Dispose(); int _currentCoins = Wallet.GetcurrentCoins(_cInfo); if (_currentCoins >= 1) { _sql = string.Format("UPDATE Players SET playerSpentCoins = {0} WHERE steamid = '{1}'", _playerSpentCoins - _currentCoins, _cInfo.playerId); SQL.FastQuery(_sql, "Players"); } } if (Event.Open && Event.PlayersTeam.ContainsKey(_cInfo.playerId)) { string _sql = string.Format("UPDATE Players SET eventReturn = 'true' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "Players"); } } } } } } } IsRunning2 = false; } }
public static void Exec() { DP = false; List <EntityPlayer> _playerList = GameManager.Instance.World.Players.list; for (int i = 0; i < _playerList.Count; i++) { EntityPlayer _player = _playerList[i]; if (_player != null) { ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForEntityId(_player.entityId); if (_cInfo != null) { if (_player.IsDead()) { DP = true; if (!Dead.Contains(_player.entityId)) { Dead.Add(_player.entityId); if (Event.Open && Event.PlayersTeam.ContainsKey(_cInfo.playerId)) { string _sql = string.Format("UPDATE Players SET eventRespawn = 'true' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); } if (!DeathTime.ContainsKey(_player.entityId)) { Vector3 _position = _player.GetPosition(); int x = (int)_position.x; int y = (int)_position.y; int z = (int)_position.z; string _dposition = x + "," + y + "," + z; DeathTime.Add(_player.entityId, DateTime.Now); LastDeathPos.Add(_player.entityId, _dposition); } else { Vector3 _position = _player.GetPosition(); int x = (int)_position.x; int y = (int)_position.y; int z = (int)_position.z; string _dposition = x + "," + y + "," + z; DeathTime[_player.entityId] = DateTime.Now; LastDeathPos[_player.entityId] = _dposition; } for (int j = 0; j < _playerList.Count; j++) { EntityPlayer _player2 = _playerList[j]; Entity _target = _player2.GetDamagedTarget(); if (_target == _player && _player != _player2) { _player2.ClearDamagedTarget(); ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForEntityId(_player2.entityId); if (_cInfo != null && _cInfo2 != null) { if (KillNotice.IsEnabled) { string _holdingItem = _player2.inventory.holdingItem.Name; ItemValue _itemValue = ItemClass.GetItem(_holdingItem, true); if (_itemValue.type != ItemValue.None.type) { _holdingItem = _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.Name; } KillNotice.Notice(_cInfo, _cInfo2, _holdingItem); } if (Bounties.IsEnabled) { if (!_player.IsFriendsWith(_player2) && !_player2.IsFriendsWith(_player)) { if (ClanManager.IsEnabled) { if (ClanManager.ClanMember.Contains(_cInfo.playerId) && ClanManager.ClanMember.Contains(_cInfo2.playerId)) { string _sql1 = string.Format("SELECT clanname FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result1 = SQL.TQuery(_sql1); string _clanName = _result1.Rows[0].ItemArray.GetValue(0).ToString(); _result1.Dispose(); _sql1 = string.Format("SELECT clanname FROM Players WHERE steamid = '{0}'", _cInfo2.playerId); DataTable _result2 = SQL.TQuery(_sql1); string _clanName2 = _result2.Rows[0].ItemArray.GetValue(0).ToString(); _result2.Dispose(); Player p2 = PersistentContainer.Instance.Players[_cInfo2.playerId, false]; if (_clanName != "Unknown" && _clanName2 != "Unknown") { if (_clanName == _clanName2) { return; } } } } string _sql = string.Format("SELECT bounty, bountyHunter FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); int _bounty; int _hunterCountVictim; int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _bounty); int.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _hunterCountVictim); _result.Dispose(); if (_bounty > 0) { _sql = string.Format("SELECT playerSpentCoins, bountyHunter FROM Players WHERE steamid = '{0}'", _cInfo2.playerId); DataTable _result2 = SQL.TQuery(_sql); int _playerSpentCoins; int _hunterCountKiller; int.TryParse(_result2.Rows[0].ItemArray.GetValue(0).ToString(), out _playerSpentCoins); int.TryParse(_result2.Rows[0].ItemArray.GetValue(1).ToString(), out _hunterCountKiller); _result2.Dispose(); if (Bounties.Bonus > 0 && _hunterCountVictim >= Bounties.Bonus) { _sql = string.Format("UPDATE Players SET playerSpentCoins = {0}, bountyHunter = {1} WHERE steamid = '{2}'", _playerSpentCoins + _bounty + Bounties.Bonus, _hunterCountKiller + 1, _cInfo2.playerId); SQL.FastQuery(_sql); } else { _sql = string.Format("UPDATE Players SET playerSpentCoins = {0}, bountyHunter = {1} WHERE steamid = '{2}'", _playerSpentCoins + _bounty, _hunterCountKiller + 1, _cInfo2.playerId); SQL.FastQuery(_sql); } _sql = string.Format("UPDATE Players SET bounty = 0, bountyHunter = 0 WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); string _phrase912; if (!Phrases.Dict.TryGetValue(912, out _phrase912)) { _phrase912 = "{PlayerName} is a bounty hunter! {Victim} was snuffed out."; } _phrase912 = _phrase912.Replace("{PlayerName}", _cInfo2.playerName); _phrase912 = _phrase912.Replace("{Victim}", _cInfo.playerName); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase912, -1, LoadConfig.Server_Response_Name, EChatType.Global, null); using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: {1} is a bounty hunter! {2} was snuffed out. Bounty was worth {3}", DateTime.Now, _cInfo2.playerName, _cInfo.playerName, _bounty)); sw.WriteLine(); sw.Flush(); sw.Close(); } } if (Bounties.Kill_Streak > 0) { if (KillStreak.ContainsKey(_cInfo.entityId)) { KillStreak.Remove(_cInfo.entityId); using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: Player {1} kill streak has come to an end by {2}.", DateTime.Now, _cInfo.playerName, _cInfo2.playerName)); sw.WriteLine(); sw.Flush(); sw.Close(); } } if (KillStreak.ContainsKey(_cInfo2.entityId)) { int _value; if (KillStreak.TryGetValue(_cInfo2.entityId, out _value)) { int _newValue = _value + 1; KillStreak[_cInfo2.entityId] = _newValue; if (_newValue == Bounties.Kill_Streak) { string _phrase913; if (!Phrases.Dict.TryGetValue(913, out _phrase913)) { _phrase913 = "{PlayerName} is on a kill streak! Their bounty has increased."; } _phrase913 = _phrase913.Replace("{PlayerName}", _cInfo2.playerName); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase913, -1, LoadConfig.Server_Response_Name, EChatType.Global, null); } if (_newValue >= Bounties.Kill_Streak) { _sql = string.Format("SELECT bounty FROM Players WHERE steamid = '{0}'", _cInfo2.playerId); DataTable _result3 = SQL.TQuery(_sql); int _oldBounty; int.TryParse(_result3.Rows[0].ItemArray.GetValue(0).ToString(), out _oldBounty); _result3.Dispose(); _sql = string.Format("UPDATE Players SET bounty = {0} WHERE steamid = '{1}'", _oldBounty + Bounties.Bonus, _cInfo.playerId); SQL.FastQuery(_sql); using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: {1} is on a kill streak of {2}. Their bounty has increased.", DateTime.Now, _cInfo2.playerName, _newValue)); sw.WriteLine(); sw.Flush(); sw.Close(); } } } } else { KillStreak.Add(_cInfo2.entityId, 1); } } } } if (Zones.IsEnabled) { Zones.Check(_cInfo2, _cInfo); } } } } if (Wallet.IsEnabled && Wallet.Lose_On_Death) { World world = GameManager.Instance.World; string _sql = string.Format("SELECT playerSpentCoins FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); int _playerSpentCoins; int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _playerSpentCoins); _result.Dispose(); int _currentCoins = Wallet.GetcurrentCoins(_cInfo); if (_currentCoins >= 1) { _sql = string.Format("UPDATE Players SET playerSpentCoins = {0} WHERE steamid = '{1}'", _playerSpentCoins - _currentCoins, _cInfo.playerId); SQL.FastQuery(_sql); } } if (Event.Open && Event.PlayersTeam.ContainsKey(_cInfo.playerId)) { string _sql = string.Format("UPDATE Players SET eventReturn = 'true' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql); } } } else { if (Zones.IsEnabled) { ZoneCheck(_cInfo, _player); } } } } } if (!DP) { _counter++; if (_counter >= 6) { _counter = 0; for (int i = 0; i < _playerList.Count; i++) { EntityPlayer _player = _playerList[i]; if (_player != null) { _player.ClearDamagedTarget(); } } } } else { _counter = 0; } }
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(); } }
private static bool GameMessage(ClientInfo _cInfo, EnumGameMessages _type, string _msg, string _mainName, bool _localizeMain, string _secondaryName, bool _localizeSecondary) { try { if (_type == EnumGameMessages.EntityWasKilled && _cInfo != null) { EntityPlayer _player1 = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player1 != null) { bool _notice = false; if (!string.IsNullOrEmpty(_secondaryName) && _mainName != _secondaryName) { ClientInfo _cInfo2 = ConsoleHelper.ParseParamIdOrName(_secondaryName); if (_cInfo2 != null) { EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo2.entityId]; if (_player2 != null) { if (KillNotice.IsEnabled && _player2.IsAlive()) { string _holdingItem = _player2.inventory.holdingItem.Name; if (!string.IsNullOrEmpty(_holdingItem)) { ItemValue _itemValue = ItemClass.GetItem(_holdingItem, true); if (_itemValue.type != ItemValue.None.type) { _holdingItem = _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.GetItemName(); KillNotice.Notice(_cInfo, _cInfo2, _holdingItem); _notice = true; } } } if (Zones.IsEnabled) { Zones.Check(_cInfo, _cInfo2); } if (Bounties.IsEnabled) { Bounties.PlayerKilled(_player1, _player2, _cInfo, _cInfo2); } if (Wallet.IsEnabled) { if (Wallet.PVP && Wallet.Player_Kills > 0) { Wallet.AddCoinsToWallet(_cInfo2.playerId, Wallet.Player_Kills); } else if (Wallet.Player_Kills > 0) { Wallet.SubtractCoinsFromWallet(_cInfo2.playerId, Wallet.Player_Kills); } } } } } if (DeathSpot.IsEnabled) { DeathSpot.PlayerKilled(_player1); } if (Event.Open && Event.PlayersTeam.ContainsKey(_cInfo.playerId)) { string _sql = string.Format("UPDATE Players SET eventReturn = 'true' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "Players"); } if (_notice) { return(false); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in API.GameMessage: {0}.", e.Message)); } return(true); }
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(); } }
private static void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)//Spawning player { try { if (_cInfo != null) { string id = _cInfo.CrossplatformId.CombinedString; EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId); if (player != null) { if (_respawnReason == RespawnType.NewGame) { if (player.distanceWalked < 1 && player.totalTimePlayed <= 1 && !PersistentOperations.NewPlayerQue.Contains(_cInfo)) { PersistentOperations.NewPlayerQue.Add(_cInfo); } } else if (_respawnReason == RespawnType.LoadedGame) { } else if (_respawnReason == RespawnType.EnterMultiplayer) { PersistentOperations.SessionTime(_cInfo); PersistentContainer.Instance.Players[id].PlayerName = _cInfo.playerName; PersistentContainer.Instance.Players[id].LastJoined = DateTime.Now; PersistentContainer.DataChange = true; if (player.AttachedToEntity != null) { player.Detach(); } if (player.distanceWalked < 1 && player.totalTimePlayed <= 1 && !PersistentOperations.NewPlayerQue.Contains(_cInfo)) { PersistentOperations.NewPlayerQue.Add(_cInfo); } else { OldPlayerJoined(_cInfo, player); } } else if (_respawnReason == RespawnType.JoinMultiplayer) { PersistentOperations.SessionTime(_cInfo); PersistentContainer.Instance.Players[id].PlayerName = _cInfo.playerName; PersistentContainer.Instance.Players[id].LastJoined = DateTime.Now; PersistentContainer.DataChange = true; if (player.AttachedToEntity != null) { player.Detach(); } if (player.distanceWalked < 1 && player.totalTimePlayed <= 1 && !PersistentOperations.NewPlayerQue.Contains(_cInfo)) { PersistentOperations.NewPlayerQue.Add(_cInfo); } else { OldPlayerJoined(_cInfo, player); } } else if (_respawnReason == RespawnType.Died) { if (player.AttachedToEntity != null) { player.Detach(); } if (Zones.IsEnabled && Zones.ZonePlayer.ContainsKey(_cInfo.entityId)) { Zones.ZonePlayer.TryGetValue(player.entityId, out string[] zone); Zones.ZonePlayer.Remove(player.entityId); Zones.Reminder.Remove(player.entityId); if (zone[9] != PersistentOperations.Player_Killing_Mode.ToString()) { _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageConsoleCmdClient>().Setup(string.Format("sgs PlayerKillingMode {0}", PersistentOperations.Player_Killing_Mode), true)); } if (Zones.Zone_Message && zone[5] != "") { ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + zone[5] + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } if (zone[7] != "") { Zones.ProcessCommand(_cInfo, zone[7]); } } if (InfiniteAmmo.IsEnabled && InfiniteAmmo.Dict.ContainsKey(_cInfo.entityId)) { InfiniteAmmo.Dict.Remove(_cInfo.entityId); } if (Bloodmoon.IsEnabled && Bloodmoon.Show_On_Respawn) { Bloodmoon.Exec(_cInfo); } } else if (_respawnReason == RespawnType.Teleport) { if (Teleportation.Teleporting.Contains(_cInfo.entityId)) { Teleportation.Teleporting.Remove(_cInfo.entityId); } } if (PlayerChecks.TwoSecondMovement.ContainsKey(_cInfo.entityId)) { PlayerChecks.TwoSecondMovement.Remove(_cInfo.entityId); } if (FlyingDetector.Flags.ContainsKey(_cInfo.entityId)) { FlyingDetector.Flags.Remove(_cInfo.entityId); } if (SpeedDetector.Flags.ContainsKey(_cInfo.entityId)) { SpeedDetector.Flags.Remove(_cInfo.entityId); } } if (ExitCommand.IsEnabled && !ExitCommand.Players.ContainsKey(_cInfo.entityId) && (GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo.PlatformId) > ExitCommand.Admin_Level && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo.CrossplatformId) > ExitCommand.Admin_Level)) { ExitCommand.Players.Add(_cInfo.entityId, player.position); } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerSpawnedInWorld: {0}", e.Message)); } }
private static void Init7(string _playerId, List <string> _commands) { Zones.ZoneCommandDelayed(_playerId, _commands); }
public static void LoadXml() { if (!Utils.FileExists(filePath)) { UpdateXml(); } XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load(filePath); } catch (XmlException e) { Log.Error(string.Format("[SERVERTOOLS] Failed loading {0}: {1}", file, e.Message)); return; } XmlNode _XmlNode = xmlDoc.DocumentElement; foreach (XmlNode childNode in _XmlNode.ChildNodes) { if (childNode.Name == "Zone") { Box1.Clear(); Box2.Clear(); ReminderMsg.Clear(); Reminder.Clear(); ZoneExit.Clear(); ZonePvE.Clear(); foreach (XmlNode subChild in childNode.ChildNodes) { if (subChild.NodeType == XmlNodeType.Comment) { continue; } if (subChild.NodeType != XmlNodeType.Element) { Log.Warning(string.Format("[SERVERTOOLS] Unexpected XML node found in 'Zone' section: {0}", subChild.OuterXml)); continue; } XmlElement _line = (XmlElement)subChild; if (!_line.HasAttribute("Corner1")) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because of missing Corner1 attribute: {0}", subChild.OuterXml)); continue; } if (!_line.HasAttribute("Corner2")) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because of missing Corner2 attribute: {0}", subChild.OuterXml)); continue; } if (!_line.HasAttribute("EntryMessage")) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because of missing EntryMessage attribute: {0}", subChild.OuterXml)); continue; } if (!_line.HasAttribute("ExitMessage")) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because of missing ExitMessage attribute: {0}", subChild.OuterXml)); continue; } if (!_line.HasAttribute("Response")) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because of missing Response attribute: {0}", subChild.OuterXml)); continue; } if (!_line.HasAttribute("ReminderNotice")) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because of missing ReminderNotice attribute: {0}", subChild.OuterXml)); continue; } if (!_line.HasAttribute("Circle")) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because of missing Circle attribute: {0}", subChild.OuterXml)); continue; } if (!_line.HasAttribute("PvE")) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because of missing PvE attribute: {0}", subChild.OuterXml)); continue; } if (!_line.HasAttribute("NoZombie")) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because of missing NoZombie attribute: {0}", subChild.OuterXml)); continue; } if (!_line.HasAttribute("Protected")) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because of missing Protected attribute: {0}", subChild.OuterXml)); continue; } else { bool _result1, _result2, _result3, _result4; string _circle = _line.GetAttribute("Circle"); if (!bool.TryParse(_circle, out _result1)) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because improper True/False for Circle attribute: {0}.", subChild.OuterXml)); continue; } string _pve = _line.GetAttribute("PvE"); if (!bool.TryParse(_pve, out _result2)) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because improper True/False for PvE attribute: {0}.", subChild.OuterXml)); continue; } string _noZ = _line.GetAttribute("NoZombie"); if (!bool.TryParse(_noZ, out _result3)) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because improper True/False for NoZombie attribute: {0}.", subChild.OuterXml)); continue; } string _protect = _line.GetAttribute("Protected"); if (!bool.TryParse(_protect, out _result4)) { Log.Warning(string.Format("[SERVERTOOLS] Ignoring Zones entry because improper True/False for Protected attribute: {0}.", subChild.OuterXml)); continue; } string[] box1 = { _line.GetAttribute("Corner1"), _line.GetAttribute("Corner2"), _line.GetAttribute("EntryMessage"), _line.GetAttribute("ExitMessage"), _line.GetAttribute("Response"), _line.GetAttribute("ReminderNotice") }; bool[] box2 = { _result1, _result2, _result3, _result4 }; if (!Box1.Contains(box1)) { Box1.Add(box1); Box2.Add(box2); if (_result4) { if (!_result1) { string[] _corner1 = box1[0].Split(','); string[] _corner2 = box1[1].Split(','); string[] _vectors = { _corner1[0], _corner1[2], _corner2[0], _corner2[2] }; Zones.AddProtection(_vectors); } else { //Add circle protection later } } } } } } } }
public static void AddProtection(string[] _vectors) { try { int _xMin = int.Parse(_vectors[0]), _zMin = int.Parse(_vectors[1]), _xMax = int.Parse(_vectors[2]), _zMax = int.Parse(_vectors[3]); int _xMinAlt = _xMin, _zMinAlt = _zMin, _xMaxAlt = _xMax, _zMaxAlt = _zMax; if (_xMin > _xMax) { _xMinAlt = _xMax; _xMaxAlt = _xMin; } if (_zMin > _zMax) { _zMinAlt = _zMax; _zMaxAlt = _zMin; } List <Chunk> _chunkList = new List <Chunk>(); string[] _vectorsAlt = { _xMinAlt.ToString(), _zMinAlt.ToString(), _xMaxAlt.ToString(), _zMaxAlt.ToString() }; if (!Zones.ProtectedList.Contains(_vectorsAlt)) { Zones.ProtectedList.Add(_vectorsAlt); for (int i = _xMinAlt; i <= _xMaxAlt; i++) { for (int j = _zMinAlt; j <= _zMaxAlt; j++) { if (GameManager.Instance.World.IsChunkAreaLoaded(i, 1, j)) { Chunk _chunk = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos(i, 1, j); if (!_chunkList.Contains(_chunk)) { _chunkList.Add(_chunk); } Bounds bounds = _chunk.GetAABB(); int _x = i - (int)bounds.min.x, _z = j - (int)bounds.min.z; _chunk.SetTraderArea(_x, _z, true); } else { continue; } } } if (_chunkList.Count > 0) { for (int k = 0; k < _chunkList.Count; k++) { Chunk _chunk = _chunkList[k]; List <ClientInfo> _clientList = PersistentOperations.ClientList(); if (_clientList != null && _clientList.Count > 0) { for (int l = 0; l < _clientList.Count; l++) { ClientInfo _cInfo2 = _clientList[l]; if (_cInfo2 != null) { _cInfo2.SendPackage(NetPackageManager.GetPackage <NetPackageChunk>().Setup(_chunk, true)); } } } } } Zones.UpdateXml(); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Zones.AddProtection: {0}", e.Message)); } }
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(); }
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(); } }
public static void ZoneCheck(ClientInfo _cInfo, EntityPlayer _player) { if (Zones.Box1.Count > 0) { int _flagCount = 0; int _X = (int)_player.position.x; int _Y = (int)_player.position.y; int _Z = (int)_player.position.z; for (int i = 0; i < Zones.Box1.Count; i++) { string[] _box = Zones.Box1[i]; bool[] _box2 = Zones.Box2[i]; if (Zones.BoxCheck(_box, _X, _Y, _Z, _box2)) { if (!Zones.ZoneExit.ContainsKey(_player.entityId)) { for (int j = 0; j < Zones.Box1.Count; j++) { string[] _box3 = Zones.Box1[j]; bool[] _box4 = Zones.Box2[j]; if (Zones.BoxCheck(_box3, _X, _Y, _Z, _box4)) { Zones.ZoneExit.Add(_player.entityId, _box3[3]); if (_box4[1]) { ZonePvE.Add(_player.entityId); } if (Zones.Zone_Message) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _box3[2] + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } if (_box3[4] != "") { Zones.Response(_cInfo, _box3[4]); } Zones.reminder.Add(_player.entityId, DateTime.Now); Zones.reminderMsg.Add(_player.entityId, _box3[5]); return; } } } else { string _exitMsg; if (Zones.ZoneExit.TryGetValue(_player.entityId, out _exitMsg)) { if (_exitMsg != _box[3]) { for (int j = 0; j < Zones.Box1.Count; j++) { string[] _box3 = Zones.Box1[j]; bool[] _box4 = Zones.Box2[j]; if (Zones.BoxCheck(_box3, _X, _Y, _Z, _box4)) { Zones.ZoneExit[_player.entityId] = _box3[3]; if (_box4[1]) { if (!ZonePvE.Contains(_player.entityId)) { ZonePvE.Add(_player.entityId); } } else { if (ZonePvE.Contains(_player.entityId)) { ZonePvE.Remove(_player.entityId); } } if (Zones.Zone_Message) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _box3[2] + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } if (_box3[4] != "") { Zones.Response(_cInfo, _box3[4]); } Zones.reminder[_player.entityId] = DateTime.Now; Zones.reminderMsg[_player.entityId] = _box3[5]; return; } } } else { return; } } } } else { _flagCount++; if (_flagCount == Zones.Box1.Count && Zones.ZoneExit.ContainsKey(_player.entityId)) { if (Zones.Zone_Message) { string _msg; if (Zones.ZoneExit.TryGetValue(_player.entityId, out _msg)) { if (_msg != "") { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _msg + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } Zones.ZoneExit.Remove(_player.entityId); if (ZonePvE.Contains(_player.entityId)) { ZonePvE.Remove(_player.entityId); } Zones.reminder.Remove(_player.entityId); Zones.reminderMsg.Remove(_player.entityId); } } } } }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { try { var _cInfo = _senderInfo.RemoteClientInfo; if (_cInfo != null) { if (_params[0].ToLower().Equals("off")) { Zones.IsEnabled = false; LoadConfig.WriteXml(); SdtdConsole.Instance.Output(string.Format("Zones has been set to off")); return; } else if (_params[0].ToLower().Equals("on")) { Zones.IsEnabled = true; LoadConfig.WriteXml(); SdtdConsole.Instance.Output(string.Format("Zones has been set to on")); return; } else if (_params[0].ToLower().Equals("new")) { if (newZone.ContainsKey(_cInfo.entityId)) { newZone[_cInfo.entityId] = 1; } else { newZone.Add(_cInfo.entityId, 1); } if (Zones.zoneSetup1.ContainsKey(_cInfo.entityId)) { Zones.zoneSetup1.Remove(_cInfo.entityId); } if (Zones.zoneSetup2.ContainsKey(_cInfo.entityId)) { Zones.zoneSetup2.Remove(_cInfo.entityId); } string[] _strings = { "", "", "", "", "", "" }; bool[] _bools = { false, false, false }; Zones.zoneSetup1.Add(_cInfo.entityId, _strings); Zones.zoneSetup2.Add(_cInfo.entityId, _bools); SdtdConsole.Instance.Output(string.Format("Stand at the first corner of the zone and type zone save.")); SdtdConsole.Instance.Output(string.Format("If you would like a circle, stand in the middle of the circle and type zone circle.")); } else if (_params[0].ToLower().Equals("list")) { if (Zones.Box1.Count > 0) { for (int i = 0; i < Zones.Box1.Count; i++) { string[] _box = Zones.Box1[i]; bool[] _box2 = Zones.Box2[i]; if (_box != null) { SdtdConsole.Instance.Output(string.Format("Zone number {0}:", i)); SdtdConsole.Instance.Output(string.Format("Corner 1 = {0}", _box[0])); SdtdConsole.Instance.Output(string.Format("Corner 2 = {0}", _box[1])); SdtdConsole.Instance.Output(string.Format("Entry message = {0}", _box[2])); SdtdConsole.Instance.Output(string.Format("Exit message = {0}", _box[3])); SdtdConsole.Instance.Output(string.Format("Response = {0}", _box[4])); SdtdConsole.Instance.Output(string.Format("Reminder Notice = {0}", _box[5])); SdtdConsole.Instance.Output(string.Format("Circle = {0}", _box2[0])); SdtdConsole.Instance.Output(string.Format("PvE = {0}", _box2[1])); SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _box2[2])); SdtdConsole.Instance.Output(string.Format("")); } } } else { SdtdConsole.Instance.Output(string.Format("There are no zones setup.")); } } else if (_params[0].ToLower().Equals("delete")) { if (Zones.Box1.Count > 0) { int _number; if (int.TryParse(_params[1], out _number)) { Zones.Box1.RemoveAt(_number); Zones.Box2.RemoveAt(_number); Zones.UpdateXml(); SdtdConsole.Instance.Output(string.Format("Removed zone entry number {0} from the list.", _number)); } else { SdtdConsole.Instance.Output(string.Format("Invalid format or non numeric entry. Type zone delete <number> from the list of zones.")); } } else { SdtdConsole.Instance.Output(string.Format("There are no zones setup.")); } } else if (_params[0].ToLower().Equals("circle")) { if (newZone.ContainsKey(_cInfo.entityId)) { int _stage; newZone.TryGetValue(_cInfo.entityId, out _stage); if (_stage == 1) { bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); _bools[0] = true; Zones.zoneSetup2[_cInfo.entityId] = _bools; 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 _sposition = x + "," + y + "," + z; string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); _strings[0] = _sposition; Zones.zoneSetup1[_cInfo.entityId] = _strings; newZone[_cInfo.entityId] = 2; SdtdConsole.Instance.Output(string.Format("Saved the zone as a circle. Circle center point = {0} {1} {2}", x, y, z)); SdtdConsole.Instance.Output(string.Format("Type zone circle <number> to set the amount of blocks from center the zone will reach.")); } else if (_stage == 2) { bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); if (_bools[0]) { int _result; if (int.TryParse(_params[1], out _result)) { string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); _strings[1] = _result.ToString(); Zones.zoneSetup1[_cInfo.entityId] = _strings; newZone[_cInfo.entityId] = 3; SdtdConsole.Instance.Output(string.Format("Saved the circle radius to {0}.", _result)); SdtdConsole.Instance.Output(string.Format("Type zone save \"entry message\". This is the message players receive upon entering the zone.")); } else { SdtdConsole.Instance.Output(string.Format("This zone is not setup as a circle, go back by typing zone back.")); } } else { SdtdConsole.Instance.Output(string.Format("This zone is not setup as a circle, go back by typing zone back.")); } } else { SdtdConsole.Instance.Output(string.Format("Start a new zone setup or go back to the circle setup if you need to change it by typing zone back.")); } } } else if (_params[0].ToLower().Equals("save")) { if (newZone.ContainsKey(_cInfo.entityId)) { int _stage; newZone.TryGetValue(_cInfo.entityId, out _stage); if (_stage == 1) { bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); _bools[0] = false; Zones.zoneSetup2[_cInfo.entityId] = _bools; 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 _sposition = x + "," + y + "," + z; string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); _strings[0] = _sposition; Zones.zoneSetup1[_cInfo.entityId] = _strings; newZone[_cInfo.entityId] = 2; SdtdConsole.Instance.Output(string.Format("Corner 1 = {0} {1} {2}", x, y, z)); SdtdConsole.Instance.Output(string.Format("Corner 1 saved. Stand in the opposite corner of the zone and type zone save.")); } if (_stage == 2) { 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 _sposition = x + "," + y + "," + z; string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); _strings[1] = _sposition; Zones.zoneSetup1[_cInfo.entityId] = _strings; newZone[_cInfo.entityId] = 3; SdtdConsole.Instance.Output(string.Format("Corner 2 = {0} {1} {2}", x, y, z)); SdtdConsole.Instance.Output(string.Format("Corner 2 saved. Type zone save \"entry message\". This is the message players receive upon entering the zone.")); } else if (_stage == 3) { string _entry = _params[1]; string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); _strings[2] = _entry; Zones.zoneSetup1[_cInfo.entityId] = _strings; newZone[_cInfo.entityId] = 4; SdtdConsole.Instance.Output(string.Format("Zone entry message = \"{0}\"", _entry)); SdtdConsole.Instance.Output(string.Format("Zone entry message saved. Type zone save \"exit message\". This is the message players receive upon exiting the zone.")); } else if (_stage == 4) { string _exit = _params[1]; string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); _strings[3] = _exit; Zones.zoneSetup1[_cInfo.entityId] = _strings; newZone[_cInfo.entityId] = 5; SdtdConsole.Instance.Output(string.Format("Zone exit message = \"{0}\"", _exit)); SdtdConsole.Instance.Output(string.Format("Zone exit message saved. Type zone save \"response\". This is the console command that will occur when a player enters this zone.")); } else if (_stage == 5) { string _response = _params[1]; string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); _strings[4] = _response; Zones.zoneSetup1[_cInfo.entityId] = _strings; newZone[_cInfo.entityId] = 6; SdtdConsole.Instance.Output(string.Format("Zone response = \"{0}\"", _response)); SdtdConsole.Instance.Output(string.Format("Zone response saved. Type zone save \"reminder message\". This will set the message players receive if they stay in this zone long enough.")); } else if (_stage == 6) { string _response = _params[1]; string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); _strings[5] = _response; Zones.zoneSetup1[_cInfo.entityId] = _strings; newZone[_cInfo.entityId] = 7; SdtdConsole.Instance.Output(string.Format("Zone reminder message = \"{0}\"", _response)); SdtdConsole.Instance.Output(string.Format("Zone reminder message saved. Type zone save 'true or false'. This will set PvE to true or false.")); } else if (_stage == 7) { bool _result; if (bool.TryParse(_params[1], out _result)) { if (_result) { bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); _bools[1] = true; Zones.zoneSetup2[_cInfo.entityId] = _bools; newZone[_cInfo.entityId] = 8; SdtdConsole.Instance.Output(string.Format("Zone PvE = {0}", _result)); SdtdConsole.Instance.Output(string.Format("Zone PvE saved. Type zone save 'true or false'. This will set No_Zombie to true or false.")); } else { bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); _bools[1] = false; Zones.zoneSetup2[_cInfo.entityId] = _bools; newZone[_cInfo.entityId] = 8; SdtdConsole.Instance.Output(string.Format("Zone PvE = {0}", _result)); SdtdConsole.Instance.Output(string.Format("Zone PvE saved. Type zone save 'true or false'. This will set No_Zombie to true or false.")); } } else { SdtdConsole.Instance.Output(string.Format("Incorrect format. Type zone save 'true or false'.")); } } else if (_stage == 8) { bool _result; if (bool.TryParse(_params[1], out _result)) { if (_result) { string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); _bools[2] = true; Zones.zoneSetup2[_cInfo.entityId] = _bools; newZone[_cInfo.entityId] = 9; SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _result)); SdtdConsole.Instance.Output(string.Format("No zombie saved")); SdtdConsole.Instance.Output(""); SdtdConsole.Instance.Output(string.Format("Zone Review:")); SdtdConsole.Instance.Output(string.Format("Corner 1 = {0}", _strings[0])); SdtdConsole.Instance.Output(string.Format("Corner 2 = {0}", _strings[1])); SdtdConsole.Instance.Output(string.Format("Entry message = {0}", _strings[2])); SdtdConsole.Instance.Output(string.Format("Exit message = {0}", _strings[3])); SdtdConsole.Instance.Output(string.Format("Response = {0}", _strings[4])); SdtdConsole.Instance.Output(string.Format("Reminder notice = {0}", _strings[5])); SdtdConsole.Instance.Output(string.Format("Circle = {0}", _bools[0])); SdtdConsole.Instance.Output(string.Format("PvE = {0}", _bools[1])); SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _bools[2])); SdtdConsole.Instance.Output(string.Format("Type zone save. This will complete the setup.")); } else { string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); _bools[2] = false; Zones.zoneSetup2[_cInfo.entityId] = _bools; newZone[_cInfo.entityId] = 9; SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _result)); SdtdConsole.Instance.Output(string.Format("No zombie saved")); SdtdConsole.Instance.Output(""); SdtdConsole.Instance.Output(string.Format("Zone Review:")); SdtdConsole.Instance.Output(string.Format("Corner 1 = {0}", _strings[0])); SdtdConsole.Instance.Output(string.Format("Corner 2 = {0}", _strings[1])); SdtdConsole.Instance.Output(string.Format("Entry message = {0}", _strings[2])); SdtdConsole.Instance.Output(string.Format("Exit message = {0}", _strings[3])); SdtdConsole.Instance.Output(string.Format("Response = {0}", _strings[4])); SdtdConsole.Instance.Output(string.Format("Reminder notice = {0}", _strings[5])); SdtdConsole.Instance.Output(string.Format("Circle = {0}", _bools[0])); SdtdConsole.Instance.Output(string.Format("PvE = {0}", _bools[1])); SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _bools[2])); SdtdConsole.Instance.Output(string.Format("Type zone save. This will complete the setup.")); } } else { SdtdConsole.Instance.Output(string.Format("Incorrect format. Type zone save true or zone save false.")); } } else if (_stage == 9) { string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); string[] _box1 = { _strings[0], _strings[1], _strings[2], _strings[3], _strings[4], _strings[5] }; bool[] _box2 = { _bools[0], _bools[1], _bools[2] }; if (!Zones.Box1.Contains(_box1)) { Zones.Box1.Add(_box1); Zones.Box2.Add(_box2); Zones.UpdateXml(); SdtdConsole.Instance.Output(string.Format("New zone setup has been completed.")); } else { SdtdConsole.Instance.Output(string.Format("This zone is already setup. Setup a new zone by typing zone new.")); } newZone.Remove(_cInfo.entityId); Zones.zoneSetup1.Remove(_cInfo.entityId); Zones.zoneSetup1.Remove(_cInfo.entityId); } } else if (_params[0].ToLower().Equals("back")) { if (newZone.ContainsKey(_cInfo.entityId)) { int _stage; newZone.TryGetValue(_cInfo.entityId, out _stage); if (_stage == 1) { SdtdConsole.Instance.Output(string.Format("You can not go any further back in the setup process.")); SdtdConsole.Instance.Output(string.Format("Stand at the first corner of the zone and type zone save.")); SdtdConsole.Instance.Output(string.Format("If you would like a circle, stand in the middle of the circle and type zone circle.")); } else if (_stage == 2) { newZone[_cInfo.entityId] = 1; SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step.")); string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); string[] _corner1 = _strings[0].Split(','); int x, y, z; int.TryParse(_corner1[0], out x); int.TryParse(_corner1[1], out y); int.TryParse(_corner1[2], out z); bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); if (_bools[0]) { SdtdConsole.Instance.Output(string.Format("Saved the zone as a circle. Circle center point = {0} {1} {2}", x, y, z)); SdtdConsole.Instance.Output(string.Format("Stand at the furthest point from the center and type zone circle.")); } else { SdtdConsole.Instance.Output(string.Format("Corner 1 = {0} {1} {2}", x, y, z)); SdtdConsole.Instance.Output(string.Format("Corner 1 saved. Stand in the opposite corner of the zone and type zone save.")); } } else if (_stage == 3) { newZone[_cInfo.entityId] = 2; SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step.")); string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); if (_bools[0]) { string _distance = _strings[1]; SdtdConsole.Instance.Output(string.Format("Saved the circle radius to {0}.", _distance)); SdtdConsole.Instance.Output(string.Format("Type zone save 'entry message'. This is the message players receive upon entering the zone.")); } else { string[] _corner2 = _strings[1].Split(','); int x, y, z; int.TryParse(_corner2[0], out x); int.TryParse(_corner2[1], out y); int.TryParse(_corner2[2], out z); SdtdConsole.Instance.Output(string.Format("Corner 2 = {0} {1} {2}", x, y, z)); SdtdConsole.Instance.Output(string.Format("Corner 2 saved. Type zone save 'entry message'. This is the message players receive upon entering the zone.")); } } else if (_stage == 4) { newZone[_cInfo.entityId] = 3; SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step.")); string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); SdtdConsole.Instance.Output(string.Format("Zone entry message = \"{0}\"", _strings[2])); SdtdConsole.Instance.Output(string.Format("Zone entry message saved. Type zone save 'exit message'. This is the message players receive upon exiting the zone.")); } else if (_stage == 5) { newZone[_cInfo.entityId] = 4; SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step.")); string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); SdtdConsole.Instance.Output(string.Format("Zone exit message = \"{0}\"", _strings[3])); SdtdConsole.Instance.Output(string.Format("Zone exit message saved. Type zone save 'response'. This is the console command that will occur when a player enters this zone.")); } else if (_stage == 6) { newZone[_cInfo.entityId] = 5; SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step.")); string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); SdtdConsole.Instance.Output(string.Format("Zone response = \"{0}\"", _strings[4])); SdtdConsole.Instance.Output(string.Format("Zone response saved. Type zone save 'reminder message'. This will set the message players receive if they stay in this zone long enough.")); } else if (_stage == 7) { newZone[_cInfo.entityId] = 6; SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step.")); string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); SdtdConsole.Instance.Output(string.Format("Zone reminder message = \"{0}\"", _strings[5])); SdtdConsole.Instance.Output(string.Format("Zone reminder message saved. Type zone save 'true or false'. This will set the zone as a PvE zone or not.")); } else if (_stage == 8) { newZone[_cInfo.entityId] = 7; SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step.")); bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); SdtdConsole.Instance.Output(string.Format("Zone PvE = {0}", _bools[1])); SdtdConsole.Instance.Output(string.Format("Zone PvE saved. Type zone save 'true or false'. This will set the zone as a PvE zone or not.")); } else if (_stage == 9) { newZone[_cInfo.entityId] = 8; SdtdConsole.Instance.Output(string.Format("Zone setup has gone back one step.")); string[] _strings; Zones.zoneSetup1.TryGetValue(_cInfo.entityId, out _strings); bool[] _bools; Zones.zoneSetup2.TryGetValue(_cInfo.entityId, out _bools); SdtdConsole.Instance.Output(string.Format("Zone Review:")); SdtdConsole.Instance.Output(string.Format("Corner 1 = {0}", _strings[0])); SdtdConsole.Instance.Output(string.Format("Corner 2 = {0}", _strings[1])); SdtdConsole.Instance.Output(string.Format("Entry message = {0}", _strings[2])); SdtdConsole.Instance.Output(string.Format("Exit message = {0}", _strings[3])); SdtdConsole.Instance.Output(string.Format("Response = {0}", _strings[4])); SdtdConsole.Instance.Output(string.Format("Reminder notice = {0}", _strings[5])); SdtdConsole.Instance.Output(string.Format("Circle = {0}", _bools[0])); SdtdConsole.Instance.Output(string.Format("PvE = {0}", _bools[1])); SdtdConsole.Instance.Output(string.Format("No zombie = {0}", _bools[2])); SdtdConsole.Instance.Output(string.Format("Type zone save. This will complete the setup.")); } } else { SdtdConsole.Instance.Output(string.Format("You have not started the setup for a new zone. Type zone new to begin setting up a new zone.")); } } } else { SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0])); } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in ZoneSetupConsole.Run: {0}.", e)); } }
public static void Exec() //Dictionary keys in schedule correspond to specific class in order to execute corresponding methods { try { foreach (var _event in Schedule.ToArray()) { if (DateTime.Now >= _event.Value) { if (_event.Key == "AutoBackup") { Add("AutoBackup", DateTime.Now.AddMinutes(AutoBackup.Delay)); AutoBackup.Exec(); } else if (_event.Key == "AutoSaveWorld") { Add("AutoSaveWorld", DateTime.Now.AddMinutes(AutoSaveWorld.Delay)); AutoSaveWorld.Save(); } else if (_event.Key == "Bloodmoon") { Add("Bloodmoon", DateTime.Now.AddMinutes(Bloodmoon.Delay)); Bloodmoon.StatusCheck(); } else if (_event.Key == "BreakTime") { Add("BreakTime", DateTime.Now.AddMinutes(BreakTime.Delay)); BreakTime.Exec(); } else if (_event.Key == "InfoTicker") { Add("InfoTicker", DateTime.Now.AddMinutes(InfoTicker.Delay)); InfoTicker.Exec(); } else if (_event.Key == "NightAlert") { Add("NightAlert", DateTime.Now.AddMinutes(NightAlert.Delay)); NightAlert.Exec(); } else if (_event.Key == "PlayerLogs") { Add("PlayerLogs", DateTime.Now.AddMinutes(PlayerLogs.Delay)); PlayerLogs.Exec(); } else if (_event.Key == "RealWorldTime") { Add("RealWorldTime", DateTime.Now.AddMinutes(RealWorldTime.Delay)); RealWorldTime.Exec(); } else if (_event.Key == "Watchlist") { Add("Watchlist", DateTime.Now.AddMinutes(Watchlist.Delay)); Watchlist.CheckWatchlist(); } else if (_event.Key == "Zones") { Add("Zones", DateTime.Now.AddMinutes(Zones.Reminder_Delay)); Zones.ReminderExec(); } else if (_event.Key == "Shutdown") //combines stop server tool to apply a countdown timer before shutdown { StopServer.PrepareShutdown(); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in EventSchedule.Exec: {0}", e.Message)); } }
private static void Exec() { if (Zones.IsEnabled || Lobby.IsEnabled || Market.IsEnabled) { PersistentOperations.CheckZone(); } if (Jail.IsEnabled) { Jail.StatusCheck(); } if (DiscordBot.IsEnabled && DiscordBot.Queue.Count > 0) { DiscordBot.WebHook(); } if (twoSecondTick >= 2) { twoSecondTick = 0; if (PlayerChecks.GodEnabled || PlayerChecks.SpectatorEnabled || FlyingDetector.IsEnabled || SpeedDetector.IsEnabled) { PlayerChecks.TwoSecondExec(); } if (WorldRadius.IsEnabled) { WorldRadius.Exec(); } } if (fiveSecondTick >= 5) { fiveSecondTick = 0; if (Zones.IsEnabled) { Zones.HostileCheck(); } if (PlayerStats.IsEnabled) { PlayerStats.Exec(); } if (Fps.IsEnabled) { Fps.LowFPS(); } } if (tenSecondTick >= 10) { tenSecondTick = 0; if (EntityCleanup.IsEnabled) { EntityCleanup.EntityCheck(); } } if (twentySecondTick >= 20) { twentySecondTick = 0; if (Track.IsEnabled) { Track.Exec(); } EventSchedule.Exec(); } if (oneMinTick >= 60) { oneMinTick = 0; if (Jail.IsEnabled && Jail.Jailed.Count > 0) { Jail.Clear(); } if (Mute.IsEnabled && Mute.Mutes.Count > 0) { Mute.Clear(); } if (BloodmoonWarrior.IsEnabled) { BloodmoonWarrior.Exec(); } } if (fiveMinTick >= 300) { fiveMinTick = 0; StateManager.Save(); if (InvalidItems.Check_Storage) { InvalidItems.CheckStorage(); } } if (PersistentOperations.NewPlayerQue.Count > 0) { newPlayer++; if (newPlayer >= 5) { newPlayer = 0; ClientInfo cInfo = PersistentOperations.NewPlayerQue[0]; PersistentOperations.NewPlayerQue.RemoveAt(0); API.NewPlayerExec(cInfo); } } if (RestartVote.IsEnabled && RestartVote.VoteOpen) { restartVote++; if (restartVote >= 60) { restartVote = 0; RestartVote.VoteOpen = false; RestartVote.ProcessRestartVote(); } } if (MuteVote.IsEnabled && MuteVote.VoteOpen) { muteVote++; if (muteVote >= 60) { muteVote = 0; MuteVote.VoteOpen = false; MuteVote.ProcessMuteVote(); } } if (KickVote.IsEnabled && KickVote.VoteOpen) { kickVote++; if (kickVote >= 60) { kickVote = 0; KickVote.VoteOpen = false; KickVote.ProcessKickVote(); } } if (Lottery.IsEnabled && Lottery.OpenLotto) { lottery++; if (lottery == Lottery.Time * 60 - 60) { Lottery.Alert(); } if (lottery >= Lottery.Time * 60) { lottery = 0; Lottery.OpenLotto = false; Lottery.StartLotto(); } } else { lottery = 0; } if (Hordes.IsEnabled) { horde++; if (horde >= 1200) { horde = 0; Hordes.Exec(); } } else { horde = 0; } if (Shutdown.ShuttingDown) { stopServerSeconds++; if (stopServerSeconds >= 60) { stopServerSeconds = 0; StopServerMinutes--; if (StopServerMinutes > 1) { Shutdown.TimeRemaining(StopServerMinutes); } else if (StopServerMinutes == 1) { Shutdown.OneMinute(); } else if (StopServerMinutes == 0) { Shutdown.ShuttingDown = false; Shutdown.Close(); } } if (StopServerMinutes == 1) { if (Shutdown.UI_Lock && stopServerSeconds == 15) { Shutdown.Lock(); } else if (stopServerSeconds == 30) { Shutdown.Kick(); } } } else { stopServerSeconds = 0; } if (Event.Invited) { eventInvitation++; if (eventInvitation >= 900) { eventInvitation = 0; Event.Invited = false; Event.CheckOpen(); } } if (Event.Open) { eventOpen++; if (eventOpen == eventTime / 2) { Event.HalfTime(); } if (eventOpen == eventTime - 300) { Event.FiveMin(); } if (eventOpen >= eventTime) { eventOpen = 0; Event.EndEvent(); } } else { eventOpen = 0; } }
public static void Exec() { DP = false; List <EntityPlayer> _playerList = GameManager.Instance.World.Players.list; for (int i = 0; i < _playerList.Count; i++) { EntityPlayer _player = _playerList[i]; if (_player != null) { if (_player.IsDead()) { DP = true; if (!Dead.Contains(_player.entityId)) { Dead.Add(_player.entityId); if (!DeathTime.ContainsKey(_player.entityId)) { Vector3 _position = _player.GetPosition(); int x = (int)_position.x; int y = (int)_position.y; int z = (int)_position.z; string _dposition = x + "," + y + "," + z; DeathTime.Add(_player.entityId, DateTime.Now); LastDeathPos.Add(_player.entityId, _dposition); } else { Vector3 _position = _player.GetPosition(); int x = (int)_position.x; int y = (int)_position.y; int z = (int)_position.z; string _dposition = x + "," + y + "," + z; DeathTime[_player.entityId] = DateTime.Now; LastDeathPos[_player.entityId] = _dposition; } for (int j = 0; j < _playerList.Count; j++) { EntityPlayer _player2 = _playerList[j]; Entity _target = _player2.GetDamagedTarget(); if (_target == _player && _player != _player2) { _player2.ClearDamagedTarget(); ClientInfo _cInfo = ConnectionManager.Instance.GetClientInfoForEntityId(_player.entityId); ClientInfo _cInfo2 = ConnectionManager.Instance.GetClientInfoForEntityId(_player2.entityId); if (_cInfo != null && _cInfo2 != null) { if (Kill_Notice) { string _holdingItem = _player2.inventory.holdingItem.Name; if (_holdingItem == "handPlayer") { _holdingItem = "Fists of Fury"; } ItemValue _itemValue = ItemClass.GetItem(_holdingItem, true); if (_itemValue.type != ItemValue.None.type) { _holdingItem = _itemValue.ItemClass.localizedName ?? _itemValue.ItemClass.Name; } string _phrase915; if (!Phrases.Dict.TryGetValue(915, out _phrase915)) { _phrase915 = "{PlayerName} has killed {Victim} with {Item}."; } _phrase915 = _phrase915.Replace("{PlayerName}", _cInfo2.playerName); _phrase915 = _phrase915.Replace("{Victim}", _cInfo.playerName); _phrase915 = _phrase915.Replace("{Item}", _holdingItem); GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase915), Config.Server_Response_Name, false, "ServerTools", false); } if (Bounties.IsEnabled) { if (!_player.IsFriendsWith(_player2) || !_player2.IsFriendsWith(_player)) { if (Friends.ContainsKey(_player.entityId)) { string _friends; if (Friends.TryGetValue(_player.entityId, out _friends)) { string[] _friendList = _friends.Split(' ').ToArray(); for (int k = 0; k < _friendList.Length; k++) { string _friend = _friendList[k]; if (_friend == _cInfo2.playerId) { return; } } } } if (Friends.ContainsKey(_player2.entityId)) { string _friends; if (Friends.TryGetValue(_player2.entityId, out _friends)) { string[] _friendList = _friends.Split(' ').ToArray(); for (int k = 0; k < _friendList.Length; k++) { string _friend = _friendList[k]; if (_friend == _cInfo.playerId) { return; } } } } if (ClanManager.IsEnabled) { if (ClanManager.ClanMember.Contains(_cInfo.playerId) && ClanManager.ClanMember.Contains(_cInfo2.playerId)) { Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false]; Player p2 = PersistentContainer.Instance.Players[_cInfo2.playerId, false]; if (p != null && p2 != null) { if (p.ClanName != null && p2.ClanName != null) { if (p.ClanName == p2.ClanName) { return; } } } } } int _bounty = PersistentContainer.Instance.Players[_cInfo.playerId, true].Bounty; if (_bounty > 0) { int _oldCoins = PersistentContainer.Instance.Players[_cInfo2.playerId, true].PlayerSpentCoins; PersistentContainer.Instance.Players[_cInfo2.playerId, true].PlayerSpentCoins = _oldCoins + _bounty; PersistentContainer.Instance.Players[_cInfo.playerId, true].Bounty = 0; PersistentContainer.Instance.Save(); string _phrase912; if (!Phrases.Dict.TryGetValue(912, out _phrase912)) { _phrase912 = "{PlayerName} is a bounty hunter! {Victim} was snuffed out."; } _phrase912 = _phrase912.Replace("{PlayerName}", _cInfo2.playerName); _phrase912 = _phrase912.Replace("{Victim}", _cInfo.playerName); GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase912), Config.Server_Response_Name, false, "ServerTools", false); using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: {1} is a bounty hunter! {2} was snuffed out. Bounty was worth {3}", DateTime.Now, _cInfo2.playerName, _cInfo.playerName, _bounty)); sw.WriteLine(); sw.Flush(); sw.Close(); } } if (Bounties.Kill_Streak > 0) { if (KillStreak.ContainsKey(_cInfo.entityId)) { KillStreak.Remove(_cInfo.entityId); using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: Player {1} kill streak has come to an end by {2}.", DateTime.Now, _cInfo.playerName, _cInfo2.playerName)); sw.WriteLine(); sw.Flush(); sw.Close(); } } if (KillStreak.ContainsKey(_cInfo2.entityId)) { int _value; if (KillStreak.TryGetValue(_cInfo2.entityId, out _value)) { int _newValue = _value + 1; KillStreak[_cInfo2.entityId] = _newValue; if (_newValue == Bounties.Kill_Streak) { string _phrase913; if (!Phrases.Dict.TryGetValue(913, out _phrase913)) { _phrase913 = "{PlayerName} is on a kill streak! Their bounty has increased."; } _phrase913 = _phrase913.Replace("{PlayerName}", _cInfo2.playerName); GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase913), Config.Server_Response_Name, false, "ServerTools", false); } if (_newValue >= Bounties.Kill_Streak) { int _oldBounty = PersistentContainer.Instance.Players[_cInfo2.playerId, true].Bounty; PersistentContainer.Instance.Players[_cInfo.playerId, true].Bounty = _oldBounty + (_player2.Level * Bounties.Bounty); PersistentContainer.Instance.Save(); using (StreamWriter sw = new StreamWriter(filepath, true)) { sw.WriteLine(string.Format("{0}: {1} is on a kill streak of {2}. Their bounty has increased.", DateTime.Now, _cInfo2.playerName, _newValue)); sw.WriteLine(); sw.Flush(); sw.Close(); } } } } else { KillStreak.Add(_cInfo2.entityId, 1); } } } } if (Zones.IsEnabled) { Zones.Check(_cInfo2, _cInfo); } } } } if (Event.Open && Event.Players.Contains(_player.entityId) && !Event.SpawnList.Contains(_player.entityId)) { Event.SpawnList.Add(_player.entityId); } } } else { if (Zones.IsEnabled) { ClientInfo _cInfo = ConnectionManager.Instance.GetClientInfoForEntityId(_player.entityId); if (_cInfo != null) { ZoneCheck(_cInfo, _player); } } } } } if (!DP) { _counter++; if (_counter >= 6) { _counter = 0; for (int i = 0; i < _playerList.Count; i++) { EntityPlayer _player = _playerList[i]; if (_player != null) { _player.ClearDamagedTarget(); } } } } else { _counter = 0; } }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { try { var _cInfo = _senderInfo.RemoteClientInfo; if (_cInfo != null) { if (_params[0].ToLower().Equals("off")) { if (Zones.IsEnabled) { Zones.IsEnabled = false; Config.WriteXml(); Config.LoadXml(); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Zones has been set to off")); return; } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Zones is already off")); return; } } else if (_params[0].ToLower().Equals("on")) { if (!Zones.IsEnabled) { Zones.IsEnabled = true; Config.WriteXml(); Config.LoadXml(); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Zones has been set to on")); return; } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Zones is already on")); return; } } else if (_params[0].ToLower().Equals("new")) { if (SetupStage.ContainsKey(_cInfo.entityId)) { SetupStage[_cInfo.entityId] = 1; } else { SetupStage.Add(_cInfo.entityId, 1); } if (Zones.ZoneSetup.ContainsKey(_cInfo.entityId)) { Zones.ZoneSetup.Remove(_cInfo.entityId); } string[] _newZone = new string[11]; _params.RemoveAt(0); string _name = string.Join(" ", _params); _newZone[0] = _name; Zones.ZoneSetup.Add(_cInfo.entityId, _newZone); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Started a new zone setup. Zone name set to {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Stand at the first corner of the zone and type zns save")); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] If you would like a circle, stand in the middle of the circle and type zns circle")); } else if (_params[0].ToLower().Equals("list")) { if (Zones.ZoneList.Count > 0) { for (int i = 0; i < Zones.ZoneList.Count; i++) { string[] _zone = Zones.ZoneList[i]; if (_zone != null) { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Zone number {0}:", i)); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _zone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _zone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 2 = {0}", _zone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Circle = {0}", _zone[3])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry message = {0}", _zone[4])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit message = {0}", _zone[5])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry Command = {0}", _zone[6])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit Command = {0}", _zone[7])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Reminder Notice = {0}", _zone[8])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("PvPvE = {0}", _zone[9])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("No zombie = {0}", _zone[10])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("")); } } } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] There are no zones setup")); } } else if (_params[0].ToLower().Equals("delete")) { if (Zones.ZoneList.Count > 0) { if (int.TryParse(_params[1], out int _number)) { if (Zones.ZoneList.Count >= _number) { Zones.ZoneList.RemoveAt(_number); Zones.UpdateXml(); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Removed zone entry number {0} from the list", _number)); return; } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Could not delete number {0} from the list. Entry not found", _number)); return; } } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid format or non numeric entry. Type zns delete <number> from the list of zones")); return; } } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] There are no zones setup")); return; } } else if (_params[0].ToLower().Equals("circle")) { if (SetupStage.ContainsKey(_cInfo.entityId)) { SetupStage.TryGetValue(_cInfo.entityId, out int _stage); if (_stage == 1) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Vector3 _position = _player.GetPosition(); Zones.ZoneSetup.TryGetValue(_cInfo.entityId, out string[] _newZone); int _x = (int)_position.x; int _y = (int)_position.y; int _z = (int)_position.z; _newZone[1] = _x + "," + _y + "," + _z; _newZone[3] = "true"; Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 2; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Circle center point = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns circle 'number' to set the amount of blocks from center the zone will reach")); } else if (_stage == 2) { Zones.ZoneSetup.TryGetValue(_cInfo.entityId, out string[] _newZone); if (_newZone[3].ToLower() == "true") { if (int.TryParse(_params[1], out int _radius)) { _newZone[2] = _radius.ToString(); Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 3; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Saved the circular zone radius to {0} blocks", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"message\". This is the message players receive upon entering the zone")); } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid radius for circlular zone, try again")); } } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] This zone is not setup as a circle, go back by typing zns back")); } } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Start a new zone setup or go back to the circle setup if you need to change it by typing zns back.")); } } } else if (_params[0].ToLower().Equals("save")) { if (SetupStage.ContainsKey(_cInfo.entityId)) { SetupStage.TryGetValue(_cInfo.entityId, out int _stage); Zones.ZoneSetup.TryGetValue(_cInfo.entityId, out string[] _newZone); switch (_stage) { case 1: 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; _newZone[1] = _x + "," + _y + "," + _z; _newZone[3] = "false"; Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 2; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Stand in the opposite corner of the zone and type zns save")); break; case 2: _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; _position = _player.GetPosition(); _x = (int)_position.x; _y = (int)_position.y; _z = (int)_position.z; if (_newZone[1].Contains(_y.ToString())) { _y++; } _newZone[2] = _x + "," + _y + "," + _z; Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 3; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Corner 2 = {0}", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"message\". This is the message players receive upon entering the zone")); break; case 3: _params.RemoveAt(0); string _entryMessage = string.Join(" ", _params); _newZone[4] = _entryMessage; Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 4; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Entry message = \"{0}\"", _newZone[4])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"message\". This is the message players receive upon exiting the zone")); break; case 4: _params.RemoveAt(0); string _exitMessage = string.Join(" ", _params); _newZone[5] = _exitMessage; Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 5; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Exit message = \"{0}\"", _newZone[5])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"command\". This is the console command that will occur when a player enters this zone")); break; case 5: _params.RemoveAt(0); string _entryCommand = string.Join(" ", _params); if (_entryCommand == "") { _entryCommand = "***"; } _newZone[6] = _entryCommand; Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 6; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Entry command = \"{0}\"", _newZone[6])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"command\". This is the console command that will occur when a player exits this zone")); break; case 6: _params.RemoveAt(0); string _exitCommand = string.Join(" ", _params); if (_exitCommand == "") { _exitCommand = "***"; } _newZone[7] = _exitCommand; Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 7; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Exit command = \"{0}\"", _newZone[7])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"message\". This will set the message players receive if they stay in this zone long enough")); break; case 7: _params.RemoveAt(0); string _reminder = string.Join(" ", _params); _newZone[8] = _reminder; Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 8; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Reminder message = \"{0}\"", _newZone[8])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save '0 to 3'. This will set PvPvE to a specific player killing mode")); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] 0 = No Killing, 1 = Kill Allies Only, 2 = Kill Strangers Only, 3 = Kill Everyone")); break; case 8: if (int.TryParse(_params[1], out int _playerKillingMode)) { _newZone[9] = _playerKillingMode.ToString(); Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 9; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Zone PvPvE = {0}", _newZone[9])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save 'true or false'. This will set no zombie to true or false")); } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Incorrect format. Type zns save '0 to 3'")); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] 0 = No Killing, 1 = Kill Allies Only, 2 = Kill Strangers Only, 3 = Kill Everyone")); } break; case 9: if (bool.TryParse(_params[1], out bool _noZombie)) { if (_noZombie) { _newZone[10] = "true"; } else { _newZone[10] = "false"; } Zones.ZoneSetup[_cInfo.entityId] = _newZone; SetupStage[_cInfo.entityId] = 10; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] No zombie = {0}", _newZone[10])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(""); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Zone Review:")); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 2 = {0}", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Circle = {0}", _newZone[3])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry message = {0}", _newZone[4])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit message = {0}", _newZone[5])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry Command = {0}", _newZone[6])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit Command = {0}", _newZone[7])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Reminder notice = {0}", _newZone[8])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("PvPvE = {0}", _newZone[9])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("No zombie = {0}", _newZone[10])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Type zns save. This will complete the setup")); } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Incorrect format. Type zns save 'true or false'")); } break; case 10: if (!Zones.ZoneList.Contains(_newZone)) { Zones.ZoneList.Add(_newZone); Zones.UpdateXml(); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] New zone setup has been completed")); } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] This zone is already setup. Setup a new zone by typing zns new")); } Zones.ZoneSetup.Remove(_cInfo.entityId); SetupStage.Remove(_cInfo.entityId); break; } } else if (_params[0].ToLower().Equals("back")) { if (SetupStage.ContainsKey(_cInfo.entityId)) { SetupStage.TryGetValue(_cInfo.entityId, out int _stage); Zones.ZoneSetup.TryGetValue(_cInfo.entityId, out string[] _newZone); switch (_stage) { case 1: SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Stand at the first corner of the zone and type zns save")); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] If you would like a circle, stand in the middle of the circle and type zns circle")); break; case 2: SetupStage[_cInfo.entityId] = 1; if (_newZone[3].ToLower() == "true") { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Stand at the furthest point from the center and type zns circle")); } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Corner 1 is saved. Stand in the opposite corner of the zone and type zns save")); } break; case 3: SetupStage[_cInfo.entityId] = 2; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 2 = {0}", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Circle = {0}", _newZone[3])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"message\". This is the message players receive upon entering the zone")); break; case 4: SetupStage[_cInfo.entityId] = 3; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 2 = {0}", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Circle = {0}", _newZone[3])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry message = {0}", _newZone[4])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"message\". This is the message players receive upon exiting the zone")); break; case 5: SetupStage[_cInfo.entityId] = 4; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 2 = {0}", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Circle = {0}", _newZone[3])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry message = {0}", _newZone[4])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit message = {0}", _newZone[5])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"command\". This is the console command that will occur when a player enters this zone")); break; case 6: SetupStage[_cInfo.entityId] = 5; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 2 = {0}", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Circle = {0}", _newZone[3])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry message = {0}", _newZone[4])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit message = {0}", _newZone[5])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry Command = {0}", _newZone[6])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"command\". This is the console command that will occur when a player exits this zone")); break; case 7: SetupStage[_cInfo.entityId] = 6; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 2 = {0}", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Circle = {0}", _newZone[3])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry message = {0}", _newZone[4])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit message = {0}", _newZone[5])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry Command = {0}", _newZone[6])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit Command = {0}", _newZone[7])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save \"message\". This will set the message players receive if they stay in this zone long enough")); break; case 8: SetupStage[_cInfo.entityId] = 7; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 2 = {0}", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Circle = {0}", _newZone[3])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry message = {0}", _newZone[4])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit message = {0}", _newZone[5])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry Command = {0}", _newZone[6])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit Command = {0}", _newZone[7])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Reminder notice = {0}", _newZone[8])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save '0 to 3'. This will set PvPvE to a specific player killing mode")); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] 0 = No Killing, 1 = Kill Allies Only, 2 = Kill Strangers Only, 3 = Kill Everyone")); break; case 9: SetupStage[_cInfo.entityId] = 8; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 2 = {0}", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Circle = {0}", _newZone[3])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry message = {0}", _newZone[4])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit message = {0}", _newZone[5])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry Command = {0}", _newZone[6])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit Command = {0}", _newZone[7])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Reminder notice = {0}", _newZone[8])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("PvPvE = {0}", _newZone[9])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Type zns save 'true or false'. This will set no zombie to true or false")); break; case 10: SetupStage[_cInfo.entityId] = 9; SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Name = {0}", _newZone[0])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 1 = {0}", _newZone[1])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Corner 2 = {0}", _newZone[2])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Circle = {0}", _newZone[3])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry message = {0}", _newZone[4])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit message = {0}", _newZone[5])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Entry Command = {0}", _newZone[6])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Exit Command = {0}", _newZone[7])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Reminder notice = {0}", _newZone[8])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("PvPvE = {0}", _newZone[9])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("No zombie = {0}", _newZone[10])); SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Type zns save. This will complete the setup")); break; } } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] You have not started the setup of a new zone. Type zns new 'name' to begin setting up a new zone")); } } else if (_params[0].ToLower().Equals("forward")) { if (SetupStage.ContainsKey(_cInfo.entityId)) { } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] You have not started the setup of a new zone. Type zns new 'name' to begin setting up a new zone")); } } else { SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0])); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in ZonesConsole.Execute: {0}", e.Message)); } }
public static void ZoneCheck(ClientInfo _cInfo, EntityPlayer _player) { if (_cInfo != null) { if (Box.Count > 0) { bool Found = false; int _flagCount = 0; int _X = (int)_player.position.x; int _Y = (int)_player.position.y; int _Z = (int)_player.position.z; for (int i = 0; i < Box.Count; i++) { string[] _box = Box[i]; if (A(_box, _X, _Y, _Z)) { if (!ZoneExit.ContainsKey(_player.entityId)) { bool _result; for (int j = 0; j < Box.Count; j++) { string[] _box2 = Box[j]; if (A(_box2, _X, _Y, _Z)) { if (!Found) { ZoneExit.Add(_player.entityId, _box2[3]); if (bool.TryParse(_box2[5], out _result)) { if (_result) { ZonePvE.Add(_player.entityId); } } if (Zones.Zone_Message) { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _box2[2]), Config.Server_Response_Name, false, "ServerTools", false)); } if (_box2[4] != "") { Zones.Response(_cInfo, _box2[4]); } return; } } } } else { string _exitMsg; if (ZoneExit.TryGetValue(_player.entityId, out _exitMsg)) { if (_exitMsg != _box[3]) { bool _result; for (int j = 0; j < Box.Count; j++) { string[] _box2 = Box[j]; if (A(_box2, _X, _Y, _Z)) { ZoneExit[_player.entityId] = _box2[3]; if (bool.TryParse(_box2[5], out _result)) { if (_result) { if (!ZonePvE.Contains(_player.entityId)) { ZonePvE.Add(_player.entityId); } } else if (ZonePvE.Contains(_player.entityId)) { ZonePvE.Remove(_player.entityId); } } if (Zones.Zone_Message) { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _box2[2]), Config.Server_Response_Name, false, "ServerTools", false)); } if (_box2[4] != "") { Zones.Response(_cInfo, _box2[4]); } return; } } } else { return; } } } } else if (ZoneExit.ContainsKey(_player.entityId)) { _flagCount++; if (_flagCount == Box.Count) { if (Zones.Zone_Message) { string _msg; if (ZoneExit.TryGetValue(_player.entityId, out _msg)) { _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _msg), Config.Server_Response_Name, false, "ServerTools", false)); } } ZoneExit.Remove(_player.entityId); ZonePvE.Remove(_player.entityId); } } } } } }
private static void Exec() { PersistentOperations.PlayerCheck(); if (Jail.IsEnabled) { Jail.StatusCheck(); } if (DiscordBot.IsEnabled && DiscordBot.Queue.Count > 0) { DiscordBot.WebHook(); } if (_twoSecondTick >= 2) { _twoSecondTick = 0; if (WorldRadius.IsEnabled) { WorldRadius.Exec(); } if (PlayerChecks.GodEnabled || PlayerChecks.FlyEnabled || PlayerChecks.SpectatorEnabled || PlayerChecks.WaterEnabled) { PlayerChecks.Exec(); } } if (_fiveSecondTick >= 5) { _fiveSecondTick = 0; if (Zones.IsEnabled) { Zones.HostileCheck(); } if (PlayerStats.IsEnabled) { PlayerStats.Exec(); } } if (_tenSecondTick >= 10) { _tenSecondTick = 0; if (EntityCleanup.IsEnabled) { EntityCleanup.EntityCheck(); } EventSchedule.Exec(); } if (_twentySecondTick >= 20) { _twentySecondTick = 0; if (Track.IsEnabled) { Track.Exec(); } } if (_oneMinTick >= 60) { _oneMinTick = 0; if (Jail.IsEnabled && Jail.Jailed.Count > 0) { Jail.Clear(); } if (Mute.IsEnabled && Mute.Mutes.Count > 0) { Mute.Clear(); } if (BloodmoonWarrior.IsEnabled) { BloodmoonWarrior.Exec(); } } if (_fiveMinTick >= 300) { _fiveMinTick = 0; StateManager.Save(); if (InvalidItems.Check_Storage) { InvalidItems.CheckStorage(); } } if (WeatherVote.IsEnabled && WeatherVote.VoteOpen) { _weatherVote++; if (_weatherVote >= 60) { _weatherVote = 0; WeatherVote.VoteOpen = false; WeatherVote.ProcessWeatherVote(); } } if (RestartVote.IsEnabled && RestartVote.VoteOpen) { _restartVote++; if (_restartVote >= 60) { _restartVote = 0; RestartVote.VoteOpen = false; RestartVote.ProcessRestartVote(); } } if (MuteVote.IsEnabled && MuteVote.VoteOpen) { _muteVote++; if (_muteVote >= 60) { _muteVote = 0; MuteVote.VoteOpen = false; MuteVote.ProcessMuteVote(); } } if (KickVote.IsEnabled && KickVote.VoteOpen) { _kickVote++; if (_kickVote >= 60) { _kickVote = 0; KickVote.VoteOpen = false; KickVote.ProcessKickVote(); } } if (Lottery.IsEnabled && Lottery.OpenLotto) { _lottery++; if (_lottery == 3300) { Lottery.Alert(); } if (_lottery >= 3600) { _lottery = 0; Lottery.StartLotto(); } } else { _lottery = 0; } if (Hordes.IsEnabled) { _horde++; if (_horde >= 1200) { _horde = 0; Hordes.Exec(); } } else { _horde = 0; } if (StopServer.ShuttingDown) { _stopServerSeconds++; if (_stopServerSeconds >= 60) { _stopServerSeconds = 0; StopServerMinutes--; if (StopServerMinutes > 1) { StopServer.TimeRemaining(StopServerMinutes); } else if (StopServerMinutes == 1) { StopServer.OneMinuteRemains(); } else if (StopServerMinutes == 0) { StopServer.ShuttingDown = false; StopServer.Stop(); } } if (_stopServerSeconds == 30 && StopServerMinutes == 1) { StopServer.Kick30(); } } else { _stopServerSeconds = 0; } if (Event.Invited) { _eventInvitation++; if (_eventInvitation >= 900) { _eventInvitation = 0; Event.Invited = false; Event.CheckOpen(); } } if (Event.Open) { _eventOpen++; if (_eventOpen == _eventTime / 2) { Event.HalfTime(); } if (_eventOpen == _eventTime - 300) { Event.FiveMin(); } if (_eventOpen >= _eventTime) { _eventOpen = 0; Event.EndEvent(); } } else { _eventOpen = 0; } if (RestartVote.Cycle) { _restartVoteCycle++; if (_restartVoteCycle >= 1800) { RestartVote.Cycle = false; } } }
private static void Init(object sender, ElapsedEventArgs e) { if (!StopServer.Shutdown) { PersistentOperations.PlayerCheck(); if (Jail.IsEnabled) { Jail.StatusCheck(); } if (UnderWater.IsEnabled) { UnderWater.Exec(); } timer2Second++; if (timer2Second >= 2) { if (WorldRadius.IsEnabled) { WorldRadius.Exec(); } if (Flying.IsEnabled) { Flying.Exec(); } timer2Second = 0; } timer5Second++; if (timer5Second >= 5) { if (Zones.IsEnabled) { Zones.HostileCheck(); } if (PlayerStatCheck.IsEnabled) { PlayerStatCheck.PlayerStat(); } timer5Second = 0; } timer10Second++; if (timer10Second >= 10) { if (EntityCleanup.IsEnabled) { EntityCleanup.EntityCheck(); } timer10Second = 0; } timer60Second++; if (timer60Second >= 60) { if (Jail.IsEnabled && Jail.Jailed.Count > 0) { Jail.Clear(); } if (Mute.IsEnabled && Mute.Mutes.Count > 0) { Mute.Clear(); } if (BloodmoonWarrior.IsEnabled) { BloodmoonWarrior.Exec(); } timer60Second = 0; } if (WeatherVote.IsEnabled && WeatherVote.VoteOpen) { _weatherVote++; if (_weatherVote >= 60) { _weatherVote = 0; WeatherVote.VoteOpen = false; WeatherVote.ProcessWeatherVote(); } } if (RestartVote.IsEnabled && RestartVote.VoteOpen) { _restartVote++; if (_restartVote >= 60) { _restartVote = 0; RestartVote.VoteOpen = false; RestartVote.ProcessRestartVote(); } } if (MuteVote.IsEnabled && MuteVote.VoteOpen) { _muteVote++; if (_muteVote >= 60) { _muteVote = 0; MuteVote.VoteOpen = false; MuteVote.ProcessMuteVote(); } } if (KickVote.IsEnabled && KickVote.VoteOpen) { _kickVote++; if (_kickVote >= 60) { _kickVote = 0; KickVote.VoteOpen = false; KickVote.ProcessKickVote(); } } if (Lottery.IsEnabled && Lottery.OpenLotto) { _lottery++; if (_lottery == 3300) { Lottery.Alert(); } if (_lottery >= 3600) { _lottery = 0; Lottery.StartLotto(); } } else { _lottery = 0; } if (Hordes.IsEnabled) { _horde++; if (_horde >= 1200) { _horde = 0; Hordes.Exec(); } } else { _horde = 0; } if (NightAlert.IsEnabled) { _nightAlert++; if (_nightAlert >= NightAlert.Delay * 60) { _nightAlert = 0; NightAlert.Exec(); } } else { _nightAlert = 0; } if (Watchlist.IsEnabled) { _watchList++; if (_watchList >= Watchlist.Delay * 60) { _watchList = 0; Watchlist.CheckWatchlist(); } } else { _watchList = 0; } if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show) { if (Bloodmoon.Delay > 0) { _bloodmoon++; if (_bloodmoon >= Bloodmoon.Delay * 60) { _bloodmoon = 0; Bloodmoon.StatusCheck(); } } } else { _bloodmoon = 0; } if (PlayerLogs.IsEnabled & PlayerLogs.Delay > 0) { _playerLogs++; if (_playerLogs >= PlayerLogs.Delay) { _playerLogs = 0; PlayerLogs.Exec(); } } else { _playerLogs = 0; } if (StopServer.StopServerCountingDown) { _stopServerCountDown++; if (_stopServerCountDown == 60) { _stopServerCountDown = 0; _stopServerCount--; } if (_stopServerCount == 0) { _stopServerCountDown = 0; StopServer.StopServerCountingDown = false; StopServer.Stop(); } if (_stopServerCount == 1 && _stopServerCountDown == 0) { StopServer.StartShutdown3(); } if (_stopServerCount > 1 && _stopServerCountDown == 0) { StopServer.StartShutdown2(_stopServerCount); } if (StopServer.Kick_30_Seconds) { if (_stopServerCount == 1 && _stopServerCountDown == 30) { StopServer.NoEntry = true; StopServer.Kick30(); } } if (StopServer.Ten_Second_Countdown) { if (_stopServerCount == 1 && _stopServerCountDown == 50) { StopServer.StartShutdown4(); } if (_stopServerCount == 1 && _stopServerCountDown == 55) { StopServer.StartShutdown5(); } if (_stopServerCount == 1 && _stopServerCountDown == 56) { StopServer.StartShutdown6(); } if (_stopServerCount == 1 && _stopServerCountDown == 57) { StopServer.StartShutdown7(); } if (_stopServerCount == 1 && _stopServerCountDown == 58) { StopServer.StartShutdown8(); } if (_stopServerCount == 1 && _stopServerCountDown == 59) { StopServer.StartShutdown9(); } } } else { _stopServerCountDown = 0; _stopServerCount = 0; } if (AutoSaveWorld.IsEnabled & AutoSaveWorld.Delay > 0) { _autoSaveWorld++; if (_autoSaveWorld >= AutoSaveWorld.Delay * 60) { _autoSaveWorld = 0; AutoSaveWorld.Save(); } } else { _autoSaveWorld = 0; } if (AutoShutdown.IsEnabled && !AutoShutdown.Bloodmoon && !AutoShutdown.BloodmoonOver && !StopServer.StopServerCountingDown) { _autoShutdown++; if (!Event.Open && _autoShutdown >= AutoShutdown.Delay * 60) { _autoShutdown = 0; AutoShutdown.BloodmoonCheck(); } } else { _autoShutdown = 0; } if (AutoShutdown.Bloodmoon) { _autoShutdownBloodmoon++; if (_autoShutdownBloodmoon >= 150) { _autoShutdownBloodmoon = 0; AutoShutdown.BloodmoonCheck(); } } if (AutoShutdown.BloodmoonOver && !Event.Open) { _autoShutdownBloodmoonOver++; if (_autoShutdownBloodmoonOver == 1) { AutoShutdown.BloodmoonOverAlert(); } else if (_autoShutdownBloodmoonOver >= 900) { _autoShutdownBloodmoonOver = 0; AutoShutdown.BloodmoonOver = false; AutoShutdown.Shutdown(); } } if (InfoTicker.IsEnabled) { _infoTicker++; if (_infoTicker >= InfoTicker.Delay * 60) { _infoTicker = 0; InfoTicker.StatusCheck(); } } else { _infoTicker = 0; } if (Event.Invited) { _eventInvitation++; if (_eventInvitation >= 900) { _eventInvitation = 0; Event.Invited = false; Event.CheckOpen(); } } else { _eventInvitation = 0; } if (Event.Open) { _eventOpen++; if (_eventOpen == _eventTime / 2) { Event.HalfTime(); } if (_eventOpen == _eventTime - 300) { Event.FiveMin(); } if (_eventOpen >= _eventTime) { _eventOpen = 0; Event.EndEvent(); } } else { _eventOpen = 0; } if (RestartVote.Startup) { _restartVote++; if (_restartVote >= 1800) { RestartVote.Startup = false; } } else { _restartVote = 0; } if (Zones.IsEnabled & Zones.Reminder.Count > 0) { _zoneReminder++; if (_zoneReminder >= Zones.Reminder_Delay * 60) { _zoneReminder = 0; Zones.ReminderExec(); } } else { _zoneReminder = 0; } if (AutoBackup.IsEnabled) { _autoBackup++; if (_autoBackup >= AutoBackup.Delay * 60) { _autoBackup = 0; AutoBackup.Exec(); } } else { _autoBackup = 0; } if (BreakTime.IsEnabled) { _breakTime++; if (_breakTime >= BreakTime.Break_Time * 60) { _breakTime = 0; BreakTime.Exec(); } } else { _breakTime = 0; } if (Tracking.IsEnabled) { _tracking++; if (_tracking >= Tracking.Rate) { _tracking = 0; Tracking.Exec(); } } else { _tracking = 0; } if (InvalidItems.IsEnabled && InvalidItems.Check_Storage) { _invalidItems++; if (_invalidItems >= 300) { _invalidItems = 0; InvalidItems.CheckStorage(); } } else { _invalidItems = 0; } if (RealWorldTime.IsEnabled) { _realWorldTime++; if (_realWorldTime >= RealWorldTime.Delay * 60) { _realWorldTime = 0; RealWorldTime.Time(); } } else { _realWorldTime = 0; } } }
private static void Exec() { if (!StopServer.ShuttingDown) { PersistentOperations.PlayerCheck(); if (Jail.IsEnabled) { Jail.StatusCheck(); } if (TwoSecondTick >= 2) { TwoSecondTick = 0; if (WorldRadius.IsEnabled) { WorldRadius.Exec(); } if (PlayerChecks.GodEnabled || PlayerChecks.FlyEnabled || PlayerChecks.SpectatorEnabled || PlayerChecks.WaterEnabled) { PlayerChecks.Exec(); } } if (FiveSecondTick >= 5) { FiveSecondTick = 0; if (Zones.IsEnabled) { Zones.HostileCheck(); } if (PlayerStats.IsEnabled) { PlayerStats.Exec(); } } if (TenSecondTick >= 10) { TenSecondTick = 0; if (EntityCleanup.IsEnabled) { EntityCleanup.EntityCheck(); } } if (SixtySecondTick >= 60) { SixtySecondTick = 0; if (Jail.IsEnabled && Jail.Jailed.Count > 0) { Jail.Clear(); } if (Mute.IsEnabled && Mute.Mutes.Count > 0) { Mute.Clear(); } if (BloodmoonWarrior.IsEnabled) { BloodmoonWarrior.Exec(); } } if (WeatherVote.IsEnabled && WeatherVote.VoteOpen) { _weatherVote++; if (_weatherVote >= 60) { _weatherVote = 0; WeatherVote.VoteOpen = false; WeatherVote.ProcessWeatherVote(); } } if (RestartVote.IsEnabled && RestartVote.VoteOpen) { _restartVote++; if (_restartVote >= 60) { _restartVote = 0; RestartVote.VoteOpen = false; RestartVote.ProcessRestartVote(); } } if (MuteVote.IsEnabled && MuteVote.VoteOpen) { _muteVote++; if (_muteVote >= 60) { _muteVote = 0; MuteVote.VoteOpen = false; MuteVote.ProcessMuteVote(); } } if (KickVote.IsEnabled && KickVote.VoteOpen) { _kickVote++; if (_kickVote >= 60) { _kickVote = 0; KickVote.VoteOpen = false; KickVote.ProcessKickVote(); } } if (Lottery.IsEnabled && Lottery.OpenLotto) { _lottery++; if (_lottery == 3300) { Lottery.Alert(); } if (_lottery >= 3600) { _lottery = 0; Lottery.StartLotto(); } } else { _lottery = 0; } if (Hordes.IsEnabled) { _horde++; if (_horde >= 1200) { _horde = 0; Hordes.Exec(); } } else { _horde = 0; } if (NightAlert.IsEnabled) { _nightAlert++; if (_nightAlert >= NightAlert.Delay * 60) { _nightAlert = 0; NightAlert.Exec(); } } else { _nightAlert = 0; } if (Watchlist.IsEnabled) { _watchList++; if (_watchList >= Watchlist.Delay * 60) { _watchList = 0; Watchlist.CheckWatchlist(); } } else { _watchList = 0; } if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show) { if (Bloodmoon.Delay > 0) { _bloodmoon++; if (_bloodmoon >= Bloodmoon.Delay * 60) { _bloodmoon = 0; Bloodmoon.StatusCheck(); } } } else { _bloodmoon = 0; } if (PlayerLogs.IsEnabled & PlayerLogs.Delay > 0) { _playerLogs++; if (_playerLogs >= PlayerLogs.Delay) { _playerLogs = 0; PlayerLogs.Exec(); } } else { _playerLogs = 0; } if (StopServer.CountingDown) { StopServerSeconds++; if (StopServerSeconds == 60) { StopServerSeconds = 0; StopServerMinutes--; } if (StopServerMinutes == 0) { StopServerSeconds = 0; StopServer.CountingDown = false; StopServer.Stop(); } if (StopServerMinutes == 1 && StopServerSeconds == 0) { StopServer.StartShutdown3(); } if (StopServerMinutes > 1 && StopServerSeconds == 0) { StopServer.StartShutdown2(StopServerMinutes); } if (StopServerMinutes == 1 && StopServerSeconds == 30) { StopServer.Kick30(); } } if (AutoSaveWorld.IsEnabled & AutoSaveWorld.Delay > 0) { _autoSaveWorld++; if (_autoSaveWorld >= AutoSaveWorld.Delay * 60) { _autoSaveWorld = 0; AutoSaveWorld.Save(); } } else { _autoSaveWorld = 0; } if (Shutdown.IsEnabled && !StopServer.CountingDown) { if (Shutdown.BloodmoonOver && !Event.Open) { _shutdownBloodmoonOver++; if (_shutdownBloodmoonOver >= 900) { _shutdownBloodmoonOver = 0; Shutdown.BloodmoonOver = false; Shutdown.Stop(); } } else if (!Shutdown.Bloodmoon) { _shutdown++; if (_shutdown >= Shutdown.Delay * 60) { if (Event.Open) { if (!Event.OperatorWarned) { Event.OperatorWarned = true; ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(Event.Operator); if (_cInfo != null) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "A scheduled shutdown is set to begin but is on hold until the event ends" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } else { _shutdown = 0; Shutdown.BloodmoonCheck(); } } } else if (Shutdown.Bloodmoon) { _shutdownBloodmoon++; if (_shutdownBloodmoon >= 150) { _shutdownBloodmoon = 0; Shutdown.BloodmoonCheck(); } } } else { _shutdown = 0; } if (InfoTicker.IsEnabled) { _infoTicker++; if (_infoTicker >= InfoTicker.Delay * 60) { _infoTicker = 0; InfoTicker.Exec(); } } else { _infoTicker = 0; } if (Event.Invited) { _eventInvitation++; if (_eventInvitation >= 900) { _eventInvitation = 0; Event.Invited = false; Event.CheckOpen(); } } else { _eventInvitation = 0; } if (Event.Open) { _eventOpen++; if (_eventOpen == _eventTime / 2) { Event.HalfTime(); } if (_eventOpen == _eventTime - 300) { Event.FiveMin(); } if (_eventOpen >= _eventTime) { _eventOpen = 0; Event.EndEvent(); } } else { _eventOpen = 0; } if (RestartVote.Cycle) { _restartVoteCycle++; if (_restartVoteCycle >= 1800) { RestartVote.Cycle = false; } } else { _restartVoteCycle = 0; } if (Zones.IsEnabled & Zones.Reminder.Count > 0) { _zoneReminder++; if (_zoneReminder >= Zones.Reminder_Delay * 60) { _zoneReminder = 0; Zones.ReminderExec(); } } else { _zoneReminder = 0; } if (AutoBackup.IsEnabled) { _autoBackup++; if (_autoBackup >= AutoBackup.Delay * 60) { _autoBackup = 0; AutoBackup.Exec(); } } else { _autoBackup = 0; } if (BreakTime.IsEnabled) { _breakTime++; if (_breakTime >= BreakTime.Break_Time * 60) { _breakTime = 0; BreakTime.Exec(); } } else { _breakTime = 0; } if (Track.IsEnabled) { _tracking++; if (_tracking >= 20) { _tracking = 0; Track.Exec(); } } else { _tracking = 0; } if (InvalidItems.IsEnabled && InvalidItems.Check_Storage) { _invalidItems++; if (_invalidItems >= 300) { _invalidItems = 0; InvalidItems.CheckStorage(); } } else { _invalidItems = 0; } if (RealWorldTime.IsEnabled) { _realWorldTime++; if (_realWorldTime >= RealWorldTime.Delay * 60) { _realWorldTime = 0; RealWorldTime.Time(); } } else { _realWorldTime = 0; } } }
public static void Exec() { try { if (Schedule.Count > 0) { foreach (var entry in Schedule.ToArray()) { switch (entry.Key) { case "AutoBackup": if (DateTime.Now >= entry.Value) { autoBackup = ""; AutoBackup.SetDelay(); AutoBackup.Exec(); } continue; case "AutoSaveWorld": if (DateTime.Now >= entry.Value) { autoSaveWorld = ""; AutoSaveWorld.SetDelay(); AutoSaveWorld.Save(); } continue; case "Bloodmoon": if (DateTime.Now >= entry.Value) { bloodmoon = ""; Bloodmoon.SetDelay(); Bloodmoon.StatusCheck(); } continue; case "BreakTime": if (DateTime.Now >= entry.Value) { breakTime = ""; BreakTime.SetDelay(); BreakTime.Exec(); } continue; case "InfoTicker": if (DateTime.Now >= entry.Value) { infoTicker = ""; InfoTicker.SetDelay(); InfoTicker.Exec(); } continue; case "NightAlert": if (DateTime.Now >= entry.Value) { nightAlert = ""; NightAlert.SetDelay(); NightAlert.Exec(); } continue; case "PlayerLogs": if (DateTime.Now >= entry.Value) { playerLogs = ""; PlayerLogs.SetDelay(); PlayerLogs.Exec(); } continue; case "RealWorldTime": if (DateTime.Now >= entry.Value) { realWorldTime = ""; RealWorldTime.SetDelay(); RealWorldTime.Exec(); } continue; case "Shutdown": if (DateTime.Now >= entry.Value) { Remove("Shutdown"); Shutdown.PrepareShutdown(); } continue; case "WatchList": if (DateTime.Now >= entry.Value) { watchList = ""; WatchList.SetDelay(); WatchList.Exec(); } continue; case "Zones": if (DateTime.Now >= entry.Value) { zones = ""; Zones.SetDelay(); Zones.ReminderExec(); } continue; } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in EventSchedule.Exec: {0}", e.Message)); } }