打开主菜单

少前百科GFwiki β

更改

模块:Gun info

添加3,407字节2024年4月23日 (星期二)
拆分data表
local etdata = mw.loadData('Module:Equip info/type data')
local odata = mw.loadData('Module:Gun info/obtain data')
local skindata = mw.loadData('Module:Gun info/skin data')
local guntype = { {'手枪', '冲锋枪', '步枪', '突击步枪', '机枪', '霰弹枪', [0] = '所有枪种'},
{'HG', 'SMG', 'RF', 'AR', 'MG', 'SG'} }
local equips = {
{{1, 4, 13, 16}, {2, 6}, {3,10}}, {{3, 9, 10}, {2, 6}, {1, 1, 2, 3, 4, 13}}, {{2, 5}, {1, 1, 2, 3, 13}, {3, 15}}, {{1, 1, 2, 3, 4, 13}, {2, 8}, {3, 9, 10}}, {{2, 5, 17}, {1, 1, 2, 3, 16}, {3, 14, 21}}, {{3, 11}, {2, 7}, {1, 1, 2, 3, 4, 22}}
}
local defaults = equips[gundata.guntype]
end
skilldata = bdata[group][id]
local skill = root:tag('table'):addClass('skill' .. order):attr{ class = 'skill-table',
['data-cd'] = skilldata.cd_time,
['data-cd-start'] = skilldata.start_cd_time }:addClass('skill' .. order)
if skilldata.vals then skill:attr('data-val', skilldata.vals) end
local signature = skill:tag('tr'):attr('class', 'skill-signature')
local icon = signature:tag('td')
icon:attr('rowspan', 2)
:wikitext('[[fileFile:icon Skill IconSkill ' .. skilldata.code .. '.png|48px|link=]]')
local skillname = signature:tag('td')
skillname:wikitext(skilldata.name)
if order == '2' then skillname:tag('span'):wikitext('改型1强化改型2解锁') elseif ismod then skillname:tag('span'):wikitext('改型2解锁改型1强化')
end
local lvcd = skill:tag('tr'):tag('td'):attr('class', 'skill-lvcd')
root:wikitext(serveSkillInfo('2', true))
end
end
 
local function addChibi()
local root = mw.html.create()
root:newline():wikitext('== 战斗形象 =='):newline()
local div = root:tag('div'):addClass('dollSpineBox')
local argTable = {'ChibiCostumeSwitcher', target = 'TDollChibiAnimation'}
local guncode = string.gsub(gundata.code, ' ', '_')
if moddata then argTable['costumes.mod'] = '心智升级' end
for _, v in ipairs(gundata.skins) do
local skin = skindata[v]
if skin then
local skincode = guncode .. '_' .. tostring(v)
argTable['costumes.' .. skincode] = skin.name
end
end
local frame = mw.getCurrentFrame()
div:wikitext(frame:callParserFunction('#widget', argTable))
div:tag('div'):addClass('tdoll_chibi'):attr{ id = 'TDollChibiAnimation',
['data-tdoll-id'] = guncode }
return tostring(root)
end
root:newline():wikitext('== 人形外观 =='):newline()
local guncode = string.gsub(gundata.code, ' ', '_')
local skindata = mw.loadData('Module:Gun info/skin_data')
local classdata = mw.loadData('Module:Gun info/skinclass_data')
local control = root:tag('div'):attr('id', 'unit-showcase-control')
if moddata then
local moditem = menu:tag('li')
:attr('data-skincode', guncode .. 'Mod'):wikitext('心智升级')
local l2dmod = {[55] = 1, [56] = 1, [57] = 1, [65] = 1, [101] = 1,
[103] = 1, [122] = 1, [143] = 1}
if l2dmod[gundata.id] then moditem:addClass('live2d1') :wikitext( '<div></div><div><span>心智升级</span></div><div class="live2d1"></div>') else moditem:wikitext('心智升级') end
end
for _, v in ipairs(gundata.skins) do
local skin = skindata[v]
if skin then
local skincode = guncode .. '_' .. tostring(v)
local skinclass = classdata[skin.class_id]
local item = menu:tag('li'):attr('data-skincode', skincode) local tdiv = item:tag('div') if skinclass then tdiv:addClass('theme' .. tostring(skinclass.theme_type)) end local scdiv = item:tag('div') scdiv:tag('span'):wikitext(skin.name) if skinclass then itemscdiv:tag('span'):wikitext(skinclass.name)end local ldiv = item:addClasstag('themediv' .. tostring(skinclass.theme_type)) end local skintype = tostring(skin['type'] item:attr('data-skincode', skincode) if skintype ~= 0 'nil' then item:addClass('live2d' .. tostringskintype) ldiv:addClass('live2d' .. skintype))
end
end
effect_text:wikitext('<br>')
effect_text:wikitext(concatEffects(anames, avals, i)) end end
end
 
