• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ OnDrop

limen

New Member
Joined
Feb 6, 2025
Messages
8
Reaction score
0
Hey. I'm using Oen upgrade system and I'd like to add rarity names to the Loot channel. Should I do this here in onDrop?
local ec = EventCallback

ec.onDropLoot = function(self, 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()
for i = 1, #monsterLoot do
local item = corpse:createLootItem(monsterLoot)
if not item then
print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
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:sendChannelMessage("", text, TALKTYPE_CHANNEL_O, 9) --9 is the channel ID, yours might be different
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
player:sendChannelMessage("", text, TALKTYPE_CHANNEL_O, 9) --9 is the channel ID, yours might be different
end
end
end

ec:register()
 
You have everything in this topic.

 
Back
Top