游戏王残局简化版

Annotation For 残局文料/残局改名.lua
Login

Annotation For 残局文料/残局改名.lua

Lines of 残局文料/残局改名.lua from check-in 6d89c30f8a that are changed by the sequence of edits moving toward check-in 47e0a87646:

                         1: package.path = [[.\lua_lib\?.lua;]] .. package.path
                         2: package.cpath = [[.\lua_lib\?.dll;]] .. package.cpath
                         3: local 字集码互转库 = require("u8_to_a")
                         4: local 字集库 = require("u8_to_a")
                         5: local u8 = 字集码互转库.u8_to_a
                         6: local f = require(u8("常用库"))
                         7: local 字段名对 = require(u8("字段名"))
                         8: local 文件系库 = require("lfs")
                         9: local 档库 = require("lsqlite3")
                        10: local 基算库 = require(字集库.u8_to_a("算机_程语_月_基类_数_基算"))
                        11: local 位算库 = require(字集库.u8_to_a("算机_程语_月_基类_数_位算"))
                        12: local 前缀库 = require(字集库.u8_to_a("算机_程语_月_基类_文_前缀"))
                        13: local 后缀库 = require(字集库.u8_to_a("算机_程语_月_基类_文_后缀"))
                        14: local 历排库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_历_基类_表_排_取全"))
                        15: local 历对库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_历_基类_表_对_取全"))
                        16: local 历文库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_历_基类_文_取全"))
                        17: local 历排取一库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_历_基类_表_排_取一"))
                        18: local 基类库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_基类"))
                        19: local 历对取一库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_历_基类_表_对_取一"))
6d89c30f8a 2024-02-09   20: local 筛卡库 = require(字集库.u8_to_a("游戏王_则拟器_原版_残局_卡_全筛_有效果卡"))
                        21: local 对库 = require(字集库.u8_to_a("算机_程语_月_基类_表_对"))
                        22: local 字节库 = require(字集库.u8_to_a("算机_理器_通用_字节"))
                        23: local 读文件库 = require(字集库.u8_to_a("算机_基统_窗群_文件系_小文件_读"))
                        24: local 写文件库 = require(字集库.u8_to_a("算机_基统_窗群_文件系_小文件_写"))
                        25: local string = string
                        26: local os = os
                        27: local d = {}
                        28: local 卡档
                        29: --~ 各文件的卡对排
                        30: function d.筛有效果卡_一维(o1_0)
                        31:   return 历排库.历排(o1_0, 筛卡库.筛有效果卡)
                        32:   end
                        33: --~ 各文件的卡编排
                        34: function d.取卡对_一维(o1_0)
                        35:   return 历排库.历排(o1_0, d.取卡对)
                        36:   end
                        37: --~ 卡编
                        38: function d.取卡对(o1)
                        39:   local k1_0, k2_0
                        40:   --~ 卡文对
                        41:   k1_0 = d.取卡文(o1)
                        42:   --~ 卡数据对
                        43:   k2_0 = d.取卡数据(o1)
                        44:   return 对库.连两对(k1_0, k2_0)
                        45:   end
                        46: --~ 卡编
                        47: function d.取卡文(o1)
                        48:   for o1_4 in 卡档:nrows("select * from texts where id = " .. o1) do
                        49:     return o1_4
                        50:     end
                        51:   end
                        52: --~ 卡编
                        53: function d.取卡数据(o1)
                        54:   for o1_4 in 卡档:nrows("select * from datas where id = " .. o1) do
                        55:     return o1_4
                        56:     end
                        57:   end
                        58: --~ 文
                        59: function d.局筛卡编(o1)
                        60:   local k1_0
                        61:   --~ 卡编排
                        62:   k1_0 = 历文库.历文(o1, string.gmatch, "[^\n]+")
                        63:   k1_0 = 历排库.历排(k1_0, string.match, "Debug%.AddCard.+")
                        64:   return 历排库.历排(k1_0, string.match, "[0-9]+")
                        65:   end
                        66: --~ 文
                        67: function d.局筛则数(o1)
                        68:   local k1
                        69:   local k1_0
                        70:   --~ 则数排
                        71:   k1_0 = 历文库.历文(o1, string.gmatch, "[^\n]+")
                        72:   k1_0 = 历排库.历排(k1_0, 前缀库.全筛前缀, "Debug.ReloadFieldBegin")
                        73:   --~ 则数
                        74:   k1 = string.match(k1_0[1], "[0-9]")
                        75:   return k1 or 3
                        76:   end
                        77: --~ 卡对排
                        78: function d.荐名(o1_0)
                        79:   local k1
                        80:   --~ 名
                        81:   k1 = d.荐字段名(o1_0)
                        82:   if k1 then
                        83:   else
                        84:     k1 = d.荐卡名(o1_0)
                        85:     end
                        86:   if k1 then
                        87:     return k1
                        88:   else
                        89:     return "请便"
                        90:     end
                        91:   end
                        92: --~ 卡对排
                        93: function d.荐卡名(o1_0)
                        94:   local k1_0
                        95:   --~ 卡名排
                        96:   k1_0 = 历排库.历排(o1_0, d.取卡名)
                        97:   return 历排取一库.筛最短文(k1_0)
                        98:   end
                        99: --~ 卡对
                       100: function d.取卡名(o1_0)
                       101:   return o1_0.name
                       102:   end
                       103: --~ 卡对排
                       104: function d.取字段对(o1_0)
                       105:   local k1, k2, k3, k4
                       106:   local k1_0
                       107:   --~ 字段对
                       108:   k1_0 = {}
                       109:   for o1 = 1, #o1_0 do
                       110:     --~ 字段数
                       111:     k1 = 字节库.to_uint64(o1_0[o1].setcode)
                       112:     if k1 < 1 then
                       113:     else
                       114:       if k1 > 0xffffFFFFffff then
                       115:         k1 = k1 - 1
                       116:       else
                       117:         for o2 = 1, 11112222 do
                       118:           if k1 < 1 then
                       119:             break
                       120:           else
                       121:             --~ 大字段号
                       122:             k2 = 位算库.位和(k1, 0xffff)
                       123:             k1 = 位算库.位右移(k1, 基算库.乘法(4, 4))
                       124:             --~ 字段名
                       125:             k3 = 字段名对[tonumber(k2)]
                       126:             if k3 then
                       127:               if k1_0[k3] then
                       128:                 k1_0[k3] = 基算库.加法(k1_0[k3], 1)
                       129:               else
                       130:                 k1_0[k3] = 1
                       131:                 end
                       132:               if k2 > 0xfff then
                       133:                 --~ 小字段号
                       134:                 k4 = 位算库.位和(k2, 0xfff)
                       135:                 k3 = 字段名对[tonumber(k4)]
                       136:                 if k3 then
                       137:                   if k1_0[k3] then
                       138:                     k1_0[k3] = 基算库.加法(k1_0[k3], 1)
                       139:                   else
                       140:                     k1_0[k3] = 1
                       141:                     end
                       142:                 else
                       143:                   end
                       144:               else
                       145:                 end
                       146:             else
                       147:               end
                       148:             end
                       149:           end
                       150:         end
                       151:       end
                       152:     end
                       153:   return k1_0
                       154:   end
                       155: --~ 卡对排
                       156: function d.荐字段名(o1_0)
                       157:   local k1
                       158:   local k1_0
                       159:   --~ 字段对
                       160:   k1_0 = d.取字段对(o1_0)
                       161:   --~ 最大的字段名数量
                       162:   _, k1 = 历对取一库.筛最大值(k1_0)
                       163:   --~ 最高频字段名对
                       164:   k2_0 = 历对库.历对(k1_0, 历对库.全等筛值, k1)
                       165:   return 历对取一库.筛最短键(k2_0)
                       166:   end
                       167: --~ 目对
6d89c30f8a 2024-02-09  168: function d.残局荐名(o1_0)
                       169:   local k1, k2
                       170:   local k1_0, k2_0, k3_0, k4_0, k5_0, k6_0, k7_0, k8_0, k9_0
                       171:   local k10_0
                       172:   --~ 文件名排
                       173:   k1_0 = 历文库.历文(o1_0.文件目, 文件系库.dir)
                       174:   k1_0 = 历排库.历排(k1_0, 后缀库.全筛后缀, ".lua")
                       175:   --~ 文件排
                       176:   k2_0 = 历排库.历排(k1_0, 后缀库.全筛后缀, ".lua")
                       177:   for o1 = 1, #k2_0 do
                       178:     k2_0[o1] = 前缀库.加前缀(k2_0[o1], o1_0.文件目)
                       179:     k2_0[o1] = 读文件库.读文件(k2_0[o1])
                       180:     k2_0[o1] = string.gsub(k2_0[o1], "%-%-" .. "%[(=*)%[" .. ".-" .. "%]%1%]", "")
                       181:     k2_0[o1] = string.gsub(k2_0[o1], "%-%-" .. "[^\n]*", "")
                       182:     end
                       183:   --~ 则数排
                       184:   k3_0 = 历排库.历排(k2_0, d.局筛则数)
                       185:   --~ 各文件的卡编排
                       186:   k4_0 = 历排库.历排(k2_0, d.局筛卡编)
                       187:   --~ 各文件的卡对排
                       188:   k5_0 = 历排库.历排(k4_0, d.取卡对_一维)
                       189:   --~ 有效果卡的卡对排
                       190:   k6_0 = 历排库.历排(k5_0, d.筛有效果卡_一维)
                       191:   --~ 有效果卡的张数排
                       192:   k7_0 = 历排库.历排(k6_0, table.maxn)
                       193:   --~ 荐名排
                       194:   k8_0 = 历排库.历排(k6_0, d.荐名)
                       195:   --~ 新名排
                       196:   k9_0 = 历排库.历排(k1_0, string.gsub, 字集库.u8_to_a(" " .. ".+"), "")
                       197:   --~ 编号排
                       198:   k10_0 = 历排库.历排(k1_0, string.gsub, 字集库.u8_to_a(" " .. ".+"), "")
                       199:   for o1 = 1, #k1_0 do
                       200:     k9_0[o1] = string.gsub(k9_0[o1], "%." .. "lua".. "$", "")
                       201:     k9_0[o1] = 字集库.a_to_u8(o1_0.文件目) .. 字集库.a_to_u8(k9_0[o1]) .. " " .. k3_0[o1] .. "_" .. k7_0[o1] .. "_" .. k8_0[o1] .. "." .. "lua"
                       202:     k1_0[o1] = o1_0.文件目 .. k1_0[o1]
                       203:     --~ 新名
                       204:     k1 = 字集库.u8_to_a(k9_0[o1])
6d89c30f8a 2024-02-09  205:     os.rename(k1_0[o1], k1)
                       206:     --~ 文件
6d89c30f8a 2024-02-09  207:     k2 = 读文件库.读文件(k1)
6d89c30f8a 2024-02-09  208:     k10_0[o1] = 字集库.a_to_u8(k10_0[o1])
6d89c30f8a 2024-02-09  209:     k2 = string.gsub(k2, "Debug" .. "%." .. "SetAIName" .. "[^\n]+", [[Debug.SetAIName("]] .. k10_0[o1] .. [[")]], 1)
6d89c30f8a 2024-02-09  210:     写文件库(k2, k1)
                       211:     end
                       212:   end
                       213: d.目对 = {
                       214:   ["文件目"] = "../single/"
                       215:   , ["卡档路"] = [[D:\install\YGOPro\cards.cdb]]
                       216:   }
                       217: for o1, o2 in pairs(d.目对) do
                       218:   d.目对[o1] = 基类库.操类(o2, "string", 字集库.u8_to_a)
                       219:   end
                       220: 卡档 = 档库.open(d.目对.卡档路)
6d89c30f8a 2024-02-09  221: d.残局荐名(d.目对)