Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1) save https://pzwiki.com/wiki/Weapons as .html file
- // 2) save code below as .cs file
- // 3) rename .html file to input.html and put in same folder as .cs file
- // 4) run .cs file using VS code or something, include the NuGet package HtmlAgilityPack
- // 5) replace Durability_Overhaul.lua adjustments with console outputs
- using HtmlAgilityPack;
- var doc = new HtmlDocument();
- doc.Load(new StreamReader("input.html"));
- var nodes = doc.DocumentNode.SelectNodes("//tbody/tr").ToArray();
- for(int i = 0; i < nodes.Length; i++) {
- var node = nodes[i];
- var conditionNode = node.SelectSingleNode("td[16]");
- var conditionLowerChanceNode = node.SelectSingleNode("td[17]");
- if(node.SelectSingleNode("td[19]") != null){
- var nameNodes = node.SelectSingleNode("td[19]").ChildNodes.ToArray();
- int condition = 0;
- if(conditionNode != null && Int32.TryParse(conditionNode.InnerHtml, out condition)) {
- for(int n = 0; n < nameNodes.Length; n++){
- var nameNode = nameNodes[n];
- if(!string.IsNullOrWhiteSpace(nameNode.InnerHtml)){
- Console.WriteLine(@"Adjust(""{0}"", ""{1}"", {2})", nameNode.InnerHtml, "ConditionMax", condition * 2);
- Console.WriteLine(@"Adjust(""{0}"", ""{1}"", {2})", nameNode.InnerHtml, "ConditionLowerChanceOneIn", Int32.Parse(conditionLowerChanceNode.InnerHtml) * 2);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment