Search in sources :

Example 1 with MaplePacketLittleEndianWriter

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());
    }
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 2 with MaplePacketLittleEndianWriter

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();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 3 with MaplePacketLittleEndianWriter

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();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 4 with MaplePacketLittleEndianWriter

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();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 5 with MaplePacketLittleEndianWriter

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();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Aggregations

MaplePacketLittleEndianWriter (tools.data.output.MaplePacketLittleEndianWriter)431 Point (java.awt.Point)44 MaplePlayerShopItem (server.maps.MaplePlayerShopItem)15 Item (client.inventory.Item)11 SpecialCashItem (server.CashShop.SpecialCashItem)11 MapleShopItem (server.MapleShopItem)11 MapleMapItem (server.maps.MapleMapItem)11 CashItem (server.CashShop.CashItem)10 MapleCharacter (client.MapleCharacter)8 MapleBuffStat (client.MapleBuffStat)4 MaplePet (client.inventory.MaplePet)3 MTSItemInfo (server.MTSItemInfo)3 MapleDisease (client.MapleDisease)2 SQLException (java.sql.SQLException)2 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 Channel (net.server.channel.Channel)2 MapleGuild (net.server.guild.MapleGuild)2 MapleMonster (server.life.MapleMonster)2 BuddylistEntry (client.BuddylistEntry)1