Skip to content

Fix posibly forged layer and different layer during equip trigger (#1391)#1421

Merged
cbnolok merged 2 commits intoSphereserver:devfrom
mtwango:layer-equiptest-fix
May 16, 2025
Merged

Fix posibly forged layer and different layer during equip trigger (#1391)#1421
cbnolok merged 2 commits intoSphereserver:devfrom
mtwango:layer-equiptest-fix

Conversation

@mtwango
Copy link
Copy Markdown
Member

@mtwango mtwango commented May 15, 2025

  • add check for real and sent layer in PacketItemEquipReq (with debug info)
  • swap real layer during ItemEquip withing EquipTest / ItemEquipTest trigger

…er#1391)

- swap real layer during ItemEquip withing EquipTest / ItemEquipTest trigger
@cbnolok
Copy link
Copy Markdown
Contributor

cbnolok commented May 15, 2025

Would you mind to explain the issues (maybe just the second one) in a dedicated changelog entry?

@mtwango
Copy link
Copy Markdown
Member Author

mtwango commented May 16, 2025

Added changelog entry.

I'll try to elaborate here:

When player dclicks object (Packet 0x06) the workflow for equipping items works roughly this way:

PacketDoubleClick::onReceive ->
CClient::Event_DoubleClick ->
CClient::Cmd_Use_Item ->
CChar::ItemEquip

And the object id is found by uid.ObjFind() (uid is sent by client).

During equipping via dragging to paperdoll or dress macro (Packet 0x13), its like this:

PacketItemEquipReq::onReceive ->
CChar::ItemEquip

In PacketItemEquipReq::onReceive we are finding object id by checking it in LAYER_DRAGGING source->LayerFind(LAYER_DRAGGING) and comparing it to id sent by client. The dragged object has modified layer, since it is currently 'equipped' there. But the EquipTest trigger had this modified layer instead of real / defined one (where it is going to be).

The actual layer during equipping is changed in LayerAdd(pItem, layer);, but it was after the EquipTest trigger.,

I'm pretty sure, this is very specific behaviour and it could have been worked around by numerous ways (ie using findlayer / findid), but it should unify the equiping behaviour.

@cbnolok cbnolok merged commit 9405a7c into Sphereserver:dev May 16, 2025
18 checks passed
@mtwango mtwango deleted the layer-equiptest-fix branch May 16, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants