Exemple #1
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);
                    }
                }
            }
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            /* if (radioButton2.Checked)
             * {
             *  verifiedTextBox1.Text = "ATTENDANCE DISCREDITED";
             *  verifiedTextBox.Text = "ATTENDANCE DISCREDITED";
             *  this.Validate();
             *  this.table1BindingSource2.EndEdit();
             *  this.tableAdapterManager2.UpdateAll(this.attendanceRecDataSet);*/

            if (adminrdb.Checked)
            {
                STAFFMEM.Hide();
                STUD.Hide();
            }
            else if (staffrdb.Checked)
            {
                admintb.Hide();
                STAFFMEM.Enabled = true;
                STAFFMEM.Show();
                ADLOT.Hide();
                ADLIN.Hide();
                STUD.Hide();
            }
            else if (studentrdb.Checked)
            {
                admintb.Hide();
                STUD.Enabled = true;
                STUD.Show();
                ADLOT.Hide();
                ADLIN.Hide();
                STAFFMEM.Hide();
            }
        }
Exemple #3
0
        private string GetGameParam(ulong key, Dictionary <ulong, Record> map, CASCHandler handler)
        {
            if (!map.ContainsKey(key))
            {
                return(null);
            }

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

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

                return(Util.GetString(gm.Header.name, map, handler));
            }
        }
Exemple #4
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)}");
                }
            }
        }
Exemple #5
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);
            }
        }
Exemple #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[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}");
                }
            }
        }
Exemple #7
0
        public static JSONPkg GenerateJSONPkg(ulong key, Dictionary <ulong, Record> map, CASCHandler handler)
        {
            if (!map.ContainsKey(key))
            {
                return(new JSONPkg {
                    Name = null
                });
            }

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

            if (stud.Instances == null)
            {
                return(new JSONPkg {
                    Name = null
                });
            }
            if (stud.Instances[0] == null)
            {
                return(new JSONPkg {
                    Name = null
                });
            }
            IInventorySTUDInstance instance = stud.Instances[0] as IInventorySTUDInstance;

            if (instance == null)
            {
                return(new JSONPkg {
                    Name = null
                });
            }

            JSONPkg pkg = new JSONPkg {
            };

            pkg.Name        = Util.GetString(instance.Header.name, map, handler);
            pkg.Description = ListInventory.GetDescription(instance, map, handler);
            pkg.Subline     = Util.GetString(instance.Header.available_in, map, handler);
            pkg.Key         = key;
            pkg.Rarity      = instance.Header.rarity.ToString();

            if (instance is CreditItem)
            {
                pkg.Description = $"{(instance as CreditItem).Data.value} Credits";
            }
            else if (instance is PortraitItem)
            {
                PortraitItem portrait = instance as PortraitItem;
                string       s        = "s";
                if (portrait.Data.star == 1)
                {
                    s = "";
                }
                pkg.Description = $"Tier {portrait.Data.tier} - At least level {(portrait.Data.bracket - 11) * 10 + 1} - {portrait.Data.star} star{s}";
            }

            pkg.Type = instance.Name.ToUpperInvariant();

            return(pkg);
        }
Exemple #8
0
        public static Tuple <string, STUD, IInventorySTUDInstance> GetInventoryName(ulong key, Dictionary <ulong, Record> map, CASCHandler handler)
        {
            if (!map.ContainsKey(key))
            {
                return(null);
            }

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

            if (stud.Instances == null)
            {
                return(null);
            }
            if (stud.Instances[0] == null)
            {
                return(null);
            }
            IInventorySTUDInstance instance = stud.Instances[0] as IInventorySTUDInstance;

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

            return(new Tuple <string, STUD, IInventorySTUDInstance>(Util.GetString(instance.Header.name.key, map, handler), stud, instance));
        }
Exemple #9
0
        public static void FindSoundsEx(ulong key, HashSet <ulong> done, Dictionary <ulong, List <ulong> > ret, Dictionary <ulong, Record> map, CASCHandler handler, Dictionary <ulong, ulong> replace, ulong parent)
        {
            if (replace.ContainsKey(key))
            {
                key = replace[key];
            }
            if (!map.ContainsKey(key))
            {
                return;
            }
            if (!done.Add(key))
            {
                return;
            }
            if (CheckAddEntry(ret, parent, key))
            {
                return;
            }

            using (Stream studStream = Util.OpenFile(map[key], handler)) {
                if (studStream == null)
                {
                    return;
                }
                STUD stud = new STUD(studStream, true, STUDManager.Instance, false, true);
                FindSoundsSTUD(stud, done, ret, map, handler, replace, parent, key);
            }
        }
Exemple #10
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            List <ulong> masters = track[0x75];
            List <ulong> blank   = new List <ulong>();
            Dictionary <ulong, ulong> blankdict = new Dictionary <ulong, ulong>();
            List <string>             extract   = new List <string>();

            for (int i = 3; i < flags.Positionals.Length; ++i)
            {
                extract.Add(flags.Positionals[i].ToLowerInvariant());
            }
            foreach (ulong masterKey in masters)
            {
                if (!map.ContainsKey(masterKey))
                {
                    continue;
                }
                STUD masterStud = new STUD(Util.OpenFile(map[masterKey], handler));
                if (masterStud.Instances == null)
                {
                    continue;
                }
                HeroMaster master = (HeroMaster)masterStud.Instances[0];
                if (master == null)
                {
                    continue;
                }
                string heroName = Util.GetString(master.Header.name.key, map, handler);
                if (heroName == null)
                {
                    continue;
                }
                if (extract.Count > 0 && !extract.Contains(heroName.ToLowerInvariant()))
                {
                    continue;
                }
                if (master.Header.itemMaster.key != 0)   // AI
                {
                    InventoryMaster inventory = Extract.OpenInventoryMaster(master, map, handler);
                    if (inventory.ItemGroups.Length > 0 || inventory.DefaultGroups.Length > 0)
                    {
                        continue;
                    }
                }
                Console.Out.WriteLine("{0} {1:X}", heroName, GUID.Index(masterKey));
                string path = string.Format("{0}{1}{2}{1}{3:X}{1}", flags.Positionals[2], Path.DirectorySeparatorChar, Util.Strip(Util.SanitizePath(heroName)), GUID.LongKey(masterKey));

                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, List <ulong> >      sound  = new Dictionary <ulong, List <ulong> >();

                ExtractLogic.Skin.FindModels(master.Header.binding, blank, models, animList, layers, blankdict, parsed, map, handler, sound);

                ExtractLogic.Skin.Save(master, path, heroName, $"{GUID.LongKey(masterKey):X}", blankdict, parsed, models, layers, animList, flags, track, map, handler, masterKey, false, quiet, sound, 0);
            }
        }
Exemple #11
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            Console.Out.WriteLine("key_name          key");
            foreach (ulong key in track[0x90])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }
                using (Stream stream = Util.OpenFile(map[key], handler)) {
                    if (stream == null)
                    {
                        continue;
                    }
                    STUD stud = new STUD(stream);
                    if (stud.Instances[0].Name != stud.Manager.GetName(typeof(EncryptionKey)))
                    {
                        continue;
                    }
                    EncryptionKey ek = (EncryptionKey)stud.Instances[0];
                    Console.Out.WriteLine("{0}  {1}", ek.KeyNameText, ek.KeyValueText);
                }
            }

            if (System.Diagnostics.Debugger.IsAttached)
            {
                using (Stream output = File.Open("ow_dump.keys", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read)) {
                    using (TextWriter writer = new StreamWriter(output)) {
                        foreach (KeyValuePair <ulong, byte[]> key in KeyService.keys)
                        {
                            writer.WriteLine("{0:X16} {1}", key.Key, ByteArrayToString(key.Value));
                        }
                    }
                }
                if (handler.Config.KeyRing != null)
                {
                    using (Stream output = File.Open("ow_keyring.keys", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read)) {
                        using (TextWriter writer = new StreamWriter(output)) {
                            foreach (KeyValuePair <string, List <string> > pair in handler.Config.KeyRing.KeyValue)
                            {
                                if (pair.Key.StartsWith("key-"))
                                {
                                    string reverseKey = pair.Key.Substring(pair.Key.Length - 16);
                                    string key        = "";
                                    for (int i = 0; i < 8; ++i)
                                    {
                                        key = reverseKey.Substring(i * 2, 2) + key;
                                    }
                                    ulong keyL = ulong.Parse(key, System.Globalization.NumberStyles.HexNumber);
                                    writer.WriteLine("{0:X16} {1}", keyL, pair.Value[0].ToByteArray());
                                }
                            }
                        }
                    }
                }
            }
        }
        public Form1()
        {
            InitializeComponent();
            STAFFMEM.Show();
            ADLOT.Show();
            ADLIN.Show();
            STUD.Show();

            STAFFMEM.Enabled = true;
            ADLOT.Enabled    = true;
            ADLIN.Enabled    = true;
            STUD.Enabled     = true;
            admintb.Text     = null;
        }
Exemple #13
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            string output = flags.Positionals[2];

            List <ulong> masters = track[0x9D];
            Dictionary <ulong, ulong> replace = new Dictionary <ulong, ulong>();

            foreach (ulong masterKey in masters)
            {
                if (!map.ContainsKey(masterKey))
                {
                    continue;
                }
                STUD masterStud = new STUD(Util.OpenFile(map[masterKey], handler));
                if (masterStud.Instances == null || masterStud.Instances[0] == null)
                {
                    continue;
                }
                AnnouncerVoiceList master = (AnnouncerVoiceList)masterStud.Instances[0];
                if (master == null)
                {
                    continue;
                }
                string path = string.Format("{0}{1}{2:X}{1}Announcer{1}", output, Path.DirectorySeparatorChar, GUID.Index(masterKey));

                HashSet <ulong> done = new HashSet <ulong>();

                Console.Out.WriteLine("Dumping voice lines for announcer {0:X}", GUID.Index(masterKey));

                Dictionary <ulong, List <ulong> > soundData = new Dictionary <ulong, List <ulong> >();
                for (int i = 0; i < master.Entries.Length; ++i)
                {
                    AnnouncerVoiceList.AnnouncerFXEntry entry = master.Entries[i];
                    OWRecord[] primary   = master.Primary[i];
                    OWRecord[] secondary = master.Secondary[i];
                    Sound.FindSoundsEx(entry.master, done, soundData, map, handler, replace, masterKey);
                    foreach (OWRecord record in primary)
                    {
                        Sound.FindSoundsEx(record, done, soundData, map, handler, replace, masterKey);
                    }
                    foreach (OWRecord record in secondary)
                    {
                        Sound.FindSoundsEx(record, done, soundData, map, handler, replace, masterKey);
                    }
                }

                DumpVoice.Save(path, soundData, map, handler, quiet);
            }
        }
Exemple #14
0
        public static InventoryMaster OpenInventoryMaster(HeroMaster master, Dictionary <ulong, Record> map, CASCHandler handler)
        {
            if (!map.ContainsKey(master.Header.itemMaster.key))
            {
                return(null);
            }
            STUD            inventoryStud = new STUD(Util.OpenFile(map[master.Header.itemMaster.key], handler));
            InventoryMaster inventory     = (InventoryMaster)inventoryStud.Instances[0];

            if (inventory == null)
            {
                return(null);
            }
            return(inventory);
        }
Exemple #15
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);
                }
            }
        }
Exemple #16
0
        public static void DumpSTU(Stream file, string @out)
        {
            if (!Directory.Exists(@out))
            {
                Directory.CreateDirectory(@out);
            }

            STUDManager manager = STUDManager.Instance;

            file.Position = 0;

            STUD stud = new STUD(file, true, new STUDManager(), false, true);

            if (stud.Instances == null)
            {
                Console.Out.WriteLine("Unknown error while parsing STU");
            }

            uint i = 0;

            if (stud.Instances != null)
            {
                foreach (ISTUDInstance instance in stud.Instances)
                {
                    STUDummy dummy = instance as STUDummy;
                    if (dummy == null)
                    {
                        if (System.Diagnostics.Debugger.IsAttached)
                        {
                            System.Diagnostics.Debugger.Break();
                        }
                    }
                    else
                    {
                        string traditional_name = manager.GetName(dummy.Id) ?? $"{dummy.Id:X8}";
                        string filename         =
                            $"{i:X8}_{dummy.Offset:X8}_{OverTool.Util.SanitizePath(traditional_name)}.stu";
                        using (Stream outputStream = File.Open(Path.Combine(@out, filename), FileMode.Create,
                                                               FileAccess.Write, FileShare.Read)) {
                            dummy.Data.Position = 0;
                            dummy.Data.CopyTo(outputStream);
                        }
                    }
                    ++i;
                }
            }
            Console.Out.WriteLine("Dumped {0} STU instances", i);
        }
Exemple #17
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            List <ulong> ids = new List <ulong>();

            foreach (string arg in flags.Positionals.Skip(2))
            {
                ids.Add(ulong.Parse(arg.Split('.')[0], System.Globalization.NumberStyles.HexNumber));
            }
            Console.Out.WriteLine("Scanning for textures...");
            foreach (ulong f003 in track[0x3])
            {
                STUD record = new STUD(Util.OpenFile(map[f003], handler), true, STUDManager.Instance, false, true);
                if (record.Instances == null)
                {
                    continue;
                }
                foreach (ISTUDInstance instance in record.Instances)
                {
                    if (instance == null)
                    {
                        continue;
                    }
                    if (instance.Name == record.Manager.GetName(typeof(ComplexModelRecord)))
                    {
                        ComplexModelRecord r = (ComplexModelRecord)instance;
                        if (ids.Contains(GUID.LongKey(r.Data.model.key)))
                        {
                            Dictionary <ulong, List <ImageLayer> > layers = new Dictionary <ulong, List <ImageLayer> >();
                            ExtractLogic.Skin.FindTextures(r.Data.material.key, layers, new Dictionary <ulong, ulong>(), new HashSet <ulong>(), map, handler);
                            Console.Out.WriteLine("Model ID {0:X12}", GUID.LongKey(r.Data.model.key));
                            foreach (KeyValuePair <ulong, List <ImageLayer> > pair in layers)
                            {
                                Console.Out.WriteLine("Material ID {0:X16}", pair.Key);
                                HashSet <ulong> dedup = new HashSet <ulong>();
                                foreach (ImageLayer layer in pair.Value)
                                {
                                    if (dedup.Add(layer.Key))
                                    {
                                        Console.Out.WriteLine("Texture ID {0:X12}", GUID.LongKey(layer.Key));
                                    }
                                }
                            }
                            ids.Remove(GUID.LongKey(r.Data.model.key));
                        }
                    }
                }
            }
        }
Exemple #18
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));
                }
            }
        }
Exemple #19
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);
            }
        }
Exemple #20
0
 public static string GetDescription(IInventorySTUDInstance instance, Dictionary <ulong, Record> map, CASCHandler handler)
 {
     if (instance.Header.description != 0)
     {
         using (Stream descStream = Util.OpenFile(map[instance.Header.description], handler)) {
             STUD description = new STUD(descStream);
             if (description.Instances == null)
             {
                 return(null);
             }
             InventoryDescription desc = description.Instances[0] as InventoryDescription;
             if (desc == null)
             {
                 return(null);
             }
             return(Util.GetString(desc.Header.str, map, handler));
         }
     }
     return(null);
 }
Exemple #21
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));
                }
            }
        }
Exemple #22
0
        public static string GetName(Dictionary <ulong, Record> map, CASCHandler handler, ulong id)
        {
            if (handler == null)
            {
                return(null);
            }

            ResolveType type = (ResolveType)GUID.Type(id);

            if (type == ResolveType.COSMETIC)
            {
                return(ListInventory.GetInventoryName(id, map, handler)?.Item1);
            }

            if (type == ResolveType.WEAPON_SKIN)
            {
                return(null); // TODO: A lot of overhead to get weaponskin name.
            }

            if (type == ResolveType.HERO)
            {
                STUD       hero   = new STUD(OverTool.Util.OpenFile(map[id], handler));
                HeroMaster master = hero?.Instances[0] as HeroMaster;
                if (master == null)
                {
                    return(null);
                }
                return(OverTool.Util.GetString(master.Header.name.key, map, handler));
            }

            if (type == ResolveType.MAP)
            {
                return(null); // TODO: document 002 file types
            }

            return(null);
        }
Exemple #23
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);
        }
Exemple #24
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);
            }
        }
