Пример #1
0
        public override bool ParseSingleJson(int id = 0)
        {
            if (m_spellTemplateData.id == 0 && id == 0)
            {
                return(false);
            }
            else if (m_spellTemplateData.id == 0 && id != 0)
            {
                m_spellTemplateData.id = id;
            }

            String spellHtml = Tools.GetHtmlFromWowhead(GetWowheadUrl(), webClient);

            if (spellHtml.Contains("inputbox-error") || spellHtml.Contains("database-detail-page-not-found-message"))
            {
                return(false);
            }
            else
            {
                String dataPattern = @"\$\.extend\(g_spells\[" + m_spellTemplateData.id + @"\], (.+)\);";

                String spellTemplateDataJSon = Tools.ExtractJsonFromWithPattern(spellHtml, dataPattern);
                if (spellTemplateDataJSon != null)
                {
                    SpellTemplateParsing spellTemplateData = JsonConvert.DeserializeObject <SpellTemplateParsing>(spellTemplateDataJSon);

                    SetSpellTemplateData(spellTemplateData);

                    // Without m_spellTemplateData we can't really do anything, so return false
                    if (m_spellTemplateData == null)
                    {
                        return(false);
                    }
                }

                if (IsCheckboxChecked("spell loot"))
                {
                    String spellRecipePattern = @"new Listview\({template: 'spell', id: 'recipes', name: LANG\.tab_recipes, tabs: tabsRelated, parent: 'lkljbjkb574', sort: \['skill', 'name'\], hiddenCols: \['slot'\], visibleCols: \['source'\], data:(.+)}\);";
                    String spellRecipeJSon    = Tools.ExtractJsonFromWithPattern(spellHtml, spellRecipePattern);
                    if (spellRecipeJSon != null)
                    {
                        SpellLootItemParsing[] spellLootDatas = spellRecipeJSon != null?JsonConvert.DeserializeObject <SpellLootItemParsing[]>(spellRecipeJSon) : new SpellLootItemParsing[0];

                        SetSpellRecipeData(spellLootDatas);
                    }
                }


                return(true);
            }
        }
Пример #2
0
 public Spell()
 {
     m_spellTemplateData    = new SpellTemplateParsing();
     m_spellTemplateData.id = 0;
 }
Пример #3
0
 public Spell(int id)
 {
     m_spellTemplateData    = new SpellTemplateParsing();
     m_spellTemplateData.id = id;
 }
Пример #4
0
 public void SetSpellTemplateData(SpellTemplateParsing spellData)
 {
     m_spellTemplateData = spellData;
 }