public static bool BuildMark(Vector3 position) { bool result; if (Zones.LastZone == null) { result = false; } else { Zones.LastZone.Points.Add(new Vector2(position.x, position.z)); WorldZone worldZone = Zones.Get(position); if (worldZone != null && !worldZone.Internal.Contains(Zones.LastZone)) { worldZone.Internal.Add(Zones.LastZone); } Vector3 ground = Zones.GetGround(position.x, position.z); Zones.Markers.Add(World.Spawn(";struct_metal_pillar", ground)); Zones.Markers.Add(World.Spawn(";struct_metal_pillar", ground + new Vector3(0f, 4f, 0f))); Zones.Markers.Add(World.Spawn(";struct_metal_pillar", ground + new Vector3(0f, 8f, 0f))); Zones.Markers.Add(World.Spawn(";struct_metal_pillar", ground + new Vector3(0f, 12f, 0f))); result = true; } return(result); }
public static WorldZone Get(uLink.NetworkPlayer netPlayer) { PlayerClient playerClient; WorldZone result; if (!PlayerClient.Find(netPlayer, out playerClient)) { result = null; } else { result = Zones.Get(playerClient.lastKnownPosition); } return(result); }
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 WorldZone Get(Vector3 position) { return(Zones.Get(position.x, position.y, position.z)); }
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 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); }