Implement item quick growth

This commit is contained in:
Melledy
2025-11-08 22:00:06 -08:00
parent 2c18963b08
commit 66ce7cf698
4 changed files with 55 additions and 9 deletions
@@ -537,11 +537,16 @@ public class Inventory extends PlayerManager implements GameDatabaseObject {
// Utility functions
public PlayerChangeInfo produce(int id, int num) {
public PlayerChangeInfo produce(int id, int num, PlayerChangeInfo change) {
// Init change info
if (change == null) {
change = new PlayerChangeInfo();
}
// Get production data
var data = GameData.getProductionDataTable().get(id);
if (data == null) {
return null;
return change;
}
// Get materials
@@ -549,12 +554,9 @@ public class Inventory extends PlayerManager implements GameDatabaseObject {
// Verify that we have the materials
if (!this.verifyItems(materials)) {
return null;
return change;
}
// Create change info
var change = new PlayerChangeInfo();
// Remove items
this.removeItems(materials, change);
@@ -27,6 +27,10 @@ public class PlayerChangeInfo {
return this;
}
public boolean isEmpty() {
return this.list == null || this.list.isEmpty();
}
public void add(ProtoMessage<?> proto) {
var any = Any.newInstance()
.setTypeUrl(GameConstants.PROTO_BASE_TYPE_URL + proto.getClass().getSimpleName())