public static void PrepareShutdown()
 {
     if (Shutdown.Bloodmoon() || Event.Open)
     {
         EventSchedule.Add("Shutdown", DateTime.Now.AddMinutes(10));
         if (Event.Open && !Event.OperatorWarned)
         {
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(Event.Operator);
             if (_cInfo != null)
             {
                 Event.OperatorWarned = true;
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + "A scheduled shutdown is set to begin but is on hold until the event ends" + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
         }
     }
     else
     {
         EventSchedule.Remove("Shutdown");
         Shutdown.Stop();
     }
 }
Ejemplo n.º 2
0
 public static void OldPlayerJoined(ClientInfo _cInfo)
 {
     if (Hardcore.IsEnabled)
     {
         if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId))
         {
             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (_player != null)
             {
                 if (Hardcore.Optional)
                 {
                     if (PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
                     {
                         Hardcore.Check(_cInfo, _player);
                     }
                 }
                 else if (!PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
                 {
                     string[] _hardcoreStats = { _cInfo.playerName, XUiM_Player.GetDeaths(_player).ToString(), "0" };
                     PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats   = _hardcoreStats;
                     PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled = true;
                     Hardcore.Check(_cInfo, _player);
                 }
             }
         }
     }
     if (LoginNotice.IsEnabled && LoginNotice.dict.ContainsKey(_cInfo.playerId))
     {
         LoginNotice.PlayerNotice(_cInfo);
     }
     if (Motd.IsEnabled)
     {
         Motd.Send(_cInfo);
     }
     if (Bloodmoon.IsEnabled)
     {
         Bloodmoon.Exec(_cInfo);
     }
     if (Shutdown.IsEnabled && Shutdown.Alert_On_Login)
     {
         Shutdown.NextShutdown(_cInfo);
     }
     if (BattleLogger.IsEnabled)
     {
         BattleLogger.AlertPlayer(_cInfo);
     }
     if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.playerId))
     {
         Poll.Message(_cInfo);
     }
     if (ClanManager.IsEnabled)
     {
         Dictionary <string, string> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin;
         if (_clanRequests != null && _clanRequests.Count > 0)
         {
             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "New clan requests from:[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             foreach (var _request in _clanRequests)
             {
                 ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _request.Value + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             }
         }
     }
     if (Event.Open && Event.Teams.ContainsKey(_cInfo.playerId) && PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn)
     {
         Event.Spawn(_cInfo);
     }
     else if (PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn)
     {
         PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn = false;
         PersistentContainer.Instance.Save();
     }
 }
Ejemplo n.º 3
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;
         }
     }
 }
Ejemplo n.º 4
0
 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;
     }
 }
