Is there a way to make a loot channel so it won't be displaying at server log? I've been trying for 3 days but haven't done it yet..
I'm using TFS 1.2
configmanager.cpp
boolean[SHOW_MONSTER_LOOT] = getGlobalBoolean(L, "showMonsterLoot", true);
config.lua
showMonsterLoot = true
What's wrong with my code?
chatchannels.xml
[/CODE]
loot.lua
creaturescripts.xml
loot.lua in creaturescripts/scripts
monsters.cpp
I'm using TFS 1.2
configmanager.cpp
boolean[SHOW_MONSTER_LOOT] = getGlobalBoolean(L, "showMonsterLoot", true);
config.lua
showMonsterLoot = true
What's wrong with my code?
chatchannels.xml
LUA:
[CODE=lua]<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel id="2" name="Rule Violations" script="ruleviolations.lua" />
<channel id="3" name="Tutor" script="tutor.lua" />
<channel id="4" name="Game Chat" public="1" script="worldchat.lua" />
<channel id="5" name="Real Chat" public="1" script="englishchat.lua" />
<channel id="6" name="Trade" public="1" script="trade.lua" />
<channel id="7" name="Help" public="1" script="help.lua" />
<channel id="8" name="Gamemaster" script="gamemaster.lua" />
<channel id="9" name="TradeRook" public="1" script="traderook.lua" />
<channel id="10" name="Loot Channel" public="0" script="loot.lua" />
</channels>
loot.lua
Code:
-- Script for the loot channel
function onJoinChannel(player, channelId)
return true
end
function onLeaveChannel(player, channelId)
return true
end
creaturescripts.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<event type="login" name="PlayerLogin" script="login.lua"/>
<event type="login" name="FirstItems" script="firstitems.lua"/>
<event type="death" name="PlayerDeath" script="playerdeath.lua"/>
<event type="kill" name="Task_Race" script="task_race.lua"/>
<event type="kill" name="Task_Solo" script="task_solo.lua"/>
<event type="kill" name="Boss_Kill" script="boss_kill.lua"/>
<event type="login" name="Storage_Time_Login" script="storage_time_login.lua"/>
<event type="think" name="Storage_Time_Real" script="storage_time_real.lua"/>
<event type="advance" name="reward_level" script="reward_level.lua"/>
<event type="kill" name="Minotaur_Mage_Rook" script="quests/minotaur_mage_rook.lua"/>
<event type="kill" name="LootDropEvent" script="loot.lua"/>
</creaturescripts>
loot.lua in creaturescripts/scripts
LUA:
local lootEvent = {}
function lootEvent.onKill(player, target)
local corpse = target:getCorpse()
if not corpse then
return true
end
if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
return true
end
local mType = target: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
local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
local party = player:getParty()
if party then
party:broadcastPartyLoot(text)
for _, member in ipairs(party:getMembers()) do
member:sendChannelMessage("", text, TALKTYPE_CHANNEL_O, 10)
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, text)
player:sendChannelMessage("", text, TALKTYPE_CHANNEL_O, 10)
end
end
return true
end
function onKill(player, target)
return lootEvent.onKill(player, target)
end
monsters.cpp
LUA:
if (g_config.getBoolean(ConfigManager::SHOW_MONSTER_LOOT)) {
Player* owner = g_game.getPlayerByID(corpse->getCorpseOwner());
if (owner && owner->isPremium()) {
std::stringstream ss;
ss << "Loot of " << nameDescription << ": " << corpse->getContentDescription() << ".";
if (owner->getParty())
{
owner->getParty()->broadcastPartyLoot(ss.str());
}
else
{
owner->sendChannelMessage("", ss.str(), TALKTYPE_CHANNEL_Y, uint16_t(10)); // 12 to numer kanału lootu
}
}
}
corpse->startDecaying();
}