Ejemplo n.º 1
0
 public override void PlayerSpawning(ClientInfo _cInfo, int _chunkViewDim, PlayerProfile _playerProfile)
 {
     if (CredentialCheck.IsEnabled)
     {
         CredentialCheck.AccCheck(_cInfo);
     }
     if (Motd.IsEnabled && !Motd.Show_On_Respawn)
     {
         Motd.Send(_cInfo);
     }
     if (AutoShutdown.IsEnabled)
     {
         if (AutoShutdown.Alert_On_Login)
         {
             AutoShutdown.CheckNextShutdown(_cInfo, false);
         }
     }
     if (Bloodmoon.Show_On_Login && !Bloodmoon.Show_On_Respawn)
     {
         Bloodmoon.GetBloodmoon(_cInfo, false);
     }
     if (LoginNotice.IsEnabled)
     {
         LoginNotice.PlayerCheck(_cInfo);
     }
     Players.SessionTime(_cInfo);
 }
Ejemplo n.º 2
0
 public static void NewPlayerExec3(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         if (NewPlayer.IsEnabled)
         {
             NewPlayer.Exec(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (BattleLogger.IsEnabled)
         {
             BattleLogger.AlertPlayer(_cInfo);
         }
         if (PollConsole.IsEnabled)
         {
             string _sql = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
             if (!string.IsNullOrEmpty(_sql))
             {
                 DataTable _result = SQL.TypeQuery(_sql);
                 if (_result.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId))
                 {
                     PollConsole.Message(_cInfo);
                 }
                 _result.Dispose();
             }
         }
         if (Hardcore.IsEnabled && !Hardcore.Optional)
         {
             string    _sql    = string.Format("SELECT * FROM Hardcore WHERE steamid = '{0}'", _cInfo.playerId);
             DataTable _result = SQL.TypeQuery(_sql);
             if (_result.Rows.Count == 0)
             {
                 int    _deaths     = XUiM_Player.GetDeaths(_player);
                 string _playerName = SQL.EscapeString(_cInfo.playerName);
                 SQL.FastQuery(string.Format("INSERT INTO Hardcore (steamid, playerName, deaths) VALUES ('{0}', '{1}', {2})", _cInfo.playerId, _playerName, _deaths), null);
             }
             else
             {
                 SQL.FastQuery(_sql = string.Format("UPDATE Hardcore SET deaths = {0} WHERE steamid = '{1}'", 0, _cInfo.playerId), "Hardcore");
             }
             _result.Dispose();
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.NewPlayerExec3: {0}.", e.Message));
     }
     PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer = true;
     PersistentContainer.Instance.Save();
 }
Ejemplo n.º 3
0
        public static void NewPlayerExec()
        {
            ClientInfo   _cInfo  = Que[0];
            EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];

            if (_cInfo != null && _player.IsSpawned())
            {
                if (Motd.IsEnabled & Motd.Show_On_Respawn)
                {
                    Motd.Send(_cInfo);
                }
                if (Bloodmoon.Show_On_Login && Bloodmoon.Show_On_Respawn)
                {
                    Bloodmoon.GetBloodmoon(_cInfo, false);
                }
                if (NewPlayer.IsEnabled)
                {
                    NewPlayer.Exec(_cInfo);
                }
                if (NewSpawnTele.IsEnabled)
                {
                    NewSpawnTele.TeleNewSpawn(_cInfo);
                }
                if (StartingItems.IsEnabled)
                {
                    if (!NewSpawnTele.IsEnabled)
                    {
                        StartingItems.StartingItemCheck(_cInfo);
                    }
                    else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position != "0,0,0")
                    {
                        StartingItems.Que.Add(_cInfo.playerId);
                    }
                    else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position == "0,0,0")
                    {
                        StartingItems.StartingItemCheck(_cInfo);
                    }
                }
                string    _sql     = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
                DataTable _result1 = SQL.TQuery(_sql);
                if (_result1.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId))
                {
                    PollConsole.Message(_cInfo);
                }
                _result1.Dispose();
                if (Hardcore.IsEnabled)
                {
                    Hardcore.Announce(_cInfo);
                }
                string _name = SQL.EscapeString(_cInfo.playerName);
                _name = Regex.Replace(_name, @"[^\u0000-\u007F]+", string.Empty);
                _sql  = string.Format("UPDATE Players SET playername = '{0}', wallet = 0, playerSpentCoins = 0, sessionTime = 0, zkills = 0, kills = 0, deaths = 0 WHERE steamid = '{1}'", _name, _cInfo.playerId);
                SQL.FastQuery(_sql, "API");
                Que.RemoveAt(0);
            }
        }
Ejemplo n.º 4
0
 public override void PlayerSpawning(ClientInfo _cInfo, int _chunkViewDim, PlayerProfile _playerProfile)
 {
     if (Motd.IsEnabled)
     {
         Motd.Send(_cInfo);
     }
     if (ClanManager.IsEnabled)
     {
         ClanManager.CheckforClantag(_cInfo);
     }
 }
Ejemplo n.º 5
0
 public static void NewPlayerExec3(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         if (NewPlayer.IsEnabled)
         {
             NewPlayer.Exec(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (BattleLogger.IsEnabled)
         {
             BattleLogger.AlertPlayer(_cInfo);
         }
         if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.playerId))
         {
             Poll.Message(_cInfo);
         }
         if (Hardcore.IsEnabled)
         {
             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);
             }
         }
         PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer = true;
         PersistentContainer.Instance.Save();
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.NewPlayerExec3: {0}", e.Message));
     }
 }
