@Override
public void useItem(L2PlayableInstance playable, L2ItemInstance item)
{
int itemId = item.getItemId();
L2PcInstance activeChar = (L2PcInstance) playable;
Castle castle = CastleManager.getInstance().getCastle(activeChar);
int castleId = -1;
if(castle != null)
{
castleId = castle.getCastleId();
}
//add check that certain tickets can only be placed in certain castles
if(MercTicketManager.getInstance().getTicketCastleId(itemId) != castleId)
{
switch(castleId)
{
case 1:
activeChar.sendMessage("This Mercenary Ticket can only be used in Gludio.");
return;
case 2:
activeChar.sendMessage("This Mercenary Ticket can only be used in Dion.");
return;
case 3:
activeChar.sendMessage("This Mercenary Ticket can only be used in Giran.");
return;
case 4:
activeChar.sendMessage("This Mercenary Ticket can only be used in Oren.");
return;
case 5:
activeChar.sendMessage("This Mercenary Ticket can only be used in Aden.");
return;
case 6:
activeChar.sendMessage("This Mercenary Ticket can only be used in Heine.");
return;
case 7:
activeChar.sendMessage("This Mercenary Ticket can only be used in Goddard.");
return;
case 8:
activeChar.sendMessage("This Mercenary Ticket can only be used in Rune.");
return;
case 9:
activeChar.sendMessage("This Mercenary Ticket can only be used in Schuttgart.");
return;
// player is not in a castle
default:
activeChar.sendMessage("Mercenary Tickets can only be used in a castle.");
return;
}
}
if(!activeChar.isCastleLord(castleId))
{
activeChar.sendMessage("You are not the lord of this castle!");
return;
}
if((castle == null) || castle.getSiege().getIsInProgress())
{
activeChar.sendMessage("You cannot hire mercenary while siege is in progress!");
return;
}