Help With Stall Plugin

Hello,

I need a function to read the name of the item sold at my stall and the name of visitor which did not bought an item.

So far I got this:

def handle_joymax(opcode,data):

        if opcode == 0x30B7: #AGENT_STALL_ENTITY_ACTION

            if data[0] == 2: #VISITOR ENTERED AT STALL
                #How to get visitor name?
                log(str(data)) #0x30B7	02 AC F7 BE 00

            elif data[0] == 3: #ITEM HAS BEEN BOUGHT 
                #How to get item name?
                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')

Thanks with any advance.

can be found in logs tho

1 Like

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

1 Like

Thank you very much for the reply, boys. :people_hugging:

I’m looking at this packet data and the python unpack function, but I have not a clue how to read that stuff. :sos: Is this Alien programming? :alien: :rofl:

Can you give me a hint how to read the packet data to:

  1. Get visitor Player ID when entered at stall;
  2. Get sold item slot;
  3. 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.

Thanks again.

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 :smiley:

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 :smiley:

1 Like

Thanks for the reply @asdk121.

After few tests, figured the get_character_data()[‘player_id’] is a random number that changes every reconnect. :scream:

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? :thought_balloon:
Perhaps it’s on another packet data or another opcode?

Appreciate Adam Sandler GIF

Appreciate your help.

Player IDs change every teleport…

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.

is handle_chat(t, player, msg) don’t see msg from stall?
all opcode what i know u can only see a id of character :smiley: