P0nk / Cosmic

MapleStory Global v83 server emulator
https://discord.gg/JU5aQapVZK
GNU Affero General Public License v3.0
418 stars 215 forks source link

Surprise Box Implementation #238

Closed channarit1994 closed 4 months ago

channarit1994 commented 4 months ago

Description

I have added the following line to show the cash inventory after a successful gachapon opening in the CashShopSurpriseHandler:

c.sendPacket(PacketCreator.showCashInventory(c));

This line is added within the condition where cssResult is not null, right after sending the success packet for the Surprise box open event. This ensures that the cash inventory is displayed to the user upon a successful operation.

and I have added the following condition to check the inventory size before proceeding with the cash shop surprise opening:

if (getItemsSize() >= 100) { return null; }

This line is added at the beginning of the openCashShopSurprise method. It ensures that if the inventory size is greater than or equal to 100, the method will return null and not proceed further. This prevents adding new items when the inventory is full.

Checklist before requesting a review

Screenshots

Record_2024_06_13_20_12_10_882

channarit1994 commented 4 months ago

Looks fine. One downside with your solution is that the surprise item is shown prematurely in the inventory, but I suppose that's better than not updating the box count at all. It doesn't seem like the "remainingBoxes" integer in the packet does anything unfortunately.

If I found it, I will let you know and update it again.

Regards,