Tier Updates

This commit is contained in:
mikx 2023-01-06 01:27:05 -05:00
parent a5d47a41fd
commit 7f066fdd50
11 changed files with 487 additions and 96 deletions

View File

@ -216,6 +216,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="compiler\section.cs" />
<Compile Include="currency_classes.cs" />
<Compile Include="generator\accessory.cs" />
<Compile Include="generator\armour.cs" />

View File

@ -0,0 +1,136 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PoE_MxFilterGen.compiler
{
public class Block
{
public string Type { get; set; }
public bool Show { get; set; }
public List<string> Class { get; set; }
public List<string> BaseType { get; set; }
public string SetTextColor { get; set; }
public string SetBackgroundColor { get; set; }
public string SetBorderColor { get; set; }
public string SetFontSize { get; set; }
public List<Condition> Conditions { get; set; }
public List<Action> Actions { get; set; }
}
public class Condition
{
public string name { get; set; }
public string op { get; set; }
public string value { get; set; }
}
public class Action
{
public string name { get; set; }
public string va { get; set; }
public object vb { get; set; }
public object vc { get; set; }
public object vd { get; set; }
}
public class RootBlocks
{
public List<Block> blocks { get; set; }
}
internal class section
{
public static string outpath = "out/filson.filter";
private static string iC;
private static string iB;
public static void Compile()
{
if (File.Exists(outpath)) { File.Delete("out/filson.filter"); }
////////// Splash //////////
File.AppendAllText(outpath, $"#### Filson - PoE Item Filter JSON Parsing - MxFilterGen v{main.version}{Environment.NewLine}");
File.AppendAllText(outpath, $"#### Filson and MxFilterGen are developped by mikx.{Environment.NewLine}");
File.AppendAllText(outpath, $"#### MxGit: https://mxgit.ovh/mikx/PoE-MxFilterGen{Environment.NewLine}");
File.AppendAllText(outpath, $"#### MxPoE: https://mxpoe.ovh/{Environment.NewLine}");
File.AppendAllText(outpath, $"#### Contact: mikx@mxpoe.ovh / http://discord.mxg.ovh{Environment.NewLine}");
foreach (Block bl in JsonConvert.DeserializeObject<RootBlocks>(File.ReadAllText("filson/LEVELING.json", Encoding.UTF8)).blocks)
{
////////// Skip a line //////////
File.AppendAllText(outpath, Environment.NewLine);
////////// Show or Hide //////////
string bshow = "";
if (bl.Show) { bshow = "Show"; } else { bshow = "Hide"; };
File.AppendAllText(outpath, bshow + Environment.NewLine);
////////// Class //////////
if (bl.Class[0] != null) {
foreach (var c in bl.Class) { iC += string.Format(@" ""{0}""", c); }
File.AppendAllText(outpath, $" Class {iC} {Environment.NewLine}");
}
////////// Base //////////
if (bl.BaseType[0] != null)
{
foreach (var b in bl.BaseType) { iB += string.Format(@" ""{0}""", b); }
File.AppendAllText(outpath, $" BaseType {iB} {Environment.NewLine}");
}
////////// SetTextColor //////////
if (bl.SetTextColor != null)
{
File.AppendAllText(outpath, $" SetTextColor {bl.SetTextColor} {Environment.NewLine}");
}
////////// SetBackgroundColor //////////
if (bl.SetBackgroundColor != null)
{
File.AppendAllText(outpath, $" SetBackgroundColor {bl.SetBackgroundColor} {Environment.NewLine}");
}
////////// SetBorderColor //////////
if (bl.SetBorderColor != null)
{
File.AppendAllText(outpath, $" SetBorderColor {bl.SetBorderColor} {Environment.NewLine}");
}
////////// SetFontSize //////////
File.AppendAllText(outpath, " SetFontSize " + bl.SetFontSize + Environment.NewLine);
////////// Conditions //////////
foreach (var con in bl.Conditions)
{
string cn;
string co;
string cv;
switch (con.name)
{
case "ItemLevel":
cn = con.name;
co = con.op;
cv = con.value;
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "Rarity":
cn = con.name;
co = con.op;
cv = con.value;
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
}
}
////////// Actions //////////
foreach (var ac in bl.Actions)
{
string an;
string ava;
switch (ac.name)
{
case "CustomAlertSound":
an = ac.name;
ava = ac.va;
File.AppendAllText(outpath, $" {an} \"{ava}\" {Environment.NewLine}");
break;
}
}
iB = "";
iC = "";
}
}
}
}

View File

@ -1,97 +1,246 @@
// Decompiled with JetBrains decompiler
// Type: PoE_MxFilterGen.generator.tier
// Assembly: mxfiltergen, Version=8.4.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 9686B206-07DB-4C70-B4F4-1F6EF4D87358
// Assembly location: C:\Users\blood\OneDrive\Desktop\mxfiltergen.exe
using Newtonsoft.Json;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;
namespace PoE_MxFilterGen.generator
{
internal class tier
{
private static string iB;
private static string bAxe;
private static string bBow;
private static string bClaw;
private static string bDagger;
private static string bFishing;
private static string bMace;
private static string bSceptre;
private static string bStaff;
private static string bSword;
private static string bWand;
private static string bBody;
private static string bBoots;
private static string bGloves;
private static string bHelmet;
private static string bShield;
private static string bQuiver;
public static void Gen(string section, int tierValue, bool tier1HAxe, bool tier2HAxe, bool tierBow, bool tierClaw, bool tierDagger, bool tier1HMace, bool tier2HMace, bool tierSceptre, bool tierStaff, bool tier1HSword, bool tier2HSword, bool tierWand, bool tierBody, bool tierBoots, bool tierGloves, bool tierHelmet, bool tierShield, bool tierQuiver)
private static List<string> iBA = new List<string>();
private static string iBInt;
private static List<string> iBIntA = new List<string>();
private static string iBStr;
private static List<string> iBStrA = new List<string>();
private static string iBDex;
private static List<string> iBDexA = new List<string>();
public static string[] Int()
{
string[] Int = new string[] {
"Wand",
"Sorcerer",
"Mind",
"Bone",
"Silk",
"Arcanist",
"Spirit",
"Solaris",
"Slippers",
"Samite",
"Demon's Horn",
"Conjurer Gloves",
"Slaughter Knife",
"Deicide",
"Conjurer",
"Necromancer",
"Deicide",
"Platinum Kris",
"Zealot Boots",
"Golden Kris",
"Steel Circlet",
"Butcher Knife",
"Embroidered Gloves"
};
return Int;
}
public static string[] Str()
{
string[] Str = new string[] {
"Astral",
"Tower",
"Burgonet",
"Ancient",
"Fencer",
"Goliath",
"Pig-Faced",
"Crusader Boots",
"Vaal Gauntlets",
"Prophet Crown",
"Antique Greaves",
"Vaal Greaves",
"Siege Helmet",
"Reinforced Greeves",
"Soldier Boots",
"Aventail Helmet",
"Reaver Helmet",
"Saint's Hauberk",
"Samnite Helmet"
};
return Str;
}
public static string[] Dex()
{
string[] Dex = new string[] {
"Claw",
"Bow",
"Quiver",
"Deerskin",
"Ambusher",
"Wyrnmscale",
"Gouger",
"Dagger",
"Spiked",
"Hood",
"Ursine",
"Oak",
"Carnal",
"Vaal Buckler",
"Nightmare Bascinet",
"Poignard",
"Gutting Knife",
"Vaal Mask",
"Throat Stabber",
"Lion Pelt",
"Stealth Gloves",
"Battle Buckler",
"Shagreen Boots",
"Shagreen Gloves",
"Sharkskin Gloves",
"Enameled Buckler",
"Corsair Sword"
};
return Dex;
}
public static void Gen(string section, int tierValue, bool tier1HAxe, bool tier2HAxe, bool tierBow, bool tierClaw, bool tierDagger, bool tier1HMace, bool tier2HMace, bool tierSceptre, bool tierStaff, bool tier1HSword, bool tier2HSword, bool tierWand, bool tierBody, bool tierBoots, bool tierGloves, bool tierHelmet, bool tierShield, bool tierQuiver, List<string> tierBaseInclude, List<string> tierBaseExclude)
{
var ln = JsonConvert.DeserializeObject<Root>(File.ReadAllText("data/ninja.base.json", Encoding.UTF8));
ForEachLine(ln, "One Handed Axe", tier1HAxe, section, tierValue);
ForEachLine(ln, "Two Handed Axe", tier2HAxe, section, tierValue);
ForEachLine(ln, "Bow", tierBow, section, tierValue);
ForEachLine(ln, "Claw", tierClaw, section, tierValue);
ForEachLine(ln, "Dagger", tierDagger, section, tierValue);
ForEachLine(ln, "One Handed Mace", tier1HMace, section, tierValue);
ForEachLine(ln, "Two Handed Mace", tier2HMace, section, tierValue);
ForEachLine(ln, "Sceptre", tierSceptre, section, tierValue);
ForEachLine(ln, "Staff", tierStaff, section, tierValue);
ForEachLine(ln, "One Handed Sword", tier1HSword, section, tierValue);
ForEachLine(ln, "Two Handed Sword", tier2HSword, section, tierValue);
ForEachLine(ln, "Wand", tierWand, section, tierValue);
ForEachLine(ln, "Body Armour", tierBody, section, tierValue);
ForEachLine(ln, "Boots", tierBoots, section, tierValue);
ForEachLine(ln, "Gloves", tierGloves, section, tierValue);
ForEachLine(ln, "Helmet", tierHelmet, section, tierValue);
ForEachLine(ln, "Shield", tierShield, section, tierValue);
ForEachLine(ln, "Quiver", tierQuiver, section, tierValue);
ForEachLine(ln, "One Handed Axe", tier1HAxe, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Two Handed Axe", tier2HAxe, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Bow", tierBow, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Claw", tierClaw, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Dagger", tierDagger, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "One Handed Mace", tier1HMace, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Two Handed Mace", tier2HMace, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Sceptre", tierSceptre, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Staff", tierStaff, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "One Handed Sword", tier1HSword, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Two Handed Sword", tier2HSword, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Wand", tierWand, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Body Armour", tierBody, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Boots", tierBoots, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Gloves", tierGloves, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Helmet", tierHelmet, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Shield", tierShield, section, tierValue, tierBaseInclude, tierBaseExclude);
ForEachLine(ln, "Quiver", tierQuiver, section, tierValue, tierBaseInclude, tierBaseExclude);
}
public static void ForEachLine(dynamic lnb, string type, bool tierBool, string section, int tierValue)
public static void ForEachLine(dynamic lnb, string type, bool tierBool, string section, int tierValue, List<string> tierBaseInclude, List<string> tierBaseExclude)
{
int c = 0;
if (tierBool)
List<string> stringList = new List<string>();
var ln = JsonConvert.DeserializeObject<Root>(File.ReadAllText("data/ninja.base.json", Encoding.UTF8));
foreach (var line in ln.lines)
{
var ln = JsonConvert.DeserializeObject<Root>(File.ReadAllText("data/ninja.base.json", Encoding.UTF8));
foreach (var line in ln.lines)
string[] cint = Int();
string[] cstr = Str();
string[] cdex = Dex();
if (line.itemType == type && tierBool && line.levelRequired <= 86 && line.variant == null && line.chaosValue >= tierValue && !stringList.Contains(line.baseType))
{
if (line.itemType == type && tierBool && line.levelRequired <= 86 && line.variant == null && line.chaosValue >= tierValue)
if (!tierBaseExclude.Contains(line.baseType))
{
c++;
iB += string.Format(@" ""{0}""", line.baseType);
iBA.Add(line.baseType);
if (cint.Any(line.baseType.Contains))
{
iBIntA.Add(line.baseType);
iBA.Remove(line.baseType);
}
if (cstr.Any(line.baseType.Contains))
{
iBStrA.Add(line.baseType);
iBA.Remove(line.baseType);
}
if (cdex.Any(line.baseType.Contains))
{
iBDexA.Add(line.baseType);
iBA.Remove(line.baseType);
}
stringList.Add(line.baseType);
}
}
else if (line.itemType == type && !tierBool && line.levelRequired <= 86 && line.variant == null && line.chaosValue >= tierValue && tierBaseInclude.Contains(line.baseType) && !stringList.Contains(line.baseType))
{
c++;
iBA.Add(line.baseType);
if (cint.Any(line.baseType.Contains))
{
iBIntA.Add(line.baseType);
iBA.Remove(line.baseType);
}
if (cstr.Any(line.baseType.Contains))
{
iBStrA.Add(line.baseType);
iBA.Remove(line.baseType);
}
if (cdex.Any(line.baseType.Contains))
{
iBDexA.Add(line.baseType);
iBA.Remove(line.baseType);
}
stringList.Add(line.baseType);
}
}
if (tierBool && c != 0)
foreach (string b in iBA)
{
GenerateFile(section, iB, type);
}
iB = "";
iB += string.Format(@" ""{0}""", b);
}
foreach (string b in iBIntA)
{
iBInt += string.Format(@" ""{0}""", b);
}
foreach (string b in iBStrA)
{
iBStr += string.Format(@" ""{0}""", b);
}
foreach (string b in iBDexA)
{
iBDex += string.Format(@" ""{0}""", b);
}
if (c != 0)
{
if (iBA.Count >= 1) { GenerateFile(section, iB, type, "Base", " SetBackgroundColor 54 54 54 255"); }
if (iBIntA.Count >= 1) { GenerateFile(section, iBInt, type, "Int", " SetBackgroundColor 56 69 89 255"); }
if (iBStrA.Count >= 1) { GenerateFile(section, iBStr, type, "Str", " SetBackgroundColor 81 54 54 255"); }
if (iBDexA.Count >= 1) { GenerateFile(section, iBDex, type, "Dex", " SetBackgroundColor 50 69 49 255"); }
}
c = 0;
iBA = new List<string>();
iBIntA = new List<string>();
iBStrA = new List<string>();
iBDexA = new List<string>();
iB = "";
iBInt = "";
iBStr = "";
iBDex = "";
}
public static void GenerateFile(string section, string iB, string type)
public static void GenerateFile(string section, string iB, string type, string att, string SetBackgroundColor)
{
if (iB == null)
if (iB == null || iB == "")
iB = "\"\"";
string path = "gen/" + section + ".filter";
File.AppendAllText(path, $"# Section: {section} ({type})" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, $"# Section: {section} ({type})({att})" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine ?? "", Encoding.UTF8);
File.AppendAllText(path, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " BaseType " + iB + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " HasExplicitMod \"Veiled\"" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, SetBackgroundColor + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBorderColor 112 255 112 255" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetFontSize 35" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " MinimapIcon 1 Green Star" + Environment.NewLine, Encoding.UTF8);
@ -103,7 +252,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " FracturedItem True" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, SetBackgroundColor + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBorderColor 112 255 112 255" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetFontSize 35" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " MinimapIcon 1 Green Star" + Environment.NewLine, Encoding.UTF8);
@ -115,7 +264,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " SynthesisedItem True" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, SetBackgroundColor + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBorderColor 112 255 112 255" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetFontSize 35" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " MinimapIcon 1 Green Star" + Environment.NewLine, Encoding.UTF8);
@ -127,7 +276,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " Identified True" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, SetBackgroundColor + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBorderColor 0 0 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetFontSize 35" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " CustomAlertSound \"mx_tier.mp3\"" + Environment.NewLine, Encoding.UTF8);
@ -137,7 +286,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " Corrupted True" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, SetBackgroundColor + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBorderColor 210 0 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetFontSize 35" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " CustomAlertSound \"mx_tier.mp3\"" + Environment.NewLine, Encoding.UTF8);
@ -148,7 +297,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " ItemLevel <= 100" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, SetBackgroundColor + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBorderColor 184 218 242" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetFontSize 35" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " CustomAlertSound \"mx_tier.mp3\"" + Environment.NewLine, Encoding.UTF8);
@ -159,7 +308,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " ItemLevel <= 74" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, SetBackgroundColor + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBorderColor 222 118 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetFontSize 35" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " CustomAlertSound \"mx_tier.mp3\"" + Environment.NewLine, Encoding.UTF8);
@ -170,7 +319,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " ItemLevel <= 74" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, SetBackgroundColor + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetBorderColor 222 118 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetFontSize 35" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " CustomAlertSound \"mx_tier.mp3\"" + Environment.NewLine, Encoding.UTF8);

View File

@ -32,8 +32,12 @@ namespace PoE_MxFilterGen.json
public int uniqueValue { get; set; }
public int fossilValue { get; set; }
public int cardValue { get; set; }
public string updateurl { get; set; }
public string section { get; set; }
public List<string> tierBaseInclude { get; set; }
public List<string> tierBaseExclude { get; set; }
public bool install { get; set; }
public string path { get; set; }
public string structure { get; set; }
}
class settings
@ -62,12 +66,6 @@ namespace PoE_MxFilterGen.json
return j.cardValue;
}
public static string GetSection()
{
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("settings.json"));
return j.section;
}
internal static bool GetTier1HAxe()
{
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("settings.json"));
@ -176,7 +174,31 @@ namespace PoE_MxFilterGen.json
return j.tierQuiver;
}
public static void WriteSection(string section)
internal static bool GetInstall()
{
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("settings.json"));
return j.install;
}
internal static string GetPath()
{
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("settings.json"));
return j.path;
}
internal static List<string> GetTierBaseInclude()
{
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("settings.json"));
return j.tierBaseInclude;
}
internal static List<string> GetTierBaseExclude()
{
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("settings.json"));
return j.tierBaseExclude;
}
public static void WriteSection(string structure)
{
SETTINGS js = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText($@"settings.json"));
SETTINGS se = new SETTINGS
@ -201,9 +223,13 @@ namespace PoE_MxFilterGen.json
tierShield = js.tierShield,
tierQuiver = js.tierQuiver,
uniqueValue = js.uniqueValue,
tierBaseInclude = js.tierBaseInclude,
tierBaseExclude = js.tierBaseExclude,
fossilValue = js.fossilValue,
cardValue = js.cardValue,
section = section
install = js.install,
path = js.path,
structure = structure
};
var raw = JsonConvert.SerializeObject(se, Formatting.Indented);
File.WriteAllText($@"settings.json", raw);

View File

@ -11,7 +11,7 @@ namespace PoE_MxFilterGen
internal class main
{
private static DateTime dt = DateTime.Now;
public static string version = "10.5.1";
public static string version = "10.7.1";
public static string fDate = string.Format("{0}-{1}-{2}", (object)main.dt.Day, (object)main.dt.Month, (object)main.dt.Year);
public static string api = "";
public static string giturl = "https://mxgit.ovh/mikx";
@ -23,34 +23,56 @@ namespace PoE_MxFilterGen
public static int sprog = 0;
public static int stotal = 0;
public static bool debug = false;
public static bool install;
public static string ipath;
public static string docpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
private static void Main(string[] args)
{
if (!File.Exists("config/mxfiltergen_settings.json"))
if (!Directory.Exists("data"))
{
Directory.CreateDirectory("data");
}
if (!Directory.Exists("gen"))
{
Directory.CreateDirectory("gen");
}
if (!Directory.Exists("structure"))
{
Directory.CreateDirectory("structure");
}
if (!Directory.Exists("out"))
{
Directory.CreateDirectory("out");
}
if (!File.Exists("settings.json"))
{
msg.CMW("ERROR: settings.json not found! Downloading a template...", true, 3);
web.DownloadFile("https://mxpoe.ovh/mxfilter/data/settings_template.json", "config/mxfiltergen_settings.json");
web.DownloadFile("https://mxpoe.ovh/mxfilter/mxfiltergen_settings.json", "settings.json");
}
msg.Splash();
if (!File.Exists("mxfiltergen_var.json"))
{
msg.CMW("ERROR: mxfiltergen_var.json not found! Downloading a template...", true, 3);
web.DownloadFile("https://mxpoe.ovh/mxfilter/mxfiltergen_var.json", "mxfiltergen_var.json");
}
msg.Splash("MxFilterGen", "mikx");
main.CleanDirData();
main.league = JsonConvert.DeserializeObject<main.REMVAR>(File.ReadAllText("config/mxfiltergen_var.json")).league;
main.league = JsonConvert.DeserializeObject<main.REMVAR>(File.ReadAllText("mxfiltergen_var.json")).league;
main.api = "https://poe.ninja/api/data/";
msg.CMW("League: " + main.league, true, 1);
msg.CMW(string.Format("Min. Unique Value - {0}c", (object)settings.GetUniqueValue()), true, 1);
msg.CMW(string.Format("Min. Fossil Value - {0}c", (object)settings.GetFossilValue()), true, 1);
msg.CMW(string.Format("Min. Card Value - {0}c", (object)settings.GetCardValue()), true, 1);
msg.CMW("Checking for required dirs...", true, 1);
if (!Directory.Exists("data"))
Directory.CreateDirectory("data");
if (!Directory.Exists("gen"))
Directory.CreateDirectory("gen");
if (!Directory.Exists("structure"))
Directory.CreateDirectory("structure");
msg.CMW("Cleaning the base dirs...", true, 1);
main.CleanDirData();
msg.CMW("Cleaning the last filter from path...", true, 1);
foreach (string filter in structures.Filters())
File.Delete("out/MxFilter_" + filter + ".filter");
foreach (string filter in structures.Filters()) {
if (File.Exists("out/MxFilter_" + filter + ".filter"))
{
File.Delete("out/MxFilter_" + filter + ".filter");
}
}
msg.CMW("Downloading the latest API data from poe.ninja...", true, 1);
web.SaveString(main.api + "itemoverview?league=" + main.league + "&type=UniqueArmour&language=en", "data/ninja.armour.json");
web.SaveString(main.api + "itemoverview?league=" + main.league + "&type=UniqueWeapon&language=en", "data/ninja.weapon.json");
@ -59,6 +81,7 @@ namespace PoE_MxFilterGen
web.SaveString(main.api + "currencyoverview?league=" + main.league + "&type=Currency&language=en", "data/ninja.currency.json");
web.SaveString(main.api + "itemoverview?league=" + main.league + "&type=Fossil&language=en", "data/ninja.fossil.json");
web.SaveString(main.api + "itemoverview?league=" + main.league + "&type=BaseType&language=en", "data/ninja.base.json");
//compiler.section.Compile();
foreach (string filter in structures.Filters())
{
string str = "MxFilter";
@ -93,6 +116,10 @@ namespace PoE_MxFilterGen
bool tierHelmet = settings.GetTierHelmet();
bool tierShield = settings.GetTierShield();
bool tierQuiver = settings.GetTierQuiver();
install = settings.GetInstall();
ipath = settings.GetPath();
List<string> tierBaseInclude = settings.GetTierBaseInclude();
List<string> tierBaseExclude = settings.GetTierBaseExclude();
switch (structure)
{
case "DIVINATION CARD (GEN)":
@ -111,7 +138,7 @@ namespace PoE_MxFilterGen
fossil.Gen(section, fossilValue);
break;
case "Tiers (DATA)":
tier.Gen(section, tierValue, tier1HAxe, tier2HAxe, tierBow, tierClaw, tierDagger, tier1HMace, tier2HMace, tierSceptre, tierStaff, tier1HSword, tier2HSword, tierWand, tierBody, tierBoots, tierGloves, tierHelmet, tierShield, tierQuiver);
tier.Gen(section, tierValue, tier1HAxe, tier2HAxe, tierBow, tierClaw, tierDagger, tier1HMace, tier2HMace, tierSceptre, tierStaff, tier1HSword, tier2HSword, tierWand, tierBody, tierBoots, tierGloves, tierHelmet, tierShield, tierQuiver, tierBaseInclude, tierBaseExclude);
break;
}
}
@ -168,11 +195,50 @@ namespace PoE_MxFilterGen
main.ftotal = 0;
main.fprog = 0;
main.CleanDir();
CurrencyValueOut();
if(debug)
CurrencyValueOut();
}
if (debug)
{
Console.ReadKey();
}
else if (!debug && install)
{
msg.CMW("INFO: install is true and will act as a personal filter generator.", true, 2);
foreach (var f in structures.Filters())
{
Console.ReadKey();
}
if (File.Exists($@"{docpath}\My Games\Path of Exile\MxFilter_{f}.filter"))
{
File.Copy($@"{docpath}\My Games\Path of Exile\MxFilter_{f}.filter", $@"{docpath}\My Games\Path of Exile\MxFilter_{f}.filter.backup", true);
File.Delete($@"{docpath}\My Games\Path of Exile\MxFilter_{f}.filter");
}
}
if (ipath == "" || ipath == null)
{
msg.CMW("ERROR: install is true but there is no path given, using default windows path.", true, 3);
foreach (var f in structures.Filters())
{
File.Copy($"out/MxFilter_{f}.filter", $@"{docpath}\My Games\Path of Exile\MxFilter_{f}.filter");
}
foreach (var s in Directory.EnumerateFiles("sound"))
{
string sf = Path.GetFileName(s);
File.Copy($"{s}", $@"{docpath}\My Games\Path of Exile\{sf}", true);
}
}
else
{
foreach (var f in structures.Filters())
{
File.Copy($"out/MxFilter_{f}.filter", $@"{ipath}\MxFilter_{f}.filter");
}
foreach (var s in Directory.EnumerateFiles("sound"))
{
File.Copy($"sound/{s}", $@"{ipath}\{s}");
}
}
} else
{
msg.CMW("INFO: install is false and will act as a remote generator.", true, 2);
}
}

View File

@ -200,13 +200,13 @@ namespace PoE_MxFilterGen
Console.WriteLine();
}
public static void Splash()
public static void Splash(string progname, string dev)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("");
Console.WriteLine("#### MxFilterGen");
Console.WriteLine($"#### {progname}");
Console.WriteLine(string.Format("#### VERSION: {0}", (object)main.version));
Console.WriteLine("#### DEV: mikx");
Console.WriteLine($"#### DEV: {dev}");
Console.WriteLine("#### POWERED BY: poe.ninja");
Console.WriteLine("");
Console.ForegroundColor = ConsoleColor.White;

View File

@ -62,3 +62,15 @@ D:\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.Fo
D:\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.CopyComplete
D:\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\mxfiltergen.exe
D:\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\mxfiltergen.pdb
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\mxfiltergen.exe.config
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\mxfiltergen.exe
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\mxfiltergen.pdb
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\Newtonsoft.Json.xml
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\System.Diagnostics.DiagnosticSource.xml
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.AssemblyReference.cache
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.SuggestedBindingRedirects.cache
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.CoreCompileInputs.cache
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.Fody.CopyLocal.cache
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.CopyComplete
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\mxfiltergen.exe
\\mxhome\Seagate\Dev\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\mxfiltergen.pdb

View File

@ -38,7 +38,8 @@ namespace PoE_MxFilterGen
"ACCESSORIES",
"Tiers (DATA)",
"GEAR BY SOCKET",
"GEAR BY QUALITY",
"GEAR BY QUALITY",
"LEVELING",
"RECIPES",
"HIDE",
};