Guild Leaders Channel
This channel is especially for Guild Leaders, where they could chat with each other about upcoming battles et cetera. It has been tested on latest revision, (protocol 9.70 r5893).
Good to know
- Only Guild Leaders will be able to enter the channel.
- It will show their Guild Name next to their own so others can see which guild they're representing.
I'll use channel ID 10, so if that ID is taken already then change to another one!
channels.xml
XML:
<channel id="10" name="Guild Leaders"/>
chat.cpp
Find bool ChatChannel::talk and replace it or compare it with this one.
9.X
[cpp]bool ChatChannel::talk(Player* player, MessageClasses type, const std::string& text, uint32_t statementId)
{
UsersMap::iterator it = m_users.find(player->getID());
if(it == m_users.end())
return false;
if(m_condition && !player->hasFlag(PlayerFlag_CannotBeMuted))
{
if(Condition* condition = m_condition->clone())
player->addCondition(condition);
}
for(it = m_users.begin(); it != m_users.end(); ++it) {
if(m_id == 10) {
std::stringstream ss;
ss << player->getName() << " [" << player->getGuildName() << "]";
it->second->sendChannelMessage(ss.str(), std::string(text), type, (uint8_t)m_id);
} else {
it->second->sendCreatureChannelSay(player, type, text, m_id, statementId);
}
}
if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open())
*m_file << "[" << formatDate() << "] " << player->getName() << ": " << text << std::endl;
return true;
}[/cpp]
8.6
[CPP]bool ChatChannel::talk(Player* player, SpeakClasses type, const std::string& text, uint32_t _time/* = 0*/)
{
UsersMap::iterator it = m_users.find(player->getID());
if(it == m_users.end())
return false;
if(m_condition && !player->hasFlag(PlayerFlag_CannotBeMuted))
{
if(Condition* condition = m_condition->clone())
player->addCondition(condition);
}
for(it = m_users.begin(); it != m_users.end(); ++it) {
if(m_id == 10) {
std::stringstream ss;
ss << player->getName() << " [" << player->getGuildName() << "]";
it->second->sendChannelMessage(ss.str(), std::string(text), type, (uint8_t)m_id);
} else {
it->second->sendToChannel(player, type, text, m_id, _time);
}
}
if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open())
*m_file << "[" << formatDate() << "] " << player->getName() << ": " << text << std::endl;
return true;
}[/CPP]
Replace this
[cpp]player->getVocationId())))[/cpp]
with this
[cpp]player->getVocationId())) || (channelId == 10 && !(player->getGuildLevel() == GUILDLEVEL_LEADER)))[/cpp]
Enjoy!
Last edited: