Esempio n. 1
0
        public void HandleMoochSkill(SimDescription sim, float incSkill)
        {
            Skill skill = sim.SkillManager.AddElement(SkillNames.Mooch);

            if (sim.Child)
            {
                skill.AddSkillPointsLevelClamped(incSkill, TraitTuning.MoochTraitChildSkill);
            }
            else if (sim.Teen)
            {
                skill.AddSkillPointsLevelClamped(incSkill, TraitTuning.MoochTraitTeenSkill);
            }
            else
            {
                skill.AddPoints(incSkill);
            }
        }
Esempio n. 2
0
        public static void AfterMoochMoney(Sim actor, Sim target, float moochSkillPoints, int moochSkillLevel)
        {
            try
            {
                Skill skill = actor.SkillManager.AddElement(SkillNames.Mooch);
                if (actor.SimDescription.Child)
                {
                    skill.AddSkillPointsLevelClamped(moochSkillPoints, TraitTuning.MoochTraitChildSkill);
                }
                else if (actor.SimDescription.Teen)
                {
                    skill.AddSkillPointsLevelClamped(moochSkillPoints, TraitTuning.MoochTraitTeenSkill);
                }
                else
                {
                    skill.AddPoints(moochSkillPoints);
                }

                int delta = Mooch.MoochAmounts[moochSkillLevel];
                if (RandomUtil.RandomChance01(TraitTuning.MoochTraitMoneyQuadChance))
                {
                    delta *= 0x4;
                }
                else if (RandomUtil.RandomChance01(TraitTuning.MoochTraitMoneyDoubleChance))
                {
                    delta *= 0x2;
                }
                delta = (int)(delta * RandomUtil.RandomFloatGaussianDistribution(TraitTuning.MoochTraitMoneyRandomBegin, TraitTuning.MoochTraitMoneyRandomEnd));

                NRaas.StoryProgression.Main.Money.AdjustFunds(target.SimDescription, "GiveAway", -delta);

                NRaas.StoryProgression.Main.Money.AdjustFunds(actor.SimDescription, "GiveAway", delta);

                actor.ShowTNSIfSelectable(SocialCallback.LocalizeString(actor.IsFemale, "MoochMoney", new object[] { actor, delta, target }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, target.ObjectId);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
Esempio n. 3
0
        public override bool Run()
        {
            try
            {
                if (Responder.Instance.TutorialModel.IsTutorialRunning())
                {
                    if (!Target.CancelTutorial())
                    {
                        return(false);
                    }
                    Responder.Instance.TutorialModel.ForceExitTutorial();
                }

                List <Sim> lazyList = new List <Sim>();
                if (!PreTimeTravel1(this, this, lazyList))
                {
                    return(false);
                }

                foreach (Sim sim4 in lazyList)
                {
                    if (!sim4.SimDescription.Baby)
                    {
                        TimePortal.GatherAround entry = TimePortal.GatherAround.Singleton.CreateInstance(Target, sim4, GetPriority(), Autonomous, CancellableByPlayer) as TimePortal.GatherAround;
                        entry.mMasterInteraction = this;
                        sim4.InteractionQueue.AddNext(entry);
                    }
                }

                int num;
                if (!Actor.RouteToSlotListAndCheckInUse(Target, TimePortal.kRoutingSlots, out num))
                {
                    CancelFollowers(lazyList);
                    return(false);
                }

                if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    CancelFollowers(lazyList);
                    return(false);
                }

                if (!PreTimeTravel2(this, lazyList))
                {
                    return(false);
                }

                EnterStateMachine("timeportal", "Enter", "x", "portal");
                AddPersistentScriptEventHandler(0xc9, CameraShakeEvent);
                AnimateSim("Call Over");

                Skill futureSkill = Actor.SkillManager.AddElement(SkillNames.Future);
                if (futureSkill.SkillLevel >= 0x3)
                {
                    AnimateSim("Jump In");
                }
                else
                {
                    AnimateSim("Apprehensive");
                }

                bool succeeded = true;
                if (!GameUtils.IsFutureWorld())
                {
                    // Custom
                    succeeded = TimePortalEx.TravelToFuture(Target, Actor, new List <Sim>(mFollowerGroup), new List <ulong>(mFollowerGroupIDs));
                }

                if (succeeded)
                {
                    foreach (Sim sim7 in lazyList)
                    {
                        futureSkill = sim7.SkillManager.GetElement(SkillNames.Future);
                        if (futureSkill != null)
                        {
                            futureSkill.AddPoints(kFollowerFutureSkillPointGain, true, false);
                        }
                    }
                }
                else
                {
                    CancelFollowers(lazyList);
                    SpeedTrap.Sleep(0x3c);
                    AnimateSim("Spit Out");
                    Target.SwitchActiveState();
                }

                AnimateSim("Exit");
                EndCommodityUpdates(succeeded);
                StandardExit();
                if (GameUtils.IsFutureWorld())
                {
                    Target.StopActiveFX();

                    // Custom
                    GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld();

                    SendEventForActorAndFollowers(Actor, lazyList, EventTypeId.kTravelToPresent);
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            finally
            {
                TravelUtil.PlayerMadeTravelRequest = false;
                //Sims3.Gameplay.Gameflow.Singleton.EnableSave(this);
            }

            return(false);
        }
        public override bool Run()
        {
            try
            {
                string str;
                mTimeTravelDef = InteractionDefinition as Definition;
                if (!Target.RouteToMachine(Actor, false, null))
                {
                    return(false);
                }

                List <Sim> lazyList = new List <Sim>();
                if (!TimePortalTravelWithEx.PreTimeTravel1(this, this, lazyList))
                {
                    return(false);
                }

                if (!TimePortalTravelWithEx.PreTimeTravel2(this, lazyList))
                {
                    return(false);
                }

                Actor.SimDescription.Contactable = false;
                EnterStateMachine("TimeMachine", "Enter", "x");
                SetActor("timeMachine", Target);
                SetParameter("isFuture", mTimeTravelDef.TimePeriod == TimeMachine.TravelTimePeriod.Future);
                AddOneShotScriptEventHandler(0x3ee, OnEnterAnimationEvent);
                AddOneShotScriptEventHandler(0x66, ToggleHiddenAnimationEvent);
                AnimateSim("GetIn");
                Target.EnableRoutingFootprint(Actor);

                mTimeTravelAlarm = AlarmManager.Global.AddAlarmRepeating(RandomUtil.GetFloat(TimeMachine.kMinutesBetweenAdventureTNSMin, TimeMachine.kMinutesBetweenAdventureTNSMax), TimeUnit.Minutes, new AlarmTimerCallback(TimeTravelCallback), RandomUtil.GetFloat(TimeMachine.kMinutesBetweenAdventureTNSMin, TimeMachine.kMinutesBetweenAdventureTNSMax), TimeUnit.Minutes, "Time Travel Alarm For:" + Actor.SimDescription.FullName, AlarmType.AlwaysPersisted, Actor);
                Target.SetMaterial("InUse");

                bool succeeded = true;
                if (!GameUtils.IsFutureWorld())
                {
                    // Custom
                    succeeded = TimePortalEx.TravelToFuture(null, Actor, new List <Sim>(mFollowerGroup), new List <ulong>(mFollowerGroupIDs));
                }

                if (succeeded)
                {
                    foreach (Sim sim7 in lazyList)
                    {
                        Skill futureSkill = sim7.SkillManager.GetElement(SkillNames.Future);
                        if (futureSkill != null)
                        {
                            futureSkill.AddPoints(TimePortalTravelWithEx.kFollowerFutureSkillPointGain, true, false);
                        }
                    }
                }

                succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));

                EndCommodityUpdates(succeeded);
                Target.PickExitStateAndSound(mTimeTravelDef.TimePeriod, out str, out mExitSound);
                AddOneShotScriptEventHandler(0x3e9, OnExitAnimationEvent);
                AddOneShotScriptEventHandler(0x3ef, OnExitAnimationEvent);
                AddOneShotScriptEventHandler(0x67, ToggleHiddenAnimationEvent);
                AnimateSim(str);

                Target.SetMaterial("default");
                AnimateSim("Exit");
                if (!string.IsNullOrEmpty(mTravelSummary))
                {
                    Actor.ShowTNSIfSelectable(mTravelSummary, StyledNotification.NotificationStyle.kGameMessagePositive, Target.ObjectId, Actor.ObjectId);
                }

                StandardExit();
                Target.Repairable.UpdateBreakage(Actor);
                InventingSkill skill = Actor.SkillManager.GetSkill <InventingSkill>(SkillNames.Inventing);
                if (succeeded && (skill != null))
                {
                    skill.RegisterTimeTravelDone();
                }

                if (GameUtils.IsFutureWorld())
                {
                    // Custom
                    GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld();

                    TimePortalTravelWithEx.SendEventForActorAndFollowers(Actor, lazyList, EventTypeId.kTravelToPresent);
                }

                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
            finally
            {
                TravelUtil.PlayerMadeTravelRequest = false;
            }
        }
        public override bool Run()
        {
            try
            {
                Target.mRoutingSims.Add(Actor);
                if (!Target.RouteToPortal(Actor))
                {
                    Actor.AddExitReason(ExitReason.RouteFailed);
                    Target.mRoutingSims.Remove(Actor);
                    return(false);
                }

                Target.mRoutingSims.Remove(Actor);

                List <Sim> lazyList = new List <Sim>();
                if (!TimePortalTravelWithEx.PreTimeTravel1(this, this, lazyList))
                {
                    return(false);
                }

                mTargetPortal = Target;

                mTargetPortal.AddToUseList(Actor);

                if (!TimePortalTravelWithEx.PreTimeTravel2(this, lazyList))
                {
                    return(false);
                }

                mTargetPortal.EnableFootprint(FootprintPlacementHash);
                mTargetPortal.PushSimsFromFootprint(FootprintPlacementHash, Actor, null, false);
                EnterStateMachine("AncientPortal", "Enter", "x", "portal");

                AddOneShotScriptEventHandler(0x65, HideSim);
                AddOneShotScriptEventHandler(0x66, ShowSim);
                AnimateSim("InsidePortal");

                SetActor("portal", mTargetPortal);

                bool succeeded = true;
                if (!GameUtils.IsFutureWorld())
                {
                    // Custom
                    succeeded = TimePortalEx.TravelToFuture(null, Actor, new List <Sim>(mFollowerGroup), new List <ulong>(mFollowerGroupIDs));
                }

                if (succeeded)
                {
                    foreach (Sim sim7 in lazyList)
                    {
                        Skill futureSkill = sim7.SkillManager.GetElement(SkillNames.Future);
                        if (futureSkill != null)
                        {
                            futureSkill.AddPoints(TimePortalTravelWithEx.kFollowerFutureSkillPointGain, true, false);
                        }
                    }
                }

                Slot    slotName       = mTargetPortal.GetRoutingSlots()[0x0];
                Vector3 positionOfSlot = mTargetPortal.GetPositionOfSlot(slotName);
                Vector3 forwardOfSlot  = mTargetPortal.GetForwardOfSlot(slotName);
                Actor.SetPosition(positionOfSlot);
                Actor.SetForward(forwardOfSlot);
                mTargetPortal.DisableFootprint(FootprintPlacementHash);

                AnimateSim("Exit");

                for (int i = 0x0; i < kPotentialTravelBuffs.Length; i++)
                {
                    if (RandomUtil.RandomChance(kChanceForEachBuff))
                    {
                        Actor.BuffManager.AddElement(kPotentialTravelBuffs[i], Origin.FromAncientPortal);
                    }
                }

                EndCommodityUpdates(succeeded);
                StandardExit();
                mTargetPortal.RemoveFromUseList(Actor);

                Actor.Wander(1f, 2f, false, RouteDistancePreference.PreferNearestToRouteOrigin, false);

                if (GameUtils.IsFutureWorld())
                {
                    // Custom
                    GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld();

                    TimePortalTravelWithEx.SendEventForActorAndFollowers(Actor, lazyList, EventTypeId.kTravelToPresent);
                }

                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
            finally
            {
                TravelUtil.PlayerMadeTravelRequest = false;
            }
        }