public static void MarketCheck(ClientInfo _cInfo, EntityAlive _player)
 {
     if (!Market.InsideMarket(_player.position.x, _player.position.z))
     {
         Market.MarketPlayers.Remove(_cInfo.entityId);
         if (Market.Return)
         {
             PersistentContainer.Instance.Players[_cInfo.playerId].MarketReturnPos = "";
             Phrases.Dict.TryGetValue(255, out string _phrase255);
             _phrase255 = _phrase255.Replace("{CommandPrivate}", ChatHook.Command_Private);
             _phrase255 = _phrase255.Replace("{Command51}", Command51);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase255 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         }
     }
 }
Example #2
0
 public static void CheckZone()
 {
     try
     {
         if (!ZoneRunning)
         {
             ZoneRunning = true;
             List <ClientInfo> clientList = ClientList();
             if (clientList != null)
             {
                 for (int i = 0; i < clientList.Count; i++)
                 {
                     ClientInfo cInfo = clientList[i];
                     if (cInfo != null && !Teleportation.Teleporting.Contains(cInfo.entityId))
                     {
                         EntityPlayer player = GetEntityPlayer(cInfo.entityId);
                         if (player != null && !player.IsDead() && player.IsSpawned() && player.position != null)
                         {
                             if (Zones.IsEnabled && Zones.ZoneList.Count > 0)
                             {
                                 Zones.ZoneCheck(cInfo, player);
                             }
                             if (Lobby.IsEnabled && Lobby.LobbyPlayers.Contains(cInfo.entityId))
                             {
                                 Lobby.InsideLobby(cInfo, player);
                             }
                             if (Market.IsEnabled && Market.MarketPlayers.Contains(cInfo.entityId))
                             {
                                 Market.InsideMarket(cInfo, player);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.CheckZone: {0}", e.Message));
     }
     ZoneRunning = false;
 }
Example #3
0
 public static void MarketCheck(ClientInfo _cInfo, EntityAlive _player)
 {
     if (Market.IsEnabled && Market.MarketPlayers.Contains(_cInfo.entityId) && !Market.InsideMarket(_player.position.x, _player.position.z))
     {
         Market.MarketPlayers.Remove(_cInfo.entityId);
         if (Market.Return)
         {
             PersistentContainer.Instance.Players[_cInfo.playerId].MarketReturnPos = "";
             PersistentContainer.Instance.Save();
             string _phrase564;
             if (!Phrases.Dict.TryGetValue(564, out _phrase564))
             {
                 _phrase564 = "You have left the market space. {CommandPrivate}{Command51} command is no longer available.";
                 _phrase564 = _phrase564.Replace("{CommandPrivate}", ChatHook.Command_Private);
                 _phrase564 = _phrase564.Replace("{Command51}", Command51);
             }
             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase564 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
 }
Example #4
0
 public static void ZoneCheck(ClientInfo _cInfo, EntityAlive _player)
 {
     if (Box1.Count > 0)
     {
         for (int i = 0; i < Box1.Count; i++)
         {
             string[] _box1 = Box1[i];
             bool[]   _box2 = Box2[i];
             if (BoxCheck(_box1, _player.position.x, _player.position.y, _player.position.z, _box2))
             {
                 if (ZoneExit.ContainsKey(_player.entityId))
                 {
                     string _exitMsg;
                     if (ZoneExit.TryGetValue(_player.entityId, out _exitMsg))
                     {
                         if (_exitMsg != _box1[3])
                         {
                             if (Zone_Message)
                             {
                                 ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _box1[2] + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                             }
                             if (_box1[4] != "")
                             {
                                 Response(_cInfo, _box1[4]);
                             }
                             ZoneExit[_player.entityId]    = _box1[3];
                             reminder[_player.entityId]    = DateTime.Now;
                             reminderMsg[_player.entityId] = _box1[5];
                         }
                     }
                 }
                 else
                 {
                     if (Zone_Message)
                     {
                         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _box1[2] + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     }
                     if (_box1[4] != "")
                     {
                         Response(_cInfo, _box1[4]);
                     }
                     ZoneExit.Add(_player.entityId, _box1[3]);
                     reminder.Add(_player.entityId, DateTime.Now);
                     reminderMsg.Add(_player.entityId, _box1[5]);
                 }
                 if (_box2[1])
                 {
                     if (!ZonePvE.Contains(_player.entityId))
                     {
                         ZonePvE.Add(_player.entityId);
                     }
                 }
                 else if (ZonePvE.Contains(_player.entityId))
                 {
                     ZonePvE.Remove(_player.entityId);
                 }
                 return;
             }
         }
         if (ZoneExit.ContainsKey(_player.entityId))
         {
             if (Zone_Message)
             {
                 string _msg;
                 if (ZoneExit.TryGetValue(_player.entityId, out _msg))
                 {
                     if (_msg != "")
                     {
                         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _msg + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     }
                 }
             }
             ZoneExit.Remove(_player.entityId);
             reminder.Remove(_player.entityId);
             reminderMsg.Remove(_player.entityId);
             if (ZonePvE.Contains(_player.entityId))
             {
                 ZonePvE.Remove(_player.entityId);
             }
         }
     }
     if (Lobby.IsEnabled && Lobby.LobbyPlayers.Contains(_cInfo.entityId) && !Lobby.InsideLobby(_player.position.x, _player.position.z))
     {
         Lobby.LobbyPlayers.Remove(_cInfo.entityId);
         if (Lobby.Return)
         {
             PersistentContainer.Instance.Players[_cInfo.playerId].LobbyReturnPos = "";
             PersistentContainer.Instance.Save();
             string _phrase556;
             if (!Phrases.Dict.TryGetValue(556, out _phrase556))
             {
                 _phrase556 = " you have left the lobby space. {PrivateCommand}{Command53} command is no longer available.";
                 _phrase556 = _phrase556.Replace("{PrivateCommand}", ChatHook.Command_Private);
                 _phrase556 = _phrase556.Replace("{Command53}", ChatHook.Command_Private);
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase556 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
     if (Market.IsEnabled && Market.MarketPlayers.Contains(_cInfo.entityId) && !Market.InsideMarket(_player.position.x, _player.position.z))
     {
         Market.MarketPlayers.Remove(_cInfo.entityId);
         if (Market.Return)
         {
             PersistentContainer.Instance.Players[_cInfo.playerId].MarketReturnPos = "";
             PersistentContainer.Instance.Save();
             string _phrase564;
             if (!Phrases.Dict.TryGetValue(564, out _phrase564))
             {
                 _phrase564 = " you have left the market space. {PrivateCommand}{Command51} command is no longer available.";
                 _phrase564 = _phrase564.Replace("{PrivateCommand}", ChatHook.Command_Private);
                 _phrase564 = _phrase564.Replace("{Command51}", ChatHook.Command_Private);
             }
             ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase564 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
 }