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


C++ Guild::ChangeMemberRank方法代码示例

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


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

示例1: HandleGuildRankCommand

    static bool HandleGuildRankCommand(ChatHandler* handler, char const* args)
    {
        char* nameStr;
        char* rankStr;
        handler->extractOptFirstArg((char*)args, &nameStr, &rankStr);
        if (!rankStr)
            return false;

        Player* target;
        uint64 targetGuid;
        std::string target_name;
        if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name))
            return false;

        uint32 guildId = target ? target->GetGuildId() : Player::GetGuildIdFromDB(targetGuid);
        if (!guildId)
            return false;

        Guild* targetGuild = sGuildMgr->GetGuildById(guildId);
        if (!targetGuild)
            return false;

        uint8 newRank = uint8(atoi(rankStr));
        return targetGuild->ChangeMemberRank(targetGuid, newRank);
	}
开发者ID:boom8866,项目名称:new,代码行数:25,代码来源:cs_guild.cpp

示例2: HandleGuildRankCommand

    static bool HandleGuildRankCommand(ChatHandler* handler, char const* args)
    {
        char* nameStr;
        char* rankStr;
        handler->extractOptFirstArg((char*)args, &nameStr, &rankStr);
        if (!rankStr)
            return false;

        Player* target;
        ObjectGuid targetGuid;
        std::string target_name;
        if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &target_name))
            return false;

        ObjectGuid::LowType guildId = target ? target->GetGuildId() : sCharacterCache->GetCharacterGuildIdByGuid(targetGuid);
        if (!guildId)
            return false;

        Guild* targetGuild = sGuildMgr->GetGuildById(guildId);
        if (!targetGuild)
            return false;

        uint8 newRank = uint8(atoi(rankStr));
        SQLTransaction trans(nullptr);
        return targetGuild->ChangeMemberRank(trans, targetGuid, newRank);
    }
开发者ID:AvariusProject,项目名称:AvariusCore,代码行数:26,代码来源:cs_guild.cpp

示例3: HandleGuildRankOpcode

void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
{
    uint32 BankStacks[GUILD_BANK_MAX_TABS];
    for (uint32 i = 0; i < GUILD_BANK_MAX_TABS; i++)
        recvPacket >> BankStacks[i];

    uint32 new_rights;
    recvPacket >> new_rights;

    uint32 new_rankId;
    recvPacket >> new_rankId;

    uint32 old_rankId;
    recvPacket >> old_rankId;

    uint32 BankRights[GUILD_BANK_MAX_TABS];
    for (uint32 i = 0; i < GUILD_BANK_MAX_TABS; i++)
        recvPacket >> BankRights[i];

    uint64 guildId;
    recvPacket >> guildId;

    uint32 old_rights;
    recvPacket >> old_rights;

    uint32 money;
    recvPacket >> money;

    uint64 playerGuid;
    recvPacket >> playerGuid;

    std::string rankName;
    recvPacket >> rankName;

    sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Received CMSG_GUILD_RANK");

    if (GetPlayer()->GetGUID() != playerGuid)
    {
        printf("CMSG_GUILD_RANK: The playerGUID in the packet does not match the current player!\n");
        recvPacket.rpos(recvPacket.wpos());
        Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD);
        return;
    }

    if (GetPlayer()->GetGuildId() != GUID_LOPART(guildId))
    {
        printf("CMSG_GUILD_RANK: This player is not in the guild.\n");
        recvPacket.rpos(recvPacket.wpos());
        Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD);
        return;
    }

    Guild* guild = _GetPlayerGuild(this, true);
    if (!guild)
    {
        recvPacket.rpos(recvPacket.wpos());
        return;
    }

    GuildBankRightsAndSlotsVec rightsAndSlots(GUILD_BANK_MAX_TABS);
    if (old_rankId != GR_GUILDMASTER)
    {
        for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
        {
            rightsAndSlots[tabId] = GuildBankRightsAndSlots(BankRights[tabId], BankStacks[tabId]);
        }

        guild->HandleSetRankInfo(this, new_rankId, rankName, new_rights, money, rightsAndSlots);
    }

    if (old_rankId != new_rankId && old_rankId != GR_GUILDMASTER && new_rankId != GR_GUILDMASTER)
        guild->ChangeMemberRank(old_rankId, new_rankId);
}
开发者ID:Bootz,项目名称:SkyFireEMU_430,代码行数:73,代码来源:GuildHandler.cpp


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