mirror of
https://github.com/4sval/FModel.git
synced 2026-03-30 21:55:42 -05:00
rarity refactor
This commit is contained in:
parent
84e74b1e75
commit
e9d7ebae63
|
|
@ -12,6 +12,8 @@
|
|||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
|
|
@ -87,7 +89,7 @@
|
|||
<HintPath>DLLs\csharp-wick.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ScintillaNET FindReplaceDialog, Version=1.4.0.17540, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ namespace FModel
|
|||
#region EVERYTHING WE NEED
|
||||
FindReplace _myFindReplace;
|
||||
public Stopwatch StopWatch;
|
||||
public PakAsset MyAsset;
|
||||
public PakExtractor MyExtractor;
|
||||
public static PakAsset MyAsset;
|
||||
public static PakExtractor MyExtractor;
|
||||
private static string[] _paksArray;
|
||||
public static string[] pakAsTxt;
|
||||
public static Dictionary<string, string> AllpaksDictionary;
|
||||
|
|
@ -1273,21 +1273,22 @@ namespace FModel
|
|||
|
||||
#region EXTRACT BUTTON
|
||||
//METHODS
|
||||
private string ExtractAsset(string currentPak, string currentItem)
|
||||
public static string ExtractAsset(string currentPak, string currentItem)
|
||||
{
|
||||
string toReturn = string.Empty;
|
||||
|
||||
MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + currentPak, Settings.Default.AESKey);
|
||||
string[] myArray = MyExtractor.GetFileList().ToArray();
|
||||
|
||||
string[] results = null;
|
||||
if (currentItem.Contains("."))
|
||||
results = Array.FindAll(MyExtractor.GetFileList().ToArray(), s => s.Contains("/" + currentItem));
|
||||
results = Array.FindAll(myArray, s => s.Contains("/" + currentItem));
|
||||
else
|
||||
results = Array.FindAll(MyExtractor.GetFileList().ToArray(), s => s.Contains("/" + currentItem + "."));
|
||||
results = Array.FindAll(myArray, s => s.Contains("/" + currentItem + "."));
|
||||
|
||||
for (int i = 0; i < results.Length; i++)
|
||||
{
|
||||
int index = Array.IndexOf(MyExtractor.GetFileList().ToArray(), results[i]);
|
||||
int index = Array.IndexOf(myArray, results[i]);
|
||||
|
||||
uint y = (uint)index;
|
||||
byte[] b = MyExtractor.GetData(y);
|
||||
|
|
@ -1296,12 +1297,14 @@ namespace FModel
|
|||
{
|
||||
Directory.CreateDirectory(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[CurrentUsedPak] + results[i].Substring(0, results[i].LastIndexOf("/")));
|
||||
File.WriteAllBytes(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[CurrentUsedPak] + results[i], b);
|
||||
|
||||
toReturn = DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[CurrentUsedPak] + results[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[AllpaksDictionary[currentItem]] + results[i].Substring(0, results[i].LastIndexOf("/")));
|
||||
File.WriteAllBytes(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[AllpaksDictionary[currentItem]] + results[i], b);
|
||||
|
||||
toReturn = DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[AllpaksDictionary[currentItem]] + results[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -1365,7 +1368,7 @@ namespace FModel
|
|||
JsonParseFile();
|
||||
}
|
||||
if (ExtractedFilePath.Contains(".ufont"))
|
||||
ConvertToOtf(ExtractedFilePath);
|
||||
ConvertToTtf(ExtractedFilePath);
|
||||
if (ExtractedFilePath.Contains(".ini"))
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
|
|
@ -1451,14 +1454,7 @@ namespace FModel
|
|||
Graphics g = Graphics.FromImage(bmp);
|
||||
g.TextRenderingHint = TextRenderingHint.AntiAlias;
|
||||
|
||||
if (theItem.Series != null)
|
||||
Rarity.GetSeriesRarity(theItem, g);
|
||||
else
|
||||
// Special ammo force-rarity check
|
||||
if (SpecialMode == "ammo")
|
||||
Rarity.GetItemRarity(theItem, g, "ammo");
|
||||
else
|
||||
Rarity.GetItemRarity(theItem, g);
|
||||
Rarity.DrawRarity(theItem, g, SpecialMode);
|
||||
|
||||
ItemIconPath = string.Empty;
|
||||
if (Settings.Default.loadFeaturedImage == false)
|
||||
|
|
@ -3672,9 +3668,9 @@ namespace FModel
|
|||
OpenWithDefaultProgramAndNoFocus(UnrealEngineDataToOgg.ConvertToOgg(soundPathToConvert));
|
||||
UpdateConsole("Opening " + CurrentUsedItem + ".ogg", Color.FromArgb(255, 66, 244, 66), "Success");
|
||||
}
|
||||
private void ConvertToOtf(string file)
|
||||
private void ConvertToTtf(string file)
|
||||
{
|
||||
File.Move(file, Path.ChangeExtension(file, ".otf") ?? throw new InvalidOperationException());
|
||||
File.Move(file, Path.ChangeExtension(file, ".ttf") ?? throw new InvalidOperationException());
|
||||
UpdateConsole(CurrentUsedItem + " successfully converter to a font", Color.FromArgb(255, 66, 244, 66), "Success");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,52 +6,60 @@ namespace FModel
|
|||
{
|
||||
class Rarity
|
||||
{
|
||||
public static void GetItemRarity(ItemsIdParser theItem, Graphics toDrawOn, string SpecialMode = null)
|
||||
public static Image GetRarityImage(ItemsIdParser theItem)
|
||||
{
|
||||
if (theItem.Rarity == "EFortRarity::Transcendent")
|
||||
switch (theItem.Rarity)
|
||||
{
|
||||
Image rarityBg = Resources.T512;
|
||||
toDrawOn.DrawImage(rarityBg, new Point(0, 0));
|
||||
}
|
||||
else if (theItem.Rarity == "EFortRarity::Mythic")
|
||||
{
|
||||
Image rarityBg = Resources.M512;
|
||||
toDrawOn.DrawImage(rarityBg, new Point(0, 0));
|
||||
}
|
||||
else if (theItem.Rarity == "EFortRarity::Legendary")
|
||||
{
|
||||
Image rarityBg = Resources.L512;
|
||||
toDrawOn.DrawImage(rarityBg, new Point(0, 0));
|
||||
}
|
||||
else if (theItem.Rarity == "EFortRarity::Epic" || theItem.Rarity == "EFortRarity::Quality")
|
||||
{
|
||||
Image rarityBg = Resources.E512;
|
||||
toDrawOn.DrawImage(rarityBg, new Point(0, 0));
|
||||
}
|
||||
else if (theItem.Rarity == "EFortRarity::Rare")
|
||||
{
|
||||
Image rarityBg = Resources.R512;
|
||||
toDrawOn.DrawImage(rarityBg, new Point(0, 0));
|
||||
}
|
||||
else if (theItem.Rarity == "EFortRarity::Common" || SpecialMode == "ammo") // Force common rarity if ammo, as ammo is always common in FN
|
||||
{
|
||||
Image rarityBg = Resources.C512;
|
||||
toDrawOn.DrawImage(rarityBg, new Point(0, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
Image rarityBg = Resources.U512;
|
||||
toDrawOn.DrawImage(rarityBg, new Point(0, 0));
|
||||
case "EFortRarity::Transcendent":
|
||||
return Resources.T512;
|
||||
case "EFortRarity::Mythic":
|
||||
return Resources.M512;
|
||||
case "EFortRarity::Legendary":
|
||||
return Resources.L512;
|
||||
case "EFortRarity::Epic":
|
||||
return Resources.E512;
|
||||
case "EFortRarity::Quality":
|
||||
return Resources.E512;
|
||||
case "EFortRarity::Rare":
|
||||
return Resources.R512;
|
||||
case "EFortRarity::Common":
|
||||
return Resources.C512;
|
||||
default:
|
||||
return Resources.U512;
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetSeriesRarity(ItemsIdParser theItem, Graphics toDrawOn)
|
||||
public static Image GetSeriesImage(ItemsIdParser theItem)
|
||||
{
|
||||
if (theItem.Series == "MarvelSeries")
|
||||
switch (theItem.Series)
|
||||
{
|
||||
Image rarityBg = Resources.Marvel512;
|
||||
toDrawOn.DrawImage(rarityBg, new Point(0, 0));
|
||||
case "MarvelSeries":
|
||||
return Resources.Marvel512;
|
||||
default:
|
||||
return GetRarityImage(theItem);
|
||||
}
|
||||
}
|
||||
public static Image GetSpecialModeImage(ItemsIdParser theItem, string SpecialMode)
|
||||
{
|
||||
switch (SpecialMode)
|
||||
{
|
||||
case "ammo":
|
||||
return Resources.C512;
|
||||
default:
|
||||
return GetRarityImage(theItem);
|
||||
}
|
||||
}
|
||||
public static void DrawRarity(ItemsIdParser theItem, Graphics toDrawOn, string SpecialMode = null)
|
||||
{
|
||||
Image rarityBg;
|
||||
|
||||
if (theItem.Series != null)
|
||||
rarityBg = GetSeriesImage(theItem);
|
||||
else if (SpecialMode != null)
|
||||
rarityBg = GetSpecialModeImage(theItem, SpecialMode);
|
||||
else
|
||||
rarityBg = GetRarityImage(theItem);
|
||||
|
||||
toDrawOn.DrawImage(rarityBg, new Point(0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 72 KiB |
|
|
@ -2,5 +2,5 @@
|
|||
<packages>
|
||||
<package id="Autoupdater.NET.Official" version="1.5.1" targetFramework="net471" />
|
||||
<package id="jacobslusser.ScintillaNET" version="3.6.3" targetFramework="net471" />
|
||||
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net471" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net471" />
|
||||
</packages>
|
||||
Loading…
Reference in New Issue
Block a user