init *= 3;
}
if (cha.isPlayable()) {
L2Player player = cha.getPlayer();
if (player != null) {
L2Clan clan = player.getClan();
if (clan != null) {
switch (player.getInResidence()) {
case Clanhall:
int clanHallIndex = clan.getHasHideout();
if (clanHallIndex > 0) {
ClanHall clansHall = ClanHallManager.getInstance()
.getClanHall(clanHallIndex);
if (clansHall != null) {
if (clansHall
.isFunctionActive(ResidenceFunction.RESTORE_MP)) {
init *= 1. + clansHall.getFunction(
ResidenceFunction.RESTORE_MP)
.getLevel() / 100.;
}
}
}
break;
case Castle:
int caslteIndex = clan.getHasCastle();
if (caslteIndex > 0) {
Castle castle = CastleManager.getInstance()
.getCastleByIndex(caslteIndex);
if (castle != null) {
if (castle
.isFunctionActive(ResidenceFunction.RESTORE_MP)) {
init *= 1. + castle.getFunction(
ResidenceFunction.RESTORE_MP)
.getLevel() / 100.;
}
}
}
break;
case Fortress:
int fortIndex = clan.getHasCastle();
if (fortIndex > 0) {
Fortress fort = FortressManager.getInstance()
.getFortressByIndex(fortIndex);
if (fort != null) {
if (fort.isFunctionActive(ResidenceFunction.RESTORE_MP)) {