Addition of rank manager.

Contributed by NviX.
This commit is contained in:
MobiusDevelopment 2019-12-11 14:35:14 +00:00
parent b1b4597ab4
commit 4869bc1745
36 changed files with 3622 additions and 538 deletions

View File

@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS `heroes` (
`charId` INT UNSIGNED NOT NULL DEFAULT 0,
`class_id` decimal(3,0) NOT NULL DEFAULT 0,
`count` decimal(3,0) NOT NULL DEFAULT 0,
`legend_count` decimal(3,0) NOT NULL DEFAULT 0,
`played` decimal(1,0) NOT NULL DEFAULT 0,
`claimed` ENUM('true','false') NOT NULL DEFAULT 'false',
`message` varchar(300) NOT NULL DEFAULT '',

View File

@ -0,0 +1,249 @@
/*
* 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.instancemanager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.gameserver.data.sql.impl.ClanTable;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.entity.Hero;
/**
* @author NviX
*/
public class RankManager
{
private static final Logger LOGGER = Logger.getLogger(RankManager.class.getName());
private static final String SELECT_CHARACTERS = "SELECT charId,char_name,level,race,base_class, clanid FROM characters WHERE level > 84 ORDER BY exp DESC";
private static final String SELECT_CHARACTERS_BY_RACE = "SELECT charId FROM characters WHERE level > 84 AND race = ? ORDER BY exp DESC";
private static final String GET_CURRENT_CYCLE_DATA = "SELECT characters.char_name, characters.level, characters.base_class, characters.clanid, olympiad_nobles.charId, olympiad_nobles.olympiad_points, olympiad_nobles.competitions_won, olympiad_nobles.competitions_lost FROM characters, olympiad_nobles WHERE characters.charId = olympiad_nobles.charId ORDER BY olympiad_nobles.olympiad_points DESC";
private static final String GET_CHARACTERS_BY_CLASS = "SELECT characters.charId, olympiad_nobles.olympiad_points FROM characters, olympiad_nobles WHERE olympiad_nobles.charId = characters.charId AND characters.base_class = ? ORDER BY olympiad_nobles.olympiad_points DESC";
private final Map<Integer, StatsSet> _mainList = new ConcurrentHashMap<>();
private Map<Integer, StatsSet> _snapshotList = new ConcurrentHashMap<>();
private final Map<Integer, StatsSet> _mainOlyList = new ConcurrentHashMap<>();
private Map<Integer, StatsSet> _snapshotOlyList = new ConcurrentHashMap<>();
protected RankManager()
{
ThreadPool.scheduleAtFixedRate(this::update, 0, 1800000);
}
public Map<Integer, StatsSet> getRankList()
{
return _mainList;
}
public Map<Integer, StatsSet> getSnapshotList()
{
return _snapshotList;
}
public Map<Integer, StatsSet> getOlyRankList()
{
return _mainOlyList;
}
public Map<Integer, StatsSet> getSnapshotOlyList()
{
return _snapshotOlyList;
}
private synchronized void update()
{
// Load charIds All
_snapshotList = _mainList;
_mainList.clear();
_snapshotOlyList = _mainOlyList;
_mainOlyList.clear();
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SELECT_CHARACTERS))
{
try (ResultSet rset = statement.executeQuery())
{
int i = 1;
while (rset.next())
{
final StatsSet player = new StatsSet();
final int charId = rset.getInt("charId");
player.set("charId", charId);
player.set("name", rset.getString("char_name"));
player.set("level", rset.getInt("level"));
player.set("classId", rset.getInt("base_class"));
final int race = rset.getInt("race");
player.set("race", race);
loadRaceRank(charId, race, player);
final int clanId = rset.getInt("clanid");
if (clanId > 0)
{
player.set("clanName", ClanTable.getInstance().getClan(clanId).getName());
}
else
{
player.set("clanName", "");
}
_mainList.put(i, player);
i++;
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Could not load chars total rank data: " + this + " - " + e.getMessage(), e);
}
// load olympiad data.
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_CURRENT_CYCLE_DATA))
{
try (ResultSet rset = statement.executeQuery())
{
int i = 1;
while (rset.next())
{
final StatsSet player = new StatsSet();
final int charId = rset.getInt("charId");
player.set("charId", charId);
player.set("name", rset.getString("char_name"));
final int clanId = rset.getInt("clanid");
if (clanId > 0)
{
player.set("clanName", ClanTable.getInstance().getClan(clanId).getName());
}
else
{
player.set("clanName", "");
}
player.set("level", rset.getInt("level"));
final int classId = rset.getInt("base_class");
player.set("classId", classId);
if (clanId > 0)
{
player.set("clanLevel", ClanTable.getInstance().getClan(clanId).getLevel());
}
else
{
player.set("clanLevel", 0);
}
player.set("competitions_won", rset.getInt("competitions_won"));
player.set("competitions_lost", rset.getInt("competitions_lost"));
player.set("olympiad_points", rset.getInt("olympiad_points"));
if (Hero.getInstance().getCompleteHeroes().containsKey(charId))
{
final StatsSet hero = Hero.getInstance().getCompleteHeroes().get(charId);
player.set("count", hero.getInt("count"));
player.set("legend_count", hero.getInt("legend_count"));
}
else
{
player.set("count", 0);
player.set("legend_count", 0);
}
loadClassRank(charId, classId, player);
_mainOlyList.put(i, player);
i++;
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Could not load olympiad total rank data: " + this + " - " + e.getMessage(), e);
}
}
private void loadClassRank(int charId, int classId, StatsSet player)
{
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(GET_CHARACTERS_BY_CLASS))
{
ps.setInt(1, classId);
try (ResultSet rset = ps.executeQuery())
{
int i = 0;
while (rset.next())
{
if (rset.getInt("charId") == charId)
{
player.set("classRank", i + 1);
}
i++;
}
if (i == 0)
{
player.set("classRank", 0);
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Could not load chars classId olympiad rank data: " + this + " - " + e.getMessage(), e);
}
}
private void loadRaceRank(int charId, int race, StatsSet player)
{
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_CHARACTERS_BY_RACE))
{
ps.setInt(1, race);
try (ResultSet rset = ps.executeQuery())
{
int i = 0;
while (rset.next())
{
if (rset.getInt("charId") == charId)
{
player.set("raceRank", i + 1);
}
i++;
}
if (i == 0)
{
player.set("raceRank", 0);
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Could not load chars race rank data: " + this + " - " + e.getMessage(), e);
}
}
private static class SingletonHolder
{
protected static final RankManager INSTANCE = new RankManager();
}
public static RankManager getInstance()
{
return SingletonHolder.INSTANCE;
}
}

View File

@ -45,6 +45,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
@ -63,11 +65,11 @@ public class Hero
{
private static final Logger LOGGER = Logger.getLogger(Hero.class.getName());
private static final String GET_HEROES = "SELECT heroes.charId, characters.char_name, heroes.class_id, heroes.count, heroes.played, heroes.claimed FROM heroes, characters WHERE characters.charId = heroes.charId AND heroes.played = 1";
private static final String GET_ALL_HEROES = "SELECT heroes.charId, characters.char_name, heroes.class_id, heroes.count, heroes.played, heroes.claimed FROM heroes, characters WHERE characters.charId = heroes.charId";
private static final String GET_HEROES = "SELECT heroes.charId, characters.char_name, heroes.class_id, heroes.count, heroes.legend_count, heroes.played, heroes.claimed FROM heroes, characters WHERE characters.charId = heroes.charId AND heroes.played = 1";
private static final String GET_ALL_HEROES = "SELECT heroes.charId, characters.char_name, heroes.class_id, heroes.count, heroes.legend_count, heroes.played, heroes.claimed FROM heroes, characters WHERE characters.charId = heroes.charId";
private static final String UPDATE_ALL = "UPDATE heroes SET played = 0";
private static final String INSERT_HERO = "INSERT INTO heroes (charId, class_id, count, played, claimed) VALUES (?,?,?,?,?)";
private static final String UPDATE_HERO = "UPDATE heroes SET count = ?, played = ?, claimed = ? WHERE charId = ?";
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 = ?";
// delete hero items
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) AND owner_id NOT IN (SELECT charId FROM characters WHERE accesslevel > 0)";
@ -82,6 +84,7 @@ public class Hero
private static final Map<Integer, String> HERO_MESSAGE = new ConcurrentHashMap<>();
public static final String COUNT = "count";
public static final String LEGEND_COUNT = "legend_count";
public static final String PLAYED = "played";
public static final String CLAIMED = "claimed";
public static final String CLAN_NAME = "clan_name";
@ -121,6 +124,7 @@ public class Hero
hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME));
hero.set(Olympiad.CLASS_ID, rset.getInt(Olympiad.CLASS_ID));
hero.set(COUNT, rset.getInt(COUNT));
hero.set(LEGEND_COUNT, rset.getInt(LEGEND_COUNT));
hero.set(PLAYED, rset.getInt(PLAYED));
hero.set(CLAIMED, Boolean.parseBoolean(rset.getString(CLAIMED)));
@ -140,6 +144,7 @@ public class Hero
hero.set(Olympiad.CHAR_NAME, rset2.getString(Olympiad.CHAR_NAME));
hero.set(Olympiad.CLASS_ID, rset2.getInt(Olympiad.CLASS_ID));
hero.set(COUNT, rset2.getInt(COUNT));
hero.set(LEGEND_COUNT, rset2.getInt(LEGEND_COUNT));
hero.set(PLAYED, rset2.getInt(PLAYED));
hero.set(CLAIMED, Boolean.parseBoolean(rset2.getString(CLAIMED)));
@ -413,6 +418,11 @@ public class Hero
return HEROES;
}
public Map<Integer, StatsSet> getCompleteHeroes()
{
return COMPLETE_HEROS;
}
public int getHeroByClass(int classid)
{
for (Entry<Integer, StatsSet> e : HEROES.entrySet())
@ -664,8 +674,16 @@ public class Hero
if (COMPLETE_HEROS.containsKey(charId))
{
final StatsSet oldHero = COMPLETE_HEROS.get(charId);
final int count = oldHero.getInt(COUNT);
oldHero.set(COUNT, count + 1);
if (hero.getInt(LEGEND_COUNT) == 1)
{
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);
}
oldHero.set(PLAYED, 1);
oldHero.set(CLAIMED, false);
HEROES.put(charId, oldHero);
@ -675,7 +693,14 @@ public class Hero
final StatsSet newHero = new StatsSet();
newHero.set(Olympiad.CHAR_NAME, hero.getString(Olympiad.CHAR_NAME));
newHero.set(Olympiad.CLASS_ID, hero.getInt(Olympiad.CLASS_ID));
newHero.set(COUNT, 1);
if (hero.getInt(LEGEND_COUNT) == 1)
{
newHero.set(LEGEND_COUNT, 1);
}
else
{
newHero.set(COUNT, 1);
}
newHero.set(PLAYED, 1);
newHero.set(CLAIMED, false);
HEROES.put(charId, newHero);
@ -711,8 +736,9 @@ public class Hero
insert.setInt(1, heroId);
insert.setInt(2, hero.getInt(Olympiad.CLASS_ID));
insert.setInt(3, hero.getInt(COUNT));
insert.setInt(4, hero.getInt(PLAYED));
insert.setString(5, String.valueOf(hero.getBoolean(CLAIMED)));
insert.setInt(4, hero.getInt(LEGEND_COUNT));
insert.setInt(5, hero.getInt(PLAYED));
insert.setString(6, String.valueOf(hero.getBoolean(CLAIMED)));
insert.execute();
insert.close();
}
@ -760,6 +786,7 @@ public class Hero
try (PreparedStatement statement = con.prepareStatement(UPDATE_HERO))
{
statement.setInt(1, hero.getInt(COUNT));
statement.setInt(2, hero.getInt(LEGEND_COUNT));
statement.setInt(2, hero.getInt(PLAYED));
statement.setString(3, String.valueOf(hero.getBoolean(CLAIMED)));
statement.setInt(4, heroId);
@ -948,6 +975,7 @@ public class Hero
loadFights(player.getObjectId());
loadDiary(player.getObjectId());
HERO_MESSAGE.put(player.getObjectId(), "");
EventDispatcher.getInstance().notifyEvent(new OnPlayerTakeHero(player));
updateHeroes(false);
}

View File

@ -112,6 +112,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSubCha
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonAgathion;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonSpawn;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction;
@ -274,6 +275,7 @@ public enum EventType
ON_PLAYER_SKILL_LEARN(OnPlayerSkillLearn.class, void.class),
ON_PLAYER_SUMMON_SPAWN(OnPlayerSummonSpawn.class, void.class),
ON_PLAYER_SUMMON_TALK(OnPlayerSummonTalk.class, void.class),
ON_PLAYER_TAKE_HERO(OnPlayerTakeHero.class, void.class),
ON_PLAYER_TRANSFORM(OnPlayerTransform.class, void.class),
ON_PLAYER_SUB_CHANGE(OnPlayerSubChange.class, void.class),
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),

View File

@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.creature.player;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
/**
* @author Mobius
*/
public class OnPlayerTakeHero implements IBaseEvent
{
private final PlayerInstance _player;
public OnPlayerTakeHero(PlayerInstance player)
{
_player = player;
}
public PlayerInstance getPlayer()
{
return _player;
}
@Override
public EventType getType()
{
return EventType.ON_PLAYER_TRANSFORM;
}
}

View File

@ -104,8 +104,11 @@ import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRProduct
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRRecentProductList;
import org.l2jmobius.gameserver.network.clientpackets.raidbossinfo.RequestRaidBossSpawnInfo;
import org.l2jmobius.gameserver.network.clientpackets.raidbossinfo.RequestRaidServerInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.ExRankCharInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.ExRankingCharRankers;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadHeroAndLegendInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadMyRankingInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadRankingInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneList;
@ -175,6 +178,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
ANSWER_JOIN_PARTY_ROOM(0x30, AnswerJoinPartyRoom::new, ConnectionState.IN_GAME),
REQUEST_LIST_PARTY_MATCHING_WAITING_ROOM(0x31, RequestListPartyMatchingWaitingRoom::new, ConnectionState.IN_GAME),
REQUEST_EX_ENCHANT_ITEM_ATTRIBUTE(0x32, RequestExEnchantItemAttribute::new, ConnectionState.IN_GAME),
CANNOT_AIRSHIP_MOVE_ANYMORE(0x34, null, ConnectionState.IN_GAME),
MOVE_TO_LOCATION_AIR_SHIP(0x35, MoveToLocationAirShip::new, ConnectionState.IN_GAME),
REQUEST_BID_ITEM_AUCTION(0x36, RequestBidItemAuction::new, ConnectionState.IN_GAME),
REQUEST_INFO_ITEM_AUCTION(0x37, RequestInfoItemAuction::new, ConnectionState.IN_GAME),
@ -190,6 +194,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
REQUEST_EX_MAGIC_SKILL_USE_GROUND(0x41, RequestExMagicSkillUseGround::new, ConnectionState.IN_GAME),
REQUEST_DUEL_SURRENDER(0x42, RequestDuelSurrender::new, ConnectionState.IN_GAME),
REQUEST_EX_ENCHANT_SKILL_INFO_DETAIL(0x43, RequestExEnchantSkillInfoDetail::new, ConnectionState.IN_GAME),
REQUEST_ANTI_FREE_SERVER(0x44, null, ConnectionState.IN_GAME),
REQUEST_FORTRESS_MAP_INFO(0x45, RequestFortressMapInfo::new, ConnectionState.IN_GAME),
REQUEST_PVP_MATCH_RECORD(0x46, RequestPVPMatchRecord::new, ConnectionState.IN_GAME),
SET_PRIVATE_STORE_WHOLE_MSG(0x47, SetPrivateStoreWholeMsg::new, ConnectionState.IN_GAME),
@ -292,6 +297,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
REQUEST_FIRST_PLAY_START(0xAC, null, ConnectionState.IN_GAME),
REQUEST_FLY_MOVE_START(0xAD, RequestFlyMoveStart::new, ConnectionState.IN_GAME),
REQUEST_HARDWARE_INFO(0xAE, RequestHardWareInfo::new, ConnectionState.values()),
USER_INTERFACE_INFO(0xAF, null, ConnectionState.IN_GAME),
SEND_CHANGE_ATTRIBUTE_TARGET_ITEM(0xB0, SendChangeAttributeTargetItem::new, ConnectionState.IN_GAME),
REQUEST_CHANGE_ATTRIBUTE_ITEM(0xB1, RequestChangeAttributeItem::new, ConnectionState.IN_GAME),
REQUEST_CHANGE_ATTRIBUTE_CANCEL(0xB2, RequestChangeAttributeCancel::new, ConnectionState.IN_GAME),
@ -320,10 +326,12 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
REQUEST_EVENT_KALIE_TOKEN(0xC9, null, ConnectionState.IN_GAME),
REQUEST_SHOW_BEAUTY_LIST(0xCA, RequestShowBeautyList::new, ConnectionState.IN_GAME),
REQUEST_REGIST_BEAUTY(0xCB, RequestRegistBeauty::new, ConnectionState.IN_GAME),
REQUEST_SHOW_RESET_BEAUTY(0xCC, null, ConnectionState.IN_GAME),
REQUEST_SHOW_RESET_SHOP_LIST(0xCD, RequestShowResetShopList::new, ConnectionState.IN_GAME),
NET_PING(0xCE, null, ConnectionState.IN_GAME),
REQUEST_BR_ADD_BASKET_PRODUCT_INFO(0xCF, null, ConnectionState.IN_GAME),
REQUEST_BR_DELETE_BASKET_PRODUCT_INFO(0xD0, null, ConnectionState.IN_GAME),
REQUEST_BR_EXIST_NEW_PRODUCT(0xD1, null, ConnectionState.IN_GAME),
REQUEST_EX_EVENT_CAMPAIGN_INFO(0xD2, null, ConnectionState.IN_GAME),
REQUEST_PLEDGE_RECRUIT_INFO(0xD3, RequestPledgeRecruitInfo::new, ConnectionState.IN_GAME),
REQUEST_PLEDGE_RECRUIT_BOARD_SEARCH(0xD4, RequestPledgeRecruitBoardSearch::new, ConnectionState.IN_GAME),
@ -462,51 +470,78 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_REQUEST_UNLOCKED_ITEM(0x159, null, ConnectionState.IN_GAME),
EX_LOCKED_ITEM_CANCEL(0x15A, null, ConnectionState.IN_GAME),
EX_UNLOCKED_ITEM_CANCEL(0x15B, null, ConnectionState.IN_GAME),
EX_ELEMENTAL_SPIRIT_CHANGE_TYPE(0x15C, null, ConnectionState.IN_GAME), // 152
// 152
EX_ELEMENTAL_SPIRIT_CHANGE_TYPE(0x15C, null, ConnectionState.IN_GAME),
REQUEST_BLOCK_LIST_FOR_AD(0x15D, null, ConnectionState.IN_GAME),
REQUEST_USER_BAN_INFO(0x15E, null, ConnectionState.IN_GAME),
EX_INTERACT_MODIFY(0x15F, null, ConnectionState.IN_GAME), // 152
EX_TRY_ENCHANT_ARTIFACT(0x160, RequestExTryEnchantArtifact::new, ConnectionState.IN_GAME), // 152
EX_XIGN_CODE(0x161, null, ConnectionState.IN_GAME), // 152
EX_OPEN_HTML(0x164, ExOpenDimensionalHtml::new, ConnectionState.IN_GAME), // 228
EX_REQUEST_CLASS_CHANGE(0x165, ExRequestClassChange::new, ConnectionState.IN_GAME), // 228
EX_REQUEST_CLASS_CHANGE_VERIFYING(0x166, null, ConnectionState.IN_GAME), // 228
EX_REQUEST_TELEPORT(0x167, ExRequestTeleport::new, ConnectionState.IN_GAME), // 228
EX_COSTUME_COLLECTION_SKILL_ACTIVE(0x16B, null, ConnectionState.IN_GAME), // 228
UNK_16C(0x16C, null, ConnectionState.IN_GAME), // 228
UNK_16D(0x16D, null, ConnectionState.IN_GAME), // 228
UNK_16E(0x16E, null, ConnectionState.IN_GAME), // 228
UNK_16F(0x16F, null, ConnectionState.IN_GAME), // 228
UNK_170(0x170, null, ConnectionState.IN_GAME), // 228
EX_ACTIVATE_AUTO_SHORTCUT(0x171, ExRequestActivateAutoShortcut::new, ConnectionState.IN_GAME), // 228
UNK_172(0x172, null, ConnectionState.IN_GAME), // 228
UNK_173(0x173, null, ConnectionState.IN_GAME), // 228
UNK_174(0x174, null, ConnectionState.IN_GAME), // 228
UNK_175(0x175, null, ConnectionState.IN_GAME), // 228
UNK_176(0x176, null, ConnectionState.IN_GAME), // 228
EX_AUTOPLAY_SETTING(0x177, ExAutoPlaySetting::new, ConnectionState.IN_GAME), // 228
UNK_178(0x178, null, ConnectionState.IN_GAME), // 228
UNK_179(0x179, null, ConnectionState.IN_GAME), // 228
UNK_17A(0x17A, null, ConnectionState.IN_GAME), // 228
UNK_17B(0x17B, null, ConnectionState.IN_GAME), // 228
UNK_17C(0x17C, null, ConnectionState.IN_GAME), // 228
UNK_17D(0x17D, null, ConnectionState.IN_GAME), // 228
UNK_17E(0x17E, null, ConnectionState.IN_GAME), // 228
EX_TIME_RESTRICT_FIELD_LIST(0x17F, ExTimedHuntingZoneList::new, ConnectionState.IN_GAME), // 228
EX_TIME_RESTRICT_FIELD_USER_ENTER(0x180, null, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_INFO(0x181, ExRankCharInfo::new, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_HISTORY(0x182, null, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_RANKERS(0x183, ExRankingCharRankers::new, ConnectionState.IN_GAME), // 228
UNK_184(0x184, null, ConnectionState.IN_GAME), // 228
UNK_185(0x185, null, ConnectionState.IN_GAME), // 228
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_ATTACKER_LIST(0x186, null, ConnectionState.IN_GAME), // 228
UNK_187(0x187, null, ConnectionState.IN_GAME), // 228
UNK_188(0x188, null, ConnectionState.IN_GAME), // 228
UNK_189(0x189, null, ConnectionState.IN_GAME), // 228
UNK_18A(0x18A, null, ConnectionState.IN_GAME), // 228
EX_PVP_BOOK_LIST(0x18B, ExPvpBookList::new, ConnectionState.IN_GAME), // 228
UNK_18C(0x18C, null, ConnectionState.IN_GAME), // 228
EX_LETTER_COLLECTOR_TAKE_REWARD(0x18D, null, ConnectionState.IN_GAME); // 228
EX_INTERACT_MODIFY(0x15F, null, ConnectionState.IN_GAME),
EX_TRY_ENCHANT_ARTIFACT(0x160, RequestExTryEnchantArtifact::new, ConnectionState.IN_GAME),
EX_UPGRADE_SYSTEM_NORMAL_REQUEST(0x161, null, ConnectionState.IN_GAME),
EX_PURCHASE_LIMIT_SHOP_ITEM_LIST(0x162, null, ConnectionState.IN_GAME),
EX_PURCHASE_LIMIT_SHOP_ITEM_BUY(0x163, null, ConnectionState.IN_GAME),
// 228
EX_OPEN_HTML(0x164, ExOpenDimensionalHtml::new, ConnectionState.IN_GAME),
EX_REQUEST_CLASS_CHANGE(0x165, ExRequestClassChange::new, ConnectionState.IN_GAME),
EX_REQUEST_CLASS_CHANGE_VERIFYING(0x166, null, ConnectionState.IN_GAME),
EX_REQUEST_TELEPORT(0x167, ExRequestTeleport::new, ConnectionState.IN_GAME),
EX_COSTUME_USE_ITEM(0x168, null, ConnectionState.IN_GAME),
EX_COSTUME_LIST(0x169, null, ConnectionState.IN_GAME),
EX_COSTUME_COLLECTION_SKILL_ACTIVE(0x16A, null, ConnectionState.IN_GAME),
EX_COSTUME_EVOLUTION(0x16B, null, ConnectionState.IN_GAME),
EX_COSTUME_EXTRACT(0x16C, null, ConnectionState.IN_GAME),
EX_COSTUME_LOCK(0x16D, null, ConnectionState.IN_GAME),
EX_COSTUME_CHANGE_SHORTCUT(0x16E, null, ConnectionState.IN_GAME),
EX_MAGICLAMP_GAME_INFO(0x16F, null, ConnectionState.IN_GAME),
EX_MAGICLAMP_GAME_START(0x170, null, ConnectionState.IN_GAME),
EX_ACTIVATE_AUTO_SHORTCUT(0x171, ExRequestActivateAutoShortcut::new, ConnectionState.IN_GAME),
EX_PREMIUM_MANAGER_LINK_HTML(0x172, null, ConnectionState.IN_GAME),
EX_PREMIUM_MANAGER_PASS_CMD_TO_SERVER(0x173, null, ConnectionState.IN_GAME),
EX_ACTIVATED_CURSED_TREASURE_BOX_LOCATION(0x174, null, ConnectionState.IN_GAME),
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_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),
EX_GACHA_SHOP_GACHA_GROUP(0x17D, null, ConnectionState.IN_GAME),
EX_GACHA_SHOP_GACHA_ITEM(0x17E, null, ConnectionState.IN_GAME),
EX_TIME_RESTRICT_FIELD_LIST(0x17F, ExTimedHuntingZoneList::new, ConnectionState.IN_GAME),
EX_TIME_RESTRICT_FIELD_USER_ENTER(0x180, null, ConnectionState.IN_GAME),
EX_RANKING_CHAR_INFO(0x181, RequestRankingCharInfo::new, ConnectionState.IN_GAME),
EX_RANKING_CHAR_HISTORY(0x182, null, ConnectionState.IN_GAME),
EX_RANKING_CHAR_RANKERS(0x183, RequestRankingCharRankers::new, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_RECRUIT_INFO_SET(0x184, null, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_CASTLEWAR_CASTLE_INFO(0x185, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_INFO(0x186, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_ATTACKER_LIST(0x187, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_DEFENDER_LIST(0x188, null, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_MEMBER_LIST(0x189, null, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_MEMBER_JOIN(0x18A, null, ConnectionState.IN_GAME),
EX_PVP_BOOK_LIST(0x18B, ExPvpBookList::new, ConnectionState.IN_GAME),
EX_PVP_BOOK_KILLER_LOCATION(0x18C, null, ConnectionState.IN_GAME),
EX_PVP_BOOK_TELEPORT_TO_KILLER(0x18D, null, ConnectionState.IN_GAME),
EX_LETTER_COLLECTOR_TAKE_REWARD(0x18E, null, ConnectionState.IN_GAME),
EX_SET_STATUS_BONUS(0x18F, null, ConnectionState.IN_GAME),
EX_RESET_STATUS_BONUS(0x190, null, ConnectionState.IN_GAME),
EX_OLYMPIAD_MY_RANKING_INFO(0x191, RequestOlympiadMyRankingInfo::new, ConnectionState.IN_GAME),
EX_OLYMPIAD_RANKING_INFO(0x192, RequestOlympiadRankingInfo::new, ConnectionState.IN_GAME),
EX_OLYMPIAD_HERO_AND_LEGEND_INFO(0x193, RequestOlympiadHeroAndLegendInfo::new, ConnectionState.IN_GAME),
EX_CASTLEWAR_OBSERVER_START(0x194, null, ConnectionState.IN_GAME),
EX_RAID_TELEPORT_INFO(0x195, null, ConnectionState.IN_GAME),
EX_TELEPORT_TO_RAID_POSITION(0x196, null, ConnectionState.IN_GAME),
EX_CRAFT_EXTRACT(0x197, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_INFO(0x198, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_LOCK_SLOT(0x199, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_REFRESH(0x19A, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_MAKE(0x19B, null, ConnectionState.IN_GAME),
EX_MULTI_SELL_LIST(0x19C, null, ConnectionState.IN_GAME),
EX_SAVE_ITEM_ANNOUNCE_SETTING(0x19D, null, ConnectionState.IN_GAME),
EX_ANTIBOT(0x19E, null, ConnectionState.IN_GAME),
EX_DPSVR(0x19F, null, ConnectionState.IN_GAME),
EX_TENPROTECT_DECRYPT_ERROR(0x1A0, null, ConnectionState.IN_GAME),
EX_MAX(0x1A1, null, ConnectionState.IN_GAME);
public static final ExIncomingPackets[] PACKET_ARRAY;

View File

@ -785,71 +785,95 @@ public enum OutgoingPackets
EX_ELEMENTAL_SPIRIT_ABSORB(0xFE, 0x1F6),
EX_CHOOSE_LOCKED_ITEM(0xFE, 0x1F7),
EX_LOCKED_RESULT(0xFE, 0x1F8),
EX_ELEMENTAL_SPIRIT_EXTRACT(0xFE, 0x1F9), // 152
EX_OLYMPIAD_INFO(0xFE, 0x1FA), // 152
EX_OLYMPIAD_RECORD(0xFE, 0x1FB), // 152
EX_OLYMPIAD_MATCH_INFO(0xFE, 0x1FC), // 152
EX_ELEMENTAL_SPIRIT_GET_EXP(0xFE, 0x1FD), // 152
EX_ITEM_ANNOUNCE(0xFE, 0x1FE), // 152
// 152
EX_ELEMENTAL_SPIRIT_EXTRACT(0xFE, 0x1F9),
EX_OLYMPIAD_INFO(0xFE, 0x1FA),
EX_OLYMPIAD_RECORD(0xFE, 0x1FB),
EX_OLYMPIAD_MATCH_INFO(0xFE, 0x1FC),
EX_ELEMENTAL_SPIRIT_GET_EXP(0xFE, 0x1FD),
EX_ITEM_ANNOUNCE(0xFE, 0x1FE),
EX_DRESS_ROOM_UI_OPEN(0xFE, 0x1FF),
EX_DRESS_HANGER_LIST(0xFE, 0x200),
EX_USER_BAN_INFO(0xFE, 0x201),
EX_TRY_ENCHANT_ARTIFACT_RESULT(0xFE, 0x202), // 152
EX_XIGN_CODE(0xFE, 0x203), // 152
EX_SHOW_UPGRADE_SYSTEM_NORMAL(0xFE, 0x204), // 196
EX_UPGRADE_SYSTEM_NORMAL_RESULT(0xFE, 0x205), // 196
EX_PURCHASE_LIMIT_SHOP_ITEM_L(0xFE, 0x206), // 196
EX_PURCHASE_LIMIT_SHOP_ITEM_B(0xFE, 0x207), // 196
EX_BLOODY_COIN_COUNT(0xFE, 0x208), // 196
EX_CLASS_CHANGE_SET_ALARM(0xFE, 0x209), // 196
EX_REQUEST_CLASS_CHANGE(0xFE, 0x20A), // 196
EX_REQUEST_CLASS_CHANGE_VERIFY(0xFE, 0x20B), // 196
EX_COSTUME_USE_ITEM(0xFE, 0x20C), // 196
EX_CHOOSE_COSTUME_ITEM(0xFE, 0x20D), // 196
EX_SEND_COSTUME_LIST(0xFE, 0x20E), // 196
EX_SEND_COSTUME_LIST_FULL(0xFE, 0x20F), // 196
EX_COSTUME_COLLECTION_SKILL_A(0xFE, 0x211), // 196
EX_COSTUME_EVOLUTION(0xFE, 0x212), // 196
EX_COSTUME_EXTRACT(0xFE, 0x213), // 196
EX_COSTUME_LOCK(0xFE, 0x214), // 196
EX_COSTUME_SHORTCUT_LIST(0xFE, 0x215), // 196
EX_MAGICLAMP_EXP_INFO(0xFE, 0x216), // 196
EX_MAGICLAMP_GAME_INFO(0xFE, 0x217), // 196
EX_MAGICLAMP_GAME_RESULT(0xFE, 0x218), // 196
EX_SHOW_TELEPORT_UI(0xFE, 0x219), // 228
EX_ACTIVATE_AUTO_SHORTCUT(0xFE, 0x21A), // 228
EX_PREMIUM_MANAGER_SHOW_HTML(0xFE, 0x21B), // 228
EX_ACTIVATED_CURSED_TREASURE(0xFE, 0x21C), // 228
EX_PAYBACK_LIST(0xFE, 0x21D), // 228
EX_PAYBACK_GIVE_REWARD(0xFE, 0x21E), // 228
EX_PAYBACK_UI_LAUNCHER(0xFE, 0x21F), // 228
EX_DIE_INFO(0xFE, 0x220), // 228
EX_AUTOPLAY_SETTING(0xFE, 0x221), // 228
EX_AUTOPLAY_DO_MACRO(0xFE, 0x222), // 228
EX_OLYMPIAD_MATCH_MAKING_RESULT(0xFE, 0x223), // 228
EX_FESTIVAL_BM_INFO(0xFE, 0x224), // 228
EX_FESTIVAL_BM_ALL_ITEM_INFO(0xFE, 0x225), // 228
EX_FESTIVAL_BM_TOP_ITEM_INFO(0xFE, 0x226), // 228
EX_FESTIVAL_BM_GAME(0xFE, 0x227), // 228
EX_GACHA_SHOP_INFO(0xFE, 0x228), // 228
EX_GACHA_SHOP_GACHA_GROUP(0xFE, 0x229), // 228
EX_GACHA_SHOP_GACHA_ITEM(0xFE, 0x22A), // 228
EX_TIME_RESTRICT_FIELD_LIST(0xFE, 0x22B), // 228
EX_TIME_RESTRICT_FIELD_USER_E(0xFE, 0x22C), // 228
EX_TIME_RESTRICT_FIELD_USER_C(0xFE, 0x22D), // 228
EX_TIME_RESTRICT_FIELD_USER_A(0xFE, 0x22E), // 228
EX_TIME_RESTRICT_FIELD_USER_E2(0xFE, 0x22F), // 228
EX_RANKING_CHAR_INFO(0xFE, 0x230), // 228
EX_RANKING_CHAR_HISTORY(0xFE, 0x231), // 228
EX_RANKING_CHAR_RANKERS(0xFE, 0x232), // 228
EX_BOW_ACTION_TO(0xFE, 0x233), // 228
EX_LETTER_COLLECTOR_UI_LAUNCH(0xFE, 0x234), // 228
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_HUD_INFO(0xFE, 0x235), // 228
EX_UNK_236(0xFE, 0x236), // 228
EX_UNK_237(0xFE, 0x237), // 228
EX_UNK_238(0xFE, 0x238), // 228
EX_UNK_239(0xFE, 0x239), // 228
EX_PVPBOOK_LIST(0xFE, 0x23A); // 228
EX_TRY_ENCHANT_ARTIFACT_RESULT(0xFE, 0x202),
EX_XIGN_CODE(0xFE, 0x203),
// 196
EX_SHOW_UPGRADE_SYSTEM_NORMAL(0xFE, 0x204),
EX_UPGRADE_SYSTEM_NORMAL_RESULT(0xFE, 0x205),
EX_PURCHASE_LIMIT_SHOP_ITEM_L(0xFE, 0x206),
EX_PURCHASE_LIMIT_SHOP_ITEM_B(0xFE, 0x207),
EX_BLOODY_COIN_COUNT(0xFE, 0x208),
EX_CLASS_CHANGE_SET_ALARM(0xFE, 0x209),
EX_REQUEST_CLASS_CHANGE(0xFE, 0x20A),
EX_REQUEST_CLASS_CHANGE_VERIFY(0xFE, 0x20B),
EX_COSTUME_USE_ITEM(0xFE, 0x20C),
EX_CHOOSE_COSTUME_ITEM(0xFE, 0x20D),
EX_SEND_COSTUME_LIST(0xFE, 0x20E),
EX_SEND_COSTUME_LIST_FULL(0xFE, 0x20F),
EX_COSTUME_COLLECTION_SKILL_A(0xFE, 0x211),
EX_COSTUME_EVOLUTION(0xFE, 0x212),
EX_COSTUME_EXTRACT(0xFE, 0x213),
EX_COSTUME_LOCK(0xFE, 0x214),
EX_COSTUME_SHORTCUT_LIST(0xFE, 0x215),
EX_MAGICLAMP_EXP_INFO(0xFE, 0x216),
EX_MAGICLAMP_GAME_INFO(0xFE, 0x217),
EX_MAGICLAMP_GAME_RESULT(0xFE, 0x218),
// 228
EX_SHOW_TELEPORT_UI(0xFE, 0x219),
EX_ACTIVATE_AUTO_SHORTCUT(0xFE, 0x21A),
EX_PREMIUM_MANAGER_SHOW_HTML(0xFE, 0x21B),
EX_ACTIVATED_CURSED_TREASURE(0xFE, 0x21C),
EX_PAYBACK_LIST(0xFE, 0x21D),
EX_PAYBACK_GIVE_REWARD(0xFE, 0x21E),
EX_PAYBACK_UI_LAUNCHER(0xFE, 0x21F),
EX_DIE_INFO(0xFE, 0x220),
EX_AUTOPLAY_SETTING(0xFE, 0x221),
EX_AUTOPLAY_DO_MACRO(0xFE, 0x222),
EX_OLYMPIAD_MATCH_MAKING_RESULT(0xFE, 0x223),
EX_FESTIVAL_BM_INFO(0xFE, 0x224),
EX_FESTIVAL_BM_ALL_ITEM_INFO(0xFE, 0x225),
EX_FESTIVAL_BM_TOP_ITEM_INFO(0xFE, 0x226),
EX_FESTIVAL_BM_GAME(0xFE, 0x227),
EX_GACHA_SHOP_INFO(0xFE, 0x228),
EX_GACHA_SHOP_GACHA_GROUP(0xFE, 0x229),
EX_GACHA_SHOP_GACHA_ITEM(0xFE, 0x22A),
EX_TIME_RESTRICT_FIELD_LIST(0xFE, 0x22B),
EX_TIME_RESTRICT_FIELD_USER_ENTER(0xFE, 0x22C),
EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT(0xFE, 0x22D),
EX_TIME_RESTRICT_FIELD_USER_ALARM(0xFE, 0x22E),
EX_TIME_RESTRICT_FIELD_USER_EXIT(0xFE, 0x22F),
EX_RANKING_CHAR_INFO(0xFE, 0x230),
EX_RANKING_CHAR_HISTORY(0xFE, 0x231),
EX_RANKING_CHAR_RANKERS(0xFE, 0x232),
EX_BOW_ACTION_TO(0xFE, 0x233),
EX_LETTER_COLLECTOR_UI_LAUNCH(0xFE, 0x234),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_HUD_INFO(0xFE, 0x235),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_INFO(0xFE, 0x236),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_ATTACKER_LIST(0xFE, 0x237),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_DEFENDER_LIST(0xFE, 0x238),
EX_PLEDGE_MERCENARY_MEMBER_LIST(0xFE, 0x239),
EX_PVPBOOK_LIST(0xFE, 0x23A),
EX_PVPBOOK_KILLER_LOCATION(0xFE, 0x23B),
EX_PVPBOOK_NEW_PK(0xFE, 0x23C),
EX_PLEDGE_MERCENARY_MEMBER_JOIN(0xFE, 0x23D),
EX_RAID_DROP_ITEM_ANNOUNCE(0xFE, 0x23E),
EX_LETTER_COLLECTOR_UI_LAUNCER(0xFE, 0x23F),
EX_OLYMPIAD_MY_RANKING_INFO(0xFE, 0x240),
EX_OLYMPIAD_RANKING_INFO(0xFE, 0x241),
EX_OLYMPIAD_HERO_AND_LEGEND_INFO(0xFE, 0x242),
EX_RAID_TELEPORT_INFO(0xFE, 0x243),
EX_CRAFT_INFO(0xFE, 0x244),
EX_CRAFT_EXTRACT(0xFE, 0x245),
EX_CRAFT_RANDOM_INFO(0xFE, 0x246),
EX_CRAFT_RANDOM_LOCK_SLOT(0xFE, 0x247),
EX_CRAFT_RANDOM_REFRESH(0xFE, 0x248),
EX_CRAFT_RANDOM_MAKE(0xFE, 0x249),
EX_ITEM_ANNOUNCE_SETTING(0xFE, 0x24A),
EX_ANTIBOT(0xFE, 0x24B),
EX_DPSVR(0xFE, 0x24C),
EX_SEND_CMD_LIST(0xFE, 0x24D),
EX_SHANGHAI_HEALTHY_TIPS(0xFE, 0x24E),
EX_MAX(0xFE, 0x24F);
private final int _id1;
private final int _id2;

View File

@ -1,40 +1,40 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingCharInfo;
/**
* @author JoeAlisson
*/
public class ExRankCharInfo implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExRankingCharInfo());
}
}
/*
* 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.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExOlympiadHeroAndLegendInfo;
/**
* @author NviX
*/
public class RequestOlympiadHeroAndLegendInfo implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExOlympiadHeroAndLegendInfo());
}
}

View File

@ -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.clientpackets.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExOlympiadMyRankingInfo;
/**
* @author NviX
*/
public class RequestOlympiadMyRankingInfo implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExOlympiadMyRankingInfo(client.getPlayer()));
}
}

View File

@ -0,0 +1,52 @@
/*
* 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.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExOlympiadRankingInfo;
/**
* @author NviX
*/
public class RequestOlympiadRankingInfo implements IClientIncomingPacket
{
private int _tabId;
private int _rankingType;
private int _unk;
private int _classId;
private int _serverId;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_tabId = packet.readC();
_rankingType = packet.readC();
_unk = packet.readC();
_classId = packet.readD();
_serverId = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExOlympiadRankingInfo(client.getPlayer(), _tabId, _rankingType, _unk, _classId, _serverId));
}
}

View File

@ -24,17 +24,20 @@ import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingCharInfo;
/**
* @author JoeAlisson
*/
public class ExRankCharInfo implements IClientIncomingPacket
public class RequestRankingCharInfo implements IClientIncomingPacket
{
private short _unk;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_unk = packet.readC();
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExRankingCharInfo());
client.sendPacket(new ExRankingCharInfo(client.getPlayer(), _unk));
}
}

View File

@ -19,12 +19,12 @@ package org.l2jmobius.gameserver.network.clientpackets.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankList;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingCharRankers;
/**
* @author JoeAlisson
*/
public class ExRankingCharRankers implements IClientIncomingPacket
public class RequestRankingCharRankers implements IClientIncomingPacket
{
private int _group;
private int _scope;
@ -33,8 +33,8 @@ public class ExRankingCharRankers implements IClientIncomingPacket
@Override
public boolean read(GameClient client, PacketReader packet)
{
_group = packet.readC();
_scope = packet.readC();
_group = packet.readC(); // Tab Id
_scope = packet.readC(); // All or personal
_race = packet.readD();
return true;
}
@ -42,6 +42,6 @@ public class ExRankingCharRankers implements IClientIncomingPacket
@Override
public void run(GameClient client)
{
client.sendPacket(new ExRankList(_group, _scope, _race));
client.sendPacket(new ExRankingCharRankers(client.getPlayer(), _group, _scope, _race));
}
}

View File

@ -0,0 +1,159 @@
/*
* 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.ranking;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.l2jmobius.Config;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.data.sql.impl.ClanTable;
import org.l2jmobius.gameserver.model.entity.Hero;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author NviX
*/
public class ExOlympiadHeroAndLegendInfo implements IClientOutgoingPacket
{
private static final String GET_HEROES = "SELECT characters.charId, characters.char_name, characters.race, characters.sex, characters.base_class, characters.level, characters.clanid, olympiad_nobles_eom.competitions_won, olympiad_nobles_eom.competitions_lost, olympiad_nobles_eom.olympiad_points, heroes.legend_count, heroes.count FROM heroes, characters, olympiad_nobles_eom WHERE characters.charId = heroes.charId AND characters.charId = olympiad_nobles_eom.charId ORDER BY olympiad_nobles_eom.olympiad_points DESC, characters.base_class ASC";
public ExOlympiadHeroAndLegendInfo()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_OLYMPIAD_HERO_AND_LEGEND_INFO.writeId(packet);
if (Hero.getInstance().getHeroes().size() > 0)
{
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_HEROES))
{
try (ResultSet rset = statement.executeQuery())
{
int i = 1;
boolean writedCount = false;
while (rset.next())
{
if (i == 1)
{
packet.writeC(1); // ?? shows 78 on JP
packet.writeC(1); // ?? shows 0 on JP
packet.writeString(rset.getString("char_name"));
int clanId = rset.getInt("clanid");
if (clanId > 0)
{
packet.writeString(ClanTable.getInstance().getClan(clanId).getName());
}
else
{
packet.writeString("");
}
packet.writeD(Config.SERVER_ID);
packet.writeD(rset.getInt("race"));
// a stupid, client uses 0 for female and 1 for male, while server no.
int sex = rset.getInt("sex");
if (sex == 1)
{
packet.writeD(0);
}
else
{
packet.writeD(1);
}
packet.writeD(rset.getInt("base_class"));
packet.writeD(rset.getInt("level"));
packet.writeD(rset.getInt("legend_count"));
packet.writeD(rset.getInt("competitions_won"));
packet.writeD(rset.getInt("competitions_lost"));
packet.writeD(rset.getInt("olympiad_points"));
if (clanId > 0)
{
packet.writeD(ClanTable.getInstance().getClan(clanId).getLevel());
}
else
{
packet.writeD(0);
}
i++;
}
else
{
if (!writedCount)
{
packet.writeD(Hero.getInstance().getHeroes().size() - 1);
}
if (Hero.getInstance().getHeroes().size() > 1)
{
packet.writeString(rset.getString("char_name"));
int clanId = rset.getInt("clanid");
if (clanId > 0)
{
packet.writeString(ClanTable.getInstance().getClan(clanId).getName());
}
else
{
packet.writeString("");
}
packet.writeD(Config.SERVER_ID);
packet.writeD(rset.getInt("race"));
// a stupid, client uses 0 for female and 1 for male, while server no.
int sex = rset.getInt("sex");
if (sex == 1)
{
packet.writeD(0);
}
else
{
packet.writeD(1);
}
packet.writeD(rset.getInt("base_class"));
packet.writeD(rset.getInt("level"));
packet.writeD(rset.getInt("count"));
packet.writeD(rset.getInt("competitions_won"));
packet.writeD(rset.getInt("competitions_lost"));
packet.writeD(rset.getInt("olympiad_points"));
if (clanId > 0)
{
packet.writeD(ClanTable.getInstance().getClan(clanId).getLevel());
}
else
{
packet.writeD(0);
}
}
}
}
}
}
catch (SQLException e)
{
LOGGER.warning("Hero and Legend Info: Couldnt load data: " + e.getMessage());
}
}
return true;
}
}

View File

@ -0,0 +1,172 @@
/*
* 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.ranking;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.entity.Hero;
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author NviX
*/
public class ExOlympiadMyRankingInfo implements IClientOutgoingPacket
{
private static final String GET_CURRENT_CYCLE_DATA = "SELECT charId, olympiad_points, competitions_won, competitions_lost FROM olympiad_nobles WHERE class_id = ?";
private static final String GET_PREVIOUS_CYCLE_DATA = "SELECT charId, olympiad_points, competitions_won, competitions_lost FROM olympiad_nobles_eom WHERE class_id = ?";
private final PlayerInstance _player;
public ExOlympiadMyRankingInfo(PlayerInstance player)
{
_player = player;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_OLYMPIAD_MY_RANKING_INFO.writeId(packet);
Date date = new Date();
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
// Add one to month {0 - 11}
int month = calendar.get(Calendar.MONTH) + 1;
if (Olympiad.getInstance().getCurrentCycle() > 1)
{
if (month == 1)
{
year--;
month = 12;
}
else
{
month--;
}
int currentPlace = 0;
int currentWins = 0;
int currentLoses = 0;
int currentPoints = 0;
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_CURRENT_CYCLE_DATA))
{
statement.setInt(1, _player.getBaseClass());
try (ResultSet rset = statement.executeQuery())
{
int i = 1;
while (rset.next())
{
if (rset.getInt("charId") == _player.getObjectId())
{
currentPlace = i;
currentWins = rset.getInt("competitions_won");
currentLoses = rset.getInt("competitions_lost");
currentPoints = rset.getInt("olympiad_points");
}
i++;
}
}
}
catch (SQLException e)
{
LOGGER.warning("Olympiad my ranking: Couldnt load data: " + e.getMessage());
}
int previousPlace = 0;
int previousWins = 0;
int previousLoses = 0;
int previousPoints = 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");
}
i++;
}
}
}
catch (SQLException e)
{
LOGGER.warning("Olympiad my ranking: Couldnt load data: " + e.getMessage());
}
int heroCount = 0;
int legendCount = 0;
if (Hero.getInstance().getCompleteHeroes().containsKey(_player.getObjectId()))
{
final StatsSet hero = Hero.getInstance().getCompleteHeroes().get(_player.getObjectId());
heroCount = hero.getInt("count");
legendCount = hero.getInt("legend_count");
}
packet.writeD(year); // Year
packet.writeD(month); // Month
packet.writeD(Olympiad.getInstance().getCurrentCycle() - 1); // cycle ?
packet.writeD(currentPlace); // Place on current cycle ?
packet.writeD(currentWins); // Wins
packet.writeD(currentLoses); // Loses
packet.writeD(currentPoints); // Points
packet.writeD(previousPlace); // Place on previous cycle
packet.writeD(previousWins); // win count & lose count previous cycle? lol
packet.writeD(previousLoses); // ??
packet.writeD(previousPoints); // Points on previous cycle
packet.writeD(heroCount); // Hero counts
packet.writeD(legendCount); // Legend counts
packet.writeD(0); // change to 1 causes shows nothing
}
else
{
packet.writeD(year); // Year
packet.writeD(month); // Month
packet.writeD(0); // cycle
packet.writeD(0); // ??
packet.writeD(0); // Wins
packet.writeD(0); // Loses
packet.writeD(0); // Points
packet.writeD(0); // Place on previous cycle
packet.writeD(0); // win count & lose count previous cycle? lol
packet.writeD(0); // ??
packet.writeD(0); // Points on previous cycle
packet.writeD(0); // Hero counts
packet.writeD(0); // Legend counts
packet.writeD(0); // change to 1 causes shows nothing
}
return true;
}
}

View File

@ -0,0 +1,311 @@
/*
* 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.ranking;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author NviX
*/
public class ExOlympiadRankingInfo implements IClientOutgoingPacket
{
private final PlayerInstance _player;
private final int _tabId;
private final int _rankingType;
private final int _unk;
private final int _classId;
private final int _serverId;
private final Map<Integer, StatsSet> _playerList;
private final Map<Integer, StatsSet> _snapshotList;
public ExOlympiadRankingInfo(PlayerInstance player, int tabId, int rankingType, int unk, int classId, int serverId)
{
_player = player;
_tabId = tabId;
_rankingType = rankingType;
_unk = unk;
_classId = classId;
_serverId = serverId;
_playerList = RankManager.getInstance().getOlyRankList();
_snapshotList = RankManager.getInstance().getSnapshotOlyList();
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_OLYMPIAD_RANKING_INFO.writeId(packet);
packet.writeC(_tabId); // Tab id
packet.writeC(_rankingType); // ranking type
packet.writeC(_unk); // unk, shows 1 all time
packet.writeD(_classId); // class id (default 148) or caller class id for personal rank
packet.writeD(_serverId); // 0 - all servers, server id - for caller server
packet.writeD(933); // unk, 933 all time
if (_playerList.size() > 0)
{
switch (_tabId)
{
case 0:
{
if (_rankingType == 0)
{
packet.writeD(_playerList.size() > 100 ? 100 : _playerList.size());
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
packet.writeString(player.getString("name")); // name
packet.writeString(player.getString("clanName")); // clan name
packet.writeD(id); // rank
if (_snapshotList.size() > 0)
{
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // previous rank
}
}
}
else
{
packet.writeD(id);
}
packet.writeD(Config.SERVER_ID);// server id
packet.writeD(player.getInt("level"));// level
packet.writeD(player.getInt("classId"));// class id
packet.writeD(player.getInt("clanLevel"));// clan level
packet.writeD(player.getInt("competitions_won"));// win count
packet.writeD(player.getInt("competitions_lost"));// lose count
packet.writeD(player.getInt("olympiad_points"));// points
packet.writeD(player.getInt("count"));// hero counts
packet.writeD(player.getInt("legend_count"));// legend counts
}
}
else
{
boolean found = false;
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (player.getInt("charId") == _player.getObjectId())
{
found = true;
int first = id > 10 ? (id - 9) : 1;
int last = _playerList.size() >= (id + 10) ? id + 10 : id + (_playerList.size() - id);
if (first == 1)
{
packet.writeD(last - (first - 1));
}
else
{
packet.writeD(last - first);
}
for (int id2 = first; id2 <= last; id2++)
{
final StatsSet plr = _playerList.get(id2);
packet.writeString(plr.getString("name"));
packet.writeString(plr.getString("clanName"));
packet.writeD(id2);
if (_snapshotList.size() > 0)
{
for (Integer id3 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id3);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id3); // class rank snapshot
}
}
}
else
{
packet.writeD(id2);
}
packet.writeD(Config.SERVER_ID);
packet.writeD(plr.getInt("level"));
packet.writeD(plr.getInt("classId"));
packet.writeD(plr.getInt("clanLevel"));// clan level
packet.writeD(plr.getInt("competitions_won"));// win count
packet.writeD(plr.getInt("competitions_lost"));// lose count
packet.writeD(plr.getInt("olympiad_points"));// points
packet.writeD(plr.getInt("count"));// hero counts
packet.writeD(plr.getInt("legend_count"));// legend counts
}
}
}
if (!found)
{
packet.writeD(0);
}
}
break;
}
case 1:
{
if (_rankingType == 0)
{
int count = 0;
for (int i = 1; i <= _playerList.size(); i++)
{
final StatsSet player = _playerList.get(i);
if (_classId == player.getInt("classId"))
{
count++;
}
}
packet.writeD(count > 50 ? 50 : count);
int i = 1;
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (_classId == player.getInt("classId"))
{
packet.writeString(player.getString("name"));
packet.writeString(player.getString("clanName"));
packet.writeD(i); // class rank
if (_snapshotList.size() > 0)
{
final Map<Integer, StatsSet> snapshotRaceList = new ConcurrentHashMap<>();
int j = 1;
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (_classId == snapshot.getInt("classId"))
{
snapshotRaceList.put(j, _snapshotList.get(id2));
j++;
}
}
for (Integer id2 : snapshotRaceList.keySet())
{
final StatsSet snapshot = snapshotRaceList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // class rank snapshot
}
}
}
else
{
packet.writeD(i);
}
packet.writeD(Config.SERVER_ID);
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("clanLevel"));// clan level
packet.writeD(player.getInt("competitions_won"));// win count
packet.writeD(player.getInt("competitions_lost"));// lose count
packet.writeD(player.getInt("olympiad_points"));// points
packet.writeD(player.getInt("count"));// hero counts
packet.writeD(player.getInt("legend_count"));// legend counts
i++;
}
}
}
else
{
boolean found = false;
final Map<Integer, StatsSet> classList = new ConcurrentHashMap<>();
int i = 1;
for (Integer id : _playerList.keySet())
{
final StatsSet set = _playerList.get(id);
if (_player.getBaseClass() == set.getInt("classId"))
{
classList.put(i, _playerList.get(id));
i++;
}
}
for (Integer id : classList.keySet())
{
final StatsSet player = classList.get(id);
if (player.getInt("charId") == _player.getObjectId())
{
found = true;
int first = id > 10 ? (id - 9) : 1;
int last = classList.size() >= (id + 10) ? id + 10 : id + (classList.size() - id);
if (first == 1)
{
packet.writeD(last - (first - 1));
}
else
{
packet.writeD(last - first);
}
for (int id2 = first; id2 <= last; id2++)
{
final StatsSet plr = classList.get(id2);
packet.writeString(plr.getString("name"));
packet.writeString(plr.getString("clanName"));
packet.writeD(id2); // class rank
packet.writeD(id2);
packet.writeD(Config.SERVER_ID);
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("clanLevel"));// clan level
packet.writeD(player.getInt("competitions_won"));// win count
packet.writeD(player.getInt("competitions_lost"));// lose count
packet.writeD(player.getInt("olympiad_points"));// points
packet.writeD(player.getInt("count"));// hero counts
packet.writeD(player.getInt("legend_count"));// legend counts
}
}
}
if (!found)
{
packet.writeD(0);
}
}
break;
}
}
}
return true;
}
}

View File

@ -1,99 +0,0 @@
/*
* 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.ranking;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author JoeAlisson
*/
public class ExRankList implements IClientOutgoingPacket
{
private final int _race;
private final int _group;
private final int _scope;
public ExRankList(int group, int scope, int race)
{
_group = group;
_scope = scope;
_race = race;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_RANKING_CHAR_RANKERS.writeId(packet);
packet.writeC(_group);
packet.writeC(_scope);
packet.writeD(_race);
List<Ranker> rankers = new ArrayList<>();
for (int i = 0; i < 5; i++)
{
addRanker(rankers);
}
packet.writeD(rankers.size());
for (Ranker ranker : rankers)
{
packet.writeString(ranker.name);
packet.writeString(ranker.pledgeName);
packet.writeD(ranker.level);
packet.writeD(ranker.rClass);
packet.writeD(ranker.race);
packet.writeD(ranker.rank);
packet.writeD(ranker.serverRankSnapshot);
packet.writeD(ranker.raceRankSnapshot);
}
return true;
}
private static void addRanker(List<Ranker> rankers)
{
final Ranker ranker = new Ranker();
ranker.name = "Ranker" + rankers.size();
ranker.pledgeName = "ClanRanker" + rankers.size();
ranker.level = 80 - rankers.size();
ranker.race = rankers.size();
ranker.rClass = 20 + rankers.size();
ranker.rank = 1 + rankers.size();
ranker.serverRankSnapshot = ranker.rank + ((rankers.size() % 2) == 0 ? 2 : -1);
ranker.raceRankSnapshot = rankers.size();
rankers.add(ranker);
}
private static class Ranker
{
String name;
String pledgeName;
int level;
int rClass;
int rank;
int race;
int serverRankSnapshot;
int raceRankSnapshot;
}
}

View File

@ -16,17 +16,32 @@
*/
package org.l2jmobius.gameserver.network.serverpackets.ranking;
import java.util.Map;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author JoeAlisson
* @author NviX
*/
public class ExRankingCharInfo implements IClientOutgoingPacket
{
public ExRankingCharInfo()
@SuppressWarnings("unused")
private final short _unk;
private final PlayerInstance _player;
private final Map<Integer, StatsSet> _playerList;
private final Map<Integer, StatsSet> _snapshotList;
public ExRankingCharInfo(PlayerInstance player, short unk)
{
_unk = unk;
_player = player;
_playerList = RankManager.getInstance().getRankList();
_snapshotList = RankManager.getInstance().getSnapshotList();
}
@Override
@ -34,11 +49,40 @@ public class ExRankingCharInfo implements IClientOutgoingPacket
{
OutgoingPackets.EX_RANKING_CHAR_INFO.writeId(packet);
packet.writeD(1); // server rank
packet.writeD(2); // race rank
packet.writeD(2); // server rank snapshot
packet.writeD(1); // race rank snapshot
if (_playerList.size() > 0)
{
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (player.getInt("charId") == _player.getObjectId())
{
packet.writeD(id); // server rank
packet.writeD(player.getInt("raceRank")); // race rank
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
return true;
}
}
}
}
packet.writeD(0); // server rank
packet.writeD(0); // race rank
packet.writeD(0); // server rank snapshot
packet.writeD(0); // race rank snapshot
}
else
{
packet.writeD(0); // server rank
packet.writeD(0); // race rank
packet.writeD(0); // server rank snapshot
packet.writeD(0); // race rank snapshot
}
return true;
}
}

View File

@ -0,0 +1,435 @@
/*
* 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.ranking;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author NviX
*/
public class ExRankingCharRankers implements IClientOutgoingPacket
{
private final PlayerInstance _player;
private final int _race;
private final int _group;
private final int _scope;
private final Map<Integer, StatsSet> _playerList;
private final Map<Integer, StatsSet> _snapshotList;
public ExRankingCharRankers(PlayerInstance player, int group, int scope, int race)
{
_player = player;
_group = group;
_scope = scope;
_race = race;
_playerList = RankManager.getInstance().getRankList();
_snapshotList = RankManager.getInstance().getSnapshotList();
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_RANKING_CHAR_RANKERS.writeId(packet);
packet.writeC(_group);
packet.writeC(_scope);
packet.writeD(_race);
if (_playerList.size() > 0)
{
switch (_group)
{
case 0: // all
{
if (_scope == 0) // all
{
int count = _playerList.size() > 150 ? 150 : _playerList.size();
packet.writeD(count);
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
packet.writeString(player.getString("name"));
packet.writeString(player.getString("clanName"));
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("race"));
packet.writeD(id); // server rank
if (_snapshotList.size() > 0)
{
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
}
}
}
else
{
packet.writeD(id);
packet.writeD(0);
}
}
}
else
{
boolean found = false;
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (player.getInt("charId") == _player.getObjectId())
{
found = true;
int first = id > 10 ? (id - 9) : 1;
int last = _playerList.size() >= (id + 10) ? id + 10 : id + (_playerList.size() - id);
if (first == 1)
{
packet.writeD(last - (first - 1));
}
else
{
packet.writeD(last - first);
}
for (int id2 = first; id2 <= last; id2++)
{
final StatsSet plr = _playerList.get(id2);
packet.writeString(plr.getString("name"));
packet.writeString(plr.getString("clanName"));
packet.writeD(plr.getInt("level"));
packet.writeD(plr.getInt("classId"));
packet.writeD(plr.getInt("race"));
packet.writeD(id2); // server rank
if (_snapshotList.size() > 0)
{
for (Integer id3 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id3);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id3); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank"));
}
}
}
}
}
}
if (!found)
{
packet.writeD(0);
}
}
break;
}
case 1: // race
{
if (_scope == 0) // all
{
int count = 0;
for (int i = 1; i <= _playerList.size(); i++)
{
final StatsSet player = _playerList.get(i);
if (_race == player.getInt("race"))
{
count++;
}
}
packet.writeD(count > 100 ? 100 : count);
int i = 1;
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (_race == player.getInt("race"))
{
packet.writeString(player.getString("name"));
packet.writeString(player.getString("clanName"));
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("race"));
packet.writeD(i); // server rank
if (_snapshotList.size() > 0)
{
final Map<Integer, StatsSet> snapshotRaceList = new ConcurrentHashMap<>();
int j = 1;
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (_race == snapshot.getInt("race"))
{
snapshotRaceList.put(j, _snapshotList.get(id2));
j++;
}
}
for (Integer id2 : snapshotRaceList.keySet())
{
final StatsSet snapshot = snapshotRaceList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
}
}
}
else
{
packet.writeD(i);
packet.writeD(i);
}
i++;
}
}
}
else
{
boolean found = false;
final Map<Integer, StatsSet> raceList = new ConcurrentHashMap<>();
int i = 1;
for (Integer id : _playerList.keySet())
{
final StatsSet set = _playerList.get(id);
if (_player.getRace().ordinal() == set.getInt("race"))
{
raceList.put(i, _playerList.get(id));
i++;
}
}
for (Integer id : raceList.keySet())
{
final StatsSet player = raceList.get(id);
if (player.getInt("charId") == _player.getObjectId())
{
found = true;
int first = id > 10 ? (id - 9) : 1;
int last = raceList.size() >= (id + 10) ? id + 10 : id + (raceList.size() - id);
if (first == 1)
{
packet.writeD(last - (first - 1));
}
else
{
packet.writeD(last - first);
}
for (int id2 = first; id2 <= last; id2++)
{
final StatsSet plr = raceList.get(id2);
packet.writeString(plr.getString("name"));
packet.writeString(plr.getString("clanName"));
packet.writeD(plr.getInt("level"));
packet.writeD(plr.getInt("classId"));
packet.writeD(plr.getInt("race"));
packet.writeD(id2); // server rank
packet.writeD(id2);
packet.writeD(id2);
}
}
}
if (!found)
{
packet.writeD(0);
}
}
break;
}
case 2: // clan
{
if (_player.getClan() != null)
{
final Map<Integer, StatsSet> clanList = new ConcurrentHashMap<>();
int i = 1;
for (Integer id : _playerList.keySet())
{
final StatsSet set = _playerList.get(id);
if (_player.getClan().getName() == set.getString("clanName"))
{
clanList.put(i, _playerList.get(id));
i++;
}
}
packet.writeD(clanList.size());
for (Integer id : clanList.keySet())
{
final StatsSet player = clanList.get(id);
packet.writeString(player.getString("name"));
packet.writeString(player.getString("clanName"));
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("race"));
packet.writeD(id); // clan rank
if (_snapshotList.size() > 0)
{
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
}
}
}
else
{
packet.writeD(id);
packet.writeD(0);
}
}
}
else
{
packet.writeD(0);
}
break;
}
case 3: // friend
{
if (_player.getFriendList().size() > 0)
{
final Set<Integer> friendList = ConcurrentHashMap.newKeySet();
int count = 1;
for (int id : _player.getFriendList())
{
for (Integer id2 : _playerList.keySet())
{
final StatsSet temp = _playerList.get(id2);
if (temp.getInt("charId") == id)
{
friendList.add(temp.getInt("charId"));
count++;
}
}
}
friendList.add(_player.getObjectId());
packet.writeD(count);
for (int id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (friendList.contains(player.getInt("charId")))
{
packet.writeString(player.getString("name"));
packet.writeString(player.getString("clanName"));
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("race"));
packet.writeD(id); // friend rank
if (_snapshotList.size() > 0)
{
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
}
}
}
else
{
packet.writeD(id);
packet.writeD(0);
}
}
}
}
else
{
packet.writeD(1);
packet.writeString(_player.getName());
if (_player.getClan() != null)
{
packet.writeString(_player.getClan().getName());
}
else
{
packet.writeString("");
}
packet.writeD(_player.getStat().getBaseLevel());
packet.writeD(_player.getBaseClass());
packet.writeD(_player.getRace().ordinal());
packet.writeD(1); // clan rank
if (_snapshotList.size() > 0)
{
for (Integer id : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id);
if (_player.getObjectId() == snapshot.getInt("charId"))
{
packet.writeD(id); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
}
}
}
else
{
packet.writeD(0);
packet.writeD(0);
}
}
break;
}
}
}
else
{
packet.writeD(0);
}
return true;
}
}

View File

@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS `heroes` (
`charId` INT UNSIGNED NOT NULL DEFAULT 0,
`class_id` decimal(3,0) NOT NULL DEFAULT 0,
`count` decimal(3,0) NOT NULL DEFAULT 0,
`legend_count` decimal(3,0) NOT NULL DEFAULT 0,
`played` decimal(1,0) NOT NULL DEFAULT 0,
`claimed` ENUM('true','false') NOT NULL DEFAULT 'false',
`message` varchar(300) NOT NULL DEFAULT '',

View File

@ -0,0 +1,249 @@
/*
* 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.instancemanager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.gameserver.data.sql.impl.ClanTable;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.entity.Hero;
/**
* @author NviX
*/
public class RankManager
{
private static final Logger LOGGER = Logger.getLogger(RankManager.class.getName());
private static final String SELECT_CHARACTERS = "SELECT charId,char_name,level,race,base_class, clanid FROM characters WHERE level > 84 ORDER BY exp DESC";
private static final String SELECT_CHARACTERS_BY_RACE = "SELECT charId FROM characters WHERE level > 84 AND race = ? ORDER BY exp DESC";
private static final String GET_CURRENT_CYCLE_DATA = "SELECT characters.char_name, characters.level, characters.base_class, characters.clanid, olympiad_nobles.charId, olympiad_nobles.olympiad_points, olympiad_nobles.competitions_won, olympiad_nobles.competitions_lost FROM characters, olympiad_nobles WHERE characters.charId = olympiad_nobles.charId ORDER BY olympiad_nobles.olympiad_points DESC";
private static final String GET_CHARACTERS_BY_CLASS = "SELECT characters.charId, olympiad_nobles.olympiad_points FROM characters, olympiad_nobles WHERE olympiad_nobles.charId = characters.charId AND characters.base_class = ? ORDER BY olympiad_nobles.olympiad_points DESC";
private final Map<Integer, StatsSet> _mainList = new ConcurrentHashMap<>();
private Map<Integer, StatsSet> _snapshotList = new ConcurrentHashMap<>();
private final Map<Integer, StatsSet> _mainOlyList = new ConcurrentHashMap<>();
private Map<Integer, StatsSet> _snapshotOlyList = new ConcurrentHashMap<>();
protected RankManager()
{
ThreadPool.scheduleAtFixedRate(this::update, 0, 1800000);
}
public Map<Integer, StatsSet> getRankList()
{
return _mainList;
}
public Map<Integer, StatsSet> getSnapshotList()
{
return _snapshotList;
}
public Map<Integer, StatsSet> getOlyRankList()
{
return _mainOlyList;
}
public Map<Integer, StatsSet> getSnapshotOlyList()
{
return _snapshotOlyList;
}
private synchronized void update()
{
// Load charIds All
_snapshotList = _mainList;
_mainList.clear();
_snapshotOlyList = _mainOlyList;
_mainOlyList.clear();
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SELECT_CHARACTERS))
{
try (ResultSet rset = statement.executeQuery())
{
int i = 1;
while (rset.next())
{
final StatsSet player = new StatsSet();
final int charId = rset.getInt("charId");
player.set("charId", charId);
player.set("name", rset.getString("char_name"));
player.set("level", rset.getInt("level"));
player.set("classId", rset.getInt("base_class"));
final int race = rset.getInt("race");
player.set("race", race);
loadRaceRank(charId, race, player);
final int clanId = rset.getInt("clanid");
if (clanId > 0)
{
player.set("clanName", ClanTable.getInstance().getClan(clanId).getName());
}
else
{
player.set("clanName", "");
}
_mainList.put(i, player);
i++;
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Could not load chars total rank data: " + this + " - " + e.getMessage(), e);
}
// load olympiad data.
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_CURRENT_CYCLE_DATA))
{
try (ResultSet rset = statement.executeQuery())
{
int i = 1;
while (rset.next())
{
final StatsSet player = new StatsSet();
final int charId = rset.getInt("charId");
player.set("charId", charId);
player.set("name", rset.getString("char_name"));
final int clanId = rset.getInt("clanid");
if (clanId > 0)
{
player.set("clanName", ClanTable.getInstance().getClan(clanId).getName());
}
else
{
player.set("clanName", "");
}
player.set("level", rset.getInt("level"));
final int classId = rset.getInt("base_class");
player.set("classId", classId);
if (clanId > 0)
{
player.set("clanLevel", ClanTable.getInstance().getClan(clanId).getLevel());
}
else
{
player.set("clanLevel", 0);
}
player.set("competitions_won", rset.getInt("competitions_won"));
player.set("competitions_lost", rset.getInt("competitions_lost"));
player.set("olympiad_points", rset.getInt("olympiad_points"));
if (Hero.getInstance().getCompleteHeroes().containsKey(charId))
{
final StatsSet hero = Hero.getInstance().getCompleteHeroes().get(charId);
player.set("count", hero.getInt("count"));
player.set("legend_count", hero.getInt("legend_count"));
}
else
{
player.set("count", 0);
player.set("legend_count", 0);
}
loadClassRank(charId, classId, player);
_mainOlyList.put(i, player);
i++;
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Could not load olympiad total rank data: " + this + " - " + e.getMessage(), e);
}
}
private void loadClassRank(int charId, int classId, StatsSet player)
{
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(GET_CHARACTERS_BY_CLASS))
{
ps.setInt(1, classId);
try (ResultSet rset = ps.executeQuery())
{
int i = 0;
while (rset.next())
{
if (rset.getInt("charId") == charId)
{
player.set("classRank", i + 1);
}
i++;
}
if (i == 0)
{
player.set("classRank", 0);
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Could not load chars classId olympiad rank data: " + this + " - " + e.getMessage(), e);
}
}
private void loadRaceRank(int charId, int race, StatsSet player)
{
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_CHARACTERS_BY_RACE))
{
ps.setInt(1, race);
try (ResultSet rset = ps.executeQuery())
{
int i = 0;
while (rset.next())
{
if (rset.getInt("charId") == charId)
{
player.set("raceRank", i + 1);
}
i++;
}
if (i == 0)
{
player.set("raceRank", 0);
}
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Could not load chars race rank data: " + this + " - " + e.getMessage(), e);
}
}
private static class SingletonHolder
{
protected static final RankManager INSTANCE = new RankManager();
}
public static RankManager getInstance()
{
return SingletonHolder.INSTANCE;
}
}

View File

@ -45,6 +45,8 @@ import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.events.EventDispatcher;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
@ -63,11 +65,11 @@ public class Hero
{
private static final Logger LOGGER = Logger.getLogger(Hero.class.getName());
private static final String GET_HEROES = "SELECT heroes.charId, characters.char_name, heroes.class_id, heroes.count, heroes.played, heroes.claimed FROM heroes, characters WHERE characters.charId = heroes.charId AND heroes.played = 1";
private static final String GET_ALL_HEROES = "SELECT heroes.charId, characters.char_name, heroes.class_id, heroes.count, heroes.played, heroes.claimed FROM heroes, characters WHERE characters.charId = heroes.charId";
private static final String GET_HEROES = "SELECT heroes.charId, characters.char_name, heroes.class_id, heroes.count, heroes.legend_count, heroes.played, heroes.claimed FROM heroes, characters WHERE characters.charId = heroes.charId AND heroes.played = 1";
private static final String GET_ALL_HEROES = "SELECT heroes.charId, characters.char_name, heroes.class_id, heroes.count, heroes.legend_count, heroes.played, heroes.claimed FROM heroes, characters WHERE characters.charId = heroes.charId";
private static final String UPDATE_ALL = "UPDATE heroes SET played = 0";
private static final String INSERT_HERO = "INSERT INTO heroes (charId, class_id, count, played, claimed) VALUES (?,?,?,?,?)";
private static final String UPDATE_HERO = "UPDATE heroes SET count = ?, played = ?, claimed = ? WHERE charId = ?";
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 = ?";
// delete hero items
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) AND owner_id NOT IN (SELECT charId FROM characters WHERE accesslevel > 0)";
@ -82,6 +84,7 @@ public class Hero
private static final Map<Integer, String> HERO_MESSAGE = new ConcurrentHashMap<>();
public static final String COUNT = "count";
public static final String LEGEND_COUNT = "legend_count";
public static final String PLAYED = "played";
public static final String CLAIMED = "claimed";
public static final String CLAN_NAME = "clan_name";
@ -121,6 +124,7 @@ public class Hero
hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME));
hero.set(Olympiad.CLASS_ID, rset.getInt(Olympiad.CLASS_ID));
hero.set(COUNT, rset.getInt(COUNT));
hero.set(LEGEND_COUNT, rset.getInt(LEGEND_COUNT));
hero.set(PLAYED, rset.getInt(PLAYED));
hero.set(CLAIMED, Boolean.parseBoolean(rset.getString(CLAIMED)));
@ -140,6 +144,7 @@ public class Hero
hero.set(Olympiad.CHAR_NAME, rset2.getString(Olympiad.CHAR_NAME));
hero.set(Olympiad.CLASS_ID, rset2.getInt(Olympiad.CLASS_ID));
hero.set(COUNT, rset2.getInt(COUNT));
hero.set(LEGEND_COUNT, rset2.getInt(LEGEND_COUNT));
hero.set(PLAYED, rset2.getInt(PLAYED));
hero.set(CLAIMED, Boolean.parseBoolean(rset2.getString(CLAIMED)));
@ -413,6 +418,11 @@ public class Hero
return HEROES;
}
public Map<Integer, StatsSet> getCompleteHeroes()
{
return COMPLETE_HEROS;
}
public int getHeroByClass(int classid)
{
for (Entry<Integer, StatsSet> e : HEROES.entrySet())
@ -664,8 +674,16 @@ public class Hero
if (COMPLETE_HEROS.containsKey(charId))
{
final StatsSet oldHero = COMPLETE_HEROS.get(charId);
final int count = oldHero.getInt(COUNT);
oldHero.set(COUNT, count + 1);
if (hero.getInt(LEGEND_COUNT) == 1)
{
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);
}
oldHero.set(PLAYED, 1);
oldHero.set(CLAIMED, false);
HEROES.put(charId, oldHero);
@ -675,7 +693,14 @@ public class Hero
final StatsSet newHero = new StatsSet();
newHero.set(Olympiad.CHAR_NAME, hero.getString(Olympiad.CHAR_NAME));
newHero.set(Olympiad.CLASS_ID, hero.getInt(Olympiad.CLASS_ID));
newHero.set(COUNT, 1);
if (hero.getInt(LEGEND_COUNT) == 1)
{
newHero.set(LEGEND_COUNT, 1);
}
else
{
newHero.set(COUNT, 1);
}
newHero.set(PLAYED, 1);
newHero.set(CLAIMED, false);
HEROES.put(charId, newHero);
@ -711,8 +736,9 @@ public class Hero
insert.setInt(1, heroId);
insert.setInt(2, hero.getInt(Olympiad.CLASS_ID));
insert.setInt(3, hero.getInt(COUNT));
insert.setInt(4, hero.getInt(PLAYED));
insert.setString(5, String.valueOf(hero.getBoolean(CLAIMED)));
insert.setInt(4, hero.getInt(LEGEND_COUNT));
insert.setInt(5, hero.getInt(PLAYED));
insert.setString(6, String.valueOf(hero.getBoolean(CLAIMED)));
insert.execute();
insert.close();
}
@ -760,6 +786,7 @@ public class Hero
try (PreparedStatement statement = con.prepareStatement(UPDATE_HERO))
{
statement.setInt(1, hero.getInt(COUNT));
statement.setInt(2, hero.getInt(LEGEND_COUNT));
statement.setInt(2, hero.getInt(PLAYED));
statement.setString(3, String.valueOf(hero.getBoolean(CLAIMED)));
statement.setInt(4, heroId);
@ -948,6 +975,7 @@ public class Hero
loadFights(player.getObjectId());
loadDiary(player.getObjectId());
HERO_MESSAGE.put(player.getObjectId(), "");
EventDispatcher.getInstance().notifyEvent(new OnPlayerTakeHero(player));
updateHeroes(false);
}

View File

@ -113,6 +113,7 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSubCha
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonAgathion;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonSpawn;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction;
@ -268,6 +269,7 @@ public enum EventType
ON_PLAYER_SKILL_LEARN(OnPlayerSkillLearn.class, void.class),
ON_PLAYER_SUMMON_SPAWN(OnPlayerSummonSpawn.class, void.class),
ON_PLAYER_SUMMON_TALK(OnPlayerSummonTalk.class, void.class),
ON_PLAYER_TAKE_HERO(OnPlayerTakeHero.class, void.class),
ON_PLAYER_TRANSFORM(OnPlayerTransform.class, void.class),
ON_PLAYER_SUB_CHANGE(OnPlayerSubChange.class, void.class),
ON_PLAYER_QUEST_ABORT(OnPlayerQuestAbort.class, void.class),

View File

@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.events.impl.creature.player;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
/**
* @author Mobius
*/
public class OnPlayerTakeHero implements IBaseEvent
{
private final PlayerInstance _player;
public OnPlayerTakeHero(PlayerInstance player)
{
_player = player;
}
public PlayerInstance getPlayer()
{
return _player;
}
@Override
public EventType getType()
{
return EventType.ON_PLAYER_TRANSFORM;
}
}

View File

@ -95,8 +95,11 @@ import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRProduct
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRRecentProductList;
import org.l2jmobius.gameserver.network.clientpackets.raidbossinfo.RequestRaidBossSpawnInfo;
import org.l2jmobius.gameserver.network.clientpackets.raidbossinfo.RequestRaidServerInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.ExRankCharInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.ExRankingCharRankers;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadHeroAndLegendInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadMyRankingInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestOlympiadRankingInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharInfo;
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneList;
@ -166,6 +169,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
ANSWER_JOIN_PARTY_ROOM(0x30, AnswerJoinPartyRoom::new, ConnectionState.IN_GAME),
REQUEST_LIST_PARTY_MATCHING_WAITING_ROOM(0x31, RequestListPartyMatchingWaitingRoom::new, ConnectionState.IN_GAME),
REQUEST_EX_ENCHANT_ITEM_ATTRIBUTE(0x32, RequestExEnchantItemAttribute::new, ConnectionState.IN_GAME),
CANNOT_AIRSHIP_MOVE_ANYMORE(0x34, null, ConnectionState.IN_GAME),
MOVE_TO_LOCATION_AIR_SHIP(0x35, MoveToLocationAirShip::new, ConnectionState.IN_GAME),
REQUEST_BID_ITEM_AUCTION(0x36, RequestBidItemAuction::new, ConnectionState.IN_GAME),
REQUEST_INFO_ITEM_AUCTION(0x37, RequestInfoItemAuction::new, ConnectionState.IN_GAME),
@ -181,6 +185,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
REQUEST_EX_MAGIC_SKILL_USE_GROUND(0x41, RequestExMagicSkillUseGround::new, ConnectionState.IN_GAME),
REQUEST_DUEL_SURRENDER(0x42, RequestDuelSurrender::new, ConnectionState.IN_GAME),
REQUEST_EX_ENCHANT_SKILL_INFO_DETAIL(0x43, RequestExEnchantSkillInfoDetail::new, ConnectionState.IN_GAME),
REQUEST_ANTI_FREE_SERVER(0x44, null, ConnectionState.IN_GAME),
REQUEST_FORTRESS_MAP_INFO(0x45, RequestFortressMapInfo::new, ConnectionState.IN_GAME),
REQUEST_PVP_MATCH_RECORD(0x46, RequestPVPMatchRecord::new, ConnectionState.IN_GAME),
SET_PRIVATE_STORE_WHOLE_MSG(0x47, SetPrivateStoreWholeMsg::new, ConnectionState.IN_GAME),
@ -283,6 +288,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
REQUEST_FIRST_PLAY_START(0xAC, null, ConnectionState.IN_GAME),
REQUEST_FLY_MOVE_START(0xAD, RequestFlyMoveStart::new, ConnectionState.IN_GAME),
REQUEST_HARDWARE_INFO(0xAE, RequestHardWareInfo::new, ConnectionState.values()),
USER_INTERFACE_INFO(0xAF, null, ConnectionState.IN_GAME),
SEND_CHANGE_ATTRIBUTE_TARGET_ITEM(0xB0, SendChangeAttributeTargetItem::new, ConnectionState.IN_GAME),
REQUEST_CHANGE_ATTRIBUTE_ITEM(0xB1, RequestChangeAttributeItem::new, ConnectionState.IN_GAME),
REQUEST_CHANGE_ATTRIBUTE_CANCEL(0xB2, RequestChangeAttributeCancel::new, ConnectionState.IN_GAME),
@ -311,10 +317,12 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
REQUEST_EVENT_KALIE_TOKEN(0xC9, null, ConnectionState.IN_GAME),
REQUEST_SHOW_BEAUTY_LIST(0xCA, RequestShowBeautyList::new, ConnectionState.IN_GAME),
REQUEST_REGIST_BEAUTY(0xCB, RequestRegistBeauty::new, ConnectionState.IN_GAME),
REQUEST_SHOW_RESET_BEAUTY(0xCC, null, ConnectionState.IN_GAME),
REQUEST_SHOW_RESET_SHOP_LIST(0xCD, RequestShowResetShopList::new, ConnectionState.IN_GAME),
NET_PING(0xCE, null, ConnectionState.IN_GAME),
REQUEST_BR_ADD_BASKET_PRODUCT_INFO(0xCF, null, ConnectionState.IN_GAME),
REQUEST_BR_DELETE_BASKET_PRODUCT_INFO(0xD0, null, ConnectionState.IN_GAME),
REQUEST_BR_EXIST_NEW_PRODUCT(0xD1, null, ConnectionState.IN_GAME),
REQUEST_EX_EVENT_CAMPAIGN_INFO(0xD2, null, ConnectionState.IN_GAME),
REQUEST_PLEDGE_RECRUIT_INFO(0xD3, RequestPledgeRecruitInfo::new, ConnectionState.IN_GAME),
REQUEST_PLEDGE_RECRUIT_BOARD_SEARCH(0xD4, RequestPledgeRecruitBoardSearch::new, ConnectionState.IN_GAME),
@ -453,51 +461,78 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_REQUEST_UNLOCKED_ITEM(0x159, null, ConnectionState.IN_GAME),
EX_LOCKED_ITEM_CANCEL(0x15A, null, ConnectionState.IN_GAME),
EX_UNLOCKED_ITEM_CANCEL(0x15B, null, ConnectionState.IN_GAME),
EX_ELEMENTAL_SPIRIT_CHANGE_TYPE(0x15C, ExElementalSpiritChangeType::new, ConnectionState.IN_GAME), // 152
// 152
EX_ELEMENTAL_SPIRIT_CHANGE_TYPE(0x15C, ExElementalSpiritChangeType::new, ConnectionState.IN_GAME),
REQUEST_BLOCK_LIST_FOR_AD(0x15D, null, ConnectionState.IN_GAME),
REQUEST_USER_BAN_INFO(0x15E, null, ConnectionState.IN_GAME),
EX_INTERACT_MODIFY(0x15F, null, ConnectionState.IN_GAME), // 152
EX_TRY_ENCHANT_ARTIFACT(0x160, null, ConnectionState.IN_GAME), // 152
EX_XIGN_CODE(0x161, null, ConnectionState.IN_GAME), // 152
EX_OPEN_HTML(0x164, ExOpenDimensionalHtml::new, ConnectionState.IN_GAME), // 228
EX_REQUEST_CLASS_CHANGE(0x165, ExRequestClassChange::new, ConnectionState.IN_GAME), // 228
EX_REQUEST_CLASS_CHANGE_VERIFYING(0x166, null, ConnectionState.IN_GAME), // 228
EX_REQUEST_TELEPORT(0x167, ExRequestTeleport::new, ConnectionState.IN_GAME), // 228
EX_COSTUME_COLLECTION_SKILL_ACTIVE(0x16B, null, ConnectionState.IN_GAME), // 228
UNK_16C(0x16C, null, ConnectionState.IN_GAME), // 228
UNK_16D(0x16D, null, ConnectionState.IN_GAME), // 228
UNK_16E(0x16E, null, ConnectionState.IN_GAME), // 228
UNK_16F(0x16F, null, ConnectionState.IN_GAME), // 228
UNK_170(0x170, null, ConnectionState.IN_GAME), // 228
EX_ACTIVATE_AUTO_SHORTCUT(0x171, ExRequestActivateAutoShortcut::new, ConnectionState.IN_GAME), // 228
UNK_172(0x172, null, ConnectionState.IN_GAME), // 228
UNK_173(0x173, null, ConnectionState.IN_GAME), // 228
UNK_174(0x174, null, ConnectionState.IN_GAME), // 228
UNK_175(0x175, null, ConnectionState.IN_GAME), // 228
UNK_176(0x176, null, ConnectionState.IN_GAME), // 228
EX_AUTOPLAY_SETTING(0x177, ExAutoPlaySetting::new, ConnectionState.IN_GAME), // 228
UNK_178(0x178, null, ConnectionState.IN_GAME), // 228
UNK_179(0x179, null, ConnectionState.IN_GAME), // 228
UNK_17A(0x17A, null, ConnectionState.IN_GAME), // 228
UNK_17B(0x17B, null, ConnectionState.IN_GAME), // 228
UNK_17C(0x17C, null, ConnectionState.IN_GAME), // 228
UNK_17D(0x17D, null, ConnectionState.IN_GAME), // 228
UNK_17E(0x17E, null, ConnectionState.IN_GAME), // 228
EX_TIME_RESTRICT_FIELD_LIST(0x17F, ExTimedHuntingZoneList::new, ConnectionState.IN_GAME), // 228
EX_TIME_RESTRICT_FIELD_USER_ENTER(0x180, null, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_INFO(0x181, ExRankCharInfo::new, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_HISTORY(0x182, null, ConnectionState.IN_GAME), // 228
EX_RANKING_CHAR_RANKERS(0x183, ExRankingCharRankers::new, ConnectionState.IN_GAME), // 228
UNK_184(0x184, null, ConnectionState.IN_GAME), // 228
UNK_185(0x185, null, ConnectionState.IN_GAME), // 228
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_ATTACKER_LIST(0x186, null, ConnectionState.IN_GAME), // 228
UNK_187(0x187, null, ConnectionState.IN_GAME), // 228
UNK_188(0x188, null, ConnectionState.IN_GAME), // 228
UNK_189(0x189, null, ConnectionState.IN_GAME), // 228
UNK_18A(0x18A, null, ConnectionState.IN_GAME), // 228
EX_PVP_BOOK_LIST(0x18B, ExPvpBookList::new, ConnectionState.IN_GAME), // 228
UNK_18C(0x18C, null, ConnectionState.IN_GAME), // 228
EX_LETTER_COLLECTOR_TAKE_REWARD(0x18D, null, ConnectionState.IN_GAME); // 228
EX_INTERACT_MODIFY(0x15F, null, ConnectionState.IN_GAME),
EX_TRY_ENCHANT_ARTIFACT(0x160, null, ConnectionState.IN_GAME),
EX_UPGRADE_SYSTEM_NORMAL_REQUEST(0x161, null, ConnectionState.IN_GAME),
EX_PURCHASE_LIMIT_SHOP_ITEM_LIST(0x162, null, ConnectionState.IN_GAME),
EX_PURCHASE_LIMIT_SHOP_ITEM_BUY(0x163, null, ConnectionState.IN_GAME),
// 228
EX_OPEN_HTML(0x164, ExOpenDimensionalHtml::new, ConnectionState.IN_GAME),
EX_REQUEST_CLASS_CHANGE(0x165, ExRequestClassChange::new, ConnectionState.IN_GAME),
EX_REQUEST_CLASS_CHANGE_VERIFYING(0x166, null, ConnectionState.IN_GAME),
EX_REQUEST_TELEPORT(0x167, ExRequestTeleport::new, ConnectionState.IN_GAME),
EX_COSTUME_USE_ITEM(0x168, null, ConnectionState.IN_GAME),
EX_COSTUME_LIST(0x169, null, ConnectionState.IN_GAME),
EX_COSTUME_COLLECTION_SKILL_ACTIVE(0x16A, null, ConnectionState.IN_GAME),
EX_COSTUME_EVOLUTION(0x16B, null, ConnectionState.IN_GAME),
EX_COSTUME_EXTRACT(0x16C, null, ConnectionState.IN_GAME),
EX_COSTUME_LOCK(0x16D, null, ConnectionState.IN_GAME),
EX_COSTUME_CHANGE_SHORTCUT(0x16E, null, ConnectionState.IN_GAME),
EX_MAGICLAMP_GAME_INFO(0x16F, null, ConnectionState.IN_GAME),
EX_MAGICLAMP_GAME_START(0x170, null, ConnectionState.IN_GAME),
EX_ACTIVATE_AUTO_SHORTCUT(0x171, ExRequestActivateAutoShortcut::new, ConnectionState.IN_GAME),
EX_PREMIUM_MANAGER_LINK_HTML(0x172, null, ConnectionState.IN_GAME),
EX_PREMIUM_MANAGER_PASS_CMD_TO_SERVER(0x173, null, ConnectionState.IN_GAME),
EX_ACTIVATED_CURSED_TREASURE_BOX_LOCATION(0x174, null, ConnectionState.IN_GAME),
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_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),
EX_GACHA_SHOP_GACHA_GROUP(0x17D, null, ConnectionState.IN_GAME),
EX_GACHA_SHOP_GACHA_ITEM(0x17E, null, ConnectionState.IN_GAME),
EX_TIME_RESTRICT_FIELD_LIST(0x17F, ExTimedHuntingZoneList::new, ConnectionState.IN_GAME),
EX_TIME_RESTRICT_FIELD_USER_ENTER(0x180, null, ConnectionState.IN_GAME),
EX_RANKING_CHAR_INFO(0x181, RequestRankingCharInfo::new, ConnectionState.IN_GAME),
EX_RANKING_CHAR_HISTORY(0x182, null, ConnectionState.IN_GAME),
EX_RANKING_CHAR_RANKERS(0x183, RequestRankingCharRankers::new, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_RECRUIT_INFO_SET(0x184, null, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_CASTLEWAR_CASTLE_INFO(0x185, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_INFO(0x186, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_ATTACKER_LIST(0x187, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_DEFENDER_LIST(0x188, null, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_MEMBER_LIST(0x189, null, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_MEMBER_JOIN(0x18A, null, ConnectionState.IN_GAME),
EX_PVP_BOOK_LIST(0x18B, ExPvpBookList::new, ConnectionState.IN_GAME),
EX_PVP_BOOK_KILLER_LOCATION(0x18C, null, ConnectionState.IN_GAME),
EX_PVP_BOOK_TELEPORT_TO_KILLER(0x18D, null, ConnectionState.IN_GAME),
EX_LETTER_COLLECTOR_TAKE_REWARD(0x18E, null, ConnectionState.IN_GAME),
EX_SET_STATUS_BONUS(0x18F, null, ConnectionState.IN_GAME),
EX_RESET_STATUS_BONUS(0x190, null, ConnectionState.IN_GAME),
EX_OLYMPIAD_MY_RANKING_INFO(0x191, RequestOlympiadMyRankingInfo::new, ConnectionState.IN_GAME),
EX_OLYMPIAD_RANKING_INFO(0x192, RequestOlympiadRankingInfo::new, ConnectionState.IN_GAME),
EX_OLYMPIAD_HERO_AND_LEGEND_INFO(0x193, RequestOlympiadHeroAndLegendInfo::new, ConnectionState.IN_GAME),
EX_CASTLEWAR_OBSERVER_START(0x194, null, ConnectionState.IN_GAME),
EX_RAID_TELEPORT_INFO(0x195, null, ConnectionState.IN_GAME),
EX_TELEPORT_TO_RAID_POSITION(0x196, null, ConnectionState.IN_GAME),
EX_CRAFT_EXTRACT(0x197, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_INFO(0x198, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_LOCK_SLOT(0x199, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_REFRESH(0x19A, null, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_MAKE(0x19B, null, ConnectionState.IN_GAME),
EX_MULTI_SELL_LIST(0x19C, null, ConnectionState.IN_GAME),
EX_SAVE_ITEM_ANNOUNCE_SETTING(0x19D, null, ConnectionState.IN_GAME),
EX_ANTIBOT(0x19E, null, ConnectionState.IN_GAME),
EX_DPSVR(0x19F, null, ConnectionState.IN_GAME),
EX_TENPROTECT_DECRYPT_ERROR(0x1A0, null, ConnectionState.IN_GAME),
EX_MAX(0x1A1, null, ConnectionState.IN_GAME);
public static final ExIncomingPackets[] PACKET_ARRAY;

View File

@ -785,71 +785,95 @@ public enum OutgoingPackets
EX_ELEMENTAL_SPIRIT_ABSORB(0xFE, 0x1F6),
EX_CHOOSE_LOCKED_ITEM(0xFE, 0x1F7),
EX_LOCKED_RESULT(0xFE, 0x1F8),
EX_ELEMENTAL_SPIRIT_EXTRACT(0xFE, 0x1F9), // 152
EX_OLYMPIAD_INFO(0xFE, 0x1FA), // 152
EX_OLYMPIAD_RECORD(0xFE, 0x1FB), // 152
EX_OLYMPIAD_MATCH_INFO(0xFE, 0x1FC), // 152
EX_ELEMENTAL_SPIRIT_GET_EXP(0xFE, 0x1FD), // 152
EX_ITEM_ANNOUNCE(0xFE, 0x1FE), // 152
// 152
EX_ELEMENTAL_SPIRIT_EXTRACT(0xFE, 0x1F9),
EX_OLYMPIAD_INFO(0xFE, 0x1FA),
EX_OLYMPIAD_RECORD(0xFE, 0x1FB),
EX_OLYMPIAD_MATCH_INFO(0xFE, 0x1FC),
EX_ELEMENTAL_SPIRIT_GET_EXP(0xFE, 0x1FD),
EX_ITEM_ANNOUNCE(0xFE, 0x1FE),
EX_DRESS_ROOM_UI_OPEN(0xFE, 0x1FF),
EX_DRESS_HANGER_LIST(0xFE, 0x200),
EX_USER_BAN_INFO(0xFE, 0x201),
EX_TRY_ENCHANT_ARTIFACT_RESULT(0xFE, 0x202), // 152
EX_XIGN_CODE(0xFE, 0x203), // 152
EX_SHOW_UPGRADE_SYSTEM_NORMAL(0xFE, 0x204), // 196
EX_UPGRADE_SYSTEM_NORMAL_RESULT(0xFE, 0x205), // 196
EX_PURCHASE_LIMIT_SHOP_ITEM_L(0xFE, 0x206), // 196
EX_PURCHASE_LIMIT_SHOP_ITEM_B(0xFE, 0x207), // 196
EX_BLOODY_COIN_COUNT(0xFE, 0x208), // 196
EX_CLASS_CHANGE_SET_ALARM(0xFE, 0x209), // 196
EX_REQUEST_CLASS_CHANGE(0xFE, 0x20A), // 196
EX_REQUEST_CLASS_CHANGE_VERIFY(0xFE, 0x20B), // 196
EX_COSTUME_USE_ITEM(0xFE, 0x20C), // 196
EX_CHOOSE_COSTUME_ITEM(0xFE, 0x20D), // 196
EX_SEND_COSTUME_LIST(0xFE, 0x20E), // 196
EX_SEND_COSTUME_LIST_FULL(0xFE, 0x20F), // 196
EX_COSTUME_COLLECTION_SKILL_A(0xFE, 0x211), // 196
EX_COSTUME_EVOLUTION(0xFE, 0x212), // 196
EX_COSTUME_EXTRACT(0xFE, 0x213), // 196
EX_COSTUME_LOCK(0xFE, 0x214), // 196
EX_COSTUME_SHORTCUT_LIST(0xFE, 0x215), // 196
EX_MAGICLAMP_EXP_INFO(0xFE, 0x216), // 196
EX_MAGICLAMP_GAME_INFO(0xFE, 0x217), // 196
EX_MAGICLAMP_GAME_RESULT(0xFE, 0x218), // 196
EX_SHOW_TELEPORT_UI(0xFE, 0x219), // 228
EX_ACTIVATE_AUTO_SHORTCUT(0xFE, 0x21A), // 228
EX_PREMIUM_MANAGER_SHOW_HTML(0xFE, 0x21B), // 228
EX_ACTIVATED_CURSED_TREASURE(0xFE, 0x21C), // 228
EX_PAYBACK_LIST(0xFE, 0x21D), // 228
EX_PAYBACK_GIVE_REWARD(0xFE, 0x21E), // 228
EX_PAYBACK_UI_LAUNCHER(0xFE, 0x21F), // 228
EX_DIE_INFO(0xFE, 0x220), // 228
EX_AUTOPLAY_SETTING(0xFE, 0x221), // 228
EX_AUTOPLAY_DO_MACRO(0xFE, 0x222), // 228
EX_OLYMPIAD_MATCH_MAKING_RESULT(0xFE, 0x223), // 228
EX_FESTIVAL_BM_INFO(0xFE, 0x224), // 228
EX_FESTIVAL_BM_ALL_ITEM_INFO(0xFE, 0x225), // 228
EX_FESTIVAL_BM_TOP_ITEM_INFO(0xFE, 0x226), // 228
EX_FESTIVAL_BM_GAME(0xFE, 0x227), // 228
EX_GACHA_SHOP_INFO(0xFE, 0x228), // 228
EX_GACHA_SHOP_GACHA_GROUP(0xFE, 0x229), // 228
EX_GACHA_SHOP_GACHA_ITEM(0xFE, 0x22A), // 228
EX_TIME_RESTRICT_FIELD_LIST(0xFE, 0x22B), // 228
EX_TIME_RESTRICT_FIELD_USER_E(0xFE, 0x22C), // 228
EX_TIME_RESTRICT_FIELD_USER_C(0xFE, 0x22D), // 228
EX_TIME_RESTRICT_FIELD_USER_A(0xFE, 0x22E), // 228
EX_TIME_RESTRICT_FIELD_USER_E2(0xFE, 0x22F), // 228
EX_RANKING_CHAR_INFO(0xFE, 0x230), // 228
EX_RANKING_CHAR_HISTORY(0xFE, 0x231), // 228
EX_RANKING_CHAR_RANKERS(0xFE, 0x232), // 228
EX_BOW_ACTION_TO(0xFE, 0x233), // 228
EX_LETTER_COLLECTOR_UI_LAUNCH(0xFE, 0x234), // 228
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_HUD_INFO(0xFE, 0x235), // 228
EX_UNK_236(0xFE, 0x236), // 228
EX_UNK_237(0xFE, 0x237), // 228
EX_UNK_238(0xFE, 0x238), // 228
EX_UNK_239(0xFE, 0x239), // 228
EX_PVPBOOK_LIST(0xFE, 0x23A); // 228
EX_TRY_ENCHANT_ARTIFACT_RESULT(0xFE, 0x202),
EX_XIGN_CODE(0xFE, 0x203),
// 196
EX_SHOW_UPGRADE_SYSTEM_NORMAL(0xFE, 0x204),
EX_UPGRADE_SYSTEM_NORMAL_RESULT(0xFE, 0x205),
EX_PURCHASE_LIMIT_SHOP_ITEM_L(0xFE, 0x206),
EX_PURCHASE_LIMIT_SHOP_ITEM_B(0xFE, 0x207),
EX_BLOODY_COIN_COUNT(0xFE, 0x208),
EX_CLASS_CHANGE_SET_ALARM(0xFE, 0x209),
EX_REQUEST_CLASS_CHANGE(0xFE, 0x20A),
EX_REQUEST_CLASS_CHANGE_VERIFY(0xFE, 0x20B),
EX_COSTUME_USE_ITEM(0xFE, 0x20C),
EX_CHOOSE_COSTUME_ITEM(0xFE, 0x20D),
EX_SEND_COSTUME_LIST(0xFE, 0x20E),
EX_SEND_COSTUME_LIST_FULL(0xFE, 0x20F),
EX_COSTUME_COLLECTION_SKILL_A(0xFE, 0x211),
EX_COSTUME_EVOLUTION(0xFE, 0x212),
EX_COSTUME_EXTRACT(0xFE, 0x213),
EX_COSTUME_LOCK(0xFE, 0x214),
EX_COSTUME_SHORTCUT_LIST(0xFE, 0x215),
EX_MAGICLAMP_EXP_INFO(0xFE, 0x216),
EX_MAGICLAMP_GAME_INFO(0xFE, 0x217),
EX_MAGICLAMP_GAME_RESULT(0xFE, 0x218),
// 228
EX_SHOW_TELEPORT_UI(0xFE, 0x219),
EX_ACTIVATE_AUTO_SHORTCUT(0xFE, 0x21A),
EX_PREMIUM_MANAGER_SHOW_HTML(0xFE, 0x21B),
EX_ACTIVATED_CURSED_TREASURE(0xFE, 0x21C),
EX_PAYBACK_LIST(0xFE, 0x21D),
EX_PAYBACK_GIVE_REWARD(0xFE, 0x21E),
EX_PAYBACK_UI_LAUNCHER(0xFE, 0x21F),
EX_DIE_INFO(0xFE, 0x220),
EX_AUTOPLAY_SETTING(0xFE, 0x221),
EX_AUTOPLAY_DO_MACRO(0xFE, 0x222),
EX_OLYMPIAD_MATCH_MAKING_RESULT(0xFE, 0x223),
EX_FESTIVAL_BM_INFO(0xFE, 0x224),
EX_FESTIVAL_BM_ALL_ITEM_INFO(0xFE, 0x225),
EX_FESTIVAL_BM_TOP_ITEM_INFO(0xFE, 0x226),
EX_FESTIVAL_BM_GAME(0xFE, 0x227),
EX_GACHA_SHOP_INFO(0xFE, 0x228),
EX_GACHA_SHOP_GACHA_GROUP(0xFE, 0x229),
EX_GACHA_SHOP_GACHA_ITEM(0xFE, 0x22A),
EX_TIME_RESTRICT_FIELD_LIST(0xFE, 0x22B),
EX_TIME_RESTRICT_FIELD_USER_ENTER(0xFE, 0x22C),
EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT(0xFE, 0x22D),
EX_TIME_RESTRICT_FIELD_USER_ALARM(0xFE, 0x22E),
EX_TIME_RESTRICT_FIELD_USER_EXIT(0xFE, 0x22F),
EX_RANKING_CHAR_INFO(0xFE, 0x230),
EX_RANKING_CHAR_HISTORY(0xFE, 0x231),
EX_RANKING_CHAR_RANKERS(0xFE, 0x232),
EX_BOW_ACTION_TO(0xFE, 0x233),
EX_LETTER_COLLECTOR_UI_LAUNCH(0xFE, 0x234),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_HUD_INFO(0xFE, 0x235),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_INFO(0xFE, 0x236),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_ATTACKER_LIST(0xFE, 0x237),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_DEFENDER_LIST(0xFE, 0x238),
EX_PLEDGE_MERCENARY_MEMBER_LIST(0xFE, 0x239),
EX_PVPBOOK_LIST(0xFE, 0x23A),
EX_PVPBOOK_KILLER_LOCATION(0xFE, 0x23B),
EX_PVPBOOK_NEW_PK(0xFE, 0x23C),
EX_PLEDGE_MERCENARY_MEMBER_JOIN(0xFE, 0x23D),
EX_RAID_DROP_ITEM_ANNOUNCE(0xFE, 0x23E),
EX_LETTER_COLLECTOR_UI_LAUNCER(0xFE, 0x23F),
EX_OLYMPIAD_MY_RANKING_INFO(0xFE, 0x240),
EX_OLYMPIAD_RANKING_INFO(0xFE, 0x241),
EX_OLYMPIAD_HERO_AND_LEGEND_INFO(0xFE, 0x242),
EX_RAID_TELEPORT_INFO(0xFE, 0x243),
EX_CRAFT_INFO(0xFE, 0x244),
EX_CRAFT_EXTRACT(0xFE, 0x245),
EX_CRAFT_RANDOM_INFO(0xFE, 0x246),
EX_CRAFT_RANDOM_LOCK_SLOT(0xFE, 0x247),
EX_CRAFT_RANDOM_REFRESH(0xFE, 0x248),
EX_CRAFT_RANDOM_MAKE(0xFE, 0x249),
EX_ITEM_ANNOUNCE_SETTING(0xFE, 0x24A),
EX_ANTIBOT(0xFE, 0x24B),
EX_DPSVR(0xFE, 0x24C),
EX_SEND_CMD_LIST(0xFE, 0x24D),
EX_SHANGHAI_HEALTHY_TIPS(0xFE, 0x24E),
EX_MAX(0xFE, 0x24F);
private final int _id1;
private final int _id2;

View File

@ -0,0 +1,40 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExOlympiadHeroAndLegendInfo;
/**
* @author NviX
*/
public class RequestOlympiadHeroAndLegendInfo implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExOlympiadHeroAndLegendInfo());
}
}

View File

@ -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.clientpackets.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExOlympiadMyRankingInfo;
/**
* @author NviX
*/
public class RequestOlympiadMyRankingInfo implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExOlympiadMyRankingInfo(client.getPlayer()));
}
}

View File

@ -0,0 +1,52 @@
/*
* 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.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExOlympiadRankingInfo;
/**
* @author NviX
*/
public class RequestOlympiadRankingInfo implements IClientIncomingPacket
{
private int _tabId;
private int _rankingType;
private int _unk;
private int _classId;
private int _serverId;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_tabId = packet.readC();
_rankingType = packet.readC();
_unk = packet.readC();
_classId = packet.readD();
_serverId = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExOlympiadRankingInfo(client.getPlayer(), _tabId, _rankingType, _unk, _classId, _serverId));
}
}

View File

@ -1,47 +1,43 @@
/*
* 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.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankList;
/**
* @author JoeAlisson
*/
public class ExRankingCharRankers implements IClientIncomingPacket
{
private int _group;
private int _scope;
private int _race;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_group = packet.readC();
_scope = packet.readC();
_race = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExRankList(_group, _scope, _race));
}
}
/*
* 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.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingCharInfo;
/**
* @author JoeAlisson
*/
public class RequestRankingCharInfo implements IClientIncomingPacket
{
private short _unk;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_unk = packet.readC();
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExRankingCharInfo(client.getPlayer(), _unk));
}
}

View File

@ -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.ranking;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ranking.ExRankingCharRankers;
/**
* @author JoeAlisson
*/
public class RequestRankingCharRankers implements IClientIncomingPacket
{
private int _group;
private int _scope;
private int _race;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_group = packet.readC(); // Tab Id
_scope = packet.readC(); // All or personal
_race = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExRankingCharRankers(client.getPlayer(), _group, _scope, _race));
}
}

View File

@ -0,0 +1,159 @@
/*
* 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.ranking;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.l2jmobius.Config;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.data.sql.impl.ClanTable;
import org.l2jmobius.gameserver.model.entity.Hero;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author NviX
*/
public class ExOlympiadHeroAndLegendInfo implements IClientOutgoingPacket
{
private static final String GET_HEROES = "SELECT characters.charId, characters.char_name, characters.race, characters.sex, characters.base_class, characters.level, characters.clanid, olympiad_nobles_eom.competitions_won, olympiad_nobles_eom.competitions_lost, olympiad_nobles_eom.olympiad_points, heroes.legend_count, heroes.count FROM heroes, characters, olympiad_nobles_eom WHERE characters.charId = heroes.charId AND characters.charId = olympiad_nobles_eom.charId ORDER BY olympiad_nobles_eom.olympiad_points DESC, characters.base_class ASC";
public ExOlympiadHeroAndLegendInfo()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_OLYMPIAD_HERO_AND_LEGEND_INFO.writeId(packet);
if (Hero.getInstance().getHeroes().size() > 0)
{
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_HEROES))
{
try (ResultSet rset = statement.executeQuery())
{
int i = 1;
boolean writedCount = false;
while (rset.next())
{
if (i == 1)
{
packet.writeC(1); // ?? shows 78 on JP
packet.writeC(1); // ?? shows 0 on JP
packet.writeString(rset.getString("char_name"));
int clanId = rset.getInt("clanid");
if (clanId > 0)
{
packet.writeString(ClanTable.getInstance().getClan(clanId).getName());
}
else
{
packet.writeString("");
}
packet.writeD(Config.SERVER_ID);
packet.writeD(rset.getInt("race"));
// a stupid, client uses 0 for female and 1 for male, while server no.
int sex = rset.getInt("sex");
if (sex == 1)
{
packet.writeD(0);
}
else
{
packet.writeD(1);
}
packet.writeD(rset.getInt("base_class"));
packet.writeD(rset.getInt("level"));
packet.writeD(rset.getInt("legend_count"));
packet.writeD(rset.getInt("competitions_won"));
packet.writeD(rset.getInt("competitions_lost"));
packet.writeD(rset.getInt("olympiad_points"));
if (clanId > 0)
{
packet.writeD(ClanTable.getInstance().getClan(clanId).getLevel());
}
else
{
packet.writeD(0);
}
i++;
}
else
{
if (!writedCount)
{
packet.writeD(Hero.getInstance().getHeroes().size() - 1);
}
if (Hero.getInstance().getHeroes().size() > 1)
{
packet.writeString(rset.getString("char_name"));
int clanId = rset.getInt("clanid");
if (clanId > 0)
{
packet.writeString(ClanTable.getInstance().getClan(clanId).getName());
}
else
{
packet.writeString("");
}
packet.writeD(Config.SERVER_ID);
packet.writeD(rset.getInt("race"));
// a stupid, client uses 0 for female and 1 for male, while server no.
int sex = rset.getInt("sex");
if (sex == 1)
{
packet.writeD(0);
}
else
{
packet.writeD(1);
}
packet.writeD(rset.getInt("base_class"));
packet.writeD(rset.getInt("level"));
packet.writeD(rset.getInt("count"));
packet.writeD(rset.getInt("competitions_won"));
packet.writeD(rset.getInt("competitions_lost"));
packet.writeD(rset.getInt("olympiad_points"));
if (clanId > 0)
{
packet.writeD(ClanTable.getInstance().getClan(clanId).getLevel());
}
else
{
packet.writeD(0);
}
}
}
}
}
}
catch (SQLException e)
{
LOGGER.warning("Hero and Legend Info: Couldnt load data: " + e.getMessage());
}
}
return true;
}
}

View File

@ -0,0 +1,172 @@
/*
* 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.ranking;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.entity.Hero;
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author NviX
*/
public class ExOlympiadMyRankingInfo implements IClientOutgoingPacket
{
private static final String GET_CURRENT_CYCLE_DATA = "SELECT charId, olympiad_points, competitions_won, competitions_lost FROM olympiad_nobles WHERE class_id = ?";
private static final String GET_PREVIOUS_CYCLE_DATA = "SELECT charId, olympiad_points, competitions_won, competitions_lost FROM olympiad_nobles_eom WHERE class_id = ?";
private final PlayerInstance _player;
public ExOlympiadMyRankingInfo(PlayerInstance player)
{
_player = player;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_OLYMPIAD_MY_RANKING_INFO.writeId(packet);
Date date = new Date();
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
// Add one to month {0 - 11}
int month = calendar.get(Calendar.MONTH) + 1;
if (Olympiad.getInstance().getCurrentCycle() > 1)
{
if (month == 1)
{
year--;
month = 12;
}
else
{
month--;
}
int currentPlace = 0;
int currentWins = 0;
int currentLoses = 0;
int currentPoints = 0;
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_CURRENT_CYCLE_DATA))
{
statement.setInt(1, _player.getBaseClass());
try (ResultSet rset = statement.executeQuery())
{
int i = 1;
while (rset.next())
{
if (rset.getInt("charId") == _player.getObjectId())
{
currentPlace = i;
currentWins = rset.getInt("competitions_won");
currentLoses = rset.getInt("competitions_lost");
currentPoints = rset.getInt("olympiad_points");
}
i++;
}
}
}
catch (SQLException e)
{
LOGGER.warning("Olympiad my ranking: Couldnt load data: " + e.getMessage());
}
int previousPlace = 0;
int previousWins = 0;
int previousLoses = 0;
int previousPoints = 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");
}
i++;
}
}
}
catch (SQLException e)
{
LOGGER.warning("Olympiad my ranking: Couldnt load data: " + e.getMessage());
}
int heroCount = 0;
int legendCount = 0;
if (Hero.getInstance().getCompleteHeroes().containsKey(_player.getObjectId()))
{
final StatsSet hero = Hero.getInstance().getCompleteHeroes().get(_player.getObjectId());
heroCount = hero.getInt("count");
legendCount = hero.getInt("legend_count");
}
packet.writeD(year); // Year
packet.writeD(month); // Month
packet.writeD(Olympiad.getInstance().getCurrentCycle() - 1); // cycle ?
packet.writeD(currentPlace); // Place on current cycle ?
packet.writeD(currentWins); // Wins
packet.writeD(currentLoses); // Loses
packet.writeD(currentPoints); // Points
packet.writeD(previousPlace); // Place on previous cycle
packet.writeD(previousWins); // win count & lose count previous cycle? lol
packet.writeD(previousLoses); // ??
packet.writeD(previousPoints); // Points on previous cycle
packet.writeD(heroCount); // Hero counts
packet.writeD(legendCount); // Legend counts
packet.writeD(0); // change to 1 causes shows nothing
}
else
{
packet.writeD(year); // Year
packet.writeD(month); // Month
packet.writeD(0); // cycle
packet.writeD(0); // ??
packet.writeD(0); // Wins
packet.writeD(0); // Loses
packet.writeD(0); // Points
packet.writeD(0); // Place on previous cycle
packet.writeD(0); // win count & lose count previous cycle? lol
packet.writeD(0); // ??
packet.writeD(0); // Points on previous cycle
packet.writeD(0); // Hero counts
packet.writeD(0); // Legend counts
packet.writeD(0); // change to 1 causes shows nothing
}
return true;
}
}

View File

@ -0,0 +1,311 @@
/*
* 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.ranking;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author NviX
*/
public class ExOlympiadRankingInfo implements IClientOutgoingPacket
{
private final PlayerInstance _player;
private final int _tabId;
private final int _rankingType;
private final int _unk;
private final int _classId;
private final int _serverId;
private final Map<Integer, StatsSet> _playerList;
private final Map<Integer, StatsSet> _snapshotList;
public ExOlympiadRankingInfo(PlayerInstance player, int tabId, int rankingType, int unk, int classId, int serverId)
{
_player = player;
_tabId = tabId;
_rankingType = rankingType;
_unk = unk;
_classId = classId;
_serverId = serverId;
_playerList = RankManager.getInstance().getOlyRankList();
_snapshotList = RankManager.getInstance().getSnapshotOlyList();
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_OLYMPIAD_RANKING_INFO.writeId(packet);
packet.writeC(_tabId); // Tab id
packet.writeC(_rankingType); // ranking type
packet.writeC(_unk); // unk, shows 1 all time
packet.writeD(_classId); // class id (default 148) or caller class id for personal rank
packet.writeD(_serverId); // 0 - all servers, server id - for caller server
packet.writeD(933); // unk, 933 all time
if (_playerList.size() > 0)
{
switch (_tabId)
{
case 0:
{
if (_rankingType == 0)
{
packet.writeD(_playerList.size() > 100 ? 100 : _playerList.size());
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
packet.writeString(player.getString("name")); // name
packet.writeString(player.getString("clanName")); // clan name
packet.writeD(id); // rank
if (_snapshotList.size() > 0)
{
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // previous rank
}
}
}
else
{
packet.writeD(id);
}
packet.writeD(Config.SERVER_ID);// server id
packet.writeD(player.getInt("level"));// level
packet.writeD(player.getInt("classId"));// class id
packet.writeD(player.getInt("clanLevel"));// clan level
packet.writeD(player.getInt("competitions_won"));// win count
packet.writeD(player.getInt("competitions_lost"));// lose count
packet.writeD(player.getInt("olympiad_points"));// points
packet.writeD(player.getInt("count"));// hero counts
packet.writeD(player.getInt("legend_count"));// legend counts
}
}
else
{
boolean found = false;
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (player.getInt("charId") == _player.getObjectId())
{
found = true;
int first = id > 10 ? (id - 9) : 1;
int last = _playerList.size() >= (id + 10) ? id + 10 : id + (_playerList.size() - id);
if (first == 1)
{
packet.writeD(last - (first - 1));
}
else
{
packet.writeD(last - first);
}
for (int id2 = first; id2 <= last; id2++)
{
final StatsSet plr = _playerList.get(id2);
packet.writeString(plr.getString("name"));
packet.writeString(plr.getString("clanName"));
packet.writeD(id2);
if (_snapshotList.size() > 0)
{
for (Integer id3 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id3);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id3); // class rank snapshot
}
}
}
else
{
packet.writeD(id2);
}
packet.writeD(Config.SERVER_ID);
packet.writeD(plr.getInt("level"));
packet.writeD(plr.getInt("classId"));
packet.writeD(plr.getInt("clanLevel"));// clan level
packet.writeD(plr.getInt("competitions_won"));// win count
packet.writeD(plr.getInt("competitions_lost"));// lose count
packet.writeD(plr.getInt("olympiad_points"));// points
packet.writeD(plr.getInt("count"));// hero counts
packet.writeD(plr.getInt("legend_count"));// legend counts
}
}
}
if (!found)
{
packet.writeD(0);
}
}
break;
}
case 1:
{
if (_rankingType == 0)
{
int count = 0;
for (int i = 1; i <= _playerList.size(); i++)
{
final StatsSet player = _playerList.get(i);
if (_classId == player.getInt("classId"))
{
count++;
}
}
packet.writeD(count > 50 ? 50 : count);
int i = 1;
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (_classId == player.getInt("classId"))
{
packet.writeString(player.getString("name"));
packet.writeString(player.getString("clanName"));
packet.writeD(i); // class rank
if (_snapshotList.size() > 0)
{
final Map<Integer, StatsSet> snapshotRaceList = new ConcurrentHashMap<>();
int j = 1;
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (_classId == snapshot.getInt("classId"))
{
snapshotRaceList.put(j, _snapshotList.get(id2));
j++;
}
}
for (Integer id2 : snapshotRaceList.keySet())
{
final StatsSet snapshot = snapshotRaceList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // class rank snapshot
}
}
}
else
{
packet.writeD(i);
}
packet.writeD(Config.SERVER_ID);
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("clanLevel"));// clan level
packet.writeD(player.getInt("competitions_won"));// win count
packet.writeD(player.getInt("competitions_lost"));// lose count
packet.writeD(player.getInt("olympiad_points"));// points
packet.writeD(player.getInt("count"));// hero counts
packet.writeD(player.getInt("legend_count"));// legend counts
i++;
}
}
}
else
{
boolean found = false;
final Map<Integer, StatsSet> classList = new ConcurrentHashMap<>();
int i = 1;
for (Integer id : _playerList.keySet())
{
final StatsSet set = _playerList.get(id);
if (_player.getBaseClass() == set.getInt("classId"))
{
classList.put(i, _playerList.get(id));
i++;
}
}
for (Integer id : classList.keySet())
{
final StatsSet player = classList.get(id);
if (player.getInt("charId") == _player.getObjectId())
{
found = true;
int first = id > 10 ? (id - 9) : 1;
int last = classList.size() >= (id + 10) ? id + 10 : id + (classList.size() - id);
if (first == 1)
{
packet.writeD(last - (first - 1));
}
else
{
packet.writeD(last - first);
}
for (int id2 = first; id2 <= last; id2++)
{
final StatsSet plr = classList.get(id2);
packet.writeString(plr.getString("name"));
packet.writeString(plr.getString("clanName"));
packet.writeD(id2); // class rank
packet.writeD(id2);
packet.writeD(Config.SERVER_ID);
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("clanLevel"));// clan level
packet.writeD(player.getInt("competitions_won"));// win count
packet.writeD(player.getInt("competitions_lost"));// lose count
packet.writeD(player.getInt("olympiad_points"));// points
packet.writeD(player.getInt("count"));// hero counts
packet.writeD(player.getInt("legend_count"));// legend counts
}
}
}
if (!found)
{
packet.writeD(0);
}
}
break;
}
}
}
return true;
}
}

View File

@ -1,99 +0,0 @@
/*
* 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.ranking;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author JoeAlisson
*/
public class ExRankList implements IClientOutgoingPacket
{
private final int _race;
private final int _group;
private final int _scope;
public ExRankList(int group, int scope, int race)
{
_group = group;
_scope = scope;
_race = race;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_RANKING_CHAR_RANKERS.writeId(packet);
packet.writeC(_group);
packet.writeC(_scope);
packet.writeD(_race);
List<Ranker> rankers = new ArrayList<>();
for (int i = 0; i < 5; i++)
{
addRanker(rankers);
}
packet.writeD(rankers.size());
for (Ranker ranker : rankers)
{
packet.writeString(ranker.name);
packet.writeString(ranker.pledgeName);
packet.writeD(ranker.level);
packet.writeD(ranker.rClass);
packet.writeD(ranker.race);
packet.writeD(ranker.rank);
packet.writeD(ranker.serverRankSnapshot);
packet.writeD(ranker.raceRankSnapshot);
}
return true;
}
private static void addRanker(List<Ranker> rankers)
{
final Ranker ranker = new Ranker();
ranker.name = "Ranker" + rankers.size();
ranker.pledgeName = "ClanRanker" + rankers.size();
ranker.level = 80 - rankers.size();
ranker.race = rankers.size();
ranker.rClass = 20 + rankers.size();
ranker.rank = 1 + rankers.size();
ranker.serverRankSnapshot = ranker.rank + ((rankers.size() % 2) == 0 ? 2 : -1);
ranker.raceRankSnapshot = rankers.size();
rankers.add(ranker);
}
private static class Ranker
{
String name;
String pledgeName;
int level;
int rClass;
int rank;
int race;
int serverRankSnapshot;
int raceRankSnapshot;
}
}

View File

@ -16,17 +16,32 @@
*/
package org.l2jmobius.gameserver.network.serverpackets.ranking;
import java.util.Map;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author JoeAlisson
* @author NviX
*/
public class ExRankingCharInfo implements IClientOutgoingPacket
{
public ExRankingCharInfo()
@SuppressWarnings("unused")
private final short _unk;
private final PlayerInstance _player;
private final Map<Integer, StatsSet> _playerList;
private final Map<Integer, StatsSet> _snapshotList;
public ExRankingCharInfo(PlayerInstance player, short unk)
{
_unk = unk;
_player = player;
_playerList = RankManager.getInstance().getRankList();
_snapshotList = RankManager.getInstance().getSnapshotList();
}
@Override
@ -34,11 +49,40 @@ public class ExRankingCharInfo implements IClientOutgoingPacket
{
OutgoingPackets.EX_RANKING_CHAR_INFO.writeId(packet);
packet.writeD(1); // server rank
packet.writeD(2); // race rank
packet.writeD(2); // server rank snapshot
packet.writeD(1); // race rank snapshot
if (_playerList.size() > 0)
{
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (player.getInt("charId") == _player.getObjectId())
{
packet.writeD(id); // server rank
packet.writeD(player.getInt("raceRank")); // race rank
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
return true;
}
}
}
}
packet.writeD(0); // server rank
packet.writeD(0); // race rank
packet.writeD(0); // server rank snapshot
packet.writeD(0); // race rank snapshot
}
else
{
packet.writeD(0); // server rank
packet.writeD(0); // race rank
packet.writeD(0); // server rank snapshot
packet.writeD(0); // race rank snapshot
}
return true;
}
}

View File

@ -0,0 +1,435 @@
/*
* 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.ranking;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author NviX
*/
public class ExRankingCharRankers implements IClientOutgoingPacket
{
private final PlayerInstance _player;
private final int _race;
private final int _group;
private final int _scope;
private final Map<Integer, StatsSet> _playerList;
private final Map<Integer, StatsSet> _snapshotList;
public ExRankingCharRankers(PlayerInstance player, int group, int scope, int race)
{
_player = player;
_group = group;
_scope = scope;
_race = race;
_playerList = RankManager.getInstance().getRankList();
_snapshotList = RankManager.getInstance().getSnapshotList();
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_RANKING_CHAR_RANKERS.writeId(packet);
packet.writeC(_group);
packet.writeC(_scope);
packet.writeD(_race);
if (_playerList.size() > 0)
{
switch (_group)
{
case 0: // all
{
if (_scope == 0) // all
{
int count = _playerList.size() > 150 ? 150 : _playerList.size();
packet.writeD(count);
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
packet.writeString(player.getString("name"));
packet.writeString(player.getString("clanName"));
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("race"));
packet.writeD(id); // server rank
if (_snapshotList.size() > 0)
{
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
}
}
}
else
{
packet.writeD(id);
packet.writeD(0);
}
}
}
else
{
boolean found = false;
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (player.getInt("charId") == _player.getObjectId())
{
found = true;
int first = id > 10 ? (id - 9) : 1;
int last = _playerList.size() >= (id + 10) ? id + 10 : id + (_playerList.size() - id);
if (first == 1)
{
packet.writeD(last - (first - 1));
}
else
{
packet.writeD(last - first);
}
for (int id2 = first; id2 <= last; id2++)
{
final StatsSet plr = _playerList.get(id2);
packet.writeString(plr.getString("name"));
packet.writeString(plr.getString("clanName"));
packet.writeD(plr.getInt("level"));
packet.writeD(plr.getInt("classId"));
packet.writeD(plr.getInt("race"));
packet.writeD(id2); // server rank
if (_snapshotList.size() > 0)
{
for (Integer id3 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id3);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id3); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank"));
}
}
}
}
}
}
if (!found)
{
packet.writeD(0);
}
}
break;
}
case 1: // race
{
if (_scope == 0) // all
{
int count = 0;
for (int i = 1; i <= _playerList.size(); i++)
{
final StatsSet player = _playerList.get(i);
if (_race == player.getInt("race"))
{
count++;
}
}
packet.writeD(count > 100 ? 100 : count);
int i = 1;
for (Integer id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (_race == player.getInt("race"))
{
packet.writeString(player.getString("name"));
packet.writeString(player.getString("clanName"));
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("race"));
packet.writeD(i); // server rank
if (_snapshotList.size() > 0)
{
final Map<Integer, StatsSet> snapshotRaceList = new ConcurrentHashMap<>();
int j = 1;
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (_race == snapshot.getInt("race"))
{
snapshotRaceList.put(j, _snapshotList.get(id2));
j++;
}
}
for (Integer id2 : snapshotRaceList.keySet())
{
final StatsSet snapshot = snapshotRaceList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
}
}
}
else
{
packet.writeD(i);
packet.writeD(i);
}
i++;
}
}
}
else
{
boolean found = false;
final Map<Integer, StatsSet> raceList = new ConcurrentHashMap<>();
int i = 1;
for (Integer id : _playerList.keySet())
{
final StatsSet set = _playerList.get(id);
if (_player.getRace().ordinal() == set.getInt("race"))
{
raceList.put(i, _playerList.get(id));
i++;
}
}
for (Integer id : raceList.keySet())
{
final StatsSet player = raceList.get(id);
if (player.getInt("charId") == _player.getObjectId())
{
found = true;
int first = id > 10 ? (id - 9) : 1;
int last = raceList.size() >= (id + 10) ? id + 10 : id + (raceList.size() - id);
if (first == 1)
{
packet.writeD(last - (first - 1));
}
else
{
packet.writeD(last - first);
}
for (int id2 = first; id2 <= last; id2++)
{
final StatsSet plr = raceList.get(id2);
packet.writeString(plr.getString("name"));
packet.writeString(plr.getString("clanName"));
packet.writeD(plr.getInt("level"));
packet.writeD(plr.getInt("classId"));
packet.writeD(plr.getInt("race"));
packet.writeD(id2); // server rank
packet.writeD(id2);
packet.writeD(id2);
}
}
}
if (!found)
{
packet.writeD(0);
}
}
break;
}
case 2: // clan
{
if (_player.getClan() != null)
{
final Map<Integer, StatsSet> clanList = new ConcurrentHashMap<>();
int i = 1;
for (Integer id : _playerList.keySet())
{
final StatsSet set = _playerList.get(id);
if (_player.getClan().getName() == set.getString("clanName"))
{
clanList.put(i, _playerList.get(id));
i++;
}
}
packet.writeD(clanList.size());
for (Integer id : clanList.keySet())
{
final StatsSet player = clanList.get(id);
packet.writeString(player.getString("name"));
packet.writeString(player.getString("clanName"));
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("race"));
packet.writeD(id); // clan rank
if (_snapshotList.size() > 0)
{
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
}
}
}
else
{
packet.writeD(id);
packet.writeD(0);
}
}
}
else
{
packet.writeD(0);
}
break;
}
case 3: // friend
{
if (_player.getFriendList().size() > 0)
{
final Set<Integer> friendList = ConcurrentHashMap.newKeySet();
int count = 1;
for (int id : _player.getFriendList())
{
for (Integer id2 : _playerList.keySet())
{
final StatsSet temp = _playerList.get(id2);
if (temp.getInt("charId") == id)
{
friendList.add(temp.getInt("charId"));
count++;
}
}
}
friendList.add(_player.getObjectId());
packet.writeD(count);
for (int id : _playerList.keySet())
{
final StatsSet player = _playerList.get(id);
if (friendList.contains(player.getInt("charId")))
{
packet.writeString(player.getString("name"));
packet.writeString(player.getString("clanName"));
packet.writeD(player.getInt("level"));
packet.writeD(player.getInt("classId"));
packet.writeD(player.getInt("race"));
packet.writeD(id); // friend rank
if (_snapshotList.size() > 0)
{
for (Integer id2 : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id2);
if (player.getInt("charId") == snapshot.getInt("charId"))
{
packet.writeD(id2); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
}
}
}
else
{
packet.writeD(id);
packet.writeD(0);
}
}
}
}
else
{
packet.writeD(1);
packet.writeString(_player.getName());
if (_player.getClan() != null)
{
packet.writeString(_player.getClan().getName());
}
else
{
packet.writeString("");
}
packet.writeD(_player.getStat().getBaseLevel());
packet.writeD(_player.getBaseClass());
packet.writeD(_player.getRace().ordinal());
packet.writeD(1); // clan rank
if (_snapshotList.size() > 0)
{
for (Integer id : _snapshotList.keySet())
{
final StatsSet snapshot = _snapshotList.get(id);
if (_player.getObjectId() == snapshot.getInt("charId"))
{
packet.writeD(id); // server rank snapshot
packet.writeD(snapshot.getInt("raceRank")); // race rank snapshot
}
}
}
else
{
packet.writeD(0);
packet.writeD(0);
}
}
break;
}
}
}
else
{
packet.writeD(0);
}
return true;
}
}