本文整理汇总了C++中GetPlayerGUID函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPlayerGUID函数的具体用法?C++ GetPlayerGUID怎么用?C++ GetPlayerGUID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPlayerGUID函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPlayerGUID
void PlayerSocial::RemoveFromSocialList(ObjectGuid const& friendGuid, SocialFlag flag)
{
PlayerSocialMap::iterator itr = _playerSocialMap.find(friendGuid);
if (itr == _playerSocialMap.end())
return;
itr->second.Flags &= ~flag;
if (!itr->second.Flags)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_SOCIAL);
stmt->setUInt64(0, GetPlayerGUID().GetCounter());
stmt->setUInt64(1, friendGuid.GetCounter());
CharacterDatabase.Execute(stmt);
_playerSocialMap.erase(itr);
}
else
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_SOCIAL_FLAGS);
stmt->setUInt8(0, itr->second.Flags);
stmt->setUInt64(1, GetPlayerGUID().GetCounter());
stmt->setUInt64(2, friendGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
}
示例2: GetPlayerGUID
bool PlayerSocial::AddToSocialList(uint32 friend_guid, bool ignore) {
// check client limits
if (ignore) {
if (GetNumberOfSocialsWithFlag(
SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT)
return false;
} else {
if (GetNumberOfSocialsWithFlag(
SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT)
return false;
}
uint32 flag = SOCIAL_FLAG_FRIEND;
if (ignore)
flag = SOCIAL_FLAG_IGNORED;
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid);
if (itr != m_playerSocialMap.end()) {
CharacterDatabase.PExecute(
"UPDATE character_social SET flags = (flags | %u) WHERE guid = '%u' AND friend = '%u'",
flag, GetPlayerGUID(), friend_guid);
m_playerSocialMap[friend_guid].Flags |= flag;
} else {
CharacterDatabase.PExecute(
"INSERT INTO character_social (guid, friend, flags) VALUES ('%u', '%u', '%u')",
GetPlayerGUID(), friend_guid, flag);
FriendInfo fi;
fi.Flags |= flag;
m_playerSocialMap[friend_guid] = fi;
}
return true;
}
示例3: GetPlayerGUID
void PlayerSocial::RemoveFromSocialList(uint32 friendGuid, bool ignore)
{
PlayerSocialMap::iterator itr = m_playerSocialMap.find(friendGuid);
if (itr == m_playerSocialMap.end()) // not exist
return;
uint8 flag = SOCIAL_FLAG_FRIEND;
if (ignore)
flag = SOCIAL_FLAG_IGNORED;
itr->second.Flags &= ~flag;
if (itr->second.Flags == 0)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_SOCIAL);
stmt->setUInt32(0, GetPlayerGUID());
stmt->setUInt32(1, friendGuid);
CharacterDatabase.Execute(stmt);
m_playerSocialMap.erase(itr);
}
else
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_REM_CHARACTER_SOCIAL_FLAGS);
stmt->setUInt8(0, flag);
stmt->setUInt32(1, GetPlayerGUID());
stmt->setUInt32(2, friendGuid);
CharacterDatabase.Execute(stmt);
}
}
示例4: GetPlayerGUID
bool PlayerSocial::AddToSocialList(uint32 friendGuid, bool ignore)
{
// check client limits
if (ignore)
{
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT)
return false;
}
else
{
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT)
return false;
}
uint8 flag = SOCIAL_FLAG_FRIEND;
if (ignore)
flag = SOCIAL_FLAG_IGNORED;
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friendGuid);
if (itr != m_playerSocialMap.end())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_CHARACTER_SOCIAL_FLAGS);
stmt->setUInt8(0, flag);
stmt->setUInt32(1, GetPlayerGUID());
stmt->setUInt32(2, friendGuid);
CharacterDatabase.Execute(stmt);
m_playerSocialMap[friendGuid].Flags |= flag;
}
else
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_SOCIAL);
stmt->setUInt32(0, GetPlayerGUID());
stmt->setUInt32(1, friendGuid);
stmt->setUInt8(2, flag);
CharacterDatabase.Execute(stmt);
FriendInfo fi;
fi.Flags |= flag;
m_playerSocialMap[friendGuid] = fi;
}
return true;
}
示例5: SendSocialList
void PlayerSocial::SendSocialList()
{
Player *plr = objmgr.GetPlayer(GetPlayerGUID());
if(!plr)
return;
uint32 size = m_playerSocialMap.size();
WorldPacket data(SMSG_CONTACT_LIST, (4+4+size*25)); // just can guess size
data << uint32(7); // unk flag (0x1, 0x2, 0x4), 0x7 if it include ignore list
data << uint32(size); // friends count
for(PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)
{
sSocialMgr.GetFriendInfo(plr, itr->first, itr->second);
data << uint64(itr->first); // player guid
data << uint32(itr->second.Flags); // player flag (0x1-friend?, 0x2-ignored?, 0x4-muted?)
data << itr->second.Note; // string note
if(itr->second.Flags & SOCIAL_FLAG_FRIEND) // if IsFriend()
{
data << uint8(itr->second.Status); // online/offline/etc?
if(itr->second.Status) // if online
{
data << uint32(itr->second.Area); // player area
data << uint32(itr->second.Level); // player level
data << uint32(itr->second.Class); // player class
}
}
}
plr->GetSession()->SendPacket(&data);
sLog.outDebug("WORLD: Sent SMSG_CONTACT_LIST");
}
示例6: SendFriendList
void PlayerSocial::SendFriendList()
{
Player *plr = sObjectMgr.GetPlayer(GetPlayerGUID());
if(!plr)
return;
uint32 size = GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND);
WorldPacket data(SMSG_FRIEND_LIST, (1+size*25)); // just can guess size
data << uint8(size); // friends count
for(PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)
{
if(itr->second.Flags & SOCIAL_FLAG_FRIEND) // if IsFriend()
{
sSocialMgr.GetFriendInfo(plr, itr->first, itr->second);
data << uint64(itr->first); // player guid
data << uint8(itr->second.Status); // online/offline/etc?
if(itr->second.Status) // if online
{
data << uint32(itr->second.Area); // player area
data << uint32(itr->second.Level); // player level
data << uint32(itr->second.Class); // player class
}
}
}
plr->GetSession()->SendPacket(&data);
sLog.outDebug("WORLD: Sent SMSG_FRIEND_LIST");
}
示例7: utf8truncate
void PlayerSocial::SetFriendNote(uint32 friend_guid, std::string note) {
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid);
if (itr == m_playerSocialMap.end()) // not exist
return;
utf8truncate(note, 48); // DB and client size limitation
CharacterDatabase.EscapeString(note);
CharacterDatabase.PExecute(
"UPDATE character_social SET note = '%s' WHERE guid = '%u' AND friend = '%u'",
note.c_str(), GetPlayerGUID(), friend_guid);
m_playerSocialMap[friend_guid].Note = note;
}
示例8: utf8truncate
void PlayerSocial::SetFriendNote(ObjectGuid const& friendGuid, std::string const& note)
{
PlayerSocialMap::iterator itr = _playerSocialMap.find(friendGuid);
if (itr == _playerSocialMap.end()) // not exist
return;
itr->second.Note = note;
utf8truncate(itr->second.Note, 48); // DB and client size limitation
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_SOCIAL_NOTE);
stmt->setString(0, itr->second.Note);
stmt->setUInt64(1, GetPlayerGUID().GetCounter());
stmt->setUInt64(2, friendGuid.GetCounter());
CharacterDatabase.Execute(stmt);
}
示例9: utf8truncate
void PlayerSocial::SetFriendNote(uint32 friendGuid, std::string note)
{
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friendGuid);
if (itr == m_playerSocialMap.end()) // not exist
return;
utf8truncate(note, 48); // DB and client size limitation
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_SOCIAL_NOTE);
stmt->setString(0, note);
stmt->setUInt32(1, GetPlayerGUID());
stmt->setUInt32(2, friendGuid);
CharacterDatabase.Execute(stmt);
m_playerSocialMap[friendGuid].Note = note;
}
示例10: SendIgnoreList
void PlayerSocial::SendIgnoreList()
{
Player *plr = sObjectMgr.GetPlayer(GetPlayerGUID());
if(!plr)
return;
uint32 size = GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED);
WorldPacket data(SMSG_IGNORE_LIST, (1+size*8)); // just can guess size
data << uint8(size); // friends count
for(PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)
{
if(itr->second.Flags & SOCIAL_FLAG_IGNORED)
{
data << uint64(itr->first); // player guid
}
}
plr->GetSession()->SendPacket(&data);
sLog.outDebug("WORLD: Sent SMSG_IGNORE_LIST");
}
示例11: GetPlayer
void TowerDefenseInstanceScript::TowerDefenseMapInstanceScript::HandleEventComplete(TDEventCompleteType completeType)
{
Player *player = GetPlayer();
if(!player)
return;
if(!completeType)
return;
switch(completeType)
{
case TD_EVENT_COMPLETE_UNFINISHED:
{
if(IsAwardingFledPlayers()){
UpdatePlayerStats(GetPlayerGUID(), TD_PLAYER_STAT_CURRENT_RESOURCES, GetResources());
SendMailToPlayer(NULL, GetPlayerGUID(), TD_SYSTEM_MSG_MAIL_BODY_EVENT_UNFINISHED, GetResources());
RecordLog("TowerDefense: Player: [%s] has received: [%u] resources due to an unfinished Event Id: [%u].", player->GetName(), GetResources(), GetEventId());
}else{
SendMailToPlayer(NULL, GetPlayerGUID(), TD_SYSTEM_MSG_MAIL_BODY_EVENT_UNFINISHED_FLED, GetResources(), GetCurrentWaveId());
RecordLog("TowerDefense: Player: [%s] was informed that he lost all his unfinished Event Id: [%u] rewards.", player->GetName(), GetResources(), GetEventId());
}
UpdatePlayerStats(player->GetGUIDLow(), TD_PLAYER_STAT_EVENTS_UNFINISHED, 1);
}break;
case TD_EVENT_COMPLETE_QUIT:
{
if(player->GetSession()->isLogingOut()){
SendMessageToPlayer(TD_SYSTEM_MSG_LOGGING_OUT);
return;
}
if(GetCurrentWaveId() < GetQuitAfterWave()){
uint32 remaining = GetQuitAfterWave() - GetCurrentWaveId();
SendMessageToPlayer(TD_SYSTEM_MSG_MORE_WAVES, remaining);
return;
}
SendMessageToPlayer(TD_SYSTEM_MSG_QUIT_EVENT, GetResources(), GetCurrentWaveId());
UpdatePlayerStats(GetPlayerGUID(), TD_PLAYER_STAT_CURRENT_RESOURCES, GetResources());
UpdatePlayerStats(player->GetGUIDLow(), TD_PLAYER_STAT_EVENTS_LOST, 1);
RecordLog("TowerDefense: Player: [%s] has received: [%u] resources after leaving Event Id: [%u].", player->GetName(), GetResources(), GetEventId());
}break;
case TD_EVENT_COMPLETE_LOST:
{
player->PlayDirectSound(TD_ENDEVENT_MUSIC,_player);
SendMessageToPlayer(TD_SYSTEM_MSG_LOST_EVENT, GetResources(), GetCurrentWaveId());
UpdatePlayerStats(player->GetGUIDLow(), TD_PLAYER_STAT_EVENTS_LOST, 1);
RecordLog("TowerDefense: Player: [%s] was informed that he lost all his Event Id: [%u] rewards.", player->GetName(), GetResources(), GetEventId());
}break;
case TD_EVENT_COMPLETE_WON:
{
SendMessageToPlayer(TD_SYSTEM_MSG_WON_EVENT, GetResources());
UpdatePlayerStats(GetPlayerGUID(), TD_PLAYER_STAT_CURRENT_RESOURCES, GetResources());
UpdatePlayerStats(player->GetGUIDLow(), TD_PLAYER_STAT_EVENTS_WON, 1);
RecordLog("TowerDefense: Player: [%s] has won [%u] resources after completing Event Id: [%u].", player->GetName(), GetResources(), GetEventId());
}break;
}
player->DestroyItemCount(GetItemEntry(),1,true); // destroy the item from the player
player->TeleportTo(1, -3673.392090, -4384.723145, 10.026433, 3.879712); // Teleport to a Neutral Mall
player->RemoveAllAuras(); // remove all auras set by event
player->RemoveAllAttackers(); // remove all attackers
SetFinished(true); // finish the event
SaveEventData(); // save event information
RecordLog("TowerDefense: Player: [%s] has completed Event Id: [%u] and his event data was saved and he was teleported.", player->GetName(), GetEventId());
DeleteEventData();
}
示例12: GetFinished
void TowerDefenseInstanceScript::TowerDefenseMapInstanceScript::SaveEventData()
{
if(QueryResult queryResult = CharacterDatabase.PQuery("SELECT * FROM custom_td_events WHERE Id = '%u'", GetEventId())){
CharacterDatabase.PExecute("UPDATE custom_td_events SET eventFinished = '%u'", GetFinished());
RecordLog("TowerDefense: Updated Event Id: [%u], it is now set to finished!",GetEventId());
}
else{
CharacterDatabase.PExecute("INSERT INTO custom_td_events VALUES ('%u', '%u', '%u', '%u', '%u', NOW(), '%u')", GetEventId(), GetPlayerGUID(), GetCurrentWaveId(), GetResources(),GetBaseHealth(), GetFinished());
RecordLog("TowerDefense: Inserted Event Id: [%u] to the database.", GetEventId());
}
}