added support for multiple userfacingflags and "BuiltInEmote" uff + button to delete current custom banner + less resources + fixed README.md

This commit is contained in:
Asval
2019-08-14 16:15:06 +02:00
parent b290ffa439
commit 9ce856b79d
12 changed files with 201 additions and 123 deletions

View File

@@ -236,19 +236,19 @@
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
@@ -290,10 +290,6 @@
<None Include="Resources\BurbankBigCondensed-Bold.ttf" />
<None Include="Resources\T-Icon-Pets-64.png" />
<None Include="Resources\T-Icon-Quests-64.png" />
<None Include="Resources\T-Icon-Variant-64.png" />
<None Include="Resources\T-Icon-Traversal-64.png" />
<None Include="Resources\T-Icon-Animated-64.png" />
<None Include="Resources\T-Icon-Adaptive-64.png" />
<None Include="Resources\unknown512.png" />
<None Include="Resources\properties_16xLG.png" />
<None Include="Resources\StatusAnnotations_Information_16xLG_color.png" />

View File

@@ -38,6 +38,8 @@ namespace FModel.Forms
this.label1 = new System.Windows.Forms.Label();
this.OKButton = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.checkBox8 = new System.Windows.Forms.CheckBox();
@@ -60,8 +62,7 @@ namespace FModel.Forms
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.button5 = new System.Windows.Forms.Button();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox4.SuspendLayout();
@@ -174,6 +175,28 @@ namespace FModel.Forms
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Icon Creation";
//
// comboBox2
//
this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Items.AddRange(new object[] {
"Default",
"Flat"});
this.comboBox2.Location = new System.Drawing.Point(85, 48);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(294, 21);
this.comboBox2.TabIndex = 31;
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.ComboBox2_SelectedIndexChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 51);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(73, 13);
this.label2.TabIndex = 30;
this.label2.Text = "Rarity Design:";
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -304,6 +327,7 @@ namespace FModel.Forms
//
// groupBox6
//
this.groupBox6.Controls.Add(this.button5);
this.groupBox6.Controls.Add(this.button3);
this.groupBox6.Controls.Add(this.button2);
this.groupBox6.Controls.Add(this.label7);
@@ -422,27 +446,15 @@ namespace FModel.Forms
this.label12.TabIndex = 9;
this.label12.Text = "Watermark:";
//
// comboBox2
// button5
//
this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Items.AddRange(new object[] {
"Default",
"Flat"});
this.comboBox2.Location = new System.Drawing.Point(85, 48);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(294, 21);
this.comboBox2.TabIndex = 31;
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.ComboBox2_SelectedIndexChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 51);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(73, 13);
this.label2.TabIndex = 30;
this.label2.Text = "Rarity Design:";
this.button5.Location = new System.Drawing.Point(168, 48);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(124, 23);
this.button5.TabIndex = 34;
this.button5.Text = "Delete Current Banner";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.Button5_Click);
//
// Settings
//
@@ -514,5 +526,6 @@ namespace FModel.Forms
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button5;
}
}

View File

@@ -34,7 +34,6 @@ namespace FModel.Forms
{
textBox6.Text = "@UseTheWatermarkBecauseWhyNot - {Date}";
}
else { textBox6.Text = Properties.Settings.Default.challengesWatermark; }
checkBox_tryToOpen.Checked = Properties.Settings.Default.tryToOpenAssets;
@@ -55,12 +54,16 @@ namespace FModel.Forms
button3.Enabled = Properties.Settings.Default.isChallengesTheme;
button4.Enabled = Properties.Settings.Default.isChallengesTheme;
checkBox2.Checked = Properties.Settings.Default.isChallengesTheme;
trackBar3.Enabled = Properties.Settings.Default.isChallengesTheme;
trackBar3.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName);
button5.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName);
trackBar3.Value = Properties.Settings.Default.challengesOpacity;
string[] colorParts = Properties.Settings.Default.challengesColors.Split(',');
headerColor = Color.FromArgb(255, Int32.Parse(colorParts[0]), Int32.Parse(colorParts[1]), Int32.Parse(colorParts[2]));
if (File.Exists(Properties.Settings.Default.challengesBannerFileName)) { drawChallengeTemplate(headerColor, true); }
else { pictureBox1.Image = Resources.cTemplate; }
if (!checkBox2.Checked)
{
pictureBox1.Image = Resources.cTemplate;
}
else { drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName)); }
//FEATURED
checkBox8.Checked = Properties.Settings.Default.loadFeaturedImage;
@@ -292,7 +295,7 @@ namespace FModel.Forms
{
button3.Enabled = checkBox2.Checked;
button4.Enabled = checkBox2.Checked;
trackBar3.Enabled = checkBox2.Checked;
trackBar3.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName);
if (!checkBox2.Checked)
{
@@ -423,6 +426,9 @@ namespace FModel.Forms
Properties.Settings.Default.Save();
drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName));
trackBar3.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName);
button5.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName);
}
}
@@ -441,5 +447,16 @@ namespace FModel.Forms
{
bmp.Dispose();
}
private void Button5_Click(object sender, EventArgs e)
{
Properties.Settings.Default.challengesBannerFileName = "";
Properties.Settings.Default.Save();
drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName));
trackBar3.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName);
button5.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName);
}
}
}

View File

@@ -5,6 +5,7 @@ using Newtonsoft.Json.Linq;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Collections.Generic;
namespace FModel
{
@@ -18,12 +19,13 @@ namespace FModel
private static string ItemAction { get; set; }
private static string WeaponDataTable { get; set; }
private static string WeaponRowName { get; set; }
private static string CosmeticUff { get; set; }
private static string[] CosmeticUff { get; set; }
private static string HeroType { get; set; }
private static string DefenderType { get; set; }
private static string MinToMax { get; set; }
private static JArray cosmeticsSetsArray { get; set; }
private static JArray weaponsStatsArray { get; set; }
private static JArray tertiaryCategoriesArray { get; set; }
private static string weaponStatsFilename { get; set; }
public static void DrawTexts(JToken theItem, Graphics myGraphic, string mode)
@@ -95,7 +97,7 @@ namespace FModel
ItemAction = "";
WeaponDataTable = "";
WeaponRowName = "";
CosmeticUff = "";
CosmeticUff = null;
HeroType = "";
DefenderType = "";
MinToMax = "";
@@ -162,10 +164,14 @@ namespace FModel
ItemAction = athenaItemAction.Value<string>().Substring(18);
}
JToken userFacingFlags = gameplayTagsArray.Children<JToken>().FirstOrDefault(x => x.ToString().StartsWith("Cosmetics.UserFacingFlags."));
IEnumerable<JToken> userFacingFlags = gameplayTagsArray.Children<JToken>().Where(x => x.ToString().StartsWith("Cosmetics.UserFacingFlags."));
if (userFacingFlags != null)
{
CosmeticUff = userFacingFlags.Value<string>();
CosmeticUff = new string[userFacingFlags.Count()];
for (int i = 0; i < CosmeticUff.Length; i++)
{
CosmeticUff[i] = userFacingFlags.ElementAt(i).Value<string>().Substring("Cosmetics.UserFacingFlags.".Length);
}
}
JToken defenderType = gameplayTagsArray.Children<JToken>().FirstOrDefault(x => x.ToString().StartsWith("NPC.CharacterType.Survivor.Defender."));
@@ -226,37 +232,136 @@ namespace FModel
}
}
private static void DrawCosmeticUff(JToken theItem, Graphics myGraphic)
{
if (tertiaryCategoriesArray == null)
{
string extractedCosmeticsSetsPath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary["ItemCategories"], "ItemCategories");
if (extractedCosmeticsSetsPath != null)
{
if (extractedCosmeticsSetsPath.Contains(".uasset") || extractedCosmeticsSetsPath.Contains(".uexp") || extractedCosmeticsSetsPath.Contains(".ubulk"))
{
JohnWick.MyAsset = new PakAsset(extractedCosmeticsSetsPath.Substring(0, extractedCosmeticsSetsPath.LastIndexOf('.')));
try
{
if (JohnWick.MyAsset.GetSerialized() != null)
{
dynamic AssetData = JsonConvert.DeserializeObject(JohnWick.MyAsset.GetSerialized());
JToken tertiaryCategories = AssetData[0]["TertiaryCategories"];
if (tertiaryCategories != null)
{
tertiaryCategoriesArray = tertiaryCategories.Value<JArray>();
DrawCosmeticUffFromArray(theItem, myGraphic);
}
}
}
catch (JsonSerializationException)
{
//do not crash when JsonSerialization does weird stuff
}
}
}
}
else { DrawCosmeticUffFromArray(theItem, myGraphic); }
}
/// <summary>
/// search for a known Cosmetics.UserFacingFlags, if found draw the uff icon
/// Cosmetics.UserFacingFlags icons are basically the style icon or the animated/reactive/traversal icon
/// </summary>
/// <param name="theItem"></param>
/// <param name="myGraphic"></param>
private static void DrawCosmeticUff(JToken theItem, Graphics myGraphic)
private static void DrawCosmeticUffFromArray(JToken theItem, Graphics myGraphic)
{
Image imageLogo = null;
Point pointCoords = new Point(6, 6);
if (CosmeticUff != null)
{
if (CosmeticUff.Contains("Animated"))
imageLogo = Resources.Animated64;
else if (CosmeticUff.Contains("HasUpgradeQuests") && !theItem["export_type"].Value<string>().Equals("AthenaPetCarrierItemDefinition"))
imageLogo = Resources.Quests64;
else if (CosmeticUff.Contains("HasUpgradeQuests") && theItem["export_type"].Value<string>().Equals("AthenaPetCarrierItemDefinition"))
imageLogo = Resources.Pets64;
else if (CosmeticUff.Contains("HasVariants"))
imageLogo = Resources.Variant64;
else if (CosmeticUff.Contains("Reactive"))
imageLogo = Resources.Adaptive64;
else if (CosmeticUff.Contains("Traversal"))
imageLogo = Resources.Traversal64;
int xCoord = 6;
for (int x = 0; x < tertiaryCategoriesArray.Count; x++)
{
JToken categoryName = tertiaryCategoriesArray[x]["CategoryName"];
if (categoryName != null)
{
JToken text = categoryName["source_string"];
if (text != null)
{
if (CosmeticUff.Any(target => target.Contains("Animated")) && string.Equals(text.Value<string>(), "Animated"))
{
Image imageLogo = getUffFromBrush(x);
drawImageLogo(myGraphic, imageLogo, xCoord);
xCoord += 28;
}
else if (CosmeticUff.Any(target => target.Contains("HasVariants")) && string.Equals(text.Value<string>(), "Unlockable Styles"))
{
Image imageLogo = getUffFromBrush(x);
drawImageLogo(myGraphic, imageLogo, xCoord);
xCoord += 28;
}
else if (CosmeticUff.Any(target => target.Contains("Reactive")) && string.Equals(text.Value<string>(), "Reactive"))
{
Image imageLogo = getUffFromBrush(x);
drawImageLogo(myGraphic, imageLogo, xCoord);
xCoord += 28;
}
else if (CosmeticUff.Any(target => target.Contains("Traversal")) && string.Equals(text.Value<string>(), "Traversal"))
{
Image imageLogo = getUffFromBrush(x);
drawImageLogo(myGraphic, imageLogo, xCoord);
xCoord += 28;
}
else if (CosmeticUff.Any(target => target.Contains("BuiltInEmote")) && string.Equals(text.Value<string>(), "Built-in"))
{
Image imageLogo = getUffFromBrush(x);
drawImageLogo(myGraphic, imageLogo, xCoord);
xCoord += 28;
}
else if (CosmeticUff.Any(target => target.Contains("HasUpgradeQuests")) && string.Equals(text.Value<string>(), "Unlockable Styles") && !theItem["export_type"].Value<string>().Equals("AthenaPetCarrierItemDefinition"))
{
Image imageLogo = Resources.Quests64;
drawImageLogo(myGraphic, imageLogo, xCoord);
xCoord += 28;
}
else if (CosmeticUff.Any(target => target.Contains("HasUpgradeQuests")) && string.Equals(text.Value<string>(), "Unlockable Styles") && theItem["export_type"].Value<string>().Equals("AthenaPetCarrierItemDefinition"))
{
Image imageLogo = Resources.Pets64;
drawImageLogo(myGraphic, imageLogo, xCoord);
xCoord += 28;
}
}
}
}
}
if (imageLogo != null)
}
private static Image getUffFromBrush(int index)
{
JToken categoryBrush = tertiaryCategoriesArray[index]["CategoryBrush"];
if (categoryBrush != null)
{
myGraphic.DrawImage(ImageUtilities.ResizeImage(imageLogo, 28, 28), pointCoords);
imageLogo.Dispose();
JToken brush_XXS = categoryBrush["Brush_XXS"];
if (brush_XXS != null)
{
JToken resourceObject = brush_XXS["ResourceObject"];
if (resourceObject != null)
{
string texture = JohnWick.AssetToTexture2D(resourceObject.Value<string>());
if (!string.IsNullOrEmpty(texture))
{
return Image.FromFile(texture);
}
else { return null; }
}
else { return null; }
}
else { return null; }
}
else { return null; }
}
private static void drawImageLogo(Graphics myGraphic, Image logo, int x)
{
if (logo != null)
{
Point pointCoords = new Point(x, 6);
myGraphic.DrawImage(ImageUtilities.ResizeImage(logo, 28, 28), pointCoords);
logo.Dispose();
}
}

