From 9351523612f85006c5f73913ddf7eae40c4f6967 Mon Sep 17 00:00:00 2001 From: Tercio Date: Sat, 17 Aug 2013 22:12:12 -0300 Subject: [PATCH] - New API: _detalhes:Msg (text) print a text to chat. - Fixed a issue with default wallpaper which isn't on Fill align. - Mode selection now are in a new order. - Added a instruction to click to report a death. - Added a 2 second delay before all raid equilize. - Capture dont try any more to get from cloud if the capture is actived. - Fixed a issue with statusbar color selection were it was changing instance color. - Added GameCooltip:SetTitle (1 or 2, text) --- boot.lua | 6 ++ classes/classe_instancia.lua | 17 +++++- classes/classe_others.lua | 11 ++-- core/control.lua | 10 +++- core/network.lua | 59 ++++++++++++++----- core/parser.lua | 2 + core/plugins_statusbar.lua | 15 +++-- framework/cooltip.lua | 77 ++++++++++++++++++++----- framework/cooltip.xml | 9 +-- framework/pictureedit.lua | 6 +- framework/slider.lua | 4 ++ gumps/janela_options.lua | 67 +++++++++++++++++----- gumps/janela_principal.lua | 105 +++++++++++++++++++++++++++------- images/atributos_captures.tga | Bin 0 -> 20256 bytes locales/Details-enUS.lua | 14 +++-- locales/Details-ptBR.lua | 16 ++++-- startup.lua | 7 ++- 17 files changed, 328 insertions(+), 97 deletions(-) create mode 100644 images/atributos_captures.tga diff --git a/boot.lua b/boot.lua index 0a6d690b..24f2d444 100644 --- a/boot.lua +++ b/boot.lua @@ -6,6 +6,7 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> global name declaration _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0") + _detalhes.userversion = "v1.1.3" _detalhes.version = "Alpha 002" _detalhes.realversion = 2 @@ -205,4 +206,9 @@ do _detalhes.delaymsgs = {} end + --> print messages + function _detalhes:Msg (_string) + print (Loc ["STRING_DETAILS1"] .. _string) + end + end diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua index 3c065640..3c0c0d8c 100644 --- a/classes/classe_instancia.lua +++ b/classes/classe_instancia.lua @@ -702,7 +702,7 @@ end nova_instancia.wallpaper = { enabled = false, texture = nil, - anchor = "bottomright", + anchor = "all", alpha = 0.5, texcoord = {0, 1, 0, 1}, width = 0, @@ -800,7 +800,7 @@ function _detalhes:RestauraJanela (index, temp) self.wallpaper = self.wallpaper or { enabled = false, texture = nil, - anchor = "bottomright", + anchor = "all", alpha = 0.5, texcoord = {0, 1, 0, 1}, width = 0, @@ -1454,7 +1454,18 @@ function _detalhes:AlteraModo (instancia, qual) _detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEMODE", nil, instancia, modo_all) end - _detalhes.popup:Select (1, qual) + local checked + if (instancia.modo == 1) then + checked = 3 + elseif (instancia.modo == 2) then + checked = 1 + elseif (instancia.modo == 3) then + checked = 2 + elseif (instancia.modo == 4) then + checked = 4 + end + + _detalhes.popup:Select (1, checked) end diff --git a/classes/classe_others.lua b/classes/classe_others.lua index 21d2f583..ac945b92 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -155,6 +155,10 @@ function _detalhes:ToolTipDead (instancia, morte, esta_barra) end end + GameCooltip:AddLine (" ", " ", 1, "white", "white") + GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], "--", 1, "white", "white") + GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625) + if (battleress) then --_table_insert (linhas, 2, {{"Interface\\AddOns\\Details\\images\\small_icons", .75, 1, 0, 1}, morte [6] .. " Morreu", "-- -- -- ", 100, {75/255, 75/255, 75/255, 1}, {noglow = true}}) --> localize-me GameCooltip:AddSpecial ("line", 2, nil, morte [6] .. " Morreu", "-- -- -- ", 1, "white") @@ -166,7 +170,7 @@ function _detalhes:ToolTipDead (instancia, morte, esta_barra) GameCooltip:AddSpecial ("statusbar", 1, nil, 100, 1, "darkgray", false) --_table_insert (linhas, 1, {{, .75, 1, 0, 1}, , 100, {75/255, 75/255, 75/255, 1}, {noglow = true}}) --> localize-me end - + GameCooltip:SetOption ("StatusBarHeightMod", -6) GameCooltip:SetOption ("FixedWidth", 300) GameCooltip:SetOption ("TextSize", 9.5) @@ -185,9 +189,8 @@ function atributo_misc:ReportSingleDeadLine (morte, instancia) local barra = instancia.barras [morte.minha_barra] local reportar = {"Detalhes da morte de " .. morte [3] .. " " .. barra.texto_esquerdo:GetText()} --> localize-me - for i = 1, _detalhes.popup.NumLines, 1 do - local texto_left = _detalhes.popup.frame1.linhas[i].left_text:GetText() - local texto_right = _detalhes.popup.frame1.linhas[i].right_text:GetText() + for i = 1, GameCooltip:GetNumLines() do + local texto_left, texto_right = GameCooltip:GetText (i) if (texto_left and texto_right) then texto_left = texto_left:gsub (("|T(.*)|t "), "") diff --git a/core/control.lua b/core/control.lua index 72307e3a..a51a28eb 100644 --- a/core/control.lua +++ b/core/control.lua @@ -232,7 +232,7 @@ end _detalhes.tabela_vigente.enemy = inimigo if (_detalhes.debug) then - _detalhes:EqualizeActors() + _detalhes:EqualizeActorsSchedule() end else @@ -252,10 +252,10 @@ end end - _detalhes:EqualizeActors() + _detalhes:EqualizeActorsSchedule() else if (_detalhes.debug) then - _detalhes:EqualizeActors() + _detalhes:EqualizeActorsSchedule() end end end @@ -413,6 +413,10 @@ end end + function _detalhes:EqualizeActorsSchedule() + _detalhes:ScheduleTimer ("EqualizeActors", 2) + end + function _detalhes:EqualizeActors() local damage, heal, energy, misc = _detalhes:GetAllActors ("current", UnitName ("player")) diff --git a/core/network.lua b/core/network.lua index f0953671..3db76b77 100644 --- a/core/network.lua +++ b/core/network.lua @@ -12,26 +12,45 @@ --> local pointers ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---> api + + function _detalhes:CheckDetailsUsers() + + if (true) then --> disabled + return + end + + if (IsInRaid()) then + for i = 1, GetNumGroupMembers() do + if (_detalhes.details_users [ UnitName ("raid"..i)]) then + end + end + elseif (IsInGroup()) then + for i = 1, GetNumGroupMembers()-1 do + if (_detalhes.details_users [ UnitName ("party"..i)]) then + end + end + end + end local temp = {} function _detalhes:RaidComm (_, data, _, source) - local type = select (2, _detalhes:Deserialize (data)) + + local type, player, realm, dversion, arg6 = select (2, _detalhes:Deserialize (data)) if (_detalhes.debug) then print ("comm received", type) end if (type == "highfive") then - local player, realm, dversion = select (3, _detalhes:Deserialize (data)) - if (player ~= _detalhes.playername) then - _detalhes.details_users [#_detalhes.details_users+1] = {player, realm, dversion} + if (player ~= _detalhes.playername and not _detalhes.details_users [player]) then + _detalhes.details_users [player] = {player, realm, dversion} end elseif (type == "clouddatareceived") then - local atributo, atributo_name, data = select (3, _detalhes:Deserialize (data)) + --local atributo, atributo_name, data = select (3, _detalhes:Deserialize (data)) + local atributo, atributo_name, data = player, realm, dversion local container = _detalhes.tabela_vigente [atributo] @@ -76,8 +95,8 @@ --> delayed response return end - - local atributo, subatributo = select (3, _detalhes:Deserialize (data)) + + local atributo, subatributo = player, realm local data local atributo_name = _detalhes:GetInternalSubAttributeName (atributo, subatributo) @@ -118,7 +137,6 @@ return end - local player, realm, dversion = select (3, _detalhes:Deserialize (data)) if (realm ~= GetRealmName()) then player = player .."-"..realm end @@ -131,7 +149,7 @@ _detalhes.cloud_process = _detalhes:ScheduleRepeatingTimer ("RequestData", 7) elseif (type == "needcloud") then - local player, realm, dversion = select (3, _detalhes:Deserialize (data)) + if (_detalhes.debug) then print (player, _detalhes.host_of, _detalhes:CaptureIsAllEnabled(), dversion == _detalhes.realversion) end @@ -148,7 +166,7 @@ if (not _detalhes.in_combat) then - local player, realm, dversion, receivedActor = select (3, _detalhes:Deserialize (data)) + local receivedActor = arg6 if (dversion ~= _detalhes.realversion) then return @@ -166,6 +184,9 @@ end function _detalhes:SendHighFive() + if (true) then --> disabled + return + end _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("highfive", UnitName ("player"), GetRealmName(), _detalhes.realversion), "RAID") end @@ -185,8 +206,20 @@ for index = 1, #_detalhes.tabela_instancias do local instancia = _detalhes.tabela_instancias [index] if (instancia.ativa) then - _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatarequest", instancia.atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by) - break + local atributo = instancia.atributo + if (atributo == 1 and not _detalhes:CaptureGet ("damage")) then + _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatarequest", atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by) + break + elseif (atributo == 2 and (not _detalhes:CaptureGet ("heal") or _detalhes:CaptureGet ("aura"))) then + _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatarequest", atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by) + break + elseif (atributo == 3 and not _detalhes:CaptureGet ("energy")) then + _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatarequest", atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by) + break + elseif (atributo == 4 and not _detalhes:CaptureGet ("miscdata")) then + _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatarequest", atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by) + break + end end end end \ No newline at end of file diff --git a/core/parser.lua b/core/parser.lua index 959da0b6..5a42a98e 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -1884,6 +1884,8 @@ _detalhes.in_group = IsInGroup() or IsInRaid() if (not _detalhes.in_group) then table.wipe (_detalhes.details_users) + else + _detalhes:CheckDetailsUsers() end end diff --git a/core/plugins_statusbar.lua b/core/plugins_statusbar.lua index 93c27dc4..f09f7089 100644 --- a/core/plugins_statusbar.lua +++ b/core/plugins_statusbar.lua @@ -775,7 +775,7 @@ end ---------> default options panel ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -local window = _detalhes.gump:NewPanel (UIParent, nil, "DetailsStatusBarOptions", nil, 300, 160) +local window = _detalhes.gump:NewPanel (UIParent, nil, "DetailsStatusBarOptions", nil, 300, 180) tinsert (UISpecialFrames, "DetailsStatusBarOptions") window:SetPoint ("center", UIParent, "center") window.locked = false @@ -783,7 +783,7 @@ window.close_with_right = true window.child = nil window.instance = nil -local extraWindow = _detalhes.gump:NewPanel (window, nil, "DetailsStatusBarOptions2", "extra", 300, 160) +local extraWindow = _detalhes.gump:NewPanel (window, nil, "DetailsStatusBarOptions2", "extra", 300, 180) extraWindow:SetPoint ("left", window, "right") extraWindow.close_with_right = true extraWindow.locked = false @@ -821,11 +821,12 @@ end) _detalhes.StatusBar:ApplyOptions (window.child, "textcolor", {r, g, b, a}) end local colorpick = function() - ColorPickerFrame:SetColorRGB (unpack (window.child.options.textColor)) - ColorPickerFrame.hasOpacity = false - ColorPickerFrame.previousValues = window.child.options.textColor ColorPickerFrame.func = selectedColor ColorPickerFrame.cancelFunc = canceledColor + ColorPickerFrame.hasOpacity = false + ColorPickerFrame.previousValues = window.child.options.textColor + ColorPickerFrame:SetParent (window.widget) + ColorPickerFrame:SetColorRGB (unpack (window.child.options.textColor)) ColorPickerFrame:Show() end @@ -917,6 +918,10 @@ end) _detalhes.StatusBar:ApplyOptions (child, "textymod", amount) end) +--> right click to close + local c = window:CreateRightClickLabel ("short") + c:SetPoint ("bottomleft", window, "bottomleft", 8, 5) + --> open options function _detalhes.StatusBar:OpenOptionsForChild (child) diff --git a/framework/cooltip.lua b/framework/cooltip.lua index 7cc83325..fd7508b7 100644 --- a/framework/cooltip.lua +++ b/framework/cooltip.lua @@ -155,20 +155,36 @@ function DetailsCreateCoolTip() --> Title Function ---------------------------------------------------------------------- + function CoolTip:SetTitle (_f, text) + if (_f == 1) then + CoolTip.title1 = true + CoolTip.title_text = text + end + end + function CoolTip:SetTitleAnchor (_f, _anchor, ...) _anchor = string.lower (_anchor) if (_f == 1) then self.frame1.titleIcon:ClearAllPoints() self.frame1.titleText:ClearAllPoints() + if (_anchor == "left") then self.frame1.titleIcon:SetPoint ("left", frame1, "left", ...) self.frame1.titleText:SetPoint ("left", frame1.titleIcon, "right") + elseif (_anchor == "center") then - self.frame1.titleIcon:SetPoint ("center", frame1, "center", ...) + self.frame1.titleIcon:SetPoint ("center", frame1, "center") + self.frame1.titleIcon:SetPoint ("bottom", frame1, "top") self.frame1.titleText:SetPoint ("left", frame1.titleIcon, "right") + self.frame1.titleText:SetText ("TESTE") + + self.frame1.titleText:Show() + self.frame1.titleIcon:Show() + elseif (_anchor == "right") then self.frame1.titleIcon:SetPoint ("right", frame1, "right", ...) self.frame1.titleText:SetPoint ("right", frame1.titleIcon, "left") + end elseif (_f == 2) then self.frame2.titleIcon:ClearAllPoints() @@ -318,7 +334,7 @@ function DetailsCreateCoolTip() local OnEnterUpdateButton = function (self, elapsed) elapsedTime = elapsedTime+elapsed - if (elapsedTime > 0.3) then + if (elapsedTime > 0.001) then --> search key: ~onenterupdatemain CoolTip:ShowSub (self.index) CoolTip.last_button = self.index @@ -390,7 +406,7 @@ function DetailsCreateCoolTip() elapsedTime = 0 frame1:SetScript ("OnUpdate", OnLeaveUpdateButton) - CoolTip:HideSub (i) + --CoolTip:HideSub (i) else CoolTip.active = false elapsedTime = 0 @@ -582,15 +598,26 @@ function DetailsCreateCoolTip() end --> string length - if (not CoolTip.OptionsTable.FixedWidth) then - if (CoolTip.Type == 1 or CoolTip.Type == 2) then - local stringWidth = menuButton.leftText:GetStringWidth() + menuButton.rightText:GetStringWidth() + menuButton.leftIcon:GetWidth() + menuButton.rightIcon:GetWidth() - if (stringWidth > frame.w) then - frame.w = stringWidth + if (not isSub) then --> main frame + if (not CoolTip.OptionsTable.FixedWidth) then + if (CoolTip.Type == 1 or CoolTip.Type == 2) then + local stringWidth = menuButton.leftText:GetStringWidth() + menuButton.rightText:GetStringWidth() + menuButton.leftIcon:GetWidth() + menuButton.rightIcon:GetWidth() + if (stringWidth > frame.w) then + frame.w = stringWidth + end end + else + menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidth - menuButton.leftIcon:GetWidth() - 20) end else - if (isSub and CoolTip.OptionsTable.FixedWidthSub) then + if (not CoolTip.OptionsTable.FixedWidthSub) then + if (CoolTip.Type == 1 or CoolTip.Type == 2) then + local stringWidth = menuButton.leftText:GetStringWidth() + menuButton.rightText:GetStringWidth() + menuButton.leftIcon:GetWidth() + menuButton.rightIcon:GetWidth() + if (stringWidth > frame.w) then + frame.w = stringWidth + end + end + else menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidthSub - menuButton.leftIcon:GetWidth() - 20) end end @@ -1008,6 +1035,14 @@ function DetailsCreateCoolTip() frame1:ClearAllPoints() CoolTip:SetMyPoint (host) + + if (CoolTip.title1) then + CoolTip.frame1.titleText:Show() + CoolTip.frame1.titleIcon:Show() + CoolTip.frame1.titleText:SetText (CoolTip.title_text) + CoolTip.frame1.titleIcon:SetWidth (frame1:GetWidth()) + CoolTip.frame1.titleIcon:SetHeight (40) + end gump:Fade (frame1, 0) @@ -1071,9 +1106,9 @@ function DetailsCreateCoolTip() function CoolTip:GetText (buttonIndex) local button1 = frame1.Lines [buttonIndex] if (not button1) then - return "" + return "", "" else - return button1.leftText:GetText() + return button1.leftText:GetText(), button1.rightText:GetText() end end @@ -1283,6 +1318,12 @@ function DetailsCreateCoolTip() _table_wipe (CoolTip.ParametersTableMain) _table_wipe (CoolTip.ParametersTableSub) + CoolTip.title1 = nil + CoolTip.title_text = nil + + CoolTip.frame1.titleText:Hide() + CoolTip.frame1.titleIcon:Hide() + CoolTip:ClearAllOptions() CoolTip:SetColor (1, "transparent") CoolTip:SetColor (2, "transparent") @@ -1952,6 +1993,14 @@ function DetailsCreateCoolTip() end host.CoolTip.BuildFunc() + + if (CoolTip.Indexes == 0) then + if (host.CoolTip.Default) then + CoolTip:SetType ("tooltip") + CoolTip:AddLine (host.CoolTip.Default, nil, 1, "white") + end + end + CoolTip:ShowCooltip() if (fromClick) then @@ -1959,7 +2008,7 @@ function DetailsCreateCoolTip() end end - local wait = 0.3 + local wait = 0.2 local InjectOnUpdateEnter = function (self, elapsed) elapsedTime = elapsedTime+elapsed @@ -1971,7 +2020,7 @@ function DetailsCreateCoolTip() local InjectOnUpdateLeave = function (self, elapsed) elapsedTime = elapsedTime+elapsed - if (elapsedTime > 0.3) then + if (elapsedTime > 0.2) then if (not CoolTip.mouseOver and not CoolTip.buttonOver and self == CoolTip.Host) then CoolTip:ShowMe (false) end @@ -2004,7 +2053,7 @@ function DetailsCreateCoolTip() CoolTip:ExecFunc (self) else elapsedTime = 0 - wait = self.CoolTip.ShowSpeed or 0.3 + wait = self.CoolTip.ShowSpeed or 0.2 self:SetScript ("OnUpdate", InjectOnUpdateEnter) end diff --git a/framework/cooltip.xml b/framework/cooltip.xml index 1cda951a..16e20ae8 100644 --- a/framework/cooltip.xml +++ b/framework/cooltip.xml @@ -61,17 +61,18 @@ -