コード例 #1
0
ファイル: PJUM.cs プロジェクト: zerodowned/angelisland
        public static void AddMacroer(string[] lines, Mobile m, DateTime dt)
        {
            ListEntry le = new ListEntry(lines, m, dt, ListEntryType.PJUM);

            TCCS.AddEntry(le);
            PJUM.MakeAllEntriesCriminal();
        }
コード例 #2
0
ファイル: PJUM.cs プロジェクト: githuborwhatever/Angel-Island
 public static void PJUM_Work()
 {
     try
     {
         PJUM.UpdateAnnouncements();
     }
     catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
 }
コード例 #3
0
ファイル: PJUM.cs プロジェクト: zerodowned/angelisland
 public static void PJUM_Work()
 {
     try
     {
         PJUM.MakeAllEntriesCriminal();
         PJUM.UpdateLocations();
     }
     catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
 }
コード例 #4
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));
            }
        }
コード例 #5
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));
            }
        }
コード例 #6
0
ファイル: IBanThee.cs プロジェクト: zerodowned/angelisland
            protected override void OnTarget(Mobile from, object targ)
            {
                if (targ is PlayerMobile)
                {
                    try
                    {
                        PlayerMobile pm = (PlayerMobile)targ;

                        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.
                        Server.Scripts.Commands.CommandLogging.WriteLine(from, "{0} used [ibanthee command on {1}({2}) - at {3}",
                                                                         from.Name, pm.Name, pm.Serial, location);

                        from.SendMessage("Reporting {0} as Banned!", pm.Name);

                        string[] lns = new string[2];
                        lns[0] = String.Format("A bounty has been placed on the head of {0} for disrupting a royal tournament. .", pm.Name);
                        lns[1] = String.Format("{0} was last seen at {1}.", pm.Name, location);


                        if (PJUM.HasBeenReported(pm))
                        {
                            from.SendMessage("{0} has already been reported.", pm.Name);
                        }
                        else
                        {
                            //move player to outside arena
                            pm.MoveToWorld(new Point3D(353, 905, 0), Map.Felucca);

                            PJUM.AddMacroer(lns, pm, DateTime.Now + TimeSpan.FromHours(2));

                            //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 == 0)
                            {
                                bountyAmount = 100;
                            }

                            Bounty bounty = new Bounty((PlayerMobile)from, pm, bountyAmount, name);
                            BountyKeeper.Add(bounty);

                            //Add comment to account
                            Account acc     = pm.Account as Account;
                            string  comment = String.Format("On {0}, {1} caught {2} disturbing event at {3} : removed using the [ibanthee command",
                                                            DateTime.Now,
                                                            from.Name,
                                                            pm.Name,
                                                            location);
                            acc.Comments.Add(new AccountComment(from.Name, comment));
                        }
                    }
                    catch (Exception except)
                    {
                        LogHelper.LogException(except);
                        System.Console.WriteLine("Caught exception in [ibanthee command: {0}", except.Message);
                        System.Console.WriteLine(except.StackTrace);
                    }
                }
                else
                {
                    from.SendMessage("Only players can be banned.");
                }
            }