Beispiel #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());
                }
            }
        }