Ejemplo n.º 6
0
 public static void ProcessPlayer(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         string id = _cInfo.CrossplatformId.CombinedString;
         if (NewPlayer.IsEnabled)
         {
             NewPlayer.Exec(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (ExitCommand.IsEnabled)
         {
             ExitCommand.AlertPlayer(_cInfo);
         }
         if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(id))
         {
             Poll.Message(_cInfo);
         }
         if (Hardcore.IsEnabled)
         {
             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);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.ProcessPlayer: {0}", e.Message));
     }
 }
Ejemplo n.º 7
0
 public override void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)
 {
     if (Jail.IsEnabled)
     {
         Jail.CheckPlayer(_cInfo);
     }
     if (NewSpawnTele.IsEnabled)
     {
         NewSpawnTele.TeleNewSpawn(_cInfo);
     }
     if (Motd.IsEnabled)
     {
         Motd.Send(_cInfo);
     }
     if (Bloodmoon.ShowOnSpawn)
     {
         Bloodmoon.GetBloodmoon(_cInfo, false);
     }
 }
Ejemplo n.º 8
0
 public static void Load()
 {
     if (!RunTimePatch.Applied)
     {
         RunTimePatch.PatchAll();
     }
     if (!Timers.IsRunning)
     {
         Timers.TimerStart();
     }
     if (!LoadTriggers.IsRunning)
     {
         LoadTriggers.Load();
     }
     if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen)
     {
         Poll.CheckTime();
     }
     if (!ClanManager.IsEnabled)
     {
         ClanManager.Clans.Clear();
         ClanManager.ClanMember.Clear();
     }
     if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
     {
         InfoTicker.Unload();
     }
     if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
     {
         InfoTicker.Load();
     }
     if (Gimme.IsRunning && !Gimme.IsEnabled)
     {
         Gimme.Unload();
     }
     if (!Gimme.IsRunning && Gimme.IsEnabled)
     {
         Gimme.Load();
     }
     if (Badwords.IsRunning && !Badwords.IsEnabled)
     {
         Badwords.Unload();
     }
     if (!Badwords.IsRunning && Badwords.IsEnabled)
     {
         Badwords.Load();
     }
     if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
     {
         LoginNotice.Load();
     }
     if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
     {
         LoginNotice.Unload();
     }
     if (!Zones.IsRunning && Zones.IsEnabled)
     {
         Zones.Load();
     }
     if (Zones.IsRunning && !Zones.IsEnabled)
     {
         Zones.Unload();
     }
     if (!VoteReward.IsRunning && VoteReward.IsEnabled)
     {
         VoteReward.Load();
     }
     if (VoteReward.IsRunning && !VoteReward.IsEnabled)
     {
         VoteReward.Unload();
     }
     if (!Watchlist.IsRunning && Watchlist.IsEnabled)
     {
         Watchlist.Load();
     }
     if (Watchlist.IsRunning && !Watchlist.IsEnabled)
     {
         Watchlist.Unload();
     }
     if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
     {
         ReservedSlots.Load();
     }
     if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
     {
         ReservedSlots.Unload();
     }
     if (!StartingItems.IsRunning && StartingItems.IsEnabled)
     {
         StartingItems.Load();
     }
     if (StartingItems.IsRunning && !StartingItems.IsEnabled)
     {
         StartingItems.Unload();
     }
     if (!Travel.IsRunning && Travel.IsEnabled)
     {
         Travel.Load();
     }
     if (Travel.IsRunning && !Travel.IsEnabled)
     {
         Travel.Unload();
     }
     if (!Shop.IsRunning && Shop.IsEnabled)
     {
         Shop.Load();
     }
     if (Shop.IsRunning && !Shop.IsEnabled)
     {
         Shop.Unload();
     }
     if (!Motd.IsRunning && Motd.IsEnabled)
     {
         Motd.Load();
     }
     if (Motd.IsRunning && !Motd.IsEnabled)
     {
         Motd.Unload();
     }
     if (InvalidItems.IsRunning && !InvalidItems.IsEnabled)
     {
         InvalidItems.Unload();
     }
     if (!InvalidItems.IsRunning && InvalidItems.IsEnabled)
     {
         InvalidItems.Load();
     }
     if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled)
     {
         HighPingKicker.Unload();
     }
     if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled)
     {
         HighPingKicker.Load();
     }
     if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
     {
         CredentialCheck.Unload();
     }
     if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
     {
         CredentialCheck.Load();
     }
     if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
     {
         CustomCommands.Unload();
     }
     if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
     {
         CustomCommands.Load();
     }
     if (DupeLog.IsRunning && !DupeLog.IsEnabled)
     {
         DupeLog.Unload();
     }
     if (!DupeLog.IsRunning && DupeLog.IsEnabled)
     {
         DupeLog.Load();
     }
     if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
     {
         ChatColorPrefix.Unload();
     }
     if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
     {
         ChatColorPrefix.Load();
     }
     if (KillNotice.IsRunning && !KillNotice.IsEnabled)
     {
         KillNotice.Unload();
     }
     if (!KillNotice.IsRunning && KillNotice.IsEnabled)
     {
         KillNotice.Load();
     }
     if (Prayer.IsRunning && !Prayer.IsEnabled)
     {
         Prayer.Unload();
     }
     if (!Prayer.IsRunning && Prayer.IsEnabled)
     {
         Prayer.Load();
     }
     if (BloodmoonWarrior.IsRunning && !BloodmoonWarrior.IsEnabled)
     {
         BloodmoonWarrior.Unload();
     }
     if (!BloodmoonWarrior.IsRunning && BloodmoonWarrior.IsEnabled)
     {
         BloodmoonWarrior.Load();
     }
     if (ProtectedSpaces.IsRunning && !ProtectedSpaces.IsEnabled)
     {
         ProtectedSpaces.Unload();
     }
     if (!ProtectedSpaces.IsRunning && ProtectedSpaces.IsEnabled)
     {
         ProtectedSpaces.Load();
     }
     if (ClanManager.IsEnabled)
     {
         ClanManager.ClanList();
     }
     if (Auction.IsEnabled)
     {
         Auction.AuctionList();
     }
     if (Mute.IsEnabled)
     {
         Mute.ClientMuteList();
         Mute.MuteList();
     }
     if (Jail.IsEnabled)
     {
         Jail.JailList();
     }
     //always load the website last
     if (WebsiteServer.IsEnabled && !WebsiteServer.DirFound)
     {
         WebsiteServer.CheckDir();
     }
     if (WebsiteServer.IsRunning && !WebsiteServer.IsEnabled)
     {
         WebsiteServer.Unload();
     }
     if (!WebsiteServer.IsRunning && WebsiteServer.IsEnabled && WebsiteServer.DirFound)
     {
         WebsiteServer.Load();
     }
 }
