private void LoadSkill() { SkillList = new Dictionary <string, EntitySkill>(); string[] urls = GenerateDataFile.fileListSkills; for (int i = 0; i < urls.Length; i++) { XmlDocument xml = new XmlDocument(); xml.Load(GenerateDataFile.dataPath + "\\" + urls[i]); XmlElement root = xml.DocumentElement; XmlNodeList list = root.ChildNodes; foreach (XmlNode node in list) { EntitySkill skill = new EntitySkill(this, node); if (skill.ViewName == null) { continue; } this.SkillList.Add(skill.Name, skill); } XMLEventHandler(this, new XMLEventArgs(XMLEvent.스킬, urls[i])); } }
public EntityItem(XMLHandler handler, XmlNode node) { this.xml = node.InnerXml; NodeData = new Dictionary <string, string>(); MainOption = new Dictionary <string, string>(); BonusOption = new Dictionary <string, string>(); BonusAOption = new Dictionary <string, string>(); BonusBOption = new Dictionary <string, string>(); EnchantOption = new Dictionary <string, string>(); foreach (XmlNode child in node.ChildNodes) { this.NodeData.Add(child.Name, child.InnerText); if (child.Name.Contains("bonus_attr")) { Dictionary <string, string> opt = BonusOption; if (child.Name.Contains("bonus_attr_a")) { opt = BonusAOption; } else if (child.Name.Contains("bonus_attr_b")) { opt = BonusBOption; } string str = child.InnerText; str = str.Replace(" ", " "); string[] tmp = str.Trim().Split(' '); if (opt.ContainsKey(tmp[0].Trim().ToLower()) == false && tmp.Length == 2 && tmp[0].Trim().Length > 4) { opt.Add(tmp[0].Trim().ToLower(), tmp[1].Trim()); } else if (tmp.Length == 1) { } else { //handler.main.AppentText(NodeData["id"] + " "); // 오면 안된다 // 101301026 123001344 123001363 123001371 } } } if (this.NodeData.ContainsKey("id")) { this.ID = (int)handler.main.StringToDouble(NodeData["id"]); } if (this.NodeData.ContainsKey("desc")) { this.ViewName = (string)handler.StrHash[((string)this.NodeData["desc"]).ToUpper()]; } if (this.NodeData.ContainsKey("name")) { this.Name = (string)NodeData["name"].ToLower(); } // 주문서 음식 캔디 등등 if (NodeData.ContainsKey("activation_skill")) { string skillName = NodeData["activation_skill"].ToLower(); if (handler.SkillList.ContainsKey(skillName)) { Skill = handler.SkillList[skillName]; // 스킬레벨 if (NodeData.ContainsKey("activation_level")) { string tmp = NodeData["activation_level"]; int value = 0; try { value = Int32.Parse(tmp); } catch { } if (value >= 1) { IDictionaryEnumerator e = Skill.MainOption.GetEnumerator(); while (e.MoveNext()) { string attrName = (string)e.Key; string attrValue = (string)e.Value; int multipleValue = 0; try { multipleValue = Int32.Parse(attrValue) * value; MainOption.Add(attrName, multipleValue + ""); } catch { } } } IDictionaryEnumerator e2 = Skill.BonusOption.GetEnumerator(); while (e2.MoveNext()) { string attrName = (string)e2.Key; string attrValue = (string)e2.Value; MainOption.Add(attrName, attrValue); } e2 = Skill.PercentOption.GetEnumerator(); while (e2.MoveNext()) { string attrName = (string)e2.Key; string attrValue = (string)e2.Value; this.BonusOption.Add(attrName, attrValue); } } } } TreeIndex = Information.GetItemType(this); // AttrList에 있는 것들.. 즉 태그 이름으로 있는것들은 그냥 다 처리? foreach (InfoAttr attr in Information.InfoAttrList) { if (attr.TagName == null) { continue; } if (NodeData.ContainsKey(attr.TagName)) { string tmp = NodeData[attr.TagName]; if (tmp == "0" || tmp == "") { continue; } MainOption.Add(attr.EngAttrName, tmp); } } if (Is마석() || Is고대마석()) { string key1 = null, value1 = null; string key2 = null, value2 = null; if (NodeData.ContainsKey("stat_enchant_type1")) { key1 = NodeData["stat_enchant_type1"]; } if (NodeData.ContainsKey("stat_enchant_value1")) { value1 = NodeData["stat_enchant_value1"]; } if (NodeData.ContainsKey("stat_enchant_type2")) { key2 = NodeData["stat_enchant_type2"]; } if (NodeData.ContainsKey("stat_enchant_value2")) { value2 = NodeData["stat_enchant_value2"]; } if (key1 != null && value1 != null) { MainOption.Add(key1.ToLower(), value1.ToLower()); } if (key2 != null && value2 != null) { MainOption.Add(key2.ToLower(), value2.ToLower()); } } if (Is마석() || Is고대마석()) { SetLevelOrCount(1); } else { SetLevelOrCount(0); } }
public Stat Load(string filename) { Stat stat = new Stat(); stat.FullFileName = filename; stat.OnlyFileName = new FileInfo(stat.FullFileName).Name; XmlDocument xml = new XmlDocument(); xml.Load(filename); XmlElement root = xml.DocumentElement; XmlNodeList nodeList = root.ChildNodes; foreach (XmlNode node in nodeList) { string s = node.InnerText; int level = -1; int gid = 0; XmlAttributeCollection xac = node.Attributes; if (xac.Count > 0) { XmlAttribute att = xac["enchant_count"]; if (att != null) { level = Int32.Parse(att.Value); } att = xac["random_option_id"]; if (att != null) { gid = Int32.Parse(att.Value); } } switch (node.Name) { case "desc": stat.Desc = s; break; case "version": stat.Version = s; break; case "클래스": stat.SetClass(s); break; case "오른손": stat.오른손 = this.main.xmlHandler.ItemList[s].Clone(); if (level > -1) { stat.오른손.SetLevelOrCount(level); } stat.오른손.RandomOptionGroupID = gid; break; case "왼손": stat.왼손 = this.main.xmlHandler.ItemList[s].Clone(); if (level > -1) { stat.왼손.SetLevelOrCount(level); } stat.왼손.RandomOptionGroupID = gid; break; case "상의": stat.상의 = this.main.xmlHandler.ItemList[s].Clone(); if (level > -1) { stat.상의.SetLevelOrCount(level); } stat.상의.RandomOptionGroupID = gid; break; case "어깨": stat.어깨 = this.main.xmlHandler.ItemList[s].Clone(); if (level > -1) { stat.어깨.SetLevelOrCount(level); } stat.어깨.RandomOptionGroupID = gid; break; case "장갑": stat.장갑 = this.main.xmlHandler.ItemList[s].Clone(); if (level > -1) { stat.장갑.SetLevelOrCount(level); } stat.장갑.RandomOptionGroupID = gid; break; case "하의": stat.하의 = this.main.xmlHandler.ItemList[s].Clone(); if (level > -1) { stat.하의.SetLevelOrCount(level); } stat.하의.RandomOptionGroupID = gid; break; case "신발": stat.신발 = this.main.xmlHandler.ItemList[s].Clone(); if (level > -1) { stat.신발.SetLevelOrCount(level); } stat.신발.RandomOptionGroupID = gid; break; case "머리": stat.머리 = this.main.xmlHandler.ItemList[s].Clone(); stat.머리.RandomOptionGroupID = gid; break; case "목걸이": stat.목걸이 = this.main.xmlHandler.ItemList[s].Clone(); stat.목걸이.RandomOptionGroupID = gid; break; case "귀고리1": stat.귀고리1 = this.main.xmlHandler.ItemList[s].Clone(); stat.귀고리1.RandomOptionGroupID = gid; break; case "귀고리2": stat.귀고리2 = this.main.xmlHandler.ItemList[s].Clone(); stat.귀고리2.RandomOptionGroupID = gid; break; case "반지1": stat.반지1 = this.main.xmlHandler.ItemList[s].Clone(); stat.반지1.RandomOptionGroupID = gid; break; case "반지2": stat.반지2 = this.main.xmlHandler.ItemList[s].Clone(); stat.반지2.RandomOptionGroupID = gid; break; case "허리띠": stat.허리띠 = this.main.xmlHandler.ItemList[s].Clone(); stat.허리띠.RandomOptionGroupID = gid; break; case "날개": stat.날개 = this.main.xmlHandler.ItemList[s].Clone(); stat.날개.RandomOptionGroupID = gid; break; case "이디안": stat.이디안 = this.main.xmlHandler.ItemList[s].Clone(); stat.이디안.RandomOptionGroupID = gid; break; case "음식": stat.음식 = this.main.xmlHandler.ItemList[s].Clone(); break; case "캔디": stat.캔디 = this.main.xmlHandler.ItemList[s].Clone(); break; case "타이틀": stat.타이틀 = this.main.xmlHandler.TitleList[s]; break; case "마석": EntityItem matter = this.main.xmlHandler.ItemList[s].Clone(); matter.SetLevelOrCount(level); stat.마석목록.Add(matter); break; case "주문서": EntityItem scroll = this.main.xmlHandler.ItemList[s].Clone(); stat.주문서목록.Add(scroll); break; case "스킬": EntitySkill skill = this.main.xmlHandler.SkillList[s]; stat.스킬목록.Add(skill); break; } } return(stat); }