Example #1
0
        public static int GetCareerPay(Sim sim, SkillNames skill)
        {
            SkillBasedCareer career = GetSkillBasedCareer(sim, skill);

            if (career == null)
            {
                return(0);
            }

            SkillBasedCareerStaticData skillData = career.GetOccupationStaticDataForSkillBasedCareer();

            if (skillData == null)
            {
                return(0);
            }

            OccupationLevelStaticData genericData;

            if (!skillData.LevelStaticDataMap.TryGetValue(career.CareerLevel, out genericData))
            {
                return(0);
            }

            XpBasedCareerLevelStaticData data = genericData as XpBasedCareerLevelStaticData;

            if (data == null)
            {
                return(0);
            }

            if (data.Rewards.Length == 0)
            {
                return(0);
            }

            int cash = 0;

            foreach (XpBasedCareerReward reward in data.Rewards)
            {
                if (reward.Token == XpBasedCareerRewardType.Cash)
                {
                    cash += int.Parse(reward.Value);
                }
            }

            return(cash);
        }
Example #2
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);
        }