private void DeleteTreasureChest(object treasurechest)
        {
            BaseContainer container = (BaseContainer)treasurechest;
            Map           map       = container.Map;
            Container     c         = treasurechest as Container;

            if (container != null || !container.Deleted)
            {
                Effects.SendLocationEffect(container.Location, container.Map, 0x3728, 10, 10);
                Effects.PlaySound(container.Location, container.Map, 0x1FC);

                container.Delete();
            }
        }
        private void DeleteDeadBody(object deadbody)
        {
            BaseContainer container = (BaseContainer)deadbody;
            Map           map       = container.Map;
            Container     c         = deadbody as Container;

            if (container != null || !container.Deleted)
            {
                Effects.SendLocationEffect(container.Location, container.Map, 0x3728, 10, 10);
                Effects.PlaySound(container.Location, container.Map, 0x1FC);

                container.Delete();
            }
        }
Exemplo n.º 3
0
        public static void DeleteChar_WarningGumpCallback(Mobile from, bool okay, object state)
        {
            Mobile           mob       = (Mobile)state;
            NetState         ns        = mob.NetState;
            List <BaseHouse> houselist = BaseHouse.GetHouses(mob);
            List <Mobile>    mobs      = new List <Mobile>();

            int mobCount, houseCount;
            int itemCount = 0;

            if (!okay)
            {
                return;
            }

            CommandLogging.WriteLine(from, "{0} {1} deleting character {2}.", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(mob));

            foreach (Mobile m in World.Mobiles.Values)
            {
                if (m is BaseCreature)
                {
                    BaseCreature bc = (BaseCreature)m;
                    if ((bc.Controlled && bc.ControlMaster == mob) || (bc.Summoned && bc.SummonMaster == mob))
                    {
                        mobs.Add(bc);
                    }
                }
                else if (m is PlayerVendor)
                {
                    PlayerVendor pv = (PlayerVendor)m;
                    if (pv.Owner == mob)
                    {
                        mobs.Add(pv);
                    }
                }
            }

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

            houseCount = houselist.Count;
            for (int j = 0; j < houselist.Count; ++j)
            {
                BaseHouse house = (BaseHouse)houselist[j];

                List <Item> itemlist = house.GetItems();

                for (int k = 0; k < itemlist.Count; ++k)
                {
                    Item item = (Item)itemlist[k];

                    if (item.IsLockedDown)
                    {
                        itemCount++;
                        item.Delete();
                    }
                    else if (item.IsSecure && item is BaseContainer)
                    {
                        BaseContainer con = (BaseContainer)itemlist[k];
                        itemCount += con.GetTotal(TotalType.Items) + 1; // +1 is the container itself
                        con.Delete();
                    }
                }
                itemlist.Clear();

                house.Delete();
            }
            houselist.Clear();

            from.SendMessage("{0} pet{3} and playervendor{3} and {1} house{4} with {2} item{5} inside deleted.", mobCount, houseCount, itemCount, mobCount != 1 ? "s" : "", houseCount != 1 ? "s" : "", itemCount != 1 ? "s" : "");
            mob.Say("I've been deleted!");

            if (ns != null)
            {
                ns.Dispose();
            }

            mob.Delete();

            from.SendMessage("Character has been disposed of thoughtfully.");
        }