Пример #1
0
        public override void OnWorldLoadFinished()
        {
            Overwatch.Log(GetTitlePrefix());

            TimeTraveler service = TimeTraveler.Instance;
            List <ulong> remove  = new List <ulong>();

            if (service != null)
            {
                foreach (KeyValuePair <ulong, Service.ServiceRequest> pair in service.mLotsRequested)
                {
                    if (!service.mTimeTravelerServiceRequests.ContainsKey(pair.Key))
                    {
                        remove.Add(pair.Key);
                    }
                }

                foreach (ulong num in remove)
                {
                    Lot lot = LotManager.GetLot(num);
                    if (lot != null)
                    {
                        service.ClearServiceForLot(lot);
                    }
                    else
                    {
                        service.mLotsRequested.Remove(num);
                    }
                    Overwatch.Log("Removed invalid Time Traveler service request");
                }
            }
        }
Пример #2
0
        public override bool Run()
        {
            try
            {
                LotLocation location = LotLocation.Invalid;
                Lot         lot      = LotManager.GetLot(World.GetLotLocation(Destination, ref location));
                if (lot != null)
                {
                    if (Teleport.Perform(Actor, lot, true))
                    {
                        return(true);
                    }
                }

                return(base.Run());
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Пример #3
0
        protected override OptionResult Run(Lot myLot, Household house)
        {
            try
            {
                string text = StringInputDialog.Show(Name, "Enter the ID for the lot:", "");
                if (string.IsNullOrEmpty(text))
                {
                    return(OptionResult.Failure);
                }

                ulong lotID = ulong.Parse(text);

                Lot lot = LotManager.GetLot(lotID);
                if (lot == null)
                {
                    SimpleMessageDialog.Show(Name, "No lot found");
                }
                else
                {
                    Focus.Perform(lot);

                    SimpleMessageDialog.Show(Name, lot.Name + " " + lot.Address);
                }
            }
            catch (Exception e)
            {
                Common.Exception(myLot, e);
            }
            return(OptionResult.SuccessClose);
        }
        public override void OnWorldLoadFinished()
        {
            Overwatch.Log(GetTitlePrefix());

            SocialWorkerChildAbuse service = SocialWorkerChildAbuse.Instance;
            List <ulong>           remove  = new List <ulong>();

            if (service != null)
            {
                foreach (KeyValuePair <ulong, Service.ServiceRequest> pair in service.mLotsRequested)
                {
                    Lot lot = LotManager.GetLot(pair.Key);
                    if (lot == null || (lot != Household.ActiveHouseholdLot))
                    {
                        remove.Add(pair.Key);
                    }
                }

                foreach (ulong num in remove)
                {
                    Lot lot = LotManager.GetLot(num);
                    if (lot != null)
                    {
                        service.ClearServiceForLot(lot);
                    }
                    else
                    {
                        service.mLotsRequested.Remove(num);
                    }
                    Overwatch.Log("Removed invalid Social Worker service request");
                }
            }
        }
Пример #5
0
        public override void OnWorldLoadFinished()
        {
            Overwatch.Log(GetTitlePrefix());

            try
            {
                bool fix = false;
                foreach (Lot lot in LotManager.AllLots)
                {
                    if (lot.ResortManager != null)
                    {
                        if (lot.ResortManager.mOwnerLot == null || LotManager.GetLot(lot.ResortManager.mOwnerLot.LotId) == null)
                        {
                            fix = true;
                            lot.ResortManager.mOwnerLot = lot;
                        }
                    }
                }

                if (fix)
                {
                    Overwatch.Log("Fixed resort managers");
                }
            }
            catch (Exception e)
            {
                Common.Exception(GetTitlePrefix(), e);
            }
        }
Пример #6
0
        public static Sim DGSMakeRandomSimNoCheck(Vector3 point, CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName worldname)
        {
            LotLocation    lotLocation     = default(LotLocation);
            ulong          lotLocation2    = World.GetLotLocation(point, ref lotLocation);
            Lot            lot             = LotManager.GetLot(lotLocation2);
            SimDescription simDescription2 = DGSMakeSSimDescription(age, gender, worldname, uint.MaxValue);

            Genetics.AssignRandomTraits(simDescription2);
            if (lot != null)
            {
                if (lot.Household == null)
                {
                    Household household = Household.Create();
                    lot.MoveIn(household);
                }
                lot.Household.Add(simDescription2);
            }
            else
            {
                Household household2 = Household.Create();
                household2.SetName(/* "E3Lesa is Good" */ "Good Household");
                household2.Add(simDescription2);
            }
            WorldName currentWorld = worldname;

            simDescription2.FirstName = SimUtils.GetRandomGivenName(simDescription2.IsMale, currentWorld);
            simDescription2.LastName  = SimUtils.GetRandomFamilyName(currentWorld);

            return(simDescription2.Instantiate(point));
        }
Пример #7
0
        private void ConfirmPurchaseTaskEx(object lotInfoParam)
        {
            try
            {
                UIBinInfo info = lotInfoParam as UIBinInfo;
                if ((info != null) && (info.LotId != ulong.MaxValue))
                {
                    int worth = 0;
                    if (!Mover.Settings.mFreeRealEstate)
                    {
                        Lot lot = LotManager.GetLot(info.LotId);
                        if (lot != null)
                        {
                            worth = info.LotWorth;
                        }
                        else
                        {
                            worth = Mover.GetLotCost(lot);
                        }
                    }

                    if (EditTownConfirmPurchaseLot.Show(info.LotId, worth, mInfo.HouseholdFunds) != EditTownConfirmPurchaseLot.Result.Cancel)
                    {
                        PlaceHouseholdEx(mInfo, info.LotId);
                    }
                }

                mPlacing = false;
            }
            catch (Exception e)
            {
                Common.Exception("ConfirmPurchaseTaskEx", e);
            }
        }
Пример #8
0
        public int Assets(Household house)
        {
            int assets = 0;

            if (house == null)
            {
                return(0);
            }
            else
            {
                assets = house.FamilyFunds + Lots.GetLotCost(house.LotHome);
            }

            if (house.RealEstateManager != null)
            {
                foreach (PropertyData data in house.RealEstateManager.AllProperties)
                {
                    Lot lot = LotManager.GetLot(data.LotId);
                    if (lot == null)
                    {
                        assets += data.TotalValue;
                    }
                    else if (lot.ResidentialLotSubType == ResidentialLotSubType.kEP1_PlayerOwnable)
                    {
                        assets += data.TotalValue;
                    }
                    else
                    {
                        assets += ManagerLot.GetUnfurnishedLotCost(lot, 0);
                    }
                }
            }

            return(assets);
        }
Пример #9
0
        public static void OnMapTagAdded(IMapTag tag)
        {
            if (Sim.ActiveActor == null || Sim.ActiveActor.MapTagManager == null || !CameraController.IsMapViewModeEnabled())
            {
                return;
            }

            if (tag.TagType == MapTagType.Venue)
            {
                MapTagsModel  model   = MapTagsModel.Singleton;
                MapTagManager manager = Sim.ActiveActor.MapTagManager;
                MapTag        mTag    = tag as MapTag;
                if (model != null && manager != null && mTag != null)
                {
                    Lot lot = LotManager.GetLot(mTag.LotId);
                    if (lot != null && ShouldReplace(lot))
                    {
                        CustomTagNRaas customTag = new CustomTagNRaas(lot, mTag.Owner);
                        manager.RemoveTag(tag.ObjectGuid);
                        Tagger.sReplaced.Add(lot.LotId);
                        manager.AddTag(customTag);
                    }
                }
            }
        }
Пример #10
0
        public static Lot GetLot(FoodTruckBase truck)
        {
            ulong lotId;

            if (!sTruckLots.TryGetValue(truck, out lotId))
            {
                return(null);
            }

            return(LotManager.GetLot(lotId));
        }
Пример #11
0
        /*protected static ListenerAction OnNewObject(Event e)
         * {
         *  GameObject o = e.TargetObject as GameObject;
         *
         *  AddInteractions(o);
         *
         *  return ListenerAction.Keep;
         * }*/

        public static void OnExitBuildBuyMode()
        {
            Lot lot = LotManager.GetLot(BuildBuyLotId);

            if (lot != null)
            {
                foreach (Type type in ApplianceTypes)
                {
                    AddInteractionsToObjects(type, lot);
                }
            }
        }
Пример #12
0
        public static bool Perform(SimDescription me, OpportunityNames guid)
        {
            Opportunity opportunity = null;

            GenericManager <OpportunityNames, Opportunity, Opportunity> .sDictionary.TryGetValue((ulong)guid, out opportunity);

            Repeatability origRepeatability = Repeatability.Undefined;

            if (opportunity != null)
            {
                origRepeatability = opportunity.RepeatLevel;

                opportunity.mSharedData.mRepeatLevel = Repeatability.Always;
            }

            try
            {
                me.Household.mCompletedHouseholdOpportunities.Remove((ulong)guid);

                if (opportunity.IsLocationBased)
                {
                    List <Lot> alreadyChosenLots = new List <Lot>();

                    foreach (ulong lotId in OpportunityManager.sLocationBasedOpportunities.Values)
                    {
                        Lot lot = LotManager.GetLot(lotId);
                        if (lot == null)
                        {
                            continue;
                        }

                        alreadyChosenLots.Add(lot);
                    }

                    Lot lotTarget = OpportunityManager.GetLotTarget(opportunity, alreadyChosenLots);
                    if (lotTarget != null)
                    {
                        lotTarget.AddLocationBasedOpportunity(opportunity.EventDay, opportunity.EventStartTime, opportunity.EventEndTime, opportunity.Guid);
                        alreadyChosenLots.Add(lotTarget);
                    }
                }

                return(me.CreatedSim.OpportunityManager.AddOpportunityNow(guid, true, false));
            }
            finally
            {
                if (opportunity != null)
                {
                    opportunity.mSharedData.mRepeatLevel = origRepeatability;
                }
            }
        }
Пример #13
0
        public static Sim DGSMakeRandomSim(Vector3 point, CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName worldname)
        {
            LotLocation lotLocation  = default(LotLocation);
            ulong       lotLocation2 = World.GetLotLocation(point, ref lotLocation);
            Lot         lot          = LotManager.GetLot(lotLocation2);

            if ((age & (CASAgeGenderFlags.Baby | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Child)) != CASAgeGenderFlags.None)
            {
                bool flag = false;
                if (lot != null && lot.Household != null)
                {
                    foreach (SimDescription simDescription in lot.Household.SimDescriptions)
                    {
                        if (simDescription.TeenOrAbove)
                        {
                            flag = true;
                            break;
                        }
                    }
                }
                if (!flag)
                {
                    return(null);
                }
            }
            SimDescription simDescription2 = DGSMakeSSimDescription(age, gender, worldname, uint.MaxValue);

            Genetics.AssignRandomTraits(simDescription2);
            if (lot != null)
            {
                if (lot.Household == null)
                {
                    Household household = Household.Create();
                    household.Name = simDescription2.mLastName ?? "";
                    lot.MoveIn(household);
                }
                lot.Household.Add(simDescription2);
            }
            else
            {
                Household household2 = Household.Create();
                household2.SetName(/* "E3Lesa is Good" */ "Good Household");
                household2.Add(simDescription2);
            }
            WorldName currentWorld = worldname;

            simDescription2.FirstName = SimUtils.GetRandomGivenName(simDescription2.IsMale, currentWorld);
            simDescription2.LastName  = SimUtils.GetRandomFamilyName(currentWorld);

            return(simDescription2.Instantiate(point));
        }
Пример #14
0
        private static void ScheduleTodaysOrientation()
        {
            Common.DebugNotify("ScheduleTodaysOrientation A");

            if (GameUtils.IsUniversityWorld())
            {
                if (GameStates.CurrentDayOfTrip != 0x1)
                {
                    return;
                }
            }
            else
            {
                if (!AcademicHelper.HasFirstDayActiveStudents())
                {
                    return;
                }
            }

            Common.DebugNotify("ScheduleTodaysOrientation B");

            Lot lot = null;

            foreach (EventLotMarker marker in Sims3.Gameplay.Queries.GetObjects <EventLotMarker>())
            {
                if (marker.LotCurrent == null)
                {
                    continue;
                }

                if (!marker.LotCurrent.IsCommunityLot)
                {
                    continue;
                }

                lot = marker.LotCurrent;
                break;
            }

            if (lot == null)
            {
                lot = LotManager.GetLot(OrientationSituation.kOrientationLotId);
            }

            Common.DebugNotify("ScheduleTodaysOrientation " + lot.LotId);

            if (lot != null)
            {
                OrientationSituation.Create(lot);
            }
        }
Пример #15
0
        public static bool PayForLot(EditTownModel ths, UIBinInfo info, ulong lotId)
        {
            Lot lot = LotManager.GetLot(lotId);

            if (lot != null)
            {
                ExportBinContents contents = ths.FindExportBinContents(info.ContentId);
                if (contents != null)
                {
                    bool flag = contents.IsLoaded();
                    if (!flag)
                    {
                        ExportBinContentsEx.Import(contents, true);
                    }

                    Household household = contents.Household;
                    if (household != null)
                    {
                        return(BinCommonEx.PayForLot(household, lot, true, Mover.GetLotCost));
                    }

                    if (!flag)
                    {
                        ExportBinContentsEx.Flush(contents);
                    }
                }
                else if (info.LotId != ulong.MaxValue)
                {
                    LotContents contents2 = Bin.Singleton.FindLot(info.LotId);
                    if ((contents2 != null) && (contents2.Household != null))
                    {
                        Household household2 = contents2.Household.Household;
                        if (household2 != null)
                        {
                            return(BinCommonEx.PayForLot(household2, lot, true, Mover.GetLotCost));
                        }
                    }
                }
                else if (info.HouseholdId != ulong.MaxValue)
                {
                    Household household3 = Household.Find(info.HouseholdId);
                    if (household3 != null)
                    {
                        return(BinCommonEx.PayForLot(household3, lot, true, Mover.GetLotCost));
                    }
                }
            }
            return(false);
        }
Пример #16
0
        protected override int GetCost(PropertyData data)
        {
            int result = 0;

            if (data.PropertyType == RealEstatePropertyType.VacationHome)
            {
                Lot lot = LotManager.GetLot(data.LotId);
                if (lot != null)
                {
                    result = ManagerLot.GetUnfurnishedLotCost(lot, int.MaxValue);
                }
            }

            return((int)(result * (GetValue <SurchargeRateOption, int>() / 100f)));
        }
Пример #17
0
 // doesn't seem to be firing...
 public static void OnLotTypeChanged(object sender, EventArgs args)
 {
     // until I can work on custom MA types, this should push some Sims to the lots (and urge them to buy stuff if the items exist)
     World.OnLotTypeChangedEventArgs args2 = args as World.OnLotTypeChangedEventArgs;
     if (args2 != null)
     {
         Lot lot = LotManager.GetLot(args2.LotId);
         if (lot != null)
         {
             if (MapTagHelper.ShouldReplace(lot))
             {
                 SetMetaAutonomyType(lot, Lot.MetaAutonomyType.MarketSmall);
             }
         }
     }
 }
Пример #18
0
        public static Lot GetPostionTargetLot(Vector3 pos)
        {
            if (LotManager.sLots == null)
            {
                return(LotManager.GetWorldLot());
            }
            LotLocation LotLocation = default(LotLocation);
            ulong       Location    = World.GetLotLocation(pos, ref LotLocation);
            Lot         TargetLot   = LotManager.GetLot(Location);

            if (TargetLot == null)
            {
                return(LotManager.GetWorldLot());
            }
            return(TargetLot);
        }
Пример #19
0
        public static Lot GetCameraTargetLot()
        {
            if (LotManager.sLots == null)
            {
                return(LotManager.sActiveLot ?? LotManager.sWorldLot);
            }
            LotLocation LotLocation = default(LotLocation);
            ulong       Location    = World.GetLotLocation(NFinalizeDeath.Fast_SnapToFloor(ScriptCore.CameraController.Camera_GetTarget()), ref LotLocation);
            Lot         TargetLot   = LotManager.GetLot(Location);

            if (TargetLot == null)
            {
                return(LotManager.sActiveLot ?? LotManager.sWorldLot);
            }
            return(TargetLot);
        }
Пример #20
0
        public static PlaceResult PlaceFromGameBin(EditTownModel ths, UIBinInfo info, ulong lotId, PlaceAction action)
        {
            PlaceResult contentFailure = PlaceResult.ContentFailure;
            Lot         lot            = LotManager.GetLot(lotId);

            if (lot == null)
            {
                return(PlaceResult.InvalidLot);
            }
            else if (lot.Household != null)
            {
                return(PlaceResult.HouseholdPresent);
            }

            ths.GetInWorldHouseholdBinInfoList();
            contentFailure = PlaceResult.ContentFailure;
            if (info.HouseholdId != ulong.MaxValue)
            {
                BinCommon.KickSimsOffLot(lot, true);
                if (info.LotId != ulong.MaxValue)
                {
                    contentFailure = BinCommonEx.PlaceHouseholdAndContentsFromGameBin(info.ContentId, lot, action, Mover.GetLotCost);
                }
                else
                {
                    contentFailure = BinCommonEx.PlaceHouseholdFromGameBin(info.ContentId, lot, action, Mover.GetLotCost);
                }

                if (contentFailure != PlaceResult.Success)
                {
                    return(contentFailure);
                }

                ths.mGameBin.Remove(info);
                if (ths.GameBinChanged != null)
                {
                    ths.GameBinChanged(ths, null);
                }

                info = BinCommon.CreateInWorldBinInfo(lot.Household, lot);
                if (info != null)
                {
                    ths.mInWorldHouseholdBin.Add(info);
                }
            }
            return(contentFailure);
        }
Пример #21
0
        public void Cleanup()
        {
            mLookup = null;

            List <PrivacyRoom> remove = new List <PrivacyRoom>();

            foreach (PrivacyRoom obj in mPrivacy)
            {
                Lot lot = LotManager.GetLot(obj.mLot);
                if (lot == null)
                {
                    remove.Add(obj);
                }
                else if (!lot.IsWorldLot)
                {
                    bool found = false;
                    foreach (Sims3.Gameplay.Scenarios.IFloodWhenBroken roomObj in lot.GetObjects <Sims3.Gameplay.Scenarios.IFloodWhenBroken>())
                    {
                        if (roomObj.RoomId == obj.mRoom)
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        remove.Add(obj);
                    }
                }
            }

            foreach (PrivacyRoom obj in remove)
            {
                mPrivacy.Remove(obj);
            }
        }
Пример #22
0
        public static PlaceResult PlaceFromExportBin(EditTownModel ths, UIBinInfo info, ulong lotId, PlaceAction action, bool showConfirmDialog)
        {
            try
            {
                PlaceResult contentFailure = PlaceResult.ContentFailure;
                Lot         lot            = LotManager.GetLot(lotId);
                if (lot == null)
                {
                    return(PlaceResult.InvalidLot);
                }

                ExportBinContents exportBinItem = ths.FindExportBinContents(info.ContentId);
                if (exportBinItem != null)
                {
                    ths.GetInWorldHouseholdBinInfoList();
                    ths.GetInWorldLotBinInfoList();
                    Sim newActiveSim = null;
                    if (lot.Household != null)
                    {
                        return(BinCommonEx.MergeHouseholdFromExportBin(exportBinItem, lot, showConfirmDialog, Mover.Settings.mAllowGreaterThanEight));
                    }

                    BinCommon.KickSimsOffLot(lot, true);
                    ProgressDialog.Show(Localization.LocalizeString("Ui/Caption/Global:Processing", new object[0x0]));

                    try
                    {
                        try
                        {
                            contentFailure = BinCommonEx.PlaceFromExportBin(exportBinItem, lot, action, true, Mover.GetLotCost, ref newActiveSim);

                            ExportBinContentsEx.Flush(exportBinItem);

                            UIBinInfo item = BinCommon.CreateInWorldBinInfo(lot.Household, lot);
                            if (item != null)
                            {
                                if (info.HouseholdId != ulong.MaxValue)
                                {
                                    ths.mInWorldHouseholdBin.Add(item);
                                }
                                else
                                {
                                    ths.mInWorldLotBin.Add(item);
                                }
                            }
                        }
                        finally
                        {
                            ProgressDialog.Close();
                        }
                    }
                    catch (ExecutionEngineException)
                    { }
                }
                return(contentFailure);
            }
            catch (Exception e)
            {
                Common.Exception("PlaceFromExportBin", e);
                return(PlaceResult.ContentFailure);
            }
        }
Пример #23
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupMissingLotSavedData");

            foreach (Lot lot in LotManager.AllLots)
            {
                if (lot.mSavedData == null)
                {
                    Overwatch.Log(lot.Name + " Added SavedData");

                    lot.mSavedData = new Lot.SavedData();
                }

                if (lot.mSavedData.mReactions == null)
                {
                    Overwatch.Log(lot.Name + " Added Reactions");

                    lot.mSavedData.mReactions = new List <ReactionBroadcaster>();
                }

                if (lot.mSavedData.mBroadcastersWithSims == null)
                {
                    Overwatch.Log(lot.Name + " Added Broadcasters with sims");

                    lot.mSavedData.mBroadcastersWithSims = new List <ReactionBroadcaster>();
                }

                if (lot.mSavedData.mAlarmManager == null)
                {
                    Overwatch.Log(lot.Name + " Added AlarmManager");

                    lot.mSavedData.mAlarmManager = new AlarmManager(lot.LotId);
                }

                if (lot.mSavedData.mPuddleManager == null)
                {
                    Overwatch.Log(lot.Name + " Added PuddleManager");

                    lot.mSavedData.mPuddleManager = new PuddleManager();
                }

                if (lot.mSavedData.mFireManager == null)
                {
                    Overwatch.Log(lot.Name + " Added FireManager");

                    lot.mSavedData.mFireManager = new FireManager();
                }

                if (lot.mSavedData.mLaundryManager == null)
                {
                    Overwatch.Log(lot.Name + " Added LaundryManager");

                    lot.mSavedData.mLaundryManager = new LaundryManager();
                }

                if (lot.ResortManager != null)
                {
                    if (lot.ResortManager.mOwnerLot == null || LotManager.GetLot(lot.ResortManager.mOwnerLot.LotId) == null)
                    {
                        Overwatch.Log(lot.Name + " Fixed ResortManager");
                        lot.ResortManager.mOwnerLot = lot;
                    }
                }
            }
        }
Пример #24
0
        /*
         * DebugString: "_NFixUp(): if (ListCollon.NullSimSimDescription == this)"
         * DebugString: "NMScript Exception Log
         * System.Exception: no message
         *
         #0: 0x0001f throw      in Sims3.Gameplay.CAS.Sims3.Gameplay.CAS.SimDescription:Fixup () ()
         #1: 0x00050 callvirt   in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.RecoverMissingSims:PrivatePerformAction (bool) (9193E9C0 [0] )
         #2: 0x00011 callvirt   in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.AlarmOption:PerformAction (bool) (9193E9C0 [0] )
         #3: 0x00002 call       in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.AlarmOption:PerformAlarm () ()
         #4: 0x0001b callvirt   in NRaas.NRaas.Overwatch:OnTimer () ()
         #5: 0x00000            in Sims3.Gameplay.Sims3.Gameplay.Function:Invoke () ()
         #6: 0x00003 callvirt   in NRaas.Common+FunctionTask:Simulate () ()
         */
        public void _NFixUp()
        {
            if (runI)
            {
                return;
            }

            if (ListCollon.NullSimSimDescription == this)
            {
                if (niec_native_func.cache_done_niecmod_native_debug_text_to_debugger)
                {
                    niec_native_func.OutputDebugString("_NFixUp(): if (ListCollon.NullSimSimDescription == this)");
                    try
                    {
                        throw new Exception("no message");
                    }
                    catch (Exception ex)
                    {
                        NiecException.SendTextExceptionToDebugger(ex);
                    }
                }

                mIsValidDescription = false;
                NFinalizeDeath.SimDesc_NullToEmpty(this);
                mIsValidDescription = true;

                if (UnsafeFixNUllSimDESC)
                {
                    var p = NFinalizeDeath.GetSafeSelectActor();
                    if (p != null && p.SimDescription != null)
                    {
                        mOutfits = p.SimDescription.Outfits;
                    }
                    if (!waitrunningtask01)
                    {
                        waitrunningtask01 = true;
                        NiecTask.Perform(() =>
                        {
                            for (int i = 0; i < 800; i++)
                            {
                                Simulator.Sleep(0);
                            }
                            waitrunningtask01 = false;
                            NFinalizeDeath.SimDescCleanse(this, true, false);
                        });
                    }
                }
                else if (!waitrunningtask01)
                {
                    waitrunningtask01 = true;
                    NiecTask.Perform(() =>
                    {
                        for (int i = 0; i < 50; i++)
                        {
                            Simulator.Sleep(0);
                        }
                        waitrunningtask01 = false;
                        NFinalizeDeath.SimDescCleanse(this, true, true);
                    });
                }
                return;
            }

            mIsValidDescription = true;

            if (base.TraitManager != null)
            {
                base.TraitManager.SetSimDescription(this);
                base.TraitManager.Fixup();
            }

            if (CreatedSim != null && CreatedSim.Inventory != null)
            {
                foreach (TraitChip item in CreatedSim.Inventory.FindAll <TraitChip>(false))
                {
                    item.OnLoadFixup();
                    if (item.Owner == null)
                    {
                        item.SetOwner(this);
                    }
                }
            }

            MiniSimDescription miniSimDescription = MiniSimDescription.Find(SimDescriptionId);

            if ((GameStates.IsTravelling || GameStates.IsEditingOtherTown) && miniSimDescription != null)
            {
                base.CASGenealogy = miniSimDescription.Genealogy;
            }

            if (GameObjectRelationships != null)
            {
                int i = 0;
                while (i < GameObjectRelationships.Count)
                {
                    if (!Sims3.SimIFace.Objects.IsValid(GameObjectRelationships[i].GameObjectDescription.GameObject.ObjectId))
                    {
                        GameObjectRelationships.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }
            }

            if (mGenealogy == null)
            {
                mGenealogy = new Genealogy(this);
            }

            if (SkillManager == null)
            {
                SkillManager = new SkillManager(this);
            }
            else
            {
                SkillManager.OnLoadFixup();
            }

            if (CareerManager == null)
            {
                CareerManager = new CareerManager(this);
            }
            else
            {
                CareerManager.OnLoadFixup();
            }

            if (VisaManager == null)
            {
                VisaManager = new VisaManager(this);
            }
            else
            {
                VisaManager.OnLoadFixup();
            }

            if (CelebrityManager == null)
            {
                CelebrityManager = new CelebrityManager(SimDescriptionId);
            }
            else if (CelebrityManager.Owner == null)
            {
                CelebrityManager.ResetOwnerSimDescription(SimDescriptionId);
            }

            if (LifeEventManager == null || !LifeEventManager.IsValid)
            {
                LifeEventManager = new LifeEventManager(this);
            }

            LifeEventManager.ClearInvalidActiveNodes();

            if (OccultManager == null)
            {
                OccultManager = new OccultManager(this);
            }
            else
            {
                OccultManager.OnLoadFixup();
            }

            if (IsPet)
            {
                if (PetManager == null)
                {
                    PetManager = CreatePetManager();
                }
            }
            else if (PetManager != null)
            {
                PetManager.Dispose();
                PetManager = null;
            }

            if (IsEP11Bot)
            {
                if (TraitChipManager == null)
                {
                    TraitChipManager = new TraitChipManager(this);
                }
                else if (TraitChipManager.Owner == null)
                {
                    TraitChipManager.ResetOwnerSimDescription(SimDescriptionId);
                }
                TraitChipManager.OnLoadFixup();
            }
            else if (TraitChipManager != null)
            {
                TraitChipManager.Dispose();
                TraitChipManager = null;
            }

            AssignSchool();

            if (mSimDescriptionId == 0)
            {
                MakeUniqueId();
            }

            if (ReadBookDataList == null)
            {
                ReadBookDataList = new Dictionary <string, ReadBookData>();
            }

            PushAgingEnabledToAgingManager();

            if (mInitialShape.Owner == null || mCurrentShape.Owner == null || mInitialShape.Owner != this || mCurrentShape.Owner != this)
            {
                mInitialShape.Owner = (mCurrentShape.Owner = this);
            }

            if (OpportunityHistory == null)
            {
                OpportunityHistory = new OpportunityHistory();
            }

            if (Sims3.Gameplay.Gameflow.sGameLoadedFromWorldFile && !Household.IsTravelImport && !GameStates.IsIdTravelling(SimDescriptionId))
            {
                mDisplayedShape.Owner    = mCurrentShape.Owner;
                mDisplayedShape.Fit      = mCurrentShape.Fit;
                mDisplayedShape.Weight   = mCurrentShape.Weight;
                mDisplayedShape.Pregnant = mCurrentShape.Pregnant;
                ResetLifetimeHappinessStatistics();
                mHomeWorld = GameUtils.GetCurrentWorld();
            }

            if (mHomeWorld == WorldName.Undefined)
            {
                mHomeWorld = GameUtils.GetCurrentWorld();
            }

            if (RelicStats == null)
            {
                RelicStats = new RelicStatTracking(this);
            }

            RelicStats.SetSimDescription(this);

            if (TombStats == null)
            {
                TombStats = new TombStatTracking(this);
            }

            TombStats.SetSimDescription(this);

            if (Singing == null)
            {
                Singing = new SingingInfo(this);
            }

            Singing.SetSimDesctiption(this);

            if (AssignedRole != null)
            {
                AssignedRole.OnLoadFixUp();
            }

            Lot lot = LotManager.GetLot(mVirtualLotId);

            if (lot != null)
            {
                lot.VirtualMoveIn(this);
            }

            if (Species == CASAgeGenderFlags.None)
            {
                Species = CASAgeGenderFlags.Human;
            }

            if (!CASLogic.GetSingleton().IsMusicTypeInstalled(FavoriteMusic))
            {
                RandomizeFavoriteMusic();
            }

            if (GetCurrentOutfits() != null)
            {
                OutfitCategories[] array = new OutfitCategories[5]
                {
                    OutfitCategories.None,
                    OutfitCategories.All,
                    OutfitCategories.CategoryMask,
                    OutfitCategories.PrimaryCategories,
                    OutfitCategories.PrimaryHorseCategories
                };

                foreach (var outfitCategories in array)
                {
                    if (GetOutfitCount(outfitCategories) > 0)
                    {
                        RemoveOutfits(outfitCategories, false);
                        if (base.mMaternityOutfits != null)
                        {
                            base.mMaternityOutfits.Remove(outfitCategories);
                        }
                        if (base.mOutfits != null)
                        {
                            base.mOutfits.Remove(outfitCategories);
                        }
                    }
                }
            }

            if (!GameUtils.IsInstalled(ProductVersion.EP4))
            {
                Sim.PlayPretend.RemoveAllChildCostumeOutfits(this);

                if (CreatedSim != null && CreatedSim.CurrentOutfitCategory == OutfitCategories.ChildImagination)
                {
                    CreatedSim.SwitchToOutfitWithoutSpin(OutfitCategories.Everyday);
                }

                RemoveOutfits(OutfitCategories.ChildImagination, true);

                base.Outfits.Remove(OutfitCategories.ChildImagination);

                if (SpoiledGiftHistory != null)
                {
                    SpoiledGiftHistory.Clear();
                    SpoiledGiftHistory = null;
                }
            }

            if (CreatedSim != null && (OccultManager == null || !OccultManager.HasOccultType(OccultTypes.Vampire | OccultTypes.Genie | OccultTypes.Werewolf | OccultTypes.Ghost)) && mSkinToneKey.InstanceId == 15475186560318337848uL)
            {
                World.ObjectSetVisualOverride(CreatedSim.ObjectId, eVisualOverrideTypes.Genie, null);
            }
        }
Пример #25
0
        public static bool OnPick(GameObject ths, UIMouseEventArgs eventArgs, GameObjectHit gameObjectHit)
        {
            Sim activeActor = Sim.ActiveActor;

            try
            {
                if (!GameStates.IsPlayFlowState)
                {
                    if (GameStates.IsBuildBuyLikeState)
                    {
                        return(false);
                    }

                    bool isFemale = false;
                    if (activeActor != null)
                    {
                        isFemale = activeActor.IsFemale;
                    }

                    InteractionMenuTypes menuType = InteractionMenuTypes.Normal;

                    List <InteractionObjectPair> interactions = new List <InteractionObjectPair>();
                    if (((eventArgs.Modifiers & Modifiers.kModifierMaskShift) != Modifiers.kModifierMaskNone) && Cheats.sTestingCheatsEnabled)
                    {
                        interactions.AddRange(ths.GetAllCheatInteractionsForActor(activeActor));

                        if (Selector.Settings.mMoveInteractionsToShift)
                        {
                            foreach (InteractionObjectPair pair in ths.GetAllInteractionsForActor(activeActor))
                            {
                                if (IsImmediateInteraction(pair, isFemale))
                                {
                                    interactions.Add(pair);
                                }
                            }
                        }

                        menuType = InteractionMenuTypes.Debug;

                        GameObject.ValidateInteractionList(activeActor, interactions);
                    }
                    else if ((activeActor != null) && activeActor.InteractionQueue.CanPlayerQueue())
                    {
                        List <InteractionObjectPair> allInteractions = null;
                        if (ths.Charred)
                        {
                            allInteractions = ths.GetCharredInteractions(activeActor);
                        }
                        else
                        {
                            allInteractions = ths.GetAllInteractionsForActor(activeActor);
                        }

                        if (Selector.Settings.mMoveInteractionsToShift)
                        {
                            foreach (InteractionObjectPair pair in allInteractions)
                            {
                                if (!IsImmediateInteraction(pair, isFemale))
                                {
                                    interactions.Add(pair);
                                }
                            }
                        }
                        else
                        {
                            interactions = allInteractions;
                        }

                        GameObject.ValidateInteractionList(activeActor, interactions);

                        Lot targetObject = LotManager.GetLot(gameObjectHit.mId);
                        if (ths.IsOnDivingFloor && ((activeActor.Level != ths.Level) || (activeActor.LotCurrent != ths.LotCurrent)))
                        {
                            interactions.Add(new InteractionObjectPair(ProxyGoToTargetsLotAndScubaDive.Singleton, ths.LotCurrent));
                        }
                        else if ((((targetObject != null) && targetObject.IsDivingLot) && (gameObjectHit.mType == GameObjectHitType.LotTerrain)) && ((activeActor.Level != 0) || (activeActor.LotCurrent != targetObject)))
                        {
                            interactions.Add(new InteractionObjectPair(ProxyGoToTargetsLotAndScubaDive.Singleton, targetObject));
                        }
                    }
                    else if ((activeActor != null) && !activeActor.InteractionQueue.CanPlayerQueue())
                    {
                        Sims3.Gameplay.UI.PieMenu.ShowGreyedOutTooltip(Localization.LocalizeString("Gameplay/Abstracts/GameObject:TooManyInteractions", new object[0x0]), eventArgs.MousePosition);
                        return(true);
                    }
                    else
                    {
                        if (Selector.Settings.mShowNoInteractions)
                        {
                            Sims3.Gameplay.UI.PieMenu.ShowGreyedOutTooltip(Localization.LocalizeString("Gameplay/Abstracts/GameObject:NoInteractions", new object[0x0]), eventArgs.MousePosition);
                        }
                        return(true);
                    }

                    if (!TestInteractions(activeActor, gameObjectHit, interactions))
                    {
                        if (!Selector.Settings.mShowNoInteractions)
                        {
                            return(true);
                        }
                    }

                    bool success = false;

                    try
                    {
                        Sims3.Gameplay.UI.PieMenu.TestAndBringUpPieMenu(ths, eventArgs, gameObjectHit, interactions, menuType);
                        success = true;
                    }
                    catch (Exception e)
                    {
                        Common.Exception(activeActor, ths, e);
                    }

                    if (!success)
                    {
                        List <InteractionObjectPair> immediateInteractions = new List <InteractionObjectPair>();

                        foreach (InteractionObjectPair interaction in interactions)
                        {
                            if (interaction.InteractionDefinition is IImmediateInteractionDefinition)
                            {
                                immediateInteractions.Add(interaction);
                            }
                        }

                        immediateInteractions = ths.BuildInteractions(activeActor, immediateInteractions);

                        Sims3.Gameplay.UI.PieMenu.TestAndBringUpPieMenu(ths, eventArgs, gameObjectHit, immediateInteractions, menuType);
                    }

                    return(true);
                }
            }
            catch (Exception e)
            {
                Common.Exception(activeActor, ths, e);
            }

            return(false);
        }
Пример #26
0
        public static Lot PromptForLot()
        {
            Lot baseCampLot = LotManager.GetBaseCampLot();

            if (!UIUtils.IsOkayToStartModalDialog(false, true))
            {
                return(null);
            }

            List <IMapTagPickerInfo> mapTagPickerInfos = new List <IMapTagPickerInfo>();

            mapTagPickerInfos.Add(new MapTagPickerLotInfo(baseCampLot, MapTagType.BaseCamp));
            Dictionary <ulong, bool> dictionary = new Dictionary <ulong, bool>();

            foreach (Lot lot in LotManager.AllLots)
            {
                if (!lot.IsResidentialLot)
                {
                    continue;
                }

                if (lot.IsWorldLot)
                {
                    continue;
                }

                if (lot.Household != null)
                {
                    continue;
                }

                if (lot.ResidentialLotSubType == ResidentialLotSubType.kEP1_PlayerOwnable)
                {
                    continue;
                }

                Lot.LotMetrics metrics = new Lot.LotMetrics();
                lot.GetLotMetrics(ref metrics);
                if (metrics.FridgeCount == 0)
                {
                    continue;
                }

                if ((lot != null) && !dictionary.ContainsKey(lot.LotId))
                {
                    dictionary[lot.LotId] = true;
                    mapTagPickerInfos.Add(new MapTagPickerLotInfo(lot, MapTagType.AvailableHousehold));
                }
            }

            GameUtils.EnableSceneDraw(true);
            LoadingScreenController.Unload();
            while (LoadingScreenController.Instance != null)
            {
                SpeedTrap.Sleep(0);
            }

            IMapTagPickerInfo info = MapTagPickerDialog.Show(mapTagPickerInfos, TravelUtil.LocalizeString("ChooseHomeLot", new object[0]), TravelUtil.LocalizeString("Accept", new object[0]), false);

            if (info == null)
            {
                return(null);
            }

            return(LotManager.GetLot(info.LotId));
        }
Пример #27
0
        public static bool ChangeLotType(ulong lotId, bool deleteInvalidObjects, LotType newType, CommercialLotSubType commercialSubType, ResidentialLotSubType residentialSubType)
        {
            EditTownModel ths = EditTownController.Instance.mModel as EditTownModel;

            Lot lot = LotManager.GetLot(lotId);

            if (lot == null)
            {
                return(false);
            }
            if (newType == LotType.Residential)
            {
                commercialSubType = CommercialLotSubType.kCommercialUndefined;
            }
            else
            {
                residentialSubType = ResidentialLotSubType.kResidentialUndefined;
            }

            if ((newType != LotType.Residential) && (commercialSubType == CommercialLotSubType.kCommercialUndefined))
            {
                return(false);
            }

            if (!ChangeLotTypeHelper(lot, deleteInvalidObjects, newType, commercialSubType, residentialSubType))
            {
                return(false);
            }

            ths.GetInWorldCommunityLotBinInfoList();
            ths.GetInWorldLotBinInfoList();
            lot.LotType = newType;
            lot.CommercialLotSubType  = commercialSubType;
            lot.ResidentialLotSubType = residentialSubType;
            if (lot.IsCommunityLot)
            {
                UIBinInfo item  = ths.FindLotBinInfo(lotId);
                bool      flag2 = true;
                if (item == null)
                {
                    flag2 = false;
                    item  = ths.FindCommunityLotBinInfo(lotId);
                }
                if (item != null)
                {
                    item.LotTypeFilter         = 0x8;
                    item.LotType               = newType;
                    item.CommercialLotSubType  = commercialSubType;
                    item.ResidentialLotSubType = residentialSubType;
                    if (flag2)
                    {
                        ths.mInWorldLotBin.Remove(item);
                        ths.mInWorldCommunityLotBin.Add(item);
                    }
                }
            }
            else
            {
                UIBinInfo info2 = ths.FindCommunityLotBinInfo(lotId);
                bool      flag3 = true;
                if (info2 == null)
                {
                    flag3 = false;
                    info2 = ths.FindLotBinInfo(lotId);
                }
                if (info2 != null)
                {
                    if (World.LotIsEmpty(lotId) && lot.IsLotEmptyFromObjects())
                    {
                        info2.LotTypeFilter = 0x2;
                    }
                    else
                    {
                        info2.LotTypeFilter = 0x4;
                    }
                    info2.LotType = newType;
                    info2.CommercialLotSubType  = commercialSubType;
                    info2.ResidentialLotSubType = residentialSubType;
                    if (flag3)
                    {
                        ths.mInWorldCommunityLotBin.Remove(info2);
                        ths.mInWorldLotBin.Add(info2);
                    }
                }
            }

            SpeedTrap.Sleep();
            lot.EnsureLotObjects();

            try
            {
                Sims3.Gameplay.Services.Services.ClearServicesForLot(lot);
            }
            catch (Exception e)
            {
                Common.Exception(lot, e);
            }

            Occupation.ValidateJobConsistencyWithLotType(lot);
            lot.UpdateCachedValues();
            return(true);
        }
Пример #28
0
            public void ReturnChildren()
            {
                Lot lot = LotManager.GetLot(mLot);

                if (lot.Household == null)
                {
                    return;
                }

                foreach (KeyValuePair <ulong, DateAndTime> pair in mOfflotChildren)
                {
                    SimDescription simDesc = lot.Household.FindMember(pair.Key);
                    if (simDesc == null)
                    {
                        continue;
                    }

                    try
                    {
                        DaycareWorkdaySituation situation = null;

                        foreach (Situation sit in Situation.sAllSituations)
                        {
                            situation = sit as DaycareWorkdaySituation;
                            if (situation == null)
                            {
                                continue;
                            }

                            if (situation.mChildMonitors.ContainsKey(pair.Key))
                            {
                                break;
                            }

                            situation = null;
                        }

                        if (situation != null)
                        {
                            Daycare career = situation.Daycare;
                            if (career != null)
                            {
                                DateAndTime duration = SimClock.CurrentTime() - pair.Value;

                                float hours = SimClock.ConvertFromTicks(duration.Ticks, TimeUnit.Hours);

                                float careerLength = (career.FinishTime - career.StartTime);

                                float ratio = hours / careerLength;

                                string debuggingLog;

                                float xp = 0;

                                DaycareWorkdaySituation priorSituation = career.mDaycareSituation;
                                try
                                {
                                    if (career.mDaycareSituation == null)
                                    {
                                        career.mDaycareSituation = situation;
                                    }

                                    xp = career.GetExperience(pair.Key, Rating.Neutral, out debuggingLog);
                                }
                                finally
                                {
                                    career.mDaycareSituation = priorSituation;
                                }

                                xp *= ratio;

                                career.UpdateXp(xp);

                                int amount = career.GetMoney(pair.Key, Rating.Neutral, out debuggingLog);

                                amount = (int)(amount * ratio);

                                career.PayOwnerSim(amount, GotPaidEvent.PayType.kCareerBonus);

                                if (simDesc.Household != null)
                                {
                                    simDesc.ModifyFunds(-amount);
                                }
                            }

                            if ((situation.mChildMonitors != null) && (situation.mChildMonitors.Count == 1) && (situation.mChildMonitors.ContainsKey(simDesc.SimDescriptionId)))
                            {
                                for (int i = situation.mSimDescIds.Count - 1; i >= 0; i--)
                                {
                                    if (!situation.mChildMonitors.ContainsKey(situation.mSimDescIds[i]))
                                    {
                                        situation.mSimDescIds.RemoveAt(i);
                                    }
                                }
                            }

                            DaycareWorkdaySituation.ScoringRecord oldRecord;
                            if (!situation.ScoringRecords.TryGetValue(simDesc.SimDescriptionId, out oldRecord))
                            {
                                oldRecord = null;
                            }

                            // ScoringRecord will be added by RemovePerson() so remove it now
                            situation.ScoringRecords.Remove(simDesc.SimDescriptionId);

                            situation.RemovePerson(simDesc.CreatedSim);

                            if (oldRecord != null)
                            {
                                DaycareWorkdaySituation.ScoringRecord newRecord;
                                if (situation.ScoringRecords.TryGetValue(simDesc.SimDescriptionId, out newRecord))
                                {
                                    newRecord.Score            += oldRecord.Score;
                                    newRecord.ScoreDebugString += Common.NewLine + oldRecord.ScoreDebugString;
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(simDesc, e);
                    }

                    Common.DebugNotify("Remove:" + Common.NewLine + simDesc.FullName);

                    if (simDesc.CreatedSim != null)
                    {
                        simDesc.CreatedSim.InteractionQueue.CancelAllInteractions();

                        /*
                         * while (simDesc.CreatedSim.InteractionQueue.GetCurrentInteraction() != null)
                         * {
                         *  Common.Sleep(5);
                         * }
                         */

                        GoHereEx.Teleport.Perform(simDesc.CreatedSim, simDesc.LotHome, false);
                    }
                }

                mOfflotChildren.Clear();

                GoHere.Settings.mCaregivers.Remove(mLot);
            }
Пример #29
0
        public static bool CanSkinnyDipAtLocation(Sim a, Vector3 position, ref GreyedOutTooltipCallback greyedOutTooltipCallback, bool okIfNoExistingSkinnyDippers, bool okIfAloneAndRomantic)
        {
            if (!GameUtils.IsInstalled(ProductVersion.EP3))
            {
                return(false);
            }

            if (a.Posture is CarryingChildPosture)
            {
                return(false);
            }
            if (a.HasTrait(TraitNames.NeverNude) || a.HasTrait(TraitNames.Shy))
            {
                return(false);
            }

            if (Woohooer.Settings.mAllowTeenSkinnyDip)
            {
                if (a.SimDescription.ChildOrBelow)
                {
                    return(false);
                }
            }
            else
            {
                if (a.SimDescription.TeenOrBelow)
                {
                    return(false);
                }
            }

            /*
             * if (a.SimDescription.IsVisuallyPregnant)
             * {
             *  greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Common.LocalizeEAString(a.IsFemale, "Gameplay/Actors/Sim:PregnantFailure", new object[0x0]));
             *
             *  return false;
             * }
             */
            if (!Pool.SimOutfitSupportsSkinnyDipping(a, ref greyedOutTooltipCallback))
            {
                return(false);
            }

            bool        flag        = okIfNoExistingSkinnyDippers;
            bool        notRomantic = false;
            bool        result      = false;
            bool        kidsAround  = false;
            LotLocation location    = new LotLocation();
            ulong       lotLocation = World.GetLotLocation(position, ref location);
            bool        outside     = World.IsPositionOutside(position);
            short       mRoom       = location.mRoom;

            List <Sim> lotSims = new List <Sim>();

            if (Woohooer.Settings.mEnforceSkinnyDipPrivacy)
            {
                Lot lot = LotManager.GetLot(lotLocation);
                if ((lot != null) && (!lot.IsWorldLot))
                {
                    lotSims = new List <Sim>(lot.GetSims());
                    if (outside)
                    {
                        List <Sim> list2 = new List <Sim>(Sims3.Gameplay.Queries.GetObjects <Sim>(position, Pool.kRadiusToCheckForKids));
                        foreach (Sim sim in list2)
                        {
                            if (sim.LotCurrent == null)
                            {
                                continue;
                            }

                            if (sim.LotCurrent.LotId != lotLocation)
                            {
                                lotSims.Add(sim);
                            }
                        }
                    }
                }
            }

            foreach (Sim sim2 in lotSims)
            {
                if (sim2 == a)
                {
                    continue;
                }

                if (sim2.SimDescription.ToddlerOrBelow)
                {
                    continue;
                }

                bool checkAge = false;
                if (Woohooer.Settings.mAllowTeenSkinnyDip)
                {
                    if (sim2.SimDescription.ChildOrBelow)
                    {
                        checkAge = true;
                    }
                }
                else
                {
                    if (sim2.SimDescription.TeenOrBelow)
                    {
                        checkAge = true;
                    }
                }

                if (checkAge)
                {
                    if (sim2.LotCurrent == null)
                    {
                        continue;
                    }

                    if (sim2.LotCurrent.LotId == lotLocation)
                    {
                        kidsAround = true;
                    }
                    else if (outside && sim2.IsOutside)
                    {
                        kidsAround = true;
                    }
                    continue;
                }

                if (sim2.IsSkinnyDipping())
                {
                    flag = true;
                }

                if (okIfAloneAndRomantic && (sim2.RoomId == mRoom))
                {
                    notRomantic = notRomantic || !sim2.IsInRomanticRelationshipWith(a);
                }
            }

            if (flag)
            {
                result = true;
            }

            if ((a.HasTrait(TraitNames.Daredevil) || a.HasTrait(TraitNames.PartyAnimal)) || a.HasTrait(TraitNames.Inappropriate))
            {
                result = true;
            }

            if (okIfAloneAndRomantic && !notRomantic)
            {
                result = true;
            }

            float hoursPassedOfDay = SimClock.HoursPassedOfDay;

            if ((hoursPassedOfDay <= (World.GetSunriseTime() + Pool.kTimeOffsetFromSunriseWhenCanGoSkinnyDip)) || (hoursPassedOfDay >= (World.GetSunsetTime() + Pool.kTimeOffsetFromSunsetWhenCanGoSkinnyDip)))
            {
                result = true;
            }

            if (result && kidsAround)
            {
                greyedOutTooltipCallback = new GrayedOutTooltipHelper(a.IsFemale, "KidsAroundTooltip", null).GetTooltip;
                return(false);
            }

            return(result);
        }
Пример #30
0
        public override bool Run()
        {
            string msg = "Run";

            checked
            {
                try
                {
                    if (AcceptCancelDialog.Show("Force Select Actor?"))
                    {
                        msg = "Accept";
                        var         definition   = base.InteractionDefinition as Definition;
                        LotLocation lotLocation  = default(LotLocation);
                        ulong       lotLocation2 = World.GetLotLocation(this.Hit.mPoint, ref lotLocation);
                        Lot         lot          = LotManager.GetLot(lotLocation2);
                        if ((definition.Age & (CASAgeGenderFlags.Baby | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Child)) != CASAgeGenderFlags.None)
                        {
                            bool flag = false;
                            if (lot != null && lot.Household != null)
                            {
                                foreach (SimDescription simDescription in lot.Household.SimDescriptions)
                                {
                                    if (simDescription.TeenOrAbove)
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                            }
                            if (!flag)
                            {
                                if (AssemblyCheckByNiec.IsInstalled("DGSCore") && TwoButtonDialog.Show("DGSCore" + NiecMod.Nra.NiecException.NewLine + "Found Childern Sims in Household Without Adult" + NiecMod.Nra.NiecException.NewLine + "Note: Social Worker Catch Remove Sims" + NiecMod.Nra.NiecException.NewLine + "Are you sure?!", "Yea It Create " + definition.Age, "No Create YoungAdult"))
                                {
                                    msg = "Accept if not flag";
                                    Sim simnocheck = DGSMakeRandomSimNoCheck(Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                                    if (simnocheck != null)
                                    {
                                        if (simnocheck.IsSelectable)
                                        {
                                            PlumbBob.SelectActor(simnocheck);
                                        }
                                        else
                                        {
                                            simnocheck.SimDescription.IsNeverSelectable = false;
                                            PlumbBob.ForceSelectActor(simnocheck);
                                        }
                                        try
                                        {
                                            GlobalFunctions.PlaceAtGoodLocation(simnocheck, new World.FindGoodLocationParams(Hit.mPoint), false);
                                            if (simnocheck.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                            {
                                                simnocheck.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                                simnocheck.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                            }
                                        }
                                        catch
                                        { }

                                        try
                                        {
                                            if (simnocheck.SimDescription.Household.mName == null)
                                            {
                                                simnocheck.SimDescription.Household.SetName(simnocheck.SimDescription.LastName);
                                            }
                                        }
                                        catch (Exception ex2)
                                        {
                                            NiecMod.Nra.NiecException.WriteLog(msg + " SetName: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex2), true, true);
                                        }
                                    }
                                    else
                                    {
                                        //return false;
                                        msg = "MakeSim Failed! if flag";
                                        goto backif;
                                    }
                                    return(true);
                                }
backif:
                                Sim sim = DGSMakeRandomSim(this.Hit.mPoint, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, definition.WorldName);
                                msg     = "Terraininstance";
                                if (sim != null)
                                {
                                    Sitoat    = true;
                                    mSima     = sim;
                                    mSimaStat = sim.SimDescription;
                                    sim.FadeOut();
                                    var terraininstance = new Terrain.TeleportMeHere.Definition(false).CreateInstance(Terrain.Singleton, sim, new InteractionPriority((InteractionPriorityLevel)8195), base.Autonomous, base.CancellableByPlayer) as TerrainInteraction;

                                    try
                                    {
                                        if (sim.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                        {
                                            sim.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                            sim.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                        }
                                    }
                                    catch
                                    { }

                                    if (terraininstance != null)
                                    {
                                        terraininstance.Hidden  = true;
                                        terraininstance.MustRun = true;
                                        //Vector3 vector2;
                                        Lot loty = sim.SimDescription.LotHome;
                                        if (loty == null)
                                        {
                                            loty = sim.SimDescription.VirtualLotHome;
                                        }
                                        //World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(Helper.Create.GetPositionInRandomLot(loty));

                                        /*
                                         * fglParams.BooleanConstraints |= FindGoodLocationBooleans.StayInRoom;
                                         * fglParams.InitialSearchDirection = RandomUtil.GetInt(0x0, 0x7);
                                         */
                                        //lot.Household.Add(sim.SimDescription);
                                        terraininstance.Destination = Helpers.Create.GetPositionInRandomLot(loty);
                                        sim.InteractionQueue.Add(terraininstance);
                                    }
                                }
                                else
                                {
                                    return(false);
                                }
                                try
                                {
                                    //sim.SimDescription.Household.SetName(/* "E3Lesa is Good" */ "Good Household");
                                    sim.SimDescription.Household.SetName(sim.SimDescription.LastName);
                                }
                                catch (Exception ex2)
                                {
                                    NiecMod.Nra.NiecException.WriteLog(msg + " SetName: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex2), true, true);
                                }
                            }
                        }

                        //lot.MoveIn(lot.Household);
                        //FixFoxNonStaticDGSMakeRandomSim = true;
                        Sim sim2 = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                        if (sim2 != null)
                        {
                            PlumbBob.ForceSelectActor(sim2);
                            if (mSima != null && Sitoat)
                            {
                                var followchildsim = Sims3.Gameplay.Actors.Sim.FollowParent.Singleton.CreateInstance(sim2, mSima, new InteractionPriority((InteractionPriorityLevel)8195), base.Autonomous, base.CancellableByPlayer) as Sims3.Gameplay.Actors.Sim.FollowParent;
                                followchildsim.Hidden  = true;
                                followchildsim.MustRun = true;
                                if (mSima.InteractionQueue.AddNextIfPossibleAfterCheckingForDuplicates(followchildsim))
                                {
                                    Sim.ForceSocial(mSima, sim2, "Chat", (InteractionPriorityLevel)8195, true);
                                }

                                //sim2.SimDescription.TraitManager.RemoveAllElements();
                                try
                                {
                                    if (sim2.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                    {
                                        sim2.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                        sim2.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                    }
                                }
                                catch
                                { }
                            }
                        }
                    }



                    else
                    {
                        msg = "Cancel";
                        var definition = base.InteractionDefinition as Definition;
                        Sim sim3       = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                        if (sim3 == null)
                        {
                            msg = "Sim3 is Null";
                            Sim sim4 = DGSMakeRandomSim(this.Hit.mPoint, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, definition.WorldName);
                            if (sim4 != null)
                            {
                                msg = "Sim4 is Keep";


                                if (!sim4.IsInActiveHousehold)
                                {
                                    try
                                    {
                                        if (sim4.SimDescription.Household.NameUnlocalized == "Good Household")
                                        {
                                            sim4.SimDescription.Household.SetName("Evil Household");
                                        }
                                        else
                                        {
                                            sim4.SimDescription.Household.SetName(sim4.LastName);
                                        }
                                        sim4.SimDescription.TraitManager.RemoveAllElements();
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Daredevil);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Adventurous);
                                    }
                                    catch
                                    { }
                                }
                                else
                                {
                                    try
                                    {
                                        if (sim4.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                        {
                                            sim4.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                            sim4.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                        }
                                    }
                                    catch
                                    { }

                                    if (sim4.SimDescription.Household.NameUnlocalized == "Evil Household")
                                    {
                                        sim4.SimDescription.Household.SetName("Good Household");
                                    }
                                    else
                                    {
                                        sim4.SimDescription.Household.SetName(sim4.LastName);
                                    }
                                }



                                Sim sim5 = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                                if (sim5 != null)
                                {
                                    msg = "Sim5 is Keep";
                                    GlobalFunctions.PlaceAtGoodLocation(sim5, new World.FindGoodLocationParams(Hit.mPoint), false);

                                    if (!sim5.IsInActiveHousehold)
                                    {
                                        try
                                        {
                                            if (sim5.SimDescription.Household.NameUnlocalized == "Good Household")
                                            {
                                                sim5.SimDescription.Household.SetName("Evil Household");
                                            }
                                            else
                                            {
                                                sim5.SimDescription.Household.SetName(sim5.LastName);
                                            }
                                            if (definition.Gender == CASAgeGenderFlags.Child)
                                            {
                                                sim5.SimDescription.TraitManager.RemoveAllElements();
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                            }
                                            else
                                            {
                                                sim5.SimDescription.TraitManager.RemoveAllElements();
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Daredevil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Adventurous);
                                            }
                                        }
                                        catch
                                        { }
                                    }
                                    else
                                    {
                                        try
                                        {
                                            if (sim5.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                            {
                                                sim5.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                            }
                                        }
                                        catch
                                        { }


                                        if (sim5.SimDescription.Household.NameUnlocalized == "Evil Household")
                                        {
                                            sim5.SimDescription.Household.SetName("Good Household");
                                        }
                                        else
                                        {
                                            sim5.SimDescription.Household.SetName(sim5.LastName);
                                        }
                                    }
                                }
                                else
                                {
                                    return(false);
                                }
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (!sim3.IsInActiveHousehold)
                            {
                                try
                                {
                                    if (sim3.SimDescription.Household.NameUnlocalized == "Good Household")
                                    {
                                        sim3.SimDescription.Household.SetName("Evil Household");
                                    }

                                    else
                                    {
                                        sim3.SimDescription.Household.SetName(sim3.LastName);
                                    }

                                    if (definition.Gender == CASAgeGenderFlags.Child)
                                    {
                                        sim3.SimDescription.TraitManager.RemoveAllElements();
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                    }
                                    else
                                    {
                                        sim3.SimDescription.TraitManager.RemoveAllElements();
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Daredevil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Adventurous);
                                    }
                                }
                                catch
                                { }
                            }
                            else
                            {
                                try
                                {
                                    if (sim3.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                    {
                                        sim3.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                    }
                                }
                                catch
                                { }


                                if (sim3.SimDescription.Household.NameUnlocalized == "Evil Household")
                                {
                                    sim3.SimDescription.Household.SetName("Good Household");
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    NiecMod.Nra.NiecException.WriteLog(msg + " DGSMakeSim: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex), true, true);
                    return(false);
                }
            }

            return(true);
        }