Example #1
0
 public void Dispose()
 {
     if ((mOpportunities != null) &&
         (mSim.OpportunityHistory != null))
     {
         mSim.OpportunityHistory.mCurrentOpportunities = mOpportunities;
         mSim.NeedsOpportunityImport = (true);
         if (mSim.CreatedSim != null)
         {
             if (mSim.CreatedSim.mOpportunityManager == null)
             {
                 mSim.CreatedSim.mOpportunityManager = new OpportunityManager(mSim.CreatedSim);
                 mSim.CreatedSim.mOpportunityManager.SetupLocationBasedOpportunities();
             }
             try{
                 //   [NRaas:]Due to an odd bit of coding at the bottom of AcceptOpportunityFromTravel(),
                 // the expiration time for non-expirying opportunities is checked
                 foreach (OpportunityHistory.OpportunityExportInfo info in mSim.OpportunityHistory.GetCurrentOpportunities())
                 {
                     if (info.ExpirationTime < SimClock.CurrentTime())
                     {
                         Opportunity opp = OpportunityManager.GetStaticOpportunity(info.Guid);
                         if (opp != null)
                         {
                             bool requiresTimeout = (false);
                             switch (opp.Timeout)
                             {
                             case Opportunity.OpportunitySharedData.TimeoutCondition.SimDays:
                             case Opportunity.OpportunitySharedData.TimeoutCondition.SimHours:
                             case Opportunity.OpportunitySharedData.TimeoutCondition.SimTime:
                             case Opportunity.OpportunitySharedData.TimeoutCondition.Gig:
                             case Opportunity.OpportunitySharedData.TimeoutCondition.AfterschoolRecitalOrAudition:
                                 requiresTimeout = (true);
                                 break;
                             }
                             if (!requiresTimeout)
                             {
                                 info.ExpirationTime = SimClock.Add(SimClock.CurrentTime(), TimeUnit.Hours, 1);
                             }
                         }
                     }
                 }
                 mSim.CreatedSim.OpportunityManager.TravelFixup();
             }catch (Exception exception) {
                 //  Get stack trace for the exception. with source file information
                 var st = new StackTrace(exception, true);
                 //  Get the top stack frame
                 var frame = st.GetFrame(0);
                 //  Get the line number from the stack frame
                 var line = frame.GetFileLineNumber();
                 Alive.WriteLog(exception.Message + "\n\n" +
                                exception.StackTrace + "\n\n" +
                                exception.Source + "\n\n" +
                                line);
             }finally{
             }
             mSim.NeedsOpportunityImport = (false);
         }
     }
 }
Example #2
0
 public static bool DisableCreateHousehold()
 {
     try{
         if (!IsCreateHouseholdAvailable())
         {
             return(false);
         }
         if (StoryProgressionService.sService.mDemographicTuning.ActionTuning.TryGetValue("Create Household", out sOriginalDemographicTuning))
         {
             StoryProgressionService.sService.mDemographicTuning.ActionTuning.Remove("Create Household");
         }
         if (StoryProgressionService.sService.mActionFactories.TryGetValue("Create Household", out sOriginalFactoryTuning))
         {
             StoryProgressionService.sService.mActionFactories.Remove("Create Household");
         }
     }catch (Exception exception) {
         //  Get stack trace for the exception. with source file information
         var st = new StackTrace(exception, true);
         //  Get the top stack frame
         var frame = st.GetFrame(0);
         //  Get the line number from the stack frame
         var line = frame.GetFileLineNumber();
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source + "\n\n" +
                        line);
     }finally{
     }
     return(true);
 }
Example #3
0
 public static void EnableCreateHousehold()
 {
     try{
         if (StoryProgressionService.sService == null)
         {
             return;
         }
         if (StoryProgressionService.sService.mDemographicTuning.ActionTuning.ContainsKey("Create Household"))
         {
             return;
         }
         if (sOriginalDemographicTuning != null)
         {
             StoryProgressionService.sService.mDemographicTuning.ActionTuning["Create Household"] = sOriginalDemographicTuning;
         }
         if (sOriginalFactoryTuning != null)
         {
             StoryProgressionService.sService.mActionFactories["Create Household"] = sOriginalFactoryTuning;
         }
     }catch (Exception exception) {
         //  Get stack trace for the exception. with source file information
         var st = new StackTrace(exception, true);
         //  Get the top stack frame
         var frame = st.GetFrame(0);
         //  Get the line number from the stack frame
         var line = frame.GetFileLineNumber();
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source + "\n\n" +
                        line);
     }finally{
     }
 }
Example #4
0
 public static void RecoverMissingSim(SimDescription sim, bool ignorePlaceholders)
 {
     try{
         if (!SimIsMissing(sim, ignorePlaceholders))
         {
             return;
         }
         if (sim.CreatedSim == null)
         {
             return;
         }
         StuckSimData stuckSim;
         if (!StuckSims.TryGetValue(sim.SimDescriptionId, out stuckSim))
         {
             stuckSim = new StuckSimData();
             StuckSims.Add(sim.SimDescriptionId, stuckSim);
         }
         if (!stuckSim.Resetting)
         {
             stuckSim.Detections++;
             Vector3 destination = Vector3.Invalid;
             if (sim.CreatedSim.RoutingComponent != null)
             {
                 sim.CreatedSim.RoutingComponent.GetDestination(out destination);
             }
             if (stuckSim.resetTask == null)
             {
                 stuckSim.resetTask = new ResetStuckSimTask(sim.CreatedSim, destination, "Missing");
             }
             else
             {
                 stuckSim.resetTask.Renew();
             }
         }
     }catch (Exception exception) {
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source + "\n\n" +
                        "RecoverMissingSim");
     }finally{
     }
 }
Example #5
0
 private void OnTimer()
 {
     try{
         if (disposeOnTimer)
         {
             AlarmManager.Global.RemoveAlarm(handle);
             handle = (AlarmHandle.kInvalidHandle);
         }
         runningTask = ModTask.Perform(AlarmFunction);
         if (disposeOnTimer)
         {
             //
         }
     }catch (Exception exception) {
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source);
     }finally{
     }
 }
Example #6
0
 public void Dispose()
 {
     if (mOutfit != null)
     {
         int index = ReplaceOutfit(mSim, mKey, mBuilder, mComponents, mAlternate);
         mOutfit = mSim.GetOutfit(mKey.mCategory, index);
         SimDescription sim = mSim as SimDescription;
         if ((sim != null) && (sim.CreatedSim != null))
         {
             try{
                 sim.CreatedSim.RefreshCurrentOutfit(false);
             }catch (Exception exception) {
                 Alive.WriteLog(exception.Message + "\n\n" +
                                exception.StackTrace + "\n\n" +
                                exception.Source);
             }
         }
     }
     mBuilder.Dispose();
     Alive.Sleep();
 }
Example #7
0
        //==================================================================================================================
        static void ResetPortalsAndRouting()
        {
            try{
                Sim.kAutonomyThoughtBalloonPercentageChance = 100f;
                Sim.kDistanceForSocials    = 15f;
                Sim.kMaxDistanceForSocials = 75f;
                Sim.kBabyToddlerLikingThresholdToAllowInteractionsWithStrangers = -101;
                Sim.kMaxStandBackFromDoorDistance = 16f;
                Sim.kPortalIntersectRadius        = 2f;
                Sim.kPortalPushMinDistance        = 8f;
                Sim.kPortalPushMaxDistance        = 16f;
                Sim.kIdleTimeAmount = 10f;
                //------------------------------------------------------
                SimUpdate.kBonehildaFreakoutTraits = new TraitNames[] {
                    TraitNames.Coward,
                };
                //------------------------------------------------------
                ElevatorInterior.kElevatorToElevatorPortalCost = 20f;
                Ladder.kPortalCost = 22f;
                Door.kMinimumTimeBeforeClosingDoor = 30f;
                Door.kDefaultPortalCost            = 2f;
                //------------------------------------------------------
                SimRoutingComponent.kNPCSubwayUseChance = 0.5f;
                //------------------------------------------------------
                GameObject.kKleptoRespawnTimeDays = 1;
                //------------------------------------------------------
                GameObject.kAutonomyMultiplierForObjectSelectionWhenSomeSimIsRouting = 0.05f;
                //------------------------------------------------------
                Autonomy.kEnergyThresholdBelowWhichTheyWantToSleepWhenSleepyDuringTheirBedTime = 0;
                //------------------------------------------------------
                Autonomy.kHoursAfterWhichBubbledUpScoreIsMax = .25f;
                //------------------------------------------------------
                Autonomy.kRandomness = .027f;
                //------------------------------------------------------
                Autonomy.kPreferSeatedSocialsMultiplier         = 1.5f;
                Autonomy.kSocialThatWillCauseDismountMultiplier = .025f;
                //------------------------------------------------------
                Autonomy.kAllowEvenIfNotAllowedInRoomAutonomousMultiplier = 0.5f;
                Autonomy.kAutonomyDelayNormal                               = 0;
                Autonomy.kAutonomyDelayWhileMounted                         = 0;
                Autonomy.kAutonomyDelayDuringSocializing                    = 0;
                SimRoutingComponent.kDefaultStandAndWaitDuration            = 1f;
                SimRoutingComponent.kMinimumPostPushStandAndWaitDuration    = 0f;
                SimRoutingComponent.kMaximumPostPushStandAndWaitDuration    = 2f;
                SimRoutingComponent.kTotalSimMinutesToWaitForSimsToBePushed = 1f;
                //------------------------------------------------------
                SimRoutingComponent.kAvoidanceReplanCheckFrequencyMin = 6;
                SimRoutingComponent.kAvoidanceReplanCheckFrequencyMax = 9;
                SimRoutingComponent.kAvoidanceReplanCheckOffsetMin    = 1;
                SimRoutingComponent.kAvoidanceReplanCheckOffsetMax    = 3;
                //------------------------------------------------------
                SimRoutingComponent.kPushHorsesAwayDistanceMin            = 14.0f;
                SimRoutingComponent.kPushHorsesAwayDistanceMax            = 20.0f;
                SimRoutingComponent.kPushFoalsAwayDistanceMin             = 14.0f;
                SimRoutingComponent.kPushFoalsAwayDistanceMax             = 20.0f;
                SimRoutingComponent.kPushDogsAwayDistanceMin              = 6.0f;
                SimRoutingComponent.kPushDogsAwayDistanceMax              = 12.0f;
                SimRoutingComponent.kPushSimsAwayDistanceFromFootprintMin = 2.50f;
                SimRoutingComponent.kPushSimsAwayDistanceMin              = 2.4f;
                SimRoutingComponent.kPushSimsAwayDistanceMin              = 10.0f;
                //------------------------------------------------------
                InteractionQueue.kMaxMinutesRemainingNotToAutosolve = 30;
                SimQueue.kMinimumRadialDistanceFromDoor             = 2.0f;
                SimQueue.kMaximumRadialDistanceFromDoor             = 10.0f;
                SimQueue.kMinimumRadialDistanceFromSim    = 4.0f;
                SimQueue.kMaximumRadialDistanceFromSim    = 10.0f;
                SimQueue.kMinimumRadialDistanceFromObject = 4.8f;
                SimQueue.kMaximumRadialDistanceFromObject = 12.0f;
                SimQueue.kCheckPeriodInMinutes            = 0.5f;
                //------------------------------------------------------
                InteractionInstance.kNumMinToWaitOnPreSync   = 60;
                InteractionInstance.kNumMinToWaitOnSyncStart = 90;
                InteractionInstance.kNumMinToWaitOnSync      = 10;
                //------------------------------------------------------
                SocialInteraction.kSocialRouteRadiusMax = 6;
                SocialInteraction.kSocialRouteMinDist   = 10;
                //------------------------------------------------------
                SocialInteraction.kSocialTimeoutTime = 45;
                //------------------------------------------------------
                SocialInteraction.kSocialJigPlacementLimit = 30f;
                SocialInteraction.kSocialSyncGiveupTime    = 45;
                //------------------------------------------------------
                SocialInteraction.kSocialBumpDistMin = 0.175f;
                SocialInteraction.kSocialBumpDistMax = 1.0f;
                //------------------------------------------------------
                SocialInteraction.kApproachGreetDistance = 6.0f;
                //------------------------------------------------------
            }
            catch (Exception exception) {
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               "tunnings");
            }finally{
            }
            try{
                List <Sim>
                toRemove = new List <Sim>();
                foreach (var simPosData in stuckPositions)
                {
                    if (simPosData.Key == null ||
                        simPosData.Key.HasBeenDestroyed ||
                        !simPosData.Key.InWorld ||
                        simPosData.Key.Position != simPosData.Value)
                    {
                        toRemove.Add(simPosData.Key);
                    }
                }
                for (int i = 0; i < toRemove.Count; i++)
                {
                    stuckPositions.Remove(toRemove[i]);
                }
                toRemove.Clear();
                foreach (Sim sim in Sims3.Gameplay.Queries.GetObjects <Sim>())
                {
                    sim.PlayRouteFailFrequency = Sim.RouteFailFrequency.NeverPlayRouteFail;
                    if (!Objects.IsValid(sim.ObjectId) ||
                        Simulator.GetProxy(sim.ObjectId) == null ||
                        sim.SimDescription == null ||
                        sim.SimDescription.CreatedSim != sim)
                    {
                        new ResetClearSimTask(sim);
                    }
                }
            }catch (Exception exception) {
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               "stuckCheck_notMovingSims_simPosData_reset");
            }finally{
            }
            try{
                foreach (ElevatorDoors elevator in Sims3.Gameplay.Queries.GetObjects <ElevatorDoors>())
                {
                    ElevatorInterior.ElevatorPortalComponent
                                       portal =
                        elevator.InteriorObj.ElevatorPortal as
                        ElevatorInterior.ElevatorPortalComponent;
                    if (portal != null)
                    {
//  Medium reset sims: reset and put in the same lot
                        foreach (SimDescription sim in new List <SimDescription>(
                                     portal.mAssignedSims.Keys))
                        {
                            if (sim.CreatedSim != null)
                            {
                                StuckSimData stuckSim;
                                if (!StuckSims.TryGetValue(sim.SimDescriptionId, out stuckSim))
                                {
                                    stuckSim = new StuckSimData();
                                    StuckSims.Add(sim.SimDescriptionId, stuckSim);
                                }
                                if (!stuckSim.Resetting)
                                {
                                    stuckSim.Detections++;
                                    Vector3 destination = Vector3.Invalid;
                                    if (sim.CreatedSim.RoutingComponent != null)
                                    {
                                        sim.CreatedSim.RoutingComponent.GetDestination(out destination);
                                    }
                                    if (stuckSim.resetTask == null)
                                    {
                                        stuckSim.resetTask = new ResetStuckSimTask(sim.CreatedSim, destination, "Elevator");
                                    }
                                    else
                                    {
                                        stuckSim.resetTask.Renew();
                                    }
                                }
                            }
                        }
                        portal.FreeAllRoutingLanes();
                    }
                    //
                    if (elevator.ActorsUsingMe != null &&
                        elevator.ActorsUsingMe.Count > 0)
                    {
                        elevator.SetObjectToReset();
                    }
                }
                foreach (Door door in Sims3.Gameplay.Queries.GetObjects <Door>())
                {
                    Door.DoorPortalComponent
                              portal =
                        door.PortalComponent as
                        Door.DoorPortalComponent;
                    if (portal != null)
                    {
//  Soft reset sims: reset and don't change position
                        foreach (SimDescription sim in new List <SimDescription>(
                                     door.ActorsUsingMeAsSimDescriptions))
                        {
                            if (sim.CreatedSim != null)
                            {
                            }
                        }
                        if (door.ActorsUsingMe != null &&
                            door.ActorsUsingMe.Count > 0)
                        {
                            portal.FreeAllRoutingLanes();
                        }
                    }
                    //
                    if (door.ActorsUsingMe != null &&
                        door.ActorsUsingMe.Count > 0)
                    {
                        door.SetObjectToReset();
                    }
                }
                foreach (StaircaseSpiral staircaseSpiral in Sims3.Gameplay.Queries.GetObjects <StaircaseSpiral>())
                {
                    StaircaseSpiral.StaircaseSpiralPortalComponent
                                         portal =
                        staircaseSpiral.PortalComponent as
                        StaircaseSpiral.StaircaseSpiralPortalComponent;
                    if (portal != null)
                    {
//  Soft reset sims: reset and don't change position
                        foreach (SimDescription sim in new List <SimDescription>(
                                     staircaseSpiral.ActorsUsingMeAsSimDescriptions))
                        {
                            if (sim.CreatedSim != null)
                            {
                            }
                        }
                        portal.FreeAllRoutingLanes();
                    }
                    //
                    if (staircaseSpiral.ActorsUsingMe != null &&
                        staircaseSpiral.ActorsUsingMe.Count > 0)
                    {
                        staircaseSpiral.SetObjectToReset();
                    }
                }
                foreach (Ladder ladder in Sims3.Gameplay.Queries.GetObjects <Ladder>())
                {
                    Ladder.LadderPortalComponent
                                portal =
                        ladder.PortalComponent as
                        Ladder.LadderPortalComponent;
                    if (portal != null)
                    {
//  Soft reset sims: reset and don't change position
                        foreach (SimDescription sim in new List <SimDescription>(
                                     ladder.ActorsUsingMeAsSimDescriptions))
                        {
                            if (sim.CreatedSim != null)
                            {
                            }
                        }
                        portal.FreeAllRoutingLanes();
                    }
                    //
                    if (ladder.ActorsUsingMe != null &&
                        ladder.ActorsUsingMe.Count > 0)
                    {
                        ladder.SetObjectToReset();
                    }
                }
                foreach (Stairs stairs in Sims3.Gameplay.Queries.GetObjects <Stairs>())
                {
                    Stairs.StairsPortalComponent
                                portal =
                        stairs.PortalComponent as
                        Stairs.StairsPortalComponent;
                    if (portal != null)
                    {
//  Soft reset sims: reset and don't change position
                        foreach (SimDescription sim in new List <SimDescription>(
                                     stairs.ActorsUsingMeAsSimDescriptions))
                        {
                            if (sim.CreatedSim != null)
                            {
                            }
                        }
                        portal.FreeAllRoutingLanes();
                    }
                    //
                    if (stairs.ActorsUsingMe != null &&
                        stairs.ActorsUsingMe.Count > 0)
                    {
                        stairs.SetObjectToReset();
                    }
                }
            }catch (Exception exception) {
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               "resetAllPortals");
            }finally{
            }
        }
Example #8
0
 public override bool Run()
 {
     if (this.Target.Parent != this.Actor && !(CarrySystem.PickUp(this.Actor, (ICustomCarryable)this.Target, new SacsEventHandler(this.Target.OnPickUp), 0U)))
     {
         Alive.WriteLog("Alive_debugInfo_LOG:NOT_ERROR\nCannot_Do_Laundry:cannot_pickUp_clothingPile");
         return(false);
     }
     this.Actor.PlayRouteFailFrequency = Sim.RouteFailFrequency.NeverPlayRouteFail;
     this.BeginCommodityUpdates();
     if (this.ActiveStage != null)
     {
         ClothingPileDry currentPile;
         do
         {
             currentPile = (this.ActiveStage as RoomVsLotStage <ClothingPileDry>).GetNext();
             if (currentPile != null)
             {
                 if (this.Actor.RouteToObjectRadiusAndCheckInUse((IGameObject)currentPile, currentPile.CarryRouteToObjectRadius) && currentPile.Parent == null)
                 {
                     this.Actor.CarryStateMachine.AddOneShotScriptEventHandler(113U, (SacsEventHandler)((A_1, A_2) => currentPile.FadeOut(false)));
                     this.Actor.CarryStateMachine.RequestState("x", "PickUpAnother");
                     this.Actor.CarryStateMachine.RequestState("x", "Carry");
                     this.Target.AddClothingPile(currentPile);
                     currentPile.Destroy();
                 }
                 this.Actor.RemoveExitReason(ExitReason.RouteFailed | ExitReason.ObjectInUse);
             }
         }while(currentPile != null && !this.Actor.HasExitReason());
     }
     this.Actor.PlayRouteFailFrequency = Sim.RouteFailFrequency.AlwaysPlayRouteFail;
     this.Stages = (List <Sims3.Gameplay.Interactions.Stage>)null;
     this.Actor.InteractionQueue.FireQueueChanged();
     if (!this.Actor.HasExitReason())
     {
         this.EndCommodityUpdates(true);
         Hamper closestObject1 = GlobalFunctions.GetClosestObject <Hamper>((IEnumerable <Hamper>)Sims3.Gameplay.Queries.GetObjects <Hamper>(this.Actor.Position, ClothingPileDry.kRadiusToConsiderHampers), (IGameObject)this.Actor, new Predicate <Hamper>(ClothingPileDry.CleanUp.DoesHamperHaveSpaceLeft));
         if (closestObject1 != null)
         {
             this.Actor.InteractionQueue.PushAsContinuation(Hamper.DropClothes.Singleton, (IGameObject)closestObject1, true);
             return(true);
         }
         if (!this.Autonomous || !this.Target.LotCurrent.LaundryManager.GivesFreshClothingBuff)
         {
             WashingMachine closestObject2 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>)Sims3.Gameplay.Queries.GetObjects <WashingMachine>(this.Actor.LotCurrent), (IGameObject)this.Actor, new Predicate <WashingMachine>(ClothingPileDry.CleanUp.IsWashingMachineUsable));
             if (closestObject2 != null)
             {
                 this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DoLaundry.SingletonNoStages, (IGameObject)closestObject2, true);
                 return(true);
             }
         }
         Hamper closestObject3 = GlobalFunctions.GetClosestObject <Hamper>((IEnumerable <Hamper>)Sims3.Gameplay.Queries.GetObjects <Hamper>(this.Actor.LotCurrent), (IGameObject)this.Actor);
         if (closestObject3 != null)
         {
             this.Actor.InteractionQueue.PushAsContinuation(Hamper.DropClothes.Singleton, (IGameObject)closestObject3, true);
             return(true);
         }
         WashingMachine closestObject4 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>)Sims3.Gameplay.Queries.GetObjects <WashingMachine>(this.Actor.LotCurrent), (IGameObject)this.Actor);
         if (closestObject4 == null)
         {
             return(this.Target.PutInInventory(this.Actor));
         }
         this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DoLaundry.SingletonNoStages, (IGameObject)closestObject4, false);
         return(true);
     }
     Alive.WriteLog("Alive_debugInfo_LOG:NOT_ERROR\nCannot_Do_Laundry:this.Actor.HasExitReason():" + this.Actor.ExitReason);
     this.EndCommodityUpdates(false);
     return(false);
 }
Example #9
0
        public void Dispose()
        {
            try{
                mSim.AssignedRole      = mRole;
                mSim.IsNeverSelectable = mNeverSelectable;
                if (mSim.CelebrityManager != null)
                {
                    mSim.CelebrityManager.ScheduleOpportunityCallIfNecessary();
                }
                if (mOpportunities != null)
                {
                    mOpportunities.Dispose();
                }
                if ((mSchool != null) &&
                    (mSim.CareerManager != null))
                {
                    mSim.CareerManager.mSchool = mSchool;
                }
                if ((mCareer != null) &&
                    (mSim.CareerManager != null) &&
                    (mSim.Occupation == null))
                {
                    mSim.CareerManager.mJob = mCareer;
                    if (mSim.Occupation != null)
                    {
                        using (BaseWorldReversion reversion = new BaseWorldReversion()){
                            if ((mFlags & Flag.LoadFixup) == Flag.LoadFixup)
                            {
                                mSim.Occupation.OnLoadFixup(false);
                            }
                            if (((mFlags & Flag.Selectable) == Flag.Selectable) &&
                                (!mSim.IsNeverSelectable &&
                                 mSim.Household == Household.ActiveHousehold))
                            {
                                using (SuppressCreateHousehold suppress = new SuppressCreateHousehold()){
                                    bool careerLoc = true;
                                    if (mSim.Occupation is Career)
                                    {
                                        careerLoc = (mSim.Occupation.CareerLoc != null);
                                    }
                                    if (careerLoc)
                                    {
                                        FixCareer(mSim.Occupation, false);
                                        mSim.Occupation.OnOwnerBecameSelectable();
                                    }
                                }
                            }
                            else
                            if ((mFlags & Flag.Unselectable) == Flag.Unselectable)
                            {
                                using (SuppressCreateHousehold suppress = new SuppressCreateHousehold()){
                                    //  [NRaas:]Fix for script error in GhostHunter:ApplyCareerSpecificModifiersToXp where
                                    // owner Sim is not null checked and breaks when this is ran during age up.
                                    ActiveCareerLevelStaticData
                                                data       = null;
                                    int         experience = 0;
                                    GhostHunter hunter     = null;
                                    try{
                                        hunter = mSim.Occupation as GhostHunter;
                                        if (hunter != null)
                                        {
                                            data = hunter.GetCurrentLevelStaticDataForActiveCareer();
                                            if (data != null)
                                            {
                                                experience = data.DailyPerfectJobBonusExperience;
                                                data.DailyPerfectJobBonusExperience = 0;
                                            }
                                        }
                                        mSim.Occupation.OnOwnerBecameUnselectable();
                                    }catch (Exception exception) {
                                        //  Get stack trace for the exception. with source file information
                                        var st = new StackTrace(exception, true);
                                        //  Get the top stack frame
                                        var frame = st.GetFrame(0);
                                        //  Get the line number from the stack frame
                                        var line = frame.GetFileLineNumber();
                                        Alive.WriteLog(exception.Message + "\n\n" +
                                                       exception.StackTrace + "\n\n" +
                                                       exception.Source + "\n\n" +
                                                       line);
                                    }finally{
                                        if (hunter != null &&
                                            data != null)
                                        {
                                            data.DailyPerfectJobBonusExperience = experience;
                                        }
                                    }
                                }
                            }
                        }

                        mSim.CareerManager.UpdateCareerUI();
                    }
                }
            }catch (Exception exception) {
                //  Get stack trace for the exception. with source file information
                var st = new StackTrace(exception, true);
                //  Get the top stack frame
                var frame = st.GetFrame(0);
                //  Get the line number from the stack frame
                var line = frame.GetFileLineNumber();
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               line);
            }finally{
            }
        }
Example #10
0
 public void Restore(Sim sim)
 {
     try{
         bool dnpUpdated = (false);
         if (mDnPExportData != null)
         {
             sim.NullDnPManager();
             DreamsAndPromisesManager.CreateFromExportData(sim, mDnPExportData);
             sim.SimDescription.DnPExportData = null;
             dnpUpdated = (true);
         }
         else
         if (mDnpManager != null)
         {
             sim.NullDnPManager();
             sim.mDreamsAndPromisesManager = mDnpManager;
             dnpUpdated = (true);
         }
         if ((dnpUpdated) && (sim.DreamsAndPromisesManager != null))
         {
             OnLoadFixup(sim, mInitialStore);
             sim.DreamsAndPromisesManager.SetToUpdate(true, true);
         }
         if (mOpportunityManager != null)
         {
             if (sim.mOpportunityManager != null)
             {
                 sim.mOpportunityManager.CancelAllOpportunities();
                 sim.mOpportunityManager.TearDownLocationBasedOpportunities();
             }
             sim.mOpportunityManager = mOpportunityManager;
         }
         else
         if (sim.mOpportunityManager == null)
         {
             sim.mOpportunityManager = new OpportunityManager(sim);
             sim.mOpportunityManager.SetupLocationBasedOpportunities();
             if (sim.mOpportunitiesAlarmHandle == AlarmHandle.kInvalidHandle)
             {
                 sim.ScheduleOpportunityCall();
             }
         }
         try{
             if (mOppStore != null)
             {
                 mOppStore.Dispose();
             }
             if (sim.OpportunityManager != null)
             {
                 sim.OpportunityManager.Fixup();
             }
         }catch (Exception exception) {
             //  Get stack trace for the exception. with source file information
             var st = new StackTrace(exception, true);
             //  Get the top stack frame
             var frame = st.GetFrame(0);
             //  Get the line number from the stack frame
             var line = frame.GetFileLineNumber();
             Alive.WriteLog(exception.Message + "\n\n" +
                            exception.StackTrace + "\n\n" +
                            exception.Source + "\n\n" +
                            line);
         }finally{
         }
         //  [NRaas:]Remove the opportunity alarm for inactive sims, as there is no check for selectability within it
         if (sim.CelebrityManager != null)
         {
             sim.CelebrityManager.RemoveOppotunityAlarm();
         }
     }catch (Exception exception) {
         //  Get stack trace for the exception. with source file information
         var st = new StackTrace(exception, true);
         //  Get the top stack frame
         var frame = st.GetFrame(0);
         //  Get the line number from the stack frame
         var line = frame.GetFileLineNumber();
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source + "\n\n" +
                        line);
     }finally{
     }
 }
Example #11
0
        protected static void OnLoadFixup(Sim sim, bool initialLoad)
        {
            for (int i = sim.DreamsAndPromisesManager.mActiveNodes.Count - 1; i >= 0; i--)
            {
                ActiveNodeBase node = sim.DreamsAndPromisesManager.mActiveNodes[i];
                if ((initialLoad) ||
                    (NeedsFixup(node)))
                {
                    try{
                        node.OnLoadFixup();
                    }catch (Exception exception) {
                        //  Get stack trace for the exception. with source file information
                        var st = new StackTrace(exception, true);
                        //  Get the top stack frame
                        var frame = st.GetFrame(0);
                        //  Get the line number from the stack frame
                        var line = frame.GetFileLineNumber();
                        Alive.WriteLog(exception.Message + "\n\n" +
                                       exception.StackTrace + "\n\n" +
                                       exception.Source + "\n\n" +
                                       line);
                    }finally{
                    }

                    if (NeedsFixup(node))
                    {
                        sim.DreamsAndPromisesManager.mActiveNodes.RemoveAt(i);
                    }
                    else
                    {
                        try{
                            sim.DreamsAndPromisesManager.AddToReferenceList(node);
                        }catch (Exception exception) {
                            //  Get stack trace for the exception. with source file information
                            var st = new StackTrace(exception, true);
                            //  Get the top stack frame
                            var frame = st.GetFrame(0);
                            //  Get the line number from the stack frame
                            var line = frame.GetFileLineNumber();
                            Alive.WriteLog(exception.Message + "\n\n" +
                                           exception.StackTrace + "\n\n" +
                                           exception.Source + "\n\n" +
                                           line);
                        }finally{
                        }
                    }
                }
            }
            for (int i = sim.DreamsAndPromisesManager.mSleepingNodes.Count - 1; i >= 0; i--)
            {
                ActiveNodeBase node = sim.DreamsAndPromisesManager.mSleepingNodes[i];
                if (NeedsFixup(node))
                {
                    try{
                        node.OnLoadFixup();
                    }catch (Exception exception) {
                        //  Get stack trace for the exception. with source file information
                        var st = new StackTrace(exception, true);
                        //  Get the top stack frame
                        var frame = st.GetFrame(0);
                        //  Get the line number from the stack frame
                        var line = frame.GetFileLineNumber();
                        Alive.WriteLog(exception.Message + "\n\n" +
                                       exception.StackTrace + "\n\n" +
                                       exception.Source + "\n\n" +
                                       line);
                    }finally{
                    }
                    if (NeedsFixup(node))
                    {
                        sim.DreamsAndPromisesManager.mSleepingNodes.RemoveAt(i);
                    }
                }
            }
        }
Example #12
0
        public DreamStore(Sim sim, bool initialStore, bool simpleRetain)
        {
            mInitialStore  = initialStore;
            mSim           = sim.SimDescription;
            mDnPExportData = null;
            bool storeDnP = (false);

            if ((sim.mDreamsAndPromisesManager != null) &&
                (sim.DreamsAndPromisesManager.mPromiseNodes != null))
            {
                foreach (ActiveDreamNode node in sim.DreamsAndPromisesManager.mPromiseNodes)
                {
                    if (node != null)
                    {
                        storeDnP = (true);
                        break;
                    }
                }
            }
            if (storeDnP)
            {
                OnLoadFixup(sim, false);
                if (simpleRetain)
                {
                    mDnpManager = sim.DreamsAndPromisesManager;
                    sim.mDreamsAndPromisesManager = null;
                }
                else
                {
                    try{
                        mDnPExportData = new DnPExportData(mSim);
                        sim.NullDnPManager();
                    }catch (Exception exception) {
                        //  Get stack trace for the exception. with source file information
                        var st = new StackTrace(exception, true);
                        //  Get the top stack frame
                        var frame = st.GetFrame(0);
                        //  Get the line number from the stack frame
                        var line = frame.GetFileLineNumber();
                        Alive.WriteLog(exception.Message + "\n\n" +
                                       exception.StackTrace + "\n\n" +
                                       exception.Source + "\n\n" +
                                       line);
                    }finally{
                    }
                }
            }

            if (sim.HasOpportunity())
            {
                foreach (Opportunity opp in sim.OpportunityManager.List)
                {
                    if (mSim.OpportunityHistory.GetCurrentOpportunity(opp.OpportunityCategory) == null)
                    {
                        mSim.OpportunityHistory.AddCurrentOpportunity(opp.OpportunityCategory,
                                                                      opp.Guid, null,
                                                                      opp.TargetObject as Sim,
                                                                      opp.ParentOpportunities,
                                                                      opp.TargetInteractionNumberItemsRequiredList(),
                                                                      opp.Name,
                                                                      opp.Description,
                                                                      opp.DeadlineString);
                    }
                }
                Alive.ResetClearSimTask.
                CleanupOpportunities(mSim, false);
                if (simpleRetain)
                {
                    mOpportunityManager = sim.OpportunityManager;
                }
                else
                {
                    mOppStore = new OpportunityStore(sim.SimDescription, true);
                }
                sim.mOpportunityManager = null;
            }
            else
            {
                mSim.NeedsOpportunityImport = false;
            }
        }
