Ejemplo n.º 1
0
        public static MedKitContext GetContext(Mobile healer)
        {
            MedKitContext bc = null;

            m_Table.TryGetValue(healer, out bc);
            return(bc);
        }
Ejemplo n.º 2
0
        public static MedKitContext BeginHeal(Mobile healer, Mobile patient)
        {
            bool isDeadPet = (patient is BaseCreature && ((BaseCreature)patient).IsDeadPet);

            if (patient is Golem)
            {
                healer.SendLocalizedMessage(500970);                   // MedKits cannot be used on that.
            }
            else if (patient is BaseCreature && ((BaseCreature)patient).IsAnimatedDead)
            {
                healer.SendLocalizedMessage(500951);                   // You cannot heal that.
            }
            else if (patient.Poisoned || BleedAttack.IsBleeding(patient))
            {
                healer.SendMessage("You cannot do that right now.");
            }
            else if (!patient.Alive)
            {
                healer.SendMessage("It's too late for them.");
            }
            else if (healer.CanBeBeneficial(patient, true, true))
            {
                healer.DoBeneficial(patient);

                bool onSelf = (healer == patient);
                int  dex    = healer.Dex;

                double seconds  = 10;
                double resDelay = (patient.Alive ? 0.0 : 5.0);

                MedKitContext context = GetContext(healer);

                if (context != null)
                {
                    context.StopHeal();
                }

                seconds *= 1000;

                context = new MedKitContext(healer, patient, TimeSpan.FromMilliseconds(seconds));

                m_Table[healer] = context;

                if (!onSelf)
                {
                    patient.SendLocalizedMessage(1008078, false, healer.Name);                       //  : Attempting to heal you.
                }
                healer.SendMessage("You begin working on the patient...");
                return(context);
            }

            return(null);
        }
Ejemplo n.º 3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_MedKit.Deleted)
                {
                    return;
                }

                if (targeted is PlayerMobile && ((PlayerMobile)targeted).Undead)
                {
                    if (from == targeted)
                    {
                        from.SendMessage("You have no need for the healing techniques of mortals.");
                    }
                    else
                    {
                        from.SendLocalizedMessage(500970);                           // MedKits can not be used on that.
                    }
                    return;
                }

                if (targeted is Mobile && targeted is PlayerMobile)
                {
                    if (from.InRange(m_MedKit.GetWorldLocation(), MedKit.Range))
                    {
                        if (MedKitContext.BeginHeal(from, (Mobile)targeted) != null)
                        {
                            m_MedKit.Consume();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500295);                           // You are too far away to do that.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500970);                       // MedKits can not be used on that.
                }
            }
Ejemplo n.º 4
0
 public InternalTimer(MedKitContext context, TimeSpan delay) : base(delay)
 {
     m_Context = context;
     Priority  = TimerPriority.FiftyMS;
 }
Ejemplo n.º 5
0
 public InternalTimer( MedKitContext context, TimeSpan delay )
     : base(delay)
 {
     m_Context = context;
     Priority = TimerPriority.FiftyMS;
 }
Ejemplo n.º 6
0
        public static MedKitContext BeginHeal( Mobile healer, Mobile patient )
        {
            bool isDeadPet = ( patient is BaseCreature && ((BaseCreature)patient).IsDeadPet );

            if ( patient is Golem )
            {
                healer.SendLocalizedMessage( 500970 ); // MedKits cannot be used on that.
            }
            else if ( patient is BaseCreature && ((BaseCreature)patient).IsAnimatedDead )
            {
                healer.SendLocalizedMessage( 500951 ); // You cannot heal that.
            }
            else if ( patient.Poisoned || BleedAttack.IsBleeding( patient ) )
            {
                healer.SendMessage("You cannot do that right now.");
            }
            else if (!patient.Alive)
            {
                healer.SendMessage("It's too late for them.");
            }
            else if (healer.CanBeBeneficial(patient, true, true))
            {
                healer.DoBeneficial( patient );

                bool onSelf = ( healer == patient );
                int dex = healer.Dex;

                double seconds = 10;
                double resDelay = ( patient.Alive ? 0.0 : 5.0 );

                MedKitContext context = GetContext( healer );

                if ( context != null )
                    context.StopHeal();

                seconds *= 1000;

                context = new MedKitContext( healer, patient, TimeSpan.FromMilliseconds( seconds ) );

                m_Table[healer] = context;

                if ( !onSelf )
                    patient.SendLocalizedMessage( 1008078, false, healer.Name ); //  : Attempting to heal you.

                healer.SendMessage("You begin working on the patient...");
                return context;
            }

            return null;
        }