ResurrectPet() public method

public ResurrectPet ( ) : void
return void
Beispiel #1
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            if (!m.Frozen && DateTime.Now >= m_NextResurrect && InRange(m, 4) && !InRange(oldLocation, 4) && InLOS(m))
            {
                if (m.IsDeadBondedPet)
                {
                    m_NextResurrect = DateTime.Now + ResurrectDelay;

                    if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false))
                    {
                        Say("I sense a spirt of an animal...somewhere.");
                    }
                    else
                    {
                        BaseCreature bc = m as BaseCreature;

                        bc.PlaySound(0x214);
                        bc.FixedEffect(0x376A, 10, 16);

                        bc.ResurrectPet();

                        Say("Rise my friend. I wish I could save every unfortunate animal.");
                    }
                }
            }
        }
Beispiel #2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            from.Frozen = false;

            switch (info.ButtonID)
            {
            case -1:
            {
                // You decide against paying the Veterinarian, and the ghost of your pet looks at you sadly...
                from.SendLocalizedMessage(1113197);

                break;
            }

            case 1:
            {
                for (int i = 0; i < m_Pets.Length; i++)
                {
                    BaseCreature pet = m_Pets[i];

                    if (info.IsSwitched(i))
                    {
                        int fee = Veterinarian.GetResurrectionFee(pet);

                        if (!pet.IsDeadBondedPet)
                        {
                            from.SendLocalizedMessage(501041);         // Target is not dead.
                        }
                        else if (!from.CanSee(pet) || !from.InLOS(pet))
                        {
                            from.SendLocalizedMessage(503376);         // Target cannot be seen.
                        }
                        else if (!from.InRange(pet, 12))
                        {
                            from.SendLocalizedMessage(500643);         // Target is too far away.
                        }
                        else if (pet.ControlMaster != from)
                        {
                            from.SendLocalizedMessage(1113200);         // You must be the owner of that pet to have it resurrected.
                        }
                        else if (pet.Corpse != null && !pet.Corpse.Deleted)
                        {
                            from.SendLocalizedMessage(1113279);         // That creature's spirit lacks cohesion. Try again in a few minutes.
                        }
                        else if (Banker.Withdraw(from, fee))
                        {
                            pet.PlaySound(0x214);
                            pet.ResurrectPet();

                            for (int j = 0; j < pet.Skills.Length; ++j)         // Decrease all skills on pet.
                            {
                                pet.Skills[j].Base -= 0.2;
                            }

                            if (pet.Map == Map.Internal)
                            {
                                pet.MoveToWorld(from.Location, from.Map);
                            }

                            from.SendLocalizedMessage(1060398, fee.ToString());                           // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString(), 0x16); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);         // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                        }
                        break;
                    }
                }

                break;
            }
            }
        }
