|
@@ -30,7 +30,6 @@ import net.sf.l2j.gameserver.model.entity.Fort;
|
|
import net.sf.l2j.gameserver.util.IllegalPlayerAction;
|
|
import net.sf.l2j.gameserver.util.IllegalPlayerAction;
|
|
import net.sf.l2j.gameserver.util.Util;
|
|
import net.sf.l2j.gameserver.util.Util;
|
|
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* This class ...
|
|
* This class ...
|
|
*
|
|
*
|
|
@@ -44,7 +43,6 @@ public final class RequestRestartPoint extends L2GameClientPacket
|
|
protected int _requestedPointType;
|
|
protected int _requestedPointType;
|
|
protected boolean _continuation;
|
|
protected boolean _continuation;
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
protected void readImpl()
|
|
protected void readImpl()
|
|
{
|
|
{
|
|
@@ -54,7 +52,7 @@ public final class RequestRestartPoint extends L2GameClientPacket
|
|
class DeathTask implements Runnable
|
|
class DeathTask implements Runnable
|
|
{
|
|
{
|
|
final L2PcInstance activeChar;
|
|
final L2PcInstance activeChar;
|
|
-
|
|
|
|
|
|
+
|
|
DeathTask (L2PcInstance _activeChar)
|
|
DeathTask (L2PcInstance _activeChar)
|
|
{
|
|
{
|
|
activeChar = _activeChar;
|
|
activeChar = _activeChar;
|
|
@@ -62,135 +60,134 @@ public final class RequestRestartPoint extends L2GameClientPacket
|
|
|
|
|
|
public void run()
|
|
public void run()
|
|
{
|
|
{
|
|
- Location loc = null;
|
|
|
|
- Castle castle = null;
|
|
|
|
- Fort fort = null;
|
|
|
|
- Boolean isInDefense = false;
|
|
|
|
-
|
|
|
|
- // force jail
|
|
|
|
- if (activeChar.isInJail())
|
|
|
|
- {
|
|
|
|
- _requestedPointType = 27;
|
|
|
|
- }
|
|
|
|
- else if (activeChar.isFestivalParticipant())
|
|
|
|
- {
|
|
|
|
- _requestedPointType = 5;
|
|
|
|
- }
|
|
|
|
- switch (_requestedPointType)
|
|
|
|
- {
|
|
|
|
- case 1: // to clanhall
|
|
|
|
- if (activeChar.getClan() == null || activeChar.getClan().getHasHideout() == 0)
|
|
|
|
- {
|
|
|
|
- //cheater
|
|
|
|
- activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
- Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.ClanHall);
|
|
|
|
-
|
|
|
|
- if (ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan())!= null &&
|
|
|
|
- ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan()).getFunction(ClanHall.FUNC_RESTORE_EXP) != null)
|
|
|
|
- {
|
|
|
|
- activeChar.restoreExp(ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan()).getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl());
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case 2: // to castle
|
|
|
|
- castle = CastleManager.getInstance().getCastle(activeChar);
|
|
|
|
-
|
|
|
|
- if (castle != null && castle.getSiege().getIsInProgress())
|
|
|
|
- {
|
|
|
|
- //siege in progress
|
|
|
|
- if (castle.getSiege().checkIsDefender(activeChar.getClan()))
|
|
|
|
- loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Castle);
|
|
|
|
- // Just in case you lost castle while beeing dead.. Port to nearest Town.
|
|
|
|
- else if (castle.getSiege().checkIsAttacker(activeChar.getClan()))
|
|
|
|
- loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- //cheater
|
|
|
|
- activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
- Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- if (activeChar.getClan() == null || activeChar.getClan().getHasCastle() == 0)
|
|
|
|
- {
|
|
|
|
- //cheater
|
|
|
|
- activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
- Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Castle);
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case 3: // to fortress
|
|
|
|
- fort = FortManager.getInstance().getFort(activeChar);
|
|
|
|
-
|
|
|
|
- if (fort != null && fort.getSiege().getIsInProgress())
|
|
|
|
- {
|
|
|
|
- //siege in progress
|
|
|
|
- if (fort.getSiege().checkIsDefender(activeChar.getClan()))
|
|
|
|
- isInDefense = true;
|
|
|
|
- }
|
|
|
|
- if ((activeChar.getClan() == null || activeChar.getClan().getHasFort() == 0) && !isInDefense)
|
|
|
|
- {
|
|
|
|
- //cheater
|
|
|
|
- activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
- Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Fortress);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case 4: // to siege HQ
|
|
|
|
- L2SiegeClan siegeClan = null;
|
|
|
|
- castle = CastleManager.getInstance().getCastle(activeChar);
|
|
|
|
- fort = FortManager.getInstance().getFort(activeChar);
|
|
|
|
-
|
|
|
|
- if (castle != null && castle.getSiege().getIsInProgress())
|
|
|
|
- siegeClan = castle.getSiege().getAttackerClan(activeChar.getClan());
|
|
|
|
- else if (fort != null && fort.getSiege().getIsInProgress())
|
|
|
|
- siegeClan = fort.getSiege().getAttackerClan(activeChar.getClan());
|
|
|
|
-
|
|
|
|
- if (siegeClan == null || siegeClan.getFlag().size() == 0)
|
|
|
|
- {
|
|
|
|
- //cheater
|
|
|
|
- activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
- Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.SiegeFlag);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case 5: // Fixed or Player is a festival participant
|
|
|
|
- if (!activeChar.isGM() && !activeChar.isFestivalParticipant())
|
|
|
|
- {
|
|
|
|
- //cheater
|
|
|
|
- activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
- Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- loc = new Location(activeChar.getX(), activeChar.getY(), activeChar.getZ()); // spawn them where they died
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case 27: // to jail
|
|
|
|
- if (!activeChar.isInJail()) return;
|
|
|
|
- loc = new Location(-114356, -249645, -2984);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- default:
|
|
|
|
- loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //Teleport and revive
|
|
|
|
- activeChar.setIsPendingRevive(true);
|
|
|
|
- activeChar.teleToLocation(loc, true);
|
|
|
|
|
|
+ Location loc = null;
|
|
|
|
+ Castle castle = null;
|
|
|
|
+ Fort fort = null;
|
|
|
|
+ Boolean isInDefense = false;
|
|
|
|
+
|
|
|
|
+ // force jail
|
|
|
|
+ if (activeChar.isInJail())
|
|
|
|
+ {
|
|
|
|
+ _requestedPointType = 27;
|
|
|
|
+ }
|
|
|
|
+ else if (activeChar.isFestivalParticipant())
|
|
|
|
+ {
|
|
|
|
+ _requestedPointType = 5;
|
|
|
|
+ }
|
|
|
|
+ switch (_requestedPointType)
|
|
|
|
+ {
|
|
|
|
+ case 1: // to clanhall
|
|
|
|
+ if (activeChar.getClan() == null || activeChar.getClan().getHasHideout() == 0)
|
|
|
|
+ {
|
|
|
|
+ //cheater
|
|
|
|
+ activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
+ Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.ClanHall);
|
|
|
|
+
|
|
|
|
+ if (ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan())!= null &&
|
|
|
|
+ ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan()).getFunction(ClanHall.FUNC_RESTORE_EXP) != null)
|
|
|
|
+ {
|
|
|
|
+ activeChar.restoreExp(ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan()).getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl());
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 2: // to castle
|
|
|
|
+ castle = CastleManager.getInstance().getCastle(activeChar);
|
|
|
|
+
|
|
|
|
+ if (castle != null && castle.getSiege().getIsInProgress())
|
|
|
|
+ {
|
|
|
|
+ //siege in progress
|
|
|
|
+ if (castle.getSiege().checkIsDefender(activeChar.getClan()))
|
|
|
|
+ loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Castle);
|
|
|
|
+ // Just in case you lost castle while beeing dead.. Port to nearest Town.
|
|
|
|
+ else if (castle.getSiege().checkIsAttacker(activeChar.getClan()))
|
|
|
|
+ loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //cheater
|
|
|
|
+ activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
+ Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (activeChar.getClan() == null || activeChar.getClan().getHasCastle() == 0)
|
|
|
|
+ {
|
|
|
|
+ //cheater
|
|
|
|
+ activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
+ Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Castle);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 3: // to fortress
|
|
|
|
+ fort = FortManager.getInstance().getFort(activeChar);
|
|
|
|
+
|
|
|
|
+ if (fort != null && fort.getSiege().getIsInProgress())
|
|
|
|
+ {
|
|
|
|
+ //siege in progress
|
|
|
|
+ if (fort.getSiege().checkIsDefender(activeChar.getClan()))
|
|
|
|
+ isInDefense = true;
|
|
|
|
+ }
|
|
|
|
+ if ((activeChar.getClan() == null || activeChar.getClan().getHasFort() == 0) && !isInDefense)
|
|
|
|
+ {
|
|
|
|
+ //cheater
|
|
|
|
+ activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
+ Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Fortress);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 4: // to siege HQ
|
|
|
|
+ L2SiegeClan siegeClan = null;
|
|
|
|
+ castle = CastleManager.getInstance().getCastle(activeChar);
|
|
|
|
+ fort = FortManager.getInstance().getFort(activeChar);
|
|
|
|
+
|
|
|
|
+ if (castle != null && castle.getSiege().getIsInProgress())
|
|
|
|
+ siegeClan = castle.getSiege().getAttackerClan(activeChar.getClan());
|
|
|
|
+ else if (fort != null && fort.getSiege().getIsInProgress())
|
|
|
|
+ siegeClan = fort.getSiege().getAttackerClan(activeChar.getClan());
|
|
|
|
+
|
|
|
|
+ if (siegeClan == null || siegeClan.getFlag().size() == 0)
|
|
|
|
+ {
|
|
|
|
+ //cheater
|
|
|
|
+ activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
+ Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.SiegeFlag);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 5: // Fixed or Player is a festival participant
|
|
|
|
+ if (!activeChar.isGM() && !activeChar.isFestivalParticipant())
|
|
|
|
+ {
|
|
|
|
+ //cheater
|
|
|
|
+ activeChar.sendMessage("You may not use this respawn point!");
|
|
|
|
+ Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ loc = new Location(activeChar.getX(), activeChar.getY(), activeChar.getZ()); // spawn them where they died
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 27: // to jail
|
|
|
|
+ if (!activeChar.isInJail()) return;
|
|
|
|
+ loc = new Location(-114356, -249645, -2984);
|
|
|
|
+
|
|
|
|
+ default:
|
|
|
|
+ loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //Teleport and revive
|
|
|
|
+ activeChar.setIsPendingRevive(true);
|
|
|
|
+ activeChar.teleToLocation(loc, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -225,29 +222,22 @@ public final class RequestRestartPoint extends L2GameClientPacket
|
|
{
|
|
{
|
|
// Schedule respawn delay for attacker
|
|
// Schedule respawn delay for attacker
|
|
ThreadPoolManager.getInstance().scheduleGeneral(new DeathTask(activeChar), castle.getSiege().getAttackerRespawnDelay());
|
|
ThreadPoolManager.getInstance().scheduleGeneral(new DeathTask(activeChar), castle.getSiege().getAttackerRespawnDelay());
|
|
- activeChar.sendMessage("You will be re-spawned in " + castle.getSiege().getAttackerRespawnDelay()/1000 + " seconds");
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- // Schedule respawn delay for defender with penalty for CT lose
|
|
|
|
- ThreadPoolManager.getInstance().scheduleGeneral(new DeathTask(activeChar), castle.getSiege().getDefenderRespawnDelay());
|
|
|
|
- activeChar.sendMessage("You will be re-spawned in " + castle.getSiege().getDefenderRespawnDelay()/1000 + " seconds");
|
|
|
|
|
|
+ if (castle.getSiege().getAttackerRespawnDelay() > 0)
|
|
|
|
+ activeChar.sendMessage("You will be re-spawned in " + castle.getSiege().getAttackerRespawnDelay()/1000 + " seconds");
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- return;
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
- // run immediatelly (no need to schedule)
|
|
|
|
- new DeathTask(activeChar).run();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
+ // run immediatelly (no need to schedule)
|
|
|
|
+ new DeathTask(activeChar).run();
|
|
|
|
+ }
|
|
|
|
|
|
/* (non-Javadoc)
|
|
/* (non-Javadoc)
|
|
- * @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()
|
|
|
|
- */
|
|
|
|
|
|
+ * @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public String getType()
|
|
public String getType()
|
|
{
|
|
{
|
|
return _C__6d_REQUESTRESTARTPOINT;
|
|
return _C__6d_REQUESTRESTARTPOINT;
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|