public static EventTimer TimeEvent_TeleportTo(NetUser Sender, NetUser Target, string Command, double time)
        {
            Class38 class2 = new Class38 {
                netUser_0 = Sender,
                netUser_1 = Target,
                string_0  = Command
            };

            if (Core.CommandTeleportOutdoorsOnly)
            {
                foreach (Collider collider in Physics.OverlapSphere(class2.netUser_1.playerClient.controllable.character.transform.position, 1f, 0x10360401))
                {
                    IDMain main = IDBase.GetMain(collider);
                    if (main != null)
                    {
                        StructureMaster component = main.GetComponent <StructureMaster>();
                        if (((component != null) && (component.ownerID != class2.netUser_0.userID)) && (component.ownerID != class2.netUser_1.userID))
                        {
                            UserData bySteamID = Users.GetBySteamID(component.ownerID);
                            if ((bySteamID == null) || (!bySteamID.HasShared(class2.netUser_0.userID) && !bySteamID.HasShared(class2.netUser_1.userID)))
                            {
                                Broadcast.Notice(class2.netUser_0, "☢", Config.GetMessage("Command.Teleport.NoTeleport", class2.netUser_0, class2.netUser_1.displayName), 5f);
                                Broadcast.Notice(class2.netUser_1, "☢", Config.GetMessage("Command.Teleport.NotHere", class2.netUser_1, class2.netUser_0.displayName), 5f);
                                return(null);
                            }
                        }
                    }
                }
            }
            Broadcast.Message(class2.netUser_0, Config.GetMessage("Command.Teleport.IsConfirm", class2.netUser_0, null).Replace("%USERNAME%", class2.netUser_1.displayName), null, 0f);
            Broadcast.Message(class2.netUser_1, Config.GetMessage("Command.Teleport.Confirmed", class2.netUser_1, null).Replace("%USERNAME%", class2.netUser_0.displayName), null, 0f);
            if (!Character.FindByUser(class2.netUser_1.userID, out class2.character_0))
            {
                return(null);
            }
            if (time <= 0.0)
            {
                Teleport_PlayerTo(null, class2.netUser_0, class2.netUser_1, class2.string_0, class2.character_0.transform.position);
                return(null);
            }
            EventTimer timer = new EventTimer {
                Interval  = time * 1000.0,
                AutoReset = false
            };

            timer.Elapsed += new ElapsedEventHandler(class2.method_0);
            timer.Sender   = class2.netUser_0;
            timer.Target   = class2.netUser_1;
            timer.Command  = class2.string_0;
            Broadcast.Notice(class2.netUser_0, "☢", Config.GetMessage("Command.Teleport.Timewait", class2.netUser_0, null).Replace("%TIME%", timer.TimeLeft.ToString()), 5f);
            Broadcast.Notice(class2.netUser_1, "☢", Config.GetMessage("Command.Teleport.Timewait", class2.netUser_1, null).Replace("%TIME%", timer.TimeLeft.ToString()), 5f);
            timer.Start();
            return(timer);
        }
Exemple #2
0
        public static EventTimer TimeEvent_TeleportTo(NetUser Sender, NetUser Target, string Command, double time)
        {
            Events.Class38 @class = new Events.Class38();
            @class.netUser_0 = Sender;
            @class.netUser_1 = Target;
            @class.string_0  = Command;
            EventTimer result;

            if (Core.CommandTeleportOutdoorsOnly)
            {
                Vector3    position = @class.netUser_1.playerClient.controllable.character.transform.position;
                Collider[] array    = Physics.OverlapSphere(position, 1f, 271975425);
                for (int i = 0; i < array.Length; i++)
                {
                    Collider component = array[i];
                    IDMain   main      = IDBase.GetMain(component);
                    if (!(main == null))
                    {
                        StructureMaster component2 = main.GetComponent <StructureMaster>();
                        if (!(component2 == null) && component2.ownerID != @class.netUser_0.userID && component2.ownerID != @class.netUser_1.userID)
                        {
                            UserData bySteamID = Users.GetBySteamID(component2.ownerID);
                            if (bySteamID == null || (!bySteamID.HasShared(@class.netUser_0.userID) && !bySteamID.HasShared(@class.netUser_1.userID)))
                            {
                                Broadcast.Notice(@class.netUser_0, "☢", Config.GetMessage("Command.Teleport.NoTeleport", @class.netUser_0, @class.netUser_1.displayName), 5f);
                                Broadcast.Notice(@class.netUser_1, "☢", Config.GetMessage("Command.Teleport.NotHere", @class.netUser_1, @class.netUser_0.displayName), 5f);
                                result = null;
                                return(result);
                            }
                        }
                    }
                }
            }
            Broadcast.Message(@class.netUser_0, Config.GetMessage("Command.Teleport.IsConfirm", @class.netUser_0, null).Replace("%USERNAME%", @class.netUser_1.displayName), null, 0f);
            Broadcast.Message(@class.netUser_1, Config.GetMessage("Command.Teleport.Confirmed", @class.netUser_1, null).Replace("%USERNAME%", @class.netUser_0.displayName), null, 0f);
            if (!Character.FindByUser(@class.netUser_1.userID, out @class.character_0))
            {
                result = null;
            }
            else if (time <= 0.0)
            {
                Events.Teleport_PlayerTo(null, @class.netUser_0, @class.netUser_1, @class.string_0, @class.character_0.transform.position);
                result = null;
            }
            else
            {
                EventTimer eventTimer = new EventTimer
                {
                    Interval  = time * 1000.0,
                    AutoReset = false
                };
                eventTimer.Elapsed += new ElapsedEventHandler(@class.method_0);
                eventTimer.Sender   = @class.netUser_0;
                eventTimer.Target   = @class.netUser_1;
                eventTimer.Command  = @class.string_0;
                Broadcast.Notice(@class.netUser_0, "☢", Config.GetMessage("Command.Teleport.Timewait", @class.netUser_0, null).Replace("%TIME%", eventTimer.TimeLeft.ToString()), 5f);
                Broadcast.Notice(@class.netUser_1, "☢", Config.GetMessage("Command.Teleport.Timewait", @class.netUser_1, null).Replace("%TIME%", eventTimer.TimeLeft.ToString()), 5f);
                eventTimer.Start();
                result = eventTimer;
            }
            return(result);
        }