Example #1
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            foreach (ulong key in track[0xC2])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }
                using (Stream input = Util.OpenFile(map[key], handler)) {
                    if (input == null)
                    {
                        continue;
                    }
                    STUD stud = new STUD(input);
                    if (stud.Instances == null || stud.Instances[0] == null)
                    {
                        continue;
                    }

                    HighlightType ht = stud.Instances[0] as HighlightType;
                    if (ht == null)
                    {
                        continue;
                    }

                    Console.Out.WriteLine($"{key}: {Util.GetString(ht.Data.name, map, handler)}");
                }
            }
        }
Example #2
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            Dictionary <ulong, JSONPkg> dict = new Dictionary <ulong, JSONPkg>();

            foreach (ulong key in track[0xA5])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }

                using (Stream input = Util.OpenFile(map[key], handler)) {
                    if (input == null)
                    {
                        continue;
                    }
                    STUD stud = new STUD(input);
                    if (stud.Instances == null || stud.Instances[0] == null)
                    {
                        continue;
                    }

                    PortraitItem master = stud.Instances[0] as PortraitItem;
                    if (master == null)
                    {
                        continue;
                    }
                    dict[key] = new JSONPkg {
                        LevelModifier = master.Data.bracket,
                        Tier          = master.Data.tier,
                        Stars         = master.Data.star,
                        MinimumLevel  = (master.Data.bracket - 11) * 10 + 1
                    };
                }
            }

            if (Path.GetDirectoryName(flags.Positionals[2]).Trim().Length > 0 && !Directory.Exists(Path.GetDirectoryName(flags.Positionals[2])))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(flags.Positionals[2]));
            }
            using (Stream file = File.OpenWrite(flags.Positionals[2])) {
                using (TextWriter writer = new StreamWriter(file)) {
                    writer.Write(JsonConvert.SerializeObject(dict, Formatting.Indented));
                }
            }
        }
Example #3
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            Console.Out.WriteLine();
            foreach (ulong master in track[0xCF])
            {
                if (!map.ContainsKey(master))
                {
                    continue;
                }
                STUD lootbox = new STUD(Util.OpenFile(map[master], handler));
                if (lootbox.Instances == null)
                {
                    continue;
                }
#if OUTPUT_STUDLOOTBOX
                Stream instream    = Util.OpenFile(map[master], handler);
                string outFilename = string.Format("./STUD/Lootboxes/{0:X16}.mat", master);
                string putPathname = outFilename.Substring(0, outFilename.LastIndexOf('/'));
                Directory.CreateDirectory(putPathname);
                Stream OutWriter = File.Create(outFilename);
                instream.CopyTo(OutWriter);
                OutWriter.Close();
                instream.Close();
#endif
                Lootbox box = lootbox.Instances[0] as Lootbox;
                if (box == null)
                {
                    continue;
                }
                Console.Out.WriteLine(box.EventNameNormal);
                Console.Out.WriteLine("\t{0}", Util.GetString(box.Master.title, map, handler));
                foreach (Lootbox.Bundle bundle in box.Bundles)
                {
                    Console.Out.WriteLine("\t\t{0}", Util.GetString(bundle.title, map, handler));
                }
            }
        }
Example #4
0
        public static void Extract(STUD itemStud, string output, string heroName, string itemName, string itemGroup, Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            string path = string.Format("{0}{1}{2}{1}{3}{1}{5}{1}{4}.dds", output, Path.DirectorySeparatorChar, Util.Strip(Util.SanitizePath(heroName)), Util.SanitizePath(itemStud.Instances[0].Name), Util.SanitizePath(itemName), Util.SanitizePath(itemGroup));

            if (itemStud.Instances == null)
            {
                return;
            }
            IconItem item = (IconItem)itemStud.Instances[0];

            if (item == null)
            {
                return;
            }
            if (!map.ContainsKey(item.Data.decal.key))
            {
                return;
            }
            STUD decalStud = new STUD(Util.OpenFile(map[item.Data.decal.key], handler));

            if (decalStud.Instances == null)
            {
                return;
            }
            Decal decal = (Decal)decalStud.Instances[0];

            if (decal == null)
            {
                return;
            }
            if (!map.ContainsKey(decal.Records[0].definiton.key))
            {
                return;
            }

            ImageDefinition definition = new ImageDefinition(Util.OpenFile(map[decal.Records[0].definiton.key], handler));

            ulong imageKey = definition.Layers[0].Key;

            if (!map.ContainsKey(imageKey))
            {
                return;
            }
            if (!Directory.Exists(Path.GetDirectoryName(path)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
            }

            ulong imageDataKey = (imageKey & 0xFFFFFFFFUL) | 0x100000000UL | 0x0320000000000000UL;

            using (Stream outp = File.Open(path, FileMode.Create, FileAccess.Write)) {
                if (map.ContainsKey(imageDataKey))
                {
                    Texture tex = new Texture(Util.OpenFile(map[imageKey], handler), Util.OpenFile(map[imageDataKey], handler));
                    tex.Save(outp);
                }
                else
                {
                    TextureLinear tex = new TextureLinear(Util.OpenFile(map[imageKey], handler));
                    tex.Save(outp);
                }
            }
            if (!quiet)
            {
                Console.Out.WriteLine("Wrote icon {0}", path);
            }
        }
Example #5
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            bool ex = System.Diagnostics.Debugger.IsAttached || flags.Expert;

            Console.Out.WriteLine("Listing Achievements");
            foreach (ulong key in track[0x68])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }

                using (Stream input = Util.OpenFile(map[key], handler))
                {
                    if (input == null)
                    {
                        continue;
                    }
                    STUD stud = new STUD(input);
                    if (stud.Instances == null || stud.Instances[0] == null)
                    {
                        continue;
                    }

                    Achievement achieve = stud.Instances[0] as Achievement;
                    if (achieve == null)
                    {
                        continue;
                    }

                    string achievementName        = Util.GetString(achieve.Header.name, map, handler);
                    string achievementDescription = Util.GetString(achieve.Header.description1, map, handler);
                    // string description2 = Util.GetString(achieve.Header.description2, map, handler); // Fancy popup description, only used for level 25 comp enabled achievement

                    Tuple <string, STUD, IInventorySTUDInstance> reward = GetRewardItem(achieve.Header.reward, map, handler);
                    string rewardName = reward.Item1;
                    STUD   rewardStud = reward.Item2;
                    IInventorySTUDInstance rewardInstance = reward.Item3;

                    if (ex)
                    {
                        Console.Out.WriteLine("{0} ({1:X16})", achievementName, GUID.LongKey(key));
                    }
                    else
                    {
                        Console.Out.WriteLine(achievementName);
                    }

                    if (rewardName != null)
                    {
                        Console.Out.WriteLine("\tReward: {0} ({1} {2})", rewardName, rewardInstance.Header.rarity, rewardStud.Instances[0].Name);
                    }

                    if (achievementDescription != null)
                    {
                        Console.Out.WriteLine("\tDescription: {0}", achievementDescription);
                    }
                }
            }
        }
Example #6
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            foreach (ulong key in track[0x75])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }

                using (Stream input = Util.OpenFile(map[key], handler)) {
                    //if (input == null) {
                    //    continue;
                    //}
                    //ISTU stu = ISTU.NewInstance(input, uint.MaxValue);
                    //if (stu.Instances == null) {
                    //    continue;
                    //}

                    //STUHero hero = stu.Instances.First() as STUHero;
                    //if (hero == null) {
                    //    continue;
                    //}
                    //if (hero.Name != null) {
                    //    Console.Out.WriteLine($"\n{Util.GetString(hero.Name, map, handler)}");
                    //} else {
                    //    Console.Out.WriteLine($"\nNULL:");
                    //}
                    //OWLib.Util.DumpSTUFields(hero);

                    //if (hero.Name != null) {
                    //    Console.Out.WriteLine($"{Util.GetString(hero.Name, map, handler)}: {hero.Unknown12} {hero.Unknown16} {hero.Unknown24} {hero.Unknown25}");
                    //} else {
                    //    Console.Out.WriteLine($"NULL: {hero.Unknown12} {hero.Unknown16} {hero.Unknown24} {hero.Unknown25}");
                    //}
                    // Console.Out.WriteLine($"\t{hero.PlayerType}\n\t{hero.AvailableAtLaunch}");

                    //Console.Out.WriteLine(Util.GetString(achieve.Name, map, handler));
                    //if (achieve.AbilityType == AbilityType.WEAPON) {
                    //    Console.Out.WriteLine($"\t{achieve.AbilityType}: {achieve.WeaponIndex}");
                    //} else {
                    //    Console.Out.WriteLine($"\t{achieve.AbilityType}");
                    //}
                    //Console.Out.WriteLine($"\t{Util.GetString(achieve.Description, map, handler)}");

                    // Console.Out.WriteLine($"{Util.GetString(achieve.Name, map, handler)}, {achieve.AbilityType}, {achieve.WeaponIndex}, {achieve.Unknown3}");
                }
            }
        }
