public override void Init(SimArrestSituationEx parent) { IPoliceStation[] objects = Sims3.Gameplay.Queries.GetObjects <IPoliceStation>(); if (objects.Length == 0x0) { Exit(); } else { IPoliceStation randomObjectFromList = RandomUtil.GetRandomObjectFromList <IPoliceStation>(objects); parent.Station = randomObjectFromList; } SimDescription description = CreateNewCopFromPool(); if (description == null) { Exit(); } else { if (description.CreatedSim != null) { parent.Cop = description.CreatedSim; SwitchOutfits.SwitchNoSpin(parent.Cop, new CASParts.Key(OutfitCategories.Career, 0)); } else { parent.Cop = Instantiation.PerformOffLot(description, parent.Lot, description.GetOutfit(OutfitCategories.Career, 0x0), null); } parent.CopCar = CarNpcManager.Singleton.CreateServiceCar(ServiceType.Police); ForceSituationSpecificInteraction(parent.Cop, parent.Cop, new GoToCulpritsLocation.Definition(Parent), null, OnCompletion, OnFailure, new InteractionPriority(InteractionPriorityLevel.High)); } }
protected static void OnRoomChanged(Event e) { Sim obj = e.Actor as Sim; if (obj != null) { if (Woohooer.Settings.NeedsChange(obj)) { if (Woohooer.Settings.mChangeRoomClothings) { bool needsChange = false; try { if (obj.CurrentOutfitCategory == Sims3.SimIFace.CAS.OutfitCategories.Naked) { needsChange = (SkinnyDipClothingPile.FindClothingPile(obj) == null); } } catch { } if (needsChange) { if (!InteractionsEx.HasInteraction <Shower.TakeShower.Definition>(obj)) { Sim.ClothesChangeReason reason = Sim.ClothesChangeReason.GoingToBed; if (obj.IsOutside) { reason = Sim.ClothesChangeReason.GoingOutside; } else if (Woohooer.Settings.mSwitchToEverydayAfterNakedWoohoo) { reason = Sim.ClothesChangeReason.LeavingRoom; } SwitchOutfits.SwitchNoSpin(obj, reason); } } } Woohooer.Settings.RemoveChange(obj); } } }
protected override bool Run(SimDescription me, bool singleSelection) { if (!ApplyAll) { List <OutfitCategories> categories = new List <OutfitCategories>(); if (!Common.kDebugging) { categories.AddRange(sCategories); } else { foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories))) { categories.Add(category); } } List <Item> allOptions = GetOptions(me, categories); Item choice = new CommonSelection <Item>(Name, me.FullName, allOptions).SelectSingle(); if (choice == null) { return(false); } mOutfits.Clear(); mOutfits.Add(choice); } if (mOutfits.Count == 0) { return(false); } Item item = mOutfits[0]; if (item.Category == OutfitCategories.Singed) { BuffSinged.SetupSingedOutfit(me.CreatedSim); } int index = item.Index; if ((me.IsUsingMaternityOutfits) && (me.mMaternityOutfits != null)) { ArrayList list = me.mMaternityOutfits[item.Category] as ArrayList; if ((list != null) && (list.Count > index)) { object a = list[0]; object b = list[index]; list[0] = b; list[index] = a; index = 0; } } if (item.Category == OutfitCategories.Career) { me.CareerOutfitIndex = index; } SwitchOutfits.SwitchNoSpin(me.CreatedSim, new CASParts.Key(item.Category, index)); if (me.HorseManager != null) { switch (item.Category) { case OutfitCategories.Naked: case OutfitCategories.Bridle: me.HorseManager.PostUnsaddleHorseAction(); break; default: me.HorseManager.PostSaddleHorseAction(); break; } } return(true); }
public static void Transform(SimDescription sim) { if (!Hybrid.Settings.mSpecialWerewolfOutfit) { return; } SimOutfit outfit = sim.GetSpecialOutfit(sWerewolfOutfitKey); if (outfit == null) { SimOutfit sourceOutfit = sim.GetOutfit(OutfitCategories.Everyday, 0); foreach (CASPart part in sourceOutfit.Parts) { if (part.BodyType == BodyTypes.FullBody) { return; } } if (sParts == null) { sParts = CASParts.GetParts(PartMatches); } List <CASParts.PartPreset> parts = new List <CASParts.PartPreset>(); foreach (CASParts.Wrapper part in sParts) { if (!part.ValidFor(sim)) { continue; } if (RandomUtil.CoinFlip()) { continue; } CASParts.PartPreset preset = part.GetRandomPreset(); if (preset == null) { continue; } parts.Add(preset); } if (parts.Count > 0) { using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(sWerewolfOutfitKey), sourceOutfit)) { foreach (CASParts.PartPreset part in parts) { builder.Builder.RemoveParts(new BodyTypes[] { part.mPart.BodyType }); builder.ApplyPartPreset(part); } } } outfit = sim.GetSpecialOutfit(sWerewolfOutfitKey); if (outfit == null) { return; } } SwitchOutfits.SwitchNoSpin(sim.CreatedSim, new CASParts.Key(sWerewolfOutfitKey)); }
protected override bool PrivateUpdate(ScenarioFrame frame) { SimDescription newSim = null; using (SimFromBin <ManagerSim> bin = new SimFromBin <ManagerSim>(this, Sims)) { CASAgeGenderFlags gender = Sim.Gender; switch (GetValue <GenderOption, BabyGenderScenario.FirstBornGender>()) { case BabyGenderScenario.FirstBornGender.Male: gender = CASAgeGenderFlags.Male; break; case BabyGenderScenario.FirstBornGender.Female: gender = CASAgeGenderFlags.Female; break; } newSim = bin.CreateNewSim(Sim.Age, gender, CASAgeGenderFlags.Human); if (newSim == null) { IncStat("Creation Fail"); return(false); } } bool genderChanged = (Sim.Gender != newSim.Gender); bool result = FacialBlends.CopyGenetics(newSim, Sim, false, false); Sim.VoiceVariation = newSim.VoiceVariation; Sim.VoicePitchModifier = newSim.VoicePitchModifier; Sim.FirstName = newSim.FirstName; if (genderChanged) { Sim.Gender = newSim.Gender; SavedOutfit.Cache cache = new SavedOutfit.Cache(newSim); Dictionary <OutfitCategories, bool> replaced = new Dictionary <OutfitCategories, bool>(); Sim.RemoveOutfits(OutfitCategories.Career, true); SimOutfit geneOutfit = CASParts.GetOutfit(Sim, CASParts.sPrimary, false); foreach (SavedOutfit.Cache.Key outfit in cache.Outfits) { using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(Sim, outfit.mKey, geneOutfit)) { builder.Builder.Gender = Sim.Gender; outfit.Apply(builder, false, null, null); if (!replaced.ContainsKey(outfit.Category)) { replaced.Add(outfit.Category, true); CASParts.RemoveOutfits(Sim, outfit.Category, false); } } } if (Sim.CreatedSim != null) { Sim.CreatedSim.UpdateOutfitInfo(); Sim.CreatedSim.RefreshCurrentOutfit(true); SwitchOutfits.SwitchNoSpin(Sim.CreatedSim, new CASParts.Key(OutfitCategories.Everyday, 0)); } } else { new SavedOutfit.Cache(Sim).PropagateGenetics(Sim, CASParts.sPrimary); } if (newSim.OccultManager.CurrentOccultTypes != OccultTypes.None) { if (Instantiation.PerformOffLot(Sim, Household.ActiveHousehold.LotHome, null) != null) { List <OccultTypes> occults = OccultTypeHelper.CreateList(newSim, true); foreach (OccultTypes occult in occults) { switch (occult) { case OccultTypes.Frankenstein: Sim.TraitManager.AddElement(TraitNames.Brave); Sim.TraitManager.AddElement(TraitNames.Hydrophobic); break; } } Sims.ApplyOccultChance(this, Sim, occults, 100, int.MaxValue); } if (Sim.GetOutfitCount(OutfitCategories.Everyday) > 1) { Sim.RemoveOutfit(OutfitCategories.Everyday, 1, true); } SimOutfit currentOutfit = Sim.GetOutfit(OutfitCategories.Everyday, 0); if (currentOutfit != null) { try { ThumbnailManager.GenerateHouseholdSimThumbnail(currentOutfit.Key, currentOutfit.Key.InstanceId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, Sim.AgeGenderSpecies); } catch (Exception e) { Common.Exception(Sim, e); } } } Deaths.CleansingKill(newSim, true); if (!result) { return(false); } if (Common.kDebugging) { Common.DebugNotify(GetTitlePrefix(PrefixType.Pure) + ": " + Sim.FullName, Sim.CreatedSim); } SpeedTrap.Sleep(); return(true); }