feat: add perks
This commit is contained in:
+43
-1
@@ -37,6 +37,14 @@ struct OfferingInfo
|
|||||||
public EPlayerRole role;
|
public EPlayerRole role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct PerkInfo
|
||||||
|
{
|
||||||
|
public string id;
|
||||||
|
public string name;
|
||||||
|
public string iconFilePath;
|
||||||
|
public EPlayerRole role;
|
||||||
|
}
|
||||||
|
|
||||||
struct DLCInfo
|
struct DLCInfo
|
||||||
{
|
{
|
||||||
public string id;
|
public string id;
|
||||||
@@ -53,6 +61,7 @@ struct CustomizationItemInfo
|
|||||||
public ECustomizationCategory category;
|
public ECustomizationCategory category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct AddonInfo
|
struct AddonInfo
|
||||||
{
|
{
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
@@ -70,9 +79,10 @@ class Dumper
|
|||||||
|
|
||||||
private readonly Dictionary<int, CharacterInfo> _characterMap = new();
|
private readonly Dictionary<int, CharacterInfo> _characterMap = new();
|
||||||
private readonly Dictionary<string, ItemInfo> _itemMap = new();
|
private readonly Dictionary<string, ItemInfo> _itemMap = new();
|
||||||
|
private readonly Dictionary<string, AddonInfo> _addonMap = new();
|
||||||
|
private readonly Dictionary<string, PerkInfo> _perkMap = new();
|
||||||
private readonly Dictionary<string, OfferingInfo> _offeringMap = new();
|
private readonly Dictionary<string, OfferingInfo> _offeringMap = new();
|
||||||
private readonly Dictionary<string, CustomizationItemInfo> _customizationItemMap = new();
|
private readonly Dictionary<string, CustomizationItemInfo> _customizationItemMap = new();
|
||||||
private readonly Dictionary<string, AddonInfo> _addonMap = new();
|
|
||||||
|
|
||||||
public Dumper(string outDir)
|
public Dumper(string outDir)
|
||||||
{
|
{
|
||||||
@@ -232,6 +242,37 @@ class Dumper
|
|||||||
WriteJson("addons", _addonMap.Values);
|
WriteJson("addons", _addonMap.Values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DumpPerks()
|
||||||
|
{
|
||||||
|
ProcessDataTables("/PerkDB.uasset", "perks", (rowKey, props) =>
|
||||||
|
{
|
||||||
|
if (!TryGetProp(props, "Role", out EPlayerRole role)
|
||||||
|
|| !TryGetProp(props, "UIData", out FStructFallback uiDataFb)
|
||||||
|
|| !TryGetProp(props, "Inventory", out bool isInventory)
|
||||||
|
|| !TryGetProp(props, "IsFakeItem", out bool isFakeItem))
|
||||||
|
throw new KeyNotFoundException($"Required properties missing for Perk: {rowKey}");
|
||||||
|
|
||||||
|
UIDataStruct uiData = uiDataFb.MapToStruct<UIDataStruct>();
|
||||||
|
|
||||||
|
if (!isInventory || isFakeItem)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (uiData.IconAssetList.Length == 0)
|
||||||
|
throw new InvalidDataException("Perk's UIData had no icons");
|
||||||
|
|
||||||
|
_perkMap[rowKey] = new PerkInfo
|
||||||
|
{
|
||||||
|
id = rowKey,
|
||||||
|
name = uiData.DisplayName.ToString(),
|
||||||
|
iconFilePath = uiData.IconAssetList[0].ToString(),
|
||||||
|
role = role
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
_log.Info("Dumped {0} perks", _perkMap.Count);
|
||||||
|
WriteJson("perks", _perkMap.Values);
|
||||||
|
}
|
||||||
|
|
||||||
public void DumpOfferings()
|
public void DumpOfferings()
|
||||||
{
|
{
|
||||||
ProcessDataTables("/OfferingDB.uasset", "offerings", (rowKey, props) =>
|
ProcessDataTables("/OfferingDB.uasset", "offerings", (rowKey, props) =>
|
||||||
@@ -331,6 +372,7 @@ class Dumper
|
|||||||
public void DumpCharacterIcons() => ExportIcons(_characterMap.Values.Select(x => x.iconFilePath), "character", "/character-icons/");
|
public void DumpCharacterIcons() => ExportIcons(_characterMap.Values.Select(x => x.iconFilePath), "character", "/character-icons/");
|
||||||
public void DumpItemIcons() => ExportIcons(_itemMap.Values.Select(x => x.iconFilePath), "item", "/item-icons/");
|
public void DumpItemIcons() => ExportIcons(_itemMap.Values.Select(x => x.iconFilePath), "item", "/item-icons/");
|
||||||
public void DumpAddonIcons() => ExportIcons(_addonMap.Values.Select(x => x.iconFilePath), "addon", "/addon-icons/");
|
public void DumpAddonIcons() => ExportIcons(_addonMap.Values.Select(x => x.iconFilePath), "addon", "/addon-icons/");
|
||||||
|
public void DumpPerkIcons() => ExportIcons(_perkMap.Values.Select(x => x.iconFilePath), "perk", "/perk-icons/");
|
||||||
public void DumpOfferingIcons() => ExportIcons(_offeringMap.Values.Select(x => x.iconFilePath), "offering", "/offering-icons/");
|
public void DumpOfferingIcons() => ExportIcons(_offeringMap.Values.Select(x => x.iconFilePath), "offering", "/offering-icons/");
|
||||||
public void DumpCustomizationIcons()
|
public void DumpCustomizationIcons()
|
||||||
{
|
{
|
||||||
|
|||||||
+7
-6
@@ -12,12 +12,13 @@ if (!hasInitialized)
|
|||||||
|
|
||||||
var dumpTasks = new (string Name, Action Execute)[]
|
var dumpTasks = new (string Name, Action Execute)[]
|
||||||
{
|
{
|
||||||
("character", () => { dumper.DumpCharacters(); dumper.DumpCharacterIcons(); }),
|
//("character", () => { dumper.DumpCharacters(); dumper.DumpCharacterIcons(); }),
|
||||||
("item", () => { dumper.DumpItems(); dumper.DumpItemIcons(); }),
|
//("item", () => { dumper.DumpItems(); dumper.DumpItemIcons(); }),
|
||||||
("addon", () => { dumper.DumpAddons(); dumper.DumpAddonIcons(); }),
|
//("addon", () => { dumper.DumpAddons(); dumper.DumpAddonIcons(); }),
|
||||||
("offering", () => { dumper.DumpOfferings(); dumper.DumpOfferingIcons(); }),
|
("perk", () => { dumper.DumpPerks(); dumper.DumpPerkIcons(); }),
|
||||||
("customization", () => { dumper.DumpCustomizations(); dumper.DumpCustomizationIcons(); }),
|
//("offering", () => { dumper.DumpOfferings(); dumper.DumpOfferingIcons(); }),
|
||||||
("dlc", () => { dumper.DumpDLCs(); })
|
//("customization", () => { dumper.DumpCustomizations(); dumper.DumpCustomizationIcons(); }),
|
||||||
|
//("dlc", () => { dumper.DumpDLCs(); })
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var task in dumpTasks)
|
foreach (var task in dumpTasks)
|
||||||
|
|||||||
Reference in New Issue
Block a user