Search in sources :

Example 26 with MapleItemInformationProvider

use of server.MapleItemInformationProvider in project HeavenMS by ronancpl.

the class MaplePacketCreator method getNPCShop.

public static byte[] getNPCShop(MapleClient c, int sid, List<MapleShopItem> items) {
    MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.OPEN_NPC_SHOP.getValue());
    mplew.writeInt(sid);
    // item count
    mplew.writeShort(items.size());
    for (MapleShopItem item : items) {
        mplew.writeInt(item.getItemId());
        mplew.writeInt(item.getPrice());
        // Perfect Pitch
        mplew.writeInt(item.getPrice() == 0 ? item.getPitch() : 0);
        // Can be used x minutes after purchase
        mplew.writeInt(0);
        // Hmm
        mplew.writeInt(0);
        if (!ItemConstants.isRechargable(item.getItemId())) {
            // stacksize o.o
            mplew.writeShort(1);
            mplew.writeShort(item.getBuyable());
        } else {
            mplew.writeShort(0);
            mplew.writeInt(0);
            mplew.writeShort(doubleToShortBits(ii.getPrice(item.getItemId())));
            mplew.writeShort(ii.getSlotMax(c, item.getItemId()));
        }
    }
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter) MapleItemInformationProvider(server.MapleItemInformationProvider) MapleShopItem(server.MapleShopItem)

Aggregations

MapleItemInformationProvider (server.MapleItemInformationProvider)26 Item (client.inventory.Item)18 Equip (client.inventory.Equip)10 MapleCharacter (client.MapleCharacter)9 Point (java.awt.Point)9 MapleInventoryType (client.inventory.MapleInventoryType)5 ArrayList (java.util.ArrayList)5 SpawnPoint (server.life.SpawnPoint)5 SQLException (java.sql.SQLException)4 MapleMap (server.maps.MapleMap)4 Skill (client.Skill)3 MapleInventory (client.inventory.MapleInventory)3 MaplePet (client.inventory.MaplePet)3 MapleMonster (server.life.MapleMonster)3 MapleMapItem (server.maps.MapleMapItem)3 MapleMapObject (server.maps.MapleMapObject)3 ScrollResult (client.inventory.Equip.ScrollResult)2 ModifyInventory (client.inventory.ModifyInventory)2 IOException (java.io.IOException)2 UnknownHostException (java.net.UnknownHostException)2