local p={} --源代码参考自[https://zh.moegirl.org.cn/%E6%A8%A1%E5%9D%97:Sandbox/Ultim_0/Userbox],仅在usebox处作更改。
--注意:userbox项中不能填有{{clear}}空白项,会自动进行排版。userbox项中不能有wikitext中的加粗字体,即“'''文字'''”。default_userbox是必要的。
list_userbox={
'{{用户 借鉴}}',
'{{用户 B站用户|EVlainA|475546702}}',
'{{User Windows|11}}',
'{{用户 VSCode}}',
'{{用户 Microsoft Edge}}',
'{{用户 阿卡林}}',
'{{用户 EVA|NIGEX}}',
'{{用户 京都动画}}',
'{{用户 百合控|只是觉得女孩子之间真好啊}}',
'{{用户 轻小说}}',
'{{用户 86|love=芙拉蒂蕾娜·米利杰}}',
'{{用户 物语系列}}',
'{{User Galgame}}',
'{{用户 VOCALOID}}',
'{{用户 初音粉}}',
'{{User luotianyi}}',
'{{用户 星尘}}',
'{{User wowaka}}',
'{{User DECO*27}}',
'{{User 匹诺曹P}}',
'{{User 伞村Tota}}',
'{{User Orangestar}}',
'{{User *Luna}}',
'{{用户 ilem}}',
'{{用户 雀魂}}',
'{{用户_赛马娘_Pretty_Derby|无声铃鹿|color=#29BD70}}',
'{{用户 osu|||圈}}',
'{{用户 Phigros|TA刚刚向你送出了一个<big><big>您</big></big>}}',
'{{用户 Arcaea|love=tairitsu}}',
'{{用户 Bandori|Band=Roselia|Love=凑友希那}}',
'{{用户 PJSK|Band=25时,在Nightcord。|Love=东云绘名}}',
'{{用户 定义阵营图|狭义保留}}',
'{{用户 HotCat}}',
'{{用户 Wikiplus}}',
'{{用户 会员|内容=不过他一直是通过每周活跃的努力编辑来获取{{黑幕|(白嫖)}}会员}}',
'{{用户_萌百九宫格|守序善良}}',
'{{用户 萌百中毒}}',
'{{用户 抛砖引玉}}',
'{{用户 别酱了|id=[[File:绪山真寻 生贺 裁切.jpg|57px|link=绪山真寻|绪山真寻]]}}',
'{{用户_憧憬成为魔法少女}}',
'{{用户 Comic Girls}}',
'{{用户 京吹}}',
'{{用户 点兔|CHINO}}',
'{{用户_工作细胞|作品=BLACK}}',
'{{用户 孤独摇滚|最喜欢{{coloredlink|#FF2291|后藤一里|小波奇}}}}',
'{{用户 辉告}}',
'{{User 来自深渊}}',
'{{User 灵能百分百}}',
'{{用户 喵帕斯}}',
'{{用户 轻音}}',
'{{用户 日常}}',
'{{用户 幸运星}}',
'{{用户 相合之物||一果可爱捏。}}',
'{{用户 龙女仆}}',
'{{User 野良神}}',
'{{用户 银魂}}',
'{{用户 月刊少女野崎君|并苦苦等待第二季。}}',
'{{用户 芳文社|Special=孤独摇滚|Text=芳文社赛高!}}',
'{{用户 AB}}',
'{{用户 你的名字}}',
'{{用户 莉可丽丝}}',
'{{用户 魔法少女小圆}}',
'{{用户 少女与战车}}',
'{{用户 未闻花名}}',
'{{用户 京都脸}}',
'{{用户 小魔女学园}}',
'{{User 玉子市场}}',
'{{用户 动画工房|Special=天使降临到我身边!}}',
'{{用户 崩坏3}}',
'{{用户 无畏契约}}',
'{{用户 GTA5}}',
'{{用户 Minecraft|1}}',
'{{用户 崩坏:星穹铁道}}',
'{{用户 PCR}}',
'{{用户 泰坦陨落|APEX}}',
'{{用户 求生之路}}',
'{{用户 植物大战僵尸}}',
'{{用户 光遇|经常串线|光之崽种}}',
'{{用户 皇室战争}}',
'{{用户 明日方舟|博士,您还有许多事情需要处理。现在还不能休息哦。}}',
'{{用户 少女前线}}',
'{{用户 王者荣耀}}',
'{{用户 蔚蓝档案|student=砂狼白子}}',
'{{用户 元气骑士}}',
'{{用户 原神}}',
'{{用户 绝区零}}',
'{{用户 战双帕弥什}}',
'{{User Roco}}',
'{{用户 英雄联盟}}',
'{{用户 守望先锋}}',
'{{用户 cl}}',
'{{用户 Epic Games}}',
'{{用户 键子}}',
'{{用户 开罗游戏}}',
'{{用户 Steam}}',
'{{用户 TapTap}}',
'{{用户 冰菓}}',
'{{用户 春物|1}}',
'{{用户 京紫}}',
'{{用户 御坂妹妹}}',
'{{用户 珂学}}',
'{{用户 青猪}}',
'{{用户 Re:从零开始的异世界生活|RNR}}',
'{{用户 无职转生}}',
'{{User IA}}',
'{{用户 歌爱雪}}',
'{{User sasakure.UK}}',
'{{用户 Pixiv}}',
'{{用户 假面骑士迷}} ',
'{{用户 奥特曼}}',
'{{用户 特摄迷}}',
'{{用户_本命|[[伊蕾娜|伊蕾娜]]|[[File:伊蕾娜.jpg|60px]]}}',
'{{用户 孤独}}',
'{{用户 社恐|严重的|互联网上除外}}',
'{{用户 阅番无数|2}}',
'{{用户 腿控}}',
'{{用户 2与3次元}}',
'{{User 繁简混用}}',
'{{用户 玩梗适度}}',
'{{用户 杂食}}',
'{{用户 幽默|该用户保持24h不间断高强度整活!}}',
'{{用户 中二恋}}',
'{{用户 少女歌剧}}'
}
default_userbox='{{用户 用户框}}'
function p.randomuserbox(n)
local rand
math.randomseed(os.time())
if tonumber(n)==0 then
rand=math.random(1,table.getn(list_userbox))
else
rand=tonumber(n)
end
local text=list_userbox[rand]
if(type(text)=="nil")then
text=default_userbox
end
return text
end
function p.randomuserboxcall(frame) --返回若干个用户框(伪随机)
if tonumber(frame.args[1])>table.getn(list_userbox) then
return '<span class=error>错误:给定的数字' .. frame.args[1] .. '大于数组的长度' .. table.getn(list_userbox) .. '!</span>'
end
math.randomseed(os.time())
sj=math.random
local tb={}
local i=1
while(i<=frame.args[1]+1) do
local flag=0
local n=sj(1,table.getn(list_userbox))
for j=1,table.getn(tb) do
if n==tb[j] then
flag=1
i=i-1
break
end
end
if flag==0 then
tb[i]=n
end
i=i+1
end
table.remove(tb,1)
local text=''
--[[调试专用代码段始
for i=1,frame.args[1] do
if type(tb[i])=='nil' then
text=text .. 'nil' .. ', '
else
text=text .. tb[i] .. ', '
end
end
]]--调试专用代码段终
text=text .. '{|align=center\n'
for i=1,frame.args[1] do
text=text .. '|' .. p.randomuserbox(tb[i]) .. '\n|-\n'
end
text=text .. '|}\n'
return frame:preprocess(text)
end
function p.userboxlist(frame) --所有用户框一览
local text='{|align=center\n'
local i
for i=1,table.getn(list_userbox),1 do
text=text .. '|' .. list_userbox[i] .. '\n'
if i%3==0 then
text=text .. '|-\n'
end
end
text=text .. '|-\n|\n|' .. default_userbox .. '\n|\n|}'
return frame:preprocess(text)
end
return p