Olympiad rework.
Contributed by facab.
This commit is contained in:
@@ -22,9 +22,9 @@ AltOlyMin = 00
|
||||
# Default: 14400000
|
||||
AltOlyCPeriod = 14400000
|
||||
|
||||
# Olympiad Battle Period, Default 6 minutes.
|
||||
# Default: 360000
|
||||
AltOlyBattle = 360000
|
||||
# Olympiad Battle Period, Default 5 minutes.
|
||||
# Default: 300000
|
||||
AltOlyBattle = 300000
|
||||
|
||||
# Olympiad Weekly Period, Default 1 week
|
||||
# Used for adding points to nobles
|
||||
@@ -43,14 +43,23 @@ AltOlyStartPoints = 10
|
||||
# Default: 10
|
||||
AltOlyWeeklyPoints = 10
|
||||
|
||||
# Required number of participants for the games
|
||||
# Required number of participants for the class based games
|
||||
# Default: 20
|
||||
AltOlyParticipants = 20
|
||||
AltOlyClassedParticipants = 20
|
||||
|
||||
# Number used for displaying amount of registered participants, messages "Fewer than ..." or "More than ...".
|
||||
# 0 for displaying digits instead of text phrase (old style).
|
||||
# Default: 100
|
||||
AltOlyRegistrationDisplayNumber = 100
|
||||
# Required number of participants for the non-class based games
|
||||
# Default: 10
|
||||
AltOlyNonClassedParticipants = 20
|
||||
|
||||
# Reward for the winner
|
||||
# Format: itemId1,itemNum1;itemId2,itemNum2... (45584,12)
|
||||
# Default: None
|
||||
AltOlyWinReward = None
|
||||
|
||||
# Reward for loser
|
||||
# Format: itemId1,itemNum1;itemId2,itemNum2... (45584,7)
|
||||
# Default: None
|
||||
AltOlyLoserReward = None
|
||||
|
||||
# ItemId used for exchanging to the points.
|
||||
# Default: 45584
|
||||
@@ -61,31 +70,31 @@ AltOlyCompRewItem = 45584
|
||||
AltOlyMinMatchesForPoints = 10
|
||||
|
||||
# Rate to exchange points to reward item.
|
||||
# Default: 1000
|
||||
# Default: 20
|
||||
AltOlyMarkPerPoint = 20
|
||||
|
||||
# Noblesse points awarded to Heroes.
|
||||
# Default: 30
|
||||
# Default: 300
|
||||
AltOlyHeroPoints = 300
|
||||
|
||||
# Noblesse points awarded to Rank 1 members.
|
||||
# Default: 100
|
||||
# Default: 200
|
||||
AltOlyRank1Points = 200
|
||||
|
||||
# Noblesse points awarded to Rank 2 members.
|
||||
# Default: 75
|
||||
# Default: 80
|
||||
AltOlyRank2Points = 80
|
||||
|
||||
# Noblesse points awarded to Rank 3 members.
|
||||
# Default: 55
|
||||
# Default: 50
|
||||
AltOlyRank3Points = 50
|
||||
|
||||
# Noblesse points awarded to Rank 4 members.
|
||||
# Default: 40
|
||||
# Default: 30
|
||||
AltOlyRank4Points = 30
|
||||
|
||||
# Noblesse points awarded to Rank 5 members.
|
||||
# Default: 30
|
||||
# Default: 15
|
||||
AltOlyRank5Points = 15
|
||||
|
||||
# Maximum points that player can gain/lose on a match.
|
||||
@@ -114,35 +123,22 @@ AltOlyEnchantLimit = -1
|
||||
AltOlyLogFights = False
|
||||
|
||||
# Time to wait before teleported to arena.
|
||||
# Default: 60
|
||||
AltOlyWaitTime = 60
|
||||
# Default: 120
|
||||
AltOlyWaitTime = 120
|
||||
|
||||
# Divider for points in games
|
||||
# Divider for points in classed and non-classed games
|
||||
# Default: 5
|
||||
AltOlyDivider = 5
|
||||
AltOlyDividerClassed = 5
|
||||
AltOlyDividerNonClassed = 5
|
||||
|
||||
# Maximum number of matches a Noblesse character can join per week
|
||||
# Default: 30
|
||||
AltOlyMaxWeeklyMatches = 30
|
||||
|
||||
# Enable competitions only on specific days.
|
||||
# Default: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||
# Classic: 6,7 (FRIDAY,SATURDAY)
|
||||
# Enable competitions only on specific days. Usage: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||
# Default: 6,7 (FRIDAY,SATURDAY)
|
||||
AltOlyCompetitionDays = 6,7
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Custom Olympiad period settings
|
||||
# ---------------------------------------------------------------------------
|
||||
# Example for Olympiad every 2 weeks:
|
||||
# AltOlyUseCustomPeriodSettings = True
|
||||
# AltOlyPeriod = WEEK
|
||||
# AltOlyPeriodMultiplier = 2
|
||||
# ---------------------------------------------------------------------------
|
||||
# Enable/disable custom period settings.
|
||||
# Default: False
|
||||
# Classic: True
|
||||
AltOlyUseCustomPeriodSettings = True
|
||||
|
||||
# Change the type of delay between two Olympiads.
|
||||
# Available values: MONTH, WEEK, DAY
|
||||
# Default: MONTH
|
||||
|
@@ -7,15 +7,15 @@
|
||||
<tr><td height=10></td></tr>
|
||||
<tr><td><center></center><br>
|
||||
<center>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;0">Haste Lv2</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;1">Acumen Lv3</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;2">Wind Walk Lv2</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;3">Might Lv3</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;4">Shield Lv3</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;5">Magic Barrier Lv2</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;6">Blessed Body Lv4</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;7">Blessed Soul Lv4</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;8">Berserker Spirit Lv2</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;0">Haste</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;1">Acumen</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;2">Wind Walk</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;3">Might</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;4">Shield</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;5">Magic Barrier</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;6">Blessed Body</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;7">Blessed Soul</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest OlyBuffer giveBuff;8">Berserker Spirit</Button>
|
||||
</center>
|
||||
</td></tr>
|
||||
<tr><td height=34></td></tr>
|
||||
|
@@ -34,15 +34,15 @@ public final class OlyBuffer extends AbstractNpcAI
|
||||
// Skills
|
||||
private static final SkillHolder[] ALLOWED_BUFFS =
|
||||
{
|
||||
new SkillHolder(4357, 2), // Haste Lv2
|
||||
new SkillHolder(4355, 3), // Acumen Lv3
|
||||
new SkillHolder(4342, 2), // Wind Walk Lv2
|
||||
new SkillHolder(4345, 3), // Might Lv3
|
||||
new SkillHolder(4344, 3), // Shield Lv3
|
||||
new SkillHolder(4349, 2), // Magic Barrier lv.2
|
||||
new SkillHolder(4347, 4), // Blessed Body lv.4
|
||||
new SkillHolder(4348, 4), // Blessed Soul lv.4
|
||||
new SkillHolder(4352, 2), // Berserker Spirit Lv2
|
||||
new SkillHolder(1086, 1), // Haste - Atk. Spd. +15%.
|
||||
new SkillHolder(1085, 1), // Acumen - Casting Spd. +15%
|
||||
new SkillHolder(1204, 1), // Wind Walk - Speed +20.
|
||||
new SkillHolder(1068, 1), // Might - P. Atk. +8%.
|
||||
new SkillHolder(1040, 1), // Shield - P. Def. +8%.
|
||||
new SkillHolder(1036, 1), // Magic Barrier - M. Def. +23%.
|
||||
new SkillHolder(1045, 1), // Blessed Body - Max HP +10%.
|
||||
new SkillHolder(1048, 1), // Blessed Soul - Max MP +10%.
|
||||
new SkillHolder(1062, 1), // Berserker Spirit - P. Def. -5%, M. Def. -10%, P. Evasion -2, P. Atk. +5%, M. Atk. +10%, Atk. Spd. +5%, Casting Spd. +5% and Speed +5.
|
||||
};
|
||||
|
||||
private OlyBuffer()
|
||||
|
@@ -30,6 +30,7 @@ import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.CompetitionType;
|
||||
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameManager;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameTask;
|
||||
@@ -123,7 +124,7 @@ public final class OlyManager extends AbstractNpcAI implements IBypassHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
OlympiadManager.getInstance().registerNoble(player);
|
||||
OlympiadManager.getInstance().registerNoble(player, CompetitionType.NON_CLASSED);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameManager;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameNormal;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameNonClassed;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameTask;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.olympiad.Participant;
|
||||
@@ -91,7 +91,7 @@ public class AdminOlympiad implements IAdminCommandHandler
|
||||
final Participant[] players = new Participant[2];
|
||||
players[0] = new Participant(activeChar, 1);
|
||||
players[1] = new Participant(player, 2);
|
||||
task.attachGame(new OlympiadGameNormal(i, players));
|
||||
task.attachGame(new OlympiadGameNonClassed(i, players));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -60,6 +60,7 @@ import org.l2jmobius.commons.util.StringUtil;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.util.FloodProtectorConfig;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@@ -512,9 +513,10 @@ public final class Config
|
||||
public static long ALT_OLY_VPERIOD;
|
||||
public static int ALT_OLY_START_POINTS;
|
||||
public static int ALT_OLY_WEEKLY_POINTS;
|
||||
public static int ALT_OLY_PARTICIPANTS;
|
||||
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;
|
||||
public static int ALT_OLY_MIN_MATCHES;
|
||||
public static int ALT_OLY_MARK_PER_POINT;
|
||||
@@ -525,7 +527,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;
|
||||
@@ -533,7 +536,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;
|
||||
@@ -2151,13 +2153,15 @@ 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_PARTICIPANTS = Olympiad.getInt("AltOlyParticipants", 20);
|
||||
ALT_OLY_REG_DISPLAY = Olympiad.getInt("AltOlyRegistrationDisplayNumber", 100);
|
||||
ALT_OLY_CLASSED = Olympiad.getInt("AltOlyClassedParticipants", 20);
|
||||
ALT_OLY_NONCLASSED = Olympiad.getInt("AltOlyNonClassedParticipants", 20);
|
||||
ALT_OLY_WINNER_REWARD = parseItemsList(Olympiad.getString("AltOlyWinReward", "none"));
|
||||
ALT_OLY_LOSER_REWARD = parseItemsList(Olympiad.getString("AltOlyLoserReward", "none"));
|
||||
ALT_OLY_COMP_RITEM = Olympiad.getInt("AltOlyCompRewItem", 45584);
|
||||
ALT_OLY_MIN_MATCHES = Olympiad.getInt("AltOlyMinMatchesForPoints", 15);
|
||||
ALT_OLY_MARK_PER_POINT = Olympiad.getInt("AltOlyMarkPerPoint", 20);
|
||||
@@ -2168,8 +2172,9 @@ public final class Config
|
||||
ALT_OLY_RANK4_POINTS = Olympiad.getInt("AltOlyRank4Points", 30);
|
||||
ALT_OLY_RANK5_POINTS = Olympiad.getInt("AltOlyRank5Points", 15);
|
||||
ALT_OLY_MAX_POINTS = Olympiad.getInt("AltOlyMaxPoints", 10);
|
||||
ALT_OLY_DIVIDER = Olympiad.getInt("AltOlyDivider", 5);
|
||||
ALT_OLY_MAX_WEEKLY_MATCHES = Olympiad.getInt("AltOlyMaxWeeklyMatches", 70);
|
||||
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);
|
||||
ALT_OLY_ANNOUNCE_GAMES = Olympiad.getBoolean("AltOlyAnnounceGames", true);
|
||||
@@ -2181,11 +2186,10 @@ public final class Config
|
||||
}
|
||||
ALT_OLY_ENCHANT_LIMIT = Olympiad.getInt("AltOlyEnchantLimit", -1);
|
||||
ALT_OLY_WAIT_TIME = Olympiad.getInt("AltOlyWaitTime", 60);
|
||||
ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Olympiad.getBoolean("AltOlyUseCustomPeriodSettings", false);
|
||||
ALT_OLY_PERIOD = Olympiad.getString("AltOlyPeriod", "MONTH");
|
||||
ALT_OLY_PERIOD_MULTIPLIER = Olympiad.getInt("AltOlyPeriodMultiplier", 1);
|
||||
ALT_OLY_COMPETITION_DAYS = new ArrayList<>();
|
||||
for (String s : Olympiad.getString("AltOlyCompetitionDays", "1,2,3,4,5,6,7").split(","))
|
||||
for (String s : Olympiad.getString("AltOlyCompetitionDays", "6,7").split(","))
|
||||
{
|
||||
ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s));
|
||||
}
|
||||
@@ -3010,6 +3014,60 @@ public final class Config
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a config value from its string representation to a two-dimensional int array.<br>
|
||||
* The format of the value to be parsed should be as follows: "item1Id,item1Amount;item2Id,item2Amount;...itemNId,itemNAmount".
|
||||
* @param line the value of the parameter to parse
|
||||
* @return the parsed list or {@code null} if nothing was parsed
|
||||
*/
|
||||
private static List<ItemHolder> parseItemsList(String line)
|
||||
{
|
||||
final String[] propertySplit = line.split(";");
|
||||
if (line.equalsIgnoreCase("none") || (propertySplit.length == 0))
|
||||
{
|
||||
// nothing to do here
|
||||
return null;
|
||||
}
|
||||
|
||||
String[] valueSplit;
|
||||
final List<ItemHolder> result = new ArrayList<>(propertySplit.length);
|
||||
for (String value : propertySplit)
|
||||
{
|
||||
valueSplit = value.split(",");
|
||||
if (valueSplit.length != 2)
|
||||
{
|
||||
LOGGER.warning("parseItemsList[Config.load()]: invalid entry -> " + valueSplit[0] + ", should be itemId,itemNumber. Skipping to the next entry in the list.");
|
||||
continue;
|
||||
}
|
||||
|
||||
int itemId = -1;
|
||||
try
|
||||
{
|
||||
itemId = Integer.parseInt(valueSplit[0]);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
LOGGER.warning("parseItemsList[Config.load()]: invalid itemId -> " + valueSplit[0] + ", value must be an integer. Skipping to the next entry in the list.");
|
||||
continue;
|
||||
}
|
||||
int count = -1;
|
||||
try
|
||||
{
|
||||
count = Integer.parseInt(valueSplit[1]);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
LOGGER.warning("parseItemsList[Config.load()]: invalid item number -> " + valueSplit[1] + ", value must be an integer. Skipping to the next entry in the list.");
|
||||
continue;
|
||||
}
|
||||
if ((itemId > 0) && (count > 0))
|
||||
{
|
||||
result.add(new ItemHolder(itemId, count));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static class IPConfigData implements IXmlReader
|
||||
{
|
||||
private static final List<String> _subnets = new ArrayList<>(5);
|
||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.model.events.impl.olympiad;
|
||||
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||
import org.l2jmobius.gameserver.model.olympiad.CompetitionType;
|
||||
import org.l2jmobius.gameserver.model.olympiad.Participant;
|
||||
|
||||
/**
|
||||
@@ -27,11 +28,13 @@ public class OnOlympiadMatchResult implements IBaseEvent
|
||||
{
|
||||
private final Participant _winner;
|
||||
private final Participant _loser;
|
||||
private final CompetitionType _type;
|
||||
|
||||
public OnOlympiadMatchResult(Participant winner, Participant looser)
|
||||
public OnOlympiadMatchResult(Participant winner, Participant looser, CompetitionType type)
|
||||
{
|
||||
_winner = winner;
|
||||
_loser = looser;
|
||||
_type = type;
|
||||
}
|
||||
|
||||
public Participant getWinner()
|
||||
@@ -44,6 +47,11 @@ public class OnOlympiadMatchResult implements IBaseEvent
|
||||
return _loser;
|
||||
}
|
||||
|
||||
public CompetitionType getCompetitionType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventType getType()
|
||||
{
|
||||
|
@@ -0,0 +1,490 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 org.l2jmobius.gameserver.model.olympiad;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Party;
|
||||
import org.l2jmobius.gameserver.model.Party.MessageType;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadMode;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* @author godson, GodKratos, Pere, DS
|
||||
*/
|
||||
public abstract class AbstractOlympiadGame
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(AbstractOlympiadGame.class.getName());
|
||||
protected static final Logger LOGGER_OLYMPIAD = Logger.getLogger("olympiad");
|
||||
|
||||
protected static final String POINTS = "olympiad_points";
|
||||
protected static final String COMP_DONE = "competitions_done";
|
||||
protected static final String COMP_WON = "competitions_won";
|
||||
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;
|
||||
protected final int _stadiumId;
|
||||
|
||||
protected AbstractOlympiadGame(int id)
|
||||
{
|
||||
_stadiumId = id;
|
||||
}
|
||||
|
||||
public final boolean isAborted()
|
||||
{
|
||||
return _aborted;
|
||||
}
|
||||
|
||||
public final int getStadiumId()
|
||||
{
|
||||
return _stadiumId;
|
||||
}
|
||||
|
||||
protected boolean makeCompetitionStart()
|
||||
{
|
||||
_startTime = System.currentTimeMillis();
|
||||
return !_aborted;
|
||||
}
|
||||
|
||||
protected final void addPointsToParticipant(Participant par, int points)
|
||||
{
|
||||
par.updateStat(POINTS, points);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_EARNED_S2_POINTS_IN_THE_OLYMPIAD_GAMES);
|
||||
sm.addString(par.getName());
|
||||
sm.addInt(points);
|
||||
broadcastPacket(sm);
|
||||
}
|
||||
|
||||
protected final void removePointsFromParticipant(Participant par, int points)
|
||||
{
|
||||
par.updateStat(POINTS, -points);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_LOST_S2_POINTS_IN_THE_OLYMPIAD_GAMES);
|
||||
sm.addString(par.getName());
|
||||
sm.addInt(points);
|
||||
broadcastPacket(sm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function return null if player passed all checks or SystemMessage with reason for broadcast to opponent(s).
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
protected static SystemMessage checkDefaulted(PlayerInstance player)
|
||||
{
|
||||
if ((player == null) || !player.isOnline())
|
||||
{
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_MADE_HASTE_WITH_THEIR_TAIL_BETWEEN_THEIR_LEGS_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
|
||||
if ((player.getClient() == null) || player.getClient().isDetached())
|
||||
{
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_MADE_HASTE_WITH_THEIR_TAIL_BETWEEN_THEIR_LEGS_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
|
||||
// safety precautions
|
||||
if (player.inObserverMode())
|
||||
{
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_DOES_NOT_MEET_THE_REQUIREMENTS_TO_DO_BATTLE_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
if (player.isDead())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_DEAD_AND_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_DOES_NOT_MEET_THE_REQUIREMENTS_TO_DO_BATTLE_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
if (player.isSubClassActive())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_YOU_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD_BECAUSE_YOU_HAVE_CHANGED_YOUR_CLASS_TO_SUBCLASS);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_DOES_NOT_MEET_THE_REQUIREMENTS_TO_DO_BATTLE_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
if (player.isCursedWeaponEquipped())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_THE_OWNER_OF_S2_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD);
|
||||
sm.addPcName(player);
|
||||
sm.addItemName(player.getCursedWeaponEquippedId());
|
||||
player.sendPacket(sm);
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_DOES_NOT_MEET_THE_REQUIREMENTS_TO_DO_BATTLE_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
if (!player.isInventoryUnder90(true))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_AS_THE_INVENTORY_WEIGHT_SLOT_IS_FILLED_BEYOND_80);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_DOES_NOT_MEET_THE_REQUIREMENTS_TO_DO_BATTLE_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static boolean portPlayerToArena(Participant par, Location loc, int id, Instance instance)
|
||||
{
|
||||
final PlayerInstance player = par.getPlayer();
|
||||
if ((player == null) || !player.isOnline())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
player.setLastLocation();
|
||||
if (player.isSitting())
|
||||
{
|
||||
player.standUp();
|
||||
}
|
||||
player.setTarget(null);
|
||||
|
||||
player.setOlympiadGameId(id);
|
||||
player.setIsInOlympiadMode(true);
|
||||
player.setIsOlympiadStart(false);
|
||||
player.setOlympiadSide(par.getSide());
|
||||
player.teleToLocation(loc, instance);
|
||||
player.sendPacket(new ExOlympiadMode(2));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static void removals(PlayerInstance player, boolean removeParty)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove Buffs
|
||||
player.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
|
||||
// Remove Clan Skills
|
||||
if (player.getClan() != null)
|
||||
{
|
||||
player.getClan().removeSkillEffects(player);
|
||||
if (player.getClan().getCastleId() > 0)
|
||||
{
|
||||
CastleManager.getInstance().getCastleByOwner(player.getClan()).removeResidentialSkills(player);
|
||||
}
|
||||
if (player.getClan().getFortId() > 0)
|
||||
{
|
||||
FortManager.getInstance().getFortByOwner(player.getClan()).removeResidentialSkills(player);
|
||||
}
|
||||
}
|
||||
// Abort casting if player casting
|
||||
player.abortAttack();
|
||||
player.abortCast();
|
||||
|
||||
// Force the character to be visible
|
||||
player.setInvisible(false);
|
||||
|
||||
// Heal Player fully
|
||||
player.setCurrentCp(player.getMaxCp());
|
||||
player.setCurrentHp(player.getMaxHp());
|
||||
player.setCurrentMp(player.getMaxMp());
|
||||
|
||||
// Remove Summon's Buffs
|
||||
if (player.hasSummon())
|
||||
{
|
||||
final Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.unSummon(player);
|
||||
}
|
||||
|
||||
player.getServitors().values().forEach(s ->
|
||||
{
|
||||
s.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
s.abortAttack();
|
||||
s.abortCast();
|
||||
});
|
||||
}
|
||||
|
||||
// stop any cubic that has been given by other player.
|
||||
player.stopCubicsByOthers();
|
||||
|
||||
// Remove player from his party
|
||||
if (removeParty)
|
||||
{
|
||||
final Party party = player.getParty();
|
||||
if (party != null)
|
||||
{
|
||||
party.removePartyMember(player, MessageType.EXPELLED);
|
||||
}
|
||||
}
|
||||
// Remove Agathion
|
||||
if (player.getAgathionId() > 0)
|
||||
{
|
||||
player.setAgathionId(0);
|
||||
player.broadcastUserInfo();
|
||||
}
|
||||
|
||||
player.checkItemRestriction();
|
||||
|
||||
// Remove shot automation
|
||||
player.disableAutoShotsAll();
|
||||
|
||||
// Discharge any active shots
|
||||
player.unchargeAllShots();
|
||||
|
||||
// enable skills with cool time <= 15 minutes
|
||||
for (Skill skill : player.getAllSkills())
|
||||
{
|
||||
if (skill.getReuseDelay() <= 900000)
|
||||
{
|
||||
player.enableSkill(skill);
|
||||
}
|
||||
}
|
||||
|
||||
player.sendSkillList();
|
||||
player.sendPacket(new SkillCoolTime(player));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void cleanEffects(PlayerInstance player)
|
||||
{
|
||||
try
|
||||
{
|
||||
// prevent players kill each other
|
||||
player.setIsOlympiadStart(false);
|
||||
player.setTarget(null);
|
||||
player.abortAttack();
|
||||
player.abortCast();
|
||||
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
|
||||
if (player.isDead())
|
||||
{
|
||||
player.setIsDead(false);
|
||||
}
|
||||
|
||||
player.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
player.clearSouls();
|
||||
player.clearCharges();
|
||||
if (player.getAgathionId() > 0)
|
||||
{
|
||||
player.setAgathionId(0);
|
||||
}
|
||||
final Summon pet = player.getPet();
|
||||
if ((pet != null) && !pet.isDead())
|
||||
{
|
||||
pet.setTarget(null);
|
||||
pet.abortAttack();
|
||||
pet.abortCast();
|
||||
pet.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
pet.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
}
|
||||
|
||||
player.getServitors().values().stream().filter(s -> !s.isDead()).forEach(s ->
|
||||
{
|
||||
s.setTarget(null);
|
||||
s.abortAttack();
|
||||
s.abortCast();
|
||||
s.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
s.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
});
|
||||
|
||||
player.setCurrentCp(player.getMaxCp());
|
||||
player.setCurrentHp(player.getMaxHp());
|
||||
player.setCurrentMp(player.getMaxMp());
|
||||
player.getStatus().startHpMpRegeneration();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void playerStatusBack(PlayerInstance player)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (player.isTransformed())
|
||||
{
|
||||
player.untransform();
|
||||
}
|
||||
|
||||
player.setIsInOlympiadMode(false);
|
||||
player.setIsOlympiadStart(false);
|
||||
player.setOlympiadSide(-1);
|
||||
player.setOlympiadGameId(-1);
|
||||
player.sendPacket(new ExOlympiadMode(0));
|
||||
|
||||
// Add Clan Skills
|
||||
if (player.getClan() != null)
|
||||
{
|
||||
player.getClan().addSkillEffects(player);
|
||||
if (player.getClan().getCastleId() > 0)
|
||||
{
|
||||
CastleManager.getInstance().getCastleByOwner(player.getClan()).giveResidentialSkills(player);
|
||||
}
|
||||
if (player.getClan().getFortId() > 0)
|
||||
{
|
||||
FortManager.getInstance().getFortByOwner(player.getClan()).giveResidentialSkills(player);
|
||||
}
|
||||
player.sendSkillList();
|
||||
}
|
||||
|
||||
// heal again after adding clan skills
|
||||
player.setCurrentCp(player.getMaxCp());
|
||||
player.setCurrentHp(player.getMaxHp());
|
||||
player.setCurrentMp(player.getMaxMp());
|
||||
player.getStatus().startHpMpRegeneration();
|
||||
|
||||
if (Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
|
||||
{
|
||||
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, player);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "playerStatusBack()", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void portPlayerBack(PlayerInstance player)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final Location loc = player.getLastLocation();
|
||||
if (loc != null)
|
||||
{
|
||||
player.setIsPendingRevive(false);
|
||||
player.teleToLocation(loc, null);
|
||||
player.unsetLastLocation();
|
||||
}
|
||||
}
|
||||
|
||||
public static void rewardParticipant(PlayerInstance player, List<ItemHolder> list)
|
||||
{
|
||||
if ((player == null) || !player.isOnline() || (list == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
list.forEach(holder ->
|
||||
{
|
||||
final ItemInstance item = player.getInventory().addItem("Olympiad", holder.getId(), holder.getCount(), player, null);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
iu.addModifiedItem(item);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
|
||||
sm.addItemName(item);
|
||||
sm.addLong(holder.getCount());
|
||||
player.sendPacket(sm);
|
||||
});
|
||||
player.sendInventoryUpdate(iu);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract CompetitionType getType();
|
||||
|
||||
public abstract String[] getPlayerNames();
|
||||
|
||||
public abstract boolean containsParticipant(int playerId);
|
||||
|
||||
public abstract void sendOlympiadInfo(Creature creature);
|
||||
|
||||
public abstract void broadcastOlympiadInfo(OlympiadStadium _stadium);
|
||||
|
||||
protected abstract void broadcastPacket(IClientOutgoingPacket packet);
|
||||
|
||||
protected abstract boolean needBuffers();
|
||||
|
||||
protected abstract boolean checkDefaulted();
|
||||
|
||||
protected abstract void removals();
|
||||
|
||||
protected abstract boolean portPlayersToArena(List<Location> spawns, Instance instance);
|
||||
|
||||
protected abstract void cleanEffects();
|
||||
|
||||
protected abstract void portPlayersBack();
|
||||
|
||||
protected abstract void playersStatusBack();
|
||||
|
||||
protected abstract void clearPlayers();
|
||||
|
||||
protected abstract void handleDisconnect(PlayerInstance player);
|
||||
|
||||
protected abstract void resetDamage();
|
||||
|
||||
protected abstract void addDamage(PlayerInstance player, int damage);
|
||||
|
||||
protected abstract boolean checkBattleStatus();
|
||||
|
||||
protected abstract boolean haveWinner();
|
||||
|
||||
protected abstract void validateWinner(OlympiadStadium stadium);
|
||||
|
||||
protected abstract int getDivider();
|
||||
|
||||
protected abstract void healPlayers();
|
||||
|
||||
protected abstract void untransformPlayers();
|
||||
|
||||
protected abstract void makePlayersInvul();
|
||||
|
||||
protected abstract void removePlayersInvul();
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 org.l2jmobius.gameserver.model.olympiad;
|
||||
|
||||
/**
|
||||
* @author DS
|
||||
*/
|
||||
public enum CompetitionType
|
||||
{
|
||||
CLASSED("classed"),
|
||||
NON_CLASSED("non-classed"),
|
||||
OTHER("other");
|
||||
|
||||
private final String _name;
|
||||
|
||||
CompetitionType(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String toString()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
}
|
@@ -394,21 +394,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;
|
||||
@@ -439,6 +424,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
|
||||
@@ -621,77 +616,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();
|
||||
}
|
||||
@@ -718,7 +696,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;
|
||||
|
||||
|
@@ -52,14 +52,32 @@ public final class OlympiadAnnouncer implements Runnable
|
||||
task = OlympiadGameManager.getInstance().getOlympiadTask(_currentStadium);
|
||||
if ((task != null) && (task.getGame() != null) && task.needAnnounce())
|
||||
{
|
||||
NpcStringId npcString;
|
||||
final String arenaId = String.valueOf(task.getGame().getStadiumId() + 1);
|
||||
switch (task.getGame().getType())
|
||||
{
|
||||
case NON_CLASSED:
|
||||
{
|
||||
npcString = NpcStringId.OLYMPIAD_CLASS_FREE_INDIVIDUAL_MATCH_IS_GOING_TO_BEGIN_IN_ARENA_S1_IN_A_MOMENT;
|
||||
break;
|
||||
}
|
||||
case CLASSED:
|
||||
{
|
||||
npcString = NpcStringId.OLYMPIAD_CLASS_INDIVIDUAL_MATCH_IS_GOING_TO_BEGIN_IN_ARENA_S1_IN_A_MOMENT;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (Spawn spawn : _managers)
|
||||
{
|
||||
final Npc manager = spawn.getLastSpawn();
|
||||
if (manager != null)
|
||||
{
|
||||
manager.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.OLYMPIAD_CLASS_FREE_INDIVIDUAL_MATCH_IS_GOING_TO_BEGIN_IN_ARENA_S1_IN_A_MOMENT, arenaId);
|
||||
manager.broadcastSay(ChatType.NPC_SHOUT, npcString, arenaId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 org.l2jmobius.gameserver.model.olympiad;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author DS
|
||||
*/
|
||||
public class OlympiadGameClassed extends OlympiadGameNormal
|
||||
{
|
||||
private OlympiadGameClassed(int id, Participant[] opponents)
|
||||
{
|
||||
super(id, opponents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CompetitionType getType()
|
||||
{
|
||||
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())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<Integer> list;
|
||||
Participant[] opponents;
|
||||
while (!classList.isEmpty())
|
||||
{
|
||||
list = classList.get(Rnd.get(classList.size()));
|
||||
if ((list == null) || (list.size() < 2))
|
||||
{
|
||||
classList.remove(list);
|
||||
continue;
|
||||
}
|
||||
|
||||
opponents = OlympiadGameNormal.createListOfParticipants(list);
|
||||
if (opponents == null)
|
||||
{
|
||||
classList.remove(list);
|
||||
continue;
|
||||
}
|
||||
|
||||
return new OlympiadGameClassed(id, opponents);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.olympiad;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
@@ -87,11 +88,12 @@ public class OlympiadGameManager implements Runnable
|
||||
|
||||
if (Olympiad.getInstance().inCompPeriod())
|
||||
{
|
||||
OlympiadGameNormal newGame;
|
||||
AbstractOlympiadGame newGame;
|
||||
|
||||
List<Set<Integer>> readyClassed = OlympiadManager.getInstance().hasEnoughRegisteredClassed();
|
||||
boolean readyNonClassed = OlympiadManager.getInstance().hasEnoughRegisteredNonClassed();
|
||||
|
||||
if (readyNonClassed)
|
||||
if ((readyClassed != null) || readyNonClassed)
|
||||
{
|
||||
// reset delay broadcast
|
||||
_delay = 0;
|
||||
@@ -104,11 +106,23 @@ public class OlympiadGameManager implements Runnable
|
||||
{
|
||||
if (!task.isRunning())
|
||||
{
|
||||
// Fair arena distribution
|
||||
// 0,2,4,6,8.. arenas checked for classed or teams first
|
||||
if (readyClassed != null)
|
||||
{
|
||||
newGame = OlympiadGameClassed.createGame(i, readyClassed);
|
||||
if (newGame != null)
|
||||
{
|
||||
task.attachGame(newGame);
|
||||
continue;
|
||||
}
|
||||
readyClassed = null;
|
||||
}
|
||||
// 1,3,5,7,9.. arenas used for non-classed
|
||||
// also other arenas will be used for non-classed if no classed or teams available
|
||||
if (readyNonClassed)
|
||||
{
|
||||
newGame = OlympiadGameNormal.createGame(i, OlympiadManager.getInstance().getPlayerRegistered());
|
||||
newGame = OlympiadGameNonClassed.createGame(i, OlympiadManager.getInstance().getRegisteredNonClassBased());
|
||||
if (newGame != null)
|
||||
{
|
||||
task.attachGame(newGame);
|
||||
@@ -120,7 +134,7 @@ public class OlympiadGameManager implements Runnable
|
||||
}
|
||||
|
||||
// stop generating games if no more participants
|
||||
if (!readyNonClassed)
|
||||
if ((readyClassed == null) && !readyNonClassed)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -132,7 +146,7 @@ public class OlympiadGameManager implements Runnable
|
||||
_delay++;
|
||||
if (_delay >= 10) // 5min
|
||||
{
|
||||
for (Integer id : OlympiadManager.getInstance().getPlayerRegistered())
|
||||
for (Integer id : OlympiadManager.getInstance().getRegisteredNonClassBased())
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
@@ -145,6 +159,24 @@ public class OlympiadGameManager implements Runnable
|
||||
noble.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_GAMES_MAY_BE_DELAYED_DUE_TO_AN_INSUFFICIENT_NUMBER_OF_PLAYERS_WAITING));
|
||||
}
|
||||
}
|
||||
|
||||
for (Set<Integer> list : OlympiadManager.getInstance().getRegisteredClassBased().values())
|
||||
{
|
||||
for (Integer id : list)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final PlayerInstance noble = World.getInstance().getPlayer(id);
|
||||
if (noble != null)
|
||||
{
|
||||
noble.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_GAMES_MAY_BE_DELAYED_DUE_TO_AN_INSUFFICIENT_NUMBER_OF_PLAYERS_WAITING));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_delay = 0;
|
||||
}
|
||||
}
|
||||
@@ -202,7 +234,7 @@ public class OlympiadGameManager implements Runnable
|
||||
return;
|
||||
}
|
||||
|
||||
final OlympiadGameNormal game = _tasks.get(id).getTask().getGame();
|
||||
final AbstractOlympiadGame game = _tasks.get(id).getTask().getGame();
|
||||
if (game != null)
|
||||
{
|
||||
game.addDamage(attacker, damage);
|
||||
|
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 org.l2jmobius.gameserver.model.olympiad;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
|
||||
/**
|
||||
* @author DS
|
||||
*/
|
||||
public class OlympiadGameNonClassed extends OlympiadGameNormal
|
||||
{
|
||||
public OlympiadGameNonClassed(int id, Participant[] opponents)
|
||||
{
|
||||
super(id, opponents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final CompetitionType getType()
|
||||
{
|
||||
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);
|
||||
if (opponents == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new OlympiadGameNonClassed(id, opponents);
|
||||
}
|
||||
}
|
@@ -24,62 +24,37 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Party;
|
||||
import org.l2jmobius.gameserver.model.Party.MessageType;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.olympiad.OnOlympiadMatchResult;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadMatchResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadMode;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadUserInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* @author GodKratos, Pere, DS
|
||||
*/
|
||||
public class OlympiadGameNormal
|
||||
public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
{
|
||||
private int _damageP1 = 0;
|
||||
private int _damageP2 = 0;
|
||||
protected int _damageP1 = 0;
|
||||
protected int _damageP2 = 0;
|
||||
|
||||
private Participant _playerOne;
|
||||
private Participant _playerTwo;
|
||||
protected Participant _playerOne;
|
||||
protected Participant _playerTwo;
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(OlympiadGameNormal.class.getName());
|
||||
private static final Logger LOGGER_OLYMPIAD = Logger.getLogger("olympiad");
|
||||
|
||||
private static final String POINTS = "olympiad_points";
|
||||
private static final String COMP_DONE = "competitions_done";
|
||||
private static final String COMP_WON = "competitions_won";
|
||||
private static final String COMP_LOST = "competitions_lost";
|
||||
private static final String COMP_DRAWN = "competitions_drawn";
|
||||
private static final String COMP_DONE_WEEK = "competitions_done_week";
|
||||
|
||||
private long _startTime = 0;
|
||||
private final boolean _aborted = false;
|
||||
private final int _stadiumId;
|
||||
|
||||
public OlympiadGameNormal(int id, Participant[] opponents)
|
||||
protected OlympiadGameNormal(int id, Participant[] opponents)
|
||||
{
|
||||
_stadiumId = id;
|
||||
super(id);
|
||||
|
||||
_playerOne = opponents[0];
|
||||
_playerTwo = opponents[1];
|
||||
@@ -88,17 +63,6 @@ public class OlympiadGameNormal
|
||||
_playerTwo.getPlayer().setOlympiadGameId(id);
|
||||
}
|
||||
|
||||
protected static OlympiadGameNormal createGame(int id, Set<Integer> list)
|
||||
{
|
||||
final Participant[] opponents = OlympiadGameNormal.createListOfParticipants(list);
|
||||
if (opponents == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new OlympiadGameNormal(id, opponents);
|
||||
}
|
||||
|
||||
protected static Participant[] createListOfParticipants(Set<Integer> set)
|
||||
{
|
||||
if ((set == null) || set.isEmpty() || (set.size() < 2))
|
||||
@@ -158,23 +122,27 @@ public class OlympiadGameNormal
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean containsParticipant(int playerId)
|
||||
{
|
||||
return ((_playerOne != null) && (_playerOne.getObjectId() == playerId)) || ((_playerTwo != null) && (_playerTwo.getObjectId() == playerId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void sendOlympiadInfo(Creature creature)
|
||||
{
|
||||
creature.sendPacket(new ExOlympiadUserInfo(_playerOne));
|
||||
creature.sendPacket(new ExOlympiadUserInfo(_playerTwo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void broadcastOlympiadInfo(OlympiadStadium stadium)
|
||||
{
|
||||
stadium.broadcastPacket(new ExOlympiadUserInfo(_playerOne));
|
||||
stadium.broadcastPacket(new ExOlympiadUserInfo(_playerTwo));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void broadcastPacket(IClientOutgoingPacket packet)
|
||||
{
|
||||
if (_playerOne.updatePlayer())
|
||||
@@ -188,6 +156,7 @@ public class OlympiadGameNormal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean portPlayersToArena(List<Location> spawns, Instance instance)
|
||||
{
|
||||
boolean result = true;
|
||||
@@ -204,11 +173,13 @@ public class OlympiadGameNormal
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needBuffers()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void removals()
|
||||
{
|
||||
if (_aborted)
|
||||
@@ -220,8 +191,14 @@ public class OlympiadGameNormal
|
||||
removals(_playerTwo.getPlayer(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean makeCompetitionStart()
|
||||
{
|
||||
if (!super.makeCompetitionStart())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((_playerOne.getPlayer() == null) || (_playerTwo.getPlayer() == null))
|
||||
{
|
||||
return false;
|
||||
@@ -234,49 +211,48 @@ public class OlympiadGameNormal
|
||||
return true;
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
}
|
||||
|
||||
@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()
|
||||
{
|
||||
_playerOne.setPlayer(null);
|
||||
@@ -285,6 +261,7 @@ public class OlympiadGameNormal
|
||||
_playerTwo = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void handleDisconnect(PlayerInstance player)
|
||||
{
|
||||
if (player.getObjectId() == _playerOne.getObjectId())
|
||||
@@ -297,6 +274,7 @@ public class OlympiadGameNormal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean checkBattleStatus()
|
||||
{
|
||||
if (_aborted)
|
||||
@@ -317,6 +295,7 @@ public class OlympiadGameNormal
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean haveWinner()
|
||||
{
|
||||
if (!checkBattleStatus())
|
||||
@@ -353,6 +332,7 @@ public class OlympiadGameNormal
|
||||
return playerOneLost || playerTwoLost;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateWinner(OlympiadStadium stadium)
|
||||
{
|
||||
if (_aborted)
|
||||
@@ -373,7 +353,7 @@ public class OlympiadGameNormal
|
||||
|
||||
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;
|
||||
@@ -403,7 +383,7 @@ public class OlympiadGameNormal
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info(_playerOne.getName() + " default," + _playerOne + "," + _playerTwo + ",0,0,0,0," + points);
|
||||
LOGGER_OLYMPIAD.info(_playerOne.getName() + " default," + _playerOne + "," + _playerTwo + ",0,0,0,0," + points + "," + getType());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -430,7 +410,7 @@ public class OlympiadGameNormal
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info(_playerTwo.getName() + " default," + _playerOne + "," + _playerTwo + ",0,0,0,0," + points);
|
||||
LOGGER_OLYMPIAD.info(_playerTwo.getName() + " default," + _playerOne + "," + _playerTwo + ",0,0,0,0," + points + "," + getType());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -477,13 +457,15 @@ public class OlympiadGameNormal
|
||||
|
||||
winside = 1;
|
||||
|
||||
rewardParticipant(_playerOne.getPlayer(), Config.ALT_OLY_WINNER_REWARD); // Winner
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info(_playerTwo.getName() + " crash," + _playerOne + "," + _playerTwo + ",0,0,0,0," + pointDiff);
|
||||
LOGGER_OLYMPIAD.info(_playerTwo.getName() + " crash," + _playerOne + "," + _playerTwo + ",0,0,0,0," + pointDiff + "," + getType());
|
||||
}
|
||||
|
||||
// Notify to scripts
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(_playerOne, _playerTwo), Olympiad.getInstance());
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(_playerOne, _playerTwo, getType()), Olympiad.getInstance());
|
||||
}
|
||||
else if (_pOneCrash && !_pTwoCrash)
|
||||
{
|
||||
@@ -501,12 +483,14 @@ public class OlympiadGameNormal
|
||||
|
||||
winside = 2;
|
||||
|
||||
rewardParticipant(_playerTwo.getPlayer(), Config.ALT_OLY_WINNER_REWARD); // Winner
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info(_playerOne.getName() + " crash," + _playerOne + "," + _playerTwo + ",0,0,0,0," + pointDiff);
|
||||
LOGGER_OLYMPIAD.info(_playerOne.getName() + " crash," + _playerOne + "," + _playerTwo + ",0,0,0,0," + pointDiff + "," + getType());
|
||||
}
|
||||
// Notify to scripts
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(_playerTwo, _playerOne), Olympiad.getInstance());
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(_playerTwo, _playerOne, getType()), Olympiad.getInstance());
|
||||
}
|
||||
else if (_pOneCrash && _pTwoCrash)
|
||||
{
|
||||
@@ -524,7 +508,7 @@ public class OlympiadGameNormal
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info("both crash," + _playerOne.getName() + "," + _playerOne + ",0,0,0,0," + _playerTwo + "," + pointDiff);
|
||||
LOGGER_OLYMPIAD.info("both crash," + _playerOne.getName() + "," + _playerOne + ",0,0,0,0," + _playerTwo + "," + pointDiff + "," + getType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,8 +528,8 @@ public class OlympiadGameNormal
|
||||
stadium.broadcastPacket(result);
|
||||
|
||||
// Notify to scripts
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(null, _playerOne), Olympiad.getInstance());
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(null, _playerTwo), Olympiad.getInstance());
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(null, _playerOne, getType()), Olympiad.getInstance());
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(null, _playerTwo, getType()), Olympiad.getInstance());
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -612,10 +596,13 @@ public class OlympiadGameNormal
|
||||
winside = 1;
|
||||
|
||||
// Save Fight Result
|
||||
saveResults(_playerOne, _playerTwo, 1, _startTime, _fightTime);
|
||||
saveResults(_playerOne, _playerTwo, 1, _startTime, _fightTime, getType());
|
||||
|
||||
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), Olympiad.getInstance());
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(_playerOne, _playerTwo, getType()), Olympiad.getInstance());
|
||||
}
|
||||
else if ((_playerOne.getPlayer() == null) || !_playerOne.getPlayer().isOnline() || ((playerOneHp == 0) && (playerTwoHp != 0)) || ((_damageP2 > _damageP1) && (playerOneHp != 0) && (playerTwoHp != 0)))
|
||||
{
|
||||
@@ -636,25 +623,28 @@ public class OlympiadGameNormal
|
||||
winside = 2;
|
||||
|
||||
// Save Fight Result
|
||||
saveResults(_playerOne, _playerTwo, 2, _startTime, _fightTime);
|
||||
saveResults(_playerOne, _playerTwo, 2, _startTime, _fightTime, getType());
|
||||
|
||||
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), Olympiad.getInstance());
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(_playerTwo, _playerOne, getType()), Olympiad.getInstance());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save Fight Result
|
||||
saveResults(_playerOne, _playerTwo, 0, _startTime, _fightTime);
|
||||
saveResults(_playerOne, _playerTwo, 0, _startTime, _fightTime, getType());
|
||||
|
||||
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));
|
||||
|
||||
@@ -678,7 +668,7 @@ public class OlympiadGameNormal
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info(winner + "," + _playerOne.getName() + "," + _playerOne + "," + _playerTwo + "," + playerOneHp + "," + playerTwoHp + "," + _damageP1 + "," + _damageP2 + "," + pointDiff);
|
||||
LOGGER_OLYMPIAD.info(winner + "," + _playerOne.getName() + "," + _playerOne + "," + _playerTwo + "," + playerOneHp + "," + playerTwoHp + "," + _damageP1 + "," + _damageP2 + "," + pointDiff + "," + getType());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -687,6 +677,7 @@ public class OlympiadGameNormal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void addDamage(PlayerInstance player, int damage)
|
||||
{
|
||||
if ((_playerOne.getPlayer() == null) || (_playerTwo.getPlayer() == null))
|
||||
@@ -703,6 +694,7 @@ public class OlympiadGameNormal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String[] getPlayerNames()
|
||||
{
|
||||
return new String[]
|
||||
@@ -712,6 +704,7 @@ public class OlympiadGameNormal
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkDefaulted()
|
||||
{
|
||||
SystemMessage reason;
|
||||
@@ -741,16 +734,17 @@ public class OlympiadGameNormal
|
||||
return _playerOne.isDefaulted() || _playerTwo.isDefaulted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void resetDamage()
|
||||
{
|
||||
_damageP1 = 0;
|
||||
_damageP2 = 0;
|
||||
}
|
||||
|
||||
protected static void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime)
|
||||
protected static void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time) values(?,?,?,?,?,?,?)"))
|
||||
PreparedStatement statement = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time, classed) values(?,?,?,?,?,?,?,?)"))
|
||||
{
|
||||
statement.setInt(1, one.getObjectId());
|
||||
statement.setInt(2, two.getObjectId());
|
||||
@@ -759,6 +753,7 @@ public class OlympiadGameNormal
|
||||
statement.setInt(5, winner);
|
||||
statement.setLong(6, startTime);
|
||||
statement.setLong(7, fightTime);
|
||||
statement.setInt(8, (type == CompetitionType.CLASSED ? 1 : 0));
|
||||
statement.execute();
|
||||
}
|
||||
catch (SQLException e)
|
||||
@@ -767,6 +762,7 @@ public class OlympiadGameNormal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void healPlayers()
|
||||
{
|
||||
final PlayerInstance player1 = _playerOne.getPlayer();
|
||||
@@ -786,6 +782,7 @@ public class OlympiadGameNormal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void untransformPlayers()
|
||||
{
|
||||
final PlayerInstance player1 = _playerOne.getPlayer();
|
||||
@@ -801,6 +798,7 @@ public class OlympiadGameNormal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void makePlayersInvul()
|
||||
{
|
||||
if (_playerOne.getPlayer() != null)
|
||||
@@ -813,6 +811,7 @@ public class OlympiadGameNormal
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void removePlayersInvul()
|
||||
{
|
||||
if (_playerOne.getPlayer() != null)
|
||||
@@ -824,341 +823,4 @@ public class OlympiadGameNormal
|
||||
_playerTwo.getPlayer().setIsInvul(false);
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isAborted()
|
||||
{
|
||||
return _aborted;
|
||||
}
|
||||
|
||||
public final int getStadiumId()
|
||||
{
|
||||
return _stadiumId;
|
||||
}
|
||||
|
||||
protected boolean makeCompetitionStart1()
|
||||
{
|
||||
_startTime = System.currentTimeMillis();
|
||||
return !_aborted;
|
||||
}
|
||||
|
||||
protected final void addPointsToParticipant(Participant par, int points)
|
||||
{
|
||||
par.updateStat(POINTS, points);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_EARNED_S2_POINTS_IN_THE_OLYMPIAD_GAMES);
|
||||
sm.addString(par.getName());
|
||||
sm.addInt(points);
|
||||
broadcastPacket(sm);
|
||||
}
|
||||
|
||||
protected final void removePointsFromParticipant(Participant par, int points)
|
||||
{
|
||||
par.updateStat(POINTS, -points);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_LOST_S2_POINTS_IN_THE_OLYMPIAD_GAMES);
|
||||
sm.addString(par.getName());
|
||||
sm.addInt(points);
|
||||
broadcastPacket(sm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function return null if player passed all checks or SystemMessage with reason for broadcast to opponent(s).
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
protected static SystemMessage checkDefaulted(PlayerInstance player)
|
||||
{
|
||||
if ((player == null) || !player.isOnline())
|
||||
{
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_MADE_HASTE_WITH_THEIR_TAIL_BETWEEN_THEIR_LEGS_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
|
||||
if ((player.getClient() == null) || player.getClient().isDetached())
|
||||
{
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_MADE_HASTE_WITH_THEIR_TAIL_BETWEEN_THEIR_LEGS_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
|
||||
// safety precautions
|
||||
if (player.inObserverMode())
|
||||
{
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_DOES_NOT_MEET_THE_REQUIREMENTS_TO_DO_BATTLE_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
if (player.isDead())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_DEAD_AND_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_DOES_NOT_MEET_THE_REQUIREMENTS_TO_DO_BATTLE_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
if (player.isSubClassActive())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_YOU_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD_BECAUSE_YOU_HAVE_CHANGED_YOUR_CLASS_TO_SUBCLASS);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_DOES_NOT_MEET_THE_REQUIREMENTS_TO_DO_BATTLE_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
if (player.isCursedWeaponEquipped())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_THE_OWNER_OF_S2_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD);
|
||||
sm.addPcName(player);
|
||||
sm.addItemName(player.getCursedWeaponEquippedId());
|
||||
player.sendPacket(sm);
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_DOES_NOT_MEET_THE_REQUIREMENTS_TO_DO_BATTLE_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
if (!player.isInventoryUnder90(true))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_AS_THE_INVENTORY_WEIGHT_SLOT_IS_FILLED_BEYOND_80);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return SystemMessage.getSystemMessage(SystemMessageId.YOUR_OPPONENT_DOES_NOT_MEET_THE_REQUIREMENTS_TO_DO_BATTLE_THE_MATCH_HAS_BEEN_CANCELLED);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static boolean portPlayerToArena(Participant par, Location loc, int id, Instance instance)
|
||||
{
|
||||
final PlayerInstance player = par.getPlayer();
|
||||
if ((player == null) || !player.isOnline())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
player.setLastLocation();
|
||||
if (player.isSitting())
|
||||
{
|
||||
player.standUp();
|
||||
}
|
||||
player.setTarget(null);
|
||||
|
||||
player.setOlympiadGameId(id);
|
||||
player.setIsInOlympiadMode(true);
|
||||
player.setIsOlympiadStart(false);
|
||||
player.setOlympiadSide(par.getSide());
|
||||
player.teleToLocation(loc, instance);
|
||||
player.sendPacket(new ExOlympiadMode(2));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static void removals(PlayerInstance player, boolean removeParty)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove Buffs
|
||||
player.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
|
||||
// Remove Clan Skills
|
||||
if (player.getClan() != null)
|
||||
{
|
||||
player.getClan().removeSkillEffects(player);
|
||||
if (player.getClan().getCastleId() > 0)
|
||||
{
|
||||
CastleManager.getInstance().getCastleByOwner(player.getClan()).removeResidentialSkills(player);
|
||||
}
|
||||
if (player.getClan().getFortId() > 0)
|
||||
{
|
||||
FortManager.getInstance().getFortByOwner(player.getClan()).removeResidentialSkills(player);
|
||||
}
|
||||
}
|
||||
// Abort casting if player casting
|
||||
player.abortAttack();
|
||||
player.abortCast();
|
||||
|
||||
// Force the character to be visible
|
||||
player.setInvisible(false);
|
||||
|
||||
// Heal Player fully
|
||||
player.setCurrentCp(player.getMaxCp());
|
||||
player.setCurrentHp(player.getMaxHp());
|
||||
player.setCurrentMp(player.getMaxMp());
|
||||
|
||||
// Remove Summon's Buffs
|
||||
if (player.hasSummon())
|
||||
{
|
||||
final Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.unSummon(player);
|
||||
}
|
||||
|
||||
player.getServitors().values().forEach(s ->
|
||||
{
|
||||
s.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
s.abortAttack();
|
||||
s.abortCast();
|
||||
});
|
||||
}
|
||||
|
||||
// stop any cubic that has been given by other player.
|
||||
player.stopCubicsByOthers();
|
||||
|
||||
// Remove player from his party
|
||||
if (removeParty)
|
||||
{
|
||||
final Party party = player.getParty();
|
||||
if (party != null)
|
||||
{
|
||||
party.removePartyMember(player, MessageType.EXPELLED);
|
||||
}
|
||||
}
|
||||
// Remove Agathion
|
||||
if (player.getAgathionId() > 0)
|
||||
{
|
||||
player.setAgathionId(0);
|
||||
player.broadcastUserInfo();
|
||||
}
|
||||
|
||||
player.checkItemRestriction();
|
||||
|
||||
// Remove shot automation
|
||||
player.disableAutoShotsAll();
|
||||
|
||||
// Discharge any active shots
|
||||
player.unchargeAllShots();
|
||||
|
||||
// enable skills with cool time <= 15 minutes
|
||||
for (Skill skill : player.getAllSkills())
|
||||
{
|
||||
if (skill.getReuseDelay() <= 900000)
|
||||
{
|
||||
player.enableSkill(skill);
|
||||
}
|
||||
}
|
||||
|
||||
player.sendSkillList();
|
||||
player.sendPacket(new SkillCoolTime(player));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void cleanEffects(PlayerInstance player)
|
||||
{
|
||||
try
|
||||
{
|
||||
// prevent players kill each other
|
||||
player.setIsOlympiadStart(false);
|
||||
player.setTarget(null);
|
||||
player.abortAttack();
|
||||
player.abortCast();
|
||||
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
|
||||
if (player.isDead())
|
||||
{
|
||||
player.setIsDead(false);
|
||||
}
|
||||
|
||||
player.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
player.clearSouls();
|
||||
player.clearCharges();
|
||||
if (player.getAgathionId() > 0)
|
||||
{
|
||||
player.setAgathionId(0);
|
||||
}
|
||||
final Summon pet = player.getPet();
|
||||
if ((pet != null) && !pet.isDead())
|
||||
{
|
||||
pet.setTarget(null);
|
||||
pet.abortAttack();
|
||||
pet.abortCast();
|
||||
pet.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
pet.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
}
|
||||
|
||||
player.getServitors().values().stream().filter(s -> !s.isDead()).forEach(s ->
|
||||
{
|
||||
s.setTarget(null);
|
||||
s.abortAttack();
|
||||
s.abortCast();
|
||||
s.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
s.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
});
|
||||
|
||||
player.setCurrentCp(player.getMaxCp());
|
||||
player.setCurrentHp(player.getMaxHp());
|
||||
player.setCurrentMp(player.getMaxMp());
|
||||
player.getStatus().startHpMpRegeneration();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void playerStatusBack(PlayerInstance player)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (player.isTransformed())
|
||||
{
|
||||
player.untransform();
|
||||
}
|
||||
|
||||
player.setIsInOlympiadMode(false);
|
||||
player.setIsOlympiadStart(false);
|
||||
player.setOlympiadSide(-1);
|
||||
player.setOlympiadGameId(-1);
|
||||
player.sendPacket(new ExOlympiadMode(0));
|
||||
|
||||
// Add Clan Skills
|
||||
if (player.getClan() != null)
|
||||
{
|
||||
player.getClan().addSkillEffects(player);
|
||||
if (player.getClan().getCastleId() > 0)
|
||||
{
|
||||
CastleManager.getInstance().getCastleByOwner(player.getClan()).giveResidentialSkills(player);
|
||||
}
|
||||
if (player.getClan().getFortId() > 0)
|
||||
{
|
||||
FortManager.getInstance().getFortByOwner(player.getClan()).giveResidentialSkills(player);
|
||||
}
|
||||
player.sendSkillList();
|
||||
}
|
||||
|
||||
// heal again after adding clan skills
|
||||
player.setCurrentCp(player.getMaxCp());
|
||||
player.setCurrentHp(player.getMaxHp());
|
||||
player.setCurrentMp(player.getMaxMp());
|
||||
player.getStatus().startHpMpRegeneration();
|
||||
|
||||
if (Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
|
||||
{
|
||||
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, player);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "playerStatusBack()", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void portPlayerBack(PlayerInstance player)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final Location loc = player.getLastLocation();
|
||||
if (loc != null)
|
||||
{
|
||||
player.setIsPendingRevive(false);
|
||||
player.teleToLocation(loc, null);
|
||||
player.unsetLastLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -93,7 +93,7 @@ public final class OlympiadGameTask implements Runnable
|
||||
};
|
||||
|
||||
private final OlympiadStadium _stadium;
|
||||
private OlympiadGameNormal _game;
|
||||
private AbstractOlympiadGame _game;
|
||||
private GameState _state = GameState.IDLE;
|
||||
private boolean _needAnnounce = false;
|
||||
private int _countDown = 0;
|
||||
@@ -154,12 +154,12 @@ public final class OlympiadGameTask implements Runnable
|
||||
return _stadium;
|
||||
}
|
||||
|
||||
public final OlympiadGameNormal getGame()
|
||||
public final AbstractOlympiadGame getGame()
|
||||
{
|
||||
return _game;
|
||||
}
|
||||
|
||||
public final void attachGame(OlympiadGameNormal game)
|
||||
public final void attachGame(AbstractOlympiadGame game)
|
||||
{
|
||||
if ((game != null) && (_state != GameState.IDLE))
|
||||
{
|
||||
|
@@ -16,6 +16,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.olympiad;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -32,7 +36,8 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
*/
|
||||
public class OlympiadManager
|
||||
{
|
||||
private final Set<Integer> _playerRegistered = ConcurrentHashMap.newKeySet();
|
||||
private final Set<Integer> _nonClassBasedRegisters = ConcurrentHashMap.newKeySet();
|
||||
private final Map<Integer, Set<Integer>> _classBasedRegisters = new ConcurrentHashMap<>();
|
||||
|
||||
protected OlympiadManager()
|
||||
{
|
||||
@@ -43,19 +48,43 @@ public class OlympiadManager
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public final Set<Integer> getPlayerRegistered()
|
||||
public final Set<Integer> getRegisteredNonClassBased()
|
||||
{
|
||||
return _playerRegistered;
|
||||
return _nonClassBasedRegisters;
|
||||
}
|
||||
|
||||
public final Map<Integer, Set<Integer>> getRegisteredClassBased()
|
||||
{
|
||||
return _classBasedRegisters;
|
||||
}
|
||||
|
||||
protected final List<Set<Integer>> hasEnoughRegisteredClassed()
|
||||
{
|
||||
List<Set<Integer>> result = null;
|
||||
for (Map.Entry<Integer, Set<Integer>> classList : _classBasedRegisters.entrySet())
|
||||
{
|
||||
if ((classList.getValue() != null) && (classList.getValue().size() >= Config.ALT_OLY_CLASSED))
|
||||
{
|
||||
if (result == null)
|
||||
{
|
||||
result = new ArrayList<>();
|
||||
}
|
||||
|
||||
result.add(classList.getValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected final boolean hasEnoughRegisteredNonClassed()
|
||||
{
|
||||
return _playerRegistered.size() >= Config.ALT_OLY_NONCLASSED;
|
||||
return _nonClassBasedRegisters.size() >= Config.ALT_OLY_NONCLASSED;
|
||||
}
|
||||
|
||||
protected final void clearRegistered()
|
||||
{
|
||||
_playerRegistered.clear();
|
||||
_nonClassBasedRegisters.clear();
|
||||
_classBasedRegisters.clear();
|
||||
AntiFeedManager.getInstance().clear(AntiFeedManager.OLYMPIAD_ID);
|
||||
}
|
||||
|
||||
@@ -67,7 +96,7 @@ public class OlympiadManager
|
||||
private boolean isRegistered(PlayerInstance noble, PlayerInstance player, boolean showMessage)
|
||||
{
|
||||
final Integer objId = Integer.valueOf(noble.getObjectId());
|
||||
if (_playerRegistered.contains(objId))
|
||||
if (_nonClassBasedRegisters.contains(objId))
|
||||
{
|
||||
if (showMessage)
|
||||
{
|
||||
@@ -77,6 +106,19 @@ public class OlympiadManager
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
final Set<Integer> classed = _classBasedRegisters.get(getClassGroup(noble));
|
||||
if ((classed != null) && classed.contains(objId))
|
||||
{
|
||||
if (showMessage)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_CLASS_MATCH_WAITING_LIST);
|
||||
sm.addPcName(noble);
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -92,7 +134,7 @@ public class OlympiadManager
|
||||
return false;
|
||||
}
|
||||
|
||||
OlympiadGameNormal game;
|
||||
AbstractOlympiadGame game;
|
||||
for (int i = OlympiadGameManager.getInstance().getNumberOfStadiums(); --i >= 0;)
|
||||
{
|
||||
game = OlympiadGameManager.getInstance().getOlympiadTask(i).getGame();
|
||||
@@ -108,17 +150,30 @@ public class OlympiadManager
|
||||
return true;
|
||||
}
|
||||
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_ALL_CLASS_BATTLE);
|
||||
sm.addPcName(noble);
|
||||
player.sendPacket(sm);
|
||||
|
||||
switch (game.getType())
|
||||
{
|
||||
case CLASSED:
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_CLASS_MATCH_WAITING_LIST);
|
||||
sm.addPcName(noble);
|
||||
player.sendPacket(sm);
|
||||
break;
|
||||
}
|
||||
case NON_CLASSED:
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_ALL_CLASS_BATTLE);
|
||||
sm.addPcName(noble);
|
||||
player.sendPacket(sm);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final boolean registerNoble(PlayerInstance player)
|
||||
public final boolean registerNoble(PlayerInstance player, CompetitionType type)
|
||||
{
|
||||
if (!Olympiad._inCompPeriod)
|
||||
{
|
||||
@@ -139,24 +194,51 @@ public class OlympiadManager
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player.isOnEvent())
|
||||
switch (type)
|
||||
{
|
||||
player.sendMessage("You can't join olympiad while participating on TvT Event.");
|
||||
return false;
|
||||
case CLASSED:
|
||||
{
|
||||
if (player.isOnEvent())
|
||||
{
|
||||
player.sendMessage("You can't join olympiad while participating on an Event.");
|
||||
return false;
|
||||
}
|
||||
|
||||
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());
|
||||
message.setFile(player, "data/html/mods/OlympiadIPRestriction.htm");
|
||||
message.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP)));
|
||||
player.sendPacket(message);
|
||||
return false;
|
||||
}
|
||||
|
||||
_classBasedRegisters.computeIfAbsent(getClassGroup(player), k -> ConcurrentHashMap.newKeySet()).add(charId);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REGISTERED_FOR_THE_OLYMPIAD_WAITING_LIST_FOR_A_CLASS_BATTLE);
|
||||
break;
|
||||
}
|
||||
case NON_CLASSED:
|
||||
{
|
||||
if (player.isOnEvent())
|
||||
{
|
||||
player.sendMessage("You can't join olympiad while participating on TvT Event.");
|
||||
return false;
|
||||
}
|
||||
|
||||
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());
|
||||
message.setFile(player, "data/html/mods/OlympiadIPRestriction.htm");
|
||||
message.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP)));
|
||||
player.sendPacket(message);
|
||||
return false;
|
||||
}
|
||||
|
||||
_nonClassBasedRegisters.add(charId);
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_CURRENTLY_REGISTERED_FOR_A_1V1_CLASS_IRRELEVANT_MATCH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
message.setFile(player, "data/html/mods/OlympiadIPRestriction.htm");
|
||||
message.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP)));
|
||||
player.sendPacket(message);
|
||||
return false;
|
||||
}
|
||||
|
||||
_playerRegistered.add(charId);
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_CURRENTLY_REGISTERED_FOR_A_1V1_CLASS_IRRELEVANT_MATCH);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -188,7 +270,19 @@ public class OlympiadManager
|
||||
}
|
||||
|
||||
final Integer objId = Integer.valueOf(noble.getObjectId());
|
||||
if (_playerRegistered.remove(objId))
|
||||
if (_nonClassBasedRegisters.remove(objId))
|
||||
{
|
||||
if (Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
|
||||
{
|
||||
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);
|
||||
}
|
||||
|
||||
noble.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REMOVED_FROM_THE_OLYMPIAD_WAITING_LIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
final Set<Integer> classed = _classBasedRegisters.get(getClassGroup(noble));
|
||||
if ((classed != null) && classed.remove(objId))
|
||||
{
|
||||
if (Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
|
||||
{
|
||||
@@ -209,16 +303,67 @@ public class OlympiadManager
|
||||
{
|
||||
task.getGame().handleDisconnect(player);
|
||||
}
|
||||
_playerRegistered.remove(player.getObjectId());
|
||||
|
||||
final Integer objId = Integer.valueOf(player.getObjectId());
|
||||
if (_nonClassBasedRegisters.remove(objId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_classBasedRegisters.getOrDefault(getClassGroup(player), Collections.emptySet()).remove(objId);
|
||||
}
|
||||
|
||||
public int getCountOpponents()
|
||||
{
|
||||
return _playerRegistered.size();
|
||||
return _nonClassBasedRegisters.size() + _classBasedRegisters.size();
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final OlympiadManager INSTANCE = new OlympiadManager();
|
||||
}
|
||||
|
||||
private int getClassGroup(PlayerInstance player)
|
||||
{
|
||||
if (player.isInCategory(CategoryType.SIXTH_TIR_GROUP))
|
||||
{
|
||||
return 1001;
|
||||
}
|
||||
else if (player.isInCategory(CategoryType.SIXTH_SIGEL_GROUP))
|
||||
{
|
||||
return 1002;
|
||||
}
|
||||
else if (player.isInCategory(CategoryType.SIXTH_OTHEL_GROUP))
|
||||
{
|
||||
return 1003;
|
||||
}
|
||||
else if (player.isInCategory(CategoryType.SIXTH_FEOH_GROUP))
|
||||
{
|
||||
return 1004;
|
||||
}
|
||||
else if (player.isInCategory(CategoryType.SIXTH_IS_GROUP))
|
||||
{
|
||||
return 1005;
|
||||
}
|
||||
else if (player.isInCategory(CategoryType.SIXTH_EOLH_GROUP))
|
||||
{
|
||||
return 1006;
|
||||
}
|
||||
else if (player.isInCategory(CategoryType.SIXTH_WYNN_GROUP))
|
||||
{
|
||||
return 1007;
|
||||
}
|
||||
else if (player.isInCategory(CategoryType.SIXTH_YR_GROUP))
|
||||
{
|
||||
return 1008;
|
||||
}
|
||||
else if (player.isInCategory(CategoryType.ERTHEIA_FOURTH_CLASS_GROUP))
|
||||
{
|
||||
return 1009;
|
||||
}
|
||||
else
|
||||
{
|
||||
return player.getBaseClass();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,8 +20,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.olympiad.AbstractOlympiadGame;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameClassed;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameManager;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameNormal;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameNonClassed;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameTask;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
@@ -61,11 +63,24 @@ public class ExOlympiadMatchList implements IClientOutgoingPacket
|
||||
|
||||
for (OlympiadGameTask curGame : _games)
|
||||
{
|
||||
final OlympiadGameNormal game = curGame.getGame();
|
||||
final AbstractOlympiadGame game = curGame.getGame();
|
||||
if (game != null)
|
||||
{
|
||||
packet.writeD(game.getStadiumId()); // Stadium Id (Arena 1 = 0)
|
||||
packet.writeD(1); // Classed is 2, Non Classed is 1, Other is 0
|
||||
|
||||
if (game instanceof OlympiadGameNonClassed)
|
||||
{
|
||||
packet.writeD(1);
|
||||
}
|
||||
else if (game instanceof OlympiadGameClassed)
|
||||
{
|
||||
packet.writeD(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.writeD(0);
|
||||
}
|
||||
|
||||
packet.writeD(curGame.isRunning() ? 0x02 : 0x01); // (1 = Standby, 2 = Playing)
|
||||
packet.writeS(game.getPlayerNames()[0]); // Player 1 Name
|
||||
packet.writeS(game.getPlayerNames()[1]); // Player 2 Name
|
||||
|
Reference in New Issue
Block a user