protected static bool GiveTip(BandInstrument ths, Sim tipper, Sim player, int moneyPerLevel, int moneyPerComposition)
        {
            if (ths.mTipJar == null)
            {
                return(false);
            }
            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();

            destination.mCenterPoint       = ths.mTipJar.Position;
            destination.mConeVector        = ths.mTipJar.ForwardVector;
            destination.mFacingPreference  = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle        = 3.141593f;
            destination.mfMinRadius        = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject      = ths.mTipJar;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (!tipper.DoRoute(r))
            {
                return(false);
            }
            tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);
            BandSkill skill = player.SkillManager.GetSkill <BandSkill>(ths.SkillName);
            int       delta = skill.SkillLevel * moneyPerLevel;

            delta += skill.NumberCompositionsPlayed() * moneyPerComposition;
            delta  = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
            delta++;

            RockBand.GiveXpForMoney(player, delta);

            NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

            int original = skill.mMoneyMadeFromGuitarPlaying;

            skill.MadeTips(delta, false);

            delta = skill.mMoneyMadeFromGuitarPlaying - original;

            NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

            return(true);
        }
Esempio n. 2
0
        protected static int GiveTipEx(DJTurntable ths, Sim tipper, Sim player)
        {
            if (ths.mTipJar == null)
            {
                return(0);
            }
            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();

            destination.mCenterPoint       = ths.mTipJar.Position;
            destination.mConeVector        = ths.mTipJar.ForwardVector;
            destination.mFacingPreference  = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle        = 3.141593f;
            destination.mfMinRadius        = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject      = ths.mTipJar;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (!tipper.DoRoute(r))
            {
                return(0);
            }
            tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);

            int delta = 0;

            int dJLevel = ths.GetDJLevel(player);

            if (((dJLevel >= 0x0) && (dJLevel <= 0x5)) && (dJLevel >= DJTurntable.kMakeATipLevel))
            {
                delta = DJTurntable.kTipAmountPerLevel[dJLevel];
            }

            delta = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
            delta++;

            NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

            NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

            return(delta);
        }
Esempio n. 3
0
        protected static bool GiveTip(PerformanceCareer.PerformerPerformForTips ths, Sim tipper, Sim player)
        {
            if (ths.mTipJar == null)
            {
                return(false);
            }
            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();

            destination.mCenterPoint       = ths.mTipJar.Position;
            destination.mConeVector        = ths.mTipJar.ForwardVector;
            destination.mFacingPreference  = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle        = 3.141593f;
            destination.mfMinRadius        = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject      = ths.mTipJar;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (!tipper.DoRoute(r))
            {
                return(false);
            }
            tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);
            PerformanceCareer occupationAsPerformanceCareer = player.OccupationAsPerformanceCareer;
            int delta = occupationAsPerformanceCareer.CareerLevel * occupationAsPerformanceCareer.Tuning.TipMoneyPerLevel;

            delta = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
            delta++;

            NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

            int original = occupationAsPerformanceCareer.mTipsCurrentGig;

            occupationAsPerformanceCareer.MadeTips(delta, false);

            delta = occupationAsPerformanceCareer.mTipsCurrentGig - original;

            NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

            return(true);
        }
Esempio n. 4
0
        protected static int GiveTipEx(DJTurntable ths, Sim tipper, Sim player)
        {
            if (ths.mTipJar == null)
            {
                return 0;
            }
            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();
            destination.mCenterPoint = ths.mTipJar.Position;
            destination.mConeVector = ths.mTipJar.ForwardVector;
            destination.mFacingPreference = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle = 3.141593f;
            destination.mfMinRadius = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject = ths.mTipJar;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (!tipper.DoRoute(r))
            {
                return 0;
            }
            tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);

            int delta = 0;

            int dJLevel = ths.GetDJLevel(player);
            if (((dJLevel >= 0x0) && (dJLevel <= 0x5)) && (dJLevel >= DJTurntable.kMakeATipLevel))
            {
                delta = DJTurntable.kTipAmountPerLevel[dJLevel];
            }

            delta = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
            delta++;

            NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

            NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

            return delta;
        }
        protected static bool GiveTip(SnakeCharmingBasket ths, Sim tipper, Sim player, int moneyPerLevel, int moneyPerComposition)
        {
            if (!ths.CanTip(player))
            {
                return(false);
            }

            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();

            destination.mCenterPoint       = ths.Position;
            destination.mConeVector        = ths.ForwardVector;
            destination.mFacingPreference  = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle        = 3.141593f;
            destination.mfMinRadius        = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject      = ths;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (tipper.DoRoute(r))
            {
                int delta = player.SkillManager.GetSkillLevel(SkillNames.SnakeCharming) * moneyPerLevel;
                delta = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
                delta++;

                NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

                NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

                tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);
                SnakeCharmingBasket.CharmForTips currentInteraction = player.CurrentInteraction as SnakeCharmingBasket.CharmForTips;
                if (currentInteraction != null)
                {
                    currentInteraction.MoneyEarnedThisSession += delta;
                }
                return(true);
            }
            return(false);
        }
Esempio n. 6
0
        // replaces the method from RabbitHole class - identical except for new slot reassignment code
        public bool RouteNearEntranceAndEnterRabbitHole(Sim a, RabbitHole.IRabbitHoleFollowers inst, RabbitHole.BeforeEnteringRabbitHoleDelegate beforeEntering, bool canUseCar, Route.RouteMetaType routeMetaType, bool playRouteFailure)
        {
            if ((Target.RabbitHoleProxy.EnterSlots.Count == 0) || (Target.RabbitHoleProxy.ExitSlots.Count == 0))
            {
                return(false);
            }
            if (a.IsInRidingPosture && ((Target.RabbitHoleProxy.MountedEnterSlots.Count == 0) || (Target.RabbitHoleProxy.MountedExitSlots.Count == 0)))
            {
                return(false);
            }
            List <Sim>           list    = new List <Sim>();
            CarryingChildPosture posture = a.Posture as CarryingChildPosture;

            if (posture != null)
            {
                list.Add(posture.Child);
            }
            if (inst != null)
            {
                if (inst.SimFollowers != null)
                {
                    foreach (Sim sim in inst.SimFollowers)
                    {
                        posture = sim.Posture as CarryingChildPosture;
                        if (posture != null)
                        {
                            list.Add(posture.Child);
                        }
                    }
                    foreach (Sim sim2 in list)
                    {
                        inst.AddFollower(sim2);
                    }
                }
                else if (list.Count > 0)
                {
                    inst.AddFollower(list[0]);
                }
            }
            bool  flag   = false;
            Route item   = null;
            Sim   parent = null;

            if (a.IsInRidingPosture)
            {
                if (a.Parent is Sim)
                {
                    parent = a.Parent as Sim;
                }
                item = parent.CreateRoute();
                item.ExecutionFromNonSimTaskIsSafe = true;
            }
            else
            {
                item = a.CreateRoute();
            }
            bool flag2 = false;
            int  kRouteAttemptsToEnterRabbitHole = RabbitHole.kRouteAttemptsToEnterRabbitHole;
            Slot slotToUse = Slot.None;

            while ((kRouteAttemptsToEnterRabbitHole > 0) && !flag2)
            {
                kRouteAttemptsToEnterRabbitHole--;
                try
                {
                    Target.RabbitHoleProxy.ActiveEntryRoutes.Add(item);
                    if (playRouteFailure)
                    {
                        item.DoRouteFail = kRouteAttemptsToEnterRabbitHole == 0;
                    }
                    item.SetOption(Route.RouteOption.EnablePlanningAsCar, canUseCar);
                    if (Target.mGuid == RabbitHoleType.Subway)
                    {
                        item.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
                    }
                    if (Target.mGuid == RabbitHoleType.HoverTrainStation)
                    {
                        item.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, false);
                    }
                    item.SetRouteMetaType(routeMetaType);
                    foreach (Slot slot2 in Target.RabbitHoleProxy.EnterSlots)
                    {
                        item.AddObjectToIgnoreForRoute(Target.RabbitHoleProxy.SlotToSlotInfo[slot2].Footprint.ObjectId);
                    }
                    foreach (Slot slot3 in Target.RabbitHoleProxy.MountedEnterSlots)
                    {
                        item.AddObjectToIgnoreForRoute(Target.RabbitHoleProxy.SlotToSlotInfo[slot3].Footprint.ObjectId);
                    }
                    item.PlanToSlot(Target.RabbitHoleProxy, (a.IsInRidingPosture ? Target.RabbitHoleProxy.MountedEnterSlots : Target.RabbitHoleProxy.EnterSlots).ToArray());
                    if (!item.PlanResult.Succeeded())
                    {
                        item.DoRouteFail = playRouteFailure;
                        if (a.IsInRidingPosture)
                        {
                            return(parent.DoRoute(item));
                        }
                        return(a.DoRoute(item));
                    }
                    slotToUse = (Slot)item.PlanResult.mDestSlotNameHash;

                    // Slot Reassignment
                    if ((Target.RabbitHoleProxy.EnterSlots.Count > 1) && (Target.RabbitHoleProxy.EnterSlots.Count <= 5))
                    {
                        slotToUse = ReassignSlot(Target.RabbitHoleProxy.EnterSlots.Count);
                    }
                    List <Sim> followers = (inst == null) ? null : inst.SimFollowers;
                    if ((!flag && (followers != null)) && ((followers.Count > 1) || ((followers.Count == 1) && (followers[0].Posture.Container != a))))
                    {
                        //if (RouteOutside(a, followers, this.RabbitHoleProxy.EnterSlots[0x0], false, true, true, false))
                        if (Target.RouteOutside(a, followers, Target.RabbitHoleProxy.EnterSlots[0], false, true, true, false))
                        {
                            flag  = true;
                            flag2 = true;
                        }
                    }
                    else
                    {
                        //flag2 = RouteOutside(a, followers, none, false, true, false, false);
                        flag2 = Target.RouteOutside(a, followers, slotToUse, false, true, false, false);
                    }
                    if (!flag2 && (kRouteAttemptsToEnterRabbitHole > 0))
                    {
                        if (IntroTutorial.TutorialSim == a)
                        {
                            break;
                        }
                        a.RemoveExitReason(ExitReason.RouteFailed);
                        if (a.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                        {
                            break;
                        }
                        a.LoopIdle();
                        Simulator.Sleep((uint)SimClock.ConvertToTicks(RandomUtil.GetFloat(RabbitHole.kMinSimMinutesToSleepOnFailedRouteAttempt, RabbitHole.kMaxSimMinutesToSleepOnFailedRouteAttempt), TimeUnit.Minutes));
                    }
                    continue;
                }
                finally
                {
                    Target.RabbitHoleProxy.ActiveEntryRoutes.Remove(item);
                }
            }
            item = null;
            if (((a.ExitReason & ExitReason.HigherPriorityNext) == ExitReason.None) && ((a.ExitReason & ExitReason.UserCanceled) == ExitReason.None))
            {
                if (flag2)
                {
                    RabbitHole.NumSuccess++;
                }
                else
                {
                    RabbitHole.NumFail++;
                }
            }
            if (!flag2)
            {
                return(flag2);
            }
            if ((beforeEntering != null) && !beforeEntering())
            {
                List <Sim> simFollowers = null;
                if (inst != null)
                {
                    simFollowers = inst.SimFollowers;
                }
                //RouteOutside(a, simFollowers, RandomUtil.GetRandomObjectFromList<Slot>(a.IsInRidingPosture ? this.RabbitHoleProxy.MountedEnterSlots : this.RabbitHoleProxy.EnterSlots), false, false, true, true);
                Target.RouteOutside(a, simFollowers, RandomUtil.GetRandomObjectFromList <Slot>(a.IsInRidingPosture ? Target.RabbitHoleProxy.MountedEnterSlots : Target.RabbitHoleProxy.EnterSlots), false, false, true, true);
                return(false);
            }
            LeadingHorsePosture posture2 = a.Posture as LeadingHorsePosture;

            if (posture2 != null)
            {
                Sim container = posture2.Container as Sim;
                LeadingHorsePosture.ReleaseHorseFromLeadingPosture(a, container, false);
                Target.AnimateEnterRabbitHole(a, slotToUse, true, routeMetaType);
                Target.AnimateEnterRabbitHole(container, slotToUse, true, routeMetaType);
                return(flag2);
            }
            return(Target.AnimateEnterRabbitHole(a, slotToUse, true, routeMetaType));
        }
        // replaces the method from RabbitHole class - identical except for new slot reassignment code
        public bool RouteNearEntranceAndEnterRabbitHole(Sim a, RabbitHole.IRabbitHoleFollowers inst, RabbitHole.BeforeEnteringRabbitHoleDelegate beforeEntering, bool canUseCar, Route.RouteMetaType routeMetaType, bool playRouteFailure)
        {
            if ((Target.RabbitHoleProxy.EnterSlots.Count == 0) || (Target.RabbitHoleProxy.ExitSlots.Count == 0))
            {
                return false;
            }
            if (a.IsInRidingPosture && ((Target.RabbitHoleProxy.MountedEnterSlots.Count == 0) || (Target.RabbitHoleProxy.MountedExitSlots.Count == 0)))
            {
                return false;
            }
            List<Sim> list = new List<Sim>();
            CarryingChildPosture posture = a.Posture as CarryingChildPosture;
            if (posture != null)
            {
                list.Add(posture.Child);
            }
            if (inst != null)
            {
                if (inst.SimFollowers != null)
                {
                    foreach (Sim sim in inst.SimFollowers)
                    {
                        posture = sim.Posture as CarryingChildPosture;
                        if (posture != null)
                        {
                            list.Add(posture.Child);
                        }
                    }
                    foreach (Sim sim2 in list)
                    {
                        inst.AddFollower(sim2);
                    }
                }
                else if (list.Count > 0)
                {
                    inst.AddFollower(list[0]);
                }
            }
            bool flag = false;
            Route item = null;
            Sim parent = null;
            if (a.IsInRidingPosture)
            {
                if (a.Parent is Sim)
                {
                    parent = a.Parent as Sim;
                }
                item = parent.CreateRoute();
                item.ExecutionFromNonSimTaskIsSafe = true;
            }
            else
            {
                item = a.CreateRoute();
            }
            bool flag2 = false;
            int kRouteAttemptsToEnterRabbitHole = RabbitHole.kRouteAttemptsToEnterRabbitHole;
            Slot slotToUse = Slot.None;
            while ((kRouteAttemptsToEnterRabbitHole > 0) && !flag2)
            {
                kRouteAttemptsToEnterRabbitHole--;
                try
                {
                    Target.RabbitHoleProxy.ActiveEntryRoutes.Add(item);
                    if (playRouteFailure)
                    {
                        item.DoRouteFail = kRouteAttemptsToEnterRabbitHole == 0;
                    }
                    item.SetOption(Route.RouteOption.EnablePlanningAsCar, canUseCar);
                    if (Target.mGuid == RabbitHoleType.Subway)
                    {
                        item.SetOption(Route.RouteOption.EnableSubwayPlanning, false);
                    }
                    if (Target.mGuid == RabbitHoleType.HoverTrainStation)
                    {
                        item.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, false);
                    }
                    item.SetRouteMetaType(routeMetaType);
                    foreach (Slot slot2 in Target.RabbitHoleProxy.EnterSlots)
                    {
                        item.AddObjectToIgnoreForRoute(Target.RabbitHoleProxy.SlotToSlotInfo[slot2].Footprint.ObjectId);
                    }
                    foreach (Slot slot3 in Target.RabbitHoleProxy.MountedEnterSlots)
                    {
                        item.AddObjectToIgnoreForRoute(Target.RabbitHoleProxy.SlotToSlotInfo[slot3].Footprint.ObjectId);
                    }
                    item.PlanToSlot(Target.RabbitHoleProxy, (a.IsInRidingPosture ? Target.RabbitHoleProxy.MountedEnterSlots : Target.RabbitHoleProxy.EnterSlots).ToArray());
                    if (!item.PlanResult.Succeeded())
                    {
                        item.DoRouteFail = playRouteFailure;
                        if (a.IsInRidingPosture)
                        {
                            return parent.DoRoute(item);
                        }
                        return a.DoRoute(item);
                    }
                    slotToUse = (Slot)item.PlanResult.mDestSlotNameHash;

                    // Slot Reassignment
                    if ((Target.RabbitHoleProxy.EnterSlots.Count > 1) && (Target.RabbitHoleProxy.EnterSlots.Count <= 5))
                    {
                        slotToUse = ReassignSlot(Target.RabbitHoleProxy.EnterSlots.Count);
                    }
                    List<Sim> followers = (inst == null) ? null : inst.SimFollowers;
                    if ((!flag && (followers != null)) && ((followers.Count > 1) || ((followers.Count == 1) && (followers[0].Posture.Container != a))))
                    {
                        //if (RouteOutside(a, followers, this.RabbitHoleProxy.EnterSlots[0x0], false, true, true, false))
                        if (Target.RouteOutside(a, followers, Target.RabbitHoleProxy.EnterSlots[0], false, true, true, false))
                        {
                            flag = true;
                            flag2 = true;
                        }
                    }
                    else
                    {
                        //flag2 = RouteOutside(a, followers, none, false, true, false, false);
                        flag2 = Target.RouteOutside(a, followers, slotToUse, false, true, false, false);
                    }
                    if (!flag2 && (kRouteAttemptsToEnterRabbitHole > 0))
                    {
                        if (IntroTutorial.TutorialSim == a)
                        {
                            break;
                        }
                        a.RemoveExitReason(ExitReason.RouteFailed);
                        if (a.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                        {
                            break;
                        }
                        a.LoopIdle();
                        Simulator.Sleep((uint)SimClock.ConvertToTicks(RandomUtil.GetFloat(RabbitHole.kMinSimMinutesToSleepOnFailedRouteAttempt, RabbitHole.kMaxSimMinutesToSleepOnFailedRouteAttempt), TimeUnit.Minutes));
                    }
                    continue;
                }
                finally
                {
                    Target.RabbitHoleProxy.ActiveEntryRoutes.Remove(item);
                }
            }
            item = null;
            if (((a.ExitReason & ExitReason.HigherPriorityNext) == ExitReason.None) && ((a.ExitReason & ExitReason.UserCanceled) == ExitReason.None))
            {
                if (flag2)
                {
                    RabbitHole.NumSuccess++;
                }
                else
                {
                    RabbitHole.NumFail++;
                }
            }
            if (!flag2)
            {
                return flag2;
            }
            if ((beforeEntering != null) && !beforeEntering())
            {
                List<Sim> simFollowers = null;
                if (inst != null)
                {
                    simFollowers = inst.SimFollowers;
                }
                //RouteOutside(a, simFollowers, RandomUtil.GetRandomObjectFromList<Slot>(a.IsInRidingPosture ? this.RabbitHoleProxy.MountedEnterSlots : this.RabbitHoleProxy.EnterSlots), false, false, true, true);
                Target.RouteOutside(a, simFollowers, RandomUtil.GetRandomObjectFromList<Slot>(a.IsInRidingPosture ? Target.RabbitHoleProxy.MountedEnterSlots : Target.RabbitHoleProxy.EnterSlots), false, false, true, true);
                return false;
            }
            LeadingHorsePosture posture2 = a.Posture as LeadingHorsePosture;
            if (posture2 != null)
            {
                Sim container = posture2.Container as Sim;
                LeadingHorsePosture.ReleaseHorseFromLeadingPosture(a, container, false);
                Target.AnimateEnterRabbitHole(a, slotToUse, true, routeMetaType);
                Target.AnimateEnterRabbitHole(container, slotToUse, true, routeMetaType);
                return flag2;
            }
            return Target.AnimateEnterRabbitHole(a, slotToUse, true, routeMetaType);
        }