johnsamir
Advanced OT User
Hello
I have the 8.6 Nekiero server TFS 1.3.
I have found a loot channel script system for tfs 1.3 is working but like i have said before. When a player killS something, the message is being sent to the whole playerbase logged in.
can somebody tell me where is the issue ?
chatchannels/loot.lua
and at chatchannel.xml
events/scripts/monsters.lua
I have the 8.6 Nekiero server TFS 1.3.
I have found a loot channel script system for tfs 1.3 is working but like i have said before. When a player killS something, the message is being sent to the whole playerbase logged in.
can somebody tell me where is the issue ?
chatchannels/loot.lua
Code:
local STORAGEVALUE_LOOT = 8914
function onSpeak(player, type, message)
return false
end
function onJoin(player)
player:setStorageValue(STORAGEVALUE_LOOT, 1)
return true
end
function onLeave(player)
player:setStorageValue(STORAGEVALUE_LOOT, 0)
return true
end
and at chatchannel.xml
Code:
<channel id="11" name="Loot" script="loot.lua" />
events/scripts/monsters.lua
Lua:
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()
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.')
end
end
if player then
local text = ("Loot de %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
sendChannelMessage(11, TALKTYPE_CHANNEL_O, text)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, text)
end
end
end
else
local text = ("Loot de %s: nada (devivo a baixa 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