游戏王残局简化版

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

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

Origin for each line in 残局文料/残局改名.lua from check-in 47e0a87646:

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