参考 › 函数参考 › Functions

Functions.presentation.phrase

公共

调用方式

Functions.presentation.phrase(template, values)

将其记录为名为 Functions.presentation.phrase 的依赖项(接受自动补全即可完成),然后按该名称调用。

作用

创建一个临时的具名条件摘要。标量值使用 {name},判断的正反两种措辞使用 {{positive|negative}};在主要措辞前加上 ! 前缀。字面的双花括号请转义为 {{{{ 和 }}}}。值会按字面插入,不解析其中的百分号、链接、颜色或花括号。带类型的判断值会参与主要措辞的选择。模板、值和渲染后的文本都有长度上限;格式错误的输入会渲染为本地化的“不可用”摘要。这只改变呈现方式,不会运行任何条件观测。

参数

名称类型作用
templatestring带有命名栏位和可选的显式判断备选项的本地化完整句子。
valuestable以标识符为键的标量值或带类型的判断。支持字符串、有限数字和布尔值;被引用的栏位必须存在。值在创建短语时被捕获。

返回值

1RMConditionPhrase条件摘要渲染所识别的临时可信短语;不要将其作为条件数据保存。

版本

内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。

它不直接读取任何游戏 API。

插件如何调用它

  • 存在增益效果 (print)
    return AuraLiteral.phrase(Functions.presentation.playerize(value.unit, L["{unit} {{!have|do not have}} {aura}"], L["{unit} {{!has|does not have}} {aura}"]), {
  • 增益效果剩余时间 (print)
    return AuraSummary.phrase(Functions.presentation.playerize(value.unit, L["{unit} {{!have|do not have}} {aura} where {remaining} {comparison} {duration}"], L["{unit} {{!has|does not have}} {aura} where {remaining} {comparison} {duration}"]), {
  • 增益效果层数 (print)
    return AuraSummary.phrase(L["the number of stacks of {aura} on {unit} {comparison} {quantity}"], {
  • 背包中有物品 (print)
    return Summary.phrase(L["the number of {item} you are carrying {comparison} {quantity}"], {
  • 施放特定法术 (print)
    return LiteralSummary.phrase(Functions.presentation.playerize(value.unit, L["{unit} {{!are|are not}} currently casting {spell}"], L["{unit} {{!is|is not}} currently casting {spell}"]), {
  • 引导特定法术 (print)
    return LiteralSummary.phrase(Functions.presentation.playerize(value.unit, L["{unit} {{!are|are not}} currently channeling {spell}"], L["{unit} {{!is|is not}} currently channeling {spell}"]), {
  • 存在减益效果 (print)
    return AuraLiteral.phrase(Functions.presentation.playerize(value.unit, L["{unit} {{!have|do not have}} {aura}"], L["{unit} {{!has|does not have}} {aura}"]), {
  • 减益效果剩余时间 (print)
    return AuraSummary.phrase(Functions.presentation.playerize(value.unit, L["{unit} {{!have|do not have}} {aura} where {remaining} {comparison} {duration}"], L["{unit} {{!has|does not have}} {aura} where {remaining} {comparison} {duration}"]), {

以及另外 18 处: 减益效果层数 (print), 扩展角色属性 (print), 扩展角色属性百分比 (print), 已装备物品 (print), 物品可用 (print), 物品冷却 (print), 物品在射程内 (print), 拥有指定名称的宠物 (print), 范围内的生命值 (print), 范围内的生命值百分比 (print), 范围内的生命值百分比计数 (print), 范围内的生命值计数 (print), 范围内的法力值 (print), 范围内的法力值百分比 (print), 范围内的法力值百分比计数 (print), 范围内的法力值计数 (print), 已装备的套装件数 (print), 区域 (print)

源码

Functions/presentation.lua,第 86 行。在游戏中为只读;“复制”会生成一份可编辑的副本。

Functions.presentation.phrase(template, values)
    return addon:CreateConditionSummaryPhrase(template, values)

返回函数参考