Pārlūkot izejas kodu

BETA: Add Olympiad H5 Features:
* The new UI for match list will now appear.
* The new UI for match end will now appear.
* Added some TODO tasks
* Patch by: JIV

Rumen Nikiforov 12 gadi atpakaļ
vecāks
revīzija
10f1a6cfc1

+ 73 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadGameNormal.java

@@ -17,6 +17,7 @@ package com.l2jserver.gameserver.model.olympiad;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
@@ -29,6 +30,7 @@ import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.zone.type.L2OlympiadStadiumZone;
 import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.ExOlympiadMatchResult;
 import com.l2jserver.gameserver.network.serverpackets.ExOlympiadUserInfo;
 import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
@@ -310,6 +312,14 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 			return;
 		}
 		
+		ExOlympiadMatchResult result = null;
+		
+		boolean tie = false;
+		int winside = 0;
+		
+		List<OlympiadInfo> list1 = new ArrayList<>(1);
+		List<OlympiadInfo> list2 = new ArrayList<>(1);
+		
 		final boolean _pOneCrash = ((_playerOne.getPlayer() == null) || _playerOne.isDisconnected());
 		final boolean _pTwoCrash = ((_playerTwo.getPlayer() == null) || _playerTwo.isDisconnected());
 		
@@ -339,6 +349,9 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 					{
 						points = Math.min(playerOnePoints / 3, Config.ALT_OLY_MAX_POINTS);
 						removePointsFromParticipant(_playerOne, points);
+						list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - points, -points));
+						
+						winside = 2;
 						
 						if (Config.ALT_OLY_LOG_FIGHTS)
 						{
@@ -368,6 +381,16 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 					{
 						points = Math.min(playerTwoPoints / 3, Config.ALT_OLY_MAX_POINTS);
 						removePointsFromParticipant(_playerTwo, points);
+						list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - points, -points));
+						
+						if (winside == 2)
+						{
+							tie = true;
+						}
+						else
+						{
+							winside = 1;
+						}
 						
 						if (Config.ALT_OLY_LOG_FIGHTS)
 						{
@@ -391,6 +414,11 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 						_log.log(Level.WARNING, "Exception on validateWinner(): " + e.getMessage(), e);
 					}
 				}
+				if (winside == 1)
+					result = new ExOlympiadMatchResult(tie, winside, list1, list2);
+				else
+					result = new ExOlympiadMatchResult(tie, winside, list2, list1);
+				stadium.broadcastPacket(result);
 				return;
 			}
 			catch (Exception e)
@@ -413,10 +441,14 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 					
 					_playerOne.updateStat(COMP_WON, 1);
 					addPointsToParticipant(_playerOne, pointDiff);
-					
+					list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints + pointDiff, pointDiff));
+										
 					_playerTwo.updateStat(COMP_LOST, 1);
 					removePointsFromParticipant(_playerTwo, pointDiff);
-					
+					list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - pointDiff, -pointDiff));
+
+					winside = 1;
+
 					rewardParticipant(_playerOne.getPlayer(), getReward());
 					
 					if (Config.ALT_OLY_LOG_FIGHTS)
@@ -444,9 +476,13 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 					
 					_playerTwo.updateStat(COMP_WON, 1);
 					addPointsToParticipant(_playerTwo, pointDiff);
+					list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints + pointDiff, pointDiff));					
 					
 					_playerOne.updateStat(COMP_LOST, 1);
 					removePointsFromParticipant(_playerOne, pointDiff);
+					list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - pointDiff, -pointDiff));
+
+					winside = 2;
 					
 					rewardParticipant(_playerTwo.getPlayer(), getReward());
 					
@@ -472,10 +508,14 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 					stadium.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_ENDED_IN_A_TIE));
 					
 					_playerOne.updateStat(COMP_LOST, 1);
-					removePointsFromParticipant(_playerOne, pointDiff);
-					
+					removePointsFromParticipant(_playerOne, pointDiff);					
+					list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - pointDiff, -pointDiff));
+
 					_playerTwo.updateStat(COMP_LOST, 1);
 					removePointsFromParticipant(_playerTwo, pointDiff);
+					list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - pointDiff, -pointDiff));
+					
+					tie = true;
 					
 					if (Config.ALT_OLY_LOG_FIGHTS)
 					{
@@ -501,6 +541,12 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 				_playerTwo.updateStat(COMP_DONE_WEEK, 1);
 				_playerOne.updateStat(getWeeklyMatchType(), 1);
 				_playerTwo.updateStat(getWeeklyMatchType(), 1);
+				
+				if (winside == 1)
+					result = new ExOlympiadMatchResult(tie, winside, list1, list2);
+				else
+					result = new ExOlympiadMatchResult(tie, winside, list2, list1);
+				stadium.broadcastPacket(result);
 				return;
 			}
 			catch (Exception e)
@@ -558,10 +604,14 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 				_playerTwo.updateStat(COMP_LOST, 1);
 				
 				addPointsToParticipant(_playerOne, pointDiff);
+				list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints + pointDiff, pointDiff));
+
 				removePointsFromParticipant(_playerTwo, pointDiff);
-				
+				list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - pointDiff, -pointDiff));
 				winner = _playerOne.getName() + " won";
 				
+				winside = 1;
+				
 				// Save Fight Result
 				saveResults(_playerOne, _playerTwo, 1, _startTime, _fightTime, getType());
 				rewardParticipant(_playerOne.getPlayer(), getReward());
@@ -576,9 +626,13 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 				_playerOne.updateStat(COMP_LOST, 1);
 				
 				addPointsToParticipant(_playerTwo, pointDiff);
+				list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints + pointDiff, pointDiff));
+
 				removePointsFromParticipant(_playerOne, pointDiff);
-				
+				list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - pointDiff, -pointDiff));
+
 				winner = _playerTwo.getName() + " won";
+				winside = 2;
 				
 				// Save Fight Result
 				saveResults(_playerOne, _playerTwo, 2, _startTime, _fightTime, getType());
@@ -592,8 +646,15 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 				sm = SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_ENDED_IN_A_TIE);
 				stadium.broadcastPacket(sm);
 				
+				int value = Math.min(playerOnePoints / getDivider(), Config.ALT_OLY_MAX_POINTS);
+				
 				removePointsFromParticipant(_playerOne, Math.min(playerOnePoints / getDivider(), Config.ALT_OLY_MAX_POINTS));
+				list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - value, -value));
+				
 				removePointsFromParticipant(_playerTwo, Math.min(playerTwoPoints / getDivider(), Config.ALT_OLY_MAX_POINTS));
+				list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - value, -value));
+				
+				tie = true;
 			}
 			
 			_playerOne.updateStat(COMP_DONE, 1);
@@ -603,6 +664,12 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 			_playerOne.updateStat(getWeeklyMatchType(), 1);
 			_playerTwo.updateStat(getWeeklyMatchType(), 1);
 			
+			if (winside == 1)
+				result = new ExOlympiadMatchResult(tie, winside, list1, list2);
+			else
+				result = new ExOlympiadMatchResult(tie, winside, list2, list1);
+			stadium.broadcastPacket(result);
+			
 			if (Config.ALT_OLY_LOG_FIGHTS)
 			{
 				LogRecord record = new LogRecord(Level.INFO, winner);
@@ -619,7 +686,6 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 				});
 				_logResults.log(record);
 			}
-			
 		}
 		catch (Exception e)
 		{

+ 73 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadGameTeams.java

@@ -26,6 +26,7 @@ import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.zone.type.L2OlympiadStadiumZone;
 import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.ExOlympiadMatchResult;
 import com.l2jserver.gameserver.network.serverpackets.ExOlympiadUserInfo;
 import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
@@ -250,6 +251,9 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 		}
 	}
 
+	/**
+	 * UnAfraid: FIXME: Sometimes buffers appear on arena 3v3 match where it shouldn't or they don't get unspawned when match start.
+	 */
 	@Override
 	protected boolean needBuffers()
 	{
@@ -487,6 +491,15 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 		if (_aborted)
 			return;
 		
+		ExOlympiadMatchResult result = null;
+		
+		boolean tie = false;
+		int winside = 0;
+		
+		List<OlympiadInfo> list1 = new ArrayList<>(3);
+		List<OlympiadInfo> list2 = new ArrayList<>(3);
+
+		
 		final boolean tOneCrash = teamOneAllDisconnected();
 		final boolean tTwoCrash = teamTwoAllDisconnected();
 		
@@ -504,17 +517,37 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 					for (int i = _teamOneSize; --i >= 0;)
 					{
 						par = _teamOne[i];
-						removePointsFromParticipant(par, Math.min(par.getStats().getInteger(POINTS) / 3, Config.ALT_OLY_MAX_POINTS));
+						points = par.getStats().getInteger(POINTS) / getDivider();
+						int val = Math.min(par.getStats().getInteger(POINTS) / 3, Config.ALT_OLY_MAX_POINTS);
+						removePointsFromParticipant(par, val);
+						list1.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT1, points - val, -val));
 					}
+					winside = 2;
 				}
 				if (_teamTwoDefaulted)
 				{
 					for (int i = _teamTwoSize; --i >= 0;)
 					{
 						par = _teamTwo[i];
-						removePointsFromParticipant(par, Math.min(par.getStats().getInteger(POINTS) / 3, Config.ALT_OLY_MAX_POINTS));
+						points = par.getStats().getInteger(POINTS) / getDivider();
+						int val = Math.min(par.getStats().getInteger(POINTS) / 3, Config.ALT_OLY_MAX_POINTS);
+						removePointsFromParticipant(par, val);
+						list2.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT2, points - val, -val));
+					}
+					if (winside == 2)
+					{
+						tie = true;
+					}
+					else
+					{
+						winside = 1;
 					}
 				}
+				if (winside == 1)
+					result = new ExOlympiadMatchResult(tie, winside, list1, list2);
+				else
+					result = new ExOlympiadMatchResult(tie, winside, list2, list1);
+				stadium.broadcastPacket(result);
 			}
 			catch (Exception e)
 			{
@@ -619,6 +652,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 						par.updateStat(COMP_LOST, 1);
 						points = pointsTeamTwo[i];
 						removePointsFromParticipant(par, points);
+						list2.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT2, par.getStats().getInteger(POINTS) - points, -points));
 					}
 
 					points = min / MAX_TEAM_SIZE;
@@ -627,10 +661,13 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 						par = _teamOne[i];
 						par.updateStat(COMP_WON, 1);
 						addPointsToParticipant(par, points);
+						list1.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT1, par.getStats().getInteger(POINTS) + points, points));
 					}
 
 					for (int i = 0; i < _teamOneSize; i++)
 						rewardParticipant(_teamOne[i].getPlayer(), getReward());
+					
+					winside = 1;
 				}
 				else if (tOneCrash && !tTwoCrash)
 				{
@@ -644,6 +681,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 						par.updateStat(COMP_LOST, 1);
 						points = pointsTeamOne[i];
 						removePointsFromParticipant(par, points);
+						list1.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT1, par.getStats().getInteger(POINTS) - points, -points));
 					}
 					
 					points = min / MAX_TEAM_SIZE;
@@ -652,7 +690,10 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 						par = _teamTwo[i];
 						par.updateStat(COMP_WON, 1);
 						addPointsToParticipant(par, points);
+						list2.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT2, par.getStats().getInteger(POINTS) + points, points));
 					}
+					
+					winside = 2;
 
 					for (int i = 0; i < _teamTwoSize; i++)
 						rewardParticipant(_teamTwo[i].getPlayer(), getReward());
@@ -666,6 +707,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 						par = _teamOne[i];
 						par.updateStat(COMP_LOST, 1);
 						removePointsFromParticipant(par, pointsTeamOne[i]);
+						list1.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT1, par.getStats().getInteger(POINTS) - pointsTeamOne[i], -pointsTeamOne[i]));
 					}
 
 					for (int i = _teamTwoSize; --i >= 0;)
@@ -673,7 +715,10 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 						par = _teamTwo[i];
 						par.updateStat(COMP_LOST, 1);
 						removePointsFromParticipant(par, pointsTeamTwo[i]);
+						list2.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT2, par.getStats().getInteger(POINTS) - pointsTeamOne[i], -pointsTeamOne[i]));
 					}
+					
+					tie = true;
 				}
 
 				for (int i = _teamOneSize; --i >= 0;)
@@ -696,6 +741,12 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 			{
 				_log.log(Level.WARNING, "Exception on validateWinner(): " + e.getMessage(), e);
 			}
