protected override bool Run(SimDescription me, bool singleSelection) { string text = StringInputDialog.Show(Name, Common.Localize("Rename:FirstName"), me.FirstName, 256, StringInputDialog.Validation.None); if ((text == null) || (text == "")) { SimpleMessageDialog.Show(Name, Common.Localize("Rename:Error")); return(false); } me.FirstName = text; text = StringInputDialog.Show(Name, Common.Localize("Rename:LastName"), me.LastName, 256, StringInputDialog.Validation.None); if ((text == null) || (text == "")) { SimpleMessageDialog.Show(Name, Common.Localize("Rename:Error")); return(false); } me.LastName = text; if (me.Household == Household.ActiveHousehold) { HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel; if ((me.CreatedSim != null) && (hudModel.FindSimInfo(me.CreatedSim.ObjectId) != null)) { hudModel.NotifyNameChanged(me.CreatedSim.ObjectId); } } return(true); }
protected override OptionResult Run(Lot lot, Household me) { if (me == null) { return(OptionResult.Failure); } string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt"), me.Name); if (string.IsNullOrEmpty(text)) { return(OptionResult.Failure); } if (AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":SimsPrompt", false, new object[] { me.Name, text }))) { foreach (SimDescription sim in CommonSpace.Helpers.Households.All(me)) { if (sim.LastName.Trim().ToLower() == me.Name.Trim().ToLower()) { sim.LastName = text; if (me == Household.ActiveHousehold) { HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel; if (sim.CreatedSim != null) { Household.AddDirtyNameSimID(sim.SimDescriptionId); hudModel.NotifyNameChanged(sim.CreatedSim.ObjectId); } } } } } me.Name = text; return(OptionResult.SuccessClose); }
public static void OnRemoval(OccultPlantSim ths, SimDescription simDes, bool alterOutfit) { Sim createdSim = simDes.CreatedSim; int index = simDes.HasOutfit(OutfitCategories.Everyday, ths.mOccultOutfitKey); if (index >= 0x0) { simDes.RemoveOutfit(OutfitCategories.Everyday, index, true); } if (createdSim != null) { createdSim.Motives.RemoveMotive(CommodityKind.BePlantSim); createdSim.Motives.EnableMotive(CommodityKind.Bladder); createdSim.Motives.EnableMotive(CommodityKind.Hunger); createdSim.BuffManager.RemoveElement(BuffNames.PlantSimDehydrated); createdSim.BuffManager.RemoveElement(BuffNames.PlantSimHydrated); createdSim.TraitManager.RemoveElement(TraitNames.PlantSim); ActiveTopic.RemoveTopicFromSim(createdSim, "PlantSim Trait Topic"); createdSim.Motives.UpdateMotives(1f, createdSim); (createdSim.RoutingComponent as SimRoutingComponent).RemoveOccultWalkingEffects(OccultTypes.PlantSim); ResourceKey skinToneKey = new ResourceKey(0xe8a7d5f0fec3d90bL, 0x354796a, 0x0); if (ths.mOldSkinToneKey != ResourceKey.kInvalidResourceKey) { skinToneKey = ths.mOldSkinToneKey; } if (alterOutfit) { simDes.SetSkinAndHairForAllOutfits(simDes.Age, skinToneKey, ths.mOldSkinIndex, ResourceKey.kInvalidResourceKey, true, ths.mOldHairColor); simDes.RemoveBodyTypeFromAllOutfits(BodyTypes.BirthMark); simDes.RemoveBodyTypeFromAllOutfits(BodyTypes.Beard); } HudModel hudModel = Responder.Instance.HudModel as HudModel; if ((hudModel != null) && (hudModel.GetSimInfo(createdSim.ObjectId) != null)) { if (alterOutfit) { SimBuilder builder = new SimBuilder(); builder.Clear(); SimOutfit outfit = simDes.GetOutfit(OutfitCategories.Everyday, 0x0); OutfitUtils.SetOutfit(builder, outfit, null); OutfitUtils.ExtractOutfitHairColor(simDes, builder); ths.mOutfitIsReady = false; createdSim.SwitchToOutfitDelayed(outfit, new CASUtils.SwapReadyCallback(ths.PlayConcealEffectAndSwapOutfit)); for (int i = 0x0; !ths.mOutfitIsReady && (i < 0xc350); i++) { Common.Sleep(0xa); } ths.SwapOutfit(); } hudModel.OnSimAppearanceChanged(createdSim.ObjectId); hudModel.NotifyNameChanged(createdSim.ObjectId); } else { createdSim.SwitchToOutfitWithoutSpin(Sim.ClothesChangeReason.Force, createdSim.CurrentOutfitCategory, true); } createdSim.Motives.RemoveMotive(CommodityKind.BePlantSim); createdSim.Motives.EnableMotive(CommodityKind.Bladder); createdSim.Motives.EnableMotive(CommodityKind.Hunger); createdSim.BuffManager.RemoveElement(BuffNames.PlantSimDehydrated); createdSim.BuffManager.RemoveElement(BuffNames.PlantSimHydrated); createdSim.TraitManager.RemoveElement(TraitNames.PlantSim); ActiveTopic.RemoveTopicFromSim(createdSim, "PlantSim Trait Topic"); hudModel.NotifyNameChanged(createdSim.ObjectId); createdSim.Motives.UpdateMotives(1f, createdSim); } }