Example #13
0
 public override bool Run()
 {
     try{
         if (!Target.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.DefaultEvict,
                                         ~(ExitReason.Replan |
                                           ExitReason.MidRoutePushRequested |
                                           ExitReason.ObjectStateChanged |
                                           ExitReason.PlayIdle |
                                           ExitReason.MaxSkillPointsReached), Shower.kTimeToWaitToEvict))
         {
             return(false);
         }
         try{
             mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
         }catch {
             return(false);
         }
         mSwitchOutfitHelper.Start();
         if (Actor.HasTrait(TraitNames.Hydrophobic))
         {
             Actor.PlayReaction(ReactionTypes.WhyMe, Target as GameObject, ReactionSpeed.ImmediateWithoutOverlay);
         }
         if (Actor.HasTrait(TraitNames.Daredevil))
         {
             TraitTipsManager.ShowTraitTip(0xb82d0015b9294260L, Actor, TraitTipsManager.TraitTipCounterIndex.Daredevil, TraitTipsManager.kDaredevilCountOfShowersTaken);
         }
         if (!Actor.RouteToSlotAndCheckInUse(Target, Slot.RoutingSlot_0))
         {
             return(false);
         }
         //    mSituation=new Shower.ShowerPrivacySituation(this);
         //if(!mSituation.Start()){
         //        return(false);
         //}
         StandardEntry();
         if (!Actor.RouteToSlot(Target, Slot.RoutingSlot_0))
         {
             if (mSituation != null)
             {
                 mSituation.Exit();
             }
             StandardExit();
             return(false);
         }
         if (Autonomous)
         {
             mPriority = new InteractionPriority(InteractionPriorityLevel.UserDirected);
         }
         mSwitchOutfitHelper.Wait(true);
         bool daredevilPerforming =
             Actor.DaredevilPerforming;
         bool flag2 = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed;
         EnterStateMachine("Shower", "Enter", "x");
         SetActor("Shower", Target);
         if (mSituation != null)
         {
             mSituation.StateMachine = mCurrentStateMachine;
         }
         SetParameter("IsShowerTub", Target.IsShowerTub);
         SetParameter("SimShouldCloseDoor", true);
         SetParameter("SimShouldClothesChange", ((!daredevilPerforming && !flag2) && !Actor.OccultManager.DisallowClothesChange()) && !Actor.BuffManager.DisallowClothesChange());
         bool paramValue = false;
         if ((Target.BoobyTrapComponent != null) && Target.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription))
         {
             paramValue = !Actor.OccultManager.DisallowClothesChange() && !Actor.BuffManager.DisallowClothesChange();
         }
         SimDescription description = ((Target.BoobyTrapComponent != null) && (Target.BoobyTrapComponent.TrapSetter != 0L)) ? SimDescription.Find(Target.BoobyTrapComponent.TrapSetter) : null;
         if (((description != null) && description.IsFairy) && Actor.BuffManager.HasElement(BuffNames.TrickedByAFairy))
         {
             paramValue = false;
         }
         SetParameter("isBoobyTrapped", paramValue);
         mSwitchOutfitHelper.AddScriptEventHandler(this);
         AddOneShotScriptEventHandler(0x3e9, EventCallbackStartShoweringSound);
         if (Actor.HasTrait(TraitNames.Virtuoso) || RandomUtil.RandomChance((float)Target.TuningShower.ChanceOfSinging))
         {
             AddOneShotScriptEventHandler(0xc8, EventCallbackStartSinging);
         }
         PetStartleBehavior.CheckForStartle(Target as GameObject, StartleType.ShowerOn);
         AnimateSim("Loop Shower");
         Actor.BuffManager.AddElement(BuffNames.SavingWater, Origin.FromShower, ProductVersion.EP2, TraitNames.EnvironmentallyConscious);
         mShowerStage.ResetCompletionTime(GetShowerTime());
         StartStages();
         if (Actor.HasTrait(TraitNames.EnvironmentallyConscious))
         {
             BeginCommodityUpdate(CommodityKind.Hygiene, Shower.kEnvironmentallyConsciousShowerSpeedMultiplier);
         }
         if (Actor.SimDescription.IsPlantSim)
         {
             ModifyCommodityUpdate(CommodityKind.Hygiene, Shower.kPlantSimHygieneModifier);
         }
         BeginCommodityUpdates();
         if (paramValue)
         {
             ApplyBoobyTrapOutfit();
             if ((description != null) && description.IsFairy)
             {
                 Actor.BuffManager.AddElement(BuffNames.TrickedByAFairy, Origin.FromFairy);
             }
         }
         bool succeeded = (false);
         try{
             try{
                 Target.SimInShower = Actor;
                 succeeded          = DoLoop(~(
                                                 ExitReason.Replan |
                                                 ExitReason.MidRoutePushRequested |
                                                 ExitReason.ObjectStateChanged |
                                                 ExitReason.PlayIdle |
                                                 ExitReason.MaxSkillPointsReached), DuringShower, null);
                 if (HavingWooHoo && Actor.HasExitReason(ExitReason.StageComplete))
                 {
                     succeeded = DoLoop(~(
                                            ExitReason.Replan |
                                            ExitReason.MidRoutePushRequested |
                                            ExitReason.ObjectStateChanged |
                                            ExitReason.PlayIdle |
                                            ExitReason.MaxSkillPointsReached |
                                            ExitReason.StageComplete), DuringShower, null);
                 }
             }finally{
                 Target.SimInShower = null;
             }
             while (HavingWooHoo)
             {
                 SpeedTrap.Sleep(10);
             }
         }finally{
             EndCommodityUpdates(succeeded);
         }
         Shower.WaitToLeaveShower(Actor, Target);
         if (succeeded)
         {
             Shower.ApplyPostShowerEffects(Actor, Target);
         }
         if (paramValue)
         {
             SetParameter("isBoobyTrapped", false);
             AddOneShotScriptEventHandler(0xc9, EventCallbackStopSinging);
             AddOneShotScriptEventHandler(0x3ea, EventCallbackStopShoweringSound);
             if ((description != null) && description.IsFairy)
             {
                 AnimateSim("TriggerFairyTrap");
             }
             else
             {
                 AnimateSim("Booby Trap Reaction");
             }
             AddOneShotScriptEventHandler(0x3e9, EventCallbackStartShoweringSound);
             AnimateSim("Loop Shower");
             RemoveBoobyTrapOutfit();
             SpeedTrap.Sleep(60);
         }
         try{
             if (flag2 && succeeded)
             {
                 mSwitchOutfitHelper.Dispose();
                 try{
                     mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
                     mSwitchOutfitHelper.Start();
                     mSwitchOutfitHelper.Wait(false);
                     mSwitchOutfitHelper.ChangeOutfit();
                 }catch {}
             }
             bool flag5 = (false);
             if ((flag2 && succeeded) || (!flag2 && !daredevilPerforming))
             {
                 SetParameter("SimShouldClothesChange", !Actor.OccultManager.DisallowClothesChange());
                 mSwitchOutfitHelper.Dispose();
                 try{
                     mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, GetOutfitReason(Actor));
                     mSwitchOutfitHelper.Start();
                     mSwitchOutfitHelper.AddScriptEventHandler(this);
                     mSwitchOutfitHelper.Wait(false);
                 }catch {}
                 flag5 = (true);
             }
             Target.Cleanable.DirtyInc(Actor);
             AddOneShotScriptEventHandler(0xc9, EventCallbackStopSinging);
             AddOneShotScriptEventHandler(0x3ea, EventCallbackStopShoweringSound);
             if (flag5 && InventingSkill.IsBeingDetonated(Target as GameObject))
             {
                 SetParameter("SimShouldClothesChange", false);
                 mSwitchOutfitHelper.Abort();
                 mSwitchOutfitHelper.Dispose();
             }
             if (Target.Repairable.UpdateBreakage(Actor))
             {
                 Target.StartBrokenFXInAnim(mCurrentStateMachine);
                 AnimateSim("Exit Broken");
             }
             else
             {
                 AnimateSim("Exit Working");
             }
             if ((Actor.SimDescription.IsMummy || Actor.DaredevilPerforming) || (Actor.TraitManager.HasElement(TraitNames.Slob) && RandomUtil.RandomChance01(TraitTuning.SlobTraitChanceToLeavePuddle)))
             {
                 PuddleManager.AddPuddle(Actor.Position);
             }
             if (succeeded)
             {
                 Actor.BuffManager.RemoveElement(BuffNames.GotFleasHuman);
             }
         }finally{
             StandardExit();
         }
         return(succeeded);
     }catch (ResetException exception) {
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source);
         return(false);
     }catch (Exception exception) {
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source);
         return(false);
     }
 }
Example #14
0
 public static void FixCareer(Occupation job, bool allowDrop)
 {
     try{
         if (job == null)
         {
             return;
         }
         if (job.Coworkers != null)
         {
             for (int i = job.Coworkers.Count - 1; i >= 0; i--)
             {
                 SimDescription coworker = job.Coworkers[i];
                 if ((!IsValidCoworker(coworker, job is School)) || (coworker == job.OwnerDescription))
                 {
                     job.Coworkers.RemoveAt(i);
                 }
             }
         }
         if ((allowDrop) && (job is Career))
         {
             bool replace = (false);
             if (job.CareerLoc == null)
             {
                 replace = (true);
             }
             else
             {
                 RabbitHole hole = job.CareerLoc.Owner;
                 if (hole == null)
                 {
                     replace = (true);
                 }
                 else
                 {
                     RabbitHole proxy = hole.RabbitHoleProxy;
                     if (proxy == null)
                     {
                         replace = (true);
                     }
                     else
                     {
                         if ((proxy.EnterSlots == null) || (proxy.EnterSlots.Count == 0) ||
                             (proxy.ExitSlots == null) || (proxy.ExitSlots.Count == 0))
                         {
                             replace = (true);
                         }
                     }
                 }
             }
             if (replace)
             {
                 SimDescription me         = job.OwnerDescription;
                 Occupation     retiredJob = me.CareerManager.mRetiredCareer;
                 try{
                     CareerLocation location = Sims3.Gameplay.Careers.Career.FindClosestCareerLocation(me, job.Guid);
                     if (location != null)
                     {
                         if (job.CareerLoc != null)
                         {
                             job.CareerLoc.Workers.Remove(me);
                         }
                         job.CareerLoc = location;
                         location.Workers.Add(me);
                     }
                     else
                     {
                         job.LeaveJobNow(Career.LeaveJobReason.kJobBecameInvalid);
                     }
                 }finally{
                     me.CareerManager.mRetiredCareer = retiredJob;
                 }
             }
         }
     }catch (Exception exception) {
         //  Get stack trace for the exception. with source file information
         var st = new StackTrace(exception, true);
         //  Get the top stack frame
         var frame = st.GetFrame(0);
         //  Get the line number from the stack frame
         var line = frame.GetFileLineNumber();
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source + "\n\n" +
                        line);
     }finally{
     }
 }
