// Lacks the "greater than eight" restriction public static bool GhostToPlayableGhost(Urnstone ths, Household newHousehold, Vector3 ghostPosition) { SimDescription simDescription = ths.DeadSimsDescription; if (!simDescription.IsValidDescription) { simDescription.Fixup(); } if (simDescription.Household != null) { simDescription.Household.Remove(simDescription, !simDescription.Household.IsSpecialHousehold); } if (!newHousehold.Contains(simDescription)) { newHousehold.Add(simDescription); } Sim ghost = Instantiation.Perform(simDescription, ghostPosition, null, null); if (ghost == null) return false; ths.GhostSetup(ghost, true); ths.RemoveMourningRelatedBuffs(ghost); simDescription.ShowSocialsOnSim = true; simDescription.IsNeverSelectable = false; simDescription.Marryable = true; simDescription.Contactable = true; if (!simDescription.IsEP11Bot) { simDescription.AgingEnabled = true; simDescription.AgingState.ResetAndExtendAgingStage(0f); simDescription.PushAgingEnabledToAgingManager(); } string failureReason; if (!Inventories.TryToMove(ths, ghost.Inventory, true, out failureReason)) { Common.DebugNotify(failureReason); } //Inventories.TryToMove(ths, ghost); if (simDescription.Child || simDescription.Teen) { simDescription.AssignSchool(); } if (ghost.IsSelectable) { ghost.OnBecameSelectable(); } return true; }
public static string GetLocalizedString(bool isFemale, SimDescription.DeathType type) { switch (type) { case SimDescription.DeathType.None: return(""); case SimDescription.DeathType.PetOldAgeBad: case SimDescription.DeathType.PetOldAgeGood: return(Common.LocalizeEAString(isFemale, "Gameplay/Objects/Urnstone:" + type.ToString())); } return(Urnstone.DeathTypeToLocalizedString(type)); }
public static void CreateActors(List <SimDescription> SimDescs, Lot lot, bool bAddInitialObjects) { List <Sim> sims = new List <Sim>(); foreach (SimDescription description in SimDescs) { try { description.HomeWorld = GameUtils.GetCurrentWorld(); if (description.CreatedSim == null) { if (description.Weight < 0f) { description.ChangeBodyShape(0f, description.Fitness, -description.Weight); } else { description.ChangeBodyShape(description.Weight, description.Fitness, 0f); } SimOutfit outfit = description.GetOutfit(OutfitCategories.Everyday, 0x0); Vector3 position = new Vector3(); // Custom Sim sim = Instantiation.Perform(description, position, outfit, null /*bAddInitialObjects*/); if (sim.SimDescription.IsGhost) { Urnstone.SimToPlayableGhost(sim, true); } sims.Add(sim); } else { sims.Add(description.CreatedSim); } description.GetMiniSimForProtection().AddProtection(MiniSimDescription.ProtectionFlag.PartialFromPlayer); } catch (Exception e) { Common.Exception(description, e); } } if (lot != null) { BinCommon.PlaceSims(sims, lot); } }
public static bool GhostToSim(SimDescription me) { Urnstone stone = Urnstones.FindGhostsGrave(me); if (stone != null) { if (me.CreatedSim != null) { stone.GhostToSim(me.CreatedSim, false, false); return(true); } } return(false); }
protected override bool Run(SimDescription me, bool singleSelection) { Urnstone urnstone = Urnstones.CreateGrave(me, false); if (urnstone == null) { return(false); } if ((urnstone.InInventory) || (!urnstone.InWorld)) { if (urnstone.InInventory) { Inventory inventory = Inventories.ParentInventory(urnstone); if ((inventory != null) && (inventory.Owner == me.CreatedSim)) { Camera.FocusOnGivenPosition(me.CreatedSim.Position, 6f); return(false); } if (!AcceptCancelDialog.Show(Common.Localize("FindGrave:Prompt"))) { return(false); } } bool bOriginalValue = mActor.Inventory.IgnoreInventoryValidation; mActor.Inventory.IgnoreInventoryValidation = true; try { mActor.Inventory.TryToMove(urnstone); } finally { mActor.Inventory.IgnoreInventoryValidation = bOriginalValue; } } else { urnstone.FadeIn(); Camera.FocusOnGivenPosition(urnstone.Position, 6f); } return(true); }
public override bool Run() { try { Urnstone grave = Urnstone.FindGhostsGrave(Actor); if (grave != null) { grave.GhostToSim(Actor, false, false); } return(true); } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
public static void GhostToSim(Sim vamp, Sim vic) { OthersResurrect.player1 = vamp; OthersResurrect.player2 = vic; Sim actor = player1; Sim target = player2; Urnstone urnstone = Urnstone.FindGhostsGrave(target); if (urnstone != null) { OthersResurrect.PlayResurrectAnimation(target, true, true); urnstone.GhostToSim(target, true, true); target.OccultManager.AddOccultType(OccultTypes.Vampire, true, false, false); target.ChooseRandomOutfitCategoryOtherThanCurrent(OutfitCategories.Everyday); OthersResurrect.AppearSimInResurrect(target, true); } }
private static ListenerAction OnObjectChanged(Event e) { try { Urnstone urnstone = e.TargetObject as Urnstone; if (urnstone != null) { Instantiator.AddInteractionsForUrnstones(urnstone); } } catch (Exception exception) { Instantiator.Exception(exception); StyledNotification.Show(new StyledNotification.Format("Failed to load Vampire Tweaker Interactions. Error generated by fer456.VampireTweaker.Interactions.dll. See info below and in Documents_Electronic Arts_The Sims 3" + exception, StyledNotification.NotificationStyle.kDebugAlert)); } return(ListenerAction.Keep); }
public static bool GhostSpawn(Urnstone me, Lot lot) { if (me.DeadSimsDescription == null) { return(false); } if (!me.DeadSimsDescription.IsValidDescription) { me.DeadSimsDescription.Fixup(); } Vector3 position; if (me.DeadSimsDescription.ToddlerOrBelow) { position = lot.EntryPoint(); } else if (!me.InInventory) { position = me.Position; } else { position = Service.GetPositionInRandomLot(lot); } Household.NpcHousehold.Add(me.DeadSimsDescription); Sim sim = Instantiation.Perform(me.DeadSimsDescription, position, null, null); sim.SetOpacity(0f, 0f); ActiveTopic.AddToSim(sim, "Ghost"); me.GhostSetup(sim, true); if (!me.InInventory) { sim.GreetSimOnLot(me.LotCurrent); Audio.StartObjectSound(me.ObjectId, "sting_ghost_appear", false); } sim.FadeIn(); me.CreateAlarmReturnToGrave(false); return(true); }
public override bool Run() { ForceKillSimNiec.Definition definition = base.InteractionDefinition as ForceKillSimNiec.Definition; List <Sim> list = new List <Sim>(); foreach (Sim sim in NFinalizeDeath.SC_GetObjects <Sim>()) { if (sim.SimDescription.ToddlerOrAbove && !sim.IsInActiveHousehold && sim.LotCurrent != Household.ActiveHousehold.LotHome) { // SpeedTrap.Sleep(10); sim.BuffManager.AddElement(BuffNames.Mourning, Origin.FromWitnessingDeath); BuffMourning.BuffInstanceMourning buffInstanceMourning = sim.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning; if (buffInstanceMourning != null) { buffInstanceMourning.MissedSim = Target.SimDescription; } // SpeedTrap.Sleep(10); sim.BuffManager.AddElement(BuffNames.HeartBroken, Urnstone.CalculateMourningMoodStrength(sim, sim.SimDescription), Origin.FromWitnessingDeath); BuffHeartBroken.BuffInstanceHeartBroken buffInstanceHeartBroken = sim.BuffManager.GetElement(BuffNames.HeartBroken) as BuffHeartBroken.BuffInstanceHeartBroken; if (buffInstanceHeartBroken != null) { buffInstanceHeartBroken.MissedSim = Target.SimDescription; } // SpeedTrap.Sleep(10); sim.BuffManager.AddElement(BuffNames.Negligent, Origin.FromNeglectingChildren); BuffNegligent.BuffInstanceNegligent buffInstanceNegligent = sim.BuffManager.GetElement(BuffNames.Negligent) as BuffNegligent.BuffInstanceNegligent; if (buffInstanceNegligent != null) { buffInstanceNegligent.MissedSims.Add(Target.SimDescription); } } } SpeedTrap.Sleep(10); if (Target.IsNPC) { SafeNRaas.NRUrnstones_CreateGrave(Target.SimDescription, definition.death, true, true); } return(true); }
public static bool MoveToMausoleum(IMausoleum mausoleum, Urnstone urnstone) { bool bOriginalValue = mausoleum.Inventory.IgnoreInventoryValidation; try { mausoleum.Inventory.IgnoreInventoryValidation = true; if (Inventories.TryToMove(urnstone, mausoleum.Inventory)) { return(true); } } finally { mausoleum.Inventory.IgnoreInventoryValidation = bOriginalValue; } return(false); }
protected override bool Run(SimDescription me, bool singleSelection) { if (!base.Run(me, singleSelection)) { return(false); } foreach (SelectionCriteria.Occult.Values type in mTypes) { if (type.mOccult == OccultTypes.Ghost) { Urnstone stone = Urnstones.FindGhostsGrave(me); if ((stone != null) && (me.CreatedSim != null)) { stone.GhostToSim(me.CreatedSim, false, false); } else { me.SetDeathStyle(SimDescription.DeathType.None, false); me.IsGhost = false; me.IsNeverSelectable = false; me.ShowSocialsOnSim = true; me.AgingEnabled = true; if (stone != null) { stone.Destroy(); } } } else { OccultTypeHelper.Remove(me, type.mOccult, true); } } return(true); }
public static bool MoveToMausoleum(Urnstone urnstone) { List <IMausoleum> mausoleums = new List <IMausoleum>(Sims3.Gameplay.Queries.GetObjects <IMausoleum>()); if (mausoleums.Count > 0) { IMausoleum mausoleum = RandomUtil.GetRandomObjectFromList(mausoleums); if (mausoleum != null) { foreach (IActor actor in urnstone.ReferenceList) { actor.InteractionQueue.PurgeInteractions(urnstone); } if (MoveToMausoleum(mausoleum, urnstone)) { return(true); } } } return(false); }
public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (isAutonomous) { return(false); } if (a != target) { return(false); } if (!target.SimDescription.IsPlayableGhost) { return(false); } Assassination skill = a.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid); if (skill == null) { return(false); } if (!skill.IsGhost()) { return(false); } if (Urnstone.FindGhostsGrave(a) == null) { return(false); } return(true); }
// Methods public override bool Run() // Run { WelcomeWagonSituation.Create(Actor.LotHome); if (Household.ActiveHousehold == null || Household.ActiveHousehold.LotHome == null) { return(false); } List <Sim> list = new List <Sim>(); foreach (Sim sim in LotManager.Actors) { if (sim.SimDescription.ToddlerOrAbove && !sim.IsInActiveHousehold && sim.LotCurrent != Household.ActiveHousehold.LotHome) { //Urnstone.FinalizeSimDeath(sim.SimDescription, sim.Household, false); //sim.InteractionQueue.CancelAllInteractions(); sim.ModifyFunds(-99999999); sim.BuffManager.AddElement(BuffNames.Mourning, Urnstone.CalculateMourningMoodStrength(sim, sim.SimDescription), Origin.FromWitnessingDeath); BuffMourning.BuffInstanceMourning buffInstanceMourning = sim.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning; if (buffInstanceMourning != null) { buffInstanceMourning.MissedSim = Actor.SimDescription; } //sim.Occupation.FireSim(true); //list.Add(sim); //sim.Occupation.FireSim(true); list.Add(sim); } } if (list.Count > 0) { Sim randomObjectFromList = RandomUtil.GetRandomObjectFromList <Sim>(list); if (!randomObjectFromList.InWorld) { randomObjectFromList.AddToWorld(); } //randomObjectFromList.SimDescription.Occupation.FireSim(true); //Urnstone.FinalizeSimDeath(randomObjectFromList.SimDescription, randomObjectFromList.Household, false); randomObjectFromList.InteractionQueue.CancelAllInteractions(); //Urnstone.FinalizeSimDeath(randomObjectFromList.SimDescription, randomObjectFromList.Household, false); //randomObjectFromList.FlagSet(Sim.SimFlags.IgnoreDoorLocks, true); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); randomObjectFromList.InteractionQueue.Add(VisitLot.Singleton.CreateInstance(Household.ActiveHousehold.LotHome, randomObjectFromList, new InteractionPriority((InteractionPriorityLevel)349), false, true)); return(true); } return(false); }
protected List <Sim> GeneratePetChildren(SimDescription woman, SimDescription man, int numChildren) { Random pregoRandom = new Random(); float[] chanceOfTwin = new float[] { 1f, PetPregnancy.kChanceEggSizeTwo, PetPregnancy.kChanceEggSizeThree, PetPregnancy.kChanceEggSizeFour }; int index = 0; SimDescription eggLead = null; GeneticsPet.SetName nameSet = GeneticsPet.SetName.SetNameNonInteractive; if (woman.IsHorse) { nameSet = GeneticsPet.SetName.SetNameInteractive; } List <Sim> babies = new List <Sim>(); for (int i = 0; i < numChildren; i++) { try { OccultTypes occult = RandomUtil.CoinFlip() ? woman.OccultManager.CurrentOccultTypes : man.OccultManager.CurrentOccultTypes; if (!OccultManager.DoesOccultTransferToOffspring(occult)) { occult = OccultTypes.None; } SimDescription newBaby = null; if (pregoRandom.NextDouble() > chanceOfTwin[index]) { index = 0x0; } if ((index == 0x0) || (woman.IsHorse)) { CASAgeGenderFlags species = woman.Species; if ((man != null) && (pregoRandom.NextDouble() > 0.5)) { species = man.Species; } newBaby = GeneticsPet.MakePetDescendant(man, woman, CASAgeGenderFlags.Child, NRaas.MasterControllerSpace.Helpers.Baby.InterpretGender(mGender), species, pregoRandom, true, nameSet, i, occult); if (newBaby != null) { if (RandomUtil.CoinFlip()) { newBaby.SetDeathStyle(woman.DeathStyle, true); } else { newBaby.SetDeathStyle(man.DeathStyle, true); } } } else { newBaby = GeneticsPet.MakeSameEggDescendant(eggLead, man, woman, NRaas.MasterControllerSpace.Helpers.Baby.InterpretGender(mGender), pregoRandom, true, nameSet, i); if (newBaby != null) { newBaby.SetDeathStyle(eggLead.DeathStyle, true); } } eggLead = newBaby; index++; if (index >= chanceOfTwin.Length) { index = chanceOfTwin.Length - 1; } if (newBaby == null) { continue; } newBaby.WasCasCreated = false; woman.Household.Add(newBaby); Vector3 position = woman.CreatedSim.Position; Sim babyToHide = Instantiation.Perform(newBaby, position, null, null); babies.Add(babyToHide); if (newBaby.DeathStyle != SimDescription.DeathType.None) { Urnstone.SimToPlayableGhost(babyToHide); } if (i == 0x0) { EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBaby, newBaby)); } if (woman.CreatedSim != null) { EventTracker.SendEvent(EventTypeId.kNewOffspringPet, woman.CreatedSim, babyToHide); } if (man.CreatedSim != null) { EventTracker.SendEvent(EventTypeId.kNewOffspringPet, man.CreatedSim, babyToHide); } foreach (Sim sim in CommonSpace.Helpers.Households.AllHumans(woman.Household)) { EventTracker.SendEvent(EventTypeId.kNewPet, sim, babyToHide); } } catch (Exception e) { Common.Exception(woman, man, e); } } return(babies); }
protected override void OnPerform() { int roomId = 0; Lot lot = null; if (mTarget.CreatedSim != null) { Vector3 location = mTarget.CreatedSim.PositionOnFloor; lot = mTarget.CreatedSim.LotCurrent; roomId = mTarget.CreatedSim.RoomId; List <GnomeData> gnomes = new List <GnomeData>(); if (mTarget.TraitManager.HasElement(TraitNames.CultureChina)) { gnomes.Add(new GnomeData(0x000000000098977D, ProductVersion.EP1)); } else if ((mTarget.TraitManager.HasElement(TraitNames.CultureEgypt)) || (mTarget.IsMummy)) { gnomes.Add(new GnomeData(0x000000000098977C, ProductVersion.EP1)); } else if (mTarget.TraitManager.HasElement(TraitNames.CultureFrance)) { gnomes.Add(new GnomeData(0x000000000098977E, ProductVersion.EP1)); } else if (mTarget.IsVampire) { gnomes.Add(new GnomeData(0x000000000098A1C2, ProductVersion.EP3)); } else if (mTarget.IsFrankenstein) { gnomes.Add(new GnomeData(0x0000000000989CD9, ProductVersion.EP2)); } else if ((mTarget.IsCelebrity) || (mTarget.AssignedRole is RolePaparazzi)) { gnomes.Add(new GnomeData(0x000000000098A1C4, ProductVersion.EP3)); } else if (mTarget.Occupation is MagicianCareer) { gnomes.Add(new GnomeData(0x000000000098D215, ProductVersion.EP6)); // Magician } else if (mTarget.Occupation is SingerCareer) { gnomes.Add(new GnomeData(0x000000000098D214, ProductVersion.EP6)); // Singer } else if (mTarget.IsCat) { gnomes.Add(new GnomeData(0x000000000098AAD6, ProductVersion.EP5)); // Pet Cat } else if (mTarget.IsADogSpecies) { gnomes.Add(new GnomeData(0x000000000098AAD5, ProductVersion.EP5)); // Pet Dog } else if (mTarget.IsHorse) { gnomes.Add(new GnomeData(0x000000000098AAD4, ProductVersion.EP5)); // Pet Horse } else { gnomes.Add(new GnomeData(0x000000000000058B, ProductVersion.BaseGame)); // Normal if (GameUtils.IsInstalled(ProductVersion.EP1)) { gnomes.Add(new GnomeData(0x000000000098977D, ProductVersion.EP1)); // China gnomes.Add(new GnomeData(0x000000000098977C, ProductVersion.EP1)); // Egypt gnomes.Add(new GnomeData(0x000000000098977E, ProductVersion.EP1)); // France } if (GameUtils.IsInstalled(ProductVersion.EP2)) { gnomes.Add(new GnomeData(0x0000000000989EEC, ProductVersion.EP2)); // Caveman gnomes.Add(new GnomeData(0x0000000000989CD9, ProductVersion.EP2)); // Inventor gnomes.Add(new GnomeData(0x0000000000989EDF, ProductVersion.EP2)); // Laundry gnomes.Add(new GnomeData(0x0000000000989CF2, ProductVersion.EP2)); // Sculptor } if (GameUtils.IsInstalled(ProductVersion.EP3)) { gnomes.Add(new GnomeData(0x000000000098A1C4, ProductVersion.EP3)); // Celebrity gnomes.Add(new GnomeData(0x000000000098A1C2, ProductVersion.EP3)); // Vampire } if (GameUtils.IsInstalled(ProductVersion.EP5)) { gnomes.Add(new GnomeData(0x000000000098AEB1, ProductVersion.EP5)); // Freezer Bunny gnomes.Add(new GnomeData(0x000000000098AAD6, ProductVersion.EP5)); // Pet Cat gnomes.Add(new GnomeData(0x000000000098AAD5, ProductVersion.EP5)); // Pet Dog gnomes.Add(new GnomeData(0x000000000098AAD4, ProductVersion.EP5)); // Pet Horse } if (GameUtils.IsInstalled(ProductVersion.EP6)) { gnomes.Add(new GnomeData(0x000000000098D215, ProductVersion.EP6)); // Magician gnomes.Add(new GnomeData(0x000000000098D214, ProductVersion.EP6)); // Singer } } if (gnomes.Count > 0) { GnomeData preferred = RandomUtil.GetRandomObjectFromList(gnomes); MagicGnomeBase gnome = ObjectCreation.CreateObject(preferred.mInstance, preferred.mVersion, null) as MagicGnomeBase; if (gnome != null) { NameComponent name = gnome.GetComponent <NameComponent>(); if (name != null) { name.mName = mTarget.FullName; } gnome.SetPosition(location); gnome.AddToWorld(); } } } Genealogy genealogy = mTarget.CASGenealogy as Genealogy; if (genealogy != null) { genealogy.ClearAllGenealogyInformation(); } foreach (SimDescription other in SimDescription.GetSimDescriptionsInWorld()) { MiniSimDescription miniOther = MiniSimDescription.Find(other.SimDescriptionId); if (miniOther == null) { continue; } miniOther.RemoveMiniRelatioship(mTarget.SimDescriptionId); } Annihilation.RemoveMSD(mTarget.SimDescriptionId); Relationship.RemoveSimDescriptionRelationships(mTarget); Urnstone urnstone = Urnstone.FindGhostsGrave(mTarget); if (urnstone != null) { if ((urnstone.InInventory) && (urnstone.Parent != null) && (urnstone.Parent.Inventory != null)) { urnstone.Parent.Inventory.RemoveByForce(urnstone); } urnstone.DestroyGrave(); try { urnstone.Dispose(); } catch { } } try { mTarget.Dispose(); Assassination skill = Assassination.EnsureSkill(mActor); if (skill != null) { skill.AddPotentialKill(mTarget, true); bool witnessed = false; if (lot != null) { witnessed = Assassination.WasWitnessed(lot, roomId, mActor.SimDescription, mTarget, new List <Sim>()); } skill.AddActualKill(mTarget, false, witnessed); } } catch { } }
protected static bool DelayedKill(Sim actor, Sim target, SimDescription.DeathType deathType) { if (actor == target) { target.SimDescription.SetDeathStyle(deathType, true); Urnstone urnstone = Urnstone.CreateGrave(target.SimDescription, false, true); if (urnstone != null) { if (!target.Inventory.TryToAdd(urnstone, false)) { urnstone.Destroy(); return(false); } urnstone.GhostSetup(target, true); } } else { List <IRabbitHolePartnershipDeed> list = Inventories.QuickDuoFind <IRabbitHolePartnershipDeed, GameObject>(target.Inventory); if ((list != null) && (list.Count > 0x0)) { Sim sim = null; float minValue = float.MinValue; foreach (Sim sim2 in Households.AllHumans(target.Household)) { if (sim2 != target) { float liking = -100f; Relationship relationship = Relationship.Get(target, sim2, false); if (relationship != null) { liking = relationship.LTR.Liking; } if (liking > minValue) { minValue = liking; sim = sim2; } } } foreach (IRabbitHolePartnershipDeed deed in list) { target.Inventory.RemoveByForce(deed); if (sim != null) { sim.Inventory.TryToAdd(deed, false); } else { deed.Destroy(); } } } InteractionInstance entry = Urnstone.KillSim.Singleton.CreateInstance(target, target, new InteractionPriority(InteractionPriorityLevel.MaxDeath, 0f), false, false); (entry as Urnstone.KillSim).simDeathType = deathType; target.InteractionQueue.Add(entry); } return(true); }
public static bool Dispose(SimDescription sim, Logger log) { if (sim == null) { return(false); } Genealogy oldGene = sim.Genealogy; if (sim.CelebrityManager == null) { // If missing, the Dispose() fires a script error sim.CelebrityManager = new Sims3.Gameplay.CelebritySystem.CelebrityManager(); } try { if (sim.Genealogy == null) { MiniSimDescription miniSim = MiniSimDescription.Find(sim.SimDescriptionId); if (miniSim != null) { sim.mGenealogy = miniSim.Genealogy; } if (sim.Genealogy == null) { sim.mGenealogy = new Genealogy(sim); } } Urnstone stone = Urnstones.FindGhostsGrave(sim); if (stone != null) { Inventory inventory = Inventories.ParentInventory(stone); if (inventory != null) { inventory.RemoveByForce(stone); } try { stone.Dispose(); stone.Destroy(); } catch (Exception e) { Common.Exception(sim, e); if (inventory != null) { inventory.TryToAdd(stone, false); } } } else { sim.Dispose(true, false, true); } if (log != null) { log(" Disposed: " + sim.FullName); } return(true); } catch (Exception e) { Common.Exception(sim, e); return(false); } finally { // Reassign the genealogy, to compensate for an issue where the miniSim is reprocessed later sim.mGenealogy = oldGene; } }
public static bool MoveToMausoleum(Urnstone urnstone) { List<IMausoleum> mausoleums = new List<IMausoleum>(Sims3.Gameplay.Queries.GetObjects<IMausoleum>()); if (mausoleums.Count > 0) { IMausoleum mausoleum = RandomUtil.GetRandomObjectFromList(mausoleums); if (mausoleum != null) { foreach (IActor actor in urnstone.ReferenceList) { actor.InteractionQueue.PurgeInteractions(urnstone); } if (MoveToMausoleum(mausoleum, urnstone)) { return true; } } } return false; }
public static bool MoveToMausoleum(IMausoleum mausoleum, Urnstone urnstone) { bool bOriginalValue = mausoleum.Inventory.IgnoreInventoryValidation; try { mausoleum.Inventory.IgnoreInventoryValidation = true; if (Inventories.TryToMove(urnstone, mausoleum.Inventory)) { return true; } } finally { mausoleum.Inventory.IgnoreInventoryValidation = bOriginalValue; } return false; }
private static void AintAllDelDesc(bool loadworld) { try { if (NiecMod.KillNiec.AssemblyCheckByNiec.IsInstalled("DGSCore")) { //bool checkkillsimxxx = false; try { //Sleep(3.0); foreach (SimDescription sdtyf in NiecMod.Nra.NFinalizeDeath.TattoaX()) { try { if (!Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions.Contains(sdtyf)) { Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions.Add(sdtyf); } } catch { } } } catch { } //Sleep(3.0); try { CommandSystem.ExecuteCommandString("dgsunsafekill false"); } catch { } try { CommandSystem.ExecuteCommandString("dgspx false"); PlumbBob.ForceSelectActor(null); try { PlumbBob.sSingleton.mSelectedActor = null; } catch { } } catch { } try { List <MiniSimDescription> asdr = new List <MiniSimDescription>(MiniSimDescription.sMiniSims.Values); foreach (MiniSimDescription esdtyef in asdr) { try { if (esdtyef == null) { continue; } if (esdtyef.mProtectionFlags != null) { esdtyef.mProtectionFlags.Clear(); } esdtyef.Instantiated = false; esdtyef.mGenealogy = null; try { foreach (MiniRelationship miniRelationship in esdtyef.mMiniRelationships) { if (miniRelationship == null) { continue; } try { MiniSimDescription miniSimDescription2 = MiniSimDescription.Find(miniRelationship.SimDescriptionId); if (miniSimDescription2 != null) { if (miniSimDescription2.mProtectionFlags != null) { miniSimDescription2.mProtectionFlags.Clear(); } miniSimDescription2.Instantiated = false; miniSimDescription2.RemoveMiniRelatioship(esdtyef.mSimDescriptionId); miniSimDescription2.mGenealogy = null; } } catch { } } } catch { } if (esdtyef.mMiniRelationships != null) { esdtyef.mMiniRelationships.Clear(); } //MiniSimDescription.sMiniSims.Remove(esdtyef.mSimDescriptionId); } catch { } } } catch { } foreach (SimDescription sdtyef in Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions) { try { if (sdtyef == null) { continue; } //sdtyef.RemoveOutfits(OutfitCategories.All, true); //sdtyef.RemoveOutfit(OutfitCategories.All, 0, true); if (!sdtyef.mIsValidDescription && !loadworld) { continue; } try { try { if (sdtyef.OccultManager != null) { sdtyef.OccultManager.RemoveAllOccultTypes(); } } catch { } sdtyef.OccultManager = null; } catch { } try { if (sdtyef.IsPregnant) { NRaas.CommonSpace.Helpers.CASParts.RemoveOutfits(sdtyef, OutfitCategories.All, false); } else { NRaas.CommonSpace.Helpers.CASParts.RemoveOutfits(sdtyef, OutfitCategories.All, true); } } catch { } sdtyef.Protected = false; MiniSimDescription inim = MiniSimDescription.Find(sdtyef.mSimDescriptionId); if (inim != null) { if (inim.mProtectionFlags != null) { inim.mProtectionFlags.Clear(); } inim.Instantiated = false; inim.mGenealogy = null; inim.ClearMiniRelationships(); } } catch { } try { Niec.iCommonSpace.KillPro.RemoveSimDescriptionRelationships(sdtyef); } catch { } try { Niec.iCommonSpace.KillPro.CleanseGenealogy(sdtyef); sdtyef.mGenealogy = null; } catch { } try { Niec.iCommonSpace.KillPro.RemoveSimDescriptionRelationships(sdtyef); } catch { } } List <Sim> asdo = new List <Sim>(); try { try { foreach (Sim simau in Sims3.Gameplay.Queries.GetObjects <Sim>()) { try { if (!asdo.Contains(simau)) { asdo.Add(simau); } } catch { } } foreach (Sim simau in LotManager.Actors) { try { if (!asdo.Contains(simau)) { asdo.Add(simau); } } catch { } } } catch { } try { foreach (Sim simaue in asdo) { try { NFinalizeDeath.ForceCancelAllInteractionsWithoutCleanup(simaue); } catch { } try { simaue.Genealogy.ClearAllGenealogyInformation(); } catch { } try { simaue.Genealogy.ClearMiniSimDescription(); } catch { } try { simaue.Destroy(); } catch { } try { (simaue as ScriptObject).Destroy(); } catch { } } } catch { } } catch { } finally { try { asdo.Clear(); } catch { } asdo = null; } foreach (SimDescription description in Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions) { try { if (description == null) { continue; } if (!description.mIsValidDescription && !loadworld) { try { while (true) { Urnstone urnstone = null; urnstone = HelperNra.TFindGhostsGrave(description); if (urnstone != null) { urnstone.DeadSimsDescription = null; try { urnstone.Dispose(); } catch { } try { urnstone.Destroy(); } catch { } } else { break; } } } catch { } continue; } } catch { } try { if (description.IsPregnant) { NRaas.CommonSpace.Helpers.CASParts.RemoveOutfits(description, OutfitCategories.All, false); } else { NRaas.CommonSpace.Helpers.CASParts.RemoveOutfits(description, OutfitCategories.All, true); } } catch { } try { description.Genealogy.ClearMiniSimDescription(); } catch { } try { description.Genealogy.ClearDerivedData(); } catch { } try { description.Genealogy.ClearSimDescription(); } catch { } try { description.Genealogy.ClearAllGenealogyInformation(); } catch { } try { if (description.CreatedSim != null) { NFinalizeDeath.ForceCancelAllInteractionsWithoutCleanup(description.CreatedSim); } } catch { } try { Household household = description.Household; if (household != null) { household.Remove(description, !household.IsSpecialHousehold); } } catch { } try { while (true) { Urnstone urnstone = null; urnstone = HelperNra.TFindGhostsGrave(description); if (urnstone != null) { urnstone.DeadSimsDescription = null; try { urnstone.Dispose(); } catch { } try { urnstone.Destroy(); } catch { } } else { break; } } } catch { } try { MiniSimDescription.RemoveMSD(description.SimDescriptionId); } catch { } try { description.Dispose(); } catch { } /* * try * { * NRaas.CommonSpace.Helpers.Annihilation.Cleanse(description); * } * catch * { } */ description.mIsValidDescription = false; } try { //Sleep(3.0); foreach (Service allService in Services.AllServices) { try { if (!(allService is GrimReaper)) { allService.ClearServicePool(); } } catch { } } } catch { } try { //Sleep(3.0); foreach (Service allService in Services.AllServices) { try { if (!(allService is GrimReaper)) { Service.Destroy(allService); } } catch { } } } catch { } try { try { try { SimDescription.sLoadedSimDescriptions.Clear(); } catch { } SimDescription.sLoadedSimDescriptions = null; SimDescription.sLoadedSimDescriptions = new List <SimDescription>(); } catch { StyledNotification.Format afra = new StyledNotification.Format("Failed 1", StyledNotification.NotificationStyle.kSystemMessage); StyledNotification.Show(afra); } if (!loadworld) { try { Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions.Clear(); Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions = null; Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions = new List <SimDescription>(); } catch { StyledNotification.Format afra = new StyledNotification.Format("Failed 2", StyledNotification.NotificationStyle.kSystemMessage); StyledNotification.Show(afra); } } try { MiniSimDescription.sMiniSims.Clear(); MiniSimDescription.sMiniSims = null; MiniSimDescription.sMiniSims = new Dictionary <ulong, MiniSimDescription>(); } catch { StyledNotification.Format afra = new StyledNotification.Format("Failed 3", StyledNotification.NotificationStyle.kSystemMessage); StyledNotification.Show(afra); } if (NiecMod.KillNiec.AssemblyCheckByNiec.IsInstalled("DGSCore")) { try { CommandSystem.ExecuteCommandString("dgsnocreate true"); StyledNotification.Format afra = new StyledNotification.Format("Termination Status: Perfect Execution!", StyledNotification.NotificationStyle.kGameMessageNegative); afra.mTNSCategory = NotificationManager.TNSCategory.Chatty; StyledNotification.Show(afra); } catch { } try { CommandSystem.ExecuteCommandString("dgsnocreate true"); } catch { } OptionsModel optionsModel = Sims3.Gameplay.UI.Responder.Instance.OptionsModel as OptionsModel; if (optionsModel != null) { optionsModel.SaveName = "ClearSave " + "No Name"; } try { GameStates.TransitionToEditTown(); } catch { } } } catch { } } } catch { } return; }
public static bool GhostSpawn(Urnstone me, Lot lot) { if (me.DeadSimsDescription == null) { return false; } if (!me.DeadSimsDescription.IsValidDescription) { me.DeadSimsDescription.Fixup(); } Vector3 position; if (me.DeadSimsDescription.ToddlerOrBelow) { position = lot.EntryPoint(); } else if (!me.InInventory) { position = me.Position; } else { position = Service.GetPositionInRandomLot(lot); } Household.NpcHousehold.Add(me.DeadSimsDescription); Sim sim = Instantiation.Perform(me.DeadSimsDescription, position, null, null); sim.SetOpacity(0f, 0f); ActiveTopic.AddToSim(sim, "Ghost"); me.GhostSetup(sim, true); if (!me.InInventory) { sim.GreetSimOnLot(me.LotCurrent); Audio.StartObjectSound(me.ObjectId, "sting_ghost_appear", false); } sim.FadeIn(); me.CreateAlarmReturnToGrave(false); return true; }
/* * [Tunable] * [TunableComment("Range: Fun/Stress motive amount. Description: Amount of stress that a Sim gets when seeing another Sim die.")] * public static float kWitnessDeathStressPenalty = -50f; * * [Tunable] * [TunableComment("Range: Float multiplier. Description: Multiplier on additional stress when a family member of loved one sees a Sim die.")] * public static float kWitnessDeathRelationshipMultiplier = 1.5f; * * [TunableComment("Range: Fun/Stress motive amount. Description: Amount of fun that a Sim gets when seeing an enemy Sim die.")] * [Tunable] * public static float kWitnessEnemyDeathFunGain = 50f; * */ public override bool Run() { SwimmingInPool swimmingInPool = Actor.Posture as SwimmingInPool; if (swimmingInPool != null && !swimmingInPool.ContainerPool.RouteToEdge(Actor)) { return(false); } SwimmingInPool swimmingInPool2 = Target.Posture as SwimmingInPool; if (swimmingInPool2 != null) { if (!swimmingInPool2.ContainerPool.RouteToEdge(Actor)) { return(false); } Actor.RouteTurnToFace(Target.Position); } else if (!GlobalFunctions.ObjectsWithinRadiusOfEachOther(Actor, Target, 2f)) { if (Actor == null || Target == null || Target.LotCurrent == null) { return(false); } Route route = Actor.CreateRoute(); if (route == null) { return(false); } RequestWalkStyle(Sim.WalkStyle.Run); route.PlanToPointRadialRange(Target.Position, 2f, 6f, RouteDistancePreference.PreferNearestToRouteDestination, RouteOrientationPreference.TowardsObject, Target.LotCurrent.LotId, new int[1] { Target.RoomId }); if (Actor == null || !Actor.DoRoute(route)) { return(false); } UnrequestWalkStyle(Sim.WalkStyle.Run); } else { Actor.RouteTurnToFace(Target.Position); } if (Simulator.CheckYieldingContext(false)) { Simulator.Sleep(20); } if (Target.SimDescription == null || !Target.SimDescription.IsValidDescription) { return(true); } NFinalizeDeath.CheckYieldingContext(); StateMachineClient stateMachineClient = StateMachineClient.Acquire(Actor, "DeathReactions"); stateMachineClient.SetActor("x", Actor); stateMachineClient.EnterState("x", "Enter"); BeginCommodityUpdates(); bool flag = false; bool flag2 = false; //bool flag3 = false; LTRData.RelationshipClassification relationshipClassification = LTRData.RelationshipClassification.Low; Relationship relationship = Relationship.Get(Actor, Target, false); if (relationship != null) { relationshipClassification = LTRData.Get(relationship.LTR.CurrentLTR).RelationshipClass; } if (Actor == null || Target == null || Actor.Genealogy == null || Target.Genealogy == null) { return(true); } if (relationshipClassification == LTRData.RelationshipClassification.High || Actor.Genealogy.IsBloodRelated(Target.Genealogy)) { if (relationship != null && relationship.AreRomantic() && relationship.LTR.IsPositive) { flag2 = true; } else { flag = true; } //flag3 = true; } NFinalizeDeath.CheckYieldingContext(); switch (Actor.SimDescription.Species) { case CASAgeGenderFlags.None: case CASAgeGenderFlags.Human: if (!Actor.IsInActiveHousehold) { stateMachineClient.RequestState("x", "Shocked"); NFinalizeDeath.CheckYieldingContext(); if (RandomUtil.RandomChance(25)) { stateMachineClient.RequestState("x", "Evil"); } else { stateMachineClient.RequestState("x", "LovedOneLoop"); } flag = true; flag2 = true; //flag3 = true; } else { stateMachineClient.RequestState("x", "Shocked"); NFinalizeDeath.CheckYieldingContext(); Actor.Motives.ChangeValue(CommodityKind.Fun, kWitnessDeathStressPenalty); stateMachineClient.RequestState("x", "BasicLoop"); flag = false; flag2 = false; //flag3 = false; } break; case CASAgeGenderFlags.Dog: case CASAgeGenderFlags.LittleDog: stateMachineClient.RequestState("x", "Dog"); break; case CASAgeGenderFlags.Cat: stateMachineClient.RequestState("x", "Cat"); break; case CASAgeGenderFlags.Horse: stateMachineClient.RequestState("x", "Horse"); break; } EventTracker.SendEvent(EventTypeId.kSawSimDie, Actor, Target); DoLoop(ExitReason.Default, __LoopDel, stateMachineClient); EndCommodityUpdates(true); if (Actor.IsInActiveHousehold) { if (Actor.BuffManager == null) { return(false); } if (flag2 && Target.SimDescription.DeathStyle != 0) { Actor.BuffManager.AddElement(BuffNames.HeartBroken, Origin.FromWitnessingDeath); BuffHeartBroken.BuffInstanceHeartBroken buffInstanceHeartBroken = Actor.BuffManager.GetElement(BuffNames.HeartBroken) as BuffHeartBroken.BuffInstanceHeartBroken; if (buffInstanceHeartBroken != null) { buffInstanceHeartBroken.MissedSim = Target.SimDescription; } } else if (flag && Target.SimDescription.DeathStyle != 0) { Actor.BuffManager.AddElement(BuffNames.Mourning, Urnstone.CalculateMourningMoodStrength(Actor, Target.SimDescription), Origin.FromWitnessingDeath); BuffMourning.BuffInstanceMourning buffInstanceMourning = Actor.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning; if (buffInstanceMourning != null) { buffInstanceMourning.MissedSim = Target.SimDescription; } } } else { if (Actor.BuffManager == null) { return(false); } if (flag2) { Actor.BuffManager.AddElement(BuffNames.HeartBroken, Origin.FromWitnessingDeath); BuffHeartBroken.BuffInstanceHeartBroken buffInstanceHeartBroken = Actor.BuffManager.GetElement(BuffNames.HeartBroken) as BuffHeartBroken.BuffInstanceHeartBroken; if (buffInstanceHeartBroken != null) { buffInstanceHeartBroken.MissedSim = Target.SimDescription; } } else if (flag) { Actor.BuffManager.AddElement(BuffNames.Mourning, Urnstone.CalculateMourningMoodStrength(Actor, Target.SimDescription), Origin.FromWitnessingDeath); BuffMourning.BuffInstanceMourning buffInstanceMourning = Actor.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning; if (buffInstanceMourning != null) { buffInstanceMourning.MissedSim = Target.SimDescription; } } } NFinalizeDeath.CheckYieldingContext(); stateMachineClient.RequestState("x", "Exit"); stateMachineClient.Dispose(); //if (!NFinalizeDeath.IsAllActiveHousehold_SimObject(Actor) && // !NFinalizeDeath.IsAllActiveHousehold_SimObject(Target) && // !(Actor.SimDescription.Service is GrimReaper) && // !(Target.SimDescription.Service is GrimReaper) && // RandomUtil.RandomChance(70) //) //return NFinalizeDeath.ForceNHSReapSoul(Target, Actor); return(true); }
public bool ImportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader) { Inventory ths = mInventory; uint[] numArray; ths.DestroyItems(); ths.Owner.InventoryComp.InventoryUIModel.ClearInvalidItemStacks(); if (!reader.ReadUint32(0x804459ab, out numArray)) { return(false); } foreach (uint num in numArray) { IGameObject obj2 = GameObject.GetObject <IGameObject>(objIdTable[(int)num]); if (obj2 != null) { IPropertyStreamReader child = reader.GetChild(num); if (child != null) { bool flag = true; try { Urnstone urnstone = obj2 as Urnstone; if (urnstone != null) { flag = urnstone.ImportContent(resKeyTable, objIdTable, child, ths.Owner); } else if (obj2 is IPhoneCell) { if (ths.AmountIn <IPhoneCell>() == 0x1) { flag = false; } } else { flag = obj2.ImportContent(resKeyTable, objIdTable, child); } } catch (Exception) { flag = false; } if (!flag) { obj2.Destroy(); continue; } } // Custom if (!Inventories.TryToMove(obj2, ths, false)) { obj2.Destroy(); } } } reader.ReadInt32(0x86c4285, out ths.mMaxInventoryCapacity, 0x0); return(true); }
public static bool Perform(SimDescription sim, bool cleanse) { if (sim == null) { return(false); } Common.StringBuilder msg = new Common.StringBuilder("Perform" + Common.NewLine); Household house = sim.Household; try { Sim createdSim = sim.CreatedSim; if (createdSim != null) { createdSim.ReservedVehicle = null; } if (PetAdoption.sNeighborAdoption != null) { if (PetAdoption.sNeighborAdoption.mMother == sim) { try { PetAdoption.ResetNeighborAdoption(); } catch (Exception e) { Common.Exception(sim, e); } finally { PetAdoption.sNeighborAdoption = null; } } else { PetAdoption.sNeighborAdoption.mPetsToAdopt.Remove(sim); } } foreach (Service service in Services.AllServices) { try { if (service == null) { continue; } msg += Common.NewLine + "Service: " + service.GetType(); if (sim.CreatedSim != null) { service.RemoveAssignment(sim.CreatedSim); } service.RemovePreferredSim(sim); service.mPool.Remove(sim); ResortWorker resortWorker = service as ResortWorker; if (resortWorker != null) { if (resortWorker.mWorkerInfo != null) { List <ObjectGuid> remove = new List <ObjectGuid>(); foreach (KeyValuePair <ObjectGuid, ResortWorker.WorkerInfo> info in resortWorker.mWorkerInfo) { if ((info.Value.CurrentSimDescriptionID == sim.SimDescriptionId) || (info.Value.DesiredSimDescriptionID == sim.SimDescriptionId)) { remove.Add(info.Key); } } foreach (ObjectGuid rem in remove) { resortWorker.mWorkerInfo[rem] = new ResortWorker.WorkerInfo(); } } } } catch (Exception e) { Common.Exception(sim, null, msg, e); } } msg += Common.NewLine + "A"; List <Household> houses = new List <Household>(); if (house != null) { houses.Add(house); } foreach (Household check in Household.sHouseholdList) { if (check == house) { continue; } if (check.Contains(sim)) { houses.Add(check); } } foreach (Household remove in houses) { Household.HouseholdSimsChangedCallback changedCallback = null; try { changedCallback = remove.HouseholdSimsChanged; remove.HouseholdSimsChanged = null; remove.Remove(sim, !remove.IsSpecialHousehold); } finally { remove.HouseholdSimsChanged = changedCallback; } } msg += Common.NewLine + "B"; try { if (cleanse) { if (sim.LifeEventManager != null) { sim.LifeEventManager.Purge(); } } } catch (Exception e) { Common.Exception(sim, null, msg, e); } msg += Common.NewLine + "C"; RemoveSimDescriptionRelationships(sim); msg += Common.NewLine + "D"; PetPoolManager.RemoveIdFromPool(sim.SimDescriptionId); msg += Common.NewLine + "E"; try { if (sim.CareerManager != null) { sim.CareerManager.LeaveAllJobs(Career.LeaveJobReason.kDied); } } catch (Exception e) { sim.CareerManager.mJob = null; sim.CareerManager.mSchool = null; Common.Exception(sim, null, msg, e); } msg += Common.NewLine + "F"; if (sim.CASGenealogy == null) { // Necessary to stop an error in MidLifeCrisisManager sim.mGenealogy = new Genealogy(sim); } msg += Common.NewLine + "G"; try { if (sim.Partner != null) { sim.Partner.Partner = null; } sim.Partner = null; } catch (Exception e) { Common.Exception(sim, null, msg, e); } msg += Common.NewLine + "H"; if (sim.DeathStyle != SimDescription.DeathType.None) { // Passing in a household can invoke the social worker, so don't bother Urnstone.FinalizeSimDeath(sim, null /*house*/); } msg += Common.NewLine + "I"; Urnstone urnstone = Urnstones.FindGhostsGrave(sim); msg += Common.NewLine + "J"; if ((cleanse) && (urnstone != null)) { if (urnstone.InInventory) { Inventory inventory = Inventories.ParentInventory(urnstone); if (inventory != null) { inventory.RemoveByForce(urnstone); } } if (urnstone.DeadSimsDescription != null) { urnstone.DeadSimsDescription.Fixup(); } try { urnstone.Dispose(); } catch (Exception e) { Common.DebugException(sim, null, msg, e); } urnstone.Destroy(); } msg += Common.NewLine + "K"; if ((FakeMetaAutonomy.Instance != null) && (FakeMetaAutonomy.Instance.mPool != null)) { FakeMetaAutonomy.Instance.mPool.Remove(sim); } msg += Common.NewLine + "L"; if (Sims3.Gameplay.Services.FakeMetaAutonomy.mToDestroy != null) { Sims3.Gameplay.Services.FakeMetaAutonomy.mToDestroy.Remove(sim); } msg += Common.NewLine + "M"; if ((houses.Contains(Household.ActiveHousehold)) && (sim.CreatedSim != null)) { HudModel model = HudController.Instance.Model as HudModel; foreach (SimInfo info in model.mSimList) { if (info.mGuid == sim.CreatedSim.ObjectId) { model.RemoveSimInfo(info); model.mSimList.Remove(info); break; } } } msg += Common.NewLine + "N"; try { if (sim.AssignedRole != null) { sim.AssignedRole.RemoveSimFromRole(); } } catch (Exception e) { Common.DebugException(sim, null, msg, e); sim.AssignedRole = null; } msg += Common.NewLine + "O1"; if ((CarNpcManager.Singleton != null) && (CarNpcManager.Singleton.NpcDriversManager != null)) { foreach (Stack <SimDescription> stack in CarNpcManager.Singleton.NpcDriversManager.mDescPools) { if (stack == null) { continue; } List <SimDescription> sims = new List <SimDescription>(); bool found = false; foreach (SimDescription stackSim in stack) { if (stackSim == sim) { found = true; } else { sims.Add(stackSim); } } if (found) { stack.Clear(); foreach (SimDescription stackSim in sims) { stack.Push(stackSim); } } } } msg += Common.NewLine + "O2"; if (cleanse) { sim.Dispose(); } msg += Common.NewLine + "P"; if ((house != null) && (createdSim != null)) { house.OnMemberChanged(sim, createdSim); } return(true); } catch (Exception e) { Common.Exception(sim, null, msg, e); if (house != null) { Household.HouseholdSimsChangedCallback changedCallback = null; try { changedCallback = house.HouseholdSimsChanged; house.HouseholdSimsChanged = null; house.Add(sim); } finally { house.HouseholdSimsChanged = changedCallback; } } return(false); } }
public static Urnstone CreateGrave(SimDescription me, SimDescription.DeathType deathType, bool ignoreExisting, bool report) { Urnstone urnstone = FindGhostsGrave(me); if ((urnstone != null) && (!ignoreExisting)) { if ((urnstone.InInventory) || (urnstone.InWorld)) { return(urnstone); } } Household originalHousehold = me.Household; bool addOnly = false; if (urnstone == null) { urnstone = PrivateCreateGrave(me); if (urnstone == null) { return(null); } } else { addOnly = true; } bool success = MoveToMausoleum(urnstone); if (!success) { if (me.CreatedSim != null) { if (Inventories.TryToMove(urnstone, me.CreatedSim.Inventory)) { success = true; } } if ((!success) && (Sim.ActiveActor != null)) { if (Inventories.TryToMove(urnstone, Sim.ActiveActor.Inventory)) { success = true; } } if (!success) { return(null); } } if (report) { Common.Notify(Common.Localize("ForceKill:Success", me.IsFemale, new object[] { me })); } if ((addOnly) && (!ignoreExisting)) { return(urnstone); } if ((originalHousehold == Household.ActiveHousehold) && (me.CreatedSim != null)) { HudModel model = HudController.Instance.Model as HudModel; foreach (SimInfo info in model.mSimList) { if (info.mGuid == me.CreatedSim.ObjectId) { model.RemoveSimInfo(info); model.mSimList.Remove(info); break; } } } if (me.CreatedSim != null) { me.CreatedSim.Destroy(); } if (originalHousehold != null) { originalHousehold.Remove(me, !originalHousehold.IsSpecialHousehold); } if (me.DeathStyle == SimDescription.DeathType.None) { if (me.IsHuman) { switch (deathType) { case SimDescription.DeathType.None: case SimDescription.DeathType.PetOldAgeBad: case SimDescription.DeathType.PetOldAgeGood: deathType = SimDescription.DeathType.OldAge; break; } } else { switch (deathType) { case SimDescription.DeathType.None: case SimDescription.DeathType.OldAge: deathType = SimDescription.DeathType.PetOldAgeGood; break; } } me.SetDeathStyle(deathType, true); } me.IsNeverSelectable = true; me.Contactable = false; me.Marryable = false; if (me.CreatedSim == PlumbBob.SelectedActor) { LotManager.SelectNextSim(); } if (me.CareerManager != null) { me.CareerManager.LeaveAllJobs(Sims3.Gameplay.Careers.Career.LeaveJobReason.kDied); } urnstone.OnHandToolMovement(); Urnstone.FinalizeSimDeath(me, originalHousehold); int num = ((int)Math.Floor((double)SimClock.ConvertFromTicks(SimClock.CurrentTime().Ticks, TimeUnit.Minutes))) % 60; urnstone.MinuteOfDeath = num; return(urnstone); }
private static void AddInteractionsForUrnstones(Urnstone obj) { obj.AddInteraction(ResurrectFromGrave.Singleton, true); }
protected static Urnstone PrivateCreateGrave(SimDescription corpse) { string style; ProductVersion version = ProductVersion.BaseGame; switch (corpse.Species) { case CASAgeGenderFlags.Dog: case CASAgeGenderFlags.LittleDog: style = "tombstoneDog"; version = ProductVersion.EP5; break; case CASAgeGenderFlags.Horse: if (corpse.IsUnicorn) { style = "tombstoneUnicorn"; } else { style = "tombstoneHorse"; } version = ProductVersion.EP5; break; case CASAgeGenderFlags.Cat: style = "tombstoneCat"; version = ProductVersion.EP5; break; default: ulong lifetimeHappiness = corpse.LifetimeHappiness; if (lifetimeHappiness >= Urnstone.LifetimeHappinessWealthyTombstone) { style = "UrnstoneHumanWealthy"; } else if (lifetimeHappiness < Urnstone.LifetimeHappinessPoorTombstone) { style = "UrnstoneHumanPoor"; } else { style = "UrnstoneHuman"; } break; } Urnstone stone = GlobalFunctions.CreateObject(style, version, Vector3.OutOfWorld, 0, Vector3.UnitZ, null, null) as Urnstone; if (stone == null) { return(null); } corpse.Fixup(); stone.SetDeadSimDescription(corpse); stone.mPlayerMoveable = true; return(stone); }
public static void RemoveUrnstoneInteractions(Urnstone obj) { obj.RemoveInteractionByType(ResurrectFromGrave.Singleton); }
// Lacks the "greater than eight" restriction public static bool GhostToPlayableGhost(Urnstone ths, Household newHousehold, Vector3 ghostPosition) { SimDescription simDescription = ths.DeadSimsDescription; if (!simDescription.IsValidDescription) { simDescription.Fixup(); } if (simDescription.Household != null) { simDescription.Household.Remove(simDescription, !simDescription.Household.IsSpecialHousehold); } if (!newHousehold.Contains(simDescription)) { newHousehold.Add(simDescription); } Sim ghost = Instantiation.Perform(simDescription, ghostPosition, null, null); if (ghost == null) { return(false); } ths.GhostSetup(ghost, true); ths.RemoveMourningRelatedBuffs(ghost); simDescription.ShowSocialsOnSim = true; simDescription.IsNeverSelectable = false; simDescription.Marryable = true; simDescription.Contactable = true; if (!simDescription.IsEP11Bot) { simDescription.AgingEnabled = true; simDescription.AgingState.ResetAndExtendAgingStage(0f); simDescription.PushAgingEnabledToAgingManager(); } string failureReason; if (!Inventories.TryToMove(ths, ghost.Inventory, true, out failureReason)) { Common.DebugNotify(failureReason); } //Inventories.TryToMove(ths, ghost); if (simDescription.Child || simDescription.Teen) { simDescription.AssignSchool(); } if (ghost.IsSelectable) { ghost.OnBecameSelectable(); } return(true); }
public AddSims(Household house, IEnumerable <IMiniSimDescription> miniSims, bool overStuff, bool transferFunds, bool dreamCatcher) { mOldMembers = new List <SimDescription>(CommonSpace.Helpers.Households.All(house)); foreach (IMiniSimDescription iMiniSim in new List <IMiniSimDescription>(miniSims)) { if (overStuff) { if (iMiniSim.IsHuman) { if (CommonSpace.Helpers.Households.NumHumansIncludingPregnancy(house) >= 8) { continue; } } else { if (CommonSpace.Helpers.Households.NumPetsIncludingPregnancy(house) >= 6) { continue; } } } MiniSimDescription miniSim = null; bool lastActiveSim = false; SimDescription sim = iMiniSim as SimDescription; if (sim == null) { miniSim = iMiniSim as MiniSimDescription; if (miniSim == null) { continue; } sim = MiniSims.UnpackSimAndUpdateRel(miniSim); if (sim == null) { continue; } } else if (sim.CreatedSim == Sim.ActiveActor) { if (Households.NumSims(sim.Household) == 1) { lastActiveSim = true; } else { LotManager.SelectNextSim(); } } Household oldHouse = sim.Household; if (oldHouse != null) { if (oldHouse == Household.ActiveHousehold) { Household.RoommateManager.RemoveRoommateInternal(sim); } if ((transferFunds) && (oldHouse.NumMembers == 1)) { int funds = oldHouse.FamilyFunds; if (oldHouse.LotHome != null) { funds += oldHouse.LotHome.Cost; } house.ModifyFamilyFunds(funds); Households.TransferData(house, oldHouse); } house.AddWardrobeToWardrobe(oldHouse.Wardrobe); house.AddServiceUniforms(oldHouse.mServiceUniforms); oldHouse.Remove(sim, !oldHouse.IsSpecialHousehold); if (PetAdoption.sNeighborAdoption != null) { PetAdoption.sNeighborAdoption.mPetsToAdopt.Remove(sim); } if (sim.CreatedSim != null) { oldHouse.GetCaregiverRoutingMonitor(sim.CreatedSim.LotCurrent, true); } } if ((oldHouse != null) && (!mOldHouses.ContainsKey(oldHouse))) { mOldHouses.Add(oldHouse, true); } mNewMembers.Add(sim); if (house.Name == null) { house.Name = sim.LastName; } if ((sim.IsDead) && (!sim.IsPlayableGhost)) { Urnstone grave = Urnstones.CreateGrave(sim, false); if (grave != null) { Urnstones.GhostToPlayableGhost(grave, house, house.LotHome.EntryPoint()); } } else { // Must be performed or the Household:Add() will bounce if (!sim.IsValidDescription) { sim.Fixup(); } MiniSims.ProtectedAddHousehold(house, sim); if (sim.IsPet) { foreach (PetPoolType type in Enum.GetValues(typeof(PetPoolType))) { if (PetPoolManager.IsPetInPoolType(sim, type)) { PetPoolManager.RemovePet(type, sim, true); } } } if ((CarNpcManager.Singleton != null) && (CarNpcManager.Singleton.NpcDriversManager != null)) { if (CarNpcManager.Singleton.NpcDriversManager.mDescPools != null) { for (int i = 0; i < CarNpcManager.Singleton.NpcDriversManager.mDescPools.Length; i++) { Stack <SimDescription> stack = CarNpcManager.Singleton.NpcDriversManager.mDescPools[i]; if (stack == null) { continue; } List <SimDescription> list = new List <SimDescription>(); foreach (SimDescription stackSim in stack) { if (stackSim == sim) { while (stack.Count > 0) { list.Add(stack.Pop()); } list.Remove(sim); for (int j = list.Count - 1; j >= 0; j--) { stack.Push(list[j]); } } } } } if ((sim.CreatedSim != null) && (CarNpcManager.Singleton.NpcDriversManager.mNpcDrivers != null)) { CarNpcManager.Singleton.NpcDriversManager.mNpcDrivers.Remove(sim.CreatedSim); } } } if (house.LotHome != null) { Instantiation.EnsureInstantiate(sim, house.LotHome); } if (miniSim != null) { (Sims3.Gameplay.UI.Responder.Instance.HudModel as HudModel).OnSimCurrentWorldChanged(true, miniSim); AgingManager.Singleton.AddSimDescription(sim); sim.AgingState.MergeTravelInformation(miniSim); sim.SetFlags(SimDescription.FlagField.AgingEnabled, true); } try { if (sim.Service != null) { sim.Service.EndService(sim); } if (sim.CreatedSim != null) { sim.CreatedSim.BuffManager.RemoveElement(BuffNames.StrayPet); DreamCatcher.AdjustSelectable(sim, sim.Household == Household.ActiveHousehold, dreamCatcher); sim.CreatedSim.SetObjectToReset(); sim.CreatedSim.Motives.RecreateMotives(sim.CreatedSim); Sim.MakeSimGoHome(sim.CreatedSim, false); if (lastActiveSim) { PlumbBob.DoSelectActor(sim.CreatedSim, false); } } } catch (Exception e) { Common.DebugException(sim, e); } } }
public void Dispose(bool postLoad, bool isReset) { try { if (mWasFutureSim) { mSim.TraitManager.AddHiddenElement(TraitNames.FutureSim); } if (mSim.CreatedSim != null) { BuffManager buffManager = mSim.CreatedSim.BuffManager; if ((buffManager != null) && (mBuffs != null)) { foreach (BuffInstance buff in mBuffs) { buffManager.AddBuff(buff.Guid, buff.mEffectValue, buff.mTimeoutCount, buff.mTimeoutPaused, buff.mAxisEffected, buff.mBuffOrigin, false); } } if ((mInventory != null) && (mSim.CreatedSim.Inventory != null)) { Inventories.RestoreInventoryFromList(mSim.CreatedSim.Inventory, mInventory, true); } if (mDreamStore != null) { mDreamStore.Restore(mSim.CreatedSim); } if (mSafeStore != null) { mSafeStore.Dispose(); } if (mSim.DeathStyle != SimDescription.DeathType.None) { Urnstone stone = Urnstones.FindGhostsGrave(mSim); if (stone != null) { stone.GhostSetup(mSim.CreatedSim, true); } } mSim.CreatedSim.ReservedVehicle = mReservedVehicle; } } catch (Exception e) { Common.Exception(mSim, null, "Inventory", e); } // Must be after the opportunities are restored if ((mOpportunitiesChanged != null) && (OpportunityTrackerModel.gSingleton != null)) { OpportunityTrackerModel.gSingleton.OpportunitiesChanged = mOpportunitiesChanged; } try { if (!postLoad) { if ((mSim.CreatedSim != null) && (mSim.CreatedSim.OpportunityManager != null) && (mSim.CreatedSim.OpportunityManager.Count > 0)) { OpportunityTrackerModel.FireOpportunitiesChanged(); } } } catch (Exception e) { Common.Exception(mSim, null, "FireOpportunitiesChanged", e); } EventTracker.sCurrentlyUpdatingDreamsAndPromisesManagers = false; mSim.mGenealogy = mGenealogy; if (mDoll != null) { mDoll.mOwner = mSim; if (SimTypes.IsSelectable(mSim)) { try { mDoll.OnOwnerBecameSelectable(); } catch (Exception e) { Common.Exception(mSim, e); SimDescription sim = mDoll.GetLiveFormSimDescription(); if (sim != null) { new FixInvisibleTask(sim).AddToSimulator(); } } } } if ((mSim.CreatedSim != null) && (mSim.CreatedSim.Motives != null)) { if (mAcademicPerformance != -101) { mSim.CreatedSim.Motives.CreateMotive(CommodityKind.AcademicPerformance); Motive motive = mSim.CreatedSim.Motives.GetMotive(CommodityKind.AcademicPerformance); if (motive != null) { motive.Value = mAcademicPerformance; } } if (mUniversityStudy != -101) { mSim.CreatedSim.Motives.CreateMotive(CommodityKind.UniversityStudy); Motive motive = mSim.CreatedSim.Motives.GetMotive(CommodityKind.UniversityStudy); if (motive != null) { motive.Value = mUniversityStudy; } } } Relationships.RestoreRelations(mSim, mRelations); if ((mSim.TraitChipManager != null) && (mChips != null)) { for (int i = 0; i < mChips.Length; i++) { if (mChips[i] == null) { continue; } Common.StringBuilder name = new Common.StringBuilder(); try { name.Append(mChips[i].GetLocalizedName()); mSim.TraitChipManager.AddTraitChip(mChips[i], i); } catch (Exception e) { Common.Exception(mSim, null, name, e); } } } sChangingWorldsSuppression.Pop(); if ((mChangedHousehold != null) && (mChangedCallback != null)) { mChangedHousehold.HouseholdSimsChanged = mChangedCallback; } }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { Lot lot = Porter.GetLot(parameters.mTarget); if (lot == null) { return(OptionResult.Failure); } List <SimDescription> selection = null; List <HouseholdItem> allHouses = new List <HouseholdItem>(); foreach (Household house in Household.sHouseholdList) { allHouses.Add(new HouseholdItem(house, house == lot.Household)); } string houseName = null; while (selection == null) { List <Household> houses = HouseholdSelection.Perform(lot.Household.Name, allHouses); if ((houses == null) || (houses.Count == 0)) { return(OptionResult.Failure); } houseName = houses[0].Name; selection = GetSimSelection(houses); } if ((selection == null) || (selection.Count == 0)) { return(OptionResult.Failure); } Dictionary <Household, int> finalHouses = new Dictionary <Household, int>(); int nextID = 1; foreach (SimDescription sim in selection) { if (sim.Household == null) { continue; } if (sim.Household.IsServiceNpcHousehold) { continue; } if (!finalHouses.ContainsKey(sim.Household)) { finalHouses.Add(sim.Household, nextID); nextID++; } } string name = StringInputDialog.Show(Common.Localize("Title"), Common.Localize("Pack:NamePrompt", false, new object[] { finalHouses.Count, selection.Count }), houseName); if (string.IsNullOrEmpty(name)) { return(OptionResult.Failure); } Household export = Household.Create(); SpeedTrap.Sleep(); foreach (Household house in finalHouses.Keys) { if (house.LotHome != null) { export.SetFamilyFunds(export.FamilyFunds + house.FamilyFunds + house.LotHome.Cost); } else { export.SetFamilyFunds(export.FamilyFunds + house.NetWorth()); } } Dictionary <SimDescription, Household> saveHouses = new Dictionary <SimDescription, Household>(); Dictionary <Sim, bool> resetDNP = new Dictionary <Sim, bool>(); Dictionary <Household, bool> inventoried = new Dictionary <Household, bool>(); foreach (SimDescription sim in selection) { if (sim.CreatedSim != null) { sim.CreatedSim.SetReservedVehicle(null); if (sim.CreatedSim.DreamsAndPromisesManager != null) { sim.CreatedSim.NullDnPManager(); if (!resetDNP.ContainsKey(sim.CreatedSim)) { resetDNP.Add(sim.CreatedSim, true); } } if ((sim.Household != null) && (!inventoried.ContainsKey(sim.Household))) { inventoried.Add(sim.Household, true); if ((sim.Household.SharedFamilyInventory != null) && (sim.Household.SharedFamilyInventory.Inventory != null)) { foreach (GameObject obj in Inventories.QuickFind <GameObject>(sim.Household.SharedFamilyInventory.Inventory)) { if (Inventories.TryToMove(obj, sim.CreatedSim.Inventory, false)) { continue; } Inventories.TryToMove(obj.Clone(), export.SharedFamilyInventory.Inventory); } } if ((sim.Household.SharedFridgeInventory != null) && (sim.Household.SharedFridgeInventory.Inventory != null)) { foreach (GameObject obj in Inventories.QuickFind <GameObject>(sim.Household.SharedFridgeInventory.Inventory)) { if (Inventories.TryToMove(obj, sim.CreatedSim.Inventory, false)) { continue; } Inventories.TryToMove(obj.Clone(), export.SharedFridgeInventory.Inventory); } } } } int id = 0; if ((sim.Household != null) && (finalHouses.ContainsKey(sim.Household))) { id = finalHouses[sim.Household]; } else { Urnstone grave = Urnstones.CreateGrave(sim, false); if (grave == null) { continue; } SpeedTrap.Sleep(); bool success = false; try { success = Urnstones.GhostToPlayableGhost(grave, Household.NpcHousehold, lot.EntryPoint()); } catch (Exception exception) { Common.DebugException(grave.DeadSimsDescription, exception); } if (!success) { Porter.Notify(Common.Localize("Pack:SimFailure", sim.IsFemale, new object[] { sim })); Porter.PlaceGraveTask.Perform(sim); //export.SharedFamilyInventory.Inventory.TryToMove(grave); continue; } } HouseData data = new HouseData(id, sim); sim.mBio = data.ToString(); saveHouses.Add(sim, sim.Household); sim.OnHouseholdChanged(export, false); export.mMembers.Add(sim, null); Porter.AddExport(sim); } string packageName = null; try { try { ProgressDialog.Show(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/Global:Processing", new object[0x0]), false); if (export.mMembers.Count > 0) { export.Name = "NRaas.Porter:" + name; ThumbnailHelper.CacheSimAtlasesForHousehold(export); ThumbnailManager.GenerateHouseholdThumbnail(export.HouseholdId, export.HouseholdId, ThumbnailSizeMask.Large); packageName = BinEx.ExportHousehold(Bin.Singleton, export, false); if (packageName != null) { BinModel.Singleton.AddToExportBin(packageName); } } foreach (Sim sim in resetDNP.Keys) { try { sim.ResetDnP(); } catch (Exception e) { Common.DebugException(sim, e); } } List <Urnstone> graves = Inventories.QuickFind <Urnstone>(export.SharedFamilyInventory.Inventory); foreach (Urnstone grave in graves) { Porter.PlaceGraveTask.Perform(grave.DeadSimsDescription); } while (export.mMembers.Count > 0) { SimDescription sim = export.mMembers.SimDescriptionList[0]; if (sim != null) { sim.OnHouseholdChanged(saveHouses[sim], false); if ((sim.Household == null) || (sim.Household.IsServiceNpcHousehold)) { Porter.PlaceGraveTask.Perform(sim); } } export.mMembers.RemoveAt(0); } export.Destroy(); export.Dispose(); } finally { ProgressDialog.Close(); } } catch (ExecutionEngineException) { // Ignored } catch (Exception e) { Common.Exception(name, e); packageName = null; } if (packageName != null) { SimpleMessageDialog.Show(Common.Localize("Title"), Common.Localize("Pack:Success", false, new object[] { export.Name })); } else { SimpleMessageDialog.Show(Common.Localize("Title"), Common.Localize("Pack:Failure")); } return(OptionResult.SuccessClose); }