Search in sources :

Example 61 with MaplePacketLittleEndianWriter

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

Example 62 with MaplePacketLittleEndianWriter

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

Example 63 with MaplePacketLittleEndianWriter

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

Example 64 with MaplePacketLittleEndianWriter

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

Example 65 with MaplePacketLittleEndianWriter

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();
}
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