模块:Flag:修订间差异
来自乐园数据管理室
MWBot |
MWBot |
||
| (未显示同一用户的1个中间版本) | |||
| 第35行: | 第35行: | ||
local ns = "任务" | local ns = "任务" | ||
if id > 6000 then | |||
ns = "佣兵团任务" | |||
end | |||
if ira then | if ira then | ||
ns = "黄金之国任务" | ns = "黄金之国任务" | ||
end | end | ||
local title = mw.title.new(questTitle, ns) | local title = mw.title.new(questTitle, ns) | ||
return "[[" .. title.fullText .. "|" .. title.text .. "]]", phase | if title.exists then | ||
return "[[" .. title.fullText .. "|" .. title.text .. "]]", phase | |||
else | |||
return nil | |||
end | |||
end | end | ||
return p | return p | ||
2020年2月10日 (一) 01:55的最新版本
此模块的文档可以在模块:Flag/doc创建
local p = {}
local QueryHelper = require("Module:Xb2QueryHelper")
local html = require("Module:Html")
local loadJson = require("Module:JSON").loadJson
-- 优先在JSON:ScenarioFlag中寻找匹配文本,找不到时去找FLAG下页面文本
function p.scenario(id)
if id == 0 then
return ""
end
local Scenario = loadJson("ScenarioFlag")
if #Scenario[id] > 0 then
return Scenario[id]
end
local title = mw.title.new("Scenario/" .. id, "FLAG")
local content = title:getContent()
if content then
return content
end
return "[[" .. title.fullText .. "|" .. id .. "]]"
end
function p.quest(id, ira)
if id <= 1000 then
return nil
end
local questTitle, phase = QueryHelper.getQuestTitleByQuestId(id, ira)
if questTitle == nil then
return nil
end
local ns = "任务"
if id > 6000 then
ns = "佣兵团任务"
end
if ira then
ns = "黄金之国任务"
end
local title = mw.title.new(questTitle, ns)
if title.exists then
return "[[" .. title.fullText .. "|" .. title.text .. "]]", phase
else
return nil
end
end
return p