Skip to content

Commit

Permalink
Add targets to binding tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Snakybo committed Sep 21, 2020
1 parent 3271d00 commit 26b932b
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Config/Bindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,46 @@ local function DrawTreeView(container)

text = text .. "\n\n"

local function GetTargetLine(target)
local units = {
PLAYER = L["CFG_UI_ACTION_TARGET_UNIT_PLAYER"],
GLOBAL = L["CFG_UI_ACTION_TARGET_UNIT_GLOBAL"],
TARGET = L["CFG_UI_ACTION_TARGET_UNIT_TARGET"],
MOUSEOVER = L["CFG_UI_ACTION_TARGET_UNIT_MOUSEOVER"],
HOVERCAST = L["CFG_UI_ACTION_TARGET_UNIT_HOVERCAST"],
FOCUS = L["CFG_UI_ACTION_TARGET_UNIT_FOCUS"],
CURSOR = L["CFG_UI_ACTION_TARGET_UNIT_CURSOR"],
PARTY_1 = L["CFG_UI_ACTION_TARGET_UNIT_PARTY"]:format("1"),
PARTY_2 = L["CFG_UI_ACTION_TARGET_UNIT_PARTY"]:format("2"),
PARTY_3 = L["CFG_UI_ACTION_TARGET_UNIT_PARTY"]:format("3"),
PARTY_4 = L["CFG_UI_ACTION_TARGET_UNIT_PARTY"]:format("4"),
PARTY_5 = L["CFG_UI_ACTION_TARGET_UNIT_PARTY"]:format("5")
}

local hostility = {
ANY = "",
HELP = L["CFG_UI_ACTION_TARGET_TYPE_FRIEND"],
HARM = L["CFG_UI_ACTION_TARGET_HOSTILITY_HARM"]
}

local result = ""

if Clicked:CanUnitBeHostile(target.unit) and target.hostility ~= Clicked.TARGET_HOSTILITY_ANY then
result = hostility[target.hostility] .. " "
end

result = result .. units[target.unit]
return result
end

text = text .. "1. " .. GetTargetLine(binding.primaryTarget)

for i, target in ipairs(binding.secondaryTargets) do
text = text .. "\n" .. (i + 1) .. ". " .. GetTargetLine(target)
end

text = text .. "\n\n"

if Clicked:IsBindingActive(binding) then
text = text .. L["CFG_UI_TREE_TOOLTIP_LOAD_STATE_LOADED"]
else
Expand Down

0 comments on commit 26b932b

Please sign in to comment.