Ejemplo n.º 9
0
 private static void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)//Spawning player
 {
     try
     {
         if (_cInfo != null)
         {
             if (_respawnReason == RespawnType.EnterMultiplayer)//New player spawned
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].PlayerName = _cInfo.playerName;
                 PersistentContainer.Instance.Save();
                 PersistentOperations.SessionTime(_cInfo);
                 Timers.NewPlayerExecTimer(_cInfo);
             }
             else if (_respawnReason == RespawnType.JoinMultiplayer)//Old player spawned
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].PlayerName = _cInfo.playerName;
                 PersistentContainer.Instance.Save();
                 PersistentOperations.SessionTime(_cInfo);
                 if (!PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer)
                 {
                     Timers.NewPlayerExecTimer(_cInfo);
                 }
                 else
                 {
                     if (Hardcore.IsEnabled && !Hardcore.Optional)
                     {
                         string    _sql    = string.Format("SELECT * FROM Hardcore WHERE steamid = '{0}'", _cInfo.playerId);
                         DataTable _result = SQL.TypeQuery(_sql);
                         if (_result.Rows.Count == 0)
                         {
                             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                             if (_player != null)
                             {
                                 int    _deaths     = XUiM_Player.GetDeaths(_player);
                                 string _playerName = SQL.EscapeString(_cInfo.playerName);
                                 SQL.FastQuery(string.Format("INSERT INTO Hardcore (steamid, playerName, deaths) VALUES ('{0}', '{1}', {2})", _cInfo.playerId, _playerName, _deaths), null);
                             }
                         }
                         _result.Dispose();
                     }
                     if (LoginNotice.IsEnabled && LoginNotice.dict.ContainsKey(_cInfo.playerId))
                     {
                         LoginNotice.PlayerNotice(_cInfo);
                     }
                     if (Motd.IsEnabled)
                     {
                         Motd.Send(_cInfo);
                     }
                     if (Bloodmoon.IsEnabled)
                     {
                         Bloodmoon.Exec(_cInfo);
                     }
                     if (AutoShutdown.IsEnabled && AutoShutdown.Alert_On_Login)
                     {
                         AutoShutdown.NextShutdown(_cInfo);
                     }
                     if (Hardcore.IsEnabled)
                     {
                         if (!Hardcore.Optional)
                         {
                             Hardcore.Alert(_cInfo);
                         }
                         else if (PersistentContainer.Instance.Players[_cInfo.playerId].Hardcore)
                         {
                             Hardcore.Alert(_cInfo);
                         }
                     }
                     if (BattleLogger.IsEnabled)
                     {
                         BattleLogger.AlertPlayer(_cInfo);
                     }
                     if (PollConsole.IsEnabled)
                     {
                         string _sql = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
                         if (!string.IsNullOrEmpty(_sql))
                         {
                             DataTable _result = SQL.TypeQuery(_sql);
                             if (_result.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId))
                             {
                                 PollConsole.Message(_cInfo);
                             }
                             _result.Dispose();
                         }
                     }
                     if (Event.Open)
                     {
                         if (Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                         {
                             string _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                             if (!string.IsNullOrEmpty(_sql))
                             {
                                 DataTable _result1      = SQL.TypeQuery(_sql);
                                 bool      _eventRespawn = false;
                                 if (_result1.Rows.Count > 0)
                                 {
                                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn);
                                 }
                                 _result1.Dispose();
                                 if (_eventRespawn)
                                 {
                                     Event.Died(_cInfo);
                                 }
                                 else
                                 {
                                     _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                                     DataTable _result2 = SQL.TypeQuery(_sql);
                                     bool      _return1 = false, _return2 = false;
                                     if (_result2.Rows.Count > 0)
                                     {
                                         bool.TryParse(_result2.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                                         bool.TryParse(_result2.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                                     }
                                     _result2.Dispose();
                                     if (_return1)
                                     {
                                         if (_return2)
                                         {
                                             _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                             SQL.FastQuery(_sql, "API");
                                         }
                                         _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                         SQL.FastQuery(_sql, "API");
                                         Event.EventSpawn(_cInfo);
                                     }
                                     else if (_return2)
                                     {
                                         Event.EventSpawn(_cInfo);
                                     }
                                 }
                             }
                         }
                     }
                     if (ClanManager.IsEnabled)
                     {
                         List <string[]> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin;
                         if (_clanRequests != null && _clanRequests.Count > 0)
                         {
                             string[] _request    = _clanRequests[0];
                             string   _playerName = _request[1];
                             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "There is a request to join the group from " + _playerName + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                         }
                     }
                 }
             }
             else if (_respawnReason == RespawnType.Died)//Player Died
             {
                 PersistentOperations.SessionTime(_cInfo);
                 if (Bloodmoon.IsEnabled && Bloodmoon.Show_On_Respawn)
                 {
                     Bloodmoon.Exec(_cInfo);
                 }
                 if (BattleLogger.IsEnabled)
                 {
                     BattleLogger.AlertPlayer(_cInfo);
                 }
                 if (Event.Open)
                 {
                     if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                     {
                         string _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                         if (!string.IsNullOrEmpty(_sql))
                         {
                             DataTable _result1 = SQL.TypeQuery(_sql);
                             bool      _return1 = false, _return2 = false;
                             if (_result1.Rows.Count > 0)
                             {
                                 bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                                 bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                             }
                             _result1.Dispose();
                             if (_return1)
                             {
                                 if (_return2)
                                 {
                                     _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                     SQL.FastQuery(_sql, "API");
                                 }
                                 _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                 SQL.FastQuery(_sql, "API");
                                 Event.EventSpawn(_cInfo);
                                 return;
                             }
                         }
                     }
                     else
                     {
                         string _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                         if (!string.IsNullOrEmpty(_sql))
                         {
                             DataTable _result       = SQL.TypeQuery(_sql);
                             bool      _eventRespawn = false;
                             if (_result.Rows.Count > 0)
                             {
                                 bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn);
                             }
                             _result.Dispose();
                             if (_eventRespawn)
                             {
                                 Event.Died(_cInfo);
                                 return;
                             }
                             else
                             {
                                 _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                                 DataTable _result1 = SQL.TypeQuery(_sql);
                                 bool      _return1 = false, _return2 = false;
                                 if (_result1.Rows.Count > 0)
                                 {
                                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                                 }
                                 _result1.Dispose();
                                 if (_return1)
                                 {
                                     if (_return2)
                                     {
                                         _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                         SQL.FastQuery(_sql, "API");
                                     }
                                     _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                     SQL.FastQuery(_sql, "API");
                                     Event.EventSpawn(_cInfo);
                                     return;
                                 }
                                 else if (_return2)
                                 {
                                     Event.EventSpawn(_cInfo);
                                     return;
                                 }
                             }
                         }
                     }
                 }
                 else
                 {
                     string _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     if (!string.IsNullOrEmpty(_sql))
                     {
                         DataTable _result1 = SQL.TypeQuery(_sql);
                         bool      _return1 = false, _return2 = false;
                         if (_result1.Rows.Count > 0)
                         {
                             bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                             bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                         }
                         _result1.Dispose();
                         if (_return1)
                         {
                             if (_return2)
                             {
                                 _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                 SQL.FastQuery(_sql, "API");
                             }
                             _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                             SQL.FastQuery(_sql, "API");
                             Event.EventSpawn(_cInfo);
                             return;
                         }
                     }
                 }
                 if (Wallet.IsEnabled)
                 {
                     if (Wallet.Lose_On_Death)
                     {
                         Wallet.ClearWallet(_cInfo);
                     }
                     else if (Wallet.Deaths > 0)
                     {
                         Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Wallet.Deaths);
                     }
                 }
                 if (Hardcore.IsEnabled)
                 {
                     if (!Hardcore.Optional)
                     {
                         Hardcore.Check(_cInfo);
                     }
                     else if (PersistentContainer.Instance.Players[_cInfo.playerId].Hardcore)
                     {
                         Hardcore.Check(_cInfo);
                     }
                 }
                 if (Zones.IsEnabled && Zones.Victim.ContainsKey(_cInfo.entityId))
                 {
                     string _response = " type {CommandPrivate}{Command50} to teleport back to your death position. There is a time limit.";
                     _response = _response.Replace("{CommandPrivate}", ChatHook.Command_Private);
                     _response = _response.Replace("{Command50}", Zones.Command50);
                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _response + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     PersistentContainer.Instance.Players[_cInfo.playerId].ZoneDeathTime = DateTime.Now;
                     PersistentContainer.Instance.Save();
                     if (Zones.Forgive.ContainsKey(_cInfo.entityId))
                     {
                         string _response2 = " type {CommandPrivate}{Command55} to release your killer from jail.";
                         _response2 = _response2.Replace("{CommandPrivate}", ChatHook.Command_Private);
                         _response2 = _response2.Replace("{Command55}", Jail.Command55);
                         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _response2 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     }
                 }
             }
             else if (_respawnReason == RespawnType.Teleport)
             {
             }
             string _ip = _cInfo.ip;
             if (_ip.Contains(":"))
             {
                 _ip = _ip.Split(':').First();
             }
             if (!string.IsNullOrEmpty(_ip) && BattleLogger.IsEnabled && BattleLogger.LogFound && !StopServer.StopServerCountingDown && !StopServer.Shutdown && GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId).PermissionLevel > BattleLogger.Admin_Level)
             {
                 if (!BattleLogger.Players.ContainsKey(_cInfo.playerId))
                 {
                     BattleLogger.Players.Add(_cInfo.playerId, _cInfo.ip);
                 }
                 else
                 {
                     string _recordedIp;
                     BattleLogger.Players.TryGetValue(_cInfo.playerId, out _recordedIp);
                     if (_recordedIp != _ip)
                     {
                         BattleLogger.Players[_cInfo.playerId] = _ip;
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerSpawnedInWorld: {0}.", e.Message));
     }
 }
Ejemplo n.º 10
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.º 11
0
 public override void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)
 {
     if (Motd.IsEnabled & Motd.Show_On_Respawn)
     {
         Motd.Send(_cInfo);
     }
     if (Bloodmoon.Show_On_Login && Bloodmoon.Show_On_Respawn)
     {
         Bloodmoon.GetBloodmoon(_cInfo, false);
     }
     if (_respawnReason == RespawnType.EnterMultiplayer)
     {
         if (NewSpawnTele.IsEnabled)
         {
             NewSpawnTele.TeleNewSpawn(_cInfo);
         }
         if (StartingItems.IsEnabled)
         {
             if (!NewSpawnTele.IsEnabled)
             {
                 StartingItems.StartingItemCheck(_cInfo);
             }
             else if (NewSpawnTele.New_Spawn_Tele_Position != "0,0,0")
             {
                 StartingItems.Que.Add(_cInfo.playerId);
             }
             else
             {
                 StartingItems.StartingItemCheck(_cInfo);
             }
         }
         if (PersistentContainer.Instance.PollOpen && !Poll.PolledYes.Contains(_cInfo.entityId) && !Poll.PolledNo.Contains(_cInfo.entityId))
         {
             Poll.Message(_cInfo);
         }
         if (Hardcore.IsEnabled)
         {
             Hardcore.Announce(_cInfo);
         }
         PersistentContainer.Instance.Players[_cInfo.playerId, true].SessionTime      = 0;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].ZKills           = 0;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].Deaths           = 0;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].Kills            = 0;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = 0;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerName       = _cInfo.playerName;
         PersistentContainer.Instance.Save();
     }
     if (_respawnReason == RespawnType.JoinMultiplayer)
     {
         EntityPlayer _player     = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         int          _zCount     = XUiM_Player.GetZombieKills(_player);
         int          _deathCount = XUiM_Player.GetDeaths(_player);
         int          _killCount  = XUiM_Player.GetPlayerKills(_player);
         Players.FriendList(_cInfo);
         if (PersistentContainer.Instance.PollOpen && !Poll.PolledYes.Contains(_cInfo.entityId) && !Poll.PolledNo.Contains(_cInfo.entityId))
         {
             Poll.Message(_cInfo);
         }
         if (Hardcore.IsEnabled)
         {
             Hardcore.Check(_cInfo);
         }
         if (PersistentContainer.Instance.Players[_cInfo.playerId, true].EventReturn != null)
         {
             Event.OfflineReturn(_cInfo);
         }
         PersistentContainer.Instance.Players[_cInfo.playerId, true].ZKills     = _zCount;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].Deaths     = _deathCount;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].Kills      = _killCount;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerName = _cInfo.playerName;
         PersistentContainer.Instance.Save();
     }
     if (_respawnReason == RespawnType.Died)
     {
         if (Hardcore.IsEnabled)
         {
             Hardcore.Check(_cInfo);
         }
         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         PersistentContainer.Instance.Players[_cInfo.playerId, true].Deaths = XUiM_Player.GetDeaths(_player);
         PersistentContainer.Instance.Save();
         if (Event.Open && Event.SpawnList.Contains(_cInfo.entityId))
         {
             Event.Died(_cInfo);
         }
         if (Zones.IsEnabled && Players.Victim.ContainsKey(_cInfo.entityId))
         {
             _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Type /return to teleport back to your death position. There is a time limit.[-]", Config.Chat_Response_Color), Config.Server_Response_Name, false, "ServerTools", false));
             PersistentContainer.Instance.Players[_cInfo.playerId, true].RespawnTime = DateTime.Now;
             PersistentContainer.Instance.Save();
             if (Players.Forgive.ContainsKey(_cInfo.entityId))
             {
                 _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Type /forgive to release your killer from jail.[-]", Config.Chat_Response_Color), Config.Server_Response_Name, false, "ServerTools", false));
             }
         }
     }
     if (_respawnReason == RespawnType.Teleport)
     {
         if (StartingItems.IsEnabled && StartingItems.Que.Contains(_cInfo.playerId))
         {
             StartingItems.StartingItemCheck(_cInfo);
             StartingItems.Que.Remove(_cInfo.playerId);
         }
         if (Players.NoFlight.Contains(_cInfo.entityId))
         {
             Players.NoFlight.Remove(_cInfo.entityId);
         }
         if (HatchElevator.IsEnabled)
         {
             HatchElevator.LastPositionY.Remove(_cInfo.entityId);
         }
     }
     if (Players.Dead.Contains(_cInfo.entityId))
     {
         Players.Dead.Remove(_cInfo.entityId);
     }
 }
Ejemplo n.º 12
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.º 13
0
        public static void Load()
        {
            Timers.TimerStart();
            if (TeleportCheck.IsEnabled)
            {
                TeleportCheck.DetectionLogsDir();
            }
            if (CountryBan.IsEnabled)
            {
                CountryBan.Load();
            }
            if (FlightCheck.IsEnabled)
            {
                FlightCheck.DetectionLogsDir();
            }
            if (HatchElevator.IsEnabled)
            {
                HatchElevator.DetectionLogsDir();
            }
            if (PlayerLogs.IsEnabled)
            {
                PlayerLogs.PlayerLogsDir();
            }
            if (InventoryCheck.IsEnabled)
            {
                InventoryCheck.PlayerLogsDir();
            }
            if (Report.IsEnabled)
            {
                Report.ReportLogsDir();
            }
            if (PlayerStatCheck.IsEnabled)
            {
                PlayerStatCheck.DetectionLogsDir();
            }
            if (UndergroundCheck.IsEnabled)
            {
                UndergroundCheck.DetectionLogsDir();
            }
            if (Zones.IsEnabled)
            {
                Zones.DetectionLogsDir();
            }
            if (Bank.IsEnabled)
            {
                Bank.CreateFolder();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.CreateFolder();
            }
            if (Bounties.IsEnabled)
            {
                Bounties.CreateFolder();
            }
            if (CredentialCheck.IsEnabled)
            {
                CredentialCheck.CreateFolder();
            }
            if (DupeLog.IsEnabled)
            {
                DupeLog.CreateFolder();
            }
            PollConsole.CreateFolder();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (ClanManager.IsEnabled)
            {
                ClanManager.GetClans();
                ClanManager.BuildList();
            }
            if (!ClanManager.IsEnabled)
            {
                ClanManager.clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (UndergroundCheck.IsRunning && !UndergroundCheck.IsEnabled)
            {
                UndergroundCheck.Unload();
            }
            if (!UndergroundCheck.IsRunning && UndergroundCheck.IsEnabled)
            {
                UndergroundCheck.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled)
            {
                InventoryCheck.Unload();
            }
            if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled)
            {
                InventoryCheck.Load();
            }
            if (HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (MutePlayer.IsEnabled)
            {
                MutePlayer.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            if (Animals.IsEnabled)
            {
                Animals.AnimalList();
            }
            if (AutoShutdown.IsEnabled)
            {
                AutoShutdown.ShutdownTime();
            }
        }
Ejemplo n.º 14
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));
     }
 }
