protected static void EnactCorrections(Collecting skill) { Overwatch.Log(" Correcting: " + skill.SkillOwner.FullName); if (skill.mGlowBugData == null) { skill.mGlowBugData = new Dictionary<Sims3.Gameplay.Objects.Insect.InsectType, Collecting.GlowBugStats>(); Overwatch.Log(" GlowBugData Fixed"); } if (skill.mMushroomData == null) { skill.mMushroomData = new Dictionary<string, Collecting.MushroomStats>(); Overwatch.Log(" MushroomData Fixed"); } if (skill.mHarvestData == null) { skill.mHarvestData = new Dictionary<string, Collecting.HarvestStats>(); Overwatch.Log(" HarvestData Fixed"); } if (skill.mMetalData != null) { List<RockGemMetal> remove = new List<RockGemMetal>(); foreach (KeyValuePair<RockGemMetal, Collecting.MetalStats> data in skill.mMetalData) { if (data.Value.count == 0) { remove.Add(data.Key); } } foreach (RockGemMetal metal in remove) { skill.mMetalData.Remove(metal); } } Gardening gardening = skill.SkillOwner.SkillManager.GetSkill<Gardening>(SkillNames.Gardening); if ((gardening != null) && (gardening.mHarvestCounts.Count != 0)) { bool success = false; foreach (KeyValuePair<string, Gardening.PlantInfo> plants in gardening.mHarvestCounts) { string ingredient = null; foreach (IngredientData choice in IngredientData.IngredientDataList) { if (choice.PlantName == plants.Key) { ingredient = choice.mStringKey; break; } } if (string.IsNullOrEmpty(ingredient)) continue; Collecting.HarvestStats data = null; if (!skill.mHarvestData.TryGetValue(ingredient, out data)) { data = new Collecting.HarvestStats(); skill.mHarvestData.Add(ingredient, data); data.quality = (int)plants.Value.BestQuality; if (data.quality <= 0) { data.quality = (int)Quality.Bad; } } else { if (data.quality < (int)plants.Value.BestQuality) { data.quality = (int)plants.Value.BestQuality; } if (data.count >= plants.Value.HarvestablesCount) continue; } if (data.mostExpensive < plants.Value.MostExpensive) { data.mostExpensive = plants.Value.MostExpensive; } if (data.count < plants.Value.HarvestablesCount) { data.count = plants.Value.HarvestablesCount; } success = true; } if (success) { Overwatch.Log(" HarvestData Reconciled"); } } }
protected static void EnactCorrections(Collecting skill) { Overwatch.Log(" Correcting: " + skill.SkillOwner.FullName); if (skill.mGlowBugData == null) { skill.mGlowBugData = new Dictionary <Sims3.Gameplay.Objects.Insect.InsectType, Collecting.GlowBugStats>(); Overwatch.Log(" GlowBugData Fixed"); } if (skill.mMushroomData == null) { skill.mMushroomData = new Dictionary <string, Collecting.MushroomStats>(); Overwatch.Log(" MushroomData Fixed"); } if (skill.mHarvestData == null) { skill.mHarvestData = new Dictionary <string, Collecting.HarvestStats>(); Overwatch.Log(" HarvestData Fixed"); } if (skill.mMetalData != null) { List <RockGemMetal> remove = new List <RockGemMetal>(); foreach (KeyValuePair <RockGemMetal, Collecting.MetalStats> data in skill.mMetalData) { if (data.Value.count == 0) { remove.Add(data.Key); } } foreach (RockGemMetal metal in remove) { skill.mMetalData.Remove(metal); } } Gardening gardening = skill.SkillOwner.SkillManager.GetSkill <Gardening>(SkillNames.Gardening); if ((gardening != null) && (gardening.mHarvestCounts.Count != 0)) { bool success = false; foreach (KeyValuePair <string, Gardening.PlantInfo> plants in gardening.mHarvestCounts) { string ingredient = null; foreach (IngredientData choice in IngredientData.IngredientDataList) { if (choice.PlantName == plants.Key) { ingredient = choice.mStringKey; break; } } if (string.IsNullOrEmpty(ingredient)) { continue; } Collecting.HarvestStats data = null; if (!skill.mHarvestData.TryGetValue(ingredient, out data)) { data = new Collecting.HarvestStats(); skill.mHarvestData.Add(ingredient, data); data.quality = (int)plants.Value.BestQuality; if (data.quality <= 0) { data.quality = (int)Quality.Bad; } } else { if (data.quality < (int)plants.Value.BestQuality) { data.quality = (int)plants.Value.BestQuality; } if (data.count >= plants.Value.HarvestablesCount) { continue; } } if (data.mostExpensive < plants.Value.MostExpensive) { data.mostExpensive = plants.Value.MostExpensive; } if (data.count < plants.Value.HarvestablesCount) { data.count = plants.Value.HarvestablesCount; } success = true; } if (success) { Overwatch.Log(" HarvestData Reconciled"); } } }