protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log(GetTitlePrefix()); int count = 0; List <MultiImageObject> digital = new List <MultiImageObject>(Sims3.Gameplay.Queries.GetObjects <MultiImageObject>()); foreach (MultiImageObject obj in digital) { if (obj.mAlarmNextSlide == AlarmHandle.kInvalidHandle) { continue; } obj.StopSlideShow(); obj.StartSlideShow(); count++; } if (count > 0) { Overwatch.AlarmNotify(Common.Localize(GetTitlePrefix() + ":Success", false, new object[] { count })); } } catch (Exception exception) { Common.Exception(Name, exception); } }
protected override void PrivatePerformAction(bool prompt) { Overwatch.Log("Delete All Magical Gnomes"); int count = 0; try { foreach (MagicGnomeBase gnome in Sims3.Gameplay.Queries.GetObjects <MagicGnomeBase>()) { if (!gnome.DestroyOnGrab) { gnome.Dispose(); gnome.Destroy(); count++; } } foreach (GnomeMemorial memorial in Sims3.Gameplay.Queries.GetObjects <GnomeMemorial>()) { memorial.Dispose(); memorial.Destroy(); count++; } if ((prompt) || (count > 0)) { Overwatch.AlarmNotify(Common.Localize("DeleteAllMagicalGnomes:Success", false, new object[] { count })); } } catch (Exception e) { Common.Exception(Name, e); } }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Turn Off Televisions"); int count = 0; List <TV> televisions = new List <TV>(Sims3.Gameplay.Queries.GetObjects <TV>()); foreach (TV obj in televisions) { if ((!NRaas.Overwatch.Settings.mAffectActiveLot) && (Household.ActiveHousehold != null)) { if (obj.LotCurrent.Household == Household.ActiveHousehold) { continue; } bool found = false; foreach (Sim sim in Households.AllSims(Household.ActiveHousehold)) { if (sim.LotCurrent == obj.LotCurrent) { found = true; break; } } if (found) { continue; } } if (obj.TurnedOn) { try { obj.ClearStateInformation(); obj.TurnOff(); count++; } catch { obj.SetObjectToReset(); } } } if (count > 0) { Overwatch.AlarmNotify(Common.Localize("TurnOffTelevisions:Success", false, new object[] { count })); } } catch (Exception exception) { Common.Exception(Name, exception); } }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Recover Missing Sims"); string msg = null; List <Sim> sims = new List <Sim>(LotManager.Actors); foreach (Sim sim in sims) { SimDescription simDesc = sim.SimDescription; if (simDesc == null) { continue; } if ((!sim.SimDescription.IsValidDescription) || (sim.Household == null)) { try { GreyedOutTooltipCallback callback = null; if (RecoverMissingSimTask.Allowed(sim.SimDescription, false, ref callback)) { simDesc.Fixup(); if (Instantiation.AttemptToPutInSafeLocation(sim, true)) { sim.Autonomy.Motives.RecreateMotives(sim); sim.SetObjectToReset(); } msg += Common.NewLine + simDesc.FullName; } } catch (Exception e) { Common.Exception(simDesc, e); } } } List <Household> houses = new List <Household>(Household.sHouseholdList); foreach (Household house in houses) { msg += Perform(house, prompt); } if ((msg != null) && (msg != "")) { Overwatch.AlarmNotify(Common.Localize("RecoverMissingSims:Success", false, new object[] { msg })); } } catch (Exception exception) { Common.Exception(Name, exception); } }
protected override void PrivatePerformAction(bool prompt) { Overwatch.Log(Name); List <Relationship> fullList = new List <Relationship>(); int count = 0; foreach (SimDescription sim in new List <SimDescription>(Relationship.sAllRelationships.Keys)) { count += Corrections.CleanupRelationship(sim, Overwatch.Log); } foreach (Relationship relation in fullList) { if (Relationships.RepairRelationship(relation, Overwatch.Log)) { count++; } } foreach (SimDescription sim in Household.EverySimDescription()) { if (sim.Partner == null) { continue; } if (!sim.Partner.IsValidDescription) { sim.mPartner = null; Overwatch.Log("Partner Relationship Dropped: " + sim.FullName); count++; } else { Relationship relation = Relationship.Get(sim, sim.Partner, false); if (relation == null) { relation = Relationship.Get(sim, sim.Partner, true); relation.MakeAcquaintances(); Overwatch.Log("Partner Relationship Corrected: " + sim.FullName); count++; } } } if ((prompt) || (count > 0)) { Overwatch.AlarmNotify(Common.Localize(GetTitlePrefix() + ":Success", false, new object[] { count })); } }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Cleanup Concert"); foreach (ShowVenue obj in Sims3.Gameplay.Queries.GetObjects <ShowVenue>()) { Overwatch.Log("Reset " + obj.ShowType); foreach (ISearchLight light in obj.LotCurrent.GetObjects <ISearchLight>()) { try { light.TurnOff(); } catch { } SearchLight searchLight = light as SearchLight; if (searchLight != null) { try { searchLight.mSMC.Dispose(); } catch { } searchLight.mSMC = null; } } obj.EndPlayerConcert(); } if (prompt) { Overwatch.AlarmNotify(Common.Localize("CleanupConcert:Complete")); } } catch (Exception e) { Common.Exception(Name, e); } }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Reset All Gnomes"); int count = 0; foreach (MagicGnomeBase gnome in Sims3.Gameplay.Queries.GetObjects <MagicGnomeBase>()) { if (gnome.IsAngry) { continue; } if (gnome.LotCurrent == null) { continue; } if (gnome.LotCurrent.AlarmManager.GetTimeLeft(gnome.mTrickeryAlarm, TimeUnit.Minutes) > 0) { continue; } gnome.IsAngry = false; count++; } if ((prompt) || (count > 0)) { Overwatch.AlarmNotify(Common.Localize("ResetAllGnomes:Success", false, new object[] { count })); } } catch (Exception e) { Common.Exception(Name, e); } }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Cleanse The Dead"); Dictionary <SimDescription, Pair <IMausoleum, Urnstone> > urnstones = new Dictionary <SimDescription, Pair <IMausoleum, Urnstone> >(); CommonSpace.Helpers.CleanseTheDead.Retrieve(urnstones); List <SimDescription> choices = new List <SimDescription>(); if (Overwatch.Settings.mCompressFamilyLevel > 0) { foreach (SimDescription choice in urnstones.Keys) { if (Genealogies.GetFamilyLevel(choice.Genealogy) >= Overwatch.Settings.mCompressFamilyLevel) { choices.Add(choice); } } } else { choices.AddRange(urnstones.Keys); } CommonSpace.Helpers.CleanseTheDead.Cleanse(choices, urnstones, true, Overwatch.Log); if ((choices.Count > 0) || (prompt)) { Overwatch.AlarmNotify(Common.Localize("CleanseTheDead:Complete", false, new object[] { choices.Count })); } } catch (Exception e) { Common.Exception(Name, e); } }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Purge Genetic Hair"); if ((!prompt) || (AcceptCancelDialog.Show(Common.Localize("PurgeGeneticHair:Prompt")))) { Dictionary <SimDescription, bool> completed = new Dictionary <SimDescription, bool>(); int count = 0; List <SimDescription> list = new List <SimDescription>(SimDescription.GetSimDescriptionsInWorld()); foreach (SimDescription sim in list) { if (sim.GeneticHairstyleKey != ResourceKey.kInvalidResourceKey) { sim.GeneticHairstyleKey = ResourceKey.kInvalidResourceKey; count++; } ; } if (prompt) { SimpleMessageDialog.Show(Name, Common.Localize("PurgeGeneticHair:Result", false, new object[] { count })); } else if (count > 0) { Overwatch.AlarmNotify(Common.Localize("PurgeGeneticHair:Result", false, new object[] { count })); } } } catch (Exception exception) { Common.Exception(Name, exception); } }
protected void PerformAction(bool prompt) { try { string msg = null; foreach (string command in Commands) { CommandSystem.ExecuteCommandString(command); msg += command + Common.NewLine; } if ((msg != null) && (prompt)) { Overwatch.AlarmNotify(msg); } } catch (Exception e) { Common.Exception(Name, e); } }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Cleanup Laundromat"); foreach (Lot lot in LotManager.AllLots) { if (!Allow(lot)) { continue; } foreach (GameObject obj in lot.GetObjects <GameObject>()) { WashingMachine washing = obj as WashingMachine; if (washing != null) { if (washing.mWashState != WashingMachine.WashState.Empty) { Overwatch.Log("Washer Emptied"); washing.SetObjectToReset(); washing.RemoveClothes(); } } else { Dryer dryer = obj as Dryer; if (dryer != null) { if (dryer.CurDryerState != Dryer.DryerState.Empty) { Overwatch.Log("Dryer Emptied"); dryer.ForceDryerDone(); dryer.TakeClothes(false); dryer.SetGeometryState("empty"); } } else { Clothesline line = obj as Clothesline; if (line != null) { if (line.CurClothesState != Dryer.DryerState.Empty) { Overwatch.Log("Line Emptied"); if (line.mDripFX == null) { line.StartDrying(); } line.ForceClothesDry(); line.ClothesTaken(); } } } } } } if (prompt) { Overwatch.AlarmNotify(Common.Localize("CleanupLaundromat:Complete")); } } catch (Exception e) { Common.Exception(Name, e); } }
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); } }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Recover Stranded Toddlers"); string msg = null; List <Sim> sims = new List <Sim>(Sims3.Gameplay.Queries.GetObjects <Sim>()); foreach (Sim sim in sims) { if (sim.SimDescription == null) { continue; } if (!sim.SimDescription.ToddlerOrBelow) { continue; } if (sim.LotHome == null) { continue; } if (sim.LotCurrent == sim.LotHome) { continue; } if (sim.Posture is BeingCarriedPosture) { continue; } if (DaycareWorkdaySituation.GetDaycareWorkdaySituationForLot(sim.LotCurrent) != null) { continue; } bool guardian = false; foreach (Sim member in Households.AllSims(sim.Household)) { if ((member.SimDescription.TeenOrAbove) && (member.LotCurrent == sim.LotCurrent)) { guardian = true; break; } } if (guardian) { continue; } try { if (Instantiation.AttemptToPutInSafeLocation(sim, false)) { SpeedTrap.Sleep(); msg += Common.NewLine + sim.Name; } } catch { } } if (msg != null) { Overwatch.AlarmNotify(Common.Localize("RecoverStrandedToddlers:Success", false, new object[] { msg })); } } catch (Exception exception) { Common.Exception(Name, exception); } }
protected override void PrivatePerformAction(bool prompt) { Overwatch.Log(Name); foreach (Sim createdSim in new List <Sim> (LotManager.Actors)) { if (createdSim.SimDescription == null) { continue; } StuckSimData other; if (!sData.TryGetValue(createdSim.SimDescription.SimDescriptionId, out other)) { other = new StuckSimData(); sData.Add(createdSim.SimDescription.SimDescriptionId, other); } try { bool reset = false; SimDescription sim = createdSim.SimDescription; if (TestAging(sim, other)) { reset = true; } if (reset) { string notice = Common.Localize(GetTitlePrefix() + ":" + other.Reason + "Two", sim.IsFemale, new object[] { sim }); if (other.mAgingSituation) { ResetSimTask.Perform(createdSim, true); sData.Remove(sim.SimDescriptionId); } else { AgeTransitionTask.Perform(createdSim); } Overwatch.AlarmNotify(notice); Overwatch.Log(notice); } else if (other.Valid) { if (Overwatch.Settings.mReportFirstResetCheck) { string notice = Common.Localize(GetTitlePrefix() + ":" + other.Reason + "One", sim.IsFemale, new object[] { sim }); Overwatch.Notify(createdSim, notice); Overwatch.Log(notice); Overwatch.Log(" Was Negative: " + other.mWasNegative); Overwatch.Log(" Aging Situation: " + other.mAgingSituation); } if (other.mWasNegative) { AgeTransitionTask.Perform(createdSim); } } } catch (Exception e) { Common.Exception(createdSim, e); } } }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Kill All Homeless"); if ((!prompt) || (AcceptCancelDialog.Show(Common.Localize("KillAllHomeless:Prompt")))) { List <Household> list = new List <Household>(); int iSimCount = 0; foreach (Household household in Household.sHouseholdList) { if (household.IsSpecialHousehold) { continue; } if (household.InWorld) { continue; } if (Households.IsPassport(household)) { continue; } if (Households.IsRole(household)) { continue; } if (Households.IsLunarCycleZombie(household)) { continue; } if (Households.IsActiveDaycare(household)) { continue; } iSimCount += Households.NumSims(household); list.Add(household); } foreach (Household household in list) { Annihilation.Cleanse(household); } if (iSimCount > 0) { Overwatch.AlarmNotify(Common.Localize("KillAllHomeless:Success", false, new object[] { iSimCount })); } } } catch (Exception exception) { Common.Exception(Name, exception); } }
protected override void PrivatePerformAction(bool prompt) { Overwatch.Log(Name); int count = 0; for (int i = Situation.sAllSituations.Count - 1; i >= 0; i--) { Situation situation = Situation.sAllSituations[i]; try { bool tested = false, remove = false; if (situation is FieldTripSituation) { tested = true; remove = true; } if ((tested) && (prompt)) { remove = true; } if (remove) { try { situation.Exit(); } catch (Exception e) { Common.Exception("Situation: " + situation.GetType().ToString(), e); } foreach (Sim sim in LotManager.Actors) { sim.RemoveRole(situation); } if ((Situation.sAllSituations.Count > i) && (Situation.sAllSituations[i] == situation)) { Situation.sAllSituations.RemoveAt(i); } count++; Overwatch.Log(" Removed: " + situation.GetType().ToString()); } } catch (Exception e) { Common.Exception("Situation: " + situation.GetType().ToString(), e); } } if ((prompt) || (count > 0)) { Overwatch.AlarmNotify(Common.Localize(GetTitlePrefix() + ":Success", false, new object[] { count })); } }
protected override void PrivatePerformAction(bool prompt) { Overwatch.Log(Name); Dictionary <IGameObject, bool> outOfWorldObjects = new Dictionary <IGameObject, bool>(); Dictionary <ObjectGuid, bool> reservedObjects = new Dictionary <ObjectGuid, bool>(); foreach (ParkingSpace space in Sims3.Gameplay.Queries.GetObjects <ParkingSpace>()) { Vehicle vehicle = space.GetContainedVehicle(); if (vehicle == null && space.ReservedVehicle != null) { space.mReservedVehicle = null; } if (vehicle == null) { continue; } if (!RetainOnLot(space)) { continue; } reservedObjects[vehicle.ObjectId] = true; } foreach (MooringPost post in Sims3.Gameplay.Queries.GetObjects <MooringPost>()) { Vehicle vehicle = post.GetContainedVehicle(); if (vehicle == null) { continue; } if (!RetainOnLot(post)) { continue; } reservedObjects[vehicle.ObjectId] = true; } foreach (BikeRack rack in Sims3.Gameplay.Queries.GetObjects <BikeRack>()) { if (!RetainOnLot(rack)) { continue; } foreach (Bicycle bike in rack.GetContainedBikes()) { reservedObjects[bike.ObjectId] = true; } } foreach (SimDescription sim in SimListing.GetResidents(false).Values) { if (sim.BoardingSchool != null) { AddOutOfWorldObjects(outOfWorldObjects, sim.BoardingSchool.mInventoryItems); } if (sim.mInventoryItemsWhileInPassport != null) { AddOutOfWorldObjects(outOfWorldObjects, sim.mInventoryItemsWhileInPassport); } Sim createdSim = sim.CreatedSim; if (createdSim != null) { PoliceStation.GoToJail interaction = createdSim.CurrentInteraction as PoliceStation.GoToJail; if ((interaction != null) && (interaction.mInmatesObjects != null)) { foreach (IGameObject obj in interaction.mInmatesObjects) { outOfWorldObjects[obj] = true; } } Vehicle reserved = createdSim.GetReservedVehicle(); if (reserved != null) { reservedObjects[reserved.ObjectId] = true; } } ObjectGuid preferred = sim.mPreferredVehicleGuid; if (preferred != ObjectGuid.InvalidObjectGuid) { reservedObjects[preferred] = true; } } if (ParentsLeavingTownSituation.sAdultsInventories != null) { foreach (List <InventoryItem> list in ParentsLeavingTownSituation.sAdultsInventories.Values) { AddOutOfWorldObjects(outOfWorldObjects, list); } } int count = 0; foreach (Vehicle vehicle in Sims3.Gameplay.Queries.GetObjects <Vehicle>()) { if (outOfWorldObjects.ContainsKey(vehicle)) { continue; } if (vehicle.HasFlags(GameObject.FlagField.IsStolen)) { continue; } if (reservedObjects.ContainsKey(vehicle.ObjectId)) { continue; } if ((!vehicle.InInventory) && (vehicle.Driver != null) && (!vehicle.Driver.HasBeenDestroyed)) { if (vehicle.Driver.LotCurrent == vehicle.LotCurrent) { continue; } if (vehicle.Driver.IsPerformingAService) { continue; } } // Temporary until further review can be done if (vehicle is CarUFO) { continue; } if (vehicle is WindSurfboard) { // These vehicles can be placed on the ground, so don't require a parent continue; } if (vehicle is MagicBroom) { if (vehicle.InInventory) { continue; } if (vehicle.Parent is BroomStand) { continue; } } else { IOwnableVehicle ownableVehicle = vehicle as IOwnableVehicle; if (ownableVehicle != null) { if (ownableVehicle.PendingUse) { continue; } CarOwnable carOwnable = vehicle as CarOwnable; if (carOwnable != null) { if (!carOwnable.GeneratedOwnableForNpc) { continue; } } else { BoatOwnable boatOwnable = vehicle as BoatOwnable; if (boatOwnable != null) { if (!boatOwnable.GeneratedOwnableForNpc) { continue; } } else { if (ownableVehicle.InInventory) { continue; } } } } if ((vehicle is FoodTruckBase) || (vehicle is CarService)) { if (vehicle.InWorld) { continue; } } } if ((vehicle.InWorld) && (vehicle.InUse)) { bool found = false; foreach (Sim sim in vehicle.ActorsUsingMe) { if (!sim.HasBeenDestroyed) { found = true; break; } } if (found) { continue; } } string parentSpace = null; if (vehicle.Parent != null) { parentSpace = vehicle.Parent.GetType().ToString(); if (parentSpace.Contains("GalleryShopParkingSpace") || parentSpace.Contains("StoreSetParkingSpace")) { continue; } } { string catalogName = vehicle.CatalogName; bool inInventory = vehicle.InInventory; vehicle.UnParent(); IUsesParkingSpace parker = vehicle as IUsesParkingSpace; if (parker != null) { ParkingSpace space = vehicle.Parent as ParkingSpace; if (space != null) { space.UnReserveSpot(parker); } else { MooringPost post = vehicle.Parent as MooringPost; if (post != null) { post.UnReserveSpot(parker as Boat); } } } vehicle.Destroy(); if (!(vehicle is LightweightTaxi)) { count++; Overwatch.Log("Towed " + catalogName); if (inInventory) { Overwatch.Log(" Was InInventory"); } if (!string.IsNullOrEmpty(parentSpace)) { Overwatch.Log(" Space: " + parentSpace); } } } } if ((count > 0) || (prompt)) { Overwatch.AlarmNotify(Common.Localize("CleanupVehicles:Complete", false, new object[] { count })); } }