Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16b0a36c86 | ||
|
|
db82cbcfae |
@@ -41,6 +41,7 @@ public class CashShopSurpriseHandler extends AbstractPacketHandler {
|
|||||||
if (cssResult != null) {
|
if (cssResult != null) {
|
||||||
Item cssItem = cssResult.getLeft(), cssBox = cssResult.getRight();
|
Item cssItem = cssResult.getLeft(), cssBox = cssResult.getRight();
|
||||||
c.sendPacket(PacketCreator.onCashGachaponOpenSuccess(c.getAccID(), cssBox.getSN(), cssBox.getQuantity(), cssItem, cssItem.getItemId(), cssItem.getQuantity(), true));
|
c.sendPacket(PacketCreator.onCashGachaponOpenSuccess(c.getAccID(), cssBox.getSN(), cssBox.getQuantity(), cssItem, cssItem.getItemId(), cssItem.getQuantity(), true));
|
||||||
|
c.sendPacket(PacketCreator.showCashInventory(c));
|
||||||
} else {
|
} else {
|
||||||
c.sendPacket(PacketCreator.onCashItemGachaponOpenFailed());
|
c.sendPacket(PacketCreator.onCashItemGachaponOpenFailed());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import provider.DataProviderFactory;
|
|||||||
import provider.DataTool;
|
import provider.DataTool;
|
||||||
import provider.wz.WZFiles;
|
import provider.wz.WZFiles;
|
||||||
import tools.DatabaseConnection;
|
import tools.DatabaseConnection;
|
||||||
|
import tools.PacketCreator;
|
||||||
import tools.Pair;
|
import tools.Pair;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -407,6 +408,17 @@ public class CashShop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getItemsSize() {
|
||||||
|
int size = 0;
|
||||||
|
lock.lock();
|
||||||
|
try {
|
||||||
|
size = inventory.size();
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Integer> getWishList() {
|
public List<Integer> getWishList() {
|
||||||
return wishList;
|
return wishList;
|
||||||
}
|
}
|
||||||
@@ -544,14 +556,14 @@ public class CashShop {
|
|||||||
Item css = getCashShopItemByItemid(ItemId.CASH_SHOP_SURPRISE);
|
Item css = getCashShopItemByItemid(ItemId.CASH_SHOP_SURPRISE);
|
||||||
|
|
||||||
if (css != null) {
|
if (css != null) {
|
||||||
|
if (getItemsSize() >= 100) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
CashItem cItem = CashItemFactory.getRandomCashItem();
|
CashItem cItem = CashItemFactory.getRandomCashItem();
|
||||||
|
|
||||||
if (cItem != null) {
|
if (cItem != null) {
|
||||||
if (css.getQuantity() > 1) {
|
if (css.getQuantity() > 1) {
|
||||||
/* if(NOT ENOUGH SPACE) { looks like we're not dealing with cash inventory limit whatsoever, k then
|
|
||||||
return null;
|
|
||||||
} */
|
|
||||||
|
|
||||||
css.setQuantity((short) (css.getQuantity() - 1));
|
css.setQuantity((short) (css.getQuantity() - 1));
|
||||||
} else {
|
} else {
|
||||||
removeFromInventory(css);
|
removeFromInventory(css);
|
||||||
|
|||||||
Reference in New Issue
Block a user