Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default_onDropLoot.lua #3941

Merged
merged 1 commit into from
Feb 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions data/scripts/eventcallbacks/monster/default_onDropLoot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@ ec.onDropLoot = function(self, corpse)

local player = Player(corpse:getCorpseOwner())
local mType = self:getType()
local doCreateLoot = false

if not player or player:getStamina() > 840 then
doCreateLoot = true
end

if doCreateLoot then
local monsterLoot = mType:getLoot()
for i = 1, #monsterLoot do
local item = corpse:createLootItem(monsterLoot[i])
if not item then
print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
print("[Warning] DropLoot: Could not add loot item to corpse.")
end
end
end

if player then
local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
local party = player:getParty()
if party then
party:broadcastPartyLoot(text)
else
player:sendTextMessage(MESSAGE_LOOT, text)
end
if player then
local text
if doCreateLoot then
text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
else
text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription())
end
else
local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription())
local party = player:getParty()
if party then
party:broadcastPartyLoot(text)
Expand Down