コード例 #1
0
        public static void ReportAsMacroer(Mobile from, PlayerMobile pm)
        {
            string location;
            int    xLong = 0, yLat = 0, xMins = 0, yMins = 0;
            bool   xEast = false, ySouth = false;
            Map    map   = pm.Map;
            bool   valid = Sextant.Format(pm.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth);

            if (valid)
            {
                location = Sextant.Format(xLong, yLat, xMins, yMins, xEast, ySouth);
            }
            else
            {
                location = "????";
            }

            if (!valid)
            {
                location = string.Format("{0} {1}", pm.X, pm.Y);
            }

            if (map != null)
            {
                Region reg = pm.Region;

                if (reg != map.DefaultRegion)
                {
                    location += (" in " + reg);
                }
            }

            //Output command log.
            if (from != null)
            {
                Server.Scripts.Commands.CommandLogging.WriteLine(from, "{0} used [Macroer command on {1}({2}) - at {3}",
                                                                 from.Name, pm.Name, pm.Serial, location);
            }

            if (from != null)
            {
                from.SendMessage("Reporting {0} as an AFK macroer!", pm.Name);
            }
            Account acct  = pm.Account as Account;
            int     count = 0;

            foreach (AccountComment comm in acct.Comments)
            {
                if (comm.Content.IndexOf(" : reported using the [macroer command") != -1)
                {
                    count++;
                }
            }
            if (from != null)
            {
                from.SendMessage("{0} has been reported for macroing {1} times before.", pm.Name, count);
            }
            string[] lns = new string[2];
            lns[0] = String.Format("A bounty has been placed on the head of {0} for unlawful resource gathering.", pm.Name);
            lns[1] = String.Format("{0} was last seen at {1}.", pm.Name, location);


            if (PJUM.HasBeenReported(pm))
            {
                if (from != null)
                {
                    from.SendMessage("{0} has already been reported.", pm.Name);
                }
                if (from == null)
                {                 // the system is automatically jailing this player.
                    Jail.JailPlayer jt = new Jail.JailPlayer(pm, 3, "Caught macroing again within 8 hours by automated system.", false);
                    jt.GoToJail();
                }
            }
            else
            {
                // Adam: changed to 4 hours from 8
                PJUM.AddMacroer(lns, pm, DateTime.Now + TimeSpan.FromHours(4));

                //Add bounty to player
                string name = String.Format("Officer {0}", Utility.RandomBool() ? NameList.RandomName("male") : NameList.RandomName("female"));

                int       bountyAmount = 0;
                Container cont         = pm.BankBox;
                if (cont != null)
                {
                    int iAmountInBank = 0;

                    Item[] golds = cont.FindItemsByType(typeof(Gold), true);
                    foreach (Item g in golds)
                    {
                        iAmountInBank += g.Amount;
                    }

                    int min = Math.Min(iAmountInBank, 1000);
                    int max = Math.Min(iAmountInBank, 3000);

                    int randomAmount = Utility.RandomMinMax(min, max);

                    if (cont.ConsumeTotal(typeof(Gold), randomAmount))
                    {
                        bountyAmount = randomAmount;
                    }
                }
                if (bountyAmount < 1500)
                {
                    bountyAmount = Utility.RandomMinMax(1000, 3000);
                }

                Bounty bounty = null;
                if (from != null)
                {
                    bounty = new Bounty((PlayerMobile)from, pm, bountyAmount, name);
                }
                else
                {
                    bounty = new Bounty(null, pm, bountyAmount, name);
                }
                if (bounty != null)
                {
                    BountyKeeper.Add(bounty);
                }

                //Add comment to account
                Account acc     = pm.Account as Account;
                string  comment = String.Format("On {0}, {1} caught {2} unattended macroing at {3} : reported using the [macroer command",
                                                DateTime.Now,
                                                from != null?from.Name:"auto-RTT",
                                                pm.Name,
                                                location);
                acc.Comments.Add(new AccountComment(from != null ? from.Name : "auto-RTT", comment));
            }
        }
コード例 #2
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
        }
