예제 #1
0
        public override String GetSQLRequest()
        {
            String returnSql = "";

            if (m_data.id == 0 || isError)
            {
                return(returnSql);
            }

            if (IsCheckboxChecked("locale"))
            {
                LocaleConstant localeIndex = (LocaleConstant)Properties.Settings.Default.localIndex;

                if (localeIndex != 0)
                {
                    m_gameobjectLocalesBuilder = new SqlBuilder("gameobject_template_locale", "entry");
                    m_gameobjectLocalesBuilder.SetFieldsNames("locale", "name");

                    m_gameobjectLocalesBuilder.AppendFieldsValue(m_data.id, localeIndex.ToString(), m_data.name);
                    returnSql += m_gameobjectLocalesBuilder.ToString() + "\n";
                }
                else
                {
                    m_gameobjectLocalesBuilder = new SqlBuilder("gameobject_template", "entry");
                    m_gameobjectLocalesBuilder.SetFieldsNames("name");

                    m_gameobjectLocalesBuilder.AppendFieldsValue(m_data.id, m_data.name);
                    returnSql += m_gameobjectLocalesBuilder.ToString() + "\n";
                }
            }

            if (IsCheckboxChecked("loot") && m_gameobjectLootDatas != null)
            {
                m_gameobjectLootBuilder = new SqlBuilder("gameobject_loot_template", "entry", SqlQueryType.DeleteInsert);
                m_gameobjectLootBuilder.SetFieldsNames("Item", "Reference", "Chance", "QuestRequired", "LootMode", "GroupId", "MinCount", "MaxCount", "Comment");

                returnSql += "UPDATE gameobject_template SET data1 = " + m_data.id + " WHERE entry = " + m_data.id + " AND type IN (3, 50);\n";
                foreach (GameObjectLootParsing gameobjectLootData in m_gameobjectLootDatas)
                {
                    GameObjectLootCurrencyParsing currentLootCurrencyData = null;
                    try
                    {
                        currentLootCurrencyData = (GameObjectLootCurrencyParsing)gameobjectLootData;
                    }
                    catch (Exception ex) { }

                    int idMultiplier = currentLootCurrencyData != null ? -1 : 1;

                    if (idMultiplier < 1)
                    {
                        continue;
                    }

                    int minLootCount = gameobjectLootData.stack.Length >= 1 ? gameobjectLootData.stack[0] : 1;
                    int maxLootCount = gameobjectLootData.stack.Length >= 2 ? gameobjectLootData.stack[1] : minLootCount;


                    m_gameobjectLootBuilder.AppendFieldsValue(m_data.id,                            // Entry
                                                              gameobjectLootData.id * idMultiplier, // Item
                                                              0,                                    // Reference
                                                              gameobjectLootData.percent,           // Chance
                                                              gameobjectLootData.questRequired,     // QuestRequired
                                                              1,                                    // LootMode
                                                              0,                                    // GroupId
                                                              minLootCount,                         // MinCount
                                                              maxLootCount,                         // MaxCount
                                                              "");                                  // Comment
                }

                returnSql += m_gameobjectLootBuilder.ToString() + "\n";
            }

            if (IsCheckboxChecked("herbalism") && m_gameobjectHerbalismDatas != null)
            {
                m_gameobjectHerbalismBuilder = new SqlBuilder("gameobject_loot_template", "entry", SqlQueryType.InsertIgnore);
                m_gameobjectHerbalismBuilder.SetFieldsNames("Item", "Reference", "Chance", "QuestRequired", "LootMode", "GroupId", "MinCount", "MaxCount", "Comment");

                returnSql += "UPDATE gameobject_template SET data1 = " + m_data.id + " WHERE entry = " + m_data.id + " AND type IN (3, 50);\n";
                foreach (GameObjectLootParsing gameobjectHerbalismData in m_gameobjectHerbalismDatas)
                {
                    m_gameobjectHerbalismBuilder.AppendFieldsValue(m_data.id,                        // Entry
                                                                   gameobjectHerbalismData.id,       // Item
                                                                   0,                                // Reference
                                                                   gameobjectHerbalismData.percent,  // Chance
                                                                   0,                                // QuestRequired
                                                                   1,                                // LootMode
                                                                   0,                                // GroupId
                                                                   gameobjectHerbalismData.stack[0], // MinCount
                                                                   gameobjectHerbalismData.stack[1], // MaxCount
                                                                   "");                              // Comment
                }
                returnSql += m_gameobjectHerbalismBuilder.ToString() + "\n";
            }

            if (IsCheckboxChecked("mining") && m_gameobjectMiningDatas != null)
            {
                m_gameobjectMiningBuilder = new SqlBuilder("gameobject_loot_template", "entry", SqlQueryType.InsertIgnore);
                m_gameobjectMiningBuilder.SetFieldsNames("Item", "Reference", "Chance", "QuestRequired", "LootMode", "GroupId", "MinCount", "MaxCount", "Comment");

                returnSql += "UPDATE gameobject_template SET data1 = " + m_data.id + " WHERE entry = " + m_data.id + " AND type IN (3, 50);\n";
                foreach (GameObjectLootParsing gameobjectMiningData in m_gameobjectMiningDatas)
                {
                    m_gameobjectMiningBuilder.AppendFieldsValue(m_data.id,                     // Entry
                                                                gameobjectMiningData.id,       // Item
                                                                0,                             // Reference
                                                                gameobjectMiningData.percent,  // Chance
                                                                0,                             // QuestRequired
                                                                1,                             // LootMode
                                                                0,                             // GroupId
                                                                gameobjectMiningData.stack[0], // MinCount
                                                                gameobjectMiningData.stack[1], // MaxCount
                                                                "");                           // Comment
                }
                returnSql += m_gameobjectMiningBuilder.ToString() + "\n";
            }

            return(returnSql);
        }
예제 #2
0
        public override String GetSQLRequest()
        {
            String returnSql = "";

            if (m_creatureTemplateData.id == 0 || isError)
            {
                return(returnSql);
            }

            // Creature Template
            if (IsCheckboxChecked("template"))
            {
                m_creatureTemplateBuilder = new SqlBuilder("creature_template", "entry");
                m_creatureTemplateBuilder.SetFieldsNames("minlevel", "maxlevel", "name", "subname", "modelid1", "rank", "type", "family");

                m_creatureTemplateBuilder.AppendFieldsValue(m_creatureTemplateData.id, m_creatureTemplateData.minlevel, m_creatureTemplateData.maxlevel, m_creatureTemplateData.name, m_subname ?? "", m_modelid, m_isBoss ? "3" : "0", m_creatureTemplateData.type, m_creatureTemplateData.family);
                returnSql += m_creatureTemplateBuilder.ToString() + "\n";
            }

            if (IsCheckboxChecked("health modifier") && m_creatureTemplateData.health != null)
            {
                SqlBuilder builder = new SqlBuilder("creature_template", "entry", SqlQueryType.Update);
                builder.SetFieldsNames("HealthModifier");

                String healthModifier = Tools.GetHealthModifier(float.Parse(m_creatureTemplateData.health), 6, m_creatureTemplateData.minlevel, 1);

                builder.AppendFieldsValue(m_creatureTemplateData.id, healthModifier);
                returnSql += builder.ToString() + "\n";
            }

            // faction
            if (IsCheckboxChecked("simple faction"))
            {
                SqlBuilder m_creatureFactionBuilder = new SqlBuilder("creature_template", "entry", SqlQueryType.Update);
                m_creatureFactionBuilder.SetFieldsNames("faction");

                m_creatureFactionBuilder.AppendFieldsValue(m_creatureTemplateData.id, m_faction);
                returnSql += m_creatureFactionBuilder.ToString() + "\n";
            }

            // Creature Template
            if (IsCheckboxChecked("money"))
            {
                SqlBuilder m_creatureMoneyBuilder = new SqlBuilder("creature_template", "entry", SqlQueryType.Update);
                m_creatureMoneyBuilder.SetFieldsNames("mingold", "maxgold");

                m_creatureMoneyBuilder.AppendFieldsValue(m_creatureTemplateData.id, m_creatureTemplateData.minGold, m_creatureTemplateData.maxGold);
                returnSql += m_creatureMoneyBuilder.ToString() + "\n";
            }

            // Locales
            if (IsCheckboxChecked("locale"))
            {
                LocaleConstant localeIndex = (LocaleConstant)Properties.Settings.Default.localIndex;

                String localeName = localeIndex.ToString();

                if (localeIndex != 0)
                {
                    m_creatureLocalesBuilder = new SqlBuilder("creature_template_locales", "entry");
                    m_creatureLocalesBuilder.SetFieldsNames("locale", "Name", "Title");

                    m_creatureLocalesBuilder.AppendFieldsValue(m_creatureTemplateData.id, localeIndex.ToString(), m_creatureTemplateData.name, m_subname ?? "");
                    returnSql += m_creatureLocalesBuilder.ToString() + "\n";
                }
                else
                {
                    m_creatureLocalesBuilder = new SqlBuilder("creature_template", "entry");
                    m_creatureLocalesBuilder.SetFieldsNames("name", "subname");

                    m_creatureLocalesBuilder.AppendFieldsValue(m_creatureTemplateData.id, m_creatureTemplateData.name, m_subname ?? "");
                    returnSql += m_creatureLocalesBuilder.ToString() + "\n";
                }
            }

            if (IsCheckboxChecked("vendor") && m_npcVendorDatas != null)
            {
                m_npcVendorBuilder = new SqlBuilder("npc_vendor", "entry", SqlQueryType.DeleteInsert);
                m_npcVendorBuilder.SetFieldsNames("slot", "item", "maxcount", "incrtime", "ExtendedCost", "type", "PlayerConditionID");

                foreach (NpcVendorParsing npcVendorData in m_npcVendorDatas)
                {
                    m_npcVendorBuilder.AppendFieldsValue(m_creatureTemplateData.id, npcVendorData.slot, npcVendorData.id, npcVendorData.avail, npcVendorData.incrTime, npcVendorData.integerExtendedCost, 1, 0);
                }

                returnSql += m_npcVendorBuilder.ToString() + "\n";
            }

            if (IsCheckboxChecked("loot") && m_creatureLootDatas != null)
            {
                bool referenceAdded   = false;
                int  maxReferenceLoot = 2; // A voir si on peut trouver

                int templateEntry = m_creatureTemplateData.id;
                m_creatureLootBuilder = new SqlBuilder("creature_loot_template", "entry", SqlQueryType.DeleteInsert);
                m_creatureLootBuilder.SetFieldsNames("Item", "Reference", "Chance", "QuestRequired", "LootMode", "GroupId", "MinCount", "MaxCount", "Comment");

                m_creatureReferenceLootBuilder = new SqlBuilder("reference_loot_template", "entry", SqlQueryType.DeleteInsert);
                m_creatureReferenceLootBuilder.SetFieldsNames("Item", "Reference", "Chance", "QuestRequired", "LootMode", "GroupId", "MinCount", "MaxCount", "Comment");

                returnSql += "UPDATE creature_template SET lootid = " + templateEntry + " WHERE entry = " + templateEntry + " AND lootid = 0;\n";
                foreach (CreatureLootParsing creatureLootData in m_creatureLootDatas)
                {
                    List <int> entryList = new List <int>();

                    CreatureLootItemParsing creatureLootItemData = null;
                    try
                    {
                        creatureLootItemData = (CreatureLootItemParsing)creatureLootData;
                    }
                    catch (Exception ex) { }

                    CreatureLootCurrencyParsing creatureLootCurrencyData = null;
                    try
                    {
                        creatureLootCurrencyData = (CreatureLootCurrencyParsing)creatureLootData;
                    }
                    catch (Exception ex) { }

                    int minLootCount = creatureLootData.stack.Length >= 1 ? creatureLootData.stack[0] : 1;
                    int maxLootCount = creatureLootData.stack.Length >= 2 ? creatureLootData.stack[1] : minLootCount;

                    // If bonuses, certainly an important loot, set to references
                    if (!IsCheckboxChecked("Is Dungeon/Raid Boss") || (creatureLootItemData == null || creatureLootItemData.bonustrees == null))
                    {
                        switch (creatureLootData.mode)
                        {
                        default:
                            entryList.Add(templateEntry);
                            break;;
                        }

                        foreach (int entry in entryList)
                        {
                            int idMultiplier = creatureLootCurrencyData != null ? -1 : 1;

                            if (idMultiplier < 1)
                            {
                                continue;
                            }

                            m_creatureLootBuilder.AppendFieldsValue(entry,                              // Entry
                                                                    creatureLootData.id * idMultiplier, // Item
                                                                    0,                                  // Reference
                                                                    creatureLootData.percent,           // Chance
                                                                    creatureLootData.questRequired,     // QuestRequired
                                                                    1,                                  // LootMode
                                                                    0,                                  // GroupId
                                                                    minLootCount,                       // MinCount
                                                                    maxLootCount,                       // MaxCount
                                                                    "");                                // Comment
                        }
                    }
                    else
                    {
                        if (!referenceAdded)
                        {
                            m_creatureLootBuilder.AppendFieldsValue(templateEntry,    // Entry
                                                                    0,                // Item
                                                                    templateEntry,    // Reference
                                                                    100,              // Chance
                                                                    0,                // QuestRequired
                                                                    1,                // LootMode
                                                                    0,                // GroupId
                                                                    maxReferenceLoot, // MinCount
                                                                    maxReferenceLoot, // MaxCount
                                                                    "");              // Comment
                            referenceAdded = true;
                        }

                        m_creatureReferenceLootBuilder.AppendFieldsValue(templateEntry,                  // Entry
                                                                         creatureLootData.id,            // Item
                                                                         0,                              // Reference
                                                                         creatureLootData.percent,       // Chance
                                                                         creatureLootData.questRequired, // QuestRequired
                                                                         1,                              // LootMode
                                                                         1,                              // GroupId
                                                                         minLootCount,                   // MinCount
                                                                         maxLootCount,                   // MaxCount
                                                                         "");                            // Comment
                    }
                }

                returnSql += m_creatureLootBuilder.ToString() + "\n";
                returnSql += m_creatureReferenceLootBuilder.ToString() + "\n";
            }

            if (IsCheckboxChecked("skinning") && m_creatureSkinningDatas != null)
            {
                m_creatureSkinningBuilder = new SqlBuilder("skinning_loot_template", "entry", SqlQueryType.DeleteInsert);
                m_creatureSkinningBuilder.SetFieldsNames("Item", "Reference", "Chance", "QuestRequired", "LootMode", "GroupId", "MinCount", "MaxCount", "Comment");

                returnSql += "UPDATE creature_template SET skinloot = " + m_creatureTemplateData.id + " WHERE entry = " + m_creatureTemplateData.id + " AND skinloot = 0;\n";
                foreach (CreatureLootParsing creatureSkinningData in m_creatureSkinningDatas)
                {
                    m_creatureSkinningBuilder.AppendFieldsValue(m_creatureTemplateData.id,     // Entry
                                                                creatureSkinningData.id,       // Item
                                                                0,                             // Reference
                                                                creatureSkinningData.percent,  // Chance
                                                                0,                             // QuestRequired
                                                                1,                             // LootMode
                                                                0,                             // GroupId
                                                                creatureSkinningData.stack[0], // MinCount
                                                                creatureSkinningData.stack[1], // MaxCount
                                                                "");                           // Comment
                }

                returnSql += m_creatureSkinningBuilder.ToString() + "\n";
            }

            if (IsCheckboxChecked("trainer") && m_creatureTrainerDatas != null)
            {
                m_creatureTrainerBuilder = new SqlBuilder("npc_trainer", "entry", SqlQueryType.DeleteInsert);
                m_creatureTrainerBuilder.SetFieldsNames("spell", "spellcost", "reqskill", "reqskillvalue", "reqlevel");

                returnSql += "UPDATE creature_template SET npc_flag = 16 WHERE entry = " + m_creatureTemplateData.id + ";\n";
                foreach (CreatureTrainerParsing creatureTrainerData in m_creatureTrainerDatas)
                {
                    int reqskill = creatureTrainerData.learnedat > 0 ? creatureTrainerData.skill[0] : 0;
                    m_creatureTrainerBuilder.AppendFieldsValue(m_creatureTemplateData.id, creatureTrainerData.id, creatureTrainerData.trainingcost, reqskill, creatureTrainerData.learnedat, creatureTrainerData.level);
                }

                returnSql += m_creatureTrainerBuilder.ToString() + "\n";
            }

            if (IsCheckboxChecked("quest starter") && m_creatureQuestStarterDatas != null)
            {
                m_creatureQuestStarterBuilder = new SqlBuilder("creature_queststarter", "entry", SqlQueryType.DeleteInsert);
                m_creatureQuestStarterBuilder.SetFieldsNames("quest");

                foreach (QuestStarterEnderParsing creatureQuestStarterData in m_creatureQuestStarterDatas)
                {
                    m_creatureQuestStarterBuilder.AppendFieldsValue(m_creatureTemplateData.id, creatureQuestStarterData.id);
                }

                returnSql += m_creatureQuestStarterBuilder.ToString() + "\n";
            }

            if (IsCheckboxChecked("quest ender") && m_creatureQuestEnderDatas != null)
            {
                m_creatureQuestEnderBuilder = new SqlBuilder("creature_questender", "entry", SqlQueryType.DeleteInsert);
                m_creatureQuestEnderBuilder.SetFieldsNames("quest");

                foreach (QuestStarterEnderParsing creatureQuestEnderData in m_creatureQuestEnderDatas)
                {
                    m_creatureQuestEnderBuilder.AppendFieldsValue(m_creatureTemplateData.id, creatureQuestEnderData.id);
                }

                returnSql += m_creatureQuestEnderBuilder.ToString() + "\n";
            }

            return(returnSql);
        }
