public static bool AllowExplosion(Vector3 _worldPos) { if (Zones.IsEnabled) { if (Zones.Protected(new Vector3i(_worldPos))) { return(false); } } if (ProtectedSpaces.IsEnabled) { if (ProtectedSpaces.IsProtectedSpace(new Vector3i(_worldPos))) { return(false); } } return(true); }
public static void Load() { if (!RunTimePatch.Applied) { RunTimePatch.PatchAll(); } if (!Timers.IsRunning) { Timers.TimerStart(); } if (!LoadTriggers.IsRunning) { LoadTriggers.Load(); } if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen) { Poll.CheckTime(); } if (!ClanManager.IsEnabled) { ClanManager.Clans.Clear(); ClanManager.ClanMember.Clear(); } if (!InfoTicker.IsEnabled && InfoTicker.IsRunning) { InfoTicker.Unload(); } if (InfoTicker.IsEnabled && !InfoTicker.IsRunning) { InfoTicker.Load(); } if (Gimme.IsRunning && !Gimme.IsEnabled) { Gimme.Unload(); } if (!Gimme.IsRunning && Gimme.IsEnabled) { Gimme.Load(); } if (Badwords.IsRunning && !Badwords.IsEnabled) { Badwords.Unload(); } if (!Badwords.IsRunning && Badwords.IsEnabled) { Badwords.Load(); } if (!LoginNotice.IsRunning && LoginNotice.IsEnabled) { LoginNotice.Load(); } if (LoginNotice.IsRunning && !LoginNotice.IsEnabled) { LoginNotice.Unload(); } if (!Zones.IsRunning && Zones.IsEnabled) { Zones.Load(); } if (Zones.IsRunning && !Zones.IsEnabled) { Zones.Unload(); } if (!VoteReward.IsRunning && VoteReward.IsEnabled) { VoteReward.Load(); } if (VoteReward.IsRunning && !VoteReward.IsEnabled) { VoteReward.Unload(); } if (!Watchlist.IsRunning && Watchlist.IsEnabled) { Watchlist.Load(); } if (Watchlist.IsRunning && !Watchlist.IsEnabled) { Watchlist.Unload(); } if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled) { ReservedSlots.Load(); } if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled) { ReservedSlots.Unload(); } if (!StartingItems.IsRunning && StartingItems.IsEnabled) { StartingItems.Load(); } if (StartingItems.IsRunning && !StartingItems.IsEnabled) { StartingItems.Unload(); } if (!Travel.IsRunning && Travel.IsEnabled) { Travel.Load(); } if (Travel.IsRunning && !Travel.IsEnabled) { Travel.Unload(); } if (!Shop.IsRunning && Shop.IsEnabled) { Shop.Load(); } if (Shop.IsRunning && !Shop.IsEnabled) { Shop.Unload(); } if (!Motd.IsRunning && Motd.IsEnabled) { Motd.Load(); } if (Motd.IsRunning && !Motd.IsEnabled) { Motd.Unload(); } if (InvalidItems.IsRunning && !InvalidItems.IsEnabled) { InvalidItems.Unload(); } if (!InvalidItems.IsRunning && InvalidItems.IsEnabled) { InvalidItems.Load(); } if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled) { HighPingKicker.Unload(); } if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled) { HighPingKicker.Load(); } if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled) { CredentialCheck.Unload(); } if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled) { CredentialCheck.Load(); } if (CustomCommands.IsRunning && !CustomCommands.IsEnabled) { CustomCommands.Unload(); } if (!CustomCommands.IsRunning && CustomCommands.IsEnabled) { CustomCommands.Load(); } if (DupeLog.IsRunning && !DupeLog.IsEnabled) { DupeLog.Unload(); } if (!DupeLog.IsRunning && DupeLog.IsEnabled) { DupeLog.Load(); } if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled) { ChatColorPrefix.Unload(); } if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled) { ChatColorPrefix.Load(); } if (KillNotice.IsRunning && !KillNotice.IsEnabled) { KillNotice.Unload(); } if (!KillNotice.IsRunning && KillNotice.IsEnabled) { KillNotice.Load(); } if (Prayer.IsRunning && !Prayer.IsEnabled) { Prayer.Unload(); } if (!Prayer.IsRunning && Prayer.IsEnabled) { Prayer.Load(); } if (BloodmoonWarrior.IsRunning && !BloodmoonWarrior.IsEnabled) { BloodmoonWarrior.Unload(); } if (!BloodmoonWarrior.IsRunning && BloodmoonWarrior.IsEnabled) { BloodmoonWarrior.Load(); } if (ProtectedSpaces.IsRunning && !ProtectedSpaces.IsEnabled) { ProtectedSpaces.Unload(); } if (!ProtectedSpaces.IsRunning && ProtectedSpaces.IsEnabled) { ProtectedSpaces.Load(); } if (ClanManager.IsEnabled) { ClanManager.ClanList(); } if (Auction.IsEnabled) { Auction.AuctionList(); } if (Mute.IsEnabled) { Mute.ClientMuteList(); Mute.MuteList(); } if (Jail.IsEnabled) { Jail.JailList(); } //always load the website last if (WebsiteServer.IsEnabled && !WebsiteServer.DirFound) { WebsiteServer.CheckDir(); } if (WebsiteServer.IsRunning && !WebsiteServer.IsEnabled) { WebsiteServer.Unload(); } if (!WebsiteServer.IsRunning && WebsiteServer.IsEnabled && WebsiteServer.DirFound) { WebsiteServer.Load(); } }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { try { if (_params.Count != 1 && _params.Count != 2 && _params.Count != 5) { SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, 2 or 5, found {0}", _params.Count)); return; } if (_params[0].ToLower().Equals("off")) { if (ProtectedSpaces.IsEnabled) { ProtectedSpaces.IsEnabled = false; LoadConfig.WriteXml(); SdtdConsole.Instance.Output(string.Format("Protected_Spaces has been set to off")); return; } else { SdtdConsole.Instance.Output(string.Format("Protected spaces is already off")); return; } } else if (_params[0].ToLower().Equals("on")) { if (!ProtectedSpaces.IsEnabled) { ProtectedSpaces.IsEnabled = true; LoadConfig.WriteXml(); SdtdConsole.Instance.Output(string.Format("Protected_Spaces has been set to on")); return; } else { SdtdConsole.Instance.Output(string.Format("Protected spaces is already on")); return; } } else if (_params[0].ToLower().Equals("add")) { if (_params.Count != 1 && _params.Count != 5) { SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 or 5, found {0}", _params.Count)); return; } if (_params.Count == 1) { if (_senderInfo.RemoteClientInfo == null) { SdtdConsole.Instance.Output(string.Format("Not a client")); return; } EntityPlayer _player = PersistentOperations.GetEntityPlayer(_senderInfo.RemoteClientInfo.playerId); if (_player != null) { if (!ProtectedSpaces.Vectors.ContainsKey(_player.entityId)) { int _x = (int)_player.position.x, _z = (int)_player.position.z; string[] _vector1 = { _x.ToString(), _z.ToString() }; ProtectedSpaces.Vectors.Add(_player.entityId, _vector1); SdtdConsole.Instance.Output(string.Format("The first position has been set to {0}x,{1}z", _x, _z)); SdtdConsole.Instance.Output("Stand in the opposite corner and use add. Use cancel to clear the saved location and start again"); return; } else { string[] _vector1; ProtectedSpaces.Vectors.TryGetValue(_player.entityId, out _vector1); ProtectedSpaces.Vectors.Remove(_player.entityId); int xMin = int.Parse(_vector1[0]), zMin = int.Parse(_vector1[1]), xMax = (int)_player.position.x, zMax = (int)_player.position.z; int _xMinAlt = xMin, _zMinAlt = zMin, _xMaxAlt = xMax, _zMaxAlt = zMax; if (xMin > xMax) { _xMinAlt = xMax; _xMaxAlt = xMin; } if (zMin > zMax) { _zMinAlt = zMax; _zMaxAlt = zMin; } string[] _vector = { _xMinAlt.ToString(), _zMinAlt.ToString(), _xMaxAlt.ToString(), _zMaxAlt.ToString() }; if (!ProtectedSpaces.ProtectedList.Contains(_vector)) { ProtectedSpaces.Add(_vector); SdtdConsole.Instance.Output(string.Format("Added protected space from {0},{1} to {2},{3}", _xMinAlt, _zMinAlt, _xMaxAlt, _zMaxAlt)); return; } else { SdtdConsole.Instance.Output(string.Format("This protected space is already on the list")); return; } } } } else if (_params.Count == 5) { int xMin, zMin, xMax, zMax; if (!int.TryParse(_params[1], out xMin)) { SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}", _params[1])); return; } if (!int.TryParse(_params[2], out zMin)) { SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}", _params[2])); return; } if (!int.TryParse(_params[3], out xMax)) { SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}", _params[3])); return; } if (!int.TryParse(_params[4], out zMax)) { SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}", _params[4])); return; } int _xMinAlt = xMin, _zMinAlt = zMin, _xMaxAlt = xMax, _zMaxAlt = zMax; if (xMin > xMax) { _xMinAlt = xMax; _xMaxAlt = xMin; } if (zMin > zMax) { _zMinAlt = zMax; _zMaxAlt = zMin; } string[] _vector = { _xMinAlt.ToString(), _zMinAlt.ToString(), _xMaxAlt.ToString(), _zMaxAlt.ToString() }; if (!ProtectedSpaces.ProtectedList.Contains(_vector)) { ProtectedSpaces.Add(_vector); SdtdConsole.Instance.Output(string.Format("Added protected space from {0},{1} to {2},{3}", _xMinAlt, _zMinAlt, _xMaxAlt, _zMaxAlt)); return; } else { SdtdConsole.Instance.Output(string.Format("This protected space is already on the list")); return; } } } else if (_params[0].ToLower().Equals("cancel")) { if (_senderInfo.RemoteClientInfo == null) { SdtdConsole.Instance.Output(string.Format("Not a client")); return; } if (ProtectedSpaces.IsEnabled && ProtectedSpaces.Vectors.ContainsKey(_senderInfo.RemoteClientInfo.entityId)) { ProtectedSpaces.Vectors.Remove(_senderInfo.RemoteClientInfo.entityId); SdtdConsole.Instance.Output(string.Format("Cancelled the saved first position for a protected space. Use add to start again")); return; } else { SdtdConsole.Instance.Output(string.Format("You have no saved position for a protected space. Use add in the first corner you want to protect")); return; } } else if (_params[0].ToLower().Equals("remove")) { if (_params.Count == 2) { if (ProtectedSpaces.ProtectedList.Count > 0) { int _listNum; if (int.TryParse(_params[1], out _listNum)) { if (ProtectedSpaces.ProtectedList.Count >= _listNum) { string[] _vectors = ProtectedSpaces.ProtectedList[_listNum - 1]; ProtectedSpaces.Remove(_vectors); SdtdConsole.Instance.Output(string.Format("Removed protected spaces list entry {0}: {1},{2} to {3},{4}", _listNum, _vectors[0], _vectors[1], _vectors[2], _vectors[3])); return; } else { SdtdConsole.Instance.Output(string.Format("Invalid list number: {0}", _params[1])); return; } } else { SdtdConsole.Instance.Output(string.Format("Invalid integer: {0}", _params[1])); return; } } else { SdtdConsole.Instance.Output(string.Format("There are no protected spaces")); return; } } else if (_senderInfo.RemoteClientInfo != null) { PersistentOperations.ClearChunkProtection(_senderInfo.RemoteClientInfo); return; } } else if (_params[0].ToLower().Equals("list")) { if (ProtectedSpaces.ProtectedList.Count > 0) { SdtdConsole.Instance.Output(string.Format("Protected spaces list:")); for (int i = 0; i < ProtectedSpaces.ProtectedList.Count; i++) { string[] _vectors = ProtectedSpaces.ProtectedList[i]; SdtdConsole.Instance.Output(string.Format("#{0}: {1},{2} to {3},{4}", i + 1, _vectors[0], _vectors[1], _vectors[2], _vectors[3])); } return; } else { SdtdConsole.Instance.Output(string.Format("There are no protected spaces")); return; } } else { SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0])); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in ProtectedSpaceConsole.Execute: {0}", e.Message)); } }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { try { if (_params.Count != 1 && _params.Count != 2 && _params.Count != 5) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, 2 or 5, found {0}", _params.Count)); return; } if (_params[0].ToLower().Equals("off")) { if (ProtectedSpaces.IsEnabled) { ProtectedSpaces.IsEnabled = false; Config.WriteXml(); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Protected spaces has been set to off")); return; } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Protected spaces is already off")); return; } } else if (_params[0].ToLower().Equals("on")) { if (!ProtectedSpaces.IsEnabled) { ProtectedSpaces.IsEnabled = true; Config.WriteXml(); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Protected spaces has been set to on")); return; } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Protected spaces is already on")); return; } } else if (_params[0].ToLower().Equals("add")) { if (_params.Count != 1 && _params.Count != 5) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1 or 5, found {0}", _params.Count)); return; } if (_params.Count == 1) { if (_senderInfo.RemoteClientInfo == null) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] No client info found. Join the server as a client before using this command")); return; } EntityPlayer _player = PersistentOperations.GetEntityPlayer(_senderInfo.RemoteClientInfo.playerId); if (_player != null) { int _x = (int)_player.position.x, _z = (int)_player.position.z; if (!ProtectedSpaces.Vectors.ContainsKey(_player.entityId)) { int[] _vector1 = { _x, _z }; ProtectedSpaces.Vectors.Add(_player.entityId, _vector1); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] The first position has been set to {0}x,{1}z", _x, _z)); SdtdConsole.Instance.Output("[SERVERTOOLS] Stand in the opposite corner and use add again. Use cancel to clear the saved location and start again"); return; } else { ProtectedSpaces.Vectors.TryGetValue(_player.entityId, out int[] _vector1); ProtectedSpaces.Vectors.Remove(_player.entityId); int[] _vectors = new int[3]; if (_vector1[0] > _x) { _vectors[0] = _x; _vectors[1] = _vector1[0]; } else { _vectors[0] = _vector1[0]; _vectors[1] = _x; } if (_vector1[2] > _z) { _vectors[2] = _z; _vectors[3] = _vector1[2]; } else { _vectors[2] = _vector1[2]; _vectors[3] = _z; } if (!ProtectedSpaces.Protected.Contains(_vectors)) { ProtectedSpaces.Protected.Add(_vectors); if (PersistentContainer.Instance.ProtectedSpace != null && PersistentContainer.Instance.ProtectedSpace.Count > 0) { if (!PersistentContainer.Instance.ProtectedSpace.Contains(_vectors)) { PersistentContainer.Instance.ProtectedSpace.Add(_vectors); ProtectedSpaces.AddProtection(_vectors); } } else { List <int[]> _protect = new List <int[]>(); _protect.Add(_vectors); PersistentContainer.Instance.ProtectedSpace = _protect; ProtectedSpaces.AddProtection(_vectors); } ProtectedSpaces.UpdateXml(); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added protected space from {0},{1} to {2},{3}", _vectors[0], _vectors[1], _vectors[2], _vectors[3])); return; } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] This protected space is already on the list")); return; } } } } else if (_params.Count == 5) { if (!int.TryParse(_params[1], out int _xMin)) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid integer: {0}", _params[1])); return; } if (!int.TryParse(_params[2], out int _zMin)) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid integer: {0}", _params[2])); return; } if (!int.TryParse(_params[3], out int _xMax)) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid integer: {0}", _params[3])); return; } if (!int.TryParse(_params[4], out int _zMax)) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid integer: {0}", _params[4])); return; } int[] _vectors = new int[3]; if (_xMin > _xMax) { _vectors[0] = _xMax; _vectors[1] = _xMin; } else { _vectors[0] = _xMin; _vectors[1] = _xMax; } if (_zMin > _zMax) { _vectors[2] = _zMax; _vectors[3] = _zMin; } else { _vectors[2] = _zMin; _vectors[3] = _zMax; } if (!ProtectedSpaces.Protected.Contains(_vectors)) { ProtectedSpaces.Protected.Add(_vectors); if (PersistentContainer.Instance.ProtectedSpace != null && PersistentContainer.Instance.ProtectedSpace.Count > 0) { if (!PersistentContainer.Instance.ProtectedSpace.Contains(_vectors)) { PersistentContainer.Instance.ProtectedSpace.Add(_vectors); ProtectedSpaces.AddProtection(_vectors); } } else { List <int[]> _protect = new List <int[]>(); _protect.Add(_vectors); PersistentContainer.Instance.ProtectedSpace = _protect; ProtectedSpaces.AddProtection(_vectors); } ProtectedSpaces.UpdateXml(); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added protected space from {0},{1} to {2},{3}", _vectors[0], _vectors[1], _vectors[2], _vectors[3])); return; } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] This protected space is already on the list")); return; } } } else if (_params[0].ToLower().Equals("cancel")) { if (_senderInfo.RemoteClientInfo == null) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Not a client")); return; } if (ProtectedSpaces.Vectors.ContainsKey(_senderInfo.RemoteClientInfo.entityId)) { ProtectedSpaces.Vectors.Remove(_senderInfo.RemoteClientInfo.entityId); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Cancelled your saved corner positions")); return; } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] You have no saved position for a protected space. Use add in the first corner you want to protect")); return; } } else if (_params[0].ToLower().Equals("remove")) { if (_params.Count == 2) { if (ProtectedSpaces.Protected.Count > 0) { if (int.TryParse(_params[1], out int _listNum)) { if (ProtectedSpaces.Protected.Count >= _listNum) { int[] _vectors = ProtectedSpaces.Protected[_listNum - 1]; ProtectedSpaces.Protected.Remove(_vectors); if (PersistentContainer.Instance.ProtectedSpace.Contains(_vectors)) { PersistentContainer.Instance.ProtectedSpace.Remove(_vectors); ProtectedSpaces.RemoveProtection(_vectors); } ProtectedSpaces.UpdateXml(); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Removed protected space {0}: {1},{2} to {3},{4}", _listNum, _vectors[0], _vectors[1], _vectors[2], _vectors[3])); return; } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid list number: {0}", _params[1])); return; } } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid integer: {0}", _params[1])); return; } } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] There are no protected spaces")); return; } } else if (_senderInfo.RemoteClientInfo != null) { PersistentOperations.ClearChunkProtection(_senderInfo.RemoteClientInfo); return; } } else if (_params[0].ToLower().Equals("list")) { if (ProtectedSpaces.Protected.Count > 0) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Protected spaces list:")); for (int i = 0; i < ProtectedSpaces.Protected.Count; i++) { int[] _vectors = ProtectedSpaces.Protected[i]; SdtdConsole.Instance.Output(string.Format("#{0}: {1},{2} to {3},{4}", i + 1, _vectors[0], _vectors[1], _vectors[2], _vectors[3])); } return; } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] There are no protected spaces")); return; } } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0])); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in ProtectedSpaceConsole.Execute: {0}", e.Message)); } }
public static void UnloadProtection() { List <string[]> _protectedList = ProtectedSpaces.ProtectedList; if (_protectedList.Count > 0) { List <Chunk> _chunkList = new List <Chunk>(); for (int i = 0; i < _protectedList.Count; i++) { string[] _vector = _protectedList[i]; int _xMin = int.Parse(_vector[0]), _zMin = int.Parse(_vector[1]), _xMax = int.Parse(_vector[2]), _zMax = int.Parse(_vector[3]); int _xMinAlt = _xMin, _zMinAlt = _zMin, _xMaxAlt = _xMax, _zMaxAlt = _zMax; if (_xMin > _xMax) { _xMinAlt = _xMax; _xMaxAlt = _xMin; } if (_zMin > _zMax) { _zMinAlt = _zMax; _zMaxAlt = _zMin; } for (int j = _xMinAlt; j <= _xMaxAlt; j++) { for (int k = _zMinAlt; k <= _zMaxAlt; k++) { if (GameManager.Instance.World.IsChunkAreaLoaded(j, 1, k)) { Chunk _chunk = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos(j, 1, k); if (!_chunkList.Contains(_chunk)) { _chunkList.Add(_chunk); } Bounds bounds = _chunk.GetAABB(); int _x = i - (int)bounds.min.x, _z = j - (int)bounds.min.z; _chunk.SetTraderArea(_x, _z, false); } } } _protectedList.Remove(_vector); } ProtectedSpaces.ProtectedList = _protectedList; if (_chunkList.Count > 0) { for (int l = 0; l < _chunkList.Count; l++) { Chunk _chunk = _chunkList[l]; List <ClientInfo> _clientList = PersistentOperations.ClientList(); if (_clientList != null && _clientList.Count > 0) { for (int m = 0; m < _clientList.Count; m++) { ClientInfo _cInfo2 = _clientList[m]; if (_cInfo2 != null) { _cInfo2.SendPackage(NetPackageManager.GetPackage <NetPackageChunk>().Setup(_chunk, true)); } } } } } ProtectedSpaces.UpdateXml(); } }
public static void Remove(string[] _vectors) { int _xMin = int.Parse(_vectors[0]), _zMin = int.Parse(_vectors[1]), _xMax = int.Parse(_vectors[2]), _zMax = int.Parse(_vectors[3]); int _xMinAlt = _xMin, _zMinAlt = _zMin, _xMaxAlt = _xMax, _zMaxAlt = _zMax; if (_xMin > _xMax) { _xMinAlt = _xMax; _xMaxAlt = _xMin; } if (_zMin > _zMax) { _zMinAlt = _zMax; _zMaxAlt = _zMin; } List <Chunk> _chunkList = new List <Chunk>(); string[] _vectorsAlt = { _xMinAlt.ToString(), _zMinAlt.ToString(), _xMaxAlt.ToString(), _zMaxAlt.ToString() }; if (ProtectedList.Contains(_vectorsAlt)) { ProtectedList.Remove(_vectorsAlt); for (int i = _xMinAlt; i <= _xMaxAlt; i++) { for (int j = _zMinAlt; j <= _zMaxAlt; j++) { if (GameManager.Instance.World.IsChunkAreaLoaded(i, 1, j)) { Chunk _chunk = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos(i, 1, j); if (!_chunkList.Contains(_chunk)) { _chunkList.Add(_chunk); } Bounds bounds = _chunk.GetAABB(); int _x = i - (int)bounds.min.x, _z = j - (int)bounds.min.z; _chunk.SetTraderArea(_x, _z, false); } else { continue; } } } if (_chunkList.Count > 0) { for (int k = 0; k < _chunkList.Count; k++) { Chunk _chunk = _chunkList[k]; List <ClientInfo> _clientList = PersistentOperations.ClientList(); if (_clientList != null && _clientList.Count > 0) { for (int l = 0; l < _clientList.Count; l++) { ClientInfo _cInfo2 = _clientList[l]; if (_cInfo2 != null) { _cInfo2.SendPackage(NetPackageManager.GetPackage <NetPackageChunk>().Setup(_chunk, true)); } } } } } ProtectedSpaces.UpdateXml(); } }
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(); } }