当前位置: 首页>>代码示例>>C++>>正文


C++ PlayerPointer::ToMasterPlayer方法代码示例

本文整理汇总了C++中PlayerPointer::ToMasterPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::ToMasterPlayer方法的具体用法?C++ PlayerPointer::ToMasterPlayer怎么用?C++ PlayerPointer::ToMasterPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerPointer的用法示例。


在下文中一共展示了PlayerPointer::ToMasterPlayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: List

void Channel::List(PlayerPointer player)
{
    ObjectGuid p = player->GetObjectGuid();

    MasterPlayer* masterPlayer = player->ToMasterPlayer();
    Player* asPlayer = player->ToPlayer();

    if (!IsOn(p))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, p);
    }
    else
    {
        WorldPacket data(SMSG_CHANNEL_LIST, 1 + (GetName().size() + 1) + 1 + 4 + m_players.size() * (8 + 1));
        data << uint8(1);                                   // channel type?
        data << GetName();                                  // channel name
        data << uint8(GetFlags());                          // channel flags?

        size_t pos = data.wpos();
        data << uint32(0);                                  // size of list, placeholder

        AccountTypes gmLevelInWhoList = (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_WHO_LIST);

        uint32 count  = 0;
        for (PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
        {
            if (masterPlayer)
            {
                MasterPlayer* plr = sObjectAccessor.FindMasterPlayer(i->first);
                // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
                // MODERATOR, GAME MASTER, ADMINISTRATOR can see all
                if (plr && (masterPlayer->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= gmLevelInWhoList) &&
                        plr->IsVisibleGloballyFor(masterPlayer))
                {
                    data << ObjectGuid(i->first);
                    data << uint8(i->second.flags);             // flags seems to be changed...
                    ++count;
                }
            }
            else
            {
                Player *plr = sObjectMgr.GetPlayer(i->first);

                // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
                // MODERATOR, GAME MASTER, ADMINISTRATOR can see all
                if (plr && (asPlayer->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= gmLevelInWhoList) &&
                        plr->IsVisibleGloballyFor(asPlayer))
                {
                    data << ObjectGuid(i->first);
                    data << uint8(i->second.flags);             // flags seems to be changed...
                    ++count;
                }
            }
        }

        data.put<uint32>(pos, count);

        SendToOne(&data, p);
    }
}
开发者ID:Maduse,项目名称:server,代码行数:62,代码来源:Channel.cpp


注:本文中的PlayerPointer::ToMasterPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。