本文整理汇总了C++中Guild::GetLeader方法的典型用法代码示例。如果您正苦于以下问题:C++ Guild::GetLeader方法的具体用法?C++ Guild::GetLeader怎么用?C++ Guild::GetLeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guild
的用法示例。
在下文中一共展示了Guild::GetLeader方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleGuildLeaveOpcode
void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
{
sLog.outDebug("WORLD: Received CMSG_GUILD_LEAVE");
Guild *guild = sObjectMgr.GetGuildById(_player->GetGuildId());
if(!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(_player->GetGUID() == guild->GetLeader() && guild->GetMemberSize() > 1)
{
SendGuildCommandResult(GUILD_QUIT_S, "", ERR_GUILD_LEADER_LEAVE);
return;
}
if(_player->GetGUID() == guild->GetLeader())
{
guild->Disband();
return;
}
guild->DelMember(_player->GetGUID());
// Put record into guild log
guild->LogGuildEvent(GUILD_EVENT_LOG_LEAVE_GUILD, _player->GetGUIDLow(), 0, 0);
guild->BroadcastEvent(GE_LEFT, _player->GetGUID(), 1, _player->GetName(), "", "");
SendGuildCommandResult(GUILD_QUIT_S, guild->GetName(), ERR_PLAYER_NO_MORE_IN_GUILD);
}
示例2: HandleGuildLeaveOpcode
void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
{
std::string plName;
Guild *guild;
//sLog.outDebug("WORLD: Received CMSG_GUILD_LEAVE");
guild = objmgr.GetGuildById(_player->GetGuildId());
if(!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(_player->GetGUID() == guild->GetLeader() && guild->GetMemberSize() > 1)
{
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return;
}
if(_player->GetGUID() == guild->GetLeader())
{
guild->Disband();
return;
}
plName = _player->GetName();
guild->DelMember(_player->GetGUID());
// Put record into guildlog
guild->LogGuildEvent(GUILD_EVENT_LOG_LEAVE_GUILD, _player->GetGUIDLow(), 0, 0);
WorldPacket data(SMSG_GUILD_EVENT, (2+10)); // guess size
data << (uint8)GE_LEFT;
data << (uint8)1; // strings count
data << plName;
guild->BroadcastPacket(&data);
//sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)");
SendGuildCommandResult(GUILD_QUIT_S, guild->GetName(), GUILD_PLAYER_NO_MORE_IN_GUILD);
}
示例3: HandleGuildLeaderOpcode
void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
{
std::string name;
Player *oldLeader = GetPlayer();
Guild *guild;
//sLog.outDebug("WORLD: Received CMSG_GUILD_LEADER");
recvPacket >> name;
if(!normalizePlayerName(name))
return;
guild = objmgr.GetGuildById(oldLeader->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if( oldLeader->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
uint64 newLeaderGUID;
MemberSlot* slot = guild->GetMemberSlot(name, newLeaderGUID);
if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
guild->SetLeader(newLeaderGUID);
guild->ChangeRank(oldLeader->GetGUID(), GR_OFFICER);
WorldPacket data(SMSG_GUILD_EVENT, (2+20)); // guess size
data << (uint8)GE_LEADER_CHANGED;
data << (uint8)2; // strings count
data << oldLeader->GetName();
data << name.c_str();
guild->BroadcastPacket(&data);
//sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)");
}
示例4: HandleGuildLeaderOpcode
void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
{
sLog.outDebug("WORLD: Received CMSG_GUILD_LEADER");
std::string name;
recvPacket >> name;
Player *oldLeader = GetPlayer();
if(!normalizePlayerName(name))
return;
Guild *guild = sObjectMgr.GetGuildById(oldLeader->GetGuildId());
if (!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (oldLeader->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
return;
}
uint64 newLeaderGUID;
MemberSlot* slot = guild->GetMemberSlot(name, newLeaderGUID);
if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, name, ERR_GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
guild->SetLeader(newLeaderGUID);
guild->ChangeRank(oldLeader->GetGUID(), GR_OFFICER);
guild->BroadcastEvent(GE_LEADER_CHANGED, 0, 2, oldLeader->GetName(), name, "");
}
示例5: HandleGuildAcceptOpcode
void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
{
Guild *guild;
Player *player = GetPlayer();
sLog.outDebug("WORLD: Received CMSG_GUILD_ACCEPT");
guild = sObjectMgr.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->GetLeader()))
return;
if(!guild->AddMember(GetPlayer()->GetGUID(),guild->GetLowestRank()))
return;
// Put record into guild log
guild->LogGuildEvent(GUILD_EVENT_LOG_JOIN_GUILD, GetPlayer()->GetGUIDLow(), 0, 0);
guild->BroadcastEvent(GE_JOINED, player->GetGUID(), 1, player->GetName(), "", "");
}
示例6: HandleGuildLeaderOpcode
void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
{
CHECK_PACKET_SIZE(recvPacket, 1);
std::string name;
Player *newLeader;
uint64 newLeaderGUID;
uint32 newLeaderGuild;
Player *oldLeader = GetPlayer();
Guild *guild;
//sLog.outDebug("WORLD: Received CMSG_GUILD_LEADER");
recvPacket >> name;
if(name.empty())
return;
normalizePlayerName(name);
//CharacterDatabase.escape_string(name); // prevent SQL injection - normal name don't must changed by this call
newLeader = ObjectAccessor::Instance().FindPlayerByName(name.c_str());
if(newLeader)
{
newLeaderGUID = newLeader->GetGUID();
newLeaderGuild = newLeader->GetGuildId();
}
else
{
newLeaderGUID = objmgr.GetPlayerGUIDByName(name);
newLeaderGuild = Player::GetGuildIdFromDB(newLeaderGUID);
}
guild = objmgr.GetGuildById(oldLeader->GetGuildId());
if(!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
else if(!newLeaderGUID)
{
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND);
return;
}
if(oldLeader->GetGuildId() != newLeaderGuild)
{
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
if(oldLeader->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
guild->SetLeader(newLeaderGUID);
guild->ChangeRank(oldLeader->GetGUID(), GR_OFFICER);
WorldPacket data(SMSG_GUILD_EVENT, (2+20)); // guess size
data << (uint8)GE_LEADER_CHANGED;
data << (uint8)2;
data << oldLeader->GetName();
data << name.c_str();
guild->BroadcastPacket(&data);
//sLog.outDebug("WORLD: Sent (SMSG_GUILD_EVENT)");
}
示例7: HandleGuildRemoveOpcode
void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
{
CHECK_PACKET_SIZE(recvPacket, 1);
std::string plName;
uint64 plGuid;
uint32 plGuildId;
Guild *guild;
Player *player;
//sLog.outDebug("WORLD: Received CMSG_GUILD_REMOVE");
recvPacket >> plName;
if(plName.empty())
return;
normalizePlayerName(plName);
//CharacterDatabase.escape_string(plName); // prevent SQL injection - normal name don't must changed by this call
player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str());
guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(player)
{
plGuid = player->GetGUID();
plGuildId = player->GetGuildId();
}
else
{
plGuid = objmgr.GetPlayerGUIDByName(plName);
plGuildId = Player::GetGuildIdFromDB(plGuid);
}
if(!guild)
{
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if(!plGuid)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND);
return;
}
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_REMOVE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
if(plGuid == guild->GetLeader())
{
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return;
}
if(GetPlayer()->GetGuildId() != plGuildId)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
guild->DelMember(plGuid);
WorldPacket data(SMSG_GUILD_EVENT, (2+20)); // guess size
data << (uint8)GE_REMOVED;
data << (uint8)2;
data << plName;
data << GetPlayer()->GetName();
guild->BroadcastPacket(&data);
}