use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.
the class MaplePacketCreator method spawnNPCRequestController.
public static byte[] spawnNPCRequestController(MapleNPC life, boolean MiniMap) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(23);
mplew.writeShort(SendOpcode.SPAWN_NPC_REQUEST_CONTROLLER.getValue());
mplew.write(1);
mplew.writeInt(life.getObjectId());
mplew.writeInt(life.getId());
mplew.writeShort(life.getPosition().x);
mplew.writeShort(life.getCy());
if (life.getF() == 1) {
mplew.write(0);
} else {
mplew.write(1);
}
mplew.writeShort(life.getFh());
mplew.writeShort(life.getRx0());
mplew.writeShort(life.getRx1());
mplew.writeBool(MiniMap);
return mplew.getPacket();
}
use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.
the class MaplePacketCreator method changePetName.
public static byte[] changePetName(MapleCharacter chr, String newname, int slot) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.PET_NAMECHANGE.getValue());
mplew.writeInt(chr.getId());
mplew.write(0);
mplew.writeMapleAsciiString(newname);
mplew.write(0);
return mplew.getPacket();
}
use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.
the class MaplePacketCreator method getWarpToMap.
/**
* Gets a packet telling the client to change maps.
*
* @param to The <code>MapleMap</code> to warp to.
* @param spawnPoint The spawn portal number to spawn at.
* @param chr The character warping to <code>to</code>
* @return The map change packet.
*/
public static byte[] getWarpToMap(MapleMap to, int spawnPoint, MapleCharacter chr) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.SET_FIELD.getValue());
mplew.writeInt(chr.getClient().getChannel() - 1);
// updated
mplew.writeInt(0);
// updated
mplew.write(0);
mplew.writeInt(to.getId());
mplew.write(spawnPoint);
mplew.writeShort(chr.getHp());
mplew.write(0);
mplew.writeLong(getTime(System.currentTimeMillis()));
return mplew.getPacket();
}
use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.
the class MaplePacketCreator method pinOperation.
/**
* Gets a packet detailing a PIN operation.
*
* Possible values for <code>mode</code>:<br> 0 - PIN was accepted<br> 1 -
* Register a new PIN<br> 2 - Invalid pin / Reenter<br> 3 - Connection
* failed due to system error<br> 4 - Enter the pin
*
* @param mode The mode.
* @return
*/
private static byte[] pinOperation(byte mode) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(3);
mplew.writeShort(SendOpcode.CHECK_PINCODE.getValue());
mplew.write(mode);
return mplew.getPacket();
}
use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.
the class MaplePacketCreator method getNPCTalkText.
public static byte[] getNPCTalkText(int npc, String talk, String def) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.NPC_TALK.getValue());
// Doesn't matter
mplew.write(4);
mplew.writeInt(npc);
mplew.write(2);
// speaker
mplew.write(0);
mplew.writeMapleAsciiString(talk);
// :D
mplew.writeMapleAsciiString(def);
mplew.writeInt(0);
return mplew.getPacket();
}
Aggregations