use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.
the class NPCAnimationHandler method handlePacket.
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
int length = (int) slea.available();
if (length == 6) {
// NPC Talk
mplew.writeShort(SendOpcode.NPC_ACTION.getValue());
mplew.writeInt(slea.readInt());
mplew.writeShort(slea.readShort());
c.announce(mplew.getPacket());
} else if (length > 6) {
// NPC Move
byte[] bytes = slea.read(length - 9);
mplew.writeShort(SendOpcode.NPC_ACTION.getValue());
mplew.write(bytes);
c.announce(mplew.getPacket());
}
}
use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.
the class AllianceOperationHandler method sendChangeRank.
private static byte[] sendChangeRank(int allianceid, int playerid, int int1, byte byte1) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.ALLIANCE_OPERATION.getValue());
mplew.write(0x09);
mplew.writeInt(allianceid);
mplew.writeInt(playerid);
mplew.writeInt(int1);
mplew.writeInt(byte1);
return mplew.getPacket();
}
use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.
the class AllianceOperationHandler method sendChangeLeader.
private static byte[] sendChangeLeader(int allianceid, int playerid, int victim) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.ALLIANCE_OPERATION.getValue());
mplew.write(0x08);
mplew.writeInt(allianceid);
mplew.writeInt(playerid);
mplew.writeInt(victim);
return mplew.getPacket();
}
use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.
the class MaplePacketCreator method environmentMove.
public static byte[] environmentMove(String env, int mode) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.FIELD_OBSTACLE_ONOFF.getValue());
mplew.writeMapleAsciiString(env);
mplew.writeInt(mode);
return mplew.getPacket();
}
use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.
the class MaplePacketCreator method rollSnowBall.
public static byte[] rollSnowBall(boolean entermap, int state, MapleSnowball ball0, MapleSnowball ball1) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.SNOWBALL_STATE.getValue());
if (entermap) {
mplew.skip(21);
} else {
// 0 = move, 1 = roll, 2 is down disappear, 3 is up disappear
mplew.write(state);
mplew.writeInt(ball0.getSnowmanHP() / 75);
mplew.writeInt(ball1.getSnowmanHP() / 75);
// distance snowball down, 84 03 = max
mplew.writeShort(ball0.getPosition());
mplew.write(-1);
// distance snowball up, 84 03 = max
mplew.writeShort(ball1.getPosition());
mplew.write(-1);
}
return mplew.getPacket();
}
Aggregations