Example #15
0
 protected static void ResetStuckSim(Sim sim, Vector3 destination, string suffix, bool deep = false)
 {
     if (sim != null &&
         !sim.HasBeenDestroyed &&
         sim.SimDescription != null)
     {
         //Alive.WriteLog("sim_is_stuck:reset_sim_in_progress:sim:"+sim.Name+";destination:"+destination);
         Lot lot = null;
         if (sim.SimDescription.IsBonehilda)
         {
             lot = BonehildaCoffin.FindBonehildaCoffin(sim)?.LotCurrent;
             if (lot == null)
             {
                 lot = sim.LotHome;
             }
         }
         else
         {
             lot = sim.LotHome;
         }
         if (lot == null)
         {
             lot = sim.VirtualLotHome;
         }
         if (lot == null)
         {
             lot = Sim.ActiveActor?.LotHome;
         }
         bool    addToWorld   = (true);
         Vector3 resetRawDest = destination;
         StuckSims.TryGetValue(sim.SimDescription.SimDescriptionId, out StuckSimData stuckSim);
         if (stuckSim != null)
         {
             //-------------------------
             if (stuckSim.Detections <= 2)
             {
                 Daycare daycare;
                 if ((sim.Household == null ||
                      (!sim.Household.InWorld &&
                       !sim.Household.IsSpecialHousehold)) &&
                     (!Passport.IsHostedPassportSim(sim) &&
                      sim.SimDescription.AssignedRole == null) &&
                     (LunarCycleManager.sFullMoonZombies == null ||
                      !LunarCycleManager.sFullMoonZombies.Contains(sim.SimDescription)) &&
                     ((daycare = sim.SimDescription.Occupation as Daycare) == null ||
                      !daycare.IsDaycareChild(sim.SimDescription)) &&
                     !sim.SimDescription.IsBonehilda &&
                     sim.Service == null)
                 {
                     addToWorld = (false);
                 }
                 if (destination != Vector3.Invalid)
                 {
                     goto DestSet;
                 }
             }
             //-------------------------
             if (stuckSim.Detections <= 3)
             {
                 if (lot == null)
                 {
                     lot = RandomUtil.GetRandomObjectFromList(Sims3.Gameplay.Queries.GetObjects <Lot>());
                 }
                 if (lot != null)
                 {
                     resetRawDest = lot.EntryPoint();
                     goto DestSet;
                 }
             }
             //-------------------------
             if (stuckSim.Detections <= 4)
             {
                 if (lot == null)
                 {
                     lot = RandomUtil.GetRandomObjectFromList(Sims3.Gameplay.Queries.GetObjects <Lot>());
                 }
                 if (lot != null)
                 {
                     Mailbox mailbox = lot.FindMailbox();
                     if (mailbox != null)
                     {
                         resetRawDest = mailbox.Position;
                         goto DestSet;
                     }
                 }
             }
             //-------------------------
             if (stuckSim.Detections <= 5 || sim.SimDescription.IsBonehilda)
             {
                 if (lot == null)
                 {
                     lot = RandomUtil.GetRandomObjectFromList(Sims3.Gameplay.Queries.GetObjects <Lot>());
                 }
                 if (lot != null)
                 {
                     Door frontDoor = lot.FindFrontDoor();
                     if (frontDoor != null)
                     {
                         int roomId = frontDoor.GetRoomIdOfDoorSide(CommonDoor.tSide.Front);
                         if (roomId != 0)
                         {
                             roomId = frontDoor.GetRoomIdOfDoorSide(CommonDoor.tSide.Back);
                         }
                         if (roomId == 0)
                         {
                             List <GameObject> objects = lot.GetObjectsInRoom <GameObject>(roomId);
                             if (objects.Count > 0)
                             {
                                 resetRawDest = RandomUtil.GetRandomObjectFromList(objects).Position;
                                 goto DestSet;
                             }
                         }
                     }
                 }
             }
             //-------------------------
             if (stuckSim.Detections <= 6)
             {
                 lot = RandomUtil.GetRandomObjectFromList(Sims3.Gameplay.Queries.GetObjects <Lot>());
                 if (lot != null)
                 {
                     resetRawDest = lot.EntryPoint();
                     goto DestSet;
                 }
             }
             //-------------------------
             if (stuckSim.Detections <= 7)
             {
                 lot = RandomUtil.GetRandomObjectFromList(Sims3.Gameplay.Queries.GetObjects <Lot>());
                 if (lot != null)
                 {
                     Mailbox mailbox = lot.FindMailbox();
                     if (mailbox != null)
                     {
                         resetRawDest = mailbox.Position;
                         goto DestSet;
                     }
                 }
             }
             //-------------------------
             if (stuckSim.Detections <= 8)
             {
                 lot = RandomUtil.GetRandomObjectFromList(Sims3.Gameplay.Queries.GetObjects <Lot>());
                 if (lot != null)
                 {
                     Door frontDoor = lot.FindFrontDoor();
                     if (frontDoor != null)
                     {
                         int roomId = frontDoor.GetRoomIdOfDoorSide(CommonDoor.tSide.Front);
                         if (roomId != 0)
                         {
                             roomId = frontDoor.GetRoomIdOfDoorSide(CommonDoor.tSide.Back);
                         }
                         if (roomId == 0)
                         {
                             List <GameObject> objects = lot.GetObjectsInRoom <GameObject>(roomId);
                             if (objects.Count > 0)
                             {
                                 resetRawDest = RandomUtil.GetRandomObjectFromList(objects).Position;
                                 goto DestSet;
                             }
                         }
                     }
                 }
             }
             //-------------------------
             if (stuckSim.Detections <= 9)
             {
                 resetRawDest        = Sim.ActiveActor.Position;
                 stuckSim.Detections = (1);
                 goto DestSet;
             }
             //-------------------------
             DestSet : {}
         }
         Vector3 resetValidatedDest;
         Vector3 forward = sim.ForwardVector;
         if (sim.SimDescription.IsHorse)
         {
             FindGoodLocationBooleans fglBooleans = FindGoodLocationBooleans.Routable |
                                                    FindGoodLocationBooleans.PreferEmptyTiles |
                                                    FindGoodLocationBooleans.AllowOnSlopes |
                                                    //FindGoodLocationBooleans.AllowIntersectionWithPlatformWalls|
                                                    //FindGoodLocationBooleans.AllowInFrontOfDoors          |
                                                    //FindGoodLocationBooleans.AllowOnStairTopAndBottomTiles|
                                                    FindGoodLocationBooleans.AllowOffLot |
                                                    FindGoodLocationBooleans.AllowOnStreets |
                                                    FindGoodLocationBooleans.AllowOnBridges |
                                                    FindGoodLocationBooleans.AllowOnSideWalks;
             if (stuckSim != null)
             {
                 if (stuckSim.Detections <= 5)
                 {
                     if (!GlobalFunctions.FindGoodLocationNearbyOnLevel(sim, sim.Level, ref resetRawDest, ref forward, fglBooleans))
                     {
                         GlobalFunctions.FindGoodLocationNearbyOnLevel(sim, sim.Level, ref resetRawDest, ref forward, FindGoodLocationBooleans.None);
                     }
                 }
             }
             World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(resetRawDest);
             fglParams.BooleanConstraints = fglBooleans;
             if (!GlobalFunctions.FindGoodLocation(sim, fglParams, out resetValidatedDest, out forward))
             {
                 fglParams.BooleanConstraints = FindGoodLocationBooleans.None;
                 GlobalFunctions.FindGoodLocation(sim, fglParams, out resetValidatedDest, out forward);
             }
         }
         else
         {
             World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(resetRawDest);
             fglParams.BooleanConstraints = FindGoodLocationBooleans.Routable |
                                            FindGoodLocationBooleans.PreferEmptyTiles |
                                            FindGoodLocationBooleans.AllowOnSlopes |
                                            FindGoodLocationBooleans.AllowIntersectionWithPlatformWalls |
                                            FindGoodLocationBooleans.AllowInFrontOfDoors |
                                            FindGoodLocationBooleans.AllowOnStairTopAndBottomTiles |
                                            FindGoodLocationBooleans.AllowOffLot |
                                            FindGoodLocationBooleans.AllowOnStreets |
                                            FindGoodLocationBooleans.AllowOnBridges |
                                            FindGoodLocationBooleans.AllowOnSideWalks;
             if (!GlobalFunctions.FindGoodLocation(sim, fglParams, out resetValidatedDest, out forward))
             {
                 fglParams.BooleanConstraints = FindGoodLocationBooleans.None;
                 GlobalFunctions.FindGoodLocation(sim, fglParams, out resetValidatedDest, out forward);
             }
         }
         if (!deep)
         {
             if (sim.InteractionQueue != null && sim.InteractionQueue.mInteractionList != null)
             {
                 InteractionInstance
                     currentInteraction;
                 if ((currentInteraction = sim.InteractionQueue.GetCurrentInteraction()) != null)
                 {
                     //
                     sim.InteractionQueue.CancelInteraction(currentInteraction.Id, ExitReason.CanceledByScript);
                 }
             }
         }
         sim.SetPosition(resetValidatedDest);
         sim.SetForward(forward);
         sim.RemoveFromWorld();
         if (addToWorld || deep)
         {
             if (!deep)
             {
                 try{
                     sim.Posture?.CancelPosture(sim);
                 }catch (Exception exception) {
                     Alive.WriteLog(exception.Message + "\n\n" +
                                    exception.StackTrace + "\n\n" +
                                    exception.Source);
                 }
             }
             sim.AddToWorld();
             sim.SetHiddenFlags(HiddenFlags.Nothing);
             sim.SetOpacity(1f, 0f);
         }
         else
         {
             sim.SetHiddenFlags(HiddenFlags.Everything);
             sim.SetOpacity(0f, 0f);
         }
         sim.SimRoutingComponent?.ForceUpdateDynamicFootprint();
         if (stuckSim != null)
         {
             stuckSim.Resetting = (false);                                       //  Pode detectar novos eventos Stuck
         }
     }
 }
Example #16
0
 static void CheckShowVenues()
 {
     try{
         foreach (ShowVenue showVenue in Sims3.Gameplay.Queries.GetObjects <ShowVenue>())
         {
             try{
                 if (showVenue.ShowInProgress ||
                     showVenue.ShowType != ShowVenue.ShowTypes.kNoShow)
                 {
                     if (!ShowDetected.ContainsKey(showVenue))
                     {
                         ShowDetected.Add(showVenue, new ShowDetectedData(SimClock.CurrentTicks));
                     }
                 }
             }catch (Exception exception) {
                 Alive.WriteLog(exception.Message + "\n\n" +
                                exception.StackTrace + "\n\n" +
                                exception.Source + "\n\n" +
                                "CheckShowVenues_foreach_check");
             }finally{
             }
         }
         List <KeyValuePair <ShowVenue, ShowDetectedData> > toRemove = new List <KeyValuePair <ShowVenue, ShowDetectedData> >();
         foreach (var showDetectedData in ShowDetected)
         {
             try{
                 if (showDetectedData.Key.HasBeenDestroyed)
                 {
                     toRemove.Add(showDetectedData);
                 }
                 else
                 if (!showDetectedData.Key.ShowInProgress &&
                     showDetectedData.Key.ShowType == ShowVenue.ShowTypes.kNoShow)
                 {
                     foreach (ISearchLight light in showDetectedData.Key.LotCurrent.GetObjects <ISearchLight>())
                     {
                         light.TurnOff();
                         SearchLight searchLight = light as SearchLight;
                         if (searchLight != null)
                         {
                             searchLight.mSMC?.Dispose();
                             searchLight.mSMC = null;
                         }
                     }
                     toRemove.Add(showDetectedData);
                 }
                 else
                 if (
                     SimClock.CurrentTicks - showDetectedData.Value.ShowStartTimeTicks > SimClock.kSimulatorTicksPerSimMinute * 300)    //  Reset
                 {
                     foreach (ISearchLight light in showDetectedData.Key.LotCurrent.GetObjects <ISearchLight>())
                     {
                         light.TurnOff();
                         SearchLight searchLight = light as SearchLight;
                         if (searchLight != null)
                         {
                             searchLight.mSMC?.Dispose();
                             searchLight.mSMC = null;
                         }
                     }
                     showDetectedData.Key.EndPlayerConcert();
                     toRemove.Add(showDetectedData);
                 }
             }catch (Exception exception) {
                 Alive.WriteLog(exception.Message + "\n\n" +
                                exception.StackTrace + "\n\n" +
                                exception.Source + "\n\n" +
                                "CheckShowVenues_foreach_end");
             }finally{
             }
         }
         for (int i = 0; i < toRemove.Count; i++)
         {
             ShowDetected.Remove(toRemove[i].Key);
         }
         toRemove.Clear();
     }catch (Exception exception) {
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source + "\n\n" +
                        "CheckShowVenues");
     }finally{
     }
 }
Example #17
0
        public static void   FixInvisibleSim(SimDescription sim, bool force = false, bool reset = false)
        {
            try{
                OutfitCategories[] categoriesArray = null;
                switch (sim.Species)
                {
                case CASAgeGenderFlags.Human:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked,
                                                               OutfitCategories.Athletic,
                                                               OutfitCategories.Formalwear,
                                                               OutfitCategories.Sleepwear,
                                                               OutfitCategories.Swimwear };
                    break;

                case CASAgeGenderFlags.Horse:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked,
                                                               OutfitCategories.Racing,
                                                               OutfitCategories.Bridle,
                                                               OutfitCategories.Jumping };
                    break;

                default:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked };
                    break;
                }
                bool necessary = force;
                if (!necessary)
                {
                    foreach (OutfitCategories category in categoriesArray)
                    {
                        if (sim.IsHuman)
                        {
                            if (category == OutfitCategories.Naked)
                            {
                                continue;
                            }
                        }
                        SimOutfit outfit2 = sim.GetOutfit(category, 0);
                        if ((outfit2 == null) || (!outfit2.IsValid))
                        {
                            necessary = true;
                        }
                    }
                }
                if (!necessary)
                {
                    return;
                }
                SimOutfit sourceOutfit = null;
                for (int i = 0; i < 2; i++)
                {
                    OutfitCategoryMap map = null;
                    if (i == 0)
                    {
                        map = sim.mOutfits;
                    }
                    else
                    {
                        map = sim.mMaternityOutfits;
                    }
                    if (map == null)
                    {
                        continue;
                    }
                    foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories)))
                    {
                        if (category == OutfitCategories.Supernatural)
                        {
                            continue;
                        }
                        ArrayList outfits = map[category] as ArrayList;
                        if (outfits == null)
                        {
                            continue;
                        }
                        foreach (SimOutfit anyOutfit in outfits)
                        {
                            if ((anyOutfit != null) && (anyOutfit.IsValid))
                            {
                                sourceOutfit = anyOutfit;
                                break;
                            }
                        }
                    }
                }
                SimBuilder builder = new SimBuilder();
                builder.UseCompression = true;
                var simTone = sim.SkinToneKey;
                List <ResourceKey> choiceTones = new List <ResourceKey>();
                KeySearch          tones       = new KeySearch(0x0354796a);
                foreach (ResourceKey tone in tones)
                {
                    choiceTones.Add(tone);
                }
                tones.Reset();
                if ((simTone.InstanceId == 0) || (!choiceTones.Contains(simTone)))
                {
                    simTone = RandomUtil.GetRandomObjectFromList(choiceTones);
                }
                ResourceKey newTone = simTone;

                builder.Age           = sim.Age;
                builder.Gender        = sim.Gender;
                builder.Species       = sim.Species;
                builder.SkinTone      = newTone;
                builder.SkinToneIndex = sim.SkinToneIndex;
                builder.MorphFat      = sim.mCurrentShape.Fat;
                builder.MorphFit      = sim.mCurrentShape.Fit;
                builder.MorphThin     = sim.mCurrentShape.Thin;
                GeneticsPet.SpeciesSpecificData speciesData = OutfitUtils.GetSpeciesSpecificData(sim);
                try{
                    if (sourceOutfit != null)
                    {
                        foreach (SimOutfit.BlendInfo blend in sourceOutfit.Blends)
                        {
                            builder.SetFacialBlend(blend.key, blend.amount);
                        }
                        CASParts.OutfitBuilder.CopyGeneticParts(builder, sourceOutfit);
                    }
                    else
                    {
                        if (sim.Genealogy != null)
                        {
                            List <SimDescription> parents      = new List <SimDescription>();
                            List <SimDescription> grandParents = new List <SimDescription>();
                            if (sim.Genealogy.Parents != null)
                            {
                                foreach (Genealogy gene in sim.Genealogy.Parents)
                                {
                                    SimDescription relative = gene.SimDescription;
                                    if (relative == null)
                                    {
                                        continue;
                                    }
                                    parents.Add(relative);
                                    if (relative.Genealogy != null)
                                    {
                                        if (relative.Genealogy.Parents != null)
                                        {
                                            foreach (Genealogy grandGene in relative.Genealogy.Parents)
                                            {
                                                var grandRelative = grandGene.SimDescription;
                                                if (grandRelative == null)
                                                {
                                                    continue;
                                                }
                                                grandParents.Add(grandRelative);
                                            }
                                        }
                                    }
                                }
                            }
                            if (parents.Count > 0)
                            {
                                if (sim.IsHuman)
                                {
                                    Genetics.InheritFacialBlends(builder, parents.ToArray(), new Random());
                                }
                                else
                                {
                                    GeneticsPet.InheritBodyShape(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritBasePeltLayer(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritPeltLayers(builder, parents, grandParents, new Random());
                                }
                            }
                        }
                    }
                }catch (Exception exception) {
                    Alive.WriteLog(exception.Message + "\n\n" +
                                   exception.StackTrace + "\n\n" +
                                   exception.Source);
                }
                if (sim.IsRobot)
                {
                    OutfitUtils.AddMissingPartsBots(builder, (OutfitCategories)0x200002, true, sim);
                    Sleep();
                    OutfitUtils.AddMissingPartsBots(builder, OutfitCategories.Everyday, true, sim);
                    Sleep();
                }
                else
                if (sim.IsHuman)
                {
                    OutfitUtils.AddMissingParts(builder, (OutfitCategories)0x200002, true, sim, sim.IsAlien);
                    Sleep();
                    OutfitUtils.AddMissingParts(builder, OutfitCategories.Everyday, true, sim, sim.IsAlien);
                    Sleep();
                }
                else
                {
                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday | (OutfitCategories)0x200000, true, sim, speciesData);
                    Sleep();
                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday, true, sim, speciesData);
                    Sleep();
                }
                ResourceKey uniformKey = new ResourceKey();
                if (sim.IsHuman)
                {
                    if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, OutfitCategories.Everyday))
                    {
                        OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                    }
                }
                OutfitUtils.SetAutomaticModifiers(builder);
                sim.ClearOutfits(OutfitCategories.Career, false);
                sim.ClearOutfits(OutfitCategories.MartialArts, false);
                sim.ClearOutfits(OutfitCategories.Special, false);
                foreach (OutfitCategories category in categoriesArray)
                {
                    ArrayList outfits = null;
                    if (!force)
                    {
                        outfits = sim.Outfits[category] as ArrayList;
                        if (outfits != null)
                        {
                            int index = 0;
                            while (index < outfits.Count)
                            {
                                SimOutfit anyOutfit = outfits[index] as SimOutfit;
                                if (anyOutfit == null)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else
                                if (!anyOutfit.IsValid)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else
                                {
                                    index++;
                                }
                            }
                        }
                    }

                    if ((outfits == null) || (outfits.Count == 0))
                    {
                        OutfitUtils.MakeCategoryAppropriate(builder, category, sim);
                        if (sim.IsHuman)
                        {
                            if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, category))
                            {
                                OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                            }
                        }
                        sim.RemoveOutfits(category, false);
                        CASParts.AddOutfit(sim, category, builder, true);
                    }
                    if (sim.IsUsingMaternityOutfits)
                    {
                        sim.BuildPregnantOutfit(category);
                    }
                }
                if (sim.IsMummy)
                {
                    OccultMummy
                    .OnMerge(sim);
                }
                else
                if (sim.IsFrankenstein)
                {
                    OccultFrankenstein
                    .OnMerge(sim, sim.OccultManager.mIsLifetimeReward);
                }
                else
                if (sim.IsGenie)
                {
                    OccultGenie
                    .OverlayUniform(sim, OccultGenie.CreateUniformName(sim.Age, sim.Gender), ProductVersion.EP6, OutfitCategories.Everyday, CASSkinTones.BlueSkinTone, 0.68f);
                }
                else
                if (sim.IsImaginaryFriend)
                {
                    OccultImaginaryFriend friend = sim.OccultManager.GetOccultType(Sims3.UI.Hud.OccultTypes.ImaginaryFriend) as OccultImaginaryFriend;
                    OccultBaseClass
                    .OverlayUniform(sim, OccultImaginaryFriend.CreateUniformName(sim.Age, friend.Pattern), ProductVersion.EP4, OutfitCategories.Special, CASSkinTones.NoSkinTone, 0f);
                }
                if (sim.IsMermaid)
                {
                    OccultMermaid
                    .AddOutfits(sim, null);
                }
                if (sim.IsWerewolf)
                {
                    if (sim.ChildOrAbove)
                    {
                        SimOutfit newWerewolfOutfit =
                            OccultWerewolf
                            .GetNewWerewolfOutfit(sim.Age, sim.Gender);
                        if (newWerewolfOutfit != null)
                        {
                            sim.AddOutfit(newWerewolfOutfit, OutfitCategories.Supernatural, 0x0);
                        }
                    }
                }
                SimOutfit currentOutfit = null;
                if (sim.CreatedSim != null)
                {
                    if (reset)
                    {
                        StuckSimData stuckSim;
                        if (!StuckSims.TryGetValue(sim.SimDescriptionId, out stuckSim))
                        {
                            stuckSim = new StuckSimData();
                            StuckSims.Add(sim.SimDescriptionId, stuckSim);
                        }
                        if (!stuckSim.Resetting)
                        {
                            stuckSim.Detections++;
                            Vector3 destination = Vector3.Invalid;
                            if (sim.CreatedSim.RoutingComponent != null)
                            {
                                sim.CreatedSim.RoutingComponent.GetDestination(out destination);
                            }
                            if (stuckSim.resetTask == null)
                            {
                                stuckSim.resetTask = new ResetStuckSimTask(sim.CreatedSim, destination, "Invisible");
                            }
                            else
                            {
                                stuckSim.resetTask.Renew();
                            }
                        }
                    }
                    try{
                        sim.CreatedSim.SwitchToOutfitWithoutSpin(Sim.ClothesChangeReason.GoingOutside, OutfitCategories.Everyday, true);
                    }catch (Exception exception) {
                        Alive.WriteLog(exception.Message + "\n\n" +
                                       exception.StackTrace + "\n\n" +
                                       exception.Source);
                    }
                    currentOutfit = sim.CreatedSim.CurrentOutfit;
                }
                else
                {
                    currentOutfit = sim.GetOutfit(OutfitCategories.Everyday, 0);
                }
                if (currentOutfit != null)
                {
                    ThumbnailManager.GenerateHouseholdSimThumbnail(currentOutfit.Key, currentOutfit.Key.InstanceId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, sim.AgeGenderSpecies);
                }
            }catch (Exception exception) {
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               "FixInvisibleSim");
            }finally{
            }
        }
Example #18
0
 //==================================================================================================================
 //==================================================================================================================
 static void RecoverMissingSims()
 {
     try{
         List <Sim> sims = new List <Sim>(LotManager.Actors);
         foreach (Sim sim in sims)
         {
             try{
                 SimDescription simDesc = sim.SimDescription;
                 if (simDesc == null)
                 {
                     continue;
                 }
                 if ((!sim.SimDescription.IsValidDescription) || (sim.Household == null))
                 {
                     try{
                         if (SimIsMissing(sim.SimDescription, true))
                         {
                             simDesc.Fixup();
                             sim.Autonomy?.Motives?.RecreateMotives(sim);
                             sim.SetObjectToReset();
                         }
                     }catch (Exception exception) {
                         Alive.WriteLog(exception.Message + "\n\n" +
                                        exception.StackTrace + "\n\n" +
                                        exception.Source + "\n\n" +
                                        "RecoverMissingSims_foreach_missing");
                     }finally{
                     }
                 }
             }catch (Exception exception) {
                 Alive.WriteLog(exception.Message + "\n\n" +
                                exception.StackTrace + "\n\n" +
                                exception.Source + "\n\n" +
                                "RecoverMissingSims_foreach");
             }finally{
             }
         }
     }catch (Exception exception) {
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source + "\n\n" +
                        "RecoverMissingSims");
     }finally{
     }
     try{
         List <Household> houses = new List <Household>(Household.sHouseholdList);
         foreach (Household house in houses)
         {
             try{
                 if (house.LotHome == null)
                 {
                     continue;
                 }
                 var        numSims = (house.AllSimDescriptions.Count);
                 List <Sim> allSims = new List <Sim>();
                 foreach (SimDescription sim in house.AllSimDescriptions)
                 {
                     if (sim.CreatedSim == null)
                     {
                         continue;
                     }
                     allSims.Add(sim.CreatedSim);
                 }
                 if (numSims != allSims.Count)
                 {
                     List <SimDescription> allSimDescriptions = house.AllSimDescriptions;
                     foreach (SimDescription description in allSimDescriptions)
                     {
                         bool flag = (true);
                         foreach (Sim sim in allSims)
                         {
                             if (sim.SimDescription == description)
                             {
                                 flag = (false);
                                 break;
                             }
                         }
                         if (flag)
                         {
                             FixInvisibleSim(description);
                             RecoverMissingSim(description, true);
                         }
                     }
                 }
             }catch (Exception exception) {
                 Alive.WriteLog(exception.Message + "\n\n" +
                                exception.StackTrace + "\n\n" +
                                exception.Source + "\n\n" +
                                "RecoverMissingSims_households_foreach");
             }finally{
             }
         }
     }catch (Exception exception) {
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source + "\n\n" +
                        "RecoverMissingSims_households");
     }finally{
     }
 }