Exemplo n.º 1
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            PerformanceCareer performer = me.OccupationAsPerformanceCareer;

            if (performer != null)
            {
                //me.OccupationAsPerformanceCareer.GivePerformerName (me.CreatedSim, false);
                string text2;
                if (string.IsNullOrEmpty(performer.StageName))
                {
                    string localizedString = StringTable.GetLocalizedString((!me.IsFemale) ? (performer.MaleGivenNameKeyBase + RandomUtil.GetInt(performer.GetNumberOfMaleGivenNames - 1).ToString()) : (performer.FemaleGivenNameKeyBase + RandomUtil.GetInt(performer.GetNumberFemaleGivenNames - 1).ToString()));
                    string text            = Common.LocalizeEAString(me.IsFemale, performer.FamilyNameKeyBase + RandomUtil.GetInt(performer.GetNumberOfFamilyNames - 1).ToString());
                    if (StringTable.GetLocale() == "ja-jp")
                    {
                        text2 = text + " " + localizedString;
                    }
                    else
                    {
                        text2 = localizedString + " " + text;
                    }
                }
                else
                {
                    text2 = performer.StageName;
                }
                string text3 = StringInputDialogRandom.Show(Common.LocalizeEAString("Ui/CreateNameUI:Title"), me.FullName + " (" + performer.CareerName + ")", text2, 27, StringInputDialog.Validation.TextOnly, false, new StringInputDialogRandom.RandomDelegate(performer.GetRandomStageName));
                if (!string.IsNullOrEmpty(text3))
                {
                    me.OccupationAsPerformanceCareer.StageName = text3;
                    me.CareerManager.UpdateCareerUI();
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
            public override void AddInteractions(InteractionObjectPair iop, Sim actor, Sim target, List <InteractionObjectPair> results)
            {
                PerformanceCareer occupationAsPerformanceCareer = actor.OccupationAsPerformanceCareer;

                if (((occupationAsPerformanceCareer != null) && target.SimDescription.HasActiveRole) && (target.SimDescription.AssignedRole.Type == Role.RoleType.Proprietor))
                {
                    results.Add(new InteractionObjectPair(new SolicitGigEx.Definition(occupationAsPerformanceCareer.SocializationTextSolicitJob, new string[0], false), iop.Target));
                }
            }
Exemplo n.º 3
0
        protected void WatchLoopEx(StateMachineClient smc, InteractionInstance.LoopData ld)
        {
            try
            {
                PerformanceCareer occupationAsPerformanceCareer = Target.OccupationAsPerformanceCareer;
                if (occupationAsPerformanceCareer == null)
                {
                    return;
                }

                int mLifeTime = (int)ld.mLifeTime;
                if ((Actor.IsNPC && (mTippingStatus == Tipping.NoTip)) && (mLifeTime > mGoalTimeToTestTip))
                {
                    if (RandomUtil.RandomChance01(mTipChancePerCheck))
                    {
                        mTippingStatus = Tipping.WillTip;
                    }
                    mGoalTimeToTestTip = mLifeTime + occupationAsPerformanceCareer.Tuning.TimePerTipTest;
                }

                if (mShouldReactNow)
                {
                    ReactToPerformance();
                    mShouldReactNow = false;
                }

                if (mItsAGoodTimeToTip)
                {
                    if (mTippingStatus == Tipping.WillTip)
                    {
                        Vector3 position = Actor.Position;

                        // Custom
                        AttemptToGiveATipEx();

                        RouteBackToViewingPosition(position);
                    }
                    mItsAGoodTimeToTip = false;
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupGigs");

            foreach (SimDescription sim in Household.EverySimDescription())
            {
                PerformanceCareer career = sim.OccupationAsPerformanceCareer;
                if (career == null)
                {
                    continue;
                }

                if (career.mSteadyGigs == null)
                {
                    career.mSteadyGigs = new List <SteadyGig>();

                    Overwatch.Log(" Missing GigList Added: " + sim.FullName);
                }

                for (int i = career.mSteadyGigs.Count - 1; i >= 0; i--)
                {
                    SteadyGig gig = career.mSteadyGigs[i];
                    if (gig == null)
                    {
                        career.mSteadyGigs.RemoveAt(i);

                        Overwatch.Log(" Null Gig removed: " + sim.FullName);
                    }
                    else if (gig.Venue == null)
                    {
                        career.mSteadyGigs.RemoveAt(i);

                        Overwatch.Log(" No Venue Gig removed: " + sim.FullName);
                    }
                    else if (MiniSimDescription.Find(gig.ProprietorId) == null)
                    {
                        career.mSteadyGigs.RemoveAt(i);

                        Overwatch.Log(" No Proprietor Gig removed: " + sim.FullName);
                    }
                }
            }
        }
Exemplo n.º 6
0
            public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (((a == target) || !target.SimDescription.TeenOrAbove) || target.IsSleeping)
                {
                    return(false);
                }
                if ((target.Posture is SwimmingInPool) || (a.Posture is SwimmingInPool))
                {
                    return(false);
                }
                PerformanceCareer occupationAsPerformanceCareer = a.CareerManager.OccupationAsPerformanceCareer;

                if (occupationAsPerformanceCareer == null)
                {
                    return(false);
                }
                if (!occupationAsPerformanceCareer.CanSolicitGig() || !target.LotCurrent.CanScheduleAnotherGigOnLot())
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Sim.LocalizeString("FullyBooked", new object[0]));
                    return(false);
                }
                if (occupationAsPerformanceCareer.HasGigScheduledAtVenue(target.LotCurrent) || (occupationAsPerformanceCareer.TryToGetSteadyGigOwnedBySim(target) != null))
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Sim.LocalizeString("AlreadyHaveGig", new object[0]));
                    return(false);
                }
                if (!occupationAsPerformanceCareer.DoesClientAcceptSolicitation(target))
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Sim.LocalizeString("SolicitedTooRecently", new object[0]));
                    return(false);
                }
                if (target.SimDescription.HasActiveRole)
                {
                    Proprietor assignedRole = target.SimDescription.AssignedRole as Proprietor;
                    if ((assignedRole != null) && !assignedRole.HasArrivedAtTargetLot())
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Sim.LocalizeString("ProprietorHasNotArrived", new object[0]));
                        return(false);
                    }
                }
                if (!occupationAsPerformanceCareer.CanSimBeSolicited(target))
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Sim.LocalizeString("LevelTooLowToSolicit", new object[0]));
                    return(false);
                }

                /*
                 * if (a.SimDescription.IsVisuallyPregnant)
                 * {
                 *  greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Sim.LocalizeString("CantDoGigsWhilePregnant", new object[0]));
                 *  return false;
                 * }
                 */
                if (target.SimDescription.HasActiveRole)
                {
                    Proprietor proprietor2 = target.SimDescription.AssignedRole as Proprietor;
                    if ((proprietor2 != null) && proprietor2.IsInSimFest())
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Sim.LocalizeString("ProprietorBusy", new object[0]));
                        return(false);
                    }
                }
                if (!IUtil.IsPass(SocialInteractionA.Definition.CanSocializeWith("Solicit Gig", a, target, isAutonomous, ref greyedOutTooltipCallback)))
                {
                    greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Sim.LocalizeString("LTRTooLowToSolicit", new object[0]));
                    return(false);
                }
                return(true);
            }
Exemplo n.º 7
0
        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);
            }
        }