“模块:Jobs”的版本间的差异
来自小鱼君和他的朋友们
([InPageEdit] 没有编辑摘要) |
([InPageEdit] 没有编辑摘要) |
||
第3行: | 第3行: | ||
local jobCode = { | local jobCode = { | ||
− | ['弓箭手'] = 'archer', | + | ['弓箭手'] = 'archer', |
− | ['archer'] = 'archer', | + | ['archer'] = 'archer', |
− | ['arc'] = 'archer' | + | ['arc'] = 'archer' |
} | } | ||
− | local | + | local jobDetail = { |
− | ['unknown'] = '未知职业', | + | ['unknown'] = { |
− | ['archer'] = '弓箭手' | + | ['name'] = '未知职业', |
+ | ['color'] = 'unknown', | ||
+ | ['prop'] = '', | ||
+ | ['level'] = 'n' | ||
+ | }, | ||
+ | ['archer'] = { | ||
+ | ['name'] = '弓箭手', | ||
+ | ['color'] = 'red', | ||
+ | ['prop'] = '远程物理', | ||
+ | ['level'] = 'n' | ||
+ | } | ||
} | } | ||
第18行: | 第28行: | ||
input = mw.ustring.lower(input) | input = mw.ustring.lower(input) | ||
local jobCode = jobCode[input] or 'unknown' | local jobCode = jobCode[input] or 'unknown' | ||
− | return | + | return jobDetail[jobCode]['name'] .. jobDetail[jobCode]['color'] |
end | end | ||
return p | return p |
2020年4月2日 (四) 10:57的版本
弓箭手red 弓箭手red
未知职业unknown 未知职业unknown
未知职业unknown 未知职业unknown
未知职业unknown
Module:Jobs/alias (编辑) • Module:Jobs/colorInfo (编辑) • Module:Jobs/details (编辑) • Module:Jobs/levels (编辑)
local p = {} local getArgs = require('Module:Arguments').getArgs local jobCode = { ['弓箭手'] = 'archer', ['archer'] = 'archer', ['arc'] = 'archer' } local jobDetail = { ['unknown'] = { ['name'] = '未知职业', ['color'] = 'unknown', ['prop'] = '', ['level'] = 'n' }, ['archer'] = { ['name'] = '弓箭手', ['color'] = 'red', ['prop'] = '远程物理', ['level'] = 'n' } } function p.main(frame) local args = getArgs(frame) local input = args['job'] or args[1] or 'unknown' input = mw.ustring.lower(input) local jobCode = jobCode[input] or 'unknown' return jobDetail[jobCode]['name'] .. jobDetail[jobCode]['color'] end return p