Пример #1
0
        public override ItemLocation Fill(XDocument xdoc, string itemId)
        {
            NetworkUtils wrw = new NetworkUtils();

            XElement subNode = xdoc.SelectSingleNode("/itemData/page/itemInfo/item/rewardFromQuests/quest[1]");

            if (subNode != null)
            {
                return(QuestItem.Construct().Fill(xdoc, itemId));
            }


            XElement cost = xdoc.SelectSingleNode("/itemData/page/itemInfo/item/cost");

            if (cost != null)
            {
                XAttribute priceAttr = cost.Attribute("buyPrice");

                if (priceAttr != null)
                {
                    Cost = int.Parse(subNode.Value);
                }
                else
                {
                    Cost = 0;
                }
            }

            foreach (XElement token in xdoc.SelectNodes("/itemData/page/itemInfo/item/cost/token"))
            {
                int    Count = int.Parse(token.Attribute("count").Value);
                string id    = token.Attribute("id").Value;
                if (!tokenIDMap.ContainsKey(id))
                {
                    //NetworkUtils wrw2 = new NetworkUtils();
                    // XDocument doc2 = wrw.DownloadItemInformation(int.Parse(id));

                    tokenIDMap[id] = "<nyi>";//doc2.SelectSingleNode("/itemData/page/itemInfo/item/@name").Value;
                }

                _tokenMap[tokenIDMap[id]] = Count;
            }


            subNode = xdoc.SelectSingleNode("/itemData/page/itemTooltips/itemTooltip/requiredFaction");
            if (subNode != null)
            {
                FactionName = subNode.Attribute("name").Value;
                Level       = (ReputationLevel)System.Enum.Parse(typeof(ReputationLevel), subNode.Attribute("rep").Value, false);
            }

            return(this);
        }
Пример #2
0
        public override ItemLocation Fill(XmlNode node, string itemId)
        {
            WebRequestWrapper wrw = new WebRequestWrapper();
            XmlDocument       doc = wrw.DownloadItemInformation(int.Parse(itemId));

            XmlNode subNode = doc.SelectSingleNode("/page/itemInfo/item/rewardFromQuests/quest[1]");

            if (subNode != null)
            {
                return(QuestItem.Construct().Fill(node, itemId));
            }



            subNode = doc.SelectSingleNode("/page/itemInfo/item/cost/@buyPrice");

            if (subNode != null)
            {
                Cost = int.Parse(subNode.InnerText);
            }
            else
            {
                Cost = 0;
            }

            foreach (XmlNode token in doc.SelectNodes("/page/itemInfo/item/cost/token"))
            {
                int    Count = int.Parse(token.Attributes["count"].Value);
                string id    = token.Attributes["id"].Value;
                if (!tokenIDMap.ContainsKey(id))
                {
                    WebRequestWrapper wrw2 = new WebRequestWrapper();
                    XmlDocument       doc2 = wrw.DownloadItemInformation(int.Parse(id));

                    tokenIDMap[id] = doc2.SelectSingleNode("/page/itemInfo/item/@name").InnerText;
                }

                _tokenMap[tokenIDMap[id]] = Count;
            }


            subNode = node.SelectSingleNode("/page/itemTooltips/itemTooltip/requiredFaction");
            if (subNode != null)
            {
                FactionName = subNode.Attributes["name"].Value;
                Level       = (ReputationLevel)System.Enum.Parse(typeof(ReputationLevel), subNode.Attributes["rep"].Value);
            }

            return(this);
        }
Пример #3
0
        public static new ItemLocation Construct()
        {
            QuestItem item = new QuestItem();

            return(item);
        }