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); }
protected void AttemptToGiveATipEx() { PerformanceCareer.PerformerPerformForTips currentInteraction = Target.CurrentInteraction as PerformanceCareer.PerformerPerformForTips; if (currentInteraction != null) { bool flag = false; if (Actor.HasExitReason(ExitReason.Finished)) { flag = true; Actor.ClearExitReasons(); } if (GiveTip(currentInteraction, Actor, Target)) { mTippingStatus = Tipping.HasTipped; } if (flag) { Actor.AddExitReason(ExitReason.Finished); } } }
public override bool Run() { try { PerformanceCareer occupationAsPerformanceCareer = Target.OccupationAsPerformanceCareer; if (occupationAsPerformanceCareer != null) { if (!RouteToWatch()) { return(false); } if (!occupationAsPerformanceCareer.PlayingForTips) { return(false); } PerformanceCareer.PerformerPerformForTips currentInteraction = Target.CurrentInteraction as PerformanceCareer.PerformerPerformForTips; if (currentInteraction == null) { return(false); } LowerPriority(); if (currentInteraction.IsPerforming()) { AddEventListeners(); StandardEntry(false); BeginCommodityUpdates(); EnterStateMachine("GenericWatch", "Enter", "x"); AnimateSim("NeutralWatchLoop"); mFriendGainAlarm = Target.AddAlarmRepeating(occupationAsPerformanceCareer.Tuning.MinutesForLikingGain, TimeUnit.Minutes, new AlarmTimerCallback(GainFriendly), occupationAsPerformanceCareer.Tuning.MinutesForLikingGain, TimeUnit.Minutes, "Friendship Gain for Watch Perform for Tips", AlarmType.AlwaysPersisted); bool succeeded = false; mTipChancePerCheck = occupationAsPerformanceCareer.Tuning.ChanceOfTipPerCareerLevel[occupationAsPerformanceCareer.CareerLevel]; foreach (TraitNames names in occupationAsPerformanceCareer.Tuning.TraitsLessLikelyToTip) { if (Actor.TraitManager.HasElement(names)) { mTipChancePerCheck *= occupationAsPerformanceCareer.Tuning.LessLikelyToTipMultiplier; } } foreach (TraitNames names2 in occupationAsPerformanceCareer.Tuning.TraitsMoreLikelyToTip) { if (Actor.TraitManager.HasElement(names2)) { mTipChancePerCheck *= occupationAsPerformanceCareer.Tuning.MoreLikelyToTipMultiplier; } } mShouldReactNow = false; mItsAGoodTimeToTip = false; mGoalTimeToTestTip = occupationAsPerformanceCareer.Tuning.TimePerTipTest; succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), WatchLoopEx, mCurrentStateMachine); if (mTippingStatus == Tipping.WillTip) { // Custom AttemptToGiveATipEx(); } AnimateSim("Exit"); EndCommodityUpdates(succeeded); StandardExit(false); return(succeeded); } } return(false); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }