Format() public static méthode

public static Format ( object o ) : object
o object
Résultat object
Exemple #1
0
        public static void LastLoc_Command(CommandEventArgs e)
        {
            PlayerMobile pm = e.Mobile as PlayerMobile;

            if (pm != null && pm.Companion)
            {
                if (pm.CompanionLastLocation != Point3D.Zero)
                {
                    if (pm.Criminal)
                    {
                        pm.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
                    }
                    else if (SpellHelper.CheckCombat(pm, true))
                    {
                        pm.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
                    }
                    else if (!SpellHelper.CheckTravel(pm, TravelCheckType.RecallFrom))
                    {
                        pm.SendMessage("Companions may not teleport away from this location");
                    }
                    else
                    {
                        CommandLogging.WriteLine(pm, "{0} {1} teleporting from {2} to {3}", pm.AccessLevel, CommandLogging.Format(pm), new Point3D(pm.Location), pm.CompanionLastLocation);
                        pm.Location = pm.CompanionLastLocation;
                        pm.CompanionLastLocation = Point3D.Zero;
                    }
                }
                else
                {
                    pm.SendAsciiMessage("You must first teleport to a new player before returning to your last location.");
                }
            }
        }
Exemple #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;
                    if (from != targ)
                    {
                        from.SendMessage("You may only set your own body to GM style.");
                    }

                    else
                    {
                        m_Mobile = from;

                        if (Config.Staff.Staffbody)
                        {
                            m_Mobile.BodyValue = 987;

                            if (Config.Staff.UseColoring)
                            {
                                switch (m_Mobile.AccessLevel)
                                {
                                case AccessLevel.Owner: m_Mobile.Hue = Config.Staff.Owner; break;

                                case AccessLevel.Developer: m_Mobile.Hue = Config.Staff.Developer; break;

                                case AccessLevel.Administrator: m_Mobile.Hue = Config.Staff.Administrator; break;

                                case AccessLevel.Seer: m_Mobile.Hue = Config.Staff.Seer; break;

                                case AccessLevel.GameMaster: m_Mobile.Hue = Config.Staff.GameMaster; break;

                                case AccessLevel.Counselor: m_Mobile.Hue = Config.Staff.Counselor; break;
                                }
                            }
                        }

                        if (Config.Staff.CutHair)
                        {
                            m_Mobile.HairItemID = 0;
                        }

                        if (Config.Staff.CutFacialHair)
                        {
                            m_Mobile.FacialHairItemID = 0;
                        }

                        CommandLogging.WriteLine(from, "{0} {1} is assuming a GM body", from.AccessLevel, CommandLogging.Format(from));

                        Container pack = from.Backpack;

                        ArrayList ItemsToDelete = new ArrayList();

                        foreach (Item item in from.Items)
                        {
                            if (item.Layer != Layer.Bank && item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Layer != Layer.Mount && item.Layer != Layer.Backpack)
                            {
                                ItemsToDelete.Add(item);
                            }
                        }
                        foreach (Item item in ItemsToDelete)
                        {
                            item.Delete();
                        }

                        if (pack == null)
                        {
                            pack         = new Backpack();
                            pack.Movable = false;

                            from.AddItem(pack);
                        }
                        else
                        {
                            pack.Delete();
                            pack         = new Backpack();
                            pack.Movable = false;

                            from.AddItem(pack);
                        }

                        from.Hunger  = 20;
                        from.Thirst  = 20;
                        from.Fame    = 0;
                        from.Karma   = 0;
                        from.Kills   = 0;
                        from.Hidden  = true;
                        from.Blessed = true;
                        from.Hits    = from.HitsMax;
                        from.Mana    = from.ManaMax;
                        from.Stam    = from.StamMax;

                        if (from.IsStaff())
                        {
                            EquipItem(new StaffRobe());

                            PackItem(new GMHidingStone());
                            PackItem(new GMEthereal());
                            PackItem(new StaffOrb(from));

                            PackItem(new Spellbook((ulong)18446744073709551615));

                            from.RawStr = 100;
                            from.RawDex = 100;
                            from.RawInt = 100;

                            from.Hits = from.HitsMax;
                            from.Mana = from.ManaMax;
                            from.Stam = from.StamMax;

                            for (int i = 0; i < targ.Skills.Length; ++i)
                            {
                                targ.Skills[i].Base = 120;
                            }
                        }

                        if (Config.Staff.GiveBoots)
                        {
                            int color = 0;
                            if (Config.Staff.UseColoring)
                            {
                                switch (m_Mobile.AccessLevel)
                                {
                                case AccessLevel.Owner: color = Config.Staff.Owner; break;

                                case AccessLevel.Developer: color = Config.Staff.Developer; break;

                                case AccessLevel.Administrator: color = Config.Staff.Administrator; break;

                                case AccessLevel.Seer: color = Config.Staff.Seer; break;

                                case AccessLevel.GameMaster: color = Config.Staff.GameMaster; break;

                                case AccessLevel.Counselor: color = Config.Staff.Counselor; break;
                                }
                            }

                            if (from.IsStaff() && from.AccessLevel <= AccessLevel.Spawner)
                            {
                                EquipItem(new FurBoots(color));
                            }
                            else if (from.AccessLevel == AccessLevel.GameMaster)
                            {
                                EquipItem(new FurBoots(color));
                            }
                            if (from.AccessLevel == AccessLevel.Seer)
                            {
                                EquipItem(new FurBoots(color));
                            }
                            if (from.AccessLevel == AccessLevel.Administrator)
                            {
                                EquipItem(new FurBoots(color));
                            }
                            if (from.AccessLevel == AccessLevel.Developer)
                            {
                                EquipItem(new FurBoots(color));
                            }
                            if (from.AccessLevel >= AccessLevel.CoOwner)
                            {
                                EquipItem(new FurBoots(color));
                            }
                        }
                    }
                }
            }
Exemple #3
0
            protected override void OnTarget(Mobile from, object targ)
            {
                var done = false;

                if (!(targ is Item))
                {
                    from.SendMessage("You can only dupe items.");
                    return;
                }

                CommandLogging.WriteLine(
                    from,
                    "{0} {1} duping {2} (inBag={3}; amount={4})",
                    from.AccessLevel,
                    CommandLogging.Format(from),
                    CommandLogging.Format(targ),
                    m_InBag,
                    m_Amount
                    );

                var       copy = (Item)targ;
                Container pack = null;

                if (m_InBag)
                {
                    if (copy.Parent is Container cont)
                    {
                        pack = cont;
                    }
                    else if (copy.Parent is Mobile m)
                    {
                        pack = m.Backpack;
                    }
                }
                else
                {
                    pack = from.Backpack;
                }

                var c = copy.GetType().GetConstructor();

                if (c != null)
                {
                    var paramList = c.GetParameters();
                    var args      = paramList.Length == 0 ? null : new object[paramList.Length];
                    if (args != null)
                    {
                        Array.Fill(args, Type.Missing);
                    }

                    try
                    {
                        from.SendMessage("Duping {0}...", m_Amount);
                        for (var i = 0; i < m_Amount; i++)
                        {
                            if (c.Invoke(args) is Item newItem)
                            {
                                CopyProperties(newItem, copy);
                                copy.OnAfterDuped(newItem);
                                newItem.Parent = null;

                                if (pack != null)
                                {
                                    pack.DropItem(newItem);
                                }
                                else
                                {
                                    newItem.MoveToWorld(from.Location, from.Map);
                                }

                                newItem.InvalidateProperties();

                                CommandLogging.WriteLine(
                                    from,
                                    "{0} {1} duped {2} creating {3}",
                                    from.AccessLevel,
                                    CommandLogging.Format(from),
                                    CommandLogging.Format(targ),
                                    CommandLogging.Format(newItem)
                                    );
                            }
                        }

                        from.SendMessage("Done");
                        done = true;
                    }
                    catch
                    {
                        from.SendMessage("Error!");
                        return;
                    }
                }

                if (!done)
                {
                    from.SendMessage("Unable to dupe. Item must have a constructor with zero required parameters.");
                }
            }
Exemple #4
0
        public static void DupeChildren(Mobile m, Container src, Container dest)
        {
            foreach (Item item in src.Items)
            {
                try
                {
                    Type t = item.GetType();

                    if (m != null)
                    {
                        object[] a = t.GetCustomAttributes(typeof(ConstructableAttribute), false);

                        if (a.OfType <ConstructableAttribute>().Any(ca => ca.AccessLevel > m.AccessLevel))
                        {
                            continue;
                        }
                    }

                    Item o;

                    try
                    {
                        o = Activator.CreateInstance(t, true) as Item;
                    }
                    catch
                    {
                        o = null;
                    }

                    if (o == null)
                    {
                        continue;
                    }

                    CopyProperties(item, o);

                    o.Parent = null;

                    item.OnAfterDuped(o);

                    if (item is Container && o is Container)
                    {
                        DupeChildren(m, (Container)item, (Container)o);
                    }

                    dest.DropItem(o);
                    o.Location = item.Location;

                    o.UpdateTotals();
                    o.InvalidateProperties();
                    o.Delta(ItemDelta.Update);

                    CommandLogging.WriteLine(
                        m,
                        "{0} {1} duped {2} creating {3}",
                        m.AccessLevel,
                        CommandLogging.Format(m),
                        CommandLogging.Format(item),
                        CommandLogging.Format(o));

                    item.Delta(ItemDelta.Update);
                }
                catch (Exception e)
                {
                    Diagnostics.ExceptionLogging.LogException(e);
                }
            }
        }
Exemple #5
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (!BaseCommand.IsAccessible(from, o))
                {
                    from.SendMessage("That is not accessible.");
                }
                else
                {
                    from.SendGump(new PropertiesGump(from, o));
                    string logText = "";
                    if (o is Mobile)
                    {
                        Mobile m = (Mobile)o;
                        if (m.Account == null)
                        {
                            logText = String.Format("{0} (no account)", m);
                        }
                        else
                        {
                            logText = String.Format("{0} ('{1}')", m, m.Account.Username);
                        }
                    }
                    else if (o is Item)
                    {
                        Item item = (Item)o;
                        logText = String.Format("0x{0:X} ({1})", item.Serial.Value, item.GetType().Name);
                    }
                    else
                    {
                        return;
                    }

                    CommandLogging.WriteLine(from, String.Format("{0} opened Props gump for {1}", CommandLogging.Format(from), logText));
                }
            }
Exemple #6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile m = (Mobile)targeted;

                    BankBox box = (m.Player ? m.BankBox : m.FindBankNoCreate());

                    if (box != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} opening bank box of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted));

                        if (from == targeted)
                        {
                            box.Open();
                        }
                        else
                        {
                            box.DisplayTo(from);
                        }
                    }
                    else
                    {
                        from.SendMessage("They have no bank box.");
                    }
                }
            }
Exemple #7
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    CommandLogging.WriteLine(from, "{0} {1} dismounting {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted));

                    Mobile targ = (Mobile)targeted;

                    for (int i = 0; i < targ.Items.Count; ++i)
                    {
                        Item item = targ.Items[i];

                        if (item is IMountItem)
                        {
                            IMount mount = ((IMountItem)item).Mount;

                            if (mount != null)
                            {
                                mount.Rider = null;
                            }

                            if (targ.Items.IndexOf(item) == -1)
                            {
                                --i;
                            }
                        }
                    }

                    for (int i = 0; i < targ.Items.Count; ++i)
                    {
                        Item item = targ.Items[i];

                        if (item.Layer == Layer.Mount)
                        {
                            item.Delete();
                            --i;
                        }
                    }
                }
            }
Exemple #8
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;
                    if (from != targ)
                    {
                        from.SendMessage("You may only set your own body to GM style.");
                    }

                    else
                    {
                        m_Mobile = from;

                        CommandLogging.WriteLine(from, "{0} {1} is assuming a GM body", from.AccessLevel, CommandLogging.Format(from));

                        Container pack = from.Backpack;

                        ArrayList ItemsToDelete = new ArrayList();

                        foreach (Item item in from.Items)
                        {
                            if (item.Layer != Layer.Bank && item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Layer != Layer.Mount && item.Layer != Layer.Backpack)
                            {
                                ItemsToDelete.Add(item);
                            }
                        }
                        foreach (Item item in ItemsToDelete)
                        {
                            item.Delete();
                        }

                        if (pack == null)
                        {
                            pack         = new Backpack();
                            pack.Movable = false;

                            from.AddItem(pack);
                        }
                        else
                        {
                            pack.Delete();
                            pack         = new Backpack();
                            pack.Movable = false;

                            from.AddItem(pack);
                        }

                        from.Hunger  = 20;
                        from.Thirst  = 20;
                        from.Fame    = 0;
                        from.Karma   = 0;
                        from.Kills   = 0;
                        from.Hidden  = true;
                        from.Blessed = true;
                        from.Hits    = from.HitsMax;
                        from.Mana    = from.ManaMax;
                        from.Stam    = from.StamMax;

                        if (from.IsStaff())
                        {
                            EquipItem(new StaffRing());
                            EquipItem(new StaffRobe());

                            PackItem(new GMHidingStone());
                            PackItem(new GMEthereal());
                            PackItem(new StaffOrb(from));

                            PackItem(new Spellbook((ulong)18446744073709551615));
                            PackItem(new NecromancerSpellbook((ulong)0xffff));
                            PackItem(new BookOfChivalry());
                            PackItem(new BookOfBushido());
                            PackItem(new SpellweavingBook((ulong)0xffff));

                            from.RawStr = 100;
                            from.RawDex = 100;
                            from.RawInt = 100;

                            from.Hits = from.HitsMax;
                            from.Mana = from.ManaMax;
                            from.Stam = from.StamMax;

                            for (int i = 0; i < targ.Skills.Length; ++i)
                            {
                                targ.Skills[i].Base = 120;
                            }
                        }

                        if (from.IsStaff() && from.AccessLevel <= AccessLevel.Spawner)
                        {
                            EquipItem(new FurBoots(3));
                        }
                        else if (from.AccessLevel == AccessLevel.GameMaster)
                        {
                            EquipItem(new FurBoots(39));
                        }
                        if (from.AccessLevel == AccessLevel.Seer)
                        {
                            EquipItem(new FurBoots(467));
                        }
                        if (from.AccessLevel == AccessLevel.Administrator)
                        {
                            EquipItem(new FurBoots(1001));
                        }
                        if (from.AccessLevel == AccessLevel.Developer)
                        {
                            EquipItem(new FurBoots(1001));
                        }
                        if (from.AccessLevel >= AccessLevel.CoOwner)
                        {
                            EquipItem(new FurBoots(1001));
                        }
                    }
                }
            }
Exemple #9
0
            protected override void OnTarget(Mobile from, object targ)
            {
                bool done = false;

                if (!(targ is Item))
                {
                    from.SendMessage("You can only dupe items.");
                    return;
                }

                CommandLogging.WriteLine(from, "{0} {1} duping {2} (inBag={3}; amount={4})", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ), this.m_InBag, this.m_Amount);

                Item      copy = (Item)targ;
                Container pack;

                if (this.m_InBag)
                {
                    if (copy.Parent is Container)
                    {
                        pack = (Container)copy.Parent;
                    }
                    else if (copy.Parent is Mobile)
                    {
                        pack = ((Mobile)copy.Parent).Backpack;
                    }
                    else
                    {
                        pack = null;
                    }
                }
                else
                {
                    pack = from.Backpack;
                }

                Type t = copy.GetType();

                //ConstructorInfo[] info = t.GetConstructors();

                ConstructorInfo c = t.GetConstructor(Type.EmptyTypes);

                if (c != null)
                {
                    try
                    {
                        from.SendMessage("Duping {0}...", this.m_Amount);
                        for (int i = 0; i < this.m_Amount; i++)
                        {
                            object o = c.Invoke(null);

                            if (o != null && o is Item)
                            {
                                Item newItem = (Item)o;
                                CopyProperties(newItem, copy);//copy.Dupe( item, copy.Amount );
                                copy.OnAfterDuped(newItem);
                                newItem.Parent = null;

                                if (pack != null)
                                {
                                    pack.DropItem(newItem);
                                }
                                else
                                {
                                    newItem.MoveToWorld(from.Location, from.Map);
                                }

                                newItem.InvalidateProperties();

                                CommandLogging.WriteLine(from, "{0} {1} duped {2} creating {3}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ), CommandLogging.Format(newItem));
                            }
                        }
                        from.SendMessage("Done");
                        done = true;
                    }
                    catch
                    {
                        from.SendMessage("Error!");
                        return;
                    }
                }

                if (!done)
                {
                    from.SendMessage("Unable to dupe.  Item must have a 0 parameter constructor.");
                }
            }