예제 #3
0
        public void LoadData(int indexField, HotfixStatements preparedStatement, HotfixStatements preparedStatementLocale)
        {
            SQLResult result = DB.Hotfix.Query(DB.Hotfix.GetPreparedStatement(preparedStatement));

            if (!result.IsEmpty())
            {
                do
                {
                    var id = result.Read <uint>(indexField == -1 ? 0 : indexField);

                    var obj = new T();

                    int dbIndex = 0;
                    foreach (var f in typeof(T).GetFields())
                    {
                        Type type = f.FieldType;

                        if (type.IsArray)
                        {
                            Type arrayElementType = type.GetElementType();
                            if (arrayElementType.IsEnum)
                            {
                                arrayElementType = arrayElementType.GetEnumUnderlyingType();
                            }

                            Array array = (Array)f.GetValue(obj);
                            switch (Type.GetTypeCode(arrayElementType))
                            {
                            case TypeCode.SByte:
                                f.SetValue(obj, ReadArray <sbyte>(result, dbIndex, array.Length));
                                break;

                            case TypeCode.Byte:
                                f.SetValue(obj, ReadArray <byte>(result, dbIndex, array.Length));
                                break;

                            case TypeCode.Int16:
                                f.SetValue(obj, ReadArray <short>(result, dbIndex, array.Length));
                                break;

                            case TypeCode.UInt16:
                                f.SetValue(obj, ReadArray <ushort>(result, dbIndex, array.Length));
                                break;

                            case TypeCode.Int32:
                                f.SetValue(obj, ReadArray <int>(result, dbIndex, array.Length));
                                break;

                            case TypeCode.UInt32:
                                f.SetValue(obj, ReadArray <uint>(result, dbIndex, array.Length));
                                break;

                            case TypeCode.Single:
                                f.SetValue(obj, ReadArray <float>(result, dbIndex, array.Length));
                                break;

                            case TypeCode.String:
                                f.SetValue(obj, ReadArray <string>(result, dbIndex, array.Length));
                                break;

                            case TypeCode.Object:
                                if (arrayElementType == typeof(Vector3))
                                {
                                    f.SetValue(obj, new Vector3(ReadArray <float>(result, dbIndex, 3)));
                                }
                                break;

                            default:
                                Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", arrayElementType.Name);
                                break;
                            }

                            dbIndex += array.Length;
                        }
                        else
                        {
                            if (type.IsEnum)
                            {
                                type = type.GetEnumUnderlyingType();
                            }

                            switch (Type.GetTypeCode(type))
                            {
                            case TypeCode.SByte:
                                f.SetValue(obj, result.Read <sbyte>(dbIndex++));
                                break;

                            case TypeCode.Byte:
                                f.SetValue(obj, result.Read <byte>(dbIndex++));
                                break;

                            case TypeCode.Int16:
                                f.SetValue(obj, result.Read <short>(dbIndex++));
                                break;

                            case TypeCode.UInt16:
                                f.SetValue(obj, result.Read <ushort>(dbIndex++));
                                break;

                            case TypeCode.Int32:
                                f.SetValue(obj, result.Read <int>(dbIndex++));
                                break;

                            case TypeCode.UInt32:
                                f.SetValue(obj, result.Read <uint>(dbIndex++));
                                break;

                            case TypeCode.Single:
                                f.SetValue(obj, result.Read <float>(dbIndex++));
                                break;

                            case TypeCode.String:
                                string str = result.Read <string>(dbIndex++);
                                f.SetValue(obj, str);
                                break;

                            case TypeCode.Object:
                                if (type == typeof(LocalizedString))
                                {
                                    LocalizedString locString = new LocalizedString();
                                    locString[Global.WorldMgr.GetDefaultDbcLocale()] = result.Read <string>(dbIndex++);

                                    f.SetValue(obj, locString);
                                }
                                else if (type == typeof(Vector2))
                                {
                                    f.SetValue(obj, new Vector2(ReadArray <float>(result, dbIndex, 2)));
                                    dbIndex += 2;
                                }
                                else if (type == typeof(Vector3))
                                {
                                    f.SetValue(obj, new Vector3(ReadArray <float>(result, dbIndex, 3)));
                                    dbIndex += 3;
                                }
                                else if (type == typeof(FlagArray128))
                                {
                                    f.SetValue(obj, new FlagArray128(ReadArray <uint>(result, dbIndex, 4)));
                                    dbIndex += 4;
                                }
                                break;

                            default:
                                Log.outError(LogFilter.ServerLoading, "Wrong Type: {0}", type.Name);
                                break;
                            }
                        }
                    }

                    base[id] = obj;
                }while (result.NextRow());
            }

            if (preparedStatementLocale == 0)
            {
                return;
            }

            for (LocaleConstant locale = 0; locale < LocaleConstant.Total; ++locale)
            {
                if (Global.WorldMgr.GetDefaultDbcLocale() == locale || locale == LocaleConstant.None)
                {
                    continue;
                }

                PreparedStatement stmt = DB.Hotfix.GetPreparedStatement(preparedStatementLocale);
                stmt.AddValue(0, locale.ToString());
                SQLResult localeResult = DB.Hotfix.Query(stmt);
                if (localeResult.IsEmpty())
                {
                    continue;
                }

                do
                {
                    int index = 0;
                    var obj   = this.LookupByKey(localeResult.Read <uint>(index++));
                    if (obj == null)
                    {
                        continue;
                    }

                    foreach (var f in typeof(T).GetFields())
                    {
                        if (f.FieldType != typeof(LocalizedString))
                        {
                            continue;
                        }

                        LocalizedString locString = (LocalizedString)f.GetValue(obj);
                        locString[locale] = localeResult.Read <string>(index++);
                    }
                } while (localeResult.NextRow());
            }
        }
예제 #4
0
        public void LoadData(int indexField, DB6FieldInfo[] helpers, HotfixStatements preparedStatement, HotfixStatements preparedStatementLocale)
        {
            SQLResult result = DB.Hotfix.Query(DB.Hotfix.GetPreparedStatement(preparedStatement));

            if (!result.IsEmpty())
            {
                do
                {
                    var idValue = result.Read <uint>(indexField == -1 ? 0 : indexField);

                    var obj   = new T();
                    int index = 0;
                    for (var fieldIndex = 0; fieldIndex < helpers.Length; fieldIndex++)
                    {
                        var helper = helpers[fieldIndex];
                        if (helper.IsArray)
                        {
                            Array array = (Array)helper.Getter(obj);
                            for (var i = 0; i < array.Length; ++i)
                            {
                                switch (Type.GetTypeCode(helper.FieldType))
                                {
                                case TypeCode.SByte:
                                    helper.SetValue(array, result.Read <sbyte>(index++), i);
                                    break;

                                case TypeCode.Byte:
                                    helper.SetValue(array, result.Read <byte>(index++), i);
                                    break;

                                case TypeCode.Int16:
                                    helper.SetValue(array, result.Read <short>(index++), i);
                                    break;

                                case TypeCode.UInt16:
                                    helper.SetValue(array, result.Read <ushort>(index++), i);
                                    break;

                                case TypeCode.Int32:
                                    helper.SetValue(array, result.Read <int>(index++), i);
                                    break;

                                case TypeCode.UInt32:
                                    helper.SetValue(array, result.Read <uint>(index++), i);
                                    break;

                                case TypeCode.Single:
                                    helper.SetValue(array, result.Read <float>(index++), i);
                                    break;

                                case TypeCode.String:
                                    helper.SetValue(array, result.Read <string>(index++), i);
                                    break;

                                case TypeCode.Object:
                                    switch (helper.FieldType.Name)
                                    {
                                    case "Vector2":
                                        var vector2 = new Vector2();
                                        vector2.X = result.Read <float>(index++);
                                        vector2.Y = result.Read <float>(index++);
                                        helper.SetValue(array, vector2, i);
                                        break;

                                    case "Vector3":
                                        var vector3 = new Vector3();
                                        vector3.X = result.Read <float>(index++);
                                        vector3.Y = result.Read <float>(index++);
                                        vector3.Z = result.Read <float>(index++);
                                        helper.SetValue(array, vector3, i);
                                        break;

                                    case "LocalizedString":
                                        LocalizedString locString = new LocalizedString();
                                        locString[Global.WorldMgr.GetDefaultDbcLocale()] = result.Read <string>(index++);
                                        helper.SetValue(array, locString, i);
                                        break;

                                    default:
                                        Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name);
                                        break;
                                    }
                                    break;

                                default:
                                    Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name);
                                    break;
                                }
                            }
                        }
                        else
                        {
                            switch (Type.GetTypeCode(helper.FieldType))
                            {
                            case TypeCode.SByte:
                                helper.SetValue(obj, result.Read <sbyte>(index++));
                                break;

                            case TypeCode.Byte:
                                helper.SetValue(obj, result.Read <byte>(index++));
                                break;

                            case TypeCode.Int16:
                                helper.SetValue(obj, result.Read <short>(index++));
                                break;

                            case TypeCode.UInt16:
                                helper.SetValue(obj, result.Read <ushort>(index++));
                                break;

                            case TypeCode.Int32:
                                helper.SetValue(obj, result.Read <int>(index++));
                                break;

                            case TypeCode.UInt32:
                                helper.SetValue(obj, result.Read <uint>(index++));
                                break;

                            case TypeCode.Single:
                                helper.SetValue(obj, result.Read <float>(index++));
                                break;

                            case TypeCode.String:
                                string str = result.Read <string>(index++);
                                helper.SetValue(obj, str);
                                break;

                            case TypeCode.Object:
                                switch (helper.FieldType.Name)
                                {
                                case "Vector2":
                                    var vector2 = new Vector2();
                                    vector2.X = result.Read <float>(index++);
                                    vector2.Y = result.Read <float>(index++);
                                    helper.SetValue(obj, vector2);
                                    break;

                                case "Vector3":
                                    var vector3 = new Vector3();
                                    vector3.X = result.Read <float>(index++);
                                    vector3.Y = result.Read <float>(index++);
                                    vector3.Z = result.Read <float>(index++);
                                    helper.SetValue(obj, vector3);
                                    break;

                                case "LocalizedString":
                                    LocalizedString locString = new LocalizedString();
                                    locString[Global.WorldMgr.GetDefaultDbcLocale()] = result.Read <string>(index++);
                                    helper.SetValue(obj, locString);
                                    break;

                                default:
                                    Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name);
                                    break;
                                }
                                break;

                            default:
                                Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name);
                                break;
                            }
                        }
                    }

                    base[idValue] = obj;
                }while (result.NextRow());
            }

            if (preparedStatementLocale == 0)
            {
                return;
            }

            for (LocaleConstant locale = 0; locale < LocaleConstant.OldTotal; ++locale)
            {
                if (Global.WorldMgr.GetDefaultDbcLocale() == locale || locale == LocaleConstant.None)
                {
                    continue;
                }

                PreparedStatement stmt = DB.Hotfix.GetPreparedStatement(preparedStatementLocale);
                stmt.AddValue(0, locale.ToString());
                SQLResult localeResult = DB.Hotfix.Query(stmt);
                if (localeResult.IsEmpty())
                {
                    continue;
                }

                do
                {
                    int index = 0;
                    var obj   = this.LookupByKey(localeResult.Read <uint>(index++));
                    if (obj == null)
                    {
                        continue;
                    }

                    for (var i = 0; i < helpers.Length; i++)
                    {
                        var fieldInfo = helpers[i];
                        if (fieldInfo.FieldType != typeof(LocalizedString))
                        {
                            continue;
                        }

                        LocalizedString locString = (LocalizedString)fieldInfo.Getter(obj);
                        locString[locale] = localeResult.Read <string>(index++);
                    }
                } while (localeResult.NextRow());
            }
        }