local p={}
list_userbox={
'{{用戶 重定向狂魔}}',
'{{用戶 定義陣營圖||\'\'\'該用戶對於[[MGP:收錄範圍|收錄範圍]]{{Ruby|並無|不願持有}}過多意見\'\'\'<br>[[三國殺:賈詡|\'\'我自冷眼看世界,不問天下是與非\'\']]}}',
'{{用戶 借鑑}}',
'{{用戶 內鏈狂魔}}',
'{{用戶 水編輯}}',
'{{用戶 SorryIE}}',
'{{用戶 消歧義狂魔}}',
'{{用戶 小編輯}}',
'{{user 最近更改}}',
'{{用戶 拋磚引玉}}',
'{{用戶 監視狂魔}}',
'{{user Android}}',
'{{用戶 HotCat}}',
'{{用戶 IPE}}',
'{{用戶 Wikiplus}}',
'{{user Windows|10}}',
'{{用戶 編輯次數|num={{#cscore:Ultim 0|changes}}|data=目前|style=6}}',
'{{用戶 方針的熟悉程度|1}}',
'{{用戶 萌百九宮格|守序中立|\'\'\'這個用戶的陣營是守序中立\'\'\'<br>別老想著把不要命的東西放到萌百啊!}}',
'{{用戶 萌百中毒}}',
'{{user Moegirl For|year=2020|month=8|day=25}}',
'{{用戶 WAF|好吃到吐!}}',
'{{用戶 新手|內容={{胡話|雖然已經在萌百做出了大量的編輯}}}}',
'{{用戶 戰五渣}}',
'{{用戶 Putonghua}}',
'{{用戶 dbiu|1}}',
'{{user en|3}}',
'{{user ja|1}}',
'{{user ko|1}}',
'{{user lzh|3}}',
'{{user C語言|2}}',
'{{user cpp|2}}',
'{{user python|1}}',
'{{user Lua|1}}',
'{{user Wiki-4}}',
'{{user ml|5}}',
'{{Userbox|id=<span/>***|info=該用戶不願透露自己的年齡。|info-size=10|info-c=skyblue|border-s=1|border-c=blue}}',
'{{用戶 Minecraft|99}}',
'{{用戶 Minecraft/技術玩家}}',
'{{用戶 Minecraft國際版|ultim_0}}',
'{{用戶 三國殺}}',
'{{user SAO}}',
'{{用戶 三體|傻孩子們,快——跑——啊——}}',
'{{用戶 Chrome}}',
'{{user LaTeX|初步}}',
'{{user Unicode|你知道嗎?Unicode目前收錄了超過十萬個漢字}}',
'{{用戶 A站用戶|-{烏啼_ultim_烏啼}-|33015959}}',
'{{用戶 B站用戶|-{烏啼_ultim_烏啼}-|444229847/dynamic}}',
'{{用戶 FANDOM用戶|ultim_0|zh.minecraft}}',
'{{用戶 QQ}}',
'{{用戶 知乎用戶|ultim 0|ultim-0}}',
'{{用戶 像素畫}}',
'{{用戶 阿卡林}}',
'{{用戶 社恐||但這與網上衝浪無關}}',
'{{用戶 水群|freq=偶爾會}}',
'{{用戶 2與3次元}}',
'{{用戶 秉筆直書}}',
'{{用戶 錯字受}}',
'{{user 繁簡混用|但只在需要避免歧義的時候使用}}',
'{{用戶 廣泛收集}}',
'{{用戶 莫談國事}}',
'{{用戶 寧缺毋濫}}',
'{{用戶 NO AI|諸如ChatGPT之類的}}',
'{{用戶 強迫症}}',
'{{用戶 太長不看}}',
'{{用戶 玩梗適度}}',
'{{用戶 勿用詞條}}',
'{{用戶 玄學|game=[[三國殺]]|way=用雙[[三國殺:無懈可擊|無懈]]|do=應對[[三國殺:兵糧寸斷|兵]][[三國殺:樂不思蜀|樂]][[三國殺:閃電|閃電]]|1={{胡話|結果:兵樂天過,閃電炸我}}}}',
'{{用戶 用戶框}}',
'{{用戶 原創}}',
'{{用戶 笨蛋}}'
}
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