vexler222
Active Member
- Joined
- Apr 22, 2012
- Messages
- 714
- Solutions
- 15
- Reaction score
- 46
Hi, I have this error in console, it appears every few minutes. When the error print in console, I wasn't killing any monsters and I didn't get any loot.
monster.lua
monster.lua
Code:
local STORAGEVALUE_LOOT = 8914
function Monster:onDropLoot(corpse)
if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
return
end
local player = Player(corpse:getCorpseOwner())
local mType = self:getType()
if not player or player:getStamina() > 840 then
local monsterLoot = mType:getLoot()
-- Boost Loot
local percentLoot = 0
if player:getStorageValue(STORAGEVALUE_LOOT_TEMPO) > os.time() then
local potion = lootPotion[player:getStorageValue(STORAGEVALUE_LOOT_ID)]
if potion then
percentLoot = (potion.exp / 100)
end
end
-- Boost Creature
local percent = 0
if (mType:getName():lower() == boostCreature[1].name) then
percent = (boostCreature[1].loot / 100)
end
for i = 1, #monsterLoot do
monsterLoot[i].chance = monsterLoot[i].chance + (monsterLoot[i].chance * percent) + (monsterLoot[i].chance * percentLoot)
local item = corpse:createLootItem(monsterLoot[i])
if not item then
print(string.format('[Warning] DropLoot: Could not add loot item to corpse. [Monster: %s]', item, mType:getName()))
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
if player:getStorageValue(STORAGEVALUE_LOOT) == 1 then
player:sendChannelMessage("", text, TALKTYPE_CHANNEL_O, 11)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, text)
end
end
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)
else
if player:getStorageValue(STORAGEVALUE_LOOT) == 1 then
sendChannelMessage(11, TALKTYPE_CHANNEL_O, text)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, text)
end
end
end
end