Example #1
0
        public override bool BuildServerXml(List <Table> table_list)
        {
            foreach (Table table in table_list)
            {
                foreach (List <object> val_list in table.itemList)
                {
                    XDocument doc       = new XDocument();
                    XElement  root_node = new XElement("config");
                    doc.Add(root_node);

                    for (int i = 0; i < table.keyList.Count; ++i)
                    {
                        XmlBuilder.SetValueInNode(root_node, table.keyList[i], val_list[i]);
                    }

                    string path = string.Format("{0}/{1}/{2}.xml", ConfigIni.XmlDir, header.serverPath, val_list[0].ToString());
                    Writer.Instance.WriteXml(path, doc, false);
                }
            }

            Command.Instance.AddSvnAddFilePath(string.Format("{0}/{1}/", ConfigIni.XmlDir, header.serverPath));
            Command.Instance.AddSvnCommitFilePath(string.Format("{0}/{1}/", ConfigIni.XmlDir, header.serverPath));

            return(true);
        }
Example #2
0
        public override XDocument ConvertToServerXml(List <Table> table_list)
        {
            {
                Table table = table_list[0];
                List <List <object> > item_list = table.itemList;
                for (int i = 0; i < item_list.Count; ++i)
                {
                    List <object> val_list = item_list[i];
                    for (int j = 0; j < val_list.Count; j++)
                    {
                        if (string.IsNullOrEmpty(val_list[j].ToString()))
                        {
                            val_list[j] = 0;
                        }
                    }
                }
            }

            XDocument xmldoc    = new XDocument();
            XElement  root_node = new XElement("config");

            xmldoc.Add(root_node);

            foreach (Table table in table_list)
            {
                XElement node = XmlBuilder.ConvertTableToXmlElement(table);
                if (null != node)
                {
                    root_node.Add(node);
                }
            }

            return(xmldoc);
        }
Example #3
0
        public override bool BuildServerXml(List <Table> table_list)
        {
            if (table_list.Count <= 0)
            {
                return(false);
            }

            Table table = table_list[0];

            foreach (List <object> val_list in table.itemList)
            {
                XDocument doc       = new XDocument();
                XElement  root_node = new XElement("config");
                doc.Add(root_node);

                for (int i = 0; i < table.keyList.Count; ++i)
                {
                    XmlBuilder.SetValueInNode(root_node, table.keyList[i], val_list[i]);
                }

                string path = string.Format("{0}/{1}/{2}.xml", ConfigIni.XmlDir, header.serverPath, val_list[0]);
                Writer.Instance.WriteXml(path, doc, false);
            }

            Command.Instance.AddSvnAddFilePath(string.Format("{0}/{1}/", ConfigIni.XmlDir, header.serverPath));
            Command.Instance.AddSvnCommitFilePath(string.Format("{0}/{1}/", ConfigIni.XmlDir, header.serverPath));

            // monster manager
            {
                XDocument doc       = new XDocument();
                XElement  root_node = new XElement("config");
                doc.Add(root_node);

                XElement monster_list_node = new XElement("monster_list");
                root_node.Add(monster_list_node);

                foreach (List <object> val_list in table.itemList)
                {
                    XElement path_node = new XElement("path");
                    path_node.SetValue(string.Format("monster/{0}.xml", val_list[0]));
                    monster_list_node.Add(path_node);
                }

                string path = string.Format("{0}/gameworld/monstermanager.xml", ConfigIni.XmlDir);
                Command.Instance.AddSvnAddFilePath(path);
                Writer.Instance.WriteXml(path, doc);
                Command.Instance.AddSvnCommitFilePath(path);
            }

            return(true);
        }
Example #4
0
        public virtual XDocument ConvertToServerXml(List <Table> table_list)
        {
            XDocument xmldoc    = new XDocument();
            XElement  root_node = new XElement("config");

            xmldoc.Add(root_node);

            foreach (Table table in table_list)
            {
                XElement node = XmlBuilder.ConvertTableToXmlElement(table);
                if (null != node)
                {
                    root_node.Add(node);
                }
            }

            return(xmldoc);
        }
        public override bool BuildServerXml(List <Table> table_list)
        {
            if (table_list.Count <= 0)
            {
                return(false);
            }

            Table table = table_list[0];

            foreach (List <object> val_list in table.itemList)
            {
                int       skill_id = Convert.ToInt32(val_list[0]);
                XDocument doc      = new XDocument();

                XElement root_node = new XElement("Skill");
                doc.Add(root_node);

                bool is_self_pos = false;

                for (int i = 0; i < table.keyList.Count; ++i)
                {
                    KeyT key_T = table.keyList[i];

                    // del effect
                    if ((key_T.key.Equals("effect") || key_T.key.Equals("tipType")) &&
                        string.IsNullOrEmpty(val_list[i].ToString()))
                    {
                        continue;
                    }

                    // set skillname output
                    if (key_T.key.Equals("skillname"))
                    {
                        key_T.outFlag = "cs";
                    }

                    if (key_T.key.Equals("Distance") && Convert.ToInt32(val_list[i]) <= 1)
                    {
                        is_self_pos = true;
                    }

                    XmlBuilder.SetValueInNode(root_node, key_T, val_list[i]);

                    // special add
                    {
                        if (key_T.key.Equals("Distance"))
                        {
                            KeyT temp_key_T = new KeyT();
                            temp_key_T.key     = "ProfLimit";
                            temp_key_T.outFlag = "s";
                            XmlBuilder.SetValueInNode(root_node, temp_key_T, 4);
                        }

                        if (key_T.key.Equals("Range"))
                        {
                            KeyT temp_key_T = new KeyT();
                            temp_key_T.key     = "IsSelfPos";
                            temp_key_T.outFlag = "s";
                            int is_self_pos_val = is_self_pos && Convert.ToInt32(val_list[i]) > 0 ? 1 : 0;
                            XmlBuilder.SetValueInNode(root_node, temp_key_T, is_self_pos_val);
                        }
                    }
                }

                string group_name = this.GetSkillGroupName(skill_id);
                string path       = string.Format("{0}/gameworld/skill/monsterskills/{1}{2}.xml", ConfigIni.XmlDir, group_name, skill_id);

                Writer.Instance.WriteXml(path, doc, false);
            }

            Command.Instance.AddSvnAddFilePath(string.Format("{0}/gameworld/skill/monsterskills/", ConfigIni.XmlDir));
            Command.Instance.AddSvnCommitFilePath(string.Format("{0}/gameworld/skill/monsterskills/", ConfigIni.XmlDir));

            // monster manager
            {
                XDocument doc       = new XDocument();
                XElement  root_node = new XElement("skills");
                doc.Add(root_node);

                Dictionary <string, XElement> group_dic = new Dictionary <string, XElement>();

                // init group
                {
                    string[] group_name_list = { "CommonSkillToEnemy",        "RangeCommonSkillToEnemyPos", "CommonSkillToSelf",
                                                 "RangeCommonSkillToSelfPos", "FaZhenSkillToEnemy",         "FaZhenSkillToSelf",
                                                 "SkillToEnemyEffectToOther", "RandZoneSkillToSelfPos",     "RectRangeSkillToEnemyPos" };

                    for (int i = 0; i < group_name_list.Length; i++)
                    {
                        XElement group_node = new XElement(group_name_list[i]);
                        root_node.Add(group_node);
                        group_dic.Add(group_name_list[i], group_node);
                    }
                }

                foreach (List <object> val_list in table.itemList)
                {
                    int    skill_id   = Convert.ToInt32(val_list[0]);
                    string group_name = this.GetSkillGroupName(skill_id);

                    XElement group_node = null;
                    if (!group_dic.TryGetValue(group_name, out group_node))
                    {
                        group_node = new XElement(group_name);
                        root_node.Add(group_node);
                        group_dic.Add(group_name, group_node);
                    }

                    XElement path_node = new XElement("skill");
                    path_node.SetValue(string.Format("monsterskills/{0}{1}.xml", group_name, skill_id));
                    group_node.Add(path_node);
                }

                string path = string.Format("{0}/gameworld/skill/MonsterPetSkillManager.xml", ConfigIni.XmlDir);

                Command.Instance.AddSvnAddFilePath(path);
                Writer.Instance.WriteXml(path, doc);

                Command.Instance.AddSvnCommitFilePath(path);
            }

            return(true);
        }
Example #6
0
        public override bool BuildServerXml(List <Table> table_list)
        {
            if (table_list.Count <= 0)
            {
                return(false);
            }

            Table table = table_list[0];

            foreach (List <object> val_list in table.itemList)
            {
                XDocument doc       = new XDocument();
                XElement  root_node = new XElement("config");
                doc.Add(root_node);

                string cond_val     = "";
                string skill_id_val = "";

                for (int i = 0; i < table.keyList.Count; ++i)
                {
                    KeyT key_T = table.keyList[i];
                    if (key_T.key.Equals("cond"))
                    {
                        cond_val = val_list[i].ToString();
                    }
                    else if (key_T.key.Equals("skill_id"))
                    {
                        skill_id_val = val_list[i].ToString();
                    }
                    else if (key_T.key.Equals("comment"))
                    {
                        continue;
                    }
                    else
                    {
                        XmlBuilder.SetValueInNode(root_node, key_T, val_list[i]);
                    }
                }

                XElement cond_list_node = new XElement("cond_list");
                root_node.Add(cond_list_node);

                string[] conds     = cond_val.Split('|');
                string[] skill_ids = skill_id_val.Split('|');

                if (conds.Length != skill_ids.Length)
                {
                    return(false);
                }

                for (int i = 0; i < conds.Length; i++)
                {
                    XElement cond_node = new XElement("cond");

                    {
                        cond_list_node.Add(cond_node);
                        string[] ary = conds[i].Split('#');
                        cond_node.SetElementValue("cond_type", ary[0]);
                        for (int j = 1; j < 5; ++j)
                        {
                            int param = j < ary.Length ? Convert.ToInt32(ary[j]) : 0;
                            cond_node.SetElementValue(string.Format("param{0}", j - 1), param);
                        }
                    }

                    // skill_id
                    {
                        XElement skill_list_node = new XElement("skill_list");
                        cond_node.Add(skill_list_node);

                        string[] ary = skill_ids[i].Split('#');
                        for (int j = 0; j < ary.Length; ++j)
                        {
                            XElement skill_node = new XElement("skill");
                            skill_list_node.Add(skill_node);
                            skill_node.SetElementValue("skill_id", ary[j]);
                        }
                    }
                }

                string path = string.Format("{0}/gameworld/bossskillcondition/{1}.xml", ConfigIni.XmlDir, val_list[0]);

                Writer.Instance.WriteXml(path, doc, false);
            }

            Command.Instance.AddSvnAddFilePath(string.Format("{0}/gameworld/bossskillcondition/", ConfigIni.XmlDir));
            Command.Instance.AddSvnCommitFilePath(string.Format("{0}/gameworld/bossskillcondition/", ConfigIni.XmlDir));

            // bossskillconditionmanager
            {
                XDocument doc       = new XDocument();
                XElement  root_node = new XElement("bossskillconditionmanager");
                doc.Add(root_node);

                foreach (List <object> val_list in table.itemList)
                {
                    XElement path_node = new XElement("path");
                    path_node.SetValue(string.Format("bossskillcondition/{0}.xml", val_list[0]));
                    root_node.Add(path_node);
                }

                string path = string.Format("{0}/gameworld/bossskillconditionmanager.xml", ConfigIni.XmlDir);
                Command.Instance.AddSvnAddFilePath(path);

                Writer.Instance.WriteXml(path, doc);
                Command.Instance.AddSvnCommitFilePath(string.Format("{0}/gameworld/bossskillcondition/", ConfigIni.XmlDir));
            }

            return(true);
        }