mirror of
https://github.com/opentibiabr/canary
synced 2026-08-16 06:26:09 -04:00
Before, the bestiary did not unlock or account for a creature due to the lack of the script in creaturescripts for its functioning.
27 lines
691 B
Lua
27 lines
691 B
Lua
local bestiaryOnKill = CreatureEvent("BestiaryOnKill")
|
|
|
|
function bestiaryOnKill.onKill(player, creature, lastHit)
|
|
if not player:isPlayer() or not creature:isMonster() or creature:hasBeenSummoned() or creature:isPlayer() then
|
|
return true
|
|
end
|
|
|
|
for cid, damage in pairs(creature:getDamageMap()) do
|
|
local participant = Player(cid)
|
|
if participant and participant:isPlayer() then
|
|
participant:addBestiaryKill(creature:getName())
|
|
end
|
|
end
|
|
|
|
return true
|
|
end
|
|
|
|
bestiaryOnKill:register()
|
|
|
|
local loginBestiaryPlayer = CreatureEvent("loginBestiaryPlayer")
|
|
|
|
function loginBestiaryPlayer.onLogin(player)
|
|
player:registerEvent("BestiaryOnKill")
|
|
return true
|
|
end
|
|
|
|
loginBestiaryPlayer:register()
|