Ejemplo n.º 1
0
    public void AddCooldown(int spellId, float cooldownEnd)
    {
        CooldownEntry cooldownEntry = new CooldownEntry(spellId, cooldownEnd);

        if (SpellCooldowns.ContainsKey(spellId))
        {
            SpellCooldowns[spellId] = cooldownEntry;
        }
        else
        {
            SpellCooldowns.Add(spellId, cooldownEntry);
        }
    }
Ejemplo n.º 2
0
        public void LoadFromDB <T>(SQLResult cooldownsResult, SQLResult chargesResult) where T : WorldObject
        {
            if (!cooldownsResult.IsEmpty())
            {
                do
                {
                    uint spellId = cooldownsResult.Read <uint>(0);
                    if (!Global.SpellMgr.HasSpellInfo(spellId))
                    {
                        continue;
                    }

                    int index = (typeof(T) == typeof(Pet) ? 1 : 2);

                    CooldownEntry cooldownEntry = new CooldownEntry();
                    cooldownEntry.SpellId     = spellId;
                    cooldownEntry.CooldownEnd = Time.UnixTimeToDateTime(cooldownsResult.Read <uint>(index++));
                    cooldownEntry.ItemId      = 0;
                    cooldownEntry.CategoryId  = cooldownsResult.Read <uint>(index++);
                    cooldownEntry.CategoryEnd = Time.UnixTimeToDateTime(cooldownsResult.Read <uint>(index++));

                    _spellCooldowns[spellId] = cooldownEntry;
                    if (cooldownEntry.CategoryId != 0)
                    {
                        _categoryCooldowns[cooldownEntry.CategoryId] = _spellCooldowns[spellId];
                    }
                } while (cooldownsResult.NextRow());
            }

            if (!chargesResult.IsEmpty())
            {
                do
                {
                    uint categoryId = chargesResult.Read <uint>(0);

                    if (!CliDB.SpellCategoryStorage.ContainsKey(categoryId))
                    {
                        continue;
                    }

                    ChargeEntry charges;
                    charges.RechargeStart = Time.UnixTimeToDateTime(chargesResult.Read <uint>(1));
                    charges.RechargeEnd   = Time.UnixTimeToDateTime(chargesResult.Read <uint>(2));
                    _categoryCharges.Add(categoryId, charges);
                } while (chargesResult.NextRow());
            }
        }
Ejemplo n.º 3
0
        public void AddCooldown(uint spellId, uint itemId, DateTime cooldownEnd, uint categoryId, DateTime categoryEnd, bool onHold = false)
        {
            CooldownEntry cooldownEntry = new CooldownEntry();

            cooldownEntry.SpellId     = spellId;
            cooldownEntry.CooldownEnd = cooldownEnd;
            cooldownEntry.ItemId      = itemId;
            cooldownEntry.CategoryId  = categoryId;
            cooldownEntry.CategoryEnd = categoryEnd;
            cooldownEntry.OnHold      = onHold;
            _spellCooldowns[spellId]  = cooldownEntry;

            if (categoryId != 0)
            {
                _categoryCooldowns[categoryId] = cooldownEntry;
            }
        }