Fixed castle functions.
This commit is contained in:
parent
3ece182d91
commit
4c2171eb5f
@ -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 p1=\"" + level + "\">" + fstring + "</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";
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence
|
||||
super(castleId);
|
||||
load();
|
||||
initResidenceZone();
|
||||
initFunctions();
|
||||
// initFunctions();
|
||||
spawnSideNpcs();
|
||||
if (_ownerId != 0)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 p1=\"" + level + "\">" + fstring + "</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";
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence
|
||||
super(castleId);
|
||||
load();
|
||||
initResidenceZone();
|
||||
initFunctions();
|
||||
// initFunctions();
|
||||
spawnSideNpcs();
|
||||
if (_ownerId != 0)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 p1=\"" + level + "\">" + fstring + "</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";
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence
|
||||
super(castleId);
|
||||
load();
|
||||
initResidenceZone();
|
||||
initFunctions();
|
||||
// initFunctions();
|
||||
spawnSideNpcs();
|
||||
if (_ownerId != 0)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 p1=\"" + level + "\">" + fstring + "</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";
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence
|
||||
super(castleId);
|
||||
load();
|
||||
initResidenceZone();
|
||||
initFunctions();
|
||||
// initFunctions();
|
||||
spawnSideNpcs();
|
||||
if (_ownerId != 0)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 p1=\"" + level + "\">" + fstring + "</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";
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence
|
||||
super(castleId);
|
||||
load();
|
||||
initResidenceZone();
|
||||
initFunctions();
|
||||
// initFunctions();
|
||||
spawnSideNpcs();
|
||||
if (_ownerId != 0)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 p1=\"" + level + "\">" + fstring + "</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";
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public final class Castle extends AbstractResidence
|
||||
super(castleId);
|
||||
load();
|
||||
initResidenceZone();
|
||||
initFunctions();
|
||||
// initFunctions();
|
||||
spawnSideNpcs();
|
||||
if (_ownerId != 0)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 p1=\"" + level + "\">" + fstring + "</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";
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public final class Castle extends AbstractResidence
|
||||
super(castleId);
|
||||
load();
|
||||
initResidenceZone();
|
||||
initFunctions();
|
||||
// initFunctions();
|
||||
spawnSideNpcs();
|
||||
if (_ownerId != 0)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 p1=\"" + level + "\">" + fstring + "</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";
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public final class Castle extends AbstractResidence
|
||||
super(castleId);
|
||||
load();
|
||||
initResidenceZone();
|
||||
initFunctions();
|
||||
// initFunctions();
|
||||
spawnSideNpcs();
|
||||
if (_ownerId != 0)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 p1=\"" + level + "\">" + fstring + "</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";
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public final class Castle extends AbstractResidence
|
||||
super(castleId);
|
||||
load();
|
||||
initResidenceZone();
|
||||
initFunctions();
|
||||
// initFunctions();
|
||||
spawnSideNpcs();
|
||||
if (_ownerId != 0)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 p1=\"" + level + "\">" + fstring + "</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";
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public final class Castle extends AbstractResidence
|
||||
super(castleId);
|
||||
load();
|
||||
initResidenceZone();
|
||||
initFunctions();
|
||||
// initFunctions();
|
||||
spawnSideNpcs();
|
||||
if (_ownerId != 0)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user