Пример #1
0
        /// <summary>
        /// Make new card base by basic node in game data
        /// </summary>
        /// <returns>Created new Card</returns>
        public static XmlDataNode MakeNewCardBase()
        {
            List <XmlDataNode> foundXmlDataNodes = DM.GameInfos.staticInfos["Card"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Card",
                                                                                                                                  attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", "100001" }
            });

            if (foundXmlDataNodes.Count > 0)
            {
                XmlDataNode xmlDataNodeToAdd = foundXmlDataNodes[0].Copy();

                string RANDOM_CARD_ID = Tools.MathTools.GetRandomNumber(DS.FilterDatas.CARD_DIV_SPECIAL, DS.FilterDatas.CARD_DIV_FINAL_STORY).ToString();
                xmlDataNodeToAdd.attribute["ID"] = RANDOM_CARD_ID;

                xmlDataNodeToAdd.SetXmlInfoByPath("Name", "");
                xmlDataNodeToAdd.SetXmlInfoByPath("Artwork", "");
                xmlDataNodeToAdd.SetXmlInfoByPath("Rarity", "Common");
                xmlDataNodeToAdd.RemoveXmlInfosByPath("BehaviourList/Behaviour");
                return(xmlDataNodeToAdd);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Make new enemy unit info base by basic node in game data
        /// </summary>
        /// <returns>Created new equip page</returns>
        public static XmlDataNode MakeNewEnemyUnitInfoBase()
        {
            List <XmlDataNode> baseBookUseNode = DM.GameInfos.staticInfos["EnemyUnitInfo"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Enemy",
                                                                                                                                         attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", "1" }
            });

            if (baseBookUseNode.Count > 0)
            {
                XmlDataNode bookUseIdBase = baseBookUseNode[0].Copy();
                bookUseIdBase.attribute["ID"] = Tools.MathTools.GetRandomNumber(100000, 999999).ToString();
                bookUseIdBase.SetXmlInfoByPath("NameID", "");
                bookUseIdBase.SetXmlInfoByPath("MinHeight", "");
                bookUseIdBase.SetXmlInfoByPath("MaxHeight", "");

                bookUseIdBase.SetXmlInfoByPath("BookId", "");
                bookUseIdBase.SetXmlInfoByPath("DeckId", "");

                bookUseIdBase.RemoveXmlInfosByPath("DropTable");
                return(bookUseIdBase);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Make new static drop books with given bookUseID
        /// </summary>
        /// <param name="bookUseID">BookUseID to use</param>
        /// <returns>If given bookUseIs is already used in game. Load it</returns>
        public static XmlDataNode MakeNewStaticDropBookBase(string bookUseID = "")
        {
            List <XmlDataNode> foundBookUseIds = DM.GameInfos.staticInfos["DropBook"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("BookUse",
                                                                                                                                    attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", bookUseID }
            });

            if (foundBookUseIds != null && foundBookUseIds.Count > 0)
            {
                return(foundBookUseIds[0].Copy());
            }
            else
            {
                List <XmlDataNode> baseBookUseNode = DM.GameInfos.staticInfos["DropBook"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("BookUse",
                                                                                                                                        attributeToCheck: new Dictionary <string, string>()
                {
                    { "ID", "31" }
                });
                if (baseBookUseNode.Count > 0)
                {
                    XmlDataNode bookUseIdBase = baseBookUseNode[0].Copy();
                    bookUseIdBase.attribute["ID"] = bookUseID;
                    bookUseIdBase.SetXmlInfoByPath("Name", "");
                    bookUseIdBase.SetXmlInfoByPath("TextId", "");
                    bookUseIdBase.SetXmlInfoByPath("Chapter", "");
                    return(bookUseIdBase);
                }
                else
                {
                    return(null);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Make new stage info base by basic node in game data
        /// </summary>
        /// <returns>Created new equip page</returns>
        public static XmlDataNode MakeNewStageInfoBase()
        {
            List <XmlDataNode> baseBookUseNode = DM.GameInfos.staticInfos["StageInfo"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Stage",
                                                                                                                                     attributeToCheck: new Dictionary <string, string>()
            {
                { "id", "2" }
            });

            if (baseBookUseNode.Count > 0)
            {
                XmlDataNode bookUseIdBase = baseBookUseNode[0].Copy();
                bookUseIdBase.attribute["id"] = Tools.MathTools.GetRandomNumber(1000000, 9999999).ToString();
                bookUseIdBase.SetXmlInfoByPath("Name", "");
                bookUseIdBase.SetXmlInfoByPath("Chapter", "");
                bookUseIdBase.SetXmlInfoByPath("StoryType", "");

                bookUseIdBase.RemoveXmlInfosByPath("Wave");
                bookUseIdBase.RemoveXmlInfosByPath("Invitation/Book");

                bookUseIdBase.ActionXmlDataNodesByPath("Story", (XmlDataNode storyNode) =>
                {
                    storyNode.innerText = "";
                });
                return(bookUseIdBase);
            }
            else
            {
                return(null);
            }
        }
Пример #5
0
        /// <summary>
        /// Make new wav info base by basic node in game data
        /// </summary>
        /// <returns></returns>
        public static XmlDataNode MakeNewWaveInfoBase()
        {
            List <XmlDataNode> baseBookUseNode = DM.GameInfos.staticInfos["StageInfo"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Stage",
                                                                                                                                     attributeToCheck: new Dictionary <string, string>()
            {
                { "id", "2" }
            });

            if (baseBookUseNode.Count > 0)
            {
                XmlDataNode STAGE_NODE_TO_USE = baseBookUseNode[0];

                List <XmlDataNode> baseWaveNode = STAGE_NODE_TO_USE.GetXmlDataNodesByPath("Wave");
                if (baseWaveNode.Count > 0)
                {
                    XmlDataNode baseWaveNodeToUse = baseWaveNode[0].Copy();
                    baseWaveNodeToUse.SetXmlInfoByPath("Formation", "");
                    baseWaveNodeToUse.RemoveXmlInfosByPath("Unit");
                    return(baseWaveNodeToUse);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
        /// <summary>
        /// Make new buff info base by basic node in game data
        /// </summary>
        /// <returns>Created new equip page</returns>
        public static XmlDataNode MakeNewBuffInfoBase()
        {
            List <XmlDataNode> baseBuffNode = DM.GameInfos.localizeInfos["EffectTexts"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("effectTextList/BattleEffectText",
                                                                                                                                      attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", "Burn" }
            });

            if (baseBuffNode.Count > 0)
            {
                XmlDataNode BuffNodeBase = baseBuffNode[0].Copy();
                BuffNodeBase.attribute["ID"] = Tools.MathTools.GetRandomNumber(999999, 9999999).ToString();
                BuffNodeBase.SetXmlInfoByPath("Name", "");
                BuffNodeBase.SetXmlInfoByPath("Desc", "");
                return(BuffNodeBase);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Make new enemy unit info base by basic node in game data
        /// </summary>
        /// <returns>Created new equip page</returns>
        public static XmlDataNode MakeNewPassiveListBase()
        {
            List <XmlDataNode> basePassiveNode = DM.GameInfos.staticInfos["PassiveList"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Passive",
                                                                                                                                       attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", "250005" }
            });

            if (basePassiveNode.Count > 0)
            {
                XmlDataNode basePassiveBase = basePassiveNode[0].Copy();
                basePassiveBase.attribute["ID"] = Tools.MathTools.GetRandomNumber(1000000, 9999999).ToString();
                basePassiveBase.SetXmlInfoByPath("Rarity", "Common");
                basePassiveBase.SetXmlInfoByPath("Cost", "1");
                return(basePassiveBase);
            }
            else
            {
                return(null);
            }
        }
Пример #8
0
        /// <summary>
        /// Set inner text by paths (If not exist, make new XmlData)
        /// </summary>
        /// <param name="path">XmlData path</param>
        /// <param name="valueToSet">Value to set</param>
        /// <returns>Edited XmlDataNode</returns>
        public XmlDataNode SetXmlInfoByPath(string path, string valueToSet = "", Dictionary <string, string> attributePairsToSet = null)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }

            List <string> NAME_LIST = path.Split('/').ToList();

            if (NAME_LIST.Count > 1)
            {
                XmlDataNode foundXmlDataNode = subNodes.Find((XmlDataNode xmlDataNode) =>
                {
                    return(xmlDataNode.name == NAME_LIST[0]);
                });
                if (foundXmlDataNode != null)
                {
                    return(foundXmlDataNode.SetXmlInfoByPath(String.Join("/", NAME_LIST.Skip(1)), valueToSet, attributePairsToSet));
                }
                else
                {
                    XmlDataNode createdXmlDataNode = new XmlDataNode(NAME_LIST[0]);
                    subNodes.Add(createdXmlDataNode);
                    return(createdXmlDataNode.SetXmlInfoByPath(String.Join("/", NAME_LIST.Skip(1)), valueToSet, attributePairsToSet));
                }
            }
            else
            {
                XmlDataNode foundXmlDataNode = subNodes.Find((XmlDataNode xmlDataNode) =>
                {
                    return(xmlDataNode.name == NAME_LIST[0]);
                });
                if (foundXmlDataNode != null)
                {
                    foundXmlDataNode.innerText = valueToSet;
                    attributePairsToSet.ForEachKeyValuePairSafe((string atName, string atValue) => {
                        attribute[atName] = atValue;
                    });
                    MainWindow.mainWindow.UpdateDebugInfo();
                    return(foundXmlDataNode);
                }
                else
                {
                    XmlDataNode createdXmlDataNode = new XmlDataNode(NAME_LIST[0], valueToSet, attributePairsToSet);
                    subNodes.Add(createdXmlDataNode);
                    MainWindow.mainWindow.UpdateDebugInfo();
                    return(createdXmlDataNode);
                }
            }
        }
        /// <summary>
        /// Make new character name base by basic node in game data
        /// </summary>
        /// <returns>Created new equip page</returns>
        public static XmlDataNode MakeNewPassiveDescBase(string descID, string descName, string descDetail)
        {
            List <XmlDataNode> foundXmlDataNodes = DM.GameInfos.localizeInfos["PassiveDesc"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("PassiveDesc",
                                                                                                                                           attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", "250005" }
            });

            if (foundXmlDataNodes.Count > 0)
            {
                XmlDataNode xmlDataNodeToAdd = foundXmlDataNodes[0].Copy();

                xmlDataNodeToAdd.attribute["ID"] = descID;
                xmlDataNodeToAdd.SetXmlInfoByPath("Name", descName);
                xmlDataNodeToAdd.SetXmlInfoByPath("Desc", descDetail);

                return(xmlDataNodeToAdd);
            }
            else
            {
                return(null);
            }
        }
Пример #10
0
        /// <summary>
        /// Make new drop book info base by basic node in game data
        /// </summary>
        /// <returns>Created new equip page</returns>
        public static XmlDataNode MakeNewDropBookInfoBase()
        {
            List <XmlDataNode> baseBookUseNode = DM.GameInfos.staticInfos["DropBook"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("BookUse",
                                                                                                                                    attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", "230002" }
            });

            if (baseBookUseNode.Count > 0)
            {
                XmlDataNode bookUseIdBase = baseBookUseNode[0].Copy();
                bookUseIdBase.attribute["ID"] = Tools.MathTools.GetRandomNumber(1000000, 9999999).ToString();
                bookUseIdBase.SetXmlInfoByPath("TextId", "");
                bookUseIdBase.SetXmlInfoByPath("BookIcon", "");
                bookUseIdBase.SetXmlInfoByPath("Chapter", "1");
                bookUseIdBase.RemoveXmlInfosByPath("DropItem");
                return(bookUseIdBase);
            }
            else
            {
                return(null);
            }
        }
Пример #11
0
        /// <summary>
        /// Make new stage info base by basic node in game data
        /// </summary>
        /// <returns>Created new equip page</returns>
        public static XmlDataNode MakeNewCardAbilityInfoBase()
        {
            List <XmlDataNode> baseAbilityNode = DM.GameInfos.localizeInfos["BattleCardAbilities"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("BattleCardAbility",
                                                                                                                                                 attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", "vulnerable1atk" }
            });

            if (baseAbilityNode.Count > 0)
            {
                XmlDataNode abilityNodeBase = baseAbilityNode[0].Copy();
                abilityNodeBase.attribute["ID"] = Tools.MathTools.GetRandomNumber(999999, 9999999).ToString();
                abilityNodeBase.SetXmlInfoByPath("Desc", "");
                return(abilityNodeBase);
            }
            else
            {
                return(null);
            }
        }
Пример #12
0
        /// <summary>
        /// Make new localize battle cards by basic node in game data
        /// </summary>
        /// <returns>Created localized base card info</returns>
        public static XmlDataNode MakeNewLocalizedBattleCardsBase(string cardIdToSet = "", string nameToSet = "")
        {
            List <XmlDataNode> foundXmlDataNodes = DM.GameInfos.localizeInfos["BattlesCards"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("cardDescList/BattleCardDesc",
                                                                                                                                            attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", "1" }
            });

            if (foundXmlDataNodes.Count > 0)
            {
                XmlDataNode xmlDataNodeToAdd = foundXmlDataNodes[0].Copy();

                xmlDataNodeToAdd.attribute["ID"] = cardIdToSet;
                xmlDataNodeToAdd.SetXmlInfoByPath("LocalizedName", nameToSet);

                return(xmlDataNodeToAdd);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Make new localize books base by basic node in game data
        /// </summary>
        /// <returns>Created books info</returns>
        public static XmlDataNode MakeNewLocalizeBooksBase(string bookIdToSet = "", string nameToSet = "", string desc = "")
        {
            List <XmlDataNode> foundXmlDataNodes = DM.GameInfos.localizeInfos["Books"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("bookDescList/BookDesc",
                                                                                                                                     attributeToCheck: new Dictionary <string, string>()
            {
                { "BookID", "200001" }
            });

            if (foundXmlDataNodes.Count > 0)
            {
                XmlDataNode xmlDataNodeToAdd = foundXmlDataNodes[0].Copy();

                xmlDataNodeToAdd.attribute["BookID"] = bookIdToSet;
                xmlDataNodeToAdd.SetXmlInfoByPath("BookName", nameToSet);

                if (!string.IsNullOrEmpty(desc))
                {
                    xmlDataNodeToAdd.RemoveXmlInfosByPath("TextList/Desc");

                    foreach (string desPart in desc.Split(new string[] { "\r\n\r\n" }, StringSplitOptions.None))
                    {
                        string DESC_TO_ADD = desPart.Replace("\r\n", " ").Replace("\r", "").Replace("\n", "");
                        xmlDataNodeToAdd.AddXmlInfoByPath("TextList/Desc", DESC_TO_ADD);
                    }
                }
                else
                {
                    xmlDataNodeToAdd.RemoveXmlInfosByPath("TextList/Desc");
                    xmlDataNodeToAdd.MakeEmptyNodeGivenPathIfNotExist("TextList/Desc");
                }

                return(xmlDataNodeToAdd);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Make new equip page base by basic node in game data
        /// </summary>
        /// <returns>Created new equip page</returns>
        public static XmlDataNode MakeNewStaticEquipPageBase()
        {
            List <XmlDataNode> foundXmlDataNodes = DM.GameInfos.staticInfos["EquipPage"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Book",
                                                                                                                                       attributeToCheck: new Dictionary <string, string>()
            {
                { "ID", "200001" }
            });

            if (foundXmlDataNodes.Count > 0)
            {
                XmlDataNode xmlDataNodeToAdd = foundXmlDataNodes[0].Copy();

                string RANDOM_BOOK_ID = Tools.MathTools.GetRandomNumber(DS.FilterDatas.CRITICAL_PAGE_DIV_USER, DS.FilterDatas.CRITICAL_PAGE_DIV_CUSTOM).ToString();
                xmlDataNodeToAdd.attribute["ID"] = RANDOM_BOOK_ID;
                xmlDataNodeToAdd.SetXmlInfoByPath("TextId", RANDOM_BOOK_ID);

                xmlDataNodeToAdd.SetXmlInfoByPath("Name", "");
                xmlDataNodeToAdd.SetXmlInfoByPath("BookIcon", "");
                xmlDataNodeToAdd.SetXmlInfoByPath("Rarity", "Common");
                xmlDataNodeToAdd.SetXmlInfoByPath("Chapter", "");
                xmlDataNodeToAdd.SetXmlInfoByPath("Episode", "");
                xmlDataNodeToAdd.SetXmlInfoByPath("CharacterSkin", "");

                xmlDataNodeToAdd.SetXmlInfoByPath("EquipEffect/HP", "50");
                xmlDataNodeToAdd.SetXmlInfoByPath("EquipEffect/Break", "50");
                xmlDataNodeToAdd.SetXmlInfoByPath("EquipEffect/SpeedMin", "1");
                xmlDataNodeToAdd.SetXmlInfoByPath("EquipEffect/Speed", "6");

                xmlDataNodeToAdd.SetXmlInfoByPath("EquipEffect/SResist", "Normal");
                xmlDataNodeToAdd.SetXmlInfoByPath("EquipEffect/PResist", "Normal");
                xmlDataNodeToAdd.SetXmlInfoByPath("EquipEffect/HResist", "Normal");

                xmlDataNodeToAdd.SetXmlInfoByPath("EquipEffect/SBResist", "Normal");
                xmlDataNodeToAdd.SetXmlInfoByPath("EquipEffect/PBResist", "Normal");
                xmlDataNodeToAdd.SetXmlInfoByPath("EquipEffect/HBResist", "Normal");
                return(xmlDataNodeToAdd);
            }
            else
            {
                return(null);
            }
        }