Making Olympiad participants invulnerable at match end.

This commit is contained in:
MobiusDev
2018-03-11 12:23:52 +00:00
parent f747e61acc
commit b6f09dba3a
22 changed files with 404 additions and 24 deletions

View File

@@ -487,4 +487,8 @@ public abstract class AbstractOlympiadGame
protected abstract void healPlayers(); protected abstract void healPlayers();
protected abstract void untransformPlayers(); protected abstract void untransformPlayers();
protected abstract void makePlayersInvul();
protected abstract void removePlayersInvul();
} }

View File

@@ -797,4 +797,30 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
player2.stopTransformation(true); player2.stopTransformation(true);
} }
} }
@Override
public final void makePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(true);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(true);
}
}
@Override
public final void removePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(false);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(false);
}
}
} }

View File

@@ -485,7 +485,7 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_stadium.updateZoneStatusForCharactersInside(); _game.cleanEffects();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -494,7 +494,16 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_game.cleanEffects(); _game.makePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try
{
_stadium.updateZoneStatusForCharactersInside();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -507,6 +516,15 @@ public final class OlympiadGameTask implements Runnable
*/ */
private void cleanupGame() private void cleanupGame()
{ {
try
{
_game.removePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try try
{ {
_game.playersStatusBack(); _game.playersStatusBack();

View File

@@ -487,4 +487,8 @@ public abstract class AbstractOlympiadGame
protected abstract void healPlayers(); protected abstract void healPlayers();
protected abstract void untransformPlayers(); protected abstract void untransformPlayers();
protected abstract void makePlayersInvul();
protected abstract void removePlayersInvul();
} }

View File

@@ -797,4 +797,30 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
player2.stopTransformation(true); player2.stopTransformation(true);
} }
} }
@Override
public final void makePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(true);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(true);
}
}
@Override
public final void removePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(false);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(false);
}
}
} }

View File

@@ -485,7 +485,7 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_stadium.updateZoneStatusForCharactersInside(); _game.cleanEffects();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -494,7 +494,16 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_game.cleanEffects(); _game.makePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try
{
_stadium.updateZoneStatusForCharactersInside();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -507,6 +516,15 @@ public final class OlympiadGameTask implements Runnable
*/ */
private void cleanupGame() private void cleanupGame()
{ {
try
{
_game.removePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try try
{ {
_game.playersStatusBack(); _game.playersStatusBack();

View File

@@ -487,4 +487,8 @@ public abstract class AbstractOlympiadGame
protected abstract void healPlayers(); protected abstract void healPlayers();
protected abstract void untransformPlayers(); protected abstract void untransformPlayers();
protected abstract void makePlayersInvul();
protected abstract void removePlayersInvul();
} }

View File

@@ -797,4 +797,30 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
player2.stopTransformation(true); player2.stopTransformation(true);
} }
} }
@Override
public final void makePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(true);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(true);
}
}
@Override
public final void removePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(false);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(false);
}
}
} }

View File

@@ -485,7 +485,7 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_stadium.updateZoneStatusForCharactersInside(); _game.cleanEffects();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -494,7 +494,16 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_game.cleanEffects(); _game.makePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try
{
_stadium.updateZoneStatusForCharactersInside();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -507,6 +516,15 @@ public final class OlympiadGameTask implements Runnable
*/ */
private void cleanupGame() private void cleanupGame()
{ {
try
{
_game.removePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try try
{ {
_game.playersStatusBack(); _game.playersStatusBack();

View File

@@ -487,4 +487,8 @@ public abstract class AbstractOlympiadGame
protected abstract void healPlayers(); protected abstract void healPlayers();
protected abstract void untransformPlayers(); protected abstract void untransformPlayers();
protected abstract void makePlayersInvul();
protected abstract void removePlayersInvul();
} }

View File

@@ -797,4 +797,30 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
player2.stopTransformation(true); player2.stopTransformation(true);
} }
} }
@Override
public final void makePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(true);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(true);
}
}
@Override
public final void removePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(false);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(false);
}
}
} }

View File

@@ -485,7 +485,7 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_stadium.updateZoneStatusForCharactersInside(); _game.cleanEffects();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -494,7 +494,16 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_game.cleanEffects(); _game.makePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try
{
_stadium.updateZoneStatusForCharactersInside();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -507,6 +516,15 @@ public final class OlympiadGameTask implements Runnable
*/ */
private void cleanupGame() private void cleanupGame()
{ {
try
{
_game.removePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try try
{ {
_game.playersStatusBack(); _game.playersStatusBack();

View File

@@ -333,6 +333,9 @@ public abstract class AbstractOlympiadGame
player.setCurrentHp(player.getMaxHp()); player.setCurrentHp(player.getMaxHp());
player.setCurrentMp(player.getMaxMp()); player.setCurrentMp(player.getMaxMp());
player.getStatus().startHpMpRegeneration(); player.getStatus().startHpMpRegeneration();
// Add invul state.
player.setIsInvul(true);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -380,6 +383,9 @@ public abstract class AbstractOlympiadGame
player.setCurrentMp(player.getMaxMp()); player.setCurrentMp(player.getMaxMp());
player.getStatus().startHpMpRegeneration(); player.getStatus().startHpMpRegeneration();
// Remove invul state.
player.setIsInvul(false);
if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0) if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
{ {
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, player); AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, player);
@@ -492,4 +498,8 @@ public abstract class AbstractOlympiadGame
protected abstract int[][] getReward(); protected abstract int[][] getReward();
protected abstract String getWeeklyMatchType(); protected abstract String getWeeklyMatchType();
protected abstract void makePlayersInvul();
protected abstract void removePlayersInvul();
} }

View File

@@ -807,4 +807,30 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
} }
} }
} }
@Override
public final void makePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(true);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(true);
}
}
@Override
public final void removePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(false);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(false);
}
}
} }

