Grasscutter/src/main/java/emu/grasscutter/data/common/ItemParamStringData.java
2022-05-30 20:06:25 -07:00

27 lines
577 B
Java

package emu.grasscutter.data.common;
public class ItemParamStringData {
private int id;
private String count;
public ItemParamStringData() {}
public int getId() {
return id;
}
public String getCount() {
return count;
}
public ItemParamData toItemParamData() {
if (count.contains(";")) {
String[] split = count.split(";");
count = count.split(";")[split.length - 1];
} else if (count.contains(".")) {
return new ItemParamData(id, (int) Math.ceil(Double.parseDouble(count)));
}
return new ItemParamData(id, Integer.parseInt(count));
}
}