Exemple #25
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            List <ulong> masters = track[0x75];

            foreach (ulong masterKey in masters)
            {
                if (!map.ContainsKey(masterKey))
                {
                    continue;
                }
                STUD masterStud = new STUD(Util.OpenFile(map[masterKey], handler));
                if (masterStud.Instances == null)
                {
                    continue;
                }
                HeroMaster master = (HeroMaster)masterStud.Instances[0];
                if (master == null)
                {
                    continue;
                }
                string heroName = Util.GetString(master.Header.name.key, map, handler);
                if (heroName == null)
                {
                    continue;
                }
                if (master.Header.itemMaster.key != 0)   // AI
                {
                    InventoryMaster inventory = Extract.OpenInventoryMaster(master, map, handler);
                    if (inventory.ItemGroups.Length > 0 || inventory.DefaultGroups.Length > 0)
                    {
                        continue;
                    }
                }
                Console.Out.WriteLine("{0} {1:X}", heroName, GUID.LongKey(masterKey));
            }
        }
Exemple #26
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            List <ulong> masters = track[0x75];

            foreach (ulong masterKey in masters)
            {
                if (!map.ContainsKey(masterKey))
                {
                    continue;
                }
                STUD masterStud = new STUD(Util.OpenFile(map[masterKey], handler));

                if (masterStud.Instances == null)
                {
                    continue;
                }
                HeroMaster master = (HeroMaster)masterStud.Instances[0];
                if (master == null)
                {
                    continue;
                }
                string heroName = Util.GetString(master.Header.name.key, map, handler);
                if (heroName == null)
                {
                    continue;
                }
                string goodhero = heroName;
                foreach (var c in Path.GetInvalidFileNameChars())
                {
                    goodhero = goodhero.Replace(c, '_');
                }

                if (master.Header.itemMaster.key == 0)   // AI
                {
                    continue;
                }
                bool ex = System.Diagnostics.Debugger.IsAttached || flags.Expert;

                bool hasName = false;
                if (!map.ContainsKey(master.Header.itemMaster.key))
                {
                    Console.Out.WriteLine("Error loading inventory master file...");
                    continue;
                }
                STUD inventoryStud = new STUD(Util.OpenFile(map[master.Header.itemMaster.key], handler));
#if OUTPUT_STUDINVENTORYMASTER
                Stream studStream  = Util.OpenFile(map[master.Header.itemMaster.key], handler);
                string outFilename = string.Format("./STUDs/ListInventoryMaster/{0}.stud", goodhero);
                string putPathname = outFilename.Substring(0, outFilename.LastIndexOf('/'));
                Directory.CreateDirectory(putPathname);
                Stream OutWriter = File.Create(outFilename);
                studStream.CopyTo(OutWriter);
                OutWriter.Close();
                studStream.Close();
#endif
                InventoryMaster inventory = (InventoryMaster)inventoryStud.Instances[0];
                if (inventory == null)
                {
                    Console.Out.WriteLine("Error loading inventory master file...");
                    continue;
                }

                Dictionary <int, string> indexMap = new Dictionary <int, string>();
                List <OWRecord>          items    = new List <OWRecord>();

                items.AddRange(inventory.Achievables.ToList());

                for (int i = 0; i < inventory.DefaultGroups.Length; ++i)
                {
                    string name = $"STANDARD_{ItemEvents.GetInstance().GetEvent(inventory.DefaultGroups[i].@event)}";
                    items.AddRange(inventory.Defaults[i].ToList());
                }

                for (int i = 0; i < inventory.ItemGroups.Length; ++i)
                {
                    string name = ItemEvents.GetInstance().GetEvent(inventory.ItemGroups[i].@event);
                    items.AddRange(inventory.Items[i].ToList());
                }

                foreach (OWRecord record in items)
                {
                    STUD item = new STUD(Util.OpenFile(map[record], handler));
                    if (item.Instances == null)
                    {
                        continue;
                    }
                    WeaponSkinItem skin = item.Instances[0] as WeaponSkinItem;
                    if (skin == null)
                    {
                        continue;
                    }
                    if (!hasName)
                    {
                        if (ex)
                        {
                            Console.Out.WriteLine("Weapons for {0} ({2:X16}) in package {1:X16}", heroName, map[masterKey].package.packageKey, masterKey);
                        }
                        else
                        {
                            Console.Out.WriteLine("Weapons for {0}", heroName);
                        }
                        hasName = true;
                    }

                    Console.Out.WriteLine("\tIndex {0} - {1}", skin.Data.index, Util.GetString(skin.Header.name, map, handler));
                }

                if (hasName)
                {
                    Console.Out.WriteLine("");
                }
            }
        }
Exemple #27
0
        public static void GetInventoryName(ulong key, bool ex, Dictionary <ulong, Record> map, CASCHandler handler, string heroName)
        {
            Tuple <string, STUD, IInventorySTUDInstance> data = GetInventoryName(key, map, handler);

            if (data == null)
            {
                return;
            }
            string name = data.Item1;
            STUD   stud = data.Item2;
            IInventorySTUDInstance instance = data.Item3;

            if (name == null && instance.Name != stud.Manager.GetName(typeof(CreditItem)))
            {
                Console.Out.WriteLine("\t\t(Untitled-{0:X12}) ({1} {2})", GUID.LongKey(key), instance.Header.rarity, stud.Instances[0].Name);
                return;
            }
#if OUTPUT_STUDINVENTORY
            Stream studStream = Util.OpenFile(map[key], handler);
            string filename   = string.Format("{0}_{1}", instance.Name, name);
            foreach (var c in Path.GetInvalidFileNameChars())
            {
                filename = filename.Replace(c, '_');
            }
            string outFilename = string.Format("./STUDs/Inventory/{0}/{1}.stud", heroName, filename);
            string putPathname = outFilename.Substring(0, outFilename.LastIndexOf('/'));
            Directory.CreateDirectory(putPathname);
            Stream OutWriter = File.Create(outFilename);
            studStream.CopyTo(OutWriter);
            OutWriter.Close();
            studStream.Close();
#endif

            string addt = string.Empty;

            if (instance.Name == stud.Manager.GetName(typeof(CreditItem)))
            {
                CreditItem credits = (CreditItem)instance;
                name = $"{credits.Data.value} Credits";
            }
            if (instance.Name == stud.Manager.GetName(typeof(WeaponSkinItem)))
            {
                WeaponSkinItem weapon = (WeaponSkinItem)instance;
                addt = $" Index {weapon.Data.index}";
            }

            if (ex)
            {
                Console.Out.WriteLine("\t\t{0} ({1} {2} in file {3:X16}){4}", name, instance.Header.rarity, stud.Instances[0].Name, GUID.LongKey(key), addt);
            }
            else
            {
                Console.Out.WriteLine("\t\t{0} ({1} {2}){3}", name, instance.Header.rarity, stud.Instances[0].Name, addt);
            }

            if (instance.Header.description != 0)
            {
                using (Stream descStream = Util.OpenFile(map[instance.Header.description], handler)) {
                    STUD description = new STUD(descStream);
                    if (description.Instances == null)
                    {
                        return;
                    }
                    InventoryDescription desc = description.Instances[0] as InventoryDescription;
                    if (desc == null)
                    {
                        return;
                    }
                    string descriptionStr = Util.GetString(desc.Header.str, map, handler);
                    if (!string.IsNullOrEmpty(descriptionStr))
                    {
                        Console.Out.WriteLine("\t\t\t{0}", descriptionStr);
                    }
                }
            }
        }
Exemple #28
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));
                }
            }
        }
Exemple #29
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            List <ulong> masters = track[0x75];

            foreach (ulong masterKey in masters)
            {
                if (!map.ContainsKey(masterKey))
                {
                    continue;
                }
                STUD masterStud = new STUD(Util.OpenFile(map[masterKey], handler));

                if (masterStud.Instances == null)
                {
                    continue;
                }
                HeroMaster master = (HeroMaster)masterStud.Instances[0];
                if (master == null)
                {
                    continue;
                }
                string heroName = Util.GetString(master.Header.name.key, map, handler);
                if (heroName == null)
                {
                    continue;
                }
                string goodhero = heroName;
                foreach (var c in Path.GetInvalidFileNameChars())
                {
                    goodhero = goodhero.Replace(c, '_');
                }

                if (master.Header.itemMaster.key == 0)   // AI
                {
                    continue;
                }
                bool ex = System.Diagnostics.Debugger.IsAttached || flags.Expert;
                if (ex)
                {
                    Console.Out.WriteLine("Cosmetics for {0} ({1:X16})", heroName, GUID.LongKey(masterKey));
                }
                else
                {
                    Console.Out.WriteLine("Cosmetics for {0}", heroName);
                }
                if (!map.ContainsKey(master.Header.itemMaster.key))
                {
                    Console.Out.WriteLine("Error loading inventory master file...");
                    continue;
                }
                STUD inventoryStud = new STUD(Util.OpenFile(map[master.Header.itemMaster.key], handler));
#if OUTPUT_STUDINVENTORYMASTER
                Stream studStream  = Util.OpenFile(map[master.Header.itemMaster.key], handler);
                string outFilename = string.Format("./STUDs/ListInventoryMaster/{0}.stud", goodhero);
                string putPathname = outFilename.Substring(0, outFilename.LastIndexOf('/'));
                Directory.CreateDirectory(putPathname);
                Stream OutWriter = File.Create(outFilename);
                studStream.CopyTo(OutWriter);
                OutWriter.Close();
                studStream.Close();
#endif
                InventoryMaster inventory = (InventoryMaster)inventoryStud.Instances[0];
                if (inventory == null)
                {
                    Console.Out.WriteLine("Error loading inventory master file...");
                    continue;
                }

                Console.Out.WriteLine("\tACHIEVEMENT ({0} items)", inventory.Achievables.Length);
                foreach (OWRecord record in inventory.Achievables)
                {
                    GetInventoryName(record.key, ex, map, handler, goodhero);
                }

                for (int i = 0; i < inventory.DefaultGroups.Length; ++i)
                {
                    if (inventory.Defaults[i].Length == 0)
                    {
                        continue;
                    }
                    OWRecord[] records = inventory.Defaults[i];
                    Console.Out.WriteLine("\tSTANDARD_{0} ({1} items)", ItemEvents.GetInstance().GetEvent(inventory.DefaultGroups[i].@event), records.Length);
                    foreach (OWRecord record in records)
                    {
                        GetInventoryName(record.key, ex, map, handler, goodhero);
                    }
                }

                for (int i = 0; i < inventory.ItemGroups.Length; ++i)
                {
                    if (inventory.Items[i].Length == 0)
                    {
                        continue;
                    }
                    OWRecord[] records = inventory.Items[i];
                    Console.Out.WriteLine("\t{0} ({1} items)", ItemEvents.GetInstance().GetEvent(inventory.ItemGroups[i].@event), records.Length);
                    foreach (OWRecord record in records)
                    {
                        GetInventoryName(record.key, ex, map, handler, goodhero);
                    }
                }
                Console.Out.WriteLine("");
            }
        }
Exemple #30
0
        public static void FindSoundsSTUD(STUD stud, HashSet <ulong> done, Dictionary <ulong, List <ulong> > ret, Dictionary <ulong, Record> map, CASCHandler handler, Dictionary <ulong, ulong> replace, ulong parent, ulong mykey)
        {
            foreach (ISTUDInstance instance in stud.Instances)
            {
                if (instance == null)
                {
                    continue;
                }

                if (instance.Name == stud.Manager.GetName(typeof(GenericRecordReference)))
                {
                    GenericRecordReference inst = (GenericRecordReference)instance;
                    FindSoundsEx(inst.Reference.key.key, done, ret, map, handler, replace, mykey);
                }
                else if (instance.Name == stud.Manager.GetName(typeof(UISoundList)))
                {
                    UISoundList inst = (UISoundList)instance;
                    foreach (UISoundList.SoundListEntry[] list in inst.Entries)
                    {
                        foreach (UISoundList.SoundListEntry entry in list)
                        {
                            FindSoundsExD(entry.sound, done, ret, map, handler, replace, mykey);
                        }
                    }
                }
                else if (instance.Name == stud.Manager.GetName(typeof(GenericSoundReference)))
                {
                    GenericSoundReference inst = (GenericSoundReference)instance;
                    FindSoundsEx(inst.Reference.key.key, done, ret, map, handler, replace, mykey);
                }
                else if (instance.Name == stud.Manager.GetName(typeof(ChildGameParameterRecord)))
                {
                    ChildGameParameterRecord inst = (ChildGameParameterRecord)instance;
                    FindSoundsEx(inst.Param.binding.key, done, ret, map, handler, replace, mykey);
                    FindSoundsEx(inst.Param.binding2.key, done, ret, map, handler, replace, mykey);
                }
                else if (instance.Name == stud.Manager.GetName(typeof(SoundMasterList)))
                {
                    SoundMasterList smr = (SoundMasterList)instance;
                    foreach (ulong key in smr.Sound)
                    {
                        FindSoundsEx(key, done, ret, map, handler, replace, mykey);
                    }
                    if (smr.Owner != null)
                    {
                        foreach (ulong key in smr.Owner)
                        {
                            FindSoundsEx(key, done, ret, map, handler, replace, mykey);
                        }
                    }
                }
                else if (instance.Name == stud.Manager.GetName(typeof(SoundOwner)))
                {
                    SoundOwner owner = (SoundOwner)instance;
                    FindSoundsEx(owner.Data.soundbank.key, done, ret, map, handler, replace, mykey);
                }
                else if (instance.Name == stud.Manager.GetName(typeof(SoundBank)))
                {
                    SoundBank sb = (SoundBank)instance;
                    FindSoundsEx(sb.Data.soundbank.key, done, ret, map, handler, replace, mykey);
                    if (sb.SFX != null)
                    {
                        foreach (OWRecord record in sb.SFX)
                        {
                            FindSoundsEx(record.key, done, ret, map, handler, replace, mykey);
                        }
                    }
                    if (sb.Music != null)
                    {
                        foreach (OWRecord record in sb.Music)
                        {
                            FindSoundsEx(record.key, done, ret, map, handler, replace, mykey);
                        }
                    }
                }
                else if (instance.Name == stud.Manager.GetName(typeof(ParameterRecord)))
                {
                    ParameterRecord parameter = (ParameterRecord)instance;
                    foreach (ParameterRecord.ParameterEntry entry in parameter.Parameters)
                    {
                        FindSoundsEx(entry.parameter.key, done, ret, map, handler, replace, mykey);
                    }
                }
                else if (instance.Name == stud.Manager.GetName(typeof(SoundBindingReference)))
                {
                    SoundBindingReference smr = (SoundBindingReference)instance;
                    FindSoundsEx(smr.Reference.sound.key, done, ret, map, handler, replace, MutateKey(mykey, (ushort)smr.Reference.Typus));
                }
                else if (instance.Name == stud.Manager.GetName(typeof(BindingRecord)))
                {
                    BindingRecord record = (BindingRecord)instance;
                    FindSoundsEx(record.Param.binding.key, done, ret, map, handler, replace, mykey);
                    FindSoundsEx(record.Param.binding2.key, done, ret, map, handler, replace, mykey);
                }
                else if (instance.Name == stud.Manager.GetName(typeof(SoundFX)))
                {
                    SoundFX record = (SoundFX)instance;
                    FindSoundsEx(record.Param.binding.key, done, ret, map, handler, replace, mykey);
                    FindSoundsEx(record.Param.binding2.key, done, ret, map, handler, replace, mykey);
                }
                else if (instance.Name == stud.Manager.GetName(typeof(ChildParameterRecord)))
                {
                    ChildParameterRecord record = (ChildParameterRecord)instance;
                    FindSoundsEx(record.Header.binding.key, done, ret, map, handler, replace, mykey);
                    foreach (ChildParameterRecord.Child child in record.Children)
                    {
                        FindSoundsEx(child.parameter.key, done, ret, map, handler, replace, mykey);
                    }
                }
                else if (instance.Name == stud.Manager.GetName(typeof(EffectReference)))
                {
                    EffectReference reference = (EffectReference)instance;
                    FindSoundsExD(reference.Reference.key.key, done, ret, map, handler, replace, mykey);
                }
                else if (instance.Name == stud.Manager.GetName(typeof(BindingEffectReference)))
                {
                    BindingEffectReference reference = (BindingEffectReference)instance;
                    // Exports a LOT of system sound effects unrelated to the origin.
                    FindSoundsExD(reference.Reference.effect.key, done, ret, map, handler, replace, mykey);
                }
                else if (instance.Name == stud.Manager.GetName(typeof(GenericKeyReference)))
                {
                    GenericKeyReference reference = (GenericKeyReference)instance;
                    FindSoundsEx(reference.Reference.key.key, done, ret, map, handler, replace, mykey);
                }
            }
        }