Search in sources :

Example 31 with MaplePacketLittleEndianWriter

use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.

the class MaplePacketCreator method sendHint.

/**
 * Sends a player hint.
 *
 * @param hint The hint it's going to send.
 * @param width How tall the box is going to be.
 * @param height How long the box is going to be.
 * @return The player hint packet.
 */
public static byte[] sendHint(String hint, int width, int height) {
    if (width < 1) {
        width = hint.length() * 10;
        if (width < 40) {
            width = 40;
        }
    }
    if (height < 5) {
        height = 5;
    }
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.PLAYER_HINT.getValue());
    mplew.writeMapleAsciiString(hint);
    mplew.writeShort(width);
    mplew.writeShort(height);
    mplew.write(1);
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 32 with MaplePacketLittleEndianWriter

use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.

the class MaplePacketCreator method showWheelsLeft.

public static byte[] showWheelsLeft(int left) {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
    mplew.write(0x15);
    mplew.write(left);
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 33 with MaplePacketLittleEndianWriter

use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.

the class MaplePacketCreator method blockedMessage2.

/**
 * Gets a "block" packet (ie. the cash shop is unavailable, etc)
 *
 * Possible values for <code>type</code>:<br> 1: You cannot move that
 * channel. Please try again later.<br> 2: You cannot go into the cash shop.
 * Please try again later.<br> 3: The Item-Trading Shop is currently
 * unavailable. Please try again later.<br> 4: You cannot go into the trade
 * shop, due to limitation of user count.<br> 5: You do not meet the minimum
 * level requirement to access the Trade Shop.<br>
 *
 * @param type The type
 * @return The "block" packet.
 */
public static byte[] blockedMessage2(int type) {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.BLOCKED_SERVER.getValue());
    mplew.write(type);
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 34 with MaplePacketLittleEndianWriter

use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.

the class MaplePacketCreator method showPetLevelUp.

public static byte[] showPetLevelUp(MapleCharacter chr, byte index) {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.SHOW_FOREIGN_EFFECT.getValue());
    mplew.writeInt(chr.getId());
    mplew.write(4);
    mplew.write(0);
    mplew.write(index);
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter)

Example 35 with MaplePacketLittleEndianWriter

use of tools.data.output.MaplePacketLittleEndianWriter in project HeavenMS by ronancpl.

the class MaplePacketCreator method updateHiredMerchant.

public static byte[] updateHiredMerchant(MapleHiredMerchant hm, MapleCharacter chr) {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.PLAYER_INTERACTION.getValue());
    mplew.write(PlayerInteractionHandler.Action.UPDATE_MERCHANT.getCode());
    mplew.writeInt(chr.getMeso());
    mplew.write(hm.getItems().size());
    for (MaplePlayerShopItem item : hm.getItems()) {
        mplew.writeShort(item.getBundles());
        mplew.writeShort(item.getItem().getQuantity());
        mplew.writeInt(item.getPrice());
        addItemInfo(mplew, item.getItem(), true);
    }
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter) MaplePlayerShopItem(server.maps.MaplePlayerShopItem)

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