当前位置: 首页>>代码示例>>C++>>正文


C++ Corpse::GetDisplayId方法代码示例

本文整理汇总了C++中Corpse::GetDisplayId方法的典型用法代码示例。如果您正苦于以下问题:C++ Corpse::GetDisplayId方法的具体用法?C++ Corpse::GetDisplayId怎么用?C++ Corpse::GetDisplayId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Corpse的用法示例。


在下文中一共展示了Corpse::GetDisplayId方法的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...");
//.........这里部分代码省略.........
开发者ID:lev1976g,项目名称:easywow,代码行数:101,代码来源:DatabaseCleaner.cpp


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