Module:AbilityHints: Difference between revisions

Jump to navigation Jump to search
Wire partial state into hint icons: split grayscale overlay and per-state tooltips (with help from vergir-bot LLM)
Vergir (talk | contribs)
Unlink automatic hint icons; wikilink game terms inside tooltips (with help from vergir-bot LLM)
Line 7: Line 7:
local p = {}
local p = {}


-- Display order. Each entry: { list, file, link, tip }
-- Display order. Each entry: { list, file, tip }
local CONFIG = {
local CONFIG = {
     { list = "melee",          file = "Melee Charge.png",    link = "https://deadlock.wiki/Melee_Charge",    tip = "Benefits from melee items" },
     { list = "melee",          file = "Melee Charge.png",    tip = "Benefits from melee items ([[Melee Charge]])" },
     { list = "movementbased",  file = "Slowing Hex.png",      link = "https://deadlock.wiki/Slowing_Hex",      tip = "Disabled by Slowing Hex" },
     { list = "movementbased",  file = "Slowing Hex.png",      tip = "Disabled by [[Slowing Hex]]" },
     { list = "debuffresist",    file = "Debuff Reducer.png",  link = "https://deadlock.wiki/Debuff_Reducer",  tip = "Debuff duration reduced by Debuff Resist" },
     { list = "debuffresist",    file = "Debuff Reducer.png",  tip = "Debuff duration reduced by [[Debuff Resist]]" },
     { list = "heal",            file = "Healing Booster.png",  link = "https://deadlock.wiki/Healing_Booster",  tip = "Healing amplified by Healing Booster and affected by healing reduction" },
     { list = "heal",            file = "Healing Booster.png",  tip = "[[Healing]] amplified by [[Healing Booster]] and affected by healing reduction" },
     { list = "reactivebarrier", file = "Reactive Barrier.png", link = "https://deadlock.wiki/Reactive_Barrier", tip = "Triggers Reactive Barrier" },
     { list = "reactivebarrier", file = "Reactive Barrier.png", tip = "Triggers [[Reactive Barrier]]" },
     { list = "dispelmagic",    file = "Dispel Magic.png",    link = "https://deadlock.wiki/Dispel_Magic",    tip = "Effect can be dispelled" },
     { list = "dispelmagic",    file = "Dispel Magic.png",    tip = "Effect can be [[Dispel Magic|dispelled]]" },
     { list = "indomitable",    file = "Indomitable.png",      link = "https://deadlock.wiki/Indomitable",      tip = "Disable prevented by Indomitable" },
     { list = "indomitable",    file = "Indomitable.png",      tip = "Disable prevented by [[Indomitable]]" },
     { list = "unstoppable",    file = "Unstoppable.png",      link = "https://deadlock.wiki/Unstoppable",      tip = "Disable prevented by Unstoppable" },
     { list = "unstoppable",    file = "Unstoppable.png",      tip = "Disable prevented by [[Unstoppable]]" },
     { list = "platedarmor",    file = "Plated Armor.png",    link = "https://deadlock.wiki/Plated_Armor",    tip = "On-shot effect prevented by Plated Armor" },
     { list = "platedarmor",    file = "Plated Armor.png",    tip = "On-shot effect prevented by [[Plated Armor]]" },
     { list = "summons",        file = "Monster Rounds.png",  link = "https://deadlock.wiki/Monster_Rounds",  tip = "Summons affected by Monster Rounds and Heroic Aura" },
     { list = "summons",        file = "Monster Rounds.png",  tip = "Summons affected by [[Monster Rounds]] and [[Heroic Aura]]" },
}
}


-- partial: split the icon so the top-left half is grayscale (mirrors the ai-partial box icon).
-- partial: split the icon so the top-left half is grayscale (mirrors the ai-partial box icon).
-- An empty link makes the icon non-clickable; automatic hints link from their tooltip text instead.
local function icon_img(file, link, partial)
local function icon_img(file, link, partial)
    link = link or ''
     if partial then
     if partial then
         return '<span class="ability-hint-icon"><span class="ability-hint-split">'
         return '<span class="ability-hint-icon"><span class="ability-hint-split">'
Line 33: Line 35:


local function hint_icon(def)
local function hint_icon(def)
     return '<span class="ability-hint">' .. icon_img(def.file, def.link)
     return '<span class="ability-hint">' .. icon_img(def.file)
         .. '<span class="ability-hint-tip">' .. def.tip .. ". Click to go to item's page</span></span>"
         .. '<span class="ability-hint-tip">' .. def.tip .. '</span></span>'
end
end