匿名
未登录
登录
乐园数据管理室
搜索
查看“︁模块:Salvage”︁的源代码
来自乐园数据管理室
命名空间
模块
讨论
更多
更多
页面操作
阅读
查看源代码
历史
刷新
←
模块:Salvage
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您没有权限编辑
模块
命名空间内的页面。
您必须确认您的电子邮件地址才能编辑页面。请通过
参数设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
local p = {} local loadJson = require("Module:JSON").loadJson function p.getDataByGmkId(gmkId) return loadJson("SalvagePoint/" .. gmkId) end function p.parseSalvageTable(SalvageTable) -- parse collection local collection = {} for ColleTableIndex = 1, 3 do local ColleTable = SalvageTable["ColleTable" .. ColleTableIndex] local ColleTablePercent = SalvageTable["ColleTablePercent" .. ColleTableIndex] / 100 local collectionStaticPopTable = {} local collectionRandomPopTable = {} for itmIndex = 1, 8 do -- 单道具行 if #ColleTable["itm" .. itmIndex .. "ID"] > 0 then local itemName = ColleTable["itm" .. itmIndex .. "ID"] local itemNum = ColleTable["itm" .. itmIndex .. "Num"] local itemPer = ColleTable["itm" .. itmIndex .. "Per"] local itemTitle = mw.title.new(itemName, "物品") local itemLink = "[[" .. itemTitle.fullText .. "|" .. itemTitle.text .. "]]" if tonumber(itemNum) > 0 then table.insert(collectionStaticPopTable, itemLink) mw.smw.set {["SalvagePop"] = itemTitle.fullText} end if tonumber(itemPer) > 0 then table.insert(collectionRandomPopTable, {itemLink, itemPer}) mw.smw.set {["SalvagePop"] = itemTitle.fullText} end end end local randitmPopNum = {ColleTable["randitmPopMin"], ColleTable["randitmPopMax"]} if ColleTable["randitmPopMin"] == ColleTable["randitmPopMax"] then randitmPopNum = {ColleTable["randitmPopMin"]} end table.insert( collection, { ["colleTablePercent"] = ColleTablePercent, ["staticPop"] = collectionStaticPopTable, ["randomPop"] = collectionRandomPopTable, ["randitmPopNum"] = randitmPopNum } ) end -- parse treasure local treasure = {} for TresureTableIndex = 1, 3 do local TresureTable = SalvageTable["TresureTable" .. TresureTableIndex] local TresureTablePercent = SalvageTable["TresureTablePercent" .. TresureTableIndex] / 100 local treasureStaticPopTable = {} local treasureRandomPopTable = {} local treasureGold = {0} for itmIndex = 1, 8 do -- 单道具行 if #TresureTable["itm" .. itmIndex .. "ID"] > 0 then local itemName = TresureTable["itm" .. itmIndex .. "ID"] local itemNum = TresureTable["itm" .. itmIndex .. "Num"] local itemPer = TresureTable["itm" .. itmIndex .. "Per"] local itemTitle = mw.title.new(itemName, "物品") local itemLink = "[[" .. itemTitle.fullText .. "|" .. itemTitle.text .. "]]" if tonumber(itemNum) > 0 then table.insert(treasureStaticPopTable, itemLink) mw.smw.set {["SalvagePop"] = itemTitle.fullText} end if tonumber(itemPer) > 0 then table.insert(treasureRandomPopTable, {itemLink, itemPer}) mw.smw.set {["SalvagePop"] = itemTitle.fullText} end if tonumber(TresureTable["goldPopMin"]) > 0 and tonumber(TresureTable["goldMax"]) > 0 then treasureGold = {TresureTable["goldMin"], TresureTable["goldMax"]} end end end local tboxImage if TresureTable["RSC_ID"] == "4" then tboxImage = "[[文件:Mnu064 image 1.png|136px]]" elseif TresureTable["RSC_ID"] == "5" then tboxImage = "[[文件:Mnu064 image 2.png|136px]]" elseif TresureTable["RSC_ID"] == "6" then tboxImage = "[[文件:Mnu064 image 4.png|136px]]" else error("No valid RSC_ID") end table.insert( treasure, { ["treasureTablePercent"] = TresureTablePercent, ["staticPop"] = treasureStaticPopTable, ["randomPop"] = treasureRandomPopTable, ["randitmPopNum"] = TresureTable["randitmPopMin"] == TresureTable["randitmPopMax"] and {TresureTable["randitmPopMin"]} or {TresureTable["randitmPopMin"], TresureTable["randitmPopMax"]}, ["tboxImage"] = tboxImage, ["treasureGold"] = treasureGold } ) end -- enemy local enemy = {} for EnemyPopTableIndex = 1, 3 do local EnemyPopTable = SalvageTable["EnemyPopTable" .. EnemyPopTableIndex] local EnemyPopTablePercent = SalvageTable["EnemyPopTablePercent" .. EnemyPopTableIndex] / 100 local enemyPop = {} if EnemyPopTablePercent > 0 then for eneIndex = 1, 4 do if #EnemyPopTable["ene" .. eneIndex .. "ID"] > 0 then local eneName = EnemyPopTable["ene" .. eneIndex .. "ID"] local eneLv = EnemyPopTable["ene" .. eneIndex .. "Lv"] local enePer = EnemyPopTable["ene" .. eneIndex .. "Per"] local eneTitle = mw.title.new(eneName, "敌人") local eneLink = "[[" .. eneTitle.fullText .. "|" .. eneTitle.text .. "]]" if tonumber(enePer) > 0 then table.insert(enemyPop, {eneLink, enePer}) mw.smw.set {["SalvageEnemyPop"] = eneTitle.fullText} end end end table.insert( enemy, { ["EnemyPopTablePercent"] = EnemyPopTablePercent, ["enemyPop"] = enemyPop } ) end end return { ["collection"] = collection, ["treasure"] = treasure, ["TresureBoxHit"] = SalvageTable["TresureBoxHit"] / 100, ["enemy"] = enemy, ["EnemyPopHit"] = SalvageTable["EnemyPopHit"] / 100 } end function DisplayTable(SalvageTable) local tableBody = "" local result = p.parseSalvageTable(SalvageTable) -- collection for i, v in ipairs(result["collection"]) do local ColleTablePercent = v["colleTablePercent"] local StaticPop = table.concat(v["staticPop"], "<br>") local randitmPopNum = table.concat(v["randitmPopNum"], " ~ ") local RandomPop = {} for i, v in ipairs(v["randomPop"]) do table.insert(RandomPop, table.concat(v, " ") .. "%") end RandomPop = table.concat(RandomPop, "<br>") tableBody = tableBody .. mw.ustring.format([[|- |%s%% |%s |%s |%s ]], ColleTablePercent, StaticPop, randitmPopNum, RandomPop) end local collectionTable = mw.ustring.format([[{| class="wikitable" |+ ! colspan="4" |收藏道具 |+ !概率 !必出道具 ! colspan="2" |额外道具 %s|} ]], tableBody) -- treasure tableBody = "" for i, v in ipairs(result["treasure"]) do local StaticPop = table.concat(v["staticPop"], "<br>") local randitmPopNum = table.concat(v["randitmPopNum"], " ~ ") local treasureGold = table.concat(v["treasureGold"], " ~ ") local RandomPop = {} for i, v in ipairs(v["randomPop"]) do table.insert(RandomPop, table.concat(v, " ") .. "%") end RandomPop = table.concat(RandomPop, "<br>") tableBody = tableBody .. mw.ustring.format( [[|- |%s%% |%s |%s |%s |%s |%s ]], v["treasureTablePercent"], v["tboxImage"], treasureGold, StaticPop, randitmPopNum, RandomPop ) end local treasureTable = mw.ustring.format( [[{| class="wikitable" |+ ! colspan="6" |宝藏 基础出现率:%s%% |+ !概率 !宝箱类型 !金币 !必出道具 ! colspan="2" |额外道具 %s|} ]], result["TresureBoxHit"], tableBody ) -- enemy local enemyTable = "" if #result["enemy"] > 0 then tableBody = "" for i, v in ipairs(result["enemy"]) do local EnemyPopTablePercent = v["EnemyPopTablePercent"] local enemyPop = {} for i, v in ipairs(v["enemyPop"]) do table.insert(enemyPop, table.concat(v, " ") .. "%") end enemyPop = table.concat(enemyPop, "<br>") tableBody = tableBody .. mw.ustring.format([[|- |%s%% |%s ]], EnemyPopTablePercent, enemyPop) end enemyTable = mw.ustring.format( [[{| class="wikitable" |+ ! colspan="2" |敌人 基础出现率:%s%% |+ !概率 !名称 %s|} ]], result["EnemyPopHit"], tableBody ) end return '<div style="display:flex;flex-wrap:wrap;">\n' .. collectionTable .. enemyTable .. treasureTable .. "</div>\n" end function p.popTable(frame) local args = frame.args local data = p.getDataByGmkId(args[1]) local output = "" -- 按键 local button1 = data["BtnChallenge0"]["BtnType1"] local button2 = data["BtnChallenge1"]["BtnType1"] local button3 = data["BtnChallenge2"]["BtnType1"] if button1 == "Random" then output = output .. "按键:随机" .. "\n\n" else output = output .. "按键:" .. button1 .. button2 .. button3 .. "\n\n" end output = output .. "=== 普通气瓶 ===\n\n" output = output .. DisplayTable(data["SalvageTable1"]) output = output .. "=== 白银气瓶 ===\n\n" output = output .. DisplayTable(data["SalvageTable2"]) output = output .. "=== 黄金气瓶 ===\n\n" output = output .. DisplayTable(data["SalvageTable3"]) output = output .. "=== 极品气瓶 ===\n\n" output = output .. DisplayTable(data["SalvageTable4"]) if data["SalvageTable5"] ~= "" then output = output .. "=== 增幅气瓶 ===\n\n" output = output .. DisplayTable(data["SalvageTable5"]) end return output end return p
该页面使用的模板:
模块:Salvage/doc
(
查看源代码
)
返回
模块:Salvage
。
导航
导航
首页
最近更改
随机页面
翻译查询
异度神剑
异度神剑3
异度神剑X
wiki工具
wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志