Example #1
0
 public static void ZoneCheck(ClientInfo _cInfo, EntityPlayer _player)
 {
     if (Zones.Box1.Count > 0)
     {
         int _flagCount = 0;
         int _X         = (int)_player.position.x;
         int _Y         = (int)_player.position.y;
         int _Z         = (int)_player.position.z;
         for (int i = 0; i < Zones.Box1.Count; i++)
         {
             string[] _box  = Zones.Box1[i];
             bool[]   _box2 = Zones.Box2[i];
             if (Zones.BoxCheck(_box, _X, _Y, _Z, _box2))
             {
                 if (!Zones.ZoneExit.ContainsKey(_player.entityId))
                 {
                     for (int j = 0; j < Zones.Box1.Count; j++)
                     {
                         string[] _box3 = Zones.Box1[j];
                         bool[]   _box4 = Zones.Box2[j];
                         if (Zones.BoxCheck(_box3, _X, _Y, _Z, _box4))
                         {
                             Zones.ZoneExit.Add(_player.entityId, _box3[3]);
                             if (_box4[1])
                             {
                                 ZonePvE.Add(_player.entityId);
                             }
                             if (Zones.Zone_Message)
                             {
                                 ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _box3[2] + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                             }
                             if (_box3[4] != "")
                             {
                                 Zones.Response(_cInfo, _box3[4]);
                             }
                             Zones.reminder.Add(_player.entityId, DateTime.Now);
                             Zones.reminderMsg.Add(_player.entityId, _box3[5]);
                             return;
                         }
                     }
                 }
                 else
                 {
                     string _exitMsg;
                     if (Zones.ZoneExit.TryGetValue(_player.entityId, out _exitMsg))
                     {
                         if (_exitMsg != _box[3])
                         {
                             for (int j = 0; j < Zones.Box1.Count; j++)
                             {
                                 string[] _box3 = Zones.Box1[j];
                                 bool[]   _box4 = Zones.Box2[j];
                                 if (Zones.BoxCheck(_box3, _X, _Y, _Z, _box4))
                                 {
                                     Zones.ZoneExit[_player.entityId] = _box3[3];
                                     if (_box4[1])
                                     {
                                         if (!ZonePvE.Contains(_player.entityId))
                                         {
                                             ZonePvE.Add(_player.entityId);
                                         }
                                     }
                                     else
                                     {
                                         if (ZonePvE.Contains(_player.entityId))
                                         {
                                             ZonePvE.Remove(_player.entityId);
                                         }
                                     }
                                     if (Zones.Zone_Message)
                                     {
                                         ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _box3[2] + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                     }
                                     if (_box3[4] != "")
                                     {
                                         Zones.Response(_cInfo, _box3[4]);
                                     }
                                     Zones.reminder[_player.entityId]    = DateTime.Now;
                                     Zones.reminderMsg[_player.entityId] = _box3[5];
                                     return;
                                 }
                             }
                         }
                         else
                         {
                             return;
                         }
                     }
                 }
             }
             else
             {
                 _flagCount++;
                 if (_flagCount == Zones.Box1.Count && Zones.ZoneExit.ContainsKey(_player.entityId))
                 {
                     if (Zones.Zone_Message)
                     {
                         string _msg;
                         if (Zones.ZoneExit.TryGetValue(_player.entityId, out _msg))
                         {
                             if (_msg != "")
                             {
                                 ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _msg + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                             }
                         }
                     }
                     Zones.ZoneExit.Remove(_player.entityId);
                     if (ZonePvE.Contains(_player.entityId))
                     {
                         ZonePvE.Remove(_player.entityId);
                     }
                     Zones.reminder.Remove(_player.entityId);
                     Zones.reminderMsg.Remove(_player.entityId);
                 }
             }
         }
     }
 }