mirror of
https://github.com/4sval/FModel.git
synced 2026-03-22 01:34:37 -05:00
added stw schematics icon
This commit is contained in:
parent
0bf8c63ba0
commit
e9f34dfca9
|
|
@ -28,60 +28,57 @@ namespace FModel
|
|||
|
||||
public static void DrawTexts(JToken theItem, Graphics myGraphic, string mode)
|
||||
{
|
||||
using (myGraphic)
|
||||
SetTexts(theItem);
|
||||
|
||||
DrawDisplayName(theItem, myGraphic);
|
||||
DrawDescription(theItem, myGraphic);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
SetTexts(theItem);
|
||||
|
||||
DrawDisplayName(theItem, myGraphic);
|
||||
DrawDescription(theItem, myGraphic);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case "athIteDef":
|
||||
DrawToLeft(ShortDescription, myGraphic);
|
||||
DrawToRight(CosmeticSource, myGraphic);
|
||||
break;
|
||||
case "consAndWeap":
|
||||
DrawToRight(ItemAction, myGraphic);
|
||||
if (Checking.ExtractedFilePath.Contains("Items\\Consumables\\"))
|
||||
{
|
||||
DrawToLeft(MaxStackSize, myGraphic);
|
||||
}
|
||||
break;
|
||||
case "variant":
|
||||
DrawToLeft(ShortDescription, myGraphic);
|
||||
DrawToRight(CosmeticId, myGraphic);
|
||||
break;
|
||||
case "stwHeroes":
|
||||
DrawToRight(HeroType, myGraphic);
|
||||
DrawPower(myGraphic);
|
||||
break;
|
||||
case "stwDefenders":
|
||||
DrawToRight(DefenderType, myGraphic);
|
||||
DrawPower(myGraphic);
|
||||
break;
|
||||
}
|
||||
|
||||
JToken exportToken = theItem["export_type"];
|
||||
if (exportToken != null && exportToken.Value<string>().Equals("AthenaItemWrapDefinition") && Checking.WasFeatured && ItemIcon.ItemIconPath.Contains("WeaponRenders"))
|
||||
{
|
||||
DrawAdditionalImage(theItem, myGraphic);
|
||||
}
|
||||
|
||||
JToken ammoToken = theItem["AmmoData"];
|
||||
if (ammoToken != null)
|
||||
{
|
||||
JToken assetPathName = ammoToken["asset_path_name"];
|
||||
if (assetPathName != null && assetPathName.Value<string>().Contains("Ammo")) //TO AVOID TRIGGERING CONSUMABLES, NAME SHOULD CONTAIN "AMMO"
|
||||
case "athIteDef":
|
||||
DrawToLeft(ShortDescription, myGraphic);
|
||||
DrawToRight(CosmeticSource, myGraphic);
|
||||
break;
|
||||
case "consAndWeap":
|
||||
DrawToRight(ItemAction, myGraphic);
|
||||
if (Checking.ExtractedFilePath.Contains("Items\\Consumables\\"))
|
||||
{
|
||||
ItemIcon.GetAmmoData(assetPathName.Value<string>(), myGraphic);
|
||||
|
||||
DrawWeaponStat(WeaponDataTable, WeaponRowName, myGraphic);
|
||||
DrawToLeft(MaxStackSize, myGraphic);
|
||||
}
|
||||
}
|
||||
|
||||
DrawCosmeticUff(theItem, myGraphic);
|
||||
break;
|
||||
case "variant":
|
||||
DrawToLeft(ShortDescription, myGraphic);
|
||||
DrawToRight(CosmeticId, myGraphic);
|
||||
break;
|
||||
case "stwHeroes":
|
||||
DrawToRight(HeroType, myGraphic);
|
||||
DrawPower(myGraphic);
|
||||
break;
|
||||
case "stwDefenders":
|
||||
DrawToRight(DefenderType, myGraphic);
|
||||
DrawPower(myGraphic);
|
||||
break;
|
||||
}
|
||||
|
||||
JToken exportToken = theItem["export_type"];
|
||||
if (exportToken != null && exportToken.Value<string>().Equals("AthenaItemWrapDefinition") && Checking.WasFeatured && ItemIcon.ItemIconPath.Contains("WeaponRenders"))
|
||||
{
|
||||
DrawAdditionalImage(theItem, myGraphic);
|
||||
}
|
||||
|
||||
JToken ammoToken = theItem["AmmoData"];
|
||||
if (ammoToken != null)
|
||||
{
|
||||
JToken assetPathName = ammoToken["asset_path_name"];
|
||||
if (assetPathName != null && assetPathName.Value<string>().Contains("Ammo")) //TO AVOID TRIGGERING CONSUMABLES, NAME SHOULD CONTAIN "AMMO"
|
||||
{
|
||||
ItemIcon.GetAmmoData(assetPathName.Value<string>(), myGraphic);
|
||||
|
||||
DrawWeaponStat(WeaponDataTable, WeaponRowName, myGraphic);
|
||||
}
|
||||
}
|
||||
|
||||
DrawCosmeticUff(theItem, myGraphic);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -541,7 +538,7 @@ namespace FModel
|
|||
{
|
||||
Image reload = Resources.reload64;
|
||||
myGraphic.DrawImage(ImageUtilities.ResizeImage(reload, 15, 15), new Point(50 + (clipSize.Value<string>().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.Value<string>().Length * 7) + 47, 503)); //64=50+icon size (-1 because that wasn't perfectly at the position i wanted)
|
||||
myGraphic.DrawString(reloadTime.Value<string>() + " " + SearchResource.getTextByKey("6BA53D764BA5CC13E821D2A807A72365", "seconds"), new Font(FontUtilities.pfc.Families[0], 11), new SolidBrush(Color.White), new Point(64 + (clipSize.Value<string>().Length * 7) + 47, 503)); //64=50+icon size (-1 because that wasn't perfectly at the position i wanted)
|
||||
}
|
||||
|
||||
DrawToRight(weaponName, myGraphic);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using System.Drawing.Drawing2D;
|
|||
using System.Drawing.Text;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FModel
|
||||
{
|
||||
|
|
@ -81,14 +82,14 @@ namespace FModel
|
|||
{
|
||||
if (JohnWick.MyAsset.GetSerialized() != null)
|
||||
{
|
||||
new UpdateMyState("Drawing " + ingredientsFileName + "...", "Waiting").ChangeProcessState();
|
||||
|
||||
dynamic AssetData = JsonConvert.DeserializeObject(JohnWick.MyAsset.GetSerialized());
|
||||
JArray AssetArray = JArray.FromObject(AssetData);
|
||||
|
||||
JToken rarity = AssetData[0]["Rarity"];
|
||||
if (rarity != null)
|
||||
{
|
||||
fillSchematicIcon(rarity, i);
|
||||
}
|
||||
fillSchematicIcon(AssetData[0], i);
|
||||
drawIngredientIcon(AssetData[0], i);
|
||||
drawDisplayNameAndQuantity(AssetData[0], SchematicItemInfos.schematicInfoList[i].theIngredientQuantity, i);
|
||||
}
|
||||
}
|
||||
catch (JsonSerializationException)
|
||||
|
|
@ -101,36 +102,91 @@ namespace FModel
|
|||
}
|
||||
}
|
||||
|
||||
public static void fillSchematicIcon(JToken rarity, int i)
|
||||
private static void fillSchematicIcon(JToken AssetArray, int i)
|
||||
{
|
||||
Color rarityColor;
|
||||
switch(rarity.Value<string>())
|
||||
Color rarityColor = new Color();
|
||||
JToken rarity = AssetArray["Rarity"];
|
||||
if (rarity != null)
|
||||
{
|
||||
case "EFortRarity::Transcendent":
|
||||
rarityColor = Color.FromArgb(255, 155, 39, 69);
|
||||
break;
|
||||
case "EFortRarity::Mythic":
|
||||
rarityColor = Color.FromArgb(255, 170, 143, 47);
|
||||
break;
|
||||
case "EFortRarity::Legendary":
|
||||
rarityColor = Color.FromArgb(255, 170, 96, 47);
|
||||
break;
|
||||
case "EFortRarity::Epic":
|
||||
case "EFortRarity::Quality":
|
||||
rarityColor = Color.FromArgb(255, 96, 47, 170);
|
||||
break;
|
||||
case "EFortRarity::Rare":
|
||||
rarityColor = Color.FromArgb(255, 55, 92, 163);
|
||||
break;
|
||||
case "EFortRarity::Common":
|
||||
rarityColor = Color.FromArgb(255, 109, 109, 109);
|
||||
break;
|
||||
default:
|
||||
rarityColor = Color.FromArgb(255, 87, 155, 39);
|
||||
break;
|
||||
switch (rarity.Value<string>())
|
||||
{
|
||||
case "EFortRarity::Transcendent":
|
||||
rarityColor = Color.FromArgb(255, 155, 39, 69);
|
||||
break;
|
||||
case "EFortRarity::Mythic":
|
||||
rarityColor = Color.FromArgb(255, 170, 143, 47);
|
||||
break;
|
||||
case "EFortRarity::Legendary":
|
||||
rarityColor = Color.FromArgb(255, 170, 96, 47);
|
||||
break;
|
||||
case "EFortRarity::Epic":
|
||||
case "EFortRarity::Quality":
|
||||
rarityColor = Color.FromArgb(255, 96, 47, 170);
|
||||
break;
|
||||
case "EFortRarity::Rare":
|
||||
rarityColor = Color.FromArgb(255, 55, 92, 163);
|
||||
break;
|
||||
case "EFortRarity::Common":
|
||||
rarityColor = Color.FromArgb(255, 109, 109, 109);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else { rarityColor = Color.FromArgb(255, 87, 155, 39); }
|
||||
|
||||
toDrawOn.FillRectangle(new SolidBrush(rarityColor), new Rectangle(0, 522 + (75 * i), schematicBitmap.Width, 75));
|
||||
Pen pen = new Pen(ControlPaint.Light(rarityColor), 4);
|
||||
pen.Alignment = PenAlignment.Inset; //<-- this
|
||||
toDrawOn.DrawRectangle(pen, new Rectangle(0, 522 + (75 * i), schematicBitmap.Width, 75));
|
||||
}
|
||||
|
||||
private static void drawIngredientIcon(JToken AssetArray, int i)
|
||||
{
|
||||
ItemIcon.ItemIconPath = string.Empty;
|
||||
ItemIcon.SearchAthIteDefIcon(AssetArray);
|
||||
if (File.Exists(ItemIcon.ItemIconPath))
|
||||
{
|
||||
Image itemIcon;
|
||||
using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
|
||||
{
|
||||
itemIcon = new Bitmap(bmpTemp);
|
||||
}
|
||||
toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 50, 50), new Point(10, 536 + (75 * i)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Image itemIcon = Resources.unknown512;
|
||||
toDrawOn.DrawImage(itemIcon, new Point(0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawDisplayNameAndQuantity(JToken AssetArray, string quantity, int i)
|
||||
{
|
||||
JToken displayName = AssetArray["DisplayName"];
|
||||
if (displayName != null)
|
||||
{
|
||||
JToken key = displayName["key"];
|
||||
JToken sourceString = displayName["source_string"];
|
||||
if (key != null && sourceString != null)
|
||||
{
|
||||
string text = SearchResource.getTextByKey(key.Value<string>(), sourceString.Value<string>());
|
||||
|
||||
toDrawOn.DrawString(
|
||||
text,
|
||||
new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[0], 25),
|
||||
new SolidBrush(Color.White),
|
||||
new Point(70, 545 + (75 * i)),
|
||||
FontUtilities.leftString
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
toDrawOn.FillRectangle(new SolidBrush(rarityColor), new Rectangle(0, 447 + (75 * i), schematicBitmap.Width, 75));
|
||||
toDrawOn.DrawString(
|
||||
quantity,
|
||||
new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[0], 25),
|
||||
new SolidBrush(Color.White),
|
||||
new Point(502, 545 + (75 * i)),
|
||||
FontUtilities.rightString
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ namespace FModel
|
|||
}
|
||||
}
|
||||
}
|
||||
else { throw new ArgumentException("Not enough informations to create an icon about this schematic - Missing: \"CraftingRecipe\""); }
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
|
@ -105,7 +106,6 @@ namespace FModel
|
|||
JToken quantity = token["Quantity"];
|
||||
if (primaryAssetName != null && quantity != null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("\"" + primaryAssetName.Value<string>() + "\"\t\t" + quantity.Value<string>());
|
||||
SchematicInfoEntry currentEntry = new SchematicInfoEntry(primaryAssetName.Value<string>(), quantity.Value<string>());
|
||||
bool isAlreadyAdded = schematicInfoList.Any(item => item.theIngredientItemDefinition.Equals(currentEntry.theIngredientItemDefinition, StringComparison.InvariantCultureIgnoreCase) && item.theIngredientQuantity == currentEntry.theIngredientQuantity);
|
||||
if (!isAlreadyAdded) { schematicInfoList.Add(currentEntry); }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
# FModel
|
||||
# FModel
|
||||
|
||||
[](https://github.com/iAmAsval/FModel/releases)
|
||||
[](https://github.com/iAmAsval/FModel//releases/latest)
|
||||
[](https://github.com/iAmAsval/FModel/blob/master/LICENSE)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user