本文整理汇总了C++中WorldSession::GetMangosString方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldSession::GetMangosString方法的具体用法?C++ WorldSession::GetMangosString怎么用?C++ WorldSession::GetMangosString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldSession
的用法示例。
在下文中一共展示了WorldSession::GetMangosString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendNameQueryOpcodeFromDBCallBack
void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId)
{
if(!result)
return;
WorldSession * session = sWorld.FindSession(accountId);
if(!session)
{
delete result;
return;
}
Field *fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
std::string name = fields[1].GetCppString();
uint8 pRace = 0, pGender = 0, pClass = 0;
if(name == "")
name = session->GetMangosString(LANG_NON_EXIST_CHARACTER);
else
{
pRace = fields[2].GetUInt8();
pGender = fields[3].GetUInt8();
pClass = fields[4].GetUInt8();
}
// guess size
WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+1+10) );
data.appendPackGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
data << uint8(0); // added in 3.1
data << name;
data << uint8(0); // realm name for cross realm BG usage
data << uint8(pRace); // race
data << uint8(pGender); // gender
data << uint8(pClass); // class
// if the first declined name field (5) is empty, the rest must be too
if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) && fields[5].GetCppString() != "")
{
data << uint8(1); // is declined
for(int i = 5; i < MAX_DECLINED_NAME_CASES+5; ++i)
data << fields[i].GetCppString();
}
else
data << uint8(0); // is not declined
session->SendPacket( &data );
delete result;
}
示例2: SendNameQueryOpcodeFromDBCallBack
void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult* result, uint32 accountId)
{
if (!result)
{
return;
}
WorldSession* session = sWorld.FindSession(accountId);
if (!session)
{
delete result;
return;
}
Field* fields = result->Fetch();
uint32 lowguid = fields[0].GetUInt32();
std::string name = fields[1].GetCppString();
uint8 pRace = 0, pGender = 0, pClass = 0;
if (name == "")
{
name = session->GetMangosString(LANG_NON_EXIST_CHARACTER);
}
else
{
pRace = fields[2].GetUInt8();
pGender = fields[3].GetUInt8();
pClass = fields[4].GetUInt8();
}
// guess size
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8 + 1 + 4 + 4 + 4 + 10));
data << ObjectGuid(HIGHGUID_PLAYER, lowguid);
data << name;
data << uint8(0); // realm name for cross realm BG usage
data << uint32(pRace); // race
data << uint32(pGender); // gender
data << uint32(pClass); // class
session->SendPacket(&data);
delete result;
}