Example #1
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));
                        }
                    }
                }
            }
Example #2
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);
            }
Example #3
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));

                        string prefix = Server.Commands.CommandSystem.Prefix;
                        CommandSystem.Handle(from, String.Format("{0}AutoSpeedBooster true", prefix));

                        Container pack = from.Backpack;

                        List <Item> ItemsToDelete = new List <Item>();

                        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.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);

                            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 = 100;
                            }
                        }

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

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

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

                        if (from.AccessLevel >= AccessLevel.Administrator)
                        {
                            PackItem(new StaffOrb());
                            EquipItem(new ThighBoots(1001));
                            EquipItem(new AdminRobe());
                        }

                        if (from.AccessLevel == AccessLevel.Administrator)
                        {
                            from.Title = "[Admin]";
                        }

                        if (from.AccessLevel == AccessLevel.Developer)
                        {
                            from.Title = "[Developer]";
                        }

                        if (from.AccessLevel == AccessLevel.Owner)
                        {
                            from.Title = "[Owner]";
                        }
                    }
                }
            }
Example #4
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.Get("Staff.Staffbody", true))
                        {
                            m_Mobile.BodyValue = 987;

                            if (Config.Get("Staff.UseColoring", true))
                            {
                                switch (m_Mobile.AccessLevel)
                                {
                                case AccessLevel.Owner: m_Mobile.Hue = Config.Get("Staff.Owner", 1001); break;

                                case AccessLevel.Developer: m_Mobile.Hue = Config.Get("Staff.Developer", 1001); break;

                                case AccessLevel.Administrator: m_Mobile.Hue = Config.Get("Staff.Administrator", 1001); break;

                                case AccessLevel.Seer: m_Mobile.Hue = Config.Get("Staff.Seer", 467); break;

                                case AccessLevel.GameMaster: m_Mobile.Hue = Config.Get("Staff.GameMaster", 39); break;

                                case AccessLevel.Counselor: m_Mobile.Hue = Config.Get("Staff.Counselor", 3); break;
                                }
                            }
                        }

                        if (Config.Get("Staff.CutHair", true))
                        {
                            m_Mobile.HairItemID = 0;
                        }

                        if (Config.Get("Staff.CutFacialHair", true))
                        {
                            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 StaffRing());

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

                            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.Get("Staff.GiveBoots", true))
                        {
                            int color = 0;
                            if (Config.Get("Staff.UseColoring", true))
                            {
                                switch (m_Mobile.AccessLevel)
                                {
                                case AccessLevel.Owner: color = Config.Get("Staff.Owner", 1001); break;

                                case AccessLevel.Developer: color = Config.Get("Staff.Developer", 1001); break;

                                case AccessLevel.Administrator: color = Config.Get("Staff.Administrator", 1001); break;

                                case AccessLevel.Seer: color = Config.Get("Staff.Seer", 467); break;

                                case AccessLevel.GameMaster: color = Config.Get("Staff.GameMaster", 39); break;

                                case AccessLevel.Counselor: color = Config.Get("Staff.Counselor", 3); 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));
                            }
                        }
                    }
                }
            }
Example #5
0
        public static int Build(Mobile from, Point3D start, Point3D end, ConstructorInfo ctor, object[] values, string[,] props, PropertyInfo[] realProps, List <Container> packs, bool outline, bool mapAvg)
        {
            try
            {
                Map map = from.Map;

                int width  = end.X - start.X + 1;
                int height = end.Y - start.Y + 1;

                if (outline && (width < 3 || height < 3))
                {
                    outline = false;
                }

                int objectCount;

                if (packs != null)
                {
                    objectCount = packs.Count;
                }
                else if (outline)
                {
                    objectCount = (width + height - 2) * 2;
                }
                else
                {
                    objectCount = width * height;
                }

                if (objectCount >= 20)
                {
                    from.SendMessage("Constructing {0} objects, please wait.", objectCount);
                }

                bool sendError = true;

                StringBuilder sb = new StringBuilder();
                sb.Append("Serials: ");

                if (packs != null)
                {
                    for (int i = 0; i < packs.Count; ++i)
                    {
                        IEntity built = Build(from, ctor, values, props, realProps, ref sendError);

                        sb.AppendFormat("0x{0:X}; ", built.Serial.Value);

                        if (built is Item)
                        {
                            Container pack = packs[i];
                            pack.DropItem((Item)built);
                        }
                        else if (built is Mobile)
                        {
                            Mobile m = (Mobile)built;
                            m.MoveToWorld(new Point3D(start.X, start.Y, start.Z), map);
                        }
                    }
                }
                else
                {
                    int z = start.Z;

                    for (int x = start.X; x <= end.X; ++x)
                    {
                        for (int y = start.Y; y <= end.Y; ++y)
                        {
                            if (outline && x != start.X && x != end.X && y != start.Y && y != end.Y)
                            {
                                continue;
                            }

                            if (mapAvg)
                            {
                                z = map.GetAverageZ(x, y);
                            }

                            IEntity built = Build(from, ctor, values, props, realProps, ref sendError);

                            sb.AppendFormat("0x{0:X}; ", built.Serial.Value);

                            if (built is Item)
                            {
                                Item item = (Item)built;
                                item.MoveToWorld(new Point3D(x, y, z), map);
                            }
                            else if (built is Mobile)
                            {
                                Mobile m = (Mobile)built;
                                m.MoveToWorld(new Point3D(x, y, z), map);
                            }
                        }
                    }
                }

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

                return(objectCount);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(0);
            }
        }
Example #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.");
                    }
                }
            }
Example #7
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));
                    }
                }
            }
Example #8
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);
                }
            }
Example #9
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));
                }
            }
Example #10
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.");
        }
Example #11
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);
                }
            }
        }
Example #12
0
        public static int Build(Mobile from, Point3D start, Point3D end, ConstructorInfo ctor, object[] values, string[,] props, PropertyInfo[] realProps, List <Container> packs)
        {
            try
            {
                Map map = from.Map;

                int objectCount = (packs == null ? (((end.X - start.X) + 1) * ((end.Y - start.Y) + 1)) : packs.Count);

                if (objectCount >= 20)
                {
                    from.SendMessage("Constructing {0} objects, please wait.", objectCount);
                }

                bool sendError = true;

                StringBuilder sb = new StringBuilder();
                sb.Append("Serials: ");

                if (packs != null)
                {
                    for (int i = 0; i < packs.Count; ++i)
                    {
                        IEntity built = Build(from, ctor, values, props, realProps, ref sendError);

                        sb.AppendFormat("0x{0:X}; ", built.Serial.Value);

                        if (built is Item)
                        {
                            Container pack = packs[i];
                            pack.DropItem((Item)built);
                        }
                        else if (built is Mobile)
                        {
                            Mobile m = (Mobile)built;
                            m.MoveToWorld(new Point3D(start.X, start.Y, start.Z), map);
                        }
                    }
                }
                else
                {
                    for (int x = start.X; x <= end.X; ++x)
                    {
                        for (int y = start.Y; y <= end.Y; ++y)
                        {
                            IEntity built = Build(from, ctor, values, props, realProps, ref sendError);

                            sb.AppendFormat("0x{0:X}; ", built.Serial.Value);

                            if (built is Item)
                            {
                                Item item = (Item)built;
                                item.MoveToWorld(new Point3D(x, y, start.Z), map);
                            }
                            else if (built is Mobile)
                            {
                                Mobile m = (Mobile)built;
                                m.MoveToWorld(new Point3D(x, y, start.Z), map);
                            }
                        }
                    }
                }

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

                return(objectCount);
            }
            catch (Exception ex)
            {
                Misc.ExceptionLogging.WriteLine(ex);
                return(0);
            }
        }
Example #13
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);
            }
        }
Example #14
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)
                {
                    pack = copy.Parent switch
                    {
                        Container cont => cont,
                        Mobile m => m.Backpack,
                                  _ => pack
                    };
                }
                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);

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

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

                                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.");
                }
            }
Example #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));
     }
 }
Example #16
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());
                            PackItem(new SpeedStone());
                            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]";
                        }
                    }
                }
            }
Example #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();
        }
Example #18
0
 public static void egate_OnCommand(CommandEventArgs e)
 {
     CommandLogging.WriteLine(e.Mobile, " accessed the egate gump.");
     e.Mobile.CloseGump(typeof(egategump));
     e.Mobile.SendGump(new egategump());
 }
Example #19
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;
                        }
                    }
                }
            }
Example #20
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.");
                }
            }
Example #21
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;

                    NetState state = targ.NetState;

                    if (state != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targeted));

                        try
                        {
                            Firewall.Add(((IPEndPoint)state.Socket.RemoteEndPoint).Address);
                        }
                        catch
                        {
                        }
                    }
                }
            }
Example #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.");
            }
        }
Example #23
0
            protected override void OnTarget(Mobile from, object targ)
            {
                IPoint3D center = targ as IPoint3D;

                if (center != null)
                {
                    Point3D p = new Point3D(center);
                    m_Location = (p.X.ToString() + ", " + p.Y.ToString());

                    Map map = from.Map;

                    if (map != null)
                    {
                        for (int x = -3; x <= 3; ++x)
                        {
                            for (int y = -3; y <= 3; ++y)
                            {
                                double dist = Math.Sqrt(x * x + y * y);

                                if (dist <= 12)
                                {
                                    new GoodiesTimer(map, p.X + x, p.Y + y, m_Amount).Start();
                                }
                            }
                        }
                    }
                }
                CommandLogging.WriteLine(from, "{0} {1} splashed {2} gold at {3} )", from.AccessLevel, CommandLogging.Format(from), m_Amount, m_Location);
            }
Example #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, DeleteList_Callback, list));
            }
            else
            {
                e.Mobile.SendMessage("There were no objects found to delete.");
            }
        }
Example #25
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.Now;

            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.Now - time).TotalSeconds);
            }
            else
            {
                SendUsage(type, from);
            }
        }
Example #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, GetFollowers_OnTarget);
                from.SendMessage("That is not a player. Try again.");
            }
        }
Example #27
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 = 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;
                }

                ConstructorInfo c = ActivatorUtil.GetConstructor(copy.GetType());

                if (c != null)
                {
                    var      paramList = c.GetParameters();
                    object[] 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 (int i = 0; i < m_Amount; i++)
                        {
                            if (c.Invoke(args) is Item newItem)
                            {
                                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.");
                }
            }
Example #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));
                }
Example #29
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();
            }
        }
Example #30
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");
                }
            }