This pull request refactors the PlayerDeath event script to improve code readability and maintainability. The original function has been split into smaller, more focused functions, each handling a specific part of the player death processing logic. This includes identifying the killer, logging deaths in the database, sending messages to the guild channel, and checking guild wars.
With this refactoring, the code is more modular and easier to understand, making future modifications and maintenance more manageable. The PlayerDeath event logic remains unchanged, ensuring the system continues to function as expected.
Changes:
Split the onDeath function into smaller local functions.
Improved SQL query formatting using string.format for clarity and to avoid repetitive code.
Renamed local variables to follow the camelCase convention.
Type of change
[x] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
Checklist
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[x] I checked the PR checks reports
[ ] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[ ] I have added tests that prove my fix is effective or that my feature works
Description
This pull request refactors the PlayerDeath event script to improve code readability and maintainability. The original function has been split into smaller, more focused functions, each handling a specific part of the player death processing logic. This includes identifying the killer, logging deaths in the database, sending messages to the guild channel, and checking guild wars.
With this refactoring, the code is more modular and easier to understand, making future modifications and maintenance more manageable. The PlayerDeath event logic remains unchanged, ensuring the system continues to function as expected.
Changes:
Type of change
Checklist