mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-20 01:29:54 +02:00
Implement commissions
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package emu.nebula.game.inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ItemRewardList extends ArrayList<ItemRewardParam> {
|
||||
private static final long serialVersionUID = -4317949564663392685L;
|
||||
|
||||
public ItemRewardList() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ItemParamMap generateRewards() {
|
||||
var map = new ItemParamMap();
|
||||
|
||||
for (var param : this) {
|
||||
map.add(param.getId(), param.getRandomCount());
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package emu.nebula.game.inventory;
|
||||
|
||||
import emu.nebula.util.Utils;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class ItemRewardParam {
|
||||
public int id;
|
||||
public int min;
|
||||
public int max;
|
||||
|
||||
public ItemRewardParam(int id, int min, int max) {
|
||||
this.id = id;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public int getRandomCount() {
|
||||
if (this.min == this.max) {
|
||||
return this.min;
|
||||
}
|
||||
|
||||
return Utils.randomRange(this.min, this.max);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user