Exemple #10
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile && m_type < 2)
                {
                    Mobile targ = ( Mobile )targeted;

                    if (from != targ && from.AccessLevel > targ.AccessLevel)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} forcing speech on {2}.", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ));
                        if (m_toSay.StartsWith(CommandSystem.Prefix))
                        {
                            targ.SendMessage("{0} makes you invoke {1}.", from.Name, m_toSay);
                            CommandSystem.Handle(targ, String.Format("{0}{1}", CommandSystem.Prefix, m_toSay.Substring(1)));
                        }
                        else
                        {
                            targ.Say(m_toSay);
                        }
                    }
                    else if (from == targ)
                    {
                        from.SendMessage("You don't need this command to make yourself say something!");
                    }
                    else if (from.AccessLevel <= targ.AccessLevel)
                    {
                        from.SendMessage("You cannot do that.");
                    }
                }
                else if (targeted is Item && m_type != 1)
                {
                    Item   targ = (Item)targeted;
                    object root = targ.RootParent;

                    if (root == null)
                    {
                        targ.PublicOverheadMessage(MessageType.Regular, (SpeechHueOverride < 0 ? Utility.RandomDyedHue() : SpeechHueOverride), false, m_toSay);
                    }
                    else if (root is Mobile)
                    {
                        if (from != ((Mobile)root) && from.AccessLevel > ((Mobile)root).AccessLevel)
                        {
                            CommandLogging.WriteLine(from, "{0} {1} forcing speech on {2}.", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(((Mobile)root)));
                            if (m_toSay.StartsWith(CommandSystem.Prefix))
                            {
                                ((Mobile)root).SendMessage("{0} makes you invoke {1}.", from.Name, m_toSay);
                                CommandSystem.Handle(((Mobile)root), String.Format("{0}{1}", CommandSystem.Prefix, m_toSay.Substring(1)));
                            }
                            else
                            {
                                ((Mobile)root).Say(m_toSay);
                            }
                        }
                        else if (from == ((Mobile)root))
                        {
                            from.SendMessage("You don't need this command to make yourself say something!");
                        }
                        else if (from.AccessLevel <= ((Mobile)root).AccessLevel)
                        {
                            from.SendMessage("You cannot do that.");
                        }
                    }
                    else if (root is Item)
                    {
                        targ.PublicOverheadMessage(MessageType.Regular, (SpeechHueOverride < 0 ? Utility.RandomDyedHue() : SpeechHueOverride), false, m_toSay);
                    }
                }
                else if (targeted is StaticTarget && m_type != 1)
                {
                    StaticOverhead s = new StaticOverhead();
                    s.MoveToWorld(((StaticTarget)targeted).Location, from.Map);
                    s.PublicOverheadMessage(MessageType.Regular, (SpeechHueOverride < 0 ? Utility.RandomDyedHue() : SpeechHueOverride), false, m_toSay);
                }
                else
                {
                    from.SendMessage("Invaild Target Type");
                }
            }
Exemple #11
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;

                    if (from != targ && from.AccessLevel > targ.AccessLevel)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} forcing speech on {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ));
                        targ.Say(m_toSay);
                    }
                }
                else if (targeted is Item)
                {
                    Item targ = (Item)targeted;
                    targ.PublicOverheadMessage(MessageType.Regular, Utility.RandomDyedHue(), false, m_toSay);
                }
                else
                {
                    from.SendMessage("Invaild Target Type");
                }
            }
			protected override void OnTarget(Mobile from, object targ)
			{
				if (!(targ is Item))
				{
					from.SendMessage("You can only dupe items.");
					return;
				}

				Server.World.Broadcast(0x35, true, "Performing routine maintenance, please wait.");
				Console.WriteLine("AddToBank: working...");
				DateTime startTime = DateTime.Now;

				from.SendMessage("Placing {0} into bank boxes...", ((Item)targ).Name == null ? "an item" : ((Item)targ).Name.ToString());
				CommandLogging.WriteLine(from, "{0} {1} adding {2} to bank boxes )", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ));

				GiveItem(from, (Item)targ, m_Amount, m_CopyProperties, m_GiveRule, m_Access);

				DateTime endTime = DateTime.Now;
				Console.WriteLine("done in {0:F1} seconds.", (endTime - startTime).TotalSeconds);
				Server.World.Broadcast(0x35, true, "Routine maintenance complete. The entire process took {0:F1} seconds.", (endTime - startTime).TotalSeconds);
			}
Exemple #13
0
            protected override void OnTarget(Mobile from, object targ)
            {
                if (!(targ is Item))
                {
                    from.SendMessage("You can only dupe items.");
                    return;
                }

                from.SendMessage("Placing {0} into bank boxes...", ((Item)targ).Name == null ? "an item" : ((Item)targ).Name.ToString());
                CommandLogging.WriteLine(from, "{0} {1} adding {2} to bank boxes )", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ));

                GiveItem(from, (Item)targ, m_Amount, m_GiveRule, m_Access);
            }
Exemple #14
0
            protected override void OnTarget(Mobile from, object targ)
            {
                bool done = false;

                if (!(targ is Item))
                {
                    from.SendMessage("You can only dupe items.");
                    return;
                }

                CommandLogging.WriteLine(from, "{0} {1} duping {2} (inBag={3}; amount={4})", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ), m_InBag, m_Amount);

                Item      copy = (Item)targ;
                Container pack;

                if (m_InBag)
                {
                    if (copy.Parent is Container)
                    {
                        pack = (Container)copy.Parent;
                    }
                    else if (copy.Parent is Mobile)
                    {
                        pack = ((Mobile)copy.Parent).Backpack;
                    }
                    else
                    {
                        pack = null;
                    }
                }
                else
                {
                    pack = from.Backpack;
                }

                from.SendMessage("Duping {0}...", m_Amount);
                for (int i = 0; i < m_Amount; i++)
                {
                    Item a = DupeItem(from, copy, true);
                    if (a == null)
                    {
                        break;
                    }

                    if (pack != null)
                    {
                        pack.DropItem(a);
                    }
                    else
                    {
                        a.MoveToWorld(from.Location, from.Map);
                    }
                    done = true;
                }

                if (done)
                {
                    from.SendMessage("Done");
                }
                else
                {
                    from.SendMessage("Error!");
                }
            }
Exemple #15
0
 public override void OnResponse(NetState state, int index)
 {
     if (index == 0)
     {
         CommandLogging.WriteLine(state.Mobile, "{0} {1} moving equipment item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format(state.Mobile), CommandLogging.Format(m_Item), CommandLogging.Format(m_Mobile));
         state.Mobile.Target = new MoveTarget(m_Item);
     }
     else if (index == 1)
     {
         CommandLogging.WriteLine(state.Mobile, "{0} {1} deleting equipment item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format(state.Mobile), CommandLogging.Format(m_Item), CommandLogging.Format(m_Mobile));
         m_Item.Delete();
     }
     else if (index == 2)
     {
         CommandLogging.WriteLine(state.Mobile, "{0} {1} opening properties for equipment item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format(state.Mobile), CommandLogging.Format(m_Item), CommandLogging.Format(m_Mobile));
         state.Mobile.SendGump(new PropertiesGump(state.Mobile, m_Item));
     }
 }
Exemple #16
0
        public static void Invoke(
            Mobile from, Point3D start, Point3D end, string[] args, List <Container> packs = null,
            bool outline = false, bool mapAvg = false
            )
        {
            var sb = new StringBuilder();

            sb.AppendFormat("{0} {1} building ", from.AccessLevel, CommandLogging.Format(from));

            if (start == end)
            {
                sb.AppendFormat("at {0} in {1}", start, from.Map);
            }
            else
            {
                sb.AppendFormat("from {0} to {1} in {2}", start, end, from.Map);
            }

            sb.Append(':');

            for (var i = 0; i < args.Length; ++i)
            {
                sb.AppendFormat(" \"{0}\"", args[i]);
            }

            CommandLogging.WriteLine(from, sb.ToString());

            var name = args[0];

            FixArgs(ref args);

            string[,] props = null;

            for (var i = 0; i < args.Length; ++i)
            {
                if (args[i].InsensitiveEquals("set"))
                {
                    var remains = args.Length - i - 1;

                    if (remains >= 2)
                    {
                        props = new string[remains / 2, 2];

                        remains /= 2;

                        for (var j = 0; j < remains; ++j)
                        {
                            props[j, 0] = args[i + j * 2 + 1];
                            props[j, 1] = args[i + j * 2 + 2];
                        }

                        FixSetString(ref args, i);
                    }

                    break;
                }
            }

            var type = AssemblyHandler.FindTypeByName(name);

            if (!IsEntity(type))
            {
                from.SendMessage("No type with that name was found.");
                return;
            }

            var watch = new Stopwatch();

            watch.Start();

            var built = BuildObjects(from, type, start, end, args, props, packs, outline, mapAvg);

            if (built > 0)
            {
                watch.Stop();
                from.SendMessage(
                    "{0} object{1} generated in {2:F2} seconds.",
                    built,
                    built != 1 ? "s" : "",
                    watch.Elapsed.TotalSeconds
                    );
            }
            else
            {
                SendUsage(type, from);
            }
        }
Exemple #17
0
        private static void PlaySound(Mobile m, int index, bool toAll)
        {
            Map map = m.Map;

            if (map == null)
            {
                return;
            }

            CommandLogging.WriteLine(m, "{0} {1} playing sound {2} (toAll={3})", m.AccessLevel, CommandLogging.Format(m), index, toAll);

            Packet p = new PlaySound(index, m.Location);

            p.Acquire();

            foreach (NetState state in m.GetClientsInRange(12))
            {
                if (toAll || state.Mobile.CanSee(m))
                {
                    state.Send(p);
                }
            }

            p.Release();
        }
Exemple #18
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is Mobile)
                {
                    Mobile speaker = (Mobile)target;

                    if (from != speaker && from.AccessLevel > speaker.AccessLevel)
                    {
                        speaker.Say(m_toSay);

                        CommandLogging.WriteLine(from, "{0} {1} forcing speech on {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(speaker));
                    }
                }
                else if (target is Item)
                {
                    Item item = (Item)target;

                    item.PublicOverheadMessage(MessageType.Regular, from.SpeechHue, false, m_toSay);
                }
                else
                {
                    from.SendMessage("Invalid type.");
                }
            }
Exemple #19
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;

                    if (targ.NetState != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} opening client menu of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted));
                        from.SendGump(new ClientGump(from, targ.NetState));
                    }
                }
            }
Exemple #20
0
        public static Item DupeItem(Mobile m, Item item)
        {
            try
            {
                var t = item.GetType();

                if (m != null)
                {
                    var a = t.GetCustomAttributes(typeof(ConstructableAttribute), false);

                    if (a.OfType <ConstructableAttribute>().Any(ca => ca.AccessLevel > m.AccessLevel))
                    {
                        return(null);
                    }
                }

                Item o;

                try
                {
                    o = Activator.CreateInstance(t, true) as Item;
                }
                catch
                {
                    o = null;
                }

                if (o == null)
                {
                    return(null);
                }

                CopyProperties(item, o);

                o.Parent = null;

                item.OnAfterDuped(o);

                if (item is Container && o is Container)
                {
                    DupeChildren(m, (Container)item, (Container)o);
                }

                if (m != null)
                {
                    o.MoveToWorld(m.Location, m.Map);

                    o.UpdateTotals();
                    o.InvalidateProperties();
                    o.Delta(ItemDelta.Update);

                    CommandLogging.WriteLine(m, "{0} {1} duped {2} creating {3}", m.AccessLevel, CommandLogging.Format(m),
                                             CommandLogging.Format(item), CommandLogging.Format(o));
                }

                item.Delta(ItemDelta.Update);

                return(o);
            }
            catch
            {
                return(null);
            }
        }
Exemple #21
0
        public void DupeEntity()
        {
            if (!HasAccess(m_Entity.GetType()))
            {
                return;
            }

            if (m_Entity is Item)
            {
                Mobile rootparent = ((Item)m_Entity).RootParent as Mobile;
                if (rootparent != null && m_From.AccessLevel < rootparent.AccessLevel)
                {
                    m_From.SendMessage("You cannot dupe what does not belong to you.");
                    return;
                }
            }

            //Set saves off?
            m_EntityInfo = new Entity(m_Entity.Serial, m_Entity.Location, m_Entity.Map);
            m_Parent     = m_Entity is Item ? ((Item)m_Entity).Parent : null;

            if (m_Entity is Mobile)
            {
                ((Mobile)m_Entity).Internalize();
            }
            else if (m_Entity is Item)
            {
                ((Item)m_Entity).Internalize();
            }

            m_Entities.Add(m_Entity);

            if (m_Entity is Mobile && !AddEntitiesFromList(((Mobile)m_Entity).Items))
            {
                return;
            }

            if (m_Entity is Item && !AddEntitiesFromList(((Item)m_Entity).LookupItems()))
            {
                return;
            }
            else
            {
                m_DupeBag      = new Bag();
                m_DupeBag.Hue  = 6;
                m_DupeBag.Name = "Duped on " + DateTime.Today.ToString("dd.MM.yyyy");
            }

            IEntity entity = Dupe();             //Main duping method; returns null if error or failure.

            if (entity is Item)
            {
                if (m_DupeBag != null)
                {
                    m_DupeBag.DropItem((Item)entity);
                    m_DupeBag.UpdateTotals();
                    m_DupeBag.InvalidateProperties();
                    m_DupeBag.ProcessDelta();
                }
                else
                {
                    ((Item)entity).MoveToWorld(m_EntityInfo.Location, m_EntityInfo.Map);
                }
            }
            else if (entity is Mobile)
            {
                ((Mobile)entity).MoveToWorld(m_EntityInfo.Location, m_EntityInfo.Map);
            }

            if (m_Entity is Item)
            {
                Item origitem = m_Entity as Item;

                if (m_Parent != null)
                {
                    if (m_Parent is Mobile)
                    {
                        ((Mobile)m_Parent).EquipItem(origitem);
                    }
                    else if (m_Parent is Container)
                    {
                        ((Container)m_Parent).DropItem(origitem);
                        origitem.Location = m_EntityInfo.Location;
                        origitem.ProcessDelta();
                    }
                }
                else
                {
                    origitem.MoveToWorld(m_EntityInfo.Location, m_EntityInfo.Map);
                }
            }
            else if (m_Entity is Mobile)
            {
                ((Mobile)m_Entity).MoveToWorld(m_EntityInfo.Location, m_EntityInfo.Map);
            }

            m_From.AddToBackpack(m_DupeBag);

            if (m_NewEntities.Count > 0)
            {
                m_From.SendGump(new InterfaceGump(m_From, new string[] { "Entity" }, new ArrayList(m_NewEntities), 0, null));

                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("{0} {1} duping ", m_From.AccessLevel, CommandLogging.Format(m_From));
                sb.AppendFormat("at {0} in {1}: ", m_From.Location, m_From.Map);
                int serial = (m_Entity is Item ? ((Item)m_Entity).Serial : ((Mobile)m_Entity).Serial);
                sb.AppendFormat("{0} objects via target {1:X}", m_NewEntities.Count, serial);
                CommandLogging.WriteLine(m_From, sb.ToString());

                sb = new StringBuilder();
                StringBuilder sbm = new StringBuilder();

                sb.Append("Serials been duped:");
                sbm.Append("Serials:");

                for (int i = 0; i < m_Entities.Count; i++)
                {
                    sb.AppendFormat(" 0x{0:X};", m_Entities[i].Serial);
                    sbm.AppendFormat(" 0x{0:X};", m_NewEntities[i].Serial);
                }
                CommandLogging.WriteLine(m_From, sb.ToString());
                CommandLogging.WriteLine(m_From, sbm.ToString());
            }

            m_From.SendMessage("Duping completed.");
        }
Exemple #22
0
        public static void DeleteList_Callback(Mobile from, bool okay, object state)
        {
            if (okay)
            {
                List <IEntity> list = (List <IEntity>)state;

                CommandLogging.WriteLine(from, "{0} {1} deleting {2} object{3}", from.AccessLevel, CommandLogging.Format(from), list.Count, list.Count == 1 ? "" : "s");

                NetState.Pause();

                for (int i = 0; i < list.Count; ++i)
                {
                    list[i].Delete();
                }

                NetState.Resume();

                from.SendMessage("You have deleted {0} object{1}.", list.Count, list.Count == 1 ? "" : "s");
            }
            else
            {
                from.SendMessage("You have chosen not to delete those objects.");
            }
        }
Exemple #23
0
            protected override void OnTarget(Mobile m, object targ)
            {
                bool done = false;

                if (!(targ is Item))
                {
                    m.SendMessage("You can only dupe items.");
                    return;
                }

                CommandLogging.WriteLine(
                    m,
                    "{0} {1} duping {2} (inBag={3}; amount={4})",
                    m.AccessLevel,
                    CommandLogging.Format(m),
                    CommandLogging.Format(targ),
                    _InBag,
                    _Amount);

                Item item = (Item)targ;

                Container pack;

                if (_InBag)
                {
                    if (item.Parent is Container)
                    {
                        pack = (Container)item.Parent;
                    }
                    else if (item.Parent is Mobile)
                    {
                        pack = ((Mobile)item.Parent).Backpack;
                    }
                    else
                    {
                        pack = null;
                    }
                }
                else
                {
                    pack = m.Backpack;
                }

                Type t = item.GetType();

                object[] a = t.GetCustomAttributes(typeof(ConstructableAttribute), false);

                if (a.OfType <ConstructableAttribute>().Any(ca => ca.AccessLevel > m.AccessLevel))
                {
                    return;
                }

                try
                {
                    m.SendMessage("Duping {0}...", _Amount);

                    bool noCtor = false;

                    for (int i = 0; i < _Amount; i++)
                    {
                        Item o;

                        try
                        {
                            o = Activator.CreateInstance(t, true) as Item;
                        }
                        catch
                        {
                            o = null;
                        }

                        if (o == null)
                        {
                            noCtor = true;
                            break;
                        }

                        CopyProperties(item, o);

                        o.Parent = null;

                        item.OnAfterDuped(o);

                        if (item is Container && o is Container)
                        {
                            m.SendMessage("Duping Container Children...");
                            DupeChildren(m, (Container)item, (Container)o);
                        }

                        if (pack != null)
                        {
                            pack.DropItem(o);
                        }
                        else
                        {
                            o.MoveToWorld(m.Location, m.Map);
                        }

                        o.UpdateTotals();
                        o.InvalidateProperties();
                        o.Delta(ItemDelta.Update);

                        CommandLogging.WriteLine(
                            m,
                            "{0} {1} duped {2} creating {3}",
                            m.AccessLevel,
                            CommandLogging.Format(m),
                            CommandLogging.Format(item),
                            CommandLogging.Format(o));
                    }

                    if (!noCtor)
                    {
                        m.SendMessage("Done");
                        done = true;
                    }
                }
                catch (Exception e)
                {
                    Diagnostics.ExceptionLogging.LogException(e);
                    m.SendMessage("Error");
                    return;
                }

                if (!done)
                {
                    m.SendMessage("Unable to dupe.  Item must have a 0 parameter constructor.");
                }
                else
                {
                    item.Delta(ItemDelta.Update);
                }
            }
