Example #1
0
        public EntitySkill(XMLHandler handler, XmlNode node)
        {
            NodeData      = new Dictionary <string, string>();
            MainOption    = new Dictionary <string, string>();
            BonusOption   = new Dictionary <string, string>();
            PercentOption = new Dictionary <string, string>();

            this.xml      = node.InnerXml;
            this.ID       = Int32.Parse(node["id"].InnerText);
            this.Name     = node["name"].InnerText.ToLower();
            this.Desc     = (string)node["desc"].InnerText.ToUpper();
            this.ViewName = (string)handler.StrHash[this.Desc];

            foreach (XmlNode child in node.ChildNodes)
            {
                string tagName = child.Name;
                string value   = child.InnerText;
                NodeData.Add(tagName, value);
            }

            if (NodeData.ContainsKey("desc_long"))
            {
                DescLong = node["desc_long"].InnerText.ToUpper();
                if (handler.StrHash.ContainsKey(DescLong))
                {
                    DescLongString = (string)handler.StrHash[DescLong];
                }
            }

            if (NodeData.ContainsKey("activation_attribute"))
            {
                string tmp = node["activation_attribute"].InnerText.ToLower();
                switch (tmp)
                {
                case "passive": this.SType = SkillType.Passive; break;

                case "toggle": this.SType = SkillType.Toggle; break;

                case "active": this.SType = SkillType.Active; break;

                case "charge": this.SType = SkillType.Charge; break;

                case "provoked": this.SType = SkillType.Provoked; break;

                case "maintain": this.SType = SkillType.Maintain; break;

                default: this.SType = SkillType.NoneActive; break;
                }
            }
            else
            {
                // 채집, 정기 추출, 오드 추출, 요리, 무기 제작,
                SType = SkillType.None;
            }


            // 음식류?
            if (NodeData.ContainsKey("activation_attribute"))
            {
                string v = ((string)NodeData["activation_attribute"].ToLower());
                //if (v == "active")
                {
                    for (int i = 1; i < 5; i++)
                    {
                        string tt = "effect" + i + "_type";
                        if (NodeData.ContainsKey(tt))
                        {
                            string t2 = NodeData[tt].ToLower();
                            //if (t2 == "statup" || t2 == "statdown" || t2 == "statboost")
                            if (t2.Contains("stat"))
                            {
                                //13 14를 메인에
                                // 13 14가 있으면 2,4
                                // 13만 있으면 1
                                // 음.. reserved1은 단계별 값이고
                                // reserved2는 단계와 상과없는 절대값이다
                                // reserved4는 퍼센트인것 같다 ;

                                string tmp1  = "effect" + i + "_reserved1";
                                string tmp2  = "effect" + i + "_reserved2";
                                string tmp3  = "effect" + i + "_reserved3";
                                string tmp4  = "effect" + i + "_reserved4";
                                string tmp13 = "effect" + i + "_reserved13";
                                string tmp14 = "effect" + i + "_reserved14";

                                string value1  = (NodeData.ContainsKey(tmp1)) ? NodeData[tmp1] : null;
                                string value2  = (NodeData.ContainsKey(tmp2)) ? NodeData[tmp2] : null;
                                string value3  = (NodeData.ContainsKey(tmp3)) ? NodeData[tmp3] : null;
                                string value4  = (NodeData.ContainsKey(tmp4)) ? NodeData[tmp4] : null;
                                string value13 = (NodeData.ContainsKey(tmp13)) ? NodeData[tmp13].ToLower() : null;
                                string value14 = (NodeData.ContainsKey(tmp14)) ? NodeData[tmp14].ToLower() : null;

                                if (t2 == "statdown")
                                {
                                    try
                                    {
                                        value1 = (value1 == null || value1 == "0") ? null : "-" + value1;
                                        value2 = (value2 == null || value2 == "0") ? null : "-" + value2;
                                        value3 = (value3 == null || value3 == "0") ? null : "-" + value3;
                                        value4 = (value4 == null || value4 == "0") ? null : "-" + value4;
                                    }
                                    catch //(Exception e)
                                    {
                                    }
                                }

                                if (SType == SkillType.Toggle && t2 == "weaponstatup")
                                {
                                    // 화살강화때문에
                                    value4 = value2; value2 = null;
                                }
                                if (SType == SkillType.Provoked && ViewName.Contains("불패의 진언") && value13 == "phyattack")
                                {
                                    value4 = value2; value2 = null;
                                }

                                if (SType == SkillType.Active && DescLongString != null && (DescLongString.Contains("e" + i + ".StatUp.Value]%%") || DescLongString.Contains("e" + i + ".StatDown.Value]%%") || DescLongString.Contains("e" + i + ".WeaponStatUp.Value]%%")))
                                {
                                    if (value4 != null && value14 != null)
                                    {
                                        // 1818181818181818
                                        PercentOption.Add(value13, value2);
                                        value13 = null;
                                    }
                                    else
                                    {
                                        value4 = value2; value2 = null;
                                    }
                                }

                                // if (SType == SkillType.Active && DescLongString != null && (DescLongString.Contains("e" + i + ".StatUp.Value2]%%") || DescLongString.Contains("e" + i + ".StatDown.Value2]%%") || DescLongString.Contains("e" + i + ".WeaponStatUp.Value2]%%")))
                                {
                                }

                                // 퍼센트옵션 ㅠ
                                if (value13 != null && value14 == null && value4 != null)
                                {
                                    if (value1 == null || value1 == "0")
                                    {
                                        if (value2 == null || value2 == "0")
                                        {
                                            if (value3 == null || value3 == "0")
                                            {
                                                PercentOption.Add(value13, value4);
                                            }
                                        }
                                    }
                                }
                                if (value13 != null)
                                {
                                    if (value1 != null && value1 != "0")
                                    {
                                        if (MainOption.ContainsKey(value13) == false)
                                        {
                                            MainOption.Add(value13, value1);
                                        }
                                    }
                                    if (value2 != null && value2 != "0")
                                    {
                                        if (BonusOption.ContainsKey(value13) == false)
                                        {
                                            BonusOption.Add(value13, value2);
                                        }
                                    }
                                }
                                if (value14 != null)
                                {
                                    if (value3 != null && value3 != "0")
                                    {
                                        if (MainOption.ContainsKey(value14) == false)
                                        {
                                            MainOption.Add(value14, value3);
                                        }
                                    }
                                    if (value4 != null && value4 != "0")
                                    {
                                        if (BonusOption.ContainsKey(value14) == false)
                                        {
                                            BonusOption.Add(value14, value4);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                // 2013-06-21
                //elementaldefendall
                if (MainOption.ContainsKey("elementaldefendall"))
                {
                    string value = MainOption["elementaldefendall"];
                    MainOption.Add("elementaldefendfire", value);
                    MainOption.Add("elementaldefendair", value);
                    MainOption.Add("elementaldefendwater", value);
                    MainOption.Add("elementaldefendearth", value);
                }
            }
        }