internal static void Postfix(GameObject ___selectedTarget, CollapsibleDetailContentPanel ___immuneSystemPanel, bool __result) { if (__result) { AttributeInstance susceptibility = Db.Get().Attributes.Get(HeartAttackMonitor.ATTRIBUTE_ID).Lookup(___selectedTarget); if (susceptibility != null) { ___immuneSystemPanel.SetLabel(HeartAttackMonitor.ATTRIBUTE_ID, susceptibility.modifier.Name + ": " + GameUtil.GetFormattedPercent(100f * Mathf.Clamp01(susceptibility.GetTotalValue())), susceptibility.GetAttributeValueTooltip()); } } }
private void RefreshBreedingChance() { if ((UnityEngine.Object)selectedTarget == (UnityEngine.Object)null) { fertilityPanel.gameObject.SetActive(false); } else { FertilityMonitor.Instance sMI = selectedTarget.GetSMI <FertilityMonitor.Instance>(); if (sMI == null) { fertilityPanel.gameObject.SetActive(false); } else { int num = 0; foreach (FertilityMonitor.BreedingChance breedingChance in sMI.breedingChances) { List <FertilityModifier> forTag = Db.Get().FertilityModifiers.GetForTag(breedingChance.egg); if (forTag.Count > 0) { string text = string.Empty; foreach (FertilityModifier item in forTag) { text += string.Format(UI.DETAILTABS.EGG_CHANCES.CHANCE_MOD_FORMAT, item.GetTooltip()); } fertilityPanel.SetLabel("breeding_" + num++, string.Format(UI.DETAILTABS.EGG_CHANCES.CHANCE_FORMAT, breedingChance.egg.ProperName(), GameUtil.GetFormattedPercent(breedingChance.weight * 100f, GameUtil.TimeSlice.None)), string.Format(UI.DETAILTABS.EGG_CHANCES.CHANCE_FORMAT_TOOLTIP, breedingChance.egg.ProperName(), GameUtil.GetFormattedPercent(breedingChance.weight * 100f, GameUtil.TimeSlice.None), text)); } else { fertilityPanel.SetLabel("breeding_" + num++, string.Format(UI.DETAILTABS.EGG_CHANCES.CHANCE_FORMAT, breedingChance.egg.ProperName(), GameUtil.GetFormattedPercent(breedingChance.weight * 100f, GameUtil.TimeSlice.None)), string.Format(UI.DETAILTABS.EGG_CHANCES.CHANCE_FORMAT_TOOLTIP_NOMOD, breedingChance.egg.ProperName(), GameUtil.GetFormattedPercent(breedingChance.weight * 100f, GameUtil.TimeSlice.None))); } } fertilityPanel.Commit(); } } }
private void Refresh() { if ((Object)selectedTarget == (Object)null) { return; } List <Descriptor> allDescriptors = GameUtil.GetAllDescriptors(selectedTarget, true); Sicknesses sicknesses = selectedTarget.GetSicknesses(); if (sicknesses != null) { for (int i = 0; i < sicknesses.Count; i++) { allDescriptors.AddRange(sicknesses[i].GetDescriptors()); } } allDescriptors = allDescriptors.FindAll((Descriptor e) => e.type == Descriptor.DescriptorType.DiseaseSource); if (allDescriptors.Count > 0) { for (int j = 0; j < allDescriptors.Count; j++) { CollapsibleDetailContentPanel collapsibleDetailContentPanel = diseaseSourcePanel; string id = "source_" + j.ToString(); Descriptor descriptor = allDescriptors[j]; string text = descriptor.text; Descriptor descriptor2 = allDescriptors[j]; collapsibleDetailContentPanel.SetLabel(id, text, descriptor2.tooltipText); } } if (!CreateImmuneInfo()) { goto IL_00ee; } goto IL_00ee; IL_00ee: if (!CreateDiseaseInfo()) { currentGermsPanel.SetTitle(UI.DETAILTABS.DISEASE.NO_CURRENT_GERMS); currentGermsPanel.SetLabel("nodisease", UI.DETAILTABS.DISEASE.DETAILS.NODISEASE, UI.DETAILTABS.DISEASE.DETAILS.NODISEASE_TOOLTIP); } diseaseSourcePanel.Commit(); immuneSystemPanel.Commit(); currentGermsPanel.Commit(); infoPanel.Commit(); infectionPanel.Commit(); }
public static void Prefix(CollapsibleDetailContentPanel ___immuneSystemPanel, GameObject ___selectedTarget) { if (___selectedTarget == null || ___immuneSystemPanel == null) { return; } var host = ___selectedTarget.GetComponent <GermHost>(); if (host == null) { return; } host.germList.RemoveAll((e) => e == null); host.germList.RemoveAll((e) => e.Id == null); foreach (var germs in host.germList) { if (germs == null) { Debug.Log("germs = null"); continue; } if (germs.Amount < 0.5) { continue; } ___immuneSystemPanel.SetTitle("GERM INFO"); if (Db.Get().Diseases.GetIndex((HashedString)germs.Id) == byte.MaxValue) { Debug.Log("germs.Id = byte.MaxValue"); host.germList.Remove(germs); return; } var germName = Db.Get().Diseases[Db.Get().Diseases.GetIndex((HashedString)germs.Id)].Name; ___immuneSystemPanel.SetLabel("germs_" + germName, "" + (int)germs.Amount + " " + germName + " germs ", "So many germs!"); } }
// Creates the immune system information panel. internal static bool CreateImmuneInfo(CollapsibleDetailContentPanel immuneSystemPanel, GameObject target) { var integrator = target.GetComponent <GermIntegrator>(); bool update = false; if (integrator != null) { var diseases = Db.Get().Diseases; // Create the immune system panel immuneSystemPanel.SetTitle(THRESHOLD_TITLE); immuneSystemPanel.SetLabel("germ_resistance", Db.Get().Attributes. GermResistance.Name + ": " + integrator.GetDupeResistance(), STRINGS. DUPLICANTS.ATTRIBUTES.GERMRESISTANCE.DESC); for (int i = 0; i < diseases.Count; i++) { CreateOneImmuneInfo(diseases[i], target, integrator, immuneSystemPanel); } update = true; } return(update); }
/// <summary> /// Refreshes the Spaced Out rocket module statistics. /// </summary> /// <param name="rocketStatus">The info panel to update.</param> /// <param name="rocket">The currently selected rocket.</param> private static void RefreshRocketStats(CollapsibleDetailContentPanel rocketStatus, CraftModuleInterface rocket) { RocketEngineCluster engine = null; int height = 0, maxHeight = TUNING.ROCKETRY.ROCKET_HEIGHT.MAX_MODULE_STACK_HEIGHT; var modules = rocket.clusterModules; int n = modules.Count; float oxyMass = 0.0f, fuelMass = 0.0f, fuelPerDist = 0.0f, burden = 0.0f, enginePower = 0.0f; var text = CACHED_BUILDER; // Find the engine first for (int i = 0; i < n; i++) { var module = modules[i].Get(); if (module != null && module.TryGetComponent(out engine)) { var perf = module.performanceStats; fuelPerDist = perf.FuelKilogramPerDistance; enginePower = perf.EnginePower; break; } } for (int i = 0; i < n; i++) { var module = modules[i].Get(); if (module != null) { if (engine != null) { // Some engines have built-in fuel tanks if (module.TryGetComponent(out IFuelTank fuelTank)) { fuelMass += fuelTank.Storage.GetAmountAvailable(engine.fuelTag); } // Do not exclude future combo LF/O tanks from mods ;) if (engine.requireOxidizer && module.TryGetComponent( out OxidizerTank oxyTank)) { oxyMass += oxyTank.TotalOxidizerPower; } } if (module.TryGetComponent(out Building building)) { height += building.Def.HeightInCells; } burden += module.performanceStats.Burden; } } // Range string tooltip = GetRangeLeft(engine, Mathf.Ceil(fuelMass), Mathf.Ceil(oxyMass), fuelPerDist); rocketStatus.SetLabel("RangeRemaining", text.ToString(), tooltip); // Speed tooltip = GetSpeed(rocket, enginePower, burden); rocketStatus.SetLabel("Speed", text.ToString(), tooltip); if (engine != null) { maxHeight = engine.maxHeight; } // Height string maxHeightStr = maxHeight.ToString(); tooltip = text.Clear().Append(ROCKETS.MAX_HEIGHT.TOOLTIP).Replace("{0}", engine.GetProperName()).Replace("{1}", maxHeightStr).ToString(); text.Clear().Append(ROCKETS.MAX_HEIGHT.NAME).Replace("{0}", height. ToString()).Replace("{1}", maxHeightStr); rocketStatus.SetLabel("MaxHeight", text.ToString(), tooltip); }
// Creates one line of the immune system information panel. private static void CreateOneImmuneInfo(Disease disease, GameObject target, GermIntegrator integrator, CollapsibleDetailContentPanel panel) { var exposure = GameUtil.GetExposureTypeForDisease(disease); var sickness = GameUtil.GetSicknessForDisease(disease); ICollection <string> required = exposure.required_traits, excluded = exposure. excluded_traits, noEffects = exposure.excluded_effects; var traits = target.GetComponent <Traits>(); var effects = target.GetComponent <Effects>(); // The part we actually changed float threshold = Mathf.Ceil(GermIntegrator.AdjustedThreshold(GermExposureTuning. ThresholdsFor(exposure).GetMinThreshold(), integrator.GetResistance(exposure))); string tooltip = ""; // Check for required traits to catch the disease if (required != null && required.Count > 0) { string traitList = ""; foreach (string trait in required) { if (!traits.HasTrait(trait)) { if (traitList.Length > 0) { traitList += ", "; } traitList += Db.Get().traits.Get(trait).Name; } } if (traitList.Length > 0) { // Immune: missing required traits threshold = 0.0f; tooltip = string.Format(STRINGS.DUPLICANTS.DISEASES. IMMUNE_FROM_MISSING_REQUIRED_TRAIT, traitList); } } // Check for traits that prevent catching it if (excluded != null && excluded.Count > 0) { string traitList = ""; foreach (string trait in excluded) { if (traits.HasTrait(trait)) { if (traitList.Length > 0) { traitList += ", "; } traitList += Db.Get().traits.Get(trait).Name; } } if (traitList.Length > 0) { // Immune: blocking trait threshold = 0.0f; if (tooltip.Length > 0) { tooltip += "\n"; } tooltip += string.Format(STRINGS.DUPLICANTS.DISEASES. IMMUNE_FROM_HAVING_EXLCLUDED_TRAIT, traitList); } } // Check for effects that prevent catching it if (noEffects != null && noEffects.Count > 0) { string effectList = ""; foreach (string effect in noEffects) { if (effects.HasEffect(effect)) { if (effectList.Length > 0) { effectList += ", "; } effectList += Db.Get().effects.Get(effect).Name; } } if (effectList.Length > 0) { // Immune: blocking effect threshold = 0.0f; if (tooltip.Length > 0) { tooltip += "\n"; } tooltip += string.Format(STRINGS.DUPLICANTS.DISEASES. IMMUNE_FROM_HAVING_EXCLUDED_EFFECT, effectList); } } // Update the label and tooltip if (tooltip.Length == 0) { if (threshold > 1.0f) { tooltip = string.Format(THRESHOLD_TOOLTIP, GameUtil.GetFormattedSimple( threshold), target.GetProperName(), sickness.Name); } else { tooltip = string.Format(THRESHOLD_TOOLTIP_1, target.GetProperName(), sickness.Name); } } panel.SetLabel("disease_" + disease.Id, " • " + disease.Name + ": " + (threshold == 0.0f ? THRESHOLD_IMMUNE.text : GameUtil.GetFormattedSimple( threshold)), tooltip); }
private void BuildFactorsStrings(int diseaseCount, int elementIdx, int environmentCell, float environmentMass, float temperature, HashSet <Tag> tags, Disease disease) { currentGermsPanel.SetTitle(string.Format(UI.DETAILTABS.DISEASE.CURRENT_GERMS, disease.Name.ToUpper())); currentGermsPanel.SetLabel("currentgerms", string.Format(UI.DETAILTABS.DISEASE.DETAILS.DISEASE_AMOUNT, disease.Name, GameUtil.GetFormattedDiseaseAmount(diseaseCount)), string.Format(UI.DETAILTABS.DISEASE.DETAILS.DISEASE_AMOUNT_TOOLTIP, GameUtil.GetFormattedDiseaseAmount(diseaseCount))); Element e = ElementLoader.elements[elementIdx]; CompositeGrowthRule growthRuleForElement = disease.GetGrowthRuleForElement(e); float tags_multiplier_base = 1f; if (tags != null && tags.Count > 0) { tags_multiplier_base = disease.GetGrowthRateForTags(tags, (float)diseaseCount > growthRuleForElement.maxCountPerKG * environmentMass); } float num = DiseaseContainers.CalculateDelta(diseaseCount, elementIdx, environmentMass, environmentCell, temperature, tags_multiplier_base, disease, 1f); currentGermsPanel.SetLabel("finaldelta", string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.RATE_OF_CHANGE, GameUtil.GetFormattedSimple(num, GameUtil.TimeSlice.PerSecond, "F0")), string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.RATE_OF_CHANGE_TOOLTIP, GameUtil.GetFormattedSimple(num, GameUtil.TimeSlice.PerSecond, "F0"))); float num2 = Disease.GrowthRateToHalfLife(1f - num / (float)diseaseCount); if (num2 > 0f) { currentGermsPanel.SetLabel("finalhalflife", string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.HALF_LIFE_NEG, GameUtil.GetFormattedCycles(num2, "F1")), string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.HALF_LIFE_NEG_TOOLTIP, GameUtil.GetFormattedCycles(num2, "F1"))); } else if (num2 < 0f) { currentGermsPanel.SetLabel("finalhalflife", string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.HALF_LIFE_POS, GameUtil.GetFormattedCycles(0f - num2, "F1")), string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.HALF_LIFE_POS_TOOLTIP, GameUtil.GetFormattedCycles(num2, "F1"))); } else { currentGermsPanel.SetLabel("finalhalflife", UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.HALF_LIFE_NEUTRAL, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.HALF_LIFE_NEUTRAL_TOOLTIP); } currentGermsPanel.SetLabel("factors", string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.TITLE), UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.TOOLTIP); bool flag = false; if ((float)diseaseCount < growthRuleForElement.minCountPerKG * environmentMass) { currentGermsPanel.SetLabel("critical_status", string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.DYING_OFF.TITLE, GetFormattedGrowthRate(0f - growthRuleForElement.underPopulationDeathRate)), string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.DYING_OFF.TOOLTIP, GameUtil.GetFormattedDiseaseAmount(Mathf.RoundToInt(growthRuleForElement.minCountPerKG * environmentMass)), GameUtil.GetFormattedMass(environmentMass, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"), growthRuleForElement.minCountPerKG)); flag = true; } else if ((float)diseaseCount > growthRuleForElement.maxCountPerKG * environmentMass) { currentGermsPanel.SetLabel("critical_status", string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.OVERPOPULATED.TITLE, GetFormattedHalfLife(growthRuleForElement.overPopulationHalfLife)), string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.OVERPOPULATED.TOOLTIP, GameUtil.GetFormattedDiseaseAmount(Mathf.RoundToInt(growthRuleForElement.maxCountPerKG * environmentMass)), GameUtil.GetFormattedMass(environmentMass, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"), growthRuleForElement.maxCountPerKG)); flag = true; } if (!flag) { currentGermsPanel.SetLabel("substrate", GetFormattedGrowthEntry(growthRuleForElement.Name(), growthRuleForElement.populationHalfLife, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.DIE, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.GROW, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.NEUTRAL), GetFormattedGrowthEntry(growthRuleForElement.Name(), growthRuleForElement.populationHalfLife, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.DIE_TOOLTIP, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.GROW_TOOLTIP, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.NEUTRAL_TOOLTIP)); } int num3 = 0; if (tags != null) { foreach (Tag tag in tags) { TagGrowthRule growthRuleForTag = disease.GetGrowthRuleForTag(tag); if (growthRuleForTag != null) { CollapsibleDetailContentPanel collapsibleDetailContentPanel = currentGermsPanel; string id = "tag_" + num3; string name = growthRuleForTag.Name(); float? populationHalfLife = growthRuleForTag.populationHalfLife; string formattedGrowthEntry = GetFormattedGrowthEntry(name, populationHalfLife.Value, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.DIE, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.GROW, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.NEUTRAL); string name2 = growthRuleForTag.Name(); float? populationHalfLife2 = growthRuleForTag.populationHalfLife; collapsibleDetailContentPanel.SetLabel(id, formattedGrowthEntry, GetFormattedGrowthEntry(name2, populationHalfLife2.Value, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.DIE_TOOLTIP, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.GROW_TOOLTIP, UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.SUBSTRATE.NEUTRAL_TOOLTIP)); } num3++; } } if (Grid.IsValidCell(environmentCell)) { CompositeExposureRule exposureRuleForElement = disease.GetExposureRuleForElement(Grid.Element[environmentCell]); if (exposureRuleForElement != null && exposureRuleForElement.populationHalfLife != float.PositiveInfinity) { if (exposureRuleForElement.GetHalfLifeForCount(diseaseCount) > 0f) { currentGermsPanel.SetLabel("environment", string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.ENVIRONMENT.TITLE, exposureRuleForElement.Name(), GetFormattedHalfLife(exposureRuleForElement.GetHalfLifeForCount(diseaseCount))), UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.ENVIRONMENT.DIE_TOOLTIP); } else { currentGermsPanel.SetLabel("environment", string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.ENVIRONMENT.TITLE, exposureRuleForElement.Name(), GetFormattedHalfLife(exposureRuleForElement.GetHalfLifeForCount(diseaseCount))), UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.ENVIRONMENT.GROW_TOOLTIP); } } } float num4 = disease.CalculateTemperatureHalfLife(temperature); if (num4 != float.PositiveInfinity) { if (num4 > 0f) { currentGermsPanel.SetLabel("temperature", string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.TEMPERATURE.TITLE, GameUtil.GetFormattedTemperature(temperature, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false), GetFormattedHalfLife(num4)), UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.TEMPERATURE.DIE_TOOLTIP); } else { currentGermsPanel.SetLabel("temperature", string.Format(UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.TEMPERATURE.TITLE, GameUtil.GetFormattedTemperature(temperature, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false), GetFormattedHalfLife(num4)), UI.DETAILTABS.DISEASE.DETAILS.GROWTH_FACTORS.TEMPERATURE.GROW_TOOLTIP); } } }
private bool CreateImmuneInfo() { GermExposureMonitor.Instance sMI = selectedTarget.GetSMI <GermExposureMonitor.Instance>(); if (sMI != null) { immuneSystemPanel.SetTitle(UI.DETAILTABS.DISEASE.CONTRACTION_RATES); immuneSystemPanel.SetLabel("germ_resistance", Db.Get().Attributes.GermResistance.Name + ": " + sMI.GetGermResistance(), DUPLICANTS.ATTRIBUTES.GERMRESISTANCE.DESC); for (int i = 0; i < Db.Get().Diseases.Count; i++) { Disease disease = Db.Get().Diseases[i]; ExposureType exposureTypeForDisease = GameUtil.GetExposureTypeForDisease(disease); Sickness sicknessForDisease = GameUtil.GetSicknessForDisease(disease); bool flag = true; List <string> list = new List <string>(); if (exposureTypeForDisease.required_traits != null && exposureTypeForDisease.required_traits.Count > 0) { for (int j = 0; j < exposureTypeForDisease.required_traits.Count; j++) { if (!selectedTarget.GetComponent <Traits>().HasTrait(exposureTypeForDisease.required_traits[j])) { list.Add(exposureTypeForDisease.required_traits[j]); } } if (list.Count > 0) { flag = false; } } bool flag2 = false; List <string> list2 = new List <string>(); if (exposureTypeForDisease.excluded_effects != null && exposureTypeForDisease.excluded_effects.Count > 0) { for (int k = 0; k < exposureTypeForDisease.excluded_effects.Count; k++) { if (selectedTarget.GetComponent <Effects>().HasEffect(exposureTypeForDisease.excluded_effects[k])) { list2.Add(exposureTypeForDisease.excluded_effects[k]); } } if (list2.Count > 0) { flag2 = true; } } bool flag3 = false; List <string> list3 = new List <string>(); if (exposureTypeForDisease.excluded_traits != null && exposureTypeForDisease.excluded_traits.Count > 0) { for (int l = 0; l < exposureTypeForDisease.excluded_traits.Count; l++) { if (selectedTarget.GetComponent <Traits>().HasTrait(exposureTypeForDisease.excluded_traits[l])) { list3.Add(exposureTypeForDisease.excluded_traits[l]); } } if (list3.Count > 0) { flag3 = true; } } string text = string.Empty; float num; if (!flag) { num = 0f; string text2 = string.Empty; for (int m = 0; m < list.Count; m++) { if (text2 != string.Empty) { text2 += ", "; } text2 += Db.Get().traits.Get(list[m]).Name; } text += string.Format(DUPLICANTS.DISEASES.IMMUNE_FROM_MISSING_REQUIRED_TRAIT, text2); } else if (flag3) { num = 0f; string text3 = string.Empty; for (int n = 0; n < list3.Count; n++) { if (text3 != string.Empty) { text3 += ", "; } text3 += Db.Get().traits.Get(list3[n]).Name; } if (text != string.Empty) { text += "\n"; } text += string.Format(DUPLICANTS.DISEASES.IMMUNE_FROM_HAVING_EXLCLUDED_TRAIT, text3); } else if (flag2) { num = 0f; string text4 = string.Empty; for (int num2 = 0; num2 < list2.Count; num2++) { if (text4 != string.Empty) { text4 += ", "; } text4 += Db.Get().effects.Get(list2[num2]).Name; } if (text != string.Empty) { text += "\n"; } text += string.Format(DUPLICANTS.DISEASES.IMMUNE_FROM_HAVING_EXCLUDED_EFFECT, text4); } else { num = ((!exposureTypeForDisease.infect_immediately) ? GermExposureMonitor.GetContractionChance(sMI.GetResistanceToExposureType(exposureTypeForDisease, 3f)) : 1f); } string arg = (!(text != string.Empty)) ? string.Format(DUPLICANTS.DISEASES.CONTRACTION_PROBABILITY, GameUtil.GetFormattedPercent(num * 100f, GameUtil.TimeSlice.None), selectedTarget.GetProperName(), sicknessForDisease.Name) : text; immuneSystemPanel.SetLabel("disease_" + disease.Id, " • " + disease.Name + ": " + GameUtil.GetFormattedPercent(num * 100f, GameUtil.TimeSlice.None), string.Format(DUPLICANTS.DISEASES.RESISTANCES_PANEL_TOOLTIP, arg, sicknessForDisease.Name)); } return(true); } return(false); }