本文整理汇总了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);
}
示例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);
}
示例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);
}