Merged with released L2J-Unity files.

This commit is contained in:
mobiusdev
2016-06-12 01:34:09 +00:00
parent e003e87887
commit 635557f5da
18352 changed files with 3245113 additions and 2892959 deletions

View File

@@ -1,41 +1,40 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.olympiad;
/**
* @author DS
*/
public enum CompetitionType
{
CLASSED("classed"),
NON_CLASSED("non-classed"),
TEAMS("teams"),
OTHER("other");
private final String _name;
private CompetitionType(String name)
{
_name = name;
}
@Override
public final String toString()
{
return _name;
}
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
/**
* @author DS
*/
public enum CompetitionType
{
CLASSED("classed"),
NON_CLASSED("non-classed"),
OTHER("other");
private final String _name;
CompetitionType(String name)
{
_name = name;
}
@Override
public final String toString()
{
return _name;
}
}

View File

@@ -1,97 +1,81 @@
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.Set;
import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.NpcSay;
/**
* @author DS
*/
public final class OlympiadAnnouncer implements Runnable
{
private static final int OLY_MANAGER = 31688;
private final Set<L2Spawn> _managers;
private int _currentStadium = 0;
public OlympiadAnnouncer()
{
_managers = SpawnTable.getInstance().getSpawns(OLY_MANAGER);
}
@Override
public void run()
{
OlympiadGameTask task;
for (int i = OlympiadGameManager.getInstance().getNumberOfStadiums(); --i >= 0; _currentStadium++)
{
if (_currentStadium >= OlympiadGameManager.getInstance().getNumberOfStadiums())
{
_currentStadium = 0;
}
task = OlympiadGameManager.getInstance().getOlympiadTask(_currentStadium);
if ((task != null) && (task.getGame() != null) && task.needAnnounce())
{
NpcStringId npcString;
final String arenaId = String.valueOf(task.getGame().getStadiumId() + 1);
switch (task.getGame().getType())
{
case NON_CLASSED:
{
npcString = NpcStringId.OLYMPIAD_CLASS_FREE_INDIVIDUAL_MATCH_IS_GOING_TO_BEGIN_IN_ARENA_S1_IN_A_MOMENT;
break;
}
case CLASSED:
{
npcString = NpcStringId.OLYMPIAD_CLASS_INDIVIDUAL_MATCH_IS_GOING_TO_BEGIN_IN_ARENA_S1_IN_A_MOMENT;
break;
}
case TEAMS:
{
npcString = NpcStringId.OLYMPIAD_ALL_CLASS_BATTLE_IS_GOING_TO_BEGIN_IN_ARENA_S1_IN_A_MOMENT;
break;
}
default:
{
continue;
}
}
L2Npc manager;
NpcSay packet;
for (L2Spawn spawn : _managers)
{
manager = spawn.getLastSpawn();
if (manager != null)
{
packet = new NpcSay(manager.getObjectId(), ChatType.NPC_SHOUT, manager.getId(), npcString);
packet.addStringParameter(arenaId);
manager.broadcastPacket(packet);
}
}
break;
}
}
}
}
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.Set;
import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.network.NpcStringId;
/**
* @author DS
*/
public final class OlympiadAnnouncer implements Runnable
{
private static final int OLY_MANAGER = 31688;
private final Set<L2Spawn> _managers;
private int _currentStadium = 0;
public OlympiadAnnouncer()
{
_managers = SpawnTable.getInstance().getSpawns(OLY_MANAGER);
}
@Override
public void run()
{
OlympiadGameTask task;
for (int i = OlympiadGameManager.getInstance().getNumberOfStadiums(); --i >= 0; _currentStadium++)
{
if (_currentStadium >= OlympiadGameManager.getInstance().getNumberOfStadiums())
{
_currentStadium = 0;
}
task = OlympiadGameManager.getInstance().getOlympiadTask(_currentStadium);
if ((task != null) && (task.getGame() != null) && task.needAnnounce())
{
NpcStringId npcString;
final String arenaId = String.valueOf(task.getGame().getStadiumId() + 1);
switch (task.getGame().getType())
{
case NON_CLASSED:
npcString = NpcStringId.OLYMPIAD_CLASS_FREE_INDIVIDUAL_MATCH_IS_GOING_TO_BEGIN_IN_ARENA_S1_IN_A_MOMENT;
break;
case CLASSED:
npcString = NpcStringId.OLYMPIAD_CLASS_INDIVIDUAL_MATCH_IS_GOING_TO_BEGIN_IN_ARENA_S1_IN_A_MOMENT;
break;
default:
continue;
}
for (L2Spawn spawn : _managers)
{
final L2Npc manager = spawn.getLastSpawn();
if (manager != null)
{
manager.broadcastSay(ChatType.NPC_SHOUT, npcString, arenaId);
}
}
break;
}
}
}
}

View File

@@ -1,87 +1,89 @@
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.List;
import com.l2jmobius.Config;
import com.l2jmobius.util.Rnd;
/**
* @author DS
*/
public class OlympiadGameClassed extends OlympiadGameNormal
{
private OlympiadGameClassed(int id, Participant[] opponents)
{
super(id, opponents);
}
@Override
public final CompetitionType getType()
{
return CompetitionType.CLASSED;
}
@Override
protected final int getDivider()
{
return Config.ALT_OLY_DIVIDER_CLASSED;
}
@Override
protected final int[][] getReward()
{
return Config.ALT_OLY_CLASSED_REWARD;
}
@Override
protected final String getWeeklyMatchType()
{
return COMP_DONE_WEEK_CLASSED;
}
protected static OlympiadGameClassed createGame(int id, List<List<Integer>> classList)
{
if ((classList == null) || classList.isEmpty())
{
return null;
}
List<Integer> list;
Participant[] opponents;
while (!classList.isEmpty())
{
list = classList.get(Rnd.nextInt(classList.size()));
if ((list == null) || (list.size() < 2))
{
classList.remove(list);
continue;
}
opponents = OlympiadGameNormal.createListOfParticipants(list);
if (opponents == null)
{
classList.remove(list);
continue;
}
return new OlympiadGameClassed(id, opponents);
}
return null;
}
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.List;
import java.util.Set;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
/**
* @author DS
*/
public class OlympiadGameClassed extends OlympiadGameNormal
{
private OlympiadGameClassed(int id, Participant[] opponents)
{
super(id, opponents);
}
@Override
public final CompetitionType getType()
{
return CompetitionType.CLASSED;
}
@Override
protected final int getDivider()
{
return Config.ALT_OLY_DIVIDER_CLASSED;
}
@Override
protected final List<ItemHolder> getReward()
{
return Config.ALT_OLY_CLASSED_REWARD;
}
@Override
protected final String getWeeklyMatchType()
{
return COMP_DONE_WEEK_CLASSED;
}
protected static OlympiadGameClassed createGame(int id, List<Set<Integer>> classList)
{
if ((classList == null) || classList.isEmpty())
{
return null;
}
Set<Integer> list;
Participant[] opponents;
while (!classList.isEmpty())
{
list = classList.get(Rnd.nextInt(classList.size()));
if ((list == null) || (list.size() < 2))
{
classList.remove(list);
continue;
}
opponents = OlympiadGameNormal.createListOfParticipants(list);
if (opponents == null)
{
classList.remove(list);
continue;
}
return new OlympiadGameClassed(id, opponents);
}
return null;
}
}

View File

@@ -1,203 +1,256 @@
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.zone.type.L2OlympiadStadiumZone;
/**
* @author GodKratos, DS
*/
public class OlympiadGameManager implements Runnable
{
private static final Logger _log = Logger.getLogger(OlympiadGameManager.class.getName());
private volatile boolean _battleStarted = false;
private final OlympiadGameTask[] _tasks;
protected OlympiadGameManager()
{
final Collection<L2OlympiadStadiumZone> zones = ZoneManager.getInstance().getAllZones(L2OlympiadStadiumZone.class);
if ((zones == null) || zones.isEmpty())
{
throw new Error("No olympiad stadium zones defined !");
}
_tasks = new OlympiadGameTask[zones.size()];
int i = 0;
for (L2OlympiadStadiumZone zone : zones)
{
_tasks[i++] = new OlympiadGameTask(zone);
}
_log.log(Level.INFO, "Olympiad System: Loaded " + _tasks.length + " stadiums.");
}
public static OlympiadGameManager getInstance()
{
return SingletonHolder._instance;
}
protected final boolean isBattleStarted()
{
return _battleStarted;
}
protected final void startBattle()
{
_battleStarted = true;
}
@Override
public final void run()
{
if (Olympiad.getInstance().isOlympiadEnd())
{
return;
}
if (Olympiad.getInstance().inCompPeriod())
{
OlympiadGameTask task;
AbstractOlympiadGame newGame;
List<List<Integer>> readyClassed = OlympiadManager.getInstance().hasEnoughRegisteredClassed();
boolean readyNonClassed = OlympiadManager.getInstance().hasEnoughRegisteredNonClassed();
boolean readyTeams = OlympiadManager.getInstance().hasEnoughRegisteredTeams();
if ((readyClassed != null) || readyNonClassed || readyTeams)
{
// set up the games queue
for (int i = 0; i < _tasks.length; i++)
{
task = _tasks[i];
synchronized (task)
{
if (!task.isRunning())
{
// Fair arena distribution
// 0,2,4,6,8.. arenas checked for classed or teams first
if (((readyClassed != null) || readyTeams) && ((i % 2) == 0))
{
// 0,4,8.. arenas checked for teams first
if (readyTeams && ((i % 4) == 0))
{
newGame = OlympiadGameTeams.createGame(i, OlympiadManager.getInstance().getRegisteredTeamsBased());
if (newGame != null)
{
task.attachGame(newGame);
continue;
}
readyTeams = false;
}
// if no ready teams found check for classed
if (readyClassed != null)
{
newGame = OlympiadGameClassed.createGame(i, readyClassed);
if (newGame != null)
{
task.attachGame(newGame);
continue;
}
readyClassed = null;
}
}
// 1,3,5,7,9.. arenas used for non-classed
// also other arenas will be used for non-classed if no classed or teams available
if (readyNonClassed)
{
newGame = OlympiadGameNonClassed.createGame(i, OlympiadManager.getInstance().getRegisteredNonClassBased());
if (newGame != null)
{
task.attachGame(newGame);
continue;
}
readyNonClassed = false;
}
}
}
// stop generating games if no more participants
if ((readyClassed == null) && !readyNonClassed && !readyTeams)
{
break;
}
}
}
}
// not in competition period
else if (isAllTasksFinished())
{
OlympiadManager.getInstance().clearRegistered();
_battleStarted = false;
_log.log(Level.INFO, "Olympiad System: All current games finished.");
}
}
public final boolean isAllTasksFinished()
{
for (OlympiadGameTask task : _tasks)
{
if (task.isRunning())
{
return false;
}
}
return true;
}
public final OlympiadGameTask getOlympiadTask(int id)
{
return (id < 0) || (id >= _tasks.length) ? null : _tasks[id];
}
public final int getNumberOfStadiums()
{
return _tasks.length;
}
public final void notifyCompetitorDamage(L2PcInstance player, int damage)
{
if (player == null)
{
return;
}
final int id = player.getOlympiadGameId();
if ((id < 0) || (id >= _tasks.length))
{
return;
}
final AbstractOlympiadGame game = _tasks[id].getGame();
if (game != null)
{
game.addDamage(player, damage);
}
}
private static class SingletonHolder
{
protected static final OlympiadGameManager _instance = new OlympiadGameManager();
}
}
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.zone.type.L2OlympiadStadiumZone;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* @author GodKratos, DS
*/
public class OlympiadGameManager implements Runnable
{
private static final Logger _log = Logger.getLogger(OlympiadGameManager.class.getName());
private static final int STADIUM_COUNT = 80; // TODO dynamic
private volatile boolean _battleStarted = false;
private final List<OlympiadStadium> _tasks;
private int _delay = 0;
protected OlympiadGameManager()
{
final Collection<L2OlympiadStadiumZone> zones = ZoneManager.getInstance().getAllZones(L2OlympiadStadiumZone.class);
if ((zones == null) || zones.isEmpty())
{
throw new Error("No olympiad stadium zones defined !");
}
final L2OlympiadStadiumZone[] array = zones.toArray(new L2OlympiadStadiumZone[zones.size()]);
_tasks = new ArrayList<>(STADIUM_COUNT);
final int zonesCount = array.length;
for (int i = 0; i < STADIUM_COUNT; i++)
{
final OlympiadStadium stadium = new OlympiadStadium(array[i % zonesCount], i);
stadium.registerTask(new OlympiadGameTask(stadium));
_tasks.add(stadium);
}
_log.info("Olympiad System: Loaded " + _tasks.size() + " stadiums.");
}
public static OlympiadGameManager getInstance()
{
return SingletonHolder._instance;
}
protected final boolean isBattleStarted()
{
return _battleStarted;
}
protected final void startBattle()
{
_battleStarted = true;
}
@Override
public final void run()
{
if (Olympiad.getInstance().isOlympiadEnd())
{
return;
}
if (Olympiad.getInstance().inCompPeriod())
{
AbstractOlympiadGame newGame;
List<Set<Integer>> readyClassed = OlympiadManager.getInstance().hasEnoughRegisteredClassed();
boolean readyNonClassed = OlympiadManager.getInstance().hasEnoughRegisteredNonClassed();
if ((readyClassed != null) || readyNonClassed)
{
// reset delay broadcast
_delay = 0;
// set up the games queue
for (int i = 0; i < _tasks.size(); i++)
{
final OlympiadGameTask task = _tasks.get(i).getTask();
synchronized (task)
{
if (!task.isRunning())
{
// Fair arena distribution
// 0,2,4,6,8.. arenas checked for classed or teams first
if (readyClassed != null)
{
newGame = OlympiadGameClassed.createGame(i, readyClassed);
if (newGame != null)
{
task.attachGame(newGame);
continue;
}
readyClassed = null;
}
// 1,3,5,7,9.. arenas used for non-classed
// also other arenas will be used for non-classed if no classed or teams available
if (readyNonClassed)
{
newGame = OlympiadGameNonClassed.createGame(i, OlympiadManager.getInstance().getRegisteredNonClassBased());
if (newGame != null)
{
task.attachGame(newGame);
continue;
}
readyNonClassed = false;
}
}
}
// stop generating games if no more participants
if ((readyClassed == null) && !readyNonClassed)
{
break;
}
}
}
// olympiad is delayed
else
{
_delay++;
if (_delay >= 10) // 5min
{
for (Integer id : OlympiadManager.getInstance().getRegisteredNonClassBased())
{
if (id == null)
{
continue;
}
final L2PcInstance noble = L2World.getInstance().getPlayer(id);
if (noble != null)
{
noble.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_GAMES_MAY_BE_DELAYED_DUE_TO_AN_INSUFFICIENT_NUMBER_OF_PLAYERS_WAITING));
}
}
for (Set<Integer> list : OlympiadManager.getInstance().getRegisteredClassBased().values())
{
for (Integer id : list)
{
if (id == null)
{
continue;
}
final L2PcInstance noble = L2World.getInstance().getPlayer(id);
if (noble != null)
{
noble.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_GAMES_MAY_BE_DELAYED_DUE_TO_AN_INSUFFICIENT_NUMBER_OF_PLAYERS_WAITING));
}
}
}
_delay = 0;
}
}
}
else
{
// not in competition period
if (isAllTasksFinished())
{
OlympiadManager.getInstance().clearRegistered();
_battleStarted = false;
_log.info("Olympiad System: All current games finished.");
}
}
}
public final boolean isAllTasksFinished()
{
for (OlympiadStadium stadium : _tasks)
{
final OlympiadGameTask task = stadium.getTask();
if (task.isRunning())
{
return false;
}
}
return true;
}
public final OlympiadGameTask getOlympiadTask(int id)
{
if ((id < 0) || (id >= _tasks.size()))
{
return null;
}
return _tasks.get(id).getTask();
}
public final int getNumberOfStadiums()
{
return _tasks.size();
}
public final void notifyCompetitorDamage(L2PcInstance attacker, int damage)
{
if (attacker == null)
{
return;
}
final int id = attacker.getOlympiadGameId();
if ((id < 0) || (id >= _tasks.size()))
{
return;
}
final AbstractOlympiadGame game = _tasks.get(id).getTask().getGame();
if (game != null)
{
game.addDamage(attacker, damage);
}
}
private static class SingletonHolder
{
protected static final OlympiadGameManager _instance = new OlympiadGameManager();
}
/**
* @return the _tasks
*/
public List<OlympiadStadium> getTasks()
{
return _tasks;
}
}

View File

@@ -1,62 +1,69 @@
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.List;
import com.l2jmobius.Config;
/**
* @author DS
*/
public class OlympiadGameNonClassed extends OlympiadGameNormal
{
private OlympiadGameNonClassed(int id, Participant[] opponents)
{
super(id, opponents);
}
@Override
public final CompetitionType getType()
{
return CompetitionType.NON_CLASSED;
}
@Override
protected final int getDivider()
{
return Config.ALT_OLY_DIVIDER_NON_CLASSED;
}
@Override
protected final int[][] getReward()
{
return Config.ALT_OLY_NONCLASSED_REWARD;
}
@Override
protected final String getWeeklyMatchType()
{
return COMP_DONE_WEEK_NON_CLASSED;
}
protected static OlympiadGameNonClassed createGame(int id, List<Integer> list)
{
final Participant[] opponents = OlympiadGameNormal.createListOfParticipants(list);
return opponents == null ? null : new OlympiadGameNonClassed(id, opponents);
}
}
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.List;
import java.util.Set;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
/**
* @author DS
*/
public class OlympiadGameNonClassed extends OlympiadGameNormal
{
public OlympiadGameNonClassed(int id, Participant[] opponents)
{
super(id, opponents);
}
@Override
public final CompetitionType getType()
{
return CompetitionType.NON_CLASSED;
}
@Override
protected final int getDivider()
{
return Config.ALT_OLY_DIVIDER_NON_CLASSED;
}
@Override
protected final List<ItemHolder> getReward()
{
return Config.ALT_OLY_NONCLASSED_REWARD;
}
@Override
protected final String getWeeklyMatchType()
{
return COMP_DONE_WEEK_NON_CLASSED;
}
protected static OlympiadGameNonClassed createGame(int id, Set<Integer> list)
{
final Participant[] opponents = OlympiadGameNormal.createListOfParticipants(list);
if (opponents == null)
{
return null;
}
return new OlympiadGameNonClassed(id, opponents);
}
}

View File

@@ -1,98 +1,98 @@
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
/**
* @author JIV
*/
public class OlympiadInfo
{
private final String _name;
private final String _clan;
private final int _clanId;
private final int _classId;
private final int _dmg;
private final int _curPoints;
private final int _diffPoints;
public OlympiadInfo(String name, String clan, int clanId, int classId, int dmg, int curPoints, int diffPoints)
{
_name = name;
_clan = clan;
_clanId = clanId;
_classId = classId;
_dmg = dmg;
_curPoints = curPoints;
_diffPoints = diffPoints;
}
/**
* @return the name the player's name.
*/
public String getName()
{
return _name;
}
/**
* @return the name the player's clan name.
*/
public String getClanName()
{
return _clan;
}
/**
* @return the name the player's clan id.
*/
public int getClanId()
{
return _clanId;
}
/**
* @return the name the player's class id.
*/
public int getClassId()
{
return _classId;
}
/**
* @return the name the player's damage.
*/
public int getDamage()
{
return _dmg;
}
/**
* @return the name the player's current points.
*/
public int getCurrentPoints()
{
return _curPoints;
}
/**
* @return the name the player's points difference since this match.
*/
public int getDiffPoints()
{
return _diffPoints;
}
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
/**
* @author JIV
*/
public class OlympiadInfo
{
private final String _name;
private final String _clan;
private final int _clanId;
private final int _classId;
private final int _dmg;
private final int _curPoints;
private final int _diffPoints;
public OlympiadInfo(String name, String clan, int clanId, int classId, int dmg, int curPoints, int diffPoints)
{
_name = name;
_clan = clan;
_clanId = clanId;
_classId = classId;
_dmg = dmg;
_curPoints = curPoints;
_diffPoints = diffPoints;
}
/**
* @return the name the player's name.
*/
public String getName()
{
return _name;
}
/**
* @return the name the player's clan name.
*/
public String getClanName()
{
return _clan;
}
/**
* @return the name the player's clan id.
*/
public int getClanId()
{
return _clanId;
}
/**
* @return the name the player's class id.
*/
public int getClassId()
{
return _classId;
}
/**
* @return the name the player's damage.
*/
public int getDamage()
{
return _dmg;
}
/**
* @return the name the player's current points.
*/
public int getCurrentPoints()
{
return _curPoints;
}
/**
* @return the name the player's points difference since this match.
*/
public int getDiffPoints()
{
return _diffPoints;
}
}

View File

@@ -1,578 +1,344 @@
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import com.l2jmobius.gameserver.model.L2Party;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* @author DS
*/
public class OlympiadManager
{
private final List<Integer> _nonClassBasedRegisters;
private final Map<Integer, List<Integer>> _classBasedRegisters;
private final List<List<Integer>> _teamsBasedRegisters;
protected OlympiadManager()
{
_nonClassBasedRegisters = new CopyOnWriteArrayList<>();
_classBasedRegisters = new ConcurrentHashMap<>();
_teamsBasedRegisters = new CopyOnWriteArrayList<>();
}
public static OlympiadManager getInstance()
{
return SingletonHolder._instance;
}
public final List<Integer> getRegisteredNonClassBased()
{
return _nonClassBasedRegisters;
}
public final Map<Integer, List<Integer>> getRegisteredClassBased()
{
return _classBasedRegisters;
}
public final List<List<Integer>> getRegisteredTeamsBased()
{
return _teamsBasedRegisters;
}
protected final List<List<Integer>> hasEnoughRegisteredClassed()
{
List<List<Integer>> result = null;
for (Map.Entry<Integer, List<Integer>> classList : _classBasedRegisters.entrySet())
{
if ((classList.getValue() != null) && (classList.getValue().size() >= Config.ALT_OLY_CLASSED))
{
if (result == null)
{
result = new CopyOnWriteArrayList<>();
}
result.add(classList.getValue());
}
}
return result;
}
protected final boolean hasEnoughRegisteredNonClassed()
{
return _nonClassBasedRegisters.size() >= Config.ALT_OLY_NONCLASSED;
}
protected final boolean hasEnoughRegisteredTeams()
{
return _teamsBasedRegisters.size() >= Config.ALT_OLY_TEAMS;
}
protected final void clearRegistered()
{
_nonClassBasedRegisters.clear();
_classBasedRegisters.clear();
_teamsBasedRegisters.clear();
AntiFeedManager.getInstance().clear(AntiFeedManager.OLYMPIAD_ID);
}
public final boolean isRegistered(L2PcInstance noble)
{
return isRegistered(noble, noble, false);
}
private final boolean isRegistered(L2PcInstance noble, L2PcInstance player, boolean showMessage)
{
final Integer objId = Integer.valueOf(noble.getObjectId());
// party may be already dispersed
for (List<Integer> team : _teamsBasedRegisters)
{
if ((team != null) && team.contains(objId))
{
if (showMessage)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_3_VS_3_CLASS_IRRELEVANT_TEAM_MATCH);
sm.addPcName(noble);
player.sendPacket(sm);
}
return true;
}
}
if (_nonClassBasedRegisters.contains(objId))
{
if (showMessage)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_ALL_CLASS_BATTLE);
sm.addPcName(noble);
player.sendPacket(sm);
}
return true;
}
final List<Integer> classed = _classBasedRegisters.get(noble.getBaseClassId());
if ((classed != null) && classed.contains(objId))
{
if (showMessage)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_CLASS_MATCH_WAITING_LIST);
sm.addPcName(noble);
player.sendPacket(sm);
}
return true;
}
return false;
}
public final boolean isRegisteredInComp(L2PcInstance noble)
{
return isRegistered(noble, noble, false) || isInCompetition(noble, noble, false);
}
private final boolean isInCompetition(L2PcInstance noble, L2PcInstance player, boolean showMessage)
{
if (!Olympiad._inCompPeriod)
{
return false;
}
AbstractOlympiadGame game;
for (int i = OlympiadGameManager.getInstance().getNumberOfStadiums(); --i >= 0;)
{
game = OlympiadGameManager.getInstance().getOlympiadTask(i).getGame();
if (game == null)
{
continue;
}
if (game.containsParticipant(noble.getObjectId()))
{
if (!showMessage)
{
return true;
}
switch (game.getType())
{
case CLASSED:
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_CLASS_MATCH_WAITING_LIST);
sm.addPcName(noble);
player.sendPacket(sm);
break;
}
case NON_CLASSED:
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_ALL_CLASS_BATTLE);
sm.addPcName(noble);
player.sendPacket(sm);
break;
}
case TEAMS:
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_3_VS_3_CLASS_IRRELEVANT_TEAM_MATCH);
sm.addPcName(noble);
player.sendPacket(sm);
break;
}
}
return true;
}
}
return false;
}
public final boolean registerNoble(L2PcInstance player, CompetitionType type)
{
if (!Olympiad._inCompPeriod)
{
player.sendPacket(SystemMessageId.THE_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
return false;
}
if (Olympiad.getInstance().getMillisToCompEnd() < 600000)
{
player.sendPacket(SystemMessageId.PARTICIPATION_REQUESTS_ARE_NO_LONGER_BEING_ACCEPTED);
return false;
}
final int charId = player.getObjectId();
if (Olympiad.getInstance().getRemainingWeeklyMatches(charId) < 1)
{
player.sendPacket(SystemMessageId.THE_MAXIMUM_MATCHES_YOU_CAN_PARTICIPATE_IN_1_WEEK_IS_30);
return false;
}
switch (type)
{
case CLASSED:
{
if (!checkNoble(player, player))
{
return false;
}
if (Olympiad.getInstance().getRemainingWeeklyMatchesClassed(charId) < 1)
{
player.sendPacket(SystemMessageId.YOU_CAN_ENTER_UP_TO_50_FREE_FOR_ALL_BATTLES_AND_50_CLASS_SPECIFIC_BATTLES_PER_WEEK);
return false;
}
List<Integer> classed = _classBasedRegisters.get(player.getBaseClassId());
if (classed != null)
{
classed.add(charId);
}
else
{
classed = new CopyOnWriteArrayList<>();
classed.add(charId);
_classBasedRegisters.put(player.getBaseClassId(), classed);
}
player.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REGISTERED_FOR_THE_OLYMPIAD_WAITING_LIST_FOR_A_CLASS_BATTLE);
break;
}
case NON_CLASSED:
{
if (!checkNoble(player, player))
{
return false;
}
if (Olympiad.getInstance().getRemainingWeeklyMatchesNonClassed(charId) < 1)
{
player.sendPacket(SystemMessageId.YOU_CAN_ENTER_UP_TO_50_FREE_FOR_ALL_BATTLES_AND_50_CLASS_SPECIFIC_BATTLES_PER_WEEK);
return false;
}
_nonClassBasedRegisters.add(charId);
player.sendPacket(SystemMessageId.YOU_ARE_CURRENTLY_REGISTERED_FOR_A_1V1_CLASS_IRRELEVANT_MATCH);
break;
}
case TEAMS:
{
final L2Party party = player.getParty();
if ((party == null) || (party.getMemberCount() != 3))
{
player.sendPacket(SystemMessageId.THE_REQUEST_CANNOT_BE_MADE_BECAUSE_THE_REQUIREMENTS_HAVE_NOT_BEEN_MET_TO_PARTICIPATE_IN_A_TEAM_MATCH_YOU_MUST_FIRST_FORM_A_3_MEMBER_PARTY);
return false;
}
if (!party.isLeader(player))
{
player.sendPacket(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_REQUEST_A_TEAM_MATCH);
return false;
}
int teamPoints = 0;
final List<Integer> team = new ArrayList<>(party.getMemberCount());
for (L2PcInstance noble : party.getMembers())
{
if (!checkNoble(noble, player))
{
// remove previously registered party members
if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
{
for (L2PcInstance unreg : party.getMembers())
{
if (unreg == noble)
{
break;
}
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, unreg);
}
}
return false;
}
if (Olympiad.getInstance().getRemainingWeeklyMatchesTeam(noble.getObjectId()) < 1)
{
player.sendPacket(SystemMessageId.YOU_CAN_ENTER_UP_TO_50_FREE_FOR_ALL_BATTLES_AND_50_CLASS_SPECIFIC_BATTLES_PER_WEEK);
return false;
}
team.add(noble.getObjectId());
teamPoints += Olympiad.getInstance().getNoblePoints(noble.getObjectId());
}
if (teamPoints < 10)
{
// TODO: replace with retail message
player.sendMessage("Your team must have at least 10 points in total.");
// remove previously registered party members
if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
{
for (L2PcInstance unreg : party.getMembers())
{
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, unreg);
}
}
return false;
}
party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_ARE_CURRENTLY_REGISTERED_FOR_A_3_VS_3_CLASS_IRRELEVANT_TEAM_MATCH));
_teamsBasedRegisters.add(team);
break;
}
}
return true;
}
public final boolean unRegisterNoble(L2PcInstance noble)
{
if (!Olympiad._inCompPeriod)
{
noble.sendPacket(SystemMessageId.THE_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
return false;
}
if (!noble.isNoble())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_ONLY_NOBLESSE_EXALTED_CHARACTERS_CAN_PARTICIPATE_IN_THE_OLYMPIAD);
sm.addString(noble.getName());
noble.sendPacket(sm);
return false;
}
if (!isRegistered(noble, noble, false))
{
noble.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_REGISTERED_FOR_THE_OLYMPIAD);
return false;
}
if (isInCompetition(noble, noble, false))
{
return false;
}
final Integer objId = Integer.valueOf(noble.getObjectId());
if (_nonClassBasedRegisters.remove(objId))
{
if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
{
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);
}
noble.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REMOVED_FROM_THE_OLYMPIAD_WAITING_LIST);
return true;
}
final List<Integer> classed = _classBasedRegisters.get(noble.getBaseClassId());
if ((classed != null) && classed.remove(objId))
{
_classBasedRegisters.put(noble.getBaseClassId(), classed);
if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
{
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);
}
noble.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REMOVED_FROM_THE_OLYMPIAD_WAITING_LIST);
return true;
}
for (List<Integer> team : _teamsBasedRegisters)
{
if ((team != null) && team.contains(objId))
{
_teamsBasedRegisters.remove(team);
ThreadPoolManager.getInstance().executeGeneral(new AnnounceUnregToTeam(team));
return true;
}
}
return false;
}
public final void removeDisconnectedCompetitor(L2PcInstance player)
{
final OlympiadGameTask task = OlympiadGameManager.getInstance().getOlympiadTask(player.getOlympiadGameId());
if ((task != null) && task.isGameStarted())
{
task.getGame().handleDisconnect(player);
}
final Integer objId = Integer.valueOf(player.getObjectId());
if (_nonClassBasedRegisters.remove(objId))
{
return;
}
final List<Integer> classed = _classBasedRegisters.get(player.getBaseClassId());
if ((classed != null) && classed.remove(objId))
{
return;
}
for (List<Integer> team : _teamsBasedRegisters)
{
if ((team != null) && team.contains(objId))
{
_teamsBasedRegisters.remove(team);
ThreadPoolManager.getInstance().executeGeneral(new AnnounceUnregToTeam(team));
return;
}
}
}
/**
* @param noble - checked noble
* @param player - messages will be sent to this L2PcInstance
* @return true if all requirements are met
*/
// TODO: move to the bypass handler after reworking points system
private final boolean checkNoble(L2PcInstance noble, L2PcInstance player)
{
SystemMessage sm;
if (!noble.isNoble())
{
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_ONLY_NOBLESSE_EXALTED_CHARACTERS_CAN_PARTICIPATE_IN_THE_OLYMPIAD);
sm.addPcName(noble);
player.sendPacket(sm);
return false;
}
if (noble.isSubClassActive())
{
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_SUBCLASSES_AND_DUEL_CLASSES_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD);
sm.addPcName(noble);
player.sendPacket(sm);
return false;
}
if (noble.isCursedWeaponEquipped())
{
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_THE_OWNER_OF_S2_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD);
sm.addPcName(noble);
sm.addItemName(noble.getCursedWeaponEquippedId());
player.sendPacket(sm);
return false;
}
if (!noble.isInventoryUnder90(true))
{
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_AS_THE_INVENTORY_WEIGHT_SLOT_IS_FILLED_BEYOND_80);
sm.addPcName(noble);
player.sendPacket(sm);
return false;
}
final int charId = noble.getObjectId();
if (noble.isOnEvent())
{
player.sendMessage("You can't join olympiad while participating on TvT Event.");
return false;
}
if (isRegistered(noble, player, true) || isInCompetition(noble, player, true))
{
return false;
}
StatsSet statDat = Olympiad.getNobleStats(charId);
if (statDat == null)
{
statDat = new StatsSet();
statDat.set(Olympiad.CLASS_ID, noble.getBaseClassId());
statDat.set(Olympiad.CHAR_NAME, noble.getName());
statDat.set(Olympiad.POINTS, Olympiad.DEFAULT_POINTS);
statDat.set(Olympiad.COMP_DONE, 0);
statDat.set(Olympiad.COMP_WON, 0);
statDat.set(Olympiad.COMP_LOST, 0);
statDat.set(Olympiad.COMP_DRAWN, 0);
statDat.set(Olympiad.COMP_DONE_WEEK, 0);
statDat.set(Olympiad.COMP_DONE_WEEK_CLASSED, 0);
statDat.set(Olympiad.COMP_DONE_WEEK_NON_CLASSED, 0);
statDat.set(Olympiad.COMP_DONE_WEEK_TEAM, 0);
statDat.set("to_save", true);
Olympiad.addNobleStats(charId, statDat);
}
final int points = Olympiad.getInstance().getNoblePoints(charId);
if (points <= 0)
{
final NpcHtmlMessage message = new NpcHtmlMessage(player.getLastHtmlActionOriginId());
message.setFile(player.getHtmlPrefix(), "html/olympiad/noble_nopoints1.htm");
message.replace("%objectId%", String.valueOf(noble.getLastHtmlActionOriginId()));
player.sendPacket(message);
return false;
}
if ((Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.OLYMPIAD_ID, noble, Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP))
{
final NpcHtmlMessage message = new NpcHtmlMessage(player.getLastHtmlActionOriginId());
message.setFile(player.getHtmlPrefix(), "html/mods/OlympiadIPRestriction.htm");
message.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP)));
player.sendPacket(message);
return false;
}
return true;
}
private static final class AnnounceUnregToTeam implements Runnable
{
private final List<Integer> _team;
public AnnounceUnregToTeam(List<Integer> t)
{
_team = t;
}
@Override
public final void run()
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_BEEN_REMOVED_FROM_THE_OLYMPIAD_WAITING_LIST);
for (int objectId : _team)
{
final L2PcInstance teamMember = L2World.getInstance().getPlayer(objectId);
if (teamMember != null)
{
teamMember.sendPacket(sm);
if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
{
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, teamMember);
}
}
}
}
}
public int getCountOpponents()
{
return _nonClassBasedRegisters.size() + _classBasedRegisters.size() + _teamsBasedRegisters.size();
}
private static class SingletonHolder
{
protected static final OlympiadManager _instance = new OlympiadManager();
}
}
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* @author DS
*/
public class OlympiadManager
{
private final Set<Integer> _nonClassBasedRegisters = ConcurrentHashMap.newKeySet();
private final Map<Integer, Set<Integer>> _classBasedRegisters = new ConcurrentHashMap<>();
protected OlympiadManager()
{
}
public static OlympiadManager getInstance()
{
return SingletonHolder._instance;
}
public final Set<Integer> getRegisteredNonClassBased()
{
return _nonClassBasedRegisters;
}
public final Map<Integer, Set<Integer>> getRegisteredClassBased()
{
return _classBasedRegisters;
}
protected final List<Set<Integer>> hasEnoughRegisteredClassed()
{
List<Set<Integer>> result = null;
for (Map.Entry<Integer, Set<Integer>> classList : _classBasedRegisters.entrySet())
{
if ((classList.getValue() != null) && (classList.getValue().size() >= Config.ALT_OLY_CLASSED))
{
if (result == null)
{
result = new ArrayList<>();
}
result.add(classList.getValue());
}
}
return result;
}
protected final boolean hasEnoughRegisteredNonClassed()
{
return _nonClassBasedRegisters.size() >= Config.ALT_OLY_NONCLASSED;
}
protected final void clearRegistered()
{
_nonClassBasedRegisters.clear();
_classBasedRegisters.clear();
AntiFeedManager.getInstance().clear(AntiFeedManager.OLYMPIAD_ID);
}
public final boolean isRegistered(L2PcInstance noble)
{
return isRegistered(noble, noble, false);
}
private boolean isRegistered(L2PcInstance noble, L2PcInstance player, boolean showMessage)
{
final Integer objId = Integer.valueOf(noble.getObjectId());
if (_nonClassBasedRegisters.contains(objId))
{
if (showMessage)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_ALL_CLASS_BATTLE);
sm.addPcName(noble);
player.sendPacket(sm);
}
return true;
}
final Set<Integer> classed = _classBasedRegisters.get(noble.getBaseClass());
if ((classed != null) && classed.contains(objId))
{
if (showMessage)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_CLASS_MATCH_WAITING_LIST);
sm.addPcName(noble);
player.sendPacket(sm);
}
return true;
}
return false;
}
public final boolean isRegisteredInComp(L2PcInstance noble)
{
return isRegistered(noble, noble, false) || isInCompetition(noble, noble, false);
}
private boolean isInCompetition(L2PcInstance noble, L2PcInstance player, boolean showMessage)
{
if (!Olympiad._inCompPeriod)
{
return false;
}
AbstractOlympiadGame game;
for (int i = OlympiadGameManager.getInstance().getNumberOfStadiums(); --i >= 0;)
{
game = OlympiadGameManager.getInstance().getOlympiadTask(i).getGame();
if (game == null)
{
continue;
}
if (game.containsParticipant(noble.getObjectId()))
{
if (!showMessage)
{
return true;
}
switch (game.getType())
{
case CLASSED:
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_CLASS_MATCH_WAITING_LIST);
sm.addPcName(noble);
player.sendPacket(sm);
break;
}
case NON_CLASSED:
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_ALL_CLASS_BATTLE);
sm.addPcName(noble);
player.sendPacket(sm);
break;
}
}
return true;
}
}
return false;
}
public final boolean registerNoble(L2PcInstance player, CompetitionType type)
{
if (!Olympiad._inCompPeriod)
{
player.sendPacket(SystemMessageId.THE_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
return false;
}
if (Olympiad.getInstance().getMillisToCompEnd() < 600000)
{
player.sendPacket(SystemMessageId.PARTICIPATION_REQUESTS_ARE_NO_LONGER_BEING_ACCEPTED);
return false;
}
final int charId = player.getObjectId();
if (Olympiad.getInstance().getRemainingWeeklyMatches(charId) < 1)
{
player.sendPacket(SystemMessageId.THE_MAXIMUM_MATCHES_YOU_CAN_PARTICIPATE_IN_1_WEEK_IS_30);
return false;
}
switch (type)
{
case CLASSED:
{
if (player.isOnEvent())
{
player.sendMessage("You can't join olympiad while participating on TvT Event.");
return false;
}
if ((Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.OLYMPIAD_ID, player, Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP))
{
final NpcHtmlMessage message = new NpcHtmlMessage(player.getLastHtmlActionOriginId());
message.setFile(player.getHtmlPrefix(), "data/html/mods/OlympiadIPRestriction.htm");
message.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP)));
player.sendPacket(message);
if (player.isGM() && player.isDebug())
{
player.sendMessage("HTML: data/html/mods/OlympiadIPRestriction.htm");
}
return false;
}
if (Olympiad.getInstance().getRemainingWeeklyMatchesClassed(charId) < 1)
{
player.sendPacket(SystemMessageId.YOU_CAN_ENTER_UP_TO_30_FREE_FOR_ALL_BATTLES_AND_30_CLASS_SPECIFIC_BATTLES_PER_WEEK);
return false;
}
_classBasedRegisters.computeIfAbsent(player.getBaseClass(), k -> ConcurrentHashMap.newKeySet()).add(charId);
player.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REGISTERED_FOR_THE_OLYMPIAD_WAITING_LIST_FOR_A_CLASS_BATTLE);
break;
}
case NON_CLASSED:
{
if (player.isOnEvent())
{
player.sendMessage("You can't join olympiad while participating on TvT Event.");
return false;
}
if ((Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.OLYMPIAD_ID, player, Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP))
{
final NpcHtmlMessage message = new NpcHtmlMessage(player.getLastHtmlActionOriginId());
message.setFile(player.getHtmlPrefix(), "data/html/mods/OlympiadIPRestriction.htm");
message.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP)));
player.sendPacket(message);
if (player.isGM() && player.isDebug())
{
player.sendMessage("HTML: data/html/mods/OlympiadIPRestriction.htm");
}
return false;
}
if (Olympiad.getInstance().getRemainingWeeklyMatchesNonClassed(charId) < 1)
{
player.sendPacket(SystemMessageId.YOU_CAN_ENTER_UP_TO_30_FREE_FOR_ALL_BATTLES_AND_30_CLASS_SPECIFIC_BATTLES_PER_WEEK);
return false;
}
_nonClassBasedRegisters.add(charId);
player.sendPacket(SystemMessageId.YOU_ARE_CURRENTLY_REGISTERED_FOR_A_1V1_CLASS_IRRELEVANT_MATCH);
break;
}
}
return true;
}
public final boolean unRegisterNoble(L2PcInstance noble)
{
if (!Olympiad._inCompPeriod)
{
noble.sendPacket(SystemMessageId.THE_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
return false;
}
if (!noble.isNoble())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DOES_NOT_MEET_THE_PARTICIPATION_REQUIREMENTS_ONLY_NOBLESSE_EXALTED_CHARACTERS_CAN_PARTICIPATE_IN_THE_OLYMPIAD);
sm.addString(noble.getName());
noble.sendPacket(sm);
return false;
}
if (!isRegistered(noble, noble, false))
{
noble.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_REGISTERED_FOR_THE_OLYMPIAD);
return false;
}
if (isInCompetition(noble, noble, false))
{
return false;
}
final Integer objId = Integer.valueOf(noble.getObjectId());
if (_nonClassBasedRegisters.remove(objId))
{
if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
{
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);
}
noble.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REMOVED_FROM_THE_OLYMPIAD_WAITING_LIST);
return true;
}
final Set<Integer> classed = _classBasedRegisters.get(noble.getBaseClass());
if ((classed != null) && classed.remove(objId))
{
if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
{
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);
}
noble.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REMOVED_FROM_THE_OLYMPIAD_WAITING_LIST);
return true;
}
return false;
}
public final void removeDisconnectedCompetitor(L2PcInstance player)
{
final OlympiadGameTask task = OlympiadGameManager.getInstance().getOlympiadTask(player.getOlympiadGameId());
if ((task != null) && task.isGameStarted())
{
task.getGame().handleDisconnect(player);
}
final Integer objId = Integer.valueOf(player.getObjectId());
if (_nonClassBasedRegisters.remove(objId))
{
return;
}
_classBasedRegisters.getOrDefault(player.getBaseClass(), Collections.emptySet()).remove(objId);
}
public int getCountOpponents()
{
return _nonClassBasedRegisters.size() + _classBasedRegisters.size();
}
private static class SingletonHolder
{
protected static final OlympiadManager _instance = new OlympiadManager();
}
}

View File

@@ -0,0 +1,191 @@
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import java.util.List;
import java.util.Objects;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.model.zone.type.L2OlympiadStadiumZone;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ExOlympiadMatchEnd;
import com.l2jmobius.gameserver.network.serverpackets.ExOlympiadUserInfo;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* @author JIV
*/
public class OlympiadStadium
{
private static final Logger LOGGER = Logger.getLogger(OlympiadStadium.class.getName());
private final L2OlympiadStadiumZone _zone;
private final Instance _instance;
private final List<L2Spawn> _buffers;
private OlympiadGameTask _task = null;
protected OlympiadStadium(L2OlympiadStadiumZone olyzone, int stadium)
{
_zone = olyzone;
_instance = InstanceManager.getInstance().createInstance(olyzone.getInstanceTemplateId(), null);
_buffers = _instance.getNpcs().stream().map(L2Npc::getSpawn).collect(Collectors.toList());
_buffers.stream().map(L2Spawn::getLastSpawn).forEach(L2Npc::decayMe);
}
public L2OlympiadStadiumZone getZone()
{
return _zone;
}
public final void registerTask(OlympiadGameTask task)
{
_task = task;
}
public OlympiadGameTask getTask()
{
return _task;
}
public Instance getInstance()
{
return _instance;
}
public final void openDoors()
{
_instance.getDoors().forEach(L2DoorInstance::openMe);
}
public final void closeDoors()
{
_instance.getDoors().forEach(L2DoorInstance::closeMe);
}
public final void spawnBuffers()
{
_buffers.forEach(L2Spawn::doSpawn);
}
public final void deleteBuffers()
{
_buffers.stream().map(L2Spawn::getLastSpawn).filter(Objects::nonNull).forEach(L2Npc::deleteMe);
}
public final void broadcastStatusUpdate(L2PcInstance player)
{
final ExOlympiadUserInfo packet = new ExOlympiadUserInfo(player);
for (L2PcInstance target : _instance.getPlayers())
{
if (target.inObserverMode() || (target.getOlympiadSide() != player.getOlympiadSide()))
{
target.sendPacket(packet);
}
}
}
public final void broadcastPacket(IClientOutgoingPacket packet)
{
_instance.broadcastPacket(packet);
}
public final void broadcastPacketToObservers(IClientOutgoingPacket packet)
{
for (L2PcInstance target : _instance.getPlayers())
{
if (target.inObserverMode())
{
target.sendPacket(packet);
}
}
}
public final void updateZoneStatusForCharactersInside()
{
if (_task == null)
{
return;
}
final boolean battleStarted = _task.isBattleStarted();
final SystemMessage sm;
if (battleStarted)
{
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
}
else
{
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
}
for (L2PcInstance player : _instance.getPlayers())
{
if (player.inObserverMode())
{
return;
}
if (battleStarted)
{
player.setInsideZone(ZoneId.PVP, true);
player.sendPacket(sm);
}
else
{
player.setInsideZone(ZoneId.PVP, false);
player.sendPacket(sm);
player.sendPacket(ExOlympiadMatchEnd.STATIC_PACKET);
}
}
}
public final void updateZoneInfoForObservers()
{
if (_task == null)
{
return;
}
for (L2PcInstance player : _instance.getPlayers())
{
if (!player.inObserverMode())
{
return;
}
final OlympiadGameTask nextArena = OlympiadGameManager.getInstance().getOlympiadTask(player.getOlympiadGameId());
final List<Location> spectatorSpawns = nextArena.getStadium().getZone().getSpectatorSpawns();
if (spectatorSpawns.isEmpty())
{
LOGGER.warning(getClass().getSimpleName() + ": Zone: " + nextArena.getStadium().getZone() + " doesn't have specatator spawns defined!");
return;
}
final Location loc = spectatorSpawns.get(Rnd.get(spectatorSpawns.size()));
player.enterOlympiadObserverMode(loc, player.getOlympiadGameId());
}
}
}

View File

@@ -1,188 +1,188 @@
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author DS, Zoey76
*/
public final class Participant
{
private final int objectId;
private L2PcInstance player;
private final String name;
private final int side;
private final int baseClass;
private boolean disconnected = false;
private boolean defaulted = false;
private final StatsSet stats;
public String clanName;
public int clanId;
public Participant(L2PcInstance plr, int olympiadSide)
{
objectId = plr.getObjectId();
player = plr;
name = plr.getName();
side = olympiadSide;
baseClass = plr.getBaseClassId();
stats = Olympiad.getNobleStats(getObjectId());
clanName = plr.getClan() != null ? plr.getClan().getName() : "";
clanId = plr.getClanId();
}
public Participant(int objId, int olympiadSide)
{
objectId = objId;
player = null;
name = "-";
side = olympiadSide;
baseClass = 0;
stats = null;
clanName = "";
clanId = 0;
}
/**
* Updates the reference to {@link #player}, if it's null or appears off-line.
* @return {@code true} if after the update the player isn't null, {@code false} otherwise.
*/
public final boolean updatePlayer()
{
if ((player == null) || !player.isOnline())
{
player = L2World.getInstance().getPlayer(getObjectId());
}
return player != null;
}
/**
* @param statName
* @param increment
*/
public final void updateStat(String statName, int increment)
{
stats.set(statName, Math.max(stats.getInt(statName) + increment, 0));
}
/**
* @return the name the player's name.
*/
public String getName()
{
return name;
}
/**
* @return the name the player's clan name.
*/
public String getClanName()
{
return clanName;
}
/**
* @return the name the player's id.
*/
public int getClanId()
{
return clanId;
}
/**
* @return the player
*/
public L2PcInstance getPlayer()
{
return player;
}
/**
* @return the objectId
*/
public int getObjectId()
{
return objectId;
}
/**
* @return the stats
*/
public StatsSet getStats()
{
return stats;
}
/**
* @param noble the player to set
*/
public void setPlayer(L2PcInstance noble)
{
player = noble;
}
/**
* @return the side
*/
public int getSide()
{
return side;
}
/**
* @return the baseClass
*/
public int getBaseClass()
{
return baseClass;
}
/**
* @return the disconnected
*/
public boolean isDisconnected()
{
return disconnected;
}
/**
* @param val the disconnected to set
*/
public void setDisconnected(boolean val)
{
disconnected = val;
}
/**
* @return the defaulted
*/
public boolean isDefaulted()
{
return defaulted;
}
/**
* @param val the value to set.
*/
public void setDefaulted(boolean val)
{
defaulted = val;
}
/*
* 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 com.l2jmobius.gameserver.model.olympiad;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author DS, Zoey76
*/
public final class Participant
{
private final int objectId;
private L2PcInstance player;
private final String name;
private final int side;
private final int baseClass;
private boolean disconnected = false;
private boolean defaulted = false;
private final StatsSet stats;
public String clanName;
public int clanId;
public Participant(L2PcInstance plr, int olympiadSide)
{
objectId = plr.getObjectId();
player = plr;
name = plr.getName();
side = olympiadSide;
baseClass = plr.getBaseClass();
stats = Olympiad.getNobleStats(getObjectId());
clanName = plr.getClan() != null ? plr.getClan().getName() : "";
clanId = plr.getClanId();
}
public Participant(int objId, int olympiadSide)
{
objectId = objId;
player = null;
name = "-";
side = olympiadSide;
baseClass = 0;
stats = null;
clanName = "";
clanId = 0;
}
/**
* Updates the reference to {@link #player}, if it's null or appears off-line.
* @return {@code true} if after the update the player isn't null, {@code false} otherwise.
*/
public final boolean updatePlayer()
{
if ((player == null) || !player.isOnline())
{
player = L2World.getInstance().getPlayer(getObjectId());
}
return (player != null);
}
/**
* @param statName
* @param increment
*/
public final void updateStat(String statName, int increment)
{
stats.set(statName, Math.max(stats.getInt(statName) + increment, 0));
}
/**
* @return the name the player's name.
*/
public String getName()
{
return name;
}
/**
* @return the name the player's clan name.
*/
public String getClanName()
{
return clanName;
}
/**
* @return the name the player's id.
*/
public int getClanId()
{
return clanId;
}
/**
* @return the player
*/
public L2PcInstance getPlayer()
{
return player;
}
/**
* @return the objectId
*/
public int getObjectId()
{
return objectId;
}
/**
* @return the stats
*/
public StatsSet getStats()
{
return stats;
}
/**
* @param noble the player to set
*/
public void setPlayer(L2PcInstance noble)
{
player = noble;
}
/**
* @return the side
*/
public int getSide()
{
return side;
}
/**
* @return the baseClass
*/
public int getBaseClass()
{
return baseClass;
}
/**
* @return the disconnected
*/
public boolean isDisconnected()
{
return disconnected;
}
/**
* @param val the disconnected to set
*/
public void setDisconnected(boolean val)
{
disconnected = val;
}
/**
* @return the defaulted
*/
public boolean isDefaulted()
{
return defaulted;
}
/**
* @param val the value to set.
*/
public void setDefaulted(boolean val)
{
defaulted = val;
}
}