Exemple #24
0
        public static void ClearFacet_OnCommand(CommandEventArgs e)
        {
            Map map = e.Mobile.Map;

            if (map == null || map == Map.Internal)
            {
                e.Mobile.SendMessage("You may not run that command here.");
                return;
            }

            List <IEntity> list = new List <IEntity>();

            foreach (Item item in World.Items.Values)
            {
                if (item.Map == map && item.Parent == null)
                {
                    list.Add(item);
                }
            }

            foreach (Mobile m in World.Mobiles.Values)
            {
                if (m.Map == map && !m.Player)
                {
                    list.Add(m);
                }
            }

            if (list.Count > 0)
            {
                CommandLogging.WriteLine(e.Mobile, "{0} {1} starting facet clear of {2} ({3} object{4})", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), map, list.Count, list.Count == 1 ? "" : "s");

                e.Mobile.SendGump(
                    new WarningGump(1060635, 30720,
                                    String.Format("You are about to delete {0} object{1} from this facet.  Do you really wish to continue?",
                                                  list.Count, list.Count == 1 ? "" : "s"),
                                    0xFFC000, 360, 260, new WarningGumpCallback(DeleteList_Callback), list));
            }
            else
            {
                e.Mobile.SendMessage("There were no objects found to delete.");
            }
        }
Exemple #25
0
        public static void DoWipe(Mobile from, Map map, Point3D start, Point3D end, WipeType type)
        {
            CommandLogging.WriteLine(from, "{0} {1} wiping from {2} to {3} in {5} ({4})", from.AccessLevel, CommandLogging.Format(from), start, end, type, map);

            bool mobiles = ((type & WipeType.Mobiles) != 0);
            bool multis  = ((type & WipeType.Multis) != 0);
            bool items   = ((type & WipeType.Items) != 0);

            List <IEntity> toDelete = new List <IEntity>();

            Rectangle2D rect = new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1);

            IPooledEnumerable eable;

            if ((items || multis) && mobiles)
            {
                eable = map.GetObjectsInBounds(rect);
            }
            else if (items || multis)
            {
                eable = map.GetItemsInBounds(rect);
            }
            else if (mobiles)
            {
                eable = map.GetMobilesInBounds(rect);
            }
            else
            {
                return;
            }

            foreach (IEntity obj in eable)
            {
                if (items && (obj is Item) && !((obj is BaseMulti) || (obj is HouseSign)))
                {
                    toDelete.Add(obj);
                }
                else if (multis && (obj is BaseMulti))
                {
                    toDelete.Add(obj);
                }
                else if (mobiles && (obj is Mobile) && !((Mobile)obj).Player)
                {
                    toDelete.Add(obj);
                }
            }

            eable.Free();

            for (int i = 0; i < toDelete.Count; ++i)
            {
                toDelete[i].Delete();
            }
        }
Exemple #26
0
        public static void GetFollowers_OnTarget(Mobile from, object obj)
        {
            if (obj is PlayerMobile)
            {
                PlayerMobile  master = (PlayerMobile)obj;
                List <Mobile> pets   = master.AllFollowers;

                if (pets.Count > 0)
                {
                    CommandLogging.WriteLine(from, "{0} {1} getting all followers of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(master));

                    from.SendMessage("That player has {0} pet{1}.", pets.Count, pets.Count != 1 ? "s" : "");

                    for (int i = 0; i < pets.Count; ++i)
                    {
                        Mobile pet = (Mobile)pets[i];

                        if (pet is IMount)
                        {
                            ((IMount)pet).Rider = null;                             // make sure it's dismounted
                        }
                        pet.MoveToWorld(from.Location, from.Map);
                    }
                }
                else
                {
                    from.SendMessage("There were no pets found for that player.");
                }
            }
            else if (obj is Mobile && ((Mobile)obj).Player)
            {
                Mobile    master = (Mobile)obj;
                ArrayList pets   = new ArrayList();

                foreach (Mobile m in World.Mobiles.Values)
                {
                    if (m is BaseCreature)
                    {
                        BaseCreature bc = (BaseCreature)m;

                        if ((bc.Controlled && bc.ControlMaster == master) || (bc.Summoned && bc.SummonMaster == master))
                        {
                            pets.Add(bc);
                        }
                    }
                }

                if (pets.Count > 0)
                {
                    CommandLogging.WriteLine(from, "{0} {1} getting all followers of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(master));

                    from.SendMessage("That player has {0} pet{1}.", pets.Count, pets.Count != 1 ? "s" : "");

                    for (int i = 0; i < pets.Count; ++i)
                    {
                        Mobile pet = (Mobile)pets[i];

                        if (pet is IMount)
                        {
                            ((IMount)pet).Rider = null;                             // make sure it's dismounted
                        }
                        pet.MoveToWorld(from.Location, from.Map);
                    }
                }
                else
                {
                    from.SendMessage("There were no pets found for that player.");
                }
            }
            else
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(GetFollowers_OnTarget));
                from.SendMessage("That is not a player. Try again.");
            }
        }
Exemple #27
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;
                    if (from != targ)
                    {
                        from.SendMessage("You may only set your own body to GM style.");
                    }

                    else
                    {
                        m_Mobile = from;

                        CommandLogging.WriteLine(from, "{0} {1} is assuming a GM body", from.AccessLevel, CommandLogging.Format(from));

                        Container pack = from.Backpack;

                        if (pack == null)
                        {
                            pack         = new Backpack();
                            pack.Movable = false;

                            from.AddItem(pack);
                        }

                        from.Hunger = 20;
                        from.Thirst = 20;
                        from.Fame   = 0;
                        from.Karma  = 0;
                        from.Kills  = 0;
                        from.Hidden = true;
                        from.Hits   = from.HitsMax;
                        from.Mana   = from.ManaMax;
                        from.Stam   = from.StamMax;

                        if (from.AccessLevel >= AccessLevel.Counselor)
                        {
                            EquipItem(new StaffRing());
                            Spellbook book1 = new Spellbook((ulong)18446744073709551615);
                            Spellbook book2 = new NecromancerSpellbook((ulong)0xffff);
                            Spellbook book3 = new BookOfChivalry();
                            Spellbook book4 = new BookOfBushido();
                            Spellbook book5 = new BookOfNinjitsu();

                            PackItem(book1);
                            PackItem(book2);
                            PackItem(book3);
                            PackItem(book4);
                            PackItem(book5);
                            PackItem(new PropsStone());
                            PackItem(new TeleportStone());
                            PackItem(new GoStone());
                            PackItem(new GMHidingStone());
                            from.RawStr = 100;
                            from.RawDex = 100;
                            from.RawInt = 100;
                            from.Hits   = from.HitsMax;
                            from.Mana   = from.ManaMax;
                            from.Stam   = from.StamMax;

                            for (int i = 0; i < targ.Skills.Length; ++i)
                            {
                                targ.Skills[i].Base = 120;
                            }
                        }

                        if (from.AccessLevel == AccessLevel.Counselor)
                        {
                            EquipItem(new CounselorRobe());
                            EquipItem(new ThighBoots(3));
                            from.Title = "[Counselor]";
                        }

                        if (from.AccessLevel == AccessLevel.GameMaster)
                        {
                            PackItem(new RemoveStone());
                            EquipItem(new GMRobe());
                            EquipItem(new ThighBoots(39));
                            from.Title = "[GM]";
                        }

                        if (from.AccessLevel == AccessLevel.Seer)
                        {
                            PackItem(new RemoveStone());
                            EquipItem(new SeerRobe());
                            EquipItem(new ThighBoots(467));
                            from.Title = "[Seer]";
                        }

                        if (from.AccessLevel == AccessLevel.Administrator)
                        {
                            PackItem(new RemoveStone());
                            PackItem(new PremiumStone());
                            PackItem(new AdminStone());
                            EquipItem(new AdminRobe());
                            EquipItem(new ThighBoots(1001));
                            from.Title = "[Admin]";
                        }

                        if (from.AccessLevel == AccessLevel.Developer)
                        {
                            PackItem(new RemoveStone());
                            PackItem(new PremiumStone());
                            PackItem(new AdminStone());
                            EquipItem(new AdminRobe());
                            EquipItem(new ThighBoots(1001));
                            from.Title = "[Developer]";
                        }

                        if (from.AccessLevel == AccessLevel.Owner)
                        {
                            PackItem(new RemoveStone());
                            PackItem(new PremiumStone());
                            PackItem(new AdminStone());
                            EquipItem(new AdminRobe());
                            EquipItem(new ThighBoots(1001));
                            from.Title = "[Owner]";
                        }
                    }
                }
            }
Exemple #28
0
                public EquipMenu(Mobile from, Mobile m, ItemListEntry[] entries) : base("Equipment", entries)
                {
                    m_Mobile = m;

                    CommandLogging.WriteLine(from, "{0} {1} viewing equipment of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m));
                }
Exemple #29
0
        public static void Invoke(Mobile from, Point3D start, Point3D end, string[] args, List <Container> packs, bool outline, bool mapAvg)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0} {1} building ", from.AccessLevel, CommandLogging.Format(from));

            if (start == end)
            {
                sb.AppendFormat("at {0} in {1}", start, from.Map);
            }
            else
            {
                sb.AppendFormat("from {0} to {1} in {2}", start, end, from.Map);
            }

            sb.Append(":");

            for (int i = 0; i < args.Length; ++i)
            {
                sb.AppendFormat(" \"{0}\"", args[i]);
            }

            CommandLogging.WriteLine(from, sb.ToString());

            string name = args[0];

            FixArgs(ref args);

            string[,] props = null;

            for (int i = 0; i < args.Length; ++i)
            {
                if (Insensitive.Equals(args[i], "set"))
                {
                    int remains = args.Length - i - 1;

                    if (remains >= 2)
                    {
                        props = new string[remains / 2, 2];

                        remains /= 2;

                        for (int j = 0; j < remains; ++j)
                        {
                            props[j, 0] = args[i + (j * 2) + 1];
                            props[j, 1] = args[i + (j * 2) + 2];
                        }

                        FixSetString(ref args, i);
                    }

                    break;
                }
            }

            Type type = ScriptCompiler.FindTypeByName(name);

            if (!IsEntity(type))
            {
                from.SendMessage("No type with that name was found.");
                return;
            }

            DateTime time = DateTime.UtcNow;

            int built = BuildObjects(from, type, start, end, args, props, packs, outline, mapAvg);

            if (built > 0)
            {
                from.SendMessage("{0} object{1} generated in {2:F1} seconds.", built, built != 1 ? "s" : "", (DateTime.UtcNow - time).TotalSeconds);
            }
            else
            {
                SendUsage(type, from);
            }
        }
Exemple #30
0
 protected override void OnTarget(Mobile from, object target)
 {
     if (target is PlayerMobile)
     {
         if (from != null && target != null && ((PlayerMobile)target).Young)
         {
             from.SendMessage("You have revoked their young status.");
             ((PlayerMobile)target).SendMessage("You may no longer enjoy the benefits of young player status.");
             ((PlayerMobile)target).Young = false;
             CommandLogging.WriteLine(from, "{0} {1} revoked the young status of {2} at {3}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(((PlayerMobile)target)), new Point3D(from.Location));
         }
         else
         {
             from.SendMessage("You must target a young player.");
         }
     }
     else
     {
         from.SendMessage("You must target a young player.");
     }
 }