Пример #1
0
        public override ItemLocation Fill(XmlDocument doc, XmlNode node, string itemId)
        {
            XmlNode subNode = doc.SelectSingleNode("/page/itemInfo/item/createdBy/spell/item");

            if (subNode != null)
            {
                Bind = (BindsOn)Enum.Parse(typeof(BindsOn), node.SelectSingleNode("/page/itemTooltips/itemTooltip/bonding").InnerText);
            }
            else
            {
                subNode = doc.SelectSingleNode("/page/itemInfo/item");
                if (subNode.Attributes["requiredSkill"] != null)
                {
                    Bind = BindsOn.BoP;
                }
                else
                {
                    Bind = BindsOn.BoE;
                }
            }
            if (subNode.Attributes["requiredSkill"] != null)
            {
                Skill = subNode.Attributes["requiredSkill"].Value;
                Level = int.Parse(subNode.Attributes["requiredSkillRank"].Value);
            }
            else
            {
                Skill = "Unknown";
            }

            subNode = doc.SelectSingleNode("/page/itemInfo/item/createdBy/spell/@name");
            if (subNode != null)
            {
                SpellName = subNode.InnerText;
            }


            foreach (XmlNode reagent in doc.SelectNodes("/page/itemInfo/item/createdBy/spell/reagent"))
            {
                string name  = reagent.Attributes["name"].Value;
                int    count = int.Parse(reagent.Attributes["count"].Value);
                if (!_materialBindMap.ContainsKey(name))
                {
                    WebRequestWrapper wrw = new WebRequestWrapper();
                    doc = wrw.DownloadItemToolTipSheet(reagent.Attributes["id"].Value);

                    _materialBindMap[name] = (BindsOn)Enum.Parse(typeof(BindsOn), doc.SelectSingleNode("/page/itemTooltips/itemTooltip/bonding").InnerText);
                }

                if (_materialBindMap[name] == BindsOn.BoP)
                {
                    BopMats[name] = count;
                }
            }

            return(this);
        }