Exemple #1
0
        public static bool TryMoveStuckPlayer(Mobile player, int searchrange)
        {
            if (player.Region is Regions.HouseRegion)
            {                   // make sure the player is inside the house (not standing under the overhang of a tower for instance)
                if ((player.Region as Regions.HouseRegion).House != null && (player.Region as Regions.HouseRegion).House.IsInside(player))
                {
                    StuckMenu.TeleportTimer tele = new StuckMenu.TeleportTimer(player, player, player.Region.GoLocation, TimeSpan.FromSeconds(Utility.RandomMinMax(10, 60)), false);
                    tele.Start();
                    player.SendMessage("You will be moved sometime in the next minute.");
                    return(true);
                }
                else
                {                       // so they're in a house and not inside and they're invoking HelpStuck? lol'zors - exploit
                                        // the system is automatically jailing this player.
                    Jail.JailPlayer jt = new Jail.JailPlayer(player as PlayerMobile, 3, "Trying Help Stuck while standing next to a house.", false);
                    jt.GoToJail();
                    player.SendMessage("Uh oh. Off to jail for trying to exploit the Help Stuck system.");
                    return(false);
                }
            }

            ArrayList locations = new ArrayList();
            Point3D   playerloc = player.Location;

            for (int y = -searchrange; y <= searchrange; y++)
            {
                for (int x = -searchrange; x <= searchrange; x++)
                {                       // avoid storing player's location
                    if (y != 0 && x != 0)
                    {                   // make sure we are in LOS of our intended destination
                        if (player.InLOS(new Point3D(playerloc.X + x, playerloc.Y + y, Map.Felucca.GetAverageZ(playerloc.X + x, playerloc.Y + y))))
                        {               // seems ok so far
                            locations.Add(new Point3D(playerloc.X + x, playerloc.Y + y, Map.Felucca.GetAverageZ(playerloc.X + x, playerloc.Y + y)));
                        }
                    }
                }
            }

            //pla, 03/10/07
            //  Check for nearby items and mobiles to log possible exploit attempts
            IPooledEnumerable objects;

            //Grab items within range
            objects = Map.Felucca.GetItemsInRange(playerloc, searchrange);
            foreach (Item i in objects)
            {
                if (i.Movable)
                {
                    LogHelper.Cheater(player, "HelpStuck Auto-Move exploit - Item in range", false);
                    //exit function!
                    player.SendMessage("Unable to move from this spot.  Please select another Help Stuck option.");
                    return(false);
                }
            }
            objects.Free();
            //Grab mobiles within range
            objects = Map.Felucca.GetMobilesInRange(playerloc, searchrange);
            foreach (Mobile m in objects)
            {
                if (m != player)
                {
                    LogHelper.Cheater(player, "HelpStuck Auto-Move exploit - Mobile in range", true);
                    //exit function!
                    player.SendMessage("Unable to move from this spot.  Please select another Help Stuck option.");
                    return(false);
                }
            }
            //free up
            objects.Free();
            objects = null;

            while (locations.Count > 0)
            {
                int index = Utility.RandomMinMax(0, locations.Count - 1);


                if (Map.Felucca.CanSpawnMobile(((Point3D)locations[index]).X, ((Point3D)locations[index]).Y, ((Point3D)locations[index]).Z) &&
                    Region.Find((Point3D)locations[index], Map.Felucca) == player.Region)
                {
                    StuckMenu.TeleportTimer tele = new StuckMenu.TeleportTimer(player, player, (Point3D)locations[index], TimeSpan.FromSeconds(Utility.RandomMinMax(10, 60)), false);
                    tele.Start();
                    player.SendMessage("You will be moved sometime in the next minute.");

                    return(true);
                }
                else
                {
                    locations.RemoveAt(index);
                }
            }

            return(false);            // failed to find a spot
        }
Exemple #2
0
        public static bool TryMoveStuckPlayer(Mobile player, int searchrange)
        {
            if (player.Region is Regions.HouseRegion)
            {
                StuckMenu.TeleportTimer tele = new StuckMenu.TeleportTimer(player, player, player.Region.GoLocation, TimeSpan.FromSeconds(Utility.RandomMinMax(10, 60)), false);
                tele.Start();
                player.SendMessage("You will be moved sometime in the next minute.");

                return(true);
            }

            ArrayList locations = new ArrayList();
            Point3D   playerloc = player.Location;

            for (int y = -searchrange; y <= searchrange; y++)
            {
                for (int x = -searchrange; x <= searchrange; x++)
                {
                    if (y != 0 && x != 0)                     // avoid storing player's location
                    {
                        locations.Add(new Point3D(playerloc.X + x, playerloc.Y + y, Map.Felucca.GetAverageZ(playerloc.X + x, playerloc.Y + y)));
                    }
                }
            }

            //pla, 03/10/07
            //  Check for nearby items and mobiles to log possible exploit attempts
            IPooledEnumerable objects;

            //Grab items within range
            objects = Map.Felucca.GetItemsInRange(playerloc, searchrange);
            foreach (Item i in objects)
            {
                if (i.Movable)
                {
                    LogHelper.Cheater(player, "HelpStuck Auto-Move exploit - Item in range", false);
                    //exit function!
                    player.SendMessage("Unable to move from this spot.  Please select another Help Stuck option.");
                    return(false);
                }
            }
            objects.Free();
            //Grab mobiles within range
            objects = Map.Felucca.GetMobilesInRange(playerloc, searchrange);
            foreach (Mobile m in objects)
            {
                if (m != player)
                {
                    LogHelper.Cheater(player, "HelpStuck Auto-Move exploit - Mobile in range", true);
                    //exit function!
                    player.SendMessage("Unable to move from this spot.  Please select another Help Stuck option.");
                    return(false);
                }
            }
            //free up
            objects.Free();
            objects = null;

            while (locations.Count > 0)
            {
                int index = Utility.RandomMinMax(0, locations.Count - 1);


                if (Map.Felucca.CanSpawnMobile(((Point3D)locations[index]).X, ((Point3D)locations[index]).Y, ((Point3D)locations[index]).Z) &&
                    Region.Find((Point3D)locations[index], Map.Felucca) == player.Region)
                {
                    StuckMenu.TeleportTimer tele = new StuckMenu.TeleportTimer(player, player, (Point3D)locations[index], TimeSpan.FromSeconds(Utility.RandomMinMax(10, 60)), false);
                    tele.Start();
                    player.SendMessage("You will be moved sometime in the next minute.");

                    return(true);
                }
                else
                {
                    locations.RemoveAt(index);
                }
            }

            return(false);            // failed to find a spot
        }