Kownikuzyt
Member
- Joined
- Feb 11, 2020
- Messages
- 170
- Solutions
- 1
- Reaction score
- 8
Hello, I'm trying to add "Loot Channel System".
C++ - Loot Channel System (https://otland.net/threads/loot-channel-system.254816/)
I am using the TFS 1.1 engine.
My problem after adding to code:
Code: data/chatchannels/chatchannels.xml
Code: data/chatchannels/scripts/loot.lua
Code: src/const.h
Code: src/monsters.cpp
Code: src/party.cpp
Should I just replace:
owner->sendTextMessage(MESSAGE_LOOT, ss.str());
on
owner->sendChannelMessage("", ss.str(), TALKTYPE_CHANNEL_Y, CHANNEL_LOOT);
member->sendTextMessage(MESSAGE_LOOT, loot);
on
member->sendChannelMessage("", loot, TALKTYPE_CHANNEL_Y, CHANNEL_LOOT);
C++ - Loot Channel System (https://otland.net/threads/loot-channel-system.254816/)
I am using the TFS 1.1 engine.
My problem after adding to code:
- No "Loot" window opened when logging into the game.
- The "server Log" still shows "Loot" (I wish it wouldn't show).
- The "Loot" window does not show anything (after killing a monster, it does not show loot).
Code: data/chatchannels/chatchannels.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<!--<channel id="2" name="Tutor" script="tutor.lua" />-->
<channel id="3" name="World Chat" public="1" script="worldchat.lua" />
<!--<channel id="4" name="English Chat" public="1" script="englishchat.lua" />-->
<!--<channel id="5" name="Advertising" public="1" script="advertising.lua" />-->
<!--<channel id="6" name="Advertising-Rookgaard" public="1" script="advertising-rook.lua" />-->
<channel id="7" name="Help" public="1" script="help.lua" />
<!--<channel id="8" name="Gamemaster" script="gamemaster.lua" />-->
<channel id="9" name="Loot" public="1" script="loot.lua" />
</channels>
Code: data/chatchannels/scripts/loot.lua
Lua:
function onSpeak(player, type, message)
return false
end
Code: src/const.h
#define CHANNEL_PARTY 0x01
#define CHANNEL_LOOT 0x09
Code: src/monsters.cpp
if (owner) {
std:: ostringstream ss;
ss << "Loot of " << nameDescription << ": " << corpse->getContentDescription();
if (owner->getParty()) {
owner->getParty()->broadcastPartyLoot(ss.str());
} else {
owner->sendTextMessage(MESSAGE_LOOT, ss.str());
}
owner->sendChannelMessage("", ss.str(), TALKTYPE_CHANNEL_Y, CHANNEL_LOOT);
}
} else {
std:: ostringstream ss;
ss << "Loot of " << nameDescription << ": nothing (due to low stamina)";
if (owner->getParty()) {
owner->getParty()->broadcastPartyLoot(ss.str());
} else {
owner->sendTextMessage(MESSAGE_LOOT, ss.str());
}
owner->sendChannelMessage("", ss.str(), TALKTYPE_CHANNEL_Y, CHANNEL_LOOT);
}
corpse->startDecaying();
}
Code: src/party.cpp
void Party::broadcastPartyLoot(const std::string& loot)
{
leader->sendTextMessage(MESSAGE_LOOT, loot);
for (Player* member : memberList) {
member->sendTextMessage(MESSAGE_LOOT, loot);
member->sendChannelMessage("", loot, TALKTYPE_CHANNEL_Y, CHANNEL_LOOT);
}
}
Should I just replace:
owner->sendTextMessage(MESSAGE_LOOT, ss.str());
on
owner->sendChannelMessage("", ss.str(), TALKTYPE_CHANNEL_Y, CHANNEL_LOOT);
member->sendTextMessage(MESSAGE_LOOT, loot);
on
member->sendChannelMessage("", loot, TALKTYPE_CHANNEL_Y, CHANNEL_LOOT);