Пример #1
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            string output = flags.Positionals[2];

            foreach (ulong key in track[0x54])
            {
                if (!map.ContainsKey(key))
                {
                    continue;
                }
                Dictionary <OWRecord, string> items = new Dictionary <OWRecord, string>();
                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;
                    }

                    foreach (OWRecord record in master.StandardItems)
                    {
                        items[record] = "ACHIEVEMENT";
                    }

                    for (int i = 0; i < master.Generic.Length; ++i)
                    {
                        string name = $"STANDARD_{ItemEvents.GetInstance().GetEvent(master.Generic[i].@event)}";
                        for (int j = 0; j < master.GenericItems[i].Length; ++j)
                        {
                            items[master.GenericItems[i][j]] = name;
                        }
                    }

                    for (int i = 0; i < master.Categories.Length; ++i)
                    {
                        string name = ItemEvents.GetInstance().GetEvent(master.Categories[i].@event);
                        for (int j = 0; j < master.CategoryItems[i].Length; ++j)
                        {
                            items[master.CategoryItems[i][j]] = name;
                        }
                    }

                    for (int i = 0; i < master.ExclusiveOffsets.Length; ++i)
                    {
                        string name = $"LOOTBOX_EXCLUSIVE_{i:X}";
                        for (int j = 0; j < master.LootboxExclusive[i].Length; ++j)
                        {
                            items[master.LootboxExclusive[i][j].item] = name;
                        }
                    }
                }

                foreach (KeyValuePair <OWRecord, string> recordname in items)
                {
                    OWRecord record    = recordname.Key;
                    string   itemGroup = recordname.Value;
                    if (!map.ContainsKey(record.key))
                    {
                        continue;
                    }

                    STUD stud = new STUD(Util.OpenFile(map[record.key], handler));
                    if (stud.Instances == null)
                    {
                        continue;
                    }
                    IInventorySTUDInstance instance = (IInventorySTUDInstance)stud.Instances[0];
                    string name = Util.GetString(instance.Header.name.key, map, handler);
                    if (name == null)
                    {
                        name = $"{GUID.LongKey(key):X12}";
                    }

                    switch (instance.Name)
                    {
                    case "Spray":
                        Console.Out.WriteLine("Extracting spray {0}...", name);
                        ExtractLogic.Spray.Extract(stud, output, "Generic", name, itemGroup, track, map, handler, quiet, flags);
                        break;

                    case "Icon":
                        Console.Out.WriteLine("Extracting icon {0}...", name);
                        ExtractLogic.Icon.Extract(stud, output, "Generic", name, itemGroup, track, map, handler, quiet, flags);
                        break;

                    case "Portrait":
                        PortraitItem portrait = instance as PortraitItem;
                        ExtractLogic.Portrait.Extract(stud, output, "Generic", $"Tier {portrait.Data.tier}", itemGroup, track, map, handler, quiet, flags);
                        break;

                    default:
                        continue;
                    }
                }
            }
        }
Пример #2
0
        public void Read(Stream input, OWLib.STUD stud)
        {
            using (BinaryReader reader = new BinaryReader(input, System.Text.Encoding.Default, true)) {
                header = reader.Read <HeroMasterHeader>();
                long seekpos = input.Position;
#if OUTPUT_STUDHEROMASTER
                input.Seek(0, SeekOrigin.Begin);
                string outFilename = string.Format("./STUDs/HeroMaster/{0:X8}_{1}.stud", (0x00000000FFFFFFFF & header.name.key), header.id.ToString());
                string putPathname = outFilename.Substring(0, outFilename.LastIndexOf('/'));
                Directory.CreateDirectory(putPathname);
                Stream OutWriter = File.Create(outFilename);
                input.CopyTo(OutWriter);
                OutWriter.Close();
                input.Seek(seekpos, SeekOrigin.Begin);
#endif
                //Console.Out.WriteLine("Name: {8:X8}, ID: {0}, x: {1}, y: {2}, z: {3}, w: {4}, index: {5}, type: {6}, subtype: {7}, ItemKey: {9:X16}", header.id, header.x, header.y, header.z, header.w, header.index, header.type, header.subtype, (0x00000000FFFFFFFF & header.name.key), header.itemMaster.key);
                if ((long)header.virtualOffset > 0)
                {
                    input.Position = (long)header.virtualOffset;
                    STUDArrayInfo ptr = reader.Read <STUDArrayInfo>();
                    virtualRecords = new OWRecord[ptr.count];
                    input.Position = (long)ptr.offset;
                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        virtualRecords[i] = reader.Read <OWRecord>();
                    }
                }
                else
                {
                    virtualRecords = new OWRecord[0] {
                    };
                }

                if ((long)header.bindsOffset > 0)
                {
                    input.Position = (long)header.bindsOffset;
                    STUDArrayInfo ptr = reader.Read <STUDArrayInfo>();
                    r09ERecords    = new OWRecord[ptr.count];
                    input.Position = (long)ptr.offset;
                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        r09ERecords[i] = reader.Read <OWRecord>();
                    }
                }
                else
                {
                    r09ERecords = new OWRecord[0] {
                    };
                }

                if ((long)header.child1Offset > 0)
                {
                    input.Position = (long)header.child1Offset;
                    STUDArrayInfo ptr = reader.Read <STUDArrayInfo>();
                    child1         = new HeroChild1[ptr.count];
                    input.Position = (long)ptr.offset;
                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        child1[i] = reader.Read <HeroChild1>();
                    }
                }
                else
                {
                    child1 = new HeroChild1[0] {
                    };
                }

                if ((long)header.child2Offset > 0)
                {
                    input.Position = (long)header.child2Offset;
                    STUDArrayInfo ptr = reader.Read <STUDArrayInfo>();
                    child2         = new HeroChild2[ptr.count];
                    input.Position = (long)ptr.offset;
                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        child2[i] = reader.Read <HeroChild2>();
                    }
                }
                else
                {
                    child2 = new HeroChild2[0] {
                    };
                }

                if ((long)header.child3Offset > 0)
                {
                    input.Position = (long)header.child3Offset;
                    STUDArrayInfo ptr = reader.Read <STUDArrayInfo>();
                    child3         = new HeroChild2[ptr.count];
                    input.Position = (long)ptr.offset;
                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        child3[i] = reader.Read <HeroChild2>();
                    }
                }
                else
                {
                    child3 = new HeroChild2[0] {
                    };
                }

                if ((long)header.directiveOffset > 0)
                {
                    input.Position = (long)header.directiveOffset;
                    STUDArrayInfo ptr = reader.Read <STUDArrayInfo>();
                    directives     = new HeroDirective[ptr.count];
                    directiveChild = new OWRecord[ptr.count][];
                    input.Position = (long)ptr.offset;
                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        directives[i] = reader.Read <HeroDirective>();
                    }
                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        if ((long)directives[i].offsetSubs > 0)
                        {
                            STUDArrayInfo ptr2 = reader.Read <STUDArrayInfo>();
                            directiveChild[i] = new OWRecord[ptr2.count];
                            input.Position    = (long)ptr2.offset;
                            for (ulong j = 0; j < ptr2.count; ++j)
                            {
                                directiveChild[i][j] = reader.Read <OWRecord>();
                            }
                        }
                        else
                        {
                            directiveChild[i] = new OWRecord[0] {
                            };
                        }
                    }
                }
                else
                {
                    directives     = new HeroDirective[0] {
                    };
                    directiveChild = new OWRecord[0][] { };
                }
            }
        }
Пример #3
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            string output = flags.Positionals[2];

            string[] validCommands = new string[] { "skin", "spray", "icon", "victory pose", "emote", "heroic intro" };

            bool          typeWildcard = true;
            List <string> types        = new List <string>();

            if (flags.Positionals.Length > 3)
            {
                types.AddRange(flags.Positionals[3].ToLowerInvariant().Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries));
                typeWildcard = types.Contains("*");
                types        = types.FindAll((string it) => validCommands.Contains(it)).ToList();
            }

            if (!typeWildcard && types.Count == 0)
            {
                string cmdlist = "";
                for (int i = 0; i < validCommands.Length; i++)
                {
                    if (i != 0)
                    {
                        cmdlist += ", ";
                        if (i == validCommands.Length - 1)
                        {
                            cmdlist += "or ";
                        }
                    }
                    cmdlist += validCommands[i].ToString().ToLower();
                }
                Console.Out.WriteLine("The output type was not a valid option. ({0})", cmdlist);
                return;
            }

            Dictionary <string, List <string> > heroTypes    = new Dictionary <string, List <string> >();
            Dictionary <string, bool>           heroWildcard = new Dictionary <string, bool>();
            Dictionary <string, Dictionary <string, List <ulong> > > heroIgnore = new Dictionary <string, Dictionary <string, List <ulong> > >();
            bool heroAllWildcard = false;

            if (flags.Positionals.Length > 4 && flags.Positionals[4] != "*")
            {
                foreach (string pair in flags.Positionals[4].ToLowerInvariant().Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    List <string> data = new List <string>(pair.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries));
                    string        name = data[0];
                    data.RemoveAt(0);

                    if (!heroTypes.ContainsKey(name))
                    {
                        heroTypes[name]    = new List <string>();
                        heroIgnore[name]   = new Dictionary <string, List <ulong> >();
                        heroWildcard[name] = false;
                    }

                    if (data.Count > 0)
                    {
                        foreach (string d in data)
                        {
                            List <string> subdata = new List <string>(d.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries));
                            string        subn    = subdata[0];
                            subdata.RemoveAt(0);
                            heroTypes[name].Add(subn);
                            heroIgnore[name][subn] = new List <ulong>();
                            if (subdata.Count > 0)
                            {
                                foreach (string sd in subdata)
                                {
                                    try {
                                        heroIgnore[name][subn].Add(ulong.Parse(sd, System.Globalization.NumberStyles.HexNumber));
                                    } catch { }
                                }
                            }
                        }
                    }

                    if (data.Count == 0 || data.Contains("*"))
                    {
                        heroWildcard[name] = true;
                    }
                }
            }
            else
            {
                heroAllWildcard = true;
            }

            int replacementIndex = flags.WeaponSkinIndex;

            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;
                }
                if (master.Header.itemMaster.key == 0)
                {
                    continue;
                }
                string heroName = Util.GetString(master.Header.name.key, map, handler);
                if (heroName == null)
                {
                    continue;
                }
                if (heroAllWildcard)
                {
                    if (!heroTypes.ContainsKey(heroName.ToLowerInvariant()))
                    {
                        heroTypes.Add(heroName.ToLowerInvariant(), new List <string>());
                    }
                    if (!heroWildcard.ContainsKey(heroName.ToLowerInvariant()))
                    {
                        heroWildcard.Add(heroName.ToLowerInvariant(), true);
                    }
                }
                if (!heroTypes.ContainsKey(heroName.ToLowerInvariant()))
                {
                    continue;
                }
                InventoryMaster inventory = OpenInventoryMaster(master, map, handler);
                if (inventory == null)
                {
                    continue;
                }

                Dictionary <OWRecord, string> items = new Dictionary <OWRecord, string>();
                foreach (OWRecord record in inventory.Achievables)
                {
                    items[record] = "ACHIEVEMENT";
                }

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

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

                foreach (KeyValuePair <OWRecord, string> recordname in items)
                {
                    OWRecord record    = recordname.Key;
                    string   itemGroup = recordname.Value;
                    if (!map.ContainsKey(record.key))
                    {
                        continue;
                    }

                    STUD stud = new STUD(Util.OpenFile(map[record.key], handler));
                    if (stud.Instances == null)
                    {
                        continue;
                    }
                    IInventorySTUDInstance instance = (IInventorySTUDInstance)stud.Instances[0];
                    if (!typeWildcard && !types.Contains(instance.Name.ToLowerInvariant()))
                    {
                        continue;
                    }

                    string name = Util.GetString(instance.Header.name.key, map, handler);
                    if (name == null)
                    {
                        name = $"Untitled-{GUID.LongKey(instance.Header.name.key):X12}";
                        continue;
                    }
                    if (!heroWildcard[heroName.ToLowerInvariant()] && !heroTypes[heroName.ToLowerInvariant()].Contains(name.ToLowerInvariant()))
                    {
                        continue;
                    }

                    switch (instance.Name)
                    {
                    case "Spray":
                        Console.Out.WriteLine("Extracting spray {0} for {1}...", name, heroName);
                        ExtractLogic.Spray.Extract(stud, output, heroName, name, itemGroup, track, map, handler, quiet, flags);
                        break;

                    case "Skin":
                        List <ulong> ignoreList = new List <ulong>();
                        try {
                            ignoreList = heroIgnore[heroName.ToLowerInvariant()][name.ToLowerInvariant()];
                        } catch { }
                        Console.Out.WriteLine("Extracting {0} models and textures for {1}", name, heroName);
                        ExtractLogic.Skin.Extract(master, stud, output, heroName, name, itemGroup, ignoreList, track, map, handler, quiet, flags, masterKey, replacementIndex);
                        break;

                    case "Icon":
                        Console.Out.WriteLine("Extracting icon {0} for {1}...", name, heroName);
                        ExtractLogic.Icon.Extract(stud, output, heroName, name, itemGroup, track, map, handler, quiet, flags);
                        break;

                    case "Emote":
                    case "Victory Pose":
                    case "Heroic Intro":
                        Console.Out.WriteLine("Extracting {2} {0} for {1}...", name, heroName, instance.Name);
                        ExtractLogic.ItemAnimation.Extract(record.key, stud, output, heroName, name, itemGroup, track, map, handler, quiet, flags);
                        break;

                    case "Voice Line":
                        //Console.Out.WriteLine("Extracting voice line {0} for {1}...", name, heroName);
                        //ExtractLogic.VoiceLine.Extract(master, stud, output, heroName, name, track, map, handler);
                        break;
                    }
                }
            }
        }
Пример #4
0
 public static string ToStringA(this OWRecord i)
 {
     return($"{GUID.LongKey(i.key):X12}.{GUID.Type(i.key):X3}");
 }
Пример #5
0
        public void Parse(Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            string output = flags.Positionals[2];

            HashSet <string> heroes    = new HashSet <string>();
            HashSet <string> heroBlank = new HashSet <string>();
            Dictionary <string, HashSet <string> > heroSkin = new Dictionary <string, HashSet <string> >();
            bool heroAllWildcard = false;

            if (flags.Positionals.Length > 3 && flags.Positionals[1] != "*")
            {
                foreach (string name in flags.Positionals[3].ToLowerInvariant().Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    string[] data     = name.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
                    string   realname = data[0];
                    heroes.Add(realname);
                    data = data.Skip(1).ToArray();
                    if (data.Length == 0)
                    {
                        heroBlank.Add(realname);
                        continue;
                    }
                    heroSkin[realname] = new HashSet <string>();
                    foreach (string skin in data)
                    {
                        heroSkin[realname].Add(skin);
                    }
                }
            }
            else
            {
                heroAllWildcard = true;
            }

            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;
                }
                if (master.Header.itemMaster.key == 0)
                {
                    continue;
                }
                string heroName = Util.GetString(master.Header.name.key, map, handler);
                if (heroName == null)
                {
                    continue;
                }
                if (heroAllWildcard)
                {
                    heroes.Add(heroName.ToLowerInvariant());
                    heroBlank.Add(heroName.ToLowerInvariant());
                }
                if (!heroes.Contains(heroName.ToLowerInvariant()))
                {
                    continue;
                }
                InventoryMaster inventory = OpenInventoryMaster(master, map, handler);
                if (inventory == null)
                {
                    continue;
                }

                Dictionary <OWRecord, string> items = new Dictionary <OWRecord, string>();
                foreach (OWRecord record in inventory.Achievables)
                {
                    items[record] = "ACHIEVEMENT";
                }

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

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

                Dictionary <string, WeaponSkinItem> weaponskins = new Dictionary <string, WeaponSkinItem>();
                Console.Out.WriteLine("Finding weapon skins for {0}", heroName);
                foreach (KeyValuePair <OWRecord, string> recordname in items)
                {
                    OWRecord record    = recordname.Key;
                    string   itemGroup = recordname.Value;
                    if (!map.ContainsKey(record.key))
                    {
                        continue;
                    }

                    STUD stud = new STUD(Util.OpenFile(map[record.key], handler));
                    if (stud.Instances == null)
                    {
                        continue;
                    }
                    IInventorySTUDInstance instance = (IInventorySTUDInstance)stud.Instances[0];
                    WeaponSkinItem         weapon   = instance as WeaponSkinItem;
                    if (weapon == null)
                    {
                        continue;
                    }
                    if (weapon.Data.index == 0)
                    {
                        continue;
                    }
                    string name = Util.GetString(instance.Header.name.key, map, handler);
                    if (name == null)
                    {
                        name = $"Untitled-{GUID.LongKey(instance.Header.name.key):X12}";
                        continue;
                    }
                    weaponskins[name] = weapon;
                    Console.Out.WriteLine("Found data for weapon skin {0}", name);
                }
                foreach (KeyValuePair <OWRecord, string> recordname in items)
                {
                    OWRecord record    = recordname.Key;
                    string   itemGroup = recordname.Value;
                    if (!map.ContainsKey(record.key))
                    {
                        continue;
                    }

                    STUD stud = new STUD(Util.OpenFile(map[record.key], handler));
                    if (stud.Instances == null)
                    {
                        continue;
                    }
                    IInventorySTUDInstance instance = (IInventorySTUDInstance)stud.Instances[0];
                    SkinItem skin = instance as SkinItem;
                    if (skin == null)
                    {
                        continue;
                    }

                    string name = Util.GetString(instance.Header.name.key, map, handler);
                    if (name == null)
                    {
                        name = $"Untitled-{GUID.LongKey(instance.Header.name.key):X12}";
                        continue;
                    }
                    if (heroBlank.Contains(heroName.ToLowerInvariant()) || heroSkin[heroName.ToLowerInvariant()].Contains(name.ToLowerInvariant()))
                    {
                        Console.Out.WriteLine("Saving textures for skin {0}", name);
                        foreach (KeyValuePair <string, WeaponSkinItem> pair in weaponskins)
                        {
                            string output_real = string.Format("{0}{1}{4}{1}Weapon Skin{1}{2}{1}{3}{1}", output, System.IO.Path.DirectorySeparatorChar, Util.SanitizePath(pair.Key), Util.SanitizePath(name), Util.SanitizePath(heroName));
                            Dictionary <ulong, ulong> replace = new Dictionary <ulong, ulong>();
                            ExtractLogic.Skin.FindReplacements(skin.Data.skin.key, (int)pair.Value.Data.index, replace, new HashSet <ulong>(), map, handler, master, skin, true);
                            Dictionary <ulong, ulong> replace_blank = new Dictionary <ulong, ulong>();
                            ExtractLogic.Skin.FindReplacements(skin.Data.skin.key, -1, replace_blank, new HashSet <ulong>(), map, handler, master, skin, false);
                            if (replace.Values.Count == 0)
                            {
                                continue;
                            }
                            Dictionary <ulong, List <ImageLayer> > layers      = new Dictionary <ulong, List <ImageLayer> >();
                            Dictionary <ulong, List <ImageLayer> > layers_orig = new Dictionary <ulong, List <ImageLayer> >();
                            foreach (KeyValuePair <ulong, ulong> texture_pair in replace)
                            {
                                ushort type = GUID.Type(texture_pair.Key);
                                switch (type)
                                {
                                case 0x1A:
                                    ExtractLogic.Skin.FindTextures(texture_pair.Value, layers, replace, new HashSet <ulong>(), map, handler);
                                    if (replace_blank.ContainsKey(texture_pair.Key))
                                    {
                                        ExtractLogic.Skin.FindTextures(replace_blank[texture_pair.Key], layers_orig, replace_blank, new HashSet <ulong>(), map, handler);
                                    }
                                    else
                                    {
                                        ExtractLogic.Skin.FindTextures(texture_pair.Key, layers_orig, replace_blank, new HashSet <ulong>(), map, handler);
                                    }
                                    break;
                                }
                            }

                            Dictionary <ulong, HashSet <ulong> > origTextures = new Dictionary <ulong, HashSet <ulong> >();
                            foreach (KeyValuePair <ulong, List <ImageLayer> > kv in layers_orig)
                            {
                                ulong             materialId     = kv.Key;
                                List <ImageLayer> sublayers      = kv.Value;
                                HashSet <ulong>   materialParsed = new HashSet <ulong>();
                                if (!origTextures.ContainsKey(materialId))
                                {
                                    origTextures[materialId] = new HashSet <ulong>();
                                }
                                foreach (ImageLayer layer in sublayers)
                                {
                                    origTextures[materialId].Add(layer.key);
                                }
                            }

                            foreach (KeyValuePair <ulong, List <ImageLayer> > kv in layers)
                            {
                                ulong             materialId     = kv.Key;
                                List <ImageLayer> sublayers      = kv.Value;
                                HashSet <ulong>   materialParsed = new HashSet <ulong>();
                                foreach (ImageLayer layer in sublayers)
                                {
                                    if (!materialParsed.Add(layer.key))
                                    {
                                        continue;
                                    }
                                    if (origTextures.ContainsKey(materialId) && origTextures[materialId].Contains(layer.key))
                                    {
                                        continue;
                                    }
                                    ExtractLogic.Skin.SaveTexture(layer.key, materialId, map, handler, output_real, quiet, "");
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #6
0
        public void Read(Stream input, OWLib.STUD stud)
        {
            using (BinaryReader reader = new BinaryReader(input, System.Text.Encoding.Default, true)) {
                data = reader.Read <AnnouncerData>();

                if (data.offsetLists > 0)
                {
                    input.Position = data.offsetLists;
                    STUDArrayInfo array = reader.Read <STUDArrayInfo>();
                    entries        = new AnnouncerFXEntry[array.count];
                    primary        = new OWRecord[array.count][];
                    secondary      = new OWRecord[array.count][];
                    input.Position = (long)array.offset;
                    for (ulong i = 0; i < array.count; ++i)
                    {
                        entries[i] = reader.Read <AnnouncerFXEntry>();
                    }

                    for (ulong i = 0; i < array.count; ++i)
                    {
                        if (entries[i].primary > 0)
                        {
                            input.Position = entries[i].primary;
                            STUDArrayInfo innerArray = reader.Read <STUDArrayInfo>();
                            primary[i]     = new OWRecord[innerArray.count];
                            input.Position = (long)innerArray.offset;
                            for (ulong j = 0; j < innerArray.count; ++j)
                            {
                                primary[i][j] = reader.Read <OWRecord>();
                            }
                        }
                        else
                        {
                            primary[i] = new OWRecord[0];
                        }

                        if (entries[i].secondary > 0)
                        {
                            input.Position = entries[i].secondary;
                            STUDArrayInfo innerArray = reader.Read <STUDArrayInfo>();
                            secondary[i]   = new OWRecord[innerArray.count];
                            input.Position = (long)innerArray.offset;
                            for (ulong j = 0; j < innerArray.count; ++j)
                            {
                                secondary[i][j] = reader.Read <OWRecord>();
                            }
                        }
                        else
                        {
                            secondary[i] = new OWRecord[0];
                        }
                    }
                }
                else
                {
                    entries   = new AnnouncerFXEntry[0];
                    primary   = new OWRecord[0][];
                    secondary = new OWRecord[0][];
                }
            }
        }
Пример #7
0
        public void Read(Stream input, OWLib.STUD stud)
        {
            using (BinaryReader reader = new BinaryReader(input, System.Text.Encoding.Default, true)) {
                header = reader.Read <InventoryMasterHeader>();

                if (header.achievableOffset > 0)
                {
                    input.Position = (long)header.achievableOffset;
                    STUDArrayInfo ptr = reader.Read <STUDArrayInfo>();
                    achievableItems = new OWRecord[ptr.count];
                    input.Position  = (long)ptr.offset;
                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        achievableItems[i] = reader.Read <OWRecord>();
                    }
                }
                else
                {
                    achievableItems = new OWRecord[0];
                }

                if (header.defaultOffset > 0)
                {
                    input.Position = (long)header.defaultOffset;
                    STUDArrayInfo ptr = reader.Read <STUDArrayInfo>();
                    defaultGroups     = new InventoryMasterGroup[ptr.count];
                    defaultGroupItems = new OWRecord[ptr.count][];
                    input.Position    = (long)ptr.offset;
                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        defaultGroups[i] = reader.Read <InventoryMasterGroup>();
                    }

                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        input.Position = (long)defaultGroups[i].offset;
                        STUDArrayInfo ptr2 = reader.Read <STUDArrayInfo>();
                        defaultGroupItems[i] = new OWRecord[ptr2.count];
                        input.Position       = (long)ptr2.offset;
                        for (ulong j = 0; j < ptr2.count; ++j)
                        {
                            defaultGroupItems[i][j] = reader.Read <OWRecord>();
                        }
                    }
                }
                else
                {
                    defaultGroupItems = new OWRecord[0][];
                    defaultGroups     = new InventoryMasterGroup[0];
                }

                if (header.itemOffset > 0)
                {
                    input.Position = (long)header.itemOffset;
                    STUDArrayInfo ptr = reader.Read <STUDArrayInfo>();
                    itemGroups     = new InventoryMasterGroup[ptr.count];
                    itemGroupItems = new OWRecord[ptr.count][];
                    input.Position = (long)ptr.offset;
                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        itemGroups[i] = reader.Read <InventoryMasterGroup>();
                    }

                    for (ulong i = 0; i < ptr.count; ++i)
                    {
                        if (itemGroups[i].offset > 0)
                        {
                            input.Position = (long)itemGroups[i].offset;
                            STUDArrayInfo ptr2 = reader.Read <STUDArrayInfo>();
                            itemGroupItems[i] = new OWRecord[ptr2.count];
                            input.Position    = (long)ptr2.offset;
                            for (ulong j = 0; j < ptr2.count; ++j)
                            {
                                itemGroupItems[i][j] = reader.Read <OWRecord>();
                            }
                        }
                        else
                        {
                            itemGroupItems[i] = new OWRecord[0];
                        }
                    }
                }
                else
                {
                    itemGroupItems = new OWRecord[0][];
                    itemGroups     = new InventoryMasterGroup[0];
                }
            }
        }
Пример #8
0
 public static string ToStringA(this OWRecord i)
 {
     return(GUID.AsString(i.key));
 }
Пример #9
0
        public void Read(Stream input, OWLib.STUD stud)
        {
            using (BinaryReader reader = new BinaryReader(input, System.Text.Encoding.Default, true)) {
                header = reader.Read <InventoryMetadata>();

                if (header.herowide > 0)
                {
                    input.Position = header.herowide;
                    STUDArrayInfo info = reader.Read <STUDArrayInfo>();
                    standardItems = new OWRecord[info.count];
                    if (info.count > 0)
                    {
                        input.Position = (long)info.offset;
                        for (ulong i = 0; i < info.count; ++i)
                        {
                            standardItems[i] = reader.Read <OWRecord>();
                        }
                    }
                }
                else
                {
                    standardItems = new OWRecord[0] {
                    };
                }

                if (header.lootbox_info > 0)
                {
                    input.Position = header.lootbox_info;
                    STUDArrayInfo info = reader.Read <STUDArrayInfo>();
                    lootboxInfo = new OWRecord[info.count];
                    if (info.count > 0)
                    {
                        input.Position = (long)info.offset;
                        for (ulong i = 0; i < info.count; ++i)
                        {
                            lootboxInfo[i] = reader.Read <OWRecord>();
                        }
                    }
                }
                else
                {
                    lootboxInfo = new OWRecord[0] {
                    };
                }

                if (header.event_box_info > 0)
                {
                    input.Position = header.event_box_info;
                    STUDArrayInfo info = reader.Read <STUDArrayInfo>();
                    eventLootboxInfo = new Bound[info.count];
                    if (info.count > 0)
                    {
                        input.Position = (long)info.offset;
                        for (ulong i = 0; i < info.count; ++i)
                        {
                            eventLootboxInfo[i] = reader.Read <Bound>();
                        }
                    }
                }
                else
                {
                    eventLootboxInfo = new Bound[0] {
                    };
                }

                if (header.lootbox_info_2 > 0)
                {
                    input.Position = header.lootbox_info_2;
                    STUDArrayInfo info = reader.Read <STUDArrayInfo>();
                    lootboxInfo2 = new Box[info.count];
                    if (info.count > 0)
                    {
                        input.Position = (long)info.offset;
                        for (ulong i = 0; i < info.count; ++i)
                        {
                            lootboxInfo2[i] = reader.Read <Box>();
                        }
                    }
                }
                else
                {
                    lootboxInfo2 = new Box[0] {
                    };
                }

                if (header.offsetarray > 0)
                {
                    input.Position = header.offsetarray;
                    STUDArrayInfo info = reader.Read <STUDArrayInfo>();
                    generic      = new InventoryEntry[info.count];
                    genericItems = new OWRecord[info.count][];
                    if (info.count > 0)
                    {
                        input.Position = (long)info.offset;
                        for (ulong i = 0; i < info.count; ++i)
                        {
                            generic[i] = reader.Read <InventoryEntry>();
                            long old = input.Position;
                            if (generic[i].items > 0)
                            {
                                input.Position = generic[i].items;
                                STUDArrayInfo subinfo = reader.Read <STUDArrayInfo>();
                                if (subinfo.count > 0)
                                {
                                    input.Position  = (long)subinfo.offset;
                                    genericItems[i] = new OWRecord[subinfo.count];
                                    for (ulong j = 0; j < subinfo.count; ++j)
                                    {
                                        genericItems[i][j] = reader.Read <OWRecord>();
                                    }
                                }
                                else
                                {
                                    genericItems[i] = new OWRecord[0];
                                }
                            }
                            else
                            {
                                genericItems[i] = new OWRecord[0];
                            }
                            input.Position = old;
                        }
                    }
                }
                else
                {
                    generic      = new InventoryEntry[0] {
                    };
                    genericItems = new OWRecord[0][] { };
                }

                if (header.categories > 0)
                {
                    input.Position = header.categories;
                    STUDArrayInfo info = reader.Read <STUDArrayInfo>();
                    categories    = new Category[info.count];
                    categoryItems = new OWRecord[info.count][];
                    if (info.count > 0)
                    {
                        input.Position = (long)info.offset;
                        for (ulong i = 0; i < info.count; ++i)
                        {
                            categories[i] = reader.Read <Category>();
                            long old = input.Position;
                            if (categories[i].offset > 0)
                            {
                                input.Position = categories[i].offset;
                                STUDArrayInfo subinfo = reader.Read <STUDArrayInfo>();
                                if (subinfo.count > 0)
                                {
                                    input.Position   = (long)subinfo.offset;
                                    categoryItems[i] = new OWRecord[subinfo.count];
                                    for (ulong j = 0; j < subinfo.count; ++j)
                                    {
                                        categoryItems[i][j] = reader.Read <OWRecord>();
                                    }
                                }
                                else
                                {
                                    categoryItems[i] = new OWRecord[0];
                                }
                            }
                            else
                            {
                                categoryItems[i] = new OWRecord[0];
                            }
                            input.Position = old;
                        }
                    }
                }
                else
                {
                    categories    = new Category[0] {
                    };
                    categoryItems = new OWRecord[0][] { };
                }

                if (header.lootbox_exclusive > 0)
                {
                    input.Position = header.lootbox_exclusive;
                    STUDArrayInfo info = reader.Read <STUDArrayInfo>();
                    exclusiveOffsets = new long[info.count];
                    lootboxExclusive = new Reward[info.count][];
                    if (info.count > 0)
                    {
                        input.Position = (long)info.offset;
                        for (ulong i = 0; i < info.count; ++i)
                        {
                            exclusiveOffsets[i] = reader.ReadInt64();
                            long old = input.Position;
                            if (exclusiveOffsets[i] > 0)
                            {
                                input.Position = exclusiveOffsets[i];
                                STUDArrayInfo subinfo = reader.Read <STUDArrayInfo>();
                                if (subinfo.count > 0)
                                {
                                    input.Position      = (long)subinfo.offset;
                                    lootboxExclusive[i] = new Reward[subinfo.count];
                                    for (ulong j = 0; j < subinfo.count; ++j)
                                    {
                                        lootboxExclusive[i][j] = reader.Read <Reward>();
                                    }
                                }
                                else
                                {
                                    lootboxExclusive[i] = new Reward[0];
                                }
                            }
                            else
                            {
                                lootboxExclusive[i] = new Reward[0];
                            }
                            input.Position = old;
                        }
                    }
                }
                else
                {
                    exclusiveOffsets = new long[0] {
                    };
                    lootboxExclusive = new Reward[0][] { };
                }
            }
        }