-
-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] Bestiary unlocked creature (#438)
Before, the bestiary did not unlock or account for a creature due to the lack of the script in creaturescripts for its functioning.
- Loading branch information
Showing
2 changed files
with
48 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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() |