Small bug fixes and improvements

This commit is contained in:
Tercio Jose
2022-10-10 13:26:13 -03:00
parent b588d5e30c
commit 1ed29008aa
119 changed files with 6556 additions and 6650 deletions
+67 -67
View File
@@ -2,7 +2,7 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local _detalhes = _G._detalhes
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" )
local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
local DEFAULT_CHILD_WIDTH = 60
@@ -16,7 +16,7 @@
--local pointers
local _math_floor = math.floor --api local
local _ipairs = ipairs --api local
local ipairs = ipairs --api local
local UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned
@@ -47,13 +47,13 @@
function _detalhes.StatusBar:LockDisplays (instance, locked)
if (instance.StatusBar.center and instance.StatusBar.left and instance.StatusBar.right) then
if (locked) then
instance.StatusBar.center.frame:EnableMouse (false)
instance.StatusBar.left.frame:EnableMouse (false)
instance.StatusBar.right.frame:EnableMouse (false)
instance.StatusBar.center.frame:EnableMouse(false)
instance.StatusBar.left.frame:EnableMouse(false)
instance.StatusBar.right.frame:EnableMouse(false)
else
instance.StatusBar.center.frame:EnableMouse (true)
instance.StatusBar.left.frame:EnableMouse (true)
instance.StatusBar.right.frame:EnableMouse (true)
instance.StatusBar.center.frame:EnableMouse(true)
instance.StatusBar.left.frame:EnableMouse(true)
instance.StatusBar.right.frame:EnableMouse(true)
end
end
end
@@ -176,7 +176,7 @@
--disable all plugin childs attached to an specified instance and reactive the childs taking the instance statusbar anchors
function _detalhes.StatusBar:ReloadAnchors (instance)
for _, child in _ipairs(instance.StatusBar) do
for _, child in ipairs(instance.StatusBar) do
child.frame:ClearAllPoints()
child.frame:Hide()
child.anchor = nil
@@ -211,7 +211,7 @@
local byuser = false
if (type(index) == "table") then
index, current_child, anchor = unpack (index)
index, current_child, anchor = unpack(index)
byuser = true
end
@@ -242,7 +242,7 @@
local chosenChild = nil
--procura pra ver se ja tem uma criada
for _, child_created in _ipairs(instance.StatusBar) do
for _, child_created in ipairs(instance.StatusBar) do
if (child_created.mainPlugin == pluginMestre) then
chosenChild = child_created
break
@@ -256,13 +256,13 @@
instance.StatusBar [anchor] = chosenChild
--copia os atributos do current para o chosen
local options_current = Details.CopyTable (current_child.options)
local options_current = Details.CopyTable(current_child.options)
if (chosenChild.anchor) then
--o widget escolhido ja estava sendo mostrado...
-- copia os atributos do chosen para o current
current_child.options = Details.CopyTable (chosenChild.options)
current_child.options = Details.CopyTable(chosenChild.options)
instance.StatusBar [chosenChild.anchor] = current_child
end
@@ -337,7 +337,7 @@
if (mouse == "LeftButton") then
if (not frame.child.Setup) then
print (Loc ["STRING_STATUSBAR_NOOPTIONS"])
print(Loc ["STRING_STATUSBAR_NOOPTIONS"])
return
end
frame.child:Setup()
@@ -349,7 +349,7 @@
local current
for index, _name_and_icon in _ipairs(_detalhes.StatusBar.Menu) do
for index, _name_and_icon in ipairs(_detalhes.StatusBar.Menu) do
GameCooltip:AddMenu (1, ChoosePlugin, {index, frame.child, frame.child.anchor}, nil, nil, _name_and_icon [1], _name_and_icon [2], true)
local pluginMestre = _detalhes.StatusBar.Plugins [index]
@@ -435,13 +435,13 @@
ChoosePlugin (nil, nil, right_index, instance.StatusBar.right, "right")
if (instance.StatusBarSaved.options and instance.StatusBarSaved.options [left]) then
instance.StatusBar.left.options = Details.CopyTable (instance.StatusBarSaved.options [left])
instance.StatusBar.left.options = Details.CopyTable(instance.StatusBarSaved.options [left])
end
if (instance.StatusBarSaved.options and instance.StatusBarSaved.options [center]) then
instance.StatusBar.center.options = Details.CopyTable (instance.StatusBarSaved.options [center])
instance.StatusBar.center.options = Details.CopyTable(instance.StatusBarSaved.options [center])
end
if (instance.StatusBarSaved.options and instance.StatusBarSaved.options [right]) then
instance.StatusBar.right.options = Details.CopyTable (instance.StatusBarSaved.options [right])
instance.StatusBar.right.options = Details.CopyTable(instance.StatusBarSaved.options [right])
end
_detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textcolor")
@@ -469,9 +469,9 @@
--build-in function for create a frame for an plugin child
function _detalhes.StatusBar:CreateChildFrame (instance, name, w, h)
--local frame = _detalhes.gump:NewPanel (instance.baseframe.cabecalho.fechar, nil, name..instance:GetInstanceId(), nil, w or DEFAULT_CHILD_WIDTH, h or DEFAULT_CHILD_HEIGHT, false)
local frame = _detalhes.gump:NewPanel (instance.baseframe, nil, name..instance:GetInstanceId(), nil, w or DEFAULT_CHILD_WIDTH, h or DEFAULT_CHILD_HEIGHT, false)
frame:SetFrameLevel (instance.baseframe:GetFrameLevel()+4)
--local frame = _detalhes.gump:NewPanel(instance.baseframe.cabecalho.fechar, nil, name..instance:GetInstanceId(), nil, w or DEFAULT_CHILD_WIDTH, h or DEFAULT_CHILD_HEIGHT, false)
local frame = _detalhes.gump:NewPanel(instance.baseframe, nil, name..instance:GetInstanceId(), nil, w or DEFAULT_CHILD_WIDTH, h or DEFAULT_CHILD_HEIGHT, false)
frame:SetFrameLevel(instance.baseframe:GetFrameLevel()+4)
--create widgets
local text = _detalhes.gump:NewLabel(frame, nil, "$parentText", "text", "0")
@@ -491,7 +491,7 @@
local _table = {}
--treat as a class
setmetatable (_table, mainObject)
setmetatable(_table, mainObject)
--default members
_table.instance = instance
@@ -504,7 +504,7 @@
if (not _table.options) then
_table.options = {
textStyle = 2,
textColor = {unpack (DEFAULT_CHILD_FONTCOLOR)},
textColor = {unpack(DEFAULT_CHILD_FONTCOLOR)},
textSize = DEFAULT_CHILD_FONTSIZE,
textAlign = 0,
textXMod = 0,
@@ -598,7 +598,7 @@
end
end
else
if (child [option] and type (child [option]) == "function") then
if (child [option] and type(child [option]) == "function") then
child [option] (nil, child, value)
end
end
@@ -615,7 +615,7 @@ do
-- handle event "COMBAT_PLAYER_ENTER"
function PDps:PlayerEnterCombat()
for index, child in _ipairs(PDps.childs) do
for index, child in ipairs(PDps.childs) do
if (child.enabled and child.instance:GetSegment() == 0) then
child.tick = _detalhes:ScheduleRepeatingTimer ("PluginDpsUpdate", 1, child)
end
@@ -624,9 +624,9 @@ do
-- handle event "COMBAT_PLAYER_LEAVE"
function PDps:PlayerLeaveCombat()
for index, child in _ipairs(PDps.childs) do
for index, child in ipairs(PDps.childs) do
if (child.tick) then
_detalhes:CancelTimer (child.tick)
_detalhes:CancelTimer(child.tick)
child.tick = nil
end
end
@@ -634,7 +634,7 @@ do
-- handle event "DETAILS_INSTANCE_CHANGESEGMENT"
function PDps:ChangeSegment (instance, segment)
for index, child in _ipairs(PDps.childs) do
for index, child in ipairs(PDps.childs) do
if (child.enabled and child.instance == instance) then
_detalhes:PluginDpsUpdate (child)
end
@@ -643,7 +643,7 @@ do
--handle event "DETAILS_DATA_RESET"
function PDps:DataReset()
for index, child in _ipairs(PDps.childs) do
for index, child in ipairs(PDps.childs) do
if (child.enabled) then
child.text:SetText("0")
end
@@ -701,7 +701,7 @@ do
-- _detalhes:InstallPlugin ( Plugin Type | Plugin Display Name | Plugin Icon | Plugin Object | Plugin Real Name )
local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_PDPSNAME"], "Interface\\Icons\\Achievement_brewery_3", PDps, "DETAILS_STATUSBAR_PLUGIN_PDPS")
if (type(install) == "table" and install.error) then
print (install.errortext)
print(install.errortext)
return
end
@@ -741,7 +741,7 @@ do
function PSegment:Change()
for index, child in _ipairs(PSegment.childs) do
for index, child in ipairs(PSegment.childs) do
if (child.enabled and child.instance:IsEnabled()) then
@@ -759,7 +759,7 @@ do
if (child.options.segmentType == 1) then
child.text:SetText(Loc ["STRING_CURRENT"])
else
local name = _detalhes.tabela_vigente:GetCombatName (true)
local name = _detalhes.tabela_vigente:GetCombatName(true)
if (name and name ~= Loc ["STRING_UNKNOW"]) then
if (child.options.segmentType == 2) then
@@ -770,7 +770,7 @@ do
else
child.text:SetText(Loc ["STRING_CURRENT"])
if (_detalhes.in_combat and PSegment.can_schedule <= 2) then
PSegment:ScheduleTimer ("SchduleGetName", 2)
PSegment:ScheduleTimer("SchduleGetName", 2)
PSegment.can_schedule = PSegment.can_schedule + 1
return
end
@@ -783,7 +783,7 @@ do
child.text:SetText(Loc ["STRING_FIGHTNUMBER"] .. child.instance.segmento)
else
local name = child.instance.showing:GetCombatName (true)
local name = child.instance.showing:GetCombatName(true)
if (name ~= Loc ["STRING_UNKNOW"]) then
if (child.options.segmentType == 2) then
child.text:SetText(name)
@@ -855,7 +855,7 @@ do
--Install
local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_PSEGMENTNAME"], "Interface\\Icons\\inv_misc_enchantedscroll", PSegment, "DETAILS_STATUSBAR_PLUGIN_PSEGMENT")
if (type(install) == "table" and install.error) then
print (install.errortext)
print(install.errortext)
return
end
@@ -881,7 +881,7 @@ do
instance, attribute, subAttribute = self.instance, self.instance.atributo, self.instance.sub_atributo
end
for index, child in _ipairs(PAttribute.childs) do
for index, child in ipairs(PAttribute.childs) do
if (child.instance == instance and child.enabled and child.instance:IsEnabled()) then
local sName = child.instance:GetInstanceAttributeText()
child.text:SetText(sName)
@@ -903,7 +903,7 @@ do
--Install
local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_PATTRIBUTENAME"], "Interface\\Icons\\inv_misc_emberclothbolt", PAttribute, "DETAILS_STATUSBAR_PLUGIN_PATTRIBUTE")
if (type(install) == "table" and install.error) then
print (install.errortext)
print(install.errortext)
return
end
@@ -929,7 +929,7 @@ do
end
--leave combat
function Clock:PlayerLeaveCombat()
_detalhes:CancelTimer (Clock.tick)
_detalhes:CancelTimer(Clock.tick)
end
function _detalhes:ClockPluginTickOnSegment()
@@ -939,7 +939,7 @@ do
--1 sec tick
function _detalhes:ClockPluginTick (force)
for index, child in _ipairs(Clock.childs) do
for index, child in ipairs(Clock.childs) do
local instance = child.instance
if (child.enabled and instance:IsEnabled()) then
if (instance.showing and ( (instance.segmento ~= -1) or (instance.segmento == -1 and not _detalhes.in_combat) or force) ) then
@@ -966,7 +966,7 @@ do
getSegment = getSegment+1
end
local lastFight = _detalhes:GetCombat (getSegment)
local lastFight = _detalhes:GetCombat(getSegment)
local currentCombatTime = instance.showing:GetCombatTime()
if (lastFight) then
@@ -983,7 +983,7 @@ do
--on reset
function Clock:DataReset()
for index, child in _ipairs(Clock.childs) do
for index, child in ipairs(Clock.childs) do
if (child.enabled and child.instance:IsEnabled()) then
child.text:SetText("0m 0s")
end
@@ -1061,7 +1061,7 @@ do
--Install
local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_CLOCKNAME"], "Interface\\Icons\\Achievement_BG_grab_cap_flagunderXseconds", Clock, "DETAILS_STATUSBAR_PLUGIN_CLOCK")
if (type(install) == "table" and install.error) then
print (install.errortext)
print(install.errortext)
return
end
@@ -1080,7 +1080,7 @@ do
local _UnitDetailedThreatSituation = UnitDetailedThreatSituation --wow api
local _cstr = string.format --lua api
local _math_abs = math.abs --lua api
local abs = math.abs --lua api
--Create the plugin Object
local Threat = _detalhes:NewPluginObject ("Details_TargetThreat", DETAILSPLUGIN_ALWAYSENABLED, "STATUSBAR")
@@ -1092,7 +1092,7 @@ do
Threat.isTank = nil
function Threat:PlayerEnterCombat()
local role = UnitGroupRolesAssigned ("player")
local role = UnitGroupRolesAssigned("player")
if (role == "TANK") then
Threat.isTank = true
else
@@ -1102,11 +1102,11 @@ do
end
function Threat:PlayerLeaveCombat()
_detalhes:CancelTimer (Threat.tick)
_detalhes:CancelTimer(Threat.tick)
end
function _detalhes:ThreatPluginTick()
for index, child in _ipairs(Threat.childs) do
for index, child in ipairs(Threat.childs) do
local instance = child.instance
if (child.enabled and instance:IsEnabled()) then
-- atualiza a threat
@@ -1115,9 +1115,9 @@ do
if (threatpct) then
child.text:SetText(_math_floor(threatpct).."%")
if (Threat.isTank) then
child.text:SetTextColor (_math_abs (threatpct-100)*0.01, threatpct*0.01, 0, 1)
child.text:SetTextColor (abs(threatpct-100)*0.01, threatpct*0.01, 0, 1)
else
child.text:SetTextColor (threatpct*0.01, _math_abs (threatpct-100)*0.01, 0, 1)
child.text:SetTextColor (threatpct*0.01, abs(threatpct-100)*0.01, 0, 1)
end
else
child.text:SetText("0%")
@@ -1149,7 +1149,7 @@ do
--Install
local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_THREATNAME"], "Interface\\Icons\\Ability_Hunter_ResistanceIsFutile", Threat, "DETAILS_STATUSBAR_PLUGIN_THREAT")
if (type(install) == "table" and install.error) then
print (install.errortext)
print(install.errortext)
return
end
@@ -1175,7 +1175,7 @@ do
end
function PFps:OnDisable()
self:CancelTimer (self.srt, true)
self:CancelTimer(self.srt, true)
end
function PFps:OnEnable()
@@ -1192,7 +1192,7 @@ do
--Install
local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_FPS"], "Interface\\Icons\\Spell_Shadow_MindTwisting", PFps, "DETAILS_STATUSBAR_PLUGIN_PFPS")
if (type(install) == "table" and install.error) then
print (install.errortext)
print(install.errortext)
return
end
@@ -1214,7 +1214,7 @@ do
end
function PLatency:OnDisable()
self:CancelTimer (self.srt, true)
self:CancelTimer(self.srt, true)
end
function PLatency:OnEnable()
@@ -1231,7 +1231,7 @@ do
--Install
local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_LATENCY"], "Interface\\FriendsFrame\\PlusManz-BattleNet", PLatency, "DETAILS_STATUSBAR_PLUGIN_PLATENCY")
if (type(install) == "table" and install.error) then
print (install.errortext)
print(install.errortext)
return
end
@@ -1263,7 +1263,7 @@ do
if (items == 0) then
self.text:SetText(Loc ["STRING_UPTADING"])
return self:ScheduleTimer ("UpdateDurability", 5, self)
return self:ScheduleTimer("UpdateDurability", 5, self)
end
percent = percent / items
@@ -1311,7 +1311,7 @@ do
--Install
local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_DURABILITY"], "Interface\\ICONS\\INV_Chest_Chain_10", PDurability, "DETAILS_STATUSBAR_PLUGIN_PDURABILITY")
if (type(install) == "table" and install.error) then
print (install.errortext)
print(install.errortext)
return
end
@@ -1329,7 +1329,7 @@ do
end
function PGold:GoldPluginTick()
for index, child in _ipairs(PGold.childs) do
for index, child in ipairs(PGold.childs) do
local instance = child.instance
if (child.enabled and instance:IsEnabled()) then
child:UpdateGold()
@@ -1360,7 +1360,7 @@ do
myframe.widget:RegisterEvent ("PLAYER_ENTERING_WORLD")
myframe.widget:SetScript("OnEvent", function(event)
if (event == "PLAYER_ENTERING_WORLD") then
return PGold:ScheduleTimer ("GoldPluginTick", 10)
return PGold:ScheduleTimer("GoldPluginTick", 10)
end
PGold:GoldPluginTick()
end)
@@ -1371,7 +1371,7 @@ do
--Install
local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_GOLD"], "Interface\\Icons\\INV_Ore_Gold_01", PGold, "DETAILS_STATUSBAR_PLUGIN_PGold")
if (type(install) == "table" and install.error) then
print (install.errortext)
print(install.errortext)
return
end
@@ -1398,7 +1398,7 @@ do
end
function PTime:OnDisable()
self:CancelTimer (self.srt, true)
self:CancelTimer(self.srt, true)
end
function PTime:OnEnable()
@@ -1456,7 +1456,7 @@ do
--Install
local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_TIME"], "Interface\\Icons\\Spell_Shadow_LastingAfflictions", PTime, "DETAILS_STATUSBAR_PLUGIN_PTIME")
if (type(install) == "table" and install.error) then
print (install.errortext)
print(install.errortext)
return
end
@@ -1464,7 +1464,7 @@ end
---------default options panel ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local window = _detalhes.gump:NewPanel (UIParent, nil, "DetailsStatusBarOptions", nil, 300, 180)
local window = _detalhes.gump:NewPanel(UIParent, nil, "DetailsStatusBarOptions", nil, 300, 180)
tinsert(UISpecialFrames, "DetailsStatusBarOptions")
window:SetPoint("center", UIParent, "center")
window.locked = false
@@ -1477,7 +1477,7 @@ DetailsFramework:ApplyStandardBackdrop(window)
--window:SetBackdrop({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, edgeFile = [[Interface\AddOns\Details\images\border_2]], edgeSize=12})
--window:SetBackdropColor(0, 0, 0, 0.9)
local extraWindow = _detalhes.gump:NewPanel (window, nil, "DetailsStatusBarOptions2", "extra", 300, 180)
local extraWindow = _detalhes.gump:NewPanel(window, nil, "DetailsStatusBarOptions2", "extra", 300, 180)
extraWindow:SetPoint("left", window, "right")
extraWindow.close_with_right = true
extraWindow.locked = false
@@ -1498,13 +1498,13 @@ end)
window.instance.StatusBar.center.options.textStyle = style
window.instance.StatusBar.right.options.textStyle = style
if (window.instance.StatusBar.left.Refresh and type (window.instance.StatusBar.left.Refresh) == "function") then
if (window.instance.StatusBar.left.Refresh and type(window.instance.StatusBar.left.Refresh) == "function") then
window.instance.StatusBar.left:Refresh (window.instance.StatusBar.left)
end
if (window.instance.StatusBar.center.Refresh and type (window.instance.StatusBar.center.Refresh) == "function") then
if (window.instance.StatusBar.center.Refresh and type(window.instance.StatusBar.center.Refresh) == "function") then
window.instance.StatusBar.center:Refresh (window.instance.StatusBar.center)
end
if (window.instance.StatusBar.right.Refresh and type (window.instance.StatusBar.right.Refresh) == "function") then
if (window.instance.StatusBar.right.Refresh and type(window.instance.StatusBar.right.Refresh) == "function") then
window.instance.StatusBar.right:Refresh (window.instance.StatusBar.right)
end
@@ -1530,7 +1530,7 @@ end)
_detalhes.StatusBar:ApplyOptions (window.instance.StatusBar.right, "textcolor", color)
end
local canceledColor = function()
local r, g, b, a = unpack (ColorPickerFrame.previousValues)
local r, g, b, a = unpack(ColorPickerFrame.previousValues)
window.textcolortexture:SetTexture(r, g, b, a)
local color = {r, g, b, a}
_detalhes.StatusBar:ApplyOptions (window.instance.StatusBar.left, "textcolor", color)
@@ -1544,7 +1544,7 @@ end)
ColorPickerFrame.hasOpacity = false
ColorPickerFrame.previousValues = window.child.options.textColor
ColorPickerFrame:SetParent(window.widget)
ColorPickerFrame:SetColorRGB (unpack (window.child.options.textColor))
ColorPickerFrame:SetColorRGB (unpack(window.child.options.textColor))
ColorPickerFrame:Show()
end