View File

@@ -445,7 +445,7 @@ public final class OlympiadGameTask implements Runnable
* Fifth stage: battle is running, returns true if winner found. * Fifth stage: battle is running, returns true if winner found.
* @return * @return
*/ */
private final boolean checkBattle() private boolean checkBattle()
{ {
try try
{ {
@@ -462,7 +462,7 @@ public final class OlympiadGameTask implements Runnable
/** /**
* Sixth stage: winner's validations * Sixth stage: winner's validations
*/ */
private final void stopGame() private void stopGame()
{ {
try try
{ {
@@ -473,15 +473,6 @@ public final class OlympiadGameTask implements Runnable
_log.log(Level.WARNING, e.getMessage(), e); _log.log(Level.WARNING, e.getMessage(), e);
} }
try
{
_zone.updateZoneStatusForCharactersInside();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try try
{ {
_game.cleanEffects(); _game.cleanEffects();
@@ -490,13 +481,40 @@ public final class OlympiadGameTask implements Runnable
{ {
_log.log(Level.WARNING, e.getMessage(), e); _log.log(Level.WARNING, e.getMessage(), e);
} }
try
{
_game.makePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try
{
_zone.updateZoneStatusForCharactersInside();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
} }
/** /**
* Seventh stage: game cleanup (port players back, closing doors, etc) * Seventh stage: game cleanup (port players back, closing doors, etc)
*/ */
private final void cleanupGame() private void cleanupGame()
{ {
try
{
_game.removePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try try
{ {
_game.playersStatusBack(); _game.playersStatusBack();

View File

@@ -1094,4 +1094,42 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
return true; return true;
} }
@Override
protected void makePlayersInvul()
{
for (Participant participant : _teamOne)
{
if (participant.getPlayer() != null)
{
participant.getPlayer().setIsInvul(true);
}
}
for (Participant participant : _teamTwo)
{
if (participant.getPlayer() != null)
{
participant.getPlayer().setIsInvul(true);
}
}
}
@Override
protected void removePlayersInvul()
{
for (Participant participant : _teamOne)
{
if (participant.getPlayer() != null)
{
participant.getPlayer().setIsInvul(false);
}
}
for (Participant participant : _teamTwo)
{
if (participant.getPlayer() != null)
{
participant.getPlayer().setIsInvul(false);
}
}
}
} }

View File

@@ -487,4 +487,8 @@ public abstract class AbstractOlympiadGame
protected abstract void healPlayers(); protected abstract void healPlayers();
protected abstract void untransformPlayers(); protected abstract void untransformPlayers();
protected abstract void makePlayersInvul();
protected abstract void removePlayersInvul();
} }

View File

@@ -797,4 +797,30 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
player2.stopTransformation(true); player2.stopTransformation(true);
} }
} }
@Override
public final void makePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(true);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(true);
}
}
@Override
public final void removePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(false);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(false);
}
}
} }

View File

@@ -485,7 +485,7 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_stadium.updateZoneStatusForCharactersInside(); _game.cleanEffects();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -494,7 +494,16 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_game.cleanEffects(); _game.makePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try
{
_stadium.updateZoneStatusForCharactersInside();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -507,6 +516,15 @@ public final class OlympiadGameTask implements Runnable
*/ */
private void cleanupGame() private void cleanupGame()
{ {
try
{
_game.removePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try try
{ {
_game.playersStatusBack(); _game.playersStatusBack();

View File

@@ -487,4 +487,8 @@ public abstract class AbstractOlympiadGame
protected abstract void healPlayers(); protected abstract void healPlayers();
protected abstract void untransformPlayers(); protected abstract void untransformPlayers();
protected abstract void makePlayersInvul();
protected abstract void removePlayersInvul();
} }

View File

@@ -797,4 +797,30 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
player2.stopTransformation(true); player2.stopTransformation(true);
} }
} }
@Override
public final void makePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(true);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(true);
}
}
@Override
public final void removePlayersInvul()
{
if (_playerOne.getPlayer() != null)
{
_playerOne.getPlayer().setIsInvul(false);
}
if (_playerTwo.getPlayer() != null)
{
_playerTwo.getPlayer().setIsInvul(false);
}
}
} }

View File

@@ -485,7 +485,7 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_stadium.updateZoneStatusForCharactersInside(); _game.cleanEffects();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -494,7 +494,16 @@ public final class OlympiadGameTask implements Runnable
try try
{ {
_game.cleanEffects(); _game.makePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try
{
_stadium.updateZoneStatusForCharactersInside();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -507,6 +516,15 @@ public final class OlympiadGameTask implements Runnable
*/ */
private void cleanupGame() private void cleanupGame()
{ {
try
{
_game.removePlayersInvul();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
try try
{ {
_game.playersStatusBack(); _game.playersStatusBack();