Skip to content

Commit

Permalink
fix bug and call it feature,
Browse files Browse the repository at this point in the history
Signed-off-by: Erymanthus[#5074] | (u/)RayDeeUx <[email protected]>
  • Loading branch information
RayDeeUx committed Jan 16, 2024
1 parent a8f4405 commit 600b57d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public class CommissionsCalculatorConfig {
@ConfigEditorBoolean
public boolean completedOnly = false;

@Expose
@ConfigOption(name = "Progress for All Milestones", desc = "Calculates remaining commissions for all incomplete Commission Milestones.")
@ConfigEditorBoolean
public boolean allMilestones = false;

@Expose
public Position position = new Position(140, 90, false, true);
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,24 @@ class CommissionsCalculator {
mileProgressPattern.matchMatcher(line) {
val completed = group("completed").groupToInt()
val required = group("required").groupToInt()
val remaining = abs(required - completed)
val commsToNextMilestone = abs(required - completed)
if (completed < required || mc.thePlayer.name == "Erymanthus") {
val remainingPlural = StringUtils.optionalPlural(remaining, "commission", "commissions")
val hotmXPGain = (remaining * perComm).roundToInt()
val remainingPlural = StringUtils.optionalPlural(commsToNextMilestone, "commission", "commissions")
val hotmXPGain = (commsToNextMilestone * perComm).roundToInt()
newList.add(
Renderable.string(" §7- $colorCode$remainingPlural §fleft to complete §6Milestone $milestone §f($colorCode+${hotmXPGain.addSeparators()} HOTM XP§f)"),
)
}
if (!config.allMilestones) {
val lastElement = newList.takeLast(1).first()
newList.clear()
newList.addAll(
listOf<Renderable>(
Renderable.string("$colorCode$firstLine"),
lastElement,
)
)
}
}
}
}
Expand Down

0 comments on commit 600b57d

Please sign in to comment.