Ejemplo n.º 15
0
        public static void Load()
        {
            Timers.TimerStart();
            Timers.Timer2Start();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TypeQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (!ClanManager.IsEnabled)
            {
                ClanManager.Clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled)
            {
                InventoryCheck.Unload();
            }
            if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled)
            {
                InventoryCheck.Load();
            }
            if (HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (KillNotice.IsRunning && !KillNotice.IsEnabled)
            {
                KillNotice.Unload();
            }
            if (!KillNotice.IsRunning && KillNotice.IsEnabled)
            {
                KillNotice.Load();
            }
            if (!Prayer.IsRunning && Prayer.IsEnabled)
            {
                Prayer.Load();
            }
            if (Prayer.IsRunning && !Prayer.IsEnabled)
            {
                Prayer.Unload();
            }
            if (LoadTriggers.IsRunning)
            {
                LoadTriggers.Unload();
            }
            if (!LoadTriggers.IsRunning)
            {
                LoadTriggers.Load();
            }
            if (ProtectedSpace.IsRunning)
            {
                ProtectedSpace.Unload();
            }
            if (!ProtectedSpace.IsRunning)
            {
                ProtectedSpace.Load();
            }
            if (ClanManager.IsEnabled)
            {
                ClanManager.ClanList();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.AuctionList();
            }
            if (Mute.IsEnabled)
            {
                Mute.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            if (BattleLogger.IsEnabled && !BattleLogger.LogFound && !string.IsNullOrEmpty(Utils.GetApplicationScratchPath()))
            {
                if (!GamePrefs.GetString(EnumGamePrefs.ServerDisabledNetworkProtocols).ToLower().Contains("litenetlib"))
                {
                    BattleLogger.LogDirectory = Utils.GetApplicationScratchPath();
                    BattleLogger.ConfirmLog();
                }
                else
                {
                    Log.Out("--------------------------------------------------------------------------");
                    Log.Out("[SERVERTOOLS] Unable to verify log file. Battle_Loggers has been disabled.");
                    Log.Out("[SERVERTOOLS] Network protocol litenetlib is required for this tool.");
                    Log.Out("--------------------------------------------------------------------");
                }
            }
            PatchTools.ApplyPatches();
        }
Ejemplo n.º 16
0
 public void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)
 {
     if (_cInfo != null)
     {
         string _name = SQL.EscapeString(_cInfo.playerName);
         if (Motd.IsEnabled & Motd.Show_On_Respawn)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.Show_On_Login && Bloodmoon.Show_On_Respawn)
         {
             Bloodmoon.GetBloodmoon(_cInfo, false);
         }
         if (_respawnReason == RespawnType.EnterMultiplayer)
         {
             if (NewPlayer.IsEnabled)
             {
                 NewPlayer.Exec(_cInfo);
             }
             if (NewSpawnTele.IsEnabled)
             {
                 NewSpawnTele.TeleNewSpawn(_cInfo);
             }
             if (StartingItems.IsEnabled)
             {
                 if (!NewSpawnTele.IsEnabled)
                 {
                     StartingItems.StartingItemCheck(_cInfo);
                 }
                 else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position != "0,0,0")
                 {
                     StartingItems.Que.Add(_cInfo.playerId);
                 }
                 else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position == "0,0,0")
                 {
                     StartingItems.StartingItemCheck(_cInfo);
                 }
             }
             string    _sql     = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
             DataTable _result1 = SQL.TQuery(_sql);
             if (_result1.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId))
             {
                 PollConsole.Message(_cInfo);
             }
             _result1.Dispose();
             if (Hardcore.IsEnabled)
             {
                 Hardcore.Announce(_cInfo);
             }
             _sql = string.Format("UPDATE Players SET playername = '{0}', wallet = 0, playerSpentCoins = 0, sessionTime = 0, zkills = 0, kills = 0, deaths = 0 WHERE steamid = '{1}'", _name, _cInfo.playerId);
             SQL.FastQuery(_sql);
         }
         if (_respawnReason == RespawnType.JoinMultiplayer)
         {
             EntityPlayer _player     = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             int          _zCount     = XUiM_Player.GetZombieKills(_player);
             int          _deathCount = XUiM_Player.GetDeaths(_player);
             int          _killCount  = XUiM_Player.GetPlayerKills(_player);
             string       _sql        = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
             DataTable    _result     = SQL.TQuery(_sql);
             if (_result.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId))
             {
                 PollConsole.Message(_cInfo);
             }
             _result.Dispose();
             if (Event.Open)
             {
                 if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                 {
                     if (Hardcore.IsEnabled)
                     {
                         Hardcore.Check(_cInfo);
                     }
                 }
                 else
                 {
                     _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     DataTable _result1 = SQL.TQuery(_sql);
                     bool      _eventRespawn;
                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn);
                     _result1.Dispose();
                     if (_eventRespawn)
                     {
                         Event.Died(_cInfo);
                     }
                     else
                     {
                         _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                         DataTable _result2 = SQL.TQuery(_sql);
                         bool      _return1 = false, _return2 = false;
                         bool.TryParse(_result2.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                         bool.TryParse(_result2.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                         _result2.Dispose();
                         if (_return1)
                         {
                             if (_return2)
                             {
                                 _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                 SQL.FastQuery(_sql);
                             }
                             _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                             SQL.FastQuery(_sql);
                             Event.EventReturn(_cInfo);
                         }
                         else if (_return2)
                         {
                             Event.EventSpawn(_cInfo);
                         }
                     }
                 }
             }
             else
             {
                 if (Hardcore.IsEnabled)
                 {
                     Hardcore.Check(_cInfo);
                 }
             }
             _sql = string.Format("UPDATE Players SET playername = '{0}', zkills = {1}, kills = {2}, deaths = {3} WHERE steamid = '{4}'", _name, _zCount, _killCount, _deathCount, _cInfo.playerId);
             SQL.FastQuery(_sql);
             if (Mogul.IsEnabled)
             {
                 if (Wallet.IsEnabled)
                 {
                     int currentCoins = Wallet.GetcurrentCoins(_cInfo);
                     _sql = string.Format("UPDATE Players SET wallet = {0} WHERE steamid = '{1}'", currentCoins, _cInfo.playerId);
                     SQL.FastQuery(_sql);
                 }
             }
         }
         if (_respawnReason == RespawnType.Died)
         {
             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (Event.Open)
             {
                 if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                 {
                     if (Wallet.Lose_On_Death)
                     {
                         Wallet.ClearWallet(_cInfo);
                     }
                     if (Hardcore.IsEnabled)
                     {
                         Hardcore.Check(_cInfo);
                     }
                     string    _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     DataTable _result1 = SQL.TQuery(_sql);
                     bool      _return1 = false, _return2 = false;
                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                     _result1.Dispose();
                     if (_return1)
                     {
                         if (_return2)
                         {
                             _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                             SQL.FastQuery(_sql);
                         }
                         _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                         SQL.FastQuery(_sql);
                         Event.EventReturn(_cInfo);
                     }
                 }
                 else
                 {
                     string    _sql    = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     DataTable _result = SQL.TQuery(_sql);
                     bool      _eventRespawn;
                     bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn);
                     _result.Dispose();
                     if (_eventRespawn)
                     {
                         Event.Died(_cInfo);
                     }
                     else
                     {
                         _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                         DataTable _result1 = SQL.TQuery(_sql);
                         bool      _return1 = false, _return2 = false;
                         bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                         bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                         _result1.Dispose();
                         if (_return1)
                         {
                             if (_return2)
                             {
                                 _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                 SQL.FastQuery(_sql);
                             }
                             _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                             SQL.FastQuery(_sql);
                             Event.EventReturn(_cInfo);
                         }
                         else if (_return2)
                         {
                             Event.EventSpawn(_cInfo);
                         }
                     }
                 }
             }
             else
             {
                 if (Wallet.Lose_On_Death)
                 {
                     Wallet.ClearWallet(_cInfo);
                 }
                 if (Hardcore.IsEnabled)
                 {
                     Hardcore.Check(_cInfo);
                 }
                 string    _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                 DataTable _result1 = SQL.TQuery(_sql);
                 bool      _return1 = false, _return2 = false;
                 bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                 bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                 _result1.Dispose();
                 if (_return1)
                 {
                     if (_return2)
                     {
                         _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                         SQL.FastQuery(_sql);
                     }
                     _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                     SQL.FastQuery(_sql);
                     Event.EventReturn(_cInfo);
                 }
             }
             string _sql2 = string.Format("UPDATE Players SET deaths = {0} WHERE steamid = '{1}'", XUiM_Player.GetDeaths(_player), _cInfo.playerId);
             SQL.FastQuery(_sql2);
             if (Zones.IsEnabled && Players.Victim.ContainsKey(_cInfo.entityId))
             {
                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + ", type /return to teleport back to your death position. There is a time limit.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 _sql2 = string.Format("UPDATE Players SET respawnTime = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
                 SQL.FastQuery(_sql2);
                 if (Players.Forgive.ContainsKey(_cInfo.entityId))
                 {
                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + ", type /forgive to release your killer from jail.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
             if (Mogul.IsEnabled)
             {
                 if (Wallet.IsEnabled)
                 {
                     int currentCoins = Wallet.GetcurrentCoins(_cInfo);
                     _sql2 = string.Format("UPDATE Players SET wallet = {0} WHERE steamid = '{1}'", currentCoins, _cInfo.playerId);
                     SQL.FastQuery(_sql2);
                 }
             }
         }
         if (_respawnReason == RespawnType.Teleport)
         {
             if (StartingItems.IsEnabled && StartingItems.Que.Contains(_cInfo.playerId))
             {
                 StartingItems.StartingItemCheck(_cInfo);
                 StartingItems.Que.Remove(_cInfo.playerId);
             }
             if (Players.NoFlight.Contains(_cInfo.entityId))
             {
                 Players.NoFlight.Remove(_cInfo.entityId);
             }
             if (HatchElevator.IsEnabled)
             {
                 HatchElevator.LastPositionY.Remove(_cInfo.entityId);
             }
         }
         if (Players.Dead.Contains(_cInfo.entityId))
         {
             Players.Dead.Remove(_cInfo.entityId);
         }
     }
 }
