Пример #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_KeyValue    = reader.ReadUInt();
                m_Open        = reader.ReadBool();
                m_Locked      = reader.ReadBool();
                m_OpenedID    = reader.ReadInt();
                m_ClosedID    = reader.ReadInt();
                m_OpenedSound = reader.ReadInt();
                m_ClosedSound = reader.ReadInt();
                m_Offset      = reader.ReadPoint3D();
                m_Link        = reader.ReadItem() as BaseDestroyableDoor;

                m_Timer = new InternalTimer(this);

                if (m_Open)
                {
                    m_Timer.Start();
                }

                break;
            }
            }
        }
Пример #2
0
 public DestroyableLightWoodGate(DoorFacing facing)
     : base(0x839 + (2 * (int)facing), 0x83A + (2 * (int)facing), 0xEB, 0xF2, BaseDestroyableDoor.GetOffset(facing))
 {
     Name    = "Light Wood Gate";
     Weight  = 1.0;
     HitsMax = 50;
     Hits    = 50;
 }
Пример #3
0
 public DestroyableIronGateShort(DoorFacing facing)
     : base(0x84c + (2 * (int)facing), 0x84d + (2 * (int)facing), 0xEC, 0xF3, BaseDestroyableDoor.GetOffset(facing))
 {
     Name    = "Short Iron Gate";
     Weight  = 1.0;
     HitsMax = 50;
     Hits    = 50;
 }
Пример #4
0
 public DestroyableStrongWoodDoor(DoorFacing facing)
     : base(0x6E5 + (2 * (int)facing), 0x6E6 + (2 * (int)facing), 0xEA, 0xF1, BaseDestroyableDoor.GetOffset(facing))
 {
     Name    = "Strong Wood Door";
     Weight  = 1.0;
     HitsMax = 50;
     Hits    = 50;
 }
Пример #5
0
 public DestroyableMetalDoor2(DoorFacing facing)
     : base(0x6C5 + (2 * (int)facing), 0x6C6 + (2 * (int)facing), 0xEC, 0xF3, BaseDestroyableDoor.GetOffset(facing))
 {
     Name    = "Metal Door";
     Weight  = 1.0;
     HitsMax = 50;
     Hits    = 50;
 }
Пример #6
0
 public DestroyableRattanDoor(DoorFacing facing)
     : base(0x695 + (2 * (int)facing), 0x696 + (2 * (int)facing), 0xEB, 0xF2, BaseDestroyableDoor.GetOffset(facing))
 {
     Name    = "Rattan Door";
     Weight  = 1.0;
     HitsMax = 50;
     Hits    = 50;
 }
Пример #7
0
        private static void ChainLink_OnTarget(Mobile from, object targeted, object state)
        {
            BaseDestroyableDoor door = targeted as BaseDestroyableDoor;

            if (door == null)
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(ChainLink_OnTarget), state);
                from.SendMessage("That is not a door. Try again.");
            }
            else
            {
                List <BaseDestroyableDoor> list = (List <BaseDestroyableDoor>)state;

                if (list.Count > 0 && list[0] == door)
                {
                    if (list.Count >= 2)
                    {
                        for (int i = 0; i < list.Count; ++i)
                        {
                            list[i].Link = list[(i + 1) % list.Count];
                        }

                        from.SendMessage("The chain of doors have been linked.");
                    }
                    else
                    {
                        from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(ChainLink_OnTarget), state);
                        from.SendMessage("You have not yet targeted two unique doors. Target the second door to link.");
                    }
                }
                else if (list.Contains(door))
                {
                    from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(ChainLink_OnTarget), state);
                    from.SendMessage("You have already targeted that door. Target another door, or retarget the first door to complete the chain.");
                }
                else
                {
                    list.Add(door);

                    from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(ChainLink_OnTarget), state);

                    if (list.Count == 1)
                    {
                        from.SendMessage("Target the second door to link.");
                    }
                    else
                    {
                        from.SendMessage("Target another door to link. To complete the chain, retarget the first door.");
                    }
                }
            }
        }
