zoukankan      html  css  js  c++  java
  • T端数据库使用

    --------SQL DEMO  01--------

    void LFGMgr::LoadRequiredLevels()
    {
        uint32 oldMSTime = getMSTime();
    
        m_RequiredIlvlMap.clear();
    
        // ORDER BY is very important for GetRandomDungeonReward!
        QueryResult result = WorldDatabase.Query("SELECT ID, ItemLevel FROM lfg_required_ilevel ORDER BY ID");
    
        if (!result)
        {
            sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg required item levels for instances");
            return;
        }
    
        uint32 count = 0;
    
        Field* fields = NULL;
        do
        {
            fields = result->Fetch();
            uint32 dungeonId = fields[0].GetUInt32();
            uint32 itemLevel = fields[1].GetUInt32();
    
            const LFGDungeonEntry* dungeon = sLFGDungeonStore.LookupEntry(dungeonId);
            if (!sLFGDungeonStore.LookupEntry(dungeonId))
            {
                sLog->outError(LOG_FILTER_SQL, "Dungeon %u specified in table `lfg_required_ilevel` does not exist!", dungeonId);
                continue;
            }
    
            m_RequiredIlvlMap.insert(LfgRequiredIlvlMap::value_type(dungeonId, itemLevel));
            ++count;
        } while (result->NextRow());
    
        sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg required itemlevels in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
    }


     

    ------SQL DEMO 02------

    void LFGMgr::LoadRequiredLevels()
    {
        uint32 oldMSTime = getMSTime();
    
        m_RequiredIlvlMap.clear();
    
        // ORDER BY is very important for GetRandomDungeonReward!
        QueryResult result = WorldDatabase.Query("SELECT ID, ItemLevel FROM lfg_required_ilevel ORDER BY ID");
    
        if (!result)
        {
            sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg required item levels for instances");
            return;
        }
    
        uint32 count = 0;
    
        Field* fields = NULL;
        do
        {
            fields = result->Fetch();
            uint32 dungeonId = fields[0].GetUInt32();
            uint32 itemLevel = fields[1].GetUInt32();
    
            const LFGDungeonEntry* dungeon = sLFGDungeonStore.LookupEntry(dungeonId);
            if (!sLFGDungeonStore.LookupEntry(dungeonId))
            {
                sLog->outError(LOG_FILTER_SQL, "Dungeon %u specified in table `lfg_required_ilevel` does not exist!", dungeonId);
                continue;
            }
    
            m_RequiredIlvlMap.insert(LfgRequiredIlvlMap::value_type(dungeonId, itemLevel));
            ++count;
        } while (result->NextRow());
    
        sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg required itemlevels in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
    }

     ------String Demo 01------

    //void World::SendWorldText(int32 string_id, ...)

    std::string str = "[|cffff0000";    //"|cfff0ff00[世界][|r"
            std::string name = handler->GetSession()->GetPlayer()->GetName();
            str += name;
            str += "|r]:";
            str += args;
            sWorld->SendWorldText(1000000, str, args);

    ------.conf Demo 01------

    ConfigMgr::GetStringDefault  //获取字符串

  • 相关阅读:
    焦点Banner效果滚动
    缓冲效果
    招商银行购物网站的产品展示效果,循环播放
    神是怎么看待计算机的呢
    Liaoning Province保三成功
    JAR文件(文件格式)
    tamarin系列之5] 植入本地方法实现
    无线上把锁:WEP、WPA无线加密方式对比
    Tamarin
    V8 Javascript 引擎设计理念
  • 原文地址:https://www.cnblogs.com/needly/p/3757391.html
Copyright © 2011-2022 走看看