mirror of
https://github.com/4sval/FModel.git
synced 2026-09-14 12:36:45 -05:00
Added Heroes & Weapons' Categories Mini-Icon
This commit is contained in:
@@ -91,6 +91,8 @@
|
||||
<MenuItem Header="Images Merger" InputGestureText="F4" Command="{x:Static commands:FModel_Commands.MergeImages}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Help">
|
||||
<MenuItem x:Name="MI_Changelog" Header="Changelog" Click="MI_Changelog_Click"/>
|
||||
<MenuItem x:Name="MI_BugReports" Header="Bugs Report" Click="MI_BugReports_Click"/>
|
||||
<MenuItem x:Name="MI_About" Header="About FModel" Click="MI_About_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/info_16x.png" Width="16" Height="16"/>
|
||||
|
||||
@@ -220,6 +220,14 @@ namespace FModel
|
||||
}
|
||||
else { FormsUtility.GetOpenedWindow<Window>("Images Merger").Focus(); }
|
||||
}
|
||||
private void MI_Changelog_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start("https://github.com/iAmAsval/FModel/releases/latest");
|
||||
}
|
||||
private void MI_BugReports_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start("https://github.com/iAmAsval/FModel/issues/new");
|
||||
}
|
||||
private void MI_About_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DebugHelper.WriteLine("FWindow: About");
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace FModel.Methods.Assets.IconCreator.AthenaID
|
||||
static class IconUserFacingFlags
|
||||
{
|
||||
private static JArray ItemCategoriesArray { get; set; }
|
||||
private static JArray HeroItemCategoriesArray { get; set; }
|
||||
public static int xCoords = 4 - 25;
|
||||
private const string PET_CUSTOM_ICON = "pack://application:,,,/Resources/T-Icon-Pets-64.png";
|
||||
private const string QUEST_CUSTOM_ICON = "pack://application:,,,/Resources/T-Icon-Quests-64.png";
|
||||
@@ -41,6 +42,52 @@ namespace FModel.Methods.Assets.IconCreator.AthenaID
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawHeroFacingFlag(JToken uFF)
|
||||
{
|
||||
if (HeroItemCategoriesArray == null)
|
||||
{
|
||||
string jsonData = AssetsUtility.GetAssetJsonDataByPath("/FortniteGame/Content/Items/ItemCategories", true);
|
||||
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
|
||||
{
|
||||
dynamic AssetData = JsonConvert.DeserializeObject(jsonData);
|
||||
JArray AssetArray = JArray.FromObject(AssetData);
|
||||
JToken secondaryCategoriesToken = AssetsUtility.GetPropertyTag<JToken>(AssetArray[0]["properties"].Value<JArray>(), "SecondaryCategories");
|
||||
if (secondaryCategoriesToken != null)
|
||||
{
|
||||
HeroItemCategoriesArray = secondaryCategoriesToken["data"].Value<JArray>();
|
||||
|
||||
string uFFTargeted = uFF.Value<string>().Substring("Unlocks.Class.".Length);
|
||||
SearchHeroFacingFlag(uFFTargeted);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string uFFTargeted = uFF.Value<string>().Substring("Unlocks.Class.".Length);
|
||||
SearchHeroFacingFlag(uFFTargeted);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SearchHeroFacingFlag(string uFFTarget)
|
||||
{
|
||||
foreach (JToken data in HeroItemCategoriesArray)
|
||||
{
|
||||
JArray propertiesArray = data["struct_type"]["properties"].Value<JArray>();
|
||||
if (propertiesArray != null)
|
||||
{
|
||||
JToken categoryNameToken = AssetsUtility.GetPropertyTagText<JToken>(propertiesArray, "CategoryName", "source_string");
|
||||
if (categoryNameToken != null)
|
||||
{
|
||||
if (uFFTarget.Equals("Commando") && categoryNameToken.Value<string>() == "Soldier" ||
|
||||
categoryNameToken.Value<string>().Equals(uFFTarget, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
GetUFFImage(propertiesArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void SearchUserFacingFlag(string uFFTarget)
|
||||
{
|
||||
foreach (JToken data in ItemCategoriesArray)
|
||||
|
||||
@@ -21,7 +21,9 @@ namespace FModel.Methods.Assets.IconCreator
|
||||
private static string _cosmeticItemDefinition;
|
||||
private static string _itemAction;
|
||||
private static string _maxStackSize;
|
||||
private static string _miniMapIconBrushPath;
|
||||
private static IEnumerable<JToken> _userFacingFlagsToken;
|
||||
private static IEnumerable<JToken> _userHeroFlagsToken;
|
||||
|
||||
public static void DrawIconText(JArray AssetProperties)
|
||||
{
|
||||
@@ -41,6 +43,7 @@ namespace FModel.Methods.Assets.IconCreator
|
||||
_itemAction = string.Empty;
|
||||
_maxStackSize = string.Empty;
|
||||
_userFacingFlagsToken = null;
|
||||
_userHeroFlagsToken = null;
|
||||
|
||||
JToken name_namespace = AssetsUtility.GetPropertyTagText<JToken>(AssetProperties, "DisplayName", "namespace");
|
||||
JToken name_key = AssetsUtility.GetPropertyTagText<JToken>(AssetProperties, "DisplayName", "key");
|
||||
@@ -59,6 +62,8 @@ namespace FModel.Methods.Assets.IconCreator
|
||||
JToken ammo_data = AssetsUtility.GetPropertyTagText<JToken>(AssetProperties, "AmmoData", "asset_path_name");
|
||||
|
||||
JArray gTagsArray = AssetsUtility.GetPropertyTagStruct<JArray>(AssetProperties, "GameplayTags", "gameplay_tags");
|
||||
JArray hTagsArray = AssetsUtility.GetPropertyTagStruct<JArray>(AssetProperties, "RequiredGPTags", "gameplay_tags");
|
||||
JArray wTagsArray = AssetsUtility.GetPropertyTagStruct<JArray>(AssetProperties, "MiniMapIconBrush", "properties");
|
||||
|
||||
if (name_namespace != null && name_key != null && name_source_string != null)
|
||||
{
|
||||
@@ -134,6 +139,16 @@ namespace FModel.Methods.Assets.IconCreator
|
||||
|
||||
_userFacingFlagsToken = gTagsArray.Children<JToken>().Where(x => x.ToString().StartsWith("Cosmetics.UserFacingFlags."));
|
||||
}
|
||||
|
||||
if (hTagsArray != null)
|
||||
_userHeroFlagsToken = hTagsArray.Children<JToken>().Where(x => x.ToString().StartsWith("Unlocks.Class."));
|
||||
|
||||
if (wTagsArray != null)
|
||||
{
|
||||
JToken resourceObjectToken = AssetsUtility.GetPropertyTagOuterImport<JToken>(wTagsArray, "ResourceObject");
|
||||
if (resourceObjectToken != null)
|
||||
_miniMapIconBrushPath = FoldersUtility.FixFortnitePath(resourceObjectToken.Value<string>());
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawTextVariables(JArray AssetProperties)
|
||||
@@ -185,6 +200,33 @@ namespace FModel.Methods.Assets.IconCreator
|
||||
}
|
||||
IconUserFacingFlags.xCoords = 4 - 25; //reset uFF coords
|
||||
}
|
||||
|
||||
if (_userHeroFlagsToken != null)
|
||||
{
|
||||
foreach (JToken uFF in _userHeroFlagsToken)
|
||||
{
|
||||
IconUserFacingFlags.DrawHeroFacingFlag(uFF);
|
||||
}
|
||||
IconUserFacingFlags.xCoords = 4 - 25; //reset uFF coords
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_miniMapIconBrushPath))
|
||||
using (System.IO.Stream image = AssetsUtility.GetStreamImageFromPath(_miniMapIconBrushPath))
|
||||
{
|
||||
if (image != null)
|
||||
{
|
||||
System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
|
||||
bmp.BeginInit();
|
||||
bmp.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad;
|
||||
bmp.StreamSource = image;
|
||||
bmp.EndInit();
|
||||
bmp.Freeze();
|
||||
|
||||
IconUserFacingFlags.xCoords += 25;
|
||||
IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(IconUserFacingFlags.xCoords, 4, 25, 25));
|
||||
IconUserFacingFlags.xCoords = 4 - 25; //reset uFF coords
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawDisplayName(string DisplayName)
|
||||
|
||||
Reference in New Issue
Block a user