本文整理汇总了C++中GetPlayerInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPlayerInfo函数的具体用法?C++ GetPlayerInfo怎么用?C++ GetPlayerInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPlayerInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TC_LOG_DEBUG
void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
{
TC_LOG_DEBUG("lfg", "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str());
uint64 guid = GetPlayer()->GetGUID();
lfg::LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid);
if (GetPlayer()->GetGroup())
{
SendLfgUpdateParty(updateData);
updateData.dungeons.clear();
SendLfgUpdatePlayer(updateData);
}
else
{
SendLfgUpdatePlayer(updateData);
updateData.dungeons.clear();
SendLfgUpdateParty(updateData);
}
}
示例2: TC_LOG_DEBUG
void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
{
uint32 channelId;
uint32 channelLength, passLength;
std::string channelName, password;
recvPacket >> channelId;
uint8 unknown1 = recvPacket.ReadBit(); // unknowns
uint8 unknown2 = recvPacket.ReadBit();
channelLength = recvPacket.ReadBits(8);
passLength = recvPacket.ReadBits(8);
channelName = recvPacket.ReadString(channelLength);
password = recvPacket.ReadString(passLength);
TC_LOG_DEBUG("chat.system", "CMSG_JOIN_CHANNEL %s Channel: %u, unk1: %u, unk2: %u, channel: %s, password: %s",
GetPlayerInfo().c_str(), channelId, unknown1, unknown2, channelName.c_str(), password.c_str());
if (channelId)
{
ChatChannelsEntry const* channel = sChatChannelsStore.LookupEntry(channelId);
if (!channel)
return;
AreaTableEntry const* zone = GetAreaEntryByAreaID(GetPlayer()->GetZoneId());
if (!zone || !GetPlayer()->CanJoinConstantChannelInZone(channel, zone))
return;
}
if (channelName.empty())
return;
if (isdigit(channelName[0]))
return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
{
cMgr->setTeam(GetPlayer()->GetTeam());
if (Channel* channel = cMgr->GetJoinChannel(channelName, channelId))
channel->JoinChannel(GetPlayer(), password);
}
}
示例3: GetPlayerInfo
int CPlayer::GetLifeState()
{
if (lifestate_offset == -1)
{
if (!g_pGameConf->GetOffset("m_lifeState", &lifestate_offset))
{
lifestate_offset = -2;
}
}
if (lifestate_offset < 0)
{
IPlayerInfo *info = GetPlayerInfo();
if (info == NULL)
{
return PLAYER_LIFE_UNKNOWN;
}
return info->IsDead() ? PLAYER_LIFE_DEAD : PLAYER_LIFE_ALIVE;
}
if (m_pEdict == NULL)
{
return PLAYER_LIFE_UNKNOWN;
}
CBaseEntity *pEntity;
IServerUnknown *pUnknown = m_pEdict->GetUnknown();
if (pUnknown == NULL || (pEntity = pUnknown->GetBaseEntity()) == NULL)
{
return PLAYER_LIFE_UNKNOWN;
}
if (*((uint8_t *)pEntity + lifestate_offset) == LIFE_ALIVE)
{
return PLAYER_LIFE_ALIVE;
}
else
{
return PLAYER_LIFE_DEAD;
}
}
示例4: TC_LOG_DEBUG
void WorldSession::SendLfgQueueStatus(lfg::LfgQueueStatusData const& queueData)
{
TC_LOG_DEBUG("lfg", "SMSG_LFG_QUEUE_STATUS %s dungeon: %u, waitTime: %d, "
"avgWaitTime: %d, waitTimeTanks: %d, waitTimeHealer: %d, waitTimeDps: %d, "
"queuedTime: %u, tanks: %u, healers: %u, dps: %u",
GetPlayerInfo().c_str(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg,
queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps,
queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps);
ObjectGuid RequesterGuid = _player->GetGUID128();
WorldPacket data(SMSG_LFG_QUEUE_STATUS, 500); // We guess size
sLFGMgr->BuildRideTicket(data, RequesterGuid, 0, 0, 0);
data << uint32(queueData.subType);
data << uint32(queueData.reason);
for (auto i = 0; i < QUEUE_NEEDS; i++)
data << uint32(queueData.needs);
data << uint32(queueData.slotsCount);
data << uint32(queueData.requestedRoles);
data << uint32(queueData.SuspendedPlayersCount);
for (uint32 i = 0; i < queueData.slotsCount; i++)
data << uint32(queueData.slots);
for (uint32 i = 0; i < queueData.SuspendedPlayersCount; i++)
data << ObjectGuid(queueData.suspendedPlayers);
data.WriteBit(queueData.IsParty);
data.WriteBit(queueData.Notify);
data.WriteBit(queueData.Joined);
data.WriteBit(queueData.LfgJoined);
data.WriteBit(queueData.Queued);
data.WriteBits(0, 8);
data.WriteString(queueData.Comment);
SendPacket(&data);
}
示例5: GetPlayerInfo
void WorldSession::HandleChannelBan(WorldPacket& recvPacket)
{
uint32 channelLength, nameLength;
std::string channelName, targetName;
channelLength = recvPacket.ReadBits(8);
nameLength = recvPacket.ReadBits(7);
targetName = recvPacket.ReadString(nameLength);
channelName = recvPacket.ReadString(channelLength);
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_BAN %s Channel: %s, Target: %s",
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
if (!normalizePlayerName(targetName))
return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
channel->Ban(GetPlayer(), targetName);
}
示例6: TC_LOG_DEBUG
// Called when clicking on Guild bank gameobject
void WorldSession::HandleGuildBankerActivate(WorldPacket& recvPacket)
{
ObjectGuid guid;
bool sendAllSlots;
recvPacket >> guid >> sendAllSlots;
TC_LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: [%s] AllSlots: %u"
, GetPlayerInfo().c_str(), guid.ToString().c_str(), sendAllSlots);
GameObject const* const go = GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK);
if (!go)
return;
Guild* const guild = GetPlayer()->GetGuild();
if (!guild)
{
Guild::SendCommandResult(this, GUILD_COMMAND_VIEW_TAB, ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
guild->SendBankList(this, 0, true, true);
}
示例7: defined
void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str());
#endif
uint64 guid = GetPlayer()->GetGUID();
lfg::LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid);
if (GetPlayer()->GetGroup())
{
SendLfgUpdateParty(updateData);
updateData.dungeons.clear();
SendLfgUpdatePlayer(updateData);
}
else
{
SendLfgUpdatePlayer(updateData);
updateData.dungeons.clear();
SendLfgUpdateParty(updateData);
}
}
示例8: GetPlayer
void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
{
ObjectGuid guid = GetPlayer()->GetGUID();
lfg::LfgAnswer playerVote = boot.votes.find(guid)->second;
uint8 votesNum = 0;
uint8 agreeNum = 0;
uint32 secsleft = uint8((boot.cancelTime - time(NULL)) / 1000);
for (auto it : boot.votes)
{
if (it.second != lfg::LFG_ANSWER_PENDING)
{
++votesNum;
if (it.second == lfg::LFG_ANSWER_AGREE)
++agreeNum;
}
}
TC_LOG_DEBUG("lfg", "SMSG_LFG_BOOT_PROPOSAL_UPDATE %s inProgress: %u - "
"didVote: %u - agree: %u - victim: %u votes: %u - agrees: %u - left: %u - "
"needed: %u - reason %s",
GetPlayerInfo().c_str(), uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING),
uint8(playerVote == lfg::LFG_ANSWER_AGREE), GUID_LOPART(boot.victim), votesNum, agreeNum,
secsleft, lfg::LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length());
data.WriteBit(boot.inProgress); // VoteInProgress
data.WriteBit(boot.VotePassed); // VotePassed
data.WriteBit(boot.MyVoteComplete); // MyVoteComplete
data.WriteBit(boot.MyVote); // MyVote
data.WriteBits(0, 8); // ReasonLen
data << ObjectGuid(boot.victim); // VictimGUID
data << uint32(boot.TotalVotes); // TotalVotes
data << uint32(boot.BootVotes); // BootVotes
data << uint32(boot.TimeLeft); // TimeLeft
data << uint32(lfg::LFG_GROUP_KICK_VOTES_NEEDED); // NeededVotes
data << boot.reason.c_str(); // Reason
SendPacket(&data);
}
示例9: TC_LOG_DEBUG
void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket)
{
uint32 unk;
std::string channelName;
recvPacket >> unk >> channelName;
if (!ChatHandler(this).isValidChatMessage(channelName.c_str()))
return;
TC_LOG_DEBUG("chat.system", "CMSG_LEAVE_CHANNEL %s Channel: %s, unk1: %u",
GetPlayerInfo().c_str(), channelName.c_str(), unk);
if (channelName.empty())
return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
{
if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
channel->LeaveChannel(GetPlayer(), true);
cMgr->LeftChannel(channelName);
}
}
示例10: GetPlayerInfo
// Called when clicking on Guild bank gameobject
void WorldSession::HandleGuildBankerActivate(WorldPacket& recvPacket)
{
uint64 guid;
bool sendAllSlots;
recvPacket >> guid >> sendAllSlots;
sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u"
, GetPlayerInfo().c_str(), guid, sendAllSlots);
GameObject const* const go = GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK);
if (!go)
return;
Guild* const guild = GetPlayer()->GetGuild();
if (!guild)
{
Guild::SendCommandResult(this, GUILD_COMMAND_VIEW_TAB, ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
guild->SendBankList(this, 0, true, true);
}
示例11: uint8
void WorldSession::SendLfgUpdatePlayer(lfg::LfgUpdateData const& updateData)
{
bool queued = false;
uint8 size = uint8(updateData.dungeons.size());
switch (updateData.updateType)
{
case lfg::LFG_UPDATETYPE_JOIN_QUEUE:
case lfg::LFG_UPDATETYPE_ADDED_TO_QUEUE:
queued = true;
break;
case lfg::LFG_UPDATETYPE_UPDATE_STATUS:
queued = updateData.state == lfg::LFG_STATE_QUEUED;
break;
default:
break;
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u",
GetPlayerInfo().c_str(), updateData.updateType);
#endif
WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
data << uint8(updateData.updateType); // Lfg Update type
data << uint8(size > 0); // Extra info
if (size)
{
data << uint8(queued); // Join the queue
data << uint8(0); // unk - Always 0
data << uint8(0); // unk - Always 0
data << uint8(size);
for (lfg::LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
data << uint32(*it);
data << updateData.comment;
}
SendPacket(&data);
}
示例12: TC_LOG_DEBUG
void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
{
uint32 rankId;
recvPacket >> rankId;
uint32 rights;
recvPacket >> rights;
std::string rankName;
recvPacket >> rankName;
uint32 money;
recvPacket >> money;
TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_RANK [%s]: Rank: %s (%u)", GetPlayerInfo().c_str(), rankName.c_str(), rankId);
Guild* guild = GetPlayer()->GetGuild();
if (!guild)
{
recvPacket.rpos(recvPacket.wpos());
return;
}
GuildBankRightsAndSlotsVec rightsAndSlots(GUILD_BANK_MAX_TABS);
for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
{
uint32 bankRights;
uint32 slots;
recvPacket >> bankRights;
recvPacket >> slots;
rightsAndSlots[tabId] = GuildBankRightsAndSlots(tabId, bankRights, slots);
}
guild->HandleSetRankInfo(this, rankId, rankName, rights, money, rightsAndSlots);
}
示例13: GetPlayer
void WorldSession::HandleLfgLeaveOpcode(WorldPacket& recvData)
{
ObjectGuid leaveGuid;
Group* group = GetPlayer()->GetGroup();
uint64 guid = GetPlayer()->GetGUID();
uint64 gguid = group ? group->GetGUID() : guid;
recvData.read_skip<uint32>(); // Always 8
recvData.read_skip<uint32>(); // Join date
recvData.read_skip<uint32>(); // Always 3
recvData.read_skip<uint32>(); // Queue Id
recvData.ReadGuidMask(leaveGuid, 0, 1, 6, 7, 3, 5, 2, 4);
recvData.ReadGuidBytes(leaveGuid, 1, 5, 6, 7, 4, 2, 3, 0);
TC_LOG_DEBUG("lfg", "CMSG_LFG_LEAVE %s in group: %u sent guid " UI64FMTD ".",
GetPlayerInfo().c_str(), group ? 1 : 0, uint64(leaveGuid));
// Check cheating - only leader can leave the queue
if (!group || group->GetLeaderGUID() == guid)
sLFGMgr->LeaveLfg(gguid);
}
示例14: GetPlayer
void WorldSession::HandleLfgLeaveOpcode(WorldPacket& recvData)
{
ObjectGuid leaveGuid;
Group* group = GetPlayer()->GetGroup();
ObjectGuid guid = GetPlayer()->GetGUID();
ObjectGuid gguid = group ? group->GetGUID() : guid;
recvData.read_skip<uint32>(); // Always 8
recvData.read_skip<uint32>(); // Join date
recvData.read_skip<uint32>(); // Always 3
recvData.read_skip<uint32>(); // Queue Id
leaveGuid[4] = recvData.ReadBit();
leaveGuid[5] = recvData.ReadBit();
leaveGuid[0] = recvData.ReadBit();
leaveGuid[6] = recvData.ReadBit();
leaveGuid[2] = recvData.ReadBit();
leaveGuid[7] = recvData.ReadBit();
leaveGuid[1] = recvData.ReadBit();
leaveGuid[3] = recvData.ReadBit();
recvData.ReadByteSeq(leaveGuid[7]);
recvData.ReadByteSeq(leaveGuid[4]);
recvData.ReadByteSeq(leaveGuid[3]);
recvData.ReadByteSeq(leaveGuid[2]);
recvData.ReadByteSeq(leaveGuid[6]);
recvData.ReadByteSeq(leaveGuid[0]);
recvData.ReadByteSeq(leaveGuid[1]);
recvData.ReadByteSeq(leaveGuid[5]);
TC_LOG_DEBUG("lfg", "CMSG_LFG_LEAVE %s in group: %u sent guid " UI64FMTD ".",
GetPlayerInfo().c_str(), group ? 1 : 0, uint64(leaveGuid));
// Check cheating - only leader can leave the queue
if (!group || group->GetLeaderGUID() == guid)
sLFGMgr->LeaveLfg(gguid);
}
示例15: GetPlayerInfo
void World::CollisionCheck()
{
auto p = GetPlayerInfo();
auto b = GetBallInfo();
for (size_t i = 0; i < b.size(); i++)
{
for (size_t j = i; j < b.size(); j++)
{
}
for (size_t j = 0; j < p.size(); j++)
{
}
if (v2fMagnitude(b[i].Position) > 200)
{
balls[i].pos[1] = -balls[i].pos[1];
}
}
//for (size_t i = 0; i < balls.size(); i++)
//{
// for (size_t j = i + 1; j < balls.size(); j++)
// {
// Collision(balls[i], balls[j]);
// }
// for (size_t j = 0; j < players.size(); j++)
// {
// Collision(balls[i], players[j]);
// }
// Collision(balls[i]);
//}
}