commit 3f10507909e3d4cf4c363e03c37d294a92f0a585 Author: mikx Date: Fri Nov 16 18:46:09 2018 -0500 commit from mxgit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6217e6c --- /dev/null +++ b/.gitignore @@ -0,0 +1,315 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# TypeScript v1 declaration files +typings/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..67cdf1b --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 WoW + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/MxWs.sln b/MxWs.sln new file mode 100644 index 0000000..a95244e --- /dev/null +++ b/MxWs.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.13 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MxWs", "MxWs\MxWs.csproj", "{5ED883B0-EE6B-4E37-9FBA-8BD70C91B610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5ED883B0-EE6B-4E37-9FBA-8BD70C91B610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5ED883B0-EE6B-4E37-9FBA-8BD70C91B610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5ED883B0-EE6B-4E37-9FBA-8BD70C91B610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5ED883B0-EE6B-4E37-9FBA-8BD70C91B610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/MxWs/App.config b/MxWs/App.config new file mode 100644 index 0000000..2e6d720 --- /dev/null +++ b/MxWs/App.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/MxWs/JSON/AHDump.cs b/MxWs/JSON/AHDump.cs new file mode 100644 index 0000000..426ede5 --- /dev/null +++ b/MxWs/JSON/AHDump.cs @@ -0,0 +1,102 @@ +//// MxWs +//// 3rd Gen MxW Server +//// BY MIKX +//// https://git.mikx.xyz/wow/MxWs +//// https://wow.mikx.xyz +//// Licensed under the Apache License 2.0 + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MxWs.JSON +{ + class AHDump + { + public class Realm + { + public string name { get; set; } + public string slug { get; set; } + } + + public class Auction + { + public Int64 auc { get; set; } + public Int64 item { get; set; } + public string owner { get; set; } + public string ownerRealm { get; set; } + public Int64 bid { get; set; } + public Int64 buyout { get; set; } + public int quantity { get; set; } + public string timeLeft { get; set; } + public int rand { get; set; } + public Int64 seed { get; set; } + public int context { get; set; } + } + + public class UID + { + public Int64 auc { get; set; } + public Int64 item { get; set; } + public Int64 buyout { get; set; } + } + + public class RootObject + { + public List realms { get; set; } + public List auctions { get; set; } + public List uid { get; set; } + } + + public static DataSet aucds = new DataSet(); + + public static void GenTable() + { + DataSet ds = JsonConvert.DeserializeObject(File.ReadAllText(string.Format("{0}_{1}-dump.json", Server.region, Server.realm))); + DataTable table = ds.Tables["auctions"]; + + DataTable auctb = new DataTable("auclist"); + + auctb.Columns.Add(new DataColumn("auc", typeof(Int64))); + auctb.Columns.Add(new DataColumn("item", typeof(Int64))); + auctb.Columns.Add(new DataColumn("owner", typeof(string))); + auctb.Columns.Add(new DataColumn("value", typeof(Int64))); + auctb.Columns.Add(new DataColumn("qty", typeof(int))); + auctb.Columns.Add(new DataColumn("time", typeof(string))); + + foreach (DataRow dr in table.Rows) + { + Int64 buy = Convert.ToInt64(dr["buyout"]); + + if (buy > 0) + { + DataRow nr = auctb.NewRow(); + + nr["auc"] = Convert.ToInt32(dr["auc"]); + nr["item"] = Convert.ToInt32(dr["item"]); + nr["owner"] = dr["owner"]; + nr["qty"] = Convert.ToInt32(dr["quantity"]); + + int qty = Convert.ToInt32(dr["quantity"]); + + if (qty == 1) + { + nr["value"] = buy; + } + else + { + nr["value"] = buy / qty; + } + + auctb.Rows.Add(nr); + } + } + aucds.Tables.Add(auctb); + } + } +} diff --git a/MxWs/JSON/AHUrl.cs b/MxWs/JSON/AHUrl.cs new file mode 100644 index 0000000..f54d3d2 --- /dev/null +++ b/MxWs/JSON/AHUrl.cs @@ -0,0 +1,44 @@ +//// MxWs +//// 3rd Gen MxW Server +//// BY MIKX +//// https://git.mikx.xyz/wow/MxWs +//// https://wow.mikx.xyz +//// Licensed under the Apache License 2.0 + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace MxWs.JSON +{ + class AHUrl + { + public class JSON + { + public string url { get; set; } + public long lastModified { get; set; } + } + + public class RootObject + { + public List files { get; set; } + } + + public static string GetURL(string region, string realm, string api) + { + using (WebClient wc = new WebClient()) + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + var json = wc.DownloadString(@"https://" + Server.region + ".api.battle.net/wow/auction/data/" + Server.realm + "?locale=en_US&apikey=" + Server.settings_apiKey); + RootObject j = JsonConvert.DeserializeObject(json); + return j.files[0].url; + } + } + } +} diff --git a/MxWs/JSON/IndexGen.cs b/MxWs/JSON/IndexGen.cs new file mode 100644 index 0000000..c9c05e9 --- /dev/null +++ b/MxWs/JSON/IndexGen.cs @@ -0,0 +1,151 @@ +using MySql.Data.MySqlClient; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MxWs.JSON +{ + + public class Index + { + public List index { get; set; } + } + + public class RootObject + { + public List Misc { get; set; } + public List Tailoring { get; set; } + public List Skinning { get; set; } + public List Herbalism { get; set; } + public List Mining { get; set; } + public List Fishing { get; set; } + } + + class IndexGen + { + internal static void GenIndex(string dumpid,string index) + { + string did = string.Format("dumpid='{0}'",dumpid); + StringBuilder sb = new StringBuilder("INSERT INTO ah_index (dumpid,itemid,contentid,catid,value) VALUES "); + List Rows = new List(); + List ind = new List(); + + Index ji = JsonConvert.DeserializeObject(File.ReadAllText(index)); + + foreach (var i in ji.index) + { + ind.Add(i); + } + + string duid = Server.dumpID; + //string duid = "nB3qJHOVPH"; + int cid = 1; + int catid = 0; + int itemid = 0; + foreach (var e in ind) + { + RootObject j = JsonConvert.DeserializeObject(File.ReadAllText(string.Format("index_{0}.json",e))); + if(j.Misc.Count > 0) + { + foreach (var d in j.Misc) + { + catid = 1; + itemid = Convert.ToInt32(d); + Rows.Add(string.Format("('{0}','{1}','{2}','{3}','{4}')", duid, itemid, cid, catid, GetItemValue(itemid))); + } + } + + if (j.Tailoring.Count > 0) + { + foreach (var d in j.Tailoring) + { + catid = 2; + itemid = Convert.ToInt32(d); + Rows.Add(string.Format("('{0}','{1}','{2}','{3}','{4}')", duid, itemid, cid, catid, GetItemValue(itemid))); + } + } + + if (j.Skinning.Count > 0) + { + foreach (var d in j.Skinning) + { + catid = 3; + itemid = Convert.ToInt32(d); + Rows.Add(string.Format("('{0}','{1}','{2}','{3}','{4}')", duid, itemid, cid, catid, GetItemValue(itemid))); + } + } + + if (j.Herbalism.Count > 0) + { + foreach (var d in j.Herbalism) + { + catid = 4; + itemid = Convert.ToInt32(d); + Rows.Add(string.Format("('{0}','{1}','{2}','{3}','{4}')", duid, itemid, cid, catid, GetItemValue(itemid))); + } + } + + if (j.Mining.Count > 0) + { + foreach (var d in j.Mining) + { + catid = 5; + itemid = Convert.ToInt32(d); + Rows.Add(string.Format("('{0}','{1}','{2}','{3}','{4}')", duid, itemid, cid, catid, GetItemValue(itemid))); + } + } + + if (j.Fishing.Count > 0) + { + foreach (var d in j.Fishing) + { + catid = 6; + itemid = Convert.ToInt32(d); + Rows.Add(string.Format("('{0}','{1}','{2}','{3}','{4}')", duid, itemid, cid, catid, GetItemValue(itemid))); + } + } + cid = cid + 1; + } + sb.Append(string.Join(",", Rows)); + sb.Append(";"); + Utilities.MSG.CMW(sb.ToString(), true, 1); + InsertIndex(sb.ToString()); + } + + public static int GetItemValue(int id) + { + string d = Server.dumpID; + //string d = "nB3qJHOVPH"; + int v = 0; + + string stm = string.Format("SELECT * FROM ah_items WHERE dumpid='{0}' AND itemid='{1}'",d,id); + MySqlConnection mc = Utilities.DB.ItemDB(); + MySqlCommand cmd = new MySqlCommand(stm, mc); + mc.Open(); + + MySqlDataReader result = cmd.ExecuteReader(); + + if (result.Read()) + { + v = Convert.ToInt32(result["minimum"]); + } + + mc.Close(); + return v; + } + + private static void InsertIndex(string cmd) + { + MySqlConnection mc = Utilities.DB.ItemDB(); + MySqlCommand command = mc.CreateCommand(); + command.CommandText = cmd; + mc.Open(); + command.ExecuteNonQuery(); + mc.Close(); + } + } +} diff --git a/MxWs/JSON/Settings.cs b/MxWs/JSON/Settings.cs new file mode 100644 index 0000000..5c73614 --- /dev/null +++ b/MxWs/JSON/Settings.cs @@ -0,0 +1,48 @@ +//// MxWs +//// 3rd Gen MxW Server +//// BY MIKX +//// https://git.mikx.xyz/wow/MxWs +//// https://wow.mikx.xyz +//// Licensed under the Apache License 2.0 + +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MxWs.JSON +{ + public class SETTINGS + { + public string apikey { get; set; } + public string dbname { get; set; } + public string dbhost { get; set; } + public string dbuser { get; set; } + public string dbpass { get; set; } + public int dump_day { get; set; } + public int dump_hour { get; set; } + } + + class Settings + { + internal static void ReadSettings() + { + SETTINGS j = JsonConvert.DeserializeObject(File.ReadAllText("settings.json")); + Server.settings_apiKey = j.apikey; + Utilities.MSG.CMW(string.Format("APIKey: {0}", j.apikey), true, 1); + Server.settings_dbname = j.dbname; + Utilities.MSG.CMW(string.Format("DB Name: {0}", j.dbname), true, 1); + Server.settings_dbhost = j.dbhost; + Utilities.MSG.CMW(string.Format("DB Host: {0}", j.dbhost), true, 1); + Server.settings_dbuser = j.dbuser; + Utilities.MSG.CMW(string.Format("DB User: {0}", j.dbuser), true, 1); + Server.settings_dbpass = j.dbpass; + + Server.settings_dumpd = j.dump_day; + Server.settings_dumph = j.dump_hour; + } + } +} diff --git a/MxWs/MxWs.csproj b/MxWs/MxWs.csproj new file mode 100644 index 0000000..7a5b9cf --- /dev/null +++ b/MxWs/MxWs.csproj @@ -0,0 +1,87 @@ + + + + + Debug + AnyCPU + {5ED883B0-EE6B-4E37-9FBA-8BD70C91B610} + Exe + MxWs + MxWs + v4.5.2 + 512 + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MySql.Data.6.10.6\lib\net452\MySql.Data.dll + + + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/MxWs/Properties/AssemblyInfo.cs b/MxWs/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c423489 --- /dev/null +++ b/MxWs/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MxWs")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MxWs")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5ed883b0-ee6b-4e37-9fba-8bd70c91b610")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MxWs/Server.cs b/MxWs/Server.cs new file mode 100644 index 0000000..1bb317e --- /dev/null +++ b/MxWs/Server.cs @@ -0,0 +1,161 @@ +//// MxWs +//// 3rd Gen MxW Server +//// BY MIKX +//// https://git.mikx.xyz/wow/MxWs +//// https://wow.mikx.xyz +//// Licensed under the Apache License 2.0 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MxWs +{ + class Server + { + public static string version = ThisAssembly.Git.Commit; + public static bool debug = false; + public static bool serverLoop = true; + public static bool indexBool = false; + + public static string st = "init"; + public static string dumpID = ""; + public static string indexString = ""; + + // Settings Variables + // Values are set by ReadSettings() during "init" state. + public static string settings_apiKey = ""; // Store the Blizzard Dev API Key + public static string settings_dbname = ""; // Store the MySQL Database Name + public static string settings_dbhost = ""; // Store the MySQL Database Host + public static string settings_dbuser = ""; // Store the MySQL Database User + public static string settings_dbpass = ""; // Store the MySQL Database Pass + public static int settings_dumpd; // internal + public static int settings_dumph; // internal + public static string region = ""; + public static string realm = ""; + + public static bool skipDump; + + static void Main(string[] args) + { + //// Main Server Loop + while (serverLoop) + { + // Go to State Logic IF there is args and they contains region & realm OR debug = true + if (args.Length > 0 && args.Contains("--region") && args.Contains("--realm")) + { + // Get the region/realm from the args + if (args.Length > 0) + { + int regi = Array.IndexOf(args, "--region"); + int reai = Array.IndexOf(args, "--realm"); + region = args[regi + 1]; + realm = args[reai + 1]; + } + // Index Arg Logic + if (args.Contains("--index")) + { + indexBool = true; + int ini = Array.IndexOf(args, "--index"); + indexString = args[ini + 1]; + + } + // SkipDump Arg Logic + if (args.Contains("--skipdump")) + { + skipDump = true; + } + //// State Logic + switch (st) + { + // STATE: INIT (Read settings. Check environment.) + case "init": + Utilities.MSG.Splash(); + Utilities.MSG.CMW("Reading settings...",true,1); + JSON.Settings.ReadSettings(); // Read the settings. + Utilities.MSG.CMW("Generating a DumpID...", true, 1); + dumpID = Utilities.Random.GenDumpID(); // Gen a new DumpID and save it to dumpID + + Utilities.MSG.CMW(@"""init"" state done. Moving to ""get_dump"" state.", true, 2); + st = "get_dump"; + //st = "gen_index"; + break; + + case "get_dump": + Utilities.MSG.CMW($"Last dump: D{settings_dumpd} H{settings_dumph} (D{DateTime.Now.Day} H{DateTime.Now.Hour})", true, 1); + if (settings_dumpd != DateTime.Now.Day && !skipDump) + { + if (settings_dumph != DateTime.Now.Hour) + { + DumpLogic(); + } + } else if (settings_dumpd == DateTime.Now.Day && !skipDump) + { + if (settings_dumph != DateTime.Now.Hour) + { + DumpLogic(); + } + } + st = "gen_aucdata"; + break; + + case "gen_aucdata": + Utilities.MSG.CMW("Preparing the auctions data...", true, 1); + JSON.AHDump.GenTable(); // Generate the internal table from the ah dump + Utilities.MSG.CMW("Generating the dump table entry...", true, 1); + Utilities.DB.GenDumpTable(); // Generate the "ah_dump" table data + Utilities.MSG.CMW("Generating the items table...", true, 1); + Utilities.DB.GenItemsTable(); // Generate the "ah_items" table data + Utilities.MSG.CMW("Generating the listing table...", true, 1); + Utilities.DB.GenListingTable(); // Generate the "ah_listing" table data + + if (indexBool) + { + st = "gen_index"; + } else + { + st = "clean"; + } + break; + case "gen_index": + Utilities.MSG.CMW("Generating the index table...", true, 1); + JSON.IndexGen.GenIndex(dumpID, indexString); + st = "clean"; + break; + case "clean": + Utilities.MSG.CMW("Cleaning the tables...", true, 1); + Utilities.DB.CleanDB(); // Clean the database, keeping the current day data. + Utilities.MSG.CMW(string.Format(@"DumpID ""{0}"" done!", dumpID), true, 1); + serverLoop = false; + break; + } + } else + { + // Print how to use the program and turn the loop off. + Utilities.MSG.Splash(); + Utilities.MSG.CMW("USAGE: MxWs.exe --region --realm ", true, 3); + Utilities.MSG.CMW("Exemple: MxWs.exe us stormrage", true, 3); + Utilities.MSG.CMW("Option(s):", true, 3); + Utilities.MSG.CMW("[--index ] Used to generate the index content of my website.", true, 3); + Utilities.MSG.CMW("Press any key to quit...", true, 1); + Console.ReadKey(); + serverLoop = false; + } + } + } + + private static void DumpLogic() + { + Utilities.MSG.CMW("Requesting latest json url from BNEt...", true, 1); + string jsonurl = JSON.AHUrl.GetURL(region, realm, settings_apiKey); // Get the json url from BNET + Utilities.MSG.CMW(string.Format("URL: {0}", jsonurl), true, 2); + Utilities.MSG.CMW("Downloading the latest AH dump from BNet...", true, 1); + Utilities.Web.DownloadFileNoAsync(jsonurl, string.Format("{0}_{1}-dump.json", region, realm)); // Download the latest ah dump using the obtained url + Utilities.MSG.CMW(@"""get_dump"" state done. Moving to ""gen_aucdata"" state.", true, 2); + settings_dumpd = DateTime.Now.Day; + settings_dumph = DateTime.Now.Hour; + } + } +} diff --git a/MxWs/Utilities/DB.cs b/MxWs/Utilities/DB.cs new file mode 100644 index 0000000..e8053fc --- /dev/null +++ b/MxWs/Utilities/DB.cs @@ -0,0 +1,159 @@ +//// MxWs +//// 3rd Gen MxW Server +//// BY MIKX +//// https://git.mikx.xyz/wow/MxWs +//// https://wow.mikx.xyz +//// Licensed under the Apache License 2.0 + +using MySql.Data.MySqlClient; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MxWs.Utilities +{ + class DB + { + public static MySqlConnection ItemDB() + { + MySqlConnection conn; + string myConnectionString; + + myConnectionString = string.Format("server={0};uid={1};pwd={2};database={3};",Server.settings_dbhost, Server.settings_dbuser,Server.settings_dbpass,Server.settings_dbname); + conn = new MySqlConnection(); + conn.ConnectionString = myConnectionString; + return conn; + } + + public static void GenDumpTable() + { + string d = Server.dumpID; + int ac = JSON.AHDump.aucds.Tables[0].Select("item is not null").Length; + + MySqlConnection mc = ItemDB(); + MySqlCommand command = mc.CreateCommand(); + command.CommandText = string.Format("INSERT INTO ah_dump (dumpid,region,realm,year,month,day,hour,quantity) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", d, Server.region, Server.realm, DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, ac); + mc.Open(); + command.ExecuteNonQuery(); + mc.Close(); + } + + public static void GenItemsTable() + { + string d = Server.dumpID; + + string stm = "SELECT * FROM items"; + MySqlConnection mc = ItemDB(); + MySqlCommand cmd = new MySqlCommand(stm, mc); + mc.Open(); + + DataTable data = new DataTable(); + data.Load(cmd.ExecuteReader()); + + using (MySqlConnection mcc = ItemDB()) + { + StringBuilder sCommand = new StringBuilder("INSERT INTO ah_items (dumpid,itemid,maximum,median,minimum,quantity) VALUES "); + List Rows = new List(); + DataRow[] result = JSON.AHDump.aucds.Tables["auclist"].Select("item is not null"); + foreach (DataRow row in data.Rows) + { + int i = Convert.ToInt32(row["id"]); + int ie = JSON.AHDump.aucds.Tables[0].Select(string.Format("item = '{0}'", i)).Length; + if (ie >= 1) + { + Int64 median = Convert.ToInt64(JSON.AHDump.aucds.Tables["auclist"].Compute("AVG(value)", string.Format("item = '{0}'", i))); + Int64 maximum = Convert.ToInt64(JSON.AHDump.aucds.Tables["auclist"].Compute("MAX(value)", string.Format("item = '{0}'", i))); + Int64 minimum = Convert.ToInt64(JSON.AHDump.aucds.Tables["auclist"].Compute("MIN(value)", string.Format("item = '{0}'", i))); + int qty = JSON.AHDump.aucds.Tables["auclist"].Select(string.Format("item = '{0}'", i)).Length; + Rows.Add(string.Format("('{0}','{1}','{2}','{3}','{4}','{5}')", d, i, maximum, median, minimum, qty)); + } + } + sCommand.Append(string.Join(",", Rows)); + sCommand.Append(";"); + mcc.Open(); + using (MySqlCommand myCmd = new MySqlCommand(sCommand.ToString(), mcc)) + { + myCmd.CommandType = CommandType.Text; + myCmd.ExecuteNonQuery(); + } + } + } + + public static void GenListingTable() + { + string d = Server.dumpID; + + using (MySqlConnection mcc = ItemDB()) + { + StringBuilder sCommand = new StringBuilder("INSERT INTO ah_listing (dumpid,itemid,owner,quantity,uvalue,tvalue) VALUES "); + List Rows = new List(); + DataRow[] result = JSON.AHDump.aucds.Tables["auclist"].Select("item is not null"); + foreach (DataRow alr in result) + { + int i = Convert.ToInt32(alr["item"]); + string owner = alr["owner"].ToString(); + int quantity = Convert.ToInt32(alr["qty"]); + Int64 uvalue = Convert.ToInt64(alr["value"]); + Int64 tvalue = Convert.ToInt64(alr["value"]) * Convert.ToInt64(alr["qty"]); + Rows.Add(string.Format("('{0}','{1}','{2}','{3}','{4}','{5}')", d, i, owner, quantity, uvalue, tvalue)); + } + sCommand.Append(string.Join(",", Rows)); + sCommand.Append(";"); + mcc.Open(); + using (MySqlCommand myCmd = new MySqlCommand(sCommand.ToString(), mcc)) + { + myCmd.CommandType = CommandType.Text; + myCmd.ExecuteNonQuery(); + } + } + } + + public static void CleanDB() + { + int day = DateTime.Now.Day; + + string stm = string.Format("SELECT * FROM ah_dump WHERE day <> {0}", day); + MySqlConnection mc = ItemDB(); + MySqlCommand cmd = new MySqlCommand(stm, mc); + mc.Open(); + + MySqlDataReader result = cmd.ExecuteReader(); + + while (result.Read()) + { + string did = result["dumpid"].ToString(); + + string stm2 = string.Format("DELETE FROM ah_items WHERE dumpid='{0}'", did); + MySqlConnection mc2 = ItemDB(); + MySqlCommand cmd2 = new MySqlCommand(stm2, mc2); + mc2.Open(); + cmd2.ExecuteNonQuery(); + mc2.Close(); + + string stm3 = string.Format("DELETE FROM ah_listing WHERE dumpid='{0}'", did); + MySqlConnection mc3 = ItemDB(); + MySqlCommand cmd3 = new MySqlCommand(stm3, mc3); + mc3.Open(); + cmd3.ExecuteNonQuery(); + mc3.Close(); + + string stm4 = string.Format("DELETE FROM ah_dump WHERE dumpid='{0}'", did); + MySqlConnection mc4 = ItemDB(); + MySqlCommand cmd4 = new MySqlCommand(stm4, mc4); + mc4.Open(); + cmd4.ExecuteNonQuery(); + mc4.Close(); + + string stm5 = string.Format("DELETE FROM ah_index WHERE dumpid='{0}'", did); + MySqlConnection mc5 = ItemDB(); + MySqlCommand cmd5 = new MySqlCommand(stm5, mc5); + mc5.Open(); + cmd5.ExecuteNonQuery(); + mc5.Close(); + } + } + } +} diff --git a/MxWs/Utilities/IO.cs b/MxWs/Utilities/IO.cs new file mode 100644 index 0000000..1223de7 --- /dev/null +++ b/MxWs/Utilities/IO.cs @@ -0,0 +1,28 @@ +//// MxWs +//// 3rd Gen MxW Server +//// BY MIKX +//// https://git.mikx.xyz/wow/MxWs +//// https://wow.mikx.xyz +//// Licensed under the Apache License 2.0 + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MxWs.Utilities +{ + class IO + { + public static void CheckDir(string path) + { + if (!Directory.Exists(path)) + { + Utilities.MSG.CMW(string.Format("[IO] Directory {0} not found. Creating...",path), true, 3); + Directory.CreateDirectory(path); + } + } + } +} diff --git a/MxWs/Utilities/MSG.cs b/MxWs/Utilities/MSG.cs new file mode 100644 index 0000000..afcb99a --- /dev/null +++ b/MxWs/Utilities/MSG.cs @@ -0,0 +1,165 @@ +//// MxWs +//// 3rd Gen MxW Server +//// BY MIKX +//// https://git.mikx.xyz/wow/MxWs +//// https://wow.mikx.xyz +//// Licensed under the Apache License 2.0 + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MxWs.Utilities +{ + class MSG + { + public static void CM(string msg, bool time, int color) + { + string seconds = ""; + string minutes = ""; + string hours = ""; + if (DateTime.Now.Second < 10) + { + seconds = String.Format("0{0}", DateTime.Now.Second); + } + else + { + seconds = DateTime.Now.Second.ToString(); + } + + if (DateTime.Now.Minute < 10) + { + minutes = String.Format("0{0}", DateTime.Now.Minute); + } + else + { + minutes = DateTime.Now.Minute.ToString(); + } + + if (DateTime.Now.Hour < 10) + { + hours = String.Format("0{0}", DateTime.Now.Hour); + } + else + { + hours = DateTime.Now.Hour.ToString(); + } + + string date = String.Format("{0}:{1}:{2}", hours, minutes, seconds); + + + //color switch + ConsoleColor cc = ConsoleColor.White; + switch (color) + { + case 0: + //nothing + break; + case 1: + cc = ConsoleColor.Cyan; + break; + case 2: + cc = ConsoleColor.Green; + break; + case 3: + cc = ConsoleColor.Red; + break; + } + + if (time) + { + Console.ForegroundColor = cc; + Console.WriteLine(String.Format("[{0}] {1}", date, msg)); + } + else + { + Console.ForegroundColor = cc; + Console.WriteLine(String.Format("{0}", msg)); + } + + Console.ForegroundColor = ConsoleColor.White; + } + + public static void CMW(string msg, bool time, int color) + { + string seconds = ""; + string minutes = ""; + string hours = ""; + if (DateTime.Now.Second < 10) + { + seconds = String.Format("0{0}", DateTime.Now.Second); + } + else + { + seconds = DateTime.Now.Second.ToString(); + } + + if (DateTime.Now.Minute < 10) + { + minutes = String.Format("0{0}", DateTime.Now.Minute); + } + else + { + minutes = DateTime.Now.Minute.ToString(); + } + + if (DateTime.Now.Hour < 10) + { + hours = String.Format("0{0}", DateTime.Now.Hour); + } + else + { + hours = DateTime.Now.Hour.ToString(); + } + + string date = String.Format("{0}:{1}:{2}", hours, minutes, seconds); + + File.AppendAllText("mxws.logs", String.Format("[{0}] {1}", date, msg) + Environment.NewLine); + + //color switch + ConsoleColor cc = ConsoleColor.White; + switch (color) + { + case 0: + //nothing + break; + case 1: + cc = ConsoleColor.Cyan; + break; + case 2: + cc = ConsoleColor.Green; + break; + case 3: + cc = ConsoleColor.Red; + break; + } + + if (time) + { + Console.ForegroundColor = cc; + Console.WriteLine(String.Format("[{0}] {1}", date, msg)); + } + else + { + Console.ForegroundColor = cc; + Console.WriteLine(String.Format("")); + } + + Console.ForegroundColor = ConsoleColor.White; + } + + public static void Splash() + { + Console.ForegroundColor = ConsoleColor.Cyan; + Console.WriteLine(""); + Console.WriteLine("#### MxWs"); + Console.WriteLine(string.Format("#### VERSION: {0}", Server.version)); + Console.WriteLine("#### DEV: mikx"); + Console.WriteLine(""); + Console.ForegroundColor = ConsoleColor.White; + } + } +} diff --git a/MxWs/Utilities/Random.cs b/MxWs/Utilities/Random.cs new file mode 100644 index 0000000..cd002a4 --- /dev/null +++ b/MxWs/Utilities/Random.cs @@ -0,0 +1,40 @@ +//// MxWs +//// 3rd Gen MxW Server +//// BY MIKX +//// https://git.mikx.xyz/wow/MxWs +//// https://wow.mikx.xyz +//// Licensed under the Apache License 2.0 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace MxWs.Utilities +{ + class Random + { + public static string GenDumpID() + { + int maxSize = 10; + char[] chars = new char[62]; + chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray(); + byte[] data = new byte[1]; + using (RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider()) + { + crypto.GetNonZeroBytes(data); + data = new byte[maxSize]; + crypto.GetNonZeroBytes(data); + } + StringBuilder result = new StringBuilder(maxSize); + foreach (byte b in data) + { + result.Append(chars[b % (chars.Length)]); + } + MSG.CMW(string.Format("DumpID: {0}", result.ToString()), true, 1); + return result.ToString(); + } + } +} diff --git a/MxWs/Utilities/Web.cs b/MxWs/Utilities/Web.cs new file mode 100644 index 0000000..7b565f5 --- /dev/null +++ b/MxWs/Utilities/Web.cs @@ -0,0 +1,27 @@ +//// MxWs +//// 3rd Gen MxW Server +//// BY MIKX +//// https://git.mikx.xyz/wow/MxWs +//// https://wow.mikx.xyz +//// Licensed under the Apache License 2.0 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; + +namespace MxWs.Utilities +{ + class Web + { + public static void DownloadFileNoAsync(string url, string file) + { + using (WebClient wc = new WebClient()) + { + wc.DownloadFile(url, file); + } + } + } +} diff --git a/MxWs/packages.config b/MxWs/packages.config new file mode 100644 index 0000000..daaa430 --- /dev/null +++ b/MxWs/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SETTINGS/settings.json b/SETTINGS/settings.json new file mode 100644 index 0000000..d744c01 --- /dev/null +++ b/SETTINGS/settings.json @@ -0,0 +1,7 @@ +{ +"apikey": "", +"dbname": "", +"dbhost": "", +"dbuser": "", +"dbpass": "" +} diff --git a/SQL/ah_dump.sql b/SQL/ah_dump.sql new file mode 100644 index 0000000..e22e9ce --- /dev/null +++ b/SQL/ah_dump.sql @@ -0,0 +1,24 @@ +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET NAMES utf8 */; +/*!50503 SET NAMES utf8mb4 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE TABLE IF NOT EXISTS `ah_dump` ( + `dumpid` varchar(50) NOT NULL, + `region` varchar(50) NOT NULL, + `realm` varchar(50) NOT NULL, + `year` int(4) NOT NULL, + `month` int(2) NOT NULL, + `day` int(2) NOT NULL, + `hour` int(2) NOT NULL, + `quantity` int(10) NOT NULL, + PRIMARY KEY (`dumpid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +/*!40000 ALTER TABLE `ah_dump` DISABLE KEYS */; +/*!40000 ALTER TABLE `ah_dump` ENABLE KEYS */; + +/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; +/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/SQL/ah_items.sql b/SQL/ah_items.sql new file mode 100644 index 0000000..7e1d39e --- /dev/null +++ b/SQL/ah_items.sql @@ -0,0 +1,21 @@ +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET NAMES utf8 */; +/*!50503 SET NAMES utf8mb4 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE TABLE IF NOT EXISTS `ah_items` ( + `dumpid` varchar(50) NOT NULL, + `itemid` int(8) NOT NULL, + `maximum` int(10) NOT NULL, + `median` int(10) NOT NULL, + `minimum` int(10) NOT NULL, + `quantity` int(10) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +/*!40000 ALTER TABLE `ah_items` DISABLE KEYS */; +/*!40000 ALTER TABLE `ah_items` ENABLE KEYS */; + +/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; +/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/SQL/ah_listing.sql b/SQL/ah_listing.sql new file mode 100644 index 0000000..7e0a0b6 --- /dev/null +++ b/SQL/ah_listing.sql @@ -0,0 +1,21 @@ +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET NAMES utf8 */; +/*!50503 SET NAMES utf8mb4 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; + +CREATE TABLE IF NOT EXISTS `ah_listing` ( + `dumpid` varchar(50) NOT NULL, + `itemid` int(11) NOT NULL, + `owner` varchar(50) NOT NULL, + `quantity` int(3) NOT NULL, + `uvalue` int(7) NOT NULL, + `tvalue` int(7) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +/*!40000 ALTER TABLE `ah_listing` DISABLE KEYS */; +/*!40000 ALTER TABLE `ah_listing` ENABLE KEYS */; + +/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; +/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;