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

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

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

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

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

示例1: bar

// -------------------void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use){    // Drop Existing Text Map, only done once and we are ready to add data from multiple sources.    m_CreatureEventAI_TextMap.clear();    // Load EventAI Text    sObjectMgr.LoadMangosStrings(WorldDatabase,"creature_ai_texts",MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID);    // Gather Additional data from EventAI Texts    QueryResult *result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");    sLog.outString("Loading EventAI Texts additional data...");    if (result)    {        BarGoLink bar(result->GetRowCount());        uint32 count = 0;        do        {            bar.step();            Field* fields = result->Fetch();            StringTextData temp;            int32 i             = fields[0].GetInt32();            temp.SoundId        = fields[1].GetInt32();            temp.Type           = fields[2].GetInt32();            temp.Language       = fields[3].GetInt32();            temp.Emote          = fields[4].GetInt32();            // range negative            if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID)            {                sLog.outErrorDb("CreatureEventAI:  Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)",i,MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID);                continue;            }            // range negative (don't must be happen, loaded from same table)            if (!sObjectMgr.GetMangosStringLocale(i))            {                sLog.outErrorDb("CreatureEventAI:  Entry %i in table `creature_ai_texts` not found",i);                continue;            }            if (temp.SoundId)            {                if (!sSoundEntriesStore.LookupEntry(temp.SoundId))                    sLog.outErrorDb("CreatureEventAI:  Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.",i,temp.SoundId);            }            if (!GetLanguageDescByID(temp.Language))                sLog.outErrorDb("CreatureEventAI:  Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.",i,temp.Language);            if (temp.Type > CHAT_TYPE_ZONE_YELL)                sLog.outErrorDb("CreatureEventAI:  Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type);            if (temp.Emote)            {                if (!sEmotesStore.LookupEntry(temp.Emote))                    sLog.outErrorDb("CreatureEventAI:  Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.",i,temp.Emote);            }            m_CreatureEventAI_TextMap[i] = temp;            ++count;        } while (result->NextRow());        delete result;        if(check_entry_use)            CheckUnusedAITexts();        sLog.outString();        sLog.outString(">> Loaded %u additional CreatureEventAI Texts data.", count);    }    else    {        BarGoLink bar(1);        bar.step();        sLog.outString();        sLog.outString(">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");    }}
开发者ID:Naxp,项目名称:server,代码行数:82,


示例2: getMSTime

void CreatureTextMgr::LoadCreatureTexts(){    uint32 oldMSTime = getMSTime();    mTextMap.clear(); // for reload case    mTextRepeatMap.clear(); //reset all currently used temp texts    PreparedStatement* stmt = WorldDB.GetPreparedStatement(WORLD_LOAD_CRETEXT);    PreparedQueryResult result = WorldDB.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           = ChatType(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 >= CHAT_TYPE_ZONE_YELL)//CHAT_TYPE_ZONE_YELL and more will be used later        {            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_TYPE_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:sacel,项目名称:StrawberryEMU,代码行数:83,


示例3: getMSTime

// -------------------void CreatureEventAIMgr::LoadCreatureEventAI_Texts(){    uint32 oldMSTime = getMSTime();    // Drop Existing Text Map, only done once and we are ready to add data from multiple sources.    m_CreatureEventAI_TextMap.clear();    // Load EventAI Text    sObjectMgr->LoadTrinityStrings("creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);    // Gather Additional data from EventAI Texts     0      1      2     3         4    QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");    if (!result)    {        TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");        return;    }    uint32 count = 0;    do    {        Field* fields = result->Fetch();        StringTextData temp;        int32 i             = fields[0].GetInt32();        temp.SoundId        = fields[1].GetUInt32();        temp.Type           = fields[2].GetUInt8();        temp.Language       = fields[3].GetUInt8();        temp.Emote          = fields[4].GetUInt16();        // range negative        if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID)        {            TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI:  Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)", i, MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);            continue;        }        // range negative (must not happen, loaded from same table)        if (!sObjectMgr->GetTrinityStringLocale(i))        {            TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI:  Entry %i in table `creature_ai_texts` not found", i);            continue;        }        if (temp.SoundId)        {            if (!sSoundEntriesStore.LookupEntry(temp.SoundId))                TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI:  Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.", i, temp.SoundId);        }        if (!GetLanguageDescByID(temp.Language))            TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI:  Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.", i, temp.Language);        if (temp.Type > CHAT_TYPE_ZONE_YELL)            TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI:  Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.", i, temp.Type);        if (temp.Emote)        {            if (!sEmotesStore.LookupEntry(temp.Emote))                TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI:  Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.", i, temp.Emote);        }        m_CreatureEventAI_TextMap[i] = temp;        ++count;    }    while (result->NextRow());    TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));}
开发者ID:mynew2,项目名称:trinitycore-1,代码行数:72,


示例4: bar

void ScriptMgr::LoadScripts(ScriptMapMap& scripts, const char* tablename){    if (IsScriptScheduled())                                // function don't must be called in time scripts use.        return;    sLog.outString("%s :", tablename);    scripts.clear();                                        // need for reload support    QueryResult *result = WorldDatabase.PQuery("SELECT id, delay, command, datalong, datalong2, datalong3, datalong4, data_flags, dataint, dataint2, dataint3, dataint4, x, y, z, o FROM %s", tablename);    uint32 count = 0;    if (!result)    {        barGoLink bar(1);        bar.step();        sLog.outString();        sLog.outString(">> Loaded %u script definitions", count);        return;    }    barGoLink bar((int)result->GetRowCount());    do    {        bar.step();        Field *fields = result->Fetch();        ScriptInfo tmp;        tmp.id          = fields[0].GetUInt32();        tmp.delay       = fields[1].GetUInt32();        tmp.command     = fields[2].GetUInt32();        tmp.raw.data[0] = fields[3].GetUInt32();        tmp.raw.data[1] = fields[4].GetUInt32();        tmp.raw.data[2] = fields[5].GetUInt32();        tmp.raw.data[3] = fields[6].GetUInt32();        tmp.raw.data[4] = fields[7].GetUInt32();        tmp.raw.data[5] = fields[8].GetInt32();        tmp.raw.data[6] = fields[9].GetInt32();        tmp.raw.data[7] = fields[10].GetInt32();        tmp.raw.data[8] = fields[11].GetInt32();        tmp.x           = fields[12].GetFloat();        tmp.y           = fields[13].GetFloat();        tmp.z           = fields[14].GetFloat();        tmp.o           = fields[15].GetFloat();        // generic command args check        switch(tmp.command)        {            case SCRIPT_COMMAND_TALK:            {                if (tmp.talk.chatType > CHAT_TYPE_ZONE_YELL)                {                    sLog.outErrorDb("Table `%s` has invalid CHAT_TYPE_ (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.talk.chatType, tmp.id);                    continue;                }                if (tmp.talk.creatureEntry && !ObjectMgr::GetCreatureTemplate(tmp.talk.creatureEntry))                {                    sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_TALK for script id %u, but this creature_template does not exist.", tablename, tmp.talk.creatureEntry, tmp.id);                    continue;                }                if (tmp.talk.creatureEntry && !tmp.talk.searchRadius)                {                    sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_TALK for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.talk.creatureEntry, tmp.id, tmp.talk.searchRadius);                    continue;                }                if (!GetLanguageDescByID(tmp.talk.language))                {                    sLog.outErrorDb("Table `%s` has datalong4 = %u in SCRIPT_COMMAND_TALK for script id %u, but this language does not exist.", tablename, tmp.talk.language, tmp.id);                    continue;                }                if (tmp.talk.textId[0] == 0)                {                    sLog.outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.talk.textId[0], tmp.id);                    continue;                }                for(int i = 0; i < MAX_TEXT_ID; ++i)                {                    if (tmp.talk.textId[i] && (tmp.talk.textId[i] < MIN_DB_SCRIPT_STRING_ID || tmp.talk.textId[i] >= MAX_DB_SCRIPT_STRING_ID))                    {                        sLog.outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.talk.textId[i], MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID, tmp.id);                        continue;                    }                }                // if (!GetMangosStringLocale(tmp.dataint)) will be checked after db_script_string loading                break;            }            case SCRIPT_COMMAND_EMOTE:            {                if (!sEmotesStore.LookupEntry(tmp.emote.emoteId))                {                    sLog.outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", tablename, tmp.emote.emoteId, tmp.id);                    continue;                }                if (tmp.emote.creatureEntry && !ObjectMgr::GetCreatureTemplate(tmp.emote.creatureEntry))                {//.........这里部分代码省略.........
开发者ID:lastsmile,项目名称:mangos,代码行数:101,


示例5: 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(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");        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)){                TC_LOG_ERROR(LOG_FILTER_SQL, "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))        {            TC_LOG_ERROR(LOG_FILTER_SQL, "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)        {            TC_LOG_ERROR(LOG_FILTER_SQL, "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))            {                TC_LOG_ERROR(LOG_FILTER_SQL, "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;        //add the text into our entry's group        mTextMap[temp.entry][temp.group].push_back(temp);        ++textCount;    } while (result->NextRow());    TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));}
开发者ID:PavelDev,项目名称:wodnetcore,代码行数:74,


示例6: switch

void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data){    uint32 type;    uint32 lang;    switch (recv_data.GetOpcode())    {        case CMSG_MESSAGECHAT_SAY:          type = CHAT_MSG_SAY;            break;        case CMSG_MESSAGECHAT_YELL:         type = CHAT_MSG_YELL;           break;        case CMSG_MESSAGECHAT_CHANNEL:      type = CHAT_MSG_CHANNEL;        break;        case CMSG_MESSAGECHAT_WHISPER:      type = CHAT_MSG_WHISPER;        break;        case CMSG_MESSAGECHAT_GUILD:        type = CHAT_MSG_GUILD;          break;        case CMSG_MESSAGECHAT_OFFICER:      type = CHAT_MSG_OFFICER;        break;        case CMSG_MESSAGECHAT_AFK:          type = CHAT_MSG_AFK;            break;        case CMSG_MESSAGECHAT_DND:          type = CHAT_MSG_DND;            break;        case CMSG_MESSAGECHAT_EMOTE:        type = CHAT_MSG_EMOTE;          break;        case CMSG_MESSAGECHAT_PARTY:        type = CHAT_MSG_PARTY;          break;        case CMSG_MESSAGECHAT_RAID:         type = CHAT_MSG_RAID;           break;        case CMSG_MESSAGECHAT_BATTLEGROUND: type = CHAT_MSG_BATTLEGROUND;   break;        case CMSG_MESSAGECHAT_RAID_WARNING: type = CHAT_MSG_RAID_WARNING;   break;        default:            sLog.outError("HandleMessagechatOpcode : Unknown chat opcode (0x%X)", recv_data.GetOpcode());            recv_data.rfinish();            return;    }    // no language sent with emote packet.    if (type != CHAT_MSG_EMOTE && type != CHAT_MSG_AFK && type != CHAT_MSG_DND)    {        recv_data >> lang;        // prevent talking at unknown language (cheating)        LanguageDesc const* langDesc = GetLanguageDescByID(lang);        if (!langDesc)        {            SendNotification(LANG_UNKNOWN_LANGUAGE);            return;        }        if (langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))        {            // also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)            Unit::AuraList const& langAuras = _player->GetAurasByType(SPELL_AURA_COMPREHEND_LANGUAGE);            bool foundAura = false;            for (Unit::AuraList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)            {                if ((*i)->GetModifier()->m_miscvalue == int32(lang))                {                    foundAura = true;                    break;                }            }            if (!foundAura)            {                SendNotification(LANG_NOT_LEARNED_LANGUAGE);                return;            }        }        if (lang == LANG_ADDON)        {            // Disabled addon channel?            if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))                return;        }        // LANG_ADDON should not be changed nor be affected by flood control        else        {            // send in universal language if player in .gmon mode (ignore spell effects)            if (_player->isGameMaster())                lang = LANG_UNIVERSAL;            else            {                // send in universal language in two side iteration allowed mode                if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT))                    lang = LANG_UNIVERSAL;                else                {                    switch (type)                    {                        case CHAT_MSG_PARTY:                        case CHAT_MSG_PARTY_LEADER:                        case CHAT_MSG_RAID:                        case CHAT_MSG_RAID_LEADER:                        case CHAT_MSG_RAID_WARNING:                            // allow two side chat at group channel if two side group allowed                            if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP))                                lang = LANG_UNIVERSAL;                            break;                        case CHAT_MSG_GUILD:                        case CHAT_MSG_OFFICER:                            // allow two side chat at guild channel if two side guild allowed                            if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD))                                lang = LANG_UNIVERSAL;                            break;                    }                }                // but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)                Unit::AuraList const& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE);                if (!ModLangAuras.empty())//.........这里部分代码省略.........
开发者ID:Calixa,项目名称:mangos-cata,代码行数:101,


示例7: 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,


示例8: GetPlayer

void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData){    uint32 type;    uint32 lang;    recvData >> type;    recvData >> lang;    if (type >= MAX_CHAT_MSG_TYPE)    {        sLog->outError("CHAT: Wrong message type received: %u", type);        recvData.rfinish();        return;    }    Player* sender = GetPlayer();    //sLog->outDebug("CHAT: packet received. type %u, lang %u", type, lang);    // pussywizard: chatting on most chat types requires 2 hours played to prevent spam/abuse    if (AccountMgr::IsPlayerAccount(GetSecurity()))        switch (type)        {        case CHAT_MSG_ADDON:        case CHAT_MSG_PARTY:        case CHAT_MSG_RAID:        case CHAT_MSG_GUILD:        case CHAT_MSG_OFFICER:        case CHAT_MSG_AFK:        case CHAT_MSG_DND:        case CHAT_MSG_RAID_LEADER:        case CHAT_MSG_RAID_WARNING:        case CHAT_MSG_BATTLEGROUND:        case CHAT_MSG_BATTLEGROUND_LEADER:        case CHAT_MSG_PARTY_LEADER:            break;        default:            if (sender->GetTotalPlayedTime() < 2*HOUR)            {                SendNotification("Speaking is allowed after playing for at least 2 hours. You may use party and guild chat.");                recvData.rfinish();                return;            }        }    // pussywizard:    switch (type)    {    case CHAT_MSG_SAY:    case CHAT_MSG_YELL:    case CHAT_MSG_EMOTE:    case CHAT_MSG_TEXT_EMOTE:    case CHAT_MSG_AFK:    case CHAT_MSG_DND:        if (sender->IsSpectator())        {            recvData.rfinish();            return;        }    }    // prevent talking at unknown language (cheating)    LanguageDesc const* langDesc = GetLanguageDescByID(lang);    if (!langDesc)    {        SendNotification(LANG_UNKNOWN_LANGUAGE);        recvData.rfinish();        return;    }    if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id))    {        // also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)        Unit::AuraEffectList const& langAuras = sender->GetAuraEffectsByType(SPELL_AURA_COMPREHEND_LANGUAGE);        bool foundAura = false;        for (Unit::AuraEffectList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)        {            if ((*i)->GetMiscValue() == int32(lang))            {                foundAura = true;                break;            }        }        if (!foundAura)        {            SendNotification(LANG_NOT_LEARNED_LANGUAGE);            recvData.rfinish();            return;        }    }    if (lang == LANG_ADDON)    {        // LANG_ADDON is only valid for the following message types        switch (type)        {        case CHAT_MSG_PARTY:        case CHAT_MSG_RAID:        case CHAT_MSG_GUILD:        case CHAT_MSG_BATTLEGROUND:        case CHAT_MSG_WHISPER://.........这里部分代码省略.........
开发者ID:yyhhrr,项目名称:SunWellCore,代码行数:101,


示例9: switch

void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData){    uint32 type;    uint32 lang;    recvData >> type;    recvData >> lang;	if (sWorld->getBoolConfig(BATTLEGROUND_CROSSFACTION_ENABLED) && lang != LANG_ADDON)    {        switch (type)        {        case CHAT_MSG_BATTLEGROUND:        case CHAT_MSG_BATTLEGROUND_LEADER:            lang = LANG_UNIVERSAL;        default:            break;        }    }    if (type >= MAX_CHAT_MSG_TYPE)    {        TC_LOG_ERROR("network", "CHAT: Wrong message type received: %u", type);        recvData.rfinish();        return;    }    if (lang == LANG_UNIVERSAL && type != CHAT_MSG_AFK && type != CHAT_MSG_DND)    {        TC_LOG_ERROR("network", "CMSG_MESSAGECHAT: Possible hacking-attempt: %s tried to send a message in universal language", GetPlayerInfo().c_str());        SendNotification(LANG_UNKNOWN_LANGUAGE);        recvData.rfinish();        return;    }    Player* sender = GetPlayer();    //TC_LOG_DEBUG("CHAT: packet received. type %u, lang %u", type, lang);    // prevent talking at unknown language (cheating)    LanguageDesc const* langDesc = GetLanguageDescByID(lang);    if (!langDesc)    {        SendNotification(LANG_UNKNOWN_LANGUAGE);        recvData.rfinish();        return;    }    if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id))    {        // also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)        Unit::AuraEffectList const& langAuras = sender->GetAuraEffectsByType(SPELL_AURA_COMPREHEND_LANGUAGE);        bool foundAura = false;        for (Unit::AuraEffectList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)        {            if ((*i)->GetMiscValue() == int32(lang))            {                foundAura = true;                break;            }        }        if (!foundAura)        {            SendNotification(LANG_NOT_LEARNED_LANGUAGE);            recvData.rfinish();            return;        }    }    if (lang == LANG_ADDON)    {        // LANG_ADDON is only valid for the following message types        switch (type)        {            case CHAT_MSG_PARTY:            case CHAT_MSG_RAID:            case CHAT_MSG_GUILD:            case CHAT_MSG_BATTLEGROUND:            case CHAT_MSG_WHISPER:                // check if addon messages are disabled                if (!sWorld->getBoolConfig(CONFIG_ADDON_CHANNEL))                {                    recvData.rfinish();                    return;                }                break;            default:                TC_LOG_ERROR("network", "Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination",                                                     GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());                recvData.rfinish();                return;        }    }    // LANG_ADDON should not be changed nor be affected by flood control    else    {        // send in universal language if player in .gmon mode (ignore spell effects)        if (sender->IsGameMaster())            lang = LANG_UNIVERSAL;//.........这里部分代码省略.........
开发者ID:treetrees,项目名称:ATN-Core,代码行数:101,


示例10: GetPlayer

void WorldSession::HandleChatMessage(ChatMsg type, uint32 lang, std::string msg, std::string target /*= ""*/){    Player* sender = GetPlayer();    if (lang == LANG_UNIVERSAL && type != CHAT_MSG_EMOTE)    {        TC_LOG_ERROR("network", "CMSG_MESSAGECHAT: Possible hacking-attempt: %s tried to send a message in universal language", GetPlayerInfo().c_str());        SendNotification(LANG_UNKNOWN_LANGUAGE);        return;    }    // prevent talking at unknown language (cheating)    LanguageDesc const* langDesc = GetLanguageDescByID(lang);    if (!langDesc)    {        SendNotification(LANG_UNKNOWN_LANGUAGE);        return;    }    if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id))    {        // also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)        Unit::AuraEffectList const& langAuras = sender->GetAuraEffectsByType(SPELL_AURA_COMPREHEND_LANGUAGE);        bool foundAura = false;        for (Unit::AuraEffectList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)        {            if ((*i)->GetMiscValue() == int32(lang))            {                foundAura = true;                break;            }        }        if (!foundAura)        {            SendNotification(LANG_NOT_LEARNED_LANGUAGE);            return;        }    }    // send in universal language if player in .gm on mode (ignore spell effects)    if (sender->IsGameMaster())        lang = LANG_UNIVERSAL;    else    {        // send in universal language in two side iteration allowed mode        if (HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHAT))            lang = LANG_UNIVERSAL;        else        {            switch (type)            {                case CHAT_MSG_PARTY:                case CHAT_MSG_RAID:                case CHAT_MSG_RAID_WARNING:                    // allow two side chat at group channel if two side group allowed                    if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))                        lang = LANG_UNIVERSAL;                    break;                case CHAT_MSG_GUILD:                case CHAT_MSG_OFFICER:                    // allow two side chat at guild channel if two side guild allowed                    if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))                        lang = LANG_UNIVERSAL;                    break;                default:                    break;            }        }        // but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)        Unit::AuraEffectList const& ModLangAuras = sender->GetAuraEffectsByType(SPELL_AURA_MOD_LANGUAGE);        if (!ModLangAuras.empty())            lang = ModLangAuras.front()->GetMiscValue();    }    if (!sender->CanSpeak())    {        std::string timeStr = secsToTimeString(m_muteTime - time(NULL));        SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());        return;    }    if (sender->HasAura(GM_SILENCE_AURA) && type != CHAT_MSG_WHISPER)    {        SendNotification(GetTrinityString(LANG_GM_SILENCE), sender->GetName().c_str());        return;    }    if (msg.empty())        return;    if (ChatHandler(this).ParseCommands(msg.c_str()))        return;    // Strip invisible characters for non-addon messages    if (sWorld->getBoolConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))        stripLineInvisibleChars(msg);    if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && !ChatHandler(this).isValidChatMessage(msg.c_str()))    {//.........这里部分代码省略.........
开发者ID:Jildor,项目名称:TrinityCore,代码行数:101,


示例11: getMSTime

void CreatureTextMgr::LoadCreatureTexts(){    uint32 oldMSTime = getMSTime();    mTextMap.clear(); // for reload case    //all currently used temp texts are NOT reset    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.creatureId      = fields[0].GetUInt32();        temp.groupId         = 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.BroadcastTextId = fields[10].GetUInt32();        temp.TextRange       = CreatureTextRange(fields[11].GetUInt8());        if (temp.sound)        {            if (!sSoundEntriesStore.LookupEntry(temp.sound))            {                TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Sound %u but sound does not exist.", temp.creatureId, temp.groupId, temp.sound);                temp.sound = 0;            }        }        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.creatureId, temp.groupId, 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.creatureId, temp.groupId, uint32(temp.type));            temp.type = CHAT_MSG_SAY;        }        if (temp.emote)        {            if (!sEmotesStore.LookupEntry(temp.emote))            {                TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Emote %u but emote does not exist.", temp.creatureId, temp.groupId, uint32(temp.emote));                temp.emote = EMOTE_ONESHOT_NONE;            }        }        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.creatureId, temp.groupId, 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.creatureId, temp.groupId, temp.id, temp.TextRange);            temp.TextRange = TEXT_RANGE_NORMAL;        }        // add the text into our entry's group        mTextMap[temp.creatureId][temp.groupId].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:ElunaLuaEngine,项目名称:ElunaTrinityWotlk,代码行数:91,


示例12: CHECK_PACKET_SIZE

void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ){    CHECK_PACKET_SIZE(recv_data,4+4+1);    uint32 type;    uint32 lang;    recv_data >> type;    recv_data >> lang;    //sLog.outDebug("CHAT: packet received. type %u, lang %u", type, lang );    // prevent talking at unknown language (cheating)    LanguageDesc const* langDesc = GetLanguageDescByID(lang);    if(!langDesc || langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))    {        SendNotification("Unknown language");        return;    }    // send in universal language if player in .gmon mode (ignore spell effects)    if (_player->isGameMaster())        lang = LANG_UNIVERSAL;    else    {        // send in universal language in two side iteration allowed mode        if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) || _player->isGameMaster())            lang = LANG_UNIVERSAL;        // but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)        Unit::AuraList& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE);        if(!ModLangAuras.empty())            lang = ModLangAuras.front()->GetModifier()->m_miscvalue;    }    if (!_player->CanSpeak())    {        std::string timeStr = secsToTimeString(m_muteTime - time(NULL));        SendNotification(LANG_WAIT_BEFORE_SPEAKING,timeStr.c_str());        return;    }    switch(type)    {        case CHAT_MSG_SAY:        case CHAT_MSG_EMOTE:        case CHAT_MSG_YELL:        {            std::string msg = "";            recv_data >> msg;            if (sChatHandler.ParseCommands(msg.c_str(), this) > 0)                break;            if(type == CHAT_MSG_SAY)            {                GetPlayer()->Say(msg, lang);                GetPlayer()->UpdateSpeakTime();            }            else if(type == CHAT_MSG_EMOTE)            {                GetPlayer()->TextEmote(msg);                GetPlayer()->UpdateSpeakTime();            }            else if(type == CHAT_MSG_YELL)            {                GetPlayer()->Yell(msg, lang);                GetPlayer()->UpdateSpeakTime();            }        } break;        case CHAT_MSG_WHISPER:        {            std::string to, msg;            recv_data >> to;            CHECK_PACKET_SIZE(recv_data,4+4+(to.size()+1)+1);            recv_data >> msg;            if(to.size() == 0)            {                WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, (to.size()+1));                data<<to;                SendPacket(&data);                break;            }            normalizePlayerName(to);            Player *player = objmgr.GetPlayer(to.c_str());            uint32 tSecurity = GetSecurity();            uint32 pSecurity = player ? player->GetSession()->GetSecurity() : 0;            if(!player || tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers())            {                WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, (to.size()+1));                data<<to;                SendPacket(&data);                return;            }            if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && tSecurity == SEC_PLAYER && pSecurity == SEC_PLAYER )            {                uint32 sidea = GetPlayer()->GetTeam();                uint32 sideb = player->GetTeam();//.........这里部分代码省略.........
开发者ID:Artea,项目名称:mangos-svn,代码行数:101,


示例13: switch

//.........这里部分代码省略.........            type = CHAT_MSG_RAID_WARNING;            break;        default:            TC_LOG_ERROR("network", "HandleMessagechatOpcode : Unknown chat opcode (%u)", recvData.GetOpcode());            recvData.hexlike();            return;    }    if (type >= MAX_CHAT_MSG_TYPE)    {        TC_LOG_ERROR("network", "CHAT: Wrong message type received: %u", type);        recvData.rfinish();        return;    }    Player* sender = GetPlayer();    //TC_LOG_DEBUG("misc", "CHAT: packet received. type %u, lang %u", type, lang);    // no language sent with emote packet.    if (type != CHAT_MSG_EMOTE && type != CHAT_MSG_AFK && type != CHAT_MSG_DND)    {        recvData >> lang;        if (lang == LANG_UNIVERSAL)        {            TC_LOG_ERROR("network", "CMSG_MESSAGECHAT: Possible hacking-attempt: %s tried to send a message in universal language", GetPlayerInfo().c_str());            SendNotification(LANG_UNKNOWN_LANGUAGE);            recvData.rfinish();            return;        }        // prevent talking at unknown language (cheating)        LanguageDesc const* langDesc = GetLanguageDescByID(lang);        if (!langDesc)        {            SendNotification(LANG_UNKNOWN_LANGUAGE);            recvData.rfinish();            return;        }        if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id))        {            // also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)            Unit::AuraEffectList const& langAuras = sender->GetAuraEffectsByType(SPELL_AURA_COMPREHEND_LANGUAGE);            bool foundAura = false;            for (Unit::AuraEffectList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)            {                if ((*i)->GetMiscValue() == int32(lang))                {                    foundAura = true;                    break;                }            }            if (!foundAura)            {                SendNotification(LANG_NOT_LEARNED_LANGUAGE);                recvData.rfinish();                return;            }        }        if (lang == LANG_ADDON)        {            // LANG_ADDON is only valid for the following message types            switch (type)
开发者ID:redlaine,项目名称:InfinityCore-Ark,代码行数:67,


示例14: LoadTrinityStrings

void SystemMgr::LoadScriptTextsCustom(){    sLog->outString("TSCR: Loading Custom Texts...");    LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3));    sLog->outString("TSCR: Loading Custom Texts additional data...");    QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts");    if (!result)    {        sLog->outString(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");        sLog->outString();        return;    }    uint32 uiCount = 0;    do    {        Field* pFields = result->Fetch();        StringTextData temp;        int32 iId             = pFields[0].GetInt32();        temp.uiSoundId        = pFields[1].GetUInt32();        temp.uiType           = pFields[2].GetUInt8();        temp.uiLanguage       = pFields[3].GetUInt8();        temp.uiEmote          = pFields[4].GetUInt16();        if (iId >= 0)        {            sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId);            continue;        }        if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3)        {            sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId);            continue;        }        if (temp.uiSoundId)        {            if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId))                sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId);        }        if (!GetLanguageDescByID(temp.uiLanguage))            sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage);        if (temp.uiType > CHAT_TYPE_ZONE_YELL)            sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType);        m_mTextDataMap[iId] = temp;        ++uiCount;    }    while (result->NextRow());    sLog->outString(">> Loaded %u additional Custom Texts data.", uiCount);    sLog->outString();}
开发者ID:4m1g0,项目名称:TrinityCore,代码行数:61,


