public override void OnDelayedWorldLoadFinished() { Overwatch.Log("CleanupCareerOutfitIndices"); foreach (SimDescription sim in Household.EverySimDescription()) { CASParts.CheckIndex(sim, Overwatch.Log); } }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Cleanup Singed"); int count = 0; foreach (SimDescription sim in Household.EverySimDescription()) { int protection = 0; while ((sim.GetOutfitCount(OutfitCategories.Singed) > 1) && (protection < 100)) { sim.RemoveOutfit(OutfitCategories.Singed, sim.GetOutfitCount(OutfitCategories.Singed) - 1, true); protection++; count++; Overwatch.Log("Singed Removed " + sim.FullName); } protection = 0; while ((sim.GetOutfitCount(OutfitCategories.Career) > 3) && (protection < 100)) { // this handles the out of control lab coat's from the generation table sim.RemoveOutfit(OutfitCategories.Career, sim.GetOutfitCount(OutfitCategories.Career) - 1, true); protection++; count++; Overwatch.Log("Career Removed " + sim.FullName); } if (sim.IsBonehilda) { protection = 0; while ((sim.GetOutfitCount(OutfitCategories.Everyday) > 1) && (protection < 100)) { sim.RemoveOutfit(OutfitCategories.Everyday, sim.GetOutfitCount(OutfitCategories.Everyday) - 1, true); protection++; count++; Overwatch.Log("Bonehilda Removed " + sim.FullName); } } // fix corrupt generations outfits ArrayList outfits = sim.GetOutfits(OutfitCategories.ChildImagination); if (outfits != null) { int index = 0; while (index < outfits.Count) { SimOutfit simOutfit = outfits[index] as SimOutfit; if (simOutfit == null) { outfits.RemoveAt(index); } else if (!simOutfit.IsValid) { outfits.RemoveAt(index); } else { index++; } } } // fix corrupt diving outfits ArrayList specialOutfits = sim.GetOutfits(OutfitCategories.Special); if (specialOutfits != null) { int index = 0; while (index < specialOutfits.Count) { SimOutfit simOutfit = specialOutfits[index] as SimOutfit; if (simOutfit == null) { sim.RemoveSpecialOutfitAtIndex(index); } else if (!simOutfit.IsValid) { sim.RemoveSpecialOutfitAtIndex(index); } else { index++; } } } CASParts.CheckIndex(sim, Overwatch.Log); } if ((prompt) && (count > 0)) { Overwatch.AlarmNotify(Common.Localize("CleanupOutfits:Complete", false, new object[] { count })); } } catch (Exception e) { Common.Exception(Name, e); } }