monster.lua

main 40 lines · 1 KB Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1function Monster:onDropLoot(corpse)
2 --[[if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
3 return
4 end
5
6 local player = Player(corpse:getCorpseOwner())
7 local mType = self:getType()
8 if not player or player:getStamina() > 840 then
9 local monsterLoot = mType:getLoot()
10 for i = 1, #monsterLoot do
11 local item = corpse:createLootItem(monsterLoot[i])
12 if not item then
13 print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
14 end
15 end
16
17 if player then
18 local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
19 local party = player:getParty()
20 if party then
21 party:broadcastPartyLoot(text)
22 else
23 player:sendTextMessage(MESSAGE_LOOT, text)
24 end
25 end
26 else
27 local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription())
28 local party = player:getParty()
29 if party then
30 party:broadcastPartyLoot(text)
31 else
32 player:sendTextMessage(MESSAGE_LOOT, text)
33 end
34 end]]
35end
36
37function Monster:onSpawn(position, startup, artificial)
38 return true
39end
40
Top