コード例 #1
0
 @Override
 public boolean canAct(Player player, Item parentItem, Item targetItem) {
   switch (storage) {
     case CUBE:
       return CubeExpandService.canExpandByTicket(player, level);
     case WAREHOUSE:
       return WarehouseService.canExpand(player);
   }
   return false;
 }
コード例 #2
0
  @Override
  public void act(Player player, Item parentItem, Item targetItem) {
    if (!player.getInventory().decreaseByObjectId(parentItem.getObjectId(), 1)) {
      return;
    }
    ItemTemplate itemTemplate = parentItem.getItemTemplate();
    PacketSendUtility.broadcastPacket(
        player,
        new SM_ITEM_USAGE_ANIMATION(
            player.getObjectId(), parentItem.getObjectId(), itemTemplate.getTemplateId()),
        true);

    switch (storage) {
      case CUBE:
        CubeExpandService.expand(player, false);
        break;
      case WAREHOUSE:
        WarehouseService.expand(player);
        break;
    }
  }