From e519d1b00b8f90e996b1d0eb3adfe7a5a41617cb Mon Sep 17 00:00:00 2001 From: RedSparr0w Date: Sat, 23 Nov 2019 14:58:44 +1300 Subject: [PATCH] Fixup buying too many items --- .../src/redone/game/shops/ShopAssistant.java | 4 ++-- .../redone/game/shops/ShopAssistant.class | Bin 12509 -> 12515 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/2006Redone Server/src/redone/game/shops/ShopAssistant.java b/2006Redone Server/src/redone/game/shops/ShopAssistant.java index ef1ea0b5..87b2d296 100644 --- a/2006Redone Server/src/redone/game/shops/ShopAssistant.java +++ b/2006Redone Server/src/redone/game/shops/ShopAssistant.java @@ -540,10 +540,10 @@ public class ShopAssistant { int totalValue = value * amount; if (currencyAmount < totalValue) { - amount = (int) Math.floor(player.playerItemsN[currencySlot] / amount); + amount = (int) Math.floor(player.playerItemsN[currencySlot] / value); // buy as many as we can afford totalValue = value * amount; - if (currencyAmount < totalValue) { + if (currencyAmount < totalValue || amount <= 0) { player.getActionSender().sendMessage("You don't have enough " + ItemAssistant.getItemName(currency).toLowerCase() + " to buy that."); return false; } diff --git a/CompiledServer/production/2006rebotted/redone/game/shops/ShopAssistant.class b/CompiledServer/production/2006rebotted/redone/game/shops/ShopAssistant.class index b1ad6174ec3a0f286b51f016e24c91cde36a41fb..995dc1023f61c4fa0be30ec1717a2f5c20607693 100644 GIT binary patch delta 348 zcmW;HJ4k|I7zN<-o!8R8G>iD52I*o^{hC-=6qU3lZQ|1A=FncWND%}!hT@y~c+!!o{LgBy^1dfT$pa z=78x~+APDL3Y!j3V!~xQO;;XvPp)|6PcZ3b4^8&6n_foP#{~{D#vv}!VuC)Na+ntk z@QOkHa#R$@#KDlXaa=k$DgB(1HBL*4Gm_=3yySncA zgnKOm)g&+Rj1x4eGxd!Z9X6{URluv3Q~jx9+-SKNQxV*vjF#G?$RMlhYdY6gRaZre zbvAuCqoA$SOXx3_J3=DT>at862_ADCJAf2Y3Ggi0VzZ delta 342 zcmW;H&nv@m90u^`^Sp=6Hq@*{^SkghYZwuhi