Beispiel #1
0
 public static TruthDetector.ActionTaken TruthDetector_NoteMoved(TruthDetector truthDetector, ref Vector3 pos, Angle2 ang, double time)
 {
     object[] array = new object[]
     {
         truthDetector,
         pos,
         ang,
         time
     };
     TruthDetector.ActionTaken result = (TruthDetector.ActionTaken)Method.Invoke("RustExtended.RustHook.TruthDetector_NoteMoved", array).AsObject;
     pos = (Vector3)array[1];
     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);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public static void OnPlayerMove(NetUser netUser, ref Vector3 newpos, ref TruthDetector.ActionTaken taken)
        {
            Predicate <EventTimer> match   = null;
            ElapsedEventHandler    handler = null;
            Class56 class2 = new Class56 {
                netUser_0 = netUser
            };

            if (((class2.netUser_0 != null) && (class2.netUser_0.playerClient != null)) && (class2.netUser_0.playerClient.controllable != null))
            {
                Vector3 position = class2.netUser_0.playerClient.controllable.character.transform.position;
                if ((position != newpos) && ((position.x != newpos.x) || (position.z != newpos.z)))
                {
                    class2.userData_0 = Users.GetBySteamID(class2.netUser_0.userID);
                    if (class2.userData_0 != null)
                    {
                        if (!class2.userData_0.HasFlag(UserFlags.onevent))
                        {
                            class2.userData_0.Position = newpos;
                        }
                        class2.worldZone_0 = Get(newpos);
                        if (class2.userData_0.Zone != class2.worldZone_0)
                        {
                            EventTimer timer = null;
                            if (class2.userData_0.Zone != null)
                            {
                                if (match == null)
                                {
                                    match = new Predicate <EventTimer>(class2.method_0);
                                }
                                timer = Events.Timer.Find(match);
                            }
                            if (timer != null)
                            {
                                Broadcast.Notice(class2.netUser_0, "☢", Config.GetMessageTeleport("Player.WarpZone.Interrupt", class2.netUser_0, class2.userData_0.Zone, null), 2f);
                                timer.Dispose();
                            }
                            if (class2.userData_0.Zone != null)
                            {
                                if ((class2.userData_0.Zone.NoLeave && !class2.netUser_0.admin) && ((class2.worldZone_0 == null) || !class2.userData_0.Zone.Internal.Contains(class2.worldZone_0)))
                                {
                                    newpos = position;
                                    taken  = TruthDetector.ActionTaken.Moved;
                                    return;
                                }
                                if (!string.IsNullOrEmpty(class2.userData_0.Zone.Notice_OnLeave))
                                {
                                    Broadcast.Notice(class2.netUser_0, "☢", class2.userData_0.Zone.Notice_OnLeave, 5f);
                                }
                                foreach (string str in class2.userData_0.Zone.Message_OnLeave)
                                {
                                    Broadcast.Message(class2.netUser_0, str, null, 0f);
                                }
                            }
                            if (class2.worldZone_0 != null)
                            {
                                if ((class2.worldZone_0.NoEnter && !class2.netUser_0.admin) && ((class2.userData_0.Zone == null) || !class2.worldZone_0.Internal.Contains(class2.userData_0.Zone)))
                                {
                                    newpos = position;
                                    taken  = TruthDetector.ActionTaken.Moved;
                                    return;
                                }
                                if (!string.IsNullOrEmpty(class2.worldZone_0.Notice_OnEnter))
                                {
                                    Broadcast.Notice(class2.netUser_0, "☢", class2.worldZone_0.Notice_OnEnter, 5f);
                                }
                                foreach (string str2 in class2.worldZone_0.Message_OnEnter)
                                {
                                    Broadcast.Message(class2.netUser_0, str2, null, 0f);
                                }
                            }
                            class2.userData_0.Zone = class2.worldZone_0;
                            if (((class2.worldZone_0 != null) && (class2.worldZone_0.WarpZone != null)) && (class2.worldZone_0.WarpZone.Spawns.Count > 0))
                            {
                                if (class2.worldZone_0.WarpTime > 0L)
                                {
                                    timer = new EventTimer {
                                        Interval  = class2.worldZone_0.WarpTime * 0x3e8L,
                                        AutoReset = false
                                    };
                                    if (handler == null)
                                    {
                                        handler = new ElapsedEventHandler(class2.method_1);
                                    }
                                    timer.Elapsed += handler;
                                    timer.Sender   = class2.netUser_0;
                                    timer.Command  = class2.worldZone_0.Defname;
                                    timer.Start();
                                    Broadcast.Notice(class2.netUser_0, "☢", Config.GetMessageTeleport("Player.WarpZone.Start", class2.netUser_0, class2.worldZone_0, null), 2f);
                                }
                                else
                                {
                                    PlayerWarp(class2.netUser_0, class2.userData_0, class2.worldZone_0);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #4
0
        public static TruthDetector.ActionTaken NoteMoved(TruthDetector detector, ref Vector3 pos, Angle2 ang, double time)
        {
            UserData userData = null;

            HackDetected  = HackMethod.None;
            actionTaken_0 = TruthDetector.ActionTaken.None;
            try
            {
                uint notedTime = detector.notedTime;
                detector.notedTime = (uint)Environment.TickCount;
                if (notedTime > 0)
                {
                    notedTime = ((uint)Environment.TickCount) - notedTime;
                }
                userData = Users.GetBySteamID(detector.netUser.userID);
                if (detector.prevSnap.time > 0.0)
                {
                    double num2 = time - detector.prevSnap.time;
                    if (detector.ignoreSeconds > 0.0)
                    {
                        if (time > detector.prevSnap.time)
                        {
                            detector.ignoreSeconds -= num2;
                        }
                    }
                    else if (!detector.netUser.admin && !Exclude.Contains(detector.netUser.userID))
                    {
                        if (CheckWallhack && smethod_0(detector, detector.prevSnap.pos, ref pos))
                        {
                            actionTaken_0 = TruthDetector.ActionTaken.Moved;
                        }
                        else if (CheckSpeedhack && smethod_1(detector, detector.prevSnap.pos, pos, num2))
                        {
                            actionTaken_0 = TruthDetector.ActionTaken.Moved;
                        }
                        else if (smethod_2(detector, detector.prevSnap.pos, ref pos, num2))
                        {
                            actionTaken_0 = TruthDetector.ActionTaken.Moved;
                        }
                    }
                }
                if (actionTaken_0 == TruthDetector.ActionTaken.None)
                {
                    detector.prevSnap.pos  = pos;
                    detector.prevSnap.time = time;
                    detector.Record();
                    if (detector.violation > 0)
                    {
                        detector.violation--;
                    }
                    if (((userData != null) && (userData.Violations > 0)) && (userData.ViolationDate.Ticks > 0L))
                    {
                        DateTime time2 = userData.ViolationDate.AddMinutes((double)ViolationTimelife);
                        if (time2 < DateTime.Now)
                        {
                            userData.ViolationDate = time2;
                            userData.Violations--;
                        }
                    }
                }
                else if ((truth.punish && (notedTime > 0)) && (notedTime > detector.netUser.networkPlayer.averagePing))
                {
                    actionTaken_0 = Punish(detector.netUser, userData, HackDetected, false);
                    PunishReason  = "";
                    PunishDetails = "";
                }
            }
            catch (Exception exception)
            {
                Helper.LogError(exception.ToString(), true);
            }
            return(actionTaken_0);
        }