Search in sources :

Example 11 with MTSItemInfo

use of server.MTSItemInfo in project HeavenMS by ronancpl.

the class MaplePacketCreator method sendMTS.

public static byte[] sendMTS(List<MTSItemInfo> items, int tab, int type, int page, int pages) {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.MTS_OPERATION.getValue());
    // operation
    mplew.write(0x15);
    // testing, change to 10 if fails
    mplew.writeInt(pages * 16);
    // number of items
    mplew.writeInt(items.size());
    mplew.writeInt(tab);
    mplew.writeInt(type);
    mplew.writeInt(page);
    mplew.write(1);
    mplew.write(1);
    for (int i = 0; i < items.size(); i++) {
        MTSItemInfo item = items.get(i);
        addItemInfo(mplew, item.getItem(), true);
        // id
        mplew.writeInt(item.getID());
        // this + below = price
        mplew.writeInt(item.getTaxes());
        // price
        mplew.writeInt(item.getPrice());
        mplew.writeInt(0);
        mplew.writeLong(getTime(item.getEndingDate()));
        // account name (what was nexon thinking?)
        mplew.writeMapleAsciiString(item.getSeller());
        // char name
        mplew.writeMapleAsciiString(item.getSeller());
        for (int j = 0; j < 28; j++) {
            mplew.write(0);
        }
    }
    mplew.write(1);
    return mplew.getPacket();
}
Also used : MaplePacketLittleEndianWriter(tools.data.output.MaplePacketLittleEndianWriter) MTSItemInfo(server.MTSItemInfo) Point(java.awt.Point)

Aggregations

MTSItemInfo (server.MTSItemInfo)11 Equip (client.inventory.Equip)8 Item (client.inventory.Item)8 Connection (java.sql.Connection)8 PreparedStatement (java.sql.PreparedStatement)8 ResultSet (java.sql.ResultSet)8 SQLException (java.sql.SQLException)8 ArrayList (java.util.ArrayList)8 DatabaseConnection (tools.DatabaseConnection)8 Point (java.awt.Point)3 MaplePacketLittleEndianWriter (tools.data.output.MaplePacketLittleEndianWriter)3 MapleItemInformationProvider (server.MapleItemInformationProvider)1