diff --git a/FModel/Methods/IconGenerator/ItemGenerator/ItemIcon.cs b/FModel/Methods/IconGenerator/ItemGenerator/ItemIcon.cs index ff4b76a3..90c7ad66 100644 --- a/FModel/Methods/IconGenerator/ItemGenerator/ItemIcon.cs +++ b/FModel/Methods/IconGenerator/ItemGenerator/ItemIcon.cs @@ -95,45 +95,45 @@ namespace FModel } else if (weaponDefinition != null) { - //MANUAL FIX - if (weaponDefinition.Value().Equals("WID_Harvest_Pickaxe_NutCracker")) + //STW PICKAXES MANUAL FIX + if (weaponDefinition.Value().Equals("WID_Harvest_Pickaxe_STWCosmetic_Tier")) { - weaponDefinition = "WID_Harvest_Pickaxe_Nutcracker"; - } - if (weaponDefinition.Value().Equals("WID_Harvest_Pickaxe_Wukong")) - { - weaponDefinition = "WID_Harvest_Pickaxe_WuKong"; + weaponDefinition = "WID_Harvest_Pickaxe_STWCosmetic_Tier_" + ThePak.CurrentUsedItem.Substring(ThePak.CurrentUsedItem.Length - 1); } - string weaponFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[weaponDefinition.Value()], weaponDefinition.Value()); - if (weaponFilePath != null) + string value = ThePak.AllpaksDictionary.Where(x => string.Equals(x.Key, weaponDefinition.Value(), StringComparison.CurrentCultureIgnoreCase)).Select(d => d.Key).FirstOrDefault(); + if (value != null) { - if (weaponFilePath.Contains(".uasset") || weaponFilePath.Contains(".uexp") || weaponFilePath.Contains(".ubulk")) + string weaponFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[value], value); + if (weaponFilePath != null) { - JohnWick.MyAsset = new PakAsset(weaponFilePath.Substring(0, weaponFilePath.LastIndexOf('.'))); - try + if (weaponFilePath.Contains(".uasset") || weaponFilePath.Contains(".uexp") || weaponFilePath.Contains(".ubulk")) { - if (JohnWick.MyAsset.GetSerialized() != null) + JohnWick.MyAsset = new PakAsset(weaponFilePath.Substring(0, weaponFilePath.LastIndexOf('.'))); + try { - dynamic AssetData = JsonConvert.DeserializeObject(JohnWick.MyAsset.GetSerialized()); - JArray AssetArray = JArray.FromObject(AssetData); - - JToken largePreviewImage = AssetArray[0]["LargePreviewImage"]; - if (largePreviewImage != null) + if (JohnWick.MyAsset.GetSerialized() != null) { - JToken assetPathName = largePreviewImage["asset_path_name"]; - if (assetPathName != null) - { - string textureFile = Path.GetFileName(assetPathName.Value()).Substring(0, Path.GetFileName(assetPathName.Value()).LastIndexOf('.')); + dynamic AssetData = JsonConvert.DeserializeObject(JohnWick.MyAsset.GetSerialized()); + JArray AssetArray = JArray.FromObject(AssetData); - ItemIconPath = JohnWick.AssetToTexture2D(textureFile); + JToken largePreviewImage = AssetArray[0]["LargePreviewImage"]; + if (largePreviewImage != null) + { + JToken assetPathName = largePreviewImage["asset_path_name"]; + if (assetPathName != null) + { + string textureFile = Path.GetFileName(assetPathName.Value()).Substring(0, Path.GetFileName(assetPathName.Value()).LastIndexOf('.')); + + ItemIconPath = JohnWick.AssetToTexture2D(textureFile); + } } } } - } - catch (JsonSerializationException) - { - //do not crash when JsonSerialization does weird stuff + catch (JsonSerializationException) + { + //do not crash when JsonSerialization does weird stuff + } } } } diff --git a/FModel/csharp_wick.dll b/FModel/csharp_wick.dll index 99d1e416..67446bf5 100644 Binary files a/FModel/csharp_wick.dll and b/FModel/csharp_wick.dll differ