コード例 #1
0
void SystemMgr::LoadScriptTextsCustom()
{
    sLog->outString("TSCR: Loading Custom Texts...");
    LoadSkyFireStrings("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* fields = result->Fetch();
        StringTextData temp;

        int32 iId           = fields[0].GetInt32();
        temp.SoundId        = fields[1].GetUInt32();
        temp.Type           = fields[2].GetUInt32();
        temp.Language       = fields[3].GetUInt32();
        temp.Emote          = fields[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.SoundId)
        {
            if (!sSoundEntriesStore.LookupEntry(temp.SoundId))
                sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.SoundId);
        }

        if (!GetLanguageDescByID(temp.Language))
            sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, temp.Language);

        if (temp.Type > 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.Type);

        m_mTextDataMap[iId] = temp;
        ++uiCount;
    } while (result->NextRow());

    sLog->outString(">> Loaded %u additional Custom Texts data.", uiCount);
    sLog->outString();
}
コード例 #2
0
ファイル: ScriptSystem.cpp プロジェクト: Maczuga/SkyFire_one
void SystemMgr::LoadScriptTexts()
{
    sLog->outString("TSCR: Loading Script Texts...");
    LoadSkyFireStrings(WorldDatabase, "script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2));

    QueryResult_AutoPtr Result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts");

    sLog->outString("TSCR: Loading Script Texts additional data...");

    if (Result)
    {
        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("");
        sLog->outString(">> Loaded %u additional Script Texts data.", uiCount);
    }
    else
    {
        sLog->outString("");
        sLog->outString(">> Loaded 0 additional Script Texts data. DB table script_texts is empty.");
    }
}