Exemple #1
0
            public override void AddInteractions(InteractionObjectPair iop, Sim actor, Restaurant target, List <InteractionObjectPair> results)
            {
                try
                {
                    int breakfastLunchBrunchCost = target.RestaurantTuning.BreakfastLunchBrunchCost;
                    if (Food.GetCurrentMealTime() == Recipe.MealTime.Dinner)
                    {
                        breakfastLunchBrunchCost = target.RestaurantTuning.DinnerCost;
                    }
                    int costForSim = target.GetCostForSim(actor, breakfastLunchBrunchCost);

                    Journalism job = OmniCareer.Career <Journalism>(actor.Occupation);
                    if ((job != null) && job.CanReviewRabbitHole(target))
                    {
                        Definition definition = new Definition(Restaurant.EatType.Review, EatHere.LocalizeString("ReviewRestaurant", new object[0x0]), new string[] { EatHere.LocalizeString("EatHere", new object[0x0]) }, 0x0, target);
                        results.Add(new InteractionObjectPair(definition, target));
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(actor, target, e);
                }
            }
Exemple #2
0
        public override bool InRabbitHole()
        {
            try
            {
                mMealTime  = Food.GetCurrentMealTime();
                mStartHour = SimClock.HoursPassedOfDay;

                StartStages();
                BeginCommodityUpdates();

                bool succeeded = false;

                try
                {
                    AddMotiveArrow(CommodityKind.Hunger, true);
                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new Interaction <Sim, Restaurant> .InsideLoopFunction(LoopCallback), null);
                }
                finally
                {
                    EndCommodityUpdates(succeeded);
                }

                if (succeeded)
                {
                    bool  flag2        = ActiveStage is Sims3.Gameplay.Objects.RabbitHoles.EatHere.EatDessertStage;
                    int   buffStrength = flag2 ? Target.DessertBuffStrength : Target.BuffStrength;
                    float buffDuration = flag2 ? Target.DessertBuffDuration : Target.BuffDuration;
                    EatHere.AddMealBuffAndSolveHunger(Actor, buffStrength, buffDuration);
                    if (Actor.CarryingChildPosture != null)
                    {
                        EatHere.AddMealBuffAndSolveHunger(Actor.CarryingChildPosture.Child, buffStrength, buffDuration);
                    }
                    EventTracker.SendEvent(EventTypeId.kAteAtRestaurant, Actor, Target);
                    int normalCost = (mMealTime == Recipe.MealTime.Dinner) ? Target.RestaurantTuning.DinnerCost : Target.RestaurantTuning.BreakfastLunchBrunchCost;
                    if (flag2)
                    {
                        normalCost += Target.RestaurantTuning.DessertCost;
                    }
                    if ((mMealTime == Recipe.MealTime.Dinner) && (mStartHour < Target.RestaurantTuning.EarlyBirdTime))
                    {
                        normalCost = (int)(normalCost * Target.RestaurantTuning.EarlyBirdDiscount);
                    }
                    if (mEatingType == Restaurant.EatType.Review)
                    {
                        OmniCareer.Career <Journalism>(Actor.Occupation).RabbitHolesReviewed.Add(new Journalism.ReviewedRabbitHole(Target, ShowVenue.ShowTypes.kNoShow));
                    }
                    else
                    {
                        int costForSim = Target.GetCostForSim(Actor, normalCost);
                        AddCostAndBuffsForOtherSims(normalCost, ref costForSim, true, buffStrength, buffDuration);
                        ChargeBill(costForSim, Sims3.Gameplay.Objects.RabbitHoles.EatHere.LocalizeString(Actor.IsFemale, "CantAffordMeal", new object[] { Actor }));
                    }
                    if (Actor.HasTrait(TraitNames.NaturalCook) && RandomUtil.RandomChance01(TraitTuning.NaturalCookTraitChanceToLearnRecipeAtRestaurant))
                    {
                        Recipe recipe = Recipe.RandomRecipeOfSkillLevelRange(0x0, Actor.SkillManager.GetSkillLevel(SkillNames.Cooking), Actor);
                        if ((recipe != null) && recipe.Learn(Actor))
                        {
                            Actor.ShowTNSIfSelectable(Sims3.Gameplay.Objects.RabbitHoles.EatHere.LocalizeString(Actor.IsFemale, "NaturalCookLearnedRecipe", new object[] { recipe, Actor }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, Actor.ObjectId);
                        }
                    }
                }
                TraitFunctions.TraitKleptomaniacStealFromRestaurant(Actor, Target, false);
                Target.OnFinishedEating(Actor, mIsSufficientlyFullForStuffed, mHasFatDelta);
                mbDoneEating = true;
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }