コード例 #1
0
            public override bool Perform(SimDescription me, bool applyAll)
            {
                SimDescription head = SimTypes.HeadOfFamily(me.Household);

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

                BoardingSchool.SchedulePickUp(head.CreatedSim, me.CreatedSim, mSchool.SchoolType);
                return(true);
            }
コード例 #2
0
        private static void ConsiderGeneratingPhoneCall()
        {
            Phone.RandomCallType weightedIndex = (Phone.RandomCallType)RandomUtil.GetWeightedIndex(new float[] { Phone.kChanceForNoCall, Phone.kChanceForRandomChat, Phone.kChanceForRandomInviteOver });
            switch (weightedIndex)
            {
            case Phone.RandomCallType.kChat:
                Sim            sim;
                SimDescription description;
                if (!RandomUtil.RandomChance01(Phone.kChanceForBoardingSchoolCallWhenChatting) || !FindCallParticipants(-100f, out sim, out description, Phone.RandomCallType.kBoardingSchool))
                {
                    if (RandomUtil.RandomChance01(Phone.kChanceToSuggestBachelorPartyWhenChatting) && FindCallParticipants(Phone.kLTRThresholdForSimToBeCalledChatMin, out sim, out description, Phone.RandomCallType.kSuggestBachelorParty))
                    {
                        PhoneService.PlaceCall(new BachelorParty.PhoneCallSuggestBachelorParty(sim, description), Phone.kRandomCallTimeout);
                    }
                    else if (RandomUtil.RandomChance01(Phone.kChanceToAskToPromWhenChatting) && FindCallParticipants(Phone.kLTRThresholdForSimToBeCalledChatMin, out sim, out description, Phone.RandomCallType.kAskToProm))
                    {
                        PhoneService.PlaceCall(new PromSituation.PhoneCallAskToProm(sim, description), Phone.kRandomCallTimeout);
                    }
                    else if (FindCallParticipants(Phone.kLTRThresholdForSimToBeCalledChatMin, out sim, out description, weightedIndex))
                    {
                        PhoneService.PlaceCall(new Phone.RandomChatCall(sim, description), Phone.kRandomCallTimeout);
                    }
                    break;
                }
                BoardingSchool.PlaceBoardingSchoolPhoneCall(sim, description, Phone.kRandomCallTimeout);
                break;

            case Phone.RandomCallType.kInviteOver:
                Sim            sim2;
                SimDescription description2;
                if (FindCallParticipants(Phone.kLTRThresholdForSimToBeInvitedOverMin, out sim2, out description2, weightedIndex))
                {
                    PhoneService.PlaceCall(new Phone.RandomInvitationCall(sim2, description2), Phone.kRandomCallTimeout);
                }
                break;
            }

            ScheduleNextCall(Phone.kMinimumCallInterval);
        }
コード例 #3
0
        private static bool FindCallParticipants(float minLtr, out Sim callee, out SimDescription caller, Phone.RandomCallType callType)
        {
            callee = null;
            caller = null;
            if ((Sim.ActiveActor != null) && (Sim.ActiveActor.Household != null))
            {
                List <Phone.CallCandidate> randomList = new List <Phone.CallCandidate>();
                foreach (Sim sim in Sim.ActiveActor.Household.Sims)
                {
                    SimDescription simDescription = sim.SimDescription;
                    foreach (object obj2 in Phone.Call.GetAppropriateCallers(sim, minLtr, callType == Phone.RandomCallType.kBoardingSchool))
                    {
                        int            num;
                        float          num2;
                        SimDescription description2 = (SimDescription)obj2;
                        if ((Phone.Call.IsSimAvailableForCall(description2, out num, out num2) == Phone.Call.SimAvailability.Available) && (((callType != Phone.RandomCallType.kInviteOver) || (description2.CreatedSim == null)) || description2.CreatedSim.IsAtHome))
                        {
                            float weight = 0f;
                            bool  flag   = false;
                            switch (callType)
                            {
                            case Phone.RandomCallType.kSuggestBachelorParty:
                                flag = BachelorParty.IsAvailableToHaveBachelorPartySuggested(sim);
                                if (flag)
                                {
                                    weight = BachelorParty.GetWeightToPlaceSuggestBachelorPartyCall(simDescription, description2);
                                }
                                break;

                            case Phone.RandomCallType.kAskToProm:
                                if ((PromSituation.IsGoingToProm(sim) && !PromSituation.HasPromDate(sim)) && !PromSituation.HasPromDate(description2))
                                {
                                    // Custom
                                    string reason;
                                    if (CommonSocials.CanGetRomantic(sim.SimDescription, description2, out reason))
                                    {
                                        weight = RomanceVisibilityState.GetWeightToPlaceCallOrInviteOver(simDescription, description2);
                                        flag   = true;
                                    }
                                }
                                break;

                            case Phone.RandomCallType.kBoardingSchool:
                                if (description2.IsEnrolledInBoardingSchool())
                                {
                                    weight = BoardingSchool.GetWeightToPlaceBoardingSchoolCall(simDescription, description2);
                                    flag   = true;
                                }
                                break;

                            default:
                                weight = RomanceVisibilityState.GetWeightToPlaceCallOrInviteOver(simDescription, description2);
                                flag   = true;
                                break;
                            }

                            if (flag)
                            {
                                randomList.Add(new Phone.CallCandidate(sim, description2, weight));
                            }
                        }
                    }
                }
                if (randomList.Count > 0x0)
                {
                    Phone.CallCandidate weightedRandomObjectFromList = RandomUtil.GetWeightedRandomObjectFromList(randomList);
                    callee = weightedRandomObjectFromList.Callee;
                    caller = weightedRandomObjectFromList.Caller;
                    return(true);
                }
            }
            return(false);
        }
コード例 #4
0
        // Token: 0x06006FBE RID: 28606 RVA: 0x0026D010 File Offset: 0x0026C010
        public void FinalizeDeath()
        {
            this.MakeHouseholdHorsesGoHome();
            if (this.Target.SimDescription.IsEnrolledInBoardingSchool())
            {
                this.Target.SimDescription.BoardingSchool.OnRemovedFromSchool();
            }
            Urnstone.FinalizeSimDeath(this.Target.SimDescription, this.Target.Household, this.mSituation.PetSavior == null);
            int minuteOfDeath = (int)Math.Floor((double)SimClock.ConvertFromTicks(SimClock.CurrentTime().Ticks, TimeUnit.Minutes)) % 60;

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

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

            if (singleton != null && singleton.IsActorUsingMe(this.Target))
            {
                singleton.RemoveFromUseList(this.Target);
                this.Target.Posture = null;
            }
        }