打开主菜单

少前百科GFwiki β

更改

模块:Enemy info

添加1,378字节2023年7月19日 (三) 14:24
无编辑摘要
local udata
local node
local currentframe = mw.getCurrentFrame()
local forces = {'铁血工造', '正规军', '帕拉蒂斯', [0] = '其他势力'}
local types = {'首领', '普通机械', '普通人形', '装甲机械', '装甲人形'}
local data = mw.loadData('模块:Enemy info/data')
local intros = mw.loadData('模块:Enemy info/intro data')
local chars = mw.loadData('模块:Enemy info/character data')
local skills = mw.loadData('模块:Enemy info/skill data')
local function addSpine()
node:tag('div'):attr('id', 'spinebox'):addClass('spinebox'):css('min-width', args['LargeSpine'] and '900px' or '450px') :tag('p'):addClass('gflabelbg'):wikitext('Q版模型预览(点击切换动画)'):done() :tag('div'):attr{ id = 'TDollChibiAnimation', ['data-tdoll-id'] = udata.code, ['data-tdoll-hidedormbutton'] = 'true' }:addClass('tdoll_chibi'):addClass(args['LargeSpine'] and 'bigScale' or 'gflabelbg1') :cssText(args['LargeSpine'] and 'height:1000px;min-width:900px' or 'height:380px;min-width:450px') :wikitext(' ')
end
local function addDesc()
node local chars = node:tagmw.loadData('table')模块:tag('tbodyEnemy info/character data')
for _,n in ipairs(udata.chars) do
node:tag('tr'):tag('td'):attr('colspan', 2):wikitext(currentframe():expandTemplate{title='敌方图鉴TAG', args={chars[n][1], chars[n][2]}})
end
if udata.skills then
local skills = mw.loadData('模块:Enemy info/skill data')
for _,n in ipairs(udata.skills) do
node:tag('tr'):tag('td'):attr('colspan', 2):wikitext(currentframe():expandTemplate{title='敌方图鉴技能', args={skills[n][1], skills[n][2]}})
end
end
node:tag('tr'):tag('td'):attr('colspan', 2):wikitext(currentframe():expandTemplate{title='敌方图鉴文本内敛', args={udata.counter}}) node = node:done():done()
end
local function addAttrs()
node = node:tag('table'):tagaddClass('tbodystattable'):addClass('integral-stattable')
node:tag('tr'):tag('td'):attr('colspan', 2):addClass('gflabelbg'):wikitext('敌方图鉴信息')
node:tag('tr'):tag('td'):wikitext('编号'):done():tag('td'):wikitext(uid)
if i % 2 == 0 then node = node:done() end
end
node = node:done():done()
end
local function addStats()
local intros = mw.loadData('模块:Enemy info/intro data') node = node:tag('div'):attraddClass('id', 'TDollStattables'):tag('div'):addClass('tabber1') node:wikitexttag('table'):attr([[{|class="stattable" 'id="', 'introduce"'):addClass('stattable')|class=" :tag('tr'):tag('td'):addClass('gflabelbg"|'):wikitext('简介'):done():done()|-|]].. :tag('tr'):tag('td'):wikitext(intros[uid]..'\n|}')
addAttrs()
addDesc()
node = node:done():done()
end
local function addPics()
local pic1 = tostring(mw.html.create():wikitext('[[media:pic '..udata.code..' LL.png]]')) local start = mw.ustring.find(pic1, '/images', 1, true)[1] local ending = (select(2, mw.ustring.find(pic1, '.png', start, true))) node:tag('div'):wikitext(currentframe():expandTemplate{title='立绘切换', args={ ['融合势力'] = 1, pic = 1, name1 = '初始立绘', pic1 = mwcurrentframe():callParserFunction('filepath', 'pic '..udata.code..ustring' LL.sub(pic1, start, endingpng')
}})
end
local function buildInfoWindow()
node = root:tag('div'):css('position', 'relative')
node = subrootnode:tag('div'):attr('id', 'TDInfWindow'):addClass('TDollInformation')
addPics()
addStats()
addDesc()
addSpine()
root:wikitext('[[分类:敌方单位]][[分类:'..forces[udata.force]..']][[分类:'..types[udata.utype]..']]')
local function _enemyInfo()
uid = tonumber(args[1])
udata = data[uid]
root = mw.html.create()
buildInfoWindow()
local templatestyle = currentframe():extensionTag{ name = 'templatestyles', args = { src = '模板:敌方单位信息/styles.css' } } return templatestyle .. tostring(root)
end
function p.enemyInfo(frame)
if frame == currentframe () then args = frame.:getParent().args
else
args = frame
end
return _enemyInfo()
end
 
function p.enemyIndex()
local groupByForce = {}
for i = 0, 3 do groupByForce[i] = mw.html.create() end
local keys = {}
for k,_ in pairs(data) do table.insert(keys, k) end
table.sort(keys)
for _, i in ipairs(keys) do
local d = data[i]
local blacklist = {126, 140, 147, 153, 156, 157, 166}
local blacklisted = false
for j = 87, 93 do if j == i then
blacklisted = true
break
end end
for _, j in ipairs(blacklist) do if j == i then
blacklisted = true
break
end end
if i == 100 or d.chars[1] == 100 or d.chars[1] == 1002 or blacklisted then
else
local ename = i ~= 115 and d.name or string.format('%s (%s)', d.name, forces[d.force])
groupByForce[d.force]:wikitext(currentframe():expandTemplate{
title='UnitRevealIcon', args={ename, i, d.utype==1 and 'BOSS单位' or ''}})
end
end
root = mw.html.create()
for _,i in ipairs{1, 2, 3, 0} do
root:wikitext('=='..forces[i]..'==')
root:newline()
root:wikitext(tostring(groupByForce[i]))
root:newline()
end
return tostring(root)
end
return p