Ejemplo n.º 1
0
        public virtual void UnconvertDoors()
        {
            if (m_House == null)
            {
                return;
            }

            BaseDoor newdoor = null;

            foreach (BaseDoor door in new ArrayList(m_House.Doors))
            {
                door.Open = false;

                Type type = typeof(StrongWoodDoor);

                for (int i = 0; i < AddDoorGump.m_Types.Length; i++)
                {
                    DoorInfo di = AddDoorGump.m_Types[i];
                    if (di.BaseID == door.ClosedID || di.BaseID + 2 == door.ClosedID || di.BaseID + 8 == door.ClosedID || di.BaseID + 10 == door.ClosedID)
                    {
                        type = di.Type;
                    }
                }

                newdoor = Activator.CreateInstance(type, new object[] { DoorFacing.WestCW }) as BaseDoor;
                //newdoor = new StrongWoodDoor( (DoorFacing)0 );
                newdoor.ItemID      = door.ItemID;
                newdoor.ClosedID    = door.ClosedID;
                newdoor.OpenedID    = door.OpenedID;
                newdoor.OpenedSound = door.OpenedSound;
                newdoor.ClosedSound = door.ClosedSound;
                newdoor.Offset      = door.Offset;
                newdoor.Location    = door.Location;
                newdoor.Map         = door.Map;

                door.Delete();

                if (m_Relock)
                {
                    newdoor.Locked = true;
                }

                foreach (Item inneritem in newdoor.GetItemsInRange(1))
                {
                    if (inneritem is BaseDoor && inneritem != newdoor && inneritem.Z == newdoor.Z)
                    {
                        ((BaseDoor)inneritem).Link = newdoor;
                        newdoor.Link = (BaseDoor)inneritem;
                    }
                }

                m_House.Doors.Remove(door);
            }
        }