Lineage 2 Tower Forum

Full Version: Packet format for selling item to NPC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Bump
    JAVA Programming
@Override
	protected void readImpl()
	{
 _listId = readD();
 int size = readD();
 if ((size <= 0) || (size > Config.MAX_ITEM_IN_PACKET) || ((size * BATCH_LENGTH) != _buf.remaining()))
 {
 return;
 }
 
 _items = new ArrayList<>(size);
 for (int i = 0; i < size; i++)
 {
 int objectId = readD();
 int itemId = readD();
 long count = readQ();
 if ((objectId < 1) || (itemId < 1) || (count < 1))
 {
 _items = null;
 return;
 }
 _items.add(new UniqueItemHolder(itemId, objectId, count));
 }
	}




so as you can see format is like:
D - items list ID (server sends it when you open that window with items to buy)
D - count of iteems to buy
repeat X times :
D - item id from list
D - object id
Q - count
:end
ok, i will help you a bit, but i will not post any code, sorry.

1. this impossible to do by script, and only possible with plugin, because there is a 'list id' parameter in the packet that you send for selling item, and this value comes from server after you talked to npc but BEFORE you are trying to sell items.

2. value that you called D[1] is that 'list id'.

3. actual packet structure is:

37 - id
XX XX XX XX - list id
XX XX XX XX - list size (how many different items we are selling)

block start (
XX XX XX XX - object id of item
XX XX XX XX - display id of item
XX XX XX XX XX XX XX XX - numbers of items
) block end

this block repeats as many times as you specified in "list size".

haha Sakaszli was first.

requesting forum add-on, that notifies about new answers while i'm writing my answer Smile
Thanks Sakaszli and Kerberos, that was extremely helpful! Big Grin
(07-07-2015 05:29 AM)mandymua Wrote: [ -> ]Thanks Sakaszli and Kerberos, that was extremely helpful! Big Grin

id you make a working plugin code?
Kerberos' post actually already contains almost all of the information you need to make it work. I will give you the last piece that Kerberos didn't mention. That is the packet with the listID is:

packet:GetID() == 0xFE and packet:GetSubID() == 184

packet:SetOffset(12)
listID = packet:ReadInt(4)
Make the plugin, get hte info, build the packet with commands through script, easy peasy.
Pages: 1 2
Reference URL's