public override void CheckForGhostBaby(Sim s) { if ((mMomWasGhostFromPotion || mDadWasGhostFromPotion) && RandomUtil.RandomChance(kChanceForGhostBaby)) { Urnstones.SimToPlayableGhost(s.SimDescription, SimDescription.DeathType.OldAge); } }
public override void Cleanup() { //if (!Actor.IsInActiveHousehold || !(Actor.Service is GrimReaper)) //?? Fail and Ok? if (Actor.IsNPC && !Actor.IsInActiveHousehold && !(Actor.Service is GrimReaper)) { Urnstones.CreateGrave(Actor.SimDescription, SimDescription.DeathType.Drown, true, true); } //base.Cleanup(); }
public static bool TKill(Sim target, SimDescription.DeathType deathType, uint time) { if (target.IsInActiveHousehold || target.Service is GrimReaper) { return(false); } SpeedTrap.Sleep(time); Urnstones.CreateGrave(target.SimDescription, deathType, true, true); return(true); }
protected static void ProcessToBeDeleted(List <GameObject> list, bool log) { Mausoleum mausoleum = null; foreach (GameObject obj in new List <GameObject>(list)) { try { Urnstone stone = obj as Urnstone; if ((stone != null) && (stone.DeadSimsDescription != null)) { if (mausoleum == null) { List <Mausoleum> mausoleums = new List <Mausoleum> (Sims3.Gameplay.Queries.GetObjects <Mausoleum>()); if (mausoleums.Count > 0) { mausoleum = RandomUtil.GetRandomObjectFromList(mausoleums); } } if (mausoleum != null) { Urnstones.MoveToMausoleum(mausoleum, stone); LogCorrection("Stone Mausoleumed: " + obj.GetType() + " (ID=" + stone.DeadSimsDescription.FullName + ")"); } } else { obj.Dispose(); obj.Destroy(); if (log) { LogCorrection("Destroyed: " + obj.GetType() + " (ID=" + obj.ObjectId + ")"); } else { DebugLogCorrection("Silent Destroyed: " + obj.GetType() + " (ID=" + obj.ObjectId + ")"); } } Common.Sleep(); } catch (Exception e) { Common.Exception(obj, e); } } list.Clear(); }
// Token: 0x0600A7E3 RID: 42979 RVA: 0x002FB788 File Offset: 0x002FA788 public override void Cleanup() { if (this.FixNotExit) { if (!Actor.IsInActiveHousehold) { this.DeathTypeFix = false; this.ActiveFix = false; this.Actor.MoveInventoryItemsToAFamilyMember(); Urnstones.CreateGrave(Actor.SimDescription, this.simDeathType, true, true); } } this.Actor.RemoveInteractionByType(Sim.DeathReaction.Singleton); if (this.CancelDeath) { SimDescription.DeathType deathStyle = this.Actor.SimDescription.DeathStyle; SimDescription simDescription = this.Actor.SimDescription; if (!simDescription.IsEP11Bot) { simDescription.AgingEnabled = true; if (simDescription.DeathStyle == SimDescription.DeathType.OldAge) { simDescription.AgingState.ResetAndExtendAgingStage(0f); } } simDescription.ShowSocialsOnSim = true; World.ObjectSetGhostState(this.Actor.ObjectId, 0u, (uint)simDescription.AgeGenderSpecies); simDescription.IsNeverSelectable = false; if (this.ActiveFix) { if (!Actor.IsInActiveHousehold) { //Actor.SimDescription.Contactable = false; this.Actor.MoveInventoryItemsToAFamilyMember(); this.DeathTypeFix = false; Urnstones.CreateGrave(Actor.SimDescription, this.simDeathType, true, true); } } if (this.DeathTypeFix) { simDescription.SetDeathStyle(SimDescription.DeathType.None, false); } } if (this.SocialJig != null) { this.SocialJig.Destroy(); this.SocialJig = null; } base.Cleanup(); }
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 void SetValue(Values value, Values storeType) { mValue = value; if (value.mOccult != OccultTypes.None) { mName = OccultTypeHelper.GetLocalizedName(value.mOccult); } else if (value.mDeathType != SimDescription.DeathType.None) { mName = Urnstones.GetLocalizedString(false, value.mDeathType); } else { mName = Common.Localize("Species:Human"); } }
public override bool Run() { ForceKillSimNiec.Definition definition = base.InteractionDefinition as ForceKillSimNiec.Definition; List <Sim> list = new List <Sim>(); foreach (Sim sim in LotManager.Actors) { 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) { Urnstones.CreateGrave(Target.SimDescription, definition.death, true, true); } return(true); }
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.None) { OccultTypeHelper.Add(me, type.mOccult, false, true); } else { Urnstones.SimToPlayableGhost(me, type.mDeathType); } } return(true); }
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 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; } }
public static bool Perform(SimDescription me, SimDescription.DeathType deathType) { if (me == null) { return(false); } Sim createdSim = me.CreatedSim; if (createdSim == PlumbBob.SelectedActor) { IntroTutorial.ForceExitTutorial(); LotManager.SelectNextSim(); } if (createdSim != null) { createdSim = Households.Reset.ResetSim(createdSim, false); if ((createdSim != null) && (createdSim.BuffManager != null)) { createdSim.BuffManager.RemoveAllElements(); } } Urnstone urnstone = Urnstones.CreateGrave(me, deathType, true, true); if (urnstone == null) { SimpleMessageDialog.Show(Common.Localize("ForceKill:MenuName"), Common.Localize("ForceKill:Error")); return(false); } if (createdSim != null) { if ((createdSim.Autonomy != null) && (createdSim.Autonomy.SituationComponent != null)) { List <Situation> situations = new List <Situation>(createdSim.Autonomy.SituationComponent.Situations); foreach (Situation situation in situations) { situation.Exit(); } } if (createdSim.LotCurrent != null) { Lot lotCurrent = createdSim.LotCurrent; lotCurrent.LastDiedSim = me; lotCurrent.NumDeathsOnLot++; } if (createdSim.InteractionQueue != null) { createdSim.InteractionQueue.CancelAllInteractions(); } urnstone.GhostCleanup(createdSim, true); createdSim.Destroy(); } return(true); }
protected override void OnPerform() { Urnstones.CreateGrave(mSim, SimDescription.DeathType.OldAge, true, false); }
public static void AlienRefreshCallback() { string msg = "Alien Household Refresh" + Common.NewLine; if (Household.AlienHousehold == null) { msg += " - Alien household is null"; Common.DebugNotify(msg); return; } if (Household.AlienHousehold.NumMembers < AlienUtils.kAlienHouseholdNumMembers) { msg += " - Adding new alien" + Common.NewLine; CASAgeGenderFlags age = RandomUtil.GetRandomObjectFromList(Aliens.Settings.mValidAlienAges); CASAgeGenderFlags gender = RandomUtil.CoinFlip() ? CASAgeGenderFlags.Male : CASAgeGenderFlags.Female; SimDescription description = MakeAlien(age, gender, GameUtils.GetCurrentWorld(), 1f, true); if (Aliens.Settings.mAllowOccultAliens && RandomUtil.RandomChance(Aliens.Settings.mOccultAlienChance)) { msg += " -- Creating occult alien" + Common.NewLine; int numOccults = RandomUtil.GetInt(1, Aliens.Settings.mMaxAlienOccults); List <OccultTypes> validOccults = new List <OccultTypes>(Aliens.Settings.mValidAlienOccults); for (int i = 0; i < numOccults; i++) { if (validOccults.Count == 0) { break; } OccultTypes type = RandomUtil.GetRandomObjectFromList(validOccults); if (type != OccultTypes.Ghost) { OccultTypeHelper.Add(description, type, false, false); msg += " --- " + OccultTypeHelper.GetLocalizedName(type) + Common.NewLine; } else { SimDescription.DeathType deathType = RandomUtil.GetRandomObjectFromList((SimDescription.DeathType[])Enum.GetValues(typeof(SimDescription.DeathType))); Urnstones.SimToPlayableGhost(description, deathType); msg += " --- " + Urnstones.GetLocalizedString(description.IsFemale, deathType) + Common.NewLine; } validOccults.Remove(type); } } msg += " -- Adding baseline skills" + Common.NewLine; Skill element = null; element = description.SkillManager.AddElement(SkillNames.Logic); if (element != null) { element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mLogicSkill[0], Aliens.Settings.mLogicSkill[1])); } msg += " --- " + element.Name + Common.NewLine; element = description.SkillManager.AddElement(SkillNames.Handiness); if (element != null) { element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mHandinessSkill[0], Aliens.Settings.mHandinessSkill[1])); } msg += " --- " + element.Name + Common.NewLine; try { if (Aliens.Settings.mFutureSim) { msg += " -- Adding Adv Tech skill" + Common.NewLine; description.TraitManager.AddElement(TraitNames.FutureSim); element = description.SkillManager.AddElement(SkillNames.Future); if (element != null) { element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mFutureSkill[0], Aliens.Settings.mFutureSkill[1])); } } } catch (Exception e) { Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Adv Tech skill", e); } /* * if (age == CASAgeGenderFlags.Teen) * { * element = description.SkillManager.AddElement(SkillNames.LearnToDrive); * * if (element != null) * element.ForceSkillLevelUp(SkillManager.GetMaximumSupportedSkillLevel(SkillNames.LearnToDrive)); * } */ try { if (Aliens.Settings.mAlienScience) { msg += " -- Adding Science skill" + Common.NewLine; //Sim temp = description.InstantiateOffScreen(LotManager.GetFarthestLot(Household.ActiveHouseholdLot)); element = description.SkillManager.AddElement(SkillNames.Science); if (element != null) { element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mScienceSkill[0], Aliens.Settings.mScienceSkill[1])); } //temp.Destroy(); } } catch (Exception e) { Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Science skill", e); } try { if (OccultTypeHelper.HasType(description, OccultTypes.Fairy) || OccultTypeHelper.HasType(description, OccultTypes.PlantSim)) { msg += " -- Adding Gardening skill" + Common.NewLine; element = description.SkillManager.AddElement(SkillNames.Gardening); if (element != null) { element.ForceSkillLevelUp(RandomUtil.GetInt(3, 6)); } } } catch (Exception e) { Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Gardening skill", e); } try { if (OccultTypeHelper.HasType(description, OccultTypes.Fairy)) { msg += " -- Adding Fairy Magic skill" + Common.NewLine; element = description.SkillManager.AddElement(SkillNames.FairyMagic); if (element != null) { element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mFairyMagicSkill[0], Aliens.Settings.mFairyMagicSkill[1])); } } } catch (Exception e) { Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Fairy Magic skill", e); } try { if (OccultTypeHelper.HasType(description, OccultTypes.Werewolf)) { msg += " -- Adding Lycanthropy skill" + Common.NewLine; element = description.SkillManager.AddElement(SkillNames.Lycanthropy); if (element != null) { element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mLycanthropySkill[0], Aliens.Settings.mLycanthropySkill[1])); } } } catch (Exception e) { Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Lycanthropy skill", e); } try { if (OccultTypeHelper.HasType(description, OccultTypes.Witch)) { msg += " -- Adding witch skills" + Common.NewLine; element = description.SkillManager.AddElement(SkillNames.Spellcasting); if (element != null) { element.ForceSkillLevelUp(RandomUtil.GetInt(3, 6)); } element = description.SkillManager.AddElement(SkillNames.Spellcraft); if (element != null) { element.ForceSkillLevelUp(RandomUtil.GetInt(3, 6)); } } } catch (Exception e) { Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add witch skills", e); } msg += " -- Adding alien to household"; Household.AlienHousehold.AddSilent(description); description.OnHouseholdChanged(Household.AlienHousehold, false); Common.DebugNotify(msg); } }
public static SimDescription MakeAlienBaby(SimDescription alien, SimDescription abductee, CASAgeGenderFlags gender, float averageMood, Random pregoRandom, bool interactive) { SimBuilder sb = new SimBuilder(); sb.Age = CASAgeGenderFlags.Baby; sb.Gender = gender; sb.Species = CASAgeGenderFlags.Human; sb.SkinTone = alien.SkinToneKey; sb.SkinToneIndex = alien.SkinToneIndex; sb.TextureSize = 1024u; sb.UseCompression = true; ApplyAlienFaceBlend(gender, ref sb); float hue = (sb.SkinToneIndex + 0.5f) % 1f; Color[] colors = new Color[] { HSLToRGB(hue, 0.71f, 0.5f), HSLToRGB(hue, 0.72f, 0.5f), HSLToRGB(hue, 0.73f, 0.5f), HSLToRGB(hue, 0.74f, 0.5f), HSLToRGB(hue, 0.75f, 0.5f), HSLToRGB(hue, 0.76f, 0.5f), HSLToRGB(hue, 0.77f, 0.5f), HSLToRGB(hue, 0.78f, 0.5f), HSLToRGB(hue, 0.79f, 0.5f), HSLToRGB(hue, 0.80f, 0.5f) }; SimDescription baby = Genetics.MakeSim(sb, CASAgeGenderFlags.Baby, gender, alien.SkinToneKey, alien.SkinToneIndex, colors, GameUtils.GetCurrentWorld(), 4294967295u, true); if (baby != null) { if (interactive) { baby.FirstName = string.Empty; } else { baby.FirstName = SimUtils.GetRandomAlienGivenName(baby.IsMale); } baby.LastName = abductee.LastName; Genetics.AssignTraits(baby, null, abductee, interactive, averageMood, pregoRandom); if (Aliens.Settings.mFutureSim) { baby.TraitManager.AddHiddenElement(TraitNames.FutureSim); } if (Aliens.Settings.mAllowOccultBabies) { List <OccultTypes> toInherit = OccultsToInherit(OccultTypeHelper.CreateList(abductee), OccultTypeHelper.CreateList(alien)); if (toInherit != null && toInherit.Count > 0) { for (int i = 0; i < toInherit.Count; i++) { if (toInherit[i] != OccultTypes.Ghost) { OccultTypeHelper.Add(baby, toInherit[i], false, false); } else { SimDescription.DeathType deathType = GetGhostBabyType(abductee, alien); Urnstones.SimToPlayableGhost(baby, deathType); } } if (OccultTypeHelper.HasType(baby, OccultTypes.Fairy)) { CASFairyData casFairyData = baby.SupernaturalData as CASFairyData; if (casFairyData != null) { Vector3 wingColor; WingTypes wingType; Genetics.InheritWings(baby, abductee, alien, pregoRandom, out wingColor, out wingType); casFairyData.WingType = wingType; casFairyData.WingColor = wingColor; } } } else if (RandomUtil.RandomChance01(abductee.Pregnancy.mChanceOfRandomOccultMutation)) { OccultTypeHelper.Add(baby, Pregnancy.ChooseARandomOccultMutation(), false, false); } } baby.CelebrityManager.SetBabyLevel(Genetics.AssignBabyCelebrityLevel(null, abductee)); abductee.Genealogy.AddChild(baby.Genealogy); if (alien != null) { alien.Genealogy.AddChild(baby.Genealogy); } } return(baby); }
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); }
public string GetDetails(IMiniSimDescription me) { Common.StringBuilder msg = new Common.StringBuilder(); try { msg += GetHeader(me); SimDescription simDesc = me as SimDescription; MiniSimDescription miniDesc = me as MiniSimDescription; if (simDesc != null) { if (!simDesc.AgingEnabled) { msg += Common.Localize("Status:AgingDisabled", me.IsFemale); } msg += Common.NewLine + Common.LocalizeEAString("Ui/Caption/HUD/KnownInfoDialog:" + simDesc.Zodiac.ToString()); } else if (miniDesc != null) { if (!miniDesc.mbAgingEnabled) { msg += Common.Localize("Status:AgingDisabled", me.IsFemale); } } SimDescription.DeathType deathType = SimDescription.DeathType.None; if (simDesc != null) { deathType = simDesc.DeathStyle; } else if (miniDesc != null) { deathType = miniDesc.mDeathStyle; } if (deathType != SimDescription.DeathType.None) { msg += Common.Localize("Status:Death", me.IsFemale) + Urnstones.GetLocalizedString(me.IsFemale, deathType); } List <OccultTypes> occultTypes = new List <OccultTypes>(); OccultTypes primaryOccult = OccultTypes.None; if (simDesc != null) { if (simDesc.OccultManager != null) { foreach (OccultTypes type in Enum.GetValues(typeof(OccultTypes))) { if (type == OccultTypes.None) { continue; } if (simDesc.OccultManager.HasOccultType(type)) { occultTypes.Add(type); } } } if (simDesc.SupernaturalData != null) { primaryOccult = simDesc.SupernaturalData.OccultType; } } else if (miniDesc != null) { if (miniDesc.IsVampire) { occultTypes.Add(OccultTypes.Vampire); } if (miniDesc.IsFrankenstein) { occultTypes.Add(OccultTypes.Frankenstein); } if (miniDesc.IsMummy) { occultTypes.Add(OccultTypes.Mummy); } if (miniDesc.IsUnicorn) { occultTypes.Add(OccultTypes.Unicorn); } if (miniDesc.IsGenie) { occultTypes.Add(OccultTypes.Unicorn); } if (miniDesc.IsWerewolf) { occultTypes.Add(OccultTypes.Werewolf); } if (miniDesc.IsWitch) { occultTypes.Add(OccultTypes.Witch); } if (miniDesc.IsFairy) { occultTypes.Add(OccultTypes.Fairy); } } foreach (OccultTypes type in occultTypes) { string isPrimary = null; if (primaryOccult == type) { isPrimary = " (+)"; } msg += Common.Localize("Status:Occult", me.IsFemale, new object[] { OccultTypeHelper.GetLocalizedName(type) + isPrimary }); } if (simDesc != null) { if (simDesc.LotHome != null) { msg += Common.Localize("Status:TypeResidentV2", me.IsFemale); } else if (simDesc.Household == null) { msg += Common.Localize("Status:TypeOutOfTowner", me.IsFemale); } else if (simDesc.AssignedRole != null) { msg += Common.Localize("Status:TypeService", me.IsFemale, new object[] { Roles.GetLocalizedName(simDesc.AssignedRole) }); } else if (simDesc.Household.IsServiceNpcHousehold) { if (SimTypes.InServicePool(simDesc)) { msg += Common.Localize("Status:TypeService", me.IsFemale, new object[] { Common.LocalizeEAString("Ui/Caption/Services/Service:" + simDesc.CreatedByService.ServiceType.ToString()) }); } else { msg += Common.Localize("Status:TypeOutOfTowner", me.IsFemale); } } else if (simDesc.Household.IsTouristHousehold) { msg += Common.Localize("Status:TypeTourist", me.IsFemale); } else if (simDesc.Household.IsTravelHousehold) { msg += Common.Localize("Status:TypeTravel", me.IsFemale); } else { msg += Common.Localize("Status:TypeHomeless", me.IsFemale); } } else if (miniDesc != null) { msg += Common.Localize("Status:TypeOutOfTowner", me.IsFemale); } string worldName = me.HomeWorld.ToString(); if (!Enum.IsDefined(typeof(WorldName), me.HomeWorld)) { worldName = ((ulong)me.HomeWorld).ToString(); } string homeWorld = Common.LocalizeEAString("Ui/Caption/Global/WorldName/EP01:" + worldName);// Sims3.UI.Responder.Instance.HudModel.LocationName(me.HomeWorld); if ((!string.IsNullOrEmpty(homeWorld)) && (homeWorld != "Ui/Caption/Global/WorldName/EP01:" + worldName)) { msg += Common.Localize("Status:HomeWorld", me.IsFemale, new object[] { homeWorld }); } if (simDesc != null) { msg += Common.Localize("Status:Favorites", me.IsFemale, new object[] { CASCharacter.GetFavoriteColor(simDesc.FavoriteColor), CASCharacter.GetFavoriteFood(simDesc.FavoriteFood), CASCharacter.GetFavoriteMusic(simDesc.FavoriteMusic) }); string LTWName = LifetimeWants.GetName(simDesc); if (!string.IsNullOrEmpty(LTWName)) { msg += Common.Localize("Status:LTW", me.IsFemale, new object[] { LTWName, Common.Localize("YesNo:" + simDesc.HasCompletedLifetimeWish.ToString()) }); } else { msg += Common.Localize("Status:NoLTW", me.IsFemale); } msg += Common.Localize("Status:LifetimeReward", me.IsFemale, new object[] { simDesc.LifetimeHappiness, simDesc.SpendableHappiness }); if (simDesc.CreatedSim != null) { if (simDesc.LotHome == simDesc.CreatedSim.LotCurrent) { msg += Common.Localize("Status:LocationHome", me.IsFemale); } else if ((simDesc.CreatedSim.LotCurrent != null) && (!simDesc.CreatedSim.LotCurrent.IsWorldLot)) { msg += Common.Localize("Status:LocationAt", me.IsFemale, new object[] { simDesc.CreatedSim.LotCurrent.Name }); } else { msg += Common.Localize("Status:LocationTransit", me.IsFemale); } msg += Common.Localize("Status:Mood" + simDesc.CreatedSim.MoodManager.MoodFlavor.ToString(), me.IsFemale); if (simDesc.CreatedSim.Autonomy != null) { if (simDesc.CreatedSim.Autonomy.AllowedToRunMetaAutonomy) { msg += Common.Localize("Status:Autonomous", me.IsFemale); } foreach (Situation situation in simDesc.CreatedSim.Autonomy.SituationComponent.Situations) { msg += Common.Localize("Status:Situation", me.IsFemale, new object[] { situation.ToString() }); } } } else { msg += Common.Localize("Status:LocationOutOfTown", me.IsFemale); } } string traits = null; int traitCount = 0; if (simDesc != null) { if (simDesc.TraitManager != null) { foreach (Trait trait in simDesc.TraitManager.List) { if (trait.IsReward) { continue; } traits += Common.NewLine + trait.TraitName(me.IsFemale); traitCount++; } } } else if (miniDesc != null) { if (miniDesc.Traits != null) { foreach (TraitNames traitName in miniDesc.Traits) { Trait trait = TraitManager.GetTraitFromDictionary(traitName); if (trait == null) { continue; } if (trait.IsReward) { continue; } traits += Common.NewLine + trait.TraitName(me.IsFemale); traitCount++; } } } if (traitCount > 10) { msg += Common.Localize("Status:TraitsOverTen", me.IsFemale, new object[] { traitCount }); } else if (traitCount > 0) { msg += Common.Localize("Status:Traits", me.IsFemale, new object[] { traits }); } } catch (Exception e) { Common.Exception(me.FullName, e); msg += Common.NewLine + "END OF LINE"; } return(msg.ToString()); }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { Dictionary <ulong, List <IMiniSimDescription> > sims = SimListing.AllSims <IMiniSimDescription>(null, true); if ((sims == null) || (sims.Count == 0)) { return(OptionResult.Failure); } List <IMiniSimDescription> dead = new List <IMiniSimDescription>(); foreach (List <IMiniSimDescription> miniSims in sims.Values) { foreach (IMiniSimDescription miniSim in miniSims) { SimDescription sim = miniSim as SimDescription; if (sim == null) { continue; } if ((!sim.IsDead) && (!sim.IsGhost) && (sim.Household != null)) { continue; } if (sim.IsPlayableGhost) { continue; } Urnstone urnstone = Sims3.Gameplay.Objects.Urnstone.FindGhostsGrave(sim); if (urnstone != null) { if ((urnstone.InInventory) || (urnstone.InWorld)) { continue; } } dead.Add(sim); } } int count = 0; if (dead.Count > 0) { if (!AcceptCancelDialog.Show(Common.Localize("ReconstituteTheDead:Prompt", false, new object[] { dead.Count }))) { return(OptionResult.Failure); } foreach (SimDescription sim in dead) { if (Urnstones.CreateGrave(sim, false) != null) { count++; } } } SimpleMessageDialog.Show(Name, Common.Localize("ReconstituteTheDead:Success", false, new object[] { count })); return(OptionResult.SuccessClose); }