Untitled
unknown
java
a year ago
5.7 kB
5
Indexable
Never
public static MaplePacket getCharInfo(MapleCharacter chr) { MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); mplew.write(SendPacketOpcode.WARP_TO_MAP.getValue()); /* this shit is all right */ 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()); /* */ 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 /* this crashes right now, just write some 0s 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); mplew.writeInt(0); mplew.writeInt(0); mplew.writeShort(0); //number of cooldowns //for each cooldown: id, cooldown //mplew.writeInt(0); //mplew.writeShort(0); // Quests // this shit only goes through if you set all the shorts to 0 // idk about the strings mplew.writeShort(0); // active mplew.writeShort(0); mplew.writeMapleAsciiString(""); mplew.writeShort(0); mplew.writeMapleAsciiString(""); mplew.writeShort(0); mplew.writeMapleAsciiString(""); mplew.writeShort(0); //Completed quest count? mplew.writeInt(0); mplew.writeInt(0); // you can remove everything below up to here before crashing at 00482606 instead of 00482620 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(); }