Exemplo n.º 1
2
 public override void Start(GameLiving target)
 {
     base.Start(target);
     if (target is GameNPC)
     {
         pet = target as GameNPC;
         pbaoe = ScriptMgr.CreateSpellHandler(EffectOwner, petSpell, petSpellLine);
         pulseTimer = new RegionTimer(EffectOwner, new RegionTimerCallback(PulseTimer), 1000);
         GameEventMgr.AddHandler(EffectOwner, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
     }
 }
Exemplo n.º 2
0
        protected virtual int PulseTimer(RegionTimer timer)
        {
            if (currentTick >= m_lifeTime || m_caster == null)
            {
                this.RemoveFromWorld();
                timer.Stop();
                timer = null;
                return 0;
            }
            if (currentTick % m_pulseFrequency == 0)
            {
                currentPulse++;
                foreach (GamePlayer target in this.GetPlayersInRadius(m_radius))
                {
                    CastSpell(target);
                }
                foreach (GameNPC npc in this.GetNPCsInRadius(m_radius))
                {
                    CastSpell(npc);
                }
            }

            currentTick++;
            return 1000;
        }
Exemplo n.º 3
0
        protected virtual int PulseTimer(RegionTimer timer)
        {
            if (currentTick >= m_lifeTime || m_caster == null)
            {
                this.RemoveFromWorld();
                timer.Stop();
                timer = null;
                return(0);
            }
            if (currentTick % m_pulseFrequency == 0)
            {
                currentPulse++;
                foreach (GamePlayer target in this.GetPlayersInRadius(m_radius))
                {
                    CastSpell(target);
                }
                foreach (GameNPC npc in this.GetNPCsInRadius(m_radius))
                {
                    CastSpell(npc);
                }
            }

            currentTick++;
            return(1000);
        }
        /// <summary>
        /// execute non duration spell effect on target
        /// </summary>
        /// <param name="target"></param>
        /// <param name="effectiveness"></param>
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            base.OnDirectEffect(target, effectiveness);
            if (target == null || target.IsAlive) return;

            SendEffectAnimation(target, 0, false, 1);
            GamePlayer targetPlayer = target as GamePlayer;
            if (targetPlayer == null)
            {
                //not a player
                ResurrectLiving(target);
            }
            else
            {
                targetPlayer.TempProperties.setProperty(RESURRECT_CASTER_PROPERTY, m_caster);
                RegionTimer resurrectExpiredTimer = new RegionTimer(targetPlayer);
                resurrectExpiredTimer.Callback = new RegionTimerCallback(ResurrectExpiredCallback);
                resurrectExpiredTimer.Properties.setProperty("targetPlayer", targetPlayer);
                resurrectExpiredTimer.Start(15000);
                lock (m_resTimersByLiving.SyncRoot)
                {
                    m_resTimersByLiving.Add(target, resurrectExpiredTimer);
                }

                //send resurrect dialog
                targetPlayer.Out.SendCustomDialog("Do you allow " + m_caster.GetName(0, true) + " to resurrected you\nwith " + m_spell.ResurrectHealth + " percent hits?", new CustomDialogResponse(ResurrectResponceHandler));
            }
        }
Exemplo n.º 5
0
        protected virtual int PulseTimer(RegionTimer timer)
        {
            if (_currentTick >= _lifeTime || Caster == null)
            {
                RemoveFromWorld();
                timer.Stop();
                return(0);
            }

            if (_currentTick % _pulseFrequency == 0)
            {
                CurrentPulse++;
                foreach (GamePlayer target in GetPlayersInRadius(_radius))
                {
                    CastSpell(target);
                }

                foreach (GameNPC npc in GetNPCsInRadius(_radius))
                {
                    CastSpell(npc);
                }
            }

            _currentTick++;
            return(1000);
        }
Exemplo n.º 6
0
 public int RemoveAttackBlock(RegionTimer timer)
 {
     GamePlayer player = timer.Owner as GamePlayer;
     if (player != null)
         player.TempProperties.removeProperty(VANISH_BLOCK_ATTACK_TIME_KEY);
     return 0;
 }
Exemplo n.º 7
0
        // Summon a spirit that will follow target
        private void SummonSpirit(int spiritId, GamePlayer targetPlayer)
        {
            _spirits[spiritId] = new GameNPC
            {
                CurrentRegion = _effectOwner.CurrentRegion,
                Heading       = (ushort)((_effectOwner.Heading + 2048) % 4096),
                Level         = SpiritLevel,
                Realm         = _effectOwner.Realm,
                Name          = SpiritName,
                Model         = SpiritModel,
                CurrentSpeed  = 0,
                MaxSpeedBase  = SpiritSpeed,
                GuildName     = string.Empty,
                Size          = 50,
                X             = _effectOwner.X + Util.Random(20, 40) - Util.Random(20, 40),
                Y             = _effectOwner.Y + Util.Random(20, 40) - Util.Random(20, 40),
                Z             = _effectOwner.Z
            };

            _spirits[spiritId].Flags |= GameNPC.eFlags.DONTSHOWNAME;
            _spirits[spiritId].SetOwnBrain(new StandardMobBrain());
            _spirits[spiritId].AddToWorld();
            _spirits[spiritId].TargetObject = targetPlayer;
            _spirits[spiritId].Follow(targetPlayer, 0, RealmAbilities.MinionRescueAbility.SpellRadius + 100);
            _spiritTimer[spiritId] = new RegionTimer(_spirits[spiritId], new RegionTimerCallback(SpiritCallBack), 200);
        }
Exemplo n.º 8
0
        // Check distance between spirit and target
        private int spiritCallBack(RegionTimer timer)
        {
            if (timer.Owner == null || !(timer.Owner is GameNPC))
            {
                timer.Stop();
                timer = null;
                return(0);
            }

            GameNPC    spirit       = timer.Owner as GameNPC;
            GamePlayer targetPlayer = spirit.TargetObject as GamePlayer;

            if (targetPlayer == null || !targetPlayer.IsAlive)
            {
                spirit.StopFollowing();
                timer.Stop();
                timer = null;
                return(0);
            }

            if (targetPlayer.IsWithinRadius(spirit, 100))
            {
                ApplySpiritEffect(spirit, targetPlayer);
                timer.Stop();
                timer = null;
                return(0);
            }

            return(200);
        }
 protected void UnloadTimers()
 {
     m_changeLevelTimer.Stop();
     m_changeLevelTimer = null;
     m_claimTimer.Stop();
     m_claimTimer = null;
 }
Exemplo n.º 10
0
 /// <summary>
 /// do not regen
 /// </summary>
 public override void StartHealthRegeneration()
 {
     m_repairTimer          = new RegionTimer(CurrentRegion.TimeManager);
     m_repairTimer.Callback = new RegionTimerCallback(RepairTimerCallback);
     m_repairTimer.Interval = repairInterval;
     m_repairTimer.Start(1);
 }
Exemplo n.º 11
0
        /// <summary>
        /// execute non duration spell effect on target
        /// </summary>
        /// <param name="target"></param>
        /// <param name="effectiveness"></param>
        public override void OnDirectEffect(GameLiving target, double effectiveness)
        {
            base.OnDirectEffect(target, effectiveness);
            if (target == null || target.IsAlive)
            {
                return;
            }

            SendEffectAnimation(target, 0, false, 1);
            GamePlayer targetPlayer = target as GamePlayer;

            if (targetPlayer == null)
            {
                //not a player
                ResurrectLiving(target);
            }
            else
            {
                targetPlayer.TempProperties.setProperty(RESURRECT_CASTER_PROPERTY, m_caster);
                RegionTimer resurrectExpiredTimer = new RegionTimer(targetPlayer);
                resurrectExpiredTimer.Callback = new RegionTimerCallback(ResurrectExpiredCallback);
                resurrectExpiredTimer.Properties.setProperty("targetPlayer", targetPlayer);
                resurrectExpiredTimer.Start(15000);
                lock (m_resTimersByLiving.SyncRoot)
                {
                    m_resTimersByLiving.Add(target, resurrectExpiredTimer);
                }

                //send resurrect dialog
                targetPlayer.Out.SendCustomDialog("Do you allow " + m_caster.GetName(0, true) + " to resurrected you\nwith " + m_spell.ResurrectHealth + " percent hits?", new CustomDialogResponse(ResurrectResponceHandler));
            }
        }
Exemplo n.º 12
0
 public int Teleport(RegionTimer timer2)
 {
     tplayer = null;
     timer2.Stop();
     timer2 = null;
     return(0);
 }
Exemplo n.º 13
0
        public int HealPulse(RegionTimer timer)
        {
            if (m_healpulse > 0)
            {
                m_healpulse--;

                GamePlayer player = Owner as GamePlayer;
                if (player == null) return 0;
                if (player.Group == null) return 3000;

                foreach (GamePlayer p in player.Group.GetPlayersInTheGroup())
                {
                    if (p.Health < p.MaxHealth && player.IsWithinRadius(p, 750) && p.IsAlive)
                    {
                        if (player.IsStealthed)
                            player.Stealth(false);

                        int heal = 300;

                        if (p.Health + heal > p.MaxHealth)
                            heal = p.MaxHealth - p.Health;

                        p.ChangeHealth(player, GameLiving.eHealthChangeType.Regenerate, heal);

                        player.Out.SendMessage("You heal " + p.Name + " for " + heal.ToString() + " hit points.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                        p.Out.SendMessage(player.Name + " heals you for " + heal.ToString() + " hit points.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                    }
                }
                return 3000;
            }
            return 0;
        }
        public override void Start(GameLiving target)
        {
            base.Start(target);

            owner = target as GamePlayer;
            if (owner == null)
            {
                return;
            }

            foreach (GamePlayer p in owner.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                p.Out.SendSpellEffectAnimation(owner, owner, Icon, 0, false, 1);
            }

            m_debuffs = new Dictionary <eProperty, int>(1 + eProperty.Stat_Last - eProperty.Stat_First);

            for (eProperty property = eProperty.Stat_First; property <= eProperty.Stat_Last; property++)
            {
                m_debuffs.Add(property, (int)(owner.GetModified(property) * 0.25));
                owner.DebuffCategory[(int)property] += m_debuffs[property];
            }

            owner.Out.SendCharStatsUpdate();

            m_timer = new RegionTimer(owner, new RegionTimerCallback(HealPulse));
            m_timer.Start(1);
        }
Exemplo n.º 15
0
        /// <summary>
        /// When guards respawn we refresh them, if a patrol guard respawns we
        /// call a special function to update leadership
        /// </summary>
        /// <param name="respawnTimer"></param>
        /// <returns></returns>
        protected override int RespawnTimerCallback(RegionTimer respawnTimer)
        {
            int temp = base.RespawnTimerCallback(respawnTimer);

            RefreshTemplate();
            return(temp);
        }
Exemplo n.º 16
0
        protected int Proceed(RegionTimer timer)
        {
            GamePlayer player = (GamePlayer)timer.Properties.getProperty <object>("repair_player", null);
            GameLiving obj    = (GameLiving)timer.Properties.getProperty <object>("repair_target", null);

            if (player == null || obj == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("There was a problem getting back the target or player in door/component repair!");
                }
                return(0);
            }

            player.CraftTimer.Stop();
            player.Out.SendCloseTimerWindow();

            if (!PreFireChecks(player, obj))
            {
                return(0);
            }

            if (Util.ChanceDouble(CalculateRepairChance(player, obj)))
            {
                int start = obj.HealthPercent;
                if (obj is GameKeepDoor)
                {
                    GameKeepDoor door = obj as GameKeepDoor;
                    door.Repair((int)(door.MaxHealth * 0.15));
                }
                if (obj is GameKeepComponent)
                {
                    GameKeepComponent component = obj as GameKeepComponent;
                    component.Repair((int)(component.MaxHealth * 0.15));
                }
                if (obj is GameSiegeWeapon)
                {
                    GameSiegeWeapon weapon = obj as GameSiegeWeapon;
                    weapon.Repair();
                }
                int finish = obj.HealthPercent;
                CalculatePlayersWood(player, (GetTotalWoodForLevel(obj.Level + 1)));
                DisplayMessage(player, "You successfully repair the component by 15%!");

                /*
                 * - Realm points will now be awarded for successfully repairing a door or outpost piece.
                 * Players will receive approximately 10% of the amount repaired in realm points.
                 * (Note that realm points for repairing a door or outpost piece will not work in the battlegrounds.)
                 */
                // tolakram - we have no idea how many hit points a live door has so this code is not accurate
                int amount = (finish - start) * obj.Level;                  // level of non claimed keep is 4
                player.GainRealmPoints(Math.Min(150, amount));
            }
            else
            {
                DisplayMessage(player, "You fail to repair the component!");
            }

            return(0);
        }
