c4461ce231 2024-02-05 顽雨沉风: package.path = [[.\lua_lib\?.lua;]] .. package.path
c4461ce231 2024-02-05 顽雨沉风: package.cpath = [[.\lua_lib\?.dll;]] .. package.cpath
c4461ce231 2024-02-05 顽雨沉风: local 字集码互转库 = require("u8_to_a")
c4461ce231 2024-02-05 顽雨沉风: local u8 = 字集码互转库.u8_to_a
c4461ce231 2024-02-05 顽雨沉风: local f = require(u8("常用库"))
c4461ce231 2024-02-05 顽雨沉风: local 字段名对 = require(u8("字段名"))
c4461ce231 2024-02-05 顽雨沉风: local 简文件库 = require("lfs")
c4461ce231 2024-02-05 顽雨沉风: local 简数据库库 = require("lsqlite3")
c4461ce231 2024-02-05 顽雨沉风: local d = {}
c4461ce231 2024-02-05 顽雨沉风: do
c4461ce231 2024-02-05 顽雨沉风: local TYPE_SPELL = 0x2
c4461ce231 2024-02-05 顽雨沉风: local TYPE_TRAP = 0x4
c4461ce231 2024-02-05 顽雨沉风: local TYPE_EFFECT = 0x20
c4461ce231 2024-02-05 顽雨沉风: local TYPE_PENDULUM = 0x1000000
c4461ce231 2024-02-05 顽雨沉风: local 有效果卡的类排 = {
c4461ce231 2024-02-05 顽雨沉风: TYPE_SPELL
c4461ce231 2024-02-05 顽雨沉风: , TYPE_TRAP
c4461ce231 2024-02-05 顽雨沉风: , TYPE_EFFECT
c4461ce231 2024-02-05 顽雨沉风: }
c4461ce231 2024-02-05 顽雨沉风: local 无效果灵摆怪兽排 = {
c4461ce231 2024-02-05 顽雨沉风: 28363749 --火蛋白石头龙头领
c4461ce231 2024-02-05 顽雨沉风: , 19474136 --曼陀林草龙
c4461ce231 2024-02-05 顽雨沉风: , 17390179 --闪光之骑士
c4461ce231 2024-02-05 顽雨沉风: , 83980492 --铜锣龙
c4461ce231 2024-02-05 顽雨沉风: }
c4461ce231 2024-02-05 顽雨沉风: --~ 卡对
c4461ce231 2024-02-05 顽雨沉风: function d.筛有效果卡(o1_4)
c4461ce231 2024-02-05 顽雨沉风: for o1 = 1, #有效果卡的类排 do
c4461ce231 2024-02-05 顽雨沉风: if bit.band(有效果卡的类排[o1], o1_4.type) == 0 then
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: return o1_4
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: if bit.band(TYPE_PENDULUM, o1_4.type) == 0 then
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: if 无效果灵摆怪兽排[o1_4.id] then
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: return o1_4
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 各文件的卡对排
c4461ce231 2024-02-05 顽雨沉风: function d.筛有效果卡_一维(o1_0)
c4461ce231 2024-02-05 顽雨沉风: return f.历排(o1_0, d.筛有效果卡)
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 各文件的卡编排
c4461ce231 2024-02-05 顽雨沉风: function d.取卡对_一维(o1_0)
c4461ce231 2024-02-05 顽雨沉风: return f.历排(o1_0, d.取卡对)
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 卡编
c4461ce231 2024-02-05 顽雨沉风: function d.取卡对(o1)
c4461ce231 2024-02-05 顽雨沉风: local k1_0, k2_0
c4461ce231 2024-02-05 顽雨沉风: --~ 卡文对
c4461ce231 2024-02-05 顽雨沉风: k1_0 = d.取卡文(o1)
c4461ce231 2024-02-05 顽雨沉风: --~ 卡数据对
c4461ce231 2024-02-05 顽雨沉风: k2_0 = d.取卡数据(o1)
c4461ce231 2024-02-05 顽雨沉风: return f.连两对(k1_0, k2_0)
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 卡编
c4461ce231 2024-02-05 顽雨沉风: function d.取卡文(o1)
c4461ce231 2024-02-05 顽雨沉风: for o1_4 in 数据库:nrows("select * from texts where id = " .. o1) do
c4461ce231 2024-02-05 顽雨沉风: return o1_4
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 卡编
c4461ce231 2024-02-05 顽雨沉风: function d.取卡数据(o1)
c4461ce231 2024-02-05 顽雨沉风: for o1_4 in 数据库:nrows("select * from datas where id = " .. o1) do
c4461ce231 2024-02-05 顽雨沉风: --~ if o1_4.setcode > 0xffffffff then
c4461ce231 2024-02-05 顽雨沉风: --~ ffi = require("ffi")
c4461ce231 2024-02-05 顽雨沉风: --~ print(bit.tohex(o1_4.setcode, 16), o1_4.setcode, o1_4.setcode == 36592129229979791, bit.tohex(bit.rshift(o1_4.setcode, 31)), bit.tohex(bit.band(o1_4.setcode, 0xf)), string.format("%x", 36592129229979791 - 36592129229979791), bit.tohex(math.fmod(36592129229979791, 0xffff + 1)), math.fmod(36592129229979791, 0xffff + 1), ffi.new("uint64_t[1]", 36592129229979791)[0], tostring(36592129229979791) == tostring(o1_4.setcode), tonumber(tostring(o1_4.setcode)) == 36592129229979791, math.modf(36592129229979791 / (0xffff + 1)), bit.tohex(bit.band(o1_4.setcode - 4, ffi.new("uint64_t[1]", 0xffff)[0])))
c4461ce231 2024-02-05 顽雨沉风: --~ print(string.format("%x", 36592129229979791 - 5))
c4461ce231 2024-02-05 顽雨沉风: --~ else
c4461ce231 2024-02-05 顽雨沉风: --~ end
c4461ce231 2024-02-05 顽雨沉风: return o1_4
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 文
c4461ce231 2024-02-05 顽雨沉风: function d.局筛卡编(o1)
c4461ce231 2024-02-05 顽雨沉风: local k1_0
c4461ce231 2024-02-05 顽雨沉风: --~ 卡编排
c4461ce231 2024-02-05 顽雨沉风: k1_0 = f.历文(o1, string.gmatch, "[^\n]+")
c4461ce231 2024-02-05 顽雨沉风: k1_0 = f.历排(k1_0, string.match, "Debug%.AddCard.+")
c4461ce231 2024-02-05 顽雨沉风: return f.历排(k1_0, string.match, "[0-9]+")
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 文
c4461ce231 2024-02-05 顽雨沉风: function d.局筛则数(o1)
c4461ce231 2024-02-05 顽雨沉风: local k1
c4461ce231 2024-02-05 顽雨沉风: local k1_0
c4461ce231 2024-02-05 顽雨沉风: --~ 则数排
c4461ce231 2024-02-05 顽雨沉风: k1_0 = f.历文(o1, string.gmatch, "[^\n]+")
c4461ce231 2024-02-05 顽雨沉风: k1_0 = f.历排(k1_0, f.全筛前缀, "Debug.ReloadFieldBegin")
c4461ce231 2024-02-05 顽雨沉风: --~ 则数
c4461ce231 2024-02-05 顽雨沉风: k1 = string.match(k1_0[1], "[0-9]")
c4461ce231 2024-02-05 顽雨沉风: return k1 or 3
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 卡对排
c4461ce231 2024-02-05 顽雨沉风: function d.荐名(o1_0)
c4461ce231 2024-02-05 顽雨沉风: local k1
c4461ce231 2024-02-05 顽雨沉风: --~ print(o1_0[1].name)
c4461ce231 2024-02-05 顽雨沉风: --~ return o1_0[1]
c4461ce231 2024-02-05 顽雨沉风: --~ 名
c4461ce231 2024-02-05 顽雨沉风: k1 = d.荐字段名(o1_0)
c4461ce231 2024-02-05 顽雨沉风: if k1 then
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: k1 = d.荐卡名(o1_0)
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: if k1 then
c4461ce231 2024-02-05 顽雨沉风: return k1
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: return "请便"
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: function d.荐卡名(o1_0)
c4461ce231 2024-02-05 顽雨沉风: local k1_0
c4461ce231 2024-02-05 顽雨沉风: --~ 卡名排
c4461ce231 2024-02-05 顽雨沉风: k1_0 = d.取卡名排(o1_0)
c4461ce231 2024-02-05 顽雨沉风: return f.历排取一(k1_0, f.筛排中最短文)
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 卡对排
c4461ce231 2024-02-05 顽雨沉风: function d.取卡名排(o1_0)
c4461ce231 2024-02-05 顽雨沉风: local k1_0
c4461ce231 2024-02-05 顽雨沉风: --~ 卡名排
c4461ce231 2024-02-05 顽雨沉风: k1_0 = {}
c4461ce231 2024-02-05 顽雨沉风: for o1 = 1, #o1_0 do
c4461ce231 2024-02-05 顽雨沉风: k1_0[o1] = o1_0[o1].name
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: return k1_0
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 卡对排
c4461ce231 2024-02-05 顽雨沉风: function d.取字段对(o1_0)
c4461ce231 2024-02-05 顽雨沉风: local k1, k2, k3, k4
c4461ce231 2024-02-05 顽雨沉风: local k1_0
c4461ce231 2024-02-05 顽雨沉风: --~ 字段对
c4461ce231 2024-02-05 顽雨沉风: k1_0 = {}
c4461ce231 2024-02-05 顽雨沉风: for o1 = 1, #o1_0 do
c4461ce231 2024-02-05 顽雨沉风: --~ 字段数
c4461ce231 2024-02-05 顽雨沉风: k1 = f.to_uint64(o1_0[o1].setcode)
c4461ce231 2024-02-05 顽雨沉风: if k1 > 0xffffFFFFffff then
c4461ce231 2024-02-05 顽雨沉风: k1 = k1 - 1
c4461ce231 2024-02-05 顽雨沉风: elseif k1 < 1 then
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: for o2 = 1, 11112222 do
c4461ce231 2024-02-05 顽雨沉风: if k1 < 1 then
c4461ce231 2024-02-05 顽雨沉风: break
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: --~ 大字段号
c4461ce231 2024-02-05 顽雨沉风: k2 = f.位和(k1, 0xffff)
c4461ce231 2024-02-05 顽雨沉风: k1 = f.位右移(k1, f.乘法(4, 4))
c4461ce231 2024-02-05 顽雨沉风: --~ 字段名
c4461ce231 2024-02-05 顽雨沉风: k3 = 字段名对[tonumber(k2)]
c4461ce231 2024-02-05 顽雨沉风: if k3 then
c4461ce231 2024-02-05 顽雨沉风: if k1_0[k3] then
c4461ce231 2024-02-05 顽雨沉风: k1_0[k3] = f.加法(k1_0[k3], 1)
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: k1_0[k3] = 1
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: if k2 > 0xfff then
c4461ce231 2024-02-05 顽雨沉风: --~ 小字段号
c4461ce231 2024-02-05 顽雨沉风: k4 = f.位和(k2, 0xfff)
c4461ce231 2024-02-05 顽雨沉风: k3 = 字段名对[tonumber(k4)]
c4461ce231 2024-02-05 顽雨沉风: if k3 then
c4461ce231 2024-02-05 顽雨沉风: if k1_0[k3] then
c4461ce231 2024-02-05 顽雨沉风: k1_0[k3] = f.加法(k1_0[k3], 1)
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: k1_0[k3] = 1
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: return k1_0
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 卡对排
c4461ce231 2024-02-05 顽雨沉风: function d.荐字段名(o1_0)
c4461ce231 2024-02-05 顽雨沉风: local k1, k2
c4461ce231 2024-02-05 顽雨沉风: local k1_0
c4461ce231 2024-02-05 顽雨沉风: --~ 字段对
c4461ce231 2024-02-05 顽雨沉风: k1_0 = d.取字段对(o1_0)
c4461ce231 2024-02-05 顽雨沉风: --~ f.历对(k1_0, print)
c4461ce231 2024-02-05 顽雨沉风: --~ 最大的字段名数量
c4461ce231 2024-02-05 顽雨沉风: _, k1 = f.历对取一(k1_0, f.筛对中最大值)
c4461ce231 2024-02-05 顽雨沉风: --~ print(_, k1)
c4461ce231 2024-02-05 顽雨沉风: --~ 最高频字段名对
c4461ce231 2024-02-05 顽雨沉风: k2_0 = f.历对(k1_0, f.全等筛对中值, k1)
c4461ce231 2024-02-05 顽雨沉风: --~ f.历对(k2_0, print)
c4461ce231 2024-02-05 顽雨沉风: --~ 最短的最高频字段
c4461ce231 2024-02-05 顽雨沉风: k2 = f.历对取一(k2_0, f.筛对中最短键)
c4461ce231 2024-02-05 顽雨沉风: --~ print(k2)
c4461ce231 2024-02-05 顽雨沉风: if k2 then
c4461ce231 2024-02-05 顽雨沉风: return k2
c4461ce231 2024-02-05 顽雨沉风: else
c4461ce231 2024-02-05 顽雨沉风: return false
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 目对
1b8a66c38a 2024-02-05 顽雨沉风: function d.残局荐名(o1_0)
c4461ce231 2024-02-05 顽雨沉风: local k1_0, k2_0, k3_0, k4_0, k5_0, k6_0, k7_0, k8_0
c4461ce231 2024-02-05 顽雨沉风: --~ 文件名排
c4461ce231 2024-02-05 顽雨沉风: k1_0 = f.历文(o1_0.文件目, 简文件库.dir)
c4461ce231 2024-02-05 顽雨沉风: k1_0 = f.历排(k1_0, f.全筛后缀, ".lua")
c4461ce231 2024-02-05 顽雨沉风: --~ 文件排
c4461ce231 2024-02-05 顽雨沉风: k2_0 = f.历排(k1_0, f.全筛后缀, ".lua")
c4461ce231 2024-02-05 顽雨沉风: for o1 = 1, #k2_0 do
c4461ce231 2024-02-05 顽雨沉风: k2_0[o1] = f.加前缀(k2_0[o1], o1_0.文件目)
c4461ce231 2024-02-05 顽雨沉风: k2_0[o1] = f.读文件(k2_0[o1])
c4461ce231 2024-02-05 顽雨沉风: k2_0[o1] = string.gsub(k2_0[o1], "%-%-" .. "%[(=*)%[" .. ".-" .. "%]%1%]", "")
c4461ce231 2024-02-05 顽雨沉风: k2_0[o1] = string.gsub(k2_0[o1], "%-%-" .. "[^\n]*", "")
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: --~ 则数排
c4461ce231 2024-02-05 顽雨沉风: k3_0 = f.历排(k2_0, d.局筛则数)
c4461ce231 2024-02-05 顽雨沉风: --~ 各文件的卡编排
c4461ce231 2024-02-05 顽雨沉风: k4_0 = f.历排(k2_0, d.局筛卡编)
c4461ce231 2024-02-05 顽雨沉风: _G.数据库 = 简数据库库.open(o1_0.数据库路)
c4461ce231 2024-02-05 顽雨沉风: --~ 各文件的卡对排
c4461ce231 2024-02-05 顽雨沉风: k5_0 = f.历排(k4_0, d.取卡对_一维)
c4461ce231 2024-02-05 顽雨沉风: --~ 有效果卡的卡对排
c4461ce231 2024-02-05 顽雨沉风: k6_0 = f.历排(k5_0, d.筛有效果卡_一维)
c4461ce231 2024-02-05 顽雨沉风: --~ 有效果卡的张数排
c4461ce231 2024-02-05 顽雨沉风: k7_0 = f.历排(k6_0, table.maxn)
c4461ce231 2024-02-05 顽雨沉风: --~ 荐名排
c4461ce231 2024-02-05 顽雨沉风: k8_0 = f.历排(k6_0, d.荐名)
c4461ce231 2024-02-05 顽雨沉风: for o1 = 1, #k1_0 do
c4461ce231 2024-02-05 顽雨沉风: print(字集码互转库.a_to_u8(k1_0[o1]), k3_0[o1], k7_0[o1], k8_0[o1])
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: end
c4461ce231 2024-02-05 顽雨沉风: d.目对 = {
c4461ce231 2024-02-05 顽雨沉风: ["文件目"] = "../single/"
c4461ce231 2024-02-05 顽雨沉风: , ["数据库路"] = [[D:\install\YGOPro\cards.cdb]]
c4461ce231 2024-02-05 顽雨沉风: }
c4461ce231 2024-02-05 顽雨沉风: for o1, o2 in pairs(d.目对) do
c4461ce231 2024-02-05 顽雨沉风: d.目对[o1] = f.操类(o2, "string", u8)
c4461ce231 2024-02-05 顽雨沉风: end
1b8a66c38a 2024-02-05 顽雨沉风: d.残局荐名(d.目对)