示例15: LoadFrenchCOREStrings

void SystemMgr::LoadScriptTexts() {	sLog->outString("TSCR: Loading Script Texts...");	LoadFrenchCOREStrings("script_texts", TEXT_SOURCE_RANGE,			1 + (TEXT_SOURCE_RANGE * 2));	sLog->outString("TSCR: Loading Script Texts additional data...");	uint32 oldMSTime = getMSTime();	QueryResult result = WorldDatabase.Query(			"SELECT entry, sound, type, language, emote FROM script_texts");	if (!result) {		sLog->outString(				">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");		sLog->outString();		return;	}	uint32 uiCount = 0;	do {		Field* pFields = result->Fetch();		StringTextData pTemp;		int32 iId = pFields[0].GetInt32();		pTemp.uiSoundId = pFields[1].GetUInt32();		pTemp.uiType = pFields[2].GetUInt32();		pTemp.uiLanguage = pFields[3].GetUInt32();		pTemp.uiEmote = pFields[4].GetUInt32();		if (iId >= 0) {			sLog->outErrorDb(					"TSCR: Entry %i in table `script_texts` is not a negative value.",					iId);			continue;		}		if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE * 2) {			sLog->outErrorDb(					"TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.",					iId);			continue;		}		if (pTemp.uiSoundId) {			if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId))				sLog->outErrorDb(						"TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.",						iId, pTemp.uiSoundId);		}		if (!GetLanguageDescByID(pTemp.uiLanguage))			sLog->outErrorDb(					"TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.",					iId, pTemp.uiLanguage);		if (pTemp.uiType > CHAT_TYPE_ZONE_YELL)			sLog->outErrorDb(					"TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.",					iId, pTemp.uiType);		m_mTextDataMap[iId] = pTemp;		++uiCount;	} while (result->NextRow());	sLog->outString(">> Loaded %u additional Script Texts data in %u ms",			uiCount, GetMSTimeDiffToNow(oldMSTime));	sLog->outString();}
开发者ID:FrenchCORE,项目名称:OLD_FrenchCORE,代码行数:69,


示例16: outstring_log

void SystemMgr::LoadScriptTexts(){    outstring_log("SD2: Loading Script Texts...");    LoadMangosStrings(SD2Database, "script_texts", TEXT_SOURCE_TEXT_START, TEXT_SOURCE_TEXT_END);    QueryResult* pResult = SD2Database.PQuery("SELECT entry, sound, type, language, emote FROM script_texts WHERE entry BETWEEN %i AND %i", TEXT_SOURCE_GOSSIP_END, TEXT_SOURCE_TEXT_START);    outstring_log("SD2: Loading Script Texts additional data...");    if (pResult)    {        BarGoLink bar(pResult->GetRowCount());        uint32 uiCount = 0;        do        {            bar.step();            Field* pFields = pResult->Fetch();            StringTextData pTemp;            int32 iId           = pFields[0].GetInt32();            pTemp.uiSoundId     = pFields[1].GetUInt32();            pTemp.uiType        = pFields[2].GetUInt32();            pTemp.uiLanguage    = pFields[3].GetUInt32();            pTemp.uiEmote       = pFields[4].GetUInt32();            if (iId >= 0)            {                error_db_log("SD2: Entry %i in table `script_texts` is not a negative value.", iId);                continue;            }            if (pTemp.uiSoundId)            {                if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId))                    error_db_log("SD2: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId);            }            if (!GetLanguageDescByID(pTemp.uiLanguage))                error_db_log("SD2: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage);            if (pTemp.uiType > CHAT_TYPE_ZONE_YELL)                error_db_log("SD2: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType);            m_mTextDataMap[iId] = pTemp;            ++uiCount;        }        while (pResult->NextRow());        delete pResult;        outstring_log("");        outstring_log(">> Loaded %u additional Script Texts data.", uiCount);    }    else    {        BarGoLink bar(1);        bar.step();        outstring_log("");        outstring_log(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");    }}
开发者ID:Calixa,项目名称:scripts,代码行数:62,


示例17: outstring_log

void SystemMgr::LoadScriptTextsCustom(){    outstring_log("TSCR: Loading Custom Texts...");    LoadTrinityStrings(WorldDatabase,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3));    QueryResult_AutoPtr Result = WorldDatabase.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts");    outstring_log("TSCR: Loading Custom Texts additional data...");    if (Result)    {        barGoLink bar(Result->GetRowCount());        uint32 uiCount = 0;        do        {            bar.step();            Field* pFields = Result->Fetch();            StringTextData pTemp;            int32 iId              = pFields[0].GetInt32();            pTemp.uiSoundId        = pFields[1].GetUInt32();            pTemp.uiType           = pFields[2].GetUInt32();            pTemp.uiLanguage       = pFields[3].GetUInt32();            pTemp.uiEmote          = pFields[4].GetUInt32();            if (iId >= 0)            {                error_db_log("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId);                continue;            }            if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3)            {                error_db_log("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId);                continue;            }            if (pTemp.uiSoundId)            {                if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId))                    error_db_log("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId);            }            if (!GetLanguageDescByID(pTemp.uiLanguage))                error_db_log("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage);            if (pTemp.uiType > CHAT_TYPE_ZONE_YELL)                error_db_log("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType);            m_mTextDataMap[iId] = pTemp;            ++uiCount;        } while (Result->NextRow());        outstring_log("");        outstring_log(">> Loaded %u additional Custom Texts data.", uiCount);    }    else    {        barGoLink bar(1);        bar.step();        outstring_log("");        outstring_log(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");    }}
开发者ID:Elevim,项目名称:RG-332,代码行数:65,


示例18: GetPlayer

void ClientSession::HandleMessagechatOpcode(WorldPacket & recv_data){    uint32 type;    uint32 lang;    recv_data >> type;    recv_data >> lang;    if (type >= MAX_CHAT_MSG_TYPE)    {        sLog->outError("CHAT: Wrong message type received: %u", type);        recv_data.rfinish();        return;    }    Player* sender = GetPlayer();    // prevent talking at unknown language (cheating)    LanguageDesc const* langDesc = GetLanguageDescByID(lang);    if (!langDesc)    {        SendNotification(LANG_UNKNOWN_LANGUAGE);        recv_data.rfinish();        return;    }    bool ignoreChecks = false;    if (lang == LANG_ADDON)    {        // LANG_ADDON is only valid for the following message types        switch (type)        {            case CHAT_MSG_PARTY:            case CHAT_MSG_RAID:            case CHAT_MSG_GUILD:            case CHAT_MSG_BATTLEGROUND:            case CHAT_MSG_WHISPER:                ignoreChecks = true;                break;            default:                sLog->outError("Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination",                    GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());                recv_data.rfinish();                return;        }    }    std::string to, channel, msg, temp;    switch (type)    {        case CHAT_MSG_SAY:        case CHAT_MSG_EMOTE:        case CHAT_MSG_YELL:        case CHAT_MSG_PARTY:        case CHAT_MSG_PARTY_LEADER:        case CHAT_MSG_GUILD:        case CHAT_MSG_OFFICER:        case CHAT_MSG_RAID:        case CHAT_MSG_RAID_LEADER:        case CHAT_MSG_RAID_WARNING:        case CHAT_MSG_BATTLEGROUND:        case CHAT_MSG_BATTLEGROUND_LEADER:            recv_data >> msg;            break;        case CHAT_MSG_WHISPER:            recv_data >> to;            recv_data >> msg;            break;        case CHAT_MSG_CHANNEL:            recv_data >> channel;            recv_data >> msg;            break;        case CHAT_MSG_AFK:        case CHAT_MSG_DND:            recv_data >> msg;            if (checkMsgForCommand(msg, recv_data) || checkMsgForMute(sender, recv_data))                return;            ignoreChecks = true;            break;    }    if (!ignoreChecks)    {        if (msg.empty())            return;        if (checkMsgForCommand(msg, recv_data) || checkMsgForMute(sender, recv_data))        {            if (!AccountMgr::IsVIPorPlayer(GetSecurity()))            {                /*if (Player* pPlayer = sender->GetSelectedPlayer())                    sGMQualityManager->OnGMChat(CHAT_MSG_SYSTEM, sender, msg, pPlayer->GetName());                else*/                    sGMQualityManager->OnGMChat(CHAT_MSG_SYSTEM, sender, msg);            }            return;        }        StripLineInvisibleChars(msg);//.........这里部分代码省略.........
开发者ID:Allowed,项目名称:Strawberry335,代码行数:101,



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


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