• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetPlayerGUID函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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);
    }
}
开发者ID:Abrek,项目名称:My-WoDCore-6.x.x,代码行数:30,代码来源:SocialMgr.cpp


示例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;
}
开发者ID:dsstest,项目名称:ArkCORE,代码行数:32,代码来源:SocialMgr.cpp


示例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);
    }
}
开发者ID:Matt-One,项目名称:azerothcore-wotlk,代码行数:33,代码来源:SocialMgr.cpp


示例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;
}
开发者ID:cooler-SAI,项目名称:PandaFire,代码行数:48,代码来源:SocialMgr.cpp


示例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");
}
开发者ID:Attractivee,项目名称:dfteam,代码行数:34,代码来源:SocialMgr.cpp


示例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");
}
开发者ID:dythzer,项目名称:mangoszero,代码行数:31,代码来源:SocialMgr.cpp


示例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;
}
开发者ID:dsstest,项目名称:ArkCORE,代码行数:13,代码来源:SocialMgr.cpp


示例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);
}
开发者ID:Abrek,项目名称:My-WoDCore-6.x.x,代码行数:17,代码来源:SocialMgr.cpp


示例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;
}
开发者ID:Matt-One,项目名称:azerothcore-wotlk,代码行数:18,代码来源:SocialMgr.cpp


示例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");
}
开发者ID:dythzer,项目名称:mangoszero,代码行数:22,代码来源:SocialMgr.cpp


示例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();
}
开发者ID:Adeer,项目名称:Patchs,代码行数:62,代码来源:TowerDefenseInstance.cpp


示例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());
    }
}
开发者ID:Adeer,项目名称:Patchs,代码行数:11,代码来源:TowerDefenseInstance.cpp



注:本文中的GetPlayerGUID函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetPlayerInMap函数代码示例发布时间:2022-05-30
下一篇:
C++ GetPlayerForEscort函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap