Exemple #1
0
        private void RefreshEffectBonus()
        {
            var siteInfo = GetIntrusionSiteInfo();

            var currentEffect = EffectHandler.GetEffectsByCategory(EffectCategory.effcat_intrusion_effect).FirstOrDefault();

            if (currentEffect != null)
            {
                var threshold = GetEffectBonusStabilityThreshold(currentEffect.Type);

                if (siteInfo.Stability < threshold)
                {
                    EffectHandler.Remove(currentEffect);
                    Logger.Info($"Intrusion outpost effect removed. outpost = {Eid} effecttype = {currentEffect.Type}");
                }
            }

            var corporationEid = siteInfo.Owner ?? 0L;

            if (corporationEid == 0L)
            {
                return;
            }

            EffectHandler.RemoveEffectsByCategory(EffectCategory.effcat_intrusion_effect);

            if (siteInfo.ActiveEffect != EffectType.undefined)
            {
                var threshold = GetEffectBonusStabilityThreshold(siteInfo.ActiveEffect);

                if (siteInfo.Stability < threshold)
                {
                    return;
                }

                var builder = NewEffectBuilder().SetType(siteInfo.ActiveEffect).SetOwnerToSource().WithCorporationEid(corporationEid);
                ApplyEffect(builder);
            }
        }