Пример #8
0
        public List <BaseDestroyableDoor> GetChain()
        {
            List <BaseDestroyableDoor> list = new List <BaseDestroyableDoor>();
            BaseDestroyableDoor        c    = this;

            do
            {
                list.Add(c);
                c = c.Link;
            } while (c != null && !list.Contains(c));

            return(list);
        }
Пример #9
0
        private static void Link_OnFirstTarget(Mobile from, object targeted)
        {
            BaseDestroyableDoor door = targeted as BaseDestroyableDoor;

            if (door == null)
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(Link_OnFirstTarget));
                from.SendMessage("That is not a door. Try again.");
            }
            else
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(Link_OnSecondTarget), door);
                from.SendMessage("Target the second door to link.");
            }
        }
Пример #10
0
        private static void Link_OnSecondTarget(Mobile from, object targeted, object state)
        {
            BaseDestroyableDoor first  = (BaseDestroyableDoor)state;
            BaseDestroyableDoor second = targeted as BaseDestroyableDoor;

            if (second == null)
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(Link_OnSecondTarget), first);
                from.SendMessage("That is not a door. Try again.");
            }
            else
            {
                first.Link  = second;
                second.Link = first;
                from.SendMessage("The doors have been linked.");
            }
        }
 public InternalTimer(BaseDestroyableDoor door)
     : base(TimeSpan.FromSeconds(20.0), TimeSpan.FromSeconds(10.0))
 {
     Priority = TimerPriority.OneSecond;
     m_Door = door;
 }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        m_KeyValue = reader.ReadUInt();
                        m_Open = reader.ReadBool();
                        m_Locked = reader.ReadBool();
                        m_OpenedID = reader.ReadInt();
                        m_ClosedID = reader.ReadInt();
                        m_OpenedSound = reader.ReadInt();
                        m_ClosedSound = reader.ReadInt();
                        m_Offset = reader.ReadPoint3D();
                        m_Link = reader.ReadItem() as BaseDestroyableDoor;

                        m_Timer = new InternalTimer(this);

                        if (m_Open)
                            m_Timer.Start();

                        break;
                    }
            }
        }
Пример #13
0
        public virtual void Use(Mobile from)
        {
            if (m_Locked && !m_Open && UseLocks())
            {
                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502502); // That is locked, but you open it with your godly powers.
                    //from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, 502502, "", "" ) ); // That is locked, but you open it with your godly powers.
                }
                else if (Key.ContainsKey(from.Backpack, this.KeyValue))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501282); // You quickly unlock, open, and relock the door
                }
                else if (IsInside(from))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501280); // That is locked, but is usable from the inside.
                }
                else
                {
                    if (Hue == 0x44E && Map == Map.Malas)           // doom door into healer room in doom
                    {
                        this.SendLocalizedMessageTo(from, 1060014); // Only the dead may pass.
                    }
                    else
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502503); // That is locked.
                    }
                    return;
                }
            }

            if (m_Open && !IsFreeToClose())
            {
                return;
            }

            if (m_Open)
            {
                OnClosed(from);
            }
            else
            {
                OnOpened(from);
            }

            if (UseChainedFunctionality)
            {
                bool open = !m_Open;

                List <BaseDestroyableDoor> list = GetChain();

                for (int i = 0; i < list.Count; ++i)
                {
                    list[i].Open = open;
                }
            }
            else
            {
                Open = !m_Open;

                BaseDestroyableDoor link = this.Link;

                if (m_Open && link != null && !link.Open)
                {
                    link.Open = true;
                }
            }
        }
Пример #14
0
 public InternalTimer(BaseDestroyableDoor door)
     : base(TimeSpan.FromSeconds(20.0), TimeSpan.FromSeconds(10.0))
 {
     Priority = TimerPriority.OneSecond;
     m_Door   = door;
 }
Пример #15
0
 public DestroyableBarredMetalDoor2(DoorFacing facing)
     : base(0x1FED + (2 * (int)facing), 0x1FEE + (2 * (int)facing), 0xEC, 0xF3, BaseDestroyableDoor.GetOffset(facing))
 {
     Name    = "Barred Metal Door";
     Weight  = 1.0;
     HitsMax = 50;
     Hits    = 50;
 }