Olympiad rework.
Contributed by facab.
This commit is contained in:
		| @@ -510,7 +510,6 @@ public final class Config | ||||
| 	public static int ALT_OLY_WEEKLY_POINTS; | ||||
| 	public static int ALT_OLY_CLASSED; | ||||
| 	public static int ALT_OLY_NONCLASSED; | ||||
| 	public static int ALT_OLY_REG_DISPLAY; | ||||
| 	public static List<ItemHolder> ALT_OLY_WINNER_REWARD; | ||||
| 	public static List<ItemHolder> ALT_OLY_LOSER_REWARD; | ||||
| 	public static int ALT_OLY_COMP_RITEM; | ||||
| @@ -523,7 +522,8 @@ public final class Config | ||||
| 	public static int ALT_OLY_RANK4_POINTS; | ||||
| 	public static int ALT_OLY_RANK5_POINTS; | ||||
| 	public static int ALT_OLY_MAX_POINTS; | ||||
| 	public static int ALT_OLY_DIVIDER; | ||||
| 	public static int ALT_OLY_DIVIDER_CLASSED; | ||||
| 	public static int ALT_OLY_DIVIDER_NON_CLASSED; | ||||
| 	public static int ALT_OLY_MAX_WEEKLY_MATCHES; | ||||
| 	public static boolean ALT_OLY_LOG_FIGHTS; | ||||
| 	public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS; | ||||
| @@ -531,7 +531,6 @@ public final class Config | ||||
| 	public static List<Integer> LIST_OLY_RESTRICTED_ITEMS; | ||||
| 	public static int ALT_OLY_ENCHANT_LIMIT; | ||||
| 	public static int ALT_OLY_WAIT_TIME; | ||||
| 	public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS; | ||||
| 	public static String ALT_OLY_PERIOD; | ||||
| 	public static int ALT_OLY_PERIOD_MULTIPLIER; | ||||
| 	public static List<Integer> ALT_OLY_COMPETITION_DAYS; | ||||
| @@ -2232,18 +2231,17 @@ public final class Config | ||||
| 			ALT_OLY_START_TIME = Olympiad.getInt("AltOlyStartTime", 20); | ||||
| 			ALT_OLY_MIN = Olympiad.getInt("AltOlyMin", 0); | ||||
| 			ALT_OLY_CPERIOD = Olympiad.getLong("AltOlyCPeriod", 14400000); | ||||
| 			ALT_OLY_BATTLE = Olympiad.getLong("AltOlyBattle", 360000); | ||||
| 			ALT_OLY_BATTLE = Olympiad.getLong("AltOlyBattle", 300000); | ||||
| 			ALT_OLY_WPERIOD = Olympiad.getLong("AltOlyWPeriod", 604800000); | ||||
| 			ALT_OLY_VPERIOD = Olympiad.getLong("AltOlyVPeriod", 86400000); | ||||
| 			ALT_OLY_START_POINTS = Olympiad.getInt("AltOlyStartPoints", 10); | ||||
| 			ALT_OLY_WEEKLY_POINTS = Olympiad.getInt("AltOlyWeeklyPoints", 10); | ||||
| 			ALT_OLY_CLASSED = Olympiad.getInt("AltOlyClassedParticipants", 10); | ||||
| 			ALT_OLY_NONCLASSED = Olympiad.getInt("AltOlyNonClassedParticipants", 20); | ||||
| 			ALT_OLY_REG_DISPLAY = Olympiad.getInt("AltOlyRegistrationDisplayNumber", 100); | ||||
| 			ALT_OLY_WINNER_REWARD = parseItemsList(Olympiad.getString("AltOlyWinReward", "45584,12")); | ||||
| 			ALT_OLY_LOSER_REWARD = parseItemsList(Olympiad.getString("AltOlyLoserReward", "45584,7")); | ||||
| 			ALT_OLY_COMP_RITEM = Olympiad.getInt("AltOlyCompRewItem", 45584); | ||||
| 			ALT_OLY_MIN_MATCHES = Olympiad.getInt("AltOlyMinMatchesForPoints", 15); | ||||
| 			ALT_OLY_MIN_MATCHES = Olympiad.getInt("AltOlyMinMatchesForPoints", 10); | ||||
| 			ALT_OLY_MARK_PER_POINT = Olympiad.getInt("AltOlyMarkPerPoint", 20); | ||||
| 			ALT_OLY_HERO_POINTS = Olympiad.getInt("AltOlyHeroPoints", 30); | ||||
| 			ALT_OLY_RANK1_POINTS = Olympiad.getInt("AltOlyRank1Points", 60); | ||||
| @@ -2252,7 +2250,8 @@ public final class Config | ||||
| 			ALT_OLY_RANK4_POINTS = Olympiad.getInt("AltOlyRank4Points", 40); | ||||
| 			ALT_OLY_RANK5_POINTS = Olympiad.getInt("AltOlyRank5Points", 30); | ||||
| 			ALT_OLY_MAX_POINTS = Olympiad.getInt("AltOlyMaxPoints", 10); | ||||
| 			ALT_OLY_DIVIDER = Olympiad.getInt("AltOlyDivider", 5); | ||||
| 			ALT_OLY_DIVIDER_CLASSED = Olympiad.getInt("AltOlyDividerClassed", 5); | ||||
| 			ALT_OLY_DIVIDER_NON_CLASSED = Olympiad.getInt("AltOlyDividerNonClassed", 5); | ||||
| 			ALT_OLY_MAX_WEEKLY_MATCHES = Olympiad.getInt("AltOlyMaxWeeklyMatches", 30); | ||||
| 			ALT_OLY_LOG_FIGHTS = Olympiad.getBoolean("AltOlyLogFights", false); | ||||
| 			ALT_OLY_SHOW_MONTHLY_WINNERS = Olympiad.getBoolean("AltOlyShowMonthlyWinners", true); | ||||
| @@ -2264,8 +2263,7 @@ public final class Config | ||||
| 				LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id)); | ||||
| 			} | ||||
| 			ALT_OLY_ENCHANT_LIMIT = Olympiad.getInt("AltOlyEnchantLimit", -1); | ||||
| 			ALT_OLY_WAIT_TIME = Olympiad.getInt("AltOlyWaitTime", 120); | ||||
| 			ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Olympiad.getBoolean("AltOlyUseCustomPeriodSettings", false); | ||||
| 			ALT_OLY_WAIT_TIME = Olympiad.getInt("AltOlyWaitTime", 60); | ||||
| 			ALT_OLY_PERIOD = Olympiad.getString("AltOlyPeriod", "MONTH"); | ||||
| 			ALT_OLY_PERIOD_MULTIPLIER = Olympiad.getInt("AltOlyPeriodMultiplier", 1); | ||||
| 			ALT_OLY_COMPETITION_DAYS = new ArrayList<>(); | ||||
| @@ -3143,9 +3141,8 @@ public final class Config | ||||
| 	private static List<ItemHolder> parseItemsList(String line) | ||||
| 	{ | ||||
| 		final String[] propertySplit = line.split(";"); | ||||
| 		if (propertySplit.length == 0) | ||||
| 		if (line.equalsIgnoreCase("none") || (propertySplit.length == 0)) | ||||
| 		{ | ||||
| 			// nothing to do here | ||||
| 			return null; | ||||
| 		} | ||||
| 		 | ||||
|   | ||||
| @@ -56,6 +56,9 @@ public abstract class AbstractOlympiadGame | ||||
| 	protected static final String COMP_LOST = "competitions_lost"; | ||||
| 	protected static final String COMP_DRAWN = "competitions_drawn"; | ||||
| 	protected static final String COMP_DONE_WEEK = "competitions_done_week"; | ||||
| 	protected static final String COMP_DONE_WEEK_CLASSED = "competitions_done_week_classed"; | ||||
| 	protected static final String COMP_DONE_WEEK_NON_CLASSED = "competitions_done_week_non_classed"; | ||||
| 	protected static final String COMP_DONE_WEEK_TEAM = "competitions_done_week_team"; | ||||
| 	 | ||||
| 	protected long _startTime = 0; | ||||
| 	protected boolean _aborted = false; | ||||
| @@ -475,6 +478,8 @@ public abstract class AbstractOlympiadGame | ||||
| 	 | ||||
| 	protected abstract void validateWinner(OlympiadStadium stadium); | ||||
| 	 | ||||
| 	protected abstract int getDivider(); | ||||
| 	 | ||||
| 	protected abstract void healPlayers(); | ||||
| 	 | ||||
| 	protected abstract void untransformPlayers(); | ||||
|   | ||||
| @@ -392,21 +392,6 @@ public class Olympiad extends ListenersContainer | ||||
| 			return; | ||||
| 		} | ||||
| 		 | ||||
| 		prepareCompStart(); | ||||
| 		_compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; | ||||
| 		 | ||||
| 		if (_scheduledOlympiadEnd != null) | ||||
| 		{ | ||||
| 			_scheduledOlympiadEnd.cancel(true); | ||||
| 		} | ||||
| 		 | ||||
| 		_scheduledOlympiadEnd = ThreadPool.schedule(new OlympiadEndTask(), getMillisToOlympiadEnd()); | ||||
| 		 | ||||
| 		updateCompStatus(); | ||||
| 	} | ||||
| 	 | ||||
| 	private void prepareCompStart() | ||||
| 	{ | ||||
| 		_compStart = Calendar.getInstance(); | ||||
| 		final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); | ||||
| 		boolean dayFound = false; | ||||
| @@ -437,6 +422,16 @@ public class Olympiad extends ListenersContainer | ||||
| 		} | ||||
| 		_compStart.set(Calendar.HOUR_OF_DAY, COMP_START); | ||||
| 		_compStart.set(Calendar.MINUTE, COMP_MIN); | ||||
| 		_compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; | ||||
| 		 | ||||
| 		if (_scheduledOlympiadEnd != null) | ||||
| 		{ | ||||
| 			_scheduledOlympiadEnd.cancel(true); | ||||
| 		} | ||||
| 		 | ||||
| 		_scheduledOlympiadEnd = ThreadPool.schedule(new OlympiadEndTask(), getMillisToOlympiadEnd()); | ||||
| 		 | ||||
| 		updateCompStatus(); | ||||
| 	} | ||||
| 	 | ||||
| 	protected class OlympiadEndTask implements Runnable | ||||
| @@ -619,77 +614,60 @@ public class Olympiad extends ListenersContainer | ||||
| 		sm.addInt(_currentCycle); | ||||
| 		Broadcast.toAllOnlinePlayers(sm); | ||||
| 		 | ||||
| 		if (!Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS) | ||||
| 		Calendar currentTime = Calendar.getInstance(); | ||||
| 		currentTime.set(Calendar.AM_PM, Calendar.AM); | ||||
| 		currentTime.set(Calendar.HOUR, 12); | ||||
| 		currentTime.set(Calendar.MINUTE, 0); | ||||
| 		currentTime.set(Calendar.SECOND, 0); | ||||
| 		 | ||||
| 		Calendar nextChange = Calendar.getInstance(); | ||||
| 		 | ||||
| 		switch (Config.ALT_OLY_PERIOD) | ||||
| 		{ | ||||
| 			final Calendar currentTime = Calendar.getInstance(); | ||||
| 			currentTime.add(Calendar.MONTH, 1); | ||||
| 			currentTime.set(Calendar.DAY_OF_MONTH, 1); | ||||
| 			currentTime.set(Calendar.AM_PM, Calendar.AM); | ||||
| 			currentTime.set(Calendar.HOUR, 12); | ||||
| 			currentTime.set(Calendar.MINUTE, 0); | ||||
| 			currentTime.set(Calendar.SECOND, 0); | ||||
| 			_olympiadEnd = currentTime.getTimeInMillis(); | ||||
| 			 | ||||
| 			final Calendar nextChange = Calendar.getInstance(); | ||||
| 			_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			Calendar currentTime = Calendar.getInstance(); | ||||
| 			currentTime.set(Calendar.AM_PM, Calendar.AM); | ||||
| 			currentTime.set(Calendar.HOUR, 12); | ||||
| 			currentTime.set(Calendar.MINUTE, 0); | ||||
| 			currentTime.set(Calendar.SECOND, 0); | ||||
| 			 | ||||
| 			Calendar nextChange = Calendar.getInstance(); | ||||
| 			 | ||||
| 			switch (Config.ALT_OLY_PERIOD) | ||||
| 			case "DAY": | ||||
| 			{ | ||||
| 				case "DAY": | ||||
| 				currentTime.add(Calendar.DAY_OF_MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER); | ||||
| 				currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation | ||||
| 				 | ||||
| 				if (Config.ALT_OLY_PERIOD_MULTIPLIER >= 14) | ||||
| 				{ | ||||
| 					currentTime.add(Calendar.DAY_OF_MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER); | ||||
| 					currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation | ||||
| 					 | ||||
| 					if (Config.ALT_OLY_PERIOD_MULTIPLIER >= 14) | ||||
| 					{ | ||||
| 						_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD; | ||||
| 					} | ||||
| 					else if (Config.ALT_OLY_PERIOD_MULTIPLIER >= 7) | ||||
| 					{ | ||||
| 						_nextWeeklyChange = nextChange.getTimeInMillis() + (WEEKLY_PERIOD / 2); | ||||
| 					} | ||||
| 					else | ||||
| 					{ | ||||
| 						LOGGER.warning("Invalid config value for Config.ALT_OLY_PERIOD_MULTIPLIER, must be >= 7"); | ||||
| 					} | ||||
| 					break; | ||||
| 				} | ||||
| 				case "WEEK": | ||||
| 				{ | ||||
| 					currentTime.add(Calendar.WEEK_OF_MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER); | ||||
| 					currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation | ||||
| 					 | ||||
| 					if (Config.ALT_OLY_PERIOD_MULTIPLIER > 1) | ||||
| 					{ | ||||
| 						_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD; | ||||
| 					} | ||||
| 					else | ||||
| 					{ | ||||
| 						_nextWeeklyChange = nextChange.getTimeInMillis() + (WEEKLY_PERIOD / 2); | ||||
| 					} | ||||
| 					break; | ||||
| 				} | ||||
| 				case "MONTH": | ||||
| 				{ | ||||
| 					currentTime.add(Calendar.MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER); | ||||
| 					currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation | ||||
| 					 | ||||
| 					_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD; | ||||
| 					break; | ||||
| 				} | ||||
| 				else if (Config.ALT_OLY_PERIOD_MULTIPLIER >= 7) | ||||
| 				{ | ||||
| 					_nextWeeklyChange = nextChange.getTimeInMillis() + (WEEKLY_PERIOD / 2); | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					LOGGER.warning("Invalid config value for Config.ALT_OLY_PERIOD_MULTIPLIER, must be >= 7"); | ||||
| 				} | ||||
| 				break; | ||||
| 			} | ||||
| 			case "WEEK": | ||||
| 			{ | ||||
| 				currentTime.add(Calendar.WEEK_OF_MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER); | ||||
| 				currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation | ||||
| 				 | ||||
| 				if (Config.ALT_OLY_PERIOD_MULTIPLIER > 1) | ||||
| 				{ | ||||
| 					_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD; | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					_nextWeeklyChange = nextChange.getTimeInMillis() + (WEEKLY_PERIOD / 2); | ||||
| 				} | ||||
| 				break; | ||||
| 			} | ||||
| 			case "MONTH": | ||||
| 			{ | ||||
| 				currentTime.add(Calendar.MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER); | ||||
| 				currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation | ||||
| 				 | ||||
| 				_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD; | ||||
| 				break; | ||||
| 			} | ||||
| 			_olympiadEnd = currentTime.getTimeInMillis(); | ||||
| 		} | ||||
| 		_olympiadEnd = currentTime.getTimeInMillis(); | ||||
| 		 | ||||
| 		scheduleWeeklyChange(); | ||||
| 	} | ||||
| @@ -716,7 +694,36 @@ public class Olympiad extends ListenersContainer | ||||
| 	 | ||||
| 	private long setNewCompBegin() | ||||
| 	{ | ||||
| 		prepareCompStart(); | ||||
| 		_compStart = Calendar.getInstance(); | ||||
| 		final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); | ||||
| 		boolean dayFound = false; | ||||
| 		int dayCounter = 0; | ||||
| 		for (int i = currentDay; i < 8; i++) | ||||
| 		{ | ||||
| 			if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) | ||||
| 			{ | ||||
| 				dayFound = true; | ||||
| 				break; | ||||
| 			} | ||||
| 			dayCounter++; | ||||
| 		} | ||||
| 		if (!dayFound) | ||||
| 		{ | ||||
| 			for (int i = 1; i < 8; i++) | ||||
| 			{ | ||||
| 				if (Config.ALT_OLY_COMPETITION_DAYS.contains(i)) | ||||
| 				{ | ||||
| 					break; | ||||
| 				} | ||||
| 				dayCounter++; | ||||
| 			} | ||||
| 		} | ||||
| 		if (dayCounter > 0) | ||||
| 		{ | ||||
| 			_compStart.add(Calendar.DAY_OF_MONTH, dayCounter); | ||||
| 		} | ||||
| 		_compStart.set(Calendar.HOUR_OF_DAY, COMP_START); | ||||
| 		_compStart.set(Calendar.MINUTE, COMP_MIN); | ||||
| 		_compStart.add(Calendar.HOUR_OF_DAY, 24); | ||||
| 		_compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; | ||||
| 		 | ||||
| @@ -1063,7 +1070,7 @@ public class Olympiad extends ListenersContainer | ||||
| 		} | ||||
| 		 | ||||
| 		// Win/no win matches point bonus | ||||
| 		points += getCompetitionWon(objectId) > 0 ? 10 : 5; | ||||
| 		points += getCompetitionWon(objectId) > 0 ? 10 : 0; | ||||
| 		 | ||||
| 		// This is a one time calculation. | ||||
| 		noble.set(POINTS, 0); | ||||
|   | ||||
| @@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.olympiad; | ||||
| import java.util.List; | ||||
| import java.util.Set; | ||||
|  | ||||
| import org.l2jmobius.Config; | ||||
| import org.l2jmobius.commons.util.Rnd; | ||||
|  | ||||
| /** | ||||
| @@ -37,6 +38,12 @@ public class OlympiadGameClassed extends OlympiadGameNormal | ||||
| 		return CompetitionType.CLASSED; | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	protected int getDivider() | ||||
| 	{ | ||||
| 		return Config.ALT_OLY_DIVIDER_CLASSED; | ||||
| 	} | ||||
| 	 | ||||
| 	protected static OlympiadGameClassed createGame(int id, List<Set<Integer>> classList) | ||||
| 	{ | ||||
| 		if ((classList == null) || classList.isEmpty()) | ||||
|   | ||||
| @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.olympiad; | ||||
|  | ||||
| import java.util.Set; | ||||
|  | ||||
| import org.l2jmobius.Config; | ||||
|  | ||||
| /** | ||||
|  * @author DS | ||||
|  */ | ||||
| @@ -34,6 +36,12 @@ public class OlympiadGameNonClassed extends OlympiadGameNormal | ||||
| 		return CompetitionType.NON_CLASSED; | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	protected int getDivider() | ||||
| 	{ | ||||
| 		return Config.ALT_OLY_DIVIDER_NON_CLASSED; | ||||
| 	} | ||||
| 	 | ||||
| 	protected static OlympiadGameNonClassed createGame(int id, Set<Integer> list) | ||||
| 	{ | ||||
| 		final Participant[] opponents = OlympiadGameNormal.createListOfParticipants(list); | ||||
|   | ||||
| @@ -214,12 +214,12 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame | ||||
| 	@Override | ||||
| 	protected final void cleanEffects() | ||||
| 	{ | ||||
| 		if (checkOnline(_playerTwo) && (_playerOne.getPlayer().getOlympiadGameId() == _stadiumId)) | ||||
| 		if ((_playerOne.getPlayer() != null) && !_playerOne.isDefaulted() && !_playerOne.isDisconnected() && (_playerOne.getPlayer().getOlympiadGameId() == _stadiumId)) | ||||
| 		{ | ||||
| 			cleanEffects(_playerOne.getPlayer()); | ||||
| 		} | ||||
| 		 | ||||
| 		if (checkOnline(_playerTwo) && (_playerTwo.getPlayer().getOlympiadGameId() == _stadiumId)) | ||||
| 		if ((_playerTwo.getPlayer() != null) && !_playerTwo.isDefaulted() && !_playerTwo.isDisconnected() && (_playerTwo.getPlayer().getOlympiadGameId() == _stadiumId)) | ||||
| 		{ | ||||
| 			cleanEffects(_playerTwo.getPlayer()); | ||||
| 		} | ||||
| @@ -228,11 +228,11 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame | ||||
| 	@Override | ||||
| 	protected final void portPlayersBack() | ||||
| 	{ | ||||
| 		if (checkOnline(_playerTwo)) | ||||
| 		if ((_playerOne.getPlayer() != null) && !_playerOne.isDefaulted() && !_playerOne.isDisconnected()) | ||||
| 		{ | ||||
| 			portPlayerBack(_playerOne.getPlayer()); | ||||
| 		} | ||||
| 		if (checkOnline(_playerTwo)) | ||||
| 		if ((_playerTwo.getPlayer() != null) && !_playerTwo.isDefaulted() && !_playerTwo.isDisconnected()) | ||||
| 		{ | ||||
| 			portPlayerBack(_playerTwo.getPlayer()); | ||||
| 		} | ||||
| @@ -241,22 +241,17 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame | ||||
| 	@Override | ||||
| 	protected final void playersStatusBack() | ||||
| 	{ | ||||
| 		if (checkOnline(_playerTwo) && (_playerOne.getPlayer().getOlympiadGameId() == _stadiumId)) | ||||
| 		if ((_playerOne.getPlayer() != null) && !_playerOne.isDefaulted() && !_playerOne.isDisconnected() && (_playerOne.getPlayer().getOlympiadGameId() == _stadiumId)) | ||||
| 		{ | ||||
| 			playerStatusBack(_playerOne.getPlayer()); | ||||
| 		} | ||||
| 		 | ||||
| 		if (checkOnline(_playerTwo) && (_playerTwo.getPlayer().getOlympiadGameId() == _stadiumId)) | ||||
| 		if ((_playerTwo.getPlayer() != null) && !_playerTwo.isDefaulted() && !_playerTwo.isDisconnected() && (_playerTwo.getPlayer().getOlympiadGameId() == _stadiumId)) | ||||
| 		{ | ||||
| 			playerStatusBack(_playerTwo.getPlayer()); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	private boolean checkOnline(Participant player) | ||||
| 	{ | ||||
| 		return (player.getPlayer() != null) && !player.isDefaulted() && !player.isDisconnected(); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	protected final void clearPlayers() | ||||
| 	{ | ||||
| @@ -358,7 +353,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame | ||||
| 		 | ||||
| 		final int playerOnePoints = _playerOne.getStats().getInt(POINTS); | ||||
| 		final int playerTwoPoints = _playerTwo.getStats().getInt(POINTS); | ||||
| 		int pointDiff = Math.min(playerOnePoints, playerTwoPoints) / Config.ALT_OLY_DIVIDER; | ||||
| 		int pointDiff = Math.min(playerOnePoints, playerTwoPoints) / getDivider(); | ||||
| 		if (pointDiff <= 0) | ||||
| 		{ | ||||
| 			pointDiff = 1; | ||||
| @@ -372,7 +367,6 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame | ||||
| 		SystemMessage sm; | ||||
| 		 | ||||
| 		// Check for if a player defaulted before battle started | ||||
| 		// TODO Is this really official? | ||||
| 		if (_playerOne.isDefaulted() || _playerTwo.isDefaulted()) | ||||
| 		{ | ||||
| 			try | ||||
| @@ -463,7 +457,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame | ||||
| 					 | ||||
| 					winside = 1; | ||||
| 					 | ||||
| 					rewardParticipant(_playerOne.getPlayer(), Config.ALT_OLY_WINNER_REWARD); | ||||
| 					rewardParticipant(_playerOne.getPlayer(), Config.ALT_OLY_WINNER_REWARD); // Winner | ||||
| 					 | ||||
| 					if (Config.ALT_OLY_LOG_FIGHTS) | ||||
| 					{ | ||||
| @@ -489,7 +483,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame | ||||
| 					 | ||||
| 					winside = 2; | ||||
| 					 | ||||
| 					rewardParticipant(_playerTwo.getPlayer(), Config.ALT_OLY_WINNER_REWARD); | ||||
| 					rewardParticipant(_playerTwo.getPlayer(), Config.ALT_OLY_WINNER_REWARD); // Winner | ||||
| 					 | ||||
| 					if (Config.ALT_OLY_LOG_FIGHTS) | ||||
| 					{ | ||||
| @@ -603,11 +597,9 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame | ||||
| 				 | ||||
| 				// Save Fight Result | ||||
| 				saveResults(_playerOne, _playerTwo, 1, _startTime, _fightTime, getType()); | ||||
| 				rewardParticipant(_playerOne.getPlayer(), Config.ALT_OLY_WINNER_REWARD); | ||||
| 				if ((_playerTwo.getPlayer() != null) && _playerTwo.getPlayer().isOnline()) | ||||
| 				{ | ||||
| 					rewardParticipant(_playerTwo.getPlayer(), Config.ALT_OLY_LOSER_REWARD); | ||||
| 				} | ||||
| 				 | ||||
| 				rewardParticipant(_playerOne.getPlayer(), Config.ALT_OLY_WINNER_REWARD); // Winner | ||||
| 				rewardParticipant(_playerTwo.getPlayer(), Config.ALT_OLY_LOSER_REWARD); // Loser | ||||
| 				 | ||||
| 				// Notify to scripts | ||||
| 				EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(_playerOne, _playerTwo, getType()), Olympiad.getInstance()); | ||||
| @@ -632,11 +624,9 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame | ||||
| 				 | ||||
| 				// Save Fight Result | ||||
| 				saveResults(_playerOne, _playerTwo, 2, _startTime, _fightTime, getType()); | ||||
| 				rewardParticipant(_playerTwo.getPlayer(), Config.ALT_OLY_WINNER_REWARD); | ||||
| 				if ((_playerOne.getPlayer() != null) && _playerOne.getPlayer().isOnline()) | ||||
| 				{ | ||||
| 					rewardParticipant(_playerOne.getPlayer(), Config.ALT_OLY_LOSER_REWARD); | ||||
| 				} | ||||
| 				 | ||||
| 				rewardParticipant(_playerTwo.getPlayer(), Config.ALT_OLY_WINNER_REWARD); // Winner | ||||
| 				rewardParticipant(_playerOne.getPlayer(), Config.ALT_OLY_LOSER_REWARD); // Loser | ||||
| 				 | ||||
| 				// Notify to scripts | ||||
| 				EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(_playerTwo, _playerOne, getType()), Olympiad.getInstance()); | ||||
| @@ -649,12 +639,12 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame | ||||
| 				sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_IS_NO_VICTOR_THE_MATCH_ENDS_IN_A_TIE); | ||||
| 				stadium.broadcastPacket(sm); | ||||
| 				 | ||||
| 				int value = Math.min(playerOnePoints / Config.ALT_OLY_DIVIDER, Config.ALT_OLY_MAX_POINTS); | ||||
| 				int value = Math.min(playerOnePoints / getDivider(), Config.ALT_OLY_MAX_POINTS); | ||||
| 				 | ||||
| 				removePointsFromParticipant(_playerOne, value); | ||||
| 				list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - value, -value)); | ||||
| 				 | ||||
| 				value = Math.min(playerTwoPoints / Config.ALT_OLY_DIVIDER, Config.ALT_OLY_MAX_POINTS); | ||||
| 				value = Math.min(playerTwoPoints / getDivider(), Config.ALT_OLY_MAX_POINTS); | ||||
| 				removePointsFromParticipant(_playerTwo, value); | ||||
| 				list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - value, -value)); | ||||
| 				 | ||||
|   | ||||
| @@ -204,8 +204,6 @@ public class OlympiadManager | ||||
| 					return false; | ||||
| 				} | ||||
| 				 | ||||
| 				// TODO Class fights are only 1st week | ||||
| 				 | ||||
| 				if ((Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.OLYMPIAD_ID, player, Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP)) | ||||
| 				{ | ||||
| 					final NpcHtmlMessage message = new NpcHtmlMessage(player.getLastHtmlActionOriginId()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment