Example #1
0
        protected override bool AllowHouse(Household house)
        {
            if (ManagerCareer.HasSkillCareer(Sim, SkillNames.Handiness))
            {
                return(true);
            }

            if (ManagerCareer.HasSkillCareer(Household.ActiveHousehold, SkillNames.Handiness))
            {
                return(false);
            }

            bool succcess = false;

            foreach (SimDescription sim in HouseholdsEx.All(house))
            {
                if (ManagerFriendship.AreEnemies(sim, Sim, -25))
                {
                    return(false);
                }

                if (ManagerFriendship.AreFriends(sim, Sim, 25))
                {
                    succcess = true;
                }
            }

            return(succcess);
        }
Example #2
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            CelebrityDisgracefulActionStaticData data;

            DisgracefulActionType disgracefulActionType = Event.DisgracefulActionType;

            if (!CelebrityUtil.sCelebrityDisgracefulActionData.TryGetValue(disgracefulActionType, out data))
            {
                IncStat("No Disgrace Data");
                return(false);
            }

            if (data.DisgracedOrigin != Origin.FromFalselyAccused)
            {
                if (HasValue <DisallowByTypeOption, DisgracefulActionType>(Event.DisgracefulActionType))
                {
                    IncStat("User Disallow");
                    return(false);
                }

                switch (Event.DisgracefulActionType)
                {
                case DisgracefulActionType.Cheating:
                case DisgracefulActionType.ChildOutOfMarriage:
                case DisgracefulActionType.Divorce:
                case DisgracefulActionType.WooHooInPublic:
                case DisgracefulActionType.WooHooWithOccult:
                    if (Sim.HasTrait(TraitNames.AboveReproach))
                    {
                        IncStat("Above Reproach");
                        return(false);
                    }
                    break;
                }
                ;

                switch (Event.DisgracefulActionType)
                {
                case DisgracefulActionType.Arrested:
                case DisgracefulActionType.CaughtSneakingIntoClub:
                case DisgracefulActionType.Divorce:
                case DisgracefulActionType.ChildTaken:
                case DisgracefulActionType.ChildOutOfMarriage:
                case DisgracefulActionType.JobSetback:
                    // No witness necessary
                    break;

                default:
                    if ((mWitnesses == null) || (mWitnesses.Count == 0))
                    {
                        IncStat("No Witnesses");
                        return(false);
                    }

                    SimDescription otherNaughty = ManagerSim.Find(Event.TargetId);

                    bool valid = false;
                    foreach (SimDescription witness in mWitnesses)
                    {
                        if (witness == Sim)
                        {
                            continue;
                        }

                        if (witness == otherNaughty)
                        {
                            continue;
                        }

                        bool testFriendship = true;
                        if (!Cares(witness, Event.DisgracefulActionType, GetValue <ReportChanceOption, int>(), out testFriendship))
                        {
                            continue;
                        }

                        if (testFriendship)
                        {
                            if (ManagerFriendship.AreFriends(Sim, witness))
                            {
                                continue;
                            }
                        }

                        valid = true;
                        break;
                    }

                    if (!valid)
                    {
                        IncStat("No One Cares");
                        return(false);
                    }
                    break;
                }
            }
            else
            {
                if (!GetValue <AllowFalseOption, bool>())
                {
                    IncStat("False Denied");
                    return(false);
                }
            }

            if (Sim.CelebrityManager.mDisgracefulActionQueue != null)
            {
                foreach (DisgracefulActionEvent e in Sim.CelebrityManager.mDisgracefulActionQueue)
                {
                    if ((e.TargetId == Event.TargetId) && (e.DisgracefulActionType == Event.DisgracefulActionType))
                    {
                        IncStat("Already Queued");
                        return(false);
                    }
                }
            }

            if (!RandomUtil.RandomChance01(data.Chance))
            {
                IncStat("Chance Fail");
                return(false);
            }

            if (Sim.CelebrityManager.mDisgracefulActionQueue == null)
            {
                Sim.CelebrityManager.mDisgracefulActionQueue = new List <DisgracefulActionEvent>();
            }

            Sim.CelebrityManager.mDisgracefulActionQueue.Add(Event);

            new TriggerDisgraceTask(this);
            return(true);
        }
Example #3
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List <SimDescription> parents = new List <SimDescription>();

            foreach (SimDescription parent in Relationships.GetParents(Sim))
            {
                if (SimTypes.IsDead(parent))
                {
                    continue;
                }

                if (!parent.Elder)
                {
                    continue;
                }

                if (parent.Household == Sim.Household)
                {
                    continue;
                }

                if (!ManagerFriendship.AreFriends(Sim, parent))
                {
                    continue;
                }

                if (GetValue <NetWorthOption, int>(parent.Household) >= GetValue <NetWorthOption, int>(Sim.Household))
                {
                    IncStat("Unnecessary");
                    continue;
                }

                parents.Add(parent);
            }

            if (parents.Count == 0)
            {
                return(false);
            }

            if (AddScoring("CaresAboutChildren", GetValue <AlimonyChanceOption, int>(Sim), ScoringLookup.OptionType.Chance, Sim) <= 0)
            {
                return(false);
            }

            int perParentPayment = GetValue <PaymentOption, int>();

            if (GetValue <IsRichOption, bool>(Sim.Household))
            {
                perParentPayment *= GetValue <AlimonyScenario.RichMultipleOption, int>();
            }

            foreach (SimDescription parent in parents)
            {
                if (!Money.Allow(this, parent, Managers.Manager.AllowCheck.None))
                {
                    IncStat("Money Denied Parent");
                    continue;
                }

                int payment = perParentPayment;
                if (Sim.FamilyFunds < payment)
                {
                    payment = Sim.FamilyFunds;
                }

                mTotalPayments += payment;

                if (payment == 0)
                {
                    IncStat("Insufficient");
                }
                else
                {
                    Money.AdjustFunds(Sim, "ElderSupport", -payment);

                    Money.AdjustFunds(parent, "ElderSupport", payment);

                    AddStat("Paid", payment);
                }
            }

            return(mTotalPayments > 0);
        }
Example #4
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (Guests.Count < TargetMinimum)
            {
                IncStat("Too Few");
                return(false);
            }

            AddStat("Guests", Guests.Count);

            if (Household.ActiveHousehold != null)
            {
                foreach (SimDescription active in HouseholdsEx.Humans(Household.ActiveHousehold))
                {
                    Target = active;
                    if (!TargetAllow(active))
                    {
                        continue;
                    }

                    if (mGuests.Contains(active))
                    {
                        continue;
                    }

                    if (ManagerFriendship.AreFriends(Sim, active))
                    {
                        mGuests.Add(active);
                    }
                }

                Target = null;
            }

            int delay = 3;

            if (Lot == Sim.LotHome)
            {
                Situations.PushGoHome(this, Sim);

                PushBuffetInteractions(this, Sim, Lot);

                DateAndTime startTime = SimClock.CurrentTime();
                startTime.Ticks += SimClock.ConvertToTicks(3f, TimeUnit.Hours);

                /*
                 * if (Lot != Sim.LotHome)
                 * {
                 *  DateAndTime rentTime = startTime;
                 *  rentTime.Ticks -= SimClock.ConvertToTicks(Sims3.Gameplay.Situations.Party.HoursToStartRentBeforePartyStart, TimeUnit.Hours);
                 *  if (rentTime.CompareTo(SimClock.CurrentTime()) < 0)
                 *  {
                 *      rentTime = SimClock.Add(SimClock.CurrentTime(), TimeUnit.Minutes, 2f);
                 *  }
                 *
                 *  if (!RentScheduler.Instance.RentLot(Lot, Sim.CreatedSim, rentTime, Guests))
                 *  {
                 *      IncStat("Couldn't Rent");
                 *      Lot = Sim.LotHome;
                 *  }
                 * }
                 */

                Party party = GetParty(Lot, Sim.CreatedSim, Guests, PartyAttire, startTime);

                EventTracker.SendEvent(new PartyEvent(EventTypeId.kThrewParty, Sim.CreatedSim, Sim, party));

                delay = 3;
            }
            else
            {
                List <Sim> followers = new List <Sim>();

                foreach (SimDescription guest in Guests)
                {
                    if (SimTypes.IsSelectable(guest))
                    {
                        continue;
                    }

                    if (!Sims.Instantiate(guest, Lot, false))
                    {
                        continue;
                    }

                    Sim guestSim = guest.CreatedSim;
                    if (guestSim == null)
                    {
                        continue;
                    }

                    guestSim.PushSwitchToOutfitInteraction(Sims3.Gameplay.Actors.Sim.ClothesChangeReason.GoingToSituation, PartyAttire);

                    followers.Add(guestSim);
                }

                AddStat("Followers", followers.Count);

                if (!Situations.PushMassVisit(this, Sim, followers, Lot))
                {
                    return(false);
                }

                delay = 0;
            }

            if (mReport)
            {
                Manager.AddAlarm(new DelayedStoryScenario(this, delay));
            }

            return(true);
        }