Beispiel #1
0
        private static void ChainLinkPortcullis_OnTarget(Mobile from, object targeted, object state)
        {
            PortcullisS door = targeted as PortcullisS;

            if (door == null)
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(ChainLinkPortcullis_OnTarget), state);
                from.SendMessage("That is not a portcullis. Try again.");
            }
            else
            {
                List <PortcullisS> list = (List <PortcullisS>)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 portcullis have been linked.");
                    }
                    else
                    {
                        from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(ChainLinkPortcullis_OnTarget), state);
                        from.SendMessage("You have not yet targeted two unique portcullis. Target the second portcullis to link.");
                    }
                }
                else if (list.Contains(door))
                {
                    from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(ChainLinkPortcullis_OnTarget), state);
                    from.SendMessage("You have already targeted that portcullis. Target another portcullis, or retarget the first portcullis to complete the chain.");
                }
                else
                {
                    list.Add(door);

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

                    if (list.Count == 1)
                    {
                        from.SendMessage("Target the second portcullis to link.");
                    }
                    else
                    {
                        from.SendMessage("Target another portcullis to link. To complete the chain, retarget the first portcullis.");
                    }
                }
            }
        }
Beispiel #2
0
        public List <PortcullisS> GetChain()
        {
            List <PortcullisS> list = new List <PortcullisS>();
            PortcullisS        c    = this;

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

            return(list);
        }
Beispiel #3
0
        private static void Link_OnFirstTarget(Mobile from, object targeted)
        {
            PortcullisS door = targeted as PortcullisS;

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

            if (second == null)
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(Link_OnSecondTarget), first);
                from.SendMessage("That is not a portcullis. Try again.");
            }
            else
            {
                first.Link  = second;
                second.Link = first;
                from.SendMessage("The portcullis have been linked.");
            }
        }
Beispiel #5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_Link        = reader.ReadItem() as PortcullisS;
            m_AutoClose   = reader.ReadBool();
            m_Open        = reader.ReadBool();
            m_Locked      = reader.ReadBool();
            m_KeyValue    = reader.ReadUInt();
            m_BaseZ       = reader.ReadInt();
            m_RaiseAmount = reader.ReadInt();

            m_SoundID1 = reader.ReadInt();
            m_SoundID2 = reader.ReadInt();

            this.m_CloseTimer = new CloseTimer(this);

            if (this.m_Open)
            {
                this.m_CloseTimer.Start();
            }
        }
Beispiel #6
0
 public CloseTimer(PortcullisS portcullis)
     : base(TimeSpan.FromSeconds(5.0))
 {
     this.Priority     = TimerPriority.OneSecond;
     this.m_Portcullis = portcullis;
 }
Beispiel #7
0
            public PortcullisOpenTimer(PortcullisS portcullisNS) : base(TimeSpan.FromSeconds(0.30))
            {
                Priority = TimerPriority.FiftyMS;

                m_PortcullisS = portcullisNS;
            }