Exemplo n.º 17
0
 protected virtual int RemoveLadyFelin(RegionTimer callingTimer)
 {
     if (ladyFelin != null)
     {
         ladyFelin.Delete();
     }
     return(0);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Stops the timers for this effect
 /// </summary>
 private void StopTimers()
 {
     if (m_expireTimer != null)
     {
         m_expireTimer.Stop();
         m_expireTimer = null;
     }
 }
Exemplo n.º 19
0
 public int DragonNukeandStun(RegionTimer timer)
 {
     //AOE Stun
     CastSpell(Summoner.Stun, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
     //AOE Nuke
     CastSpell(Summoner.Nuke, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
     return(0);
 }
Exemplo n.º 20
0
 // Stops the timers for this effect
 protected virtual void StopTimers()
 {
     if (_expireTimer != null)
     {
         _expireTimer.Stop();
         _expireTimer = null;
     }
 }
Exemplo n.º 21
0
 protected override int TeleportTimerCallback(RegionTimer respawnTimer)
 {
     // Check any Keep State / Tower State here
     // This is called 16 times between each teleport !
     // You can change teleport speed using
     // this.PortalTeleportInterval (in ms !!)
     return(base.TeleportTimerCallback(respawnTimer));
 }
Exemplo n.º 22
0
        protected virtual int ResetPlayerModel(RegionTimer callingTimer)
        {
            GameClient client = QuestPlayer.Client;

            QuestPlayer.Model = (ushort)client.Account.Characters[client.ActiveCharIndex].CreationModel;
            SendSystemMessage("You change back to your normal form!");
            return(0);
        }
Exemplo n.º 23
0
 protected virtual int RemoveLadyLegada(RegionTimer callingTimer)
 {
     if (ladyLegada != null)
     {
         ladyLegada.Delete();
     }
     return(0);
 }
 /// <summary>
 /// Destroys the Change Level Timer
 /// </summary>
 public void DestroyChangeLevelTimer()
 {
     if (m_changeLevelTimer != null)
     {
         m_changeLevelTimer.Stop();
         m_changeLevelTimer = null;
     }
 }
Exemplo n.º 25
0
 protected virtual void StopTimer()
 {
     if (m_expireTimer != null)
     {
         m_expireTimer.Stop();
         m_expireTimer = null;
     }
 }
Exemplo n.º 26
0
 /// <summary>
 /// Stops the timers for this effect
 /// </summary>
 private void StopTimers()
 {
     if (m_expireTimer != null)
     {
         m_expireTimer.Stop();
         m_expireTimer = null;
     }
 }
 protected void InitialiseTimers()
 {
     m_changeLevelTimer          = new RegionTimer(CurrentRegion.TimeManager);
     m_changeLevelTimer.Callback = new RegionTimerCallback(ChangeLevelTimerCallback);
     m_claimTimer          = new RegionTimer(CurrentRegion.TimeManager);
     m_claimTimer.Callback = new RegionTimerCallback(ClaimCallBack);
     m_claimTimer.Interval = CLAIM_CALLBACK_INTERVAL;
 }
Exemplo n.º 28
0
 public int TreeGrow(RegionTimer timer)
 {
     //It's been some time now, lets change the tree's name, size, and level.
     this.Size  = 61;
     this.Name  = "haunted appletree";       //same as live
     this.Level = (byte)Util.Random(18, 23); //from live, they range from level 18 to 23.
     return(0);
 }
Exemplo n.º 29
0
 /// <summary>
 /// Stops the timers for this effect
 /// </summary>
 private void StopTimers()
 {
     if (_expireTimer != null)
     {
         _expireTimer.Stop();
         _expireTimer = null;
     }
 }
Exemplo n.º 30
0
 protected virtual int CastLadyLegada(RegionTimer callingTimer)
 {
     foreach (GamePlayer visPlayer in ladyLegada.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
     {
         visPlayer.Out.SendSpellCastAnimation(ladyLegada, 1, 20);
     }
     return(0);
 }
Exemplo n.º 31
0
        protected override int TeleportTimerCallback(RegionTimer respawnTimer)
        {
            // Check any Keep State / Tower State here
            // This is called 16 times between each teleport !
            // You can change teleport speed using
            // this.PortalTeleportInterval (in ms !!)

            return base.TeleportTimerCallback(respawnTimer);
        }
Exemplo n.º 32
0
        public int RemoveAttackBlock(RegionTimer timer)
        {
            if (timer.Owner is GamePlayer player)
            {
                player.TempProperties.removeProperty(VANISH_BLOCK_ATTACK_TIME_KEY);
            }

            return(0);
        }
Exemplo n.º 33
0
 public void ShowAnimation(GamePlayer target)
 {
     foreach (GamePlayer vplayer in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
     {
         vplayer.Out.SendSpellCastAnimation(this, spell, 20); //Caster,SpellID,Duration
     }
     tplayer = target;
     RegionTimer timer = new RegionTimer(tplayer, new RegionTimerCallback(ShowEffect), 2000);//GameObject,ElapsedEvent,Duration in MS
 }
Exemplo n.º 34
0
        private void StartTimer()
        {
            _tickTimer = new RegionTimer(_playerOwner)
            {
                Callback = new RegionTimerCallback(onTick)
            };

            _tickTimer.Start(3000);
        }
 /// <summary>
 /// Stops the timers for this effect
 /// </summary>
 protected virtual void StopTimers()
 {
     if (_expireTimer != null)
     {
         // DOLConsole.WriteLine("effect stop expire on "+Owner.Name+" "+this.InternalID);
         _expireTimer.Stop();
         _expireTimer = null;
     }
 }
        protected virtual int EndCast(RegionTimer timer)
        {
            if (m_caster.TargetObject == null)
            {
                m_caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                m_caster.DisableSkill(this, 3 * 1000);
                return(0);
            }

            if (!m_caster.IsWithinRadius(m_caster.TargetObject, (int)(1500 * m_caster.GetModified(eProperty.SpellRange) * 0.01)))
            {
                m_caster.Out.SendMessage(m_caster.TargetObject + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                return(0);
            }

            foreach (GamePlayer player in m_caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendSpellEffectAnimation(m_caster, (m_caster.TargetObject as GameLiving), 7025, 0, false, 1);
            }

            foreach (GameNPC mob in m_caster.TargetObject.GetNPCsInRadius(500))
            {
                if (!GameServer.ServerRules.IsAllowedToAttack(m_caster, mob, true))
                {
                    continue;
                }

                mob.TakeDamage(m_caster, eDamageType.Heat, m_dmgValue, 0);
                m_caster.Out.SendMessage("You hit the " + mob.Name + " for " + m_dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
                foreach (GamePlayer player2 in m_caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    player2.Out.SendSpellEffectAnimation(m_caster, mob, 7025, 0, false, 1);
                }
            }

            foreach (GamePlayer aeplayer in m_caster.TargetObject.GetPlayersInRadius(500))
            {
                if (!GameServer.ServerRules.IsAllowedToAttack(m_caster, aeplayer, true))
                {
                    continue;
                }

                aeplayer.TakeDamage(m_caster, eDamageType.Heat, m_dmgValue, 0);
                m_caster.Out.SendMessage("You hit " + aeplayer.Name + " for " + m_dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
                aeplayer.Out.SendMessage(m_caster.Name + " hits you for " + m_dmgValue + " damage.", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
                foreach (GamePlayer player3 in m_caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    player3.Out.SendSpellEffectAnimation(m_caster, aeplayer, 7025, 0, false, 1);
                }
            }

            DisableSkill(m_caster);
            timer.Stop();
            timer = null;
            return(0);
        }
Exemplo n.º 37
0
		/// <summary>
		/// Starts the effect
		/// </summary>
		/// <param name="target">The player of this effect</param>
		public override void Start(GameLiving target)
		{
			base.Start(target);
			GamePlayer player = target as GamePlayer;
			if (player == null) return;
			player.EffectList.Add(this);
			m_range = (int)(2000 * (player.GetModified(eProperty.SpellRange) * 0.01));
			m_countDownTimer = new RegionTimer(player, new RegionTimerCallback(CountDown));
			m_countDownTimer.Start(1);
		}
Exemplo n.º 38
0
        public virtual int RepairTimerCallback(RegionTimer timer)
        {
            if (HealthPercent == 100 || AbstractKeep.InCombat)
            {
                return(repairInterval);
            }

            Repair((MaxHealth / 100) * 5);
            return(repairInterval);
        }
Exemplo n.º 39
0
 public int CountDown(RegionTimer timer)
 {
     if (m_countdown > 0)
     {
         ((GamePlayer)Owner).Out.SendMessage("You are hidden for " + m_countdown + " more seconds!", eChatType.CT_SpellPulse, eChatLoc.CL_SystemWindow);
         m_countdown--;
         return 1000;
     }
     return 0;
 }
Exemplo n.º 40
0
		/// <summary>
		/// Stops the effect
		/// </summary>
		public override void Stop()
		{
			base.Stop();
			Owner.EffectList.Remove(this);
			if (m_countDownTimer != null)
			{
				m_countDownTimer.Stop();
				m_countDownTimer = null;
			}
		}
Exemplo n.º 41
0
 /// <summary>
 /// Start the timed effect on target
 /// </summary>
 /// <param name="target">The effect target</param>
 public override void Start(GameLiving target)
 {
     lock (m_LockObject)
     {
         if (m_expireTimer == null)
         {
             m_expireTimer = new RegionTimer(target, new RegionTimerCallback(ExpiredCallback), m_duration);
         }
         base.Start(target);
     }
 }
Exemplo n.º 42
0
		public override void Stop()
		{
			base.Stop();
			GamePlayer player = Owner as GamePlayer;
			player.Out.SendUpdateMaxSpeed();
			if (m_countDownTimer != null)
			{
				m_countDownTimer.Stop();
				m_countDownTimer = null;
			}
		}
Exemplo n.º 43
0
 protected virtual int Timer(RegionTimer callingTimer)
 {
     if (base.IsAlive)
     {
         foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
         {
             player.Out.SendSpellCastAnimation(this, 4321, 30);
             RegionTimer timer = new RegionTimer(player, new RegionTimerCallback(ShowEffect), 3000);
         }
     }
     return INTERVAL;
 }
Exemplo n.º 44
0
 /// <summary>
 /// Stop the timed effect on owner
 /// </summary>
 public override void Stop()
 {
     lock (m_LockObject)
     {
         if (m_expireTimer != null)
         {
             m_expireTimer.Stop();
             m_expireTimer = null;
         }
         base.Stop();
     }
 }
        protected virtual int EndCast(RegionTimer timer)
        {
            if (caster.TargetObject == null)
            {
                caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                caster.DisableSkill(this, 3 * 1000);
                return 0;
            }

            if (!caster.IsWithinRadius(caster.TargetObject, (int)(1500 * caster.GetModified(eProperty.SpellRange) * 0.01)))
            {
                caster.Out.SendMessage(caster.TargetObject + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                return 0;
            }

            foreach (GamePlayer player in caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendSpellEffectAnimation(caster, (caster.TargetObject as GameLiving), 7025, 0, false, 1);
            }

            foreach (GameNPC mob in caster.TargetObject.GetNPCsInRadius(500))
            {
                if (!GameServer.ServerRules.IsAllowedToAttack(caster, mob, true))
                    continue;

                mob.TakeDamage(caster, eDamageType.Heat, dmgValue, 0);
                caster.Out.SendMessage("You hit the " + mob.Name + " for " + dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
                foreach (GamePlayer player2 in caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    player2.Out.SendSpellEffectAnimation(caster, mob, 7025, 0, false, 1);
                }
            }

            foreach (GamePlayer aeplayer in caster.TargetObject.GetPlayersInRadius(500))
            {
                if (!GameServer.ServerRules.IsAllowedToAttack(caster, aeplayer, true))
                    continue;

                aeplayer.TakeDamage(caster, eDamageType.Heat, dmgValue, 0);
                caster.Out.SendMessage("You hit " + aeplayer.Name + " for " + dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
                aeplayer.Out.SendMessage(caster.Name + " hits you for " + dmgValue + " damage.", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow);
                foreach (GamePlayer player3 in caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    player3.Out.SendSpellEffectAnimation(caster, aeplayer, 7025, 0, false, 1);
                }
            }

            DisableSkill(caster);
            timer.Stop();
            timer = null;
            return 0;
        }
Exemplo n.º 46
0
		public override void Start(GameLiving target)
		{
			base.Start(target);
			GamePlayer player = target as GamePlayer;
			player.StopAttack();
			player.Stealth(true);
			player.Out.SendUpdateMaxSpeed();
			m_countDownTimer = new RegionTimer(player, new RegionTimerCallback(CountDown));
			m_countDownTimer.Start(1);
			player.TempProperties.setProperty(VANISH_BLOCK_ATTACK_TIME_KEY, player.CurrentRegion.Time + 30000);
			m_removeTimer = new RegionTimer(player, new RegionTimerCallback(RemoveAttackBlock));
			m_removeTimer.Start(30000);
		}
 private int CauldronCallBack(RegionTimer timer)
 {
     if (Cauldron != null && EffectOwner != null)
     {
         foreach (GamePlayer target in Cauldron.GetPlayersInRadius(spellRadius))
         {
             if (GameServer.ServerRules.IsAllowedToAttack(EffectOwner, target, true))
                 target.TakeDamage(EffectOwner, eDamageType.Heat, spellDamage, 0);
         }
     }
     timer.Stop();
     timer = null;
     return 0;
 }
Exemplo n.º 48
0
 public int ShowEffect(RegionTimer timer)
 {
     if (base.IsAlive)
     {
         foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
         {
             player.Out.SendSpellEffectAnimation(this, this, 4321, 0, false, 1);
         }
         foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
         {
             player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "GuardCaster.SkinsHardens", this.Name), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
         }
     }
     timer.Stop();
     timer = null;
     return 0;
 }
 protected virtual int EndCast(RegionTimer timer)
 {
     bool castWasSuccess = player.TempProperties.getProperty(NM_CAST_SUCCESS, false);
     player.TempProperties.removeProperty(IS_CASTING);
     GameEventMgr.RemoveHandler(player, GamePlayerEvent.Moving, new DOLEventHandler(CastInterrupted));
     GameEventMgr.RemoveHandler(player, GamePlayerEvent.AttackFinished, new DOLEventHandler(CastInterrupted));
     GameEventMgr.RemoveHandler(player, GamePlayerEvent.Dying, new DOLEventHandler(CastInterrupted));
     if (player.IsMezzed || player.IsStunned || player.IsSitting)
         return 0;
     if (!castWasSuccess)
         return 0;
     Statics.NegativeMaelstromBase nm = new Statics.NegativeMaelstromBase(dmgValue);
     nm.CreateStatic(player, player.GroundTarget, duration, 5, 350);
     DisableSkill(player);
     timer.Stop();
     timer = null;
     return 0;
 }
Exemplo n.º 50
0
		private int startSpell(RegionTimer timer)
		{
			if (!owner.IsAlive)
				return 0;

			traparea = new Area.Circle("decimation trap", owner.X, owner.Y, owner.Z, 50);

			owner.CurrentRegion.AddArea(traparea);
			region = owner.CurrentRegionID;

			GameEventMgr.AddHandler(traparea, AreaEvent.PlayerEnter, new DOLEventHandler(EventHandler));
			ticktimer = new RegionTimer(owner);
			ticktimer.Callback = new RegionTimerCallback(onTick);
			ticktimer.Start(600000);
			getTargets();
			DisableSkill(owner);

			return 0;
		}
        public override void Start(GameLiving target)
        {
            base.Start(target);

            owner = target as GamePlayer;
            if (owner == null) return;

            foreach (GamePlayer p in owner.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                p.Out.SendSpellEffectAnimation(owner, owner, Icon, 0, false, 1);

            m_debuffs = new Dictionary<eProperty, int>(1 + eProperty.Stat_Last - eProperty.Stat_First);

            for (eProperty property = eProperty.Stat_First; property <= eProperty.Stat_Last; property++)
            {
                m_debuffs.Add(property, (int)(owner.GetModified(property) * 0.25));
                owner.DebuffCategory[(int)property] += m_debuffs[property];
            }

            owner.Out.SendCharStatsUpdate();

            m_timer = new RegionTimer(owner, new RegionTimerCallback(HealPulse));
            m_timer.Start(1);
        }
Exemplo n.º 52
0
 protected virtual int ExpiredCallback(RegionTimer callingTimer)
 {
     Stop();
     return 0;
 }
Exemplo n.º 53
0
 protected virtual void StopTimers()
 {
     if (m_expireTimer != null)
     {
         m_expireTimer.Stop();
         m_expireTimer = null;
     }
 }
Exemplo n.º 54
0
 protected virtual void StartTimers()
 {
     StopTimers();
     m_expireTimer = new RegionTimer(playertarget, new RegionTimerCallback(ExpiredCallback), 10000);
 }
Exemplo n.º 55
0
        protected virtual int DeleteDunwynClone(RegionTimer callingTimer)
        {
            if (dunwynClone != null)
            {
                dunwynClone.Delete();
                GameEventMgr.RemoveHandler(dunwynClone, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterDunwyn));
                GameEventMgr.RemoveHandler(dunwynClone, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterDunwyn));
            }

            for (int i = 0; i < recruits.Length; i++)
            {
                if (recruits[i] != null)
                    recruits[i].Delete();
            }

            return 0;
        }
Exemplo n.º 56
0
		/// <summary>
		/// When guards respawn we refresh them, if a patrol guard respawns we
		/// call a special function to update leadership
		/// </summary>
		/// <param name="respawnTimer"></param>
		/// <returns></returns>
		protected override int RespawnTimerCallback(RegionTimer respawnTimer)
		{
			int temp = base.RespawnTimerCallback(respawnTimer);
			if (Component != null && Component.AbstractKeep != null)
			{
				Component.AbstractKeep.TemplateManager.GetMethod("RefreshTemplate").Invoke(null, new object[] { this });
			}
			else
			{
				TemplateMgr.RefreshTemplate(this);
			}
			return temp;
		}
Exemplo n.º 57
0
 /// <summary>
 /// Starts the timers for this effect
 /// </summary>
 private void StartTimers()
 {
     StopTimers();
     m_expireTimer = new RegionTimer(m_player, new RegionTimerCallback(ExpireCallback), m_effectDuration * 1000);
 }
Exemplo n.º 58
0
        /// <summary>
        /// The callback for when the effect expires
        /// </summary>
        /// <param name="timer">The ObjectTimerCallback object</param>
        private int ExpireCallback(RegionTimer timer)
        {
            Cancel(false);

            return 0;
        }
Exemplo n.º 59
0
		protected virtual int RootExpires(RegionTimer timer)
		{
			GameLiving living = timer.Owner as GameLiving;
			if (living != null)
			{
				living.BuffBonusMultCategory1.Remove((int)eProperty.MaxSpeed, this);
				SendUpdates(living);
			}
			timer.Stop();
			timer = null;
			return 0;
		}
Exemplo n.º 60
0
		public override void Execute(GameLiving living)
		{
			if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

			caster = living as GamePlayer;
			if (caster == null)
				return;

			if (caster.TargetObject == null)
			{
				caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				caster.DisableSkill(this, 3 * 1000);
				return;
			}

			if (!caster.TargetInView)
			{
				caster.Out.SendMessage(caster.TargetObject.Name + " is not in view.", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
				caster.DisableSkill(this, 3 * 1000);
				return;
			}

			if (!caster.IsWithinRadius( caster.TargetObject, 1875 ))
			{
				caster.Out.SendMessage(caster.TargetObject.Name + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
				caster.DisableSkill(this, 3 * 1000);
				return;
			}

			if (m_expireTimerID != null && m_expireTimerID.IsAlive)
			{
				caster.Out.SendMessage("You are already casting this ability.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
				caster.DisableSkill(this, 3 * 1000);
				return;
			}

			if(ServerProperties.Properties.USE_NEW_ACTIVES_RAS_SCALING)
			{
				switch (Level)
				{
						case 1: dmgValue = 150; duration = 10000; break;
						case 2: dmgValue = 275; duration = 15000; break;
						case 3: dmgValue = 400; duration = 20000; break;
						case 4: dmgValue = 500; duration = 25000; break;
						case 5: dmgValue = 600; duration = 30000; break;
						default: return;
				}				
			}
				//150 dam/10 sec || 400/20  || 600/30
				switch (Level)
				{
						case 1: dmgValue = 150; duration = 10000; break;
						case 2: dmgValue = 400; duration = 20000; break;
						case 3: dmgValue = 600; duration = 30000; break;
						default: return;
				}

			#region resist and det
			GameLiving m_target = caster.TargetObject as GameLiving;

			int primaryResistModifier = m_target.GetResist(eDamageType.Spirit);
			int secondaryResistModifier = m_target.SpecBuffBonusCategory[(int)eProperty.Resist_Spirit];
			int rootdet = ((m_target.GetModified(eProperty.SpeedDecreaseDurationReduction) - 100) * -1);

			int ResistModifier = 0;
			ResistModifier += (int)((dmgValue * (double)primaryResistModifier) * -0.01);
			ResistModifier += (int)((dmgValue + (double)ResistModifier) * (double)secondaryResistModifier * -0.01);


			if (m_target is GamePlayer)
			{
				dmgValue += ResistModifier;
			}
			if (m_target is GameNPC)
			{
				dmgValue += ResistModifier;
			}
			
			int rootmodifier = 0;
			rootmodifier += (int)((duration * (double)primaryResistModifier) * -0.01);
			rootmodifier += (int)((duration + (double)primaryResistModifier) * (double)secondaryResistModifier * -0.01);
			rootmodifier += (int)((duration + (double)rootmodifier) * (double)rootdet * -0.01);
			
			duration += rootmodifier;

			if (duration < 1)
				duration = 1;
			#endregion


			foreach (GamePlayer i_player in caster.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
			{
				if (i_player == caster)
				{
					i_player.MessageToSelf("You cast " + this.Name + "!", eChatType.CT_Spell);
				}
				else
				{
					i_player.MessageFromArea(caster, caster.Name + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
				}

				i_player.Out.SendSpellCastAnimation(caster, 7029, 20);
			}

			m_expireTimerID = new RegionTimer(caster, new RegionTimerCallback(EndCast), 2000);
		}