Example #7
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            Dictionary <string, Dictionary <string, Dictionary <string, Dictionary <string, List <JSONPkg> > > > > dict_upper = new Dictionary <string, Dictionary <string, Dictionary <string, Dictionary <string, List <JSONPkg> > > > >();

            foreach (ulong key in track[0x75])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }

                using (Stream input = Util.OpenFile(map[key], handler)) {
                    if (input == null)
                    {
                        continue;
                    }
                    STUD stud = new STUD(input);
                    if (stud.Instances == null || stud.Instances[0] == null)
                    {
                        continue;
                    }

                    HeroMaster hero = stud.Instances[0] as HeroMaster;
                    if (hero == null)
                    {
                        continue;
                    }
                    Dictionary <string, Dictionary <string, Dictionary <string, List <JSONPkg> > > > dict = new Dictionary <string, Dictionary <string, Dictionary <string, List <JSONPkg> > > >();


                    string heroName = Util.GetString(hero.Header.name.key, map, handler);
                    if (heroName == null)
                    {
                        continue;
                    }
                    if (hero.Header.itemMaster.key == 0)   // AI
                    {
                        continue;
                    }

                    if (!map.ContainsKey(hero.Header.itemMaster.key))
                    {
                        continue;
                    }
                    STUD            inventoryStud = new STUD(Util.OpenFile(map[hero.Header.itemMaster.key], handler));
                    InventoryMaster master        = (InventoryMaster)inventoryStud.Instances[0];
                    if (master == null)
                    {
                        continue;
                    }

                    if (!dict.ContainsKey("ACHIEVEMENT"))
                    {
                        dict["ACHIEVEMENT"] = new Dictionary <string, Dictionary <string, List <JSONPkg> > >();
                    }

                    if (!dict.ContainsKey("STANDARD"))
                    {
                        dict["STANDARD"] = new Dictionary <string, Dictionary <string, List <JSONPkg> > >();
                    }

                    if (!dict.ContainsKey("AVAILABLE"))
                    {
                        dict["AVAILABLE"] = new Dictionary <string, Dictionary <string, List <JSONPkg> > >();
                    }

                    string s = ItemEvents.GetInstance().GetEvent(0);
                    if (!dict["ACHIEVEMENT"].ContainsKey(s))
                    {
                        dict["ACHIEVEMENT"][s] = new Dictionary <string, List <JSONPkg> >();
                    }

                    for (int i = 0; i < master.Achievables.Length; ++i)
                    {
                        JSONPkg pkg = JSONGeneral.GenerateJSONPkg(master.Achievables[i], map, handler);
                        if (pkg.Name == null)
                        {
                            continue;
                        }
                        pkg.EventId = 0;
                        pkg.Event   = s;

                        if (!dict["ACHIEVEMENT"][s].ContainsKey(pkg.Type))
                        {
                            dict["ACHIEVEMENT"][s][pkg.Type] = new List <JSONPkg>();
                        }
                        dict["ACHIEVEMENT"][s][pkg.Type].Add(pkg);
                    }

                    for (int i = 0; i < master.DefaultGroups.Length; ++i)
                    {
                        if (master.Defaults[i].Length == 0)
                        {
                            continue;
                        }

                        s = ItemEvents.GetInstance().GetEvent(master.DefaultGroups[i].@event);
                        if (!dict["STANDARD"].ContainsKey(s))
                        {
                            dict["STANDARD"][s] = new Dictionary <string, List <JSONPkg> >();
                        }

                        for (int j = 0; j < master.Defaults[i].Length; ++j)
                        {
                            JSONPkg pkg = GenerateJSONPkg(master.Defaults[i][j].key, map, handler);
                            if (pkg.Name == null)
                            {
                                continue;
                            }
                            pkg.EventId = master.DefaultGroups[i].@event;
                            pkg.Event   = s;

                            if (!dict["STANDARD"][s].ContainsKey(pkg.Type))
                            {
                                dict["STANDARD"][s][pkg.Type] = new List <JSONPkg>();
                            }
                            dict["STANDARD"][s][pkg.Type].Add(pkg);
                        }
                    }


                    for (int i = 0; i < master.ItemGroups.Length; ++i)
                    {
                        if (master.Items[i].Length == 0)
                        {
                            continue;
                        }

                        s = ItemEvents.GetInstance().GetEvent(master.ItemGroups[i].@event);
                        if (!dict["AVAILABLE"].ContainsKey(s))
                        {
                            dict["AVAILABLE"][s] = new Dictionary <string, List <JSONPkg> >();
                        }

                        for (int j = 0; j < master.Items[i].Length; ++j)
                        {
                            JSONPkg pkg = GenerateJSONPkg(master.Items[i][j].key, map, handler);
                            if (pkg.Name == null)
                            {
                                continue;
                            }
                            pkg.EventId = master.ItemGroups[i].@event;
                            pkg.Event   = s;

                            if (!dict["AVAILABLE"][s].ContainsKey(pkg.Type))
                            {
                                dict["AVAILABLE"][s][pkg.Type] = new List <JSONPkg>();
                            }
                            dict["AVAILABLE"][s][pkg.Type].Add(pkg);
                        }
                    }

                    dict_upper[heroName] = dict;
                }
            }

            if (Path.GetDirectoryName(flags.Positionals[2]).Trim().Length > 0 && !Directory.Exists(Path.GetDirectoryName(flags.Positionals[2])))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(flags.Positionals[2]));
            }
            using (Stream file = File.OpenWrite(flags.Positionals[2])) {
                using (TextWriter writer = new StreamWriter(file)) {
                    writer.Write(JsonConvert.SerializeObject(dict_upper, Formatting.Indented));
                }
            }
        }
Example #8
0
        private void Extract(ulong model, Lootbox lootbox, Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            if (model == 0 || !map.ContainsKey(model))
            {
                return;
            }

            string output = $"{flags.Positionals[2]}{Path.DirectorySeparatorChar}{Util.SanitizePath(lootbox.EventName)}{Path.DirectorySeparatorChar}";

            STUD stud = new STUD(Util.OpenFile(map[model], handler));

            HashSet <ulong>           models              = new HashSet <ulong>();
            Dictionary <ulong, ulong> animList            = new Dictionary <ulong, ulong>();
            HashSet <ulong>           parsed              = new HashSet <ulong>();
            Dictionary <ulong, List <ImageLayer> > layers = new Dictionary <ulong, List <ImageLayer> >();
            Dictionary <ulong, ulong>         replace     = new Dictionary <ulong, ulong>();
            Dictionary <ulong, List <ulong> > sound       = new Dictionary <ulong, List <ulong> >();

            foreach (ISTUDInstance inst in stud.Instances)
            {
                if (inst == null)
                {
                    continue;
                }
                if (inst.Name == stud.Manager.GetName(typeof(ComplexModelRecord)))
                {
                    ComplexModelRecord r = (ComplexModelRecord)inst;
                    ulong modelKey       = r.Data.model.key;
                    models.Add(modelKey);
                    Skin.FindAnimations(r.Data.animationList.key, sound, animList, replace, parsed, map, handler, models, layers, modelKey);
                    Skin.FindAnimations(r.Data.secondaryAnimationList.key, sound, animList, replace, parsed, map, handler, models, layers, modelKey);
                    Skin.FindTextures(r.Data.material.key, layers, replace, parsed, map, handler);
                }
            }

            Skin.Save(null, output, "", "", replace, parsed, models, layers, animList, flags, track, map, handler, model, false, quiet, sound, 0);
        }
Example #9
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            Dictionary <uint, Dictionary <uint, string> > data = new Dictionary <uint, Dictionary <uint, string> >();

            foreach (ulong key in track[0xC0])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }
                using (Stream input = Util.OpenFile(map[key], handler)) {
                    if (input == null)
                    {
                        continue;
                    }
                    STUD stud = new STUD(input);
                    if (stud.Instances == null || stud.Instances[0] == null)
                    {
                        continue;
                    }

                    GameType gm = stud.Instances[0] as GameType;
                    if (gm == null)
                    {
                        continue;
                    }

                    string name = Util.GetString(gm.Header.name, map, handler);
                    if (name != null)
                    {
                        uint ruleset = GUID.Index(gm.Header.raw_type);
                        if (!data.ContainsKey(ruleset))
                        {
                            data[ruleset] = new Dictionary <uint, string>();
                        }
                        data[ruleset].Add(GUID.Index(key), name);
                    }
                }
            }
            foreach (KeyValuePair <uint, Dictionary <uint, string> > pairs in data)
            {
                Console.Out.WriteLine("{0:X8}:", pairs.Key);
                foreach (KeyValuePair <uint, string> kv in pairs.Value)
                {
                    Console.Out.WriteLine("\t{0} ({1:X8})", kv.Value, kv.Key);
                }
            }
        }
