本文整理汇总了C++中ObjectGuid::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectGuid::Set方法的具体用法?C++ ObjectGuid::Set怎么用?C++ ObjectGuid::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectGuid
的用法示例。
在下文中一共展示了ObjectGuid::Set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleLoginBotCommand
bool ChatHandler::HandleLoginBotCommand(char* args)
{
uint32 botId;
if (!ExtractUInt32Base(&args, botId, 10))
{
SendSysMessage("Please provide a valid account id.");
return true;
}
uint32 characterId;
if (!ExtractUInt32Base(&args, characterId, 10))
{
SendSysMessage("Please provide a valid character guid.");
return true;
}
ObjectGuid characterGuid;
characterGuid.Set(characterId);
if (sPlayerBotMgr.LoginBot(botId, characterGuid))
{
PSendSysMessage("Bot %u successfully logged in.", botId);
}
else
{
PSendSysMessage("Bot %u failed to log in.", botId);
}
return true;
}
示例2: HandlePlayerbotCommand
bool ChatHandler::HandlePlayerbotCommand(char* args)
{
if (sWorld.getConfig(CONFIG_BOOL_PLAYERBOT_DISABLE))
{
PSendSysMessage("|cffff0000Playerbot system is currently disabled!");
SetSentErrorMessage(true);
return false;
}
if (!m_session)
{
PSendSysMessage("|cffff0000You may only add bots from an active session");
SetSentErrorMessage(true);
return false;
}
if (!*args)
{
PSendSysMessage("|cffff0000usage: add PLAYERNAME or remove PLAYERNAME");
SetSentErrorMessage(true);
return false;
}
char *cmd = strtok ((char *) args, " ");
char *charname = strtok (NULL, " ");
if (!cmd || !charname)
{
PSendSysMessage("|cffff0000usage: add PLAYERNAME or remove PLAYERNAME");
SetSentErrorMessage(true);
return false;
}
std::string cmdStr = cmd;
std::string charnameStr = charname;
if (!normalizePlayerName(charnameStr))
return false;
ObjectGuid guid = sAccountMgr.GetPlayerGuidByName(charnameStr.c_str());
if (guid == ObjectGuid() || (guid == m_session->GetPlayer()->GetObjectGuid()))
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
uint32 accountId = sAccountMgr.GetPlayerAccountIdByGUID(guid);
if (accountId != m_session->GetAccountId())
{
if (!sWorld.getConfig(CONFIG_BOOL_PLAYERBOT_SHAREDBOTS))
{
PSendSysMessage("|cffff0000You may only add bots from the same account.");
SetSentErrorMessage(true);
return false;
}
QueryResult *resultsocial = CharacterDatabase.PQuery("SELECT COUNT(*) FROM character_social s, characters c WHERE s.guid=c.guid AND c.online = 0 AND flags & 1 AND s.note " _LIKE_ " " _CONCAT3_ ("'%%'","'shared'","'%%'")" AND s.friend = '%u' AND s.guid = '%llu'", m_session->GetPlayer()->GetGUIDLow(), guid.GetRawValue());
if (resultsocial)
{
Field *fields = resultsocial->Fetch();
if (fields[0].GetUInt32() == 0 && (cmdStr == "add" || cmdStr == "login"))
{
PSendSysMessage("|cffff0000You may only add bots from the same account or a friend's character that contains 'shared' in the notes on their friend list while not online.");
SetSentErrorMessage(true);
delete resultsocial;
return false;
}
}
delete resultsocial;
}
// create the playerbot manager if it doesn't already exist
PlayerbotMgr* mgr = m_session->GetPlayer()->GetPlayerbotMgr();
if (!mgr)
{
mgr = new PlayerbotMgr(m_session->GetPlayer());
m_session->GetPlayer()->SetPlayerbotMgr(mgr);
}
if (!(m_session->GetSecurity() > SEC_PLAYER))
{
int maxnum = sWorld.getConfig(CONFIG_UINT32_PLAYERBOT_MAXBOTS);
int charcount = m_session->GetPlayer()->GetPlayerbotMgr()->GetBotCount();
if (charcount >= maxnum && (cmdStr == "add" || cmdStr == "login"))
{
PSendSysMessage("|cffff0000You cannot summon anymore bots.(Current Max: |cffffffff%u)",maxnum);
SetSentErrorMessage(true);
return false;
}
}
QueryResult *resultlvl = CharacterDatabase.PQuery("SELECT level, name, race FROM characters WHERE guid = '%u'", guid.GetCounter());
if (resultlvl)
{
Field *fields = resultlvl->Fetch();
int charlvl = fields[0].GetUInt32();
uint32 race = fields[2].GetUInt32();
Team master_team = m_session->GetPlayer()->GetTeam();
Team bot_team = HORDE;
if (RACEMASK_ALLIANCE & (1 << (race-1)))
//.........这里部分代码省略.........
示例3: HandlePlayerbotCommand
bool ChatHandler::HandlePlayerbotCommand(char* args)
{
if (sWorld.getConfig(CONFIG_BOOL_PLAYERBOT_DISABLE))
{
PSendSysMessage("|cffff0000Playerbot system is currently disabled!");
SetSentErrorMessage(true);
return false;
}
if (!m_session)
{
PSendSysMessage("|cffff0000You may only add bots from an active session");
SetSentErrorMessage(true);
return false;
}
if (!*args)
{
PSendSysMessage("|cffff0000usage: add PLAYERNAME or remove PLAYERNAME");
SetSentErrorMessage(true);
return false;
}
char *cmd = strtok ((char *) args, " ");
char *charname = strtok (NULL, " ");
if (!cmd || !charname)
{
PSendSysMessage("|cffff0000usage: add PLAYERNAME or remove PLAYERNAME");
SetSentErrorMessage(true);
return false;
}
std::string cmdStr = cmd;
std::string charnameStr = charname;
if (!normalizePlayerName(charnameStr))
return false;
uint64 guid = sObjectMgr.GetPlayerGUIDByName(charnameStr.c_str());
if (guid == 0 || (guid == m_session->GetPlayer()->GetGUID()))
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
uint32 accountId = sObjectMgr.GetPlayerAccountIdByGUID(guid);
if (accountId != m_session->GetAccountId())
{
PSendSysMessage("|cffff0000You may only add bots from the same account.");
SetSentErrorMessage(true);
return false;
}
// create the playerbot manager if it doesn't already exist
PlayerbotMgr* mgr = m_session->GetPlayer()->GetPlayerbotMgr();
if (!mgr)
{
mgr = new PlayerbotMgr(m_session->GetPlayer());
m_session->GetPlayer()->SetPlayerbotMgr(mgr);
}
QueryResult *resultchar = CharacterDatabase.PQuery("SELECT COUNT(*) FROM characters WHERE online = '1' AND account = '%u'", m_session->GetAccountId());
if (resultchar)
{
Field *fields = resultchar->Fetch();
int acctcharcount = fields[0].GetUInt32();
int maxnum = sWorld.getConfig(CONFIG_UINT32_PLAYERBOT_MAXBOTS);
if (!(m_session->GetSecurity() > SEC_PLAYER))
if (acctcharcount > maxnum && (cmdStr == "add" || cmdStr == "login"))
{
PSendSysMessage("|cffff0000You cannot summon anymore bots.(Current Max: |cffffffff%u)", maxnum);
SetSentErrorMessage(true);
delete resultchar;
return false;
}
}
delete resultchar;
QueryResult *resultlvl = CharacterDatabase.PQuery("SELECT level,name FROM characters WHERE guid = '%lu'", guid);
if (resultlvl)
{
Field *fields = resultlvl->Fetch();
int charlvl = fields[0].GetUInt32();
int maxlvl = sWorld.getConfig(CONFIG_UINT32_PLAYERBOT_RESTRICTLEVEL);
if (!(m_session->GetSecurity() > SEC_PLAYER))
if (charlvl > maxlvl)
{
PSendSysMessage("|cffff0000You cannot summon |cffffffff[%s]|cffff0000, it's level is too high.(Current Max:lvl |cffffffff%u)", fields[1].GetString(), maxlvl);
SetSentErrorMessage(true);
delete resultlvl;
return false;
}
}
delete resultlvl;
// end of gmconfig patch
if (cmdStr == "add" || cmdStr == "login")
{
if (mgr->GetPlayerBot(guid))
{
//.........这里部分代码省略.........