}
Location loc = null;
long ref = 0;
boolean isInDefense;
L2Clan clan = activeChar.getClan();
Siege siege = SiegeManager.getSiege(activeChar, true);
switch(_requestedPointType)
{
case TO_CLANHALL:
if(clan == null || clan.getHasHideout() == 0)
{
loc = MapRegion.getTeleToClosestTown(activeChar);
}
else
{
ClanHall clanHall = activeChar.getClanHall();
loc = MapRegion.getTeleToClanHall(activeChar);
if(clanHall.getFunction(ResidenceFunction.RESTORE_EXP) != null)
{
activeChar.restoreExp(clanHall.getFunction(ResidenceFunction.RESTORE_EXP).getLevel());
}
}
break;
case TO_CASTLE:
isInDefense = false;
if(siege != null && siege.checkIsDefender(clan))
{
isInDefense = true;
}
if((clan == null || clan.getHasCastle() == 0) && !isInDefense)
{
sendPacket(Msg.ActionFail, new Die(activeChar));
return;
}
Castle castle = activeChar.getCastle();
loc = MapRegion.getTeleToCastle(activeChar);
if(castle.getFunction(ResidenceFunction.RESTORE_EXP) != null)
{
activeChar.restoreExp(castle.getFunction(ResidenceFunction.RESTORE_EXP).getLevel());
}
break;
case TO_FORTRESS:
isInDefense = false;
if(siege != null && siege.checkIsDefender(clan))
{
isInDefense = true;
}
if((clan == null || clan.getHasFortress() == 0) && !isInDefense)
{
sendPacket(Msg.ActionFail, new Die(activeChar));
return;
}
Fortress fort = activeChar.getFortress();
loc = MapRegion.getTeleToFortress(activeChar);
if(fort.getFunction(ResidenceFunction.RESTORE_EXP) != null)
{
activeChar.restoreExp(fort.getFunction(ResidenceFunction.RESTORE_EXP).getLevel());
}
break;
case TO_SIEGEHQ:
SiegeClan siegeClan = null;
if(siege != null)
{
siegeClan = siege.getAttackerClan(clan);
}
else if(TerritorySiege.checkIfInZone(activeChar))
{
siegeClan = TerritorySiege.getSiegeClan(clan);
}