Example #10
0
        public static void Extract(STUD itemStud, string output, string heroName, string itemName, string itemGroup, Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            string path = string.Format("{0}{1}{2}{1}{3}{1}{5}{1}{4}", output, Path.DirectorySeparatorChar, Util.Strip(Util.SanitizePath(heroName)), Util.SanitizePath(itemStud.Instances[0].Name), Util.SanitizePath(itemName), Util.SanitizePath(itemGroup));

            if (itemStud.Instances == null)
            {
                return;
            }
            PortraitItem item = (PortraitItem)itemStud.Instances[0];

            if (item == null)
            {
                return;
            }
            if (!map.ContainsKey(item.Data.portrait.key))
            {
                return;
            }
            if (!File.Exists($"{path} ({item.Data.bracket}).dds"))
            {
                Save(item.Data.portrait.key, $"{path} ({item.Data.bracket}).dds", map, quiet, handler);
            }
            if (!File.Exists($"{path} Star {item.Data.star}.dds"))
            {
                Save(item.Data.portrait2.key, $"{path} Star {item.Data.star}.dds", map, quiet, handler);
            }
        }
Example #11
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            foreach (ulong key in track[0x9E])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }

                using (Stream input = Util.OpenFile(map[key], handler)) {
                    if (input == null)
                    {
                        continue;
                    }
                    ISTU stu = ISTU.NewInstance(input, uint.MaxValue);
                    if (stu.Instances == null)
                    {
                        continue;
                    }

                    STULoadout ability = stu.Instances.First() as STULoadout;
                    if (ability == null)
                    {
                        continue;
                    }

                    Console.Out.WriteLine(Util.GetString(ability.Name, map, handler));
                    if (ability.Category == STULib.Types.Enums.LoadoutCategory.Weapon)
                    {
                        Console.Out.WriteLine($"\t{ability.Category}: {ability.WeaponIndex}");
                    }
                    else
                    {
                        Console.Out.WriteLine($"\t{ability.Category}");
                    }
                    Console.Out.WriteLine($"\t{Util.GetString(ability.Description, map, handler)}");

                    // Console.Out.WriteLine($"{Util.GetString(achieve.Name, map, handler)}, {achieve.AbilityType}, {achieve.WeaponIndex}, {achieve.Unknown3}");
                }
            }
        }
Example #12
0
        public static void Extract(ulong key, STUD stud, string output, string heroName, string name, string itemGroup, Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            string dest = string.Format("{0}{1}{2}{1}{3}{1}{5}{1}{4}{1}", output, Path.DirectorySeparatorChar, Util.Strip(Util.SanitizePath(heroName)), Util.SanitizePath(stud.Instances[0].Name), Util.SanitizePath(name), Util.SanitizePath(itemGroup));

            Dictionary <ulong, ulong> animList            = new Dictionary <ulong, ulong>();
            HashSet <ulong>           models              = new HashSet <ulong>();
            Dictionary <ulong, List <ImageLayer> > layers = new Dictionary <ulong, List <ImageLayer> >();
            Dictionary <ulong, List <ulong> >      sound  = new Dictionary <ulong, List <ulong> >();

            Skin.FindAnimations(key, sound, animList, new Dictionary <ulong, ulong>(), new HashSet <ulong>(), map, handler, models, layers, key);
            if (animList.Count > 0)
            {
                if (!Directory.Exists(dest))
                {
                    Directory.CreateDirectory(dest);
                }
                Skin.Save(null, dest, heroName, name, new Dictionary <ulong, ulong>(), new HashSet <ulong>(), models, layers, animList, flags, track, map, handler, 0, true, quiet, sound, 0);
            }
        }
Example #13
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            foreach (ulong key in track[0xD9])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }
                using (Stream input = Util.OpenFile(map[key], handler)) {
                    if (input == null)
                    {
                        continue;
                    }
                    ISTU stu = ISTU.NewInstance(input, uint.MaxValue);
                    if (stu.Instances == null)
                    {
                        continue;
                    }
                    STUBrawlName bn = stu.Instances.First() as STUBrawlName;

                    // BrawlName bn = stud.Instances[0] as BrawlName;
                    if (bn == null)
                    {
                        continue;
                    }

                    Console.Out.WriteLine($"{key}: {Util.GetString(bn.Name, map, handler)}");
                }
            }
        }
Example #14
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            foreach (ulong key in track[0x71])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }
                using (Stream input = Util.OpenFile(map[key], handler)) {
                    if (input == null)
                    {
                        continue;
                    }
                    STUD stud = new STUD(input);
                    if (stud.Instances == null || stud.Instances.Length < 1 || stud.Instances[1] == null)
                    {
                        continue;
                    }

                    Subtitle st = stud.Instances[1] as Subtitle;
                    if (st == null)
                    {
                        continue;
                    }

                    Console.Out.WriteLine($"{key}: {st.String}");
                }
            }
        }
Example #15
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            foreach (ulong key in track[0xC7])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }
                using (Stream input = Util.OpenFile(map[key], handler)) {
                    if (input == null)
                    {
                        continue;
                    }
                    STUD stud = new STUD(input);
                    if (stud.Instances == null || stud.Instances[0] == null)
                    {
                        continue;
                    }

                    GameMode gm = stud.Instances[0] as GameMode;
                    if (gm == null)
                    {
                        continue;
                    }

                    string name = Util.GetString(gm.Header.name, map, handler);
                    if (name != null)
                    {
                        string desc                  = Util.GetString(gm.Header.description, map, handler);
                        string difficultyName        = Util.GetString(gm.Header.difficultyName, map, handler);
                        string difficultyDescription = Util.GetString(gm.Header.difficultyDescription, map, handler);
                        Console.Out.WriteLine(name);

                        if (difficultyName != null)
                        {
                            Console.Out.WriteLine("\t{0}", difficultyName);
                        }

                        if (difficultyDescription != null)
                        {
                            Console.Out.WriteLine("\t{0}", difficultyDescription);
                        }

                        if (desc != null)
                        {
                            Console.Out.WriteLine("\t{0}", desc);
                        }
                        foreach (OWRecord @string in gm.Strings)
                        {
                            string str = Util.GetString(@string, map, handler);
                            if (str != null)
                            {
                                Console.Out.WriteLine("\t{0}", str);
                            }
                        }
                        foreach (OWRecord gp in gm.Params)
                        {
                            string str = GetGameParam(gp, map, handler);
                            if (str != null)
                            {
                                Console.Out.WriteLine("\t{0}", str);
                            }
                        }
                        foreach (OWRecord gt in gm.Types)
                        {
                            string str = GetGameType(gt, map, handler);
                            if (str != null)
                            {
                                Console.Out.WriteLine("\t{0}", str);
                            }
                        }
                    }
                }
            }
        }
Example #16
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            Dictionary <string, Dictionary <string, Dictionary <string, List <JSONPkg> > > > dict = new Dictionary <string, Dictionary <string, Dictionary <string, List <JSONPkg> > > >();

            foreach (ulong key in track[0x54])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }

                using (Stream input = Util.OpenFile(map[key], handler)) {
                    if (input == null)
                    {
                        continue;
                    }
                    STUD stud = new STUD(input);
                    if (stud.Instances == null || stud.Instances[0] == null)
                    {
                        continue;
                    }

                    GlobalInventoryMaster master = stud.Instances[0] as GlobalInventoryMaster;
                    if (master == null)
                    {
                        continue;
                    }

                    if (!dict.ContainsKey("ACHIEVEMENT"))
                    {
                        dict["ACHIEVEMENT"] = new Dictionary <string, Dictionary <string, List <JSONPkg> > >();
                    }

                    if (!dict.ContainsKey("AVAILABLE"))
                    {
                        dict["AVAILABLE"] = new Dictionary <string, Dictionary <string, List <JSONPkg> > >();
                    }

                    if (!dict.ContainsKey("LOOTBOX_EXCLUSIVE"))
                    {
                        dict["LOOTBOX_EXCLUSIVE"] = new Dictionary <string, Dictionary <string, List <JSONPkg> > >();
                    }

                    for (int i = 0; i < master.Generic.Length; ++i)
                    {
                        if (master.GenericItems[i].Length == 0)
                        {
                            continue;
                        }
                        string s = ItemEvents.GetInstance().GetEvent(master.Generic[i].@event);
                        if (!dict["ACHIEVEMENT"].ContainsKey(s))
                        {
                            dict["ACHIEVEMENT"][s] = new Dictionary <string, List <JSONPkg> >();
                        }

                        for (int j = 0; j < master.GenericItems[i].Length; ++j)
                        {
                            JSONPkg pkg = GenerateJSONPkg(master.GenericItems[i][j].key, map, handler);
                            if (pkg.Name == null)
                            {
                                continue;
                            }
                            pkg.EventId = master.Generic[i].@event;
                            pkg.Event   = s;

                            if (!dict["ACHIEVEMENT"][s].ContainsKey(pkg.Type))
                            {
                                dict["ACHIEVEMENT"][s][pkg.Type] = new List <JSONPkg>();
                            }
                            dict["ACHIEVEMENT"][s][pkg.Type].Add(pkg);
                        }
                    }

                    for (int i = 0; i < master.Categories.Length; ++i)
                    {
                        if (master.CategoryItems[i].Length == 0)
                        {
                            continue;
                        }

                        string s = ItemEvents.GetInstance().GetEvent(master.Categories[i].@event);
                        if (!dict["AVAILABLE"].ContainsKey(s))
                        {
                            dict["AVAILABLE"][s] = new Dictionary <string, List <JSONPkg> >();
                        }

                        for (int j = 0; j < master.CategoryItems[i].Length; ++j)
                        {
                            JSONPkg pkg = GenerateJSONPkg(master.CategoryItems[i][j].key, map, handler);
                            if (pkg.Name == null)
                            {
                                continue;
                            }
                            pkg.EventId = master.Categories[i].@event;
                            pkg.Event   = s;

                            if (!dict["AVAILABLE"][s].ContainsKey(pkg.Type))
                            {
                                dict["AVAILABLE"][s][pkg.Type] = new List <JSONPkg>();
                            }
                            dict["AVAILABLE"][s][pkg.Type].Add(pkg);
                        }
                    }

                    for (int i = 0; i < master.ExclusiveOffsets.Length; ++i)
                    {
                        if (master.LootboxExclusive[i].Length == 0)
                        {
                            continue;
                        }

                        string s = ItemEvents.GetInstance().GetEvent((ulong)i);
                        if (!dict["LOOTBOX_EXCLUSIVE"].ContainsKey(s))
                        {
                            dict["LOOTBOX_EXCLUSIVE"][s] = new Dictionary <string, List <JSONPkg> >();
                        }

                        for (int j = 0; j < master.LootboxExclusive[i].Length; ++j)
                        {
                            JSONPkg pkg = GenerateJSONPkg(master.LootboxExclusive[i][j].item, map, handler);
                            if (pkg.Name == null)
                            {
                                continue;
                            }
                            pkg.EventId = (ulong)i;
                            pkg.Event   = s;

                            if (!dict["LOOTBOX_EXCLUSIVE"][s].ContainsKey(pkg.Type))
                            {
                                dict["LOOTBOX_EXCLUSIVE"][s][pkg.Type] = new List <JSONPkg>();
                            }
                            dict["LOOTBOX_EXCLUSIVE"][s][pkg.Type].Add(pkg);
                        }
                    }
                }
            }

            if (Path.GetDirectoryName(flags.Positionals[2]).Trim().Length > 0 && !Directory.Exists(Path.GetDirectoryName(flags.Positionals[2])))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(flags.Positionals[2]));
            }
            using (Stream file = File.OpenWrite(flags.Positionals[2])) {
                using (TextWriter writer = new StreamWriter(file)) {
                    writer.Write(JsonConvert.SerializeObject(dict, Formatting.Indented));
                }
            }
        }
Example #17
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            Console.Out.WriteLine();
            foreach (ulong master in track[0xCF])
            {
                if (!map.ContainsKey(master))
                {
                    continue;
                }
                STUD lootbox = new STUD(Util.OpenFile(map[master], handler));
                if (lootbox.Instances == null)
                {
                    continue;
                }
                Lootbox box = lootbox.Instances[0] as Lootbox;
                if (box == null)
                {
                    continue;
                }

                Extract(box.Master.model, box, track, map, handler, quiet, flags);
                Extract(box.Master.alternate, box, track, map, handler, quiet, flags);
            }
        }