This way the killer list will show who gave the final hit, who did the
most damage and all other participants, whether monsters or players.
PR Complement: https://github.com/opentibiabr/myaac/pull/134
I made corrections to the `death.lua` script to resolve nil value errors
in the `handleGuildWar` function. I added checks to ensure that both the
player and the killer are valid and that both belong to a guild before
proceeding with the guild war logic. This helps prevent failures when
one of the objects is undefined.
Fixes from: 3c98b4161c
This 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.