Reworked points to be based on item price
This commit is contained in:
@@ -1,10 +1,25 @@
|
||||
package com.alttd.objects;
|
||||
|
||||
import com.alttd.config.Config;
|
||||
import com.alttd.util.Utilities;
|
||||
|
||||
public record Price(double price, int points) {
|
||||
public final class Price {
|
||||
private final double price;
|
||||
private final int points;
|
||||
|
||||
public Price(double price) {
|
||||
this.price = price;
|
||||
for (int key : Config.pointsRangeMap.keySet()) {
|
||||
if (Config.pointsRangeMap.get(key).contains(price)) {
|
||||
points = key;
|
||||
return;
|
||||
}
|
||||
}
|
||||
points = -1; //TODO check for if points is -1
|
||||
}
|
||||
|
||||
public static Price addPrice(Price one, Price two) {
|
||||
return (new Price(Utilities.round(one.price() + two.price(), 2), one.points() + two.points()));
|
||||
return (new Price(Utilities.round(one.getPrice(1) + two.getPrice(1), 2)));
|
||||
}
|
||||
|
||||
public double getPrice(int multiplier) {
|
||||
@@ -14,4 +29,5 @@ public record Price(double price, int points) {
|
||||
public int getPoints() {
|
||||
return (points);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user