All pastes #898891 Raw Edit

Meins

public text v1 · immutable
·published 2008-02-10 18:44 UTC
rendered paste body
bool ChatHandler::HandleGMListCommand(const char* /*args*/)
{
    bool first = true;
    std::string type;
    std::string name;
    std::string msg;
    HashMapHolder<Player>::MapType &m = HashMapHolder<Player>::GetContainer();
    HashMapHolder<Player>::MapType::iterator itr = m.begin();
    for(; itr != m.end(); ++itr)
    {
        if( itr->second->GetSession()->GetSecurity() && (itr->second->isGameMaster() || sWorld.getConfig(CONFIG_GM_IN_GM_LIST) ) &&
            itr->second->IsVisibleGloballyFor(m_session->GetPlayer()) )
        {
            if(first)
            {
                SendSysMessage(LANG_GMS_ON_SRV);
                first = false;
            }
            switch(itr->second->GetSession()->GetSecurity())
            {
                case 3:
                    type = "<Supporter>";
                    break;
                case 4:
                    type = "<ProbeGM>";
                    break;
                case 5:
                    type = "<GM>";
                    break;
                case 6:
                    type = "<SysAdmin>";
                    break;
            }
            name = itr->second->GetName();
            msg = type+name;
            SendSysMessage(msg.c_str());
        }
    }

    if(first)
        SendSysMessage(LANG_GMS_NOT_LOGGED);

    return true;
}