02-03-2013, 02:10 PM
Не могу разобраться, в чем проблема. Вроде пакет апнул, а все равно такая фигня.
Код:
public class CharacterSelectionInfo extends L2GameServerPacket {
private static final Logger _log = LoggerFactory.getLogger(CharacterSelectionInfo.class);
private String _loginName;
private int _sessionId;
private CharSelectionInfo charSelectionInfo;
public CharacterSelectionInfo(String loginName, int sessionId) {
_sessionId = sessionId;
_loginName = loginName;
charSelectionInfo = loadCharacterSelectInfo(loginName);
}
public CharSelectionInfo getCharInfo() {
return charSelectionInfo;
}
@Override
protected final void writeImpl() {
int size = charSelectionInfo.size();
writeC(0x09);
writeD(size);
writeD(0x07);
writeC(0x00);
writeC(0x01);
writeD(0x00);
long lastAccess = -1L;
int lastUsed = -1;
for (CharSelectInfoPackage info : charSelectionInfo)
if (lastAccess < info.getLastAccess())
{
lastAccess = info.getLastAccess();
lastUsed++;
}
int i = 0;
for (CharSelectInfoPackage charInfoPackage : charSelectionInfo) {
writeS(charInfoPackage.getName());
writeD(charInfoPackage.getCharId()); // ?
writeS(_loginName);
writeD(_sessionId);
writeD(charInfoPackage.getClanId());
writeD(0x00); // ??
writeD(charInfoPackage.getSex());
writeD(charInfoPackage.getRace());
writeD(charInfoPackage.getBaseClassId());
writeD(0x01); // default active for all (GOD)
writeD(charInfoPackage.getX());
writeD(charInfoPackage.getY());
writeD(charInfoPackage.getZ());
writeF(charInfoPackage.getCurrentHp());
writeF(charInfoPackage.getCurrentMp());
writeD(charInfoPackage.getSp());
writeQ(charInfoPackage.getExp());
writeF(Experience.getExpPercent(charInfoPackage.getLevel(), charInfoPackage.getExp()));
writeD(charInfoPackage.getLevel());
writeD(charInfoPackage.getKarma());
writeD(charInfoPackage.getPk());
writeD(charInfoPackage.getPvP());
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
for (int PAPERDOLL_ID : Inventory.PAPERDOLL_ORDER)
writeD(charInfoPackage.getPaperdollItemId(PAPERDOLL_ID));
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
writeD(0);
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));
writeH(0x00);
writeH(0x00);
int weaponId = charInfoPackage.getPaperdollItemId(Inventory.PAPERDOLL_RHAND);
if (weaponId == 8190) // Transform id
writeD(301);
else if (weaponId == 8689)
writeD(302);
else
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeD(0x00);
writeF(0x00);
writeF(0x00);
writeD(charSelectionInfo.getVitalityPoints());
writeD(0); //?
writeD(0); //?
writeD(charInfoPackage.getAccessLevel() > -100 ? 0x01 : 0x00);
writeC(0x00);
writeC(0x00);
i++;
}
}