Update to resources message

This commit is contained in:
2024-06-11 12:53:07 -04:00
parent f5cc4a3290
commit 35c8ac0289
4 changed files with 36 additions and 34 deletions
+2 -2
View File
@@ -166,7 +166,7 @@ public class Mine extends AbstractGameObject {
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
writer.putString(mine.mineType.name);
writer.putString(mine.zoneName);
writer.putInt(mine.production.hash);
writer.putInt(mine.production.resourceHash);
writer.putInt(mine.production.mine_production);
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
writer.putInt(3600); //window in seconds
@@ -393,7 +393,7 @@ public class Mine extends AbstractGameObject {
// writer.putInt(0x215C92BB); //this.unknown1);
writer.putString(this.mineType.name);
writer.putString(this.zoneName);
writer.putInt(this.production.hash);
writer.putInt(this.production.resourceHash);
writer.putInt(this.production.mine_production);
writer.putInt(this.getModifiedProductionAmount()); //TODO calculate range penalty here
writer.putInt(3600); //window in seconds
+3 -3
View File
@@ -381,7 +381,7 @@ public class Warehouse {
int amount = (int) (warehouse.resources.get(resourceType) * taxPercent);
if (amount <= 0) {
msg.getResources().put(resourceType.hash, 0);
msg.getResources().put(resourceType.resourceHash, 0);
continue;
}
@@ -395,10 +395,10 @@ public class Warehouse {
if (newAmount < amount)
continue;
msg.getResources().put(resourceType.hash, amount);
msg.getResources().put(resourceType.resourceHash, amount);
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
msg.getResources().put(resourceType.hash, 0);
msg.getResources().put(resourceType.resourceHash, 0);
warehouse.resources.put(resourceType, oldAmount);
continue;
}