Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Core/Hook): New hook OnBeforePlayerLogout #18163

Merged
merged 3 commits into from
Jan 13, 2024

Conversation

NathanHandley
Copy link
Contributor

@NathanHandley NathanHandley commented Jan 13, 2024

Changes Proposed:

Adding a new hook "OnBeforePlayerLogout" which fires before the logout logic is executed for a player inside WorldSession::LogoutPlayer. This is to support a mod I made which allows a character to change their class, which you can find here.

There is logic to perform before the logout save event, which made utilizing the existing OnPlayerLogout non-viable (visual item changes on class switch were not being pushed and registered on the client). Since the save hook does not have the "logout" bool available, I was left with a choice to add this new hook or update/overload that hook. It seems that a OnBeforeLogout could be useful for more hypothetical use cases, so I elected with this approach. Also, this allows it to work in the situation that save on logout isn't enabled for some reason.

Issues Addressed:

none

SOURCE:

n/a

Tests Performed:

  • Tested on both an Ubuntu 22.04 and Windows 10 Pro server

How to Test the Changes:

The mod here uses this hook. Install that mod, and switch your class while wearing gear.

Known Issues and TODO List:

none

@github-actions github-actions bot added CORE Related to the core file-cpp Used to trigger the matrix build labels Jan 13, 2024
@NathanHandley NathanHandley changed the title feat(Core/Hook): New hook OnPlayerPreLogout feat(Core/Hook): New hook OnPlayerBeforeLogout Jan 13, 2024
@NathanHandley NathanHandley changed the title feat(Core/Hook): New hook OnPlayerBeforeLogout feat(Core/Hook): New hook OnBeforePlayerLogout Jan 13, 2024
@Kitzunu Kitzunu merged commit 4321b8a into azerothcore:master Jan 13, 2024
13 of 14 checks passed
@NathanHandley NathanHandley deleted the PlayerPreLogout branch January 13, 2024 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CORE Related to the core file-cpp Used to trigger the matrix build To Be Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants