Untitled
unknown
java
a year ago
5.4 kB
1
Indexable
Never
public static MaplePacket getCharInfo(MapleCharacter chr) { MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); mplew.write(SendPacketOpcode.WARP_TO_MAP.getValue()); mplew.writeInt(chr.getClient().getChannel() - 1); //channel mplew.write(0); // character portal counter mplew.write(1); // is connecting mplew.writeInt(new Random().nextInt()); mplew.writeInt(new Random().nextInt()); mplew.writeInt(new Random().nextInt()); mplew.writeInt(new Random().nextInt()); //start of character decode mplew.write(0xFF); mplew.write(0xFF); 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 Cash ID 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.write(chr.getBuddylist().getCapacity()); mplew.writeInt(chr.getMeso()); //Todo - make these the real numbers mplew.write(100); // equip slots mplew.write(100); // use slots mplew.write(100); // set-up slots mplew.write(100); // etc slots mplew.write(100); // cash slots MapleInventory iv = chr.getInventory(MapleInventoryType.EQUIPPED); Collection<IItem> equippedC = iv.list(); List<Item> equipped = new ArrayList<Item>(equippedC.size()); for (IItem item : equippedC) { equipped.add((Item) item); } Collections.sort(equipped); //Start of inventory window for (Item item : equipped) { addItemInfo(mplew, item, false); } mplew.write(0); // start of equip inventory iv = chr.getInventory(MapleInventoryType.EQUIP); for (IItem item : iv.list()) { addItemInfo(mplew, item, false); } mplew.write(0); // start of use inventory iv = chr.getInventory(MapleInventoryType.USE); for (IItem item : iv.list()) { addItemInfo(mplew, item, false); } mplew.write(0); // start of set-up inventory iv = chr.getInventory(MapleInventoryType.SETUP); for (IItem item : iv.list()) { addItemInfo(mplew, item, false); } mplew.write(0); // start of etc inventory iv = chr.getInventory(MapleInventoryType.ETC); for (IItem item : iv.list()) { addItemInfo(mplew, item, false); } mplew.write(0); // start of cash inventory iv = chr.getInventory(MapleInventoryType.CASH); for (IItem item : iv.list()) { addItemInfo(mplew, item, false); } mplew.write(0); // start of skills Map<ISkill, MapleCharacter.SkillEntry> skills = chr.getSkills(); mplew.writeShort(skills.size()); for (Entry<ISkill, MapleCharacter.SkillEntry> skill : skills.entrySet()) { mplew.writeInt(skill.getKey().getId()); mplew.writeInt((byte)skill.getValue().skillevel); } mplew.writeShort(0); //number of cooldowns //for each cooldown: id, cooldown //mplew.writeInt(0); //mplew.writeShort(0); // Quests mplew.writeShort(3); // active mplew.writeShort(2029); mplew.writeMapleAsciiString(""); mplew.writeShort(2000); mplew.writeMapleAsciiString(""); mplew.writeShort(1000); mplew.writeMapleAsciiString(""); mplew.writeShort(0); //Completed quest count? mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeInt(0); mplew.writeLong(System.currentTimeMillis()); return mplew.getPacket(); }