/// <summary> /// Get full description for Buff /// </summary> /// <param name="cardID">Buff id to use</param> /// <returns>Buff full desscription</returns> public static string GetFullDescriptionForBuff(string buffID) { List <XmlDataNode> foundDataNodes = DM.GameInfos.localizeInfos["EffectTexts"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("effectTextList/BattleEffectText", attributeToCheck: new Dictionary <string, string>() { { "ID", buffID } }); if (foundDataNodes.Count <= 0) { foundDataNodes = DM.EditGameData_Buff.LocalizedBuff.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("effectTextList/BattleEffectText", attributeToCheck: new Dictionary <string, string>() { { "ID", buffID } }); } if (foundDataNodes.Count > 0) { XmlDataNode BUFF_NODE = foundDataNodes[0]; string BUFF_NAME_DES = BUFF_NODE.GetInnerTextByPath("Name"); string BUFF_DESC = BUFF_NODE.GetInnerTextByPath("Desc"); return($"{BUFF_NAME_DES} / {BUFF_DESC}:{buffID}"); } else { return($"Buff ID :{buffID}"); } }
/// <summary> /// Load xml datas /// </summary> private XmlDataNode LoadNodeData(XmlNode nodeToLoad) { XmlDataNode loadedXmlDataNode = new XmlDataNode(); loadedXmlDataNode.name = nodeToLoad.Name; if (nodeToLoad.Attributes != null) { foreach (XmlAttribute attribute in nodeToLoad.Attributes) { loadedXmlDataNode.attribute[attribute.Name] = attribute.Value; } } if (nodeToLoad.ChildNodes != null) { foreach (XmlNode childNode in nodeToLoad.ChildNodes) { if (childNode.Name == "#text") { loadedXmlDataNode.innerText = nodeToLoad.InnerText; } else if (!childNode.Name.Contains("#")) { loadedXmlDataNode.subNodes.Add(LoadNodeData(childNode)); } } } return(loadedXmlDataNode); }
/// <summary> /// Get full description for DropBook /// </summary> /// <param name="dropBookID">Drop book ID to use</param> /// <returns>Dropbook description</returns> public static string GetFullDescriptionForDropBook(string dropBookID) { List <XmlDataNode> foundDataNodes = DM.GameInfos.staticInfos["DropBook"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("BookUse", attributeToCheck: new Dictionary <string, string>() { { "ID", dropBookID } }); if (foundDataNodes.Count <= 0) { foundDataNodes = DM.EditGameData_DropBookInfo.StaticDropBookInfo.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("BookUse", attributeToCheck: new Dictionary <string, string>() { { "ID", dropBookID } }); } if (foundDataNodes.Count > 0) { XmlDataNode DROP_BOOK_NODE = foundDataNodes[0]; string DROP_BOOK_DES = LocalizedGameDescriptions.GetDescriptionForETC(DROP_BOOK_NODE.GetInnerTextByPath("TextId")); string CHAPTER_DES = LocalizedGameDescriptions.GetDescriptionForChapter(DROP_BOOK_NODE.GetInnerTextByPath("Chapter")); return($"{CHAPTER_DES} / {DROP_BOOK_DES}:{dropBookID}"); } else { return($"Drop Book ID :{dropBookID}"); } }
/// <summary> /// Get full description for Card /// </summary> /// <param name="cardID">Card id to use</param> /// <returns>Card full desscription</returns> public static string GetFullDescriptionForCard(string cardID) { List <XmlDataNode> foundDataNodes = DM.GameInfos.staticInfos["Card"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Card", attributeToCheck: new Dictionary <string, string>() { { "ID", cardID } }); if (foundDataNodes.Count <= 0) { foundDataNodes = DM.EditGameData_CardInfos.StaticCard.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Card", attributeToCheck: new Dictionary <string, string>() { { "ID", cardID } }); } if (foundDataNodes.Count > 0) { XmlDataNode CARD_NODE = foundDataNodes[0]; string CARD_NAME_DES = LocalizedGameDescriptions.GetDecriptionForCard(CARD_NODE.GetAttributesSafe("ID")); string CHAPTER_DES = LocalizedGameDescriptions.GetDescriptionForChapter(CARD_NODE.GetInnerTextByPath("Chapter")); string DIV_INFO_DES = GetDivideInfo.GetDividedCardInfo(cardID); return($"{DIV_INFO_DES} {CHAPTER_DES} / {CARD_NAME_DES}:{cardID}"); } else { return($"Card ID :{cardID}"); } }
/// <summary> /// Get full description of stage /// </summary> /// <param name="stageID">Stage ID to use</param> /// <returns>Full description for stage</returns> public static string GetFullDescriptionForStage(string stageID) { List <XmlDataNode> foundDataNodes = DM.GameInfos.staticInfos["StageInfo"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Stage", attributeToCheck: new Dictionary <string, string>() { { "id", stageID } }); if (foundDataNodes.Count <= 0) { foundDataNodes = DM.EditGameData_StageInfo.StaticStageInfo.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Stage", attributeToCheck: new Dictionary <string, string>() { { "id", stageID } }); } if (foundDataNodes.Count > 0) { XmlDataNode STAGE_NODE = foundDataNodes[0]; string STAGE_ID = STAGE_NODE.GetAttributesSafe("id"); string CHPATER_NUM = STAGE_NODE.GetInnerTextByPath("Chapter"); string STAGE_DES = LocalizedGameDescriptions.GetDescriptionForStage(STAGE_ID); string CHAPTER_DES = LocalizedGameDescriptions.GetDescriptionForChapter(CHPATER_NUM); return($"{CHAPTER_DES} / {STAGE_DES}:{STAGE_ID}"); } else { return($"Stage ID :{stageID}"); } }
/// <summary> /// Add new XmlInfoData /// </summary> /// <param name="path">XmlData path</param> /// <param name="valueToSet">Value to set</param> /// <returns>Created XmlDataNode</returns> public XmlDataNode AddXmlInfoByPath(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.AddXmlInfoByPath(String.Join("/", NAME_LIST.Skip(1)), valueToSet, attributePairsToSet)); } else { XmlDataNode createdXmlDataNode = new XmlDataNode(NAME_LIST[0]); subNodes.Add(createdXmlDataNode); return(createdXmlDataNode.AddXmlInfoByPath(String.Join("/", NAME_LIST.Skip(1)), valueToSet, attributePairsToSet)); } } else { XmlDataNode createdXmlDataNode = new XmlDataNode(NAME_LIST[0], valueToSet, attributePairsToSet); subNodes.Add(createdXmlDataNode); MainWindow.mainWindow.UpdateDebugInfo(); return(createdXmlDataNode); } }
/// <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); } } }
/// <summary> /// Get description for formation /// </summary> /// <param name="formationID"></param> /// <returns></returns> public static string GetDescriptionForFormation(string formationID) { List <XmlDataNode> formationNodes = DM.GameInfos.staticInfos["FormationInfo"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Formation", attributeToCheck: new Dictionary <string, string>() { { "ID", formationID } }); if (formationNodes.Count > 0) { XmlDataNode FORMATION_NODE = formationNodes[0]; string NUM_OF_PEOPLE_WORD = DM.LocalizeCore.GetLanguageData(DM.LANGUAGE_FILE_NAME.GLOBAL_WINDOW, $"NUM_OF_PEOPLE"); List <XmlDataNode> positionNodes = FORMATION_NODE.GetXmlDataNodesByPath("Position"); string postionDes = ""; foreach (XmlDataNode positionNode in positionNodes) { positionNode.ActionXmlDataNodesByPath("Vector", (XmlDataNode vector) => { postionDes += $"x({vector.GetAttributesSafe("x")}) y({vector.GetAttributesSafe("y")}),"; }); } postionDes = postionDes.Trim(','); return($"{NUM_OF_PEOPLE_WORD}:{positionNodes.Count} - {postionDes}:{formationID}"); } else { return($"Formation ID :{formationID}"); } }
/// <summary> /// Make new static card drop table with given bookUseID /// </summary> /// <param name="CardDropTableID">Card drop table ID to use</param> /// <returns>If given card drop table id is already used in game. Load it</returns> public static XmlDataNode MakeNewStaticCardDropTableBase(string CardDropTableID = "") { List <XmlDataNode> foundCardDropTableIDs = DM.GameInfos.staticInfos["CardDropTable"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("DropTable", attributeToCheck: new Dictionary <string, string>() { { "ID", CardDropTableID } }); if (foundCardDropTableIDs != null && foundCardDropTableIDs.Count > 0) { return(foundCardDropTableIDs[0].Copy()); } else { List <XmlDataNode> baseCardDropTableNode = DM.GameInfos.staticInfos["CardDropTable"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("DropTable", attributeToCheck: new Dictionary <string, string>() { { "ID", "200001" } }); if (baseCardDropTableNode.Count > 0) { XmlDataNode cardDropTableNode = baseCardDropTableNode[0].Copy(); cardDropTableNode.RemoveXmlInfosByPath("Card"); return(cardDropTableNode); } else { return(null); } } }
/// <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); } }
/// <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); } }
/// <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 dice base by basic node in game data /// </summary> /// <returns></returns> public static XmlDataNode MakeNewDiceBase() { List <XmlDataNode> foundXmlDataNodes = DM.GameInfos.staticInfos["Card"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Card", attributeToCheck: new Dictionary <string, string>() { { "ID", "100001" } }); if (foundXmlDataNodes.Count > 0) { List <XmlDataNode> foundDiceXmlDataNodes = foundXmlDataNodes[0].GetXmlDataNodesByPathWithXmlInfo("BehaviourList/Behaviour"); if (foundDiceXmlDataNodes.Count > 0) { XmlDataNode diceNodeToAdd = foundDiceXmlDataNodes[0].Copy(); diceNodeToAdd.attribute["Min"] = "1"; diceNodeToAdd.attribute["Dice"] = "6"; diceNodeToAdd.attribute["Type"] = "Atk"; diceNodeToAdd.attribute["Detail"] = "Slash"; diceNodeToAdd.attribute["Motion"] = "H"; diceNodeToAdd.attribute["EffectRes"] = ""; diceNodeToAdd.attribute["Script"] = ""; diceNodeToAdd.attribute["Desc"] = ""; return(diceNodeToAdd); } else { return(null); } } else { return(null); } }
/// <summary> /// Load xmlData from xml file or directory /// </summary> /// <param name="xmlPath">xml file path to load</param> public XmlData(string xmlPath) { if (xmlPath.Contains(".txt") || xmlPath.Contains(".xml")) { this.currentXmlFilePaths.Add(xmlPath); XmlDocument XML_DOC = new XmlDocument(); XML_DOC.Load(xmlPath); rootDataNode = LoadNodeData(XML_DOC.DocumentElement); } else { LoadFromXmlFilePaths(Directory.GetFiles(xmlPath).ToList()); } }
/// <summary> /// Load xmlData from multiple xml file /// </summary> /// <param name="xmlFilePaths">Multiple xml file path list</param> private void LoadFromXmlFilePaths(List <string> xmlFilePaths) { this.currentXmlFilePaths = xmlFilePaths; if (xmlFilePaths.Count > 0) { XmlDocument XML_DOC = new XmlDocument(); XML_DOC.Load(xmlFilePaths[0]); rootDataNode = LoadNodeData(XML_DOC.DocumentElement); xmlFilePaths.Skip(1).ForEachSafe((string xmlPath) => { XmlDocument XML_DOC_SUB = new XmlDocument(); XML_DOC_SUB.Load(xmlPath); rootDataNode.subNodes.AddRange(LoadNodeData(XML_DOC_SUB.DocumentElement).subNodes); }); } }
/// <summary> /// Get full description of Key Book /// </summary> /// <param name="bookID"></param> /// <returns></returns> public static string GetFullDescriptionForKeyBook(string bookID) { List <XmlDataNode> foundDataNodes = DM.GameInfos.staticInfos["EquipPage"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Book", attributeToCheck: new Dictionary <string, string>() { { "ID", bookID } }); if (foundDataNodes.Count <= 0) { foundDataNodes = DM.EditGameData_BookInfos.StaticEquipPage.rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Book", attributeToCheck: new Dictionary <string, string>() { { "ID", bookID } }); } if (foundDataNodes.Count > 0) { XmlDataNode STAGE_NODE = foundDataNodes[0]; string TEXT_ID = STAGE_NODE.GetInnerTextByPath("TextId"); string CHPATER_NUM = STAGE_NODE.GetInnerTextByPath("Chapter"); string BOOK_DES = ""; int KEY_PAGE_ID = Convert.ToInt32(bookID); if (KEY_PAGE_ID > 9000000 && KEY_PAGE_ID < 9999999) { BOOK_DES = LocalizedGameDescriptions.GetDescriptionForBooks(bookID); } else { BOOK_DES = LocalizedGameDescriptions.GetDescriptionForBooks(TEXT_ID); } string CHAPTER_DES = LocalizedGameDescriptions.GetDescriptionForChapter(CHPATER_NUM); string DIV_INFO_DES = GetDivideInfo.GetDividedKeyPageInfo(bookID); return($"{DIV_INFO_DES} {CHAPTER_DES} / {BOOK_DES}:{bookID}"); } else { return($"Book ID :{bookID}"); } }
/// <summary> /// Get inner text by searched attribute node if not null or empty /// </summary> /// <param name="path">XmlData path</param> /// <param name="attributeName">Attribute name to search</param> /// <param name="attributeValue">Attribute value to search</param> /// <param name="defaultText">Default text if given node is null or empty</param> /// <returns></returns> public string GetInnerTextByAttributeWithPath(string path, string attributeName, string attributeValue, string defaultText = "") { 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.GetInnerTextByAttributeWithPath(String.Join("/", NAME_LIST.Skip(1)), attributeName, attributeValue, defaultText)); } else { return(defaultText); } } else { XmlDataNode foundXmlDataNode = subNodes.Find((XmlDataNode xmlDataNode) => { return(xmlDataNode.name == NAME_LIST[0] && xmlDataNode.attribute.ContainsKey(attributeName) && xmlDataNode.attribute[attributeName] == attributeValue); }); if (foundXmlDataNode != null) { return(foundXmlDataNode.innerText); } else { return(defaultText); } } }
/// <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); } }
/// <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); } }
/// <summary> /// Make new drop book info base by basic node in game data /// </summary> /// <returns>Created new equip page</returns> public static XmlDataNode MakeNewCardDropTableBase() { List <XmlDataNode> cardDropTableNodes = DM.GameInfos.staticInfos["CardDropTable"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("DropTable", attributeToCheck: new Dictionary <string, string>() { { "ID", "200001" } }); if (cardDropTableNodes.Count > 0) { XmlDataNode caedDropTableBase = cardDropTableNodes[0].Copy(); caedDropTableBase.attribute["ID"] = Tools.MathTools.GetRandomNumber(1000000, 9999999).ToString(); caedDropTableBase.RemoveXmlInfosByPath("Card"); return(caedDropTableBase); } 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); } }
/// <summary> /// Make new stage info base by basic node in game data /// </summary> /// <returns>Created new equip page</returns> public static XmlDataNode MakeNewDeckInfoBase() { List <XmlDataNode> baseDeckNode = DM.GameInfos.staticInfos["Deck"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Deck", attributeToCheck: new Dictionary <string, string>() { { "ID", "200001" } }); if (baseDeckNode.Count > 0) { XmlDataNode deckNodeBase = baseDeckNode[0].Copy(); deckNodeBase.attribute["ID"] = Tools.MathTools.GetRandomNumber(999999, 5999999).ToString(); deckNodeBase.RemoveXmlInfosByPath("Card"); deckNodeBase.RemoveXmlInfosByPath("Random"); return(deckNodeBase); } else { return(null); } }
/// <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 each node data from writer /// </summary> /// <param name="writer">Writer to use</param> /// <param name="xmlDataNodeToUse">XmlDataNode that converted to string by writer</param> private void MakeEachNodeData(XmlWriter writer, XmlDataNode xmlDataNodeToUse) { writer.WriteStartElement(xmlDataNodeToUse.name); foreach (KeyValuePair <string, string> attributeKeyPair in xmlDataNodeToUse.attribute) { writer.WriteAttributeString(attributeKeyPair.Key, attributeKeyPair.Value); } if (!string.IsNullOrEmpty(xmlDataNodeToUse.innerText)) { writer.WriteString(xmlDataNodeToUse.innerText); } xmlDataNodeToUse.subNodes.ForEachSafe((XmlDataNode xmlDataNode) => { MakeEachNodeData(writer, xmlDataNode); }); writer.WriteEndElement(); }
/// <summary> /// Get inner text by searched name node if not null or empty /// </summary> /// <param name="path">XmlData path</param> /// <param name="defaultText">Default text if given node is null or empty</param> /// <returns>Searched text</returns> public string GetInnerTextByPath(string path, string defaultText = "") { 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.GetInnerTextByPath(String.Join("/", NAME_LIST.Skip(1)), defaultText)); } else { return(defaultText); } } else { XmlDataNode foundXmlDataNode = subNodes.Find((XmlDataNode xmlDataNode) => { return(xmlDataNode.name == NAME_LIST[0]); }); if (foundXmlDataNode != null) { return(foundXmlDataNode.innerText); } else { return(defaultText); } } }
/// <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 character name base by basic node in game data /// </summary> /// <returns>Created new equip page</returns> public static XmlDataNode MakeNewCharactersNameBase(string charIDToSet = "", string charToSet = "") { List <XmlDataNode> foundXmlDataNodes = DM.GameInfos.localizeInfos["CharactersName"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Name", attributeToCheck: new Dictionary <string, string>() { { "ID", "1" } }); if (foundXmlDataNodes.Count > 0) { XmlDataNode xmlDataNodeToAdd = foundXmlDataNodes[0].Copy(); xmlDataNodeToAdd.attribute["ID"] = charIDToSet; xmlDataNodeToAdd.innerText = charToSet; return(xmlDataNodeToAdd); } else { return(null); } }
/// <summary> /// Make new book name base by basic node in game data /// </summary> /// <returns>Created new book book name</returns> public static XmlDataNode MakeNewDropBookNameBase(string dropBookIdToSet = "", string nameToSet = "") { List <XmlDataNode> foundXmlDataNodes = DM.GameInfos.localizeInfos["etc"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("text", attributeToCheck: new Dictionary <string, string>() { { "id", "dropbook_rat" } }); if (foundXmlDataNodes.Count > 0) { XmlDataNode xmlDataNodeToAdd = foundXmlDataNodes[0].Copy(); xmlDataNodeToAdd.attribute["id"] = dropBookIdToSet; xmlDataNodeToAdd.innerText = 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); } }