Source-X icon indicating copy to clipboard operation
Source-X copied to clipboard

Inconsistent Layer in @ItemEquipTest and @EquipTest triggers

Open mtwango opened this issue 10 months ago • 2 comments

When trying to equip item and check layer, different methods return different values.

Tested on i_platemail_leggings with Sphere X rev 3941 and clients 2.0.0 + 7.0.107

When doubleclicking to equip:

ItemEquipTest Serial: 040001fe5, Layer: 4
EquipTest Serial: 040001fe5, Layer: 4

ItemEquip Serial: 040001fe5, Layer: 4
Equip Serial: 040001fe5, Layer: 4

When dragging item to Paperdoll or using dress macro:

ItemEquipTest Serial: 040001fe5, Layer: 31
EquipTest Serial: 040001fe5, Layer: 31

ItemEquip Serial: 040001fe5, Layer: 4
Equip Serial: 040001fe5, Layer: 4

mtwango avatar Apr 04 '25 07:04 mtwango

I'd say this is normal, since 31 = LAYER_DRAGGING. You should have also another trigger firing with layer 4, after you dragged the item on the paperdoll, isn't this the case?

cbnolok avatar Apr 29 '25 05:04 cbnolok

That is true, equip trigger (or itemEquip) fires with layer 4.

I guess during dragging to Paperdoll is kinda ok, but since dress macro equips item previously recored from recordDress macro, it should go directly to layers, because it was recored there.

mtwango avatar Apr 30 '25 08:04 mtwango

After some digging: I'm pretty sure its packet 0x13 (PacketItemEquipReq) https://github.com/Sphereserver/Source-X/blob/0911dd22b145d4bb006c9a3371b658ec63df26ca/src/network/receive.cpp#L518

The itemLayer should not be used (at least not from packet). This data is sent from client. I'm not sure, where client sends this data from (probably tiledata), but it can be forged (ie equipping legs on head layer) by either sending packet by itself or by modifying client data). It should be loaded from the actual item on server.

The dragging layer should be unset, and actual layer should be set after client->ClearTargMode(); // done dragging.

mtwango avatar May 05 '25 09:05 mtwango