public static Vector2 GetCentroid(WorldZone zone) { return(Zones.GetCentroid(zone.Points)); }
public static void OnPlayerMove(NetUser netUser, ref Vector3 newpos, ref TruthDetector.ActionTaken taken) { Predicate <EventTimer> predicate = null; ElapsedEventHandler elapsedEventHandler = null; Zones.Class56 @class = new Zones.Class56(); @class.netUser_0 = netUser; if (@class.netUser_0 != null && !(@class.netUser_0.playerClient == null) && !(@class.netUser_0.playerClient.controllable == null)) { Vector3 position = @class.netUser_0.playerClient.controllable.character.transform.position; if (!(position == newpos)) { if (position.x != newpos.x || position.z != newpos.z) { @class.userData_0 = Users.GetBySteamID(@class.netUser_0.userID); if (@class.userData_0 != null) { if ([email protected]_0.HasFlag(UserFlags.onevent)) { @class.userData_0.Position = newpos; } @class.worldZone_0 = Zones.Get(newpos); if (@class.userData_0.Zone != @class.worldZone_0) { EventTimer eventTimer = null; if (@class.userData_0.Zone != null) { List <EventTimer> timer = Events.Timer; if (predicate == null) { predicate = new Predicate <EventTimer>(@class.method_0); } eventTimer = timer.Find(predicate); } if (eventTimer != null) { Broadcast.Notice(@class.netUser_0, "☢", Config.GetMessageTeleport("Player.WarpZone.Interrupt", @class.netUser_0, @class.userData_0.Zone, null), 2f); eventTimer.Dispose(); } if (@class.userData_0.Zone != null) { if (@class.userData_0.Zone.NoLeave && [email protected]_0.admin && (@class.worldZone_0 == null || [email protected]_0.Zone.Internal.Contains(@class.worldZone_0))) { newpos = position; taken = (TruthDetector.ActionTaken) 2; return; } if (!string.IsNullOrEmpty(@class.userData_0.Zone.Notice_OnLeave)) { Broadcast.Notice(@class.netUser_0, "☢", @class.userData_0.Zone.Notice_OnLeave, 5f); } string[] message_OnLeave = @class.userData_0.Zone.Message_OnLeave; for (int i = 0; i < message_OnLeave.Length; i++) { string text = message_OnLeave[i]; Broadcast.Message(@class.netUser_0, text, null, 0f); } } if (@class.worldZone_0 != null) { if (@class.worldZone_0.NoEnter && [email protected]_0.admin && (@class.userData_0.Zone == null || [email protected]_0.Internal.Contains(@class.userData_0.Zone))) { newpos = position; taken = (TruthDetector.ActionTaken) 2; return; } if (!string.IsNullOrEmpty(@class.worldZone_0.Notice_OnEnter)) { Broadcast.Notice(@class.netUser_0, "☢", @class.worldZone_0.Notice_OnEnter, 5f); } string[] message_OnEnter = @class.worldZone_0.Message_OnEnter; for (int j = 0; j < message_OnEnter.Length; j++) { string text2 = message_OnEnter[j]; Broadcast.Message(@class.netUser_0, text2, null, 0f); } } @class.userData_0.Zone = @class.worldZone_0; if (@class.worldZone_0 != null && @class.worldZone_0.WarpZone != null && @class.worldZone_0.WarpZone.Spawns.Count > 0) { if (@class.worldZone_0.WarpTime > 0L) { eventTimer = new EventTimer { Interval = (double)(@class.worldZone_0.WarpTime * 1000L), AutoReset = false }; Timer timer2 = eventTimer; if (elapsedEventHandler == null) { elapsedEventHandler = new ElapsedEventHandler(@class.method_1); } timer2.Elapsed += elapsedEventHandler; eventTimer.Sender = @class.netUser_0; eventTimer.Command = @class.worldZone_0.Defname; eventTimer.Start(); Broadcast.Notice(@class.netUser_0, "☢", Config.GetMessageTeleport("Player.WarpZone.Start", @class.netUser_0, @class.worldZone_0, null), 2f); } else { Zones.PlayerWarp(@class.netUser_0, @class.userData_0, @class.worldZone_0); } } } } } } } }
public static bool AtZone(WorldZone zone, Vector3 position) { return(Zones.AtZone(zone, position.x, position.y, position.z)); }
public static bool AtZone(WorldZone zone, float x, float y, float z) { return(Zones.AtZone(zone.Points, new Vector2(x, z))); }
public static bool AtZone(WorldZone zone, GameObject gameObject) { return(Zones.AtZone(zone, gameObject.transform.position)); }
public static bool AtZone(WorldZone zone, Transform transform) { return(Zones.AtZone(zone, transform.position)); }
public static bool AtZone(WorldZone zone, PlayerClient player) { return(Zones.AtZone(zone, player.lastKnownPosition)); }
public static bool LoadAsFile() { bool result; if (Zones.Database == null) { result = false; } else { Zones.Database.Clear(); string[] array = File.ReadAllLines(Zones.SaveFilePath); WorldZone worldZone = null; Dictionary <WorldZone, string> dictionary = new Dictionary <WorldZone, string>(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text = array2[i]; if (text.StartsWith("[") && text.EndsWith("]")) { worldZone = null; if (!text.StartsWith("[ZONE ", StringComparison.OrdinalIgnoreCase)) { ConsoleSystem.LogError("Invalid section \"" + text + "\" from zones."); } else { string[] array3 = Helper.SplitQuotes(text.Trim(new char[] { '[', ']' }), ' '); if (Zones.Database.ContainsKey(array3[1])) { worldZone = Zones.Database[array3[1]]; } else { worldZone = new WorldZone(null, (ZoneFlags)0); Zones.Database.Add(array3[1], worldZone); } } } else if (worldZone != null) { string[] array3 = text.Split(new char[] { '=' }); if (array3.Length >= 2) { array3[1] = array3[1].Trim(); if (!string.IsNullOrEmpty(array3[1])) { float x = 0f; float y = 0f; float z = 0f; string text2 = array3[0].ToUpper(); switch (text2) { case "NAME": worldZone.Name = array3[1]; break; case "FLAGS": worldZone.Flags = array3[1].ToEnum <ZoneFlags>(); break; case "INTERNAL": if (!Zones.Database.ContainsKey(array3[1])) { WorldZone worldZone2 = new WorldZone(null, (ZoneFlags)0); Zones.Database.Add(array3[1], worldZone2); worldZone.Internal.Add(worldZone2); } break; case "CENTER": array3 = array3[1].Split(new char[] { ',' }); if (array3.Length > 0) { float.TryParse(array3[0], out x); } if (array3.Length > 1) { float.TryParse(array3[1], out y); } worldZone.Center = new Vector2(x, y); break; case "WARP": array3 = array3[1].Split(new char[] { ',' }); dictionary.Add(worldZone, array3[0].Trim()); if (array3.Length > 1) { long.TryParse(array3[1], out worldZone.WarpTime); } break; case "POINT": array3 = array3[1].Split(new char[] { ',' }); if (array3.Length > 0) { float.TryParse(array3[0], out x); } if (array3.Length > 1) { float.TryParse(array3[1], out y); } worldZone.Points.Add(new Vector2(x, y)); break; case "SPAWN": array3 = array3[1].Split(new char[] { ',' }); if (array3.Length > 0) { float.TryParse(array3[0], out x); } if (array3.Length > 1) { float.TryParse(array3[1], out y); } if (array3.Length > 2) { float.TryParse(array3[2], out z); } worldZone.Spawns.Add(new Vector3(x, y, z)); break; case "FORBIDDEN.COMMAND": worldZone.ForbiddenCommand = worldZone.ForbiddenCommand.Add(array3[1]); break; case "ENTER.NOTICE": worldZone.Notice_OnEnter = array3[1]; break; case "LEAVE.NOTICE": worldZone.Notice_OnLeave = array3[1]; break; case "ENTER.MESSAGE": worldZone.Message_OnEnter = worldZone.Message_OnEnter.Add(array3[1]); break; case "LEAVE.MESSAGE": worldZone.Message_OnLeave = worldZone.Message_OnLeave.Add(array3[1]); break; } } } } } foreach (WorldZone current in dictionary.Keys) { current.WarpZone = Zones.Get(dictionary[current]); } result = true; } return(result); }
public static WorldZone Get(Vector3 position) { return(Zones.Get(position.x, position.y, position.z)); }
public static bool AtZone(WorldZone zone, uLink.NetworkPlayer netPlayer) { PlayerClient playerClient; return(PlayerClient.Find(netPlayer, out playerClient) && Zones.AtZone(zone, playerClient.lastKnownPosition)); }
public static WorldZone Get(Transform transform) { return(Zones.Get(transform.position.x, transform.position.y, transform.position.z)); }
public static WorldZone Get(NetUser netUser) { return(Zones.Get(netUser.playerClient.lastKnownPosition)); }
public static WorldZone Get(PlayerClient player) { return(Zones.Get(player.lastKnownPosition)); }
public void method_1(object sender, ElapsedEventArgs e) { Zones.PlayerWarp(this.netUser_0, this.userData_0, this.worldZone_0); }
public static bool AtZone(WorldZone zone, NetUser netUser) { return(Zones.AtZone(zone, netUser.playerClient.lastKnownPosition)); }
public static bool Initialize() { Initialized = AssemblyVerifed; if (!Initialized) { return(false); } Helper.Log("RustExtended Initialization", true); World.Initialize(); Zones.Initialize(); Economy.Initialize(); Helper.Log("RustExtended Economy " + (Economy.Enabled ? "Enabled" : "Disabled") + ".", true); Helper.Log("RustExtended Shopping " + (Shop.Enabled ? "Enabled" : "Disabled") + ".", true); Users.Initialize(); Banned.Initialize(); Clans.Initialize(); Blocklist.Initialize(); LoadoutInitialized = InitializeLoadout(); if (Config.Initialized) { Helper.Log(" - " + PremiumConnections + " Allocated Premium Connection(s)", true); Helper.Log(" - " + Commands.Count + " Total Command(s)", true); Helper.Log(" - " + Ranks.Count + " Total Rank(s)", true); Helper.Log(" - " + Kits.Count + " Total Kit(s)", true); Helper.Log(" - " + ForbiddenUsername.Count + " Total Forbidden Name(s)", true); Helper.Log(" - " + ForbiddenObscene.Count + " Total Obscene(s)", true); Helper.Log(" - " + Events.Motd.Count + " Total Message Event(s)", true); Helper.Log(" - " + Clans.Levels.Count + " Total Clan Level(s)", true); } if (LoadoutInitialized) { Helper.Log(" - " + Loadout.Count + " Loadout", true); } if (Zones.Initialized) { Helper.Log(" - " + Zones.Count + " Total Zone(s)", true); } if (Users.Initialized) { Helper.Log(" - " + Users.Count + " Total User(s)", true); } if (Banned.Initialized) { Helper.Log(" - " + Banned.Count + " Banned User(s)", true); } if (Clans.Initialized) { Helper.Log(" - " + Clans.Count + " Total Clan(s)", true); } if (Economy.Enabled && Shop.Initialized) { Helper.Log(" - " + Shop.GroupCount + " Total Shop Group(s)", true); Helper.Log(" - " + Shop.ItemCount + " Total Shop Item(s)", true); } if (Blocklist.Initialized) { Helper.Log(" - " + Blocklist.Count + " Total Blocked IP", true); } if (Override.LootsFileCreated) { Helper.Log(" Loots file has been created.", true); } else if (OverrideLoots && Override.LootsInitialized) { Helper.Log(" - " + Override.LootsCount + " Overridden Loot(s)", true); } if (Override.ItemsFileCreated) { Helper.Log(" Items file has been created.", true); } else if (OverrideItems && Override.ItemsInitialized) { Helper.Log(" - " + Override.ItemsCount + " Overridden Item(s)", true); } Events.Initialize(); GenericSpawners = UnityEngine.Object.FindObjectsOfType <GenericSpawner>(); for (int i = 0; i < GenericSpawners.Length; i++) { int num2 = 0; switch (i) { case 0x2b: GenericSpawners[i].transform.position = new Vector3(6019f, 428.8f, -2296.3f); break; case 0x2c: GenericSpawners[i].transform.position = new Vector3(5819f, 428.8f, -1896.3f); break; } foreach (GenericSpawnerSpawnList.GenericSpawnInstance instance in GenericSpawners[i]._spawnList) { GenericSpawnsTotal += instance.targetPopulation; num2 += instance.targetPopulation; } Helper.Log(string.Format("[GenericSpawner #{0}] Position={1}, Radius={2}, Spawns={3}({4}), Think Delay={5}", new object[] { i, GenericSpawners[i].transform.position.AsString(), GenericSpawners[i].radius, GenericSpawners[i]._spawnList.Count, num2, GenericSpawners[i].thinkDelay }), false); } return(Initialized); }
public static bool Initialize() { Core.Initialized = Core.AssemblyVerifed; bool result; if (!Core.Initialized) { result = false; } else { Helper.Log("RustExtended Initialization", true); World.Initialize(); Zones.Initialize(); Economy.Initialize(); Users.Initialize(); Banned.Initialize(); Clans.Initialize(); Blocklist.Initialize(); Core.LoadoutInitialized = Core.InitializeLoadout(); if (Spawns.Singleton != null) { Spawns.Singleton.Initialize(); } if (Config.Initialized) { Helper.Log(" - " + Core.PremiumConnections + " Allocated Premium Connection(s)", true); Helper.Log(" - " + Core.Commands.Count + " Total Command(s)", true); Helper.Log(" - " + Core.Ranks.Count + " Total Rank(s)", true); Helper.Log(" - " + Core.Kits.Count + " Total Kit(s)", true); Helper.Log(" - " + Core.ForbiddenUsername.Count + " Total Forbidden Name(s)", true); Helper.Log(" - " + Core.ForbiddenObscene.Count + " Total Obscene(s)", true); Helper.Log(" - " + Events.Motd.Count + " Total Message Event(s)", true); Helper.Log(" - " + Clans.Levels.Count + " Total Clan Level(s)", true); } if (Core.LoadoutInitialized) { } if (Zones.Initialized) { } if (Users.Initialized) { } if (Banned.Initialized) { } if (Clans.Initialized) { } if (Economy.Enabled && Shop.Initialized) { Helper.Log(" - " + Shop.GroupCount + " Total Shop Group(s)", true); Helper.Log(" - " + Shop.ItemCount + " Total Shop Item(s)", true); } if (Blocklist.Initialized) { Helper.Log(" - " + Blocklist.Count + " Total Blocked IP", true); } if (!Override.LootsFileCreated) { if (Core.OverrideLoots && Override.LootsInitialized) { } } if (!Override.ItemsFileCreated) { if (Core.OverrideItems && Override.ItemsInitialized) { } } if (Spawns.Initialized) { Helper.Log(" - " + Spawns.TotalGeneric + " Generic Spawner(s)", true); Helper.Log(" - " + Spawns.TotalLootable + " Lootable Spawner(s)", true); } Events.Initialize(); result = Core.Initialized; } return(result); }