コード例 #1
0
ファイル: CacheData.Buffs.cs プロジェクト: MGramolini/Trinity
            public void UpdateBuffsCache()
            {
                if (!Player.IsValid)
                    return;

                using (new PerformanceLogger("UpdateCachedBuffsData"))
                {
                    if (DateTime.UtcNow.Subtract(LastUpdated).TotalMilliseconds < 250)
                        return;

                    Clear();

                    foreach (var buff in ZetaDia.Me.GetAllBuffs())
                    {
                        if (!buff.IsValid)
                            return;

                        var cachedBuff = new CachedBuff(buff);

                        cachedBuff.VariantId = GetBuffVariantId((SNOPower)cachedBuff.Id);
                        cachedBuff.VariantName = GetBuffVariantName(cachedBuff);

                        // Convention of Elements
                        if (cachedBuff.Id == (int) SNOPower.P2_ItemPassive_Unique_Ring_038)
                        {
                            ConventionElement = (Element)cachedBuff.VariantId;
                        }

                        if(!_buffsById.ContainsKey(buff.SNOId))                      
                            _buffsById.Add(buff.SNOId, cachedBuff);                        

                        _buffs.Add(cachedBuff);
                       
                        Logger.Log(TrinityLogLevel.Debug, LogCategory.CacheManagement,
                            "ActiveBuffs: Id={0} Name={1} Stacks={2} VariantId={3} VariantName={4}", cachedBuff.Id, cachedBuff.InternalName, cachedBuff.StackCount, cachedBuff.VariantId, cachedBuff.VariantName);
                    }

                    LastUpdated = DateTime.UtcNow;

                    Logger.Log(TrinityLogLevel.Debug, LogCategory.CacheManagement,
                        "Refreshed Inventory: ActiveBuffs={0}", ActiveBuffs.Count);
                }

                // Bastians of Will
                HasBastiansWillSpenderBuff = HasBuff(SNOPower.ItemPassive_Unique_Ring_735_x1,2);
                HasBastiansWillGeneratorBuff = HasBuff(SNOPower.ItemPassive_Unique_Ring_735_x1,1);

                // Shrines
                HasBlessedShrine = HasBuff(30476); //Blessed (+25% defence)
                HasFrenzyShrine = HasBuff(30479); //Frenzy  (+25% atk speed)
                HasInvulnerableShrine = HasBuff(SNOPower.Pages_Buff_Invulnerable);
                HasCastingShrine = HasBuff(SNOPower.Pages_Buff_Infinite_Casting);
                HasConduitShrine = HasBuff(SNOPower.Pages_Buff_Electrified);

            }
コード例 #2
0
ファイル: CacheData.Buffs.cs プロジェクト: MGramolini/Trinity
            public string GetBuffVariantName(CachedBuff buff)
            {
                switch (buff.Id)
                {
                    case (int)SNOPower.ItemPassive_Unique_Ring_735_x1: // Bastians of Will
                        return ((ResourceEffectType) buff.VariantId).ToString();

                    case (int)SNOPower.P2_ItemPassive_Unique_Ring_038: // Convention of Elements
                        return ((Element)buff.VariantId).ToString();
                }
                return string.Empty;
            }