Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
        // 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();
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 protected override void OnPerform()
 {
     Urnstones.CreateGrave(mSim, SimDescription.DeathType.OldAge, true, false);
 }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }