Exemplo n.º 1
0
        public void GetGeneralUnlocks(ICLIFlags toolFlags)
        {
            string basePath;

            if (toolFlags is ExtractFlags flags)
            {
                basePath = flags.OutputPath;
            }
            else
            {
                throw new Exception("no output path");
            }

            foreach (var key in TrackedFiles[0x54])
            {
                STUGlobalInventoryMaster invMaster = GetInstance <STUGlobalInventoryMaster>(key);
                if (invMaster == null)
                {
                    continue;
                }

                var achivementUnlocks = invMaster.AchievementUnlocks?.Unlocks?.Select(it => GatherUnlock((ulong)it)).ToList();
                SprayAndIcon.SaveItems(basePath, null, "General", "Achievements", flags, achivementUnlocks);

                if (invMaster.EventGeneralUnlocks != null)
                {
                    foreach (var eventUnlocks in invMaster.EventGeneralUnlocks)
                    {
                        if (eventUnlocks?.Unlocks?.Unlocks == null)
                        {
                            continue;
                        }

                        var eventKey = ItemEvents.GetInstance().EventsNormal[(uint)eventUnlocks.Event];
                        var unlocks  = eventUnlocks.Unlocks.Unlocks.Select(it => GatherUnlock((ulong)it)).ToList();
                        SprayAndIcon.SaveItems(basePath, null, "General", eventKey, flags, unlocks);
                    }
                }

                if (invMaster.LevelUnlocks != null)
                {
                    var unlocks = new HashSet <ItemInfo>();
                    foreach (var levelUnlocks in invMaster.LevelUnlocks)
                    {
                        if (levelUnlocks?.Unlocks == null)
                        {
                            continue;
                        }
                        foreach (var unlock in levelUnlocks.Unlocks)
                        {
                            unlocks.Add(GatherUnlock(unlock));
                        }
                    }

                    SprayAndIcon.SaveItems(basePath, null, "General", "Standard", flags, unlocks.ToList());
                    Portrait.SaveItems(basePath, null, "General", "Standard", flags, unlocks.ToList());
                }
            }
        }
Exemplo n.º 2
0
        public static void SaveUnlock(ICLIFlags flags, Unlock unlock, string path, string eventKey,
                                      Dictionary <string, ParsedArg> config,
                                      Dictionary <string, TagExpectedValue> tags, VoiceSet voiceSet, STUHero hero)
        {
            string rarity;

            if (tags != null)
            {
                if (unlock.STU.m_0B1BA7C1 == null)
                {
                    rarity             = unlock.Rarity.ToString();
                    tags["leagueTeam"] = new TagExpectedValue("none");
                }
                else
                {
                    TeamDefinition teamDef = new TeamDefinition(unlock.STU.m_0B1BA7C1);
                    tags["leagueTeam"] = new TagExpectedValue(teamDef.Abbreviation, // NY
                                                              teamDef.Location,     // New York
                                                              teamDef.Name,         // Excelsior
                                                              teamDef.FullName,     // New York Excelsior
                                                              (teamDef.Division == Enum_5A789F71.None && teamDef.Abbreviation == null) ? "none" : "*",
                                                              "*");                 // all

                    // nice file structure
                    rarity   = "";
                    eventKey = "League";
                }
                tags["rarity"] = new TagExpectedValue(unlock.Rarity.ToString());

                tags["special"] = new TagExpectedValue(unlock.Tag ?? "none");
            }
            else
            {
                rarity = ""; // for general unlocks
            }

            var eventMap = GetEventConfig();

            if (unlock.STU.m_BEE9BCDA != null)
            {
                var formalEventKey = unlock.STU.m_BEE9BCDA.FirstOrDefault(x => eventMap.ContainsKey(x));
                if (eventMap.ContainsKey(formalEventKey))
                {
                    eventKey = eventMap[formalEventKey];
                }
            }

            string thisPath = Path.Combine(path, unlock.GetTypeNameEnum(), eventKey, rarity, GetValidFilename(unlock.GetName()));

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SprayPaint)))
            {
                SprayAndIcon.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_AvatarPortrait)))
            {
                SprayAndIcon.Save(flags, thisPath, unlock);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_POTGAnimation)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Emote)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Pose)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_VoiceLine)))
            {
                VoiceLine.Save(flags, thisPath, unlock, voiceSet);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SkinTheme)))
            {
                SkinTheme.Save(flags, thisPath, unlock, hero);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_PortraitFrame)))
            {
                thisPath = Path.Combine(path, unlock.Type);
                PortraitFrame.Save(flags, thisPath, unlock);
            }
        }
Exemplo n.º 3
0
        public void SaveItemInfo(ItemInfo itemInfo, string basePath, string heroFileName, ICLIFlags flags, STUHero hero,
                                 string eventKey, Dictionary <string, ParsedArg> config, Dictionary <string, TagExpectedValue> tags, List <ItemInfo> weaponSkins)
        {
            if (itemInfo?.Unlock == null)
            {
                return;
            }

            if (itemInfo.Unlock.LeagueTeam != null)
            {
                STULeagueTeam team = GetInstance <STULeagueTeam>(itemInfo.Unlock.LeagueTeam);
                tags["leagueTeam"] = new TagExpectedValue(GetString(team.Abbreviation),                         // NXL
                                                          GetString(team.Location),                             // New York
                                                          GetString(team.Name),                                 // Excelsior
                                                          $"{GetString(team.Location)} {GetString(team.Name)}", // New York Excelsior
                                                          "*");                                                 // all
                eventKey        = "League";
                itemInfo.Rarity = "";
            }
            else
            {
                tags["leagueTeam"] = new TagExpectedValue("none");
            }

            if (eventKey == "Achievement" && itemInfo.Type == "Skin")
            {
                itemInfo.Rarity = "";
            }


            tags["rarity"] = new TagExpectedValue(itemInfo.Rarity);

            if (itemInfo.Type == "Spray" && config.ContainsKey("spray") && config["spray"].ShouldDo(itemInfo.Name, tags))
            {
                SprayAndIcon.SaveItem(basePath, heroFileName, RootDir, eventKey, flags, itemInfo);
            }
            if (itemInfo.Type == "PlayerIcon" && config.ContainsKey("icon") && config["icon"].ShouldDo(itemInfo.Name, tags))
            {
                SprayAndIcon.SaveItem(basePath, heroFileName, RootDir, eventKey, flags, itemInfo);
            }
            if (itemInfo.Type == "Skin" && config.ContainsKey("skin") && config["skin"].ShouldDo(itemInfo.Name, tags))
            {
                Skin.Save(flags, $"{basePath}\\{RootDir}", hero, $"{eventKey}\\{itemInfo.Rarity}", itemInfo.Unlock as STUUnlock_Skin, weaponSkins, null, false);
            }
            if (itemInfo.Type == "Pose" && config.ContainsKey("victorypose") && config["victorypose"].ShouldDo(itemInfo.Name, tags))
            {
                AnimationItem.SaveItem(basePath, heroFileName, RootDir, eventKey, flags, itemInfo);
            }
            if (itemInfo.Type == "HighlightIntro" && config.ContainsKey("highlightintro") && config["highlightintro"].ShouldDo(itemInfo.Name, tags))
            {
                AnimationItem.SaveItem(basePath, heroFileName, RootDir, eventKey, flags, itemInfo);
            }
            if (itemInfo.Type == "Emote" && config.ContainsKey("emote") && config["emote"].ShouldDo(itemInfo.Name, tags))
            {
                AnimationItem.SaveItem(basePath, heroFileName, RootDir, eventKey, flags, itemInfo);
            }
            if (itemInfo.Type == "VoiceLine" && config.ContainsKey("voiceline") && config["voiceline"].ShouldDo(itemInfo.Name, tags))
            {
                VoiceLine.SaveItem(basePath, heroFileName, RootDir, eventKey, flags, itemInfo, hero);
            }
        }
Exemplo n.º 4
0
        public static void SaveUnlock(ICLIFlags flags, Unlock unlock, string path, string eventKey,
                                      Dictionary <string, ParsedArg> config,
                                      Dictionary <string, TagExpectedValue> tags, VoiceSet voiceSet, STUHero hero)
        {
            string rarity;

            if (tags != null)
            {
                if (unlock.STU.m_0B1BA7C1 == null)
                {
                    rarity             = unlock.Rarity.ToString();
                    tags["leagueTeam"] = new TagExpectedValue("none");
                }
                else
                {
                    TeamDefinition teamDef = new TeamDefinition(unlock.STU.m_0B1BA7C1);
                    tags["leagueTeam"] = new TagExpectedValue(teamDef.Abbreviation, // NY
                                                              teamDef.Location,     // New York
                                                              teamDef.Name,         // Excelsior
                                                              teamDef.FullName,     // New York Excelsior
                                                              "*");                 // all

                    // nice file structure
                    rarity   = "";
                    eventKey = "League";
                }
                tags["rarity"] = new TagExpectedValue(unlock.Rarity.ToString());

                //if (UnlockData.SummerGames2016.Contains(unlock.GUID)) {
                //    tags["special"] = new TagExpectedValue("sg2016");
                //} if (UnlockData.SummerGames2017.Contains(unlock.GUID)) {
                //    tags["special"] = new TagExpectedValue("sg2017");
                //} else
                if (UnlockData.SummerGames2018.Contains(unlock.GUID))
                {
                    tags["special"] = new TagExpectedValue("sg2018");
                }
                else
                {
                    tags["special"] = new TagExpectedValue("none");
                }
            }
            else
            {
                rarity = ""; // for general unlocks
            }

            string thisPath = Path.Combine(path, unlock.Type, eventKey, rarity, GetValidFilename(unlock.GetName()));

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SprayPaint)))
            {
                SprayAndIcon.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_AvatarPortrait)))
            {
                SprayAndIcon.Save(flags, thisPath, unlock);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_POTGAnimation)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Emote)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }
            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_Pose)))
            {
                AnimationItem.Save(flags, thisPath, unlock);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_VoiceLine)))
            {
                VoiceLine.Save(flags, thisPath, unlock, voiceSet);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_SkinTheme)))
            {
                SkinTheme.Save(flags, thisPath, unlock, hero);
            }

            if (ShouldDo(unlock, config, tags, typeof(STUUnlock_PortraitFrame)))
            {
                thisPath = Path.Combine(path, unlock.Type);
                PortraitFrame.Save(flags, thisPath, unlock);
            }
        }