unitframes: add combat hit indicators

thanks @Jayrgo for his work on that.
This commit is contained in:
shagu
2018-04-27 18:21:59 +02:00
parent befdda295e
commit 50eff475d9
11 changed files with 97 additions and 6 deletions
+36 -6
View File
@@ -127,6 +127,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", nil, "clickcast_alt", "")
pfUI:UpdateConfig("unitframes", nil, "clickcast_ctrl", "")
pfUI:UpdateConfig("unitframes", "player", "showPVPMinimap", "0")
pfUI:UpdateConfig("unitframes", "player", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "player", "energy", "1")
pfUI:UpdateConfig("unitframes", "player", "visible", "1")
pfUI:UpdateConfig("unitframes", "player", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "player", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
@@ -163,10 +167,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "player", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "player", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "player", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "player", "showPVPMinimap", "0")
pfUI:UpdateConfig("unitframes", "player", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "player", "energy", "1")
pfUI:UpdateConfig("unitframes", "player", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "player", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "player", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "target", "visible", "1")
pfUI:UpdateConfig("unitframes", "target", "portrait", "bar")
@@ -205,6 +208,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "target", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "target", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "target", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "target", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "target", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "target", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "focus", "visible", "1")
pfUI:UpdateConfig("unitframes", "focus", "portrait", "bar")
@@ -242,6 +248,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "focus", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "focus", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "focus", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "focus", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "focus", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "focus", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "group", "visible", "1")
pfUI:UpdateConfig("unitframes", "group", "portrait", "off")
@@ -280,6 +289,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "group", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "group", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "group", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "group", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "group", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "group", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "grouptarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "portrait", "off")
@@ -317,6 +329,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouptarget", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "grouptarget", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "grouptarget", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "grouppet", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "portrait", "off")
@@ -354,6 +369,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouppet", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "grouppet", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "grouppet", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "raid", "visible", "1")
pfUI:UpdateConfig("unitframes", "raid", "portrait", "off")
@@ -391,6 +409,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "raid", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "raid", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "raid", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "raid", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "raid", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "raid", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "ttarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "portrait", "bar")
@@ -428,6 +449,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "ttarget", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "ttarget", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "ttarget", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "pet", "visible", "1")
pfUI:UpdateConfig("unitframes", "pet", "portrait", "bar")
@@ -438,11 +462,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "pet", "pwidth", "-1")
pfUI:UpdateConfig("unitframes", "pet", "panchor", "TOP")
pfUI:UpdateConfig("unitframes", "pet", "pspace", "-3")
pfUI:UpdateConfig("unitframes", "pet", "buffs", "off")
pfUI:UpdateConfig("unitframes", "pet", "buffs", "top")
pfUI:UpdateConfig("unitframes", "pet", "buffsize", "12")
pfUI:UpdateConfig("unitframes", "pet", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "pet", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "pet", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "pet", "debuffs", "top")
pfUI:UpdateConfig("unitframes", "pet", "debuffsize", "12")
pfUI:UpdateConfig("unitframes", "pet", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "pet", "debuffperrow", "8")
@@ -465,6 +489,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "pet", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "pet", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "pet", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "pet", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "pet", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "pet", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "fallback", "visible", "1")
pfUI:UpdateConfig("unitframes", "fallback", "portrait", "bar")
@@ -502,6 +529,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "fallback", "txtpowerleft", "none")
pfUI:UpdateConfig("unitframes", "fallback", "txtpowercenter", "none")
pfUI:UpdateConfig("unitframes", "fallback", "txtpowerright", "none")
pfUI:UpdateConfig("unitframes", "fallback", "hitindicator", "0")
pfUI:UpdateConfig("unitframes", "fallback", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "fallback", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("bars", nil, "icon_size", "20")
pfUI:UpdateConfig("bars", nil, "background", "1")
+25
View File
@@ -222,6 +222,25 @@ function pfUI.uf:UpdateConfig()
f.portrait:Hide()
end
if f.config.hitindicator == "1" then
f.feedbackText:SetFont(f.config.hitindicatorfont, f.config.hitindicatorsize, "OUTLINE")
f.feedbackFontHeight = f.config.hitindicatorsize
f.feedbackStartTime = GetTime()
if f.config.portrait == "bar" or f.config.portrait == "off" then
f.feedbackText:SetParent(f.hp.bar)
f.feedbackText:ClearAllPoints()
f.feedbackText:SetPoint("CENTER", f.hp.bar, "CENTER")
else
f.feedbackText:SetParent(f.portrait)
f.feedbackText:ClearAllPoints()
f.feedbackText:SetPoint("CENTER", f.portrait, "CENTER")
end
f:RegisterEvent("UNIT_COMBAT")
else
f.feedbackText:Hide()
f:UnregisterEvent("UNIT_COMBAT")
end
f.hpLeftText:SetFont(pfUI.font_unit, C.global.font_unit_size, "OUTLINE")
f.hpLeftText:SetJustifyH("LEFT")
f.hpLeftText:SetFontObject(GameFontWhite)
@@ -573,6 +592,8 @@ function pfUI.uf:EnableScripts()
pfUI.uf:RefreshUnit(this, "portrait")
elseif event == "UNIT_AURA" then
pfUI.uf:RefreshUnit(this, "aura")
elseif event == "UNIT_COMBAT" then
CombatFeedback_OnCombatEvent(arg2, arg3, arg4, arg5)
else
pfUI.uf:RefreshUnit(this)
end
@@ -582,6 +603,9 @@ function pfUI.uf:EnableScripts()
f:SetScript("OnUpdate", function()
local unitname = ( this.label and UnitName(this.label) ) or ""
-- update combat feedback
if this.feedbackText then CombatFeedback_OnUpdate(arg1) end
-- focus unit detection
if this.unitname and this.unitname ~= strlower(unitname) then
-- invalid focus frame
@@ -726,6 +750,7 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
f.portrait.tex = f.portrait:CreateTexture("pfPortraitTexture" .. f.label .. f.id, "OVERLAY")
f.portrait.model = CreateFrame("PlayerModel", "pfPortraitModel" .. f.label .. f.id, f.portrait)
f.portrait.model.next = CreateFrame("PlayerModel", nil, nil)
f.feedbackText = f:CreateFontString("pfHitIndicator" .. f.label .. f.id, "OVERLAY", "NumberFontNormalHuge")
f:Hide()
f:UpdateConfig()
+4
View File
@@ -171,6 +171,7 @@ pfUI_translation["deDE"] = {
["Enable Energy Ticks"] = nil,
["Enable Extended Guild Information"] = nil,
["Enable Health Color"] = nil,
["Enable Hit Indicator"] = nil,
["Enable Item Quality Color For Equipment Only"] = nil,
["Enable Left Actionbar (BottomRight)"] = nil,
["Enable Level Color"] = nil,
@@ -247,6 +248,9 @@ pfUI_translation["deDE"] = {
["Hide Group Frames While In Raid"] = nil,
["Hide Totems"] = nil,
["Highlight Settings That Require Reload"] = nil,
["Hit Indicator"] = nil,
["Hit Indicator Text Font"] = nil,
["Hit Indicator Text Size"] = nil,
["Hoverbind"] = nil,
["Huge (PixelPerfect)"] = nil,
["Icon Size"] = nil,
+4
View File
@@ -171,6 +171,7 @@ pfUI_translation["enUS"] = {
["Enable Energy Ticks"] = nil,
["Enable Extended Guild Information"] = nil,
["Enable Health Color"] = nil,
["Enable Hit Indicator"] = nil,
["Enable Item Quality Color For Equipment Only"] = nil,
["Enable Left Actionbar (BottomRight)"] = nil,
["Enable Level Color"] = nil,
@@ -247,6 +248,9 @@ pfUI_translation["enUS"] = {
["Hide Group Frames While In Raid"] = nil,
["Hide Totems"] = nil,
["Highlight Settings That Require Reload"] = nil,
["Hit Indicator"] = nil,
["Hit Indicator Text Font"] = nil,
["Hit Indicator Text Size"] = nil,
["Hoverbind"] = nil,
["Huge (PixelPerfect)"] = nil,
["Icon Size"] = nil,
+4
View File
@@ -171,6 +171,7 @@ pfUI_translation["esES"] = {
["Enable Energy Ticks"] = "Activar Tic de Energía",
["Enable Extended Guild Information"] = "Activar Información de Hermandad Extendida",
["Enable Health Color"] = "Activar Color de Salud",
["Enable Hit Indicator"] = nil,
["Enable Item Quality Color For Equipment Only"] = "Activar Color de Calidad de Objetos solo para Equipo",
["Enable Left Actionbar (BottomRight)"] = "Activar la Barra de Acción Izquierda (Inferior Derecha)",
["Enable Level Color"] = "Activar Color de Nivel",
@@ -247,6 +248,9 @@ pfUI_translation["esES"] = {
["Hide Group Frames While In Raid"] = "Ocultar los Marcos del Grupo Mientras estés en la Banda",
["Hide Totems"] = "Ocultar Tótems",
["Highlight Settings That Require Reload"] = "Resaltar las Configuraciones que Requieren Recarga",
["Hit Indicator"] = nil,
["Hit Indicator Text Font"] = nil,
["Hit Indicator Text Size"] = nil,
["Hoverbind"] = "Teclado",
["Huge (PixelPerfect)"] = "Enorme (Píxel Perfecta)",
["Icon Size"] = "Tamaño del Icono",
+4
View File
@@ -171,6 +171,7 @@ pfUI_translation["frFR"] = {
["Enable Energy Ticks"] = "Activer la barre de rechargement d'énergie",
["Enable Extended Guild Information"] = "Activer les informations de guilde étendues",
["Enable Health Color"] = nil,
["Enable Hit Indicator"] = nil,
["Enable Item Quality Color For Equipment Only"] = "Activer la couleur de la qualité des objets seulement sur les pièces d'équipement",
["Enable Left Actionbar (BottomRight)"] = nil,
["Enable Level Color"] = nil,
@@ -247,6 +248,9 @@ pfUI_translation["frFR"] = {
["Hide Group Frames While In Raid"] = "Cacher l'UI Groupe en Raid",
["Hide Totems"] = nil,
["Highlight Settings That Require Reload"] = nil,
["Hit Indicator"] = nil,
["Hit Indicator Text Font"] = nil,
["Hit Indicator Text Size"] = nil,
["Hoverbind"] = "Mode Raccourcis",
["Huge (PixelPerfect)"] = nil,
["Icon Size"] = "Taille des icônes",
+4
View File
@@ -171,6 +171,7 @@ pfUI_translation["koKR"] = {
["Enable Energy Ticks"] = "Energy Ticks 활성화",
["Enable Extended Guild Information"] = "길드 정보 확장 사용",
["Enable Health Color"] = nil,
["Enable Hit Indicator"] = nil,
["Enable Item Quality Color For Equipment Only"] = "착용장비 전용 아이템품질 색상 활성화",
["Enable Left Actionbar (BottomRight)"] = nil,
["Enable Level Color"] = nil,
@@ -247,6 +248,9 @@ pfUI_translation["koKR"] = {
["Hide Group Frames While In Raid"] = nil,
["Hide Totems"] = nil,
["Highlight Settings That Require Reload"] = nil,
["Hit Indicator"] = nil,
["Hit Indicator Text Font"] = nil,
["Hit Indicator Text Size"] = nil,
["Hoverbind"] = "단축키 설정",
["Huge (PixelPerfect)"] = nil,
["Icon Size"] = "아이콘 크기",
+4
View File
@@ -171,6 +171,7 @@ pfUI_translation["ruRU"] = {
["Enable Energy Ticks"] = "Включить восполнение энергии",
["Enable Extended Guild Information"] = "Включить расширенную информацию о гильдии",
["Enable Health Color"] = "Включить цвет здоровья",
["Enable Hit Indicator"] = nil,
["Enable Item Quality Color For Equipment Only"] = "Включить цвет качества предметов только для экипировки",
["Enable Left Actionbar (BottomRight)"] = "Включить левую панель действий (BottomRight)",
["Enable Level Color"] = "Включить цвет уровня",
@@ -247,6 +248,9 @@ pfUI_translation["ruRU"] = {
["Hide Group Frames While In Raid"] = "Скрыть окно группы, когда в рейде",
["Hide Totems"] = "Скрыть тотемы",
["Highlight Settings That Require Reload"] = "Выделить параметры, требующие перезагрузки",
["Hit Indicator"] = nil,
["Hit Indicator Text Font"] = nil,
["Hit Indicator Text Size"] = nil,
["Hoverbind"] = "Назначение клавиш",
["Huge (PixelPerfect)"] = "Огромный (идеальный пиксель)",
["Icon Size"] = "Размер иконки",
+4
View File
@@ -171,6 +171,7 @@ pfUI_translation["zhCN"] = {
["Enable Energy Ticks"] = "显示能量刻度",
["Enable Extended Guild Information"] = "公会信息扩展显示",
["Enable Health Color"] = nil,
["Enable Hit Indicator"] = nil,
["Enable Item Quality Color For Equipment Only"] = "仅在装备上显示品质颜色",
["Enable Left Actionbar (BottomRight)"] = nil,
["Enable Level Color"] = nil,
@@ -247,6 +248,9 @@ pfUI_translation["zhCN"] = {
["Hide Group Frames While In Raid"] = "在团队框架下隐藏小队框架",
["Hide Totems"] = "隐藏图腾",
["Highlight Settings That Require Reload"] = nil,
["Hit Indicator"] = nil,
["Hit Indicator Text Font"] = nil,
["Hit Indicator Text Size"] = nil,
["Hoverbind"] = "悬停设置",
["Huge (PixelPerfect)"] = nil,
["Icon Size"] = "图标大小",
+4
View File
@@ -171,6 +171,7 @@ pfUI_translation["zhTW"] = {
["Enable Energy Ticks"] = "顯示能量刻度",
["Enable Extended Guild Information"] = "公會資訊擴展顯示",
["Enable Health Color"] = nil,
["Enable Hit Indicator"] = nil,
["Enable Item Quality Color For Equipment Only"] = "僅在裝備上顯示品質顏色",
["Enable Left Actionbar (BottomRight)"] = nil,
["Enable Level Color"] = nil,
@@ -247,6 +248,9 @@ pfUI_translation["zhTW"] = {
["Hide Group Frames While In Raid"] = "在團隊框架下隱藏小隊框架",
["Hide Totems"] = nil,
["Highlight Settings That Require Reload"] = nil,
["Hit Indicator"] = nil,
["Hit Indicator Text Font"] = nil,
["Hit Indicator Text Size"] = nil,
["Hoverbind"] = "懸停設置",
["Huge (PixelPerfect)"] = nil,
["Icon Size"] = "圖示大小",
+4
View File
@@ -901,6 +901,10 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(update[c], this, T["Enable Level Color"], C.unitframes[c], "levelcolor", "checkbox")
CreateConfig(update[c], this, T["Enable Class Color"], C.unitframes[c], "classcolor", "checkbox")
CreateConfig(update[c], this, T["Hit Indicator"], nil, nil, "header")
CreateConfig(update[c], this, T["Enable Hit Indicator"], C.unitframes[c], "hitindicator", "checkbox")
CreateConfig(update[c], this, T["Hit Indicator Text Font"], C.unitframes[c], "hitindicatorfont", "dropdown", pfUI.gui.dropdowns.fonts)
CreateConfig(update[c], this, T["Hit Indicator Text Size"], C.unitframes[c], "hitindicatorsize")
this.setup = true
end
end)