打开/关闭搜索
搜索
打开/关闭菜单
5
6
1
403
夜幕之下
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
上传文件
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
创建账号
登录
查看“︁模块:HttpTest”︁的源代码
来自夜幕之下
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
模块:HttpTest
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
管理员
您可以查看和复制此页面的源代码。
local p = {} local function val(v, fallback) if v == nil or v == "" then return fallback or "—" end return v end function p.get(frame) local cardname = frame.args[1] or "" local url = "https://data.saltedkiss.org/items/cards?filter[stylename][_eq]=" .. mw.uri.encode(cardname) .. "&limit=1&fields=*,character.*,profession.*,desire.*,skill_normal_attack.*,skill_passive.*,skill_ultimate.*,feats.stages.*,stories.story" -- 从 ExternalData 获取数据 local data = mw.ext.externalData.getExternalData({ url = url, format = "json" }) if not data or not data[1] then return "未获取到卡牌数据" end local card = data[1] -- 创建变量 local stylename = val(card.stylename) local rarity = val(card.rarity) local character = val(card.character and card.character.name) local profession = val(card.profession and card.profession.name) local desire = val(card.desire and card.desire.name) local skill_normal_attack = card.skill_normal_attack or {} local skill_passive = card.skill_passive or {} local skill_ultimate = card.skill_ultimate or {} local feats = card.feats or {} local stories = card.stories or {} -- 简单输出测试(可换成你后续处理) local output = "<pre>" output = output .. "卡牌名: " .. stylename .. "\n" output = output .. "稀有度: " .. rarity .. "\n" output = output .. "角色: " .. character .. "\n" output = output .. "职业: " .. profession .. "\n" output = output .. "欲望: " .. desire .. "\n" -- 技能输出示例 output = output .. "\n普通攻击: " .. val(skill_normal_attack.name) .. " - " .. val(skill_normal_attack.description) .. "\n" output = output .. "被动技能: " .. val(skill_passive.name) .. " - " .. val(skill_passive.description) .. "\n" output = output .. "必杀技能: " .. val(skill_ultimate.name) .. " - " .. val(skill_ultimate.description) .. "\n" -- 输出故事数量 output = output .. "\n故事条数: " .. #stories .. "\n" output = output .. "</pre>" return output end return p
该页面嵌入的页面:
模块:HttpTest/doc
(
查看源代码
)
返回
模块:HttpTest
。
查看“︁模块:HttpTest”︁的源代码
来自夜幕之下