예제 #1
0
 private void NapLoop(StateMachineClient smc, InteractionInstance.LoopData data)
 {
     if (data.mLifeTime > BuffTiredFromMoving.TimeToRemove * 60f)
     {
         this.Actor.BuffManager.RemoveElement(BuffNames.TiredFromMoving);
     }
     TraitFunctions.BedSnore(this.Actor, data.mLifeTime, ref this.NapSoundTime);
     TraitFunctions.CheckLightSleeperDisturbed(this.Actor);
 }
예제 #2
0
파일: Swipe.cs 프로젝트: yakoder/NRaas
        public override bool Run()
        {
            try
            {
                if (Target.Parent != null)
                {
                    Target.UnParent();
                }

                Household household = Target.LotCurrent.Household;

                Target.FadeOut(true);
                Target.RemoveFromUseList(base.Actor);
                Target.RemoveFromWorld();

                if (Actor.Inventory.CanAdd(Target))
                {
                    Actor.Inventory.TryToAdd(Target, false);
                }
                else
                {
                    Actor.Household.SharedFamilyInventory.Inventory.TryToAdd(Target, false);

                    Common.Notify(Common.Localize("Swipe:FamilyInventory", Actor.IsFemale, new object[] { Actor, Target }));
                }

                if ((household != null) && (household.Sims.Count > 0x0))
                {
                    TraitFunctions.ItemStolenCallback(household, Origin.FromTheft);
                    Target.SetStealActors(Actor, RandomUtil.GetRandomObjectFromList <Sim>(household.Sims));
                }
                else
                {
                    Target.SetStealActors(Actor, null);
                }

                foreach (Situation situation in Actor.Autonomy.SituationComponent.Situations)
                {
                    VisitSituation situation2 = situation as VisitSituation;
                    if (situation2 != null)
                    {
                        situation2.GuestStartingInappropriateAction(base.Actor, TraitTuning.KleptomaniacStealingInnapropriateness);
                    }
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
예제 #3
0
        public override bool Run()
        {
            try
            {
                if (!Target.RouteToFireplace(Actor))
                {
                    return(false);
                }

                if (!Target.mLit)
                {
                    return(false);
                }

                if (!Target.WaitToPutOut(Actor))
                {
                    return(false);
                }

                StandardEntry();
                BeginCommodityUpdates();
                Target.EnableFootprintAndPushSims(Target.FootprintPathingHash, Actor);

                MagicControl control = MagicControl.GetBestControl(Actor, CastIceBlastEx.Singleton as IMagicalDefinition);
                if (control != null)
                {
                    mProxy.Run(this, CastIceBlastEx.Singleton as IMagicalDefinition);

                    mWand.FinishUsing(Actor);
                }
                else
                {
                    StateMachineClient stateMachine = Target.GetStateMachine(this, "Enter");
                    stateMachine.SetParameter("HaveRemote", Target.TuningFireplace.HasRemote);
                    stateMachine.SetParameter("CheapVersion", Target.UseCheapAnimations);
                    stateMachine.AddOneShotScriptEventHandler(0x65, StopFireCallback);
                    stateMachine.RequestState("x", "ExtinguishFire");
                    stateMachine.RequestState("x", "Exit");
                }

                TraitFunctions.CheckForNeuroticAnxiety(Actor, TraitFunctions.NeuroticTraitAnxietyType.Fireplace);
                EndCommodityUpdates(true);
                StandardExit();
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
예제 #4
0
 public override bool Run()
 {
     Stove_Have.Definition definition = base.InteractionDefinition as Stove_Have.Definition;
     TraitFunctions.CheckForNeuroticAnxiety(Actor, TraitFunctions.NeuroticTraitAnxietyType.Stove);
     return(AniRecipe.ForcePushFridgeHave(Actor, Target, definition.ChosenRecipe, definition.Destination, definition.Quantity, definition.Repetition));
 }
예제 #5
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List <PropertyData> properties = new List <PropertyData>();

            int max = Maximum;
            int min = Minimum;

            foreach (PropertyData property in Sim.Household.RealEstateManager.AllProperties)
            {
                int cost = GetCost(property);
                if (cost <= 0)
                {
                    continue;
                }

                if (cost < min)
                {
                    continue;
                }

                if (cost > max)
                {
                    continue;
                }

                properties.Add(property);
            }

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

            mFail = IsFail(Sim, Target);

            if (!mFail)
            {
                PropertyData choice = RandomUtil.GetRandomObjectFromList(properties);

                mObjectName  = choice.LocalizedName;
                mObjectValue = GetCost(choice);

                if (ActualTransfer)
                {
                    ManagerMoney.TransferProperty(Sim.Household, Target.Household, choice);
                }
                else
                {
                    Money.AdjustFunds(Target, "PropertyTransfer", -mObjectValue);

                    Money.AdjustFunds(Sim, "PropertyTransfer", mObjectValue);
                }

                if (Delta < 0)
                {
                    TraitFunctions.ItemStolenCallback(Target.Household, Origin.FromTheft);

                    foreach (Sim sim in HouseholdsEx.AllSims(Target.Household))
                    {
                        EventTracker.SendEvent(EventTypeId.kWasRobbed, sim);
                    }
                }
            }

            if (Delta < 0)
            {
                if (OnInvestigateScenario != null)
                {
                    OnInvestigateScenario(this, frame);
                }
            }

            return(true);
        }
예제 #6
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);
            }
        }
예제 #7
0
파일: AniStove.cs 프로젝트: pepoluan/NRaas
 public override bool Run()
 {
     OverridedStove_Have.Definition definition = base.InteractionDefinition as OverridedStove_Have.Definition;
     TraitFunctions.CheckForNeuroticAnxiety(this.Actor, TraitFunctions.NeuroticTraitAnxietyType.Stove);
     return(Fridge.ForcePushFridgeHave(this.Actor, this.Target, definition.ChosenRecipe, definition.MenuText, definition.MenuPath, definition.ObjectClickedOn, definition.Destination, definition.Quantity, definition.Repetition, false, definition.Cost));
 }
예제 #8
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List <GameObject> objects = new List <GameObject>();

            int min = Minimum;
            int max = Maximum;

            AddStat("Minimum", min);
            AddStat("Maximum", max);

            foreach (Lot lot in ManagerLot.GetOwnedLots(Target))
            {
                foreach (GameObject obj in lot.GetObjects <GameObject>())
                {
                    if (!obj.IsStealable())
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(obj.CatalogName))
                    {
                        continue;
                    }

                    if (obj.Value <= 0)
                    {
                        continue;
                    }

                    if (obj.Value < min)
                    {
                        continue;
                    }

                    if (obj.Value > max)
                    {
                        continue;
                    }

                    objects.Add(obj);
                }
            }

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

            mFail = IsFail(Sim, Target);

            GameObject choice = RandomUtil.GetRandomObjectFromList(objects);

            mObjectName  = choice.CatalogName;
            mObjectValue = choice.Value;

            if (!mFail)
            {
                EventTracker.SendEvent(EventTypeId.kStoleObject, Sim.CreatedSim, choice);

                AddStat("Object Value", mObjectValue);

                if ((KeepObject) && (Sim.CreatedSim != null))
                {
                    if (!Inventories.TryToMove(choice, Sim.CreatedSim))
                    {
                        return(false);
                    }

                    choice.SetStealActors(Sim.CreatedSim, Target.CreatedSim);
                }
                else
                {
                    Money.AdjustFunds(Target, "Burgled", -mObjectValue);

                    Money.AdjustFunds(Sim, "Burgled", mObjectValue);
                }

                TraitFunctions.ItemStolenCallback(Target.Household, Origin.FromBurglar);

                foreach (Sim sim in HouseholdsEx.AllSims(Target.Household))
                {
                    EventTracker.SendEvent(EventTypeId.kWasRobbed, sim);
                }
            }

            if (OnInvestigateScenario != null)
            {
                OnInvestigateScenario(this, frame);
            }

            return(true);
        }
예제 #9
0
        public override bool Run()
        {
            try
            {
                try
                {
                    mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
                }
                catch
                {
                    return(false);
                }

                mSwitchOutfitHelper.Start();
                if (!Target.RouteToSink(this))
                {
                    return(false);
                }

                if (Shooless.Settings.GetPrivacy(Target))
                {
                    mSituation = new Sink.SpongeBathPrivacySituation(this);
                    if (!mSituation.Start())
                    {
                        return(false);
                    }
                }

                Matrix44 transform = Actor.Transform;
                if (!Actor.RouteToMatrix(ref transform))
                {
                    if (mSituation != null)
                    {
                        mSituation.Exit();
                    }
                    return(false);
                }
                StandardEntry();
                mSwitchOutfitHelper.Wait(true);
                bool flag = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed;
                Target.mSimUsingSink = Actor;
                mCurrentStateMachine = Target.GetStateMachine(Actor, "Enter");
                if (mSituation != null)
                {
                    mSituation.StateMachine = mCurrentStateMachine;
                }
                SetParameter("SimShouldClothesChange", !flag && !Actor.OccultManager.DisallowClothesChange());
                mSwitchOutfitHelper.AddScriptEventHandler(this);
                AddOneShotScriptEventHandler(0x3e9, new SacsEventHandler(EventCallbackStartWaterSound));
                bool paramValue = (Target.BoobyTrapComponent != null) ? Target.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription) : false;
                mCurrentStateMachine.SetParameter("isBoobyTrapped", paramValue);
                AnimateSim("Loop SpongeBath");
                StartStages();
                Target.StartDisgustEffect();
                BeginCommodityUpdates();

                bool succeeded = false;
                if (paramValue)
                {
                    Target.TriggerTrap(Actor);
                }
                else
                {
                    try
                    {
                        Sink.CheckToAddChillyBuff(Actor, Target);
                        succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), LoopDel, null);
                        Actor.BuffManager.UnpauseBuff(BuffNames.Chilly);
                    }
                    finally
                    {
                        EndCommodityUpdates(succeeded);
                    }

                    if (succeeded)
                    {
                        Actor.BuffManager.RemoveElement(BuffNames.Singed);
                        Actor.BuffManager.RemoveElement(BuffNames.SingedElectricity);
                        Actor.BuffManager.RemoveElement(BuffNames.GotFleasHuman);
                    }
                    if (!flag || (flag && succeeded))
                    {
                        SetParameter("SimShouldClothesChange", !Actor.OccultManager.DisallowClothesChange());
                        mSwitchOutfitHelper.Dispose();

                        try
                        {
                            mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GettingOutOfBath);
                            mSwitchOutfitHelper.Start();
                            mSwitchOutfitHelper.AddScriptEventHandler(this);
                            mSwitchOutfitHelper.Wait(false);
                        }
                        catch
                        { }
                    }
                }

                AddOneShotScriptEventHandler(0x3ea, new SacsEventHandler(EventCallbackStopWaterSound));
                Target.UpdateDirtyBreakAndPickExitState(mCurrentStateMachine, Actor);
                Target.StopDisgustEffect();
                Target.mSimUsingSink = null;
                TraitFunctions.CheckForNeuroticAnxiety(Actor, TraitFunctions.NeuroticTraitAnxietyType.Sink);
                StandardExit();
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }