No more empty gifts!

This commit is contained in:
ArpyAge 2022-03-23 03:28:23 +01:00
parent 529a84ec47
commit f81470f7ba

View File

@ -168,8 +168,13 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
item.sellRare();
}
int totalCredits = 0;
int totalPoints = 0;
int totalCredits = item.getCredits();
int totalPoints = item.getPoints();
if(totalCredits > this.client.getHabbo().getHabboInfo().getCredits() || totalPoints > this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType())) {
this.client.sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
CatalogLimitedConfiguration limitedConfiguration;
int limitedStack = 0;
@ -224,23 +229,11 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
return;
}
for (int i = 0; i < count; i++) {
if (item.getCredits() <= this.client.getHabbo().getHabboInfo().getCredits() - totalCredits) {
if (
item.getPoints() <= this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()) - totalPoints)
//item.getPointsType() == 0 && item.getPoints() <= this.client.getHabbo().getHabboInfo().getPixels() - totalPoints ||
{
if (((i + 1) % 6 != 0 && CatalogItem.haveOffer(item)) || !CatalogItem.haveOffer(item)) {
totalCredits += item.getCredits();
totalPoints += item.getPoints();
}
for (int j = 0; j < item.getAmount(); j++) {
if (item.getAmount() > 1 || item.getBaseItems().size() > 1) {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
for (Item baseItem : item.getBaseItems()) {
if (item.getItemAmount(baseItem.getId()) > 1) {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
@ -320,10 +313,6 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
}
}
}
}
}
}
}
StringBuilder giftData = new StringBuilder(itemsList.size() + "\t");