Beispiel #3
0
        private void Flare()
        {
            Mobile caster = this.ControlMaster;

            if (caster == null)
            {
                caster = this.SummonMaster;
            }

            if (caster == null)
            {
                return;
            }
            int range         = (int)((caster.Skills.Fletching.Value + caster.Skills.Inscribe.Value + caster.Skills.ArmsLore.Value + caster.Skills.Tinkering.Value) / 100.0);
            int overseerCount = 0;
            int amount        = 0;

            if (!InRange(ControlMaster, 4))
            {
                return;
            }
            ArrayList deadList = new ArrayList();
            ArrayList list     = new ArrayList();
            Spell     spell;

            if ((Hue == 0 || Hue == 2425 || Hue == 2213) && Mana > 40 && Backpack.GetAmount(typeof(RecallRune), false) + Backpack.GetAmount(typeof(Runebook), false) > 0)
            {
                spell = new GateTravelSpell(this, null);
                if (spell != null)
                {
                    spell.Cast();
                }
                return;
            }
            if (Hue == 2419)
            {
                if (ControlOrder == OrderType.Guard)
                {
                    BaseCreature.Summon(new LesserGolem(1, 1, .2), false, this, Location, 0x212, TimeSpan.FromSeconds(120));
                }
                return;
            }

            foreach (Mobile m_patient in this.GetMobilesInRange(range))
            {
                if (m_patient.Alive || ((m_patient is BaseCreature) && ((BaseCreature)m_patient).IsDeadPet))
                {
                    if (m_patient is GolemOverseer)
                    {
                        overseerCount += 1;
                    }
                    else
                    {
                    }
                }
                else
                {
                    deadList.Add(m_patient);
                }
            }
            if (overseerCount > 8)
            {
                overseerCount = 8;
            }
            range += overseerCount;

            foreach (Mobile m_patient in this.GetMobilesInRange(range))
            {
                if (m_patient.Alive && (!(m_patient is BaseCreature) || !((BaseCreature)m_patient).IsDeadPet))
                {
                    list.Add(m_patient);
                }
            }

            amount = (int)((caster.Skills.Inscribe.Value * caster.Skills.Tinkering.Value / 1000.0) * Utility.RandomDouble());

            for (int i = 0; i < list.Count; ++i)
            {
                Mobile m        = (Mobile)list[i];
                bool   friendly = true;

                for (int j = 0; friendly && j < caster.Aggressors.Count; ++j)
                {
                    friendly = (caster.Aggressors[j].Attacker != m);
                }

                for (int j = 0; friendly && j < caster.Aggressed.Count; ++j)
                {
                    friendly = (caster.Aggressed[j].Defender != m);
                }

                if (friendly)
                {
                    if (Hue == 2413 || Hue == 2425)  //Copper || Agapite
                    {
                        m.Mana += (amount);
                        m.Hits += (amount / 4);
                        m.Stam += (amount / 2);
                        if (Hue == 2425)
                        {
                            if (m.MeleeDamageAbsorb <= amount * 2)
                            {
                                m.MeleeDamageAbsorb = amount * 2;
                            }
                        }
                    }
                    else if (Hue == 2406 || Hue == 2219)   //Shadow || Valorite
                    {
                        if (m.MagicDamageAbsorb <= amount * 2)
                        {
                            m.MagicDamageAbsorb = amount * 2;
                        }
                        if (Hue == 2406)
                        {
                            ShadowBonus(m, amount);
                            if (ControlMaster.Hidden)
                            {
                                Hidden = true;
                                AllowedStealthSteps = ControlMaster.AllowedStealthSteps;
                            }
                        }
                    }
                }
                if ((m != caster) && m != this && (SpellHelper.ValidIndirectTarget(this, (Mobile)m) && CanBeHarmful((Mobile)m, false)))
                {
                    if (ControlOrder == OrderType.Guard)
                    {
                        if (Hue == 2413 || Hue == 2425)  //Copper or Agapite
                        {
                            DoHarmful(m);
                            m.Mana -= (amount / 2);
                            m.Hits -= (amount / 4);
                            m.Stam -= (amount / 2);
                            Mana   += (amount / 2);
                            if (InRange(caster, range))
                            {
                                caster.Mana += (amount / 2);
                            }
                        }
                        else if (Hue == 2207)   //Verite
                        {
                            DoHarmful(m);
                            EatArmor(m);
                        }
                        else if (Hue == 2418 || Hue == 2219)  //Bronze || Valorite
                        {
                            DoHarmful(m);
                            ThrowGas(m);
                        }
                    }
                }
            }
            if (Mana >= 50 && caster.Skills.Inscribe.Value >= 80 && overseerCount >= 3 && (Hue == 2425 || Hue == 0 || Hue == 2213))//Agapite or Iron or Gold
            {
                for (int i = 0; i < deadList.Count; ++i)
                {
                    if (DateTime.UtcNow < m_NextRes)
                    {
                        return;
                    }

                    if (ControlMaster == null)
                    {
                        m_NextRes = DateTime.UtcNow + TimeSpan.FromSeconds(0.5 + 100.0 * Utility.RandomDouble());
                    }
                    else
                    {
                        m_SpeedBonus = (int)((ControlMaster.Skills.Carpentry.Value + ControlMaster.Skills.Blacksmith.Value) * 4 / 280);
                        m_NextRes    = DateTime.UtcNow + TimeSpan.FromSeconds(0.5 + (8.0 - m_SpeedBonus) * Utility.RandomDouble());//0.5-8.0 (0.5-5.35) (0.5-4.5 with hammer)
                    }

                    int patientNumber = -1;
                    if (Mana >= 50)
                    {
                        Mobile       m_Patient  = (Mobile)deadList[i];
                        BaseCreature petPatient = m_Patient as BaseCreature;
                        if (this == null || !this.Alive || ((BaseCreature)this).IsDeadPet)
                        {
                            patientNumber = -1;
                        }
                        else if (!m_Patient.Alive || (petPatient != null && petPatient.IsDeadPet))
                        {
                            if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_Patient.Location, 16, false, false))
                            {
                                patientNumber = 502391;                         // Thou can not be resurrected there!
                            }
                            else if (m_Patient.Region != null && m_Patient.Region.IsPartOf("Khaldun"))
                            {
                                patientNumber = 502391;                         // Thou can not be resurrected there!
                            }
                            else
                            {
                                Mana         -= 50;
                                patientNumber = -1;

                                m_Patient.PlaySound(0x214);
                                m_Patient.FixedEffect(0x376A, 10, 16);

                                if (petPatient != null && petPatient.IsDeadPet)
                                {
                                    Mobile master = petPatient.ControlMaster;
                                    if (master != null && ControlMaster == master)
                                    {
                                        petPatient.ResurrectPet();

                                        for (int j = 0; j < petPatient.Skills.Length; ++j)
                                        {
                                            petPatient.Skills[j].Base -= 0.1;
                                        }
                                    }
                                    else if (master != null && master.InRange(petPatient, 3))
                                    {
                                        master.CloseGump(typeof(PetResurrectGump));
                                        master.SendGump(new PetResurrectGump(ControlMaster, petPatient));
                                    }
                                    else
                                    {
                                        bool found = false;

                                        List <Mobile> friends = petPatient.Friends;

                                        for (int j = 0; friends != null && j < friends.Count; ++j)
                                        {
                                            Mobile friend = friends[j];

                                            if (friend.InRange(petPatient, 3))
                                            {
                                                friend.CloseGump(typeof(PetResurrectGump));
                                                friend.SendGump(new PetResurrectGump(ControlMaster, petPatient));

                                                found = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    m_Patient.CloseGump(typeof(ResurrectGump));
                                    m_Patient.SendGump(new ResurrectGump(m_Patient, ControlMaster));
                                }
                            }
                        }
                    }
                }
            }
        }