+			
+			if (winside == 1)
+				result = new ExOlympiadMatchResult(tie, winside, list1, list2);
+			else
+				result = new ExOlympiadMatchResult(tie, winside, list2, list1);
+			stadium.broadcastPacket(result);
 			return;
 		}
 		
@@ -746,6 +797,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 					par.updateStat(COMP_LOST, 1);
 					points = pointsTeamTwo[i];
 					removePointsFromParticipant(par, points);
+					list2.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT2, par.getStats().getInteger(POINTS) - points, -points));
 				}
 
 				points = min / MAX_TEAM_SIZE;
@@ -754,8 +806,11 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 					par = _teamOne[i];
 					par.updateStat(COMP_WON, 1);
 					addPointsToParticipant(par, points);
+					list1.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT1, par.getStats().getInteger(POINTS) + points, points));
 				}
-
+				
+				winside = 1;
+				
 				for (int i = 0; i < _teamOneSize; i++)
 					rewardParticipant(_teamOne[i].getPlayer(), getReward());
 			}
@@ -772,6 +827,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 					par.updateStat(COMP_LOST, 1);
 					points = pointsTeamOne[i];
 					removePointsFromParticipant(par, points);
+					list1.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT1, par.getStats().getInteger(POINTS) - points, -points));
 				}
 				
 				points = min / MAX_TEAM_SIZE;
@@ -780,7 +836,10 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 					par = _teamTwo[i];
 					par.updateStat(COMP_WON, 1);
 					addPointsToParticipant(par, points);
+					list2.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT2, par.getStats().getInteger(POINTS) + points, points));
 				}
+				
+				winside = 2;
 
 				for (int i = 0; i < _teamTwoSize; i++)
 					rewardParticipant(_teamTwo[i].getPlayer(), getReward());
@@ -795,6 +854,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 					par.updateStat(COMP_DRAWN, 1);
 					points = Math.min(par.getStats().getInteger(POINTS) / getDivider(), Config.ALT_OLY_MAX_POINTS);
 					removePointsFromParticipant(par, points);
+					list1.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT1, par.getStats().getInteger(POINTS) - points, -points));
 				}
 
 				for (int i = 0; i < _teamTwoSize; i++)
@@ -803,7 +863,9 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 					par.updateStat(COMP_DRAWN, 1);
 					points = Math.min(par.getStats().getInteger(POINTS) / getDivider(), Config.ALT_OLY_MAX_POINTS);
 					removePointsFromParticipant(par, points);
+					list2.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT2, par.getStats().getInteger(POINTS) - points, -points));
 				}
+				tie = true;
 			}
 			
 			for (int i = _teamOneSize; --i >= 0;)
@@ -821,6 +883,11 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 				par.updateStat(COMP_DONE_WEEK, 1);
 				par.updateStat(getWeeklyMatchType(), 1);
 			}
+			if (winside == 1)
+				result = new ExOlympiadMatchResult(tie, winside, list1, list2);
+			else
+				result = new ExOlympiadMatchResult(tie, winside, list2, list1);
+			stadium.broadcastPacket(result);
 		}
 		catch (Exception e)
 		{
@@ -828,6 +895,9 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
 		}
 	}
 	
+	/**
+	 * 	UnAfraid: TODO: We should calculate the damage in array separately for each player so we can display it on ExOlympiadMatchResult correctly.
+	 */
 	@Override
 	protected final void addDamage(L2PcInstance player, int damage)
 	{

+ 96 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadInfo.java

@@ -0,0 +1,96 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.olympiad;
+
+/**
+ * @author JIV
+ */
+public class OlympiadInfo
+{
+	private final String _name;
+	private final String _clan;
+	private final int _clanId;
+	private final int _classId;
+	private final int _dmg;
+	private final int _curPoints;
+	private final int _diffPoints;
+	
+	public OlympiadInfo(String name, String clan, int clanId, int classId, int dmg, int curPoints, int diffPoints)
+	{
+		_name = name;
+		_clan = clan;
+		_clanId = clanId;
+		_classId = classId;
+		_dmg = dmg;
+		_curPoints = curPoints;
+		_diffPoints = diffPoints;
+	}
+	
+	/**
+	 * @return the name the player's name.
+	 */
+	public String getName()
+	{
+		return _name;
+	}
+	
+	/**
+	 * @return the name the player's clan name.
+	 */
+	public String getClanName()
+	{
+		return _clan;
+	}
+	
+	/**
+	 * @return the name the player's clan id.
+	 */
+	public int getClanId()
+	{
+		return _clanId;
+	}
+	
+	/**
+	 * @return the name the player's class id.
+	 */
+	public int getClassId()
+	{
+		return _classId;
+	}
+	
+	/**
+	 * @return the name the player's damage.
+	 */
+	public int getDamage()
+	{
+		return _dmg;
+	}
+	
+	/**
+	 * @return the name the player's current points.
+	 */
+	public int getCurrentPoints()
+	{
+		return _curPoints;
+	}
+	
+	/**
+	 * @return the name the player's points difference since this match.
+	 */
+	public int getDiffPoints()
+	{
+		return _diffPoints;
+	}
+}

+ 22 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/Participant.java

@@ -31,6 +31,8 @@ public final class Participant
 	private boolean disconnected = false;
 	private boolean defaulted = false;
 	private final StatsSet stats;
+	public String clanName;
+	public int clanId;
 	
 	public Participant(L2PcInstance plr, int olympiadSide)
 	{
@@ -40,6 +42,8 @@ public final class Participant
 		side = olympiadSide;
 		baseClass = plr.getBaseClass();
 		stats = Olympiad.getNobleStats(getObjectId());
+		clanName = plr.getClan() != null ? plr.getClan().getName() : "";
+		clanId = plr.getClanId();
 	}
 	
 	public Participant(int objId, int olympiadSide)
@@ -50,6 +54,8 @@ public final class Participant
 		side = olympiadSide;
 		baseClass = 0;
 		stats = null;
+		clanName = "";
+		clanId = 0;
 	}
 	
 	/**
@@ -82,6 +88,22 @@ public final class Participant
 		return name;
 	}
 	
+	/**
+	 * @return the name the player's clan name.
+	 */
+	public String getClanName()
+	{
+		return clanName;
+	}
+	
+	/**
+	 * @return the name the player's id.
+	 */
+	public int getClanId()
+	{
+		return clanId;
+	}
+	
 	/**
 	 * @return the player
 	 */

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/L2GamePacketHandler.java

@@ -1103,7 +1103,7 @@ public final class L2GamePacketHandler implements IPacketHandler<L2GameClient>,
 								msg = new RequestExFriendListExtended();
 								break;
 							case 0x88:
-								//msg = new RequestExOlympiadMatchListRefresh();
+								msg = new RequestExOlympiadMatchListRefresh();
 								break;
 							case 0x89:
 								// RequestBRGamePoint

+ 9 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java

@@ -297,6 +297,15 @@ public final class RequestBypassToServer extends L2GameClientPacket
 					Hero.getInstance().showHeroDiary(activeChar, heroclass, heroid, heropage);
 				}
 			}
+			else if (_command.startsWith("_olympiad?command"))
+			{
+				int arenaId = Integer.parseInt(_command.split("=")[2]);
+				final IBypassHandler handler = BypassHandler.getInstance().getHandler("arenachange");
+				if (handler != null)
+				{
+					handler.useBypass("arenachange " + (arenaId - 1), activeChar, null);
+				}
+			}
 			else
 			{
 				final IBypassHandler handler = BypassHandler.getInstance().getHandler(_command);

+ 2 - 18
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestExOlympiadMatchListRefresh.java

@@ -14,12 +14,7 @@
  */
 package com.l2jserver.gameserver.network.clientpackets;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.olympiad.OlympiadGameManager;
-import com.l2jserver.gameserver.model.olympiad.OlympiadGameTask;
 import com.l2jserver.gameserver.network.serverpackets.ExOlympiadMatchList;
 
 /**
@@ -42,21 +37,10 @@ public class RequestExOlympiadMatchListRefresh extends L2GameClientPacket
 	protected void runImpl()
 	{
 		final L2PcInstance activeChar = getClient().getActiveChar();
-		if (activeChar == null || !activeChar.inObserverMode())
+		if (activeChar == null)
 			return;
 		
-		List<OlympiadGameTask> games = new ArrayList<>();
-		OlympiadGameTask task;
-		for (int i = 0; i < OlympiadGameManager.getInstance().getNumberOfStadiums(); i++)
-		{
-			task = OlympiadGameManager.getInstance().getOlympiadTask(i);
-			if (task != null)
-			{
-				if (!task.isBattleFinished())
-					games.add(task);
-			}
-		}
-		activeChar.sendPacket(new ExOlympiadMatchList(games));
+		activeChar.sendPacket(new ExOlympiadMatchList());
 	}
 	
 	@Override

+ 17 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/ExOlympiadMatchList.java

@@ -14,10 +14,12 @@
  */
 package com.l2jserver.gameserver.network.serverpackets;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import com.l2jserver.gameserver.model.olympiad.AbstractOlympiadGame;
 import com.l2jserver.gameserver.model.olympiad.OlympiadGameClassed;
+import com.l2jserver.gameserver.model.olympiad.OlympiadGameManager;
 import com.l2jserver.gameserver.model.olympiad.OlympiadGameNonClassed;
 import com.l2jserver.gameserver.model.olympiad.OlympiadGameTask;
 import com.l2jserver.gameserver.model.olympiad.OlympiadGameTeams;
@@ -27,14 +29,23 @@ import com.l2jserver.gameserver.model.olympiad.OlympiadGameTeams;
  */
 public class ExOlympiadMatchList extends L2GameServerPacket
 {
-	private final List<OlympiadGameTask> _games;
+	private final List<OlympiadGameTask> _games = new ArrayList<>();
 	
-	/**
-	 * @param games competitions list
-	 */
-	public ExOlympiadMatchList(List<OlympiadGameTask> games)
+	public ExOlympiadMatchList()
 	{
-		_games = games;
+		OlympiadGameTask task;
+		for (int i = 0; i < OlympiadGameManager.getInstance().getNumberOfStadiums(); i++)
+		{
+			task = OlympiadGameManager.getInstance().getOlympiadTask(i);
+			if (task != null)
+			{
+				if (!task.isGameStarted() || task.isBattleFinished())
+				{
+					continue; //initial or finished state not shown
+				}
+				_games.add(task);
+			}
+		}
 	}
 	
 	@Override

+ 84 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/network/serverpackets/ExOlympiadMatchResult.java

@@ -0,0 +1,84 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.network.serverpackets;
+
+import java.util.List;
+
+import com.l2jserver.gameserver.model.olympiad.OlympiadInfo;
+
+/**
+ * @author JIV
+ */
+public class ExOlympiadMatchResult extends L2GameServerPacket
+{
+	private final boolean _tie;
+	private int _winTeam; // 1,2
+	private int _loseTeam = 2;
+	private final List<OlympiadInfo> _winnerList;
+	private final List<OlympiadInfo> _loserList;
+	
+	public ExOlympiadMatchResult(boolean tie, int winTeam, List<OlympiadInfo> winnerList, List<OlympiadInfo> loserList)
+	{
+		_tie = tie;
+		_winTeam = winTeam;
+		_winnerList = winnerList;
+		_loserList = loserList;
+		
+		if (_winTeam == 2)
+		{
+			_loseTeam = 1;
+		}
+		else if (_winTeam == 0)
+		{
+			_winTeam = 1;
+		}
+	}
+	
+	@Override
+	protected void writeImpl()
+	{
+		writeC(0xFE);
+		writeH(0xD4);
+		writeD(0x01); // Type 0 = Match List, 1 = Match Result
+		
+		writeD(_tie ? 1 : 0); // 0 - win, 1 - tie
+		writeS(_winnerList.get(0).getName());
+		writeD(_winTeam);
+		writeD(_winnerList.size());
+		for (OlympiadInfo info : _winnerList)
+		{
+			writeS(info.getName());
+			writeS(info.getClanName());
+			writeD(info.getClanId());
+			writeD(info.getClassId());
+			writeD(info.getDamage());
+			writeD(info.getCurrentPoints());
+			writeD(info.getDiffPoints());
+		}
+		
+		writeD(_loseTeam);
+		writeD(_loserList.size());
+		for (OlympiadInfo info : _loserList)
+		{
+			writeS(info.getName());
+			writeS(info.getClanName());
+			writeD(info.getClanId());
+			writeD(info.getClassId());
+			writeD(info.getDamage());
+			writeD(info.getCurrentPoints());
+			writeD(info.getDiffPoints());
+		}
+	}
+}