Qbox-project / qbx_core

http://qbox-project.github.io
Other
65 stars 136 forks source link

feat: console command convertjobs #387

Closed Manason closed 7 months ago

Manason commented 7 months ago

Adds a console command 'convertjobs': An idempotent function which copies all player's primary job & gang into the player_groups table. This works for both online & offline players, so isn't required to be ran when the server is empty.

We want the player_groups table to accurately reflect the groups the player is in. Without doing this step, it is likely that the data will eventually make its way into the player_groups table, but that would lessen the accuracy of exports that return data about which jobs the player holds. I also considered doing a check on player login instead, but that would preclude offline players from having their data corrected. The best solution I feel, is to convert all at once to guarantee the data is present immediately.

I didn't include conversions for existing multi job resources out there. Given that there is no built-in UI for qbox's multi job system, external multi job resources will need to be made qbox compatible anyway and providing a conversion function is one more step to doing that. For this reason, a server event is triggered at the end of the conversion that can be consumed by multi job resources to do additional conversion.

Tested.