本帖最后由 czjt1234 于 2025-2-1 15:49 编辑
| rem 另存为 ANSI 编码 bat | | | | | | Option Explicit | | Dim oDOMDocument, oWshShell, oFSO, p, i, a, f, n | | | | p = "." | | f = vbTab | | n = 10 | | | | a = Array("@id", _ | | "@level", _ | | "@type", _ | | "@name", _ | | "parameters/param[@name='MoveAroundSocial' and @value]", _ | | "parameters/param[@name='MoveAroundSocial1' and @value]", _ | | "parameters/param[@name='MoveAroundSocial2' and @value]", _ | | "race", _ | | "sex", _ | | "acquire[@exp]", _ | | "acquire[@sp]", _ | | "stats[@str]", _ | | "stats[@int]", _ | | "stats[@dex]", _ | | "stats[@wit]", _ | | "stats[@con]", _ | | "stats[@men]", _ | | "stats/vitals[@hp]", _ | | "stats/vitals[@hpRegen]", _ | | "stats/vitals[@mp]", _ | | "stats/vitals[@mpRegen]", _ | | "stats/attack[@physical]", _ | | "stats/attack[@magical]", _ | | "stats/attack[@random]", _ | | "stats/attack[@critical]", _ | | "stats/attack[@accuracy]", _ | | "stats/attack[@attackSpeed]", _ | | "stats/attack[@type]", _ | | "stats/attack[@range]", _ | | "stats/attack[@distance]", _ | | "stats/attack[@width]", _ | | "stats/defence[@physical]", _ | | "stats/defence[@magical]", _ | | "stats/attribute/defence[@fire]", _ | | "stats/attribute/defence[@water]", _ | | "stats/attribute/defence[@wind]", _ | | "stats/attribute/defence[@earth]", _ | | "stats/attribute/defence[@holy]", _ | | "stats/attribute/defence[@dark]", _ | | "stats/speed/walk[@ground]", _ | | "stats/speed/run[@ground]", _ | | "stats/hitTime", _ | | "status[@undying]", _ | | "status[@canBeSown]", _ | | "skillList/skill[@id and @level]", _ | | "exCrtEffect", _ | | "ai[@aggroRange]", _ | | "ai[@clanHelpRange]", _ | | "ai[@isAggressive]", _ | | "ai/clanList/clan", _ | | "collision/radius[@normal]", _ | | "collision/height[@normal]") | | | | Set oDOMDocument = CreateObject("Msxml2.DOMDocument") | | Set oWshShell = CreateObject("WScript.Shell") | | Set oFSO = CreateObject("Scripting.FileSystemObject") | | p = oFSO.GetAbsolutePathName(p) | | oWshShell.CurrentDirectory = p | | For Each i In oFSO.GetFolder(p).Files | | If LCase(oFSO.GetExtensionName(i)) = LCase("xml") Then Call t(i.Path) | | Next | | | | Sub t(ByVal file) | | Dim s, i, x, oNode, oNodeList, m | | oDOMDocument.load file | | If oDOMDocument.parseError.errorCode <> 0 Then | | wsh.Echo file & " Error!" | | Exit Sub | | End If | | For Each oNode In oDOMDocument.documentElement.getElementsByTagName("npc") | | s = "" | | For Each i in a | | Set oNodeList = oNode.SelectNodes(i) | | x = "" | | If oNodeList.length = 1 Then | | If Left(i, 1) ="@" Then | | x = oNodeList(0).value | | ElseIf UBound(Split(i, "@")) = 0 Then | | x = oNodeList(0).text | | ElseIf UBound(Split(i, "@")) = 1 Then | | x = RePlace(Split(i, "@")(1), "]", "") | | x = oNodeList(0).getAttribute(x) | | ElseIf UBound(Split(i, "@")) = 2 Then | | x = RePlace(Split(i, "@")(2), "]", "") | | x = oNodeList(0).getAttribute(x) | | Else | | End If | | End If | | If oNodeList.length > 1 Then | | For Each m In oNodeList | | x = x & m.getAttribute("id") & f & m.getAttribute("level") & f | | Next | | m = UBound(Split(x, f)) | | x = x & String(n * 2 - m, f) | | x = Left(x, Len(x) - 1) | | End If | | s = s & x & f | | Next | | wsh.Echo s | | Next | | End SubCOPY |
楼主的输出结果把29.5916164000214输出为了29.5916164
这里采用批处理调用vbs,输出结果不会变 |