Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Commit

Permalink
Partial fix for 3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael committed Apr 17, 2021
1 parent b513db5 commit ff8f92c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public List<String> getLeagues() {

log.debug("Getting leagues from pathofexile.com");
Request request = new Request.Builder()
.url("http://api.pathofexile.com/leagues")
.url("http://www.pathofexile.com/api/leagues")
.build();
Response response;
try {
Expand All @@ -102,7 +102,7 @@ public List<String> getLeagues() {

private void getStats() {
Request request = new Request.Builder()
.url("http://api.pathofexile.com/trade/data/stats")
.url("http://www.pathofexile.com/api/trade/data/stats")
.build();
StatsResponse statsResponse;
try {
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/dev/tricht/lunaris/item/parser/NamePart.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ public NamePart(ArrayList<String> lines) {
}

private String getRarityRaw() {
return lines.get(0).split("Rarity: ")[1];
return lines.get(1).split("Rarity: ")[1];
}

public ItemRarity getRarity() {
switch(lines.get(0).split("Rarity: ")[1]) {
switch(lines.get(1).split("Rarity: ")[1]) {
case "Magic":
return ItemRarity.MAGIC;
case "Rare":
Expand All @@ -45,36 +46,36 @@ public ItemRarity getRarity() {
}

public String getFullName() {
if (lines.size() == 2) {
return sanitizeName(lines.get(1));
if (lines.size() == 3) {
return sanitizeName(lines.get(2));
}

return sanitizeName(lines.get( lines.size() - 2) + " " + lines.get( lines.size() - 1));
}

public String getItemName() {
if (lines.size() == 2) {
if (lines.size() == 3) {
return "";
}
return sanitizeName(lines.get(1));
return sanitizeName(lines.get(2));
}

public String getBaseName() {
if (lines.size() == 2) {
return sanitizeName(lines.get(1));
if (lines.size() == 3) {
return sanitizeName(lines.get(2));
}

return sanitizeName(lines.get(2));
return sanitizeName(lines.get(3));
}

private String sanitizeName(String name) {
return name.replace("Superior ", "");
}

public ItemType getItemType() {
int lineNum = 1;
if (getRarity() == ItemRarity.UNIQUE || getRarity() == ItemRarity.RARE) {
lineNum = Math.min(2, lines.size() - 1);
int lineNum = 2;
if (getRarity() == ItemRarity.UNIQUE) {
lineNum = Math.min(3, lines.size() - 1);
}
String name = sanitizeName(lines.get(lineNum));

Expand Down Expand Up @@ -147,7 +148,6 @@ public ItemType getItemType() {
return new EquipmentItem(EquipmentSlot.BODY_ARMOUR);
}


return new UnknownItem();
}

Expand Down

0 comments on commit ff8f92c

Please sign in to comment.