Ejemplo n.º 5
0
 public static void OldPlayerJoined(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         if (Hardcore.IsEnabled)
         {
             if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId))
             {
                 if (Hardcore.Optional)
                 {
                     if (PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
                     {
                         Hardcore.Check(_cInfo, _player);
                     }
                 }
                 else if (!PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
                 {
                     string[] _hardcoreStats = { _cInfo.playerName, XUiM_Player.GetDeaths(_player).ToString(), "0" };
                     PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats   = _hardcoreStats;
                     PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled = true;
                     PersistentContainer.DataChange = true;
                     Hardcore.Check(_cInfo, _player);
                 }
             }
         }
         if (LoginNotice.IsEnabled && LoginNotice.dict.ContainsKey(_cInfo.playerId))
         {
             LoginNotice.PlayerNotice(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (Shutdown.IsEnabled && Shutdown.Alert_On_Login)
         {
             Shutdown.NextShutdown(_cInfo);
         }
         if (ExitCommand.IsEnabled)
         {
             ExitCommand.AlertPlayer(_cInfo);
         }
         if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.playerId))
         {
             Poll.Message(_cInfo);
         }
         if (ClanManager.IsEnabled)
         {
             Dictionary <string, string> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin;
             if (_clanRequests != null && _clanRequests.Count > 0)
             {
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + "New clan requests from:[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 foreach (var _request in _clanRequests)
                 {
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _request.Value + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
         }
         //If they are in a clan, check if we should get them into a party
         ClanManager.checkClanParty(_cInfo, _player);
         if (Event.Open && Event.Teams.ContainsKey(_cInfo.playerId) && PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn)
         {
             Event.Spawn(_cInfo);
         }
         else if (PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn)
         {
             PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn = false;
             PersistentContainer.DataChange = true;
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.OldPlayerJoined: {0}", e.Message));
     }
 }
Ejemplo n.º 6
0
 public static void OldPlayerJoined(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         string id = _cInfo.CrossplatformId.CombinedString;
         if (Hardcore.IsEnabled && PersistentContainer.Instance.Players[id] != null)
         {
             if (Hardcore.Optional)
             {
                 if (PersistentContainer.Instance.Players[id].HardcoreEnabled)
                 {
                     Hardcore.Check(_cInfo, _player);
                 }
             }
             else if (!PersistentContainer.Instance.Players[id].HardcoreEnabled)
             {
                 string[] hardcoreStats = { _cInfo.playerName, "0", "0" };
                 PersistentContainer.Instance.Players[id].HardcoreStats   = hardcoreStats;
                 PersistentContainer.Instance.Players[id].HardcoreEnabled = true;
                 PersistentContainer.DataChange = true;
                 Hardcore.Check(_cInfo, _player);
             }
         }
         if (LoginNotice.IsEnabled && LoginNotice.Dict1.ContainsKey(_cInfo.PlatformId.CombinedString) || LoginNotice.Dict1.ContainsKey(id))
         {
             LoginNotice.PlayerNotice(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (Shutdown.IsEnabled && Shutdown.Alert_On_Login)
         {
             Shutdown.NextShutdown(_cInfo);
         }
         if (ExitCommand.IsEnabled)
         {
             ExitCommand.AlertPlayer(_cInfo);
         }
         if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(id))
         {
             Poll.Message(_cInfo);
         }
         if (ClanManager.IsEnabled && PersistentContainer.Instance.Players[id] != null)
         {
             Dictionary <string, string> clanRequests = PersistentContainer.Instance.Players[id].ClanRequestToJoin;
             if (clanRequests != null && clanRequests.Count > 0)
             {
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + "New clan requests from:[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 foreach (var request in clanRequests)
                 {
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + request.Value + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
         }
         if (PersistentContainer.Instance.Players[id] != null)
         {
             if (PersistentContainer.Instance.Players[id].EventSpawn)
             {
                 PersistentContainer.Instance.Players[id].EventSpawn = false;
                 PersistentContainer.DataChange = true;
             }
             if (Wallet.IsEnabled && PersistentContainer.Instance.Players[id].PlayerWallet > 0)
             {
                 Wallet.AddCurrency(id, PersistentContainer.Instance.Players[id].PlayerWallet);
                 PersistentContainer.Instance.Players[id].PlayerWallet = 0;
                 PersistentContainer.DataChange = true;
             }
             if (PersistentContainer.Instance.Players[id].JailRelease)
             {
                 PersistentContainer.Instance.Players[id].JailRelease = false;
                 PersistentContainer.DataChange = true;
                 Vector3[] _pos = GameManager.Instance.World.GetRandomSpawnPointPositions(1);
                 _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_pos[0].x, _pos[0].y + 1, _pos[0].z), null, false));
                 Phrases.Dict.TryGetValue("Jail2", out string phrase);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
         }
         if (AutoPartyInvite.IsEnabled)
         {
             AutoPartyInvite.Exec(_cInfo, _player);
         }
         if (Event.Open && Event.Teams.ContainsKey(id) && PersistentContainer.Instance.Players[id] != null && PersistentContainer.Instance.Players[id].EventSpawn)
         {
             Event.Spawn(_cInfo);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.OldPlayerJoined: {0}", e.Message));
     }
 }
        public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
        {
            try
            {
                if (_params.Count != 1)
                {
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, found '{0}'", _params.Count));

                    return;
                }
                if (_params[0] == "cancel")
                {
                    if (!Shutdown.ShuttingDown)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output("[SERVERTOOLS] Stopserver is not running");
                    }
                    else
                    {
                        Shutdown.ShuttingDown = false;
                        Shutdown.NoEntry      = false;
                        Shutdown.UI_Locked    = false;
                        Lottery.ShuttingDown  = false;
                        if (ExitCommand.IsEnabled)
                        {
                            List <ClientInfo> clientList = PersistentOperations.ClientList();
                            if (clientList != null)
                            {
                                for (int i = 0; i < clientList.Count; i++)
                                {
                                    ClientInfo cInfo = clientList[i];
                                    if (!ExitCommand.Players.ContainsKey(cInfo.entityId) && (GameManager.Instance.adminTools.GetUserPermissionLevel(cInfo.PlatformId) > ExitCommand.Admin_Level &&
                                                                                             GameManager.Instance.adminTools.GetUserPermissionLevel(cInfo.CrossplatformId) > ExitCommand.Admin_Level))
                                    {
                                        EntityPlayer player = PersistentOperations.GetEntityPlayer(cInfo.entityId);
                                        if (player != null)
                                        {
                                            ExitCommand.Players.Add(cInfo.entityId, player.position);
                                        }
                                    }
                                }
                            }
                        }
                        if (Shutdown.IsEnabled)
                        {
                            Shutdown.SetDelay();
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output("[SERVERTOOLS] Stopserver has been cancelled and the next shutdown has been reset");
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output("[SERVERTOOLS] Stopserver has been cancelled");
                        }
                    }
                }
                else
                {
                    if (Shutdown.ShuttingDown)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Server is already set to shutdown. Cancel it if you wish to set a new countdown"));
                    }
                    else
                    {
                        if (int.TryParse(_params[0], out int countdown))
                        {
                            Shutdown.StartShutdown(countdown);
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid time specified '{0}'", _params[0]));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in StopServerCommandConsole.Execute: {0}", e.Message));
            }
        }
Ejemplo n.º 8
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));
            }
        }