void ActionDragonThrow(GameLiving target)
 {
     SummonerBroadcast(Name + " throws " + m_summonerTarget.Name + " into the air!");
     m_summonerTarget.MoveTo(m_summonerTarget.CurrentRegionID,
                             m_summonerTarget.X,
                             m_summonerTarget.Y,
                             m_summonerTarget.Z + 100,
                             m_summonerTarget.Heading);
 }
Beispiel #2
0
        /// <summary>
        /// Hurl a player into the air.
        /// </summary>
        /// <param name="target">The player to hurl into the air.</param>
        private void ThrowLiving(GameLiving target)
        {
            BroadcastMessage(string.Format("{0} is hurled into the air!", target.Name));

            // Face the target, then push it 700 units up and 300 - 500 units backwards.
            TurnTo(target);

            Point3D targetPosition = PositionOfTarget(target, 700, Heading, Util.Random(300, 500));

            if (target is GamePlayer)
            {
                target.MoveTo(target.CurrentRegionID, targetPosition.X, targetPosition.Y, targetPosition.Z, target.Heading);
            }
            else if (target is GameNPC)
            {
                (target as GameNPC).MoveInRegion(target.CurrentRegionID, targetPosition.X, targetPosition.Y, targetPosition.Z, target.Heading, true);
                target.ChangeHealth(this, eHealthChangeType.Spell, (int)(target.Health * -0.35));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Hurl a player into the air.
        /// </summary>
        /// <param name="target">The player to hurl into the air.</param>
        private void ThrowLiving(GameLiving target)
        {
            BroadcastMessage(String.Format("{0} is hurled into the air!", target.Name));

            // Face the target, then push it 700 units up and 300 - 500 units backwards.

            TurnTo(target);

            Point3D targetPosition = PositionOfTarget(target, 700, Heading, Util.Random(300, 500));

            if (target is GamePlayer)
            {
                target.MoveTo(target.CurrentRegionID, targetPosition.X, targetPosition.Y, targetPosition.Z, target.Heading);
            }
            else if (target is GameNPC)
            {
                (target as GameNPC).MoveInRegion(target.CurrentRegionID, targetPosition.X, targetPosition.Y, targetPosition.Z, target.Heading, true);
                target.ChangeHealth(this, eHealthChangeType.Spell, (int)(target.Health * -0.35));
            }
        }
Beispiel #4
0
        public override bool SayReceive(GameLiving source, string str)
        {
            if (!base.SayReceive(source, str))
            {
                return(false);
            }

            string[] split = str.Split(' ');
            switch (split[0])
            {
            case "create":
                ushort id = 286;

                if (split.Length > 1)
                {
                    try { id = ushort.Parse(split[1]); }
                    catch { }
                }

                m_instance = (Instance)WorldMgr.CreateInstance(id, typeof(Instance));
                if (m_instance != null)
                {
                    Say("Success, instance created.");
                }
                else
                {
                    Say("Instance creation found errors.");
                }

                // Try and load a template from the db...
                if (split.Length > 2)
                {
                    string load = split[2];
                    Say("Trying to load instance '" + load + "' template from DB");
                    m_instance.LoadFromDatabase(load);
                }

                break;

            case "test":
                if (m_instance == null)
                {
                    Say("Instance is currently null.");
                }
                else
                {
                    int    x       = 32361;
                    int    y       = 31744;
                    int    z       = 16003;
                    ushort heading = 1075;

                    if (m_instance.InstanceEntranceLocation != null)
                    {
                        x       = m_instance.InstanceEntranceLocation.X;
                        y       = m_instance.InstanceEntranceLocation.Y;
                        z       = m_instance.InstanceEntranceLocation.Z;
                        heading = m_instance.InstanceEntranceLocation.Heading;
                    }

                    // save current position so player can use /instance exit
                    GameLocation saveLocation = new GameLocation(source.Name + "_exit", source.CurrentRegionID, source.X, source.Y, source.Z);
                    source.TempProperties.setProperty(saveLocation.Name, saveLocation);

                    Say("Instance ID " + m_instance.ID + ", Skin: " + m_instance.Skin + ", with " + m_instance.Zones.Count + " zones inside the region.");

                    if (!source.MoveTo(m_instance.ID, x, y, z, heading))
                    {
                        Say("Source could not be moved to instance entrance; MoveTo returned false.  Now trying to move to current location inside the instance.");

                        if (!source.MoveTo(m_instance.ID, source.X, source.Y, source.Z, source.Heading))
                        {
                            Say("Sorry, that failed as well.");
                        }
                    }
                }

                break;
            }

            return(true);
        }
Beispiel #5
0
        public override bool SayReceive(GameLiving source, string str)
        {
            if (!base.SayReceive(source, str))
                return false;

            string[] split = str.Split(' ');
            switch (split[0])
            {
                case "create":
                    ushort id = 286;

                    if (split.Length > 1)
                    {
                        try { id = ushort.Parse(split[1]); }
                        catch { }
                    }

                    m_instance = (Instance)WorldMgr.CreateInstance(id, typeof(Instance));
                    if (m_instance != null)
                        Say("Success, instance created.");
                    else
                        Say("Instance creation found errors.");

                    //Try and load a template from the db...
                    if (split.Length > 2)
                    {
                        string load = split[2];
                        Say("Trying to load instance '" + load + "' template from DB");
                        m_instance.LoadFromDatabase(load);
                    }

                    break;
                case "test":
                    if (m_instance == null)
                        Say("Instance is currently null.");
                    else
                    {
                        int x = 32361;
                        int y = 31744;
                        int z = 16003;
                        ushort heading = 1075;

                        if (m_instance.InstanceEntranceLocation != null)
                        {
                            x = m_instance.InstanceEntranceLocation.X;
                            y = m_instance.InstanceEntranceLocation.Y;
                            z = m_instance.InstanceEntranceLocation.Z;
                            heading = m_instance.InstanceEntranceLocation.Heading;
                        }

                        // save current position so player can use /instance exit
                        GameLocation saveLocation = new GameLocation(source.Name + "_exit", source.CurrentRegionID, source.X, source.Y, source.Z);
                        source.TempProperties.setProperty(saveLocation.Name, saveLocation);

                        Say("Instance ID " + m_instance.ID + ", Skin: " + m_instance.Skin + ", with " + m_instance.Zones.Count + " zones inside the region.");

                        if (!source.MoveTo(m_instance.ID, x, y, z, heading))
                        {
                            Say("Source could not be moved to instance entrance; MoveTo returned false.  Now trying to move to current location inside the instance.");

                            if (!source.MoveTo(m_instance.ID, source.X, source.Y, source.Z, source.Heading))
                            {
                                Say("Sorry, that failed as well.");
                            }
                        }
                    }
                    break;
            }
            return true;
        }
        /// <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);
                    }
                }
            }
        }
        /// <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.X, m_caster.Y, m_caster.Z, 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);
                    }
                }
            }
        }