local function r2fs(r)
local f = math.floor(1500/r)
return f, string.format('%.2g', f/30)
end
 
local function r2fsMG(r)
local f = math.floor((4 + 200/r)*30)
return f, string.format('%.2g', f/30)
end
 
local function r2fsSG(r)
local f = math.floor(65 + 15*r)
return f, string.format('%.2g', f/30)
end
 
local function popup(frame, content)
return frame:expandTemplate{title = 'Popup', args = {
['内容'] = content
}}
end
local gtype = gundata.guntype
local speeds = {15,12,7,10,4,6}
local crits typeDefaults = { crit = {20,5,40,20,5,40}, max_rate = {120, 120, 120, 120, 1000, 60} }
local targets = {{0}, {4}, {1}, {2}, {6}, {5}}
root:newline():wikitext('== 战斗数据 =='):newline()
local ratios = { gundata.life, gundata.power, gundata.rate,
gundata.hit, gundata.dodge, gundata.armor or 0 , gundata.rec }
local attrdataset = root:tag('div'):attr{
id = 'attr-dataset',
['data-type'] = gtype,
['data-growing'] = table.concat(ratios, ','),
['data-growth'] = gundata.growth, ['data-max-rate'] = gundata.max_rate
}
if moddata then
ratios = { moddata.life, moddata.power, moddata.rate,
moddata.hit, moddata.dodge, moddata.armor or 0 , moddata.rec }
attrdataset:attr{
['data-growing-mod'] = table.concat(ratios, ','),
['data-growth-mod'] = moddata.growth, ['data-max-rate-mod'] = moddata.max_rate
}
end
local attrtable = root:tag('div'):attr('id', 'attr-table')
attrtable:newline():wikitext(string.format([[
{|
|+生命|-!×1!!×2!!×3!!×4!!×5|-id="aphp-tr"| || || |穿甲| |||}]]):newline() attrtable:wikitext[[{|!id="pow" | 伤害| id="pow-td" ||-!id="roundhit" | 命中| id="hit-td"|弹量!|-!id="speeddodge" | 回避| id="dodge-td"|移速!|-!id="critrate"|暴击!!射速| id="critpowrate-td"|暴伤
|-
! id="armor" |15护甲||data-attrid="%darmor-td" data||-mod! id="%dgrowth"|%s成长||%s||data-attrid="%d" datagrowth-mod="%dtd"|%s%%||150%%|}]] attrtable:newline() local ctable = attrtable:tag('table') local consts = { {'critpow', '暴伤'}, {'crit', '暴击'}, {'speed', '移速'}, {'max_rate', '射速上限'}, {'ap', '穿甲'}, {'rec', '修复'} } local constVals = { 150, gundata.round crit or 0typeDefaults.crit[gtype], moddata and moddataspeeds[gtype], gundata.round max_rate or 0typeDefaults.max_rate[gtype], 15, tostring(gundata.round or rec } local f = mw.getCurrentFrame() for i = 1, 6 do local tr = ctable:tag('tr') tr:tag('不适用th'):attr('id',consts[i][1]):wikitext(consts[i][2]) tostringlocal td = tr:tag(speeds'td') if i == 2 or i == 4 then td:attr{ ['data-attr'] = constVals[gtypei]), ['data-mod'] = moddata and moddata[consts[i][1]] or constVals[i] } end gundata.crit or critstd:wikitext(constVals[gtypei],i < 3 and '%' or '') if i == 4 and gtype ~= 5 then local action, func = gtype ~= 5 and '攻击', r2fs or '换弹', r2fsMG local fmt = action .. '间隔%d帧(%s秒)' td:wikitext(popup(f, string.format(fmt, func(constVals[4])))) if moddata and then td:wikitext(popup(f, string.format(fmt, func(moddata.crit max_rate or critsconstVals[4])))) end end end if gtype> 4 then local tr = ctable:tag('tr') tr:tag('th'):attr('id', 'round'):wikitext('弹量') local td = tr:tag('td'):attr{ ['data-attr']= gundata.round, ['data-mod'] = moddata and moddata.round or gundata.round } tostringtd:wikitext(gundata.crit round) if gtype == 6 then local fmt = '换弹间隔%d帧(%s秒)' td:wikitext(popup(f, string.format(fmt, r2fsSG(gundata.round)))) if moddata then td:wikitext(popup(f, string.format(fmt, r2fsSG(moddata.round or crits[gtype]gundata.round)))) end end end
local self_pos, effect_poses = getGridPositions(gundata.grid_center or 13, gundata.grid_pos)
local container = moddata and root:tag('div'):attr('id', 'effects') or root
local function addInfobox()
local root = mw.html.create('div'):addClass('dollinfo')
local modrank = {'', '4', '4', '5', '6'} local orgdata = mw.loadData('Module:Gun info/org data') local org, org2 = orgdata[math.floor(gundata.org/100)], orgdata[gundata.org] local stars, rank = '', gundata.rank local isextra = mid > 1000 local weapon = guntype[1][gundata.guntype] if isextra then stars = '<span>★</span> EXTRA' else for i = 1, rank do stars = stars .. '<span>★</span>' end if moddata then for i = rank+1, modrank[rank] do stars = '<span>☆</span>' .. stars end end end local obtains = {} for _, v in ipairs(gundata.obtain) do obtains[#obtains+1] = odata[v] end if gundata.obtain[1] == 1 or gundata.obtain[1] == 2 then obtains[#obtains+1] = '制造用时:' .. mw.getContentLanguage() :formatDuration(gundata.produce_time) end root:wikitext(string.format([=[
<div id="dollnum">NO.%d</div><div id="dollrar">%s</div>
<div id="dollwph">%s武器</div><div id="dollwpd">[[File:图标-%s.png|link=]]%s</div>
<div id="dollpic"><div>[[File:Icon_No.%d%s.png|link=]]</div></div>
<div id="dollilh">形象设计</div><div id="dollild">%s</div>
<div id="dollcvh">配音</div><div id="dollcvd">%s</div>
<div id="dolldph">部门</div><div id="dolldpd">%s</div>
<div id="dollobh">入编渠道</div><div id="dollobd">%s</div>
isextra and '' or '烙印', weapon, isextra and weapon or (args['武器'] or gundata.name),
mid, moddata and '_Mod' or '',
gundata.illu or '不明', gundata.cv or '不明',
org and string.format('[[内部一览/%s|%s]]-%s', org, org, org2) or '无',
table.concat(obtains, '<br>'), args['介绍'] or ''))
return tostring(root)
end
mid = tonumber(args[1])
if mid < 1000 then
data = mw.loadData('Module:Gun info/datadata_'.. tostring(math.floor((mid - 1)/100)))
else
data = mw.loadData('Module:Gun info/data extra')
if gundata['mod'] == 1 then
local moddataOrig = mw.loadData('Module:Gun info/data mod')[tonumber(args[1])+20000]
moddata = {skill2 } for k,v in pairs(moddataOrig) do moddata[k] = moddataOrig.skill2}v end for k,v in pairs(gundata) do moddata[k] = moddataOrigmoddata[k] or v end
end
local root = mw.html.create()
putSkills()
putEquipments()
root:wikitext(addChibi())
local templatestyles = mw.getCurrentFrame():extensionTag{