您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetMSTimeDiffToNow函数代码示例

51自学网 2021-06-01 21:10:21
  C++
这篇教程C++ GetMSTimeDiffToNow函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetMSTimeDiffToNow函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMSTimeDiffToNow函数的具体用法?C++ GetMSTimeDiffToNow怎么用?C++ GetMSTimeDiffToNow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetMSTimeDiffToNow函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getMSTime

void MapManager::LoadTransportNPCs(){    uint32 oldMSTime = getMSTime();    //                                                 0       1            2                3             4             5             6        7    QueryResult result = WorldDatabase.Query("SELECT guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO, emote FROM creature_transport");    if (!result)    {        sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");        return;    }    uint32 count = 0;    do    {        Field* fields = result->Fetch();        uint32 guid = fields[0].GetInt32();        uint32 entry = fields[1].GetInt32();        uint32 transportEntry = fields[2].GetInt32();        float tX = fields[3].GetFloat();        float tY = fields[4].GetFloat();        float tZ = fields[5].GetFloat();        float tO = fields[6].GetFloat();        uint32 anim = fields[7].GetInt32();        for (MapManager::TransportSet::iterator itr = m_Transports.begin(); itr != m_Transports.end(); ++itr)        {            if ((*itr)->GetEntry() == transportEntry)            {                (*itr)->AddNPCPassenger(guid, entry, tX, tY, tZ, tO, anim);                break;            }        }        ++count;    }    while (result->NextRow());    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));}
开发者ID:Aristoo,项目名称:TrinityCore,代码行数:42,


示例2: getMSTime

void TicketMgr::LoadTickets(){    uint32 oldMSTime = getMSTime();    for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr)        delete itr->second;    _ticketList.clear();    _lastTicketId = 0;    _openTicketCount = 0;    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GM_TICKETS);    PreparedQueryResult result = CharacterDatabase.Query(stmt);    if (!result)    {        TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");        return;    }    uint32 count = 0;    do    {        Field* fields = result->Fetch();        GmTicket* ticket = new GmTicket();        if (!ticket->LoadFromDB(fields))        {            delete ticket;            continue;        }        if (!ticket->IsClosed())            ++_openTicketCount;        // Update max ticket id if necessary        uint32 id = ticket->GetId();        if (_lastTicketId < id)            _lastTicketId = id;        _ticketList[id] = ticket;        ++count;    } while (result->NextRow());    TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));}
开发者ID:smaitlx,项目名称:Origin-Engine,代码行数:45,


示例3: getMSTime

void CreatureTextMgr::LoadCreatureTexts(){    uint32 oldMSTime = getMSTime();    mTextMap.clear(); // for reload case    mTextRepeatMap.clear(); //reset all currently used temp texts    PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_LOAD_CRETEXT);    PreparedQueryResult result = WorldDatabase.Query(stmt);    if(!result)    {        sLog->outString(">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");        sLog->outString();        return;    }    uint32 textCount = 0;    uint32 creatureCount = 0;    do    {        Field* fields = result->Fetch();        CreatureTextEntry temp;        temp.entry          = fields[0].GetUInt32();        temp.group          = fields[1].GetUInt8();        temp.id             = fields[2].GetUInt8();        temp.text           = fields[3].GetString();        temp.type           = ChatMsg(fields[4].GetUInt8());        temp.lang           = Language(fields[5].GetUInt8());        temp.probability    = fields[6].GetFloat();        temp.emote          = Emote(fields[7].GetUInt32());        temp.duration       = fields[8].GetUInt32();        temp.sound          = fields[9].GetUInt32();        if(temp.sound)        {            if(!sSoundEntriesStore.LookupEntry(temp.sound)){                sLog->outErrorDb("CreatureTextMgr:  Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);                temp.sound = 0;            }        }        if(!GetLanguageDescByID(temp.lang))        {            sLog->outErrorDb("CreatureTextMgr:  Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));            temp.lang = LANG_UNIVERSAL;        }        if(temp.type >= MAX_CHAT_MSG_TYPE)        {            sLog->outErrorDb("CreatureTextMgr:  Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));            temp.type = CHAT_MSG_SAY;        }        if(temp.emote)        {            if(!sEmotesStore.LookupEntry(temp.emote))            {                sLog->outErrorDb("CreatureTextMgr:  Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));                temp.emote = EMOTE_ONESHOT_NONE;            }        }        //entry not yet added, add empty TextHolder (list of groups)        if(mTextMap.find(temp.entry) == mTextMap.end())        {            ++creatureCount;            CreatureTextHolder TextHolder;            mTextMap[temp.entry] = TextHolder;        }        //group not yet added, add empty TextGroup (list of texts)        if(mTextMap[temp.entry].find(temp.group) == mTextMap[temp.entry].end())        {            CreatureTextGroup TextGroup;            mTextMap[temp.entry][temp.group] = TextGroup;        }        //add the text into our entry's group        mTextMap[temp.entry][temp.group].push_back(temp);        ++textCount;    } while(result->NextRow());    sLog->outString(">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));    sLog->outString();}
开发者ID:Darkelmo,项目名称:MythCore,代码行数:83,


示例4: getMSTime

void CreatureTextMgr::LoadCreatureTexts(){    uint32 oldMSTime = getMSTime();    mTextMap.clear(); // for reload case    mTextRepeatMap.clear(); //reset all currently used temp texts    PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_TEXT);    PreparedQueryResult result = WorldDatabase.Query(stmt);    if (!result)    {        TC_LOG_INFO("server.loading", ">> Loaded 0 ceature texts. DB table `creature_text` is empty.");        return;    }    uint32 textCount = 0;    do    {        Field* fields = result->Fetch();        CreatureTextEntry temp;        temp.entry           = fields[0].GetUInt32();        temp.group           = fields[1].GetUInt8();        temp.id              = fields[2].GetUInt8();        temp.type            = ChatMsg(fields[3].GetUInt8());        temp.lang            = Language(fields[4].GetUInt8());        temp.probability     = fields[5].GetFloat();        temp.duration        = fields[6].GetUInt32();        temp.BroadcastTextId = fields[7].GetUInt32();        temp.TextRange       = CreatureTextRange(fields[8].GetUInt8());        if (!GetLanguageDescByID(temp.lang))        {            TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));            temp.lang = LANG_UNIVERSAL;        }        if (temp.type >= MAX_CHAT_MSG_TYPE)        {            TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));            temp.type = CHAT_MSG_SAY;        }        if (temp.BroadcastTextId)        {            if (!sObjectMgr->GetBroadcastText(temp.BroadcastTextId))            {                TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has non-existing or incompatible BroadcastTextId %u.", temp.entry, temp.group, temp.id, temp.BroadcastTextId);                temp.BroadcastTextId = 0;            }        }        if (temp.TextRange > TEXT_RANGE_WORLD)        {            TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has incorrect TextRange %u.", temp.entry, temp.group, temp.id, temp.TextRange);            temp.TextRange = TEXT_RANGE_NORMAL;        }        // add the text into our entry's group        mTextMap[temp.entry][temp.group].push_back(temp);        ++textCount;    }    while (result->NextRow());    TC_LOG_INFO("server.loading", ">> Loaded %u creature texts for " SZFMTD " creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime));}
开发者ID:qadll52001314,项目名称:loa,代码行数:70,


示例5: getMSTime

void AuctionHouseMgr::LoadAuctions(){    uint32 oldMSTime = getMSTime();    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONS);    PreparedQueryResult result = CharacterDatabase.Query(stmt);    if (!result)    {        sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auctions. DB table `auctionhouse` is empty.");        return;    }    uint32 count = 0;    SQLTransaction trans = CharacterDatabase.BeginTransaction();    do    {        Field* fields = result->Fetch();        AuctionEntry* aItem = new AuctionEntry();        if (!aItem->LoadFromDB(fields))        {            aItem->DeleteFromDB(trans);            delete aItem;            continue;        }        GetAuctionsMap(aItem->factionTemplateId)->AddAuction(aItem);        count++;    } while (result->NextRow());    CharacterDatabase.CommitTransaction(trans);    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));}
开发者ID:Alexdeath,项目名称:FaceCore,代码行数:38,


示例6: getMSTime

void PoolMgr::LoadFromDB(){    // Pool templates    {        uint32 oldMSTime = getMSTime();        QueryResult result = WorldDatabase.Query("SELECT entry, max_limit FROM pool_template");        if (!result)        {            mPoolTemplate.clear();            sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 object pools. DB table `pool_template` is empty.");            return;        }        uint32 count = 0;        do        {            Field* fields = result->Fetch();            uint32 pool_id = fields[0].GetUInt32();            PoolTemplateData& pPoolTemplate = mPoolTemplate[pool_id];            pPoolTemplate.MaxLimit  = fields[1].GetUInt32();            ++count;        }        while (result->NextRow());        sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));    }    // Creatures    sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creatures Pooling Data...");    {        uint32 oldMSTime = getMSTime();        //                                                 1       2         3        QueryResult result = WorldDatabase.Query("SELECT guid, pool_entry, chance FROM pool_creature");        if (!result)        {            sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in  pools. DB table `pool_creature` is empty.");        }        else        {            uint32 count = 0;            do            {                Field* fields = result->Fetch();                uint32 guid    = fields[0].GetUInt32();                uint32 pool_id = fields[1].GetUInt32();                float chance   = fields[2].GetFloat();                CreatureData const* data = sObjectMgr->GetCreatureData(guid);                if (!data)                {                    sLog->outError(LOG_FILTER_SQL, "`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);                    continue;                }                if (pool_id > max_pool_id)                {                    sLog->outError(LOG_FILTER_SQL, "`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);                    continue;                }                if (chance < 0 || chance > 100)                {                    sLog->outError(LOG_FILTER_SQL, "`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);                    continue;                }                PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id];                PoolObject plObject = PoolObject(guid, chance);                PoolGroup<Creature>& cregroup = mPoolCreatureGroups[pool_id];                cregroup.SetPoolId(pool_id);                cregroup.AddEntry(plObject, pPoolTemplate->MaxLimit);                SearchPair p(guid, pool_id);                mCreatureSearchMap.insert(p);                ++count;            }            while (result->NextRow());            sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));        }    }    // Gameobjects    sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Pooling Data...");    {        uint32 oldMSTime = getMSTime();        //                                                 1        2         3        QueryResult result = WorldDatabase.Query("SELECT guid, pool_entry, chance FROM pool_gameobject");        if (!result)        {            sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in  pools. DB table `pool_gameobject` is empty.");        }//.........这里部分代码省略.........
开发者ID:3DViking,项目名称:MistCore,代码行数:101,


示例7: LoadSkillExtraItemTable

// loads the extra item creation info from DBvoid LoadSkillExtraItemTable(){    uint32 oldMSTime = getMSTime();    SkillExtraItemStore.clear();                            // need for reload    //                                                 0        1                       2                       3    QueryResult result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template");    if (!result)    {        sLog->outErrorDb(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");        sLog->outString();        return;    }    uint32 count = 0;    do    {        Field* fields = result->Fetch();        uint32 spellId = fields[0].GetUInt32();        if (!sSpellMgr->GetSpellInfo(spellId))        {            sLog->outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);            continue;        }        uint32 requiredSpecialization = fields[1].GetUInt32();        if (!sSpellMgr->GetSpellInfo(requiredSpecialization))        {            sLog->outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);            continue;        }        float additionalCreateChance = fields[2].GetFloat();        if (additionalCreateChance <= 0.0f)        {            sLog->outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);            continue;        }        uint8 additionalMaxNum = fields[3].GetUInt8();        if (!additionalMaxNum)        {            sLog->outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);            continue;        }        SkillExtraItemEntry& skillExtraItemEntry = SkillExtraItemStore[spellId];        skillExtraItemEntry.requiredSpecialization = requiredSpecialization;        skillExtraItemEntry.additionalCreateChance = additionalCreateChance;        skillExtraItemEntry.additionalMaxNum       = additionalMaxNum;        ++count;    }    while (result->NextRow());    sLog->outString(">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));    sLog->outString();}
开发者ID:SkyFireArchives,项目名称:SkyFireEMU_434,代码行数:65,


示例8: getMSTime

// -------------------void CreatureEventAIMgr::LoadCreatureEventAI_Summons(){    uint32 oldMSTime = getMSTime();    //Drop Existing EventSummon Map    m_CreatureEventAI_Summon_Map.clear();    // Gather additional data for EventAI    QueryResult result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons");    if (!result)    {        sLog->outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");        sLog->outString();        return;    }    uint32 count = 0;    do    {        Field* fields = result->Fetch();        CreatureEventAI_Summon temp;        uint32 i = fields[0].GetUInt32();        temp.position_x = fields[1].GetFloat();        temp.position_y = fields[2].GetFloat();        temp.position_z = fields[3].GetFloat();        temp.orientation = fields[4].GetFloat();        temp.SpawnTimeSecs = fields[5].GetUInt32();        if (!Trinity::IsValidMapCoord(temp.position_x, temp.position_y, temp.position_z, temp.orientation))        {            sLog->outErrorDb("CreatureEventAI:  Summon id %u have wrong coordinates (%f, %f, %f, %f), skipping.", i, temp.position_x, temp.position_y, temp.position_z, temp.orientation);            continue;        }        //Add to map        m_CreatureEventAI_Summon_Map[i] = temp;        ++count;    }    while (result->NextRow());    sLog->outString(">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));    sLog->outString();}
开发者ID:MCInteger,项目名称:uwom-server,代码行数:48,


示例9: getMSTime

//.........这里部分代码省略.........    //                                                0      1        2        3     4       5        6    QueryResult result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text FROM achievement_reward");    if (!result)    {        sLog->outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");        sLog->outString();        return;    }    uint32 count = 0;    do    {        Field *fields = result->Fetch();        uint32 entry = fields[0].GetUInt32();        const AchievementEntry* pAchievement = sAchievementStore.LookupEntry(entry);        if (!pAchievement)        {            sLog->outErrorDb("Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry);            continue;        }        AchievementReward reward;        reward.titleId[0] = fields[1].GetUInt32();        reward.titleId[1] = fields[2].GetUInt32();        reward.itemId     = fields[3].GetUInt32();        reward.sender     = fields[4].GetUInt32();        reward.subject    = fields[5].GetString();        reward.text       = fields[6].GetString();        // must be title or mail at least        if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender)        {            sLog->outErrorDb("Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry);            continue;        }        if (pAchievement->requiredFaction == ACHIEVEMENT_FACTION_ANY && ((reward.titleId[0] == 0) != (reward.titleId[1] == 0)))            sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]);        if (reward.titleId[0])        {            CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]);            if (!titleEntry)            {                sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]);                reward.titleId[0] = 0;            }        }        if (reward.titleId[1])        {            CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]);            if (!titleEntry)            {                sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]);                reward.titleId[1] = 0;            }        }        //check mail data before item for report including wrong item case        if (reward.sender)        {            if (!sObjectMgr->GetCreatureTemplate(reward.sender))            {                sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender);                reward.sender = 0;            }        }        else        {            if (reward.itemId)                sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry);            if (!reward.subject.empty())                sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry);            if (!reward.text.empty())                sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry);        }        if (reward.itemId)        {            if (!sObjectMgr->GetItemTemplate(reward.itemId))            {                sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId);                reward.itemId = 0;            }        }        m_achievementRewards[entry] = reward;        ++count;    }    while (result->NextRow());    sLog->outString(">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));    sLog->outString();}
开发者ID:Facelive,项目名称:ArkCORE2,代码行数:101,


示例10: getMSTime

void GuildMgr::LoadGuilds(){    // 1. Load all guilds    sLog->outString("Loading guilds definitions...");    {        uint32 oldMSTime = getMSTime();                                                     //          0          1       2             3              4              5              6        QueryResult result = CharacterDatabase.Query("SELECT g.guildid, g.name, g.leaderguid, g.EmblemStyle, g.EmblemColor, g.BorderStyle, g.BorderColor, "                                                     //   7                  8       9       10            11           12                                                     "g.BackgroundColor, g.info, g.motd, g.createdate, g.BankMoney, COUNT(gbt.guildid) "                                                     "FROM guild g LEFT JOIN guild_bank_tab gbt ON g.guildid = gbt.guildid GROUP BY g.guildid ORDER BY g.guildid ASC");        if (!result)        {            sLog->outString(">> Loaded 0 guild definitions. DB table `guild` is empty.");            sLog->outString();            return;        }        else        {            uint32 count = 0;            do            {                Field* fields = result->Fetch();                Guild* guild = new Guild();                if (!guild->LoadFromDB(fields))                {                    delete guild;                    continue;                }                QueryResult gNews = CharacterDatabase.PQuery("SELECT type, date, value1, value2, source_guid, flags FROM guild_news WHERE guildid = %u ORDER BY date DESC", guild->GetId());                if (gNews)                {                    Field* fields = gNews->Fetch();                    guild->LoadGuildNewsFromDB(fields);                }                AddGuild(guild);                ++count;            }            while (result->NextRow());            sLog->outString(">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));            sLog->outString();        }    }    // 2. Load all guild ranks    sLog->outString("Loading guild ranks...");    {        uint32 oldMSTime = getMSTime();        // Delete orphaned guild rank entries before loading the valid ones        CharacterDatabase.DirectExecute("DELETE gr FROM guild_rank gr LEFT JOIN guild g ON gr.guildId = g.guildId WHERE g.guildId IS NULL");        //                                                         0    1      2       3                4        QueryResult result = CharacterDatabase.Query("SELECT guildid, rid, rname, rights, BankMoneyPerDay FROM guild_rank ORDER BY guildid ASC, rid ASC");        if (!result)        {            sLog->outString(">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");            sLog->outString();        }        else        {            uint32 count = 0;            do            {                Field* fields = result->Fetch();                uint32 guildId = fields[0].GetUInt32();                if (Guild* guild = GetGuildById(guildId))                    guild->LoadRankFromDB(fields);                ++count;            }            while (result->NextRow());            sLog->outString(">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));            sLog->outString();        }    }    // 3. Load all guild members    sLog->outString("Loading guild members...");    {        uint32 oldMSTime = getMSTime();        // Delete orphaned guild member entries before loading the valid ones        CharacterDatabase.DirectExecute("DELETE gm FROM guild_member gm LEFT JOIN guild g ON gm.guildId = g.guildId WHERE g.guildId IS NULL");                                                     //          0        1        2     3      4        5                   6        QueryResult result = CharacterDatabase.Query("SELECT guildid, gm.guid, rank, pnote, offnote, BankResetTimeMoney, BankRemMoney, "                                                     //   7                  8                 9                  10                11                 12                                                     "BankResetTimeTab0, BankRemSlotsTab0, BankResetTimeTab1, BankRemSlotsTab1, BankResetTimeTab2, BankRemSlotsTab2, "                                                     //   13                 14                15                 16                17                 18                                                     "BankResetTimeTab3, BankRemSlotsTab3, BankResetTimeTab4, BankRemSlotsTab4, BankResetTimeTab5, BankRemSlotsTab5, "                                                     //   19      20       21       22      23         24//.........这里部分代码省略.........
开发者ID:Anyriand,项目名称:ArkCORE,代码行数:101,


示例11: getMSTime

void SmartWaypointMgr::LoadFromDB(){    uint32 oldMSTime = getMSTime();    waypoint_map.clear();    PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_LOAD_SMARTAI_WP);    PreparedQueryResult result = WorldDatabase.Query(stmt);    if (!result)    {        sLog->outString(">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");        sLog->outString();        return;    }    uint32 count = 0;    uint32 total = 0;    WPPath* path = NULL;    uint32 last_entry = 0;    uint32 last_id = 1;    do    {        Field* fields = result->Fetch();        uint32 entry = fields[0].GetUInt32();        uint32 id = fields[1].GetUInt32();        float x, y, z;        x = fields[2].GetFloat();        y = fields[3].GetFloat();        z = fields[4].GetFloat();        WayPoint* wp = new WayPoint(id, x, y, z);        if (last_entry != entry)        {            path = new WPPath;            last_id = 1;        }        if (last_id != id)        {            sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);        }        last_id++;        (*path)[id] = wp;        if (last_entry != entry)        {            count++;            waypoint_map[entry] = path;        }        last_entry = entry;        total++;    }    while (result->NextRow());    sLog->outString(">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));    sLog->outString();}
开发者ID:55887MX,项目名称:CCORE,代码行数:59,


示例12: LoadSkillDiscoveryTable

//.........这里部分代码省略.........    {        sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty.");        return;    }    uint32 count = 0;    std::ostringstream ssNonDiscoverableEntries;    std::set<uint32> reportedReqSpells;    do    {        Field* fields = result->Fetch();        uint32 spellId         = fields[0].GetUInt32();        int32  reqSkillOrSpell = fields[1].GetInt32();        uint32 reqSkillValue   = fields[2].GetUInt16();        float  chance          = fields[3].GetFloat();        if (chance <= 0)                                    // chance        {            ssNonDiscoverableEntries << "spellId = " << spellId << " reqSkillOrSpell = " << reqSkillOrSpell                << " reqSkillValue = " << reqSkillValue << " chance = " << chance << "(chance problem)/n";            continue;        }        if (reqSkillOrSpell > 0)                            // spell case        {            uint32 absReqSkillOrSpell = uint32(reqSkillOrSpell);            SpellInfo const* reqSpellInfo = sSpellMgr->GetSpellInfo(absReqSkillOrSpell);            if (!reqSpellInfo)            {                if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())                {                    sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell);                    reportedReqSpells.insert(absReqSkillOrSpell);                }                continue;            }            // mechanic discovery            if (reqSpellInfo->Mechanic != MECHANIC_DISCOVERY &&                // explicit discovery ability                !reqSpellInfo->IsExplicitDiscovery())            {                if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())                {                    sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc"                        " and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",                        absReqSkillOrSpell, spellId);                    reportedReqSpells.insert(absReqSkillOrSpell);                }                continue;            }            SkillDiscoveryStore[reqSkillOrSpell].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance));        }        else if (reqSkillOrSpell == 0)                      // skill case        {            SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);            if (bounds.first == bounds.second)            {                sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId);                continue;            }            for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)                SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance));        }        else        {            sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId);            continue;        }        ++count;    }    while (result->NextRow());    if (!ssNonDiscoverableEntries.str().empty())        sLog->outError(LOG_FILTER_SQL, "Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:/n%s", ssNonDiscoverableEntries.str().c_str());    // report about empty data for explicit discovery spells    for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)    {        SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell_id);        if (!spellEntry)            continue;        // skip not explicit discovery spells        if (!spellEntry->IsExplicitDiscovery())            continue;        if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end())            sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id);    }    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));}
开发者ID:Tithand,项目名称:TER-Server,代码行数:101,


示例13: getMSTime

void MapManager::LoadTransports(){    uint32 oldMSTime = getMSTime();    QueryResult result = WorldDatabase.Query("SELECT guid, entry, name, period, ScriptName FROM transports");    if (!result)    {        sLog->outString(">> Loaded 0 transports. DB table `transports` is empty!");        sLog->outString();        return;    }    uint32 count = 0;    do    {        Field* fields = result->Fetch();        uint32 lowguid = fields[0].GetUInt32();        uint32 entry = fields[1].GetUInt32();        std::string name = fields[2].GetString();        uint32 period = fields[3].GetUInt32();        uint32 scriptId = sObjectMgr->GetScriptId(fields[4].GetCString());        const GameObjectTemplate* goinfo = sObjectMgr->GetGameObjectTemplate(entry);        if (!goinfo)        {            sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str());            continue;        }        if (goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT)        {            sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str());            continue;        }        // sLog->outString("Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);        std::set<uint32> mapsUsed;        Transport* t = new Transport(period, scriptId);        if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed))            // skip transports with empty waypoints list        {            sLog->outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId);            delete t;            continue;        }        float x = t->m_WayPoints[0].x;        float y = t->m_WayPoints[0].y;        float z = t->m_WayPoints[0].z;        uint32 mapid = t->m_WayPoints[0].mapid;        float o = 1.0f;         // creates the Gameobject        if (!t->Create(lowguid, entry, mapid, x, y, z, o, 100, 0))        {            delete t;            continue;        }        m_Transports.insert(t);        for (std::set<uint32>::const_iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i)            m_TransportsByMap[*i].insert(t);        //If we someday decide to use the grid to track transports, here:        t->SetMap(sMapMgr->CreateBaseMap(mapid));        t->AddToWorld();        ++count;    }    while (result->NextRow());    // check transport data DB integrity    result = WorldDatabase.Query("SELECT gameobject.guid, gameobject.id, transports.name FROM gameobject, transports WHERE gameobject.id = transports.entry");    if (result)                                              // wrong data found    {        do        {            Field* fields = result->Fetch();            uint32 guid  = fields[0].GetUInt32();            uint32 entry = fields[1].GetUInt32();            std::string name = fields[2].GetString();            sLog->outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.", entry, name.c_str(), guid);        }        while (result->NextRow());    }    sLog->outString(">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));    sLog->outString();}
开发者ID:FirstCore,项目名称:PandaCore,代码行数:97,


示例14: getMSTime

void CreatureTextMgr::LoadCreatureTexts(){    uint32 oldMSTime = getMSTime();    mTextMap.clear(); // for reload case    //all currently used temp texts are NOT reset    QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, groupid, id, text, type, language, probability, emote, duration, sound, TextRange FROM creature_text");    if (!result)    {        sLog.outString(">> Loaded 0 ceature texts. DB table `creature_text` is empty.");        return;    }    uint32 textCount = 0;    do    {        Field* fields = result->Fetch();        CreatureTextEntry temp;        temp.entry           = fields[0].GetUInt32();        temp.group           = fields[1].GetUInt8();        temp.id              = fields[2].GetUInt8();        temp.text            = fields[3].GetString();        temp.type            = ChatMsg(fields[4].GetUInt8());        temp.lang            = Language(fields[5].GetUInt8());        temp.probability     = fields[6].GetFloat();        temp.emote           = Emote(fields[7].GetUInt32());        temp.duration        = fields[8].GetUInt32();        temp.sound           = fields[9].GetUInt32();        temp.TextRange       = CreatureTextRange(fields[10].GetUInt8());        if (temp.sound)        {            if (!sSoundEntriesStore.LookupEntry(temp.sound))            {                sLog.outError("CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);                temp.sound = 0;            }        }        if (!GetLanguageDescByID(temp.lang))        {            sLog.outError("CreatureTextMgr: Entry %u, Group %u in table `creature_text` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));            temp.lang = LANG_UNIVERSAL;        }        if (temp.type >= MAX_CHAT_MSG_TYPE)        {            sLog.outError("CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));            temp.type = CHAT_MSG_SAY;        }        if (temp.emote)        {            if (!sEmotesStore.LookupEntry(temp.emote))            {                sLog.outError("CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));                temp.emote = EMOTE_ONESHOT_NONE;            }        }        if (temp.TextRange > TEXT_RANGE_WORLD)        {            sLog.outError("CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has incorrect TextRange %u.", temp.entry, temp.group, temp.id, temp.TextRange);            temp.TextRange = TEXT_RANGE_NORMAL;        }        // add the text into our entry's group        mTextMap[temp.entry][temp.group].push_back(temp);        ++textCount;    }    while (result->NextRow());    sLog.outString(">> Loaded %u creature texts for %lu creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime));}
开发者ID:Zaffy,项目名称:OregonCore,代码行数:80,


示例15: LoadDBCStores

//.........这里部分代码省略.........                {                    // not spell path                    if (spellPaths.find(dest_i->second.ID) == spellPaths.end())                    {                        ok = true;                        break;                    }                }                if (!ok)                    continue;            }            // valid taxi network node            uint8  field   = (uint8)((i - 1) / 32);            uint32 submask = 1<<((i-1)%32);            sTaxiNodesMask[field] |= submask;            if (node->MountCreatureID[0] && node->MountCreatureID[0] != 32981)                sHordeTaxiNodesMask[field] |= submask;            if (node->MountCreatureID[1] && node->MountCreatureID[1] != 32981)                sAllianceTaxiNodesMask[field] |= submask;            if (node->MountCreatureID[0] == 32981 || node->MountCreatureID[1] == 32981)                sDeathKnightTaxiNodesMask[field] |= submask;            // old continent node (+ nodes virtually at old continents, check explicitly to avoid loading map files for zone info)            if (node->map_id < 2 || i == 82 || i == 83 || i == 93 || i == 94)                sOldContinentsNodesMask[field] |= submask;            // fix DK node at Ebon Hold and Shadow Vault flight master            if (i == 315 || i == 333)                ((TaxiNodesEntry*)node)->MountCreatureID[1] = 32981;        }    }    LoadDBC(availableDbcLocales, bad_dbc_files, sTeamContributionPointsStore, dbcPath, "TeamContributionPoints.dbc");    LoadDBC(availableDbcLocales, bad_dbc_files, sTotemCategoryStore,          dbcPath, "TotemCategory.dbc");    LoadDBC(availableDbcLocales, bad_dbc_files, sTransportAnimationStore,     dbcPath, "TransportAnimation.dbc");    for (uint32 i = 0; i < sTransportAnimationStore.GetNumRows(); ++i)    {        TransportAnimationEntry const* anim = sTransportAnimationStore.LookupEntry(i);        if (!anim)            continue;        sTransportMgr->AddPathNodeToTransport(anim->TransportEntry, anim->TimeSeg, anim);    }    LoadDBC(availableDbcLocales, bad_dbc_files, sTransportRotationStore,     dbcPath, "TransportRotation.dbc");    for (uint32 i = 0; i < sTransportRotationStore.GetNumRows(); ++i)    {        TransportRotationEntry const* rot = sTransportRotationStore.LookupEntry(i);        if (!rot)            continue;        sTransportMgr->AddPathRotationToTransport(rot->TransportEntry, rot->TimeSeg, rot);    }    LoadDBC(availableDbcLocales, bad_dbc_files, sVehicleStore,                dbcPath, "Vehicle.dbc");    LoadDBC(availableDbcLocales, bad_dbc_files, sVehicleSeatStore,            dbcPath, "VehicleSeat.dbc");    LoadDBC(availableDbcLocales, bad_dbc_files, sWMOAreaTableStore,           dbcPath, "WMOAreaTable.dbc");    for (uint32 i = 0; i < sWMOAreaTableStore.GetNumRows(); ++i)        if (WMOAreaTableEntry const* entry = sWMOAreaTableStore.LookupEntry(i))            sWMOAreaInfoByTripple.insert(WMOAreaInfoByTripple::value_type(WMOAreaTableTripple(entry->rootId, entry->adtId, entry->groupId), entry));    LoadDBC(availableDbcLocales, bad_dbc_files, sWorldMapAreaStore,           dbcPath, "WorldMapArea.dbc");    LoadDBC(availableDbcLocales, bad_dbc_files, sWorldMapOverlayStore,        dbcPath, "WorldMapOverlay.dbc");    LoadDBC(availableDbcLocales, bad_dbc_files, sWorldSafeLocsStore,          dbcPath, "WorldSafeLocs.dbc");    // error checks    if (bad_dbc_files.size() >= DBCFileCount)    {        TC_LOG_ERROR("misc", "Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str());        exit(1);    }    else if (!bad_dbc_files.empty())    {        std::string str;        for (StoreProblemList::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)            str += *i + "/n";        TC_LOG_ERROR("misc", "Some required *.dbc files (%u from %d) not found or not compatible:/n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str());        exit(1);    }    // Check loaded DBC files proper version    if (!sAreaStore.LookupEntry(3617)              ||       // last area (areaflag) added in 3.3.5a        !sCharTitlesStore.LookupEntry(177)         ||       // last char title added in 3.3.5a        !sGemPropertiesStore.LookupEntry(1629)     ||       // last added spell in 3.3.5a        !sItemStore.LookupEntry(56806)             ||       // last gem property added in 3.3.5a        !sItemExtendedCostStore.LookupEntry(2997)  ||       // last item extended cost added in 3.3.5a        !sMapStore.LookupEntry(724)                ||       // last map added in 3.3.5a        !sSpellStore.LookupEntry(80864)            )        // last client known item added in 3.3.5a    {        TC_LOG_ERROR("misc", "You have _outdated_ DBC files. Please extract correct versions from current using client.");        exit(1);    }    TC_LOG_INFO("server.loading", ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));}
开发者ID:mynew0,项目名称:Effec7Core,代码行数:101,


示例16: getMSTime

void OutdoorPvPMgr::InitOutdoorPvP(){    uint32 oldMSTime = getMSTime();    //                                                 0       1    QueryResult result = WorldDatabase.Query("SELECT TypeId, ScriptName FROM outdoorpvp_template");    if (!result)    {        sLog->outErrorDb(">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");        sLog->outString();        return;    }    uint32 count = 0;    uint32 typeId = 0;    do    {        Field* fields = result->Fetch();        typeId = fields[0].GetUInt8();        if (DisableMgr::IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, NULL))            continue;        if (typeId >= MAX_OUTDOORPVP_TYPES)        {            sLog->outErrorDb("Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId);            continue;        }        OutdoorPvPData* data = new OutdoorPvPData();        OutdoorPvPTypes realTypeId = OutdoorPvPTypes(typeId);        data->TypeId = realTypeId;        data->ScriptId = sObjectMgr->GetScriptId(fields[1].GetCString());        m_OutdoorPvPDatas[realTypeId] = data;        ++count;    }    while (result->NextRow());    OutdoorPvP* pvp;    for (uint8 i = 1; i < MAX_OUTDOORPVP_TYPES; ++i)    {        OutdoorPvPDataMap::iterator iter = m_OutdoorPvPDatas.find(OutdoorPvPTypes(i));        if (iter == m_OutdoorPvPDatas.end())        {            sLog->outErrorDb("Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i));            continue;        }        pvp = sScriptMgr->CreateOutdoorPvP(iter->second);        if (!pvp)        {            sLog->outError("Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i));            continue;        }        if (!pvp->SetupOutdoorPvP())        {            sLog->outError("Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i));            delete pvp;            continue;        }        m_OutdoorPvPSet.push_back(pvp);    }    sLog->outString(">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));    sLog->outString();}
开发者ID:kmN666,项目名称:Leroy,代码行数:72,


示例17: getMSTime

void SmartWaypointMgr::LoadFromDB(){    uint32 oldMSTime = getMSTime();    for (UNORDERED_MAP<uint32, WPPath*>::iterator itr = waypoint_map.begin(); itr != waypoint_map.end(); ++itr)    {        for (WPPath::iterator pathItr = itr->second->begin(); pathItr != itr->second->end(); ++pathItr)            delete pathItr->second;        delete itr->second;    }    waypoint_map.clear();    PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_SMARTAI_WP);    PreparedQueryResult result = WorldDatabase.Query(stmt);    if (!result)    {        TC_LOG_INFO("server.loading", ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");        return;    }    uint32 count = 0;    uint32 total = 0;    uint32 last_entry = 0;    uint32 last_id = 1;    do    {        Field* fields = result->Fetch();        uint32 entry = fields[0].GetUInt32();        uint32 id = fields[1].GetUInt32();        float x, y, z;        x = fields[2].GetFloat();        y = fields[3].GetFloat();        z = fields[4].GetFloat();        if (last_entry != entry)        {            waypoint_map[entry] = new WPPath();            last_id = 1;            count++;        }        if (last_id != id)            TC_LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);        last_id++;        (*waypoint_map[entry])[id] = new WayPoint(id, x, y, z);        last_entry = entry;        total++;    }    while (result->NextRow());    TC_LOG_INFO("server.loading", ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));}
开发者ID:Ajaxhore,项目名称:TrinityCore,代码行数:60,


示例18: ASSERT

void InfoMgr::Initialize(){    ASSERT(m_charInfos.size() == 0);    sLog->outInfo(LOG_FILTER_SERVER_LOADING, "/n/nInitializing InfoMgr...");    uint32 count;    uint32 allStart = getMSTime();    // General stuff    uint32 start = allStart;    count = 0;    if (QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class, account, level, zone FROM characters WHERE account != 0"))    {        do        {            Field *fields = result->Fetch();            UpdateCharBase(fields[0].GetUInt32() /* guid */, fields[1].GetString() /* name */, fields[3].GetUInt8() /*gender*/,                fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/, fields[5].GetUInt32() /* account */, fields[6].GetUInt8() /* level */, fields[7].GetUInt16() /* zone */);            ++count;        } while (result->NextRow());    }    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded base for %u characters (%ums)", count, GetMSTimeDiffToNow(start));    // MMR    start = getMSTime();    count = 0;    if (QueryResult mmrResult = CharacterDatabase.Query("SELECT guid, matchMakerRating, slot FROM character_arena_stats WHERE guid != 0"))    {        do        {            Field *fields = mmrResult->Fetch();            UpdateCharMMR(fields[0].GetUInt32() /* guid */, fields[1].GetUInt32() /* MMR */, fields[2].GetUInt8() /* slot */);            ++count;        } while (mmrResult->NextRow());    }    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded MMR for %u characters (%ums)", count, GetMSTimeDiffToNow(start));    // Guilds    start = getMSTime();    count = 0;    if (QueryResult guildResult = CharacterDatabase.Query("SELECT guildid, guid FROM guild_member"))    {        do        {            Field *fields = guildResult->Fetch();            UpdateCharGuild(fields[1].GetUInt32(), fields[0].GetUInt32());            ++count;        } while (guildResult->NextRow());    }    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded guild for %u characters (%ums)", count, GetMSTimeDiffToNow(start));    // Groups    start = getMSTime();    count = 0;    if (QueryResult groupResult = CharacterDatabase.Query("SELECT guid, memberGuid FROM group_member"))    {        do        {            Field *fields = groupResult->Fetch();            UpdateCharGroup(fields[1].GetUInt32(), fields[0].GetUInt32());            ++count;        } while (groupResult->NextRow());    }    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded group for %u characters (%ums)", count, GetMSTimeDiffToNow(start));    // Arena teams    start = getMSTime();    count = 0;    if (QueryResult arenaResult = CharacterDatabase.Query("SELECT arena_team.arenateamid, arena_team.type, arena_team_member.guid FROM arena_team JOIN arena_team_member ON arena_team.arenateamid = arena_team_member.arenateamid"))    {        do        {            Field *fields = arenaResult->Fetch();            UpdateCharArenaTeam(fields[2].GetUInt32(), fields[0].GetUInt32(), ArenaTeam::GetSlotByType(fields[1].GetUInt8()));            ++count;        } while (arenaResult->NextRow());    }    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u arena teams (%ums)", count, GetMSTimeDiffToNow(start));    // Account char counts    start = getMSTime();    count = 0;    if (QueryResult charCountResult = CharacterDatabase.Query("SELECT account, COUNT(1) FROM characters WHERE account <> 0 GROUP BY account"))    {        do        {            Field *fields = charCountResult->Fetch();            SetAccountCharCount(fields[0].GetUInt32(), fields[1].GetUInt64());            ++count;        } while (charCountResult->NextRow());    }    sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded char count for %u accounts (%ums)", count, GetMSTimeDiffToNow(start));    // pets    /*start = getMSTime();    count = 0;    if (QueryResult pets = CharacterDatabase.Query("SELECT id, entry, owner, modelid, CreatedBySpell, PetType, Reactstate, name, renamed, slot, curhealth, curmana, curhappiness, savetime, abdata, level, exp FROM character_pet"))    {        do        {//.........这里部分代码省略.........
开发者ID:AwkwardDev,项目名称:WoWSource434,代码行数:101,


示例19: getMSTime

//.........这里部分代码省略.........        if (temp.entryOrGuid >= 0)        {            switch (source_type)            {                case SMART_SCRIPT_TYPE_CREATURE:                {                    if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid))                    {                        TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));                        continue;                    }                    break;                }                case SMART_SCRIPT_TYPE_GAMEOBJECT:                {                    if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid))                    {                        TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));                        continue;                    }                    break;                }                case SMART_SCRIPT_TYPE_AREATRIGGER:                {                    if (!sAreaTriggerStore.LookupEntry((uint32)temp.entryOrGuid))                    {                        TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));                        continue;                    }                    break;                }                case SMART_SCRIPT_TYPE_TIMED_ACTIONLIST:                    break;//nothing to check, really                default:                    TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type);                    continue;            }        }        else        {            if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid))))            {                TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid)));                continue;            }        }        temp.source_type = source_type;        temp.event_id = fields[2].GetUInt16();        temp.link = fields[3].GetUInt16();        temp.event.type = (SMART_EVENT)fields[4].GetUInt8();        temp.event.event_phase_mask = fields[5].GetUInt8();        temp.event.event_chance = fields[6].GetUInt8();        temp.event.event_flags = fields[7].GetUInt8();        temp.event.raw.param1 = fields[8].GetUInt32();        temp.event.raw.param2 = fields[9].GetUInt32();        temp.event.raw.param3 = fields[10].GetUInt32();        temp.event.raw.param4 = fields[11].GetUInt32();        temp.action.type = (SMART_ACTION)fields[12].GetUInt8();        temp.action.raw.param1 = fields[13].GetUInt32();        temp.action.raw.param2 = fields[14].GetUInt32();        temp.action.raw.param3 = fields[15].GetUInt32();        temp.action.raw.param4 = fields[16].GetUInt32();        temp.action.raw.param5 = fields[17].GetUInt32();        temp.action.raw.param6 = fields[18].GetUInt32();        temp.target.type = (SMARTAI_TARGETS)fields[19].GetUInt8();        temp.target.raw.param1 = fields[20].GetUInt32();        temp.target.raw.param2 = fields[21].GetUInt32();        temp.target.raw.param3 = fields[22].GetUInt32();        temp.target.x = fields[23].GetFloat();        temp.target.y = fields[24].GetFloat();        temp.target.z = fields[25].GetFloat();        temp.target.o = fields[26].GetFloat();        //check target        if (!IsTargetValid(temp))            continue;        // check all event and action params        if (!IsEventValid(temp))            continue;        // creature entry / guid not found in storage, create empty event list for it and increase counters        if (mEventMap[source_type].find(temp.entryOrGuid) == mEventMap[source_type].end())        {            ++count;            SmartAIEventList eventList;            mEventMap[source_type][temp.entryOrGuid] = eventList;        }        // store the new event        mEventMap[source_type][temp.entryOrGuid].push_back(temp);    }    while (result->NextRow());    TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));}
开发者ID:Grimtonz1337,项目名称:TrinityCore,代码行数:101,


示例20: LoadFromDB

void LoadFromDB(){    uint32 oldMSTime = getMSTime();    QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons");    if (result)    {        uint32 count = 0;        do        {            Field* fields = result->Fetch();            std::string name = fields[0].GetString();            uint32 crc = fields[1].GetUInt32();            m_knownAddons.push_back(SavedAddon(name, crc));            ++count;        }        while (result->NextRow());        TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));    }    else        TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!");    oldMSTime = getMSTime();    result = CharacterDatabase.Query("SELECT id, name, version, UNIX_TIMESTAMP(timestamp) FROM banned_addons");    if (result)    {        uint32 count = 0;        uint32 dbcMaxBannedAddon = sBannedAddOnsStore.GetNumRows();        do        {            Field* fields = result->Fetch();            BannedAddon addon;            addon.Id = fields[0].GetUInt32() + dbcMaxBannedAddon;            addon.Timestamp = uint32(fields[3].GetUInt64());            std::string name = fields[1].GetString();            std::string version = fields[2].GetString();            MD5(reinterpret_cast<uint8 const*>(name.c_str()), name.length(), addon.NameMD5);            MD5(reinterpret_cast<uint8 const*>(version.c_str()), version.length(), addon.VersionMD5);            m_bannedAddons.push_back(addon);            ++count;        }        while (result->NextRow());        TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u banned addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));    }}
开发者ID:mynew2,项目名称:trinitycore-1,代码行数:57,



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


C++ GetMType函数代码示例
C++ GetMDIParent函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。