Beispiel #1
0
 /// <summary>
 /// Returns the delay until the given spell has cooled down in milliseconds
 /// </summary>
 public int GetRemainingCooldownMillis(Spell spell)
 {
     if (this.m_cooldowns == null)
     {
         return(0);
     }
     NPCSpellCollection.CooldownRemoveTimer cooldownRemoveTimer =
         this.m_cooldowns.Find(
             (Predicate <NPCSpellCollection.CooldownRemoveTimer>)(cd => (int)cd.Spell.Id == (int)spell.Id));
     if (cooldownRemoveTimer != null)
     {
         return(cooldownRemoveTimer.GetDelayUntilNextExecution((WorldObject)this.Owner));
     }
     return(0);
 }
Beispiel #2
0
 public override void ClearCooldown(Spell spell, bool alsoCategory = true)
 {
     if (this.m_cooldowns == null)
     {
         return;
     }
     for (int index = 0; index < this.m_cooldowns.Count; ++index)
     {
         NPCSpellCollection.CooldownRemoveTimer cooldown = this.m_cooldowns[index];
         if ((int)cooldown.Spell.Id == (int)spell.Id)
         {
             this.m_cooldowns.Remove(cooldown);
             this.AddReadySpell(cooldown.Spell);
             break;
         }
     }
 }
Beispiel #3
0
 private void AddCooldown(Spell spell, int millis)
 {
     if (millis <= 0)
     {
         return;
     }
     this.m_readySpells.Remove(spell);
     NPCSpellCollection.CooldownRemoveTimer cooldownRemoveTimer =
         new NPCSpellCollection.CooldownRemoveTimer(millis, spell);
     this.Owner.CallDelayed(millis,
                            (Action <WorldObject>)(o => ((NPCSpellCollection)this.Owner.Spells).AddReadySpell(spell)));
     if (this.m_cooldowns == null)
     {
         this.m_cooldowns = new List <NPCSpellCollection.CooldownRemoveTimer>();
     }
     this.m_cooldowns.Add(cooldownRemoveTimer);
 }