diff --git a/Corvus.iml b/Corvus.iml
new file mode 100644
index 0000000..78b2cc5
--- /dev/null
+++ b/Corvus.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..0f9e8c0
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,46 @@
+
+
+ 4.0.0
+
+ com.srfairyox
+ Corvus
+ 0.1
+
+
+ 8
+ 8
+ UTF-8
+ UTF-8
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.1.0
+
+
+ com.zenjava
+ javafx-maven-plugin
+ 8.8.3
+
+ com.srfairyox.Corvus.Main
+
+
+
+
+
+
+
+ org.json
+ json
+ 20201115
+ compile
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..afb1c48
--- /dev/null
+++ b/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: com.srfairyox.Corvus.Main
+
diff --git a/src/main/java/com/srfairyox/Corvus/Config/ConfigLoader.java b/src/main/java/com/srfairyox/Corvus/Config/ConfigLoader.java
new file mode 100644
index 0000000..9b065eb
--- /dev/null
+++ b/src/main/java/com/srfairyox/Corvus/Config/ConfigLoader.java
@@ -0,0 +1,48 @@
+package com.srfairyox.Corvus.Config;
+
+import com.srfairyox.Corvus.Main;
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Objects;
+
+public class ConfigLoader {
+ private static File configJSON;
+
+ public ConfigLoader() {
+ configJSON = new File("config.json");
+ if(!configJSON.exists()) {
+ try {
+ Files.copy(Objects.requireNonNull(Main.instance.getClass().getClassLoader().getResourceAsStream(configJSON.getName())), configJSON.toPath());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void save(Boolean enableLog, Boolean enableDebugConsole, int gateSelectedIndex, Boolean placeGateOnMap, Boolean spinOnlyEE, int minUridium, int maxSpinCost) throws IOException {
+ JSONObject jsonObject = new JSONObject();
+
+ jsonObject.put("enableLog", enableLog);
+ jsonObject.put("enableDebugConsole", enableDebugConsole);
+ jsonObject.put("gateSelectedIndex", gateSelectedIndex);
+ jsonObject.put("placeGateOnMap", placeGateOnMap);
+ jsonObject.put("spinOnlyEE", spinOnlyEE);
+ jsonObject.put("minUridium", minUridium);
+ jsonObject.put("maxSpinCost", maxSpinCost);
+
+ Files.write(Paths.get(configJSON.getName()), jsonObject.toString().getBytes());
+ }
+
+ public String load() {
+ try {
+ return new String(Files.readAllBytes(configJSON.toPath()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/com/srfairyox/Corvus/Controller.java b/src/main/java/com/srfairyox/Corvus/Controller.java
new file mode 100644
index 0000000..68a9faf
--- /dev/null
+++ b/src/main/java/com/srfairyox/Corvus/Controller.java
@@ -0,0 +1,549 @@
+package com.srfairyox.Corvus;
+
+import com.srfairyox.Corvus.Config.ConfigLoader;
+import com.srfairyox.Corvus.DarkOrbit.DOAccount;
+import com.srfairyox.Corvus.DarkOrbit.Data.GalaxyGate;
+import com.srfairyox.Corvus.DarkOrbit.Data.GalaxyGate.GalaxyGateEnum;
+import com.srfairyox.Corvus.Http.Urls;
+import javafx.application.Platform;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.event.ActionEvent;
+import javafx.fxml.FXML;
+import javafx.scene.control.*;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextArea;
+import javafx.scene.control.TextField;
+import javafx.scene.control.cell.CheckBoxTableCell;
+import javafx.scene.control.cell.PropertyValueFactory;
+import org.json.JSONObject;
+
+import java.awt.*;
+import java.awt.event.WindowEvent;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.text.NumberFormat;
+import java.time.OffsetDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.FutureTask;
+
+@SuppressWarnings("unchecked")
+public class Controller {
+ public Button btnStop;
+ public CheckBox chkEnableLog;
+ public CheckBox chkEnableDebugCMD;
+ private DOAccount account;
+ private boolean loginAccount = false;
+ private boolean useMultiplier = false;
+ private boolean running = false;
+
+ //App
+ public Button btnOpenBackPage;
+ public Label lblLastStatus;
+
+ //Tab Login
+ public Tab tabLogin;
+ public Label lblErrorNotificationLogin;
+ ///Group of SessionID Login
+ public TitledPane tpSessionIDLogin;
+ public TextField txtFServer;
+ public TextField txtFSID;
+ public Button btnLogin;
+ public Button btnClearFields;
+ ///Group of General Settings
+ public TitledPane tpGeneralSettings;
+
+ //Tab Galaxy Gates
+ public Tab tabGalaxyGates;
+ ///Group of Materializer
+ public TitledPane tpMaterializer;
+ public ComboBox cBoxGates;
+ public Button btnStart;
+ ///Table of Gate info
+ public TableView tableViewGateInfo;
+ public TableColumn nameColumn;
+ public TableColumn partsColumn;
+ public TableColumn readyColumn;
+ public TableColumn onMapColumn;
+ public TableColumn gatesBuiltColumn;
+ ///Group of Account
+ public TitledPane tpAccount;
+ public Label lblUridium;
+ public Label lblExtraEnergy;
+ public Label lblSpinCost;
+ ///Group of Statistics
+ public TitledPane tpStatistics;
+ public Label lblSpinsUsed;
+ public Label lblReceivedX2;
+ public Label lblReceivedX3;
+ public Label lblReceivedX4;
+ public Label lblReceivedSAB;
+ public Label lblReceivedPLT2021;
+ public Label lblReceivedACM;
+ public Label lblReceivedNanoHull;
+ public Label lblReceivedLogDisks;
+ public Label lblReceivedParts;
+ public Label lblReceivedRepairCredits;
+ public Label lblReceivedXenomit;
+ ///Group of Settings Gates
+ public TitledPane tpSettingsGates;
+ public CheckBox chkBoxPlaceGateOnMap;
+ public CheckBox chkBoxSpinOnlyEE;
+ public TextField txtMinUridium;
+ public TextField txtMaxSpinCost;
+
+ //Tab Log
+ public Tab tabLog;
+ public TextArea txtAreaLog;
+
+ //Variable initial
+ private int GatesBuiltAlpha = 0;
+ private int GatesBuiltBeta = 0;
+ private int GatesBuiltGamma = 0;
+ private int GatesBuiltDelta = 0;
+ private int GatesBuiltEpsilon = 0;
+ private int GatesBuiltZeta = 0;
+ private int GatesBuiltKappa = 0;
+ private int GatesBuiltLambda = 0;
+ private int GatesBuiltHades = 0;
+ private int GatesBuiltKuiper = 0;
+
+ @FXML
+ public void initialize() {
+ Log("Corvus v0.1 started - Made by 'Heaven. and SrFairyox");
+ tpSessionIDLogin.setCollapsible(false);
+ tpGeneralSettings.setCollapsible(false);
+
+ tpMaterializer.setCollapsible(false);
+ tpAccount.setCollapsible(false);
+ tpStatistics.setCollapsible(false);
+ tpSettingsGates.setCollapsible(false);
+
+ btnOpenBackPage.setDisable(true);
+ btnStart.setDisable(true);
+ btnStop.setDisable(true);
+
+ ObservableList gates = FXCollections.observableArrayList("ABG","Delta","Epsilon","Zeta","Kappa","Labda","Hades","Kuiper");
+
+ cBoxGates.setItems(gates);
+ cBoxGates.getSelectionModel().select(0);
+
+ txtFServer.textProperty().addListener((observable, oldValue, newValue) -> {
+ if(newValue.isEmpty()){
+ txtFServer.setStyle("-fx-background-color: rgba(215, 44, 44, 0.4)");
+ } else {
+ txtFServer.setStyle("");
+ }
+ });
+
+ txtFSID.textProperty().addListener((observable, oldValue, newValue) -> {
+ if(newValue.isEmpty()){
+ txtFSID.setStyle("-fx-background-color: rgba(215, 44, 44, 0.4)");
+ } else {
+ txtFSID.setStyle("");
+ }
+ });
+
+ txtMinUridium.textProperty().addListener((observable, oldValue, newValue) -> {
+ if(newValue.isEmpty()) {
+ txtMinUridium.setText(oldValue);
+ }
+ if(!newValue.matches("\\d*")) {
+ txtMinUridium.setText(newValue.replaceAll("[^\\d]", oldValue));
+ }
+ });
+
+ txtMaxSpinCost.textProperty().addListener((observable, oldValue, newValue) -> {
+ if(newValue.isEmpty()) {
+ txtMaxSpinCost.setText(oldValue);
+ }
+ if(!newValue.matches("\\d*")) {
+ txtMaxSpinCost.setText(newValue.replaceAll("[^\\d]", oldValue));
+ }
+
+ });
+
+ tabLog.setDisable(!chkEnableLog.isSelected());
+
+ chkEnableLog.selectedProperty().addListener((observable, oldValue, newValue) -> {
+ tabLog.setDisable(!newValue);
+ });
+
+
+ if(new File("config.json").exists()) {
+ String configLoader = new ConfigLoader().load();
+ JSONObject obj = new JSONObject(configLoader);
+
+ chkEnableLog.setSelected(obj.getBoolean("enableLog"));
+ chkEnableDebugCMD.setSelected(obj.getBoolean("enableDebugConsole"));
+ chkBoxPlaceGateOnMap.setSelected(obj.getBoolean("enableDebugConsole"));
+ chkBoxSpinOnlyEE.setSelected(obj.getBoolean("spinOnlyEE"));
+ cBoxGates.getSelectionModel().select(obj.getInt("gateSelectedIndex"));
+ txtMinUridium.setText(String.valueOf(obj.getInt("minUridium")));
+ txtMaxSpinCost.setText(String.valueOf(obj.getInt("maxSpinCost")));
+ }
+ }
+
+ public void btnLoginOnClick(ActionEvent actionEvent) {
+ //Disable gui
+ if(txtFServer.getText().equals("") || txtFSID.getText().equals("")) {
+ if(txtFServer.getText().equals("") && txtFSID.getText().equals("")){
+ lblErrorNotificationLogin.setText("Error: Field server and sid empty");
+ txtFServer.setStyle("-fx-background-color: rgba(215, 44, 44, 0.4)");
+ txtFSID.setStyle("-fx-background-color: rgba(215, 44, 44, 0.4)");
+ }
+ else if(txtFServer.getText().equals("")){
+ lblErrorNotificationLogin.setText("Error: Field server empty");
+ txtFServer.setStyle("-fx-background-color: rgba(215, 44, 44, 0.4)");
+ }
+ else if(txtFSID.getText().equals("")){
+ lblErrorNotificationLogin.setText("Error: Field sid empty");
+ txtFSID.setStyle("-fx-background-color: rgba(215, 44, 44, 0.4)");
+ }
+ } else {
+ lblErrorNotificationLogin.setText("");
+
+ new Thread(() -> {
+ Log("Performing sessionId...");
+ account = new DOAccount(txtFServer.getText(), txtFSID.getText());
+ boolean sessionValid = account.CheckSessionValid();
+
+ if(!sessionValid) {
+ Log("There was a problem performing the login! Please check your input data!");
+ return;
+ } else {
+ loginAccount = true;
+ btnOpenBackPage.setDisable(false);
+ btnStart.setDisable(false);
+ btnStop.setDisable(true);
+ }
+
+ Log("Login success!");
+ InitializeGuiAsync();
+ }).start();
+
+
+ //Enable GUI
+ }
+ }
+
+ public void btnClearFieldsOnClick(ActionEvent actionEvent) {
+ System.out.println("clear");
+ txtFServer.setText("");
+ txtFServer.setStyle("");
+ txtFSID.setText("");
+ txtFSID.setStyle("");
+ }
+
+ public void btnOpenBackPageOnClick(ActionEvent actionEvent) {
+ System.out.println("backpage");
+ if(account.accountData.getSessionId()!=null) {
+ try {
+ Desktop.getDesktop().browse(URI.create(Urls.getBaseUrl(account.accountData.getServer())+Urls.getOpenBackPage(account.accountData.getSessionId())));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void btnStartOnClick(ActionEvent actionEvent) {
+ btnStart.setDisable(true);
+ btnStop.setDisable(false);
+
+ running = true;
+
+ new Thread(() -> {
+ while (running) {
+ DoWork();
+ }
+ }).start();
+
+ }
+
+ private synchronized void InitializeGuiAsync() {
+ Platform.runLater(() -> {
+ Log("Initializing gui...");
+ Log("Reading Galaxy Gates...");
+ });
+ account.ReadGatesAsync();
+ Platform.runLater(() -> {
+ UpdateGui();
+ Log("Initialization finished!");
+ });
+ }
+
+ private void UpdateGui() {
+ NumberFormat numberFormat = NumberFormat.getInstance();
+ numberFormat.setGroupingUsed(true);
+
+ Log("Updating Gate gui...");
+ UpdateGateTable(account.gateData);
+ Platform.runLater(() -> {
+ lblUridium.setText("Uridium: "+ numberFormat.format(account.gateData.Money));
+ lblExtraEnergy.setText("Extra Energy: "+ numberFormat.format(account.gateData.Samples));
+ lblSpinCost.setText("Spin Cost: "+ numberFormat.format(account.gateData.EnergyCost.Text));
+
+ lblSpinsUsed.setText("Spin used: "+ numberFormat.format(GalaxyGate.GateItemsReceived.TotalSpins));
+ lblReceivedX2.setText("X2: "+ numberFormat.format(GalaxyGate.GateItemsReceived.X2));
+ lblReceivedX3.setText("X3: "+ numberFormat.format(GalaxyGate.GateItemsReceived.X3));
+ lblReceivedX4.setText("X4: "+ numberFormat.format(GalaxyGate.GateItemsReceived.X4));
+ lblReceivedSAB.setText("SAB: "+ numberFormat.format(GalaxyGate.GateItemsReceived.SAB));
+ lblReceivedPLT2021.setText("PLT-2021: "+ numberFormat.format(GalaxyGate.GateItemsReceived.PLT2021));
+ lblReceivedACM.setText("ACM: "+ numberFormat.format(GalaxyGate.GateItemsReceived.ACM));
+ lblReceivedNanoHull.setText("Nano hull: "+ numberFormat.format(GalaxyGate.GateItemsReceived.NanoHull));
+ lblReceivedLogDisks.setText("Log disks: "+ numberFormat.format(GalaxyGate.GateItemsReceived.LogDisks));
+ lblReceivedParts.setText("Parts: "+ numberFormat.format(GalaxyGate.GateItemsReceived.GateParts));
+ lblReceivedRepairCredits.setText("Repair credits: "+ numberFormat.format(GalaxyGate.GateItemsReceived.RepairCredits));
+ lblReceivedXenomit.setText("Xenomit: "+ numberFormat.format(GalaxyGate.GateItemsReceived.Xenomit));
+ });
+ }
+
+ private synchronized void ExecuteSpinAsync() {
+ UpdateGui();
+ GalaxyGate.Gate currentGate = account.gateData.Gates.Get(GetSelectedGate());
+ if(cBoxGates.getSelectionModel().getSelectedIndex() == 0) {
+ GalaxyGate.Gate currentGateA = account.gateData.Gates.Get(GalaxyGateEnum.Alpha);
+ GalaxyGate.Gate currentGateB = account.gateData.Gates.Get(GalaxyGateEnum.Beta);
+ GalaxyGate.Gate currentGateG = account.gateData.Gates.Get(GalaxyGateEnum.Gamma);
+ if(chkBoxPlaceGateOnMap.isSelected()) {
+ if((currentGateA.prepared && currentGateA.isReady()) || (currentGateB.prepared && currentGateB.isReady()) || (currentGateG.prepared && currentGateG.isReady())) {
+ Log("Stopping gate mode. Can not get more parts.");
+ return;
+ }
+ if(currentGateA.isReady() && !currentGateA.prepared){
+ //place
+ PlaceGateAsync(GalaxyGateEnum.Alpha);
+ }
+ if(currentGateB.isReady() && !currentGateB.prepared){
+ //place
+ PlaceGateAsync(GalaxyGateEnum.Beta);
+ }
+ if(currentGateG.isReady() && !currentGateG.prepared){
+ //place
+ PlaceGateAsync(GalaxyGateEnum.Gamma);
+ }
+ } else {
+ if (currentGateA.isReady() || currentGateB.isReady() || currentGateG.isReady())
+ {
+ Log("Stopping gate mode. Can not get more parts.");
+ return;
+ }
+ }
+ } else {
+ if(chkBoxPlaceGateOnMap.isSelected()) {
+ if(currentGate.prepared && currentGate.isReady()) {
+ Log("Stopping gate mode. Can not get more parts.");
+ return;
+ }
+ if(currentGate.isReady() && !currentGate.prepared) {
+ //place
+ PlaceGateAsync(GetSelectedGate());
+ }
+ } else {
+ if(currentGate.isReady()) {
+ Log("Stopping gate mode. Can not get more parts.");
+ return;
+ }
+ }
+ }
+
+ if(account.gateData.EnergyCost.Text > account.gateData.Money && account.gateData.Samples <= 0) {
+ Log("Stopping gate mode. No Uridium/EE left");
+ return;
+ }
+ if(account.gateData.Money <= Integer.parseInt(txtMinUridium.getText())) {
+ Log("Stopping gate mode. Minimum Uridium reached");
+ return;
+ }
+ if(chkBoxSpinOnlyEE.isSelected() && account.gateData.Samples <= 0) {
+ Log("Stopping gate mode. No EE left");
+ return;
+ }
+ if(!(account.gateData.EnergyCost.Text <= Integer.parseInt(txtMaxSpinCost.getText()))) {
+ Log("Stopping gate mode. Max Spin Cost");
+ return;
+ }
+
+ if(cBoxGates.getSelectionModel().getSelectedIndex()==0) {
+ Log("Spinning ABG...");
+ } else {
+ Log("Spinning "+GetSelectedGate().getDisplayName());
+ }
+
+ GalaxyGate.Multipliers multiplierinfo = account.gateData.MultiplierInfo;
+ for (GalaxyGate.Multiplier mi:multiplierinfo.multiplierList) {
+ if(mi.Mode.contains(GetSelectedGate().getDisplayNameReal().toLowerCase())) {
+ if(cBoxGates.getSelectionModel().getSelectedIndex() == 0) {
+ if(use3MultiplierABG(account.gateData.Gates.Get(GalaxyGateEnum.Alpha).current, account.gateData.Gates.Get(GalaxyGateEnum.Alpha).total, account.gateData.Gates.Get(GalaxyGateEnum.Beta).current,account.gateData.Gates.Get(GalaxyGateEnum.Beta).total,account.gateData.Gates.Get(GalaxyGateEnum.Gamma).current,account.gateData.Gates.Get(GalaxyGateEnum.Gamma).total)) {
+ useMultiplier = 2 <= mi.Value;
+ } else {
+ useMultiplier = 1 <= mi.Value;
+ }
+ } else {
+ if ((account.gateData.Gates.Get(GetSelectedGate()).total - account.gateData.Gates.Get(GetSelectedGate()).current) == 3) {
+ useMultiplier = (2 <= mi.Value);
+ } else {
+ useMultiplier = (1 <= mi.Value);
+ }
+ }
+ }
+ }
+ System.out.println("useMultiplier: "+useMultiplier);
+
+ //spin
+ GalaxyGate.GateSpinData spin = account.SpinGateAsync(GetSelectedGate(), useMultiplier);
+
+ for (GalaxyGate.GateSpinData.Item allItem:spin.Items.GetAllItems()) {
+ if(allItem.Duplicate) {
+ Log("Received duplicate gate part > received multiplier");
+ } else {
+ Log("Received "+allItem.ToString());
+ }
+ }
+ UpdateGui();
+ }
+
+ private synchronized void DoWork() {
+ try {
+ Log("Reading Galaxy Gates...");
+ account.ReadGatesAsync();
+ UpdateGui();
+ try {
+ ExecuteSpinAsync();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private synchronized void PlaceGateAsync(GalaxyGate.GalaxyGateEnum gate) {
+ Log("Gate "+gate.getDisplayName()+" is ready...");
+ Log("Placing "+gate.getDisplayName());
+ account.PlaceGateAsync(gate);
+ addGatesBuilt(gate);
+ Log("Reading Galaxy Gates...");
+ account.ReadGatesAsync();
+ UpdateGui();
+ }
+
+ //Update gates in table
+ public void UpdateGateTable(GalaxyGate.GateData value) {
+ final ObservableList data = FXCollections.observableArrayList(new Gate("Alpha", value.Gates.Alpha().current+"/"+value.Gates.Alpha().total, value.Gates.Alpha().current==value.Gates.Alpha().total, value.Gates.Alpha().prepared, GatesBuiltAlpha),
+ new Gate("Beta", value.Gates.Beta().current+"/"+value.Gates.Beta().total, value.Gates.Beta().current==value.Gates.Beta().total, value.Gates.Beta().prepared, GatesBuiltBeta),
+ new Gate("Gamma", value.Gates.Gamma().current+"/"+value.Gates.Gamma().total, value.Gates.Gamma().current==value.Gates.Gamma().total, value.Gates.Gamma().prepared, GatesBuiltGamma),
+ new Gate("Delta", value.Gates.Delta().current+"/"+value.Gates.Delta().total, value.Gates.Delta().current==value.Gates.Delta().total, value.Gates.Delta().prepared, GatesBuiltDelta),
+ new Gate("Epsilon", value.Gates.Epsilon().current+"/"+value.Gates.Epsilon().total, value.Gates.Epsilon().current==value.Gates.Epsilon().total, value.Gates.Epsilon().prepared, GatesBuiltEpsilon),
+ new Gate("Zeta", value.Gates.Zeta().current+"/"+value.Gates.Zeta().total, value.Gates.Zeta().current==value.Gates.Zeta().total, value.Gates.Zeta().prepared, GatesBuiltZeta),
+ new Gate("Kappa", value.Gates.Kappa().current+"/"+value.Gates.Kappa().total, value.Gates.Kappa().current==value.Gates.Kappa().total, value.Gates.Kappa().prepared, GatesBuiltKappa),
+ new Gate("Lambda", value.Gates.Lambda().current+"/"+value.Gates.Lambda().total, value.Gates.Lambda().current==value.Gates.Lambda().total, value.Gates.Lambda().prepared, GatesBuiltLambda),
+ new Gate("Hades", value.Gates.Hades().current+"/"+value.Gates.Hades().total, value.Gates.Hades().current==value.Gates.Hades().total, value.Gates.Hades().prepared, GatesBuiltHades),
+ new Gate("Kuiper", value.Gates.Kuiper().current+"/"+value.Gates.Kuiper().total, value.Gates.Kuiper().current==value.Gates.Kuiper().total, value.Gates.Kuiper().prepared, GatesBuiltKuiper)
+ );
+
+ nameColumn.setCellValueFactory(new PropertyValueFactory("name"));
+ partsColumn.setCellValueFactory(new PropertyValueFactory("parts"));
+ readyColumn.setCellValueFactory(new PropertyValueFactory("ready"));
+ readyColumn.setCellFactory(column -> new CheckBoxTableCell());
+ onMapColumn.setCellValueFactory(new PropertyValueFactory("onMap"));
+ onMapColumn.setCellFactory(column -> new CheckBoxTableCell());
+ gatesBuiltColumn.setCellValueFactory(new PropertyValueFactory("gatesBuilt"));
+
+ tableViewGateInfo.setItems(data);
+ }
+
+
+ //Get Gate Selected from ComboBox
+ private GalaxyGateEnum GetSelectedGate() {
+ switch (cBoxGates.getSelectionModel().getSelectedIndex()) {
+ case 0:
+ return GalaxyGateEnum.Alpha;
+ case 1:
+ return GalaxyGateEnum.Delta;
+ case 2:
+ return GalaxyGateEnum.Epsilon;
+ case 3:
+ return GalaxyGateEnum.Zeta;
+ case 4:
+ return GalaxyGateEnum.Kappa;
+ case 5:
+ return GalaxyGateEnum.Lambda;
+ case 6:
+ return GalaxyGateEnum.Hades;
+ case 7:
+ return GalaxyGateEnum.Kuiper;
+ }
+ return GalaxyGateEnum.None;
+ }
+
+ public void Log(String text) {
+ Platform.runLater(() -> {
+ lblLastStatus.setText("Last status: " + text);
+ if(chkEnableLog.isSelected()) {
+ if(txtAreaLog.getLength()>20000)
+ txtAreaLog.appendText("");
+ txtAreaLog.appendText("["+ DateTimeFormatter.ofPattern("HH:mm:ss").format(OffsetDateTime.now()) +"] " +text+"\n");
+ }
+ });
+ if(chkEnableDebugCMD.isSelected()) {
+ System.out.println(text);
+ }
+ }
+
+ //Add gates built
+ public void addGatesBuilt(GalaxyGate.GalaxyGateEnum gate)
+ {
+ switch (gate.getGateId())
+ {
+ case 1:
+ GatesBuiltAlpha++;
+ break;
+ case 2:
+ GatesBuiltBeta++;
+ break;
+ case 3:
+ GatesBuiltGamma++;
+ break;
+ case 4:
+ GatesBuiltDelta++;
+ break;
+ case 5:
+ GatesBuiltEpsilon++;
+ break;
+ case 6:
+ GatesBuiltZeta++;
+ break;
+ case 7:
+ GatesBuiltKappa++;
+ break;
+ case 8:
+ GatesBuiltLambda++;
+ break;
+ case 13:
+ GatesBuiltHades++;
+ break;
+ case 19:
+ GatesBuiltKuiper++;
+ break;
+ }
+ }
+
+ private Boolean use3MultiplierABG(int a_curr, int a_max, int b_curr, int b_max, int g_curr, int g_max)
+ {
+ if (a_max - a_curr == 3) return b_curr <= b_max * 0.2 && g_curr <= g_max * 0.2;
+ if (b_max - b_curr == 3) return a_curr <= a_max * 0.2 && g_curr <= g_max * 0.2;
+ if (g_max - b_curr == 3) return a_curr <= a_max * 0.2 && b_curr <= b_max * 0.2;
+ return false;
+ }
+
+
+ public void btnStopOnClick(ActionEvent actionEvent) {
+ running = false;
+ btnStart.setDisable(false);
+ btnStop.setDisable(true);
+ }
+}
diff --git a/src/main/java/com/srfairyox/Corvus/DarkOrbit/DOAccount.java b/src/main/java/com/srfairyox/Corvus/DarkOrbit/DOAccount.java
new file mode 100644
index 0000000..e77f797
--- /dev/null
+++ b/src/main/java/com/srfairyox/Corvus/DarkOrbit/DOAccount.java
@@ -0,0 +1,192 @@
+package com.srfairyox.Corvus.DarkOrbit;
+
+import com.srfairyox.Corvus.DarkOrbit.Data.AccountData;
+import com.srfairyox.Corvus.DarkOrbit.Data.GalaxyGate;
+import com.srfairyox.Corvus.Http.DOHttpClient;
+import com.srfairyox.Corvus.Http.Http;
+import com.srfairyox.Corvus.Http.Urls;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import java.io.StringReader;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class DOAccount {
+
+ public AccountData accountData;
+ public DOHttpClient doHttpClient;
+ public GalaxyGate.GateData gateData;
+
+ public DOAccount(String server, String sessionID) {
+ accountData = new AccountData();
+ doHttpClient = new DOHttpClient();
+ accountData.setServer(server);
+ accountData.setSessionId(sessionID);
+ doHttpClient.initialize();
+ }
+
+ public synchronized void ReadGatesAsync() {
+ try {
+ String url = Urls.getBaseUrl(accountData.getServer())+Urls.getGateInfo(accountData.getUserId(), accountData.getSessionId());
+ String data = Http.readResponse(doHttpClient.getConnection2(url));
+ StringReader reader = new StringReader(data);
+ JAXBContext jaxbContext = JAXBContext.newInstance(GalaxyGate.GateData.class);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ gateData = (GalaxyGate.GateData) unmarshaller.unmarshal(reader);
+ } catch (Exception e) {
+ e.printStackTrace();
+ gateData = null;
+ }
+ }
+
+ public synchronized Boolean CheckSessionValid() {
+ try {
+ String rawResponse = Http.readResponse(doHttpClient.getConnection(Urls.getBaseUrl(accountData.getServer())+Urls.getInternalStart(), accountData.getSessionId()));
+ if(rawResponse.contains("dosid")) {
+ String regexUsername = "alt=\"([^\"]+)\"\\s+id=\"pilotAvatar\" ()";
+ Pattern patternUsername = Pattern.compile(regexUsername);
+ Matcher username = patternUsername.matcher(rawResponse);
+ if(username.find()) {
+ accountData.setUsername(username.group(1));
+ }
+
+ String regexUserId = "\"uid\":(.*?),()";
+ Pattern patternUserId = Pattern.compile(regexUserId);
+ Matcher userID = patternUserId.matcher(rawResponse);
+ if(userID.find()) {
+ accountData.setUserId(userID.group(1));
+ }
+ return true;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ private boolean IsMultiplierAvailable(GalaxyGate.GalaxyGateEnum gate) {
+ String gateName = gate.getDisplayNameReal().toLowerCase();
+ GalaxyGate.Multiplier data = gateData.MultiplierInfo.multiplierList.stream().filter(x->x.Mode.toLowerCase().equals(gateName)).findFirst().orElse(null);
+ if(data == null) {
+ return false;
+ }
+ return data.Value >= 0;
+ }
+
+ public synchronized GalaxyGate.GateSpinData SpinGateAsync(GalaxyGate.GalaxyGateEnum gate, boolean useMultiplier) {
+ String spinUrl = "";
+ if(useMultiplier && IsMultiplierAvailable(gate)) {
+ spinUrl = Urls.getBaseUrl(accountData.getServer())+Urls.getSpinGateMultiplier(accountData.getUserId(), accountData.getSessionId(), gate.getGateId(), gate.getDisplayNameReal().toLowerCase());
+ if(gateData.Samples>0) {
+ spinUrl = Urls.getBaseUrl(accountData.getServer())+Urls.getSpinGateSampleMultiplier(accountData.getUserId(), accountData.getSessionId(), gate.getGateId(), gate.getDisplayNameReal().toLowerCase());
+ }
+ } else {
+ spinUrl = Urls.getBaseUrl(accountData.getServer())+Urls.getSpinGate(accountData.getUserId(), accountData.getSessionId(), gate.getGateId(), gate.getDisplayNameReal().toLowerCase());
+ if(gateData.Samples>0) {
+ spinUrl = Urls.getBaseUrl(accountData.getServer())+Urls.getSpinGateSample(accountData.getUserId(), accountData.getSessionId(), gate.getGateId(), gate.getDisplayNameReal().toLowerCase());
+ }
+ }
+
+ String resultString = "";
+ try {
+ GalaxyGate.GateSpinData result;
+ resultString = Http.readResponse(doHttpClient.getConnection2(spinUrl));
+ StringReader reader = new StringReader(resultString);
+ JAXBContext jaxbContext = JAXBContext.newInstance(GalaxyGate.GateSpinData.class);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ result = (GalaxyGate.GateSpinData) unmarshaller.unmarshal(reader);
+
+ EvaluateSpin(result);
+ return result;
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private void EvaluateSpin(GalaxyGate.GateSpinData spinData) {
+ try {
+ GalaxyGate.GateItemsReceived.TotalSpins++;
+ gateData.Samples = spinData.Samples;
+ gateData.EnergyCost.Text = spinData.EnergyCost.Text;
+ gateData.Money = spinData.Money;
+ gateData.MultiplierInfo = spinData.MultiplierInfo;
+
+ for (GalaxyGate.GateSpinData.Item spinItem:spinData.Items.GetAllItems()) {
+ if(spinItem.Type.equals("part") && !spinItem.Duplicate) {
+ GalaxyGate.GateItemsReceived.GateParts++;
+ GalaxyGate.Gate gate = gateData.Gates.Gates.stream().filter(x->x.id == spinItem.GateId).findAny().orElse(null);
+ if(gate != null) {
+ gate.total = spinItem.Total;
+ gate.current = spinItem.Current;
+ }
+ }
+
+ if(spinItem.Type.equals("battery")) {
+ switch (spinItem.ItemId) {
+ case 2:
+ GalaxyGate.GateItemsReceived.X2 += spinItem.Amount;
+ break;
+ case 3:
+ GalaxyGate.GateItemsReceived.X3 += spinItem.Amount;
+ break;
+ case 4:
+ GalaxyGate.GateItemsReceived.X4 += spinItem.Amount;
+ break;
+ case 5:
+ GalaxyGate.GateItemsReceived.SAB += spinItem.Amount;
+ break;
+ }
+ }
+
+ if(spinItem.Type.equals("ore") && spinItem.ItemId == 4) {
+ GalaxyGate.GateItemsReceived.Xenomit += spinItem.Amount;
+ }
+
+ if (spinItem.Type.equals("rocket"))
+ {
+ switch (spinItem.ItemId)
+ {
+ case 3:
+ GalaxyGate.GateItemsReceived.PLT2021 += spinItem.Amount;
+ break;
+ case 11:
+ GalaxyGate.GateItemsReceived.ACM += spinItem.Amount;
+ break;
+ }
+ }
+
+ if (spinItem.Type.equals("logfile"))
+ {
+ GalaxyGate.GateItemsReceived.LogDisks += spinItem.Amount;
+ }
+
+ if (spinItem.Type.equals("voucher"))
+ {
+ GalaxyGate.GateItemsReceived.RepairCredits += spinItem.Amount;
+ }
+
+ if (spinItem.Type.equals("nanohull"))
+ {
+ GalaxyGate.GateItemsReceived.NanoHull += spinItem.Amount;
+ }
+
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public synchronized boolean PlaceGateAsync(GalaxyGate.GalaxyGateEnum gate) {
+ try {
+ String url = Urls.getBaseUrl(accountData.getServer())+Urls.getPlaceGate(accountData.getUserId(), accountData.getSessionId(), gate.getGateId());
+ String placed = Http.readResponse(doHttpClient.getConnection2(url));
+ return !placed.contains("not_enough_parts");
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+}
diff --git a/src/main/java/com/srfairyox/Corvus/DarkOrbit/Data/AccountData.java b/src/main/java/com/srfairyox/Corvus/DarkOrbit/Data/AccountData.java
new file mode 100644
index 0000000..bdfd570
--- /dev/null
+++ b/src/main/java/com/srfairyox/Corvus/DarkOrbit/Data/AccountData.java
@@ -0,0 +1,70 @@
+package com.srfairyox.Corvus.DarkOrbit.Data;
+
+public class AccountData {
+ private String Username;
+ private String Password;
+ private String SessionId;
+ private String UserId;
+ private String Server;
+ private Boolean UsernamePasswordLogin;
+
+ public String getUsername() {
+ return Username;
+ }
+
+ public void setUsername(String username) {
+ Username = username;
+ }
+
+ public String getPassword() {
+ return Password;
+ }
+
+ public void setPassword(String password) {
+ Password = password;
+ }
+
+ public String getSessionId() {
+ return SessionId;
+ }
+
+ public void setSessionId(String sessionId) {
+ SessionId = sessionId;
+ }
+
+ public String getUserId() {
+ return UserId;
+ }
+
+ public void setUserId(String userId) {
+ UserId = userId;
+ }
+
+ public String getServer() {
+ return Server;
+ }
+
+ public void setServer(String server) {
+ Server = server;
+ }
+
+ public Boolean getUsernamePasswordLogin() {
+ return UsernamePasswordLogin;
+ }
+
+ public void setUsernamePasswordLogin(Boolean usernamePasswordLogin) {
+ UsernamePasswordLogin = usernamePasswordLogin;
+ }
+
+ @Override
+ public String toString() {
+ return "AccountData{" +
+ "Username='" + Username + '\'' +
+ ", Password='" + Password + '\'' +
+ ", SessionId='" + SessionId + '\'' +
+ ", UserId='" + UserId + '\'' +
+ ", Server='" + Server + '\'' +
+ ", UsernamePasswordLogin=" + UsernamePasswordLogin +
+ '}';
+ }
+}
diff --git a/src/main/java/com/srfairyox/Corvus/DarkOrbit/Data/GalaxyGate.java b/src/main/java/com/srfairyox/Corvus/DarkOrbit/Data/GalaxyGate.java
new file mode 100644
index 0000000..c91e0f9
--- /dev/null
+++ b/src/main/java/com/srfairyox/Corvus/DarkOrbit/Data/GalaxyGate.java
@@ -0,0 +1,309 @@
+package com.srfairyox.Corvus.DarkOrbit.Data;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlValue;
+import java.util.ArrayList;
+
+public class GalaxyGate {
+ public enum GalaxyGateEnum {
+ None(0, "None", "none"), Alpha(1, "Alpha", "alpha"), Beta(2, "Beta", "beta"), Gamma(3, "Gamma", "gamma"), Delta(4, "Delta", "delta"), Epsilon(5,"Epsilon", "epsilon"), Zeta(6, "Zeta", "zeta"), Kappa(7, "Kappa", "kappa"), Lambda(8, "Lambda", "lambda"), Hades(13, "Hades", "hades"), Kuiper(19, "Kuiper", "streuner");
+
+ private final int gateId;
+ private final String displayName;
+ private final String displayNameReal;
+
+ GalaxyGateEnum(int gateId, String displayName, String displayNameReal) {
+ this.gateId = gateId;
+ this.displayName = displayName;
+ this.displayNameReal = displayNameReal;
+ }
+
+ public int getGateId() {
+ return gateId;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public String getDisplayNameReal() {
+ return displayNameReal;
+ }
+
+ public static String getGateId(int id) {
+ for (GalaxyGateEnum res : GalaxyGateEnum.values()) {
+ if(id == res.gateId) {
+ return res.getDisplayName();
+ }
+ }
+ return null;
+ }
+ }
+
+ @XmlRootElement(name = "multiplier")
+ public static class Multiplier {
+ @XmlAttribute(name = "mode")
+ public String Mode;
+ @XmlAttribute(name = "value")
+ public int Value;
+ @XmlAttribute(name = "state")
+ public int State;
+ }
+
+ @XmlRootElement(name = "multipliers")
+ public static class Multipliers {
+ @XmlElement(name = "multiplier")
+ public ArrayList multiplierList = new ArrayList<>();
+ }
+
+ @XmlRootElement(name = "jumpgate")
+ public static class GateData {
+ @XmlElement(name = "money")
+ public int Money;
+ @XmlElement(name = "samples")
+ public int Samples;
+ @XmlElement(name = "energy_cost")
+ public EnergyCostInfo EnergyCost;
+ @XmlElement(name = "multipliers")
+ public Multipliers MultiplierInfo;
+ @XmlElement(name = "gates")
+ public GatesInfo Gates;
+ @XmlElement(name = "spinOnSale")
+ public int spinOnSale;
+ @XmlElement(name = "spinSalePercentage")
+ public int spinSalePercentage;
+ @XmlElement(name = "galaxyGateDay")
+ public int galaxyGateDay;
+ @XmlElement(name = "bonusRewardsDay")
+ public int bonusRewardsDay;
+ public boolean loaded() {
+ return (this.EnergyCost != null && this.MultiplierInfo != null && this.Gates != null);
+ }
+ }
+
+ @XmlRootElement(name = "energy_cost")
+ public static class EnergyCostInfo {
+ @XmlAttribute(name = "mode")
+ public String Mode;
+ @XmlValue
+ public int Text;
+ }
+
+ @XmlRootElement(name = "gate")
+ public static class Gate {
+ @XmlAttribute(name = "total")
+ public int total;
+ @XmlAttribute(name = "current")
+ public int current;
+ @XmlAttribute(name = "id")
+ public int id;
+ @XmlAttribute(name = "prepared")
+ public Boolean prepared;
+ @XmlAttribute(name = "totalWave")
+ public int totalWave;
+ @XmlAttribute(name = "currentWave")
+ public int currentWave;
+ @XmlAttribute(name = "state")
+ public String state;
+ @XmlAttribute(name = "livesLeft")
+ public int livesLeft;
+ @XmlAttribute(name = "lifePrice")
+ public int lifePrice;
+ public boolean isReady() {
+ return (this.current == this.total);
+ }
+ }
+
+ @XmlRootElement(name = "gates")
+ public static class GatesInfo {
+ @XmlElement(name = "gate")
+ public ArrayList Gates = new ArrayList<>();
+
+ public Gate Get(GalaxyGateEnum gate) {
+ return Gates.stream().filter(x->x.id == gate.gateId).findAny().orElse(null);
+ }
+ public Gate Alpha() {
+ return Gates.stream().filter(x->x.id == GalaxyGateEnum.Alpha.gateId).findAny().orElse(null);
+ }
+ public Gate Beta() {
+ return Gates.stream().filter(x->x.id == GalaxyGateEnum.Beta.gateId).findAny().orElse(null);
+ }
+ public Gate Gamma() {
+ return Gates.stream().filter(x->x.id == GalaxyGateEnum.Gamma.gateId).findAny().orElse(null);
+ }
+ public Gate Delta() {
+ return Gates.stream().filter(x->x.id == GalaxyGateEnum.Delta.gateId).findAny().orElse(null);
+ }
+ public Gate Epsilon() {
+ return Gates.stream().filter(x->x.id == GalaxyGateEnum.Epsilon.gateId).findAny().orElse(null);
+ }
+ public Gate Zeta() {
+ return Gates.stream().filter(x->x.id == GalaxyGateEnum.Zeta.gateId).findAny().orElse(null);
+ }
+ public Gate Kappa() {
+ return Gates.stream().filter(x->x.id == GalaxyGateEnum.Kappa.gateId).findAny().orElse(null);
+ }
+ public Gate Lambda() {
+ return Gates.stream().filter(x->x.id == GalaxyGateEnum.Lambda.gateId).findAny().orElse(null);
+ }
+ public Gate Kuiper() {
+ return Gates.stream().filter(x->x.id == GalaxyGateEnum.Kuiper.gateId).findAny().orElse(null);
+ }
+ public Gate Hades() {
+ return Gates.stream().filter(x->x.id == GalaxyGateEnum.Hades.gateId).findAny().orElse(null);
+ }
+ }
+
+ @XmlRootElement(name = "jumpgate")
+ public static class GateSpinData {
+ @XmlElement(name = "money")
+ public int Money;
+ @XmlElement(name = "samples")
+ public int Samples;
+ @XmlElement(name = "energy_cost")
+ public EnergyCostInfo EnergyCost;
+ @XmlElement(name = "items")
+ public ItemsInfo Items;
+ @XmlElement(name = "multipliers")
+ public Multipliers MultiplierInfo;
+
+ @XmlRootElement(name = "energy_cost")
+ public static class EnergyCostInfo {
+ @XmlAttribute(name = "mode")
+ public String Mode;
+ @XmlValue
+ public int Text;
+ }
+
+ @XmlRootElement(name = "item")
+ public static class Item {
+ @XmlAttribute(name = "type")
+ public String Type;
+ @XmlAttribute(name = "item_id")
+ public int ItemId;
+ @XmlAttribute(name = "amount")
+ public int Amount;
+ @XmlAttribute(name = "current")
+ public int Current;
+ @XmlAttribute(name = "total")
+ public int Total;
+ @XmlAttribute(name = "state")
+ public String State;
+ @XmlAttribute(name = "date")
+ public String Date;
+ @XmlAttribute(name = "gate_id")
+ public int GateId;
+ @XmlAttribute(name = "part_id")
+ public int PartId;
+ @XmlAttribute(name = "multiplier_used")
+ public int MultiplierUsed;
+ @XmlAttribute(name = "duplicate")
+ public boolean Duplicate;
+
+ public String ToString() {
+ if (Type.equals("part"))
+ {
+ return GalaxyGateEnum.getGateId(GateId)+" part #"+PartId+" ("+Current+"/"+Total+")";
+ }
+
+ if (Type.equals("battery"))
+ {
+ switch (ItemId)
+ {
+ case 2:
+ return "X2: "+Amount;
+ case 3:
+ return "X3: "+Amount;
+ case 4:
+ return "X4: "+Amount;
+ case 5:
+ return "SAB: "+Amount;
+ }
+ }
+
+ if (Type.equals("ore") && ItemId == 4)
+ {
+ return "Xenomit: "+Amount;
+ }
+
+ if (Type.equals("rocket"))
+ {
+ switch (ItemId)
+ {
+ case 3:
+ return "PLT-2021: "+Amount;
+ case 11:
+ return "ACM: "+Amount;
+ }
+ }
+
+ if (Type.equals("logfile"))
+ {
+ return "Log Disks: "+Amount;
+ }
+
+ if (Type.equals("voucher"))
+ {
+ return "Repair credits: "+Amount;
+ }
+
+ if (Type.equals("nanohull"))
+ {
+ return "Nano hull: "+Amount;
+ }
+
+ return Type+":"+Amount;
+ }
+ }
+ }
+
+ @XmlRootElement(name = "items")
+ public static class ItemsInfo {
+ @XmlElement(name = "item")
+ public ArrayList Items;
+ public GateSpinData.Item Item;
+
+ public ArrayList GetAllItems() {
+ if(Items == null) {
+ Items = new ArrayList<>();
+ }
+ if(Item != null) {
+ Items.add(Item);
+ }
+ return Items;
+ }
+ }
+
+ public static class GateItemsReceived {
+ public static int TotalSpins;
+ public static int GateParts;
+ public static int X2;
+ public static int X3;
+ public static int X4;
+ public static int SAB;
+ public static int PLT2021;
+ public static int ACM;
+ public static int LogDisks;
+ public static int RepairCredits;
+ public static int Xenomit;
+ public static int NanoHull;
+
+ public void Reset() {
+ TotalSpins = 0;
+ GateParts = 0;
+ X2 = 0;
+ X3 = 0;
+ X4 = 0;
+ SAB = 0;
+ PLT2021 = 0;
+ ACM = 0;
+ LogDisks = 0;
+ RepairCredits = 0;
+ Xenomit = 0;
+ NanoHull = 0;
+ }
+ }
+
+}
diff --git a/src/main/java/com/srfairyox/Corvus/Gate.java b/src/main/java/com/srfairyox/Corvus/Gate.java
new file mode 100644
index 0000000..d9d0cc3
--- /dev/null
+++ b/src/main/java/com/srfairyox/Corvus/Gate.java
@@ -0,0 +1,92 @@
+package com.srfairyox.Corvus;
+
+import javafx.beans.property.SimpleBooleanProperty;
+import javafx.beans.property.SimpleIntegerProperty;
+import javafx.beans.property.SimpleStringProperty;
+
+public class Gate {
+ private final SimpleStringProperty name;
+ private final SimpleStringProperty parts;
+ private final SimpleBooleanProperty ready;
+ private final SimpleBooleanProperty onMap;
+ private final SimpleIntegerProperty gatesBuilt;
+
+ public Gate(String name, String parts, Boolean ready, Boolean onMap, int gatesBuilt) {
+ this.name = new SimpleStringProperty(name);
+ this.parts = new SimpleStringProperty(parts);
+ this.ready = new SimpleBooleanProperty(ready);
+ this.onMap = new SimpleBooleanProperty(onMap);
+ this.gatesBuilt = new SimpleIntegerProperty(gatesBuilt);
+ }
+
+ public String getName() {
+ return name.get();
+ }
+
+ public SimpleStringProperty nameProperty() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name.set(name);
+ }
+
+ public String getParts() {
+ return parts.get();
+ }
+
+ public SimpleStringProperty partsProperty() {
+ return parts;
+ }
+
+ public void setParts(String parts) {
+ this.parts.set(parts);
+ }
+
+ public boolean isReady() {
+ return ready.get();
+ }
+
+ public SimpleBooleanProperty readyProperty() {
+ return ready;
+ }
+
+ public void setReady(boolean ready) {
+ this.ready.set(ready);
+ }
+
+ public boolean isOnMap() {
+ return onMap.get();
+ }
+
+ public SimpleBooleanProperty onMapProperty() {
+ return onMap;
+ }
+
+ public void setOnMap(boolean onMap) {
+ this.onMap.set(onMap);
+ }
+
+ public int getGatesBuilt() {
+ return gatesBuilt.get();
+ }
+
+ public SimpleIntegerProperty gatesBuiltProperty() {
+ return gatesBuilt;
+ }
+
+ public void setGatesBuilt(String gatesBuilt) {
+ this.gatesBuilt.set(Integer.parseInt(gatesBuilt));
+ }
+
+ @Override
+ public String toString() {
+ return "Gate{" +
+ "name=" + name +
+ ", parts=" + parts +
+ ", ready=" + ready +
+ ", onMap=" + onMap +
+ ", gatesBuilt=" + gatesBuilt +
+ '}';
+ }
+}
diff --git a/src/main/java/com/srfairyox/Corvus/Http/DOHttpClient.java b/src/main/java/com/srfairyox/Corvus/Http/DOHttpClient.java
new file mode 100644
index 0000000..840c128
--- /dev/null
+++ b/src/main/java/com/srfairyox/Corvus/Http/DOHttpClient.java
@@ -0,0 +1,24 @@
+package com.srfairyox.Corvus.Http;
+
+import java.net.*;
+
+public class DOHttpClient {
+
+ public void initialize() {
+ CookieManager cookies = new CookieManager(null, CookiePolicy.ACCEPT_ALL);
+ CookieHandler.setDefault(cookies);
+ }
+
+ public HttpURLConnection getConnection(String url, String sid) throws Exception {
+ HttpURLConnection conn = (HttpURLConnection)(new URL(url)).openConnection();
+ conn.setInstanceFollowRedirects(false);
+ conn.setRequestProperty("Cookie", "dosid=" + sid);
+ return conn;
+ }
+
+ public HttpURLConnection getConnection2(String url) throws Exception {
+ HttpURLConnection conn = (HttpURLConnection)(new URL(url)).openConnection();
+ conn.setInstanceFollowRedirects(false);
+ return conn;
+ }
+}
diff --git a/src/main/java/com/srfairyox/Corvus/Http/Http.java b/src/main/java/com/srfairyox/Corvus/Http/Http.java
new file mode 100644
index 0000000..20120af
--- /dev/null
+++ b/src/main/java/com/srfairyox/Corvus/Http/Http.java
@@ -0,0 +1,31 @@
+package com.srfairyox.Corvus.Http;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+
+public class Http {
+ public static String readResponse(HttpURLConnection conn) {
+ try {
+ InputStream inputStream;
+ int responseCode = conn.getResponseCode();
+ if (200 <= responseCode && responseCode <= 299) {
+ inputStream = conn.getInputStream();
+ } else {
+ inputStream = conn.getErrorStream();
+ }
+ if (inputStream == null)
+ return "ERR";
+ BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
+ StringBuilder response = new StringBuilder();
+ String currentLine;
+ while ((currentLine = in.readLine()) != null)
+ response.append(currentLine);
+ in.close();
+ return response.toString();
+ } catch (Exception e) {
+ return "ERR";
+ }
+ }
+}
diff --git a/src/main/java/com/srfairyox/Corvus/Http/Urls.java b/src/main/java/com/srfairyox/Corvus/Http/Urls.java
new file mode 100644
index 0000000..34c4630
--- /dev/null
+++ b/src/main/java/com/srfairyox/Corvus/Http/Urls.java
@@ -0,0 +1,56 @@
+package com.srfairyox.Corvus.Http;
+
+public class Urls {
+
+ public static String getBaseUrl(String server) {
+ return "https://"+server+".darkorbit.com";
+ }
+
+ public static String getOpenBackPage(String sid) {
+ return "/?dosid="+sid;
+ }
+
+ public static String getInternalStart() {
+ return "/indexInternal.es?action=internalStart";
+ }
+
+ public static String getSpinGate(String userID, String sid, int gateId, String gateName) {
+ return "/flashinput/galaxyGates.php?userID="+userID+"&action=multiEnergy&sid="+sid+"&gateID="+gateId+"&"+gateName+"=1";
+ }
+
+ public static String getSpinGateMultiplier(String userID, String sid, int gateId, String gateName) {
+ return "/flashinput/galaxyGates.php?userID="+userID+"&action=multiEnergy&sid="+sid+"&gateID="+gateId+"&"+gateName+"=1&multiplier=1";
+ }
+
+ public static String getSpinGateAmount(String userID, String sid, String gateId, String gateName, String spinAmount) {
+ return "/flashinput/galaxyGates.php?userID="+userID+"&action=multiEnergy&sid="+sid+"&gateID="+gateId+"&"+gateName+"=1&spinamount="+spinAmount;
+ }
+
+ public static String getSpinGateMultiplierAmount(String userID, String sid, String gateId, String gateName, String spinAmount) {
+ return "/flashinput/galaxyGates.php?userID="+userID+"&action=multiEnergy&sid="+sid+"&gateID="+gateId+"&"+gateName+"=1&multiplier=1&spinamount="+spinAmount;
+ }
+
+ public static String getSpinGateSample(String userID, String sid, int gateId, String gateName) {
+ return "/flashinput/galaxyGates.php?userID="+userID+"&action=multiEnergy&sid="+sid+"&gateID="+gateId+"&"+gateName+"=1&sample=1";
+ }
+
+ public static String getSpinGateSampleMultiplier(String userID, String sid, int gateId, String gateName) {
+ return "/flashinput/galaxyGates.php?userID="+userID+"&action=multiEnergy&sid="+sid+"&gateID="+gateId+"&"+gateName+"=1&multiplier=1&sample=1";
+ }
+
+ public static String getSpinGateSampleAmount(String userID, String sid, String gateId, String gateName, String spinAmount) {
+ return "/flashinput/galaxyGates.php?userID="+userID+"&action=multiEnergy&sid="+sid+"&gateID="+gateId+"&"+gateName+"=1&sample=1&spinamount="+spinAmount;
+ }
+
+ public static String getSpinGateSampleMultiplierAmount(String userID, String sid, String gateId, String gateName, String spinAmount) {
+ return "/flashinput/galaxyGates.php?userID="+userID+"&action=multiEnergy&sid="+sid+"&gateID="+gateId+"&"+gateName+"=1&multiplier=1&sample=1&spinamount="+spinAmount;
+ }
+
+ public static String getGateInfo(String userID, String sid) {
+ return "/flashinput/galaxyGates.php?userID="+userID+"&action=init&sid="+sid;
+ }
+
+ public static String getPlaceGate(String userID, String sid, int gateId) {
+ return "/flashinput/galaxyGates.php?userID="+userID+"&sid="+sid+"&action=setupGate&gateID="+gateId;
+ }
+}
diff --git a/src/main/java/com/srfairyox/Corvus/Main.java b/src/main/java/com/srfairyox/Corvus/Main.java
new file mode 100644
index 0000000..2c5914d
--- /dev/null
+++ b/src/main/java/com/srfairyox/Corvus/Main.java
@@ -0,0 +1,51 @@
+package com.srfairyox.Corvus;
+
+import com.srfairyox.Corvus.Config.ConfigLoader;
+import javafx.application.Application;
+import javafx.application.Platform;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.scene.image.Image;
+import javafx.stage.Stage;
+
+import java.io.File;
+import java.io.IOException;
+
+public class Main extends Application {
+ public static Controller controller;
+ public static Main instance;
+
+ @Override
+ public void start(Stage primaryStage) throws Exception{
+ instance = this;
+ FXMLLoader loader = new FXMLLoader(getClass().getResource("/Corvus.fxml"));
+ Parent root = loader.load();
+ controller = loader.getController();
+
+ primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("/corvus_img.png")));
+ primaryStage.setTitle("Corvus - DarkOrbit Bot Helper");
+ primaryStage.setScene(new Scene(root, 771, 520));
+ primaryStage.setResizable(false);
+ primaryStage.show();
+
+
+ ConfigLoader configLoader = new ConfigLoader();
+
+ primaryStage.setOnCloseRequest(event -> {
+ try {
+ configLoader.save(controller.chkEnableLog.isSelected(), controller.chkEnableDebugCMD.isSelected(), controller.cBoxGates.getSelectionModel().getSelectedIndex(), controller.chkBoxPlaceGateOnMap.isSelected(), controller.chkBoxSpinOnlyEE.isSelected(), Integer.parseInt(controller.txtMinUridium.getText()), Integer.parseInt(controller.txtMaxSpinCost.getText()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ Platform.exit();
+ System.exit(0);
+ });
+ }
+
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/src/main/resources/Corvus.fxml b/src/main/resources/Corvus.fxml
new file mode 100644
index 0000000..dadba90
--- /dev/null
+++ b/src/main/resources/Corvus.fxml
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/config.json b/src/main/resources/config.json
new file mode 100644
index 0000000..195f213
--- /dev/null
+++ b/src/main/resources/config.json
@@ -0,0 +1 @@
+{"placeGateOnMap":true,"enableLog":true,"spinOnlyEE":false,"gateSelectedIndex":3,"maxSpinCost":100,"enableDebugConsole":true,"minUridium":5854}
\ No newline at end of file
diff --git a/src/main/resources/corvus_img.png b/src/main/resources/corvus_img.png
new file mode 100644
index 0000000..9464766
Binary files /dev/null and b/src/main/resources/corvus_img.png differ