}
}
private final boolean getPlayerAllyHasCastle(L2PcInstance player)
{
L2Clan playerClan = player.getClan();
// The player is not in a clan, so return false.
if(playerClan == null)
return false;
// If castle ownage check is clan-based rather than ally-based,
// check if the player's clan has a castle and return the result.
if(!Config.ALT_GAME_REQUIRE_CLAN_CASTLE)
{
int allyId = playerClan.getAllyId();
// The player's clan is not in an alliance, so return false.
if(allyId != 0)
{
// Check if another clan in the same alliance owns a castle,
// by traversing the list of clans and act accordingly.
L2Clan[] clanList = ClanTable.getInstance().getClans();
for(L2Clan clan : clanList)
if(clan.getAllyId() == allyId && clan.getHasCastle() > 0)
return true;
clanList = null;
}
}
return playerClan.getHasCastle() > 0;
}