This commit is contained in:
mikx 2023-05-03 05:32:55 -04:00
parent 7f066fdd50
commit 183c8d7e03
13 changed files with 345 additions and 164 deletions

View File

@ -3,20 +3,21 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
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 List<object> Class { get; set; }
public List<object> BaseType { get; set; }
public List<string> SetTextColor { get; set; }
public List<string> SetBackgroundColor { get; set; }
public List<string> SetBorderColor { get; set; }
public string SetFontSize { get; set; }
public List<Condition> Conditions { get; set; }
public List<Action> Actions { get; set; }
@ -33,9 +34,9 @@ namespace PoE_MxFilterGen.compiler
{
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 string vb { get; set; }
public string vc { get; set; }
public string vd { get; set; }
}
public class RootBlocks
@ -44,93 +45,206 @@ namespace PoE_MxFilterGen.compiler
}
internal class section
{
public static string outpath = "out/filson.filter";
public static string outpath = "";
private static string iC;
private static string iB;
public static void Compile()
public static void Compile(string section, string filter)
{
if (File.Exists(outpath)) { File.Delete($"out/{section}.filter"); }
//DoSplash(filter, section);
foreach (Block bl in JsonConvert.DeserializeObject<RootBlocks>(File.ReadAllText($"filson/{section}.json", Encoding.UTF8)).blocks)
{
string type = filter;
string blocktype = bl.Type;
outpath = $"out/{filter}/{section}.filter";
DoCompile(bl, blocktype, filter);
}
}
public static void DoSplash(string filter, string section)
{
if (File.Exists(outpath)) { File.Delete("out/filson.filter"); }
string outp = $"out/{filter}/{section}.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(outp, $"#### Filson - PoE Item Filter JSON Parsing - MxFilterGen v{main.version}{Environment.NewLine}");
File.AppendAllText(outp, $"#### Filson and MxFilterGen are developped by mikx.{Environment.NewLine}");
File.AppendAllText(outp, $"#### MxGit: https://mxgit.ovh/mikx/PoE-MxFilterGen{Environment.NewLine}");
File.AppendAllText(outp, $"#### MxPoE: https://mxpoe.ovh/{Environment.NewLine}");
File.AppendAllText(outp, $"#### Contact: mikx@mxpoe.ovh / http://discord.mxg.ovh{Environment.NewLine}");
}
public static void DoCompile(Block bl, string bltype, string type)
{
////////// Skip a line //////////
File.AppendAllText(outpath, Environment.NewLine);
////////// Show or Hide //////////
string bshow = "";
if (bl.Show) { bshow = "Show"; } else { bshow = "Hide"; };
if (bltype == "Normal" && type == "Strict") { 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[0] != null)
{
File.AppendAllText(outpath, $" SetTextColor {bl.SetTextColor[0]} {Environment.NewLine}");
}
////////// SetBackgroundColor //////////
if (bl.SetBackgroundColor[0] != null)
{
File.AppendAllText(outpath, $" SetBackgroundColor {bl.SetBackgroundColor[0]} {Environment.NewLine}");
}
////////// SetBorderColor //////////
if (bl.SetBorderColor[0] != null)
{
File.AppendAllText(outpath, $" SetBorderColor {bl.SetBorderColor[0]} {Environment.NewLine}");
}
////////// SetFontSize //////////
if (bl.SetFontSize != null)
{
File.AppendAllText(outpath, " SetFontSize " + bl.SetFontSize + Environment.NewLine);
////////// Conditions //////////
foreach (var con in bl.Conditions)
}
////////// Conditions //////////
foreach (var con in bl.Conditions)
{
string cn = con.name;
string co = con.op;
var cv = con.value;
switch (con.name)
{
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;
}
case "AreaLevel":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "ItemLevel":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "DropLevel":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "Quality":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "Rarity":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "LinkedSockets":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "SocketGroup":
File.AppendAllText(outpath, $" {cn} {co} \"{cv}\" {Environment.NewLine}");
break;
case "Sockets":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "Height":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "Width":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "HasExplicitMod":
File.AppendAllText(outpath, $" {cn} \"{cv}\" {Environment.NewLine}");
break;
case "AnyEnchantment":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "StackSize":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "GemLevel":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
case "GemQualityType":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "AlternateQuality":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "Identified":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "Corrupted":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "Mirrored":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "ElderItem":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "ShaperItem":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "HasInfluence":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "FracturedItem":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "SynthesisedItem":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "BlightedMap":
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
break;
case "MapTier":
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
break;
}
////////// Actions //////////
}
////////// Actions //////////
if (bltype == "Normal" && type == "Strict")
{
// No Action
} else
{
foreach (var ac in bl.Actions)
{
string an;
string ava;
string avb;
string avc;
string avd;
an = ac.name;
ava = "";
avb = "";
avc = "";
avd = "";
if (ava != null) { ava = ac.va; }
if (avb != null) { avb = ac.vb; }
if (avc != null) { avc = ac.vc; }
if (avd != null) { avd = ac.vd; }
switch (ac.name)
{
case "PlayAlertSound":
File.AppendAllText(outpath, $" {an} {ava} {avb} {Environment.NewLine}");
break;
case "CustomAlertSound":
an = ac.name;
ava = ac.va;
File.AppendAllText(outpath, $" {an} \"{ava}\" {Environment.NewLine}");
break;
case "MinimapIcon":
File.AppendAllText(outpath, $" {an} {ava} {avb} {avc} {Environment.NewLine}");
break;
case "PlayEffect":
File.AppendAllText(outpath, $" {an} {ava} {avb} {Environment.NewLine}");
break;
}
}
iB = "";
iC = "";
}
}
iB = "";
iC = "";
}
}
}

View File

@ -26,7 +26,7 @@ namespace PoE_MxFilterGen.generator
if (accessory.iB == null)
accessory.iB = "\"\"";
string path = "gen/" + section + ".filter";
File.AppendAllText(path, string.Format("# Section: {0}", (object)section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, string.Format("#### SECTION: {0}", (object)section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine ?? "", Encoding.UTF8);
File.AppendAllText(path, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " BaseType" + accessory.iB + Environment.NewLine, Encoding.UTF8);
@ -38,6 +38,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " CustomAlertSound \"mx_unique.mp3\"" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " MinimapIcon 0 White Star" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " PlayEffect White", Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine, Encoding.UTF8);
}
}
}

View File

@ -33,7 +33,7 @@ namespace PoE_MxFilterGen.generator
if (armour.iB == null)
armour.iB = "\"\"";
string path = "gen/" + section + ".filter";
File.AppendAllText(path, string.Format("# Section: {0}", (object)section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, string.Format("#### SECTION: {0}", (object)section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine ?? "", Encoding.UTF8);
File.AppendAllText(path, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " BaseType " + armour.iB + Environment.NewLine, Encoding.UTF8);
@ -45,6 +45,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " CustomAlertSound \"mx_unique.mp3\"" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " MinimapIcon 0 White Star" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " PlayEffect White", Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine, Encoding.UTF8);
}
}
}

View File

@ -32,7 +32,7 @@ namespace PoE_MxFilterGen.generator
if (card.iB == null)
card.iB = "\"\"";
string path = "gen/" + section + ".filter";
File.AppendAllText(path, string.Format("# Section: {0}", (object) section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, string.Format("#### SECTION: {0}", (object) section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine ?? "", Encoding.UTF8);
File.AppendAllText(path, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " Class \"Divination Card\"" + Environment.NewLine, Encoding.UTF8);
@ -42,6 +42,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " SetBorderColor 0 105 178" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetFontSize 45" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " CustomAlertSound \"mx_highvalue.mp3\"", Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine, Encoding.UTF8);
}
}
}

View File

@ -32,7 +32,7 @@ namespace PoE_MxFilterGen.generator
if (fossil.iB == null)
fossil.iB = "\"\"";
string path = "gen/" + section + ".filter";
File.AppendAllText(path, string.Format("# Section: {0}", (object) section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, string.Format("#### SECTION: {0}", (object) section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine ?? "", Encoding.UTF8);
File.AppendAllText(path, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " Class \"Stackable Currency\"" + Environment.NewLine, Encoding.UTF8);
@ -42,6 +42,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " SetBorderColor 255 165 0 255" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " SetFontSize 40" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " CustomAlertSound \"mx_fossil.mp3\"", Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine, Encoding.UTF8);
}
}
}

View File

@ -6,7 +6,7 @@ using System.Text;
using System.Linq;
namespace PoE_MxFilterGen.generator
{
{
internal class tier
{
private static string iB;
@ -43,7 +43,31 @@ namespace PoE_MxFilterGen.generator
"Golden Kris",
"Steel Circlet",
"Butcher Knife",
"Embroidered Gloves"
"Embroidered Gloves",
"Void Sceptre",
"Opal Sceptre",
"Abyssal Sceptre",
"Crystal Sceptre",
"Carnal Sceptre",
"Vaal Sceptre",
"Quartz Sceptre",
"Shadow Sceptre",
"Grinning Fetish",
"Crystal Sceptre",
"Lead Sceptre",
"Blood Sceptre",
"Royal Sceptre",
"Stabilising Sceptre",
"Abyssal Sceptre",
"Karui Sceptre",
"Tyrant's Sekhem",
"Opal Sceptre",
"Platinum Sceptre",
"Vaal Sceptre",
"Carnal Sceptre",
"Void Sceptre",
"Alternating Sceptre",
"Sambar Sceptre"
};
return Int;
}
@ -143,7 +167,7 @@ namespace PoE_MxFilterGen.generator
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 && !stringList.Contains(line.baseType) && line.baseType != "Serpent Wand")
{
if (!tierBaseExclude.Contains(line.baseType))
{
@ -187,7 +211,7 @@ namespace PoE_MxFilterGen.generator
iBA.Remove(line.baseType);
}
stringList.Add(line.baseType);
}
}
}
foreach (string b in iBA)
@ -215,8 +239,8 @@ namespace PoE_MxFilterGen.generator
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"); }
}
if (iBDexA.Count >= 1) { GenerateFile(section, iBDex, type, "Dex", " SetBackgroundColor 50 69 49 255"); }
}
c = 0;
iBA = new List<string>();
iBIntA = new List<string>();
@ -233,7 +257,7 @@ namespace PoE_MxFilterGen.generator
if (iB == null || iB == "")
iB = "\"\"";
string path = "gen/" + section + ".filter";
File.AppendAllText(path, $"# Section: {section} ({type})({att})" + 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);

View File

@ -33,7 +33,7 @@ namespace PoE_MxFilterGen.generator
if (weapon.iB == null)
weapon.iB = "\"\"";
string path = "gen/" + section + ".filter";
File.AppendAllText(path, string.Format("# Section: {0}", (object)section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, string.Format("#### SECTION: {0}", (object)section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine ?? "", Encoding.UTF8);
File.AppendAllText(path, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " BaseType " + weapon.iB + Environment.NewLine, Encoding.UTF8);
@ -45,6 +45,7 @@ namespace PoE_MxFilterGen.generator
File.AppendAllText(path, " CustomAlertSound \"mx_unique.mp3\"" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " MinimapIcon 0 White Star" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(path, " PlayEffect White", Encoding.UTF8);
File.AppendAllText(path, Environment.NewLine, Encoding.UTF8);
}
}
}

View File

@ -10,6 +10,7 @@ namespace PoE_MxFilterGen.json
{
public class SETTINGS
{
public string league { get; set; }
public int tierValue { get; set; }
public bool tier1HAxe { get; set; }
public bool tier2HAxe { get; set; }
@ -42,6 +43,11 @@ namespace PoE_MxFilterGen.json
class settings
{
internal static string GetLeague()
{
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("settings.json"));
return j.league;
}
public static int GetTierValue()
{
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText("settings.json"));
@ -203,6 +209,7 @@ namespace PoE_MxFilterGen.json
SETTINGS js = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText($@"settings.json"));
SETTINGS se = new SETTINGS
{
league = js.league,
tierValue = js.tierValue,
tier1HAxe = js.tier1HAxe,
tier2HAxe = js.tier2HAxe,

View File

@ -4,6 +4,7 @@ using PoE_MxFilterGen.json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace PoE_MxFilterGen
@ -11,7 +12,7 @@ namespace PoE_MxFilterGen
internal class main
{
private static DateTime dt = DateTime.Now;
public static string version = "10.7.1";
public static string version = "11.0.0";
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";
@ -24,11 +25,19 @@ namespace PoE_MxFilterGen
public static int stotal = 0;
public static bool debug = false;
public static bool install;
public static bool compile = false;
public static string ipath;
public static string docpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
private static void Main(string[] args)
{
if (args.Count() >= 1)
{
if (args[0].Contains("--compile"))
{
compile = true;
}
}
if (!Directory.Exists("data"))
{
Directory.CreateDirectory("data");
@ -50,14 +59,9 @@ namespace PoE_MxFilterGen
msg.CMW("ERROR: settings.json not found! Downloading a template...", true, 3);
web.DownloadFile("https://mxpoe.ovh/mxfilter/mxfiltergen_settings.json", "settings.json");
}
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("mxfiltergen_var.json")).league;
main.league = settings.GetLeague();
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);
@ -80,10 +84,18 @@ namespace PoE_MxFilterGen
web.SaveString(main.api + "itemoverview?league=" + main.league + "&type=DivinationCard&language=en", "data/ninja.card.json");
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();
web.SaveString(main.api + "itemoverview?league=" + main.league + "&type=BaseType&language=en", "data/ninja.base.json");
foreach (string filter in structures.Filters())
{
if(!Directory.Exists($@"out\{filter}")) { Directory.CreateDirectory($@"out\{filter}"); }
if (Directory.Exists($@"out\{filter}"))
{
var fout = Directory.GetFiles($@"out\{filter}");
foreach (var f in fout)
{
File.Delete(f);
}
}
string str = "MxFilter";
int sc = structures.Structures().Length;
msg.CMW(string.Format("Generating the {0} filter using {1} source(s)...", filter, sc), true, 1);
@ -120,81 +132,94 @@ namespace PoE_MxFilterGen
ipath = settings.GetPath();
List<string> tierBaseInclude = settings.GetTierBaseInclude();
List<string> tierBaseExclude = settings.GetTierBaseExclude();
switch (structure)
if (section.Contains("(GEN)"))
{
case "DIVINATION CARD (GEN)":
card.Gen(section, cardValue);
break;
case "EXPENSIVE UNIQUE (GEN) (Accessories)":
accessory.Gen(section, uniqueValue);
break;
case "EXPENSIVE UNIQUE (GEN) (Armours)":
armour.Gen(section, uniqueValue);
break;
case "EXPENSIVE UNIQUE (GEN) (Weapons)":
weapon.Gen(section, uniqueValue);
break;
case "FOSSIL (GEN)":
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, tierBaseInclude, tierBaseExclude);
break;
}
if (!compile)
{
switch (structure)
{
case "DIVINATIONCARD(GEN)":
card.Gen(section, cardValue);
break;
case "EXPENSIVEUNIQUE(GEN)(Accessories)":
accessory.Gen(section, uniqueValue);
break;
case "EXPENSIVEUNIQUE(GEN)(Armours)":
armour.Gen(section, uniqueValue);
break;
case "EXPENSIVEUNIQUE(GEN)(Weapons)":
weapon.Gen(section, uniqueValue);
break;
case "FOSSIL(GEN)":
fossil.Gen(section, fossilValue);
break;
case "Tiers(GEN)":
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;
}
}
} else
{
compiler.section.Compile(section, filter);
}
}
msg.CMW("Creating the final filter...", true, 1);
string outp = "out/" + str + "_" + filter + ".filter";
////////// Splash //////////
File.AppendAllText(outp, $"#### Filson - PoE Item Filter JSON Parsing - MxFilterGen v{main.version}{Environment.NewLine}");
File.AppendAllText(outp, $"#### Filson and MxFilterGen are developped by mikx.{Environment.NewLine}");
File.AppendAllText(outp, $"#### MxGit: https://mxgit.ovh/mikx/PoE-MxFilterGen{Environment.NewLine}");
File.AppendAllText(outp, $"#### MxPoE: https://mxpoe.ovh/{Environment.NewLine}");
File.AppendAllText(outp, $"#### Contact: mikx@mxpoe.ovh / http://discord.mxg.ovh{Environment.NewLine}");
File.AppendAllText(outp, $"{Environment.NewLine}");
File.AppendAllText(outp, $"#### SECTIONS{Environment.NewLine}");
foreach (var s in structures.Structures())
{
File.AppendAllText(outp, $"# {s}{Environment.NewLine}");
}
File.AppendAllText(outp, $"{Environment.NewLine}");
foreach (var structure in structures.Structures())
{
switch (structure)
{
case "DIVINATION CARD (GEN)":
case "DIVINATIONCARD(GEN)":
File.AppendAllText("out/" + str + "_" + filter + ".filter", File.ReadAllText(string.Format("gen/" + structure + ".filter")));
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
break;
case "EXPENSIVE UNIQUE (GEN) (Accessories)":
case "EXPENSIVEUNIQUE(GEN)(Accessories)":
File.AppendAllText("out/" + str + "_" + filter + ".filter", File.ReadAllText(string.Format("gen/" + structure + ".filter")));
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
break;
case "EXPENSIVE UNIQUE (GEN) (Armours)":
case "EXPENSIVEUNIQUE(GEN)(Armours)":
File.AppendAllText("out/" + str + "_" + filter + ".filter", File.ReadAllText(string.Format("gen/" + structure + ".filter")));
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
break;
case "EXPENSIVE UNIQUE (GEN) (Weapons)":
case "EXPENSIVEUNIQUE(GEN)(Weapons)":
File.AppendAllText("out/" + str + "_" + filter + ".filter", File.ReadAllText(string.Format("gen/" + structure + ".filter")));
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
break;
case "FOSSIL (GEN)":
case "FOSSIL(GEN)":
File.AppendAllText("out/" + str + "_" + filter + ".filter", File.ReadAllText(string.Format("gen/" + structure + ".filter")));
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
break;
case "Tiers (DATA)":
case "Tiers(GEN)":
File.AppendAllText("out/" + str + "_" + filter + ".filter", File.ReadAllText(string.Format("gen/" + structure + ".filter")));
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
break;
case "Tiers - Caster (DATA)":
File.AppendAllText("out/" + str + "_" + filter + ".filter", File.ReadAllText(string.Format("gen/" + structure + ".filter")));
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
break;
default:
File.AppendAllText("out/" + str + "_" + filter + ".filter", string.Format("# Section: {0}", (object)structure) + Environment.NewLine);
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
File.AppendAllText("out/" + str + "_" + filter + ".filter", File.ReadAllText(string.Format("structure/" + filter + "/" + structure + ".filter")));
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
File.AppendAllText("out/" + str + "_" + filter + ".filter", string.Format("#### SECTION: {0}", (object)structure) + Environment.NewLine);
File.AppendAllText("out/" + str + "_" + filter + ".filter", File.ReadAllText(string.Format("out/" + filter + "/" + structure + ".filter")));
File.AppendAllText("out/" + str + "_" + filter + ".filter", Environment.NewLine ?? "");
break;
}
}
main.ftotal = 0;
main.fprog = 0;
main.CleanDir();
//main.CleanDir();
CurrencyValueOut();
}
if (debug)
@ -251,55 +276,55 @@ namespace PoE_MxFilterGen
if (currencyTypeName == "Divine Orb")
{
string fc = line.chaosEquivalent.ToString();
File.WriteAllText("out/divine.txt", fc);
File.WriteAllText("out/Market/divine.txt", fc);
}
if (currencyTypeName == "Exalted Orb")
{
string fc = line.chaosEquivalent.ToString();
File.WriteAllText("out/exalted.txt", fc);
File.WriteAllText("out/Market/exalted.txt", fc);
}
if (currencyTypeName == "Orb of Annulment")
{
string fc = line.chaosEquivalent.ToString();
File.WriteAllText("out/annulment.txt", fc);
File.WriteAllText("out/Market/annulment.txt", fc);
}
if (currencyTypeName == "Orb of Alteration")
{
string fc = line.chaosEquivalent.ToString();
File.WriteAllText("out/alteration.txt", fc);
File.WriteAllText("out/Market/alteration.txt", fc);
}
if (currencyTypeName == "Orb of Fusing")
{
string fc = line.chaosEquivalent.ToString();
File.WriteAllText("out/fusing.txt", fc);
File.WriteAllText("out/Market/fusing.txt", fc);
}
if (currencyTypeName == "Chromatic Orb")
{
string fc = line.chaosEquivalent.ToString();
File.WriteAllText("out/chromatic.txt", fc);
File.WriteAllText("out/Market/chromatic.txt", fc);
}
if (currencyTypeName == "Jeweller's Orb")
{
string fc = line.chaosEquivalent.ToString();
File.WriteAllText("out/jeweller.txt", fc);
File.WriteAllText("out/Market/jeweller.txt", fc);
}
if (currencyTypeName == "Orb of Alchemy")
{
string fc = line.chaosEquivalent.ToString();
File.WriteAllText("out/alchemy.txt", fc);
File.WriteAllText("out/Market/alchemy.txt", fc);
}
if (currencyTypeName == "Cartographer's Chisel")
{
string fc = line.chaosEquivalent.ToString();
File.WriteAllText("out/chisel.txt", fc);
File.WriteAllText("out/Market/chisel.txt", fc);
}
}
}
@ -310,14 +335,20 @@ namespace PoE_MxFilterGen
DirectoryInfo directoryInfo2 = new DirectoryInfo("gen");
foreach (FileSystemInfo file in directoryInfo1.GetFiles())
file.Delete();
foreach (FileSystemInfo file in directoryInfo2.GetFiles())
file.Delete();
if(!compile)
{
foreach (FileSystemInfo file in directoryInfo2.GetFiles())
file.Delete();
}
}
public static void CleanDir()
{
foreach (FileSystemInfo file in new DirectoryInfo("gen").GetFiles())
file.Delete();
if (!compile)
{
foreach (FileSystemInfo file in new DirectoryInfo("gen").GetFiles())
file.Delete();
}
}
private static void AutoUpdater_ApplicationExitEvent() => Environment.Exit(-1);

View File

@ -21,26 +21,26 @@ namespace PoE_MxFilterGen
{
string[] Structures = new string[] {
"LEAGUE",
"FOSSIL (GEN)",
"FOSSIL(GEN)",
"FOSSIL",
"MISC",
"ESSENCE",
"SKILL GEM",
"FLASK",
"SKILLGEM",
"MAPS",
"JEWEL",
"DIVINATION CARD",
"DIVINATION CARD (GEN)",
"EXPENSIVE UNIQUE (GEN) (Armours)",
"EXPENSIVE UNIQUE (GEN) (Weapons)",
"JEWEL",
"DIVINATIONCARD(GEN)",
"DIVINATIONCARD",
"EXPENSIVEUNIQUE(GEN)(Armours)",
"EXPENSIVEUNIQUE(GEN)(Weapons)",
"CURRENCY",
"INFLUENCED",
"ACCESSORIES",
"Tiers (DATA)",
"GEAR BY SOCKET",
"GEAR BY QUALITY",
"ACCESSORIES",
"Tiers(GEN)",
"GEARBYSOCKET",
"GEARBYQUALITY",
"LEVELING",
"RECIPES",
"RECIPES",
"FLASK",
"HIDE",
};
return Structures;