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")
490477db61 2024-02-03 4: local u8 = 字集码互转库.u8_to_a
490477db61 2024-02-03 5: local f = require(u8("常用库"))
13cd0daf30 2024-02-03 6: local 简文件库 = require("lfs")
a8787a258d 2024-02-03 7: local 简数据库库 = require("lsqlite3")
eda1d2cdc8 2024-02-04 8: local d = {}
b2d67bda64 2024-02-03 9: do
023be319b7 2024-02-03 10: local TYPE_SPELL = 0x2
023be319b7 2024-02-03 11: local TYPE_TRAP = 0x4
023be319b7 2024-02-03 12: local TYPE_EFFECT = 0x20
65d8c2fcdd 2024-02-03 13: local TYPE_PENDULUM = 0x1000000
65d8c2fcdd 2024-02-03 14: local 有效果卡的类排 = {
023be319b7 2024-02-03 15: TYPE_SPELL
023be319b7 2024-02-03 16: , TYPE_TRAP
023be319b7 2024-02-03 17: , TYPE_EFFECT
023be319b7 2024-02-03 18: }
023be319b7 2024-02-03 19: local 无效果灵摆怪兽排 = {
023be319b7 2024-02-03 20: 28363749 --火蛋白石头龙头领
023be319b7 2024-02-03 21: , 19474136 --曼陀林草龙
023be319b7 2024-02-03 22: , 17390179 --闪光之骑士
023be319b7 2024-02-03 23: , 83980492 --铜锣龙
023be319b7 2024-02-03 24: }
b2d67bda64 2024-02-03 25: --~ 卡对
eda1d2cdc8 2024-02-04 26: function d.筛有效果卡(o1_5)
65d8c2fcdd 2024-02-03 27: for o1 = 1, #有效果卡的类排 do
65d8c2fcdd 2024-02-03 28: if bit.band(有效果卡的类排[o1], o1_5.type) == 0 then
65d8c2fcdd 2024-02-03 29: else
65d8c2fcdd 2024-02-03 30: return o1_5
65d8c2fcdd 2024-02-03 31: end
65d8c2fcdd 2024-02-03 32: end
65d8c2fcdd 2024-02-03 33: if bit.band(TYPE_PENDULUM, o1_5.type) == 0 then
65d8c2fcdd 2024-02-03 34: else
65d8c2fcdd 2024-02-03 35: if 无效果灵摆怪兽排[o1_5.id] then
65d8c2fcdd 2024-02-03 36: else
65d8c2fcdd 2024-02-03 37: return o1_5
65d8c2fcdd 2024-02-03 38: end
65d8c2fcdd 2024-02-03 39: end
b2d67bda64 2024-02-03 40: end
b2d67bda64 2024-02-03 41: end
b2d67bda64 2024-02-03 42: --~ 卡对排
eda1d2cdc8 2024-02-04 43: function d.筛有效果卡的张数(o1_8)
d8075946c6 2024-02-03 44: local k1_8
b2d67bda64 2024-02-03 45: --~ 卡排
eda1d2cdc8 2024-02-04 46: k1_8 = f.历排(o1_8, d.筛有效果卡)
65d8c2fcdd 2024-02-03 47: return #k1_8
d8075946c6 2024-02-03 48: end
a8787a258d 2024-02-03 49: --~ 卡编排
eda1d2cdc8 2024-02-04 50: function d.取卡对_一维(o1_8)
eda1d2cdc8 2024-02-04 51: return f.历排(o1_8, d.取卡对)
a8787a258d 2024-02-03 52: end
a8787a258d 2024-02-03 53: --~ 卡编
eda1d2cdc8 2024-02-04 54: function d.取卡对(o1_8)
a8787a258d 2024-02-03 55: for o1_5 in 数据库:nrows("select * from datas where id = " .. o1_8) do
a8787a258d 2024-02-03 56: return o1_5
a8787a258d 2024-02-03 57: end
a8787a258d 2024-02-03 58: end
a8787a258d 2024-02-03 59: --~ 文
eda1d2cdc8 2024-02-04 60: function d.局筛卡编(o1)
33033c8d3d 2024-02-04 61: local k1_0
a8787a258d 2024-02-03 62: --~ 卡编排
33033c8d3d 2024-02-04 63: k1_0 = f.历文(o1, string.gmatch, "[^\n]+")
33033c8d3d 2024-02-04 64: k1_0 = f.历排(k1_0, f.全筛前缀, "Debug.AddCard")
33033c8d3d 2024-02-04 65: return f.历排(k1_0, string.match, "[0-9]+")
a8787a258d 2024-02-03 66: end
d7e39f5d2e 2024-02-03 67: --~ 文
eda1d2cdc8 2024-02-04 68: function d.局筛则数(o1)
81015f535b 2024-02-03 69: local k1
d75e496659 2024-02-04 70: local k1_0
81015f535b 2024-02-03 71: --~ 则数排
d75e496659 2024-02-04 72: k1_0 = f.历文(o1, string.gmatch, "[^\n]+")
d75e496659 2024-02-04 73: k1_0 = f.历排(k1_0, f.全筛前缀, "Debug.ReloadFieldBegin")
a8787a258d 2024-02-03 74: --~ 则数
d75e496659 2024-02-04 75: k1 = string.match(k1_0[1], "[0-9]")
81015f535b 2024-02-03 76: return k1 or 3
d7e39f5d2e 2024-02-03 77: end
13cd0daf30 2024-02-03 78: --~ 目对
987280ca92 2024-02-04 79: function d.残局改名(o1_0)
987280ca92 2024-02-04 80: local k1_0, k2_0, k3_0, k4_0, k5_0, k6_0
3a58d8f06c 2024-02-03 81: --~ 文件排
987280ca92 2024-02-04 82: k1_0 = f.历文(o1_0.文件目, 简文件库.dir)
987280ca92 2024-02-04 83: k1_0 = f.历排(k1_0, f.全筛后缀, ".lua")
987280ca92 2024-02-04 84: for o1 = 1, #k1_0 do
987280ca92 2024-02-04 85: k1_0[o1] = f.加前缀(k1_0[o1], o1_0.文件目)
987280ca92 2024-02-04 86: k1_0[o1] = f.读文件(k1_0[o1])
987280ca92 2024-02-04 87: k1_0[o1] = string.gsub(k1_0[o1], "%-%-" .. "%[(=*)%[" .. ".-" .. "%]%1%]", "")
987280ca92 2024-02-04 88: k1_0[o1] = string.gsub(k1_0[o1], "%-%-" .. "[^\n]*", "")
4d150d683b 2024-02-03 89: end
4d150d683b 2024-02-03 90: --~ 则数排
987280ca92 2024-02-04 91: k2_0 = f.历排(k1_0, d.局筛则数)
a8787a258d 2024-02-03 92: --~ 各文件的卡编排
987280ca92 2024-02-04 93: k3_0 = f.历排(k1_0, d.局筛卡编)
987280ca92 2024-02-04 94: _G.数据库 = 简数据库库.open(o1_0.数据库路)
a8787a258d 2024-02-03 95: --~ 各文件的卡对排
987280ca92 2024-02-04 96: k4_0 = f.历排(k3_0, d.取卡对_一维)
65d8c2fcdd 2024-02-03 97: --~ 有效果卡的张数排
987280ca92 2024-02-04 98: k5_0 = f.历排(k4_0, d.筛有效果卡的张数)
65d8c2fcdd 2024-02-03 99: --~ 卡文排
987280ca92 2024-02-04 100: --~ k6_0 = f.历排(k3_0, d.取卡文)
987280ca92 2024-02-04 101: --~ print(k5_0[2])
13cd0daf30 2024-02-03 102: end
eda1d2cdc8 2024-02-04 103: d.目对 = {
13cd0daf30 2024-02-03 104: ["文件目"] = "../single/"
13cd0daf30 2024-02-03 105: , ["数据库路"] = [[D:\install\YGOPro\cards.cdb]]
9cdbbb717e 2024-02-03 106: }
eda1d2cdc8 2024-02-04 107: for o1_0, o2_0 in pairs(d.目对) do
eda1d2cdc8 2024-02-04 108: d.目对[o1_0] = f.操类(o2_0, "string", u8)
13cd0daf30 2024-02-03 109: end
eda1d2cdc8 2024-02-04 110: d.残局改名(d.目对)