Пример #1
0
        public override void AddCooldown(Spell spell, Item casterItem)
        {
            bool flag   = casterItem != null && casterItem.Template.UseSpell != null;
            int  millis = 0;

            if (flag)
            {
                millis = casterItem.Template.UseSpell.Cooldown;
            }
            if (millis == 0)
            {
                millis = spell.GetCooldown(this.Owner);
            }
            if (millis <= 0)
            {
                return;
            }
            SpellIdCooldown spellIdCooldown = new SpellIdCooldown()
            {
                SpellId = spell.Id,
                Until   = DateTime.Now + TimeSpan.FromMilliseconds((double)millis)
            };

            if (flag)
            {
                spellIdCooldown.ItemId = casterItem.Template.Id;
            }
            this.m_idCooldowns.Add((ISpellIdCooldown)spellIdCooldown);
            this.OwnerChar.Map.CallDelayed(500,
                                           (Action)(() => Asda2SpellHandler.SendSetSkillCooldownResponse(this.OwnerChar, spell)));
            this.OwnerChar.Map.CallDelayed(millis,
                                           (Action)(() => Asda2SpellHandler.SendClearCoolDown(this.OwnerChar, spell.RealId)));
        }
Пример #2
0
        public override void AddCooldown(Spell spell, Item casterItem)
        {
            var itemSpell = casterItem != null && casterItem.Template.UseSpell != null;

            var cd = 0;

            if (itemSpell)
            {
                cd = casterItem.Template.UseSpell.Cooldown;
            }
            if (cd == 0)
            {
                cd = spell.GetCooldown(Owner);
            }


            if (cd > 0)
            {
                var idCooldown = new SpellIdCooldown
                {
                    SpellId = spell.Id,
                    Until   = (DateTime.Now + TimeSpan.FromMilliseconds(cd))
                };

                if (itemSpell)
                {
                    idCooldown.ItemId = casterItem.Template.Id;
                }
                m_idCooldowns.Add(idCooldown);

                OwnerChar.Map.CallDelayed(500, () => Asda2SpellHandler.SendSetSkillCooldownResponse(OwnerChar, spell));
                OwnerChar.Map.CallDelayed(cd, () => Asda2SpellHandler.SendClearCoolDown(OwnerChar, spell.RealId));
            }
        }
Пример #3
0
        /// <summary>
        /// When NPC Spells cooldown, they get removed from the list of
        /// ready Spells.
        /// </summary>
        public override void AddCooldown(Spell spell, Item item)
        {
            var millis = Math.Max(spell.GetCooldown(Owner), spell.CategoryCooldownTime);

            if (millis <= 0)
            {
                if (spell.CastDelay == 0 && spell.Durations.Max == 0)
                {
                    // no cooldown, no cast delay, no duration: Add default cooldown
                    millis = Owner.Auras.GetModifiedInt(SpellModifierType.CooldownTime, spell, DefaultNPCSpellCooldownMillis);
                    AddCooldown(spell, millis);
                }
            }
            else
            {
                // add existing cooldown
                millis = Owner.Auras.GetModifiedInt(SpellModifierType.CooldownTime, spell, millis);
                AddCooldown(spell, millis);
            }
        }
Пример #4
0
        /// <summary>
        /// When NPC Spells cooldown, they get removed from the list of
        /// ready Spells.
        /// </summary>
        public override void AddCooldown(Spell spell, Item item)
        {
            int num = Math.Max(spell.GetCooldown(this.Owner), spell.CategoryCooldownTime);

            if (num <= 0)
            {
                if (spell.CastDelay != 0U || spell.Durations.Max != 0)
                {
                    return;
                }
                int modifiedInt = this.Owner.Auras.GetModifiedInt(SpellModifierType.CooldownTime, spell,
                                                                  NPCSpellCollection.DefaultNPCSpellCooldownMillis);
                this.AddCooldown(spell, modifiedInt);
            }
            else
            {
                int modifiedInt = this.Owner.Auras.GetModifiedInt(SpellModifierType.CooldownTime, spell, num);
                this.AddCooldown(spell, modifiedInt);
            }
        }
Пример #5
0
		/// <summary>
		/// When NPC Spells cooldown, they get removed from the list of
		/// ready Spells.
		/// </summary>
		public override void AddCooldown(Spell spell, Item item)
		{
			var millis = Math.Max(spell.GetCooldown(Owner), spell.CategoryCooldownTime);
			if (millis <= 0)
			{
				if (spell.CastDelay == 0 && spell.Durations.Max == 0)
				{
					// no cooldown, no cast delay, no duration: Add default cooldown
					millis = Owner.Auras.GetModifiedInt(SpellModifierType.CooldownTime, spell, DefaultNPCSpellCooldownMillis);
					AddCooldown(spell, millis);
				}
			}
			else
			{
				// add existing cooldown
				millis = Owner.Auras.GetModifiedInt(SpellModifierType.CooldownTime, spell, millis);
				AddCooldown(spell, millis);
			}
		}
Пример #6
0
		/// <summary>
		/// When NPC Spells cooldown, they get removed from the list of
		/// ready Spells.
		/// </summary>
		public override void AddCooldown(Spell spell, Item item)
		{
            var millis = Math.Max(spell.GetCooldown(Owner), spell.CategoryCooldownTime);
			ProcessCooldown(spell, millis);
		}
Пример #7
0
        public override void AddCooldown(Spell spell, Item casterItem)
        {
            var itemSpell = casterItem != null && casterItem.Template.UseSpell != null;

            var cd = 0;

            if (itemSpell)
            {
                cd = casterItem.Template.UseSpell.Cooldown;
            }
            if (cd == 0)
            {
                cd = spell.GetCooldown(Owner);
            }

            int catCd;

            if (itemSpell)
            {
                catCd = casterItem.Template.UseSpell.CategoryCooldown;
            }
            else
            {
                catCd = spell.GetModifiedCooldown(Owner, spell.CategoryCooldownTime);
            }

            if (cd > 0)
            {
                var idCooldown = new SpellIdCooldown
                {
                    SpellId = spell.Id,
                    Until   = (DateTime.Now + TimeSpan.FromMilliseconds(cd))
                };

                if (itemSpell)
                {
                    idCooldown.ItemId = casterItem.Template.Id;
                }
                m_idCooldowns.Add(idCooldown);
            }

            if (spell.CategoryCooldownTime > 0)
            {
                var catCooldown = new SpellCategoryCooldown
                {
                    SpellId = spell.Id,
                    Until   = DateTime.Now.AddMilliseconds(catCd)
                };

                if (itemSpell)
                {
                    catCooldown.CategoryId = casterItem.Template.UseSpell.CategoryId;
                    catCooldown.ItemId     = casterItem.Template.Id;
                }
                else
                {
                    catCooldown.CategoryId = spell.Category;
                }
                m_categoryCooldowns.Add(catCooldown);
            }
        }