本文整理汇总了C++中Guild::GetLeaderGuid方法的典型用法代码示例。如果您正苦于以下问题:C++ Guild::GetLeaderGuid方法的具体用法?C++ Guild::GetLeaderGuid怎么用?C++ Guild::GetLeaderGuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guild
的用法示例。
在下文中一共展示了Guild::GetLeaderGuid方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleGuildAddRankOpcode
void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: Received opcode CMSG_GUILD_ADD_RANK");
recvPacket >> Unused<uint32>(); // rank id
std::string rankname = recvPacket.ReadString(recvPacket.ReadBits(7));
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (GetPlayer()->GetObjectGuid() != guild->GetLeaderGuid())
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
return;
}
if (guild->GetRanksSize() >= GUILD_RANKS_MAX_COUNT) // client not let create more 10 than ranks
return;
guild->CreateRank(rankname, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
guild->Query(this);
guild->QueryRanks(this);
guild->Roster(); // broadcast for tab rights update
}
示例2: HandleGuildDelRankOpcode
void WorldSession::HandleGuildDelRankOpcode(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: Received opcode CMSG_GUILD_DEL_RANK");
uint32 rankId;
recvPacket >> rankId;
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (GetPlayer()->GetObjectGuid() != guild->GetLeaderGuid())
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
return;
}
// do not allow delete rank if there are still members using it
if (guild->HasMembersWithRank(rankId))
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_RANK_IN_USE);
return;
}
guild->DelRank(rankId);
guild->Query(this);
guild->QueryRanks(this);
guild->Roster(); // broadcast for tab rights update
}
示例3: HandleGuildDisbandOpcode
void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/)
{
DEBUG_LOG("WORLD: Received opcode CMSG_GUILD_DISBAND");
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (GetPlayer()->GetObjectGuid() != guild->GetLeaderGuid())
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
return;
}
// do not delete guilds that level are higher than undeletable
if (guild->GetMemberSize() == 1 && guild->GetLevel() >= sWorld.getConfig(CONGIG_UINT32_GUILD_UNDELETABLE_LEVEL))
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_UNDELETABLE_DUE_TO_LEVEL);
return;
}
guild->Disband();
delete guild;
DEBUG_LOG("WORLD: Guild Successfully Disbanded");
}
示例4: HandleGuildSwitchRankOpcode
void WorldSession::HandleGuildSwitchRankOpcode(WorldPacket& recvPacket)
{
uint32 rankId;
bool up;
recvPacket >> rankId;
up = recvPacket.ReadBit();
DEBUG_LOG("WORLD: Received CMSG_GUILD_SWITCH_RANK rank %u up %u", rankId, up);
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (GetPlayer()->GetObjectGuid() != guild->GetLeaderGuid())
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
return;
}
guild->SwitchRank(rankId, up);
guild->QueryRanks(this);
guild->Query(this);
guild->Roster(); // broadcast for tab rights update
}
示例5: SendApplicantListUpdate
void GuildFinderMgr::SendApplicantListUpdate(Guild& guild)
{
WorldPacket data(SMSG_LF_GUILD_APPLICANT_LIST_UPDATED, 0);
if (Player* player = sObjectAccessor.FindPlayer(guild.GetLeaderGuid()))
player->SendDirectMessage(&data);
guild.BroadcastPacketToRank(&data, GR_OFFICER);
}
示例6: HandleGuildLeaveOpcode
void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
{
DEBUG_LOG("WORLD: Received opcode CMSG_GUILD_LEAVE");
Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (_player->GetObjectGuid() == guild->GetLeaderGuid() && guild->GetMemberSize() > 1)
{
SendGuildCommandResult(GUILD_QUIT_S, "", ERR_GUILD_LEADER_LEAVE);
return;
}
// do not delete guilds that level are higher than undeletable
if (guild->GetMemberSize() == 1 && guild->GetLevel() >= sWorld.getConfig(CONGIG_UINT32_GUILD_UNDELETABLE_LEVEL))
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_UNDELETABLE_DUE_TO_LEVEL);
return;
}
sCalendarMgr.RemoveGuildCalendar(_player->GetObjectGuid(), guild->GetId());
if (_player->GetObjectGuid() == guild->GetLeaderGuid())
{
guild->Disband();
delete guild;
return;
}
SendGuildCommandResult(GUILD_QUIT_S, guild->GetName(), ERR_PLAYER_NO_MORE_IN_GUILD);
if (guild->DelMember(_player->GetObjectGuid()))
{
guild->Disband();
delete guild;
return;
}
// Put record into guild log
guild->LogGuildEvent(GUILD_EVENT_LOG_LEAVE_GUILD, _player->GetObjectGuid());
guild->BroadcastEvent(GE_LEFT, _player->GetObjectGuid(), _player->GetName());
}
示例7: HandleGuildRankOpcode
void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
{
std::string rankname;
uint32 rankId;
uint32 rights, MoneyPerDay;
DEBUG_LOG("WORLD: Received opcode CMSG_GUILD_RANK");
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
if (!guild)
{
recvPacket.rfinish(); // set to end to avoid warnings spam
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (GetPlayer()->GetObjectGuid() != guild->GetLeaderGuid())
{
recvPacket.rfinish(); // set to end to avoid warnings spam
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
return;
}
recvPacket >> Unused<uint32>(); // unk
recvPacket >> Unused<uint32>(); // old rights
recvPacket >> rights;
uint32 BankRights[GUILD_BANK_MAX_TABS];
uint32 BankSlotPerDay[GUILD_BANK_MAX_TABS];
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
recvPacket >> BankRights[i];
recvPacket >> BankSlotPerDay[i];
}
recvPacket >> MoneyPerDay;
recvPacket >> rankId;
rankname = recvPacket.ReadString(recvPacket.ReadBits(7));
DEBUG_LOG("WORLD: Changed RankName to %s , Rights to 0x%.4X", rankname.c_str(), rights);
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
guild->SetBankRightsAndSlots(rankId, uint8(i), uint16(BankRights[i] & 0xFF), uint16(BankSlotPerDay[i]), true);
guild->SetBankMoneyPerDay(rankId, MoneyPerDay);
guild->SetRankName(rankId, rankname);
if (rankId == GR_GUILDMASTER) // prevent loss leader rights
rights = GR_RIGHT_ALL;
guild->SetRankRights(rankId, rights);
guild->Query(this);
guild->Roster(); // broadcast for tab rights update
}
示例8: HandleSaveGuildEmblemOpcode
void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: Received MSG_SAVE_GUILD_EMBLEM");
ObjectGuid vendorGuid;
uint32 EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor;
recvPacket >> vendorGuid;
recvPacket >> EmblemStyle >> EmblemColor >> BorderStyle >> BorderColor >> BackgroundColor;
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_TABARDDESIGNER);
if (!pCreature)
{
//"That's not an emblem vendor!"
SendSaveGuildEmblem(ERR_GUILDEMBLEM_INVALIDVENDOR);
DEBUG_LOG("WORLD: HandleSaveGuildEmblemOpcode - %s not found or you can't interact with him.", vendorGuid.GetString().c_str());
return;
}
// remove fake death
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
if (!guild)
{
//"You are not part of a guild!";
SendSaveGuildEmblem(ERR_GUILDEMBLEM_NOGUILD);
return;
}
if (guild->GetLeaderGuid() != GetPlayer()->GetObjectGuid())
{
//"Only guild leaders can create emblems."
SendSaveGuildEmblem(ERR_GUILDEMBLEM_NOTGUILDMASTER);
return;
}
if (GetPlayer()->GetMoney() < 10 * GOLD)
{
//"You can't afford to do that."
SendSaveGuildEmblem(ERR_GUILDEMBLEM_NOTENOUGHMONEY);
return;
}
GetPlayer()->ModifyMoney(-10 * GOLD);
guild->SetEmblem(EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor);
//"Guild Emblem saved."
SendSaveGuildEmblem(ERR_GUILDEMBLEM_SUCCESS);
guild->Query(this);
}
示例9: HandleGuildLeaveOpcode
void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
{
DEBUG_LOG("WORLD: Received opcode CMSG_GUILD_LEAVE");
Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (_player->GetObjectGuid() == guild->GetLeaderGuid() && guild->GetMemberSize() > 1)
{
SendGuildCommandResult(GUILD_QUIT_S, "", ERR_GUILD_LEADER_LEAVE);
return;
}
if (_player->GetObjectGuid() == guild->GetLeaderGuid())
{
guild->Disband();
delete guild;
return;
}
SendGuildCommandResult(GUILD_QUIT_S, guild->GetName(), ERR_PLAYER_NO_MORE_IN_GUILD);
if (guild->DelMember(_player->GetObjectGuid()))
{
guild->Disband();
delete guild;
return;
}
// Put record into guild log
guild->LogGuildEvent(GUILD_EVENT_LOG_LEAVE_GUILD, _player->GetObjectGuid());
guild->BroadcastEvent(GE_LEFT, _player->GetObjectGuid(), _player->GetName());
}
示例10: HandleGuildLeaderOpcode
void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: Received opcode CMSG_GUILD_LEADER");
std::string name = recvPacket.ReadString(recvPacket.ReadBits(7));
Player* oldLeader = GetPlayer();
if (!normalizePlayerName(name))
return;
Guild* guild = sGuildMgr.GetGuildById(oldLeader->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (oldLeader->GetObjectGuid() != guild->GetLeaderGuid())
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
return;
}
MemberSlot* oldSlot = guild->GetMemberSlot(oldLeader->GetObjectGuid());
if (!oldSlot)
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
return;
}
MemberSlot* slot = guild->GetMemberSlot(name);
if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, name, ERR_GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
if (slot->guid == oldLeader->GetObjectGuid())
return;
guild->SetLeader(slot->guid);
// NOTE: GR_OFFICER might not actually be officer rank
oldSlot->ChangeRank(GR_OFFICER);
guild->BroadcastEvent(GE_LEADER_CHANGED, oldLeader->GetName(), name.c_str());
}
示例11: HandleGuildDisbandOpcode
void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/)
{
DEBUG_LOG("WORLD: Received opcode CMSG_GUILD_DISBAND");
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (GetPlayer()->GetObjectGuid() != guild->GetLeaderGuid())
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
return;
}
guild->Disband();
delete guild;
DEBUG_LOG("WORLD: Guild Successfully Disbanded");
}
示例12: HandleGuildAcceptOpcode
void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
{
Guild* guild;
Player* player = GetPlayer();
DEBUG_LOG("WORLD: Received opcode CMSG_GUILD_ACCEPT");
guild = sGuildMgr.GetGuildById(player->GetGuildIdInvited());
if (!guild || player->GetGuildId())
{ return; }
// not let enemies sign guild charter
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(guild->GetLeaderGuid()))
{ return; }
if (!guild->AddMember(GetPlayer()->GetObjectGuid(), guild->GetLowestRank()))
{ return; }
// Put record into guild log
guild->LogGuildEvent(GUILD_EVENT_LOG_JOIN_GUILD, GetPlayer()->GetObjectGuid());
guild->BroadcastEvent(GE_JOINED, player->GetObjectGuid(), player->GetName());
}