Untitled
unknown
java
2 years ago
3.1 kB
2
Indexable
Never
private static void addCharData(MaplePacketLittleEndianWriter mplew, MapleCharacter chr) { mplew.writeInt(chr.getId()); mplew.writeAsciiString(chr.getName(), 13); mplew.write(chr.getGender()); mplew.write(chr.getSkinColor().getId()); mplew.writeInt(chr.getFace()); mplew.writeInt(chr.getHair()); mplew.writeLong(0); // Pet SN mplew.write(chr.getLevel()); mplew.writeShort(chr.getJob().getId()); mplew.writeShort(chr.getStr()); mplew.writeShort(chr.getDex()); mplew.writeShort(chr.getInt()); mplew.writeShort(chr.getLuk()); mplew.writeShort(chr.getHp()); mplew.writeShort(chr.getMaxHp()); mplew.writeShort(chr.getMp()); mplew.writeShort(chr.getMaxMp()); mplew.writeShort(chr.getRemainingAp()); mplew.writeShort(chr.getRemainingSp()); mplew.writeInt(chr.getExp()); mplew.writeShort(chr.getFame()); mplew.writeInt(chr.getMapId()); mplew.write(chr.getInitialSpawnpoint()); mplew.writeLong(0); mplew.writeInt(0); mplew.writeInt(0); MapleInventory iv = chr.getInventory(MapleInventoryType.EQUIPPED); Map<Byte, Integer> myEquip = new LinkedHashMap<Byte, Integer>(); Map<Byte, Integer> maskedEquip = new LinkedHashMap<Byte, Integer>(); for (IItem item : iv.list()) { byte pos = (byte) (item.getPosition() * -1); if (pos < 100 && myEquip.get(pos) == null) { maskedEquip.put(pos, item.getItemId()); } else if (pos > 100) { // lol odinms. walao eh pos -= 100; if (myEquip.get(pos) != null) { maskedEquip.put(pos, myEquip.get(pos)); } myEquip.put(pos, item.getItemId()); } else if (myEquip.get(pos) != null) { maskedEquip.put(pos, item.getItemId()); } } for (Entry<Byte, Integer> entry : maskedEquip.entrySet()) { mplew.write(entry.getKey()); mplew.writeInt(entry.getValue()); } mplew.write(0); for (Entry<Byte, Integer> entry : myEquip.entrySet()) { mplew.write(entry.getKey()); mplew.writeInt(entry.getValue()); } mplew.write(0); if ((chr.getJob().getId() / 100) != 5) { mplew.write(1); mplew.writeInt(chr.getRank()); mplew.writeInt(chr.getRankMove()); // might be reverted mplew.writeInt(chr.getJobRank()); mplew.writeInt(chr.getJobRankMove()); } else { mplew.write(0); } }