canary/data/scripts/creaturescripts/player/adventure_blessing.lua
Marco 3c98b4161c
refactor: split player death event handler into smaller functions (#3113)
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.
2024-12-09 15:14:36 -03:00

9 lines
266 B
Lua

dofile(CORE_DIRECTORY .. "/libs/systems/blessing.lua")
local adventurerBlessingLogin = CreatureEvent("AdventurerBlessingLogin")
function adventurerBlessingLogin.onLogin(player)
return Blessings.doAdventurerBlessing(player)
end
adventurerBlessingLogin:register()