View File

@@ -3,7 +3,6 @@ using FModel.Properties;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;

View File

@@ -60,26 +60,6 @@ namespace FModel.Properties {
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Adaptive64 {
get {
object obj = ResourceManager.GetObject("Adaptive64", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Animated64 {
get {
object obj = ResourceManager.GetObject("Animated64", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Byte[].
/// </summary>
@@ -310,16 +290,6 @@ namespace FModel.Properties {
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Traversal64 {
get {
object obj = ResourceManager.GetObject("Traversal64", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Icon semblable à (Icône).
/// </summary>
@@ -350,16 +320,6 @@ namespace FModel.Properties {
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Variant64 {
get {
object obj = ResourceManager.GetObject("Variant64", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
/// </summary>

View File

@@ -142,18 +142,6 @@
<data name="FModel_Logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FModel_Logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Adaptive64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\T-Icon-Adaptive-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Animated64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\T-Icon-Animated-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Traversal64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\T-Icon-Traversal-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Variant64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\T-Icon-Variant-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Quests64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\T-Icon-Quests-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -56,28 +56,28 @@
[Demonstration](https://streamable.com/c39oz)
## DOCUMENTATION
### Q&A
_What's FModel?_
### FAQ
- _What's FModel?_
- FModel is a Fortnite .PAK files explorer mainly known to create icons for different BR/STW items as well as all BR challenges
_Where can i download FModel?_
[Latest Version](https://github.com/iAmAsval/FModel/releases/latest/download/FModel.zip)
- _Where can i download FModel?_
- [Latest Version](https://github.com/iAmAsval/FModel/releases/latest/download/FModel.zip)
_I'm sure the key is correct but opening the file with this key isn't working_
- _I'm sure the key is correct but opening the file with this key isn't working_
- First, make sure `C:\Windows\System32\vcruntime140.dll` isn't missing. If it's missing you can download it by installing [Microsoft Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads).
- If it's not missing you can open on issue on GitHub or contact us on Twitter @AsvalFN @MaikyMOficial @iFireMonkey
_I can't compile the solution on Visual Studio_
- _I can't compile the solution on Visual Studio_
- If issues occur when compiling the source code, make sure that the software is being built for x64.
_Why FModel?_
- _Why FModel?_
- The name come from the popular Unreal Engine Viewer [UModel](https://github.com/gildor2/UModel)
- It wasn't made to be a competitor but more to complete what was missing exclusively on Fortnite
- Icon creation with languages support, an area to display the serialized asset, single pak file loader, and more).
- It wasn't made to be a competitor but more to complete what was missing for Fortnite
- Icon creation with languages support, an area to display the serialized asset, single pak file loader, and more.
If you find this project useful, feel free to give it a :star: thank you :kissing_heart: