模块:角色表情
刷
历
编
跳到导航
跳到搜索
此模块的文档可以在模块:角色表情/doc创建
local p = {}
local strinova = require("模块:卡拉彼丘")
local data = mw.loadData("模块:角色表情/Data")
local mobileData = mw.loadData("模块:角色表情/MobileData")
-- 如果有'-',进行分割返回第二部分,否则直接返回原字符串
local function splitKey(key)
if not key:find("-") then
return key
end
local parts = {}
for part in key:gmatch("[^-]+") do
parts[#parts + 1] = part
end
return parts[2] or key
end
-- 合并表
local function mergeTables(t1, t2)
local result = {}
if t1 then
for _, v in ipairs(t1) do
table.insert(result, v)
end
end
if t2 then
for _, v in ipairs(t2) do
table.insert(result, v)
end
end
return result
end
------角色页角色表情
p["角色表情"] = function (frame)
local emoteRole = strinova.get_page_title(frame)
local allItems = mergeTables(data, mobileData)
local resultList = {}
for _, item in pairs(allItems) do
if emoteRole == item.role then
local emoteHTML = item.file.."|'''<big>"..splitKey(item.name)
.."</big>'''<br><small>"..item.desc.."</small><br>获得方式:"..item.get
table.insert(resultList, tostring(emoteHTML))
end
end
local result = table.concat(resultList, "\n")
return result..'\n'
end
------表情包页面
p["表情包"] = function (frame)
local emoteRole = frame.args[1]
local allItems = mergeTables(data, mobileData)
local resultList = {}
for _, item in pairs(allItems) do
if emoteRole == item.role then
local emoteHTML = item.file.."|'''<big>"..splitKey(item.name)
.."</big>'''<br><small>"..item.desc.."</small><br>获得方式:"..item.get
table.insert(resultList, tostring(emoteHTML))
end
end
local result = table.concat(resultList, "\n")
return frame:preprocess('<gallery mode="packed">\n'..result..'\n</gallery>')
end
------意识重构页角色表情
p["意识重构角色表情"] = function (frame)
local emoteRole = frame.args[1]
local resultList = {}
for _, item in pairs(data) do
if string.find(item.get, emoteRole, 1, true) then
local emoteHTML = item.file..
"|'''<big>"..item.role.."表情:"..splitKey(item.name).."</big>'''"
..strinova.rarity_tag(frame, item.quality)
table.insert(resultList, tostring(emoteHTML))
end
end
local result = table.concat(resultList, "\n")
return frame:preprocess('<gallery mode="packed">\n'..result..'\n</gallery>')
end
return p

沪公网安备 31011002002714 号