Exemplo n.º 1
0
        public static float GetPerformance(SimDescription me)
        {
            if (me.Occupation == null)
            {
                return(0);
            }

            AcademicCareer academic = me.Occupation as AcademicCareer;

            if (academic != null)
            {
                return(me.Occupation.Performance);
            }
            else
            {
                XpBasedCareer xpCareer = me.Occupation as XpBasedCareer;
                if (xpCareer != null)
                {
                    return(me.Occupation.Performance * 100);
                }
                else
                {
                    return(me.Occupation.Performance);
                }
            }
        }
Exemplo n.º 2
0
 protected override void SetValue(SimDescription me, float value)
 {
     Sims3.Gameplay.Careers.Career career = me.Occupation as Sims3.Gameplay.Careers.Career;
     if (career != null)
     {
         career.mPerformance = value;
     }
     else
     {
         AcademicCareer academicCareer = me.OccupationAsAcademicCareer;
         if (academicCareer != null)
         {
             if (me.CreatedSim != null)
             {
                 me.CreatedSim.Motives.SetValue(CommodityKind.AcademicPerformance, value);
             }
         }
         else
         {
             XpBasedCareer xpCareer = me.Occupation as XpBasedCareer;
             if (xpCareer != null)
             {
                 xpCareer.mXp = (value / 100f) * xpCareer.GetCurrentLevelGoalXp();
             }
         }
     }
 }
Exemplo n.º 3
0
        protected static string GetText(Occupation occupation)
        {
            if (occupation is Retired)
            {
                return(null);
            }

            Career career = occupation as Career;

            if (career != null)
            {
                if (career.CurLevel == null)
                {
                    return(null);
                }

                if (occupation.CareerLoc == null)
                {
                    return(null);
                }

                if (occupation.CareerLoc.Owner == null)
                {
                    return(null);
                }

                DaysOfTheWeek nextWorkDay = career.CurLevel.GetNextWorkDay(SimClock.CurrentDayOfWeek);
                string        entryKey    = (occupation is School) ? "Gameplay/Careers/Career:FirstSchoolDayDetails" : "Gameplay/Careers/Career:FirstDayDetails";

                string text = Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, entryKey, new object[] { occupation.OwnerDescription, occupation.CareerLoc.Owner.CatalogName, SimClockUtils.GetText(career.CurLevel.StartTime), SimClockUtils.GetDayAsText(nextWorkDay) });
                if (occupation.Boss != null)
                {
                    text += Common.NewLine + Common.NewLine + Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, "Gameplay/Careers:MetBoss", new object[] { occupation.OwnerDescription, occupation.Boss });
                }

                return(text);
            }
            else
            {
                XpBasedCareer xpCareer = occupation as XpBasedCareer;
                if (xpCareer != null)
                {
                    return(PromotedScenario.GenerateXPBasedLevelUp(xpCareer));
                }
            }

            return(null);
        }
Exemplo n.º 4
0
        public static string GenerateXPBasedLevelUp(XpBasedCareer ths)
        {
            XpBasedCareerLevelStaticData currentLevelStaticDataForXpBasedCareer = ths.GetCurrentLevelStaticDataForXpBasedCareer();

            if (currentLevelStaticDataForXpBasedCareer != null)
            {
                StringBuilder stringBuilder = new StringBuilder();
                if (ths.mLevel == 0x1)
                {
                    string occupationJoiningTnsTextPrefix = ths.GetOccupationJoiningTnsTextPrefix();
                    if (!string.IsNullOrEmpty(occupationJoiningTnsTextPrefix))
                    {
                        stringBuilder.Append(occupationJoiningTnsTextPrefix);
                    }
                }
                else if (ths.mLevel > 0x1)
                {
                    stringBuilder.Append(Common.LocalizeEAString(ths.OwnerDescription.IsFemale, "Gameplay/Excel/ActiveCareers/CareerLevels:PromotionTextBaseNew", new object[] { ths.OwnerDescription, ths.CurLevelJobTitle }));
                }
                if (ths.AppendLevelDescriptionInTns)
                {
                    ths.AppendTextForTns(ref stringBuilder, Common.LocalizeEAString(ths.OwnerDescription.IsFemale, currentLevelStaticDataForXpBasedCareer.DescriptionLocalizationKey, new object[] { ths.OwnerDescription, ths.CurLevelJobTitle }));
                }
                string rewardLocalizationKey = currentLevelStaticDataForXpBasedCareer.RewardLocalizationKey;
                if (!string.IsNullOrEmpty(rewardLocalizationKey))
                {
                    ths.AppendTextForTns(ref stringBuilder, Common.LocalizeEAString(ths.OwnerDescription.IsFemale, rewardLocalizationKey, new object[] { ths.OwnerDescription, ths.CurLevelJobTitle }));
                }
                if (ths.PayPerHourOrStipend > 0f)
                {
                    string str5 = "StipendUpdate";
                    if (((ths.StartTimeText == null) && (ths.FinishTimeText == null)) || ths.HasOpenHours)
                    {
                        str5 = "StipendUpdateNoTimes";
                    }
                    ths.AppendTextForTns(ref stringBuilder, XpBasedCareer.LocalizeString(ths.OwnerDescription.IsFemale, str5, new object[] { ths.OwnerDescription, ths.PayPerHourOrStipend, ths.StartTimeText, ths.FinishTimeText }));
                }

                return(stringBuilder.ToString());
            }

            return(null);
        }
Exemplo n.º 5
0
        protected static string GetText(Occupation occupation)
        {
            Career career = occupation as Career;

            if (career != null)
            {
                if (occupation.OwnerDescription.CreatedSim != null)
                {
                    return(career.GeneratePromotionText(0));
                }
                else
                {
                    // This is a copy of the GeneratePromotionText() sans the use of CreatedSim
                    string entryKey  = "Gameplay/Careers/Career:PromotedTextNoBonus";
                    string str2      = Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, entryKey, new object[] { occupation.OwnerDescription, career.CurLevel.GetLocalizedName(occupation.OwnerDescription), 0 }) + Common.NewLine + Common.NewLine + Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, career.CurLevel.Text_Promotion, new object[] { occupation.OwnerDescription, career.CurLevel.GetLocalizedName(occupation.OwnerDescription) });
                    string startTime = SimClockUtils.GetText(career.CurLevel.StartTime);
                    string str4      = SimClockUtils.GetText(career.CurLevel.StartTime + career.CurLevel.DayLength);
                    if (!occupation.ShowRockStarUI)
                    {
                        return(str2 + Common.NewLine + Common.NewLine + Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, "Gameplay/Careers/Career:PromotedWageUpdate", new object[] { occupation.OwnerDescription, career.PayPerHourOrStipend, startTime, str4 }));
                    }
                    else
                    {
                        return(str2 + Common.NewLine + Common.NewLine + Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, "Gameplay/Careers/Career:RockStarPromotedUpdate", new object[] { occupation.OwnerDescription }));
                    }
                }
            }
            else
            {
                XpBasedCareer xpCareer = occupation as XpBasedCareer;
                if (xpCareer != null)
                {
                    return(GenerateXPBasedLevelUp(xpCareer));
                }
            }

            return(null);
        }
Exemplo n.º 6
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            Sims3.Gameplay.Careers.Career career = me.Occupation as Sims3.Gameplay.Careers.Career;
            if (career != null)
            {
                List <CareerLevel> levels = AllLevels(career);
                if ((levels == null) || (levels.Count == 0))
                {
                    return(false);
                }

                List <Item> allOptions = new List <Item>();
                foreach (CareerLevel level in levels)
                {
                    allOptions.Add(new Item(me, level));
                }

                Item choice = new CommonSelection <Item>(Name, me.FullName, allOptions).SelectSingle();
                if (choice == null)
                {
                    return(false);
                }

                List <CareerLevel> order = null;
                if (choice.mLevel.Level < me.Occupation.CareerLevel)
                {
                    order = LevelsBetween(choice.mLevel, career.CurLevel, true);
                }
                else
                {
                    order = LevelsBetween(career.CurLevel, choice.mLevel, false);
                }

                if (order.Count == 0)
                {
                    List <CareerLevel> oldBranches = AllBranches(career.CurLevel);
                    List <CareerLevel> newBranches = AllBranches(choice.mLevel);

                    CareerLevel common = null;
                    foreach (CareerLevel branch in newBranches)
                    {
                        if (oldBranches.Contains(branch))
                        {
                            common = branch;
                            break;
                        }
                    }

                    if (common != null)
                    {
                        order.AddRange(LevelsBetween(common, career.CurLevel, true));
                        order.AddRange(LevelsBetween(common, choice.mLevel, false));
                    }
                }

                foreach (CareerLevel level in order)
                {
                    if (career.CurLevel == level)
                    {
                        continue;
                    }

                    if (career.CurLevel.LastLevel == level)
                    {
                        career.DemoteSim();
                    }
                    else
                    {
                        Promote(career, level);
                    }
                }
                return(true);
            }
            else
            {
                XpBasedCareer xpCareer = me.Occupation as XpBasedCareer;
                if (xpCareer != null)
                {
                    List <Item> allOptions = new List <Item>();
                    for (int level = 1; level <= xpCareer.HighestLevel; level++)
                    {
                        allOptions.Add(new Item(xpCareer.LevelJobTitle(level), level));
                    }

                    Item choice = new CommonSelection <Item>(Name, me.FullName, allOptions).SelectSingle();
                    if (choice == null)
                    {
                        return(false);
                    }

                    if (choice.mXPLevel < me.Occupation.CareerLevel)
                    {
                        xpCareer.mLevel = choice.mXPLevel;
                        xpCareer.mXp    = 0;
                    }
                    else
                    {
                        Dictionary <DelegateListener, ProcessEventDelegate> retain = new Dictionary <DelegateListener, ProcessEventDelegate>();

                        Dictionary <ulong, List <EventListener> > dictionary;
                        EventTracker.Instance.mListeners.TryGetValue((ulong)EventTypeId.kActiveCareerAdvanceLevel, out dictionary);

                        // Required to stop a hang when an inactive firefighter is promoted to level 10

                        if (me.Household != Household.ActiveHousehold)
                        {
                            foreach (List <EventListener> list in dictionary.Values)
                            {
                                foreach (EventListener listener in list)
                                {
                                    DelegateListener delListener = listener as DelegateListener;
                                    if (delListener != null)
                                    {
                                        RewardsManager.OccupationRewardInfo target = delListener.mProcessEvent.Target as RewardsManager.OccupationRewardInfo;
                                        if (target != null)
                                        {
                                            retain.Add(delListener, delListener.mProcessEvent);

                                            delListener.mProcessEvent = OnStub;
                                        }
                                    }
                                }
                            }
                        }

                        xpCareer.ForcePromoteToLevel(choice.mXPLevel);

                        if (me.Household != Household.ActiveHousehold)
                        {
                            foreach (List <EventListener> list in dictionary.Values)
                            {
                                foreach (EventListener listener in list)
                                {
                                    DelegateListener delListener = listener as DelegateListener;
                                    if (delListener != null)
                                    {
                                        RewardsManager.OccupationRewardInfo target = delListener.mProcessEvent.Target as RewardsManager.OccupationRewardInfo;
                                        if (target != null)
                                        {
                                            delListener.mProcessEvent = retain[delListener];
                                        }
                                    }
                                }
                            }
                        }
                    }

                    return(true);
                }
            }
            return(false);
        }