Skip to content

Commit

Permalink
QuestProxy updated
Browse files Browse the repository at this point in the history
  • Loading branch information
dm94 committed Oct 23, 2023
1 parent 02019db commit b91744f
Showing 1 changed file with 58 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,6 @@ public void update() {
this.completed = API.readMemoryBoolean(address + 0x38);
this.activable = API.readMemoryBoolean(address + 0x3C);
this.title = API.readMemoryString(address, 0x58);

/*
* Types:
* questType_kill - NPC/Player Kill
* questType_collect - Resources Farm
* questType_epic - Various types
* questType_discovery - Go to x points
* questType_daily1
*/

this.type = API.readMemoryString(address, 0x70);
}

Expand Down Expand Up @@ -139,12 +129,13 @@ public static class Quest extends Auto {
private String title;
private int conditionsCount;
private int id;
private boolean completed;

private final List<Contition> conditionItems = new ArrayList<>();
private final ObjArray conditionItemsArr = ObjArray.ofVector(true);
private final ObjArray conditionItemsArr = ObjArray.ofArrObj(true);

private final List<Reward> rewardItems = new ArrayList<>();
private final ObjArray rewardItemsArr = ObjArray.ofVector(true);
private final ObjArray rewardItemsArr = ObjArray.ofArrObj(true);

@Override
public void update() {
Expand All @@ -160,6 +151,7 @@ public void update() {

long conditionsAddr = API.readMemoryLong(address + 0x38) & ByteUtils.ATOM_MASK;
this.conditionsCount = API.readMemoryInt(conditionsAddr + 0x30);
this.completed = API.readMemoryBoolean(conditionsAddr, 0x38);

conditionItemsArr.update(API.readMemoryPtr(conditionsAddr + 0x40));
conditionItemsArr.sync(conditionItems, Contition::new);
Expand Down Expand Up @@ -191,33 +183,70 @@ public String getDescription() {
public int getConditionsCount() {
return conditionsCount;
}

public boolean isCompleted() {
return completed;
}

public List<Contition> getConditions() {
return conditionItems;
}

public List<Reward> getRewards() {
return rewardItems;
}
}

public static class Reward extends Auto {
private int amount;
private String type;

@Override
public void update() {
if (address == 0) {
return;
}

System.out.println(address);
this.amount = API.readMemoryInt(address + 0x20);
this.type = API.readMemoryString(address, 0x28);
}

public int getAmount() {
return amount;
}

public String getType() {
return type;
}
}

public static class Contition extends Auto {
private String description;
private double goalReached;
private double goal;
private boolean completed;

private final List<Contition> conditionItems = new ArrayList<>();
private final ObjArray conditionItemsArr = ObjArray.ofArrObj(true);

private String conditionType;

@Override
public void update() {
if (address == 0) {
return;
}

this.description = API.readMemoryString(address, 0x5F);
this.goalReached = API.readMemoryDouble(address + 0x77);
this.goal = API.readMemoryDouble(address + 0x7F);
this.completed = API.readMemoryBoolean(address, 0x34);
this.description = API.readMemoryString(address, 0x60);
this.goalReached = API.readMemoryDouble(address + 0x78);
this.goal = API.readMemoryDouble(address + 0x80);

long definitionAddr = API.readMemoryLong(address + 0x58) & ByteUtils.ATOM_MASK;
this.conditionType = API.readMemoryString(definitionAddr, 0x28);

conditionItemsArr.update(API.readMemoryPtr(address + 0x48));
conditionItemsArr.sync(conditionItems, Contition::new);
}

public String getDescription() {
Expand All @@ -231,5 +260,18 @@ public double getGoalReached() {
public double getGoal() {
return goal;
}

public boolean isCompleted() {
return completed;
}

public String getConditionType() {
return conditionType;
}

public List<Contition> getConditions() {
return conditionItems;
}

}
}

0 comments on commit b91744f

Please sign in to comment.