Module:明日方舟材料
跳到导航
跳到搜索
-- 数据写在 Module:明日方舟材料/data . local getArgs = require ( 'Module:Arguments' ).getArgs local p = {} local data = mw.loadData ( 'Module:明日方舟材料/data' ) local switch = { ["f1"]=function() return "基础作战记录" end, ["小电影"]=function() return "基础作战记录" end, ["f2"]=function() return "初级作战记录" end, ["电影"]=function() return "初级作战记录" end, ["f3"]=function() return "中级作战记录" end, ["中电影"]=function() return "中级作战记录" end, ["f4"]=function() return "高级作战记录" end, ["大电影"]=function() return "高级作战记录" end, ["lmb"]=function() return "龙门币" end, ["jq1"]=function() return "技巧概要·卷1" end, ["jq2"]=function() return "技巧概要·卷2" end, ["jq3"]=function() return "技巧概要·卷3" end, ["pz1"]=function() return "资质凭证" end, ["绿票"]=function() return "资质凭证" end, ["pz2"]=function() return "高级凭证" end, ["黄票"]=function() return "高级凭证" end, ["pz3"]=function() return "采购凭证" end, ["红票"]=function() return "采购凭证" end, ["xk1"]=function() return "招聘许可" end, ["xk2"]=function() return "加急许可" end, ["180"]=function() return "至纯源石" end, ["hcy"]=function() return "合成玉" end, ["pz600"]=function() return "寻访凭证" end, ["狗粮券"]=function() return "寻访凭证" end, ["pz6000"]=function() return "十连寻访凭证" end, ["十连券"]=function() return "十连寻访凭证" end, ["yy1"]=function() return "源岩" end, ["石片"]=function() return "源岩" end, ["yy2"]=function() return "固源岩" end, ["石"]=function() return "固源岩" end, ["yy3"]=function() return "固源岩组" end, ["石组"]=function() return "固源岩组" end, ["yy4"]=function() return "提纯源岩" end, ["石块"]=function() return "提纯源岩" end, ["zz1"]=function() return "破损装置" end, ["zz2"]=function() return "装置" end, ["zz3"]=function() return "全新装置" end, ["zz4"]=function() return "改量装置" end, ["jz1"]=function() return "酯原料" end, ["肥皂片"]=function() return "聚酸酯" end, ["jz2"]=function() return "聚酸酯" end, ["肥皂"]=function() return "聚酸酯" end, ["jz3"]=function() return "聚酸酯组" end, ["肥皂组"]=function() return "聚酸酯组" end, ["jz4"]=function() return "聚酸酯块" end, ["肥皂块"]=function() return "聚酸酯块" end, ["dt1"]=function() return "代糖" end, ["糖片"]=function() return "代糖" end, ["dt2"]=function() return "糖" end, ["dt3"]=function() return "糖组" end, ["dt4"]=function() return "糖聚块" end, ["糖块"]=function() return "糖聚块" end, ["yt1"]=function() return "异铁碎片" end, ["铁片"]=function() return "异铁碎片" end, ["yt2"]=function() return "异铁" end, ["铁"]=function() return "异铁" end, ["yt3"]=function() return "异铁组" end, ["铁组"]=function() return "异铁组" end, ["yt4"]=function() return "异铁块" end, ["铁块"]=function() return "异铁块" end, ["tt1"]=function() return "双酮" end, ["铜片"]=function() return "双酮" end, ["tt2"]=function() return "酮凝集" end, ["铜"]=function() return "酮凝集" end, ["tt3"]=function() return "酮凝集组" end, ["铜组"]=function() return "酮凝集组" end, ["tt4"]=function() return "酮阵列" end, ["铜块"]=function() return "酮阵列" end, ["nzc"]=function() return "扭转醇" end, ["口香糖"]=function() return "扭转醇" end, ["bmc"]=function() return "白马醇" end, ["qmk"]=function() return "轻锰矿" end, ["ssmk"]=function() return "三水锰矿" end, ["yms"]=function() return "研磨石" end, ["wsyms"]=function() return "五水研磨石" end, ["r12"]=function() return "RMA70-12" end, ["刺球"]=function() return "RMA70-24" end, ["r24"]=function() return "RMA70-24" end, ["红刺球"]=function() return "RMA70-24" end, ["jhj"]=function() return "聚合剂" end, ["nmp"]=function() return "双极纳米片" end, ["d32"]=function() return "D32钢" end, ["nj"]=function() return "凝胶" end, ["果冻"]=function() return "凝胶" end, ["jhnj"]=function() return "聚合凝胶" end, ["果粒爽"]=function() return "聚合凝胶" end, ["chj"]=function() return "炽合金" end, ["合金"]=function() return "炽合金" end, ["chjk"]=function() return "炽合金块" end, ["合金块"]=function() return "炽合金块" end, ["htjz"]=function() return "环烃聚质" end, ["htyzt"]=function() return "环烃预制体" end, ["hsxw"]=function() return "褐素纤维" end, ["ghxwb"]=function() return "固化纤维板" end, ["#dafault"]=function(name) return (name and {name} or{'龙门币'})[1] end, } local itemdic = { ["龙门币"]=1,[1]="龙门币", ["先锋双芯片"]=2,[2]="先锋双芯片",["近卫双芯片"]=3,[3]="近卫双芯片",["狙击双芯片"]=4,[4]="狙击双芯片",["重装双芯片"]=5,[5]="重装双芯片", ["医疗双芯片"]=6,[6]="医疗双芯片",["辅助双芯片"]=7,[7]="辅助双芯片",["术师双芯片"]=8,[8]="术师双芯片",["特种双芯片"]=9,[9]="特种双芯片", ["先锋芯片组"]=10,[10]="先锋芯片组",["近卫芯片组"]=11,[11]="近卫芯片组",["狙击芯片组"]=12,[12]="狙击芯片组",["重装芯片组"]=13,[13]="重装芯片组", ["医疗芯片组"]=14,[14]="医疗芯片组",["辅助芯片组"]=15,[15]="辅助芯片组",["术师芯片组"]=16,[16]="术师芯片组",["特种芯片组"]=17,[17]="特种芯片组", ["先锋芯片"]=18,[18]="先锋芯片",["近卫芯片"]=19,[19]="近卫芯片",["狙击芯片"]=20,[20]="狙击芯片",["重装芯片"]=21,[21]="重装芯片", ["医疗芯片"]=22,[22]="医疗芯片",["辅助芯片"]=23,[23]="辅助芯片",["术师芯片"]=24,[24]="术师芯片",["特种芯片"]=25,[25]="特种芯片", ["技巧概要·卷3"]=26,[26]="技巧概要·卷3",["技巧概要·卷2"]=27,[27]="技巧概要·卷2",["技巧概要·卷1"]=28,[28]="技巧概要·卷1", ["D32钢"]=29,[29]="D32钢",["双极纳米片"]=30,[30]="双极纳米片",["聚合剂"]=31,[31]="聚合剂", ["白马醇"]=32,[32]="白马醇",["扭转醇"]=33,[33]="扭转醇",["三水锰矿"]=34,[34]="三水锰矿",["轻锰矿"]=35,[35]="轻锰矿", ["五水研磨石"]=36,[36]="五水研磨石",["研磨石"]=37,[37]="研磨石",["RMA70-24"]=38,[38]="RMA70-24",["RMA70-12"]=39,[39]="RMA70-12", ["提纯源岩"]=40,[40]="提纯源岩",["固源岩组"]=41,[41]="固源岩组",["固源岩"]=42,[42]="固源岩",["源岩"]=43,[43]="源岩", ["改量装置"]=44,[44]="改量装置",["全新装置"]=45,[45]="全新装置",["装置"]=46,[46]="装置",["破损装置"]=47,[47]="破损装置", ["聚酸酯块"]=48,[48]="聚酸酯块",["聚酸酯组"]=49,[49]="聚酸酯组",["聚酸酯"]=50,[50]="聚酸酯",["酯原料"]=51,[51]="酯原料", ["糖聚块"]=52,[52]="糖聚块",["糖组"]=53,[53]="糖组",["糖"]=54,[54]="糖",["代糖"]=55,[55]="代糖", ["异铁块"]=56,[56]="异铁块",["异铁组"]=57,[57]="异铁组",["异铁"]=58,[58]="异铁",["异铁碎片"]=59,[59]="异铁碎片", ["酮阵列"]=60,[60]="酮阵列",["酮凝集组"]=61,[61]="酮凝集组",["酮凝集"]=62,[62]="酮凝集",["双酮"]=63,[63]="双酮", ["聚合凝胶"]=64,[64]="聚合凝胶",["凝胶"]=65,[65]="凝胶",["炽合金块"]=66,[66]="炽合金块",["炽合金"]=67,[67]="炽合金", ["晶体电子单元"]=68,[68]="晶体电子单元",["晶体电路"]=69,[69]="晶体电路",["晶体元件"]=70,[70]="晶体元件", ["基础作战记录"]=71,[71]="基础作战记录",["初级作战记录"]=72,[72]="初级作战记录",["中级作战记录"]=73,[73]="中级作战记录",["高级作战记录"]=74,[74]="高级作战记录",["模组数据块"]=75,[75]="模组数据块", ["切削原液"]=76,[76]="切削原液",["化合切削液"]=77,[77]="化合切削液", ["精炼溶剂"]=78,[78]="精炼溶剂",["半自然溶剂"]=79,[79]="半自然溶剂", ["数据增补条"]=80,[80]="数据增补条",["数据增补仪"]=81,[81]="数据增补仪", ["转质盐组"]=82,[82]="转质盐组",["转质盐聚块"]=83,[83]="转质盐聚块",["烧结核凝晶"]=84,[84]="烧结核凝晶", ["褐素纤维"]=85,[85]="褐素纤维",["固化纤维板"]=86,[86]="固化纤维板",["环烃聚质"]=87,[87]="环烃聚质",["环烃预制体"]=88,[88]="环烃预制体" } function split(szFullString, szSeparator) local nFindStartIndex = 1 local nSplitIndex = 1 local nSplitArray = {} while true do local nFindLastIndex = string.find(szFullString, szSeparator, nFindStartIndex) if not nFindLastIndex then nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, string.len(szFullString)) break end nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, nFindLastIndex - 1) nFindStartIndex = nFindLastIndex + string.len(szSeparator) nSplitIndex = nSplitIndex + 1 end return nSplitArray end function merge(arr, left, right, middle, result) local resultIndex = left local arrLeftIndex = left local arrRightIndex = middle while (arrLeftIndex <= middle - 1 and arrRightIndex <= right) do if (arr[arrLeftIndex] > arr[arrRightIndex]) then result[resultIndex] = arr[arrRightIndex] arrRightIndex = arrRightIndex + 1 else result[resultIndex] = arr[arrLeftIndex] arrLeftIndex = arrLeftIndex + 1 end resultIndex = resultIndex + 1 end while (arrLeftIndex <= middle - 1) do result[resultIndex] = arr[arrLeftIndex] resultIndex = resultIndex + 1 arrLeftIndex = arrLeftIndex + 1 end while (arrRightIndex <= right) do result[resultIndex] = arr[arrRightIndex] resultIndex = resultIndex + 1 arrRightIndex = arrRightIndex + 1 end for i = left, right do arr[i] = result[i] end end function mergeSort(arr, left, right) local result = {} if (1 == right - left) then if (arr[left] > arr[right]) then local temp = arr[left] arr[left] = arr[right] arr[right] = temp end elseif (0 ~= left - right) then local middle = math.floor((right - left + 1) / 2) + left mergeSort(arr, left, middle - 1, result) mergeSort(arr, middle, right, result) merge(arr, left, right, middle, result) end end function p.lookup(frame,args,exargs) local sw = switch[((exargs['2'] or args[1]) and {(exargs['2'] or args[1])} or {"#dafault"})[1]] local trans = frame:expandTemplate{title="Akitem", args={ ['1']='mat', ['2']=(sw and {sw((exargs['2'] or args[1]))} or {(switch["#dafault"])((exargs['2'] or args[1]))})[1], ['num']=((exargs['num'] or args[2]) and {(exargs['num'] or args[2])} or {""})[1], ['size']=((exargs['size'] or args[3]) and {(exargs['size'] or args[3])} or {"40"})[1] } } return trans end function p.makeupexpests(s,expsets) local tb = split(s,'+') for key,str in pairs(tb) do local cmd = split(str,'*') local dx = string.sub(cmd[2],string.len(cmd[2])) local addnum = cmd[2] if dx=='w' then addnum = tonumber(string.sub(addnum,1,string.len(cmd[2])-1)) *10000 end if expsets['item-'..cmd[1]] then expsets['item-'..cmd[1]] = tonumber(expsets['item-'..cmd[1]]) + addnum else expsets['index'] = expsets['index'] + 1 expsets['index'..expsets['index']] = cmd[1] expsets['item-'..cmd[1]] = addnum end end return expsets end function p.makeupexp(expsets,frame,args) local exp = '' local step = 1 local expsuffix = '' local attr = {} for step=1,expsets['index'] do local itname=expsets['index'..step] attr[step]=itemdic[itname] end mergeSort(attr,1,#attr) for step=1,expsets['index'] do local itid = attr[step] expsets['index'..step]=itemdic[itid] end for step=1,expsets['index'] do local matname = expsets['index'..step] local matnum = expsets['item-'..matname] if (string.len(matnum) >3) and not(args[2]=='notrans') then matnum = tostring(tonumber(matnum)/10000) ..'w' end local exargs = {['1']="mat",['2']=matname, ['num']=(matnum and { matnum } or {""})[1], ['size']=(args['size'] and {args['size']} or {"40"})[1] } exp = exp..p.lookup(frame,args,exargs) end return exp end function p.calc(frame) local expsets = {['index']=0} local args = getArgs(frame) p.makeupexpests(args[1],expsets) return p.makeupexp(expsets,frame,args) end function p.skill ( frame ) local args = getArgs ( frame ) return p._skill ( frame, args ) end function p.redname(tempa,tempb) local sw = switch[(tempa and {tempa} or {"#dafault"})[1]] local rename = (sw and {sw(tempa)} or {tempa})[1] return ( data[rename] and { data[rename][tempb] } or {'null'} )[1] end function p._skill ( frame, args ) local expsets = {['index']=0} local exp = '' local expa = split(args[1],'+') local testrt = '' for ka,va in pairs(expa) do local expb = split(va,'v') local tempa = args[1] local tempb = args[2] local madetext = '' if #expb >=2 then tempa = expb[1] tempb = 'v'..expb[2] local rangepacks = split(expb[2],'&') for krps,vrps in pairs(rangepacks) do local range = split(vrps,'-') if #range>=2 then local num1 = (type(tonumber(range[1]))=='number'and{tonumber(range[1])}or{0})[1] local num2 = (type(tonumber(range[2]))=='number'and{tonumber(range[2])}or{num1})[1] local start = (((num1<7 and num1> 0 ) or (num1>=17 and num1<=19) or (num1>=27 and num1<=29) or (num1>=37 and num1<=39)) and{num1} or{1})[1] local step = (((num2<7 and num2>start) or (num2>=17 and num2<=19) or (num2>=27 and num2<=29) or (num2>=37 and num2<=39)) and{num2} or{6})[1] while start<=step and ((step-start)<10) do madetext = madetext..((madetext=='') and {''} or {'+'} )[1] madetext = madetext..p.redname(tempa,'v'..start) start = start + 1 end else madetext = madetext..((madetext=='') and {''} or {'+'} )[1]..p.redname(tempa,'v'..range[1]) end end else madetext = p.redname(tempa,tempb) end p.makeupexpests(madetext,expsets) end exp = p.makeupexp(expsets,frame,args) return exp..((args[2]=='test')and{testrt}or{''})[1] end return p