refactored translations (thoughts?) + added FText with namespace if not empty + removed IconGeneratorAssets + double click to extract

This commit is contained in:
Asval 2019-07-20 04:20:26 +02:00
parent 93cd181feb
commit edf2167010
24 changed files with 309 additions and 2059 deletions

View File

@ -16,21 +16,6 @@
<setting name="ExtractOutput" serializeAs="String">
<value />
</setting>
<setting name="createIconForCosmetics" serializeAs="String">
<value>True</value>
</setting>
<setting name="createIconForVariants" serializeAs="String">
<value>True</value>
</setting>
<setting name="createIconForConsumablesWeapons" serializeAs="String">
<value>True</value>
</setting>
<setting name="createIconForTraps" serializeAs="String">
<value>True</value>
</setting>
<setting name="createIconForChallenges" serializeAs="String">
<value>True</value>
</setting>
<setting name="loadFeaturedImage" serializeAs="String">
<value>False</value>
</setting>
@ -112,18 +97,6 @@
<setting name="UpdateSettings" serializeAs="String">
<value>True</value>
</setting>
<setting name="createIconForAmmo" serializeAs="String">
<value>True</value>
</setting>
<setting name="createIconForSTWDefenders" serializeAs="String">
<value>True</value>
</setting>
<setting name="createIconForSTWHeroes" serializeAs="String">
<value>True</value>
</setting>
<setting name="createIconForSTWCardPacks" serializeAs="String">
<value>True</value>
</setting>
<setting name="IconLanguage" serializeAs="String">
<value>English</value>
</setting>
@ -133,9 +106,6 @@
<setting name="challengesWatermark" serializeAs="String">
<value />
</setting>
<setting name="createIconForCreativeGalleries" serializeAs="String">
<value>True</value>
</setting>
<setting name="tryToOpenAssets" serializeAs="String">
<value>True</value>
</setting>

View File

@ -81,8 +81,8 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoUpdater.NET, Version=1.5.3.0, Culture=neutral, PublicKeyToken=501435c91b35f4bc, processorArchitecture=MSIL">
<HintPath>..\packages\Autoupdater.NET.Official.1.5.3\lib\net40\AutoUpdater.NET.dll</HintPath>
<Reference Include="AutoUpdater.NET, Version=1.5.4.0, Culture=neutral, PublicKeyToken=501435c91b35f4bc, processorArchitecture=MSIL">
<HintPath>..\packages\Autoupdater.NET.Official.1.5.4\lib\net40\AutoUpdater.NET.dll</HintPath>
</Reference>
<Reference Include="csharp-wick, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@ -91,8 +91,8 @@
<Reference Include="Hammock.ClientProfile, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c148cfba29ed1a4d, processorArchitecture=MSIL">
<HintPath>..\packages\TweetMoaSharp.6.0.0\lib\4.5\Hammock.ClientProfile.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPack, Version=1.11.9.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlAgilityPack.1.11.9\lib\Net45\HtmlAgilityPack.dll</HintPath>
<Reference Include="HtmlAgilityPack, Version=1.11.10.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlAgilityPack.1.11.10\lib\Net45\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
@ -171,12 +171,6 @@
<Compile Include="Forms\SearchFiles.Designer.cs">
<DependentUpon>SearchFiles.cs</DependentUpon>
</Compile>
<Compile Include="Forms\IconGeneratorAssets.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\IconGeneratorAssets.Designer.cs">
<DependentUpon>IconGeneratorAssets.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Settings.cs">
<SubType>Form</SubType>
</Compile>
@ -204,7 +198,6 @@
<Compile Include="Parser\Featured\FeaturedParser.cs" />
<Compile Include="Parser\Items\CosmeticSetsParser.cs" />
<Compile Include="Parser\Items\ItemIDParser.cs" />
<Compile Include="Parser\LocRes\LocResParser.cs" />
<Compile Include="Parser\Meshes\MeshesParser.cs" />
<Compile Include="Parser\Quests\QuestParser.cs" />
<Compile Include="Parser\RenderMat\RenderSwitchMaterial.cs" />
@ -220,9 +213,6 @@
<EmbeddedResource Include="Forms\SearchFiles.resx">
<DependentUpon>SearchFiles.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\IconGeneratorAssets.resx">
<DependentUpon>IconGeneratorAssets.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Settings.resx">
<DependentUpon>Settings.cs</DependentUpon>
</EmbeddedResource>

View File

@ -1,90 +0,0 @@
namespace FModel.Forms
{
partial class IconGeneratorAssets
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(IconGeneratorAssets));
this.OKButton = new System.Windows.Forms.Button();
this.checkedAssets = new System.Windows.Forms.CheckedListBox();
this.SuspendLayout();
//
// OKButton
//
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OKButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.OKButton.Location = new System.Drawing.Point(222, 300);
this.OKButton.Name = "OKButton";
this.OKButton.Size = new System.Drawing.Size(97, 21);
this.OKButton.TabIndex = 15;
this.OKButton.Text = "OK";
this.OKButton.UseVisualStyleBackColor = true;
this.OKButton.Click += new System.EventHandler(this.OKButton_Click);
//
// checkedAssets
//
this.checkedAssets.CheckOnClick = true;
this.checkedAssets.FormattingEnabled = true;
this.checkedAssets.Items.AddRange(new object[] {
"Challenges",
"Consumables & Weapons",
"Cosmetics",
"Traps",
"Variants",
"Ammo",
"STW Heroes",
"STW Defenders",
"STW Card Packs",
"Creative Galleries"});
this.checkedAssets.Location = new System.Drawing.Point(12, 12);
this.checkedAssets.Name = "checkedAssets";
this.checkedAssets.Size = new System.Drawing.Size(307, 274);
this.checkedAssets.TabIndex = 16;
//
// IconGeneratorAssets
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(331, 333);
this.Controls.Add(this.checkedAssets);
this.Controls.Add(this.OKButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "IconGeneratorAssets";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FModel Settings - Icon Assets";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button OKButton;
private System.Windows.Forms.CheckedListBox checkedAssets;
}
}

View File

@ -1,43 +0,0 @@
using System;
using System.Windows.Forms;
namespace FModel.Forms
{
public partial class IconGeneratorAssets : Form
{
public IconGeneratorAssets()
{
InitializeComponent();
//ICON CREATION
checkedAssets.SetItemChecked(0, Properties.Settings.Default.createIconForChallenges);
checkedAssets.SetItemChecked(1, Properties.Settings.Default.createIconForConsumablesWeapons);
checkedAssets.SetItemChecked(2, Properties.Settings.Default.createIconForCosmetics);
checkedAssets.SetItemChecked(3, Properties.Settings.Default.createIconForTraps);
checkedAssets.SetItemChecked(4, Properties.Settings.Default.createIconForVariants);
checkedAssets.SetItemChecked(5, Properties.Settings.Default.createIconForAmmo);
checkedAssets.SetItemChecked(6, Properties.Settings.Default.createIconForSTWHeroes);
checkedAssets.SetItemChecked(7, Properties.Settings.Default.createIconForSTWDefenders);
checkedAssets.SetItemChecked(8, Properties.Settings.Default.createIconForSTWCardPacks);
checkedAssets.SetItemChecked(9, Properties.Settings.Default.createIconForCreativeGalleries);
}
private void OKButton_Click(object sender, EventArgs e)
{
//ICON CREATION
Properties.Settings.Default.createIconForChallenges = checkedAssets.GetItemChecked(0);
Properties.Settings.Default.createIconForConsumablesWeapons = checkedAssets.GetItemChecked(1);
Properties.Settings.Default.createIconForCosmetics = checkedAssets.GetItemChecked(2);
Properties.Settings.Default.createIconForTraps = checkedAssets.GetItemChecked(3);
Properties.Settings.Default.createIconForVariants = checkedAssets.GetItemChecked(4);
Properties.Settings.Default.createIconForAmmo = checkedAssets.GetItemChecked(5);
Properties.Settings.Default.createIconForSTWHeroes = checkedAssets.GetItemChecked(6);
Properties.Settings.Default.createIconForSTWDefenders = checkedAssets.GetItemChecked(7);
Properties.Settings.Default.createIconForSTWCardPacks = checkedAssets.GetItemChecked(8);
Properties.Settings.Default.createIconForCreativeGalleries = checkedAssets.GetItemChecked(9);
Properties.Settings.Default.Save(); //SAVE
Close();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,6 @@ namespace FModel.Forms
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.checkBox8 = new System.Windows.Forms.CheckBox();
this.checkBox7 = new System.Windows.Forms.CheckBox();
this.filenameLabel = new System.Windows.Forms.Label();
@ -156,7 +155,6 @@ namespace FModel.Forms
this.groupBox4.Controls.Add(this.checkBox1);
this.groupBox4.Controls.Add(this.comboBox1);
this.groupBox4.Controls.Add(this.label10);
this.groupBox4.Controls.Add(this.button2);
this.groupBox4.Controls.Add(this.checkBox8);
this.groupBox4.Controls.Add(this.checkBox7);
this.groupBox4.Controls.Add(this.filenameLabel);
@ -176,7 +174,7 @@ namespace FModel.Forms
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(244, 47);
this.checkBox1.Location = new System.Drawing.Point(244, 54);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(139, 17);
this.checkBox1.TabIndex = 30;
@ -204,7 +202,7 @@ namespace FModel.Forms
"Turkish",
"Chinese (S)",
"Traditional Chinese"});
this.comboBox1.Location = new System.Drawing.Point(70, 161);
this.comboBox1.Location = new System.Drawing.Point(70, 19);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(309, 21);
this.comboBox1.TabIndex = 29;
@ -212,26 +210,16 @@ namespace FModel.Forms
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(6, 164);
this.label10.Location = new System.Drawing.Point(6, 22);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(58, 13);
this.label10.TabIndex = 28;
this.label10.Text = "Language:";
//
// button2
//
this.button2.Location = new System.Drawing.Point(6, 19);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(377, 22);
this.button2.TabIndex = 27;
this.button2.Text = "Manage Assets";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// checkBox8
//
this.checkBox8.AutoSize = true;
this.checkBox8.Location = new System.Drawing.Point(6, 47);
this.checkBox8.Location = new System.Drawing.Point(6, 54);
this.checkBox8.Name = "checkBox8";
this.checkBox8.Size = new System.Drawing.Size(177, 17);
this.checkBox8.TabIndex = 26;
@ -242,7 +230,7 @@ namespace FModel.Forms
// checkBox7
//
this.checkBox7.AutoSize = true;
this.checkBox7.Location = new System.Drawing.Point(6, 75);
this.checkBox7.Location = new System.Drawing.Point(6, 90);
this.checkBox7.Name = "checkBox7";
this.checkBox7.Size = new System.Drawing.Size(15, 14);
this.checkBox7.TabIndex = 25;
@ -253,7 +241,7 @@ namespace FModel.Forms
//
this.filenameLabel.AutoEllipsis = true;
this.filenameLabel.AutoSize = true;
this.filenameLabel.Location = new System.Drawing.Point(115, 76);
this.filenameLabel.Location = new System.Drawing.Point(115, 91);
this.filenameLabel.MaximumSize = new System.Drawing.Size(260, 13);
this.filenameLabel.Name = "filenameLabel";
this.filenameLabel.Size = new System.Drawing.Size(60, 13);
@ -262,7 +250,7 @@ namespace FModel.Forms
//
// trackBar1
//
this.trackBar1.Location = new System.Drawing.Point(54, 128);
this.trackBar1.Location = new System.Drawing.Point(58, 144);
this.trackBar1.Maximum = 100;
this.trackBar1.Name = "trackBar1";
this.trackBar1.Size = new System.Drawing.Size(325, 45);
@ -273,7 +261,7 @@ namespace FModel.Forms
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(18, 99);
this.label9.Location = new System.Drawing.Point(22, 115);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(30, 13);
this.label9.TabIndex = 23;
@ -281,7 +269,7 @@ namespace FModel.Forms
//
// trackBar2
//
this.trackBar2.Location = new System.Drawing.Point(54, 99);
this.trackBar2.Location = new System.Drawing.Point(58, 115);
this.trackBar2.Maximum = 1000;
this.trackBar2.Minimum = 1;
this.trackBar2.Name = "trackBar2";
@ -295,7 +283,7 @@ namespace FModel.Forms
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(2, 131);
this.label8.Location = new System.Drawing.Point(6, 147);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(46, 13);
this.label8.TabIndex = 21;
@ -303,7 +291,7 @@ namespace FModel.Forms
//
// button1
//
this.button1.Location = new System.Drawing.Point(27, 69);
this.button1.Location = new System.Drawing.Point(27, 84);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(82, 24);
this.button1.TabIndex = 19;
@ -485,7 +473,6 @@ namespace FModel.Forms
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.GroupBox groupBox6;

View File

@ -229,19 +229,6 @@ namespace FModel.Forms
}
}
private void button2_Click(object sender, EventArgs e)
{
var assetsForm = new IconGeneratorAssets();
if (Application.OpenForms[assetsForm.Name] == null)
{
assetsForm.Show();
}
else
{
Application.OpenForms[assetsForm.Name].Focus();
}
}
private void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if (!checkBox1.Checked)

View File

@ -460,6 +460,7 @@ namespace FModel
this.listBox1.Sorted = true;
this.listBox1.TabIndex = 1;
this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
this.listBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.ListBox1_MouseDoubleClick);
this.listBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDown);
//
// richTextBox1

View File

@ -996,53 +996,79 @@ namespace FModel
new UpdateMyState("Parsing " + ThePak.CurrentUsedItem + "...", "Waiting").ChangeProcessState();
for (int i = 0; i < itemId.Length; i++)
{
if (Settings.Default.createIconForCosmetics && itemId[i].ExportType.Contains("Athena") && itemId[i].ExportType.Contains("Item") && itemId[i].ExportType.Contains("Definition"))
switch (itemId[i].ExportType)
{
CreateItemIcon(itemId[i], "athIteDef");
case "AthenaBackpackItemDefinition":
case "AthenaBattleBusItemDefinition":
case "AthenaCharacterItemDefinition":
case "AthenaConsumableEmoteItemDefinition":
case "AthenaSkyDiveContrailItemDefinition":
case "AthenaDanceItemDefinition":
case "AthenaEmojiItemDefinition":
case "AthenaGliderItemDefinition":
case "AthenaItemWrapDefinition":
case "AthenaLoadingScreenItemDefinition":
case "AthenaMusicPackItemDefinition":
case "AthenaPetCarrierItemDefinition":
case "AthenaPickaxeItemDefinition":
case "AthenaSprayItemDefinition":
case "AthenaToyItemDefinition":
case "AthenaVictoryPoseItemDefinition":
case "FortBannerTokenType":
case "AthenaGadgetItemDefinition":
CreateItemIcon(itemId[i], "athIteDef");
break;
case "FortWeaponRangedItemDefinition":
case "FortWeaponMeleeItemDefinition":
case "FortIngredientItemDefinition":
CreateItemIcon(itemId[i], "consAndWeap");
break;
case "FortVariantTokenType":
CreateItemIcon(itemId[i], "variant");
break;
case "FortAmmoItemDefinition":
CreateItemIcon(itemId[i], "ammo");
break;
case "FortHeroType":
CreateItemIcon(itemId[i], "stwHeroes");
break;
case "FortDefenderItemDefinition":
CreateItemIcon(itemId[i], "stwDefenders");
break;
case "FortContextTrapItemDefinition":
case "FortTrapItemDefinition":
case "FortCardPackItemDefinition":
case "FortPlaysetGrenadeItemDefinition":
case "FortConsumableAccountItemDefinition":
case "FortBadgeItemDefinition":
case "FortCurrencyItemDefinition":
case "FortConversionControlItemDefinition":
case "FortHomebaseNodeItemDefinition":
case "FortPersonalVehicleItemDefinition":
case "FortCampaignHeroLoadoutItemDefinition":
case "FortNeverPersistItemDefinition":
case "FortPersistentResourceItemDefinition":
case "FortResourceItemDefinition":
case "FortGadgetItemDefinition":
case "FortStatItemDefinition":
case "FortTokenType":
case "FortDailyRewardScheduleTokenDefinition":
case "FortWorkerType":
case "FortConditionalResourceItemDefinition":
case "FortAwardItemDefinition":
case "FortChallengeBundleScheduleDefinition":
CreateItemIcon(itemId[i]);
break;
case "FortChallengeBundleItemDefinition":
CreateBundleChallengesIcon(itemId[i], parsedJson, questJson);
break;
case "Texture2D":
ConvertTexture2D();
break;
case "SoundWave":
ConvertSoundWave();
break;
}
else if (Settings.Default.createIconForConsumablesWeapons && (itemId[i].ExportType == "FortWeaponRangedItemDefinition" || itemId[i].ExportType == "FortWeaponMeleeItemDefinition"))
{
CreateItemIcon(itemId[i], "consAndWeap");
}
else if (Settings.Default.createIconForTraps && (itemId[i].ExportType == "FortTrapItemDefinition" || itemId[i].ExportType == "FortContextTrapItemDefinition"))
{
CreateItemIcon(itemId[i]);
}
else if (Settings.Default.createIconForVariants && (itemId[i].ExportType == "FortVariantTokenType"))
{
CreateItemIcon(itemId[i], "variant");
}
else if (Settings.Default.createIconForAmmo && (itemId[i].ExportType == "FortAmmoItemDefinition"))
{
CreateItemIcon(itemId[i], "ammo");
}
else if (itemId[i].ExportType == "FortBannerTokenType")
{
CreateItemIcon(itemId[i], "athIteDef"); //athIteDef because there's a cosmetic source
}
else if (questJson != null && (Settings.Default.createIconForSTWHeroes && (itemId[i].ExportType == "FortHeroType" && (questJson.Contains("ItemDefinition") || questJson.Contains("TestDefsSkydive") || questJson.Contains("GameplayPrototypes"))))) //Contains x not to trigger HID from BR
{
CreateItemIcon(itemId[i], "stwHeroes");
}
else if (Settings.Default.createIconForSTWDefenders && (itemId[i].ExportType == "FortDefenderItemDefinition"))
{
CreateItemIcon(itemId[i], "stwDefenders");
}
else if (Settings.Default.createIconForSTWCardPacks && (itemId[i].ExportType == "FortCardPackItemDefinition"))
{
CreateItemIcon(itemId[i]);
}
else if (Settings.Default.createIconForCreativeGalleries && (itemId[i].ExportType == "FortPlaysetGrenadeItemDefinition"))
{
CreateItemIcon(itemId[i]);
}
else if (itemId[i].ExportType == "FortChallengeBundleItemDefinition")
{
CreateBundleChallengesIcon(itemId[i], parsedJson, questJson);
}
else if (itemId[i].ExportType == "Texture2D") { ConvertTexture2D(); }
else if (itemId[i].ExportType == "SoundWave") { ConvertSoundWave(); }
else { new UpdateMyState(ThePak.CurrentUsedItem + " successfully extracted", "Success").ChangeProcessState(); }
}
}
catch (Exception ex)
@ -1122,21 +1148,17 @@ namespace FModel
{
ChallengeBundleIdParser bundleParser = ChallengeBundleIdParser.FromJson(theParsedJson).FirstOrDefault();
BundleInfos.getBundleData(bundleParser);
Bitmap bmp = null;
bool isFortbyte = false;
if (Settings.Default.createIconForChallenges)
{
bmp = new Bitmap(2500, 15000);
BundleDesign.BundlePath = extractedBundlePath;
BundleDesign.theY = 275;
BundleDesign.toDrawOn = Graphics.FromImage(bmp);
BundleDesign.toDrawOn.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
BundleDesign.toDrawOn.SmoothingMode = SmoothingMode.HighQuality;
BundleDesign.myItem = theItem;
Bitmap bmp = new Bitmap(2500, 15000);
BundleDesign.BundlePath = extractedBundlePath;
BundleDesign.theY = 275;
BundleDesign.toDrawOn = Graphics.FromImage(bmp);
BundleDesign.toDrawOn.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
BundleDesign.toDrawOn.SmoothingMode = SmoothingMode.HighQuality;
BundleDesign.myItem = theItem;
BundleDesign.drawBackground(bmp, bundleParser);
}
BundleDesign.drawBackground(bmp, bundleParser);
if (BundleInfos.BundleData[0].rewardItemId != null && string.Equals(BundleInfos.BundleData[0].rewardItemId, "AthenaFortbyte", StringComparison.CurrentCultureIgnoreCase))
isFortbyte = true;
@ -1156,49 +1178,43 @@ namespace FModel
new UpdateMyConsole("\t\tCount: " + BundleInfos.BundleData[i].questCount, Color.DarkRed).AppendToConsole();
new UpdateMyConsole("\t\t" + BundleInfos.BundleData[i].rewardItemId + ":" + BundleInfos.BundleData[i].rewardItemQuantity, Color.DarkGreen, true).AppendToConsole();
if (Settings.Default.createIconForChallenges)
BundleDesign.theY += 140;
//in case you wanna make some changes
//BundleDesign.toDrawOn.DrawRectangle(new Pen(new SolidBrush(Color.Red)), new Rectangle(107, BundleDesign.theY + 7, 2000, 93)); //rectangle that resize the font -> used for "Font goodFont = "
//BundleDesign.toDrawOn.DrawRectangle(new Pen(new SolidBrush(Color.Blue)), new Rectangle(107, BundleDesign.theY + 7, 2000, 75)); //rectangle the font needs to be fit with
//draw quest description
Font goodFont = FontUtilities.FindFont(BundleDesign.toDrawOn, BundleInfos.BundleData[i].questDescr, new Rectangle(107, BundleDesign.theY + 7, 2000, 93).Size, new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], 50)); //size in "new Font()" is never check
BundleDesign.toDrawOn.DrawString(BundleInfos.BundleData[i].questDescr, goodFont, new SolidBrush(Color.White), new Point(100, BundleDesign.theY));
//draw slider + quest count
Image slider = Resources.Challenges_Slider;
BundleDesign.toDrawOn.DrawImage(slider, new Point(108, BundleDesign.theY + 86));
BundleDesign.toDrawOn.DrawString(BundleInfos.BundleData[i].questCount.ToString(), new Font(FontUtilities.pfc.Families[0], 20), new SolidBrush(Color.FromArgb(255, 255, 255, 255)), new Point(968, BundleDesign.theY + 87));
//draw quest reward
DrawingRewards.getRewards(BundleInfos.BundleData[i].rewardItemId, BundleInfos.BundleData[i].rewardItemQuantity);
if (i != 0)
{
BundleDesign.theY += 140;
//in case you wanna make some changes
//BundleDesign.toDrawOn.DrawRectangle(new Pen(new SolidBrush(Color.Red)), new Rectangle(107, BundleDesign.theY + 7, 2000, 93)); //rectangle that resize the font -> used for "Font goodFont = "
//BundleDesign.toDrawOn.DrawRectangle(new Pen(new SolidBrush(Color.Blue)), new Rectangle(107, BundleDesign.theY + 7, 2000, 75)); //rectangle the font needs to be fit with
//draw quest description
Font goodFont = FontUtilities.FindFont(BundleDesign.toDrawOn, BundleInfos.BundleData[i].questDescr, new Rectangle(107, BundleDesign.theY + 7, 2000, 93).Size, new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], 50)); //size in "new Font()" is never check
BundleDesign.toDrawOn.DrawString(BundleInfos.BundleData[i].questDescr, goodFont, new SolidBrush(Color.White), new Point(100, BundleDesign.theY));
//draw slider + quest count
Image slider = Resources.Challenges_Slider;
BundleDesign.toDrawOn.DrawImage(slider, new Point(108, BundleDesign.theY + 86));
BundleDesign.toDrawOn.DrawString(BundleInfos.BundleData[i].questCount.ToString(), new Font(FontUtilities.pfc.Families[0], 20), new SolidBrush(Color.FromArgb(255, 255, 255, 255)), new Point(968, BundleDesign.theY + 87));
//draw quest reward
DrawingRewards.getRewards(BundleInfos.BundleData[i].rewardItemId, BundleInfos.BundleData[i].rewardItemQuantity);
if (i != 0)
{
//draw separator
BundleDesign.toDrawOn.DrawLine(new Pen(Color.FromArgb(30, 255, 255, 255)), 100, BundleDesign.theY - 10, 2410, BundleDesign.theY - 10);
}
//draw separator
BundleDesign.toDrawOn.DrawLine(new Pen(Color.FromArgb(30, 255, 255, 255)), 100, BundleDesign.theY - 10, 2410, BundleDesign.theY - 10);
}
}
new UpdateMyConsole("", Color.Black, true).AppendToConsole();
if (Settings.Default.createIconForChallenges)
BundleDesign.drawCompletionReward(bundleParser);
BundleDesign.drawWatermark(bmp);
//cut if too long and return the bitmap
using (Bitmap bmp2 = bmp)
{
BundleDesign.drawCompletionReward(bundleParser);
BundleDesign.drawWatermark(bmp);
var newImg = bmp2.Clone(
new Rectangle { X = 0, Y = 0, Width = bmp.Width, Height = BundleDesign.theY + 280 },
bmp2.PixelFormat);
//cut if too long and return the bitmap
using (Bitmap bmp2 = bmp)
{
var newImg = bmp2.Clone(
new Rectangle { X = 0, Y = 0, Width = bmp.Width, Height = BundleDesign.theY + 280 },
bmp2.PixelFormat);
pictureBox1.Image = newImg;
}
pictureBox1.Image = newImg;
}
new UpdateMyState(theItem.DisplayName.SourceString, "Success").ChangeProcessState();
@ -1233,7 +1249,8 @@ namespace FModel
string filePath = App.DefaultOutputPath + "\\Extracted\\" + treeviewPath + "\\" + listBox1.SelectedItem;
if (File.Exists(filePath))
{
scintilla1.Text = LocResSerializer.StringFinder(filePath);
LocResSerializer.setLocRes(filePath);
scintilla1.Text = JsonConvert.SerializeObject(LocResSerializer.LocResDict, Formatting.Indented);
}
else { throw new FileNotFoundException("Error while searching " + listBox1.SelectedItem); }
}));
@ -1338,6 +1355,13 @@ namespace FModel
{
ExtractProcess();
}
private void ListBox1_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (listBox1.SelectedItem != null && SelectedItemsArray == null)
{
ExtractProcess();
}
}
private void ExtractProcess()
{
@ -1620,6 +1644,12 @@ namespace FModel
}
}
}
private void openExtractionFolderToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Settings.Default.ExtractOutput))
Process.Start(@"" + Settings.Default.ExtractOutput);
}
#endregion
#region RIGHT CLICK
@ -1680,11 +1710,5 @@ namespace FModel
}
}
#endregion
private void openExtractionFolderToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Properties.Settings.Default.ExtractOutput))
System.Diagnostics.Process.Start(@"" + Properties.Settings.Default.ExtractOutput);
}
}
}

View File

@ -78,7 +78,7 @@ namespace FModel
}
catch (Exception)
{
new UpdateMyConsole("Error while checking for dynamic keys", Color.Red, true).AppendToConsole();
new UpdateMyConsole("[BenBot API] Error while checking for dynamic keys", Color.Red, true).AppendToConsole();
return null;
}
}

View File

@ -6,8 +6,6 @@ using System.Drawing.Drawing2D;
using System.IO;
using System.Windows.Forms;
using System;
using Newtonsoft.Json.Linq;
using FModel.Parser.LocResParser;
namespace FModel
{
@ -40,7 +38,8 @@ namespace FModel
/// <param name="myBundle"></param>
public static void drawBackground(Bitmap myBitmap, ChallengeBundleIdParser myBundle)
{
if (Settings.Default.createIconForChallenges && myBundle.DisplayStyle != null)
new UpdateMyState("Drawing...", "Waiting").ChangeProcessState();
if (myBundle.DisplayStyle != null)
{
//main header
toDrawOn.FillRectangle(new SolidBrush(BundleInfos.getSecondaryColor(myBundle)), new Rectangle(0, 0, myBitmap.Width, 281));
@ -57,7 +56,15 @@ namespace FModel
GraphicsPath p = new GraphicsPath();
Pen myPen = new Pen(ControlPaint.Light(BundleInfos.getSecondaryColor(myBundle), (float)0.2), 3);
myPen.LineJoin = LineJoin.Round; //needed to avoid spikes
p.AddString(BundleInfos.getLastFolder(BundlePath), Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], (int)FontStyle.Regular, 55, new Point(342, 40), FontUtilities.leftString);
p.AddString(
Utilities.CaseInsensitiveContains(BundleInfos.getLastFolder(BundlePath), "SEASON", StringComparison.CurrentCultureIgnoreCase) ?
SearchResource.getTextByKey("15EB9C4A494F597285CC5CA2EAA571E1", "SEASON") + " " + BundleInfos.getLastFolder(BundlePath).Substring(BundleInfos.getLastFolder(BundlePath).Length - 1) :
BundleInfos.getLastFolder(BundlePath),
Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1],
(int)FontStyle.Regular, 55,
new Point(342, 40),
FontUtilities.leftString
);
toDrawOn.DrawPath(myPen, p);
toDrawOn.FillPath(new SolidBrush(ControlPaint.Dark(BundleInfos.getSecondaryColor(myBundle), (float)0.05)), p);
@ -112,7 +119,13 @@ namespace FModel
toDrawOn.FillRectangle(new SolidBrush(ControlPaint.Dark(myBaseColor, (float)0.1)), new Rectangle(0, 271, myBitmap.Width, myBitmap.Height));
//last folder
toDrawOn.DrawString(BundleInfos.getLastFolder(BundlePath), new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], 42), new SolidBrush(ControlPaint.Dark(myBaseColor, (float)0.05)), new Point(40, 40));
toDrawOn.DrawString(Utilities.CaseInsensitiveContains(BundleInfos.getLastFolder(BundlePath), "SEASON", StringComparison.CurrentCultureIgnoreCase) ?
SearchResource.getTextByKey("15EB9C4A494F597285CC5CA2EAA571E1", "SEASON") + " " + BundleInfos.getLastFolder(BundlePath).Substring(BundleInfos.getLastFolder(BundlePath).Length - 1) :
BundleInfos.getLastFolder(BundlePath),
new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], 42),
new SolidBrush(ControlPaint.Dark(myBaseColor, (float)0.05)),
new Point(40, 40)
);
//name
toDrawOn.DrawString(BundleInfos.getBundleDisplayName(myItem), new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], 115), new SolidBrush(Color.White), new Point(25, 70));
@ -192,32 +205,24 @@ namespace FModel
case "Turkish":
case "Chinese (S)":
case "Traditional Chinese":
foreach (JToken token in SearchResource.jo.FindTokens("AthenaChallengeDetailsEntry")) //no need to check if we need a new SearchResource.jo
all = SearchResource.getTextByKey("CompletionRewardFormat_All", "Complete ALL CHALLENGES to earn the reward item", "AthenaChallengeDetailsEntry");
any = SearchResource.getTextByKey("CompletionRewardFormat", "Complete ANY " + count + " CHALLENGES to earn the reward item", "AthenaChallengeDetailsEntry");
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(all);
if (doc.DocumentNode.InnerText.Contains(" {0}")) //avoid white space
{
LocResParser LocResParse = LocResParser.FromJson(token.ToString());
if (LocResParse.CompletionRewardFormatAll != null)
{
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(LocResParse.CompletionRewardFormatAll);
if (doc.DocumentNode.InnerText.Contains(" {0}")) //avoid white space
{
all = doc.DocumentNode.InnerText.Replace(" {0}", string.Empty);
}
else { all = doc.DocumentNode.InnerText.Replace("{0}", string.Empty); }
}
if (LocResParse.CompletionRewardFormat != null)
{
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(LocResParse.CompletionRewardFormat);
if (doc.DocumentNode.InnerText.Contains("{QuestNumber}")) //russian
{
any = doc.DocumentNode.InnerText.Replace("{QuestNumber}", count);
}
else { any = string.Format(doc.DocumentNode.InnerText, count); }
}
all = doc.DocumentNode.InnerText.Replace(" {0}", string.Empty);
}
else { all = doc.DocumentNode.InnerText.Replace("{0}", string.Empty); }
doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(any);
if (doc.DocumentNode.InnerText.Contains("{QuestNumber}")) //russian
{
any = doc.DocumentNode.InnerText.Replace("{QuestNumber}", count);
}
else { any = string.Format(doc.DocumentNode.InnerText, count); }
break;
default:
break;

View File

@ -78,6 +78,8 @@ namespace FModel
{
if (JohnWick.MyAsset.GetSerialized() != null)
{
new UpdateMyState("Parsing " + questFile + "...", "Waiting").ChangeProcessState();
QuestParser[] questParser = QuestParser.FromJson(JToken.Parse(JohnWick.MyAsset.GetSerialized()).ToString());
for (int x = 0; x < questParser.Length; x++)
{

View File

@ -1,6 +1,5 @@
using csharp_wick;
using FModel.Parser.Items;
using FModel.Parser.LocResParser;
using FModel.Properties;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@ -8,6 +7,7 @@ using System;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Collections.Generic;
namespace FModel
{
@ -24,19 +24,17 @@ namespace FModel
private static string HeroType { get; set; }
private static string DefenderType { get; set; }
private static string MinToMax { get; set; }
private static JObject wStatsjo { get; set; }
private static JObject cSetsjo { get; set; }
private static JObject weaponStats { get; set; }
public static void DrawTexts(ItemsIdParser theItem, Graphics myGraphic, string mode)
{
bool isSTW = (mode.Equals("stwHeroes") || mode.Equals("stwDefenders"));
using (myGraphic)
{
SetTexts(theItem, isSTW);
SetTexts(theItem);
DrawDisplayName(theItem, myGraphic, isSTW);
DrawDescription(theItem, myGraphic, isSTW);
DrawDisplayName(theItem, myGraphic);
DrawDescription(theItem, myGraphic);
switch (mode)
{
@ -72,7 +70,14 @@ namespace FModel
if (theItem.AmmoData != null && theItem.AmmoData.AssetPathName.Contains("Ammo")) //TO AVOID TRIGGERING CONSUMABLES, NAME SHOULD CONTAIN "AMMO"
{
ItemIcon.GetAmmoData(theItem.AmmoData.AssetPathName, myGraphic);
DrawWeaponStat(WeaponRowName, myGraphic);
try
{
DrawWeaponStat(WeaponRowName, myGraphic);
}
catch (Exception)
{
//stw weapons
}
}
DrawCosmeticUff(theItem, myGraphic);
@ -83,7 +88,7 @@ namespace FModel
/// todo: find a better way to handle errors
/// </summary>
/// <param name="theItem"></param>
private static void SetTexts(ItemsIdParser theItem, bool isSTW = false)
private static void SetTexts(ItemsIdParser theItem)
{
CosmeticSource = "";
CosmeticSet = "";
@ -115,7 +120,7 @@ namespace FModel
case "Turkish":
case "Chinese (S)":
case "Traditional Chinese":
ShortDescription = theItem.ShortDescription != null ? SearchResource.getTextByKey(theItem.ShortDescription.Key, theItem.ShortDescription.SourceString, isSTW) : "";
ShortDescription = theItem.ShortDescription != null ? SearchResource.getTextByKey(theItem.ShortDescription.Key, theItem.ShortDescription.SourceString) : "";
break;
default:
ShortDescription = theItem.ShortDescription != null ? theItem.ShortDescription.SourceString : "";
@ -250,13 +255,13 @@ namespace FModel
/// </summary>
/// <param name="theItem"></param>
/// <param name="myGraphic"></param>
private static void DrawDisplayName(ItemsIdParser theItem, Graphics myGraphic, bool isSTW = false)
private static void DrawDisplayName(ItemsIdParser theItem, Graphics myGraphic)
{
if (theItem.DisplayName != null)
{
//myGraphic.DrawRectangle(new Pen(new SolidBrush(Color.Red)), new Rectangle(5, 405, 512, 55));
string text = SearchResource.getTextByKey(theItem.DisplayName.Key, theItem.DisplayName.SourceString, isSTW);
string text = SearchResource.getTextByKey(theItem.DisplayName.Key, theItem.DisplayName.SourceString);
Font goodFont = FontUtilities.FindFont(
myGraphic,
@ -280,13 +285,13 @@ namespace FModel
/// </summary>
/// <param name="theItem"></param>
/// <param name="myGraphic"></param>
private static void DrawDescription(ItemsIdParser theItem, Graphics myGraphic, bool isSTW = false)
private static void DrawDescription(ItemsIdParser theItem, Graphics myGraphic)
{
if (theItem.Description != null)
{
//myGraphic.DrawRectangle(new Pen(new SolidBrush(Color.Pink)), new Rectangle(5, 455, 512, 42));
string text = SearchResource.getTextByKey(theItem.Description.Key, theItem.Description.SourceString, isSTW);
string text = SearchResource.getTextByKey(theItem.Description.Key, theItem.Description.SourceString);
if (!string.IsNullOrEmpty(CosmeticSet))
{
string theSet = DrawCosmeticSet(CosmeticSet);
@ -341,7 +346,7 @@ namespace FModel
}
private static string searchSetName(string setName)
{
string toReturn = "";
string toReturn = string.Empty;
JToken setToken = cSetsjo.FindTokens(setName).FirstOrDefault();
Parser.CosmeticSetsParser.CosmeticSetsParser cSetsParsed = Parser.CosmeticSetsParser.CosmeticSetsParser.FromJson(setToken.ToString());
@ -362,17 +367,9 @@ namespace FModel
case "Turkish":
case "Chinese (S)":
case "Traditional Chinese":
JToken setNameTokenLocalized = SearchResource.jo.FindTokens("CosmeticSets").FirstOrDefault();
string parsedJson = JToken.Parse(setNameTokenLocalized.ToString()).ToString().TrimStart('[').TrimEnd(']');
JToken setNameToken = JObject.Parse(parsedJson).FindTokens(cSetsParsed.DisplayName.Key).FirstOrDefault();
string translatedName = setNameToken == null ? cSetsParsed.DisplayName.SourceString : setNameToken.ToString();
string translatedName = SearchResource.getTextByKey(cSetsParsed.DisplayName.Key, cSetsParsed.DisplayName.SourceString, cSetsParsed.DisplayName.Namespace);
JToken setDescriptionToken = SearchResource.jo.FindTokens("Fort.Cosmetics").FirstOrDefault();
LocResParser dTokenParsed = LocResParser.FromJson(setDescriptionToken.ToString());
if (dTokenParsed.CosmeticItemDescriptionSetMembershipNotRich != null)
{
toReturn = string.Format(dTokenParsed.CosmeticItemDescriptionSetMembershipNotRich, translatedName);
}
toReturn = string.Format(SearchResource.getTextByKey("CosmeticItemDescription_SetMembership_NotRich", cSetsParsed.DisplayName.SourceString, "Fort.Cosmetics"), translatedName);
break;
default:
toReturn = string.Format("\nPart of the {0} set.", cSetsParsed.DisplayName.SourceString);
@ -433,7 +430,7 @@ namespace FModel
/// <param name="myGraphic"></param>
private static void DrawWeaponStat(string weaponName, Graphics myGraphic)
{
if (wStatsjo == null)
if (weaponStats == null)
{
ItemIcon.ItemIconPath = string.Empty;
string extractedWeaponsStatPath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary["AthenaRangedWeapons"], "AthenaRangedWeapons");
@ -446,8 +443,7 @@ namespace FModel
{
if (JohnWick.MyAsset.GetSerialized() != null)
{
string parsedJson = JToken.Parse(JohnWick.MyAsset.GetSerialized()).ToString().TrimStart('[').TrimEnd(']');
wStatsjo = JObject.Parse(parsedJson);
weaponStats = JObject.Parse(JohnWick.MyAsset.GetSerialized().ToString().TrimStart('[').TrimEnd(']'));
loopingLol(weaponName, myGraphic);
}
}
@ -462,24 +458,24 @@ namespace FModel
}
private static void loopingLol(string weaponName, Graphics myGraphic)
{
foreach (JToken token in wStatsjo.FindTokens(weaponName))
{
Parser.Weapons.WeaponStatParser statParsed = Parser.Weapons.WeaponStatParser.FromJson(token.ToString());
IEnumerable<JProperty> myStats = weaponStats.Value<JObject>(weaponName).Properties();
Image bulletImage = Resources.dmg64;
myGraphic.DrawImage(ImageUtilities.ResizeImage(bulletImage, 15, 15), new Point(5, 502));
DrawToLeft(" " + statParsed.DmgPb, myGraphic); //damage per bullet
string damagePerBullet = myStats.Where(x => x.Name == "DmgPB").Select(x => x.Value).FirstOrDefault().ToString();
Image bulletImage = Resources.dmg64;
myGraphic.DrawImage(ImageUtilities.ResizeImage(bulletImage, 15, 15), new Point(5, 502));
DrawToLeft(" " + damagePerBullet, myGraphic); //damage per bullet
Image clipSizeImage = Resources.clipSize64;
myGraphic.DrawImage(ImageUtilities.ResizeImage(clipSizeImage, 15, 15), new Point(52, 502));
myGraphic.DrawString(" " + statParsed.ClipSize, new Font(FontUtilities.pfc.Families[0], 11), new SolidBrush(Color.White), new Point(50, 503));
string clipSize = myStats.Where(x => x.Name == "ClipSize").Select(x => x.Value).FirstOrDefault().ToString();
Image clipSizeImage = Resources.clipSize64;
myGraphic.DrawImage(ImageUtilities.ResizeImage(clipSizeImage, 15, 15), new Point(52, 502));
myGraphic.DrawString(" " + clipSize, new Font(FontUtilities.pfc.Families[0], 11), new SolidBrush(Color.White), new Point(50, 503));
Image reload = Resources.reload64;
myGraphic.DrawImage(ImageUtilities.ResizeImage(reload, 15, 15), new Point(50 + (statParsed.ClipSize.ToString().Length * 7) + 47, 502)); //50=clipsize text position | for each clipsize letter we add 7 to x | 47=difference between 2 icons
myGraphic.DrawString(statParsed.ReloadTime + " " + SearchResource.getTextByKey("6BA53D764BA5CC13E821D2A807A72365", "seconds"), new Font(FontUtilities.pfc.Families[0], 11), new SolidBrush(Color.White), new Point(64 + (statParsed.ClipSize.ToString().Length * 7) + 47, 503)); //64=50+icon size (-1 because that wasn't perfectly at the position i wanted)
string reloadTime = myStats.Where(x => x.Name == "ReloadTime").Select(x => x.Value).FirstOrDefault().ToString();
Image reload = Resources.reload64;
myGraphic.DrawImage(ImageUtilities.ResizeImage(reload, 15, 15), new Point(50 + (clipSize.Length * 7) + 47, 502)); //50=clipsize text position | for each clipsize letter we add 7 to x | 47=difference between 2 icons
myGraphic.DrawString(reloadTime + " " + SearchResource.getTextByKey("6BA53D764BA5CC13E821D2A807A72365", "seconds"), new Font(FontUtilities.pfc.Families[0], 11), new SolidBrush(Color.White), new Point(64 + (clipSize.Length * 7) + 47, 503)); //64=50+icon size (-1 because that wasn't perfectly at the position i wanted)
DrawToRight(weaponName, myGraphic);
}
DrawToRight(weaponName, myGraphic);
}
/// <summary>

View File

@ -4,68 +4,51 @@ namespace FModel
{
static class LoadLocRes
{
public static string myLocRes { get; set; }
public static string myLocResSTW { get; set; }
public static void LoadMySelectedLocRes(string selectedLanguage)
{
switch (selectedLanguage)
{
case "French":
myLocRes = getMyLocRes("fr");
myLocResSTW = getMyLocRes("fr", true);
getMyLocRes("fr");
break;
case "German":
myLocRes = getMyLocRes("de");
myLocResSTW = getMyLocRes("de", true);
getMyLocRes("de");
break;
case "Italian":
myLocRes = getMyLocRes("it");
myLocResSTW = getMyLocRes("it", true);
getMyLocRes("it");
break;
case "Spanish":
myLocRes = getMyLocRes("es");
myLocResSTW = getMyLocRes("es", true);
getMyLocRes("es");
break;
case "Spanish (LA)":
myLocRes = getMyLocRes("es-419");
myLocResSTW = getMyLocRes("es-419", true);
getMyLocRes("es-419");
break;
case "Arabic":
myLocRes = getMyLocRes("ar");
myLocResSTW = getMyLocRes("ar", true);
getMyLocRes("ar");
break;
case "Japanese":
myLocRes = getMyLocRes("ja");
myLocResSTW = getMyLocRes("ja", true);
getMyLocRes("ja");
break;
case "Korean":
myLocRes = getMyLocRes("ko");
myLocResSTW = getMyLocRes("ko", true);
getMyLocRes("ko");
break;
case "Polish":
myLocRes = getMyLocRes("pl");
myLocResSTW = getMyLocRes("pl", true);
getMyLocRes("pl");
break;
case "Portuguese (Brazil)":
myLocRes = getMyLocRes("pt-BR");
myLocResSTW = getMyLocRes("pt-BR", true);
getMyLocRes("pt-BR");
break;
case "Russian":
myLocRes = getMyLocRes("ru");
myLocResSTW = getMyLocRes("ru", true);
getMyLocRes("ru");
break;
case "Turkish":
myLocRes = getMyLocRes("tr");
myLocResSTW = getMyLocRes("tr", true);
getMyLocRes("tr");
break;
case "Chinese (S)":
myLocRes = getMyLocRes("zh-CN");
myLocResSTW = getMyLocRes("zh-CN", true);
getMyLocRes("zh-CN");
break;
case "Traditional Chinese":
myLocRes = getMyLocRes("zh-Hant");
myLocResSTW = getMyLocRes("zh-Hant", true);
getMyLocRes("zh-Hant");
break;
default:
break;
@ -77,28 +60,40 @@ namespace FModel
/// </summary>
/// <param name="selectedLanguage"></param>
/// <returns></returns>
private static string getMyLocRes(string selectedLanguage, bool isSTW = false)
private static void getMyLocRes(string selectedLanguage)
{
if (ThePak.AllpaksDictionary != null)
{
if (ThePak.AllpaksDictionary.ContainsKey(isSTW ? "Game_StW.locres" : "Game_BR.locres"))
if (ThePak.AllpaksDictionary.ContainsKey("Game_BR.locres"))
{
string locResPath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[isSTW ? "Game_StW.locres" : "Game_BR.locres"], isSTW ? "Game_StW.locres" : "Game_BR.locres");
string locResPath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary["Game_BR.locres"], "Game_BR.locres");
return LocResSerializer.StringFinder(locResPath.Replace("zh-Hant", selectedLanguage));
LocResSerializer.setLocRes(locResPath.Replace("zh-Hant", selectedLanguage));
}
else
{
new UpdateMyConsole("[FModel] "+ (isSTW ? "STW" : "BR") +" Localization File Not Found - Icon Language set to English", Color.DarkRed, true).AppendToConsole();
new UpdateMyConsole("[FModel] BR Localization File Not Found - Icon Language set to English", Color.DarkRed, true).AppendToConsole();
new UpdateMyConsole("", Color.Black, true).AppendToConsole();
Properties.Settings.Default.IconLanguage = "English";
Properties.Settings.Default.Save();
}
return "";
if (ThePak.AllpaksDictionary.ContainsKey("Game_StW.locres"))
{
string locResPath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary["Game_StW.locres"], "Game_StW.locres");
LocResSerializer.setLocRes(locResPath.Replace("zh-Hant", selectedLanguage), true);
}
else
{
new UpdateMyConsole("[FModel] STW Localization File Not Found - Icon Language set to English", Color.DarkRed, true).AppendToConsole();
new UpdateMyConsole("", Color.Black, true).AppendToConsole();
Properties.Settings.Default.IconLanguage = "English";
Properties.Settings.Default.Save();
}
}
else { return ""; }
}
}
}

View File

@ -1,65 +1,42 @@
using Newtonsoft.Json.Linq;
using FModel.Parser.LocResParser;
using System.Collections.Generic;
namespace FModel
{
static class SearchResource
{
private static string parsedJsonToCheck { get; set; }
private static string parsedSTWJsonToCheck { get; set; }
public static JObject jo { get; set; }
private static string oldLanguage = Properties.Settings.Default.IconLanguage;
private static bool isSTWCheck { get; set; }
/// <summary>
/// for most (if not all) of our translations there's no namespace so we just have to find the key in the string
/// once found, we only take the part between this key and we parse to get out LocResText
/// To improve speed, we check if the language has change or if JObject has never been loaded
/// because idk, i made my serializer in a weird way
/// if a namespace is empty the key become the namespace and the new key is "LocResText"
/// i could change the serializer but it's gonna break a lot of things and i don't wanna take time to fix them
/// </summary>
/// <param name="theNamespace"></param>
/// <param name="theKey"></param>
/// <returns></returns>
public static string getTranslatedText(string theKey, bool isSTW)
public static string getTranslatedText(string theNamespace, string theKey)
{
string toReturn = string.Empty;
string newLanguage = Properties.Settings.Default.IconLanguage;
if (isSTW)
try
{
if (parsedSTWJsonToCheck == null || newLanguage != oldLanguage || isSTWCheck != isSTW)
if (!string.Equals(theNamespace, "LocResText"))
{
parsedSTWJsonToCheck = JToken.Parse(LoadLocRes.myLocResSTW).ToString().TrimStart('[').TrimEnd(']');
jo = JObject.Parse(parsedSTWJsonToCheck);
return LocResSerializer.LocResDict[theNamespace][theKey];
}
else
{
return LocResSerializer.LocResDict[theKey][theNamespace];
}
}
else
catch (KeyNotFoundException)
{
if (parsedJsonToCheck == null || newLanguage != oldLanguage || isSTWCheck != isSTW)
{
parsedJsonToCheck = JToken.Parse(LoadLocRes.myLocRes).ToString().TrimStart('[').TrimEnd(']');
jo = JObject.Parse(parsedJsonToCheck);
}
return string.Empty;
}
foreach (JToken token in jo.FindTokens(theKey))
{
LocResParser LocResParse = LocResParser.FromJson(token.ToString());
if (LocResParse.LocResText != null)
{
toReturn = LocResParse.LocResText;
}
}
isSTWCheck = isSTW;
oldLanguage = newLanguage;
return toReturn;
}
public static string getTextByKey(string key, string defaultText, bool isSTW = false)
public static string getTextByKey(string key, string defaultText, string namespac = null)
{
string text = defaultText;
if (LoadLocRes.myLocRes != null && Properties.Settings.Default.IconLanguage != "English")
if (LocResSerializer.LocResDict != null && Properties.Settings.Default.IconLanguage != "English")
{
text = getTranslatedText(key, isSTW);
text = getTranslatedText(namespac == null ? "LocResText" : namespac, key);
if (string.IsNullOrEmpty(text))
text = defaultText;
}

View File

@ -36,10 +36,11 @@ namespace FModel
{
_extractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + ThePak.mainPaksList[i].thePak, Settings.Default.AESKey);
}
else { break; }
else { if (_extractor != null) { _extractor.Dispose(); } break; }
}
catch (Exception)
{
if (_extractor != null) { _extractor.Dispose(); }
break;
}
@ -67,6 +68,7 @@ namespace FModel
catch (Exception)
{
new UpdateMyConsole("0x" + pakKey + " doesn't work with " + ThePak.dynamicPaksList[i].thePak, Color.Red, true).AppendToConsole();
if (_extractor != null) { _extractor.Dispose(); }
continue;
}

View File

@ -1,5 +1,6 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -14,42 +15,42 @@ namespace FModel
* */
static class LocResSerializer
{
private static byte[] LocResMagic = { 0x0E, 0x14, 0x74, 0x75, 0x67, 0x4A, 0x03, 0xFC, 0x4A, 0x15, 0x90, 0x9D, 0xC3, 0x37, 0x7F, 0x1B };
private static long LocalizedStringArrayOffset { get; set; }
private static string[] LocalizedStringArray { get; set; }
private static string NamespacesString { get; set; }
private static string myKey { get; set; }
private static Dictionary<string, Dictionary<string, string>> LocResDict { get; set; }
private static byte[] _locResMagic = { 0x0E, 0x14, 0x74, 0x75, 0x67, 0x4A, 0x03, 0xFC, 0x4A, 0x15, 0x90, 0x9D, 0xC3, 0x37, 0x7F, 0x1B };
private static long _localizedStringArrayOffset { get; set; }
private static string[] _localizedStringArray { get; set; }
private static string _namespacesString { get; set; }
private static string _myKey { get; set; }
public static Dictionary<string, Dictionary<string, string>> LocResDict { get; set; }
public static string StringFinder(string filepath)
public static void setLocRes(string filepath, bool addToCurrent = false)
{
LocResDict = new Dictionary<string, Dictionary<string, string>>();
myKey = "LocResText";
NamespacesString = "";
LocalizedStringArrayOffset = -1;
if (!addToCurrent) { LocResDict = new Dictionary<string, Dictionary<string, string>>(); }
_myKey = "LocResText";
_namespacesString = "";
_localizedStringArrayOffset = -1;
using (BinaryReader reader = new BinaryReader(File.Open(filepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.GetEncoding(1252)))
{
byte[] MagicNumber = reader.ReadBytes(16);
if (MagicNumber.SequenceEqual(LocResMagic))
if (MagicNumber.SequenceEqual(_locResMagic))
{
byte VersionNumber = reader.ReadByte();
if (VersionNumber == 2) //optimized
{
LocalizedStringArrayOffset = reader.ReadInt64();
if (LocalizedStringArrayOffset != -1)
_localizedStringArrayOffset = reader.ReadInt64();
if (_localizedStringArrayOffset != -1)
{
long CurrentFileOffset = reader.BaseStream.Position;
reader.BaseStream.Seek(LocalizedStringArrayOffset, SeekOrigin.Begin);
reader.BaseStream.Seek(_localizedStringArrayOffset, SeekOrigin.Begin);
int arrayLength = reader.ReadInt32();
reader.BaseStream.Seek(LocalizedStringArrayOffset, SeekOrigin.Begin);
reader.BaseStream.Seek(_localizedStringArrayOffset, SeekOrigin.Begin);
LocalizedStringArray = new string[arrayLength];
for (int i = 0; i < LocalizedStringArray.Length; i++)
_localizedStringArray = new string[arrayLength];
for (int i = 0; i < _localizedStringArray.Length; i++)
{
LocalizedStringArray[i] = AssetReader.readCleanString(reader);
_localizedStringArray[i] = AssetReader.readCleanString(reader);
}
reader.BaseStream.Seek(CurrentFileOffset, SeekOrigin.Begin);
@ -68,37 +69,35 @@ namespace FModel
}
else { throw new ArgumentException("Wrong LocResMagic number."); }
}
return JsonConvert.SerializeObject(LocResDict, Formatting.Indented);
}
private static void readNamespaces(BinaryReader br)
{
if (br.BaseStream.Position > LocalizedStringArrayOffset) { return; }
if (br.BaseStream.Position > _localizedStringArrayOffset) { return; }
int stringLength = br.ReadInt32();
if (stringLength > 0)
{
NamespacesString = Encoding.GetEncoding(1252).GetString(br.ReadBytes(stringLength)).TrimEnd('\0');
_namespacesString = Encoding.GetEncoding(1252).GetString(br.ReadBytes(stringLength)).TrimEnd('\0');
}
else if (stringLength == 0)
{
NamespacesString = "";
_namespacesString = "";
}
else
{
byte[] data = br.ReadBytes((-1 - stringLength) * 2);
br.ReadBytes(2);
NamespacesString = Encoding.Unicode.GetString(data);
_namespacesString = Encoding.Unicode.GetString(data);
}
br.ReadInt32();
int stringIndex = br.ReadInt32();
if (stringIndex > LocalizedStringArray.Length || stringIndex < 0)
if (stringIndex > _localizedStringArray.Length || stringIndex < 0)
{
if (!LocResDict.ContainsKey(NamespacesString))
if (!LocResDict.ContainsKey(_namespacesString))
{
LocResDict[NamespacesString] = new Dictionary<string, string>();
LocResDict[_namespacesString] = new Dictionary<string, string>();
}
long newOffset = br.BaseStream.Position - 8;
@ -107,20 +106,20 @@ namespace FModel
int KeyCount = br.ReadInt32();
for (int i = 0; i < KeyCount; i++)
{
myKey = AssetReader.readCleanString(br);
_myKey = AssetReader.readCleanString(br);
br.ReadInt32();
stringIndex = br.ReadInt32();
LocResDict[NamespacesString][myKey] = LocalizedStringArray[stringIndex];
LocResDict[_namespacesString][_myKey] = _localizedStringArray[stringIndex];
}
}
else
{
if (!LocResDict.ContainsKey(NamespacesString))
if (!LocResDict.ContainsKey(_namespacesString))
{
LocResDict[NamespacesString] = new Dictionary<string, string>();
LocResDict[NamespacesString][myKey] = LocalizedStringArray[stringIndex];
LocResDict[_namespacesString] = new Dictionary<string, string>();
LocResDict[_namespacesString][_myKey] = _localizedStringArray[stringIndex];
}
}
}

View File

@ -29,6 +29,9 @@ namespace FModel.Parser.CosmeticSetsParser
public partial class Description
{
[JsonProperty("namespace")]
public string Namespace { get; set; }
[JsonProperty("key")]
public string Key { get; set; }

View File

@ -69,6 +69,9 @@ namespace FModel.Parser.Items
public partial class FTextInfos
{
[JsonProperty("namespace")]
public string Namespace { get; set; }
[JsonProperty("key")]
public string Key { get; set; }

View File

@ -1,55 +0,0 @@
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using FModel.Parser.LocResParser;
//
// var locResParser = LocResParser.FromJson(jsonString);
namespace FModel.Parser.LocResParser
{
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class LocResParser
{
[JsonProperty("LocResText")]
public string LocResText { get; set; }
[JsonProperty("WorkerSetBonusTraitPattern")]
public string WorkerSetBonusTraitPattern { get; set; }
[JsonProperty("CompletionRewardFormat_All")]
public string CompletionRewardFormatAll { get; set; }
[JsonProperty("CompletionRewardFormat")]
public string CompletionRewardFormat { get; set; }
[JsonProperty("CosmeticItemDescription_SetMembership_NotRich")]
public string CosmeticItemDescriptionSetMembershipNotRich { get; set; }
}
public partial class LocResParser
{
public static LocResParser FromJson(string json) => JsonConvert.DeserializeObject<LocResParser>(json, Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this LocResParser self) => JsonConvert.SerializeObject(self, Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
{
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
}
}

View File

@ -47,66 +47,6 @@ namespace FModel.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool createIconForCosmetics {
get {
return ((bool)(this["createIconForCosmetics"]));
}
set {
this["createIconForCosmetics"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool createIconForVariants {
get {
return ((bool)(this["createIconForVariants"]));
}
set {
this["createIconForVariants"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool createIconForConsumablesWeapons {
get {
return ((bool)(this["createIconForConsumablesWeapons"]));
}
set {
this["createIconForConsumablesWeapons"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool createIconForTraps {
get {
return ((bool)(this["createIconForTraps"]));
}
set {
this["createIconForTraps"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool createIconForChallenges {
get {
return ((bool)(this["createIconForChallenges"]));
}
set {
this["createIconForChallenges"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
@ -431,54 +371,6 @@ namespace FModel.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool createIconForAmmo {
get {
return ((bool)(this["createIconForAmmo"]));
}
set {
this["createIconForAmmo"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool createIconForSTWDefenders {
get {
return ((bool)(this["createIconForSTWDefenders"]));
}
set {
this["createIconForSTWDefenders"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool createIconForSTWHeroes {
get {
return ((bool)(this["createIconForSTWHeroes"]));
}
set {
this["createIconForSTWHeroes"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool createIconForSTWCardPacks {
get {
return ((bool)(this["createIconForSTWCardPacks"]));
}
set {
this["createIconForSTWCardPacks"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("English")]
@ -515,18 +407,6 @@ namespace FModel.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool createIconForCreativeGalleries {
get {
return ((bool)(this["createIconForCreativeGalleries"]));
}
set {
this["createIconForCreativeGalleries"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]

View File

@ -8,21 +8,6 @@
<Setting Name="ExtractOutput" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="createIconForCosmetics" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="createIconForVariants" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="createIconForConsumablesWeapons" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="createIconForTraps" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="createIconForChallenges" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="loadFeaturedImage" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
@ -104,18 +89,6 @@
<Setting Name="UpdateSettings" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="createIconForAmmo" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="createIconForSTWDefenders" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="createIconForSTWHeroes" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="createIconForSTWCardPacks" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="IconLanguage" Type="System.String" Scope="User">
<Value Profile="(Default)">English</Value>
</Setting>
@ -125,9 +98,6 @@
<Setting Name="challengesWatermark" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="createIconForCreativeGalleries" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="tryToOpenAssets" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autoupdater.NET.Official" version="1.5.3" targetFramework="net471" />
<package id="HtmlAgilityPack" version="1.11.9" targetFramework="net471" />
<package id="Autoupdater.NET.Official" version="1.5.4" targetFramework="net471" />
<package id="HtmlAgilityPack" version="1.11.10" targetFramework="net471" />
<package id="jacobslusser.ScintillaNET" version="3.6.3" targetFramework="net471" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net471" />
<package id="RestSharp" version="106.6.10" targetFramework="net471" />