mirror of
https://github.com/opentibiabr/canary
synced 2026-08-16 06:26:09 -04:00
31 lines
707 B
Lua
31 lines
707 B
Lua
local playerLogout = CreatureEvent("PlayerLogout")
|
|
|
|
function playerLogout.onLogout(player)
|
|
local playerId = player:getId()
|
|
|
|
if _G.NextUseStaminaTime[playerId] then
|
|
_G.NextUseStaminaTime[playerId] = nil
|
|
end
|
|
|
|
local stats = player:inBossFight()
|
|
if stats then
|
|
local boss = Monster(stats.bossId)
|
|
if boss then
|
|
local dmgOut = boss:getDamageMap()[playerId]
|
|
if dmgOut then
|
|
stats.damageOut = (stats.damageOut or 0) + dmgOut.total
|
|
end
|
|
|
|
stats.stamina = player:getStamina()
|
|
end
|
|
end
|
|
|
|
if _G.OnExerciseTraining[playerId] then
|
|
stopEvent(_G.OnExerciseTraining[playerId].event)
|
|
_G.OnExerciseTraining[playerId] = nil
|
|
player:setTraining(false)
|
|
end
|
|
return true
|
|
end
|
|
|
|
playerLogout:register()
|