Addition of World Olympiad.
Thanks to nasseka and Sero.
This commit is contained in:
@@ -516,41 +516,41 @@ public class Config
|
||||
public static int WORLD_CHAT_MIN_LEVEL;
|
||||
public static int WORLD_CHAT_POINTS_PER_DAY;
|
||||
public static Duration WORLD_CHAT_INTERVAL;
|
||||
public static int ALT_OLY_START_TIME;
|
||||
public static int ALT_OLY_MIN;
|
||||
public static long ALT_OLY_CPERIOD;
|
||||
public static long ALT_OLY_BATTLE;
|
||||
public static long ALT_OLY_WPERIOD;
|
||||
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_CLASSED;
|
||||
public static int ALT_OLY_NONCLASSED;
|
||||
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;
|
||||
public static int ALT_OLY_HERO_POINTS;
|
||||
public static int ALT_OLY_RANK1_POINTS;
|
||||
public static int ALT_OLY_RANK2_POINTS;
|
||||
public static int ALT_OLY_RANK3_POINTS;
|
||||
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_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;
|
||||
public static boolean ALT_OLY_ANNOUNCE_GAMES;
|
||||
public static Set<Integer> LIST_OLY_RESTRICTED_ITEMS = new HashSet<>();
|
||||
public static int ALT_OLY_WEAPON_ENCHANT_LIMIT;
|
||||
public static int ALT_OLY_ARMOR_ENCHANT_LIMIT;
|
||||
public static int ALT_OLY_WAIT_TIME;
|
||||
public static String ALT_OLY_PERIOD;
|
||||
public static int ALT_OLY_PERIOD_MULTIPLIER;
|
||||
public static List<Integer> ALT_OLY_COMPETITION_DAYS;
|
||||
public static boolean OLYMPIAD_ENABLED;
|
||||
public static int OLYMPIAD_START_TIME;
|
||||
public static int OLYMPIAD_MIN;
|
||||
public static long OLYMPIAD_CPERIOD;
|
||||
public static long OLYMPIAD_BATTLE;
|
||||
public static long OLYMPIAD_WPERIOD;
|
||||
public static long OLYMPIAD_VPERIOD;
|
||||
public static int OLYMPIAD_START_POINTS;
|
||||
public static int OLYMPIAD_CLASSED;
|
||||
public static int OLYMPIAD_NONCLASSED;
|
||||
public static List<ItemHolder> OLYMPIAD_WINNER_REWARD;
|
||||
public static List<ItemHolder> OLYMPIAD_LOSER_REWARD;
|
||||
public static int OLYMPIAD_COMP_RITEM;
|
||||
public static int OLYMPIAD_MIN_MATCHES;
|
||||
public static int OLYMPIAD_MARK_PER_POINT;
|
||||
public static int OLYMPIAD_HERO_POINTS;
|
||||
public static int OLYMPIAD_RANK1_POINTS;
|
||||
public static int OLYMPIAD_RANK2_POINTS;
|
||||
public static int OLYMPIAD_RANK3_POINTS;
|
||||
public static int OLYMPIAD_RANK4_POINTS;
|
||||
public static int OLYMPIAD_RANK5_POINTS;
|
||||
public static int OLYMPIAD_MAX_POINTS;
|
||||
public static int OLYMPIAD_DIVIDER_CLASSED;
|
||||
public static int OLYMPIAD_DIVIDER_NON_CLASSED;
|
||||
public static int OLYMPIAD_MAX_WEEKLY_MATCHES;
|
||||
public static boolean OLYMPIAD_LOG_FIGHTS;
|
||||
public static boolean OLYMPIAD_SHOW_MONTHLY_WINNERS;
|
||||
public static boolean OLYMPIAD_ANNOUNCE_GAMES;
|
||||
public static Set<Integer> OLYMPIAD_RESTRICTED_ITEMS = new HashSet<>();
|
||||
public static int OLYMPIAD_WEAPON_ENCHANT_LIMIT;
|
||||
public static int OLYMPIAD_ARMOR_ENCHANT_LIMIT;
|
||||
public static int OLYMPIAD_WAIT_TIME;
|
||||
public static String OLYMPIAD_PERIOD;
|
||||
public static int OLYMPIAD_PERIOD_MULTIPLIER;
|
||||
public static List<Integer> OLYMPIAD_COMPETITION_DAYS;
|
||||
public static int ALT_MANOR_REFRESH_TIME;
|
||||
public static int ALT_MANOR_REFRESH_MIN;
|
||||
public static int ALT_MANOR_APPROVE_TIME;
|
||||
@@ -2432,57 +2432,57 @@ public class Config
|
||||
|
||||
// Load Olympiad config file (if exists)
|
||||
final PropertiesParser olympiadConfig = new PropertiesParser(OLYMPIAD_CONFIG_FILE);
|
||||
ALT_OLY_START_TIME = olympiadConfig.getInt("AltOlyStartTime", 20);
|
||||
ALT_OLY_MIN = olympiadConfig.getInt("AltOlyMin", 0);
|
||||
ALT_OLY_CPERIOD = olympiadConfig.getLong("AltOlyCPeriod", 14400000);
|
||||
ALT_OLY_BATTLE = olympiadConfig.getLong("AltOlyBattle", 300000);
|
||||
ALT_OLY_WPERIOD = olympiadConfig.getLong("AltOlyWPeriod", 604800000);
|
||||
ALT_OLY_VPERIOD = olympiadConfig.getLong("AltOlyVPeriod", 86400000);
|
||||
ALT_OLY_START_POINTS = olympiadConfig.getInt("AltOlyStartPoints", 10);
|
||||
ALT_OLY_WEEKLY_POINTS = olympiadConfig.getInt("AltOlyWeeklyPoints", 10);
|
||||
ALT_OLY_CLASSED = olympiadConfig.getInt("AltOlyClassedParticipants", 10);
|
||||
ALT_OLY_NONCLASSED = olympiadConfig.getInt("AltOlyNonClassedParticipants", 20);
|
||||
ALT_OLY_WINNER_REWARD = parseItemsList(olympiadConfig.getString("AltOlyWinReward", "45584,12"));
|
||||
ALT_OLY_LOSER_REWARD = parseItemsList(olympiadConfig.getString("AltOlyLoserReward", "45584,7"));
|
||||
ALT_OLY_COMP_RITEM = olympiadConfig.getInt("AltOlyCompRewItem", 45584);
|
||||
ALT_OLY_MIN_MATCHES = olympiadConfig.getInt("AltOlyMinMatchesForPoints", 10);
|
||||
ALT_OLY_MARK_PER_POINT = olympiadConfig.getInt("AltOlyMarkPerPoint", 20);
|
||||
ALT_OLY_HERO_POINTS = olympiadConfig.getInt("AltOlyHeroPoints", 30);
|
||||
ALT_OLY_RANK1_POINTS = olympiadConfig.getInt("AltOlyRank1Points", 60);
|
||||
ALT_OLY_RANK2_POINTS = olympiadConfig.getInt("AltOlyRank2Points", 50);
|
||||
ALT_OLY_RANK3_POINTS = olympiadConfig.getInt("AltOlyRank3Points", 45);
|
||||
ALT_OLY_RANK4_POINTS = olympiadConfig.getInt("AltOlyRank4Points", 40);
|
||||
ALT_OLY_RANK5_POINTS = olympiadConfig.getInt("AltOlyRank5Points", 30);
|
||||
ALT_OLY_MAX_POINTS = olympiadConfig.getInt("AltOlyMaxPoints", 10);
|
||||
ALT_OLY_DIVIDER_CLASSED = olympiadConfig.getInt("AltOlyDividerClassed", 5);
|
||||
ALT_OLY_DIVIDER_NON_CLASSED = olympiadConfig.getInt("AltOlyDividerNonClassed", 5);
|
||||
ALT_OLY_MAX_WEEKLY_MATCHES = olympiadConfig.getInt("AltOlyMaxWeeklyMatches", 30);
|
||||
ALT_OLY_LOG_FIGHTS = olympiadConfig.getBoolean("AltOlyLogFights", false);
|
||||
ALT_OLY_SHOW_MONTHLY_WINNERS = olympiadConfig.getBoolean("AltOlyShowMonthlyWinners", true);
|
||||
ALT_OLY_ANNOUNCE_GAMES = olympiadConfig.getBoolean("AltOlyAnnounceGames", true);
|
||||
final String olyRestrictedItems = olympiadConfig.getString("AltOlyRestrictedItems", "").trim();
|
||||
OLYMPIAD_ENABLED = olympiadConfig.getBoolean("OlympiadEnabled", true);
|
||||
OLYMPIAD_START_TIME = olympiadConfig.getInt("OlympiadStartTime", 20);
|
||||
OLYMPIAD_MIN = olympiadConfig.getInt("OlympiadMin", 0);
|
||||
OLYMPIAD_CPERIOD = olympiadConfig.getLong("OlympiadCPeriod", 14400000);
|
||||
OLYMPIAD_BATTLE = olympiadConfig.getLong("OlympiadBattle", 300000);
|
||||
OLYMPIAD_WPERIOD = olympiadConfig.getLong("OlympiadWPeriod", 604800000);
|
||||
OLYMPIAD_VPERIOD = olympiadConfig.getLong("OlympiadVPeriod", 86400000);
|
||||
OLYMPIAD_START_POINTS = olympiadConfig.getInt("OlympiadStartPoints", 1000);
|
||||
OLYMPIAD_CLASSED = olympiadConfig.getInt("OlympiadClassedParticipants", 10);
|
||||
OLYMPIAD_NONCLASSED = olympiadConfig.getInt("OlympiadNonClassedParticipants", 20);
|
||||
OLYMPIAD_WINNER_REWARD = parseItemsList(olympiadConfig.getString("OlympiadWinReward", "45584,12"));
|
||||
OLYMPIAD_LOSER_REWARD = parseItemsList(olympiadConfig.getString("OlympiadLoserReward", "45584,7"));
|
||||
OLYMPIAD_COMP_RITEM = olympiadConfig.getInt("OlympiadCompRewItem", 45584);
|
||||
OLYMPIAD_MIN_MATCHES = olympiadConfig.getInt("OlympiadMinMatchesForPoints", 10);
|
||||
OLYMPIAD_MARK_PER_POINT = olympiadConfig.getInt("OlympiadMarkPerPoint", 20);
|
||||
OLYMPIAD_HERO_POINTS = olympiadConfig.getInt("OlympiadHeroPoints", 30);
|
||||
OLYMPIAD_RANK1_POINTS = olympiadConfig.getInt("OlympiadRank1Points", 60);
|
||||
OLYMPIAD_RANK2_POINTS = olympiadConfig.getInt("OlympiadRank2Points", 50);
|
||||
OLYMPIAD_RANK3_POINTS = olympiadConfig.getInt("OlympiadRank3Points", 45);
|
||||
OLYMPIAD_RANK4_POINTS = olympiadConfig.getInt("OlympiadRank4Points", 40);
|
||||
OLYMPIAD_RANK5_POINTS = olympiadConfig.getInt("OlympiadRank5Points", 30);
|
||||
OLYMPIAD_MAX_POINTS = olympiadConfig.getInt("OlympiadMaxPoints", 10);
|
||||
OLYMPIAD_DIVIDER_CLASSED = olympiadConfig.getInt("OlympiadDividerClassed", 5);
|
||||
OLYMPIAD_DIVIDER_NON_CLASSED = olympiadConfig.getInt("OlympiadDividerNonClassed", 5);
|
||||
OLYMPIAD_MAX_WEEKLY_MATCHES = olympiadConfig.getInt("OlympiadMaxWeeklyMatches", 25);
|
||||
OLYMPIAD_LOG_FIGHTS = olympiadConfig.getBoolean("OlympiadLogFights", false);
|
||||
OLYMPIAD_SHOW_MONTHLY_WINNERS = olympiadConfig.getBoolean("OlympiadShowMonthlyWinners", true);
|
||||
OLYMPIAD_ANNOUNCE_GAMES = olympiadConfig.getBoolean("OlympiadAnnounceGames", true);
|
||||
final String olyRestrictedItems = olympiadConfig.getString("OlympiadRestrictedItems", "").trim();
|
||||
if (!olyRestrictedItems.isEmpty())
|
||||
{
|
||||
final String[] olyRestrictedItemsSplit = olyRestrictedItems.split(",");
|
||||
LIST_OLY_RESTRICTED_ITEMS = new HashSet<>(olyRestrictedItemsSplit.length);
|
||||
OLYMPIAD_RESTRICTED_ITEMS = new HashSet<>(olyRestrictedItemsSplit.length);
|
||||
for (String id : olyRestrictedItemsSplit)
|
||||
{
|
||||
LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
|
||||
OLYMPIAD_RESTRICTED_ITEMS.add(Integer.parseInt(id));
|
||||
}
|
||||
}
|
||||
else // In case of reload with removal of all items ids.
|
||||
{
|
||||
LIST_OLY_RESTRICTED_ITEMS.clear();
|
||||
OLYMPIAD_RESTRICTED_ITEMS.clear();
|
||||
}
|
||||
ALT_OLY_WEAPON_ENCHANT_LIMIT = olympiadConfig.getInt("AltOlyWeaponEnchantLimit", -1);
|
||||
ALT_OLY_ARMOR_ENCHANT_LIMIT = olympiadConfig.getInt("AltOlyArmorEnchantLimit", -1);
|
||||
ALT_OLY_WAIT_TIME = olympiadConfig.getInt("AltOlyWaitTime", 60);
|
||||
ALT_OLY_PERIOD = olympiadConfig.getString("AltOlyPeriod", "MONTH");
|
||||
ALT_OLY_PERIOD_MULTIPLIER = olympiadConfig.getInt("AltOlyPeriodMultiplier", 1);
|
||||
ALT_OLY_COMPETITION_DAYS = new ArrayList<>();
|
||||
for (String s : olympiadConfig.getString("AltOlyCompetitionDays", "6,7").split(","))
|
||||
OLYMPIAD_WEAPON_ENCHANT_LIMIT = olympiadConfig.getInt("OlympiadWeaponEnchantLimit", -1);
|
||||
OLYMPIAD_ARMOR_ENCHANT_LIMIT = olympiadConfig.getInt("OlympiadArmorEnchantLimit", -1);
|
||||
OLYMPIAD_WAIT_TIME = olympiadConfig.getInt("OlympiadWaitTime", 60);
|
||||
OLYMPIAD_PERIOD = olympiadConfig.getString("OlympiadPeriod", "MONTH");
|
||||
OLYMPIAD_PERIOD_MULTIPLIER = olympiadConfig.getInt("OlympiadPeriodMultiplier", 1);
|
||||
OLYMPIAD_COMPETITION_DAYS = new ArrayList<>();
|
||||
for (String s : olympiadConfig.getString("OlympiadCompetitionDays", "6,7").split(","))
|
||||
{
|
||||
ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s));
|
||||
OLYMPIAD_COMPETITION_DAYS.add(Integer.parseInt(s));
|
||||
}
|
||||
|
||||
final File hexIdFile = new File(HEXID_FILE);
|
||||
|
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.enums;
|
||||
|
||||
/**
|
||||
* @author NasSeKa
|
||||
*/
|
||||
public enum OlympiadMode
|
||||
{
|
||||
NONE,
|
||||
BLUE,
|
||||
RED,
|
||||
SPECTATOR
|
||||
}
|
@@ -50,9 +50,9 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.skill.SkillBuffType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.AbnormalStatusUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExAbnormalStatusUpdateFromTarget;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadSpelledInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PartySpelled;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ShortBuffStatusUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadSpelledInfo;
|
||||
|
||||
/**
|
||||
* Effect lists.<br>
|
||||
|
@@ -99,6 +99,7 @@ import org.l2jmobius.gameserver.enums.ItemGrade;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
import org.l2jmobius.gameserver.enums.NextActionType;
|
||||
import org.l2jmobius.gameserver.enums.OlympiadMode;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
import org.l2jmobius.gameserver.enums.PartyMessageType;
|
||||
import org.l2jmobius.gameserver.enums.PartySmallWindowUpdateType;
|
||||
@@ -308,7 +309,6 @@ import org.l2jmobius.gameserver.network.serverpackets.ExDuelUpdateUserInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExGetBookMarkInfoPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExGetOnAirShip;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExMagicAttackInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadMode;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExPledgeCoinInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExPledgeCount;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExPrivateStoreSetWholeMsg;
|
||||
@@ -366,6 +366,7 @@ import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySetting
|
||||
import org.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommissionInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.friend.FriendStatus;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExBloodyCoinCount;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMode;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.AutoPlayTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.AutoUseTaskManager;
|
||||
@@ -9364,7 +9365,10 @@ public class Player extends Playable
|
||||
|
||||
public void enterObserverMode(Location loc)
|
||||
{
|
||||
setLastLocation();
|
||||
if (!isInOlympiadMode())
|
||||
{
|
||||
setLastLocation();
|
||||
}
|
||||
|
||||
// Remove Hide.
|
||||
getEffectList().stopEffects(AbnormalType.HIDE);
|
||||
@@ -9417,7 +9421,7 @@ public class Player extends Playable
|
||||
{
|
||||
standUp();
|
||||
}
|
||||
if (!_observerMode)
|
||||
if (!_observerMode && !isInOlympiadMode())
|
||||
{
|
||||
setLastLocation();
|
||||
}
|
||||
@@ -9428,7 +9432,7 @@ public class Player extends Playable
|
||||
setInvisible(true);
|
||||
setInstance(OlympiadGameManager.getInstance().getOlympiadTask(id).getStadium().getInstance());
|
||||
teleToLocation(loc, false);
|
||||
sendPacket(new ExOlympiadMode(3));
|
||||
sendPacket(new ExOlympiadMode(OlympiadMode.SPECTATOR));
|
||||
broadcastUserInfo();
|
||||
}
|
||||
|
||||
@@ -9464,7 +9468,7 @@ public class Player extends Playable
|
||||
_olympiadGameId = -1;
|
||||
_observerMode = false;
|
||||
setTarget(null);
|
||||
sendPacket(new ExOlympiadMode(0));
|
||||
sendPacket(new ExOlympiadMode(OlympiadMode.NONE));
|
||||
setInstance(null);
|
||||
teleToLocation(_lastLoc, true);
|
||||
if (!isGM())
|
||||
@@ -9647,14 +9651,24 @@ public class Player extends Playable
|
||||
return _olympiadStart;
|
||||
}
|
||||
|
||||
public boolean isInOlympiadMode()
|
||||
{
|
||||
return _inOlympiadMode;
|
||||
}
|
||||
|
||||
public boolean isHero()
|
||||
{
|
||||
return _hero;
|
||||
}
|
||||
|
||||
public boolean isInOlympiadMode()
|
||||
public boolean isLegend()
|
||||
{
|
||||
return _inOlympiadMode;
|
||||
return getVariables().getBoolean(PlayerVariables.IS_LEGEND, false);
|
||||
}
|
||||
|
||||
public void setLegend(boolean legend)
|
||||
{
|
||||
getVariables().set(PlayerVariables.IS_LEGEND, legend);
|
||||
}
|
||||
|
||||
public boolean isInDuel()
|
||||
|
@@ -940,7 +940,7 @@ public abstract class ItemTemplate extends ListenersContainer implements IIdenti
|
||||
|
||||
public boolean isOlyRestrictedItem()
|
||||
{
|
||||
return _isOlyRestricted || Config.LIST_OLY_RESTRICTED_ITEMS.contains(_itemId);
|
||||
return _isOlyRestricted || Config.OLYMPIAD_RESTRICTED_ITEMS.contains(_itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1995,16 +1995,16 @@ public class Item extends WorldObject
|
||||
{
|
||||
if (_itemTemplate.isWeapon())
|
||||
{
|
||||
if ((Config.ALT_OLY_WEAPON_ENCHANT_LIMIT >= 0) && (enchant > Config.ALT_OLY_WEAPON_ENCHANT_LIMIT))
|
||||
if ((Config.OLYMPIAD_WEAPON_ENCHANT_LIMIT >= 0) && (enchant > Config.OLYMPIAD_WEAPON_ENCHANT_LIMIT))
|
||||
{
|
||||
enchant = Config.ALT_OLY_WEAPON_ENCHANT_LIMIT;
|
||||
enchant = Config.OLYMPIAD_WEAPON_ENCHANT_LIMIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Config.ALT_OLY_ARMOR_ENCHANT_LIMIT >= 0) && (enchant > Config.ALT_OLY_ARMOR_ENCHANT_LIMIT))
|
||||
if ((Config.OLYMPIAD_ARMOR_ENCHANT_LIMIT >= 0) && (enchant > Config.OLYMPIAD_ARMOR_ENCHANT_LIMIT))
|
||||
{
|
||||
enchant = Config.ALT_OLY_ARMOR_ENCHANT_LIMIT;
|
||||
enchant = Config.OLYMPIAD_ARMOR_ENCHANT_LIMIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.OlympiadMode;
|
||||
import org.l2jmobius.gameserver.enums.PartyMessageType;
|
||||
import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
@@ -39,11 +40,11 @@ import org.l2jmobius.gameserver.model.siege.Castle;
|
||||
import org.l2jmobius.gameserver.model.siege.Fort;
|
||||
import org.l2jmobius.gameserver.model.skill.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;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMode;
|
||||
|
||||
/**
|
||||
* @author godson, GodKratos, Pere, DS
|
||||
@@ -163,7 +164,7 @@ public abstract class AbstractOlympiadGame
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static boolean portPlayerToArena(Participant par, Location loc, int id, Instance instance)
|
||||
protected static boolean portPlayerToArena(Participant par, Location loc, int id, Instance instance, OlympiadMode mode)
|
||||
{
|
||||
final Player player = par.getPlayer();
|
||||
if ((player == null) || !player.isOnline())
|
||||
@@ -173,6 +174,7 @@ public abstract class AbstractOlympiadGame
|
||||
|
||||
try
|
||||
{
|
||||
player.setPvpFlag(0);
|
||||
player.setLastLocation();
|
||||
if (player.isSitting())
|
||||
{
|
||||
@@ -185,7 +187,32 @@ public abstract class AbstractOlympiadGame
|
||||
player.setOlympiadStart(false);
|
||||
player.setOlympiadSide(par.getSide());
|
||||
player.teleToLocation(loc, instance);
|
||||
player.sendPacket(new ExOlympiadMode(2));
|
||||
player.sendPacket(new ExOlympiadMode(mode));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static boolean portPlayerToSpot(Participant par, Location loc, int id)
|
||||
{
|
||||
final Player player = par.getPlayer();
|
||||
if ((player == null) || !player.isOnline())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (player.isSitting())
|
||||
{
|
||||
player.standUp();
|
||||
}
|
||||
player.setTarget(null);
|
||||
player.teleToLocation(loc);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -299,6 +326,48 @@ public abstract class AbstractOlympiadGame
|
||||
}
|
||||
}
|
||||
|
||||
protected void roundTwoClean(Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove Debuffs
|
||||
player.getEffectList().stopEffects(info -> info.getSkill().isDebuff(), true, true);
|
||||
|
||||
// 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());
|
||||
|
||||
// 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 void cleanEffects(Player player)
|
||||
{
|
||||
try
|
||||
@@ -371,7 +440,8 @@ public abstract class AbstractOlympiadGame
|
||||
player.setOlympiadStart(false);
|
||||
player.setOlympiadSide(-1);
|
||||
player.setOlympiadGameId(-1);
|
||||
player.sendPacket(new ExOlympiadMode(0));
|
||||
player.sendPacket(new ExOlympiadMode(OlympiadMode.SPECTATOR));
|
||||
player.sendPacket(new ExOlympiadMode(OlympiadMode.NONE));
|
||||
|
||||
// Add Clan Skills
|
||||
final Clan clan = player.getClan();
|
||||
@@ -420,6 +490,7 @@ public abstract class AbstractOlympiadGame
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Location loc = player.getLastLocation();
|
||||
if (loc != null)
|
||||
{
|
||||
@@ -481,6 +552,8 @@ public abstract class AbstractOlympiadGame
|
||||
|
||||
protected abstract boolean portPlayersToArena(List<Location> spawns, Instance instance);
|
||||
|
||||
protected abstract boolean portPlayersToSpots(List<Location> spawns, Instance instance);
|
||||
|
||||
protected abstract void cleanEffects();
|
||||
|
||||
protected abstract void portPlayersBack();
|
||||
@@ -489,22 +562,40 @@ public abstract class AbstractOlympiadGame
|
||||
|
||||
protected abstract void clearPlayers();
|
||||
|
||||
protected abstract void matchEnd(boolean value);
|
||||
|
||||
protected abstract boolean isMatchEnd();
|
||||
|
||||
protected abstract void handleDisconnect(Player player);
|
||||
|
||||
protected abstract void resetDamage();
|
||||
|
||||
protected abstract void resetDamageFinal();
|
||||
|
||||
protected abstract void addDamage(Player player, int damage);
|
||||
|
||||
protected abstract boolean checkBattleStatus();
|
||||
|
||||
protected abstract boolean haveWinner();
|
||||
|
||||
protected abstract boolean roundWinner();
|
||||
|
||||
protected abstract void validateWinner(OlympiadStadium stadium);
|
||||
|
||||
protected abstract void validateRound1Winner(OlympiadStadium stadium);
|
||||
|
||||
protected abstract void validateRound2Winner(OlympiadStadium stadium);
|
||||
|
||||
protected abstract void validateRound3Winner(OlympiadStadium stadium);
|
||||
|
||||
protected abstract int getDivider();
|
||||
|
||||
protected abstract void healPlayers();
|
||||
|
||||
protected abstract void buffPlayers();
|
||||
|
||||
protected abstract void roundTwoCleanUp();
|
||||
|
||||
protected abstract void untransformPlayers();
|
||||
|
||||
protected abstract void makePlayersInvul();
|
||||
|
@@ -40,6 +40,7 @@ import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.data.xml.ClassListData;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.RankManager;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
@@ -71,7 +72,7 @@ public class Hero
|
||||
private static final String INSERT_HERO = "INSERT INTO heroes (charId, class_id, count, legend_count, played, claimed) VALUES (?,?,?,?,?,?)";
|
||||
private static final String UPDATE_HERO = "UPDATE heroes SET count = ?, legend_count = ?, played = ?, claimed = ? WHERE charId = ?";
|
||||
private static final String GET_CLAN_ALLY = "SELECT characters.clanid AS clanid, coalesce(clan_data.ally_Id, 0) AS allyId FROM characters LEFT JOIN clan_data ON clan_data.clan_id = characters.clanid WHERE characters.charId = ?";
|
||||
private static final String DELETE_ITEMS = "DELETE FROM items WHERE item_id IN (30392, 30393, 30394, 30395, 30396, 30397, 30398, 30399, 30400, 30401, 30402, 30403, 30404, 30405, 30372, 30373, 6842, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 9388, 9389, 9390, 48551, 48552) AND owner_id NOT IN (SELECT charId FROM characters WHERE accesslevel > 0)";
|
||||
private static final String DELETE_ITEMS = "DELETE FROM items WHERE item_id IN (30392, 30393, 30394, 30395, 30396, 30397, 30398, 30399, 30400, 30401, 30402, 30403, 30404, 30405, 30372, 30373, 6842, 6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 9388, 9389, 9390, 48551, 48552, 48554, 48555, 48556, 48557, 48558, 48559, 48560, 48561, 48562, 48563, 48564, 48565, 48566, 48567) AND owner_id NOT IN (SELECT charId FROM characters WHERE accesslevel > 0)";
|
||||
|
||||
private static final Map<Integer, StatSet> HEROES = new ConcurrentHashMap<>();
|
||||
private static final Map<Integer, StatSet> COMPLETE_HEROS = new ConcurrentHashMap<>();
|
||||
@@ -95,7 +96,10 @@ public class Hero
|
||||
|
||||
protected Hero()
|
||||
{
|
||||
init();
|
||||
if (Config.OLYMPIAD_ENABLED)
|
||||
{
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
private void init()
|
||||
@@ -607,6 +611,10 @@ public class Hero
|
||||
}
|
||||
|
||||
player.setHero(false);
|
||||
if (player.isLegend())
|
||||
{
|
||||
player.setLegend(false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)
|
||||
{
|
||||
@@ -644,19 +652,17 @@ public class Hero
|
||||
|
||||
for (StatSet hero : newHeroes)
|
||||
{
|
||||
final int legendId = RankManager.getInstance().getOlyRankList().get(1).getInt("charId", 0);
|
||||
final int charId = hero.getInt(Olympiad.CHAR_ID);
|
||||
if (COMPLETE_HEROS.containsKey(charId))
|
||||
{
|
||||
final StatSet oldHero = COMPLETE_HEROS.get(charId);
|
||||
if (hero.getInt(LEGEND_COUNT, 0) == 1)
|
||||
final int count = oldHero.getInt(COUNT);
|
||||
oldHero.set(COUNT, count + 1);
|
||||
if (charId == legendId)
|
||||
{
|
||||
final int count = oldHero.getInt(LEGEND_COUNT);
|
||||
oldHero.set(LEGEND_COUNT, count + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
final int count = oldHero.getInt(COUNT);
|
||||
oldHero.set(COUNT, count + 1);
|
||||
final int legendCount = oldHero.getInt(LEGEND_COUNT);
|
||||
oldHero.set(LEGEND_COUNT, legendCount + 1);
|
||||
}
|
||||
oldHero.set(PLAYED, 1);
|
||||
oldHero.set(CLAIMED, false);
|
||||
@@ -667,14 +673,11 @@ public class Hero
|
||||
final StatSet newHero = new StatSet();
|
||||
newHero.set(Olympiad.CHAR_NAME, hero.getString(Olympiad.CHAR_NAME));
|
||||
newHero.set(Olympiad.CLASS_ID, hero.getInt(Olympiad.CLASS_ID));
|
||||
if (hero.getInt(LEGEND_COUNT, 0) == 1)
|
||||
newHero.set(COUNT, 1);
|
||||
if (charId == legendId)
|
||||
{
|
||||
newHero.set(LEGEND_COUNT, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
newHero.set(COUNT, 1);
|
||||
}
|
||||
newHero.set(PLAYED, 1);
|
||||
newHero.set(CLAIMED, false);
|
||||
HEROES.put(charId, newHero);
|
||||
@@ -918,6 +921,7 @@ public class Hero
|
||||
*/
|
||||
public void claimHero(Player player)
|
||||
{
|
||||
final int legendId = RankManager.getInstance().getOlyRankList().get(1).getInt("charId", 0);
|
||||
StatSet hero = HEROES.get(player.getObjectId());
|
||||
if (hero == null)
|
||||
{
|
||||
@@ -938,6 +942,19 @@ public class Hero
|
||||
}
|
||||
|
||||
player.setHero(true);
|
||||
if (player.getObjectId() == legendId)
|
||||
{
|
||||
player.setLegend(true);
|
||||
player.getVariables().set(ALLY_NAME, false);
|
||||
if ((clan != null) && (clan.getLevel() >= 5))
|
||||
{
|
||||
clan.addReputationScore(100000);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_MEMBER_C1_HAS_BECOME_THE_HERO_CLAN_REPUTATION_POINTS_S2);
|
||||
sm.addString(CharNameTable.getInstance().getNameById(player.getObjectId()));
|
||||
sm.addInt(Config.HERO_POINTS);
|
||||
clan.broadcastToOnlineMembers(sm);
|
||||
}
|
||||
}
|
||||
player.broadcastPacket(new SocialAction(player.getObjectId(), 20016)); // Hero Animation
|
||||
player.sendPacket(new UserInfo(player));
|
||||
player.broadcastUserInfo();
|
||||
|
@@ -50,6 +50,7 @@ import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.events.ListenersContainer;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadInfo;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
@@ -69,13 +70,13 @@ public class Olympiad extends ListenersContainer
|
||||
private static final String OLYMPIAD_LOAD_NOBLES = "SELECT olympiad_nobles.charId, olympiad_nobles.class_id, characters.char_name, olympiad_nobles.olympiad_points, olympiad_nobles.competitions_done, olympiad_nobles.competitions_won, olympiad_nobles.competitions_lost, olympiad_nobles.competitions_drawn, olympiad_nobles.competitions_done_week FROM olympiad_nobles, characters WHERE characters.charId = olympiad_nobles.charId";
|
||||
private static final String OLYMPIAD_SAVE_NOBLES = "INSERT INTO olympiad_nobles (`charId`,`class_id`,`olympiad_points`,`competitions_done`,`competitions_won`,`competitions_lost`,`competitions_drawn`, `competitions_done_week`) VALUES (?,?,?,?,?,?,?,?)";
|
||||
private static final String OLYMPIAD_UPDATE_NOBLES = "UPDATE olympiad_nobles SET olympiad_points = ?, competitions_done = ?, competitions_won = ?, competitions_lost = ?, competitions_drawn = ?, competitions_done_week = ? WHERE charId = ?";
|
||||
private static final String OLYMPIAD_GET_HEROS = "SELECT olympiad_nobles.charId, characters.char_name FROM olympiad_nobles, characters WHERE characters.charId = olympiad_nobles.charId AND olympiad_nobles.class_id = ? AND olympiad_nobles.competitions_done >= " + Config.ALT_OLY_MIN_MATCHES + " AND olympiad_nobles.competitions_won > 0 ORDER BY olympiad_nobles.olympiad_points DESC, olympiad_nobles.competitions_done DESC, olympiad_nobles.competitions_won DESC";
|
||||
private static final String OLYMPIAD_GET_LEGEND = "SELECT olympiad_nobles.charId FROM olympiad_nobles WHERE olympiad_nobles.competitions_done >=" + Config.ALT_OLY_MIN_MATCHES + " ORDER BY olympiad_nobles.olympiad_points DESC LIMIT 1";
|
||||
private static final String GET_ALL_CLASSIFIED_NOBLESS = "SELECT charId from olympiad_nobles_eom WHERE competitions_done >= " + Config.ALT_OLY_MIN_MATCHES + " ORDER BY olympiad_points DESC, competitions_done DESC, competitions_won DESC";
|
||||
private static final String GET_EACH_CLASS_LEADER = "SELECT characters.char_name from olympiad_nobles_eom, characters WHERE characters.charId = olympiad_nobles_eom.charId AND olympiad_nobles_eom.class_id = ? AND olympiad_nobles_eom.competitions_done >= " + Config.ALT_OLY_MIN_MATCHES + " ORDER BY olympiad_nobles_eom.olympiad_points DESC, olympiad_nobles_eom.competitions_done DESC, olympiad_nobles_eom.competitions_won DESC LIMIT 10";
|
||||
private static final String GET_EACH_CLASS_LEADER_CURRENT = "SELECT characters.char_name from olympiad_nobles, characters WHERE characters.charId = olympiad_nobles.charId AND olympiad_nobles.class_id = ? AND olympiad_nobles.competitions_done >= " + Config.ALT_OLY_MIN_MATCHES + " ORDER BY olympiad_nobles.olympiad_points DESC, olympiad_nobles.competitions_done DESC, olympiad_nobles.competitions_won DESC LIMIT 10";
|
||||
private static final String GET_EACH_CLASS_LEADER_SOULHOUND = "SELECT characters.char_name from olympiad_nobles_eom, characters WHERE characters.charId = olympiad_nobles_eom.charId AND (olympiad_nobles_eom.class_id = ? OR olympiad_nobles_eom.class_id = 133) AND olympiad_nobles_eom.competitions_done >= " + Config.ALT_OLY_MIN_MATCHES + " ORDER BY olympiad_nobles_eom.olympiad_points DESC, olympiad_nobles_eom.competitions_done DESC, olympiad_nobles_eom.competitions_won DESC LIMIT 10";
|
||||
private static final String GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND = "SELECT characters.char_name from olympiad_nobles, characters WHERE characters.charId = olympiad_nobles.charId AND (olympiad_nobles.class_id = ? OR olympiad_nobles.class_id = 133) AND olympiad_nobles.competitions_done >= " + Config.ALT_OLY_MIN_MATCHES + " ORDER BY olympiad_nobles.olympiad_points DESC, olympiad_nobles.competitions_done DESC, olympiad_nobles.competitions_won DESC LIMIT 10";
|
||||
private static final String OLYMPIAD_GET_HEROS = "SELECT olympiad_nobles.charId, characters.char_name FROM olympiad_nobles, characters WHERE characters.charId = olympiad_nobles.charId AND olympiad_nobles.class_id = ? AND olympiad_nobles.competitions_done >= " + Config.OLYMPIAD_MIN_MATCHES + " AND olympiad_nobles.competitions_won > 0 ORDER BY olympiad_nobles.olympiad_points DESC, olympiad_nobles.competitions_done DESC, olympiad_nobles.competitions_won DESC";
|
||||
private static final String OLYMPIAD_GET_LEGEND = "SELECT olympiad_nobles.charId FROM olympiad_nobles WHERE olympiad_nobles.competitions_done >=" + Config.OLYMPIAD_MIN_MATCHES + " ORDER BY olympiad_nobles.olympiad_points DESC LIMIT 1";
|
||||
private static final String GET_ALL_CLASSIFIED_NOBLESS = "SELECT charId from olympiad_nobles_eom WHERE competitions_done >= " + Config.OLYMPIAD_MIN_MATCHES + " ORDER BY olympiad_points DESC, competitions_done DESC, competitions_won DESC";
|
||||
private static final String GET_EACH_CLASS_LEADER = "SELECT characters.char_name from olympiad_nobles_eom, characters WHERE characters.charId = olympiad_nobles_eom.charId AND olympiad_nobles_eom.class_id = ? AND olympiad_nobles_eom.competitions_done >= " + Config.OLYMPIAD_MIN_MATCHES + " ORDER BY olympiad_nobles_eom.olympiad_points DESC, olympiad_nobles_eom.competitions_done DESC, olympiad_nobles_eom.competitions_won DESC LIMIT 10";
|
||||
private static final String GET_EACH_CLASS_LEADER_CURRENT = "SELECT characters.char_name from olympiad_nobles, characters WHERE characters.charId = olympiad_nobles.charId AND olympiad_nobles.class_id = ? AND olympiad_nobles.competitions_done >= " + Config.OLYMPIAD_MIN_MATCHES + " ORDER BY olympiad_nobles.olympiad_points DESC, olympiad_nobles.competitions_done DESC, olympiad_nobles.competitions_won DESC LIMIT 10";
|
||||
private static final String GET_EACH_CLASS_LEADER_SOULHOUND = "SELECT characters.char_name from olympiad_nobles_eom, characters WHERE characters.charId = olympiad_nobles_eom.charId AND (olympiad_nobles_eom.class_id = ? OR olympiad_nobles_eom.class_id = 133) AND olympiad_nobles_eom.competitions_done >= " + Config.OLYMPIAD_MIN_MATCHES + " ORDER BY olympiad_nobles_eom.olympiad_points DESC, olympiad_nobles_eom.competitions_done DESC, olympiad_nobles_eom.competitions_won DESC LIMIT 10";
|
||||
private static final String GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND = "SELECT characters.char_name from olympiad_nobles, characters WHERE characters.charId = olympiad_nobles.charId AND (olympiad_nobles.class_id = ? OR olympiad_nobles.class_id = 133) AND olympiad_nobles.competitions_done >= " + Config.OLYMPIAD_MIN_MATCHES + " ORDER BY olympiad_nobles.olympiad_points DESC, olympiad_nobles.competitions_done DESC, olympiad_nobles.competitions_won DESC LIMIT 10";
|
||||
|
||||
private static final String REMOVE_UNCLAIMED_POINTS = "DELETE FROM character_variables WHERE charId=? AND var=?";
|
||||
private static final String INSERT_UNCLAIMED_POINTS = "INSERT INTO character_variables (charId, var, val) VALUES (?, ?, ?)";
|
||||
@@ -87,14 +88,13 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
private static final Set<Integer> HERO_IDS = CategoryData.getInstance().getCategoryByType(CategoryType.SIXTH_CLASS_GROUP);
|
||||
|
||||
private static final int COMP_START = Config.ALT_OLY_START_TIME; // 6PM
|
||||
private static final int COMP_MIN = Config.ALT_OLY_MIN; // 00 mins
|
||||
private static final long COMP_PERIOD = Config.ALT_OLY_CPERIOD; // 6 hours
|
||||
protected static final long WEEKLY_PERIOD = Config.ALT_OLY_WPERIOD; // 1 week
|
||||
protected static final long VALIDATION_PERIOD = Config.ALT_OLY_VPERIOD; // 24 hours
|
||||
private static final int COMP_START = Config.OLYMPIAD_START_TIME; // 6PM
|
||||
private static final int COMP_MIN = Config.OLYMPIAD_MIN; // 00 mins
|
||||
private static final long COMP_PERIOD = Config.OLYMPIAD_CPERIOD; // 6 hours
|
||||
protected static final long WEEKLY_PERIOD = Config.OLYMPIAD_WPERIOD; // 1 week
|
||||
protected static final long VALIDATION_PERIOD = Config.OLYMPIAD_VPERIOD; // 24 hours
|
||||
|
||||
public static final int DEFAULT_POINTS = Config.ALT_OLY_START_POINTS;
|
||||
protected static final int WEEKLY_POINTS = Config.ALT_OLY_WEEKLY_POINTS;
|
||||
public static final int DEFAULT_POINTS = Config.OLYMPIAD_START_POINTS;
|
||||
|
||||
public static final String CHAR_ID = "charId";
|
||||
public static final String CLASS_ID = "class_id";
|
||||
@@ -131,12 +131,19 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
protected Olympiad()
|
||||
{
|
||||
load();
|
||||
AntiFeedManager.getInstance().registerEvent(AntiFeedManager.OLYMPIAD_ID);
|
||||
|
||||
if (_period == 0)
|
||||
if (Config.OLYMPIAD_ENABLED)
|
||||
{
|
||||
init();
|
||||
load();
|
||||
AntiFeedManager.getInstance().registerEvent(AntiFeedManager.OLYMPIAD_ID);
|
||||
|
||||
if (_period == 0)
|
||||
{
|
||||
init();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +406,7 @@ public class Olympiad extends ListenersContainer
|
||||
int dayCounter = 0;
|
||||
for (int i = currentDay; i < 8; i++)
|
||||
{
|
||||
if (Config.ALT_OLY_COMPETITION_DAYS.contains(i))
|
||||
if (Config.OLYMPIAD_COMPETITION_DAYS.contains(i))
|
||||
{
|
||||
dayFound = true;
|
||||
break;
|
||||
@@ -410,7 +417,7 @@ public class Olympiad extends ListenersContainer
|
||||
{
|
||||
for (int i = 1; i < 8; i++)
|
||||
{
|
||||
if (Config.ALT_OLY_COMPETITION_DAYS.contains(i))
|
||||
if (Config.OLYMPIAD_COMPETITION_DAYS.contains(i))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -514,19 +521,24 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
_scheduledCompStart = ThreadPool.schedule(() ->
|
||||
{
|
||||
if (isOlympiadEnd())
|
||||
if (isOlympiadEnd() || !Config.OLYMPIAD_ENABLED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_inCompPeriod = true;
|
||||
|
||||
for (Player player : World.getInstance().getPlayers())
|
||||
{
|
||||
player.sendPacket(new ExOlympiadInfo(1));
|
||||
}
|
||||
|
||||
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.THE_OLYMPIAD_HAS_BEGAN));
|
||||
LOGGER.info("Olympiad System: Olympiad Games have started.");
|
||||
LOGGER_OLYMPIAD.info("Result,Player1,Player2,Player1 HP,Player2 HP,Player1 Damage,Player2 Damage,Points,Classed");
|
||||
|
||||
_gameManager = ThreadPool.scheduleAtFixedRate(OlympiadGameManager.getInstance(), 30000, 30000);
|
||||
if (Config.ALT_OLY_ANNOUNCE_GAMES)
|
||||
if (Config.OLYMPIAD_ANNOUNCE_GAMES)
|
||||
{
|
||||
_gameAnnouncer = ThreadPool.scheduleAtFixedRate(new OlympiadAnnouncer(), 30000, 500);
|
||||
}
|
||||
@@ -543,7 +555,14 @@ public class Olympiad extends ListenersContainer
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_inCompPeriod = false;
|
||||
|
||||
for (Player player : World.getInstance().getPlayers())
|
||||
{
|
||||
player.sendPacket(new ExOlympiadInfo(0));
|
||||
}
|
||||
|
||||
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.BATTLES_IN_THE_OLYMPIAD_GAMES_ARE_NOW_OVER));
|
||||
LOGGER.info("Olympiad System: Olympiad games have ended.");
|
||||
|
||||
@@ -624,33 +643,33 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
final Calendar nextChange = Calendar.getInstance();
|
||||
|
||||
switch (Config.ALT_OLY_PERIOD)
|
||||
switch (Config.OLYMPIAD_PERIOD)
|
||||
{
|
||||
case "DAY":
|
||||
{
|
||||
currentTime.add(Calendar.DAY_OF_MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER);
|
||||
currentTime.add(Calendar.DAY_OF_MONTH, Config.OLYMPIAD_PERIOD_MULTIPLIER);
|
||||
currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation
|
||||
|
||||
if (Config.ALT_OLY_PERIOD_MULTIPLIER >= 14)
|
||||
if (Config.OLYMPIAD_PERIOD_MULTIPLIER >= 14)
|
||||
{
|
||||
_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
|
||||
}
|
||||
else if (Config.ALT_OLY_PERIOD_MULTIPLIER >= 7)
|
||||
else if (Config.OLYMPIAD_PERIOD_MULTIPLIER >= 7)
|
||||
{
|
||||
_nextWeeklyChange = nextChange.getTimeInMillis() + (WEEKLY_PERIOD / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning("Invalid config value for Config.ALT_OLY_PERIOD_MULTIPLIER, must be >= 7");
|
||||
LOGGER.warning("Invalid config value for Config.OLYMPIAD_PERIOD_MULTIPLIER, must be >= 7");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "WEEK":
|
||||
{
|
||||
currentTime.add(Calendar.WEEK_OF_MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER);
|
||||
currentTime.add(Calendar.WEEK_OF_MONTH, Config.OLYMPIAD_PERIOD_MULTIPLIER);
|
||||
currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation
|
||||
|
||||
if (Config.ALT_OLY_PERIOD_MULTIPLIER > 1)
|
||||
if (Config.OLYMPIAD_PERIOD_MULTIPLIER > 1)
|
||||
{
|
||||
_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
|
||||
}
|
||||
@@ -662,7 +681,7 @@ public class Olympiad extends ListenersContainer
|
||||
}
|
||||
case "MONTH":
|
||||
{
|
||||
currentTime.add(Calendar.MONTH, Config.ALT_OLY_PERIOD_MULTIPLIER);
|
||||
currentTime.add(Calendar.MONTH, Config.OLYMPIAD_PERIOD_MULTIPLIER);
|
||||
currentTime.add(Calendar.DAY_OF_MONTH, -1); // last day is for validation
|
||||
|
||||
_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
|
||||
@@ -719,7 +738,7 @@ public class Olympiad extends ListenersContainer
|
||||
int dayCounter = 0;
|
||||
for (int i = currentDay; i < 8; i++)
|
||||
{
|
||||
if (Config.ALT_OLY_COMPETITION_DAYS.contains(i))
|
||||
if (Config.OLYMPIAD_COMPETITION_DAYS.contains(i))
|
||||
{
|
||||
dayFound = true;
|
||||
break;
|
||||
@@ -730,7 +749,7 @@ public class Olympiad extends ListenersContainer
|
||||
{
|
||||
for (int i = 1; i < 8; i++)
|
||||
{
|
||||
if (Config.ALT_OLY_COMPETITION_DAYS.contains(i))
|
||||
if (Config.OLYMPIAD_COMPETITION_DAYS.contains(i))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -769,8 +788,6 @@ public class Olympiad extends ListenersContainer
|
||||
{
|
||||
_scheduledWeeklyTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
addWeeklyPoints();
|
||||
LOGGER.info("Olympiad System: Added weekly points to nobles");
|
||||
resetWeeklyMatches();
|
||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||
|
||||
@@ -778,22 +795,6 @@ public class Olympiad extends ListenersContainer
|
||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||
}
|
||||
|
||||
protected synchronized void addWeeklyPoints()
|
||||
{
|
||||
if (_period == 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int currentPoints;
|
||||
for (StatSet nobleInfo : NOBLES.values())
|
||||
{
|
||||
currentPoints = nobleInfo.getInt(POINTS);
|
||||
currentPoints += WEEKLY_POINTS;
|
||||
nobleInfo.set(POINTS, currentPoints);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets number of matches, classed matches, non classed matches, team matches done by noble characters in the week.
|
||||
*/
|
||||
@@ -1036,7 +1037,7 @@ public class Olympiad extends ListenersContainer
|
||||
public List<String> getClassLeaderBoard(int classId)
|
||||
{
|
||||
final List<String> names = new ArrayList<>();
|
||||
final String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
|
||||
final String query = Config.OLYMPIAD_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(query))
|
||||
{
|
||||
@@ -1075,33 +1076,33 @@ public class Olympiad extends ListenersContainer
|
||||
}
|
||||
|
||||
// Hero point bonus
|
||||
int points = Hero.getInstance().isHero(objectId) || Hero.getInstance().isUnclaimedHero(objectId) ? Config.ALT_OLY_HERO_POINTS : 0;
|
||||
int points = Hero.getInstance().isHero(objectId) || Hero.getInstance().isUnclaimedHero(objectId) ? Config.OLYMPIAD_HERO_POINTS : 0;
|
||||
// Rank point bonus
|
||||
switch (NOBLES_RANK.get(objectId))
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
points += Config.ALT_OLY_RANK1_POINTS;
|
||||
points += Config.OLYMPIAD_RANK1_POINTS;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
points += Config.ALT_OLY_RANK2_POINTS;
|
||||
points += Config.OLYMPIAD_RANK2_POINTS;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
points += Config.ALT_OLY_RANK3_POINTS;
|
||||
points += Config.OLYMPIAD_RANK3_POINTS;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
points += Config.ALT_OLY_RANK4_POINTS;
|
||||
points += Config.OLYMPIAD_RANK4_POINTS;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
points += Config.ALT_OLY_RANK5_POINTS;
|
||||
points += Config.OLYMPIAD_RANK5_POINTS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1203,7 +1204,7 @@ public class Olympiad extends ListenersContainer
|
||||
*/
|
||||
public int getRemainingWeeklyMatches(int objId)
|
||||
{
|
||||
return Math.max(Config.ALT_OLY_MAX_WEEKLY_MATCHES - getCompetitionDoneWeek(objId), 0);
|
||||
return Math.max(Config.OLYMPIAD_MAX_WEEKLY_MATCHES - getCompetitionDoneWeek(objId), 0);
|
||||
}
|
||||
|
||||
protected void deleteNobles()
|
||||
|
@@ -41,7 +41,7 @@ public class OlympiadGameClassed extends OlympiadGameNormal
|
||||
@Override
|
||||
protected int getDivider()
|
||||
{
|
||||
return Config.ALT_OLY_DIVIDER_CLASSED;
|
||||
return Config.OLYMPIAD_DIVIDER_CLASSED;
|
||||
}
|
||||
|
||||
protected static OlympiadGameClassed createGame(int id, List<Set<Integer>> classList)
|
||||
@@ -73,4 +73,13 @@ public class OlympiadGameClassed extends OlympiadGameNormal
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.l2jmobius.gameserver.model.olympiad.AbstractOlympiadGame#validateRound3Winner(org.l2jmobius.gameserver.model.olympiad.OlympiadStadium)
|
||||
*/
|
||||
@Override
|
||||
protected void validateRound3Winner(OlympiadStadium stadium)
|
||||
{
|
||||
}
|
||||
}
|
@@ -39,7 +39,7 @@ public class OlympiadGameNonClassed extends OlympiadGameNormal
|
||||
@Override
|
||||
protected int getDivider()
|
||||
{
|
||||
return Config.ALT_OLY_DIVIDER_NON_CLASSED;
|
||||
return Config.OLYMPIAD_DIVIDER_NON_CLASSED;
|
||||
}
|
||||
|
||||
protected static OlympiadGameNonClassed createGame(int id, Set<Integer> list)
|
||||
|
@@ -27,7 +27,9 @@ import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.OlympiadMode;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@@ -35,11 +37,14 @@ import org.l2jmobius.gameserver.model.actor.Player;
|
||||
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.skill.CommonSkill;
|
||||
import org.l2jmobius.gameserver.model.skill.SkillCaster;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadMatchResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadUserInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMatchInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMatchResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadUserInfo;
|
||||
|
||||
/**
|
||||
* @author GodKratos, Pere, DS
|
||||
@@ -48,10 +53,19 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
{
|
||||
protected int _damageP1 = 0;
|
||||
protected int _damageP2 = 0;
|
||||
protected int _damageP1Final = 0;
|
||||
protected int _damageP2Final = 0;
|
||||
|
||||
protected Participant _playerOne;
|
||||
protected Participant _playerTwo;
|
||||
|
||||
String round_1_winner;
|
||||
String round_2_winner;
|
||||
String round_3_winner;
|
||||
int player1Wins = 0;
|
||||
int player2Wins = 0;
|
||||
boolean matchEnd;
|
||||
|
||||
protected OlympiadGameNormal(int id, Participant[] opponents)
|
||||
{
|
||||
super(id);
|
||||
@@ -162,8 +176,25 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
boolean result = true;
|
||||
try
|
||||
{
|
||||
result &= portPlayerToArena(_playerOne, spawns.get(0), _stadiumId, instance);
|
||||
result &= portPlayerToArena(_playerTwo, spawns.get(spawns.size() / 2), _stadiumId, instance);
|
||||
result &= portPlayerToArena(_playerOne, spawns.get(0), _stadiumId, instance, OlympiadMode.BLUE);
|
||||
result &= portPlayerToArena(_playerTwo, spawns.get(spawns.size() / 2), _stadiumId, instance, OlympiadMode.RED);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "", e);
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final boolean portPlayersToSpots(List<Location> spawns, Instance instance)
|
||||
{
|
||||
boolean result = true;
|
||||
try
|
||||
{
|
||||
result &= portPlayerToSpot(_playerOne, spawns.get(0), _stadiumId);
|
||||
result &= portPlayerToSpot(_playerTwo, spawns.get(spawns.size() / 2), _stadiumId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -332,6 +363,407 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
return playerOneLost || playerTwoLost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean roundWinner()
|
||||
{
|
||||
if (!checkBattleStatus())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean playerOneLost = true;
|
||||
try
|
||||
{
|
||||
if (_playerOne.getPlayer().getOlympiadGameId() == _stadiumId)
|
||||
{
|
||||
playerOneLost = _playerOne.getPlayer().isDead();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
playerOneLost = true;
|
||||
}
|
||||
|
||||
boolean playerTwoLost = true;
|
||||
try
|
||||
{
|
||||
if (_playerTwo.getPlayer().getOlympiadGameId() == _stadiumId)
|
||||
{
|
||||
playerTwoLost = _playerTwo.getPlayer().isDead();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
playerTwoLost = true;
|
||||
}
|
||||
|
||||
return playerOneLost || playerTwoLost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void matchEnd(boolean value)
|
||||
{
|
||||
matchEnd = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMatchEnd()
|
||||
{
|
||||
return matchEnd;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateRound1Winner(OlympiadStadium stadium)
|
||||
{
|
||||
if (_aborted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
|
||||
try
|
||||
{
|
||||
double playerOneHp = 0;
|
||||
if ((_playerOne.getPlayer() != null) && !_playerOne.getPlayer().isDead())
|
||||
{
|
||||
playerOneHp = _playerOne.getPlayer().getCurrentHp() + _playerOne.getPlayer().getCurrentCp();
|
||||
if (playerOneHp < 0.5)
|
||||
{
|
||||
playerOneHp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
double playerTwoHp = 0;
|
||||
if ((_playerTwo.getPlayer() != null) && !_playerTwo.getPlayer().isDead())
|
||||
{
|
||||
playerTwoHp = _playerTwo.getPlayer().getCurrentHp() + _playerTwo.getPlayer().getCurrentCp();
|
||||
if (playerTwoHp < 0.5)
|
||||
{
|
||||
playerTwoHp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// if players crashed, search if they've relogged
|
||||
_playerOne.updatePlayer();
|
||||
_playerTwo.updatePlayer();
|
||||
|
||||
_damageP1Final += _damageP1;
|
||||
_damageP2Final += _damageP2;
|
||||
|
||||
if (((_playerOne.getPlayer() == null) || !_playerOne.getPlayer().isOnline()) && ((_playerTwo.getPlayer() == null) || !_playerTwo.getPlayer().isOnline()))
|
||||
{
|
||||
_playerOne.updateStat(COMP_DRAWN, 1);
|
||||
_playerTwo.updateStat(COMP_DRAWN, 1);
|
||||
sm = new SystemMessage(SystemMessageId.THE_DUEL_HAS_ENDED_IN_A_TIE);
|
||||
stadium.broadcastPacket(sm);
|
||||
}
|
||||
else if ((_playerTwo.getPlayer() == null) || !_playerTwo.getPlayer().isOnline() || ((playerTwoHp == 0) && (playerOneHp != 0)) || ((_damageP1 > _damageP2) && (playerTwoHp != 0) && (playerOneHp != 0)))
|
||||
{
|
||||
final SystemMessage KO = new SystemMessage(((_damageP1 > _damageP2) && (playerTwoHp != 0) && (playerOneHp != 0)) ? SystemMessageId.HIDDEN_MSG_OLYMPIAD_TIME_OVER : SystemMessageId.HIDDEN_MSG_OLYMPIAD_KNOCK_DOWN);
|
||||
_playerOne.getPlayer().sendPacket(KO);
|
||||
_playerTwo.getPlayer().sendPacket(KO);
|
||||
final SystemMessage win = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_VICTORY);
|
||||
_playerOne.getPlayer().sendPacket(win);
|
||||
final SystemMessage loose = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_DEFEAT);
|
||||
_playerTwo.getPlayer().setCurrentCp(_playerTwo.getPlayer().getMaxCp() * 0.7);
|
||||
_playerTwo.getPlayer().setCurrentHp(_playerTwo.getPlayer().getMaxHp() * 0.7);
|
||||
_playerTwo.getPlayer().setCurrentMp(_playerTwo.getPlayer().getMaxMp() * 0.7);
|
||||
_playerTwo.getPlayer().sendPacket(loose);
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 0, 1, 20));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 0, 1, 20));
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
SkillCaster.triggerCast(_playerOne.getPlayer(), _playerOne.getPlayer(), CommonSkill.OLYMPIAD_WIN.getSkill());
|
||||
}, 2000);
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 0, 1, 100));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 0, 1, 100));
|
||||
}, 20000);
|
||||
round_1_winner = _playerOne.getName();
|
||||
player1Wins += 1;
|
||||
}
|
||||
else if ((_playerOne.getPlayer() == null) || !_playerOne.getPlayer().isOnline() || ((playerOneHp == 0) && (playerTwoHp != 0)) || ((_damageP2 > _damageP1) && (playerOneHp != 0) && (playerTwoHp != 0)))
|
||||
{
|
||||
final SystemMessage KO = new SystemMessage(((_damageP2 > _damageP1) && (playerTwoHp != 0) && (playerOneHp != 0)) ? SystemMessageId.HIDDEN_MSG_OLYMPIAD_TIME_OVER : SystemMessageId.HIDDEN_MSG_OLYMPIAD_KNOCK_DOWN);
|
||||
_playerOne.getPlayer().sendPacket(KO);
|
||||
_playerTwo.getPlayer().sendPacket(KO);
|
||||
final SystemMessage win = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_VICTORY);
|
||||
_playerTwo.getPlayer().sendPacket(win);
|
||||
final SystemMessage loose = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_DEFEAT);
|
||||
_playerOne.getPlayer().sendPacket(loose);
|
||||
_playerOne.getPlayer().setCurrentCp(_playerOne.getPlayer().getMaxCp() * 0.7);
|
||||
_playerOne.getPlayer().setCurrentHp(_playerOne.getPlayer().getMaxHp() * 0.7);
|
||||
_playerOne.getPlayer().setCurrentMp(_playerOne.getPlayer().getMaxMp() * 0.7);
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 0, 1, 1, 20));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 0, 1, 1, 20));
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 0, 1, 1, 100));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 0, 1, 1, 100));
|
||||
}, 20000);
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
_playerTwo.getPlayer().useMagic(CommonSkill.OLYMPIAD_WIN.getSkill(), null, false, false);
|
||||
}, 2000);
|
||||
round_1_winner = _playerTwo.getName();
|
||||
player2Wins += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
round_1_winner = null;
|
||||
final SystemMessage _tie = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_TIE);
|
||||
_playerTwo.getPlayer().broadcastPacket(_tie);
|
||||
_playerOne.getPlayer().broadcastPacket(_tie);
|
||||
}
|
||||
resetDamage();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Exception on validateRound1Winner(): " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateRound2Winner(OlympiadStadium stadium)
|
||||
{
|
||||
if (_aborted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
|
||||
try
|
||||
{
|
||||
double playerOneHp = 0;
|
||||
if ((_playerOne.getPlayer() != null) && !_playerOne.getPlayer().isDead())
|
||||
{
|
||||
playerOneHp = _playerOne.getPlayer().getCurrentHp() + _playerOne.getPlayer().getCurrentCp();
|
||||
if (playerOneHp < 0.5)
|
||||
{
|
||||
playerOneHp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
double playerTwoHp = 0;
|
||||
if ((_playerTwo.getPlayer() != null) && !_playerTwo.getPlayer().isDead())
|
||||
{
|
||||
playerTwoHp = _playerTwo.getPlayer().getCurrentHp() + _playerTwo.getPlayer().getCurrentCp();
|
||||
if (playerTwoHp < 0.5)
|
||||
{
|
||||
playerTwoHp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// if players crashed, search if they've relogged
|
||||
_playerOne.updatePlayer();
|
||||
_playerTwo.updatePlayer();
|
||||
|
||||
_damageP1Final += _damageP1;
|
||||
_damageP2Final += _damageP2;
|
||||
|
||||
if (((_playerOne.getPlayer() == null) || !_playerOne.getPlayer().isOnline()) && ((_playerTwo.getPlayer() == null) || !_playerTwo.getPlayer().isOnline()))
|
||||
{
|
||||
_playerOne.updateStat(COMP_DRAWN, 1);
|
||||
_playerTwo.updateStat(COMP_DRAWN, 1);
|
||||
sm = new SystemMessage(SystemMessageId.THE_DUEL_HAS_ENDED_IN_A_TIE);
|
||||
stadium.broadcastPacket(sm);
|
||||
}
|
||||
else if ((_playerTwo.getPlayer() == null) || !_playerTwo.getPlayer().isOnline() || ((playerTwoHp == 0) && (playerOneHp != 0)) || ((_damageP1 > _damageP2) && (playerTwoHp != 0) && (playerOneHp != 0)))
|
||||
{
|
||||
final SystemMessage KO = new SystemMessage(((_damageP1 > _damageP2) && (playerTwoHp != 0) && (playerOneHp != 0)) ? SystemMessageId.HIDDEN_MSG_OLYMPIAD_TIME_OVER : SystemMessageId.HIDDEN_MSG_OLYMPIAD_KNOCK_DOWN);
|
||||
_playerOne.getPlayer().sendPacket(KO);
|
||||
_playerTwo.getPlayer().sendPacket(KO);
|
||||
final SystemMessage win = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_VICTORY);
|
||||
_playerOne.getPlayer().sendPacket(win);
|
||||
final SystemMessage loose = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_DEFEAT);
|
||||
_playerTwo.getPlayer().sendPacket(loose);
|
||||
round_2_winner = _playerOne.getName();
|
||||
player1Wins += 1;
|
||||
|
||||
if (round_1_winner.toLowerCase().equalsIgnoreCase(_playerOne.getName()))
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 2, 0, 2, 20));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 2, 0, 2, 20));
|
||||
matchEnd(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 1, 2, 20));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 1, 2, 20));
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 1, 2, 100));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 1, 2, 100));
|
||||
}, 20000);
|
||||
}
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
SkillCaster.triggerCast(_playerOne.getPlayer(), _playerOne.getPlayer(), CommonSkill.OLYMPIAD_WIN.getSkill());
|
||||
}, 2000);
|
||||
}
|
||||
else if ((_playerOne.getPlayer() == null) || !_playerOne.getPlayer().isOnline() || ((playerOneHp == 0) && (playerTwoHp != 0)) || ((_damageP2 > _damageP1) && (playerOneHp != 0) && (playerTwoHp != 0)))
|
||||
{
|
||||
final SystemMessage KO = new SystemMessage(((_damageP2 > _damageP1) && (playerTwoHp != 0) && (playerOneHp != 0)) ? SystemMessageId.HIDDEN_MSG_OLYMPIAD_TIME_OVER : SystemMessageId.HIDDEN_MSG_OLYMPIAD_KNOCK_DOWN);
|
||||
_playerOne.getPlayer().sendPacket(KO);
|
||||
_playerTwo.getPlayer().sendPacket(KO);
|
||||
final SystemMessage win = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_VICTORY);
|
||||
_playerTwo.getPlayer().sendPacket(win);
|
||||
final SystemMessage loose = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_DEFEAT);
|
||||
_playerOne.getPlayer().sendPacket(loose);
|
||||
round_2_winner = _playerTwo.getName();
|
||||
player2Wins += 1;
|
||||
|
||||
if (round_1_winner.toLowerCase().equalsIgnoreCase(_playerTwo.getName()))
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 0, 2, 2, 20));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 0, 2, 2, 20));
|
||||
matchEnd(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 1, 2, 20));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 1, 2, 20));
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 1, 2, 100));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 1, 2, 100));
|
||||
}, 20000);
|
||||
}
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
_playerTwo.getPlayer().useMagic(CommonSkill.OLYMPIAD_WIN.getSkill(), null, false, false);
|
||||
}, 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
final SystemMessage _tie = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_TIE);
|
||||
_playerTwo.getPlayer().broadcastPacket(_tie);
|
||||
_playerOne.getPlayer().broadcastPacket(_tie);
|
||||
}
|
||||
resetDamage();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Exception on validateRound2Winner(): " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateRound3Winner(OlympiadStadium stadium)
|
||||
{
|
||||
if (_aborted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
|
||||
try
|
||||
{
|
||||
double playerOneHp = 0;
|
||||
if ((_playerOne.getPlayer() != null) && !_playerOne.getPlayer().isDead())
|
||||
{
|
||||
playerOneHp = _playerOne.getPlayer().getCurrentHp() + _playerOne.getPlayer().getCurrentCp();
|
||||
if (playerOneHp < 0.5)
|
||||
{
|
||||
playerOneHp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
double playerTwoHp = 0;
|
||||
if ((_playerTwo.getPlayer() != null) && !_playerTwo.getPlayer().isDead())
|
||||
{
|
||||
playerTwoHp = _playerTwo.getPlayer().getCurrentHp() + _playerTwo.getPlayer().getCurrentCp();
|
||||
if (playerTwoHp < 0.5)
|
||||
{
|
||||
playerTwoHp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// if players crashed, search if they've relogged
|
||||
_playerOne.updatePlayer();
|
||||
_playerTwo.updatePlayer();
|
||||
|
||||
_damageP1Final += _damageP1;
|
||||
_damageP2Final += _damageP2;
|
||||
|
||||
if (((_playerOne.getPlayer() == null) || !_playerOne.getPlayer().isOnline()) && ((_playerTwo.getPlayer() == null) || !_playerTwo.getPlayer().isOnline()))
|
||||
{
|
||||
_playerOne.updateStat(COMP_DRAWN, 1);
|
||||
_playerTwo.updateStat(COMP_DRAWN, 1);
|
||||
sm = new SystemMessage(SystemMessageId.THE_DUEL_HAS_ENDED_IN_A_TIE);
|
||||
stadium.broadcastPacket(sm);
|
||||
}
|
||||
else if ((_playerTwo.getPlayer() == null) || !_playerTwo.getPlayer().isOnline() || ((playerTwoHp == 0) && (playerOneHp != 0)) || ((_damageP1 > _damageP2) && (playerTwoHp != 0) && (playerOneHp != 0)))
|
||||
{
|
||||
final SystemMessage KO = new SystemMessage(((_damageP1 > _damageP2) && (playerTwoHp != 0) && (playerOneHp != 0)) ? SystemMessageId.HIDDEN_MSG_OLYMPIAD_TIME_OVER : SystemMessageId.HIDDEN_MSG_OLYMPIAD_KNOCK_DOWN);
|
||||
_playerOne.getPlayer().sendPacket(KO);
|
||||
_playerTwo.getPlayer().sendPacket(KO);
|
||||
final SystemMessage win = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_VICTORY);
|
||||
_playerOne.getPlayer().sendPacket(win);
|
||||
final SystemMessage loose = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_DEFEAT);
|
||||
_playerTwo.getPlayer().sendPacket(loose);
|
||||
round_3_winner = _playerOne.getName();
|
||||
player1Wins += 1;
|
||||
if (round_3_winner.toLowerCase().equalsIgnoreCase(_playerOne.getName()))
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 2, 1, 3, 0));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 2, 1, 3, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 2, 3, 0));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 2, 3, 0));
|
||||
}
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
SkillCaster.triggerCast(_playerOne.getPlayer(), _playerOne.getPlayer(), CommonSkill.OLYMPIAD_WIN.getSkill());
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
else if ((_playerOne.getPlayer() == null) || !_playerOne.getPlayer().isOnline() || ((playerOneHp == 0) && (playerTwoHp != 0)) || ((_damageP2 > _damageP1) && (playerOneHp != 0) && (playerTwoHp != 0)))
|
||||
{
|
||||
final SystemMessage KO = new SystemMessage(((_damageP2 > _damageP1) && (playerTwoHp != 0) && (playerOneHp != 0)) ? SystemMessageId.HIDDEN_MSG_OLYMPIAD_TIME_OVER : SystemMessageId.HIDDEN_MSG_OLYMPIAD_KNOCK_DOWN);
|
||||
_playerOne.getPlayer().sendPacket(KO);
|
||||
_playerTwo.getPlayer().sendPacket(KO);
|
||||
final SystemMessage win = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_VICTORY);
|
||||
_playerTwo.getPlayer().sendPacket(win);
|
||||
final SystemMessage loose = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_DEFEAT);
|
||||
_playerOne.getPlayer().sendPacket(loose);
|
||||
round_3_winner = _playerTwo.getName();
|
||||
player2Wins += 1;
|
||||
if (round_3_winner.toLowerCase().equalsIgnoreCase(_playerTwo.getName()))
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 2, 3, 0));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 1, 2, 3, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerOne.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 2, 1, 3, 0));
|
||||
_playerTwo.getPlayer().sendPacket(new ExOlympiadMatchInfo(_playerOne.getName(), _playerTwo.getName(), 2, 1, 3, 0));
|
||||
}
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
SkillCaster.triggerCast(_playerTwo.getPlayer(), _playerTwo.getPlayer(), CommonSkill.OLYMPIAD_WIN.getSkill());
|
||||
}, 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
final SystemMessage _tie = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_TIE);
|
||||
_playerTwo.getPlayer().broadcastPacket(_tie);
|
||||
_playerOne.getPlayer().broadcastPacket(_tie);
|
||||
}
|
||||
resetDamage();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Exception on validateRound3Winner(): " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateWinner(OlympiadStadium stadium)
|
||||
{
|
||||
@@ -342,7 +774,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
|
||||
ExOlympiadMatchResult result = null;
|
||||
|
||||
boolean tie = false;
|
||||
boolean tie = round_1_winner == null ? true : false;
|
||||
int winside = 0;
|
||||
|
||||
final List<OlympiadInfo> list1 = new ArrayList<>(1);
|
||||
@@ -358,9 +790,9 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
{
|
||||
pointDiff = 1;
|
||||
}
|
||||
else if (pointDiff > Config.ALT_OLY_MAX_POINTS)
|
||||
else if (pointDiff > Config.OLYMPIAD_MAX_POINTS)
|
||||
{
|
||||
pointDiff = Config.ALT_OLY_MAX_POINTS;
|
||||
pointDiff = Config.OLYMPIAD_MAX_POINTS;
|
||||
}
|
||||
|
||||
int points;
|
||||
@@ -375,13 +807,13 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
{
|
||||
try
|
||||
{
|
||||
points = Math.min(playerOnePoints / 3, Config.ALT_OLY_MAX_POINTS);
|
||||
points = Math.min(playerOnePoints / 3, Config.OLYMPIAD_MAX_POINTS);
|
||||
removePointsFromParticipant(_playerOne, points);
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - points, -points));
|
||||
|
||||
winside = 2;
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
if (Config.OLYMPIAD_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info(_playerOne.getName() + " default," + _playerOne + "," + _playerTwo + ",0,0,0,0," + points + "," + getType());
|
||||
}
|
||||
@@ -395,7 +827,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
{
|
||||
try
|
||||
{
|
||||
points = Math.min(playerTwoPoints / 3, Config.ALT_OLY_MAX_POINTS);
|
||||
points = Math.min(playerTwoPoints / 3, Config.OLYMPIAD_MAX_POINTS);
|
||||
removePointsFromParticipant(_playerTwo, points);
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - points, -points));
|
||||
|
||||
@@ -408,7 +840,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
winside = 1;
|
||||
}
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
if (Config.OLYMPIAD_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info(_playerTwo.getName() + " default," + _playerOne + "," + _playerTwo + ",0,0,0,0," + points + "," + getType());
|
||||
}
|
||||
@@ -420,11 +852,11 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
}
|
||||
if (winside == 1)
|
||||
{
|
||||
result = new ExOlympiadMatchResult(tie, winside, list1, list2);
|
||||
result = new ExOlympiadMatchResult(tie, winside, list1, list2, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = new ExOlympiadMatchResult(tie, winside, list2, list1);
|
||||
result = new ExOlympiadMatchResult(tie, winside, list2, list1, 0, 0, 0);
|
||||
}
|
||||
stadium.broadcastPacket(result);
|
||||
return;
|
||||
@@ -449,17 +881,17 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
|
||||
_playerOne.updateStat(COMP_WON, 1);
|
||||
addPointsToParticipant(_playerOne, pointDiff);
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints + pointDiff, pointDiff));
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1Final, playerOnePoints + pointDiff, pointDiff));
|
||||
|
||||
_playerTwo.updateStat(COMP_LOST, 1);
|
||||
removePointsFromParticipant(_playerTwo, pointDiff);
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - pointDiff, -pointDiff));
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2Final, playerTwoPoints - pointDiff, -pointDiff));
|
||||
|
||||
winside = 1;
|
||||
|
||||
rewardParticipant(_playerOne.getPlayer(), Config.ALT_OLY_WINNER_REWARD); // Winner
|
||||
rewardParticipant(_playerOne.getPlayer(), Config.OLYMPIAD_WINNER_REWARD); // Winner
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
if (Config.OLYMPIAD_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info(_playerTwo.getName() + " crash," + _playerOne + "," + _playerTwo + ",0,0,0,0," + pointDiff + "," + getType());
|
||||
}
|
||||
@@ -475,17 +907,17 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
|
||||
_playerTwo.updateStat(COMP_WON, 1);
|
||||
addPointsToParticipant(_playerTwo, pointDiff);
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints + pointDiff, pointDiff));
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2Final, playerTwoPoints + pointDiff, pointDiff));
|
||||
|
||||
_playerOne.updateStat(COMP_LOST, 1);
|
||||
removePointsFromParticipant(_playerOne, pointDiff);
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - pointDiff, -pointDiff));
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1Final, playerOnePoints - pointDiff, -pointDiff));
|
||||
|
||||
winside = 2;
|
||||
|
||||
rewardParticipant(_playerTwo.getPlayer(), Config.ALT_OLY_WINNER_REWARD); // Winner
|
||||
rewardParticipant(_playerTwo.getPlayer(), Config.OLYMPIAD_WINNER_REWARD); // Winner
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
if (Config.OLYMPIAD_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info(_playerOne.getName() + " crash," + _playerOne + "," + _playerTwo + ",0,0,0,0," + pointDiff + "," + getType());
|
||||
}
|
||||
@@ -498,15 +930,15 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
|
||||
_playerOne.updateStat(COMP_LOST, 1);
|
||||
removePointsFromParticipant(_playerOne, pointDiff);
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - pointDiff, -pointDiff));
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1Final, playerOnePoints - pointDiff, -pointDiff));
|
||||
|
||||
_playerTwo.updateStat(COMP_LOST, 1);
|
||||
removePointsFromParticipant(_playerTwo, pointDiff);
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - pointDiff, -pointDiff));
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2Final, playerTwoPoints - pointDiff, -pointDiff));
|
||||
|
||||
tie = true;
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
if (Config.OLYMPIAD_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info("both crash," + _playerOne.getName() + "," + _playerOne + ",0,0,0,0," + _playerTwo + "," + pointDiff + "," + getType());
|
||||
}
|
||||
@@ -519,11 +951,11 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
|
||||
if (winside == 1)
|
||||
{
|
||||
result = new ExOlympiadMatchResult(tie, winside, list1, list2);
|
||||
result = new ExOlympiadMatchResult(tie, winside, list1, list2, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = new ExOlympiadMatchResult(tie, winside, list2, list1);
|
||||
result = new ExOlympiadMatchResult(tie, winside, list2, list1, 0, 0, 0);
|
||||
}
|
||||
stadium.broadcastPacket(result);
|
||||
|
||||
@@ -577,7 +1009,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
sm = new SystemMessage(SystemMessageId.THE_DUEL_HAS_ENDED_IN_A_TIE);
|
||||
stadium.broadcastPacket(sm);
|
||||
}
|
||||
else if ((_playerTwo.getPlayer() == null) || !_playerTwo.getPlayer().isOnline() || ((playerTwoHp == 0) && (playerOneHp != 0)) || ((_damageP1 > _damageP2) && (playerTwoHp != 0) && (playerOneHp != 0)))
|
||||
else if ((player1Wins == 2) || (_playerTwo.getPlayer() == null) || !_playerTwo.getPlayer().isOnline() || ((playerTwoHp == 0) && (playerOneHp != 0)) || ((_damageP1 > _damageP2) && (playerTwoHp != 0) && (playerOneHp != 0)))
|
||||
{
|
||||
sm = new SystemMessage(SystemMessageId.CONGRATULATIONS_C1_YOU_WIN_THE_MATCH);
|
||||
sm.addString(_playerOne.getName());
|
||||
@@ -587,10 +1019,10 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
_playerTwo.updateStat(COMP_LOST, 1);
|
||||
|
||||
addPointsToParticipant(_playerOne, pointDiff);
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints + pointDiff, pointDiff));
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1Final, playerOnePoints + pointDiff, pointDiff));
|
||||
|
||||
removePointsFromParticipant(_playerTwo, pointDiff);
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - pointDiff, -pointDiff));
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2Final, playerTwoPoints - pointDiff, -pointDiff));
|
||||
winner = _playerOne.getName() + " won";
|
||||
|
||||
winside = 1;
|
||||
@@ -598,13 +1030,13 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
// Save Fight Result
|
||||
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
|
||||
rewardParticipant(_playerOne.getPlayer(), Config.OLYMPIAD_WINNER_REWARD); // Winner
|
||||
rewardParticipant(_playerTwo.getPlayer(), Config.OLYMPIAD_LOSER_REWARD); // Loser
|
||||
|
||||
// Notify to scripts
|
||||
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)))
|
||||
else if ((player2Wins == 2) || (_playerOne.getPlayer() == null) || !_playerOne.getPlayer().isOnline() || ((playerOneHp == 0) && (playerTwoHp != 0)) || ((_damageP2 > _damageP1) && (playerOneHp != 0) && (playerTwoHp != 0)))
|
||||
{
|
||||
sm = new SystemMessage(SystemMessageId.CONGRATULATIONS_C1_YOU_WIN_THE_MATCH);
|
||||
sm.addString(_playerTwo.getName());
|
||||
@@ -614,10 +1046,10 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
_playerOne.updateStat(COMP_LOST, 1);
|
||||
|
||||
addPointsToParticipant(_playerTwo, pointDiff);
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints + pointDiff, pointDiff));
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2Final, playerTwoPoints + pointDiff, pointDiff));
|
||||
|
||||
removePointsFromParticipant(_playerOne, pointDiff);
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - pointDiff, -pointDiff));
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1Final, playerOnePoints - pointDiff, -pointDiff));
|
||||
|
||||
winner = _playerTwo.getName() + " won";
|
||||
winside = 2;
|
||||
@@ -625,8 +1057,8 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
// Save Fight Result
|
||||
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
|
||||
rewardParticipant(_playerTwo.getPlayer(), Config.OLYMPIAD_WINNER_REWARD); // Winner
|
||||
rewardParticipant(_playerOne.getPlayer(), Config.OLYMPIAD_LOSER_REWARD); // Loser
|
||||
|
||||
// Notify to scripts
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnOlympiadMatchResult(_playerTwo, _playerOne, getType()), Olympiad.getInstance());
|
||||
@@ -639,14 +1071,14 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
sm = new SystemMessage(SystemMessageId.THE_DUEL_HAS_ENDED_IN_A_TIE);
|
||||
stadium.broadcastPacket(sm);
|
||||
|
||||
int value = Math.min(playerOnePoints / getDivider(), Config.ALT_OLY_MAX_POINTS);
|
||||
int value = Math.min(playerOnePoints / getDivider(), Config.OLYMPIAD_MAX_POINTS);
|
||||
|
||||
removePointsFromParticipant(_playerOne, value);
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - value, -value));
|
||||
list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1Final, playerOnePoints - value, -value));
|
||||
|
||||
value = Math.min(playerTwoPoints / getDivider(), Config.ALT_OLY_MAX_POINTS);
|
||||
value = Math.min(playerTwoPoints / getDivider(), Config.OLYMPIAD_MAX_POINTS);
|
||||
removePointsFromParticipant(_playerTwo, value);
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - value, -value));
|
||||
list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2Final, playerTwoPoints - value, -value));
|
||||
|
||||
tie = true;
|
||||
}
|
||||
@@ -658,15 +1090,16 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
|
||||
if (winside == 1)
|
||||
{
|
||||
result = new ExOlympiadMatchResult(tie, winside, list1, list2);
|
||||
result = new ExOlympiadMatchResult(tie, winside, list1, list2, round_1_winner.equalsIgnoreCase(_playerOne.getName()) ? 2 : 3, round_2_winner.equalsIgnoreCase(_playerOne.getName()) ? 2 : 3, (round_3_winner != null) && round_3_winner.equalsIgnoreCase(_playerOne.getName()) ? 2 : (round_3_winner == null) ? 0 : 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = new ExOlympiadMatchResult(tie, winside, list2, list1);
|
||||
result = new ExOlympiadMatchResult(tie, winside, list2, list1, round_1_winner.equalsIgnoreCase(_playerTwo.getName()) ? 3 : 2, round_2_winner.equalsIgnoreCase(_playerTwo.getName()) ? 3 : 2, (round_3_winner != null) && round_3_winner.equalsIgnoreCase(_playerTwo.getName()) ? 3 : (round_3_winner == null) ? 0 : 2);
|
||||
}
|
||||
|
||||
stadium.broadcastPacket(result);
|
||||
|
||||
if (Config.ALT_OLY_LOG_FIGHTS)
|
||||
if (Config.OLYMPIAD_LOG_FIGHTS)
|
||||
{
|
||||
LOGGER_OLYMPIAD.info(winner + "," + _playerOne.getName() + "," + _playerOne + "," + _playerTwo + "," + playerOneHp + "," + playerTwoHp + "," + _damageP1 + "," + _damageP2 + "," + pointDiff + "," + getType());
|
||||
}
|
||||
@@ -750,6 +1183,13 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
_damageP2 = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetDamageFinal()
|
||||
{
|
||||
_damageP1Final = 0;
|
||||
_damageP2Final = 0;
|
||||
}
|
||||
|
||||
protected void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
@@ -791,6 +1231,41 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buffPlayers()
|
||||
{
|
||||
final Player player1 = _playerOne.getPlayer();
|
||||
if (player1 != null)
|
||||
{
|
||||
SkillCaster.triggerCast(player1, player1, CommonSkill.OLYMPIAD_HARMONY.getSkill());
|
||||
SkillCaster.triggerCast(player1, player1, CommonSkill.OLYMPIAD_MELODY.getSkill());
|
||||
}
|
||||
|
||||
final Player player2 = _playerTwo.getPlayer();
|
||||
if (player2 != null)
|
||||
{
|
||||
SkillCaster.triggerCast(player2, player2, CommonSkill.OLYMPIAD_HARMONY.getSkill());
|
||||
SkillCaster.triggerCast(player2, player2, CommonSkill.OLYMPIAD_MELODY.getSkill());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void roundTwoCleanUp()
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
if ((_playerOne.getPlayer() != null) && !_playerOne.isDefaulted() && !_playerOne.isDisconnected() && (_playerOne.getPlayer().getOlympiadGameId() == _stadiumId))
|
||||
{
|
||||
roundTwoClean(_playerOne.getPlayer());
|
||||
}
|
||||
|
||||
if ((_playerTwo.getPlayer() != null) && !_playerTwo.isDefaulted() && !_playerTwo.isDisconnected() && (_playerTwo.getPlayer().getOlympiadGameId() == _stadiumId))
|
||||
{
|
||||
roundTwoClean(_playerTwo.getPlayer());
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void untransformPlayers()
|
||||
{
|
||||
|
@@ -24,7 +24,13 @@ enum OlympiadGameState
|
||||
BATTLE_COUNTDOWN_FIRST,
|
||||
BATTLE_COUNTDOWN_SECOND,
|
||||
BATTLE_STARTED,
|
||||
ROUND_1,
|
||||
WAIT_TIME_1,
|
||||
ROUND_2,
|
||||
WAIT_TIME_2,
|
||||
ROUND_3,
|
||||
BATTLE_IN_PROGRESS,
|
||||
ROUND_ENDED,
|
||||
GAME_STOPPED,
|
||||
TELEPORT_TO_TOWN,
|
||||
CLEANUP,
|
||||
|
@@ -23,6 +23,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMatchInfo;
|
||||
|
||||
/**
|
||||
* @author DS
|
||||
@@ -116,7 +117,7 @@ public class OlympiadGameTask implements Runnable
|
||||
|
||||
public boolean isBattleStarted()
|
||||
{
|
||||
return _state == OlympiadGameState.BATTLE_IN_PROGRESS;
|
||||
return (_state == OlympiadGameState.BATTLE_IN_PROGRESS) || (_state == OlympiadGameState.ROUND_2) || (_state == OlympiadGameState.ROUND_3);
|
||||
}
|
||||
|
||||
public boolean isBattleFinished()
|
||||
@@ -163,6 +164,8 @@ public class OlympiadGameTask implements Runnable
|
||||
{
|
||||
try
|
||||
{
|
||||
final String player1 = _game.getPlayerNames()[0];
|
||||
final String player2 = _game.getPlayerNames()[1];
|
||||
int delay = 1; // schedule next call after 1s
|
||||
switch (_state)
|
||||
{
|
||||
@@ -170,7 +173,7 @@ public class OlympiadGameTask implements Runnable
|
||||
case BEGIN:
|
||||
{
|
||||
_state = OlympiadGameState.TELEPORT_TO_ARENA;
|
||||
_countDown = Config.ALT_OLY_WAIT_TIME;
|
||||
_countDown = Config.OLYMPIAD_WAIT_TIME;
|
||||
break;
|
||||
}
|
||||
// Teleport to arena countdown
|
||||
@@ -198,6 +201,7 @@ public class OlympiadGameTask implements Runnable
|
||||
// Game start, port players to arena
|
||||
case GAME_STARTED:
|
||||
{
|
||||
_stadium.makeZonePvPForCharsInside(false);
|
||||
if (!startGame())
|
||||
{
|
||||
_state = OlympiadGameState.GAME_STOPPED;
|
||||
@@ -215,7 +219,7 @@ public class OlympiadGameTask implements Runnable
|
||||
{
|
||||
if (_countDown > 0)
|
||||
{
|
||||
if (_countDown == 55) // 55sec
|
||||
if (_countDown == 50) // 55sec
|
||||
{
|
||||
_game.healPlayers();
|
||||
}
|
||||
@@ -232,6 +236,7 @@ public class OlympiadGameTask implements Runnable
|
||||
{
|
||||
_game.makePlayersInvul();
|
||||
_game.resetDamage();
|
||||
_game.resetDamageFinal();
|
||||
_stadium.openDoors();
|
||||
|
||||
_state = OlympiadGameState.BATTLE_COUNTDOWN_SECOND;
|
||||
@@ -255,15 +260,33 @@ public class OlympiadGameTask implements Runnable
|
||||
{
|
||||
_state = OlympiadGameState.BATTLE_STARTED;
|
||||
_game.removePlayersInvul();
|
||||
_stadium.broadcastPacket(new SystemMessage(SystemMessageId.HIDDEN_MSG_START_OLYMPIAD));
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Beginning of the battle
|
||||
case BATTLE_STARTED:
|
||||
{
|
||||
_countDown = 0;
|
||||
_countDown = (int) Config.OLYMPIAD_BATTLE / 1000;
|
||||
|
||||
_game.broadcastPacket(new ExOlympiadMatchInfo(player1, player2, 0, 0, 1, 100));
|
||||
|
||||
final SystemMessage round1 = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_ROUND_1);
|
||||
_stadium.broadcastPacket(round1);
|
||||
final SystemMessage start = new SystemMessage(SystemMessageId.HIDDEN_MSG_START_OLYMPIAD);
|
||||
_stadium.broadcastPacket(start);
|
||||
_game.broadcastOlympiadInfo(_stadium);
|
||||
_state = OlympiadGameState.ROUND_1; // set state first, used in zone update
|
||||
if (!startBattle())
|
||||
{
|
||||
_state = OlympiadGameState.GAME_STOPPED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ROUND_1:
|
||||
{
|
||||
_state = OlympiadGameState.BATTLE_IN_PROGRESS; // set state first, used in zone update
|
||||
_countDown = (int) Config.OLYMPIAD_BATTLE / 1000;
|
||||
_stadium.makeZonePvPForCharsInside(true);
|
||||
if (!startBattle())
|
||||
{
|
||||
_state = OlympiadGameState.GAME_STOPPED;
|
||||
@@ -273,8 +296,8 @@ public class OlympiadGameTask implements Runnable
|
||||
// Checks during battle
|
||||
case BATTLE_IN_PROGRESS:
|
||||
{
|
||||
_countDown += 1000;
|
||||
final int remaining = (int) ((Config.ALT_OLY_BATTLE - _countDown) / 1000);
|
||||
_countDown -= 1;
|
||||
final int remaining = (int) Config.OLYMPIAD_BATTLE / 1000;
|
||||
for (int announceTime : BATTLE_END_TIME_SECOND)
|
||||
{
|
||||
if (announceTime == remaining)
|
||||
@@ -285,13 +308,122 @@ public class OlympiadGameTask implements Runnable
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkBattle() || (_countDown > Config.ALT_OLY_BATTLE))
|
||||
if (roundCheck() || (_countDown <= 0))
|
||||
{
|
||||
round1();
|
||||
_game.makePlayersInvul();
|
||||
_state = OlympiadGameState.WAIT_TIME_1;
|
||||
_stadium.makeZonePvPForCharsInside(false);
|
||||
_countDown = 20;
|
||||
}
|
||||
else if (checkBattle())
|
||||
{
|
||||
_state = OlympiadGameState.GAME_STOPPED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WAIT_TIME_1:
|
||||
{
|
||||
_countDown -= 1;
|
||||
if (_countDown == 14)
|
||||
{
|
||||
_game.buffPlayers();
|
||||
_game.portPlayersToSpots(_stadium.getZone().getSpawns(), _stadium.getInstance());
|
||||
_game.broadcastOlympiadInfo(_stadium);
|
||||
}
|
||||
if (_countDown <= 0)
|
||||
{
|
||||
_game.removePlayersInvul();
|
||||
_state = OlympiadGameState.ROUND_2;
|
||||
_countDown = (int) Config.OLYMPIAD_BATTLE / 1000;
|
||||
final SystemMessage round2 = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_ROUND_2);
|
||||
_stadium.broadcastPacket(round2);
|
||||
final SystemMessage start = new SystemMessage(SystemMessageId.HIDDEN_MSG_START_OLYMPIAD);
|
||||
_stadium.broadcastPacket(start);
|
||||
_stadium.makeZonePvPForCharsInside(true);
|
||||
_game.broadcastOlympiadInfo(_stadium);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ROUND_2:
|
||||
{
|
||||
_countDown -= 1;
|
||||
final int remaining = (int) Config.OLYMPIAD_BATTLE / 1000;
|
||||
for (int announceTime : BATTLE_END_TIME_SECOND)
|
||||
{
|
||||
if (announceTime == remaining)
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.THE_GAME_ENDS_IN_S1_SEC);
|
||||
sm.addInt(announceTime);
|
||||
_stadium.broadcastPacket(sm);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (roundCheck() || (_countDown <= 0))
|
||||
{
|
||||
round2();
|
||||
if (_game.isMatchEnd())
|
||||
{
|
||||
_state = OlympiadGameState.GAME_STOPPED;
|
||||
break;
|
||||
}
|
||||
_state = OlympiadGameState.WAIT_TIME_2;
|
||||
_game.makePlayersInvul();
|
||||
_stadium.makeZonePvPForCharsInside(false);
|
||||
_countDown = 20;
|
||||
}
|
||||
else if (checkBattle())
|
||||
{
|
||||
_state = OlympiadGameState.GAME_STOPPED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WAIT_TIME_2:
|
||||
{
|
||||
_countDown -= 1;
|
||||
if (_countDown == 14)
|
||||
{
|
||||
_game.buffPlayers();
|
||||
_game.roundTwoCleanUp();
|
||||
_game.broadcastOlympiadInfo(_stadium);
|
||||
_game.portPlayersToSpots(_stadium.getZone().getSpawns(), _stadium.getInstance());
|
||||
}
|
||||
if (_countDown <= 0)
|
||||
{
|
||||
_state = OlympiadGameState.ROUND_3;
|
||||
_game.removePlayersInvul();
|
||||
_countDown = (int) Config.OLYMPIAD_BATTLE / 1000;
|
||||
final SystemMessage round2 = new SystemMessage(SystemMessageId.HIDDEN_MSG_OLYMPIAD_ROUND_3);
|
||||
_stadium.broadcastPacket(round2);
|
||||
final SystemMessage start = new SystemMessage(SystemMessageId.HIDDEN_MSG_START_OLYMPIAD);
|
||||
_stadium.broadcastPacket(start);
|
||||
_stadium.makeZonePvPForCharsInside(true);
|
||||
_game.broadcastOlympiadInfo(_stadium);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ROUND_3:
|
||||
{
|
||||
_countDown -= 1;
|
||||
final int remaining = (int) Config.OLYMPIAD_BATTLE / 1000;
|
||||
for (int announceTime : BATTLE_END_TIME_SECOND)
|
||||
{
|
||||
if (announceTime == remaining)
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.THE_GAME_ENDS_IN_S1_SEC);
|
||||
sm.addInt(announceTime);
|
||||
_stadium.broadcastPacket(sm);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (roundCheck() || (_countDown <= 0) || checkBattle())
|
||||
{
|
||||
round3();
|
||||
_game.makePlayersInvul();
|
||||
_stadium.makeZonePvPForCharsInside(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// End of the battle
|
||||
case GAME_STOPPED:
|
||||
{
|
||||
@@ -425,7 +557,7 @@ public class OlympiadGameTask implements Runnable
|
||||
{
|
||||
// game successfully started
|
||||
_game.broadcastOlympiadInfo(_stadium);
|
||||
_stadium.broadcastPacket(new SystemMessage(SystemMessageId.THE_MATCH_HAS_BEGUN_FIGHT));
|
||||
// _stadium.broadcastPacket(new SystemMessage(SystemMessageId.THE_MATCH_HAS_BEGUN_FIGHT));
|
||||
_stadium.updateZoneStatusForCharactersInside();
|
||||
return true;
|
||||
}
|
||||
@@ -437,6 +569,82 @@ public class OlympiadGameTask implements Runnable
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean roundCheck()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _game.roundWinner();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void round1()
|
||||
{
|
||||
try
|
||||
{
|
||||
_game.validateRound1Winner(_stadium);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void round2()
|
||||
{
|
||||
try
|
||||
{
|
||||
_game.validateRound2Winner(_stadium);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void round3()
|
||||
{
|
||||
try
|
||||
{
|
||||
_game.validateRound3Winner(_stadium);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_game.makePlayersInvul();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_stadium.updateZoneStatusForCharactersInside();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_state = OlympiadGameState.GAME_STOPPED;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fifth stage: battle is running, returns true if winner found.
|
||||
* @return
|
||||
|
@@ -45,11 +45,6 @@ public class OlympiadManager
|
||||
{
|
||||
}
|
||||
|
||||
public static OlympiadManager getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public Set<Integer> getRegisteredNonClassBased()
|
||||
{
|
||||
return _nonClassBasedRegisters;
|
||||
@@ -65,7 +60,7 @@ public class OlympiadManager
|
||||
List<Set<Integer>> result = null;
|
||||
for (Entry<Integer, Set<Integer>> classList : _classBasedRegisters.entrySet())
|
||||
{
|
||||
if ((classList.getValue() != null) && (classList.getValue().size() >= Config.ALT_OLY_CLASSED))
|
||||
if ((classList.getValue() != null) && (classList.getValue().size() >= Config.OLYMPIAD_CLASSED))
|
||||
{
|
||||
if (result == null)
|
||||
{
|
||||
@@ -80,7 +75,7 @@ public class OlympiadManager
|
||||
|
||||
protected final boolean hasEnoughRegisteredNonClassed()
|
||||
{
|
||||
return _nonClassBasedRegisters.size() >= Config.ALT_OLY_NONCLASSED;
|
||||
return _nonClassBasedRegisters.size() >= Config.OLYMPIAD_NONCLASSED;
|
||||
}
|
||||
|
||||
protected final void clearRegistered()
|
||||
@@ -341,11 +336,6 @@ public class OlympiadManager
|
||||
return _nonClassBasedRegisters.size() + _classBasedRegisters.size();
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final OlympiadManager INSTANCE = new OlympiadManager();
|
||||
}
|
||||
|
||||
private int getClassGroup(Player player)
|
||||
{
|
||||
if (player.isInCategory(CategoryType.SIXTH_TIR_GROUP))
|
||||
@@ -389,4 +379,14 @@ public class OlympiadManager
|
||||
return player.getBaseClass();
|
||||
}
|
||||
}
|
||||
|
||||
public static OlympiadManager getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final OlympiadManager INSTANCE = new OlympiadManager();
|
||||
}
|
||||
}
|
||||
|
@@ -31,11 +31,9 @@ import org.l2jmobius.gameserver.model.actor.instance.Door;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.type.OlympiadStadiumZone;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadMatchEnd;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadUserInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMatchEnd;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadUserInfo;
|
||||
|
||||
/**
|
||||
* @author JIV
|
||||
@@ -127,6 +125,32 @@ public class OlympiadStadium
|
||||
}
|
||||
}
|
||||
|
||||
public void makeZonePvPForCharsInside(boolean value)
|
||||
{
|
||||
if (_task == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (value)
|
||||
{
|
||||
for (Player player : _instance.getPlayers())
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, true);
|
||||
player.setOlympiadStart(true);
|
||||
_task.getGame().sendOlympiadInfo(player);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : _instance.getPlayers())
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
player.setOlympiadStart(false);
|
||||
_task.getGame().sendOlympiadInfo(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateZoneStatusForCharactersInside()
|
||||
{
|
||||
if (_task == null)
|
||||
@@ -135,15 +159,16 @@ public class OlympiadStadium
|
||||
}
|
||||
|
||||
final boolean battleStarted = _task.isBattleStarted();
|
||||
final SystemMessage sm;
|
||||
if (battleStarted)
|
||||
{
|
||||
sm = new SystemMessage(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = new SystemMessage(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
|
||||
}
|
||||
final boolean battleEnded = _task.isBattleFinished();
|
||||
// final SystemMessage sm;
|
||||
// if (battleStarted)
|
||||
// {
|
||||
// sm = new SystemMessage(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// sm = new SystemMessage(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
|
||||
// }
|
||||
|
||||
for (Player player : _instance.getPlayers())
|
||||
{
|
||||
@@ -155,12 +180,16 @@ public class OlympiadStadium
|
||||
if (battleStarted)
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, true);
|
||||
player.sendPacket(sm);
|
||||
// player.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
player.sendPacket(sm);
|
||||
// player.sendPacket(sm);
|
||||
// player.sendPacket(ExOlympiadMatchEnd.STATIC_PACKET);
|
||||
}
|
||||
if (battleEnded)
|
||||
{
|
||||
player.sendPacket(ExOlympiadMatchEnd.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
@@ -71,7 +71,10 @@ public enum CommonSkill
|
||||
EINHASAD_OVERSEEING_3(29413, 3),
|
||||
EINHASAD_OVERSEEING_4(29413, 4),
|
||||
EINHASAD_CHAINS(29414, 1),
|
||||
TELEPORTATION_CUBE(39723, 1);
|
||||
TELEPORTATION_CUBE(39723, 1),
|
||||
OLYMPIAD_MELODY(34247, 1),
|
||||
OLYMPIAD_HARMONY(32415, 1),
|
||||
OLYMPIAD_WIN(32417, 1);
|
||||
|
||||
private final SkillHolder _holder;
|
||||
|
||||
|
@@ -130,11 +130,16 @@ public class SkillCaster implements Runnable
|
||||
*/
|
||||
public static SkillCaster castSkill(Creature caster, WorldObject target, Skill skill, Item item, SkillCastingType castingType, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
// Prevent players from attacking before the Olympiad countdown ends. Olympiad Manager NPC is excluded.
|
||||
if (caster.isPlayer() && caster.getActingPlayer().isInOlympiadMode() && !caster.getActingPlayer().isOlympiadStart() && skill.isBad() && (target != null) && (target.getId() != 36402))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// Prevent players from attacking before the Olympiad countdown ends. Olympiad Manager NPC is excluded.
|
||||
if (caster.isPlayer() && caster.getActingPlayer().isInOlympiadMode() && !caster.getActingPlayer().isOlympiadStart() && skill.isBad())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return castSkill(caster, target, skill, item, castingType, ctrlPressed, shiftPressed, -1);
|
||||
}
|
||||
|
||||
|
@@ -133,16 +133,16 @@ public interface IStatFunction
|
||||
{
|
||||
if (item.isWeapon())
|
||||
{
|
||||
if ((Config.ALT_OLY_WEAPON_ENCHANT_LIMIT >= 0) && (enchant > Config.ALT_OLY_WEAPON_ENCHANT_LIMIT))
|
||||
if ((Config.OLYMPIAD_WEAPON_ENCHANT_LIMIT >= 0) && (enchant > Config.OLYMPIAD_WEAPON_ENCHANT_LIMIT))
|
||||
{
|
||||
enchant = Config.ALT_OLY_WEAPON_ENCHANT_LIMIT;
|
||||
enchant = Config.OLYMPIAD_WEAPON_ENCHANT_LIMIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Config.ALT_OLY_ARMOR_ENCHANT_LIMIT >= 0) && (enchant > Config.ALT_OLY_ARMOR_ENCHANT_LIMIT))
|
||||
if ((Config.OLYMPIAD_ARMOR_ENCHANT_LIMIT >= 0) && (enchant > Config.OLYMPIAD_ARMOR_ENCHANT_LIMIT))
|
||||
{
|
||||
enchant = Config.ALT_OLY_ARMOR_ENCHANT_LIMIT;
|
||||
enchant = Config.OLYMPIAD_ARMOR_ENCHANT_LIMIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -71,6 +71,7 @@ public class PlayerVariables extends AbstractVariables
|
||||
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
||||
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
||||
public static final String HUNTING_ZONE_REMAIN_REFILL = "HUNTING_ZONE_REMAIN_REFILL_";
|
||||
public static final String IS_LEGEND = "IS_LEGEND";
|
||||
public static final String FAVORITE_TELEPORTS = "FAVORITE_TELEPORTS";
|
||||
public static final String HOMUNCULUS_HP_POINTS = "HOMUNCULUS_HP_POINTS";
|
||||
public static final String HOMUNCULUS_SP_POINTS = "HOMUNCULUS_SP_POINTS";
|
||||
|
@@ -34,7 +34,7 @@ import org.l2jmobius.gameserver.model.zone.AbstractZoneSettings;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneRespawn;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadMatchEnd;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMatchEnd;
|
||||
|
||||
/**
|
||||
* An olympiad stadium
|
||||
|
@@ -122,6 +122,12 @@ import org.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMenteeAdd
|
||||
import org.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMenteeWaitingList;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMentorCancel;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMentorList;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.olympiad.OlympiadMatchMaking;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.olympiad.OlympiadMatchMakingCancel;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.olympiad.OlympiadUI;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.olympiad.RequestExOlympiadMatchListRefresh;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.olympiad.RequestOlympiadMatchList;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.olympiad.RequestOlympiadObserverEnd;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pk.RequestExPkPenaltyList;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pk.RequestExPkPenaltyListOnlyLoc;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeAnnounce;
|
||||
@@ -557,8 +563,8 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
EX_PAYBACK_LIST(0x175, null, ConnectionState.IN_GAME),
|
||||
EX_PAYBACK_GIVE_REWARD(0x176, null, ConnectionState.IN_GAME),
|
||||
EX_AUTOPLAY_SETTING(0x177, ExAutoPlaySetting::new, ConnectionState.IN_GAME),
|
||||
EX_OLYMPIAD_MATCH_MAKING(0x178, null, ConnectionState.IN_GAME),
|
||||
EX_OLYMPIAD_MATCH_MAKING_CANCEL(0x179, null, ConnectionState.IN_GAME),
|
||||
EX_OLYMPIAD_MATCH_MAKING(0x178, OlympiadMatchMaking::new, ConnectionState.IN_GAME),
|
||||
EX_OLYMPIAD_MATCH_MAKING_CANCEL(0x179, OlympiadMatchMakingCancel::new, ConnectionState.IN_GAME),
|
||||
EX_FESTIVAL_BM_INFO(0x17A, null, ConnectionState.IN_GAME),
|
||||
EX_FESTIVAL_BM_GAME(0x17B, null, ConnectionState.IN_GAME),
|
||||
EX_GACHA_SHOP_INFO(0x17C, null, ConnectionState.IN_GAME),
|
||||
@@ -597,7 +603,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
EX_CRAFT_RANDOM_MAKE(0x19D, null, ConnectionState.IN_GAME),
|
||||
EX_MULTI_SELL_LIST(0x19E, null, ConnectionState.IN_GAME),
|
||||
EX_SAVE_ITEM_ANNOUNCE_SETTING(0x19F, ExSaveItemAnnounceSetting::new, ConnectionState.IN_GAME),
|
||||
EX_OLYMPIAD_UI(0x1A0, null, ConnectionState.IN_GAME),
|
||||
EX_OLYMPIAD_UI(0x1A0, OlympiadUI::new, ConnectionState.IN_GAME),
|
||||
// 270
|
||||
EX_SHARED_POSITION_SHARING_UI(0x1A1, null, ConnectionState.IN_GAME),
|
||||
EX_SHARED_POSITION_TELEPORT_UI(0x1A2, null, ConnectionState.IN_GAME),
|
||||
|
@@ -55,6 +55,7 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.item.type.EtcItemType;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
@@ -120,6 +121,7 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPoi
|
||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusReady;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExBloodyCoinCount;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.settings.ExItemAnnounceSetting;
|
||||
import org.l2jmobius.gameserver.util.BuilderUtil;
|
||||
|
||||
@@ -644,6 +646,12 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
player.sendMessage("Experience gain is disabled.");
|
||||
}
|
||||
|
||||
// Send packet that olympiad is opened.
|
||||
if (Config.OLYMPIAD_ENABLED && Olympiad.getInstance().inCompPeriod())
|
||||
{
|
||||
player.sendPacket(new ExOlympiadInfo(1));
|
||||
}
|
||||
|
||||
player.updateSymbolSealSkills();
|
||||
|
||||
player.broadcastUserInfo();
|
||||
|
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.network.clientpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMatchMakingResult;
|
||||
|
||||
public class OlympiadMatchMaking implements IClientIncomingPacket
|
||||
{
|
||||
private byte _gameRuleType;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_gameRuleType = (byte) packet.readC();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final Player player = client.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExOlympiadMatchMakingResult(_gameRuleType, 1));
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.network.clientpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMatchMakingResult;
|
||||
|
||||
public class OlympiadMatchMakingCancel implements IClientIncomingPacket
|
||||
{
|
||||
private byte _gameRuleType;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_gameRuleType = (byte) packet.readC();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final Player player = client.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExOlympiadMatchMakingResult(_gameRuleType, 0));
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.network.clientpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadRecord;
|
||||
|
||||
public class OlympiadUI implements IClientIncomingPacket
|
||||
{
|
||||
private byte _gameRuleType;
|
||||
private int _type;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_gameRuleType = (byte) packet.readC();
|
||||
_type = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final Player player = client.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExOlympiadRecord(player, _gameRuleType, _type));
|
||||
}
|
||||
}
|
@@ -14,12 +14,13 @@
|
||||
* 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.network.clientpackets;
|
||||
package org.l2jmobius.gameserver.network.clientpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadMatchList;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMatchList;
|
||||
|
||||
/**
|
||||
* Format: (ch)d d: unknown (always 0?)
|
@@ -14,13 +14,14 @@
|
||||
* 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.network.clientpackets;
|
||||
package org.l2jmobius.gameserver.network.clientpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.handler.BypassHandler;
|
||||
import org.l2jmobius.gameserver.handler.IBypassHandler;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
|
||||
/**
|
||||
* format ch c: (id) 0xD0 h: (subid) 0x13
|
@@ -14,11 +14,12 @@
|
||||
* 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.network.clientpackets;
|
||||
package org.l2jmobius.gameserver.network.clientpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
|
||||
/**
|
||||
* format ch c: (id) 0xD0 h: (subid) 0x12
|
@@ -196,7 +196,7 @@ public class CharInfo implements IClientOutgoingPacket
|
||||
packet.writeC(_player.getTeam().getId()); // Confirmed
|
||||
packet.writeD(_player.getClanCrestLargeId());
|
||||
packet.writeC(_player.getNobleLevel()); // Confirmed
|
||||
packet.writeC(_player.isHero() || (_player.isGM() && Config.GM_HERO_AURA) ? 2 : 0); // 152 - Value for enabled changed to 2?
|
||||
packet.writeC(_player.isLegend() ? 4 : _player.isHero() || (_player.isGM() && Config.GM_HERO_AURA) ? 2 : 0); // 152 - Value for enabled changed to 2? 4 = legend
|
||||
|
||||
packet.writeC(_player.isFishing() ? 1 : 0); // Confirmed
|
||||
final ILocational baitLocation = _player.getFishing().getBaitLocation();
|
||||
|
@@ -298,7 +298,7 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
|
||||
packet.writeC(_player.getPvpFlag());
|
||||
packet.writeD(_player.getReputation()); // Reputation
|
||||
packet.writeC(_player.getNobleLevel());
|
||||
packet.writeC(_player.isHero() || (_player.isGM() && Config.GM_HERO_AURA) ? 2 : 0); // 152 - Value for enabled changed to 2?
|
||||
packet.writeC(_player.isLegend() ? 4 : _player.isHero() || (_player.isGM() && Config.GM_HERO_AURA) ? 2 : 0); // 152 - Value for enabled changed to 2? 4 = legend
|
||||
packet.writeC(_player.getPledgeClass());
|
||||
packet.writeD(_player.getPkKills());
|
||||
packet.writeD(_player.getPvpKills());
|
||||
|
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.network.serverpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
public class ExOlympiadInfo implements IClientOutgoingPacket
|
||||
{
|
||||
private static int _open;
|
||||
|
||||
public ExOlympiadInfo(int open)
|
||||
{
|
||||
_open = open;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_OLYMPIAD_INFO.writeId(packet);
|
||||
packet.writeC(_open);
|
||||
packet.writeD(0); // RemainTime
|
||||
packet.writeC(1); // GameRuleType
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -14,10 +14,11 @@
|
||||
* 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.network.serverpackets;
|
||||
package org.l2jmobius.gameserver.network.serverpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author GodKratos
|
||||
@@ -36,4 +37,4 @@ public class ExOlympiadMatchEnd implements IClientOutgoingPacket
|
||||
OutgoingPackets.EX_OLYMPIAD_MATCH_END.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.network.serverpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExOlympiadMatchInfo implements IClientOutgoingPacket
|
||||
{
|
||||
private final String _name1;
|
||||
private final String _name2;
|
||||
private final int _wins1;
|
||||
private final int _wins2;
|
||||
private final int _round;
|
||||
private final int _time;
|
||||
|
||||
public ExOlympiadMatchInfo(String name1, String name2, int wins1, int wins2, int round, int time)
|
||||
{
|
||||
_name1 = name1;
|
||||
_name2 = name2;
|
||||
_wins1 = wins1;
|
||||
_wins2 = wins2;
|
||||
_round = round;
|
||||
_time = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_OLYMPIAD_MATCH_INFO.writeId(packet);
|
||||
packet.writeS(String.format("%1$-" + 23 + "s", _name2));
|
||||
packet.writeD(_wins2);
|
||||
packet.writeS(String.format("%1$-" + 23 + "s", _name1));
|
||||
packet.writeD(_wins1);
|
||||
packet.writeD(_round);
|
||||
packet.writeD(_time); // Seconds
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.network.serverpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
public class ExOlympiadMatchInfoEnd implements IClientOutgoingPacket
|
||||
{
|
||||
public static final ExOlympiadMatchInfoEnd STATIC_PACKET = new ExOlympiadMatchInfoEnd();
|
||||
|
||||
private ExOlympiadMatchInfoEnd()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_OLYMPIAD_MATCH_INFO.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -14,7 +14,7 @@
|
||||
* 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.network.serverpackets;
|
||||
package org.l2jmobius.gameserver.network.serverpackets.olympiad;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -26,6 +26,7 @@ import org.l2jmobius.gameserver.model.olympiad.OlympiadGameManager;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameNonClassed;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadGameTask;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
@@ -55,15 +56,19 @@ public class ExOlympiadMatchList implements IClientOutgoingPacket
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_RECEIVE_OLYMPIAD.writeId(packet);
|
||||
|
||||
packet.writeD(0); // Type 0 = Match List, 1 = Match Result
|
||||
|
||||
packet.writeD(_games.size());
|
||||
packet.writeD(0);
|
||||
|
||||
for (OlympiadGameTask curGame : _games)
|
||||
{
|
||||
final AbstractOlympiadGame game = curGame.getGame();
|
||||
if (game != null)
|
||||
{
|
||||
packet.writeD(game.getStadiumId()); // Stadium Id (Arena 1 = 0)
|
||||
|
||||
if (game instanceof OlympiadGameNonClassed)
|
||||
{
|
||||
packet.writeD(1);
|
||||
@@ -76,6 +81,7 @@ public class ExOlympiadMatchList implements IClientOutgoingPacket
|
||||
{
|
||||
packet.writeD(0);
|
||||
}
|
||||
|
||||
packet.writeD(curGame.isRunning() ? 2 : 1); // (1 = Standby, 2 = Playing)
|
||||
packet.writeS(game.getPlayerNames()[0]); // Player 1 Name
|
||||
packet.writeS(game.getPlayerNames()[1]); // Player 2 Name
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.network.serverpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
public class ExOlympiadMatchMakingResult implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _gameRuleType;
|
||||
private final int _type;
|
||||
|
||||
public ExOlympiadMatchMakingResult(int cGameRuleType, int type)
|
||||
{
|
||||
_gameRuleType = 0;
|
||||
_type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_OLYMPIAD_INFO.writeId(packet);
|
||||
packet.writeC(_type);
|
||||
packet.writeD(_gameRuleType);
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -14,13 +14,14 @@
|
||||
* 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.network.serverpackets;
|
||||
package org.l2jmobius.gameserver.network.serverpackets.olympiad;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadInfo;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author JIV
|
||||
@@ -32,8 +33,11 @@ public class ExOlympiadMatchResult implements IClientOutgoingPacket
|
||||
private int _loseTeam = 2;
|
||||
private final List<OlympiadInfo> _winnerList;
|
||||
private final List<OlympiadInfo> _loserList;
|
||||
private final int _round1winner;
|
||||
private final int _round2winner;
|
||||
private final int _round3winner;
|
||||
|
||||
public ExOlympiadMatchResult(boolean tie, int winTeam, List<OlympiadInfo> winnerList, List<OlympiadInfo> loserList)
|
||||
public ExOlympiadMatchResult(boolean tie, int winTeam, List<OlympiadInfo> winnerList, List<OlympiadInfo> loserList, int round1winner, int round2winner, int round3winner)
|
||||
{
|
||||
_tie = tie;
|
||||
_winTeam = winTeam;
|
||||
@@ -47,13 +51,16 @@ public class ExOlympiadMatchResult implements IClientOutgoingPacket
|
||||
{
|
||||
_winTeam = 1;
|
||||
}
|
||||
_round1winner = round1winner;
|
||||
_round2winner = round2winner;
|
||||
_round3winner = round3winner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_RECEIVE_OLYMPIAD.writeId(packet);
|
||||
packet.writeD(1); // Type 0 = Match List, 1 = Match Result
|
||||
packet.writeD(2); // Type 0 = Match List, 1 = Match Result, 2 = New Oly look, 3 = 3v3
|
||||
packet.writeD(_tie ? 1 : 0); // 0 - win, 1 - tie
|
||||
packet.writeS(_winnerList.get(0).getName());
|
||||
packet.writeD(_winTeam);
|
||||
@@ -82,6 +89,11 @@ public class ExOlympiadMatchResult implements IClientOutgoingPacket
|
||||
packet.writeD(info.getDiffPoints());
|
||||
packet.writeD(0); // Helios
|
||||
}
|
||||
packet.writeC(_round1winner); // Round 1 outcome
|
||||
packet.writeC(_round2winner); // Round 2 outcome
|
||||
packet.writeC(_round3winner); // Round 3 outcome
|
||||
packet.writeD(15); // Bonus Reward
|
||||
packet.writeD(0); // Bonus Reward for looser
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -14,22 +14,24 @@
|
||||
* 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.network.serverpackets;
|
||||
package org.l2jmobius.gameserver.network.serverpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.enums.OlympiadMode;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author godson
|
||||
*/
|
||||
public class ExOlympiadMode implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _mode;
|
||||
private final OlympiadMode _mode;
|
||||
|
||||
/**
|
||||
* @param mode (0 = return, 3 = spectate)
|
||||
*/
|
||||
public ExOlympiadMode(int mode)
|
||||
public ExOlympiadMode(OlympiadMode mode)
|
||||
{
|
||||
_mode = mode;
|
||||
}
|
||||
@@ -38,7 +40,7 @@ public class ExOlympiadMode implements IClientOutgoingPacket
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_OLYMPIAD_MODE.writeId(packet);
|
||||
packet.writeC(_mode);
|
||||
packet.writeC(_mode.ordinal());
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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.network.serverpackets.olympiad;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.instancemanager.RankManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.PacketLogger;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
public class ExOlympiadRecord implements IClientOutgoingPacket
|
||||
{
|
||||
private static final String GET_PREVIOUS_CYCLE_DATA = "SELECT charId, class_id, olympiad_points, competitions_won, competitions_lost FROM olympiad_nobles_eom WHERE class_id = ? ORDER BY olympiad_points DESC LIMIT " + RankManager.PLAYER_LIMIT;
|
||||
|
||||
private final Player _player;
|
||||
private final int _gameRuleType;
|
||||
private final int _type;
|
||||
|
||||
public ExOlympiadRecord(Player player, int cGameRuleType, int type)
|
||||
{
|
||||
_player = player;
|
||||
_gameRuleType = cGameRuleType;
|
||||
_type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_OLYMPIAD_RECORD.writeId(packet);
|
||||
packet.writeD(Olympiad.getInstance().getNoblePoints(_player)); // nPoint
|
||||
packet.writeD(Olympiad.getInstance().getCompetitionWon(_player.getObjectId())); // nWinCount
|
||||
packet.writeD(Olympiad.getInstance().getCompetitionLost(_player.getObjectId())); // nLoseCount
|
||||
packet.writeD(Olympiad.getInstance().getRemainingWeeklyMatches(_player.getObjectId())); // nMatchCount
|
||||
// Previous Cycle
|
||||
int previousPlace = 0;
|
||||
int previousWins = 0;
|
||||
int previousLoses = 0;
|
||||
int previousPoints = 0;
|
||||
int previousClass = 0;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(GET_PREVIOUS_CYCLE_DATA))
|
||||
{
|
||||
statement.setInt(1, _player.getBaseClass());
|
||||
try (ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
int i = 1;
|
||||
while (rset.next())
|
||||
{
|
||||
if (rset.getInt("charId") == _player.getObjectId())
|
||||
{
|
||||
previousPlace = i;
|
||||
previousWins = rset.getInt("competitions_won");
|
||||
previousLoses = rset.getInt("competitions_lost");
|
||||
previousPoints = rset.getInt("olympiad_points");
|
||||
previousClass = rset.getInt("class_id");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
PacketLogger.warning("Olympiad my ranking: Couldnt load data: " + e.getMessage());
|
||||
}
|
||||
|
||||
packet.writeD(previousClass); // nPrevClassType
|
||||
packet.writeD(1); // nPrevRank in all servers
|
||||
packet.writeD(2); // nPrevRankCount number of participants with 25+ matches
|
||||
packet.writeD(previousPlace); // nPrevClassRank in all servers
|
||||
packet.writeD(4); // nPrevClassRankCount number of participants with 25+ matches
|
||||
packet.writeD(5); // nPrevClassRankByServer in current server
|
||||
packet.writeD(6); // nPrevClassRankByServerCount number of participants with 25+ matches
|
||||
packet.writeD(previousPoints); // nPrevPoint
|
||||
packet.writeD(previousWins); // nPrevWinCount
|
||||
packet.writeD(previousLoses); // nPrevLoseCount
|
||||
packet.writeD(previousPlace); // nPrevGrade
|
||||
packet.writeD(Calendar.getInstance().get(Calendar.YEAR)); // nSeasonYear
|
||||
packet.writeD(Calendar.getInstance().get(Calendar.MONTH) + 1); // nSeasonMonth
|
||||
packet.writeC(Olympiad.getInstance().inCompPeriod() ? 1 : 0); // bMatchOpen
|
||||
packet.writeD(Olympiad.getInstance().getCurrentCycle()); // nSeason
|
||||
packet.writeC(_type); // bRegistered
|
||||
packet.writeD(_gameRuleType); // cGameRuleType
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -14,7 +14,7 @@
|
||||
* 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.network.serverpackets;
|
||||
package org.l2jmobius.gameserver.network.serverpackets.olympiad;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -24,6 +24,7 @@ import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.skill.BuffInfo;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author godson
|
||||
@@ -53,6 +54,7 @@ public class ExOlympiadSpelledInfo implements IClientOutgoingPacket
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_OLYMPIAD_SPELLED_INFO.writeId(packet);
|
||||
|
||||
packet.writeD(_playerId);
|
||||
packet.writeD(_effects.size() + _effects2.size());
|
||||
for (BuffInfo info : _effects)
|
||||
@@ -61,7 +63,7 @@ public class ExOlympiadSpelledInfo implements IClientOutgoingPacket
|
||||
{
|
||||
packet.writeD(info.getSkill().getDisplayId());
|
||||
packet.writeH(info.getSkill().getDisplayLevel());
|
||||
packet.writeH(0); // Sub level
|
||||
packet.writeH(0x00); // Sub level
|
||||
packet.writeD(info.getSkill().getAbnormalType().getClientId());
|
||||
writeOptionalD(packet, info.getSkill().isAura() ? -1 : info.getTime());
|
||||
}
|
||||
@@ -72,7 +74,7 @@ public class ExOlympiadSpelledInfo implements IClientOutgoingPacket
|
||||
{
|
||||
packet.writeD(skill.getDisplayId());
|
||||
packet.writeH(skill.getDisplayLevel());
|
||||
packet.writeH(0); // Sub level
|
||||
packet.writeH(0x00); // Sub level
|
||||
packet.writeD(skill.getAbnormalType().getClientId());
|
||||
packet.writeH(-1);
|
||||
}
|
@@ -14,12 +14,13 @@
|
||||
* 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.network.serverpackets;
|
||||
package org.l2jmobius.gameserver.network.serverpackets.olympiad;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.olympiad.Participant;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author godson
|
||||
@@ -76,6 +77,7 @@ public class ExOlympiadUserInfo implements IClientOutgoingPacket
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_OLYMPIAD_USER_INFO.writeId(packet);
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
packet.writeC(_player.getOlympiadSide());
|
||||
@@ -90,6 +92,7 @@ public class ExOlympiadUserInfo implements IClientOutgoingPacket
|
||||
packet.writeS(_par.getName());
|
||||
packet.writeD(_par.getBaseClass());
|
||||
}
|
||||
|
||||
packet.writeD(_curHp);
|
||||
packet.writeD(_maxHp);
|
||||
packet.writeD(_curCp);
|
Reference in New Issue
Block a user