コード例 #1
0
        public void ResurrectLiving(GamePlayer resurrectedPlayer, GameLiving rezzer)
        {
            if (rezzer.ObjectState != GameObject.eObjectState.Active)
            {
                return;
            }
            if (rezzer.CurrentRegionID != resurrectedPlayer.CurrentRegionID)
            {
                return;
            }
            resurrectedPlayer.Health    = (int)(resurrectedPlayer.MaxHealth * m_resurrectValue / 100);
            resurrectedPlayer.Mana      = (int)(resurrectedPlayer.MaxMana * m_resurrectValue / 100);
            resurrectedPlayer.Endurance = (int)(resurrectedPlayer.MaxEndurance * m_resurrectValue / 100);             //no endurance after any rez
            resurrectedPlayer.MoveTo(rezzer.CurrentRegionID, rezzer.X, rezzer.Y, rezzer.Z, rezzer.Heading);

            GameLiving living = resurrectedPlayer as GameLiving;
            GameTimer  resurrectExpiredTimer = null;

            lock (m_resTimersByLiving.SyncRoot)
            {
                resurrectExpiredTimer = (GameTimer)m_resTimersByLiving[living];
                m_resTimersByLiving.Remove(living);
            }
            if (resurrectExpiredTimer != null)
            {
                resurrectExpiredTimer.Stop();
            }

            resurrectedPlayer.StopReleaseTimer();
            resurrectedPlayer.Out.SendPlayerRevive(resurrectedPlayer);
            resurrectedPlayer.UpdatePlayerStatus();

            GameSpellEffect effect = SpellHandler.FindEffectOnTarget(resurrectedPlayer, GlobalSpells.PvEResurrectionIllnessSpellType);

            if (effect != null)
            {
                effect.Cancel(false);
            }
            GameSpellEffect effecttwo = SpellHandler.FindEffectOnTarget(resurrectedPlayer, GlobalSpells.RvRResurrectionIllnessSpellType);

            if (effecttwo != null)
            {
                effecttwo.Cancel(false);
            }
            resurrectedPlayer.Out.SendMessage("You have been resurrected by " + rezzer.GetName(0, false) + "!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            //Lifeflight: this should make it so players who have been ressurected don't take damage for 5 seconds
            RezDmgImmunityEffect rezImmune = new RezDmgImmunityEffect();

            rezImmune.Start(resurrectedPlayer);

            //Lifeflight: We need to reward rez RPs
            GamePlayer casterPlayer = rezzer as GamePlayer;

            if (casterPlayer != null)
            {
                long rezRps = resurrectedPlayer.LastDeathRealmPoints * (m_resurrectValue + 50) / 1000;
                if (rezRps > 0)
                {
                    casterPlayer.GainRealmPoints(rezRps);
                }
                else
                {
                    casterPlayer.Out.SendMessage("The player you resurrected was not worth realm points on death.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                    casterPlayer.Out.SendMessage("You thus get no realm points for the resurrect.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Resurrects living
        /// </summary>
        /// <param name="living"></param>
        protected virtual void ResurrectLiving(GameLiving living)
        {
            if (m_caster.ObjectState != GameObject.eObjectState.Active)
            {
                return;
            }
            if (m_caster.CurrentRegionID != living.CurrentRegionID)
            {
                return;
            }

            living.Health = living.MaxHealth * m_spell.ResurrectHealth / 100;
            int tempManaEnd = m_spell.ResurrectMana / 100;

            living.Mana = living.MaxMana * tempManaEnd;

            //The spec rez spells are the only ones that have endurance
            if (!SpellLine.IsBaseLine)
            {
                living.Endurance = living.MaxEndurance * tempManaEnd;
            }
            else
            {
                living.Endurance = 0;
            }

            living.MoveTo(m_caster.CurrentRegionID, m_caster.Position, m_caster.Heading);

            GameTimer resurrectExpiredTimer = null;

            lock (m_resTimersByLiving.SyncRoot)
            {
                resurrectExpiredTimer = (GameTimer)m_resTimersByLiving[living];
                m_resTimersByLiving.Remove(living);
            }
            if (resurrectExpiredTimer != null)
            {
                resurrectExpiredTimer.Stop();
            }

            GamePlayer player = living as GamePlayer;

            if (player != null)
            {
                player.StopReleaseTimer();
                player.Out.SendPlayerRevive(player);
                player.UpdatePlayerStatus();
                player.Out.SendMessage("You have been resurrected by " + m_caster.GetName(0, false) + "!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                player.Notify(GamePlayerEvent.Revive, player, new RevivedEventArgs(Caster, Spell));

                //Lifeflight add this should make it so players who have been ressurected don't take damage for 5 seconds
                RezDmgImmunityEffect rezImmune = new RezDmgImmunityEffect();
                rezImmune.Start(player);

                IList <GameObject> attackers;
                lock (player.Attackers) { attackers = new List <GameObject>(player.Attackers); }

                foreach (GameObject attacker in attackers)
                {
                    if (attacker is GameLiving && attacker != living.TargetObject)
                    {
                        attacker.Notify(
                            GameLivingEvent.EnemyHealed,
                            attacker,
                            new EnemyHealedEventArgs(living, m_caster, GameLiving.eHealthChangeType.Spell, living.Health));
                    }
                }

                GamePlayer casterPlayer = Caster as GamePlayer;
                if (casterPlayer != null)
                {
                    long rezRps = player.LastDeathRealmPoints * (Spell.ResurrectHealth + 50) / 1000;
                    if (rezRps > 0)
                    {
                        casterPlayer.GainRealmPoints(rezRps);
                    }
                    else
                    {
                        casterPlayer.Out.SendMessage("The player you resurrected was not worth realm points on death.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                        casterPlayer.Out.SendMessage("You thus get no realm points for the resurrect.", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                    }
                }
            }
        }