Example #1
0
            private static void ConvertTileBox_Callback(Mobile from, Map map, Point3D start, Point3D end, object state)
            {
                Rectangle2D rect     = new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1);
                ArrayList   toDelete = new ArrayList();

                int staticTotal   = 0;
                int nostaticTotal = 0;

                foreach (object item in map.GetObjectsInBounds(rect))
                {
                    if (item is Static && !(item is BreakableTile))
                    {
                        Static oldtile = ( Static )item;

                        BreakableTile tile = new BreakableTile(oldtile.ItemID);
                        tile.Hue  = oldtile.Hue;
                        tile.Name = oldtile.Name;

                        tile.MoveToWorld(oldtile.Location, oldtile.Map);
                        toDelete.Add(oldtile);

                        staticTotal++;
                    }
                    else if (item is Item)
                    {
                        nostaticTotal++;
                    }
                }

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

                from.SendMessage("There were {0} total items found. {0} items were converted.", nostaticTotal + staticTotal, staticTotal);
            }