Announcement: The amount of coins earned has been increased, visit the F.A.Q Section for more information!
Register and start earning coins for adding servers, creating threads, posting and much more!


Guild Leaders Channel (9.X and 8.6) Watch Thread

Extrodus
Administrator

Posts: 112
Guild Leaders Channel


Credits to Ninja from OTLand.

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
<channel id="10" name="Guild Leaders"/>

chat.cpp

Find bool ChatChannel::talk and replace it or compare it with this one.

9.X
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() << " ";
        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 << " " << player->getName() << ": " << text << std::endl;


    return true;
}


8.6
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() << " ";
        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 << " "  << player->getName() << ": " << text <<  std::endl;


    return true;
}


Replace this
player->getVocationId())))

with this
player->getVocationId())) || (channelId == 10 && !(player->getGuildLevel() == GUILDLEVEL_LEADER)))


Enjoy!
Created 21 December 2013 03:34:17 Updated 21 December 2013 03:42:28#post-25
Who is viewing this thread?
nobody
Copyright OTList.net Follow us on Facebook