@Override
protected final void writeImpl()
{
int size = _characterPackages != null ? _characterPackages.length : 0;
writeC(0x09);
writeD(size); // Created character count
writeD(ServerConfig.CHAR_NUMBER_PER_SERVER); // Can prevent players from creating new characters (if 0); (if 1, the client will ask if chars may be created (0x13) Response: (0x0D) )
writeC(size == ServerConfig.CHAR_NUMBER_PER_SERVER ? 0x01 : 0x00); // if 1 can't create new char
writeC(0x01); // 0=can't play, 1=can play free until level 85, 2=100% free play
writeD(0x02); // if 1, Korean client
writeC(0x00); // Gift message for inactive accounts // 152
writeC(0x00); // Balthus Knights, if 1 suggests premium account
long lastAccess = -1L;
int lastUsed = -1;
for(int i = 0; i < size; i++)
if(lastAccess < _characterPackages[I].getLastAccess())
{
lastAccess = _characterPackages[I].getLastAccess();
lastUsed = i;
}
for(int i = 0; i < size; i++)
{
CharSelectInfoPackage charInfoPackage = _characterPackages[I];
writeS(charInfoPackage.getName());
writeD(charInfoPackage.getCharId()); // ?
writeS(_loginName);
writeD(_sessionId);
writeD(0x00);
writeD(0x00); // ??
writeD(charInfoPackage.getSex());
writeD(charInfoPackage.getRace());
writeD(charInfoPackage.getBaseClassId());
writeD(0x01); // GameServerName
writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());
writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());
writeQ(charInfoPackage.getSp());
writeQ(charInfoPackage.getExp());
final int lvl = charInfoPackage.getLevel();
writeF(ExpDataHolder.getInstance().getExpPercent(lvl, charInfoPackage.getExp()));
writeD(lvl);
writeD(charInfoPackage.getKarma());
writeD(charInfoPackage.getPk());
writeD(charInfoPackage.getPvP());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00); // unk Ertheia
writeD(0x00); // unk Ertheia
for(int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(charInfoPackage.getPaperdollItemId(PAPERDOLL_ID));
writeD(0x00); //Внешний вид оружия (ИД Итема).
writeD(0x00); //Внешний вид щита (ИД Итема).
writeD(0x00); //Внешний вид перчаток (ИД Итема).
writeD(0x00); //Внешний вид верха (ИД Итема).
writeD(0x00); //Внешний вид низа (ИД Итема).
writeD(0x00); //Внешний вид ботинок (ИД Итема).
writeD(0x00);
writeD(0x00); //Внешний вид шляпы (ИД итема).
writeD(0x00); //Внешний вид маски (ИД итема).
writeH(0x00); // unk Episodion
writeH(0x00); // unk Episodion
writeH(0x00); // unk Episodion
writeH(0x00); // unk Episodion
writeH(0x00); // unk Episodion
writeD(charInfoPackage.getHairStyle());
writeD(charInfoPackage.getHairColor());
writeD(charInfoPackage.getFace());
writeF(charInfoPackage.getMaxHp()); // hp max
writeF(charInfoPackage.getMaxMp()); // mp max
writeD(charInfoPackage.getAccessLevel() > -100 ? charInfoPackage.getDeleteTimer() : -1);
writeD(charInfoPackage.getClassId());
writeD(i == lastUsed ? 1 : 0);
writeC(Math.min(charInfoPackage.getPaperdollEnchantEffect(Inventory.PAPERDOLL_RHAND), 127));
writeD(charInfoPackage.getPaperdollAugmentation1Id(Inventory.PAPERDOLL_RHAND));
writeD(charInfoPackage.getPaperdollAugmentation2Id(Inventory.PAPERDOLL_RHAND));
writeD(0x00);
//TODO: Pet info?
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeF(0x00);
writeF(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
[COLOR=rgb(226, 80, 65)] writeD(charInfoPackage.getAccessLevel() == -100 ? 0x00 : 0x01); // Char is active or not[/COLOR]
writeC(0x00); // UNK
writeC(0x00);// hero glow
writeC(0x00);// show hair accessory if enabled
writeD(0x00);
writeD((int) (charInfoPackage.getLastAccess() / 1000)); // 235 - last play time
}
}