Exemplo n.º 1
0
 public override bool Run() // Run
 {
     if (Target.IsInActiveHousehold && Target.Service is GrimReaper)
     {
         if (!AcceptCancelDialog.Show("Warning: Remove Sim Family Death Good System or Grim Reaper?"))
         {
             return(false);
         }
         {
             if (this.Target.IsActiveSim)             // Fix Not Household
             {
                 //UserToolUtils.OnClose();
                 LotManager.SelectNextSim();
             }
             Target.SimDescription.Household.Remove(this.Target.SimDescription);
             Household.NpcHousehold.Add(this.Target.SimDescription);
         }
         return(true);
     }
     if (!AcceptCancelDialog.Show("Force Request Grim Reaper?"))
     {
         return(false);
     }
     GrimReaper.Instance.MakeServiceRequest(Target.LotCurrent, true, ObjectGuid.InvalidObjectGuid);
     return(true);
 }
Exemplo n.º 2
0
            public bool Apply(SimDescription me)
            {
                if (me.CreatedSim == Sim.ActiveActor)
                {
                    LotManager.SelectNextSim();
                }

                Household house = me.Household;

                if (house != null)
                {
                    house.Remove(me, !house.IsServiceNpcHousehold);
                }

                try
                {
                    if (PetPoolManager.AddPet(Value, me))
                    {
                        return(true);
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(me, e);

                    if ((house != null) && (me.Household == null))
                    {
                        house.Add(me);
                    }
                }

                return(false);
            }
Exemplo n.º 3
0
            public bool Apply(SimDescription me)
            {
                if (me.CreatedSim == Sim.ActiveActor)
                {
                    LotManager.SelectNextSim();
                }

                Household house = me.Household;

                if (house != null)
                {
                    house.Remove(me, !SimTypes.IsSpecial(house));
                }

                try
                {
                    Household.MermaidHousehold.Add(me);
                }
                catch (Exception e)
                {
                    Common.Exception(me, e);

                    if ((house != null) && (me.Household == null))
                    {
                        house.Add(me);
                    }
                }

                return(false);
            }
Exemplo n.º 4
0
        public static void _OnObjectPendingDestruction(object sender, EventArgs e)
        {
            if (sender == null)
            {
                return;
            }

            if (sCurrentSimTwo != null && (sCurrentSimTwo.ObjectId.mValue == 0 || !NFinalizeDeath.GameObjectIsValid(sCurrentSimTwo.ObjectId.mValue)))
            {
                sCurrentSimTwo = null;
            }

            World.OnObjectPendingDestructionEventArgs onObjectPendingDestructionEventArgs = e as World.OnObjectPendingDestructionEventArgs;
            if (onObjectPendingDestructionEventArgs == null || sCurrentSim == null || !(onObjectPendingDestructionEventArgs.ObjectId == sCurrentSim.ObjectId))
            {
                return;
            }

            LotManager.SelectNextSim();

            if (sCurrentSim == null || !(onObjectPendingDestructionEventArgs.ObjectId == sCurrentSim.ObjectId))
            {
                return;
            }

            bool y = false;

            if (!PlumbBob.DoSelectActor(null, true))
            {
                var p = sCurrentSimTwo;
                sCurrentSimTwo = null;
                y = PlumbBob.DoSelectActor(p, true);
            }

            if (!y)
            {
                sCurrentSim = null;
                if (PlumbBob.sSingleton != null)
                {
                    PlumbBob.sSingleton.mSelectedActor = null;
                }
            }
        }
Exemplo n.º 5
0
        private bool FinishAdoption(Sim pet)
        {
            if (pet != null)
            {
                pet.InteractionQueue.CancelAllInteractions();
                pet.SetObjectToReset();

                SpeedTrap.Sleep();

                pet.UpdateBlockTime();
                Actor.ShowTNSAndPlayStingIfSelectable("sting_pet_adopt", TNSNames.AdoptLitterTNS, Target, pet, null, null, pet.IsFemale, false, new object[] { pet });

                if (pet == Sim.ActiveActor)
                {
                    LotManager.SelectNextSim();
                }

                if (pet.Household != null)
                {
                    pet.Household.Remove(pet.SimDescription);
                }
                Actor.Household.Add(pet.SimDescription);

                Relationships.CheckAddHumanParentFlagOnAdoption(Actor.SimDescription, pet.SimDescription);

                if (Actor.Partner != null)
                {
                    Relationships.CheckAddHumanParentFlagOnAdoption(Actor.Partner, pet.SimDescription);
                }

                InteractionInstance entry = new SocialInteractionA.Definition("Talk To Pet", new string[0x0], null, false).CreateInstance(pet, Actor, GetPriority(), false, false);

                List <Sim> list = new List <Sim>();
                list.Add(pet);
                GoHome home = GoHome.Singleton.CreateInstance(Actor.LotHome, Actor, GetPriority(), false, false) as GoHome;
                home.SimFollowers = list;

                Actor.InteractionQueue.AddNext(home);
                return(Actor.InteractionQueue.AddNext(entry));
            }
            return(false);
        }
Exemplo n.º 6
0
            public bool Apply(SimDescription me)
            {
                Service choice = null;

                foreach (Service service in Services.AllServices)
                {
                    if (service.ServiceType == Value)
                    {
                        choice = service;
                        break;
                    }
                }

                if (choice == null)
                {
                    return(false);
                }

                if (me.CreatedSim == Sim.ActiveActor)
                {
                    LotManager.SelectNextSim();
                }

                if (me.Household != null)
                {
                    me.Household.Remove(me);
                }

                Service.InitialServiceNpcSetup(choice, me);

                me.FindSuitableVirtualHome();

                choice.SetServiceNPCProperties(me);
                choice.OverlayUniform(me, choice.ServiceType.ToString());

                choice.AddSimToPool(me);
                return(true);
            }
Exemplo n.º 7
0
        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);
        }
        public override bool Run()
        {
            try
            {
                Actor.PlaySoloAnimation("a_react_waveA_standing_x", true);
                EventTracker.SendEvent(new TravelUtil.TravelEvent(EventTypeId.kReturnedFromVacation, Actor, null, GameStates.sTravelData.mDestWorld, GameStates.sTravelData.mCurrentDayOfTrip));
                if (GameStates.sTravelData.mEarlyDepartures == null)
                {
                    GameStates.sTravelData.mEarlyDepartures = new List <Sim>();
                }

                GameStates.sTravelData.mEarlyDepartures.Add(Actor);

                if (Households.AllHumans(Actor.Household).Count == 0x1)
                {
                    GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld();
                    return(true);
                }

                if (Actor.IsActiveSim)
                {
                    LotManager.SelectNextSim();
                }

                Actor.SimDescription.DnPExportData = new DnPExportData(Actor.SimDescription);
                if (Actor.OpportunityManager != null)
                {
                    Actor.OpportunityManager.StoreOpportunitiesForTravel();
                }

                if (Actor.BuffManager != null)
                {
                    Actor.BuffManager.StoreBuffsForTravel(Actor.SimDescription);
                }

                Actor.Household.RemoveSim(Actor);
                Actor.NullDnPManager();
                Actor.Motives.FreezeDecayEverythingExcept(new CommodityKind[0x0]);
                Actor.Autonomy.IncrementAutonomyDisabled();

                try
                {
                    Actor.DisablePieMenuOnSim = true;

                    if (DestinationLot != null)
                    {
                        Route r = Actor.CreateRoute();
                        r.DoRouteFail = false;
                        DestinationLot.PlanToLot(r);
                        Actor.DoRoute(r);
                    }

                    Actor.FadeOut(true, false, 1f);
                }
                finally
                {
                    Actor.DisablePieMenuOnSim = false;
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            finally
            {
                TravelUtil.PlayerMadeTravelRequest = false;
            }
            return(false);
        }
Exemplo n.º 9
0
        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);
                }
            }
        }
Exemplo n.º 10
0
        // Token: 0x06006FBE RID: 28606 RVA: 0x0026D010 File Offset: 0x0026C010
        public void FinalizeDeath()
        {
            this.MakeHouseholdHorsesGoHome();
            if (this.Target.SimDescription.IsEnrolledInBoardingSchool())
            {
                this.Target.SimDescription.BoardingSchool.OnRemovedFromSchool();
            }
            Urnstone.FinalizeSimDeath(this.Target.SimDescription, this.Target.Household, this.mSituation.PetSavior == null);
            int minuteOfDeath = (int)Math.Floor((double)SimClock.ConvertFromTicks(SimClock.CurrentTime().Ticks, TimeUnit.Minutes)) % 60;

            this.mGrave.MinuteOfDeath = minuteOfDeath;
            if (this.Target.DeathReactionBroadcast != null)
            {
                this.Target.DeathReactionBroadcast.Dispose();
                this.Target.DeathReactionBroadcast = null;
            }
            this.Target.SetHiddenFlags((HiddenFlags)4294967295u);
            Household household = this.Target.Household;

            if (household != null)
            {
                if (household.IsActive)
                {
                    this.Target.MoveInventoryItemsToAFamilyMember();
                }
                this.Target.LotCurrent.LastDiedSim = this.Target.SimDescription;
                this.Target.LotCurrent.NumDeathsOnLot++;
                this.Actor.ClearSynchronizationData();
                this.mSituation.DeathCheckForAbandonedChildren(this.Target);
                if (this.Target.SimDescription.DeathStyle != SimDescription.DeathType.OldAge)
                {
                    this.Actor.RemoveInteractionByType(GrimReaperSituation.ChessChallenge.Singleton);
                }
                if (BoardingSchool.ShouldSimsBeRemovedFromBoardingSchool(household))
                {
                    BoardingSchool.RemoveAllSimsFromBoardingSchool(household);
                }
                if (household.IsActive && !this.Target.BuffManager.HasElement(BuffNames.Ensorcelled))
                {
                    int num = 0;
                    foreach (Sim sim in household.AllActors)
                    {
                        if (sim.BuffManager.HasElement(BuffNames.Ensorcelled))
                        {
                            num++;
                        }
                    }
                    if (household.AllActors.Count == num + 1)
                    {
                        foreach (Sim sim2 in household.AllActors)
                        {
                            if (sim2.BuffManager.HasElement(BuffNames.Ensorcelled))
                            {
                                sim2.BuffManager.RemoveElement(BuffNames.Ensorcelled);
                            }
                        }
                    }
                }
                int num2 = household.AllActors.Count - household.GetNumberOfRoommates();
                if (household.IsActive && num2 == 1 && !Household.RoommateManager.IsNPCRoommate(this.Target))
                {
                    this.mSituation.LastSimOfHousehold = this.Target;
                }
                else
                {
                    if (this.Target.IsActiveSim)
                    {
                        LotManager.SelectNextSim();
                    }
                    if (this.mWasMemberOfActiveHousehold)
                    {
                        household.RemoveSim(this.Target);
                    }
                }
            }
            this.mGrave.RemoveFromUseList(this.Actor);
            Ocean singleton = Ocean.Singleton;

            if (singleton != null && singleton.IsActorUsingMe(this.Target))
            {
                singleton.RemoveFromUseList(this.Target);
                this.Target.Posture = null;
            }
        }
Exemplo n.º 11
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);
        }