Exemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadEncodedInt();

            m_Sender = reader.ReadItem <BroadcastCrystal>();
        }
Exemplo n.º 2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            /*int version = */ reader.ReadEncodedInt();

            m_Sender = (BroadcastCrystal)reader.ReadItem();
        }
Exemplo n.º 3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            m_Charges   = reader.ReadEncodedInt();
            m_Receivers = reader.ReadItemList();
            m_Sender    = (BroadcastCrystal)reader.ReadItem();
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            #region genova: support to mono
#if MONO
            m_Sender = reader.ReadItemG <BroadcastCrystal>();
#else
            m_Sender = reader.ReadItem <BroadcastCrystal>();
#endif
            #endregion
        }
Exemplo n.º 5
0
        public void TransmitMessage(Mobile from, string message, BroadcastCrystal receiver)
        {
            if (!receiver.Active)
            {
                return;
            }

            string text = String.Format("{0} says {1}", from.Name, message);

            if (receiver.RootParent is Mobile)
            {
                //((Mobile)receiver.RootParent).SendMessage( 0x2B2, "Crystal: " + text );
                ((Mobile)receiver.RootParent).SendAsciiMessage(0x2B2, "Crystal: " + text);
            }
            else if (receiver.RootParent is Item)
            {
                ((Item)receiver.RootParent).PublicOverheadMessage(MessageType.Regular, 0x2B2, true, "Crystal: " + text);
            }
            else
            {
                PublicOverheadMessage(MessageType.Regular, 0x2B2, true, text);
            }
        }
Exemplo n.º 6
0
 public InternalTarget(BroadcastCrystal crystal) : base(2, false, TargetFlags.None)
 {
     m_Crystal = crystal;
 }
Exemplo n.º 7
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadEncodedInt();

			m_Sender = reader.ReadItem<BroadcastCrystal>();
		}
Exemplo n.º 8
0
			public InternalTarget( BroadcastCrystal crystal ) : base( 2, false, TargetFlags.None )
			{
				m_Crystal = crystal;
			}
Exemplo n.º 9
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            /*int version = */
            reader.ReadEncodedInt();

            m_Sender = (BroadcastCrystal) reader.ReadItem();
        }
Exemplo n.º 10
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!m_Crystal.IsAccessibleTo(from))
                {
                    return;
                }

                if (from.Map != m_Crystal.Map || !from.InRange(m_Crystal.GetWorldLocation(), 2))
                {
                    //from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
                    int OldHue = from.SpeechHue;
                    from.SpeechHue = 0;
                    from.SayTo(from, true, "I can't reach that.");
                    from.SpeechHue = OldHue;
                    return;
                }

                if (targeted == m_Crystal)
                {
                    if (m_Crystal.Active)
                    {
                        m_Crystal.Active = false;
                        //from.SendLocalizedMessage( 500672 ); // You turn the crystal off.
                        from.SendAsciiMessage("You turn the crystal off.");
                    }
                    else
                    {
                        if (m_Crystal.Charges > 0)
                        {
                            m_Crystal.Active = true;
                            //from.SendLocalizedMessage( 500673 ); // You turn the crystal on.
                            from.SendAsciiMessage("You turn the crystal on.");
                        }
                        else
                        {
                            //from.SendLocalizedMessage( 500676 ); // This crystal is out of charges.
                            from.SendAsciiMessage("This crystal is out of charges");
                        }
                    }
                }
                else if (targeted is BroadcastCrystal)
                {
                    BroadcastCrystal receiver = (BroadcastCrystal)targeted;

                    if (m_Crystal.Receivers.Count >= 10)
                    {
                        //from.SendLocalizedMessage( 1010042 ); // This broadcast crystal is already linked to 10 receivers.
                        from.SendAsciiMessage("This broadcast crystal is already linked to 10 receivers");
                    }

                    /*else if ( receiver.Sender == m_Crystal )
                     * {
                     *      from.SendLocalizedMessage( 500674 ); // This crystal is already linked with that crystal.
                     * }*/
                    else if (receiver.Sender != null)
                    {
                        receiver.Sender = null;
                        //from.SendLocalizedMessage( 1010044 ); // You unlink the receiver crystal.
                        from.SendAsciiMessage("That crystal has been unlinked to this crystal.");
                    }
                    else
                    {
                        receiver.Sender = m_Crystal;
                        //from.SendLocalizedMessage( 500675 ); // That crystal has been linked to this crystal.
                        from.SendAsciiMessage("That crystal has been linked to this crystal.");
                    }
                }
                else if (targeted == from)
                {
                    foreach (BroadcastCrystal receiver in new ArrayList(m_Crystal.Receivers))
                    {
                        receiver.Sender = null;
                    }

                    //from.SendLocalizedMessage( 1010046 ); // You unlink the broadcast crystal from all of its receivers.
                    from.SendAsciiMessage("You unlink all of the crystals.");
                }
                else
                {
                    Item targItem = targeted as Item;

                    if (targItem != null && targItem.VerifyMove(from))
                    {
                        CrystalRechargeInfo info = CrystalRechargeInfo.Get(targItem.GetType());

                        if (info != null)
                        {
                            if (m_Crystal.Charges >= MaxCharges)
                            {
                                //from.SendLocalizedMessage( 500678 ); // This crystal is already fully charged.
                                from.SendAsciiMessage("This crystal is already fully charged.");
                            }
                            else
                            {
                                targItem.Consume();

                                if (m_Crystal.Charges + info.Amount >= MaxCharges)
                                {
                                    m_Crystal.Charges = MaxCharges;
                                    //from.SendLocalizedMessage( 500679 ); // You completely recharge the crystal.
                                    from.SendAsciiMessage("You completely recharge the crystal.");
                                }
                                else
                                {
                                    m_Crystal.Charges += info.Amount;
                                    //from.SendLocalizedMessage( 500680 ); // You recharge the crystal.
                                    from.SendAsciiMessage("You recharge the crystal.");
                                }
                            }

                            return;
                        }
                    }

                    //from.SendLocalizedMessage( 500681 ); // You cannot use this crystal on that.
                    from.SendAsciiMessage("You cannot use this crystal on that.");
                }
            }
Exemplo n.º 11
0
        public void TransmitMessage( Mobile from, string message, BroadcastCrystal receiver )
        {
            if ( !receiver.Active )
                return;

            string text = String.Format( "{0} says {1}", from.Name, message );

            if ( receiver.RootParent is Mobile )
            {
                //((Mobile)receiver.RootParent).SendMessage( 0x2B2, "Crystal: " + text );
                ((Mobile)receiver.RootParent).SendAsciiMessage( 0x2B2, "Crystal: " + text );
            }
            else if ( receiver.RootParent is Item )
            {
                 ((Item)receiver.RootParent).PublicOverheadMessage( MessageType.Regular, 0x2B2, true, "Crystal: " + text );
            }
            else
            {
                PublicOverheadMessage( MessageType.Regular, 0x2B2, true, text );
            }
        }
Exemplo n.º 12
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadEncodedInt();

            m_Charges = reader.ReadEncodedInt();
            m_Receivers = reader.ReadItemList();
            m_Sender = (BroadcastCrystal) reader.ReadItem();
        }