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