本文整理汇总了C++中Corpse::LoadValues方法的典型用法代码示例。如果您正苦于以下问题:C++ Corpse::LoadValues方法的具体用法?C++ Corpse::LoadValues怎么用?C++ Corpse::LoadValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Corpse
的用法示例。
在下文中一共展示了Corpse::LoadValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CleanCharacters
void DatabaseCleaner::CleanCharacters()
{
set<uint32> chr_guids;
set<uint32> chr_guilds;
set<uint32> chr_charters;
Log.Notice("DatabaseCleaner", "Loading guids...");
QueryResult* result = CharacterDatabase.Query("SELECT guid, guildid, charterId FROM characters");
if (result)
{
do
{
chr_guids.insert(result->Fetch()[0].GetUInt32());
if (result->Fetch()[1].GetUInt32() != 0)
chr_guilds.insert(result->Fetch()[1].GetUInt32());
if (result->Fetch()[2].GetUInt32() != 0)
chr_guilds.insert(result->Fetch()[2].GetUInt32());
} while (result->NextRow());
delete result;
}
Log.Notice("DatabaseCleaner", "Got %u guids.", chr_guids.size());
Log.Notice("DatabaseCleaner", "Cleaning playeritems...");
result = CharacterDatabase.Query("SELECT ownerguid, guid FROM playeritems");
vector<uint64> tokill_items;
if (result)
{
do
{
if (result->Fetch()[0].GetUInt32() != 0 && chr_guids.find(result->Fetch()[0].GetUInt32()) == chr_guids.end())
{
tokill_items.push_back(result->Fetch()[1].GetUInt64());
}
} while (result->NextRow());
delete result;
}
for (vector<uint64>::iterator itr = tokill_items.begin(); itr != tokill_items.end(); ++itr)
{
CharacterDatabase.WaitExecute("DELETE FROM playeritems WHERE guid = " I64FMTD, *itr);
}
Log.Notice("DatabaseCleaner", "Deleted %u item instances.", tokill_items.size());
Log.Notice("DatabaseCleaner", "Cleaning questlog...");
result = CharacterDatabase.Query("SELECT index, player_guid FROM questlog");
vector<uint32> tokill_quests;
if (result)
{
do
{
if (chr_guids.find(result->Fetch()[1].GetUInt32()) == chr_guids.end())
tokill_quests.push_back(result->Fetch()[0].GetUInt32());
} while (result->NextRow());
delete result;
}
for (vector<uint32>::iterator itr = tokill_quests.begin(); itr != tokill_quests.end(); ++itr)
CharacterDatabase.WaitExecute("DELETE FROM questlog WHERE index = %u", *itr);
Log.Notice("DatabaseCleaner", "Deleted %u questlog entries.", tokill_quests.size());
Log.Notice("DatabaseCleaner", "Cleaning corpses...");
vector<uint32> tokill_corpses;
result = CharacterDatabase.Query("SELECT * FROM corpses");
if (result)
{
do
{
Corpse* pCorpse = new Corpse(0, result->Fetch()[0].GetUInt32());
pCorpse->LoadValues(result->Fetch()[8].GetString());
pCorpse->SetLowGUID(0);
if (pCorpse->GetDisplayId() == 0 ||
GET_LOWGUID_PART(pCorpse->GetOwner()) == 0 ||
chr_guids.find(GET_LOWGUID_PART(pCorpse->GetOwner())) == chr_guids.end())
{
tokill_corpses.push_back(pCorpse->GetLowGUID());
}
delete pCorpse;
} while (result->NextRow());
delete result;
}
for (vector<uint32>::iterator itr = tokill_corpses.begin(); itr != tokill_corpses.end(); ++itr)
CharacterDatabase.WaitExecute("DELETE FROM corpses WHERE guid = %u", *itr);
Log.Notice("DatabaseCleaner", "Removed %u corpses.", tokill_corpses.size());
Log.Notice("DatabaseCleaner", "Cleaning mailbox...");
result = CharacterDatabase.Query("SELECT message_id, player_guid FROM mailbox");
vector<uint32> tokill_mail;
if (result)
{
do
{
if (chr_guids.find(result->Fetch()[1].GetUInt32()) == chr_guids.end())
tokill_mail.push_back(result->Fetch()[0].GetUInt32());
} while (result->NextRow());
delete result;
}
for (vector<uint32>::iterator itr = tokill_mail.begin(); itr != tokill_mail.end(); ++itr)
CharacterDatabase.WaitExecute("DELETE FROM mailbox WHERE message_id = %u", *itr);
Log.Notice("DatabaseCleaner", "Deleted %u mail messages.", tokill_mail.size());
Log.Notice("DatabaseCleaner", "Cleaning guilds table...");
//.........这里部分代码省略.........