Lines of
残局文料/残局改名.lua
from check-in 0667f9cf14
that are changed by the sequence of edits moving toward
check-in 054bca82de:
1: package.path = [[.\lua_lib\?.lua;]] .. package.path
2: package.cpath = [[.\lua_lib\?.dll;]] .. package.cpath
3: local 字集码互转库 = require("u8_to_a")
4: local u8 = 字集码互转库.u8_to_a
5: local f = require(u8("常用库"))
6: local 简文件库 = require("lfs")
7: local 简数据库库 = require("lsqlite3")
8: local d_3 = {}
9: do
10: local TYPE_SPELL = 0x2
11: local TYPE_TRAP = 0x4
12: local TYPE_EFFECT = 0x20
13: local TYPE_PENDULUM = 0x1000000
14: local 有效果卡的类排 = {
15: TYPE_SPELL
16: , TYPE_TRAP
17: , TYPE_EFFECT
18: }
19: local 无效果灵摆怪兽排 = {
20: 28363749 --火蛋白石头龙头领
21: , 19474136 --曼陀林草龙
22: , 17390179 --闪光之骑士
23: , 83980492 --铜锣龙
24: }
25: --~ 卡对
26: function d_3.筛有效果卡(o1_5)
27: for o1 = 1, #有效果卡的类排 do
28: if bit.band(有效果卡的类排[o1], o1_5.type) == 0 then
29: else
30: return o1_5
31: end
32: end
33: if bit.band(TYPE_PENDULUM, o1_5.type) == 0 then
34: else
35: if 无效果灵摆怪兽排[o1_5.id] then
36: else
37: return o1_5
38: end
39: end
40: end
41: end
42: --~ 卡对排
43: function d_3.筛有效果卡的张数(o1_8)
44: local k1_8
45: --~ 卡排
46: k1_8 = f.历排(o1_8, d_3.筛有效果卡)
47: return #k1_8
48: end
49: --~ 卡编排
50: function d_3.取卡对_一维(o1_8)
51: return f.历排(o1_8, d_3.取卡对)
52: end
53: --~ 卡编
54: function d_3.取卡对(o1_8)
55: for o1_5 in 数据库:nrows("select * from datas where id = " .. o1_8) do
56: return o1_5
57: end
58: end
59: --~ 文
60: function d_3.局筛卡编(o1)
61: local k1_9
62: --~ 卡编排
63: k1_9 = f.历文(o1, string.gmatch, "[^\n]+")
64: k1_9 = f.历排(k1_9, f.全筛前缀, "Debug.AddCard")
65: return f.历排(k1_9, string.match, "[0-9]+")
66: end
67: --~ 文
68: function d_3.局筛则数(o1)
69: local k1
70: local k1_9
71: --~ 则数排
72: k1_9 = f.历文(o1, string.gmatch, "[^\n]+")
73: k1_9 = f.历排(k1_9, f.全筛前缀, "Debug.ReloadFieldBegin")
74: --~ 则数
75: k1 = string.match(k1_9[1], "[0-9]")
76: return k1 or 3
77: end
78: --~ 目对
79: function d_3.残局改名(o1)
80: local k1_9, k2_9, k3_9, k4_9, k5_9, k6_9
81: --~ 文件排
82: k1_9 = f.历文(o1.文件目, 简文件库.dir)
83: k1_9 = f.历排(k1_9, f.全筛后缀, ".lua")
84: for o2 = 1, #k1_9 do
85: k1_9[o2] = f.加前缀(k1_9[o2], o1.文件目)
86: k1_9[o2] = f.读文件(k1_9[o2])
87: k1_9[o2] = string.gsub(k1_9[o2], "%-%-" .. "%[(=*)%[" .. ".-" .. "%]%1%]", "")
88: k1_9[o2] = string.gsub(k1_9[o2], "%-%-" .. "[^\n]*", "")
89: end
90: --~ 则数排
91: k2_9 = f.历排(k1_9, d_3.局筛则数)
92: --~ 各文件的卡编排
93: k3_9 = f.历排(k1_9, d_3.局筛卡编)
94: _G.数据库 = 简数据库库.open(o1.数据库路)
95: --~ 各文件的卡对排
96: k4_9 = f.历排(k3_9, d_3.取卡对_一维)
97: --~ 有效果卡的张数排
98: k5_9 = f.历排(k4_9, d_3.筛有效果卡的张数)
99: --~ 卡文排
100: --~ k6_9 = f.历排(k3_9, d_3.取卡文)
101: --~ print(k5_9[2])
102: end
103: d_3.目对 = {
104: ["文件目"] = "../single/"
105: , ["数据库路"] = [[D:\install\YGOPro\cards.cdb]]
106: }
0667f9cf14 2024-02-04 107: for o1, o2 in pairs(d_3.目对) do
0667f9cf14 2024-02-04 108: d_3.目对[o1] = f.操类(o2, "string", u8)
109: end
110: d_3.残局改名(d_3.目对)