public static bool HasActiveMagicEffect(this Player player, string effectType) { return(null != EquipmentEffectCache.Get(player, effectType, () => { List <MagicItemEffect> allEffects = player.GetAllActiveMagicEffects(effectType); return allEffects.Count > 0 ? (float?)allEffects.Select(x => x.EffectValue).Sum() : null; })); }
public static float GetTotalActiveMagicEffectValue(this Player player, string effectType, float scale = 1.0f) { return(scale * (EquipmentEffectCache.Get(player, effectType, () => { List <MagicItemEffect> allEffects = player.GetAllActiveMagicEffects(effectType); return allEffects.Count > 0 ? (float?)allEffects.Select(x => x.EffectValue).Sum() : null; }) ?? 0)); }