DarkflameUniverse / DarkflameServer

The main repository for the Darkflame Universe Server Emulator project.
https://www.darkflameuniverse.org/
GNU Affero General Public License v3.0
654 stars 173 forks source link

fix: skill desync when picking up powerups or casting server side calculations #1602

Closed EmosewaMC closed 5 months ago

EmosewaMC commented 6 months ago

From static analysis it appears that the client and server need to be keeping track of their own skillUIds as inside the client, there are GameMessages for CastLocalSkill which increment the client side skillUId counter 0x00d45300 alongside the same tracker being used for tracking the ones the client sends to the server 0x00d44980. With no way for the server to actually know the clients actual skill tracker value, I believe it is safe to assume that the two are ok to overlap and you just have to keep track of both. This PR utilizes a multimap to accomplish this task.

Tested that battling on Crux Prime using a wormholer, bat lord helm and picking up powerups constantly from boxes does not cause my character to become permanently slowed, nor do I permanently gain as money magnet. Tested that loading into Avant Gardens and destroying the piles of debris at this location with the wormholer, a speedboost and a money magnet active results in

Xiphoseer commented 5 months ago

there are GameMessages for CastLocalSkill which increment the client side skillUId counter 0x00d45300 alongside the same tracker being used for tracking the ones the client sends to the server 0x00d44980

Are those base offsets of some sort of global array? Are they hardcoded or could they change on reallocation?

EmosewaMC commented 5 months ago

there are GameMessages for CastLocalSkill which increment the client side skillUId counter 0x00d45300 alongside the same tracker being used for tracking the ones the client sends to the server 0x00d44980

Are those base offsets of some sort of global array? Are they hardcoded or could they change on reallocation?

the addresses above are subroutines where the variable (which is located on the players' LWOSkillComponent) are incremented the same way and show that the variable on the client does not interact with one on the server. these values reset upon a world change since the players' LWOSkillComponent is re-created and as such reset to 0. Can share more over discord if you'd like :)