diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java index 46af32c4f7..1000ad23f6 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java @@ -160,7 +160,7 @@ public final class CastleChamberlain extends AbstractNpcAI html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); } - else if ((castle.getFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) + else if ((castle.getCastleFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "" + fstring + ""); @@ -940,7 +940,7 @@ public final class CastleChamberlain extends AbstractNpcAI { castle.updateFunctions(player, func, level, 0, 0, false); } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) + else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getCastleFunction(func) == null)) { htmltext = "chamberlain-09.html"; } @@ -976,7 +976,7 @@ public final class CastleChamberlain extends AbstractNpcAI { htmltext = "chamberlain-21.html"; } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) + else if (castle.getCastleFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1022,7 +1022,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1043,7 +1043,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java index 88d3ad7201..241f6b8d9f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence super(castleId); load(); initResidenceZone(); - initFunctions(); + // initFunctions(); spawnSideNpcs(); if (_ownerId != 0) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java index 3b29461e3a..c2178b2f3f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -243,7 +243,7 @@ public final class Fort extends AbstractResidence loadFunctions(); } initResidenceZone(); - initFunctions(); + // initFunctions(); initNpcs(); // load and spawn npcs (Always spawned) initSiegeNpcs(); // load suspicious merchants (Despawned 10mins before siege) // spawnSuspiciousMerchant(); // spawn suspicious merchants diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index 37e438a0de..1f010d853b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -28,6 +28,10 @@ import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.entity.Siege; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; @@ -96,13 +100,13 @@ public class RegenHPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -115,13 +119,13 @@ public class RegenHPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index c5b81e0ae7..df32adb74f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -26,6 +26,10 @@ import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; @@ -81,13 +85,13 @@ public class RegenMPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -100,13 +104,13 @@ public class RegenMPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java index e08c984b59..541c32f93c 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java @@ -22,18 +22,20 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.ClanHall; import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener; import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Event; -import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; import com.l2jmobius.gameserver.network.L2GameClient; @@ -157,15 +159,16 @@ public final class RequestRestartPoint implements IClientIncomingPacket } case 2: // to castle { - final Castle castle = CastleManager.getInstance().getCastle(activeChar); + final L2Clan clan = activeChar.getClan(); + Castle castle = CastleManager.getInstance().getCastle(activeChar); if ((castle != null) && castle.getSiege().isInProgress()) { // Siege in progress - if (castle.getSiege().checkIsDefender(activeChar.getClan())) + if (castle.getSiege().checkIsDefender(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - else if (castle.getSiege().checkIsAttacker(activeChar.getClan())) + else if (castle.getSiege().checkIsAttacker(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); } @@ -177,32 +180,45 @@ public final class RequestRestartPoint implements IClientIncomingPacket } else { - if ((activeChar.getClan() == null) || (activeChar.getClan().getCastleId() == 0)) + if ((clan == null) || (clan.getCastleId() == 0)) { return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - if ((castle != null) && (castle.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + if (clan != null) { - activeChar.restoreExp(castle.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + castle = CastleManager.getInstance().getCastleByOwner(clan); + if (castle != null) + { + final CastleFunction castleFunction = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP); + if (castleFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * castleFunction.getLvl()) / 100)); + } + } } break; } case 3: // to fortress { - if ((activeChar.getClan() == null) || (activeChar.getClan().getFortId() == 0)) + final L2Clan clan = activeChar.getClan(); + if ((clan == null) || (clan.getFortId() == 0)) { LOGGER.warning("Player [" + activeChar.getName() + "] called RestartPointPacket - To Fortress and he doesn't have Fortress!"); return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.FORTRESS); - final AbstractResidence residense = FortManager.getInstance().getFortByOwner(activeChar.getClan()); - if ((residense != null) && (residense.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + final Fort fort = FortManager.getInstance().getFortByOwner(clan); + if (fort != null) { - activeChar.restoreExp(residense.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + final FortFunction fortFunction = fort.getFortFunction(Fort.FUNC_RESTORE_EXP); + if (fortFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * fortFunction.getLvl()) / 100)); + } } break; } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java index 46af32c4f7..1000ad23f6 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java @@ -160,7 +160,7 @@ public final class CastleChamberlain extends AbstractNpcAI html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); } - else if ((castle.getFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) + else if ((castle.getCastleFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "" + fstring + ""); @@ -940,7 +940,7 @@ public final class CastleChamberlain extends AbstractNpcAI { castle.updateFunctions(player, func, level, 0, 0, false); } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) + else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getCastleFunction(func) == null)) { htmltext = "chamberlain-09.html"; } @@ -976,7 +976,7 @@ public final class CastleChamberlain extends AbstractNpcAI { htmltext = "chamberlain-21.html"; } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) + else if (castle.getCastleFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1022,7 +1022,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1043,7 +1043,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java index 88d3ad7201..241f6b8d9f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence super(castleId); load(); initResidenceZone(); - initFunctions(); + // initFunctions(); spawnSideNpcs(); if (_ownerId != 0) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java index 3b29461e3a..c2178b2f3f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -243,7 +243,7 @@ public final class Fort extends AbstractResidence loadFunctions(); } initResidenceZone(); - initFunctions(); + // initFunctions(); initNpcs(); // load and spawn npcs (Always spawned) initSiegeNpcs(); // load suspicious merchants (Despawned 10mins before siege) // spawnSuspiciousMerchant(); // spawn suspicious merchants diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index 37e438a0de..1f010d853b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -28,6 +28,10 @@ import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.entity.Siege; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; @@ -96,13 +100,13 @@ public class RegenHPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -115,13 +119,13 @@ public class RegenHPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index c5b81e0ae7..df32adb74f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -26,6 +26,10 @@ import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; @@ -81,13 +85,13 @@ public class RegenMPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -100,13 +104,13 @@ public class RegenMPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java index e08c984b59..541c32f93c 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java @@ -22,18 +22,20 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.ClanHall; import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener; import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Event; -import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; import com.l2jmobius.gameserver.network.L2GameClient; @@ -157,15 +159,16 @@ public final class RequestRestartPoint implements IClientIncomingPacket } case 2: // to castle { - final Castle castle = CastleManager.getInstance().getCastle(activeChar); + final L2Clan clan = activeChar.getClan(); + Castle castle = CastleManager.getInstance().getCastle(activeChar); if ((castle != null) && castle.getSiege().isInProgress()) { // Siege in progress - if (castle.getSiege().checkIsDefender(activeChar.getClan())) + if (castle.getSiege().checkIsDefender(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - else if (castle.getSiege().checkIsAttacker(activeChar.getClan())) + else if (castle.getSiege().checkIsAttacker(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); } @@ -177,32 +180,45 @@ public final class RequestRestartPoint implements IClientIncomingPacket } else { - if ((activeChar.getClan() == null) || (activeChar.getClan().getCastleId() == 0)) + if ((clan == null) || (clan.getCastleId() == 0)) { return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - if ((castle != null) && (castle.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + if (clan != null) { - activeChar.restoreExp(castle.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + castle = CastleManager.getInstance().getCastleByOwner(clan); + if (castle != null) + { + final CastleFunction castleFunction = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP); + if (castleFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * castleFunction.getLvl()) / 100)); + } + } } break; } case 3: // to fortress { - if ((activeChar.getClan() == null) || (activeChar.getClan().getFortId() == 0)) + final L2Clan clan = activeChar.getClan(); + if ((clan == null) || (clan.getFortId() == 0)) { LOGGER.warning("Player [" + activeChar.getName() + "] called RestartPointPacket - To Fortress and he doesn't have Fortress!"); return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.FORTRESS); - final AbstractResidence residense = FortManager.getInstance().getFortByOwner(activeChar.getClan()); - if ((residense != null) && (residense.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + final Fort fort = FortManager.getInstance().getFortByOwner(clan); + if (fort != null) { - activeChar.restoreExp(residense.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + final FortFunction fortFunction = fort.getFortFunction(Fort.FUNC_RESTORE_EXP); + if (fortFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * fortFunction.getLvl()) / 100)); + } } break; } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java index 46af32c4f7..1000ad23f6 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java @@ -160,7 +160,7 @@ public final class CastleChamberlain extends AbstractNpcAI html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); } - else if ((castle.getFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) + else if ((castle.getCastleFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "" + fstring + ""); @@ -940,7 +940,7 @@ public final class CastleChamberlain extends AbstractNpcAI { castle.updateFunctions(player, func, level, 0, 0, false); } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) + else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getCastleFunction(func) == null)) { htmltext = "chamberlain-09.html"; } @@ -976,7 +976,7 @@ public final class CastleChamberlain extends AbstractNpcAI { htmltext = "chamberlain-21.html"; } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) + else if (castle.getCastleFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1022,7 +1022,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1043,7 +1043,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java index 88d3ad7201..241f6b8d9f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence super(castleId); load(); initResidenceZone(); - initFunctions(); + // initFunctions(); spawnSideNpcs(); if (_ownerId != 0) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java index 3b29461e3a..c2178b2f3f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -243,7 +243,7 @@ public final class Fort extends AbstractResidence loadFunctions(); } initResidenceZone(); - initFunctions(); + // initFunctions(); initNpcs(); // load and spawn npcs (Always spawned) initSiegeNpcs(); // load suspicious merchants (Despawned 10mins before siege) // spawnSuspiciousMerchant(); // spawn suspicious merchants diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index 37e438a0de..1f010d853b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -28,6 +28,10 @@ import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.entity.Siege; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; @@ -96,13 +100,13 @@ public class RegenHPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -115,13 +119,13 @@ public class RegenHPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index c5b81e0ae7..df32adb74f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -26,6 +26,10 @@ import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; @@ -81,13 +85,13 @@ public class RegenMPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -100,13 +104,13 @@ public class RegenMPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java index e08c984b59..541c32f93c 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java @@ -22,18 +22,20 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.ClanHall; import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener; import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Event; -import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; import com.l2jmobius.gameserver.network.L2GameClient; @@ -157,15 +159,16 @@ public final class RequestRestartPoint implements IClientIncomingPacket } case 2: // to castle { - final Castle castle = CastleManager.getInstance().getCastle(activeChar); + final L2Clan clan = activeChar.getClan(); + Castle castle = CastleManager.getInstance().getCastle(activeChar); if ((castle != null) && castle.getSiege().isInProgress()) { // Siege in progress - if (castle.getSiege().checkIsDefender(activeChar.getClan())) + if (castle.getSiege().checkIsDefender(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - else if (castle.getSiege().checkIsAttacker(activeChar.getClan())) + else if (castle.getSiege().checkIsAttacker(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); } @@ -177,32 +180,45 @@ public final class RequestRestartPoint implements IClientIncomingPacket } else { - if ((activeChar.getClan() == null) || (activeChar.getClan().getCastleId() == 0)) + if ((clan == null) || (clan.getCastleId() == 0)) { return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - if ((castle != null) && (castle.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + if (clan != null) { - activeChar.restoreExp(castle.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + castle = CastleManager.getInstance().getCastleByOwner(clan); + if (castle != null) + { + final CastleFunction castleFunction = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP); + if (castleFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * castleFunction.getLvl()) / 100)); + } + } } break; } case 3: // to fortress { - if ((activeChar.getClan() == null) || (activeChar.getClan().getFortId() == 0)) + final L2Clan clan = activeChar.getClan(); + if ((clan == null) || (clan.getFortId() == 0)) { LOGGER.warning("Player [" + activeChar.getName() + "] called RestartPointPacket - To Fortress and he doesn't have Fortress!"); return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.FORTRESS); - final AbstractResidence residense = FortManager.getInstance().getFortByOwner(activeChar.getClan()); - if ((residense != null) && (residense.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + final Fort fort = FortManager.getInstance().getFortByOwner(clan); + if (fort != null) { - activeChar.restoreExp(residense.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + final FortFunction fortFunction = fort.getFortFunction(Fort.FUNC_RESTORE_EXP); + if (fortFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * fortFunction.getLvl()) / 100)); + } } break; } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java index 46af32c4f7..1000ad23f6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java @@ -160,7 +160,7 @@ public final class CastleChamberlain extends AbstractNpcAI html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); } - else if ((castle.getFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) + else if ((castle.getCastleFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "" + fstring + ""); @@ -940,7 +940,7 @@ public final class CastleChamberlain extends AbstractNpcAI { castle.updateFunctions(player, func, level, 0, 0, false); } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) + else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getCastleFunction(func) == null)) { htmltext = "chamberlain-09.html"; } @@ -976,7 +976,7 @@ public final class CastleChamberlain extends AbstractNpcAI { htmltext = "chamberlain-21.html"; } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) + else if (castle.getCastleFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1022,7 +1022,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1043,7 +1043,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java index 88d3ad7201..241f6b8d9f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence super(castleId); load(); initResidenceZone(); - initFunctions(); + // initFunctions(); spawnSideNpcs(); if (_ownerId != 0) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java index 3b29461e3a..c2178b2f3f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -243,7 +243,7 @@ public final class Fort extends AbstractResidence loadFunctions(); } initResidenceZone(); - initFunctions(); + // initFunctions(); initNpcs(); // load and spawn npcs (Always spawned) initSiegeNpcs(); // load suspicious merchants (Despawned 10mins before siege) // spawnSuspiciousMerchant(); // spawn suspicious merchants diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index 37e438a0de..1f010d853b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -28,6 +28,10 @@ import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.entity.Siege; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; @@ -96,13 +100,13 @@ public class RegenHPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -115,13 +119,13 @@ public class RegenHPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index c5b81e0ae7..df32adb74f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -26,6 +26,10 @@ import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; @@ -81,13 +85,13 @@ public class RegenMPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -100,13 +104,13 @@ public class RegenMPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java index e08c984b59..541c32f93c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java @@ -22,18 +22,20 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.ClanHall; import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener; import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Event; -import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; import com.l2jmobius.gameserver.network.L2GameClient; @@ -157,15 +159,16 @@ public final class RequestRestartPoint implements IClientIncomingPacket } case 2: // to castle { - final Castle castle = CastleManager.getInstance().getCastle(activeChar); + final L2Clan clan = activeChar.getClan(); + Castle castle = CastleManager.getInstance().getCastle(activeChar); if ((castle != null) && castle.getSiege().isInProgress()) { // Siege in progress - if (castle.getSiege().checkIsDefender(activeChar.getClan())) + if (castle.getSiege().checkIsDefender(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - else if (castle.getSiege().checkIsAttacker(activeChar.getClan())) + else if (castle.getSiege().checkIsAttacker(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); } @@ -177,32 +180,45 @@ public final class RequestRestartPoint implements IClientIncomingPacket } else { - if ((activeChar.getClan() == null) || (activeChar.getClan().getCastleId() == 0)) + if ((clan == null) || (clan.getCastleId() == 0)) { return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - if ((castle != null) && (castle.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + if (clan != null) { - activeChar.restoreExp(castle.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + castle = CastleManager.getInstance().getCastleByOwner(clan); + if (castle != null) + { + final CastleFunction castleFunction = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP); + if (castleFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * castleFunction.getLvl()) / 100)); + } + } } break; } case 3: // to fortress { - if ((activeChar.getClan() == null) || (activeChar.getClan().getFortId() == 0)) + final L2Clan clan = activeChar.getClan(); + if ((clan == null) || (clan.getFortId() == 0)) { LOGGER.warning("Player [" + activeChar.getName() + "] called RestartPointPacket - To Fortress and he doesn't have Fortress!"); return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.FORTRESS); - final AbstractResidence residense = FortManager.getInstance().getFortByOwner(activeChar.getClan()); - if ((residense != null) && (residense.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + final Fort fort = FortManager.getInstance().getFortByOwner(clan); + if (fort != null) { - activeChar.restoreExp(residense.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + final FortFunction fortFunction = fort.getFortFunction(Fort.FUNC_RESTORE_EXP); + if (fortFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * fortFunction.getLvl()) / 100)); + } } break; } diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java index 46af32c4f7..1000ad23f6 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java @@ -160,7 +160,7 @@ public final class CastleChamberlain extends AbstractNpcAI html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); } - else if ((castle.getFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) + else if ((castle.getCastleFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "" + fstring + ""); @@ -940,7 +940,7 @@ public final class CastleChamberlain extends AbstractNpcAI { castle.updateFunctions(player, func, level, 0, 0, false); } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) + else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getCastleFunction(func) == null)) { htmltext = "chamberlain-09.html"; } @@ -976,7 +976,7 @@ public final class CastleChamberlain extends AbstractNpcAI { htmltext = "chamberlain-21.html"; } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) + else if (castle.getCastleFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1022,7 +1022,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1043,7 +1043,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/entity/Castle.java index 88d3ad7201..241f6b8d9f 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence super(castleId); load(); initResidenceZone(); - initFunctions(); + // initFunctions(); spawnSideNpcs(); if (_ownerId != 0) { diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/entity/Fort.java index 3b29461e3a..c2178b2f3f 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -243,7 +243,7 @@ public final class Fort extends AbstractResidence loadFunctions(); } initResidenceZone(); - initFunctions(); + // initFunctions(); initNpcs(); // load and spawn npcs (Always spawned) initSiegeNpcs(); // load suspicious merchants (Despawned 10mins before siege) // spawnSuspiciousMerchant(); // spawn suspicious merchants diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index 37e438a0de..1f010d853b 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -28,6 +28,10 @@ import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.entity.Siege; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; @@ -96,13 +100,13 @@ public class RegenHPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -115,13 +119,13 @@ public class RegenHPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index c5b81e0ae7..df32adb74f 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -26,6 +26,10 @@ import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; @@ -81,13 +85,13 @@ public class RegenMPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -100,13 +104,13 @@ public class RegenMPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java index e08c984b59..541c32f93c 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java @@ -22,18 +22,20 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.ClanHall; import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener; import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Event; -import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; import com.l2jmobius.gameserver.network.L2GameClient; @@ -157,15 +159,16 @@ public final class RequestRestartPoint implements IClientIncomingPacket } case 2: // to castle { - final Castle castle = CastleManager.getInstance().getCastle(activeChar); + final L2Clan clan = activeChar.getClan(); + Castle castle = CastleManager.getInstance().getCastle(activeChar); if ((castle != null) && castle.getSiege().isInProgress()) { // Siege in progress - if (castle.getSiege().checkIsDefender(activeChar.getClan())) + if (castle.getSiege().checkIsDefender(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - else if (castle.getSiege().checkIsAttacker(activeChar.getClan())) + else if (castle.getSiege().checkIsAttacker(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); } @@ -177,32 +180,45 @@ public final class RequestRestartPoint implements IClientIncomingPacket } else { - if ((activeChar.getClan() == null) || (activeChar.getClan().getCastleId() == 0)) + if ((clan == null) || (clan.getCastleId() == 0)) { return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - if ((castle != null) && (castle.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + if (clan != null) { - activeChar.restoreExp(castle.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + castle = CastleManager.getInstance().getCastleByOwner(clan); + if (castle != null) + { + final CastleFunction castleFunction = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP); + if (castleFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * castleFunction.getLvl()) / 100)); + } + } } break; } case 3: // to fortress { - if ((activeChar.getClan() == null) || (activeChar.getClan().getFortId() == 0)) + final L2Clan clan = activeChar.getClan(); + if ((clan == null) || (clan.getFortId() == 0)) { LOGGER.warning("Player [" + activeChar.getName() + "] called RestartPointPacket - To Fortress and he doesn't have Fortress!"); return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.FORTRESS); - final AbstractResidence residense = FortManager.getInstance().getFortByOwner(activeChar.getClan()); - if ((residense != null) && (residense.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + final Fort fort = FortManager.getInstance().getFortByOwner(clan); + if (fort != null) { - activeChar.restoreExp(residense.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + final FortFunction fortFunction = fort.getFortFunction(Fort.FUNC_RESTORE_EXP); + if (fortFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * fortFunction.getLvl()) / 100)); + } } break; } diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java index 46af32c4f7..1000ad23f6 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java @@ -160,7 +160,7 @@ public final class CastleChamberlain extends AbstractNpcAI html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); } - else if ((castle.getFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) + else if ((castle.getCastleFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "" + fstring + ""); @@ -940,7 +940,7 @@ public final class CastleChamberlain extends AbstractNpcAI { castle.updateFunctions(player, func, level, 0, 0, false); } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) + else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getCastleFunction(func) == null)) { htmltext = "chamberlain-09.html"; } @@ -976,7 +976,7 @@ public final class CastleChamberlain extends AbstractNpcAI { htmltext = "chamberlain-21.html"; } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) + else if (castle.getCastleFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1022,7 +1022,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1043,7 +1043,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/entity/Castle.java index 88d3ad7201..241f6b8d9f 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence super(castleId); load(); initResidenceZone(); - initFunctions(); + // initFunctions(); spawnSideNpcs(); if (_ownerId != 0) { diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/entity/Fort.java index 3b29461e3a..c2178b2f3f 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -243,7 +243,7 @@ public final class Fort extends AbstractResidence loadFunctions(); } initResidenceZone(); - initFunctions(); + // initFunctions(); initNpcs(); // load and spawn npcs (Always spawned) initSiegeNpcs(); // load suspicious merchants (Despawned 10mins before siege) // spawnSuspiciousMerchant(); // spawn suspicious merchants diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index 37e438a0de..1f010d853b 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -28,6 +28,10 @@ import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.entity.Siege; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; @@ -96,13 +100,13 @@ public class RegenHPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -115,13 +119,13 @@ public class RegenHPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index c5b81e0ae7..df32adb74f 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -26,6 +26,10 @@ import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; @@ -81,13 +85,13 @@ public class RegenMPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -100,13 +104,13 @@ public class RegenMPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java index e08c984b59..541c32f93c 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java @@ -22,18 +22,20 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.ClanHall; import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener; import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Event; -import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; import com.l2jmobius.gameserver.network.L2GameClient; @@ -157,15 +159,16 @@ public final class RequestRestartPoint implements IClientIncomingPacket } case 2: // to castle { - final Castle castle = CastleManager.getInstance().getCastle(activeChar); + final L2Clan clan = activeChar.getClan(); + Castle castle = CastleManager.getInstance().getCastle(activeChar); if ((castle != null) && castle.getSiege().isInProgress()) { // Siege in progress - if (castle.getSiege().checkIsDefender(activeChar.getClan())) + if (castle.getSiege().checkIsDefender(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - else if (castle.getSiege().checkIsAttacker(activeChar.getClan())) + else if (castle.getSiege().checkIsAttacker(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); } @@ -177,32 +180,45 @@ public final class RequestRestartPoint implements IClientIncomingPacket } else { - if ((activeChar.getClan() == null) || (activeChar.getClan().getCastleId() == 0)) + if ((clan == null) || (clan.getCastleId() == 0)) { return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - if ((castle != null) && (castle.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + if (clan != null) { - activeChar.restoreExp(castle.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + castle = CastleManager.getInstance().getCastleByOwner(clan); + if (castle != null) + { + final CastleFunction castleFunction = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP); + if (castleFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * castleFunction.getLvl()) / 100)); + } + } } break; } case 3: // to fortress { - if ((activeChar.getClan() == null) || (activeChar.getClan().getFortId() == 0)) + final L2Clan clan = activeChar.getClan(); + if ((clan == null) || (clan.getFortId() == 0)) { LOGGER.warning("Player [" + activeChar.getName() + "] called RestartPointPacket - To Fortress and he doesn't have Fortress!"); return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.FORTRESS); - final AbstractResidence residense = FortManager.getInstance().getFortByOwner(activeChar.getClan()); - if ((residense != null) && (residense.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + final Fort fort = FortManager.getInstance().getFortByOwner(clan); + if (fort != null) { - activeChar.restoreExp(residense.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + final FortFunction fortFunction = fort.getFortFunction(Fort.FUNC_RESTORE_EXP); + if (fortFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * fortFunction.getLvl()) / 100)); + } } break; } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java index 6919da2828..6e678ad959 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java @@ -160,7 +160,7 @@ public final class CastleChamberlain extends AbstractNpcAI html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); } - else if ((castle.getFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) + else if ((castle.getCastleFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "" + fstring + ""); @@ -374,17 +374,17 @@ public final class CastleChamberlain extends AbstractNpcAI // private final boolean isDomainFortressInContractStatus(int castleId) // { - // final int numFort = ((castleId == 1) || (castleId == 5)) ? 2 : 1; - // final List fortList = FORTRESS.get(castleId); - // for (int i = 0; i < numFort; i++) - // { - // final Fort fortress = FortManager.getInstance().getFortById(fortList.get(i)); - // if (fortress.getFortState() == 2) - // { - // return true; - // } - // } - // return false; + // final int numFort = ((castleId == 1) || (castleId == 5)) ? 2 : 1; + // final List fortList = FORTRESS.get(castleId); + // for (int i = 0; i < numFort; i++) + // { + // final Fort fortress = FortManager.getInstance().getFortById(fortList.get(i)); + // if (fortress.getFortState() == 2) + // { + // return true; + // } + // } + // return false; // } private final boolean isOwner(L2PcInstance player, L2Npc npc) @@ -465,7 +465,7 @@ public final class CastleChamberlain extends AbstractNpcAI } // else if (!isDomainFortressInContractStatus(castle.getResidenceId())) // { - // htmltext = "chamberlain-27.html"; + // htmltext = "chamberlain-27.html"; // } else { @@ -940,7 +940,7 @@ public final class CastleChamberlain extends AbstractNpcAI { castle.updateFunctions(player, func, level, 0, 0, false); } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) + else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getCastleFunction(func) == null)) { htmltext = "chamberlain-09.html"; } @@ -976,7 +976,7 @@ public final class CastleChamberlain extends AbstractNpcAI { htmltext = "chamberlain-21.html"; } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) + else if (castle.getCastleFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1022,7 +1022,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1043,7 +1043,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Castle.java index 08284f3f0b..561ef10af7 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -242,7 +242,7 @@ public final class Castle extends AbstractResidence super(castleId); load(); initResidenceZone(); - initFunctions(); + // initFunctions(); spawnSideNpcs(); if (_ownerId != 0) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java index 3b29461e3a..c2178b2f3f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -243,7 +243,7 @@ public final class Fort extends AbstractResidence loadFunctions(); } initResidenceZone(); - initFunctions(); + // initFunctions(); initNpcs(); // load and spawn npcs (Always spawned) initSiegeNpcs(); // load suspicious merchants (Despawned 10mins before siege) // spawnSuspiciousMerchant(); // spawn suspicious merchants diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index 37e438a0de..1f010d853b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -28,6 +28,10 @@ import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.entity.Siege; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; @@ -96,13 +100,13 @@ public class RegenHPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -115,13 +119,13 @@ public class RegenHPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index c5b81e0ae7..df32adb74f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -26,6 +26,10 @@ import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; @@ -81,13 +85,13 @@ public class RegenMPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -100,13 +104,13 @@ public class RegenMPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java index e08c984b59..541c32f93c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java @@ -22,18 +22,20 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.ClanHall; import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener; import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Event; -import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; import com.l2jmobius.gameserver.network.L2GameClient; @@ -157,15 +159,16 @@ public final class RequestRestartPoint implements IClientIncomingPacket } case 2: // to castle { - final Castle castle = CastleManager.getInstance().getCastle(activeChar); + final L2Clan clan = activeChar.getClan(); + Castle castle = CastleManager.getInstance().getCastle(activeChar); if ((castle != null) && castle.getSiege().isInProgress()) { // Siege in progress - if (castle.getSiege().checkIsDefender(activeChar.getClan())) + if (castle.getSiege().checkIsDefender(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - else if (castle.getSiege().checkIsAttacker(activeChar.getClan())) + else if (castle.getSiege().checkIsAttacker(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); } @@ -177,32 +180,45 @@ public final class RequestRestartPoint implements IClientIncomingPacket } else { - if ((activeChar.getClan() == null) || (activeChar.getClan().getCastleId() == 0)) + if ((clan == null) || (clan.getCastleId() == 0)) { return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - if ((castle != null) && (castle.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + if (clan != null) { - activeChar.restoreExp(castle.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + castle = CastleManager.getInstance().getCastleByOwner(clan); + if (castle != null) + { + final CastleFunction castleFunction = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP); + if (castleFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * castleFunction.getLvl()) / 100)); + } + } } break; } case 3: // to fortress { - if ((activeChar.getClan() == null) || (activeChar.getClan().getFortId() == 0)) + final L2Clan clan = activeChar.getClan(); + if ((clan == null) || (clan.getFortId() == 0)) { LOGGER.warning("Player [" + activeChar.getName() + "] called RestartPointPacket - To Fortress and he doesn't have Fortress!"); return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.FORTRESS); - final AbstractResidence residense = FortManager.getInstance().getFortByOwner(activeChar.getClan()); - if ((residense != null) && (residense.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + final Fort fort = FortManager.getInstance().getFortByOwner(clan); + if (fort != null) { - activeChar.restoreExp(residense.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + final FortFunction fortFunction = fort.getFortFunction(Fort.FUNC_RESTORE_EXP); + if (fortFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * fortFunction.getLvl()) / 100)); + } } break; } diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java index 6919da2828..6e678ad959 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java @@ -160,7 +160,7 @@ public final class CastleChamberlain extends AbstractNpcAI html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); } - else if ((castle.getFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) + else if ((castle.getCastleFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "" + fstring + ""); @@ -374,17 +374,17 @@ public final class CastleChamberlain extends AbstractNpcAI // private final boolean isDomainFortressInContractStatus(int castleId) // { - // final int numFort = ((castleId == 1) || (castleId == 5)) ? 2 : 1; - // final List fortList = FORTRESS.get(castleId); - // for (int i = 0; i < numFort; i++) - // { - // final Fort fortress = FortManager.getInstance().getFortById(fortList.get(i)); - // if (fortress.getFortState() == 2) - // { - // return true; - // } - // } - // return false; + // final int numFort = ((castleId == 1) || (castleId == 5)) ? 2 : 1; + // final List fortList = FORTRESS.get(castleId); + // for (int i = 0; i < numFort; i++) + // { + // final Fort fortress = FortManager.getInstance().getFortById(fortList.get(i)); + // if (fortress.getFortState() == 2) + // { + // return true; + // } + // } + // return false; // } private final boolean isOwner(L2PcInstance player, L2Npc npc) @@ -465,7 +465,7 @@ public final class CastleChamberlain extends AbstractNpcAI } // else if (!isDomainFortressInContractStatus(castle.getResidenceId())) // { - // htmltext = "chamberlain-27.html"; + // htmltext = "chamberlain-27.html"; // } else { @@ -940,7 +940,7 @@ public final class CastleChamberlain extends AbstractNpcAI { castle.updateFunctions(player, func, level, 0, 0, false); } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) + else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getCastleFunction(func) == null)) { htmltext = "chamberlain-09.html"; } @@ -976,7 +976,7 @@ public final class CastleChamberlain extends AbstractNpcAI { htmltext = "chamberlain-21.html"; } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) + else if (castle.getCastleFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1022,7 +1022,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1043,7 +1043,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Castle.java index 08284f3f0b..561ef10af7 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -242,7 +242,7 @@ public final class Castle extends AbstractResidence super(castleId); load(); initResidenceZone(); - initFunctions(); + // initFunctions(); spawnSideNpcs(); if (_ownerId != 0) { diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java index 3b29461e3a..c2178b2f3f 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -243,7 +243,7 @@ public final class Fort extends AbstractResidence loadFunctions(); } initResidenceZone(); - initFunctions(); + // initFunctions(); initNpcs(); // load and spawn npcs (Always spawned) initSiegeNpcs(); // load suspicious merchants (Despawned 10mins before siege) // spawnSuspiciousMerchant(); // spawn suspicious merchants diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index 37e438a0de..1f010d853b 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -28,6 +28,10 @@ import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.entity.Siege; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; @@ -96,13 +100,13 @@ public class RegenHPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -115,13 +119,13 @@ public class RegenHPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index c5b81e0ae7..df32adb74f 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -26,6 +26,10 @@ import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; @@ -81,13 +85,13 @@ public class RegenMPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -100,13 +104,13 @@ public class RegenMPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java index e08c984b59..541c32f93c 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java @@ -22,18 +22,20 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.ClanHall; import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener; import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Event; -import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; import com.l2jmobius.gameserver.network.L2GameClient; @@ -157,15 +159,16 @@ public final class RequestRestartPoint implements IClientIncomingPacket } case 2: // to castle { - final Castle castle = CastleManager.getInstance().getCastle(activeChar); + final L2Clan clan = activeChar.getClan(); + Castle castle = CastleManager.getInstance().getCastle(activeChar); if ((castle != null) && castle.getSiege().isInProgress()) { // Siege in progress - if (castle.getSiege().checkIsDefender(activeChar.getClan())) + if (castle.getSiege().checkIsDefender(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - else if (castle.getSiege().checkIsAttacker(activeChar.getClan())) + else if (castle.getSiege().checkIsAttacker(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); } @@ -177,32 +180,45 @@ public final class RequestRestartPoint implements IClientIncomingPacket } else { - if ((activeChar.getClan() == null) || (activeChar.getClan().getCastleId() == 0)) + if ((clan == null) || (clan.getCastleId() == 0)) { return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - if ((castle != null) && (castle.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + if (clan != null) { - activeChar.restoreExp(castle.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + castle = CastleManager.getInstance().getCastleByOwner(clan); + if (castle != null) + { + final CastleFunction castleFunction = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP); + if (castleFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * castleFunction.getLvl()) / 100)); + } + } } break; } case 3: // to fortress { - if ((activeChar.getClan() == null) || (activeChar.getClan().getFortId() == 0)) + final L2Clan clan = activeChar.getClan(); + if ((clan == null) || (clan.getFortId() == 0)) { LOGGER.warning("Player [" + activeChar.getName() + "] called RestartPointPacket - To Fortress and he doesn't have Fortress!"); return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.FORTRESS); - final AbstractResidence residense = FortManager.getInstance().getFortByOwner(activeChar.getClan()); - if ((residense != null) && (residense.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + final Fort fort = FortManager.getInstance().getFortByOwner(clan); + if (fort != null) { - activeChar.restoreExp(residense.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + final FortFunction fortFunction = fort.getFortFunction(Fort.FUNC_RESTORE_EXP); + if (fortFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * fortFunction.getLvl()) / 100)); + } } break; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java index 6919da2828..6e678ad959 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java @@ -160,7 +160,7 @@ public final class CastleChamberlain extends AbstractNpcAI html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); } - else if ((castle.getFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) + else if ((castle.getCastleFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "" + fstring + ""); @@ -374,17 +374,17 @@ public final class CastleChamberlain extends AbstractNpcAI // private final boolean isDomainFortressInContractStatus(int castleId) // { - // final int numFort = ((castleId == 1) || (castleId == 5)) ? 2 : 1; - // final List fortList = FORTRESS.get(castleId); - // for (int i = 0; i < numFort; i++) - // { - // final Fort fortress = FortManager.getInstance().getFortById(fortList.get(i)); - // if (fortress.getFortState() == 2) - // { - // return true; - // } - // } - // return false; + // final int numFort = ((castleId == 1) || (castleId == 5)) ? 2 : 1; + // final List fortList = FORTRESS.get(castleId); + // for (int i = 0; i < numFort; i++) + // { + // final Fort fortress = FortManager.getInstance().getFortById(fortList.get(i)); + // if (fortress.getFortState() == 2) + // { + // return true; + // } + // } + // return false; // } private final boolean isOwner(L2PcInstance player, L2Npc npc) @@ -465,7 +465,7 @@ public final class CastleChamberlain extends AbstractNpcAI } // else if (!isDomainFortressInContractStatus(castle.getResidenceId())) // { - // htmltext = "chamberlain-27.html"; + // htmltext = "chamberlain-27.html"; // } else { @@ -940,7 +940,7 @@ public final class CastleChamberlain extends AbstractNpcAI { castle.updateFunctions(player, func, level, 0, 0, false); } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) + else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getCastleFunction(func) == null)) { htmltext = "chamberlain-09.html"; } @@ -976,7 +976,7 @@ public final class CastleChamberlain extends AbstractNpcAI { htmltext = "chamberlain-21.html"; } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) + else if (castle.getCastleFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1022,7 +1022,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1043,7 +1043,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Castle.java index 08284f3f0b..561ef10af7 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -242,7 +242,7 @@ public final class Castle extends AbstractResidence super(castleId); load(); initResidenceZone(); - initFunctions(); + // initFunctions(); spawnSideNpcs(); if (_ownerId != 0) { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Fort.java index 3b29461e3a..c2178b2f3f 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -243,7 +243,7 @@ public final class Fort extends AbstractResidence loadFunctions(); } initResidenceZone(); - initFunctions(); + // initFunctions(); initNpcs(); // load and spawn npcs (Always spawned) initSiegeNpcs(); // load suspicious merchants (Despawned 10mins before siege) // spawnSuspiciousMerchant(); // spawn suspicious merchants diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index 37e438a0de..1f010d853b 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -28,6 +28,10 @@ import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.entity.Siege; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; @@ -96,13 +100,13 @@ public class RegenHPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -115,13 +119,13 @@ public class RegenHPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index c5b81e0ae7..df32adb74f 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -26,6 +26,10 @@ import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; @@ -81,13 +85,13 @@ public class RegenMPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -100,13 +104,13 @@ public class RegenMPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java index e08c984b59..541c32f93c 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java @@ -22,18 +22,20 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.ClanHall; import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener; import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Event; -import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; import com.l2jmobius.gameserver.network.L2GameClient; @@ -157,15 +159,16 @@ public final class RequestRestartPoint implements IClientIncomingPacket } case 2: // to castle { - final Castle castle = CastleManager.getInstance().getCastle(activeChar); + final L2Clan clan = activeChar.getClan(); + Castle castle = CastleManager.getInstance().getCastle(activeChar); if ((castle != null) && castle.getSiege().isInProgress()) { // Siege in progress - if (castle.getSiege().checkIsDefender(activeChar.getClan())) + if (castle.getSiege().checkIsDefender(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - else if (castle.getSiege().checkIsAttacker(activeChar.getClan())) + else if (castle.getSiege().checkIsAttacker(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); } @@ -177,32 +180,45 @@ public final class RequestRestartPoint implements IClientIncomingPacket } else { - if ((activeChar.getClan() == null) || (activeChar.getClan().getCastleId() == 0)) + if ((clan == null) || (clan.getCastleId() == 0)) { return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - if ((castle != null) && (castle.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + if (clan != null) { - activeChar.restoreExp(castle.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + castle = CastleManager.getInstance().getCastleByOwner(clan); + if (castle != null) + { + final CastleFunction castleFunction = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP); + if (castleFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * castleFunction.getLvl()) / 100)); + } + } } break; } case 3: // to fortress { - if ((activeChar.getClan() == null) || (activeChar.getClan().getFortId() == 0)) + final L2Clan clan = activeChar.getClan(); + if ((clan == null) || (clan.getFortId() == 0)) { LOGGER.warning("Player [" + activeChar.getName() + "] called RestartPointPacket - To Fortress and he doesn't have Fortress!"); return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.FORTRESS); - final AbstractResidence residense = FortManager.getInstance().getFortByOwner(activeChar.getClan()); - if ((residense != null) && (residense.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + final Fort fort = FortManager.getInstance().getFortByOwner(clan); + if (fort != null) { - activeChar.restoreExp(residense.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + final FortFunction fortFunction = fort.getFortFunction(Fort.FUNC_RESTORE_EXP); + if (fortFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * fortFunction.getLvl()) / 100)); + } } break; } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java index 6919da2828..6e678ad959 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/others/CastleChamberlain/CastleChamberlain.java @@ -160,7 +160,7 @@ public final class CastleChamberlain extends AbstractNpcAI html = getHtmlPacket(player, npc, "castleresetdeco.html"); html.replace("%AgitDecoSubmit%", Integer.toString(func)); } - else if ((castle.getFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) + else if ((castle.getCastleFunction(func) != null) && (castle.getCastleFunction(func).getLvl() == level)) { html = getHtmlPacket(player, npc, "castledecoalreadyset.html"); html.replace("%AgitDecoEffect%", "" + fstring + ""); @@ -374,17 +374,17 @@ public final class CastleChamberlain extends AbstractNpcAI // private final boolean isDomainFortressInContractStatus(int castleId) // { - // final int numFort = ((castleId == 1) || (castleId == 5)) ? 2 : 1; - // final List fortList = FORTRESS.get(castleId); - // for (int i = 0; i < numFort; i++) - // { - // final Fort fortress = FortManager.getInstance().getFortById(fortList.get(i)); - // if (fortress.getFortState() == 2) - // { - // return true; - // } - // } - // return false; + // final int numFort = ((castleId == 1) || (castleId == 5)) ? 2 : 1; + // final List fortList = FORTRESS.get(castleId); + // for (int i = 0; i < numFort; i++) + // { + // final Fort fortress = FortManager.getInstance().getFortById(fortList.get(i)); + // if (fortress.getFortState() == 2) + // { + // return true; + // } + // } + // return false; // } private final boolean isOwner(L2PcInstance player, L2Npc npc) @@ -465,7 +465,7 @@ public final class CastleChamberlain extends AbstractNpcAI } // else if (!isDomainFortressInContractStatus(castle.getResidenceId())) // { - // htmltext = "chamberlain-27.html"; + // htmltext = "chamberlain-27.html"; // } else { @@ -940,7 +940,7 @@ public final class CastleChamberlain extends AbstractNpcAI { castle.updateFunctions(player, func, level, 0, 0, false); } - else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getFunction(func) == null)) + else if (!castle.updateFunctions(player, func, level, getFunctionFee(func, level), getFunctionRatio(func), castle.getCastleFunction(func) == null)) { htmltext = "chamberlain-09.html"; } @@ -976,7 +976,7 @@ public final class CastleChamberlain extends AbstractNpcAI { htmltext = "chamberlain-21.html"; } - else if (castle.getFunction(Castle.FUNC_TELEPORT) == null) + else if (castle.getCastleFunction(Castle.FUNC_TELEPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1022,7 +1022,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } @@ -1043,7 +1043,7 @@ public final class CastleChamberlain extends AbstractNpcAI { if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS)) { - if (castle.getFunction(Castle.FUNC_SUPPORT) == null) + if (castle.getCastleFunction(Castle.FUNC_SUPPORT) == null) { htmltext = "castlefuncdisabled.html"; } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/entity/Castle.java index 08284f3f0b..561ef10af7 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -242,7 +242,7 @@ public final class Castle extends AbstractResidence super(castleId); load(); initResidenceZone(); - initFunctions(); + // initFunctions(); spawnSideNpcs(); if (_ownerId != 0) { diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/entity/Fort.java index 3b29461e3a..c2178b2f3f 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -243,7 +243,7 @@ public final class Fort extends AbstractResidence loadFunctions(); } initResidenceZone(); - initFunctions(); + // initFunctions(); initNpcs(); // load and spawn npcs (Always spawned) initSiegeNpcs(); // load suspicious merchants (Despawned 10mins before siege) // spawnSuspiciousMerchant(); // spawn suspicious merchants diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java index 37e438a0de..1f010d853b 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenHPFinalizer.java @@ -28,6 +28,10 @@ import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.entity.Siege; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; @@ -96,13 +100,13 @@ public class RegenHPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -115,13 +119,13 @@ public class RegenHPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.HP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_HP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java index c5b81e0ae7..df32adb74f 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/stats/finalizers/RegenMPFinalizer.java @@ -26,6 +26,10 @@ import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunction; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; @@ -81,13 +85,13 @@ public class RegenMPFinalizer implements IStatsFunction final int castleIndex = player.getClan().getCastleId(); if ((castleIndex > 0) && (castleIndex == posCastleIndex)) { - final AbstractResidence residense = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); - if (residense != null) + final Castle castle = CastleManager.getInstance().getCastleById(player.getClan().getCastleId()); + if (castle != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final CastleFunction func = castle.getCastleFunction(Castle.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } @@ -100,13 +104,13 @@ public class RegenMPFinalizer implements IStatsFunction final int fortIndex = player.getClan().getFortId(); if ((fortIndex > 0) && (fortIndex == posFortIndex)) { - final AbstractResidence residense = FortManager.getInstance().getFortById(player.getClan().getCastleId()); - if (residense != null) + final Fort fort = FortManager.getInstance().getFortById(player.getClan().getCastleId()); + if (fort != null) { - final ResidenceFunction func = residense.getFunction(ResidenceFunctionType.MP_REGEN); + final FortFunction func = fort.getFortFunction(Fort.FUNC_RESTORE_MP); if (func != null) { - baseValue *= func.getValue(); + baseValue *= func.getLvl(); } } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java index e08c984b59..541c32f93c 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/network/clientpackets/RequestRestartPoint.java @@ -22,18 +22,20 @@ import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Castle.CastleFunction; import com.l2jmobius.gameserver.model.entity.ClanHall; import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.entity.Fort.FortFunction; import com.l2jmobius.gameserver.model.events.EventType; import com.l2jmobius.gameserver.model.events.listeners.AbstractEventListener; import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Event; -import com.l2jmobius.gameserver.model.residences.AbstractResidence; import com.l2jmobius.gameserver.model.residences.ResidenceFunctionType; import com.l2jmobius.gameserver.network.L2GameClient; @@ -157,15 +159,16 @@ public final class RequestRestartPoint implements IClientIncomingPacket } case 2: // to castle { - final Castle castle = CastleManager.getInstance().getCastle(activeChar); + final L2Clan clan = activeChar.getClan(); + Castle castle = CastleManager.getInstance().getCastle(activeChar); if ((castle != null) && castle.getSiege().isInProgress()) { // Siege in progress - if (castle.getSiege().checkIsDefender(activeChar.getClan())) + if (castle.getSiege().checkIsDefender(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - else if (castle.getSiege().checkIsAttacker(activeChar.getClan())) + else if (castle.getSiege().checkIsAttacker(clan)) { loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN); } @@ -177,32 +180,45 @@ public final class RequestRestartPoint implements IClientIncomingPacket } else { - if ((activeChar.getClan() == null) || (activeChar.getClan().getCastleId() == 0)) + if ((clan == null) || (clan.getCastleId() == 0)) { return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.CASTLE); } - if ((castle != null) && (castle.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + if (clan != null) { - activeChar.restoreExp(castle.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + castle = CastleManager.getInstance().getCastleByOwner(clan); + if (castle != null) + { + final CastleFunction castleFunction = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP); + if (castleFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * castleFunction.getLvl()) / 100)); + } + } } break; } case 3: // to fortress { - if ((activeChar.getClan() == null) || (activeChar.getClan().getFortId() == 0)) + final L2Clan clan = activeChar.getClan(); + if ((clan == null) || (clan.getFortId() == 0)) { LOGGER.warning("Player [" + activeChar.getName() + "] called RestartPointPacket - To Fortress and he doesn't have Fortress!"); return; } loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.FORTRESS); - final AbstractResidence residense = FortManager.getInstance().getFortByOwner(activeChar.getClan()); - if ((residense != null) && (residense.hasFunction(ResidenceFunctionType.EXP_RESTORE))) + final Fort fort = FortManager.getInstance().getFortByOwner(clan); + if (fort != null) { - activeChar.restoreExp(residense.getFunction(ResidenceFunctionType.EXP_RESTORE).getValue()); + final FortFunction fortFunction = fort.getFortFunction(Fort.FUNC_RESTORE_EXP); + if (fortFunction != null) + { + activeChar.getStat().addExp(Math.round(((activeChar.getExpBeforeDeath() - activeChar.getExp()) * fortFunction.getLvl()) / 100)); + } } break; }