Ejemplo n.º 17
0
 public void PlayerSpawning(ClientInfo _cInfo, int _chunkViewDim, PlayerProfile _playerProfile)
 {
     if (_cInfo != null)
     {
         if (CountryBan.IsEnabled && _cInfo.ip != "127.0.0.1" && !_cInfo.ip.StartsWith("192.168"))
         {
             if (CountryBan.IsCountryBanned(_cInfo))
             {
                 return;
             }
         }
         string    _sql    = string.Format("SELECT steamid FROM Players WHERE steamid = '{0}'", _cInfo.playerId);;
         DataTable _result = SQL.TQuery(_sql);
         string    _name   = SQL.EscapeString(_cInfo.playerName);
         if (_result.Rows.Count == 0)
         {
             _sql = string.Format("INSERT INTO Players (steamid, playername, last_joined) VALUES ('{0}', '{1}', '{2}')", _cInfo.playerId, _name, DateTime.Now);
         }
         else
         {
             _sql = string.Format("UPDATE Players SET playername = '{0}', last_joined = '{1}' WHERE steamid = '{2}'", _name, DateTime.Now, _cInfo.playerId);
         }
         _result.Dispose();
         SQL.FastQuery(_sql);
         if (StopServer.NoEntry)
         {
             int    _seconds = (60 - Timers._sSCD);
             string _phrase452;
             if (!Phrases.Dict.TryGetValue(452, out _phrase452))
             {
                 _phrase452 = "Shutdown is in {Minutes} minutes {Seconds} seconds. Please come back after the server restarts.";
             }
             _phrase452 = _phrase452.Replace("{Minutes}", Timers._sSC.ToString());
             _phrase452 = _phrase452.Replace("{Seconds}", _seconds.ToString());
             SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.entityId, _phrase452), (ClientInfo)null);
         }
         if (ReservedSlots.IsEnabled)
         {
             if (ReservedSlots.Kicked.ContainsKey(_cInfo.playerName))
             {
                 DateTime _dateTime;
                 ReservedSlots.Kicked.TryGetValue(_cInfo.playerId, out _dateTime);
                 TimeSpan varTime           = DateTime.Now - _dateTime;
                 double   fractionalMinutes = varTime.TotalMinutes;
                 int      _timepassed       = (int)fractionalMinutes;
                 if (_timepassed >= 5)
                 {
                     int    _timeleft = 5 - _timepassed;
                     string _phrase22;
                     if (!Phrases.Dict.TryGetValue(22, out _phrase22))
                     {
                         _phrase22 = "Sorry {PlayerName} you have reached the max session time. Please wait {TimeRemaining} minutes before rejoining.";
                     }
                     _phrase22 = _phrase22.Replace("{PlayerName}", _cInfo.playerName);
                     _phrase22 = _phrase22.Replace("{TimeRemaining}", _timeleft.ToString());
                     SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.playerId, _phrase22), (ClientInfo)null);
                 }
                 else
                 {
                     ReservedSlots.CheckReservedSlot(_cInfo);
                 }
             }
             else
             {
                 ReservedSlots.CheckReservedSlot(_cInfo);
             }
         }
         if (CredentialCheck.IsEnabled)
         {
             CredentialCheck.AccCheck(_cInfo);
         }
         if (Motd.IsEnabled && !Motd.Show_On_Respawn)
         {
             Motd.Send(_cInfo);
         }
         if (AutoShutdown.IsEnabled)
         {
             if (AutoShutdown.Alert_On_Login)
             {
                 AutoShutdown.CheckNextShutdown(_cInfo, false);
             }
         }
         if (Bloodmoon.Show_On_Login && !Bloodmoon.Show_On_Respawn)
         {
             Bloodmoon.GetBloodmoon(_cInfo, false);
         }
         if (LoginNotice.IsEnabled)
         {
             LoginNotice.PlayerCheck(_cInfo);
         }
         Players.SessionTime(_cInfo);
     }
 }
Ejemplo n.º 18
0
        public static void Load()
        {
            Confirm.Exec();
            PatchTools.ApplyPatches();
            if (!LoadTriggers.IsRunning)
            {
                LoadTriggers.Load();
            }
            Timers.TimerStart();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TypeQuery(_sql);

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