- Fixed the problem with bar's custom texts.

- Function calls inside the custom text are now protected against script errors.
- Chart Data scripts and Custom Displays scripts now also are protected.
- Still more smoothing tweaks on menus and skins.
This commit is contained in:
tercio
2014-10-20 15:10:19 -02:00
parent 202bbdc606
commit 5a783e8c60
13 changed files with 103 additions and 58 deletions
+6 -3
View File
File diff suppressed because one or more lines are too long
+17 -7
View File
@@ -23,6 +23,7 @@
local _bit_band = bit.band --lua local
local _unpack = unpack --lua local
local _type = type --lua local
local _pcall = pcall -- lua local
local _GetSpellInfo = _detalhes.getspellinfo -- api local
local _IsInRaid = IsInRaid -- api local
@@ -31,6 +32,8 @@
local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers -- api local
local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers -- api local
local _GetUnitName = GetUnitName -- api local
local _string_replace = _detalhes.string.replace --details api
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
@@ -131,7 +134,14 @@
end
--> call the loop function
total, top, amount = func (combat, instance_container, instance)
--total, top, amount = func (combat, instance_container, instance)
okey, total, top, amount = _pcall (func, combat, instance_container, instance)
if (not okey) then
_detalhes:Msg ("|cFFFF9900error on custom display function|r:", total)
return _detalhes:EndRefresh (instance, 0, combat, combat [1])
end
else
--> get the attribute
local attribute = custom_object:GetAttribute()
@@ -458,7 +468,7 @@
else
local formated_value = SelectedToKFunction (_, self.value)
if (UsingCustomRightText) then
row.texto_direita:SetText (instance.row_info.textR_custom_text:ReplaceData (formated_value, "", percent, self))
row.texto_direita:SetText (_string_replace (instance.row_info.textR_custom_text, formated_value, "", percent, self))
else
row.texto_direita:SetText (formated_value .. " (" .. percent .. "%)")
end
@@ -604,7 +614,7 @@
if (self.enemy) then
if (self.arena_enemy) then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName)
end
@@ -612,13 +622,13 @@
else
if (_detalhes.faction_against == "Horde") then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA
end
else
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY
end
@@ -631,13 +641,13 @@
else
if (self.arena_ally) then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName)
end
else
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, ""))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, ""))
else
esta_barra.texto_esquerdo:SetText (bar_number .. self.displayName) --seta o texto da esqueda
end
+13 -11
View File
@@ -26,7 +26,9 @@
local GameTooltip = GameTooltip --api local
local _IsInRaid = IsInRaid --api local
local _IsInGroup = IsInGroup --api local
local _GetSpellInfo = _detalhes.getspellinfo --details api
local _string_replace = _detalhes.string.replace --details api
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
@@ -645,7 +647,7 @@
end
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_damage, formated_dps, porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_damage, formated_dps, porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_damage .. " (" .. formated_dps .. ", " .. porcentagem .. "%)")
end
@@ -1353,7 +1355,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra,
local formated_dps = SelectedToKFunction (_, dps)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_damage, formated_dps, porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_damage, formated_dps, porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_damage .. " (" .. formated_dps .. ", " .. porcentagem .. "%)") --seta o texto da direita
end
@@ -1366,7 +1368,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra,
local formated_dps = SelectedToKFunction (_, dps)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_dps, formated_damage, porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_dps, formated_damage, porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_dps .. " (" .. formated_damage .. ", " .. porcentagem .. "%)") --seta o texto da direita
end
@@ -1380,7 +1382,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra,
local formated_dtps = SelectedToKFunction (_, dtps)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_damage_taken, formated_dtps, porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_damage_taken, formated_dtps, porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_damage_taken .." (" .. formated_dtps .. ", " .. porcentagem .. "%)") --seta o texto da direita --
end
@@ -1391,7 +1393,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra,
local formated_friendly_fire = SelectedToKFunction (_, self.friendlyfire_total)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_friendly_fire, "", porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_friendly_fire, "", porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_friendly_fire .. " (" .. porcentagem .. "%)") --seta o texto da direita --
end
@@ -1404,7 +1406,7 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra,
local formated_dps = SelectedToKFunction (_, dps)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_damage, formated_dps, porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_damage, formated_dps, porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_damage .. " (" .. formated_dps .. ", " .. porcentagem .. "%)") --seta o texto da direita
end
@@ -1570,7 +1572,7 @@ end
if (self.enemy) then
if (self.arena_enemy) then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName)
end
@@ -1578,13 +1580,13 @@ end
else
if (_detalhes.faction_against == "Horde") then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA
end
else
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY
end
@@ -1597,13 +1599,13 @@ end
else
if (self.arena_ally) then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName)
end
else
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, ""))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, ""))
else
esta_barra.texto_esquerdo:SetText (bar_number .. self.displayName) --seta o texto da esqueda
end
+8 -6
View File
@@ -24,6 +24,8 @@ local GameTooltip = GameTooltip
local _IsInRaid = IsInRaid
local _IsInGroup = IsInGroup
local _string_replace = _detalhes.string.replace --details api
local _detalhes = _G._detalhes
local AceLocale = LibStub ("AceLocale-3.0")
local Loc = AceLocale:GetLocale ( "Details" )
@@ -517,7 +519,7 @@ function atributo_energy:AtualizaBarra (instancia, barras_container, qual_barra,
local formated_energy = SelectedToKFunction (_, esta_e_energy_total)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_energy, "", porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_energy, "", porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_energy .. " (" .. porcentagem .. "%)") --seta o texto da direita
end
@@ -661,7 +663,7 @@ function atributo_energy:RefreshBarra (esta_barra, instancia, from_resize)
if (self.enemy) then
if (self.arena_enemy) then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName)
end
@@ -669,13 +671,13 @@ function atributo_energy:RefreshBarra (esta_barra, instancia, from_resize)
else
if (_detalhes.faction_against == "Horde") then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA
end
else
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY
end
@@ -688,13 +690,13 @@ function atributo_energy:RefreshBarra (esta_barra, instancia, from_resize)
else
if (self.arena_ally) then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName)
end
else
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, ""))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, ""))
else
esta_barra.texto_esquerdo:SetText (bar_number .. self.displayName) --seta o texto da esqueda
end
+13 -11
View File
@@ -21,6 +21,8 @@ local _IsInGroup = IsInGroup
local _UnitName = UnitName
local _GetNumGroupMembers = GetNumGroupMembers
local _string_replace = _detalhes.string.replace --details api
local _detalhes = _G._detalhes
local _
@@ -634,7 +636,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local formated_hps = SelectedToKFunction (_, hps)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_heal, formated_hps, porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_heal, formated_hps, porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_heal .." (" .. formated_hps .. ", " .. porcentagem .. "%)") --seta o texto da direita
end
@@ -647,7 +649,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local formated_hps = SelectedToKFunction (_, hps)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_hps, formated_heal, porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_hps, formated_heal, porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_hps .. " (" .. formated_heal .. ", " .. porcentagem .. "%)") --seta o texto da direita
end
@@ -658,7 +660,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local formated_overheal = SelectedToKFunction (_, self.totalover)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_overheal, "", porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_overheal, "", porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_overheal .." (" .. porcentagem .. "%)") --seta o texto da direita --_cstr("%.1f", dps) .. " - ".. DPS do damage taken não será possivel correto?
end
@@ -669,7 +671,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local formated_healtaken = SelectedToKFunction (_, self.healing_taken)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_healtaken, "", porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_healtaken, "", porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_healtaken .. " (" .. porcentagem .. "%)") --seta o texto da direita --_cstr("%.1f", dps) .. " - ".. DPS do damage taken não será possivel correto?
end
@@ -680,7 +682,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local formated_enemyheal = SelectedToKFunction (_, self.heal_enemy_amt)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_enemyheal, "", porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_enemyheal, "", porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_enemyheal .. " (" .. porcentagem .. "%)") --seta o texto da direita --_cstr("%.1f", dps) .. " - ".. DPS do damage taken não será possivel correto?
end
@@ -691,7 +693,7 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l
local formated_absorbs = SelectedToKFunction (_, self.totalabsorb)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (formated_absorbs, "", porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, formated_absorbs, "", porcentagem, self))
else
esta_barra.texto_direita:SetText (formated_absorbs .. " (" .. porcentagem .. "%)") --seta o texto da direita --_cstr("%.1f", dps) .. " - ".. DPS do damage taken não será possivel correto?
end
@@ -852,7 +854,7 @@ function atributo_heal:RefreshBarra (esta_barra, instancia, from_resize)
if (self.enemy) then
if (self.arena_enemy) then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName)
end
@@ -860,13 +862,13 @@ function atributo_heal:RefreshBarra (esta_barra, instancia, from_resize)
else
if (_detalhes.faction_against == "Horde") then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA
end
else
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY
end
@@ -879,13 +881,13 @@ function atributo_heal:RefreshBarra (esta_barra, instancia, from_resize)
else
if (self.arena_ally) then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName)
end
else
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, ""))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, ""))
else
esta_barra.texto_esquerdo:SetText (bar_number .. self.displayName) --seta o texto da esqueda
end
+8 -6
View File
@@ -26,6 +26,8 @@ local _UnitAura = UnitAura
local _UnitGUID = UnitGUID
local _UnitName = UnitName
local _string_replace = _detalhes.string.replace --details api
local _detalhes = _G._detalhes
local AceLocale = LibStub ("AceLocale-3.0")
local Loc = AceLocale:GetLocale ( "Details" )
@@ -751,7 +753,7 @@ function atributo_misc:AtualizaBarra (instancia, barras_container, qual_barra, l
local esta_porcentagem = _math_floor ((meu_total/instancia.top) * 100)
if (UsingCustomRightText) then
esta_barra.texto_direita:SetText (instancia.row_info.textR_custom_text:ReplaceData (meu_total, "", porcentagem, self))
esta_barra.texto_direita:SetText (_string_replace (instancia.row_info.textR_custom_text, meu_total, "", porcentagem, self))
else
esta_barra.texto_direita:SetText (meu_total .." (" .. porcentagem .. "%)") --seta o texto da direita
end
@@ -895,7 +897,7 @@ function atributo_misc:RefreshBarra (esta_barra, instancia, from_resize)
if (self.enemy) then
if (self.arena_enemy) then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName)
end
@@ -903,13 +905,13 @@ function atributo_misc:RefreshBarra (esta_barra, instancia, from_resize)
else
if (_detalhes.faction_against == "Horde") then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA
end
else
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY
end
@@ -922,13 +924,13 @@ function atributo_misc:RefreshBarra (esta_barra, instancia, from_resize)
else
if (self.arena_ally) then
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t"))
else
esta_barra.texto_esquerdo:SetText (bar_number .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName)
end
else
if (UsingCustomLeftText) then
esta_barra.texto_esquerdo:SetText (instancia.row_info.textL_custom_text:ReplaceData (esta_barra.colocacao, self.displayName, ""))
esta_barra.texto_esquerdo:SetText (_string_replace (instancia.row_info.textL_custom_text, esta_barra.colocacao, self.displayName, ""))
else
esta_barra.texto_esquerdo:SetText (bar_number .. self.displayName) --seta o texto da esqueda
end
+13 -8
View File
@@ -28,6 +28,7 @@
local _select = select
local _tonumber = tonumber
local _strsplit = strsplit
local _pcall = pcall
local _UnitClass = UnitClass --wow api local
local _IsInRaid = IsInRaid --wow api local
@@ -151,22 +152,26 @@
_detalhes.ToKFunctions = {_detalhes.NoToK, _detalhes.ToK, _detalhes.ToK2, _detalhes.ToK0, _detalhes.ToKMin, _detalhes.ToK2Min, _detalhes.ToK0Min, _detalhes.comma_value}
_detalhes.string = {}
--> replacing data
local args
local replace_arg = function (i)
return args [tonumber(i)]
end
local run_function = function (str)
local r = loadstring (str)(args[4])
return r or 0
end
function string:ReplaceData (...)
args = {...}
return (self:gsub ("{data(%d+)}", replace_arg):gsub ("{func(.-)}", run_function))
local okey, value = _pcall (loadstring (str), args[4])
if (not okey) then
_detalhes:Msg ("|cFFFF9900error on custom text function|r:", value)
return 0
end
return value or 0
end
--local usertext = "i got the time: {data2}, {data3}% of {data1} minutes"
--local expanded = usertext:expand(50000, 1000, 20)
function _detalhes.string.replace (str, ...)
args = {...}
return (str:gsub ("{data(%d+)}", replace_arg):gsub ("{func(.-)}", run_function))
end
--> remove a index from a hash table
function _detalhes:tableRemove (tabela, indexName)
+2 -2
View File
@@ -1747,8 +1747,8 @@
local function errorhandler(err)
return geterrorhandler()(err)
end
local code = [[local str = "STR"; str = str:ReplaceData (100, 50, 75, {nome = "you", total = 10, total_without_pet = 5, damage_taken = 7, last_dps = 1, friendlyfire_total = 6, totalover = 2, totalabsorb = 4, totalover_without_pet = 6, healing_taken = 1, heal_enemy_amt = 2});]]
local code = [[local str = "STR"; str = _detalhes.string.replace (str, 100, 50, 75, {nome = "you", total = 10, total_without_pet = 5, damage_taken = 7, last_dps = 1, friendlyfire_total = 6, totalover = 2, totalabsorb = 4, totalover_without_pet = 6, healing_taken = 1, heal_enemy_amt = 2});]]
code = code:gsub ("STR", test)
local f = loadstring (code)
+5 -2
View File
@@ -98,7 +98,7 @@ local _
["text_size"] = 10,
["anchor"] = {
5, -- [1]
4, -- [2]
3, -- [2]
},
["text_color"] = {
0.823529411764706, -- [1]
@@ -273,6 +273,8 @@ local _
menu_anchor = {16, 1, side = 2},
menu_anchor_down = {16, -2},
["menu_icons"] = {true, true, true, true, true, true, ["shadow"] = true, ["space"] = -3},
plugins_grow_direction = 1,
show_sidebars = false,
@@ -282,9 +284,10 @@ local _
row_info = {
texture = "BantoBar", --"Details Serenity"
font_face = "Arial Narrow",
font_face = "Accidental Presidency",
texture_background_class_color = false,
texture_background = "Details Serenity",
font_size = 11,
fixed_texture_background_color = {0, 0, 0, 0.3186},
icon_file = [[Interface\AddOns\Details\images\classes_small_alpha]],
start_after_icon = false,
+6 -1
View File
@@ -17,6 +17,7 @@
--> local pointers
local ipairs = ipairs
local _math_floor = math.floor
local _pcall = pcall
local time = time
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -205,7 +206,11 @@
local exec_user_func = function (func, attributes, data, this_second)
local result = func()
local okey, result = _pcall (func)
if (not okey) then
_detalhes:Msg ("|cFFFF9900error on chart script function|r:", result)
result = 0
end
local current = result - attributes.last_value
data [this_second] = current
+12 -1
View File
@@ -4502,10 +4502,21 @@ local build_mode_list = function (self, elapsed)
--CoolTip:AddMenu (2, _detalhes.OpenOptionsWindow, true, 1, nil, "Cant Create Window", _, true)
--CoolTip:AddIcon ([[Interface\Buttons\UI-PlusButton-Up]], 2, 1, 16, 16)
local HaveClosedInstances = false
for index = 1, math.min (#_detalhes.tabela_instancias, _detalhes.instances_amount), 1 do
local _this_instance = _detalhes.tabela_instancias [index]
if (not _this_instance.ativa) then
HaveClosedInstances = true
break
end
end
if (_detalhes:GetNumInstancesAmount() < _detalhes:GetMaxInstancesAmount()) then
CoolTip:AddMenu (2, OnClickNovoMenu, true, instancia, nil, "Create Window", _, true)
CoolTip:AddIcon ([[Interface\Buttons\UI-AttributeButton-Encourage-Up]], 2, 1, 16, 16)
GameCooltip:AddLine ("$div", nil, 2, nil, -5, -11)
if (HaveClosedInstances) then
GameCooltip:AddLine ("$div", nil, 2, nil, -5, -11)
end
end
local ClosedInstances = 0
Binary file not shown.
Binary file not shown.