Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring cleaning rescue #12

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ build/
dist/
.DS_Store

bin/
.classpath
.project
PathOfLeveling-*.jar
Binary file added lib/commons-codec-1.12-sources.jar
Binary file not shown.
Binary file added lib/commons-codec-1.12.jar
Binary file not shown.
11 changes: 4 additions & 7 deletions src/poe/level/data/Act.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
package poe.level.data;

import java.util.ArrayList;

public class Act {
int actid;
String act;
public ArrayList<Zone> zones;

public Act(int actId, String act){
this.actid = actId;
public Act(int actId, String act) {
this.zones = new ArrayList<Zone>();
this.act= act;
}

public ArrayList<Zone> getZones(){
public ArrayList<Zone> getZones() {
return zones;
}

public void putZone(Zone z){
public void putZone(Zone z) {
zones.add(z);
}
}
21 changes: 11 additions & 10 deletions src/poe/level/data/ActHandler.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
package poe.level.data;

import java.util.ArrayList;

public class ActHandler {

private static ActHandler mInstance;

public static synchronized ActHandler getInstance() {
if (mInstance == null ) {
mInstance = new ActHandler();
if (mInstance == null) {
mInstance = new ActHandler();
}
return mInstance;
}
return mInstance;
}


public ArrayList<Act> acts;

public ActHandler(){
public ActHandler() {
acts = new ArrayList<>();
}

public void putAct(Act a){
public void putAct(Act a) {
acts.add(a);
}

public ArrayList<Act> getActs(){
public ArrayList<Act> getActs() {
return acts;
}
}
181 changes: 93 additions & 88 deletions src/poe/level/data/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import java.util.ArrayList;
import java.util.Comparator;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

/**
*
Expand All @@ -24,149 +22,156 @@ public class Build {
public boolean hasPob;
public String pobLink;
public boolean isValid;

public Build(String buildName,String className
, String ascendancyName){

public Build(String buildName, String className, String ascendancyName) {
this.buildName = buildName;
this.className = className;
this.ascendancyName = ascendancyName;
gems = new ArrayList<>();
level = -1;
characterName = "";
}
public String getName(){

public String getName() {
return buildName;
}
public String getClassName(){

public String getClassName() {
return className;
}

public String getAsc(){
public String getAsc() {
return ascendancyName;
}

public ArrayList<SocketGroup> getSocketGroup(){
public ArrayList<SocketGroup> getSocketGroup() {
return gems;
}
public boolean validate(){
System.out.println(">>>>Validating build :"+this.buildName+"... <<<<");
for(SocketGroup sg : getSocketGroup()){
if(sg.getActiveGem()==null){

public boolean validate() {
System.out.println(">>>>Validating build :" + this.buildName + "... <<<<");
for (SocketGroup sg : getSocketGroup()) {
if (sg.getActiveGem() == null) {
System.out.println(">>>>A socket group doesn't have a valid main gem.<<<<");
return false;
}else{
System.out.println("SocketGroup # "+sg.getActiveGem().getGemName());
System.out.println("- Use at level: "+sg.fromGroupLevel);
if(sg.replaceGroup()){
if(sg.getGroupReplaced().getActiveGem()==null){
System.out.println(">>>>Socket group -"+sg.getActiveGem().getGemName()+" replaces with a socket group that doesn't have a valid main gem.");
} else {
System.out.println("SocketGroup # " + sg.getActiveGem().getGemName());
System.out.println("- Use at level: " + sg.fromGroupLevel);
if (sg.replaceGroup()) {
if (sg.getGroupReplaced().getActiveGem() == null) {
System.out.println(">>>>Socket group -" + sg.getActiveGem().getGemName()
+ " replaces with a socket group that doesn't have a valid main gem.");
return false;
}
if(sg.getGroupReplaced().getFromGroupLevel()!=sg.getUntilGroupLevel()){
System.out.println(">>>>Socket group -"+sg.getActiveGem().getGemName()+"- replaces with -"
+sg.getGroupReplaced().getActiveGem().getGemName()+"- and group levels don't match.");
if (sg.getGroupReplaced().getFromGroupLevel() != sg.getUntilGroupLevel()) {
System.out.println(">>>>Socket group -" + sg.getActiveGem().getGemName() + "- replaces with -"
+ sg.getGroupReplaced().getActiveGem().getGemName()
+ "- and group levels don't match.");
return false;
}
System.out.println("- Replace at level: "+sg.untilGroupLevel);
System.out.println("- Replace with : -"+sg.getGroupReplaced().getActiveGem().getGemName()+"- .");
System.out.println("- Replace at level: " + sg.untilGroupLevel);
System.out
.println("- Replace with : -" + sg.getGroupReplaced().getActiveGem().getGemName() + "- .");
}
//inner loop

// inner loop
ArrayList<Gem> sorted = new ArrayList<>(sg.getGems());
sorted.sort(Comparator.comparing(Gem::getLevelAdded));
for(Gem g : sorted){
if(g.getGemName().equals("<empty group>")){
for (Gem g : sorted) {
if (g.getGemName().equals("<empty group>")) {
System.out.println(">>>>A gem in this socket group is not set.<<<<");
return false;
}
System.out.println("--Gem # "+g.getGemName());
System.out.println("--- Use at level: "+g.getLevelAdded());
if(g.replaced){
if(g.replacedWith==null){
System.out.println(">>>>Gem -"+g.getGemName()+" replacement has not been set.");
System.out.println("--Gem # " + g.getGemName());
System.out.println("--- Use at level: " + g.getLevelAdded());
if (g.replaced) {
if (g.replacedWith == null) {
System.out.println(">>>>Gem -" + g.getGemName() + " replacement has not been set.");
return false;
}
if(g.replacedWith.getLevelAdded()<=g.getLevelAdded()){
System.out.println(">>>>Gem -"+g.getGemName()+"- replaces with -"
+g.replacedWith.getGemName()+"- and change level don't match.");
if (g.replacedWith.getLevelAdded() <= g.getLevelAdded()) {
System.out.println(">>>>Gem -" + g.getGemName() + "- replaces with -"
+ g.replacedWith.getGemName() + "- and change level don't match.");
return false;
}
System.out.println("--- Replace at level: "+g.replacedWith.getLevelAdded());
System.out.println("--- Replace with : -"+g.replacedWith.getGemName()+"- .");
System.out.println("--- Replace at level: " + g.replacedWith.getLevelAdded());
System.out.println("--- Replace with : -" + g.replacedWith.getGemName() + "- .");
}
}
}
}
//isValid = true;
// isValid = true;
return true;
}
public String validate_failed_string(){

public String validate_failed_string() {
String error = "";
System.out.println(">>>>Validating build :"+this.buildName+"... <<<<");
error += ">>>>Validating build :"+this.buildName+"... <<<<\n";
for(SocketGroup sg : getSocketGroup()){
if(sg.getActiveGem()==null){
System.out.println(">>>>Validating build :" + this.buildName + "... <<<<");
error += ">>>>Validating build :" + this.buildName + "... <<<<\n";
for (SocketGroup sg : getSocketGroup()) {
if (sg.getActiveGem() == null) {
System.out.println(">>>>A socket group doesn't have a valid main gem.<<<<");
error += ">>>>A socket group doesn't have a valid main gem.<<<<";
return error;
}else{
System.out.println("SocketGroup # "+sg.getActiveGem().getGemName());
error+="SocketGroup # "+sg.getActiveGem().getGemName()+"\n";
System.out.println("- Use at level: "+sg.fromGroupLevel);
error+="- Use at level: "+sg.fromGroupLevel+"\n";
if(sg.replaceGroup()){
if(sg.getGroupReplaced().getActiveGem()==null){
System.out.println(">>>>Socket group -"+sg.getActiveGem().getGemName()+" replaces with a socket group that doesn't have a valid main gem.");
error+=">>>>Socket group -"+sg.getActiveGem().getGemName()+" replaces with a socket group that doesn't have a valid main gem.\n";
} else {
System.out.println("SocketGroup # " + sg.getActiveGem().getGemName());
error += "SocketGroup # " + sg.getActiveGem().getGemName() + "\n";
System.out.println("- Use at level: " + sg.fromGroupLevel);
error += "- Use at level: " + sg.fromGroupLevel + "\n";
if (sg.replaceGroup()) {
if (sg.getGroupReplaced().getActiveGem() == null) {
System.out.println(">>>>Socket group -" + sg.getActiveGem().getGemName()
+ " replaces with a socket group that doesn't have a valid main gem.");
error += ">>>>Socket group -" + sg.getActiveGem().getGemName()
+ " replaces with a socket group that doesn't have a valid main gem.\n";
return error;
}
if(sg.getGroupReplaced().getFromGroupLevel()!=sg.getUntilGroupLevel()){
System.out.println(">>>>Socket group -"+sg.getActiveGem().getGemName()+"- replaces with -"
+sg.getGroupReplaced().getActiveGem().getGemName()+"- and group levels don't match.");
error+=">>>>Socket group -"+sg.getActiveGem().getGemName()+"- replaces with -"
+sg.getGroupReplaced().getActiveGem().getGemName()+"- and group levels don't match.\n";
if (sg.getGroupReplaced().getFromGroupLevel() != sg.getUntilGroupLevel()) {
System.out.println(">>>>Socket group -" + sg.getActiveGem().getGemName() + "- replaces with -"
+ sg.getGroupReplaced().getActiveGem().getGemName()
+ "- and group levels don't match.");
error += ">>>>Socket group -" + sg.getActiveGem().getGemName() + "- replaces with -"
+ sg.getGroupReplaced().getActiveGem().getGemName()
+ "- and group levels don't match.\n";
return error;
}
System.out.println("- Replace at level: "+sg.untilGroupLevel);
error+="- Replace at level: "+sg.untilGroupLevel+"\n";
System.out.println("- Replace with : -"+sg.getGroupReplaced().getActiveGem().getGemName()+"- .");
error+="- Replace with : -"+sg.getGroupReplaced().getActiveGem().getGemName()+"- .\n";
System.out.println("- Replace at level: " + sg.untilGroupLevel);
error += "- Replace at level: " + sg.untilGroupLevel + "\n";
System.out
.println("- Replace with : -" + sg.getGroupReplaced().getActiveGem().getGemName() + "- .");
error += "- Replace with : -" + sg.getGroupReplaced().getActiveGem().getGemName() + "- .\n";
}
//inner loop

// inner loop
ArrayList<Gem> sorted = new ArrayList<>(sg.getGems());
sorted.sort(Comparator.comparing(Gem::getLevelAdded));
for(Gem g : sorted){
if(g.getGemName().equals("<empty group>")){
for (Gem g : sorted) {
if (g.getGemName().equals("<empty group>")) {
System.out.println(">>>>A gem in this socket group is not set.<<<<");
error+=">>>>A gem in this socket group is not set.<<<<\n";
error += ">>>>A gem in this socket group is not set.<<<<\n";
return error;
}
System.out.println("--Gem # "+g.getGemName());
error+="--Gem # "+g.getGemName()+"\n";
System.out.println("--- Use at level: "+g.getLevelAdded());
error+="--- Use at level: "+g.getLevelAdded()+"\n";
if(g.replaced){
if(g.replacedWith==null){
System.out.println(">>>>Gem -"+g.getGemName()+" replacement has not been set.");
error+=">>>>Gem -"+g.getGemName()+" replacement has not been set.\n";
System.out.println("--Gem # " + g.getGemName());
error += "--Gem # " + g.getGemName() + "\n";
System.out.println("--- Use at level: " + g.getLevelAdded());
error += "--- Use at level: " + g.getLevelAdded() + "\n";
if (g.replaced) {
if (g.replacedWith == null) {
System.out.println(">>>>Gem -" + g.getGemName() + " replacement has not been set.");
error += ">>>>Gem -" + g.getGemName() + " replacement has not been set.\n";
return error;
}
if(g.replacedWith.getLevelAdded()<=g.getLevelAdded()){
System.out.println(">>>>Gem -"+g.getGemName()+"- replaces with -"
+g.replacedWith.getGemName()+"- and change level don't match.");
error+=">>>>Gem -"+g.getGemName()+"- replaces with -"
+g.replacedWith.getGemName()+"- and change level don't match.\n";
if (g.replacedWith.getLevelAdded() <= g.getLevelAdded()) {
System.out.println(">>>>Gem -" + g.getGemName() + "- replaces with -"
+ g.replacedWith.getGemName() + "- and change level don't match.");
error += ">>>>Gem -" + g.getGemName() + "- replaces with -" + g.replacedWith.getGemName()
+ "- and change level don't match.\n";
return error;
}
System.out.println("--- Replace at level: "+g.replacedWith.getLevelAdded());
error+="--- Replace at level: "+g.replacedWith.getLevelAdded()+"\n";
System.out.println("--- Replace with : -"+g.replacedWith.getGemName()+"- .");
error+="--- Replace with : -"+g.replacedWith.getGemName()+"- .\n";
System.out.println("--- Replace at level: " + g.replacedWith.getLevelAdded());
error += "--- Replace at level: " + g.replacedWith.getLevelAdded() + "\n";
System.out.println("--- Replace with : -" + g.replacedWith.getGemName() + "- .");
error += "--- Replace with : -" + g.replacedWith.getGemName() + "- .\n";
}
}
}
Expand Down
Loading