Beispiel #1
0
    public void LoadList(IEnumerable <string> keyValues)
    {
        var effects = new List <EffectData>();

        foreach (var keyValue in keyValues)
        {
            var parts            = keyValue.Split(',');
            var effectTemplateId = parts[0];
            var amount           = parts.Length > 0 ? parts[1] : null;

            var effectTemplateData = CriticalEffectsFeature.GetEffectData(effectTemplateId);
            if (effectTemplateData == null)
            {
                continue;
            }

            var data = effectTemplateData.ToJSON() !;
            if (amount != null)
            {
                data = data.Replace("{amt}", amount);
            }
            var effect = new EffectData();
            effect.FromJSON(data);
            effects.Add(effect);
        }
        Def.statusEffects = Def.statusEffects.Union(effects).ToArray();
    }
Beispiel #2
0
        internal static bool ProcessLocationalEffectData(ref EffectData effect, MechComponent mechComponent)
        {
            if (effect.effectType == EffectType.StatisticEffect &&
                LocationNaming.IsLocational(effect.Description.Id) &&
                LocationNaming.Create(mechComponent, out var naming))
            {
                var data = effect.ToJSON();
                effect = new EffectData();
                effect.FromJSON(data);

                Control.mod.Logger.LogDebug($"Replacing location in {effect.Description.Id} with {naming.LocationId}");

                effect.statisticData.statName = naming.InterpolateStatisticName(effect.statisticData.statName);

                effect.Description = new BaseDescriptionDef(
                    naming.InterpolateEffectId(effect.Description.Id),
                    naming.InterpolateText(effect.Description.Name),
                    naming.InterpolateText(effect.Description.Details),
                    naming.InterpolateText(effect.Description.Icon)
                    );

                return(true);
            }

            return(false);
        }
Beispiel #3
0
        public void initialize()
        {
            UidManager.reset();
            quirks = new Dictionary <string, PilotQuirk>();
            foreach (PilotQuirk pilotQuirk in Main.settings.pilotQuirks)
            {
                foreach (JObject jObject in pilotQuirk.effectData)
                {
                    EffectData effectData = new EffectData();
                    effectData.FromJSON(jObject.ToString());
                    pilotQuirk.effects.Add(effectData);
                }

                quirks.Add(pilotQuirk.tag, pilotQuirk);
            }
            quirkPools = new Dictionary <string, QuirkPool>();
            foreach (QuirkPool quirkPool in Main.settings.quirkPools)
            {
                quirkPools.Add(quirkPool.tag, quirkPool);
            }
        }