mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 08:39:07 +00:00
Fixup buying too many items
This commit is contained in:
@@ -540,10 +540,10 @@ public class ShopAssistant {
|
|||||||
|
|
||||||
int totalValue = value * amount;
|
int totalValue = value * amount;
|
||||||
if (currencyAmount < totalValue) {
|
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
|
// buy as many as we can afford
|
||||||
totalValue = value * amount;
|
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.");
|
player.getActionSender().sendMessage("You don't have enough " + ItemAssistant.getItemName(currency).toLowerCase() + " to buy that.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user