コード例 #1
0
            public override void ConfigureInteraction()
            {
                try
                {
                    mCareer = Actor.OccupationAsCareer;

                    mFinishTime = (SimClock.Hours24 + mCareer.CurLevel.DayLength) % 24;

                    InteractionIconKey = new ThumbnailKey(ResourceKey.CreatePNGKey(mCareer.DreamsAndPromisesIcon, 0x0), ThumbnailSize.Medium);
                    mCareer.SetTones(this);

                    StringDelegate delegate2;
                    if (((mCareer.LastTone != null) && mCareer.LastTone.ShouldAddTone(mCareer)) && mCareer.LastTone.Test(this, out delegate2))
                    {
                        CurrentTone = mCareer.LastTone;
                    }
                    if (mCareer.IsSpecialWorkTime)
                    {
                        TimeOfDayStage stage = new TimeOfDayStage(LocalizeString("WorkStage", new object[0x0]), mCareer.HourSpecialWorkTimeEnds, 24f);
                        Stages = new List <Stage>(new Stage[] { stage });
                    }
                    else
                    {
                        float maxDurationInHours     = (mCareer.CurLevel.DayLength + Career.kNumHoursEarlyCanShowUpForWork) + mCareer.OvertimeHours;
                        WorkInRabbitHoleStage stage2 = new WorkInRabbitHoleStage(LocalizeString("WorkEndShiftStage", new object[0x0]), mFinishTime, maxDurationInHours, mCareer);
                        Stages      = new List <Stage>(new Stage[] { stage2 });
                        ActiveStage = stage2;
                        if (Actor.TraitManager.HasElement(TraitNames.Workaholic))
                        {
                            foreach (CareerTone tone in mCareer.Tones)
                            {
                                if (tone is WorkHardTone)
                                {
                                    CurrentTone = tone;
                                    break;
                                }
                            }
                        }
                        else if (Actor.TraitManager.HasElement(TraitNames.Schmoozer))
                        {
                            foreach (CareerTone tone2 in mCareer.Tones)
                            {
                                if (tone2 is SuckUpToBossTone)
                                {
                                    CurrentTone = tone2;
                                    break;
                                }
                            }
                        }
                    }
                }
                catch (ResetException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    Common.Exception(Actor, Target, e);
                }
            }
コード例 #2
0
        private void UpdateCreditIconEx(int CreditsAwardedPerSim, CreditAwardtype creditAwardType, AcademicDegreeNames degreeName)
        {
            if (CreditsAwardedPerSim > 0x0)
            {
                mCreditIconWin.TooltipText = Responder.Instance.LocalizationModel.LocalizeString("Ui/Dialog/Enrollment:CreditToolTip" + ((int)degreeName).ToString() + ((creditAwardType <= 0x0) ? "Partial" : "Full"), new object[] { CreditsAwardedPerSim * 0x6 });
                switch (creditAwardType)
                {
                case CreditAwardtype.LowCreditAward:
                    if (PartialScholarshipCreditsIconName.ContainsKey(degreeName))
                    {
                        mCreditIconWin.SetImage(ResourceKey.CreatePNGKey(PartialScholarshipCreditsIconName[degreeName], ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)));
                    }
                    return;

                case CreditAwardtype.HighCreditAward:
                    if (FullScholarshipCreditsIconName.ContainsKey(degreeName))
                    {
                        mCreditIconWin.SetImage(ResourceKey.CreatePNGKey(FullScholarshipCreditsIconName[degreeName], ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)));
                    }
                    return;
                }
            }
            else
            {
                mCreditIconWin.SetImage(ResourceKey.kInvalidResourceKey);
                mCreditIconWin.TooltipText = Responder.Instance.LocalizationModel.LocalizeString("Ui/Dialog/Enrollment:NoCreditToolTip", new object[0x0]);
            }
        }
コード例 #3
0
ファイル: PreferenceColor.cs プロジェクト: yakoder/NRaas
            public override void SetValue(Color dataType, Color storeType)
            {
                mValue = dataType;

                mName = CASCharacter.GetFavoriteColor(dataType);

                SetThumbnail(ResourceKey.CreatePNGKey(CASCharacter.GetFavoriteColorPngName(dataType), 0x0));
            }
コード例 #4
0
ファイル: PreferenceFood.cs プロジェクト: yakoder/NRaas
            public override void SetValue(FavoriteFoodType value, FavoriteFoodType storeType)
            {
                mValue = value;

                mName = CASCharacter.GetFavoriteFood(value);

                SetThumbnail(ResourceKey.CreatePNGKey(CASCharacter.GetFavoriteFoodPngName(value), 0x0));
            }
コード例 #5
0
            public override void SetValue(Zodiac value, Zodiac storeType)
            {
                mValue = value;

                mName = Common.LocalizeEAString("Ui/Caption/HUD/KnownInfoDialog:" + value.ToString());

                SetThumbnail(ResourceKey.CreatePNGKey("sign_" + value.ToString() + "_sm", 0));
            }
コード例 #6
0
ファイル: CareerBaseOption.cs プロジェクト: yakoder/NRaas
        protected override string GetLocalizedValue(OccupationNames value, ref ThumbnailKey icon)
        {
            Occupation career = CareerManager.GetStaticOccupation(value);

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

            icon = new ThumbnailKey(ResourceKey.CreatePNGKey(career.CareerIconColored, ResourceUtils.ProductVersionToGroupId(ProductVersion.BaseGame)), ThumbnailSize.Medium);

            return(career.CareerName);
        }
コード例 #7
0
ファイル: TraitBaseOption.cs プロジェクト: yakoder/NRaas
        protected override string GetLocalizedValue(TraitNames value, ref ThumbnailKey icon)
        {
            Trait trait = TraitManager.GetTraitFromDictionary(value);

            if (trait == null)
            {
                return(null);
            }

            icon = new ThumbnailKey(ResourceKey.CreatePNGKey(trait.ThumbnailIcon, ResourceUtils.ProductVersionToGroupId(trait.ProductVersion)), ThumbnailSize.Medium);

            return(Traits.ProperName(value, false));
        }
コード例 #8
0
ファイル: SkillGainFactor.cs プロジェクト: yakoder/NRaas
        public SkillGainFactor(Skill skill)
        {
            mSkill = skill;

            if (mSkill != null)
            {
                SetThumbnail(mSkill.DreamsAndPromisesIconKey);
            }
            else
            {
                SetThumbnail(ResourceKey.CreatePNGKey("shop_all_r2", ResourceUtils.ProductVersionToGroupId(ProductVersion.BaseGame)));
            }
        }
コード例 #9
0
ファイル: WorldData.cs プロジェクト: yakoder/NRaas
 public static UIImage GetConfirmImage(int index)
 {
     if (index > sConfirmImages.Count)
     {
         if (index < 3)
         {
             return(UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[index], 0x0)));
         }
         else
         {
             return(null);
         }
     }
     else
     {
         return(sConfirmImages[index]);
     }
 }
コード例 #10
0
        protected override string GetLocalizedValue(string value, ref ThumbnailKey icon)
        {
            string[] split = value.Split('-');

            if (split.Length < 2)
            {
                split[0] = ""; // will cause TryParseEnum to fail
            }

            OccupationNames result;
            Occupation      career;

            if (!ParserFunctions.TryParseEnum <OccupationNames>(split[0], out result, OccupationNames.Undefined))
            {
                ulong guid;
                if (ulong.TryParse(split[0], out guid))
                {
                    result = (OccupationNames)guid;
                }
                else
                {
                    return(OccupationNames.Undefined + " " + EAText.GetNumberString(0));
                }
            }

            career = CareerManager.GetStaticOccupation(result);

            if (career == null)
            {
                return(OccupationNames.Undefined + " " + EAText.GetNumberString(0));
            }

            icon = new ThumbnailKey(ResourceKey.CreatePNGKey(career.CareerIconColored, ResourceUtils.ProductVersionToGroupId(ProductVersion.BaseGame)), ThumbnailSize.Medium);

            int num = 0;

            int.TryParse(split[1], out num);

            return(career.CareerName + " " + EAText.GetNumberString(num));
        }
コード例 #11
0
        public void UpdateSelectedStates(int toggledIndex)
        {
            if (mRow == null)
            {
                return;
            }

            if (mRow.mGridWindows == null)
            {
                return;
            }

            for (int i = 0x0; i < CASClothingRow.kNumGridWindows; i++)
            {
                string msg = "UpdateSelectedStates";

                try
                {
                    Window window = mRow.mGridWindows[i] as Window;
                    if (window == null)
                    {
                        continue;
                    }

                    CASClothingRow.ClothingThumbnail tag = window.Tag as CASClothingRow.ClothingThumbnail;
                    StdDrawable drawable = window.Drawable as StdDrawable;
                    string      name     = null;
                    if (tag != null)
                    {
                        WindowBase childByID = window.GetChildByID(0x27, true);

                        CASPart cASPart = mRow.CASPart;
                        if (tag.mData is CASPart)
                        {
                            cASPart = (CASPart)tag.mData;
                        }
                        else if (tag.mData is CASPartPreset)
                        {
                            cASPart = ((CASPartPreset)tag.mData).mPart;
                        }

                        if ((mRow.mRowController.IsAccessoryType(cASPart.BodyType)) && (MasterController.Settings.mCompactAccessoryCAS))
                        {
                            msg += "A";

                            bool active = false;
                            if (tag.mIndex == toggledIndex)
                            {
                                active = !childByID.Visible;
                            }
                            else
                            {
                                active = IsWorn(cASPart);
                            }

                            if (active)
                            {
                                msg += "B";

                                tag.mState |= CASClothingRow.WindowState.Active;
                                if ((tag.mState & CASClothingRow.WindowState.Highlighted) == CASClothingRow.WindowState.Normal)
                                {
                                    name = CASClothingRow.kActiveImage;
                                }

                                if (childByID != null)
                                {
                                    childByID.Visible = true;
                                }
                            }
                            else
                            {
                                msg += "C";

                                tag.mState &= ~CASClothingRow.WindowState.Active;
                                if (tag.mState == CASClothingRow.WindowState.Normal)
                                {
                                    name = CASClothingRow.kNormalImage;
                                }

                                if (childByID != null)
                                {
                                    childByID.Visible = false;
                                }
                            }
                        }
                        else if (tag.mIndex == mRow.mSelectedItem)
                        {
                            msg += "D";

                            tag.mState |= CASClothingRow.WindowState.Active;
                            if ((tag.mState & CASClothingRow.WindowState.Highlighted) == CASClothingRow.WindowState.Normal)
                            {
                                name = CASClothingRow.kActiveImage;
                            }

                            msg += "E";

                            if (((cASPart.Key != CASClothingRow.kInvalidCASPart.Key) && (childByID != null)) && mRow.mRowController.IsAccessoryType(cASPart.BodyType))
                            {
                                childByID.Visible = true;
                            }
                        }
                        else
                        {
                            msg += "F";

                            tag.mState &= ~CASClothingRow.WindowState.Active;
                            if (tag.mState == CASClothingRow.WindowState.Normal)
                            {
                                name = CASClothingRow.kNormalImage;
                            }

                            msg += "G";

                            if (((cASPart.Key != CASClothingRow.kInvalidCASPart.Key) && (childByID != null)) && mRow.mRowController.IsAccessoryType(cASPart.BodyType))
                            {
                                childByID.Visible = false;
                            }
                        }
                    }

                    msg += "H";

                    if (name != null)
                    {
                        ResourceKey resKey = ResourceKey.CreatePNGKey(name, 0x0);
                        drawable[DrawableBase.ControlStates.kNormal] = UIManager.LoadUIImage(resKey);
                        window.Invalidate();
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(msg, e);
                }
            }
        }
コード例 #12
0
        // Sims3.Gameplay.ActorSystems.BuffManager
        public static void ParseBuffData(XmlDbData data, bool bStore)
        {
            try
            {
                XmlDbTable xmlDbTable = null;
                data.Tables.TryGetValue("BuffList", out xmlDbTable);
                if (xmlDbTable == null)
                {
                    xmlDbTable = data.Tables["Buffs"];
                }

                foreach (XmlDbRow current in xmlDbTable.Rows)
                {
                    bool   flag = false;
                    string text = current["BuffName"];
                    //  if (!bStore || Localization.HasLocalizationString("Gameplay/Excel/buffs/BuffList:" + text))
                    {
                        string    mDescription = current["BuffDescription"];
                        string    mHelpText    = current["BuffHelpText"];
                        BuffNames guid         = (BuffNames)BuffManager.GetGuid(current["Hex"], bStore);
                        double    mVersion     = 0.0;
                        if (guid == BuffNames.Undefined)
                        {
                            flag = true;
                        }
                        Buff buff = null;

                        if (!flag)
                        {
                            BuffCategory mBuffCategory;
                            ParserFunctions.TryParseEnum <BuffCategory>(current["Category"], out mBuffCategory, BuffCategory.None, true);
                            CommodityKind mSolveCommodity = CommodityKind.None;
                            ParserFunctions.TryParseEnum <CommodityKind>(current["SolveCommodity"], out mSolveCommodity, CommodityKind.None, true);
                            string names  = current["IncreasedEffectiveness"];
                            string names2 = current["ReducedEffectiveness"];
                            List <SocialManager.SocialEffectiveness> mIncreasedEffectivenessList;
                            ParserFunctions.TryParseCommaSeparatedList <SocialManager.SocialEffectiveness>(names, out mIncreasedEffectivenessList, SocialManager.SocialEffectiveness.None);
                            List <SocialManager.SocialEffectiveness> mReducedEffectivenessList;
                            ParserFunctions.TryParseCommaSeparatedList <SocialManager.SocialEffectiveness>(names2, out mReducedEffectivenessList, SocialManager.SocialEffectiveness.None);
                            string   mTopic = current["Topic"];
                            MoodAxis mAxisEffected;
                            if (ParserFunctions.TryParseEnum <MoodAxis>(current["AxisEffected"], out mAxisEffected, MoodAxis.None, true))
                            {
                                Polarity mPolarityOverride;
                                ParserFunctions.TryParseEnum <Polarity>(current["PolarityOverride"], out mPolarityOverride, Polarity.NoOverride, true);
                                Buff.BuffData buffData = new Buff.BuffData();
                                ParserFunctions.TryParseEnum <ProductVersion>(current["SKU"], out buffData.mProductVersion, (ProductVersion)1);
                                ResourceKey resourceKey = ResourceKey.kInvalidResourceKey;
                                string      text2       = null;
                                if (AppDomain.CurrentDomain.GetData("UIManager") != null)
                                {
                                    text2       = current["ThumbFilename"];
                                    resourceKey = ResourceKey.CreatePNGKey(text2, ResourceUtils.ProductVersionToGroupId(buffData.mProductVersion));
                                    if (!World.ResourceExists(resourceKey))
                                    {
                                        resourceKey = ResourceKey.CreatePNGKey(text2, 0u);
                                    }
                                }
                                if (bStore)
                                {
                                    mVersion = Convert.ToDouble(current["Version"]);
                                }
                                buffData.mBuffGuid     = guid;
                                buffData.mBuffName     = text;
                                buffData.mDescription  = mDescription;
                                buffData.mHelpText     = mHelpText;
                                buffData.mBuffCategory = mBuffCategory;
                                buffData.mVersion      = mVersion;
                                buffData.SetFlags(Buff.BuffData.FlagField.PermaMoodlet, ParserFunctions.ParseBool(current["PermaMoodlet"]));
                                string @string = current.GetString("PermaMoodletColor");
                                ParserFunctions.TryParseEnum <MoodColor>(@string, out buffData.mMoodletColor, MoodColor.Invalid);
                                buffData.mAxisEffected      = mAxisEffected;
                                buffData.mPolarityOverride  = mPolarityOverride;
                                buffData.mEffectValue       = ParserFunctions.ParseInt(current["EffectValue"], 0);
                                buffData.mDelayTimer        = (float)ParserFunctions.ParseInt(current["DelayTimer"], 0);
                                buffData.mTimeoutSimMinutes = ParserFunctions.ParseFloat(current["TimeoutLength"], -1f);
                                buffData.mSolveCommodity    = mSolveCommodity;
                                buffData.mSolveTime         = ParserFunctions.ParseFloat(current["SolveTime"], -3.40282347E+38f);
                                buffData.SetFlags(Buff.BuffData.FlagField.AttemptAutoSolve, ParserFunctions.ParseBool(current["AttemptAutoSolve"]));
                                ParserFunctions.ParseCommaSeparatedString(current["FacialIdle"], out buffData.mFacialIdles);
                                buffData.SetFlags(Buff.BuffData.FlagField.IsExtreme, ParserFunctions.ParseBool(current["IsExtreme"]));
                                buffData.mIncreasedEffectivenessList = mIncreasedEffectivenessList;
                                buffData.mReducedEffectivenessList   = mReducedEffectivenessList;
                                buffData.mThumbKey    = resourceKey;
                                buffData.mThumbString = text2;
                                buffData.mTopic       = mTopic;
                                buffData.SetFlags(Buff.BuffData.FlagField.ShowBalloon, current.GetBool("ShowBallon"));
                                buffData.SetFlags(Buff.BuffData.FlagField.Travel, current.GetBool("Travel"));
                                ParserFunctions.TryParseCommaSeparatedList <OccultTypes>(current["DisallowedOccults"], out buffData.mDisallowedOccults, OccultTypes.None);
                                if (buffData.mDisallowedOccults.Count == 0)
                                {
                                    buffData.mDisallowedOccults = null;
                                }
                                string text3 = current.GetString("JazzStateSuffix");
                                if (string.IsNullOrEmpty(text3))
                                {
                                    text3 = text;
                                }
                                buffData.mJazzStateSuffix = text3;
                                string string2 = current.GetString("SpeciesAvailability");
                                if (string.IsNullOrEmpty(string2))
                                {
                                    buffData.mAvailabilityFlags = (CASAGSAvailabilityFlags)127L;
                                }
                                else
                                {
                                    buffData.mAvailabilityFlags = ParserFunctions.ParseAllowableAgeSpecies(string2);
                                }
                                string text4 = current["CustomClassName"];
                                if (text4.Length > 0)
                                {
                                    text4 = text4.Replace(" ", "");
                                    int num = text4.IndexOf(',');
                                    if (num < 0)
                                    {
                                        flag = true;
                                    }
                                    else
                                    {
                                        string str = text4.Substring(0, num);
                                        text4.Substring(num + 1);
                                        Type type = null;
                                        if (bStore)
                                        {
                                            type = Type.GetType(str + ",Sims3StoreObjects");
                                        }
                                        if (type == null)
                                        {
                                            type = Type.GetType(text4);
                                        }
                                        if (type == null)
                                        {
                                            flag = true;
                                        }
                                        else
                                        {
                                            Type[] types = new Type[]
                                            {
                                                typeof(Buff.BuffData)
                                            };
                                            ConstructorInfo constructor = type.GetConstructor(types);
                                            object          obj         = constructor.Invoke(new object[]
                                            {
                                                buffData
                                            });
                                            buff = (Buff)obj;
                                        }
                                    }
                                }
                                else
                                {
                                    buff = new Buff(buffData);
                                }
                            }
                            if (!flag && buff != null)
                            {
                                BuffInstance value = buff.CreateBuffInstance();
                                if (GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary.ContainsKey((ulong)guid))
                                {
                                    if (GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary[(ulong)guid].mBuff.BuffVersion < buff.BuffVersion)
                                    {
                                        GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary[(ulong)guid] = value;
                                    }
                                }
                                else
                                {
                                    GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary.Add((ulong)guid, value);

                                    BuffManager.sBuffEnumValues.AddNewEnumValue(text, guid);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                StyledNotification.Show(new StyledNotification.Format(ex.ToString(), StyledNotification.NotificationStyle.kGameMessageNegative));
            }
        }
コード例 #13
0
ファイル: SkillBooter.cs プロジェクト: yakoder/NRaas
        private static void ParseSkillData(XmlDbData data, XmlDbRow row, bool bStore)
        {
            ProductVersion version;
            bool           flag = false;
            SkillNames     guid = SkillNames.None;

            string skillHex = row.GetString("Hex");

            try
            {
                guid = (SkillNames)SkillManager.GetGuid(ref skillHex, bStore);
            }
            catch
            { }

            if (guid == SkillNames.None)
            {
                flag = true;

                BooterLogger.AddError("GUID Fail " + skillHex);
            }

            if (!row.TryGetEnum <ProductVersion>("CodeVersion", out version, ProductVersion.BaseGame))
            {
                flag = true;

                BooterLogger.AddError("CodeVersion Fail " + version);
            }
            else if (!GameUtils.IsInstalled(version))
            {
                flag = true;

                BooterLogger.AddError("Install Fail " + version);
            }

            if (!flag)
            {
                Skill  skill    = null;
                string typeName = row.GetString("CustomClassName");
                bool   flag2    = typeName.Length > 0x0;
                if (flag2)
                {
                    Type type = null;

                    /*
                     * if (bStore)
                     * {
                     *  string[] strArray = typeName.Split(new char[] { ',' });
                     *  if (strArray.Length < 0x2)
                     *  {
                     *      flag = true;
                     *  }
                     *  else
                     *  {
                     *      type = Type.GetType(strArray[0x0] + ",Sims3StoreObjects");
                     *  }
                     * }
                     */
                    if (type == null)
                    {
                        type = Type.GetType(typeName);
                    }

                    if (type == null)
                    {
                        flag = true;

                        BooterLogger.AddError("CustomClassName Not Found " + typeName);
                    }
                    else
                    {
                        object[]        args        = new object[] { guid };
                        ConstructorInfo constructor = type.GetConstructor(Type.GetTypeArray(args));
                        if (constructor == null)
                        {
                            flag = true;

                            BooterLogger.AddError("Constructor Missing " + typeName);
                        }
                        else
                        {
                            try
                            {
                                skill = constructor.Invoke(args) as Skill;
                            }
                            catch (Exception e)
                            {
                                Common.Exception(skillHex, e);
                            }

                            if (skill == null)
                            {
                                flag = true;

                                BooterLogger.AddError("Constructor Fail " + typeName);
                            }
                        }
                    }
                }
                else
                {
                    skill = new Skill(guid);

                    BooterLogger.AddTrace("Generic Skill Used " + skillHex);
                }

                if (!flag)
                {
                    Skill.NonPersistableSkillData data2 = new Skill.NonPersistableSkillData();
                    skill.NonPersistableData = data2;
                    uint group = ResourceUtils.ProductVersionToGroupId(version);
                    data2.SkillProductVersion = version;
                    data2.Name = "Gameplay/Excel/Skills/SkillList:" + row.GetString("SkillName");
                    if (!bStore || Localization.HasLocalizationString(data2.Name))
                    {
                        data2.Description   = "Gameplay/Excel/Skills/SkillList:" + row.GetString("SkillDescription");
                        data2.MaxSkillLevel = row.GetInt("MaxSkillLevel", 0x0);
                        //skill.Guid = (SkillNames)(uint)guid; // Performed by the constructor, don't do it again here
                        data2.ThoughtBalloonTopicString = row.GetString("ThoughtBalloonTopic");

                        data2.IconKey        = ResourceKey.CreatePNGKey(row.GetString("IconKey"), group);
                        data2.SkillUIIconKey = ResourceKey.CreatePNGKey(row.GetString("SkillUIIcon"), group);
                        string        str3      = row.GetString("Commodity");
                        CommodityKind commodity = CommodityKind.None;

                        try
                        {
                            commodity = (CommodityKind)Enum.Parse(typeof(CommodityKind), str3);
                        }
                        catch
                        { }

                        if (commodity == CommodityKind.None)
                        {
                            commodity = unchecked ((CommodityKind)ResourceUtils.HashString64(str3));
                        }

                        data2.Commodity = commodity;
                        SkillManager.SkillCommodityMap.Add(commodity, guid);

                        double num = 0;
                        if (bStore)
                        {
                            string versionStr = row.GetString("Version");
                            if (!string.IsNullOrEmpty(versionStr))
                            {
                                num = Convert.ToDouble(versionStr);
                            }
                        }
                        data2.SkillVersion = num;

                        if (row.GetBool("Physical"))
                        {
                            skill.AddCategoryToSkill(SkillCategory.Physical);
                        }
                        if (row.GetBool("Mental"))
                        {
                            skill.AddCategoryToSkill(SkillCategory.Mental);
                        }
                        if (row.GetBool("Musical"))
                        {
                            skill.AddCategoryToSkill(SkillCategory.Musical);
                        }
                        if (row.GetBool("Creative"))
                        {
                            skill.AddCategoryToSkill(SkillCategory.Creative);
                        }
                        if (row.GetBool("Artistic"))
                        {
                            skill.AddCategoryToSkill(SkillCategory.Artistic);
                        }
                        if (row.GetBool("Hidden"))
                        {
                            skill.AddCategoryToSkill(SkillCategory.Hidden);
                        }
                        if (row.GetBool("Certificate"))
                        {
                            skill.AddCategoryToSkill(SkillCategory.Certificate);
                        }
                        if ((row.Exists("HiddenWithSkillProgress") && row.GetBool("HiddenWithSkillProgress")) && skill.HasCategory(SkillCategory.Hidden))
                        {
                            skill.AddCategoryToSkill(SkillCategory.HiddenWithSkillProgress);
                        }

                        int[] numArray = new int[skill.MaxSkillLevel];
                        int   num3     = 0x0;
                        for (int i = 0x1; i <= skill.MaxSkillLevel; i++)
                        {
                            string column = "Level_" + i.ToString();
                            num3 += row.GetInt(column, 0x0);
                            numArray[i - 0x1] = num3;
                        }
                        data2.PointsForNextLevel      = numArray;
                        data2.AlwaysDisplayLevelUpTns = row.GetBool("AlwaysDisplayTNS");
                        string[] strArray2 = new string[skill.MaxSkillLevel + 0x1];
                        for (int j = 0x2; j <= skill.MaxSkillLevel; j++)
                        {
                            string str6 = "Level_" + j.ToString() + "_Text";
                            strArray2[j - 0x1] = row.GetString(str6);
                            if (strArray2[j - 0x1] != string.Empty)
                            {
                                strArray2[j - 0x1] = "Gameplay/Excel/Skills/SkillList:" + strArray2[j - 0x1];
                            }
                        }
                        strArray2[skill.MaxSkillLevel] = row.GetString("Level_10_Text_Alternate");
                        if (strArray2[skill.MaxSkillLevel] != string.Empty)
                        {
                            strArray2[skill.MaxSkillLevel] = "Gameplay/Excel/Skills/SkillList:" + strArray2[skill.MaxSkillLevel];
                        }
                        data2.LevelUpStrings = strArray2;
                        if (flag2)
                        {
                            XmlDbTable table2 = null;
                            string     key    = row.GetString("CustomDataSheet");
                            data.Tables.TryGetValue(key, out table2);
                            if ((table2 == null) && (key.Length > 0x0))
                            {
                                flag  = true;
                                skill = null;
                            }
                            else if (!skill.ParseSkillData(table2))
                            {
                                flag  = true;
                                skill = null;
                            }
                        }
                        data2.AvailableAgeSpecies      = ParserFunctions.ParseAllowableAgeSpecies(row, "AvailableAgeSpecies");
                        data2.DreamsAndPromisesIcon    = row.GetString("DreamsAndPromisesIcon");
                        data2.DreamsAndPromisesIconKey = ResourceKey.CreatePNGKey(data2.DreamsAndPromisesIcon, group);
                        data2.LogicSkillBoost          = row.GetBool("LogicSkillBoost");

                        if (!flag)
                        {
                            GenericManager <SkillNames, Skill, Skill> .sDictionary.Add((uint)guid, skill);

                            SkillManager.sSkillEnumValues.AddNewEnumValue(skillHex, skill.Guid);

                            BooterLogger.AddTrace("Loaded " + skill.Name + " (" + skill.Guid + ")");
                        }
                    }
                }
            }
        }
コード例 #14
0
        public static void ParseDiseaseData(XmlDbData data)
        {
            XmlDbTable value = null;

            data.Tables.TryGetValue("DiseaseList", out value);
            if (value == null)
            {
                value = data.Tables["Disease"];
            }
            foreach (XmlDbRow row in value.Rows)
            {
                bool      flag         = false;
                string    text         = row["DiseaseName"];
                string    mDescription = row["DiseaseDescription"];
                BuffNames guid         = (BuffNames)BuffManager.GetGuid(row["Hex"], false);
                //double mVersion = 0.0;
                if (guid == BuffNames.Undefined)
                {
                    flag = true;
                }
                Buff buff = null;
                if (flag)
                {
                    continue;
                }
                string immuneTraits     = row["ImmuneTraits"];
                string vulnerableTraits = row["VulnerableTraits"];
                string resitantTraits   = row["ResistantTraits"];
                string text2            = row["NeededTraitForRobot"];
                ParserFunctions.TryParseCommaSeparatedList(immuneTraits, out List <TraitNames> list, TraitNames.Unknown);
                ParserFunctions.TryParseCommaSeparatedList(vulnerableTraits, out List <TraitNames> vulnerableList, TraitNames.Unknown);
                ParserFunctions.TryParseCommaSeparatedList(resitantTraits, out List <TraitNames> resistantList, TraitNames.Unknown);
                string mTopic = row["Topic"];
                if (ParserFunctions.TryParseEnum(row["AxisEffected"], out MoodAxis value4, MoodAxis.None, ignoreCase: true))
                {
                    ParserFunctions.TryParseEnum(row["PolarityOverride"], out Polarity value5, Polarity.NoOverride, ignoreCase: true);
                    Buff.BuffData buffData = new Buff.BuffData();
                    ParserFunctions.TryParseEnum <ProductVersion>(row["SKU"], out buffData.mProductVersion, (ProductVersion)1);
                    ResourceKey val   = ResourceKey.kInvalidResourceKey;
                    string      text3 = null;
                    if (AppDomain.CurrentDomain.GetData("UIManager") != null)
                    {
                        text3 = row["ThumbFilename"];
                        val   = ResourceKey.CreatePNGKey(text3, ResourceUtils.ProductVersionToGroupId(buffData.mProductVersion));
                        if (!World.ResourceExists(val))
                        {
                            val = ResourceKey.CreatePNGKey(text3, 0u);
                        }
                    }
                    //buffData.mBuffGuid = guid;
                    //buffData.mBuffName = text;
                    //buffData.mDescription = mDescription;
                    //buffData.mHelpText = mHelpText;
                    //buffData.mBuffCategory = value2;
                    //buffData.mVersion = mVersion;
                    //buffData.SetFlags(Buff.BuffData.FlagField.PermaMoodlet, ParserFunctions.ParseBool(row["PermaMoodlet"]));
                    //string @string = row.GetString("PermaMoodletColor");
                    //ParserFunctions.TryParseEnum<MoodColor>(@string, out buffData.mMoodletColor, (MoodColor)(-1));
                    //buffData.mAxisEffected = value4;
                    //buffData.mPolarityOverride = value5;
                    //buffData.mEffectValue = ParserFunctions.ParseInt(row["EffectValue"], 0);
                    //buffData.mDelayTimer = ParserFunctions.ParseInt(row["DelayTimer"], 0);
                    //buffData.mTimeoutSimMinutes = ParserFunctions.ParseFloat(row["TimeoutLength"], -1f);
                    //buffData.mSolveCommodity = value3;
                    //buffData.mSolveTime = ParserFunctions.ParseFloat(row["SolveTime"], float.MinValue);
                    //buffData.SetFlags(Buff.BuffData.FlagField.AttemptAutoSolve, ParserFunctions.ParseBool(row["AttemptAutoSolve"]));
                    //ParserFunctions.ParseCommaSeparatedString(row["FacialIdle"], out buffData.mFacialIdles);
                    //buffData.SetFlags(Buff.BuffData.FlagField.IsExtreme, ParserFunctions.ParseBool(row["IsExtreme"]));
                    //buffData.mNeededTraitList = list;
                    //buffData.mIncreasedEffectivenessList = vulnerableList;
                    //buffData.mReducedEffectivenessList = resistantList;
                    //buffData.mThumbKey = val;
                    //buffData.mThumbString = text3;
                    //buffData.mTopic = mTopic;
                    buffData.SetFlags(Buff.BuffData.FlagField.ShowBalloon, row.GetBool("ShowBallon"));
                    buffData.SetFlags(Buff.BuffData.FlagField.Travel, row.GetBool("Travel"));
                    ParserFunctions.TryParseCommaSeparatedList <OccultTypes>(row["DisallowedOccults"], out buffData.mDisallowedOccults, (OccultTypes)0);
                    if (buffData.mDisallowedOccults.Count == 0)
                    {
                        buffData.mDisallowedOccults = null;
                    }
                    string text4 = row.GetString("JazzStateSuffix");
                    if (string.IsNullOrEmpty(text4))
                    {
                        text4 = text;
                    }
                    buffData.mJazzStateSuffix = text4;
                    string string2 = row.GetString("SpeciesAvailability");
                    if (string.IsNullOrEmpty(string2))
                    {
                        buffData.mAvailabilityFlags = (CASAGSAvailabilityFlags)127;
                    }
                    else
                    {
                        buffData.mAvailabilityFlags = ParserFunctions.ParseAllowableAgeSpecies(string2);
                    }
                    string text5 = row["CustomClassName"];
                    if (text5.Length > 0)
                    {
                        text5 = text5.Replace(" ", "");
                        int num = text5.IndexOf(',');
                        if (num < 0)
                        {
                            flag = true;
                        }
                        else
                        {
                            string str = text5.Substring(0, num);
                            text5.Substring(num + 1);
                            Type type = null;
                            //if (bStore)
                            //{
                            //	type = Type.GetType(str + ",Sims3StoreObjects");
                            //}
                            if ((object)type == null)
                            {
                                type = Type.GetType(text5);
                            }
                            if ((object)type == null)
                            {
                                flag = true;
                            }
                            else
                            {
                                Type[] types = new Type[1] {
                                    typeof(Buff.BuffData)
                                };
                                //ConstructorInfo constructor = type.GetConstructor(types);
                                // object obj; // = constructor.Invoke(new object[1] {
                                //	buffData
                                //});
                                //buff = (Buff)obj;
                            }
                        }
                    }
                    else
                    {
                        buff = new Buff(buffData);
                    }
                }
                if (flag || buff == null)
                {
                    continue;
                }
                BuffInstance value6 = buff.CreateBuffInstance();
                if (GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary.ContainsKey((ulong)guid))
                {
                    if (GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary[(ulong)guid].mBuff.BuffVersion < buff.BuffVersion)
                    {
                        GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary[(ulong)guid] = value6;
                    }
                }
                else
                {
                    GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary.Add((ulong)guid, value6);

                    //sBuffEnumValues.AddNewEnumValue(text, guid);
                }
            }
        }
コード例 #15
0
        // This isn't used currently because EA hard coded the function that matches this type to the lot type...
        // but it's here in case I have a lightbulb moment
        // At this time this still isn't used because of the above but I inject bar data cause the code still
        // honors the hours with that. The other mechnisms (like pushing sims to the lots) is handled via GoHere and a replacement
        // of the CalculateScore on VisitCommunityLot
        public static void InjectMetaAutonomyVenueType(string str, string icon, string maptag)
        {
            MetaAutonomyVenueType type;
            MetaAutonomyTuning    sCurrentTuning;

            if (ParserFunctions.TryParseEnum <MetaAutonomyVenueType>(str, out type, MetaAutonomyVenueType.Restaurant))
            {
                List <MetaAutonomyTuning> list;
                sCurrentTuning = new MetaAutonomyTuning(type);
                if (!MetaAutonomyManager.sTunings.TryGetValue(type, out list))
                {
                    MetaAutonomyManager.sTunings[type] = list = new List <MetaAutonomyTuning>();
                }
                list.Add(sCurrentTuning);

                // w_simoleon
                if (!string.IsNullOrEmpty(icon))
                {
                    sCurrentTuning.IconKey = ResourceKey.CreatePNGKey(icon, ResourceUtils.ProductVersionToGroupId(ProductVersion.Undefined));
                    if (!World.ResourceExists(sCurrentTuning.IconKey))
                    {
                        sCurrentTuning.IconKey = ResourceKey.CreatePNGKey(icon, 0);
                    }
                }

                // hud_mt_i_consignment
                if (!string.IsNullOrEmpty(maptag))
                {
                    sCurrentTuning.MaptagIconKey = ResourceKey.CreatePNGKey(maptag, 0);
                }

                /*
                 * string str4 = row.GetString("OneShotMotives");
                 * if (!string.IsNullOrEmpty(str4))
                 * {
                 *  ParserFunctions.TryParseCommaSeparatedList<CommodityKind>(str4, out sCurrentTuning.OneShotMotives, CommodityKind.None);
                 * }
                 * string str5 = row.GetString("ContinuousMotive");
                 * if (!string.IsNullOrEmpty(str5))
                 * {
                 *  CommodityKind none = CommodityKind.None;
                 *  if (ParserFunctions.TryParseEnum<CommodityKind>(str5, out none, CommodityKind.None))
                 *  {
                 *      sCurrentTuning.ContinuousMotive = none;
                 *  }
                 * }
                 */

                sCurrentTuning.Intensity          = 0.75f;
                sCurrentTuning.Intensity_Downtown = 0.75f;

                /*
                 * if (!string.IsNullOrEmpty(row.GetString("HourOpen")))
                 * {
                 *  sCurrentTuning.HourOpen = row.GetFloat("HourOpen");
                 * }
                 * if (!string.IsNullOrEmpty(row.GetString("HourClose")))
                 * {
                 *  sCurrentTuning.HourClose = row.GetFloat("HourClose");
                 * }
                 */

                sCurrentTuning.MinLength = 0.1f;
                sCurrentTuning.MaxLength = 0.3f;

                sCurrentTuning.ColdSpotPriority = 4;
                sCurrentTuning.HowLongSimsWaitOutsideBeforeEntering = 0;

                sCurrentTuning.mMiscellaneousFlags |= MetaAutonomyTuning.TuningAttribute.ChildCanVisit;

                /*
                 * if (!string.IsNullOrEmpty(row.GetString("SpecialMotiveLock")) && row.GetBool("SpecialMotiveLock"))
                 * {
                 *  sCurrentTuning.mMiscellaneousFlags |= MetaAutonomyTuning.TuningAttribute.HasSpecialMotiveLockForNpcs;
                 * }
                 */

                sCurrentTuning.mAllowedPetSpecies = CASAGSAvailabilityFlags.None;

                sCurrentTuning.mBookGigModifier     = 0f;
                sCurrentTuning.mPerformanceMeterMax = 1f;
            }
        }
コード例 #16
0
ファイル: Kill.cs プロジェクト: ferferga/TS3VampireTweaker
 public ResourceKey GetTraitIcon(Sim actor, GameObject target)
 {
     return(ResourceKey.CreatePNGKey("trait_vampirenocturnal_supernatural_ep7", 0u));
 }
コード例 #17
0
        public List <PhoneSimPicker.SimPickerInfo> GetPickerInfo()
        {
            List <PhoneSimPicker.SimPickerInfo> sims = new List <PhoneSimPicker.SimPickerInfo>();

            if (mAddAll)
            {
                PhoneSimPicker.SimPickerInfo all = new PhoneSimPicker.SimPickerInfo();

                if (mLastFirst)
                {
                    all.FirstName = "";
                    all.LastName  = "(" + Common.LocalizeEAString("Ui/Caption/ObjectPicker:All") + ")";
                }
                else
                {
                    all.FirstName = "(" + Common.LocalizeEAString("Ui/Caption/ObjectPicker:All") + ")";
                    all.LastName  = "";
                }

                all.CoWorker                  = false;
                all.Thumbnail                 = new ThumbnailKey(ResourceKey.CreatePNGKey("shop_all_r2", ResourceUtils.ProductVersionToGroupId(ProductVersion.BaseGame)), ThumbnailSize.Large);
                all.RelationShip              = 0f;
                all.LtrType                   = LongTermRelationshipTypes.Stranger;
                all.Friend                    = false;
                all.RelationshipText          = "";
                all.RelationshipWithFirstName = mMe.FirstName;

                sims.Add(all);
            }

            foreach (T sim in All)
            {
                if (!AllowRow(sim))
                {
                    continue;
                }

                PhoneSimPicker.SimPickerInfo item = new PhoneSimPicker.SimPickerInfo();

                string firstName = null;
                string lastName  = null;
                GetName(sim, out firstName, out lastName);

                item.FirstName = firstName;
                item.LastName  = lastName;
                item.CoWorker  = false;

                IMiniRelationship relation = null;

                if (sim is SimDescription)
                {
                    SimDescription simDesc = sim as SimDescription;

                    if (simDesc.GetOutfit(OutfitCategories.Everyday, 0x0) != null)
                    {
                        try
                        {
                            item.Thumbnail = sim.GetThumbnailKey(ThumbnailSize.Large, 0);
                        }
                        catch
                        { }
                    }

                    if (mMe is SimDescription)
                    {
                        SimDescription meDesc = mMe as SimDescription;

                        relation = Relationship.Get(simDesc, meDesc, false);

                        if ((meDesc.CareerManager != null) && (meDesc.CareerManager.Occupation != null))
                        {
                            if (sim == meDesc.CareerManager.Occupation.Boss)
                            {
                                item.CoWorker = true;
                            }
                            else if (meDesc.CareerManager.Occupation.Coworkers != null)
                            {
                                foreach (SimDescription description2 in meDesc.CareerManager.Occupation.Coworkers)
                                {
                                    if (description2 == sim)
                                    {
                                        item.CoWorker = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        relation = mMe.GetMiniRelationship(simDesc);
                    }
                }
                else
                {
                    try
                    {
                        item.Thumbnail = sim.GetThumbnailKey(ThumbnailSize.Large, 0);
                    }
                    catch
                    { }

                    relation = sim.GetMiniRelationship(mMe);
                }

                item.SimDescription = sim;

                if (sim == mMe)
                {
                    item.RelationShip = 100f;
                    item.LtrType      = LongTermRelationshipTypes.BestFriend;
                    item.Friend       = true;
                }
                else if (relation != null)
                {
                    item.RelationShip = relation.CurrentLTRLiking;
                    item.LtrType      = relation.CurrentLTR;
                    item.Friend       = relation.AreFriends() || relation.AreRomantic();
                }
                else
                {
                    item.RelationShip = 0f;
                    item.LtrType      = LongTermRelationshipTypes.Stranger;
                    item.Friend       = false;
                }

                item.RelationshipText          = LTRData.Get(item.LtrType).GetName(mMe, sim);
                item.RelationshipWithFirstName = mMe.FirstName;

                sims.Add(item);
            }

            return(sims);
        }
コード例 #18
0
 public ResourceKey GetTraitIcon(Sim actor, GameObject target)
 {
     return(ResourceKey.CreatePNGKey("trait_SpellcastingTalent_s", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP7)));
 }
コード例 #19
0
ファイル: CommonOptionItem.cs プロジェクト: yakoder/NRaas
 public void SetThumbnail(string icon, ProductVersion version)
 {
     SetThumbnail(ResourceKey.CreatePNGKey(icon, ResourceUtils.ProductVersionToGroupId(version)));
 }
コード例 #20
0
        public List <CareerLevelItem> GetLevelOptions(OccupationNames career)
        {
            List <CareerLevelItem> results = new List <CareerLevelItem>();

            Career career2 = CareerManager.GetStaticCareer(career);

            if (career2 == null)
            {
                return(results);
            }

            results.Add(new CareerLevelItem(new LevelData(career, string.Empty, -1), Common.Localize("Selection:All"), ThumbnailKey.kInvalidThumbnailKey));

            foreach (KeyValuePair <string, Dictionary <int, Sims3.Gameplay.Careers.CareerLevel> > staticData in career2.CareerLevels)
            {
                foreach (KeyValuePair <int, Sims3.Gameplay.Careers.CareerLevel> levelStaticData in staticData.Value)
                {
                    results.Add(new CareerLevelItem(new LevelData(career, staticData.Key, levelStaticData.Key), career2.Name + " - " + levelStaticData.Value.BranchName + " - " + Common.LocalizeEAString(false, levelStaticData.Value.mName) + " (" + EAText.GetNumberString(levelStaticData.Key) + ")", new ThumbnailKey(ResourceKey.CreatePNGKey(career2.CareerIconColored, ResourceUtils.ProductVersionToGroupId(ProductVersion.BaseGame)), ThumbnailSize.Medium)));
                }
            }

            return(results);
        }
コード例 #21
0
        public override bool Run()
        {
            try
            {
                Vector3 vector4;
                if (Actor.LotCurrent.IsHouseboatLot())
                {
                    mIsHouseboat = true;
                }
                mSittingInBoatPosture = Actor.Posture as SittingInBoat;

                Vector3 mPoint       = Hit.mPoint;
                Vector3 newTargetPos = mPoint;
                if (mSittingInBoatPosture == null)
                {
                    if (!mIsHouseboat)
                    {
                        if (IsNearHiddenIsland(mPoint))
                        {
                            Vector3 invalid = Vector3.Invalid;
                            World.GetNearestSwimmingPoint(Actor.Position, ref invalid, ref mPoint);
                        }

                        if (!RouteToFishingLocation(mPoint, Actor, Hit.mType, Hit.mId))
                        {
                            Actor.PlayRouteFailure(new ThumbnailKey(ResourceKey.CreatePNGKey("w_fishing_skill", ResourceUtils.ProductVersionToGroupId(ProductVersion.BaseGame)), ThumbnailSize.Medium));
                            return(false);
                        }
                    }
                    else if (!RouteToFishingLocationOnHouseboat(Actor, ref mPoint, Actor, Hit.mType, Hit.mId, ref newTargetPos))
                    {
                        return(false);
                    }
                }
                else
                {
                    Boat container = mSittingInBoatPosture.Container as Boat;
                    if (container != null)
                    {
                        mPoint = container.GetFishingPosition(mSittingInBoatPosture);
                        if (World.GetTerrainType(mPoint.x, mPoint.z, container.Level) != 2)
                        {
                            return(false);
                        }

                        RoutingComponent routingComponent = container.RoutingComponent;
                        if ((routingComponent == null) || routingComponent.IsRouting)
                        {
                            return(false);
                        }
                    }
                }

                if (mIsHouseboat && World.GetHouseboatDisplayToWorldPosition(Actor.LotCurrent.LotId, newTargetPos, out vector4))
                {
                    PrepFishing(mPoint, vector4);
                }
                else
                {
                    PrepFishing(mPoint, mPoint);
                }

                WaterTypes waterType = FishingSpot.GetWaterType(Hit.mType);
                Fishing    fishing   = Actor.SkillManager.AddElement(SkillNames.Fishing) as Fishing;
                fishing.TypesOfWaterFishedIn = waterType | fishing.TypesOfWaterFishedIn;
                if (!BaitSelected)
                {
                    BaitInfoSelected = fishing.mBaitInfo;
                }
                if (BaitInfoSelected != null)
                {
                    BaitInUse = FindProperBait(BaitInfoSelected);
                    Actor.InteractionQueue.FireQueueChanged();
                }
                else if (fishing.SkillLevel > kNoBaitUsedLesson)
                {
                    Tutorialette.TriggerLesson(Lessons.FishingSkill, Actor);
                }

                BeginCommodityUpdates();

                bool succeeded = false;

                MotiveDelta delta = null;

                try
                {
                    StartStages();
                    if (Actor.TraitManager.HasElement(TraitNames.Angler))
                    {
                        mIsAngler = true;
                        delta     = AddMotiveDelta(CommodityKind.Fun, kAnglerFunPerHour);
                    }

                    mLoopLengthForNextFish = mFishingData.GetNextFishTimeLength(mIsAngler, fishing.IsFisherman());
                    mShowTns = mFishingData.ShouldShowFishingTns(Actor, BaitInUse);
                    mCurrentStateMachine.SetParameter("skillLevel", fishing.GetSkillLevelParameterForJazzGraph());
                    if (BaitInUse != null)
                    {
                        fishing.mBaitInfo = new Fishing.BaitInfo(BaitInUse);
                    }
                    else
                    {
                        fishing.mBaitInfo = null;
                    }

                    AnimateSim("Fish");
                    Actor.RegisterGroupTalk();

                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new Interaction <Sim, Terrain> .InsideLoopFunction(LoopFunc), mCurrentStateMachine);

                    Actor.UnregisterGroupTalk();
                    if (BaitInUse != null)
                    {
                        Actor.Inventory.SetNotInUse(BaitInUse);
                    }

                    if (mSittingInBoatPosture == null)
                    {
                        AnimateSim("Exit");
                    }
                    else
                    {
                        AnimateSim("ExitFishing");
                        mSittingInBoatPosture.CurrentStateMachine.RequestState("x", "SimIdle");
                    }
                }
                finally
                {
                    StandardExit(false, false);
                    if (mIsAngler)
                    {
                        RemoveMotiveDelta(delta);
                    }

                    EndCommodityUpdates(succeeded);
                }
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
コード例 #22
0
ファイル: CareerSettingOption.cs プロジェクト: yakoder/NRaas
        public List <Item> GetOptions()
        {
            List <Item> results = new List <Item>();

            results.Add(new Item(OccupationNames.Any, Common.Localize("Selection:All"), ThumbnailKey.kInvalidThumbnailKey));

            foreach (Career career in CareerManager.CareerList)
            {
                results.Add(new Item(career.Guid, career.GetLocalizedCareerName(false), new ThumbnailKey(ResourceKey.CreatePNGKey(career.CareerIconColored, ResourceUtils.ProductVersionToGroupId(ProductVersion.BaseGame)), ThumbnailSize.Medium)));
            }

            return(results);
        }
コード例 #23
0
 public override ResourceKey GetIconKey()
 {
     return(ResourceKey.CreatePNGKey("hud_interactions_stage_x5", 0u));
 }
コード例 #24
0
ファイル: WorldData.cs プロジェクト: yakoder/NRaas
        public void OnPreLoad()
        {
            sDefaultBarTuned = false;

            foreach (BookComicData bookData in BookData.BookComicDataList.Values)
            {
                bookData.AllowedWorldTypes.Add(WorldType.Vacation);
            }

            foreach (Opportunity opp in OpportunityManager.sLocationBasedOpportunityList.Values)
            {
                if (opp.SharedData.mTargetWorldRequired == WorldName.SunsetValley)
                {
                    opp.SharedData.mTargetWorldRequired = WorldName.Undefined;
                }
            }

            if (ServiceNPCSpecifications.sServiceSpecifications != null)
            {
                foreach (ServiceType type in Enum.GetValues(typeof(ServiceType)))
                {
                    ServiceNPCSpecifications.ServiceSpecifications spec;
                    if (ServiceNPCSpecifications.sServiceSpecifications.TryGetValue(type.ToString(), out spec))
                    {
                        spec.InvalidWorlds.Clear();
                    }
                }
            }

            foreach (List <MotiveTuning> tempTuning in MotiveTuning.sTuning.Values)
            {
                foreach (MotiveTuning tuning in tempTuning)
                {
                    tuning.WorldRestrictionType = WorldRestrictionType.None;
                }
            }

            Bartending.BarData defaultData;
            if (Bartending.TryGetBarData(Lot.MetaAutonomyType.None, out defaultData))
            {
                sDefaultBarTuned = (defaultData.mFoods.Count > 0);
            }

            // Unlock all subTypes for all worlds
            foreach (Lot.CommercialSubTypeData commData in Lot.sCommnunityTypeData)
            {
                commData.WorldAllowed     = null;
                commData.WorldTypeAllowed = null;
            }

            // Unlock all subTypes for all worlds
            foreach (Lot.ResidentialSubTypeData residentData in Lot.sResidentialTypeData)
            {
                residentData.WorldAllowed     = null;
                residentData.WorldTypeAllowed = null;
            }

            foreach (ActionData action in ActionData.sData.Values)
            {
                if (action.mAllowedWorldTypes != null)
                {
                    List <WorldType> types = new List <WorldType>(action.mAllowedWorldTypes);

                    if (types.Count > 0)
                    {
                        if ((!types.Contains(WorldType.Vacation)))
                        {
                            types.Add(WorldType.Vacation);
                        }

                        if ((!types.Contains(WorldType.Future)))
                        {
                            types.Add(WorldType.Future);
                        }

                        action.mAllowedWorldTypes = types.ToArray();
                    }
                }
            }

            STCData.SetNumSocialsDuringConversation(int.MaxValue);

            foreach (InsectData insect in InsectData.sData.Values)
            {
                if (insect.RequiredWorld != WorldName.Undefined)
                {
                    insect.mRequiredWorld = WorldName.Undefined;

                    BooterLogger.AddTrace("  Unlocked: " + insect.Name);
                }
            }

            foreach (RockGemMetalData rock in RockGemMetalBase.sData.Values)
            {
                if (rock.RequiredWorld != WorldName.Undefined)
                {
                    rock.mRequiredWorld = WorldName.Undefined;

                    BooterLogger.AddTrace("  Unlocked: " + rock.Name);
                }
            }

            List <KeyValuePair <WorldName, WorldNameData> > data = new List <KeyValuePair <WorldName, WorldNameData> >();

            if (GameUtils.IsInstalled(ProductVersion.EP1))
            {
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.China, new WorldNameData("China.world", "China_0x0859db4c", TravelUtil.DestinationInfoImage[0], TravelUtil.DestinationInfoName[0], TravelUtil.DestinationInfoDescription[0], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[0], 0x0)), TravelUtil.DestinationInfoComfirmDescription[0])));
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.Egypt, new WorldNameData("Egypt.world", "Egypt_0x0859db48", TravelUtil.DestinationInfoImage[1], TravelUtil.DestinationInfoName[1], TravelUtil.DestinationInfoDescription[1], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[1], 0x0)), TravelUtil.DestinationInfoComfirmDescription[1])));
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.France, new WorldNameData("France.world", "France_0x0859db50", TravelUtil.DestinationInfoImage[2], TravelUtil.DestinationInfoName[2], TravelUtil.DestinationInfoDescription[2], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[2], 0x0)), TravelUtil.DestinationInfoComfirmDescription[2])));
            }

            List <WorldFileMetadata> worlds = new List <WorldFileMetadata>();

            WorldFileSearch search = new WorldFileSearch(0x0);

            foreach (string str in search)
            {
                WorldFileMetadata info = new WorldFileMetadata();

                info.mWorldFile = str;
                if (GetWorldFileDetails(ref info))
                {
                    worlds.Add(info);
                }
            }

            worlds.Sort(OnSort);

            foreach (WorldFileMetadata info in worlds)
            {
                string name = info.mWorldFile.Replace(".world", "");

                WorldName worldName = WorldName.Undefined;

                try
                {
                    worldName = unchecked ((WorldName)ResourceUtils.HashString32(name.Replace(" ", "")));
                }
                catch
                {
                    continue;
                }

                string saveFile = name;
                switch (name.ToLower())
                {
                case "islaparadiso":
                    if (!GameUtils.IsInstalled(ProductVersion.EP10))
                    {
                        continue;
                    }

                    worldName = WorldName.IslaParadiso;

                    saveFile += "_0x0c50c382";
                    break;

                case "sims university":
                    if (!GameUtils.IsInstalled(ProductVersion.EP9))
                    {
                        continue;
                    }

                    worldName = WorldName.University;

                    saveFile += "_0x0e41c954";
                    break;

                case "bridgeport":
                    if (!GameUtils.IsInstalled(ProductVersion.EP3))
                    {
                        continue;
                    }

                    worldName = WorldName.NewDowntownWorld;

                    saveFile += "_0x09ffe3d7";
                    break;

                case "twinbrook":
                    if (!GameUtils.IsInstalled(ProductVersion.EP2))
                    {
                        continue;
                    }

                    worldName = WorldName.TwinBrook;

                    saveFile += "_0x09b610fa";
                    break;

                case "appaloosaplains":
                    if (!GameUtils.IsInstalled(ProductVersion.EP5))
                    {
                        continue;
                    }

                    worldName = WorldName.AppaloosaPlains;

                    saveFile += "_0x0c50c56d";
                    break;

                case "riverview":
                    worldName = WorldName.RiverView;

                    saveFile += "_0x0859db43";
                    break;

                case "sunset valley":
                    worldName = WorldName.SunsetValley;

                    saveFile += "_0x0859db3c";
                    break;

                case "moonlight falls":
                    worldName = WorldName.MoonlightFalls;

                    saveFile += "_0x09b61110";
                    break;

                case "starlight shores":
                    if (!GameUtils.IsInstalled(ProductVersion.EP6))
                    {
                        continue;
                    }

                    worldName = WorldName.StarlightShores;

                    saveFile += "_0x09b610ff";
                    break;

                case "hidden springs":
                case "barnacle bay":
                case "lunar lakes":
                case "lucky palms":
                    saveFile += "_0x08866eb8";
                    break;

                case "roaring heights":
                    worldName = WorldName.DOT11;

                    saveFile += "_0x0de07e86";
                    break;

                case "midnight hollow":
                    worldName = WorldName.DOT10;

                    saveFile += "_0x0de07e7d";
                    break;

                case "dragon valley":
                    worldName = WorldName.DOT09;

                    saveFile += "_0x0de07c9c";
                    break;

                case "aurora skies":
                    worldName = WorldName.DOT08;

                    saveFile += "_0x0de07c8b";
                    break;

                case "monte vista":
                    worldName = WorldName.DOT07;

                    saveFile += "_0x0de07c83";
                    break;

                case "sunlit tides":
                    worldName = WorldName.DOT06;

                    saveFile += "_0x0de07c78";
                    break;

                case "oasis landing":
                    worldName = WorldName.FutureWorld;

                    saveFile += "_0x0f36012a";
                    break;

                case "egypt":
                case "china":
                case "france":
                    continue;

                default:
                    saveFile = FileNameBooter.GetFileName(saveFile);
                    break;
                }

                string infoIcon = "glb_i_suburb";
                switch (info.mWorldType)
                {
                case WorldType.Downtown:
                    infoIcon = "glb_i_downtown";
                    break;

                case WorldType.Vacation:
                    infoIcon = "glb_i_vacation";
                    break;

                default:
                    break;
                }

                if (!VisaManager.sDictionary.ContainsKey((ulong)worldName))
                {
                    Visa defaultVisa = new Visa();
                    defaultVisa.mWorldName          = worldName;
                    defaultVisa.mNonPersistableData = new NonPersistableVisaData();
                    defaultVisa.NonPersistableData.LevelUpStrings = new string[3] {
                        "", "", ""
                    };
                    defaultVisa.NonPersistableData.PointsForNextLevel = new int[3] {
                        0, 0, 0
                    };

                    Visa chinaVisa = VisaManager.GetStaticVisaData(WorldName.China);
                    if (chinaVisa != null)
                    {
                        defaultVisa.NonPersistableData.LevelUpStrings     = new List <string>(chinaVisa.NonPersistableData.LevelUpStrings).ToArray();
                        defaultVisa.NonPersistableData.PointsForNextLevel = new List <int>(chinaVisa.NonPersistableData.PointsForNextLevel).ToArray();
                    }

                    VisaManager.sDictionary.Add((ulong)worldName, defaultVisa);

                    data.Add(new KeyValuePair <WorldName, WorldNameData>(worldName, new WorldNameData(info.mWorldFile, saveFile, infoIcon, info.mCaption, info.mDescription, info.mWorldThumb, Common.Localize("Itinerary:Name", false, new object[] { info.mCaption }))));
                }
            }

            TravelUtil.kVacationWorldNames = new WorldName[data.Count];

            TravelUtil.DestinationInfoImage              = new string[data.Count];
            TravelUtil.DestinationInfoName               = new string[data.Count];
            TravelUtil.DestinationInfoDescription        = new string[data.Count];
            TravelUtil.DestinationInfoConfirmImage       = new string[data.Count];
            TravelUtil.DestinationInfoComfirmDescription = new string[data.Count];

            TravelUtil.DestinationInfoIndex = new int[data.Count];

            int index = 0;

            foreach (KeyValuePair <WorldName, WorldNameData> value in data)
            {
                TravelUtil.kVacationWorldNames[index] = value.Key;

                TravelUtil.DestinationInfoIndex[index] = index;

                TravelUtil.DestinationInfoImage[index]              = value.Value.mDestinationInfoImage;
                TravelUtil.DestinationInfoName[index]               = value.Value.mDestinationInfoName;
                TravelUtil.DestinationInfoDescription[index]        = value.Value.mDestinationInfoDescription;
                TravelUtil.DestinationInfoConfirmImage[index]       = "";
                TravelUtil.DestinationInfoComfirmDescription[index] = value.Value.mDestinationInfoConfirmDescription;

                sConfirmImages.Add(value.Value.mDestinationInfoConfirmImage);

                BooterLogger.AddTrace(value.Value.ToString());
                BooterLogger.AddTrace("  WorldName: " + (ulong)value.Key);

                index++;

                sData.Add(value.Key, value.Value);
            }

            //BooterLogger.AddError("WorldData");

            sOrigWorldNameToType = GameUtils.WorldNameToType;

            foreach (InteractionTuning tuning in InteractionTuning.sAllTunings.Values)
            {
                switch (tuning.Availability.WorldRestrictionType)
                {
                case WorldRestrictionType.Allow:
                    if (!tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Vacation))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Add(WorldType.Vacation);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (A) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }
                    else if (!tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Downtown))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Add(WorldType.Downtown);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (C) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }

                    break;

                case WorldRestrictionType.Disallow:
                    if ((tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Vacation)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Downtown)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.University)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Future)))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Vacation);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Downtown);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.University);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Future);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (B) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }

                    break;
                }
            }
        }
コード例 #25
0
ファイル: HudModelEx.cs プロジェクト: yakoder/NRaas
        public static List <KnownInfo> GetKnownInfoAboutSelf(HudModel ths, IMiniSimDescription simDescription)
        {
            List <KnownInfo> infos       = new List <KnownInfo>();
            SimDescription   description = simDescription as SimDescription;

            if (description != null)
            {
                string firstName;
                bool   isHuman = description.IsHuman;
                bool   teen    = (description.Age & CASAgeGenderFlags.Teen) != CASAgeGenderFlags.None;
                bool   child   = (description.Age & CASAgeGenderFlags.Child) != CASAgeGenderFlags.None;
                foreach (Trait trait in description.TraitManager.List)
                {
                    if (trait.IsVisible && Localization.HasLocalizationString(trait.TraitNameInfo))
                    {
                        infos.Add(new KnownInfo(trait.TraitName(description.IsFemale), trait.IconKey, KnownInfoType.Trait));
                    }
                }

                if (isHuman && !child)
                {
                    if (GameUtils.GetCurrentWorld() != description.HomeWorld)
                    {
                        MiniSimDescription description2 = MiniSimDescription.Find(description.SimDescriptionId);
                        if (description2 != null)
                        {
                            description2.GetKnownJobInfo(infos);
                        }
                    }
                    else if ((description.CareerManager != null) && (description.CareerManager.Occupation != null))
                    {
                        infos.Add(new KnownInfo(description.CareerManager.Occupation.CurLevelJobTitle, ResourceKey.CreatePNGKey(description.CareerManager.Occupation.CareerIcon, 0), KnownInfoType.Career));
                    }
                    else if (description.CreatedByService != null)
                    {
                        string str2 = Localization.LocalizeString(description.IsFemale, "Gameplay/Services/Title:" + description.CreatedByService.ServiceType.ToString(), new object[0]);
                        infos.Add(new KnownInfo(str2, ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                    }
                    else
                    {
                        infos.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:Unemployed", new object[0]), ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                    }
                }

                ResourceKey kInvalidResourceKey = ResourceKey.kInvalidResourceKey;
                if (description.Partner != null)
                {
                    firstName = description.Partner.FirstName;
                    Relationship relationship = description.GetRelationship(description.Partner, false);

                    // Custom
                    if (relationship != null)
                    {
                        kInvalidResourceKey = RelationshipFunctions.GetLTRRelationshipImageKey(relationship.LTR.CurrentLTR, relationship.IsPetToPetRelationship);
                    }
                }
                else
                {
                    firstName = Localization.LocalizeString("Ui/Caption/HUD/KnownInfoDialog:None", new object[0]);
                }

                infos.Add(new KnownInfo(firstName, kInvalidResourceKey, KnownInfoType.Partner));
                if ((isHuman && (teen || child)) && ((description.CareerManager != null) && (description.CareerManager.School != null)))
                {
                    infos.Add(new KnownInfo(description.CareerManager.School.Name, ResourceKey.CreatePNGKey(description.CareerManager.School.CareerIcon, 0), KnownInfoType.School));
                }

                if (GameUtils.IsInstalled(ProductVersion.EP9))
                {
                    List <IDegreeEntry> completedDegreeEntries = description.CareerManager.DegreeManager.GetCompletedDegreeEntries();
                    if (completedDegreeEntries.Count > 0)
                    {
                        KnownInfo item = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                        foreach (IDegreeEntry entry in completedDegreeEntries)
                        {
                            if (item.mDegreeIcons.Count == 5)
                            {
                                infos.Add(item);
                                item = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                            }
                            item.mDegreeIcons.Add(ResourceKey.CreatePNGKey(entry.DegreeIcon, 0));
                        }
                        infos.Add(item);
                    }
                }

                if (description.IsRich)
                {
                    infos.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:IsRich", new object[0]), ResourceKey.CreatePNGKey("w_simoleon_32", 0), KnownInfoType.Rich));
                }
                return(infos);
            }

            MiniSimDescription description3 = simDescription as MiniSimDescription;

            if (description3 != null)
            {
                infos = description3.GetKnownInfoOfSelf();
            }
            return(infos);
        }
コード例 #26
0
        static void OnPreload()
        {
            try
            {
                ObjectLoader.GetAllXMLSettingsForSewables();
                XmlDbData data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("tutorialSewingTable"), 0x0333406C, 0x0), false);
                ParseLessons(data);
            }
            catch (Exception ex2)
            {
                //print("There was a problem, couldn't get the sewables settings (if the error is talking about an already existed key, then this does mean that you have the patterns! It just says that the sewing table has already parsed all the patterns already. So feel free to continue playing!)  \n \n" + ex2.Message.ToString());
                return;
            }
            try
            {
                bool bStore = true;
                if (HasBeenLoaded)
                {
                    return;                // you only want to run it once per gameplay session
                }
                HasBeenLoaded = true;

                // fill this in with the resourcekey of your SKIL xml
                XmlDbData data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("SewingSkill"), 0xA8D58BE5, 0x0), false);
                if (data == null)
                {
                    return;
                }
                if (data == null || data.Tables == null)
                {
                    return;
                }
                XmlDbTable xmlDbTable = null;
                data.Tables.TryGetValue("SkillList", out xmlDbTable);
                if (xmlDbTable == null)
                {
                    return;
                }
                foreach (XmlDbRow current in xmlDbTable.Rows)
                {
                    bool       flag    = false;
                    string     @string = current.GetString("Hex");
                    SkillNames guid    = (SkillNames)SkillManager.GetGuid(ref @string, bStore);
                    if (guid == SkillNames.None)
                    {
                        flag = true;
                    }
                    ProductVersion productVersion = ProductVersion.BaseGame;
                    double         skillVersion   = 0.0;
                    if (!flag)
                    {
                        Skill  skill   = null;
                        string string2 = current.GetString("CustomClassName");
                        bool   flag2   = string2.Length > 0;
                        if (flag2)
                        {
                            Type type = null;
                            if (bStore)
                            {
                                string[] array = string2.Split(new char[] {
                                    ','
                                });
                                if (array.Length < 2)
                                {
                                    flag = true;
                                }
                                else
                                {
                                    type = Type.GetType(array[0] + ",Sims3StoreObjects");
                                }
                            }
                            if (type == null)
                            {
                                type = Type.GetType(string2);
                            }
                            if (type == null)
                            {
                                flag = true;
                            }
                            else
                            {
                                object[] array2 = new object[] {
                                    guid
                                };
                                ConstructorInfo constructor = type.GetConstructor(Type.GetTypeArray(array2));
                                if (constructor == null)
                                {
                                    flag = true;
                                }
                                else
                                {
                                    skill = (constructor.Invoke(array2) as Skill);
                                    if (skill == null)
                                    {
                                        flag = true;
                                    }
                                }
                            }
                        }
                        else
                        {
                            skill = new Skill(guid);
                        }
                        if (!flag)
                        {
                            Skill.NonPersistableSkillData nonPersistableSkillData = new Skill.NonPersistableSkillData();
                            skill.NonPersistableData = nonPersistableSkillData;
                            uint num = ResourceUtils.ProductVersionToGroupId(productVersion);
                            nonPersistableSkillData.SkillProductVersion = productVersion;
                            nonPersistableSkillData.Name = "Gameplay/Excel/Skills/SkillList:" + current.GetString("SkillName");
                            string string3 = current.GetString("SkillDescription");
                            nonPersistableSkillData.Description   = (string.IsNullOrEmpty(string3) ? "" : ("Gameplay/Excel/Skills/SkillList:" + string3));
                            nonPersistableSkillData.MaxSkillLevel = current.GetInt("MaxSkillLevel", 0);
                            skill.Guid = guid;
                            nonPersistableSkillData.ThoughtBalloonTopicString = current.GetString("ThoughtBalloonTopic");
                            string string4 = current.GetString("IconKey");
                            nonPersistableSkillData.IconKey        = ResourceKey.CreatePNGKey(string4, num);
                            nonPersistableSkillData.SkillUIIconKey = ResourceKey.CreatePNGKey(current.GetString("SkillUIIcon"), num);
                            string        string5   = current.GetString("Commodity");
                            CommodityKind commodity = (CommodityKind)SkillManager.GetCommodity(string5, bStore);

                            nonPersistableSkillData.Commodity = commodity;
                            if (commodity != CommodityKind.None)
                            {
                                SkillManager.SkillCommodityMap[commodity] = guid;
                            }
                            if (bStore)
                            {
                                skillVersion = Convert.ToDouble(current.GetString("Version"));
                            }
                            nonPersistableSkillData.SkillVersion = skillVersion;
                            if (current.GetBool("Physical"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Physical);
                            }
                            if (current.GetBool("Mental"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Mental);
                            }
                            if (current.GetBool("Musical"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Musical);
                            }
                            if (current.GetBool("Creative"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Creative);
                            }
                            if (current.GetBool("Artistic"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Artistic);
                            }
                            if (current.GetBool("Hidden"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Hidden);
                            }
                            if (current.GetBool("Certificate"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Certificate);
                            }
                            if (current.Exists("HiddenWithSkillProgress") && current.GetBool("HiddenWithSkillProgress") && skill.HasCategory(SkillCategory.Hidden))
                            {
                                skill.AddCategoryToSkill(SkillCategory.HiddenWithSkillProgress);
                            }
                            if (current.GetBool("CanDecay"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.CanDecay);
                            }
                            int[] array3 = new int[skill.MaxSkillLevel];
                            int   num2   = 0;
                            for (int i = 1; i <= skill.MaxSkillLevel; i++)
                            {
                                string column = "Level_" + i.ToString();
                                num2         += current.GetInt(column, 0);
                                array3[i - 1] = num2;
                            }
                            nonPersistableSkillData.PointsForNextLevel      = array3;
                            nonPersistableSkillData.AlwaysDisplayLevelUpTns = current.GetBool("AlwaysDisplayTNS");
                            string[] array4 = new string[skill.MaxSkillLevel + 1];
                            for (int j = 2; j <= skill.MaxSkillLevel; j++)
                            {
                                string column2 = "Level_" + j.ToString() + "_Text";
                                array4[j - 1] = current.GetString(column2);
                                if (array4[j - 1] != string.Empty)
                                {
                                    array4[j - 1] = "Gameplay/Excel/Skills/SkillList:" + array4[j - 1];
                                }
                            }
                            array4[skill.MaxSkillLevel] = current.GetString("Level_10_Text_Alternate");
                            if (array4[skill.MaxSkillLevel] != string.Empty)
                            {
                                array4[skill.MaxSkillLevel] = "Gameplay/Excel/Skills/SkillList:" + array4[skill.MaxSkillLevel];
                            }
                            nonPersistableSkillData.LevelUpStrings = array4;
                            if (flag2)
                            {
                                XmlDbTable xmlDbTable2 = null;
                                string     string6     = current.GetString("CustomDataSheet");
                                data.Tables.TryGetValue(string6, out xmlDbTable2);
                                if (xmlDbTable2 == null && string6.Length > 0)
                                {
                                    flag  = true;
                                    skill = null;
                                }
                                else
                                {
                                    if (!skill.ParseSkillData(xmlDbTable2))
                                    {
                                        flag  = true;
                                        skill = null;
                                    }
                                }
                            }
                            nonPersistableSkillData.AvailableAgeSpecies      = ParserFunctions.ParseAllowableAgeSpecies(current, "AvailableAgeSpecies");
                            nonPersistableSkillData.DreamsAndPromisesIcon    = current.GetString("DreamsAndPromisesIcon");
                            nonPersistableSkillData.DreamsAndPromisesIconKey = ResourceKey.CreatePNGKey(nonPersistableSkillData.DreamsAndPromisesIcon, num);
                            nonPersistableSkillData.LogicSkillBoost          = current.GetBool("LogicSkillBoost");
                            if (!flag)
                            {
                                if (GenericManager <SkillNames, Skill, Skill> .sDictionary.ContainsKey((ulong)guid))
                                {
                                    if (GenericManager <SkillNames, Skill, Skill> .sDictionary[(ulong)guid].SkillVersion < skill.SkillVersion)
                                    {
                                        GenericManager <SkillNames, Skill, Skill> .sDictionary[(ulong)guid] = skill;
                                    }
                                }
                                else
                                {
                                    GenericManager <SkillNames, Skill, Skill> .sDictionary.Add((ulong)guid, skill);

                                    SkillManager.sSkillEnumValues.AddNewEnumValue(@string, guid);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                print("In Preload - caught issue" + ex.ToString());
                return;
            }
        }
コード例 #27
0
ファイル: WorldData.cs プロジェクト: yakoder/NRaas
        private static bool GetWorldFileDetails(ref WorldFileMetadata info)
        {
            string mWorldFile = info.mWorldFile;

            if (!mWorldFile.ToLower().EndsWith(".world"))
            {
                mWorldFile = mWorldFile + ".world";
            }

            info.mDescription = null;
            info.mWorldThumb  = null;
            info.mLotCount    = 0x0;

            WorldName worldName    = WorldName.Undefined;
            ulong     worldNameKey = 0x0L;

            string entryKey = UIManager.GetWorldMetadata(mWorldFile, ref info.mLotCount, ref info.mWorldThumb, ref worldNameKey, ref info.mWorldType, ref worldName);

            if (!GameUtils.WorldNameToType.ContainsKey(worldName))
            {
                GameUtils.WorldNameToType.Add(worldName, info.mWorldType);
            }

            ILocalizationModel localizationModel = Sims3.Gameplay.UI.Responder.Instance.LocalizationModel;

            if (entryKey != null)
            {
                if (localizationModel.HasLocalizationString(entryKey))
                {
                    info.mDescription = localizationModel.LocalizeString(entryKey, new object[0x0]);
                }
                else
                {
                    info.mDescription = entryKey;
                }
            }

            if ((worldNameKey != 0x0L) && localizationModel.HasLocalizationString(worldNameKey))
            {
                info.mCaption = localizationModel.LocalizeString(worldNameKey);
            }

            if (string.IsNullOrEmpty(info.mCaption))
            {
                BooterLogger.AddTrace("Untranslated " + mWorldFile + ": " + worldNameKey);

                if (mWorldFile.ToLower().EndsWith(".world"))
                {
                    int num2 = mWorldFile.LastIndexOfAny(new char[] { '\\', '/' });
                    info.mCaption = ((num2 >= 0x0) && (mWorldFile.Length > 0x0)) ? mWorldFile.Substring(num2 + 0x1) : mWorldFile.Substring(0x0, mWorldFile.Length - 0x6);
                }
                else
                {
                    info.mCaption = mWorldFile;
                }
            }

            if (info.mDescription == null)
            {
                info.mDescription = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce pulvinar. Donec faucibus, dolor eu porta lobortis ante nibh vulputate justo, velvolutpat odio sapien venenatis justo. Quisque sit amet felis acelit imperdiet hendrerit. Nam ut mauris et nisi varius portitor. Fusce blandit, diam id varius portitor, sem elit bibendum dolor, congue molestie sapien lorem vel dolor. Fusce laoreet est non urna euismod commodo. Donec enim quam, blandit at, placerat in, eleifend vitae, justo. Suspendisse potenti. In blandit pede sit amet sem. Nam condimentum sapien sit amet erat.";
            }

            if (info.mWorldThumb == null)
            {
                info.mWorldThumb = UIManager.LoadUIImage(ResourceKey.CreatePNGKey("game_entry_town_placeholder", 0x0));
            }
            return(true);
        }
コード例 #28
0
ファイル: HudModelEx.cs プロジェクト: yakoder/NRaas
        public static List <KnownInfo> GetKnownInfoList(HudModel ths, SimDescription otherSimDesc, InformationLearnedAboutSim learnedInfo)
        {
            List <KnownInfo> list = new List <KnownInfo>();

            Common.StringBuilder msg = new Common.StringBuilder("GetKnownInfoList" + Common.NewLine);

            try
            {
                if (otherSimDesc != null)
                {
                    bool   isHuman = otherSimDesc.IsHuman;
                    bool   isTeen  = (otherSimDesc.Age & CASAgeGenderFlags.Teen) != CASAgeGenderFlags.None;
                    bool   isChild = (otherSimDesc.Age & CASAgeGenderFlags.Child) != CASAgeGenderFlags.None;
                    string str     = Localization.LocalizeString("Ui/Caption/HUD/RelationshipsPanel:UnknownTrait", new object[0x0]);

                    msg += "A";

                    foreach (Trait trait in otherSimDesc.TraitManager.List)
                    {
                        if (!trait.IsVisible || !Localization.HasLocalizationString(trait.TraitNameInfo))
                        {
                            continue;
                        }
                        bool flag4 = false;
                        foreach (TraitNames names in learnedInfo.Traits)
                        {
                            if (trait.Guid == names)
                            {
                                list.Add(new KnownInfo(trait.TraitName(otherSimDesc.IsFemale), trait.IconKey, KnownInfoType.Trait));
                                flag4 = true;
                                break;
                            }
                        }
                        if (!flag4)
                        {
                            list.Add(new KnownInfo(str, ResourceKey.CreatePNGKey("trait_unknown", 0x0), KnownInfoType.TraitUnknown));
                        }
                    }

                    msg += "B";

                    if ((isHuman && learnedInfo.CareerKnown) && !isChild)
                    {
                        bool      flag5        = false;
                        WorldName currentWorld = GameUtils.GetCurrentWorld();
                        if ((otherSimDesc.HomeWorld != currentWorld) && (GameUtils.GetWorldType(currentWorld) == WorldType.Vacation))
                        {
                            MiniSimDescription description = MiniSimDescription.Find(otherSimDesc.SimDescriptionId);
                            if (description != null)
                            {
                                ResourceKey iconKey = string.IsNullOrEmpty(description.JobIcon) ? ResourceKey.kInvalidResourceKey : ResourceKey.CreatePNGKey(description.JobIcon, 0x0);
                                list.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, description.JobOrServiceName, new object[0x0]), iconKey, KnownInfoType.Career));
                                flag5 = true;
                            }
                        }

                        msg += "C";

                        if (!flag5)
                        {
                            CareerManager careerManager = otherSimDesc.CareerManager;
                            if ((careerManager != null) && (careerManager.Occupation != null))
                            {
                                msg += "C1";

                                Occupation    occupation = careerManager.Occupation;
                                string        careerIcon = occupation.CareerIcon;
                                ResourceKey   key2       = string.IsNullOrEmpty(careerIcon) ? ResourceKey.kInvalidResourceKey : ResourceKey.CreatePNGKey(careerIcon, 0x0);
                                KnownInfoType type       = occupation.IsAcademicCareer ? KnownInfoType.AcademicCareer : KnownInfoType.Career;
                                list.Add(new KnownInfo(occupation.CurLevelJobTitle, key2, type));
                            }
                            else if ((otherSimDesc.CreatedByService != null) && Sims3.Gameplay.Services.Services.IsSimDescriptionInAnyServicePool(otherSimDesc))
                            {
                                string str4 = Localization.LocalizeString(otherSimDesc.IsFemale, "Gameplay/Services/Title:" + otherSimDesc.CreatedByService.ServiceType.ToString(), new object[0x0]);
                                list.Add(new KnownInfo(str4, ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                            }
                            else if ((otherSimDesc.AssignedRole != null) && !string.IsNullOrEmpty(otherSimDesc.AssignedRole.CareerTitleKey))
                            {
                                list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, otherSimDesc.AssignedRole.CareerTitleKey, new object[0x0]), ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                            }
                            else if (((careerManager != null) && (careerManager.Occupation == null)) && (careerManager.RetiredCareer != null))
                            {
                                list.Add(new KnownInfo(Localization.LocalizeString("Ui/Caption/HUD/Career:Retired", new object[0x0]), ResourceKey.CreatePNGKey(careerManager.RetiredCareer.CareerIcon, 0x0), KnownInfoType.Career));
                            }
                            else
                            {
                                list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:Unemployed", new object[0x0]), ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                            }
                        }
                    }

                    msg += "D";

                    if (learnedInfo.PartnerKnown)
                    {
                        string      firstName            = null;
                        ResourceKey relationshipImageKey = ResourceKey.kInvalidResourceKey;
                        if (otherSimDesc.Partner != null)
                        {
                            msg += "D1";

                            firstName = otherSimDesc.Partner.FirstName;

                            // Custom : false -> true
                            Relationship relationship = otherSimDesc.GetRelationship(otherSimDesc.Partner, true);
                            if (relationship != null)
                            {
                                relationshipImageKey = RelationshipFunctions.GetLTRRelationshipImageKey(relationship.LTR.CurrentLTR, relationship.IsPetToPetRelationship);
                            }
                        }
                        else
                        {
                            msg += "D2";

                            if (otherSimDesc.HomeWorld != GameUtils.GetCurrentWorld())
                            {
                                MiniSimDescription description2 = MiniSimDescription.Find(otherSimDesc.SimDescriptionId);
                                if ((description2 != null) && (description2.PartnerId != 0x0L))
                                {
                                    MiniSimDescription otherSim = MiniSimDescription.Find(description2.PartnerId);
                                    if (otherSim != null)
                                    {
                                        firstName = otherSim.FirstName;
                                        MiniRelationship miniRelationship = description2.GetMiniRelationship(otherSim) as MiniRelationship;
                                        if (miniRelationship != null)
                                        {
                                            relationshipImageKey = RelationshipFunctions.GetLTRRelationshipImageKey(miniRelationship.CurrentLTR, miniRelationship.IsPetToPetRelationship);
                                        }
                                    }
                                }
                            }

                            if (string.IsNullOrEmpty(firstName))
                            {
                                firstName = Localization.LocalizeString("Ui/Caption/HUD/KnownInfoDialog:None", new object[0x0]);
                            }
                        }
                        list.Add(new KnownInfo(firstName, relationshipImageKey, KnownInfoType.Partner));
                    }

                    msg += "E";

                    if ((isHuman && (isTeen || isChild)) && ((otherSimDesc.CareerManager != null) && (otherSimDesc.CareerManager.School != null)))
                    {
                        list.Add(new KnownInfo(otherSimDesc.CareerManager.School.Name, ResourceKey.CreatePNGKey(otherSimDesc.CareerManager.School.CareerIcon, 0x0), KnownInfoType.School));
                    }

                    if (learnedInfo.IsRichAndKnownToBeRich)
                    {
                        list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:IsRich", new object[0x0]), ResourceKey.CreatePNGKey("w_simoleon_32", 0x0), KnownInfoType.Rich));
                    }

                    if (isHuman && learnedInfo.SignKnown)
                    {
                        Zodiac zodiac = otherSimDesc.Zodiac;
                        list.Add(new KnownInfo(Localization.LocalizeString(otherSimDesc.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:" + zodiac.ToString(), new object[0x0]), ResourceKey.CreatePNGKey("sign_" + zodiac.ToString() + "_sm", 0x0), KnownInfoType.Zodiac));
                    }

                    if (isHuman && learnedInfo.AlmaMaterKnown)
                    {
                        if (otherSimDesc.AlmaMater != AlmaMater.None)
                        {
                            list.Add(new KnownInfo(otherSimDesc.AlmaMaterName, ResourceKey.CreatePNGKey("w_simple_school_career_s", 0), KnownInfoType.AlmaMater));
                        }
                        if (((otherSimDesc.CareerManager != null) && (otherSimDesc.CareerManager.DegreeManager != null)) && (otherSimDesc.CareerManager.DegreeManager.GetDegreeEntries().Count > 0))
                        {
                            list.Add(new KnownInfo(Localization.LocalizeString("Ui/Caption/HUD/KnownInfoTooltip:UniversityAlmaMater", new object[0]), ResourceKey.CreatePNGKey("moodlet_just_graduated", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.AlmaMater));
                        }
                    }

                    msg += "G";

                    uint celebrityLevel = otherSimDesc.CelebrityLevel;
                    if (celebrityLevel > 0x0)
                    {
                        KnownInfo item = new KnownInfo(otherSimDesc.CelebrityManager.LevelName, ResourceKey.CreatePNGKey("hud_i_celebrity_page", 0x0), KnownInfoType.CelebrityLevel);
                        item.mCelebrityLevel = celebrityLevel;
                        list.Add(item);
                    }

                    msg += "H";

                    if (learnedInfo.IsSocialGroupsKnown)
                    {
                        TraitManager traitManager = otherSimDesc.TraitManager;
                        SkillManager skillManager = otherSimDesc.SkillManager;
                        if ((traitManager != null) && (skillManager != null))
                        {
                            if (traitManager.HasElement(TraitNames.InfluenceNerd))
                            {
                                InfluenceSkill skill = skillManager.GetSkill <InfluenceSkill>(SkillNames.InfluenceNerd);
                                if ((skill != null) && (skill.SkillLevel > 0))
                                {
                                    list.Add(new KnownInfo(string.Concat(new object[] { Localization.LocalizeString("Ui/Tooltips/SocialGroup:Nerd", new object[0]), "(", skill.SkillLevel, ")" }), ResourceKey.CreatePNGKey("trait_SocialGroup01_s", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.SocialGroup));
                                }
                            }
                            if (traitManager.HasElement(TraitNames.InfluenceSocialite))
                            {
                                InfluenceSkill skill2 = skillManager.GetSkill <InfluenceSkill>(SkillNames.InfluenceSocialite);
                                if ((skill2 != null) && (skill2.SkillLevel > 0))
                                {
                                    list.Add(new KnownInfo(string.Concat(new object[] { Localization.LocalizeString("Ui/Tooltips/SocialGroup:Jock", new object[0]), "(", skill2.SkillLevel, ")" }), ResourceKey.CreatePNGKey("trait_SocialGroup03_s", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.SocialGroup));
                                }
                            }
                            if (traitManager.HasElement(TraitNames.InfluenceRebel))
                            {
                                InfluenceSkill skill3 = skillManager.GetSkill <InfluenceSkill>(SkillNames.InfluenceRebel);
                                if ((skill3 != null) && (skill3.SkillLevel > 0))
                                {
                                    list.Add(new KnownInfo(string.Concat(new object[] { Localization.LocalizeString("Ui/Tooltips/SocialGroup:Rebel", new object[0]), "(", skill3.SkillLevel, ")" }), ResourceKey.CreatePNGKey("trait_SocialGroup02_s", ResourceUtils.ProductVersionToGroupId(ProductVersion.EP9)), KnownInfoType.SocialGroup));
                                }
                            }
                        }
                    }

                    msg += "I";

                    if (learnedInfo.NumDegreesKnown() > 0)
                    {
                        KnownInfo info2 = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                        otherSimDesc.CareerManager.DegreeManager.GetCompletedDegreeEntries();
                        foreach (AcademicDegreeNames names2 in learnedInfo.Degrees)
                        {
                            AcademicDegree element = otherSimDesc.CareerManager.DegreeManager.GetElement(names2);
                            if ((element != null) && element.IsDegreeCompleted)
                            {
                                if (info2.mDegreeIcons.Count == 5)
                                {
                                    list.Add(info2);
                                    info2 = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                                }
                                ResourceKey key4 = ResourceKey.CreatePNGKey(element.DegreeIcon, 0);
                                info2.mDegreeIcons.Add(key4);
                                info2.mIconKey = key4;
                                info2.mInfo    = element.DegreeName;
                            }
                        }
                        list.Add(info2);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(otherSimDesc, null, msg, e);
            }

            return(list);
        }