return;
}
try
{
Location loc = null;
Castle castle = null;
Fort fort = null;
if (activeChar.isInJail())
{
_requestedPointType = 27;
}
else if (activeChar.isFestivalParticipant())
{
_requestedPointType = 4;
}
if (activeChar.isPhoenixBlessed())
activeChar.stopPhoenixBlessing(null);
switch (_requestedPointType)
{
case 1: // to clanhall
if (activeChar.getClan() != null)
{
if (activeChar.getClan().getHasHideout() == 0)
{
// cheater
activeChar.sendMessage("You may not use this respawn point!");
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
return;
}
loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.ClanHall);
if (ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan()) != null && ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan()).getFunction(ClanHall.FUNC_RESTORE_EXP) != null)
{
activeChar.restoreExp(ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan()).getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl());
}
break;
}
loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
break;
case 2: // to castle
Boolean isInDefense = false;
castle = CastleManager.getInstance().getCastle(activeChar);
fort = FortManager.getInstance().getFort(activeChar);
MapRegionTable.TeleportWhereType teleportWhere = MapRegionTable.TeleportWhereType.Town;
if (castle != null && castle.getSiege().getIsInProgress())
{
// siege in progress
if (castle.getSiege().checkIsDefender(activeChar.getClan()))
{
isInDefense = true;
}
}
if (fort != null && fort.getSiege().getIsInProgress())
{
// siege in progress
if (fort.getSiege().checkIsDefender(activeChar.getClan()))
{
isInDefense = true;
}
}
if (activeChar.getClan().getHasCastle() == 0 && activeChar.getClan().getHasFort() == 0 && !isInDefense)
{
// cheater
activeChar.sendMessage("You may not use this respawn point!");
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
return;
}
if (CastleManager.getInstance().getCastleByOwner(activeChar.getClan()) != null)
teleportWhere = MapRegionTable.TeleportWhereType.Castle;
else if (FortManager.getInstance().getFortByOwner(activeChar.getClan()) != null)
teleportWhere = MapRegionTable.TeleportWhereType.Fortress;
loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, teleportWhere);
break;
case 3: // to siege HQ
L2SiegeClan siegeClan = null;
castle = CastleManager.getInstance().getCastle(activeChar);
fort = FortManager.getInstance().getFort(activeChar);
if (castle != null && castle.getSiege().getIsInProgress())
{
siegeClan = castle.getSiege().getAttackerClan(activeChar.getClan());
}
else if (fort != null && fort.getSiege().getIsInProgress())
{
siegeClan = fort.getSiege().getAttackerClan(activeChar.getClan());
}