Esempio n. 1
0
        protected void ParseTemperatures(Season currentSeason)
        {
            XmlDbData xmlData = XmlDbData.ReadData("Seasons");

            if ((xmlData == null) || (xmlData.Tables == null))
            {
                return;
            }

            XmlDbTable xmlDbTable = SeasonsManager.GetXmlDbTable(xmlData, "Temperature");

            if (xmlDbTable != null)
            {
                foreach (XmlDbRow row in xmlDbTable.Rows)
                {
                    Season season;
                    if (!row.TryGetEnum <Season>("Season", out season, Season.Summer))
                    {
                        continue;
                    }

                    if (season != currentSeason)
                    {
                        continue;
                    }

                    ParseTemperature(row);
                }
            }
        }
Esempio n. 2
0
        public static int ReturnFee(WorkOut w)
        {
            int       price = 0;
            XmlDbData xdb   = XmlDbData.ReadData("WorkOutConfig");

            if ((xdb != null) && (xdb.Tables != null))
            {
                XmlDbTable table;

                if (xdb.Tables.TryGetValue("WorkOut", out table) && (table != null))
                {
                    foreach (XmlDbRow row in table.Rows)
                    {
                        switch (w)
                        {
                        case WorkOut.Swim:
                            price = row.GetInt("swimfee");
                            break;

                        case WorkOut.WorkOut:
                            price = row.GetInt("workoutfee");
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            return(price);
        }
Esempio n. 3
0
        public static WooHooConfig GetWooHooConfig()
        {
            WooHooConfig whc = new WooHooConfig();

            XmlDbData xdb = XmlDbData.ReadData("WooHooForMoneyConfig");

            if ((xdb != null) && (xdb.Tables != null))
            {
                XmlDbTable table;

                if (xdb.Tables.TryGetValue("WooHooConfig", out table) && (table != null))
                {
                    foreach (XmlDbRow row in table.Rows)
                    {
                        whc.pay           = row.GetInt("pay");
                        whc.skill         = (WooHooSkill)row.GetInt("skill");
                        whc.pregnancy     = row.GetInt("preg");
                        whc.TeenPregnancy = row.GetBool("tpreg");
                        whc.STD           = row.GetInt("std");
                        whc.Moodlets      = row.GetBool("moodlets");
                    }
                }
            }
            return(whc);
        }
Esempio n. 4
0
        public static void OnPreLoad()
        {
            if (HasBeenLoaded)
            {
                return;                // you only want to run it once per gameplay session
            }
            HasBeenLoaded = true;

            AddEnumValue <SkillNames>("EWPetFightingSkill", EWPetFightingSkill.skillNameID);
            AddEnumValue <CommodityKind>("SkillEWPetFight", EWPetFightingSkill.commodityKindID);

            // Load custom buffs
            (new BuffBooter()).LoadBuffData();

            // fill this in with the resourcekey of your SKIL xml
            XmlDbData data = XmlDbData.ReadData(new ResourceKey(0x494F3A8118D98C44, 0xA8D58BE5, 0x00000000), false);

            if (data == null)
            {
                return;
            }
            SkillManager.ParseSkillData(data, true);

            FightPet.Singleton  = new EWFightPet.EWFightPetDefinition();
            ChaseMean.Singleton = new EWChaseMean.EWChaseMeanDefinition();
            ChasePlay.Singleton = new EWChasePlay.EWChasePlayDefinition();
        }
Esempio n. 5
0
        // From InsectSpawner.ParseData
        protected static void ParseSpawnerData(XmlDbData data, bool bStore)
        {
            XmlDbTable table = null;

            data.Tables.TryGetValue("Spawners", out table);
            if (table != null)
            {
                foreach (XmlDbRow row in table.Rows)
                {
                    List <InsectType> list;
                    if (Insect.sInsectsTypes.TryParseSuperSetEnumCommaSeparatedList(row["Spawns"], out list, InsectType.Undefined))
                    {
                        string typeName = row["SpawnerClassName"];

                        // Custom, unsure why it is needed since EA Standard does not have it
                        if (!typeName.Contains(","))
                        {
                            typeName += ",Sims3GameplayObjects";
                        }

                        Type type = null;
                        if (bStore)
                        {
                            string[] strArray = typeName.Split(new char[] { '|' });
                            if (strArray.Length > 0x1)
                            {
                                typeName = strArray[0x0] + ",Sims3StoreObjects";
                                type     = Type.GetType(typeName, false, true);
                                if (type == null)
                                {
                                    typeName = strArray[0x0] + ',' + strArray[0x1];
                                }
                            }
                        }

                        if (type == null)
                        {
                            type = Type.GetType(typeName, false, true);
                        }

                        if (type != null)
                        {
                            FieldInfo field = type.GetField("kSpawnerData", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
                            if (field != null)
                            {
                                InsectSpawner.InsectSpawnerData spawnerData = field.GetValue(null) as InsectSpawner.InsectSpawnerData;
                                if ((spawnerData != null) && (spawnerData.SpawnerTuning != null))
                                {
                                    sOriginalSpawnChance[spawnerData.SpawnerTuning] = spawnerData.SpawnerTuning.SpawnChance;
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        public void AddBuffs(ResourceKey[] resourceKeys)
        {
            ResourceKey key  = new ResourceKey(ResourceUtils.HashString64("buffs_NonaMena_BreastfeedBaby"), 0x0333406C, 0x0);
            XmlDbData   data = XmlDbData.ReadData(key, false);

            if (data != null)
            {
                BuffManager.ParseBuffData(data, true);
            }
        }
Esempio n. 7
0
        public void AddBuffs(ResourceKey[] resourceKeys)
        {
            ResourceKey key  = new ResourceKey(ResourceUtils.HashString64("EWMedicineCat_Buffs"), 0x0333406C, 0x0);
            XmlDbData   data = XmlDbData.ReadData(key, false);

            if (data != null)
            {
                BuffManager.ParseBuffData(data, true);
            }
        }
Esempio n. 8
0
        // From InsectSpawner.ParseData
        protected static void ParseSpawnerData(XmlDbData data, bool bStore)
        {
            XmlDbTable table = null;
            data.Tables.TryGetValue("Spawners", out table);
            if (table != null)
            {
                foreach (XmlDbRow row in table.Rows)
                {
                    List<InsectType> list;
                    if (Insect.sInsectsTypes.TryParseSuperSetEnumCommaSeparatedList(row["Spawns"], out list, InsectType.Undefined))
                    {
                        string typeName = row["SpawnerClassName"];

                        // Custom, unsure why it is needed since EA Standard does not have it
                        if (!typeName.Contains(","))
                        {
                            typeName += ",Sims3GameplayObjects";
                        }

                        Type type = null;
                        if (bStore)
                        {
                            string[] strArray = typeName.Split(new char[] { '|' });
                            if (strArray.Length > 0x1)
                            {
                                typeName = strArray[0x0] + ",Sims3StoreObjects";
                                type = Type.GetType(typeName, false, true);
                                if (type == null)
                                {
                                    typeName = strArray[0x0] + ',' + strArray[0x1];
                                }
                            }
                        }

                        if (type == null)
                        {
                            type = Type.GetType(typeName, false, true);
                        }

                        if (type != null)
                        {
                            FieldInfo field = type.GetField("kSpawnerData", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
                            if (field != null)
                            {
                                InsectSpawner.InsectSpawnerData spawnerData = field.GetValue(null) as InsectSpawner.InsectSpawnerData;
                                if ((spawnerData != null) && (spawnerData.SpawnerTuning != null))
                                {
                                    sOriginalSpawnChance[spawnerData.SpawnerTuning] = spawnerData.SpawnerTuning.SpawnChance;
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 9
0
            public void Parse(string key, OnPopulate populate)
            {
                XmlDbData careerFile = XmlDbData.ReadData(key);

                if ((careerFile != null) && (careerFile.Tables != null) && (careerFile.Tables.ContainsKey("CareerData")))
                {
                    XmlDbTable table = careerFile.Tables["CareerData"];

                    foreach (XmlDbRow row in table.Rows)
                    {
                        string guid = row.GetString("Career");

                        string branch = row.GetString("Branch");
                        if (string.IsNullOrEmpty(branch))
                        {
                            branch = "Base";
                        }

                        int level = row.GetInt("Level");
                        if (level == 1)
                        {
                            continue;
                        }

                        OccupationNames careerGuid = OccupationNames.Undefined;
                        ParserFunctions.TryParseEnum <OccupationNames>(guid, out careerGuid, OccupationNames.Undefined);

                        if (careerGuid == OccupationNames.Undefined)
                        {
                            careerGuid = unchecked ((OccupationNames)ResourceUtils.HashString64(guid));
                        }

                        Dictionary <int, Dictionary <string, TData> > levels;
                        if (!mLevels.TryGetValue(careerGuid, out levels))
                        {
                            levels = new Dictionary <int, Dictionary <string, TData> >();
                            mLevels.Add(careerGuid, levels);
                        }

                        Dictionary <string, TData> branches;
                        if (!levels.TryGetValue(level, out branches))
                        {
                            branches = new Dictionary <string, TData>();
                            levels.Add(level, branches);
                        }

                        if (branches.ContainsKey(branch))
                        {
                            continue;
                        }

                        branches.Add(branch, populate(row));
                    }
                }
            }
Esempio n. 10
0
        public static bool Load(string fileName)
        {
            // BuffManager.ParseBuffData(XmlDbData.ReadData("Buffs"), false);
            XmlDbData xmlDbData = XmlDbData.ReadData(fileName);

            if (xmlDbData != null)
            {
                ParseBuffData(xmlDbData, true);
            }
            UIManager.NewHotInstallStoreBuffData += new UIManager.NewHotInstallStoreBuffCallback(BuffManager.LoadNewlyAddedBuffRecords);
            return(true);
        }
Esempio n. 11
0
        public static void ParseEWCatFishingPrimitives()
        {
            //sNodePrimitves = new Dictionary<uint, DreamNodePrimitive>();

            List <DreamNodePrimitive> cachePrimitives = new List <DreamNodePrimitive>();
            XmlDbData xmlDbData = XmlDbData.ReadData(new ResourceKey(0xC54CBCBB14C4EC27, 0x0333406C, 0x00000000), false);

            if (xmlDbData != null)
            {
                DreamsAndPromisesManager.ParseNodePrimitivesFromXmlDbData(xmlDbData, ref cachePrimitives, isStore: false);
            }
        }
Esempio n. 12
0
        public void OnPreLoad()
        {
            XmlDbData data = XmlDbData.ReadData("Insects");

            ParseSpawnerData(data, false);

            data = XmlDbData.ReadData(Insect.kKeyInsectsSpawners, false);
            if (data != null)
            {
                ParseSpawnerData(data, true);
            }
        }
Esempio n. 13
0
        public override void OnPreLoad()
        {
            Overwatch.Log(GetTitlePrefix());

            if (GameUtils.IsInstalled(ProductVersion.EP5))
            {
                if (SkillManager.sPetSkillFatigueTuning.Count == 0)
                {
                    SkillManager.ParsePetSkillFatigueRates(XmlDbData.ReadData("Skills"));

                    Overwatch.Log("  Loaded Missing Pet Fatigue Rates");
                }
            }
        }
Esempio n. 14
0
        public void OnPreLoad()
        {
            try
            {
                XmlDbData careerData = XmlDbData.ReadData("NRaas.StoryProgression.Retired");

                XmlDbData careerEventData = XmlDbData.ReadData("CareerEvents");

                if ((careerData != null) &&
                    (careerData.Tables != null) &&
                    (careerEventData != null) &&
                    (careerEventData.Tables != null) &&
                    (careerData.Tables.ContainsKey("CareerList")))
                {
                    XmlDbTable table = careerData.Tables["CareerList"];
                    foreach (XmlDbRow row in table.Rows)
                    {
                        string key = row.GetString("TableName");
                        if (key != "Retired")
                        {
                            continue;
                        }

                        if (careerData.Tables.ContainsKey(key))
                        {
                            XmlDbTable table2 = careerData.Tables[key];
                            if (table2 != null)
                            {
                                XmlDbTable table3 = null;
                                careerEventData.Tables.TryGetValue(key, out table3);

                                Career career = new Retired(row, table2, table3);

                                if ((career != null) && (career.Guid != OccupationNames.Undefined))
                                {
                                    if (!GenericManager <OccupationNames, Occupation, Occupation> .sDictionary.ContainsKey((ulong)career.Guid))
                                    {
                                        GenericManager <OccupationNames, Occupation, Occupation> .sDictionary.Add((ulong)career.Guid, career);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Common.Exception("Retired PreLoad", exception);
            }
        }
Esempio n. 15
0
 public static void ParseSkillData(XmlDbData data, bool bStore)
 {
     if ((data != null) && (data.Tables != null))
     {
         XmlDbTable table = null;
         data.Tables.TryGetValue("SkillList", out table);
         if (table != null)
         {
             foreach (XmlDbRow row in table.Rows)
             {
                 ParseSkillData(data, row, bStore);
             }
         }
     }
 }
Esempio n. 16
0
 public static void ParseSkillData(XmlDbData data, bool bStore)
 {
     if ((data != null) && (data.Tables != null))
     {
         XmlDbTable table = null;
         data.Tables.TryGetValue("SkillList", out table);
         if (table != null)
         {
             foreach (XmlDbRow row in table.Rows)
             {
                 ParseSkillData(data, row, bStore);
             }
         }
     }
 }
Esempio n. 17
0
 public void AddBuffs(ResourceKey[] resourceKeys)
 {
     try {
         /* Process the XML file inside the .package file */
         /* First is the FNV64 hash of file in the .package, second is the type (_XML), and third the group. */
         /* Customize first, leave second and third as they are. */
         ResourceKey key       = new ResourceKey(ResourceUtils.HashString64("Template.TplBuff.Buffs"), 0x0333406C, 0x0);
         XmlDbData   xmlDbData = XmlDbData.ReadData(key, false);
         if (xmlDbData != null)
         {
             BuffManager.ParseBuffData(xmlDbData, true);
         }
     } catch {
         /* You can use Logger to report failure */
     }
 }
Esempio n. 18
0
        public static void LoadBuffXMLandParse(ResourceKey[] resourceKeys)
        {
            ResourceKey key       = new ResourceKey(1655640191445312029ul, 53690476u, 0u);
            XmlDbData   xmlDbData = XmlDbData.ReadData(key, false);
            bool        flag      = xmlDbData != null;

            if (flag)
            {
                BuffManager.ParseBuffData(xmlDbData, true);
            }
            if (!once)
            {
                once = true;
                UIManager.NewHotInstallStoreBuffData += LoadBuffXMLandParse;
            }
        }
Esempio n. 19
0
        protected static bool LoadSkillBookData(XmlDbData spreadsheet, string bookSheet)
        {
            if (spreadsheet.Tables.ContainsKey(bookSheet))
            {
                XmlDbTable table    = spreadsheet.Tables[bookSheet];
                int        rowIndex = 0x0;
                foreach (XmlDbRow row in table.Rows)
                {
                    try
                    {
                        XmlDbData.XmlDbRowFast data = row as XmlDbData.XmlDbRowFast;
                        if (data != null)
                        {
                            if (row.Exists("AltSkill"))
                            {
                                data.mData.Remove("Skill");
                                data.mData.Add("Skill", row.GetString("AltSkill"));
                            }
                        }

                        BooterLogger.AddTrace("Skill Book Found: " + row.GetString("Skill"));

                        if (SkillManager.GetStaticSkill(SkillManager.sSkillEnumValues.ParseEnumValue(row.GetString("Skill"))) == null)
                        {
                            return(false);
                        }

                        BookSkillData book = new BookSkillData(row, rowIndex);

                        string msg = book.ID;

                        msg += Common.NewLine + "  AllowedWorldTypes " + new ListToString <WorldType>().Convert(book.AllowedWorldTypes);

                        msg += Common.NewLine + "  AllowedWorlds " + new ListToString <WorldName>().Convert(book.AllowedWorlds);

                        BooterLogger.AddTrace("Book Loaded: " + msg);
                    }
                    catch (Exception e)
                    {
                        Common.Exception("Title: " + row["Title"], e);
                    }

                    rowIndex++;
                }
            }
            return(true);
        }
        public static void ParseLessons(XmlDbData data)
        {
            bool       flag       = DeviceConfig.IsMac();
            XmlDbTable xmlDbTable = null;

            data.Tables.TryGetValue("Tutorialettes", out xmlDbTable);
            //Tutorialette.Tutorialettes = new List<TutorialetteDialog.TutorialetteData>();
            //Tutorialette.sIgnoreGlobalCooldown = new Dictionary<Lessons, bool>();
            List <TutorialetteDialog.TutorialettePage> list = null;

            //Tutorialette.sLessonTnsKeys = new Dictionary<Lessons, LessonTNSData>();
            foreach (XmlDbRow row in xmlDbTable.Rows)
            {
                ProductVersion productVersion;
                row.TryGetEnum("EPValid", out productVersion, ProductVersion.BaseGame);
                if (GameUtils.IsInstalled(productVersion))
                {
                    if (!string.IsNullOrEmpty(row["LessonKey"]))
                    {
                        //print("Lesson defaulted into: " + lessons.ToString());
                        string        lessonTnsKey = "Gameplay/Excel/Tutorial/Tutorialettes:" + row["TnsKey"];
                        LessonTNSData value        = new LessonTNSData(lessonTnsKey, productVersion);
                        Tutorialette.sLessonTnsKeys.Add((Lessons)207, value);
                        list = new List <TutorialetteDialog.TutorialettePage>();
                        Tutorialette.Tutorialettes.Add(new TutorialetteDialog.TutorialetteData("Gameplay/Excel/Tutorial/Tutorialettes:" + row["LessonName"], list, (int)207, (ulong)productVersion));
                        Tutorialette.sIgnoreGlobalCooldown.Add((Lessons)207, ParserFunctions.ParseBool(row["IgnoreGlobalCooldown"]));
                    }
                    if (list != null)
                    {
                        string text;
                        if (flag)
                        {
                            text = row["PageTextMac"];
                            if (string.IsNullOrEmpty(text))
                            {
                                text = row["PageText"];
                            }
                        }
                        else
                        {
                            text = row["PageText"];
                        }
                        list.Add(new TutorialetteDialog.TutorialettePage("Gameplay/Excel/Tutorial/Tutorialettes:" + text, row["PageImage"]));
                    }
                }
            }
        }
Esempio n. 21
0
        protected static bool LoadSkillBookData(XmlDbData spreadsheet, string bookSheet)
        {
            if (spreadsheet.Tables.ContainsKey(bookSheet))
            {
                XmlDbTable table = spreadsheet.Tables[bookSheet];
                int rowIndex = 0x0;
                foreach (XmlDbRow row in table.Rows)
                {
                    try
                    {
                        XmlDbData.XmlDbRowFast data = row as XmlDbData.XmlDbRowFast;
                        if (data != null)
                        {
                            if (row.Exists("AltSkill"))
                            {
                                data.mData.Remove("Skill");
                                data.mData.Add("Skill", row.GetString("AltSkill"));
                            }
                        }

                        BooterLogger.AddTrace("Skill Book Found: " + row.GetString("Skill"));

                        if (SkillManager.GetStaticSkill(SkillManager.sSkillEnumValues.ParseEnumValue(row.GetString("Skill"))) == null)
                        {
                            return false;
                        }

                        BookSkillData book = new BookSkillData(row, rowIndex);

                        string msg = book.ID;

                        msg += Common.NewLine + "  AllowedWorldTypes " + new ListToString<WorldType>().Convert(book.AllowedWorldTypes);

                        msg += Common.NewLine + "  AllowedWorlds " + new ListToString<WorldName>().Convert(book.AllowedWorlds);

                        BooterLogger.AddTrace("Book Loaded: " + msg);
                    }
                    catch(Exception e)
                    {
                        Common.Exception("Title: " + row["Title"], e);
                    }

                    rowIndex++;
                }
            }
            return true;
        }
Esempio n. 22
0
        public void AddTraits(ResourceKey[] resourceKeys)
        {
            try
            {
                ResourceKey key       = new ResourceKey(ResourceUtils.HashString64(sReference), 0x0333406C, 0u);
                XmlDbData   xmlDbData = XmlDbData.ReadData(key, false);

                if (xmlDbData != null)
                {
                    TraitManager.ParseTraitData(xmlDbData, true);
                }
            }
            catch (Exception e)
            {
                Common.DebugException("TraitBooter", e);
            }
        }
Esempio n. 23
0
        public void AddBuffs(ResourceKey[] keys)
        {
            try
            {
                ResourceKey key  = new ResourceKey(ResourceUtils.HashString64("Duglarogg.Abductor.Buffs"), 0x0333406C, 0u);
                XmlDbData   data = XmlDbData.ReadData(key, false);

                if (data != null)
                {
                    BuffManager.ParseBuffData(data, true);
                }
            }
            catch (Exception e)
            {
                Logger.WriteExceptionLog(e, this, "Duglarogg.AbductorSpace.Booters.BuffBooter.AddBuffs Error");
            }
        }
Esempio n. 24
0
        public void AddTraits(ResourceKey[] keys)
        {
            try
            {
                ResourceKey key  = new ResourceKey(ResourceUtils.HashString64(sFileName), 0x0333406C, 0u);
                XmlDbData   data = XmlDbData.ReadData(key, false);

                if (data != null)
                {
                    TraitManager.ParseTraitData(data, true);
                }
            }
            catch (Exception e)
            {
                Logger.WriteExceptionLog(e, this, "TraitBooter.AddTraits Error");
            }
        }
 public void ReadRecipe()
 {
     //debugger.Debug(this, "Starting recipe reading");
     Recipe.LoadRecipeData(XmlDbData.ReadData("MisukisuRecipeMasterList"), false);
     //foreach (Recipe current2 in Recipe.Recipes)
     //{
     //    string singleServingFull = current2.ModelsAndMaterials.SingleServingFull;
     //    ulong inst = (ulong)ResourceUtils.XorFoldHashString32(singleServingFull);
     //    for (uint num3 = 0u; num3 < 3u; num3 += 1u)
     //    {
     //        UIManager.GetThumbnailImage(new ThumbnailKey(new ResourceKey(inst, 23466547u, 1u), (ThumbnailSize)num3));
     //    }
     //}
     //debugger.Debug(this, "Recipes loaded ");
     //debugger.EndDebugLog();
     //TestStuff();
 }
Esempio n. 26
0
        public static void OnPreLoad()
        {
            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(0x67503AA43670DA12, 0xA8D58BE5, 0x00000000), false);

            if (data == null)
            {
                return;
            }
            SkillManager.ParseSkillData(data, true);
        }
Esempio n. 27
0
 public void AddBuffs(ResourceKey[] resourceKeys)
 {
     try
     {
         ResourceKey key       = new ResourceKey(ResourceUtils.HashString64("VampireTweaker_CustomBuffs"), 0x0333406C, 0x0);
         XmlDbData   xmlDbData = XmlDbData.ReadData(key, false);
         if (xmlDbData != null)
         {
             BuffManager.ParseBuffData(xmlDbData, true);
         }
     }
     catch (Exception e)
     {
         Debugger.WriteExceptionLog(e, this, null);
     }
     {
     }
 }
Esempio n. 28
0
        public static void OnPreLoad()
        {
            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("EW_MedicineCat_Skill"),
                                                                0xA8D58BE5, 0x00000000), false);

            if (data == null)
            {
                return;
            }
            SkillManager.ParseSkillData(data, true);
        }
Esempio n. 29
0
        public static int ReturnPrice()
        {
            int       price = 0;
            XmlDbData xdb   = XmlDbData.ReadData("CoffeeConfig");

            if ((xdb != null) && (xdb.Tables != null))
            {
                XmlDbTable table;

                if (xdb.Tables.TryGetValue("Coffee", out table) && (table != null))
                {
                    foreach (XmlDbRow row in table.Rows)
                    {
                        price = row.GetInt("price");
                    }
                }
            }
            return(price);
        }
Esempio n. 30
0
 // this is injected even for lots that aren't a bar to take advantage of the core and make the game honor
 // open/close times for roles and such
 public static void InjectBarData(string varname, TagStaticData tData)
 {
     Lot.MetaAutonomyType type;
     if (ParserFunctions.TryParseEnum <Lot.MetaAutonomyType>(varname, out type, Lot.MetaAutonomyType.None))
     {
         XmlDbTable table;
         XmlDbData  data = XmlDbData.ReadData("Bars");
         if (data.Tables.TryGetValue("Venues", out table))
         {
             XmlDbRow           row     = table.Rows[1];
             Bartending.BarData rowData = new Bartending.BarData(row);
             rowData.mHourOpen  = tData.openHour;
             rowData.mHourClose = tData.closeHour;
             if (!Bartending.sData.ContainsKey(type))
             {
                 Bartending.sData[type] = rowData;
             }
         }
     }
 }
        public static void ParseBooks()
        {
            string    text      = "BooksSewable";
            XmlDbData xmlDbData = XmlDbData.ReadData(text);

            if (xmlDbData != null && xmlDbData.Tables != null)
            {
                sDelayedSkillBooks.Add(xmlDbData);
                BookData.LoadBookData(xmlDbData, "BookSkill", BookData.BookType.Skill);
                bool loaded = true;
                if (loaded)
                {
                    Bookstore.mItemDictionary.Clear();
                    Bookstore.LoadData();
                }
            }
            else
            {
                SimpleMessageDialog.Show("[DEBUG] Arsil's CustomBookLoader", "Resource " + text + " of type _XML not found or with no data defined!");
            }
        }
Esempio n. 32
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupBrokenSkills");

            Dictionary <ulong, SimDescription> sims = SimListing.GetResidents(true);

            foreach (SimDescription sim in sims.Values)
            {
                Corrections.CleanupBrokenSkills(sim, Overwatch.Log);
            }

            if (GameUtils.IsInstalled(ProductVersion.EP5))
            {
                if (SkillManager.sPetSkillFatigueTuning.Count == 0)
                {
                    SkillManager.ParsePetSkillFatigueRates(XmlDbData.ReadData("Skills"));

                    Overwatch.Log("Loaded Missing Pet Fatigue Rates");
                }
            }
        }
Esempio n. 33
0
            public DataBootFile(string reference, string name, bool primary)
                : base(name, primary)
            {
                if (!string.IsNullOrEmpty(mName))
                {
                    try
                    {
                        mFile = XmlDbData.ReadData(mName);

                        if (IsValid)
                        {
                            BooterLogger.AddTrace("Found: " + mName);
                        }
                    }
                    catch (Exception e)
                    {
                        BooterLogger.AddError(mName + " Parse fail");

                        Common.Exception(reference + Common.NewLine + mName, e);
                    }
                }
            }
Esempio n. 34
0
        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 + ")");
                        }
                    }
                }
            }
        }
Esempio n. 35
0
        protected static void LoadWrittenBookMaterials(XmlDbData spreadsheet)
        {
            if (spreadsheet.Tables.ContainsKey("WrittenBookMaterials"))
            {
                XmlDbTable table = spreadsheet.Tables["WrittenBookMaterials"];

                int count = 0;

                foreach (XmlDbRow row in table.Rows)
                {
                    try
                    {
                        string item = row.GetString("Trashy");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Trashy].Add(item);
                        }
                        item = row.GetString("Drama");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Drama].Add(item);
                        }
                        item = row.GetString("SciFi");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.SciFi].Add(item);
                        }
                        item = row.GetString("Fantasy");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Fantasy].Add(item);
                        }
                        item = row.GetString("Humor");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Humor].Add(item);
                        }
                        item = row.GetString("Satire");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Satire].Add(item);
                        }
                        item = row.GetString("Mystery");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Mystery].Add(item);
                        }
                        item = row.GetString("Romance");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Romance].Add(item);
                        }
                        item = row.GetString("Historical");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Historical].Add(item);
                        }
                        item = row.GetString("Childrens");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Childrens].Add(item);
                        }
                        item = row.GetString("Vaudeville");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Vaudeville].Add(item);
                        }
                        item = row.GetString("Biography");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Biography].Add(item);
                        }
                        item = row.GetString("Article");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Article].Add(item);
                        }
                        item = row.GetString("Autobiography");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Autobiography].Add(item);
                        }
                        item = row.GetString("Masterpiece");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Masterpiece].Add(item);
                        }
                        item = row.GetString("PoliticalMemoir");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.PoliticalMemoir].Add(item);
                        }
                        item = row.GetString("LifeStory");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.LifeStory].Add(item);
                        }
                        item = row.GetString("Fiction");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Fiction].Add(item);
                        }
                        item = row.GetString("NonFiction");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.NonFiction].Add(item);
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP3))
                        {
                            item = row.GetString("ActionScreenplay");
                            if (item != "")
                            {
                                BookData.WrittenBookMaterials[BookData.BookGenres.ActionScreenplay].Add(item);
                            }
                            item = row.GetString("RomanticComedyScreenplay");
                            if (item != "")
                            {
                                BookData.WrittenBookMaterials[BookData.BookGenres.RomanticComedyScreenplay].Add(item);
                            }
                            item = row.GetString("DramaScreenplay");
                            if (item != "")
                            {
                                BookData.WrittenBookMaterials[BookData.BookGenres.DramaScreenplay].Add(item);
                            }
                            item = row.GetString("SciFiScreenplay");
                            if (item != "")
                            {
                                BookData.WrittenBookMaterials[BookData.BookGenres.SciFiScreenplay].Add(item);
                            }
                            item = row.GetString("IndieScreenplay");
                            if (item != "")
                            {
                                BookData.WrittenBookMaterials[BookData.BookGenres.IndieScreenplay].Add(item);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception("Entry: " + count, e);
                    }

                    count++;
                }
            }
        }
Esempio n. 36
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));
            }
        }
Esempio n. 37
0
            public DataBootFile(string reference, string name, bool primary)
                : base(name, primary)
            {
                if (!string.IsNullOrEmpty(mName))
                {
                    try
                    {
                        mFile = XmlDbData.ReadData(mName);

                        if (IsValid)
                        {
                            BooterLogger.AddTrace("Found: " + mName);
                        }
                    }
                    catch (Exception e)
                    {
                        BooterLogger.AddError(mName + " Parse fail");

                        Common.Exception(reference + Common.NewLine + mName, e);
                    }
                }
            }