New API + Settings Tweaks + URL Changes

This commit is contained in:
mikx 2020-07-01 12:25:13 -04:00
parent 8751fd185a
commit b729413646
10 changed files with 286 additions and 24 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>
</configuration>

View File

@ -9,11 +9,12 @@
<OutputType>Exe</OutputType>
<RootNamespace>PoE_MxFilterGen</RootNamespace>
<AssemblyName>mxfiltergen</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -54,10 +55,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="generator\fossil.cs" />
<Compile Include="json\settings.cs" />
<Compile Include="main.cs" />
<Compile Include="msg.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TierGen.cs" />
<Compile Include="web.cs" />
</ItemGroup>
<ItemGroup>

122
PoE-MxFilterGen/TierGen.cs Normal file
View File

@ -0,0 +1,122 @@
using PoE_MxFilterGen.json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PoE_MxFilterGen
{
class TierGen
{
private static string iB;
public static void Gen(string section, string api, string league, int minValue)
{
string giturl = settings.GetGIT();
var js = web.ReadString($@"{giturl}/PoE-MxFilter-Structure/master/Tiers.txt");
if (iB == null) { iB = @""""""; }
string fn = @"gen\" + section + ".filter";
File.AppendAllText(fn, string.Format("# Section: {0}", section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, $" BaseType {js}" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" HasExplicitMod ""Veiled""" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBorderColor 112 255 112 255" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetFontSize 40" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " MinimapIcon 1 Green Star" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " PlayEffect Green" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" CustomAlertSound ""mx_tier.mp3""" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, $" BaseType {js}" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " FracturedItem True" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBorderColor 112 255 112 255" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetFontSize 40" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " MinimapIcon 1 Green Star" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " PlayEffect Green" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" CustomAlertSound ""mx_tier.mp3""" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, $" BaseType {js}" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SynthesisedItem True" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBorderColor 112 255 112 255" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetFontSize 40" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " MinimapIcon 1 Green Star" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " PlayEffect Green" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" CustomAlertSound ""mx_tier.mp3""" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, $" BaseType {js}" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " Identified True" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBorderColor 0 0 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetFontSize 35" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" CustomAlertSound ""mx_tier.mp3""" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, $" BaseType {js}" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " Corrupted True" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBorderColor 210 0 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetFontSize 35" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" CustomAlertSound ""mx_tier.mp3""" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, $" BaseType {js}" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " ItemLevel >= 75" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " ItemLevel <= 100" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBorderColor 184 218 242" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetFontSize 40" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" CustomAlertSound ""mx_tier.mp3""" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, $" BaseType {js}" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " ItemLevel >= 60" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " ItemLevel <= 74" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBorderColor 222 118 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetFontSize 40" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" CustomAlertSound ""mx_tier.mp3""" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, $" BaseType {js}" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " ItemLevel >= 60" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " ItemLevel <= 74" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " Rarity = Rare" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetTextColor 255 215 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBackgroundColor 54 54 54" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBorderColor 222 118 0" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetFontSize 40" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" CustomAlertSound ""mx_tier.mp3""" + Environment.NewLine, Encoding.UTF8);
}
}
}

View File

@ -0,0 +1,122 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace FOSSIL__GEN_
{
public class Sparkline
{
public List<double> data { get; set; }
public double totalChange { get; set; }
}
public class LowConfidenceSparkline
{
public List<double> data { get; set; }
public double totalChange { get; set; }
}
public class ExplicitModifier
{
public string text { get; set; }
public bool optional { get; set; }
}
public class Line
{
public int id { get; set; }
public string name { get; set; }
public string icon { get; set; }
public int mapTier { get; set; }
public int levelRequired { get; set; }
public object baseType { get; set; }
public int stackSize { get; set; }
public object variant { get; set; }
public object prophecyText { get; set; }
public object artFilename { get; set; }
public int links { get; set; }
public int itemClass { get; set; }
public Sparkline sparkline { get; set; }
public LowConfidenceSparkline lowConfidenceSparkline { get; set; }
public List<object> implicitModifiers { get; set; }
public List<ExplicitModifier> explicitModifiers { get; set; }
public string flavourText { get; set; }
public bool corrupted { get; set; }
public int gemLevel { get; set; }
public int gemQuality { get; set; }
public string itemType { get; set; }
public double chaosValue { get; set; }
public double exaltedValue { get; set; }
public int count { get; set; }
public string detailsId { get; set; }
public object tradeInfo { get; set; }
public object mapRegion { get; set; }
}
public class Translations
{
}
public class Language
{
public string name { get; set; }
public Translations translations { get; set; }
}
public class RootFossil
{
public List<Line> lines { get; set; }
public Language language { get; set; }
}
public class fossil
{
private static string iB;
public static void Gen(string section, string api, string league, int minValue)
{
List<string> itemBase = new List<string>();
var RootFossil = JsonConvert.DeserializeObject<List<RootFossil>>(File.ReadAllText("data/ninja.fossil.json", Encoding.UTF8));
foreach (var ln in RootFossil)
{
// Check if the item value is equal or superior to the minimum value
foreach (var r in ln.lines)
{
if (r.chaosValue >= 10)
{
if (!itemBase.Contains(r.name))
{
itemBase.Add(r.name);
iB = iB + string.Format(@" ""{0}""", r.name);
}
}
}
}
if (iB == null) { iB = @""""""; }
string fn = @"gen\" + section + ".filter";
File.AppendAllText(fn, string.Format("# Section: {0}", section) + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, "Show" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" Class ""Stackable Currency""" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " BaseType" + iB + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetTextColor 255 165 0 255" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBackgroundColor 255 255 255" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetBorderColor 255 165 0 255" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, " SetFontSize 40" + Environment.NewLine, Encoding.UTF8);
File.AppendAllText(fn, @" CustomAlertSound ""mx_fossil.mp3""", Encoding.UTF8);
}
}
}

View File

@ -17,9 +17,12 @@ namespace PoE_MxFilterGen
{
private static DateTime dt = DateTime.Now;
public static string version = "7.1.0";
public static string version = "8.0.0";
public static string fDate = string.Format("{0}-{1}-{2}", dt.Day, dt.Month, dt.Year);
public static string api = "";
public static string giturl = "https://raw.githubusercontent.com/mikxqc";
public static string section = "";
public static string league = "";
public static string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
@ -32,8 +35,6 @@ namespace PoE_MxFilterGen
public static bool deb = false;
private static string giturl = "";
public class REMVAR
{
public string league { get; set; }
@ -74,16 +75,16 @@ namespace PoE_MxFilterGen
// Get current league from MxD
var ls = web.ReadString("https://raw.githubusercontent.com/mikxqc/PoE-MxFilter-Data/master/json/mxfiltergen_var.json");
REMVAR lj = JsonConvert.DeserializeObject<REMVAR>(ls);
league = lj.league;
league = lj.league;
api = $"https://poe.ninja/api/data/";
msg.CMW(string.Format("GIT: {0}", json.settings.GetGIT()), true, 1);
msg.CMW(string.Format("API: {0}", json.settings.GetAPI()), true, 1);
msg.CMW(string.Format("League: {0}", league), true, 1);
msg.CMW(string.Format("Minimum Value: {0}c", json.settings.GetMinimumValue().ToString()), true, 1);
msg.CMW(string.Format("Verbose: {0}", json.settings.GetVerbose().ToString()), true, 1);
msg.CMW(string.Format("SSF: {0}", json.settings.GetSSF().ToString()), true, 1);
giturl = json.settings.GetGIT();
msg.CMW(string.Format("SSF: {0}", json.settings.GetSSF().ToString()), true, 1);
// Check for updates
string remote_version = web.ReadString(@"https://raw.githubusercontent.com/mikxqc/PoE-MxFilter-Data/master/txt/mxfiltergen_version.txt");
@ -119,18 +120,14 @@ namespace PoE_MxFilterGen
if (File.Exists($@"{path}\My Games\Path of Exile\MxFilter.filter")) { File.Delete($@"{path}\My Games\Path of Exile\MxFilter.filter"); }
// Get latest poe.ninja api
msg.CMW($"Downloading the latest API data from poe.watch...", true, 1);
/*web.SaveString(json.settings.GetAPI() + "GetUniqueArmourOverview?league=" + league, "data/ninja.armour.json");
web.SaveString(json.settings.GetAPI() + "GetUniqueWeaponOverview?league=" + league, "data/ninja.weapon.json");
web.SaveString(json.settings.GetAPI() + "GetUniqueAccessoryOverview?league=" + league, "data/ninja.accessory.json");
web.SaveString(json.settings.GetAPI() + "GetUniqueMapOverview?league=" + league, "data/ninja.map.json");
web.SaveString(json.settings.GetAPI() + "GetDivinationCardsOverview?league=" + league, "data/ninja.card.json"); */
msg.CMW($"Downloading the latest API data from poe.ninja...", true, 1);
web.SaveString(json.settings.GetAPI() + $"get?league={league}&category=armour", "data/poew.armour.json");
web.SaveString(json.settings.GetAPI() + $"get?league={league}&category=weapon", "data/poew.weapon.json");
web.SaveString(json.settings.GetAPI() + $"get?league={league}&category=accessory", "data/poew.accessory.json");
web.SaveString(json.settings.GetAPI() + $"get?league={league}&category=card", "data/poew.card.json");
web.SaveString(json.settings.GetAPI() + $"get?league={league}&category=currency", "data/poew.currency.json");
web.SaveString(api + $"itemoverview?league={league}&type=UniqueArmour&language=en", "data/ninja.armour.json");
web.SaveString(api + $"itemoverview?league={league}&type=UniqueWeapon&language=en", "data/ninja.weapon.json");
web.SaveString(api + $"itemoverview?league={league}&type=UniqueAccessory&language=en", "data/ninja.accessory.json");
web.SaveString(api + $"itemoverview?league={league}&type=DivinationCard&language=en", "data/ninja.card.json");
web.SaveString(api + $"currencyoverview?league={league}&type=Currency&language=en", "data/ninja.currency.json");
web.SaveString(api + $"itemoverview?league={league}&type=Fossil&language=en", "data/ninja.fossil.json");
// Get Theme File(s)
web.DownloadFile($@"{giturl}/PoE-MxFilter-Structure/master/Chancing.json", @"structure\Chancing.json");
@ -282,7 +279,7 @@ namespace PoE_MxFilterGen
Type type = AppDomain.CurrentDomain.GetAssemblies().SelectMany(t => t.GetTypes()).Where(t => String.Equals(t.Name, "Generator", StringComparison.Ordinal)).First();
object o = Activator.CreateInstance(type);
MethodInfo mi = o.GetType().GetMethod("Gen");
Object[] ob = { json.settings.GetSection(), json.settings.GetAPI(), main.league, json.settings.GetMinimumValue() };
Object[] ob = new object[] { json.settings.GetSection(), json.settings.GetAPI(), main.league, json.settings.GetMinimumValue() };
mi.Invoke(o, ob);
}
}

View File

@ -201,7 +201,7 @@ namespace PoE_MxFilterGen
Console.WriteLine("#### MxFilterGen");
Console.WriteLine(string.Format("#### VERSION: {0}",main.version));
Console.WriteLine("#### DEV: mikx");
Console.WriteLine("#### POWERED BY: poe.watch");
Console.WriteLine("#### POWERED BY: poe.ninja");
Console.WriteLine("");
Console.ForegroundColor = ConsoleColor.White;
}

View File

@ -32,3 +32,21 @@ E:\_MxGitHub\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.Co
E:\_MxGitHub\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\mxfiltergen.exe
E:\_MxGitHub\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\mxfiltergen.pdb
E:\_MxGitHub\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csprojAssemblyReference.cache
I:\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csprojAssemblyReference.cache
I:\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.CoreCompileInputs.cache
I:\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\mxfiltergen.exe
I:\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\mxfiltergen.pdb
I:\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\mxfiltergen.exe.config
I:\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\mxfiltergen.exe
I:\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\mxfiltergen.pdb
I:\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\Newtonsoft.Json.xml
I:\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.CopyComplete
I:\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\mxfiltergen.exe.config
I:\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\mxfiltergen.exe
I:\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\mxfiltergen.pdb
I:\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\bin\Debug\Newtonsoft.Json.xml
I:\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csprojAssemblyReference.cache
I:\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.CoreCompileInputs.cache
I:\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\PoE-MxFilterGen.csproj.CopyComplete
I:\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\mxfiltergen.exe
I:\MxGit\PoE-MxFilterGen\PoE-MxFilterGen\obj\Debug\mxfiltergen.pdb