From 602b16457f0f1ab2eb8422e85b06b0dcc116e946 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 15 Mar 2025 16:41:47 -0500 Subject: [PATCH] finish checks for increased player inventory gold limits --- src/engine/devcmd/cmds/AddGoldCmd.java | 7 ++++--- src/engine/devcmd/cmds/GimmeCmd.java | 3 ++- src/engine/gameManager/LootManager.java | 2 +- src/engine/net/client/ClientMessagePump.java | 4 ++-- src/engine/objects/CharacterItemManager.java | 4 ++-- src/engine/powers/poweractions/StealPowerAction.java | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/engine/devcmd/cmds/AddGoldCmd.java b/src/engine/devcmd/cmds/AddGoldCmd.java index e998fc5b..9d15ad21 100644 --- a/src/engine/devcmd/cmds/AddGoldCmd.java +++ b/src/engine/devcmd/cmds/AddGoldCmd.java @@ -14,6 +14,7 @@ import engine.gameManager.ChatManager; import engine.objects.AbstractGameObject; import engine.objects.Item; import engine.objects.PlayerCharacter; +import engine.server.MBServerStatics; /** * @author Eighty @@ -46,10 +47,10 @@ public class AddGoldCmd extends AbstractDevCmd { throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid"); return; } - if (amt < 1 || amt > 10000000) { - throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)"); + if (amt < 1 || amt > MBServerStatics.PLAYER_GOLD_LIMIT) { + throwbackError(pc, "Quantity must be between 1 and " + MBServerStatics.PLAYER_GOLD_LIMIT); return; - } else if ((curAmt + amt) > 10000000) { + } else if ((curAmt + amt) > MBServerStatics.PLAYER_GOLD_LIMIT) { throwbackError(pc, "This would place your inventory over 10,000,000 gold."); return; } diff --git a/src/engine/devcmd/cmds/GimmeCmd.java b/src/engine/devcmd/cmds/GimmeCmd.java index c26cbbf8..f11b99c6 100644 --- a/src/engine/devcmd/cmds/GimmeCmd.java +++ b/src/engine/devcmd/cmds/GimmeCmd.java @@ -17,6 +17,7 @@ import engine.gameManager.ChatManager; import engine.gameManager.DbManager; import engine.objects.*; import engine.powers.EffectsBase; +import engine.server.MBServerStatics; import java.util.ArrayList; @@ -34,7 +35,7 @@ public class GimmeCmd extends AbstractDevCmd { AbstractGameObject target) { int amt = 0; int currentGold = pc.getCharItemManager().getGoldInventory().getNumOfItems(); - amt = 10000000 - currentGold; + amt = MBServerStatics.PLAYER_GOLD_LIMIT - currentGold; if (!pc.getCharItemManager().addGoldToInventory(amt, true)) { throwbackError(pc, "Failed to add gold to inventory"); return; diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 74f7db29..f741e699 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -712,7 +712,7 @@ public enum LootManager { ItemBase ib = ItemBase.getItemBase(selectedItem.cacheID); if(ib.getUUID() == Warehouse.coalIB.getUUID()){ //no more coal, give gold instead - if (itemMan.getGoldInventory().getNumOfItems() + 250000 > 10000000) { + if (itemMan.getGoldInventory().getNumOfItems() + 250000 > MBServerStatics.PLAYER_GOLD_LIMIT) { ErrorPopupMsg.sendErrorPopup(playerCharacter, 21); return; } diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index fb2f37f0..d6e4bb97 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -583,7 +583,7 @@ public class ClientMessagePump implements NetMsgHandler { if (i.getItemBaseID() == 980066) goldValue = 0; - if(itemManager.getGoldInventory().getNumOfItems() + goldValue > 10000000) + if(itemManager.getGoldInventory().getNumOfItems() + goldValue > MBServerStatics.PLAYER_GOLD_LIMIT) return; if (itemManager.delete(i)) { @@ -1294,7 +1294,7 @@ public class ClientMessagePump implements NetMsgHandler { cost *= profit; - if (gold.getNumOfItems() + cost > 10000000) { + if (gold.getNumOfItems() + cost > MBServerStatics.PLAYER_GOLD_LIMIT) { return; } diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 1b594644..e5acc08a 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -2353,7 +2353,7 @@ public class CharacterItemManager { } - if (this.getGoldInventory().getNumOfItems() + goldFrom2 > 10000000) { + if (this.getGoldInventory().getNumOfItems() + goldFrom2 > MBServerStatics.PLAYER_GOLD_LIMIT) { PlayerCharacter pc = (PlayerCharacter) this.absCharacter; if (pc.getClientConnection() != null) ErrorPopupMsg.sendErrorPopup(pc, 202); @@ -2361,7 +2361,7 @@ public class CharacterItemManager { } - if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > 10000000) { + if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > MBServerStatics.PLAYER_GOLD_LIMIT) { PlayerCharacter pc = (PlayerCharacter) tradingWith.absCharacter; if (pc.getClientConnection() != null) ErrorPopupMsg.sendErrorPopup(pc, 202); diff --git a/src/engine/powers/poweractions/StealPowerAction.java b/src/engine/powers/poweractions/StealPowerAction.java index 5170ff94..dec6febb 100644 --- a/src/engine/powers/poweractions/StealPowerAction.java +++ b/src/engine/powers/poweractions/StealPowerAction.java @@ -180,7 +180,7 @@ public class StealPowerAction extends AbstractPowerAction { int targetGold = ownerCIM.getGoldInventory().getNumOfItems(); int myGold = myCIM.getGoldInventory().getNumOfItems(); - if(myGold + amount > 10000000) + if(myGold + amount > MBServerStatics.PLAYER_GOLD_LIMIT) return; ownerCIM.getGoldInventory().setNumOfItems(targetGold - amount);