Server.Items.CrystalRechargeInfo.Get C# (CSharp) Méthode

Get() public static méthode

public static Get ( Type type ) : CrystalRechargeInfo
type System.Type
Résultat CrystalRechargeInfo
		public static CrystalRechargeInfo Get( Type type )
		{
			foreach ( CrystalRechargeInfo info in Table )
			{
				if ( info.Type == type )
					return info;
			}

			return null;
		}

Usage Example

            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.
                    }
                    else
                    {
                        m_Crystal.Active = true;
                        from.SendLocalizedMessage(500673);                           // You turn the crystal on.
                    }
                }
                else if (targeted == from)
                {
                    if (m_Crystal.Sender != null)
                    {
                        m_Crystal.Sender = null;
                        from.SendLocalizedMessage(1010044);                           // You unlink the receiver crystal.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1010045);                           // That receiver crystal is not linked.
                    }
                }
                else
                {
                    Item targItem = targeted as Item;

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

                        if (info != null)
                        {
                            from.SendLocalizedMessage(500677);                               // This crystal cannot be recharged.
                            return;
                        }
                    }

                    from.SendLocalizedMessage(1010045);                       // That receiver crystal is not linked.
                }
            }
All Usage Examples Of Server.Items.CrystalRechargeInfo::Get
CrystalRechargeInfo