{
if (!canBypassCheck(player, this))
{
return;
}
Fortress fortress = getFortress();
if (!player.isClanLeader() || (fortress.getOwnerId() != player.getClanId()))
{
showChatWindow(player, "residence2/fortress/fortress_not_authorized.htm");
return;
}
if (command.equalsIgnoreCase("guardInfo"))
{
if (fortress.getContractState() != Fortress.CONTRACT_WITH_CASTLE)
{
showChatWindow(player, "residence2/fortress/fortress_supply_officer005.htm");
return;
}
showChatWindow(player, "residence2/fortress/fortress_supply_officer002.htm", "%guard_buff_level%", fortress.getFacilityLevel(Fortress.GUARD_BUFF));
}
else if (command.equalsIgnoreCase("supplyInfo"))
{
if (fortress.getContractState() != Fortress.CONTRACT_WITH_CASTLE)
{
showChatWindow(player, "residence2/fortress/fortress_supply_officer005.htm");
return;
}
showChatWindow(player, "residence2/fortress/fortress_supply_officer009.htm", "%supply_count%", fortress.getSupplyCount());
}
else if (command.equalsIgnoreCase("rewardInfo"))
{
showChatWindow(player, "residence2/fortress/fortress_supply_officer010.htm", "%blood_oaths%", fortress.getRewardCount());
}
else if (command.equalsIgnoreCase("receiveSupply"))
{
String filename;
if (fortress.getSupplyCount() > 0)
{
filename = "residence2/fortress/fortress_supply_officer016.htm";
NpcInstance npc = NpcHolder.getInstance().getTemplate(SUPPLY_NPC[fortress.getSupplyCount() - 1]).getNewInstance();
npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
npc.spawnMe(new Location(getX() - 23, getY() + 41, getZ()));
}
else
{
filename = "residence2/fortress/fortress_supply_officer017.htm";
}
NpcHtmlMessage html = new NpcHtmlMessage(player, this);
html.setFile(filename);
player.sendPacket(html);
}
else if (command.equalsIgnoreCase("receiveRewards"))
{
String filename;
int count = fortress.getRewardCount();
if (count > 0)
{
filename = "residence2/fortress/fortress_supply_officer013.htm";
fortress.setRewardCount(0);
fortress.setJdbcState(JdbcEntityState.UPDATED);
fortress.update();
Functions.addItem(player, ITEM_ID, count);
}
else
{
filename = "residence2/fortress/fortress_supply_officer014.htm";