private IntestinalParasitesSaveDataProxy ConvertBackIntestinalParasites(IntestinalParasitesSaveDataProxy proxy, Dictionary <AfflictionType, List <Affliction> > afflictionDict) { proxy = proxy ?? new IntestinalParasitesSaveDataProxy(); var parasites = (IntestinalParasites)afflictionDict.Get(AfflictionType.IntestinalParasites)?[0]; var parasitesRisk = (IntestinalParasites)afflictionDict.Get(AfflictionType.IntestinalParasitesRisk)?[0]; if (parasites == null && parasitesRisk == null) { return((proxy.m_HasParasites || proxy.m_HasParasiteRisk) ? new IntestinalParasitesSaveDataProxy() : proxy); } if (parasites != null) { proxy.m_CurrentInfectionChance = 80; proxy.m_DayToAllowNextDose = 0; proxy.m_HasParasiteRisk = false; proxy.m_HasParasites = true; proxy.m_HasTakenDoseToday = false; proxy.m_NumDosesTaken = 0; proxy.m_NumPiecesEatenThisRiskCycle = 0; proxy.m_ParasitesElapsedHours = 0; proxy.m_RiskDurationHours = 0; proxy.m_RiskElapsedHours = 0; } else { proxy.m_CurrentInfectionChance = 40; proxy.m_DayToAllowNextDose = 0; proxy.m_HasParasiteRisk = true; proxy.m_HasParasites = false; proxy.m_HasTakenDoseToday = false; proxy.m_NumDosesTaken = 0; proxy.m_NumPiecesEatenThisRiskCycle = 0; proxy.m_ParasitesElapsedHours = 0; proxy.m_RiskDurationHours = 0; proxy.m_RiskElapsedHours = 0; } return(proxy); }
private void ConvertIntestinalParasites(IntestinalParasitesSaveDataProxy proxy) { if (proxy == null) { return; } if (proxy.m_HasParasites || proxy.m_HasParasiteRisk) { var affliction = proxy.m_HasParasites ? AfflictionType.IntestinalParasites : AfflictionType.IntestinalParasitesRisk; Negative.Add(new IntestinalParasites(negative) { AfflictionType = affliction, Location = 7, CurrentInfectionChance = proxy.m_CurrentInfectionChance, DayToAllowNextDose = proxy.m_DayToAllowNextDose, DosesTaken = proxy.m_NumDosesTaken, HasTakenDoseToday = proxy.m_HasTakenDoseToday, ParasitesElapsedHours = proxy.m_ParasitesElapsedHours, PiecesEatenThisRiskCycle = proxy.m_NumPiecesEatenThisRiskCycle, RiskDurationHours = proxy.m_RiskDurationHours, RiskElapsedHours = proxy.m_RiskElapsedHours, }); } }