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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #4
0
        public bool RouteToMirror(Sim s, float radius, Mirror obj)
        {
            RadialRangeDestination destination = new RadialRangeDestination();

            destination.mTargetObject     = obj;
            destination.mCenterPoint      = obj.Position;
            destination.mfMinRadius       = radius;
            destination.mfMaxRadius       = radius;
            destination.mConeVector       = obj.ForwardVector;
            destination.mfConeAngle       = MathUtils.Degree2Radian(0.5f);
            destination.mFacingPreference = RouteOrientationPreference.TowardsObject;
            Route r = s.CreateRoute();

            r.SetValidRooms(obj.LotCurrent.LotId, new int[] { obj.RoomId });
            r.SetOption(Route.RouteOption.DoLineOfSightCheckUserOverride, true);
            r.AddDestination(destination);
            r.Plan();
            return(s.DoRoute(r));
        }
Exemple #5
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);
        }
Exemple #7
0
        public static bool IsPointInLotSafelyRoutable(Sim ths, Lot lot, Vector3 pos)
        {
            if ((lot == null) || (lot.Corners == null))
            {
                return(false);
            }

            if (pos.IsSimilarTo(Vector3.Zero) || pos.IsSimilarTo(Vector3.OutOfWorld))
            {
                return(false);
            }

            LotLocation invalid     = LotLocation.Invalid;
            ulong       lotLocation = World.GetLotLocation(pos, ref invalid);

            if (!lot.IsWorldLot && (lotLocation != lot.LotId))
            {
                return(false);
            }

            TerrainType terrainType = World.GetTerrainType(pos);

            switch (terrainType)
            {
            case TerrainType.WorldSea:
            case TerrainType.WorldPond:
            case TerrainType.LotPool:
            case TerrainType.LotPond:
                return(false);
            }

            if (!lot.IsWorldLot)
            {
                // Custom
                Route route = SimRoutingComponentEx.CreateRouteAsAdult(ths.SimRoutingComponent);
                route.SetOption(Route.RouteOption.EnableWaterPlanning, ths.IsHuman);
                float num2 = 1f;
                if (lot.IsHouseboatLot())
                {
                    num2++;
                }

                for (int i = 0x0; i < 0x4; i++)
                {
                    RadialRangeDestination destination = new RadialRangeDestination();
                    destination.mCenterPoint = lot.Corners[i];
                    destination.mfMinRadius  = 0f;
                    destination.mfMaxRadius  = num2;
                    route.AddDestination(destination);
                    destination = new RadialRangeDestination();
                    int num4 = (i + 0x1) % 0x4;
                    destination.mCenterPoint = (Vector3)((lot.Corners[i] + lot.Corners[num4]) * 0.5f);
                    destination.mfMinRadius  = 0f;
                    destination.mfMaxRadius  = num2;
                    route.AddDestination(destination);
                }

                route.PlanFromPoint(pos);
                if (route.PlanResult.mType != RoutePlanResultType.Succeeded)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #8
0
        public static bool IsPointInLotSafelyRoutable(Sim ths, Lot lot, Vector3 pos)
        {
            if ((lot == null) || (lot.Corners == null))
            {
                return false;
            }

            if (pos.IsSimilarTo(Vector3.Zero) || pos.IsSimilarTo(Vector3.OutOfWorld))
            {
                return false;
            }

            LotLocation invalid = LotLocation.Invalid;
            ulong lotLocation = World.GetLotLocation(pos, ref invalid);
            if (!lot.IsWorldLot && (lotLocation != lot.LotId))
            {
                return false;
            }

            TerrainType terrainType = World.GetTerrainType(pos);
            switch (terrainType)
            {
                case TerrainType.WorldSea:
                case TerrainType.WorldPond:
                case TerrainType.LotPool:
                case TerrainType.LotPond:
                    return false;
            }

            if (!lot.IsWorldLot)
            {
                // Custom
                Route route = SimRoutingComponentEx.CreateRouteAsAdult(ths.SimRoutingComponent);
                route.SetOption(Route.RouteOption.EnableWaterPlanning, ths.IsHuman);
                float num2 = 1f;
                if (lot.IsHouseboatLot())
                {
                    num2++;
                }

                for (int i = 0x0; i < 0x4; i++)
                {
                    RadialRangeDestination destination = new RadialRangeDestination();
                    destination.mCenterPoint = lot.Corners[i];
                    destination.mfMinRadius = 0f;
                    destination.mfMaxRadius = num2;
                    route.AddDestination(destination);
                    destination = new RadialRangeDestination();
                    int num4 = (i + 0x1) % 0x4;
                    destination.mCenterPoint = (Vector3)((lot.Corners[i] + lot.Corners[num4]) * 0.5f);
                    destination.mfMinRadius = 0f;
                    destination.mfMaxRadius = num2;
                    route.AddDestination(destination);
                }

                route.PlanFromPoint(pos);
                if (route.PlanResult.mType != RoutePlanResultType.Succeeded)
                {
                    return false;
                }
            }
            return true;
        }
Exemple #9
0
        public override bool Run()
        {
            EventListener listener = null;

            if (listeners.TryGetValue(Actor.FullName, out listener))
            {
                if (EventTracker.ContainsListener(listener))
                {
                    EventTracker.RemoveListener(listener);
                }
                listeners.Remove(Actor.FullName);
            }

            listener = EventTracker.AddListener(EventTypeId.kMixedDrink, new ProcessEventDelegate(TendHomeBar.OnDrinkOrdered), this.Actor);
            listeners.Add(Actor.FullName, listener);


            //AddNeededSkills(this.Actor);
            MakeBusinessBar.EnableBarInteractions(Target);
            Sim  mBartender = this.Target.mBartender;
            bool flag       = false;

            if (this.Target.IsBartenderReplacement())
            {
                flag = true;
            }
            //if (!Bartending.IsSimAllowedToBartend(this.Actor, this.Target.LotCurrent.GetMetaAutonomyType))
            //{
            //    ObjectGuid thumbnailObject = ObjectGuid.InvalidObjectGuid;
            //    StyledNotification.NotificationStyle style = StyledNotification.NotificationStyle.kGameMessagePositive;
            //    if (mBartender != null)
            //    {
            //        thumbnailObject = mBartender.ObjectId;
            //        style = StyledNotification.NotificationStyle.kSimTalking;
            //    }
            //    this.Actor.ShowTNSIfSelectable(BarProfessional.LocalizeString(this.Actor.IsFemale, "BarTendHomeBarTakeOverFail", new object[0]), style, thumbnailObject, this.Actor.ObjectId);
            //    return false;
            //}
            if (flag)
            {
                RadialRangeDestination radialRangeDestination = new RadialRangeDestination();
                radialRangeDestination.mCenterPoint      = this.Target.GetPositionOfSlot(Slot.RoutingSlot_0);
                radialRangeDestination.mfConeAngle       = BarProfessional.Tend.kRouteToReplaceAngle;
                radialRangeDestination.mConeVector       = -this.Target.GetForwardOfSlot(Slot.RoutingSlot_0);
                radialRangeDestination.mfMinRadius       = BarProfessional.Tend.kRouteToReplaceRadiusMinimum;
                radialRangeDestination.mfMaxRadius       = BarProfessional.Tend.kRouteToReplaceRadiusMaximum;
                radialRangeDestination.mfPreferredRadius = BarProfessional.Tend.kRouteToReplaceRadiusPreferred;
                radialRangeDestination.mTargetObject     = this.Target;
                radialRangeDestination.mFacingPreference = RouteOrientationPreference.TowardsObject;
                Route route = this.Actor.CreateRoute();
                route.AddDestination(radialRangeDestination);
                route.SetValidRooms(this.Target.LotCurrent.LotId, new int[]
                {
                    this.Target.RoomId
                });
                route.Plan();
                if (!this.Actor.DoRoute(route))
                {
                    return(false);
                }
            }
            else
            {
                if (!this.Target.RouteToBarAsBartender(this.Actor))
                {
                    return(false);
                }
            }
            if (!this.Test())
            {
                this.Actor.RouteAway(BarProfessional.Tend.kRouteAwayDistanceMinimum, BarProfessional.Tend.kRouteAwayDistanceMaximum, false, base.GetPriority(), false, false, true, RouteDistancePreference.NoPreference);
                return(false);
            }
            if (flag)
            {
                this.Actor.LoopIdle();
                while (mBartender.CurrentInteraction != null && !(mBartender.CurrentInteraction is BarProfessional.IdleTend))
                {
                    Simulator.Sleep(0u);
                    if (this.Actor.HasExitReason())
                    {
                        return(false);
                    }
                }
                this.Actor.ShowTNSIfSelectable(BarProfessional.LocalizeString(this.Actor.IsFemale, "BarTendHomeBarTakeOver", new object[]
                {
                    this.Actor
                }), StyledNotification.NotificationStyle.kSimTalking, mBartender.ObjectId, this.Actor.ObjectId);
                this.Target.mBartender = this.Actor;
                mBartender.InteractionQueue.CancelAllInteractions();
                mBartender.RouteAway(BarProfessional.Tend.kRouteAwayDistanceMinimum, BarProfessional.Tend.kRouteAwayDistanceMaximum, false, base.GetPriority(), false, false, true, RouteDistancePreference.NoPreference);
            }
            bool hasSwitchedIntoBarTendHomeBarerOutfit = false;

            this.Actor.Posture      = new BarProfessional.TendingPosture(this.Actor, this.Target, hasSwitchedIntoBarTendHomeBarerOutfit);
            this.Actor.BridgeOrigin = this.Actor.Posture.Idle();
            InteractionInstance continuation = BarProfessional.IdleTend.Singleton.CreateInstance(this.Target, this.Actor, base.GetPriority(), true, true);

            return(base.TryPushAsContinuation(continuation));
        }