It’s been awhile since I looked at these packets but if I remember correctly the sell packet is based on the slot in the stall so you need to track when items are added to the stall to know what’s been sold.
Player you aren’t going to be able to get because that’s based on player ID
I’m looking at this packet data and the python unpack function, but I have not a clue how to read that stuff. Is this Alien programming?
Can you give me a hint how to read the packet data to:
Get visitor Player ID when entered at stall;
Get sold item slot;
Get buyer Player ID;
Code
def handle_joymax(opcode,data):
if opcode == 0x30B7: #AGENT_STALL_ENTITY_ACTION
if data[0] == 2: #VISITOR ENTERED AT STALL
#How to get visitor Player ID?
log(str(data)) #0x30B7 02 AC F7 BE 00
elif data[0] == 3: #ITEM HAS BEEN BOUGHT
#How to get buyer Player ID and sold item slot?
log(str(data)) #0x30B7 03 00 03 00 55 6E 69 FF
vBuyerNameSize = struct.unpack_from('<H', data, 2)[0]
vBuyerName = struct.unpack_from('<' + str(vBuyerNameSize) + 's', data, 4)[0].decode('cp1252')
In order to get the sold item name, I’ll try to store items positions at inventory before stall open.
id is always uint so struct.unpack with ‘I’ for 4 byte
for nickname if its nickname you need unpack length
name_len = struct.unpack with ‘B’
and for nickname
nickname = data[4:4 + name_len].decode(‘cp1252’)
if u are corect i don’t see there a slot
edit
03 00 03 00 55 6E 69 FF
03 is a stall action
00 is slot
03 00 name len its 2 byte ushort
but u can’t rly get id from nickname and nickname from id so its waste time
After few tests, figured the get_character_data()[‘player_id’] is a random number that changes every reconnect.
Even tho, now I can see when the customer visit the stall and how many visitors entered at specific stall.
if opcode == 0x30B7: #AGENT_STALL_ENTITY_ACTION
if data[0] == 2:
#VISITOR ENTERED AT STALL
vPlayerID = struct.unpack_from('<I', data, 1)[0]
Still, I ask myself why is it not possible to get the nickname if we can see his name at stall chat?
Perhaps it’s on another packet data or another opcode?
The information you want is a available in the spawn packets… that’s how the bot knows but this packet is blocked for plugins for obvious abuse reasons.