コード例 #3
0
        public static void ReportAsMacroer(Mobile from, PlayerMobile pm)
        {
            string location;
            int    xLong = 0, yLat = 0, xMins = 0, yMins = 0;
            bool   xEast = false, ySouth = false;
            Map    map   = pm.Map;
            bool   valid = Sextant.Format(pm.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth);

            if (valid)
            {
                location = Sextant.Format(xLong, yLat, xMins, yMins, xEast, ySouth);
            }
            else
            {
                location = "????";
            }

            if (!valid)
            {
                location = string.Format("{0} {1}", pm.X, pm.Y);
            }

            if (map != null)
            {
                Region reg = pm.Region;

                if (reg != map.DefaultRegion)
                {
                    location += (" in " + reg);
                }
            }

            //Output command log.
            if (from != null)
            {
                Server.Commands.CommandLogging.WriteLine(from, "{0} used [Macroer command on {1}({2}) - at {3}",
                                                         from.Name, pm.Name, pm.Serial, location);
            }

            if (from != null)
            {
                from.SendMessage("Reporting {0} as an AFK macroer!", pm.Name);
            }
            Account acct  = pm.Account as Account;
            int     count = 0;

            foreach (AccountComment comm in acct.Comments)
            {
                if (comm.Content.IndexOf(" : reported using the [macroer command") != -1)
                {
                    count++;
                }
            }
            if (from != null)
            {
                from.SendMessage("{0} has been reported for macroing {1} times before.", pm.Name, count);
            }

            if (PJUM.HasBeenReported(pm))
            {
                if (from != null)
                {
                    from.SendMessage("{0} has already been reported.", pm.Name);
                }
                if (from == null)
                {                       // the system is automatically jailing this player.
                    Jail.JailPlayer jt = new Jail.JailPlayer(pm, 3, "Caught macroing again within 8 hours by automated system.", false);
                    jt.GoToJail();
                }
            }
            else
            {
                string[] lns = new string[2];

                // make the message reflect whether or not there is an actual/reasonable bounty
                if (HasGold(pm) > 100 || BountyKeeper.CurrentLBBonusAmount > 100)
                {
                    lns[0] = String.Format("A bounty has been placed on the head of {0} for unlawful resource gathering.", pm.Name);
                }
                else
                {
                    lns[0] = String.Format("{0} is an enemy of the kingdom for unlawful resource gathering.", pm.Name);
                }

                lns[1] = String.Format("{0} was last seen at {1}.", pm.Name, location);

                // Adam: changed to 4 hours from 8
                ListEntry TCTextHandle = PJUM.AddMacroer(lns, pm, DateTime.Now + TimeSpan.FromHours(4));

                //Add bounty to player
                string name = String.Format("Officer {0}", Utility.RandomBool() ? NameList.RandomName("male") : NameList.RandomName("female"));

                int       bountyAmount = 0;
                Container cont         = pm.BankBox;
                if (cont != null)
                {
                    int iAmountInBank = 0;

                    Item[] golds = cont.FindItemsByType(typeof(Gold), true);
                    foreach (Item g in golds)
                    {
                        iAmountInBank += g.Amount;
                    }

                    int randomAmount = Utility.RandomMinMax(iAmountInBank / 2, iAmountInBank);

                    if (cont.ConsumeTotal(typeof(Gold), randomAmount))
                    {
                        bountyAmount = randomAmount;
                    }
                }

                // note, from can be null (which is fine)
                Bounty bounty = null;
                bounty = new Bounty(from as PlayerMobile, pm, bountyAmount, name);
                if (bounty != null)
                {                       // associate the town crier message with thie bounty so we can update the message once the bounty is collected.
                    bounty.TownCrierEntryID = TCTextHandle.EntryID;
                    BountyKeeper.Add(bounty);
                }

                //Add comment to account
                Account acc     = pm.Account as Account;
                string  comment = String.Format("On {0}, {1} caught {2} unattended macroing at {3} : reported using the [macroer command",
                                                DateTime.Now,
                                                from != null ? from.Name : "auto-RTT",
                                                pm.Name,
                                                location);
                acc.Comments.Add(new AccountComment(from != null ? from.Name : "RTT SYSTEM", comment));
            }
        }