@Override protected void writeImpl(L2Client client, MMOBuffer buf) throws RuntimeException { // TODO: when implementing, consult an up-to-date packets_game_server.xml and/or savormix final ClientProtocolVersion cpv = client.getVersion(); buf.writeD(_characters.size()); // Character count buf.writeD(7); // New characters buf.writeC(0); // 0 if (cpv.isNewerThanOrEqualTo(ClientProtocolVersion.GODDESS_OF_DESTRUCTION)) { buf.writeC(1); // 1 buf.writeD(0); // 0 } for (PlayerDB p : _characters) { buf.writeS(p.name); // Character name buf.writeD(p.getPersistentId()); // Character ID buf.writeS(p.accountName); // Account name buf.writeD(client.getSessionId()); // Session ID buf.writeD(0); // Pledge ID buf.writeD(0); // 0 buf.writeD(p.gender); // Sex buf.writeD(p.mainClassId.getRace()); // Race buf.writeD(p.mainClassId); // Main class buf.writeD(ReportedConfig.ID); // Game server buf.writeD(p.x); // Location X buf.writeD(p.y); // Location Y buf.writeD(p.z); // Location Z buf.writeF(100D); // Current HP buf.writeF(30D); // Current MP buf.writeD(0); // SP buf.writeQ(0L); // XP if (client.getVersion().isNewerThanOrEqualTo(ClientProtocolVersion.HIGH_FIVE)) buf.writeF(0D); // XP % buf.writeD(1); // Level buf.writeD(0); // Karma buf.writeD(0); // PK Count buf.writeD(0); // PvP Count buf.writeD(0); // ??? 0 buf.writeD(0); // ??? 0 buf.writeD(0); // ??? 0 buf.writeD(0); // ??? 0 buf.writeD(0); // ??? 0 buf.writeD(0); // ??? 0 buf.writeD(0); // ??? 0 buf.writeD(0); // Shirt buf.writeD(0); // Right earring buf.writeD(0); // Left earring buf.writeD(0); // Necklace buf.writeD(0); // Right ring buf.writeD(0); // Left ring buf.writeD(0); // Helmet buf.writeD(0); // Main weapon buf.writeD(0); // Shield/support weapon buf.writeD(0); // Gloves buf.writeD(0); // Chest armor buf.writeD(0); // Leg armor buf.writeD(0); // Boots buf.writeD(0); // Cloak buf.writeD(0); // Two-handed weapon buf.writeD(0); // 1st hair item buf.writeD(0); // 2nd hair item buf.writeD(0); // Right bracelet buf.writeD(0); // Left bracelet buf.writeD(0); // 1st talisman buf.writeD(0); // 2nd talisman buf.writeD(0); // 3rd talisman buf.writeD(0); // 4th talisman buf.writeD(0); // 5th talisman buf.writeD(0); // 6th talisman buf.writeD(0); // Belt buf.writeD(p.hairStyle); // Hair style buf.writeD(p.hairColor); // Hair color buf.writeD(p.face); // Face buf.writeF(100D); // Maximum HP buf.writeF(30D); // Maximum MP buf.writeD(0); // Time of deletion buf.writeD(p.activeClassId); // Current class buf.writeD(1); // Selected buf.writeC(0); // Weapon enchant glow buf.writeD(0); // Weapon augmentation buf.writeD(0); // Transformation buf.writeD(0); // Pet buf.writeD(0); // Pet level buf.writeD(0); // ??? 0 buf.writeD(0); // Total satiation incl inv food? buf.writeF(0D); // Pet current HP buf.writeF(0D); // Pet current MP if (cpv.isNewerThanOrEqualTo(ClientProtocolVersion.HIGH_FIVE)) buf.writeD(20000); // Vitality if (cpv.isNewerThanOrEqualTo(ClientProtocolVersion.GODDESS_OF_DESTRUCTION)) buf.writeD(1); // ??? 1 } }
/** * Sends the available character list from the specified account. * * @param client recipient * @param account account name */ public static void sendToClient(L2Client client, String account) { // FIXME: don't fetch the whole player only the required data List<PlayerDB> characters = PlayerDB.findByAccount(account); client.definePlayerSlots(characters); client.sendPacket(new AvailableCharacters(characters)); }