int type = Integer.parseInt(st.nextToken());
int level = Integer.parseInt(st.nextToken());
long price = getDoorCost(type, level);
List<DoorObject> doorObjects = castle.getSiegeEvent().getObjects(SiegeEvent.DOORS);
DoorObject targetDoorObject = null;
for(DoorObject o : doorObjects)
if(o.getUId() == id)
{
targetDoorObject = o;
break;
}
DoorInstance door = targetDoorObject.getDoor();
int upgradeHp = (door.getMaxHp() - door.getUpgradeHp()) * level - door.getMaxHp();
if(price == 0 || upgradeHp < 0)
{
player.sendMessage(new CustomMessage("common.Error", player));
return;
}
if(door.getUpgradeHp() >= upgradeHp)
{
int oldLevel = door.getUpgradeHp() / (door.getMaxHp() - door.getUpgradeHp()) + 1;
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile("castle/chamberlain/doorAlready.htm");
html.replace("%level%", String.valueOf(oldLevel));
player.sendPacket(html);
return;
}
if(player.getClan().getAdenaCount() < price)
{
player.sendPacket(SystemMsg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
return;
}
player.getClan().getWarehouse().destroyItemByItemId(ItemTemplate.ITEM_ID_ADENA, price);
targetDoorObject.setUpgradeValue(castle.<SiegeEvent<?, ?>> getSiegeEvent(), upgradeHp);
CastleDoorUpgradeDAO.getInstance().insert(door.getDoorId(), upgradeHp);
}
else if(actualCommand.equalsIgnoreCase("report")) // Report page
{
if(!isHaveRigths(player, Clan.CP_CS_USE_FUNCTIONS))