diff --git a/.gitignore b/.gitignore
index bba7b53..0b076ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/target/
/.idea/
+/Output/
diff --git a/pom.xml b/pom.xml
index ee2d012..dd303b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.fi0x.edct
EliteDangerousCarrierTrader
- 1.7.11.9
+ 2.0.0.0
UTF-8
@@ -139,7 +139,7 @@
io.github.Fi0x
JavaLogger
- 1.1.8
+ 1.1.9
org.openjfx
@@ -169,7 +169,7 @@
org.xerial
sqlite-jdbc
- 3.39.4.1
+ 3.40.0.0
org.zeromq
diff --git a/setup.iss b/setup.iss
index d32a769..941ac59 100644
--- a/setup.iss
+++ b/setup.iss
@@ -3,7 +3,7 @@
; TODO: Update Version info
#define MyAppName "Elite Dangerous Carrier Trader"
-#define MyAppVersion "1.7.11.9"
+#define MyAppVersion "2.0.0.0"
#define MyAppPublisher "Fi0x"
#define MyAppURL "https://github.com/Fi0x/EDCT"
#define MyAppExeName "EDCT.exe"
diff --git a/src/main/java/com/fi0x/edct/Main.java b/src/main/java/com/fi0x/edct/Main.java
index dc83287..f934af1 100644
--- a/src/main/java/com/fi0x/edct/Main.java
+++ b/src/main/java/com/fi0x/edct/Main.java
@@ -39,7 +39,7 @@ public class Main
public static File reddit;
public static File discord;
//TODO: Update version information
- public static final String version = "1.7.11.9";//All.GUI.Logic.Hotfix
+ public static final String version = "2.0.0.0";//All.GUI.Logic.Hotfix
public static final VersionType versionType = VersionType.INSTALLER;
public static void main(String[] args)
@@ -181,7 +181,7 @@ private static boolean createFileIfNotExists(File file, boolean isFile)
if(file.createNewFile()) return false;
} catch(IOException e)
{
- Logger.log("Could not create file: " + file, LogName.ERROR, e, 997);
+ Logger.log("Could not create file: " + file, LogName.getError(997), e, 997);
System.exit(997);
}
} else return !file.mkdir();
diff --git a/src/main/java/com/fi0x/edct/gui/controller/Interaction.java b/src/main/java/com/fi0x/edct/gui/controller/Interaction.java
index 44b5aa2..70e6373 100644
--- a/src/main/java/com/fi0x/edct/gui/controller/Interaction.java
+++ b/src/main/java/com/fi0x/edct/gui/controller/Interaction.java
@@ -47,7 +47,7 @@ private void loadDatastorage()
storageController.setInteractionController(this);
} catch(IOException e)
{
- Logger.log("Could not load Datastorage controller", LogName.ERROR, e, 999);
+ Logger.log("Could not load Datastorage controller", LogName.getError(999), e, 999);
return;
}
@@ -64,7 +64,7 @@ private void loadFilters()
filterController = loader.getController();
} catch(IOException e)
{
- Logger.log("Could not load Filters controller", LogName.ERROR, e, 999);
+ Logger.log("Could not load Filters controller", LogName.getError(999), e, 999);
return;
}
diff --git a/src/main/java/com/fi0x/edct/gui/controller/Results.java b/src/main/java/com/fi0x/edct/gui/controller/Results.java
index 51e06ab..f082b81 100644
--- a/src/main/java/com/fi0x/edct/gui/controller/Results.java
+++ b/src/main/java/com/fi0x/edct/gui/controller/Results.java
@@ -67,7 +67,7 @@ private void loadCommodity()
} catch(IOException e)
{
- Logger.log("Could not load Commodity controller", LogName.ERROR, e, 999);
+ Logger.log("Could not load Commodity controller", LogName.getError(999), e, 999);
return;
}
@@ -92,7 +92,7 @@ private void loadStation(boolean isBuying)
}
} catch(IOException e)
{
- Logger.log("Could not load Station controller", LogName.ERROR, e, 999);
+ Logger.log("Could not load Station controller", LogName.getError(999), e, 999);
return;
}
@@ -110,7 +110,7 @@ private void loadDetails()
} catch(IOException e)
{
- Logger.log("Could not load Details controller", LogName.ERROR, e, 999);
+ Logger.log("Could not load Details controller", LogName.getError(999), e, 999);
return;
}
diff --git a/src/main/java/com/fi0x/edct/gui/controller/Station.java b/src/main/java/com/fi0x/edct/gui/controller/Station.java
index 99c3fae..084094f 100644
--- a/src/main/java/com/fi0x/edct/gui/controller/Station.java
+++ b/src/main/java/com/fi0x/edct/gui/controller/Station.java
@@ -89,7 +89,7 @@ public void initialize(URL url, ResourceBundle resourceBundle)
if(text == null)
{
- Logger.log("Something went wrong when creating a reddit String", LogName.ERROR, null, 992);
+ Logger.log("Something went wrong when creating a reddit String", LogName.getError(992), null, 992);
return;
}
@@ -104,7 +104,7 @@ public void initialize(URL url, ResourceBundle resourceBundle)
if(text == null)
{
- Logger.log("Something went wrong when creating a discord String", LogName.ERROR, null, 992);
+ Logger.log("Something went wrong when creating a discord String", LogName.getError(992), null, 992);
return;
}
diff --git a/src/main/java/com/fi0x/edct/gui/visual/MainWindow.java b/src/main/java/com/fi0x/edct/gui/visual/MainWindow.java
index bfc67be..f31c720 100644
--- a/src/main/java/com/fi0x/edct/gui/visual/MainWindow.java
+++ b/src/main/java/com/fi0x/edct/gui/visual/MainWindow.java
@@ -40,7 +40,7 @@ public void start(Stage stage)
root = loader.load();
} catch(IOException e)
{
- Logger.log("Could not load MainWindow controller", LogName.ERROR, e, 999);
+ Logger.log("Could not load MainWindow controller", LogName.getError(999), e, 999);
System.exit(999);
return;
}
@@ -57,7 +57,7 @@ public void start(Stage stage)
progressbar.setStage(primaryStage);
- Logger.log("GUI loaded", LogName.VERBOSE);
+ Logger.log("GUI loaded", LogName.INFO);
Main.updater.start();
}
@@ -96,7 +96,7 @@ private void loadInfo(FXMLLoader parentLoader)
infoController = loader.getController();
} catch(IOException e)
{
- Logger.log("Could not load ProgramInfo controller", LogName.ERROR, e, 999);
+ Logger.log("Could not load ProgramInfo controller", LogName.getError(999), e, 999);
return;
}
@@ -118,7 +118,7 @@ private void loadInteraction(FXMLLoader parentLoader)
interactionController.setMainController(parentLoader.getController());
} catch(IOException e)
{
- Logger.log("Could not load Interaction controller", LogName.ERROR, e, 999);
+ Logger.log("Could not load Interaction controller", LogName.getError(999), e, 999);
System.exit(999);
return;
}
@@ -138,7 +138,7 @@ private void loadResults(FXMLLoader parentLoader)
resultsController.updateResultController(parentLoader.getController());
} catch(IOException e)
{
- Logger.log("Could not load Results controller", LogName.ERROR, e, 999);
+ Logger.log("Could not load Results controller", LogName.getError(999), e, 999);
System.exit(999);
return;
}
diff --git a/src/main/java/com/fi0x/edct/logging/LogName.java b/src/main/java/com/fi0x/edct/logging/LogName.java
index 59a087b..22f5b23 100644
--- a/src/main/java/com/fi0x/edct/logging/LogName.java
+++ b/src/main/java/com/fi0x/edct/logging/LogName.java
@@ -1,9 +1,18 @@
package com.fi0x.edct.logging;
+import com.fi0x.edct.gui.visual.MainWindow;
+import javafx.application.Platform;
+
public enum LogName
{
VERBOSE,
INFO,
WARNING,
- ERROR
+ ERROR;
+
+ public static LogName getError(int errorCode)
+ {
+ Platform.runLater(() -> MainWindow.getInstance().infoController.setError(errorCode));
+ return ERROR;
+ }
}
diff --git a/src/main/java/com/fi0x/edct/logic/NameMap.java b/src/main/java/com/fi0x/edct/logic/NameMap.java
index 50cabdf..f580b8e 100644
--- a/src/main/java/com/fi0x/edct/logic/NameMap.java
+++ b/src/main/java/com/fi0x/edct/logic/NameMap.java
@@ -20,6 +20,7 @@ public class NameMap
put("H.E. Suits", "hazardousenvironmentsuits");
put("Hostages", "hostage");
put("Occupied Escape Pod", "occupiedcryopod");
+ put("Damaged Escape Pod", "damagedescapepod");
put("Skimmer Components", "skimercomponents");
put("Agri-Medicines", "agriculturalmedicines");
put("Guardian Casket", "ancientcasket");
@@ -224,12 +225,16 @@ public class NameMap
add("thargoidtissuesampletype2");
add("thargoidtissuesampletype3");
add("thargoidtissuesampletype4");
+ add("thargoidtissuesampletype5");
+ add("thargoidgeneratortissuesample");
add("unknownartifact");
add("unknownartifact2");
add("unknownartifact3");
add("s6_tissuesample_cells");
add("s6_tissuesample_coenosarc");
add("s_tissuesample_cells");
+ add("ancientrelictg");
+ add("unocuppiedescapepod");
}
};
diff --git a/src/main/java/com/fi0x/edct/logic/cleanup/EDDNCleanup.java b/src/main/java/com/fi0x/edct/logic/cleanup/EDDNCleanup.java
index 645da79..99f4bb5 100644
--- a/src/main/java/com/fi0x/edct/logic/cleanup/EDDNCleanup.java
+++ b/src/main/java/com/fi0x/edct/logic/cleanup/EDDNCleanup.java
@@ -11,6 +11,7 @@
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.Objects;
@@ -99,9 +100,14 @@ public static PADSIZE getStationPad(String inputHTML)
PADSIZE padsize = PADSIZE.NONE;
Element details = HTMLCleanup.getStationDetails(inputHTML);
- if(details == null) return null;
-
- for(Element pair : details.getElementsByClass("itempaircontainer"))
+ if(details == null)
+ return null;
+ Element div = details.getElementsByTag("div").first();
+ if(div == null)
+ return null;
+ Elements pairs = div.getElementsByClass("itempaircontainer");
+
+ for(Element pair : pairs)
{
String pairText = pair.toString().toLowerCase();
if(pairText.contains("landing pad"))
@@ -121,9 +127,14 @@ public static STATIONTYPE getStationType(String inputHTML)
STATIONTYPE type = STATIONTYPE.UNKNOWN;
Element details = HTMLCleanup.getStationDetails(inputHTML);
- if(details == null) return null;
-
- for(Element pair : details.getElementsByClass("itempaircontainer"))
+ if(details == null)
+ return null;
+ Element div = details.getElementsByTag("div").first();
+ if(div == null)
+ return null;
+ Elements pairs = div.getElementsByClass("itempaircontainer");
+
+ for(Element pair : pairs)
{
if(pair.toString().toLowerCase().contains("station type"))
{
@@ -146,7 +157,12 @@ public static double getStarDistance(String inputHTML)
double starDistance = -1;
Element details = HTMLCleanup.getStationDetails(inputHTML);
- if(details == null) return -1;
+ if(details == null)
+ return -1;
+ Element div = details.getElementsByTag("div").first();
+ if(div == null)
+ return -1;
+ Elements pairs = div.getElementsByClass("itempaircontainer");
for(Element pair : details.getElementsByClass("itempaircontainer"))
{
diff --git a/src/main/java/com/fi0x/edct/logic/cleanup/HTMLCleanup.java b/src/main/java/com/fi0x/edct/logic/cleanup/HTMLCleanup.java
index c55ec55..1a273fc 100644
--- a/src/main/java/com/fi0x/edct/logic/cleanup/HTMLCleanup.java
+++ b/src/main/java/com/fi0x/edct/logic/cleanup/HTMLCleanup.java
@@ -10,31 +10,17 @@
public class HTMLCleanup
{
- public static Element getStationDetails(String inputHTML)
- {
- Elements mainconten1s = getStationMaincontent1(inputHTML);
- if(mainconten1s == null || mainconten1s.size() == 0) return null;
-
- Elements mainblocks = Objects.requireNonNull(mainconten1s.first()).getElementsByClass("mainblock");
- if(mainblocks.size() == 0) return null;
-
- for(Element block : mainblocks)
- {
- String blockText = block.toString().toLowerCase();
- if(blockText.contains("class=\"mainblock\"") && (blockText.contains("landing pad") || blockText.contains("station type") || blockText.contains("href=\"/station/")))
- return block;
- }
- return null;
- }
-
public static ArrayList getStationTrades(String inputHTML)
{
+ //TODO: Adjust for new inara
ArrayList stationTrades = new ArrayList<>();
- Elements mainconten1s = getStationMaincontent1(inputHTML);
- if(mainconten1s == null || mainconten1s.size() == 0) return null;
+ Document doc = Jsoup.parse(inputHTML);
+
+ Element mainconten1s = doc.getElementsByClass("maincontainer").first();
- Elements mainblocks = Objects.requireNonNull(mainconten1s.first()).getElementsByClass("mainblock maintable");
+ assert mainconten1s != null;
+ Elements mainblocks = mainconten1s.getElementsByClass("mainblock maintable");
if(mainblocks.size() == 0) return null;
Elements tables = Objects.requireNonNull(mainblocks.first()).getElementsByTag("table");
@@ -54,22 +40,49 @@ public static ArrayList getStationTrades(String inputHTML)
return stationTrades;
}
- private static Elements getStationMaincontent1(String inputHTML)
+ public static Element getStationDetails(String inputHTML)
+ {
+ Document doc = Jsoup.parse(inputHTML);
+
+ Elements mainContainers = doc.getElementsByClass("maincontainer");
+ if(mainContainers.size() == 0)
+ return null;
+ Elements mainContents = Objects.requireNonNull(mainContainers.first()).getElementsByClass("maincontent0");
+ if(mainContents.size() == 0)
+ return null;
+ Elements subContents = Objects.requireNonNull(mainContents.first()).getElementsByClass("subcontent0 smallgaps");
+ if(subContents.size() == 0)
+ return null;
+ Elements mainBlocks = Objects.requireNonNull(subContents.first()).getElementsByClass("mainblock illustrationleftsmall");
+ if(mainBlocks.size() == 0)
+ return null;
+ Elements columns = Objects.requireNonNull(mainBlocks.first()).getElementsByClass("incontent grid2columns columnseparator");
+ if(columns.size() == 0)
+ return null;
+
+ return Objects.requireNonNull(columns.first()).getElementsByTag("div").first();
+ }
+
+ public static Elements getStationNameAndSystem(String inputHTML)
{
Document doc = Jsoup.parse(inputHTML);
- Elements maincons = doc.getElementsByClass("maincon");
- if(maincons.size() == 0) return null;
+ Elements mainContainers = doc.getElementsByClass("maincontainer");
+ if(mainContainers.size() == 0)
+ return null;
- Elements containermains = Objects.requireNonNull(maincons.first()).getElementsByClass("containermain");
- if(containermains.size() == 0) return null;
+ Elements mainContents = Objects.requireNonNull(mainContainers.first()).getElementsByClass("maincontent1 fullwidth");
+ if(mainContents.size() == 0)
+ return null;
- Elements maincontentcontainers = Objects.requireNonNull(containermains.first()).getElementsByClass("maincontentcontainer");
- if(maincontentcontainers.size() == 0) return null;
+ Elements mainBlocks = Objects.requireNonNull(mainContents.first()).getElementsByClass("mainblock");
+ if(mainBlocks.size() == 0)
+ return null;
- Elements mainconten1s = Objects.requireNonNull(maincontentcontainers.first()).getElementsByClass("maincontent1");
- if(mainconten1s.size() == 0) return null;
+ Elements table = Objects.requireNonNull(mainBlocks.first()).getElementsByClass("incontentlist columns3");
+ if(table.size() == 0)
+ return null;
- return mainconten1s;
+ return Objects.requireNonNull(table.first()).getElementsByTag("a");
}
}
diff --git a/src/main/java/com/fi0x/edct/logic/cleanup/INARACleanup.java b/src/main/java/com/fi0x/edct/logic/cleanup/INARACleanup.java
index 1ec3815..d80d826 100644
--- a/src/main/java/com/fi0x/edct/logic/cleanup/INARACleanup.java
+++ b/src/main/java/com/fi0x/edct/logic/cleanup/INARACleanup.java
@@ -1,7 +1,9 @@
package com.fi0x.edct.logic.cleanup;
+import com.fi0x.edct.logging.LogName;
import com.fi0x.edct.logic.database.DBHandler;
import com.fi0x.edct.logic.structures.*;
+import io.fi0x.javalogger.logging.Logger;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
@@ -20,18 +22,18 @@ public static Map getCommodityIDs(String inputHTML)
Document doc = Jsoup.parse(inputHTML);
Element body = doc.body();
- Element table = body.getElementsByClass("tablesorter").first();
+ Element table = body.getElementsByClass("tablesortercollapsed").first();
if(table == null) return commodities;
Elements entries = Objects.requireNonNull(table.getElementsByTag("tbody").first()).getElementsByTag("tr");
entries.remove(0);
for(Element entry : entries)
{
- Element commodityInfo = entry.getElementsByClass("lineright paddingleft wrap").first();
+ Element commodityInfo = entry.getElementsByClass("lineright wrap").first();
if(commodityInfo == null) continue;
String commodityName = commodityInfo.text();
- String commodityIDText = Objects.requireNonNull(commodityInfo.getElementsByTag("a").first()).attr("href").replace("commodity", "").replace("/", "");
+ String commodityIDText = Objects.requireNonNull(commodityInfo.getElementsByTag("a").first()).attr("href").replace("elite/commodity", "").replace("/", "");
int commodityID = Integer.parseInt(commodityIDText);
commodities.put(commodityName, commodityID);
@@ -45,25 +47,25 @@ public static ArrayList getCommodityPrices(int commodityID, String inputH
ArrayList stations = new ArrayList<>();
Document doc = Jsoup.parse(inputHTML);
- Element table = doc.getElementsByClass("tablesorterintab").first();
- if(table == null) return stations;
+ Element table = doc.getElementsByClass("tablesortercollapsed").first();
+ if(table == null)
+ return stations;
+
Element tbody = table.getElementsByTag("tbody").first();
Elements entries = Objects.requireNonNull(tbody).getElementsByTag("tr");
for(Element entry : entries)
{
- Element stationDescriptor = Objects.requireNonNull(entry.getElementsByClass("wrap").first()).getElementsByClass("inverse").first();
- String system = Objects.requireNonNull(Objects.requireNonNull(stationDescriptor).getElementsByClass("uppercase").first()).ownText();
- String stationName = Objects.requireNonNull(stationDescriptor.getElementsByClass("normal").first()).ownText();
- if(stationName.length() > 2) stationName = stationName.substring(0, stationName.length() - 2);
+ Element stationDescriptor = Objects.requireNonNull(entry.getElementsByClass("wrap").first()).getElementsByTag("a").first();
+ String system = Objects.requireNonNull(Objects.requireNonNull(stationDescriptor).getElementsByClass("uppercase nowrap").first()).ownText();
+ String stationName = Objects.requireNonNull(stationDescriptor.getElementsByClass("standardcase standardcolor nowrap").first()).ownText();
+ if(stationName.length() > 2)
+ stationName = stationName.substring(0, stationName.length() - 2);
- String padSizeName = Objects.requireNonNull(entry.getElementsByClass("minor").first()).ownText();
+ String padSizeName = Objects.requireNonNull(entry.getElementsByClass("alignright minor").first()).ownText();
Elements tradeElements = entry.getElementsByClass("alignright lineright");
- Element quantityElement = Objects.requireNonNull(tradeElements.first()).getAllElements().first();
-
- String quantityText = Objects.requireNonNull(Objects.requireNonNull(quantityElement).getAllElements().first()).ownText().replace(",", "");
-
+ String quantityText = Objects.requireNonNull(tradeElements.first()).ownText().replace(",", "");
String priceText = Objects.requireNonNull(tradeElements.last()).ownText().replace(",", "");
var q = quantityText.length() > 0 ? Integer.parseInt(quantityText) : 0;
@@ -73,18 +75,30 @@ public static ArrayList getCommodityPrices(int commodityID, String inputH
int buyPrice = isSeller ? 0 : p;
int sellPrice = isSeller ? p : 0;
+ //TODO: Maybe make this part useful again
STATIONTYPE type;
- if(entry.hasClass("filterable1")) type = STATIONTYPE.CARRIER;
- else if(entry.hasClass("filterable3")) type = STATIONTYPE.SURFACE;
- else if(entry.hasClass("filterable4")) type = STATIONTYPE.ODYSSEY;
- else type = STATIONTYPE.ORBIT;
+ if(entry.hasClass("filterable1"))
+ type = STATIONTYPE.CARRIER;
+ else if(entry.hasClass("filterable3"))
+ type = STATIONTYPE.SURFACE;
+ else if(entry.hasClass("filterable4"))
+ type = STATIONTYPE.ODYSSEY;
+ else
+ type = STATIONTYPE.ORBIT;
Element starDistanceElement = entry.getElementsByClass("minor alignright lineright").first();
String starDistanceText = Objects.requireNonNull(starDistanceElement).ownText();
- double starDistance = Double.parseDouble(starDistanceText.replace(",", "").replace(" Ls", "").replace("---", "-1"));
+ double starDistance = -1;
+ try
+ {
+ starDistance = Double.parseDouble(starDistanceText.replace(",", "").replace(" Ls", "").replace("-", "-1"));
+ } catch(NumberFormatException e)
+ {
+ Logger.log("Could not parse the star-distance for station '" + stationName + "'", LogName.WARNING);
+ }
long inara_time = 0;
- String[] dataAgeString = Objects.requireNonNull(entry.getElementsByClass("minor alignright smaller").first()).ownText().split(" ");
+ String[] dataAgeString = Objects.requireNonNull(entry.getElementsByClass("minor alignright small").first()).ownText().split(" ");
if(dataAgeString.length == 3)
{
inara_time = Long.parseLong(dataAgeString[0]);
@@ -117,15 +131,16 @@ public static String getStationID(String inputHTML, String stationName, String s
{
String stationID = null;
- Element details = HTMLCleanup.getStationDetails(inputHTML);
- if(details == null) return null;
+ Elements stations = HTMLCleanup.getStationNameAndSystem(inputHTML);
+ if(stations == null)
+ return null;
- for(Element station : details.getElementsByTag("a"))
+ for(Element station : stations)
{
String stationEntry = station.toString();
if(stationEntry.contains(stationName) && stationEntry.contains(systemName))
{
- stationID = station.attr("href").replace("station", "").replace("/", "");
+ stationID = station.attr("href").replace("elite/station", "").replace("/", "");
break;
}
}
diff --git a/src/main/java/com/fi0x/edct/logic/database/DBHandler.java b/src/main/java/com/fi0x/edct/logic/database/DBHandler.java
index 0d3678b..a813675 100644
--- a/src/main/java/com/fi0x/edct/logic/database/DBHandler.java
+++ b/src/main/java/com/fi0x/edct/logic/database/DBHandler.java
@@ -32,7 +32,7 @@ private DBHandler()
} catch(SQLException e)
{
- Logger.log("Something went wrong when connecting to the local DB", LogName.ERROR, e, 998);
+ Logger.log("Something went wrong when connecting to the local DB", LogName.getError(998), e, 998);
System.exit(998);
}
}
@@ -473,7 +473,7 @@ private static synchronized void sendStatement(String command)
} catch(SQLException e)
{
if(e.toString().contains("The database file is locked"))
- Logger.log("Could not access database file because of locking", LogName.ERROR, e, 993);
+ Logger.log("Could not access database file because of locking", LogName.getError(993), e, 993);
else
Logger.log("Something went wrong when sending an SQL statement. Statement: " + command, LogName.WARNING, e, 994);
}
@@ -488,7 +488,7 @@ private static synchronized ResultSet getQueryResults(String query)
} catch(SQLException e)
{
if(e.toString().contains("The database file is locked"))
- Logger.log("Could not access database file because of locking", LogName.ERROR, e, 993);
+ Logger.log("Could not access database file because of locking", LogName.getError(993), e, 993);
else
Logger.log("Something went wrong when sending a SQL query. Query: " + query, LogName.WARNING, e, 994);
}
diff --git a/src/main/java/com/fi0x/edct/logic/helper/ExternalProgram.java b/src/main/java/com/fi0x/edct/logic/helper/ExternalProgram.java
index c61213b..f94751b 100644
--- a/src/main/java/com/fi0x/edct/logic/helper/ExternalProgram.java
+++ b/src/main/java/com/fi0x/edct/logic/helper/ExternalProgram.java
@@ -21,7 +21,7 @@ public static void openWebsite(String url)
desktop.browse(new URI(url));
} catch(IOException | URISyntaxException e)
{
- Logger.log("Could not open url in browser", LogName.ERROR, e, 992);
+ Logger.log("Could not open url in browser", LogName.getError(992), e, 992);
}
}
@@ -47,7 +47,7 @@ public static void openDefaultEditor(File fileToOpen)
Desktop.getDesktop().edit(fileToOpen);
} catch(IOException e)
{
- Logger.log("Could not open file (" + fileToOpen.getName() + ") in editor", LogName.ERROR, e, 992);
+ Logger.log("Could not open file (" + fileToOpen.getName() + ") in editor", LogName.getError(992), e, 992);
}
}
}
diff --git a/src/main/java/com/fi0x/edct/logic/structures/ENDPOINTS.java b/src/main/java/com/fi0x/edct/logic/structures/ENDPOINTS.java
index b5d6f51..456bbd0 100644
--- a/src/main/java/com/fi0x/edct/logic/structures/ENDPOINTS.java
+++ b/src/main/java/com/fi0x/edct/logic/structures/ENDPOINTS.java
@@ -3,10 +3,11 @@
public enum ENDPOINTS
{
Releases("https://api.github.com/repos/Fi0x/EDCT/releases", "GET"),
- Commodities("https://inara.cz/commodities/", "GET"),
+ Commodities("https://inara.cz/elite/commodities-list/", "GET"),
EDDNPrices("https://eddb.io/commodity", "GET"),
- Prices("https://inara.cz/commodity/", "GET"),
+ Prices("https://inara.cz/commodities/", "GET", "pi1", "pi2", "pi3", "pi4", "pi5", "pi7", "pi8", "pi9", "pi10", "pi11", "pi12"),
StationSearch("https://inara.cz/elite/stations/", "GET", "search"),
+ StationInfo("https://inara.cz/elite/station/", "GET"),
EDSMCoordinates("https://www.edsm.net/api-v1/system", "GET", "systemName", "showCoordinates");
public final String url;
diff --git a/src/main/java/com/fi0x/edct/logic/webrequests/RequestHandler.java b/src/main/java/com/fi0x/edct/logic/webrequests/RequestHandler.java
index 2de6814..327a8ae 100644
--- a/src/main/java/com/fi0x/edct/logic/webrequests/RequestHandler.java
+++ b/src/main/java/com/fi0x/edct/logic/webrequests/RequestHandler.java
@@ -1,6 +1,5 @@
package com.fi0x.edct.logic.webrequests;
-import com.fi0x.edct.Main;
import com.fi0x.edct.logging.LogName;
import com.fi0x.edct.logging.exceptions.HtmlConnectionException;
import io.fi0x.javalogger.logging.Logger;
@@ -10,12 +9,9 @@
import java.io.InputStreamReader;
import java.net.*;
import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Date;
-import java.util.List;
import java.util.Map;
public class RequestHandler
@@ -69,8 +65,11 @@ public static String sendHTTPRequest(String endpoint, String requestType, Map entry : commodities.entrySet())
{
DBHandler.setCommodityData(entry.getKey(), entry.getValue());
@@ -46,13 +49,14 @@ public static boolean updateCommodityIDs() throws InterruptedException
public static boolean updateCommodityPrices(int commodityRefID) throws InterruptedException, HtmlConnectionException
{
- Map parameters1 = getRefinedParameters(ENDPOINTS.Prices.parameter, commodityRefID, "buymin");
- Map parameters2 = getRefinedParameters(ENDPOINTS.Prices.parameter, commodityRefID, "sellmax");
+ Map parameters1 = getRefinedParameters(ENDPOINTS.Prices.parameter, commodityRefID, "2");
+ Map parameters2 = getRefinedParameters(ENDPOINTS.Prices.parameter, commodityRefID, "1");
- String html = RequestHandler.sendHTTPRequest(ENDPOINTS.Prices.url + commodityRefID + "/#tab_ui-id-2", ENDPOINTS.Prices.type, parameters1);
+ String html = RequestHandler.sendHTTPRequest(ENDPOINTS.Prices.url, ENDPOINTS.Prices.type, parameters1);
if(html == null) return false;
ArrayList sellStations = INARACleanup.getCommodityPrices(commodityRefID, html, true);
- html = RequestHandler.sendHTTPRequest(ENDPOINTS.Prices.url + commodityRefID + "/#tab_ui-id-8", ENDPOINTS.Prices.type, parameters2);
+
+ html = RequestHandler.sendHTTPRequest(ENDPOINTS.Prices.url, ENDPOINTS.Prices.type, parameters2);
if(html == null) return false;
ArrayList buyStations = INARACleanup.getCommodityPrices(commodityRefID, html, false);
@@ -102,17 +106,30 @@ private static Map getRefinedParameters(String[] parameter, int
{
switch(param)
{
- case "act":
- parameters.put(param, "goodsdata");
- break;
- case "refname":
+ case "pi1":
parameters.put(param, sellParam);
break;
- case "refid":
+ case "pi2":
parameters.put(param, String.valueOf(commRefID));
break;
- case "refid2":
- parameters.put(param, "1261");
+ case "pi3":
+ case "pi4":
+ case "pi8":
+ case "pi10":
+ parameters.put(param, "1");
+ break;
+ case "pi7":
+ case "pi12":
+ parameters.put(param, "0");
+ break;
+ case "pi5":
+ parameters.put(param, "168");
+ break;
+ case "pi9":
+ parameters.put(param, "100000");
+ break;
+ case "pi11":
+ parameters.put(param, "5000");
break;
default:
break;
diff --git a/src/main/java/com/fi0x/edct/logic/websites/InaraStation.java b/src/main/java/com/fi0x/edct/logic/websites/InaraStation.java
index ea9722a..30ba426 100644
--- a/src/main/java/com/fi0x/edct/logic/websites/InaraStation.java
+++ b/src/main/java/com/fi0x/edct/logic/websites/InaraStation.java
@@ -26,13 +26,12 @@ public static String getInaraStationID(String stationName, String systemName) th
public static String getStationHtml(String stationID) throws InterruptedException, HtmlConnectionException
{
- Map parameters = new HashMap<>();
-
- return RequestHandler.sendHTTPRequest(ENDPOINTS.StationSearch.url + stationID, ENDPOINTS.StationSearch.type, parameters);
+ return RequestHandler.sendHTTPRequest(ENDPOINTS.StationInfo.url + stationID, ENDPOINTS.StationInfo.type, new HashMap<>());
}
public static void updateSingleStationTrades(String stationName, String systemName, TRADE tradeToUpdate)
{
+ //TODO: Update for new inara
String stationHTML = null;
try
{