You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9812 lines
339 KiB

4 years ago
3 years ago
local Details = _G._detalhes
local Loc = LibStub("AceLocale-3.0"):GetLocale("Details")
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
local segmentos = Details.segmentos
local gump = Details.gump
4 years ago
local _
--lua locals
3 years ago
local ceil = math.ceil
local floor = math.floor
4 years ago
local _math_max = math.max
3 years ago
local ipairs = ipairs
local pairs = pairs
4 years ago
local abs = _G.abs
3 years ago
local unpack = unpack
4 years ago
--api locals
local CreateFrame = CreateFrame
3 years ago
local GetTime = GetTime
4 years ago
local _GetCursorPosition = GetCursorPosition
3 years ago
local UIParent = UIParent
4 years ago
local _IsAltKeyDown = IsAltKeyDown
local _IsShiftKeyDown = IsShiftKeyDown
local _IsControlKeyDown = IsControlKeyDown
3 years ago
local modo_raid = Details._detalhes_props["MODO_RAID"]
local modo_alone = Details._detalhes_props["MODO_ALONE"]
4 years ago
local IsInInstance = _G.IsInInstance
3 years ago
local tokFunctions = Details.ToKFunctions
4 years ago
--constants
local baseframe_strata = "LOW"
3 years ago
local defaultBackdropSt = {
4 years ago
bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16,
insets = {left = 0, right = 0, top = 0, bottom = 0}}
3 years ago
local CONST_ROWFRAME_ALPHA = 0.975036
local parseRowFrameAlpha = function(value)
return math.min(value, CONST_ROWFRAME_ALPHA)
end
function Details:ScheduleUpdate(instancia)
4 years ago
instancia.barraS = {nil, nil}
instancia.update = true
if (instancia.showing) then
instancia.atributo = instancia.atributo or 1
3 years ago
if (not instancia.showing[instancia.atributo]) then
instancia.showing = Details.tabela_vigente
4 years ago
end
3 years ago
instancia.showing[instancia.atributo].need_refresh = true
4 years ago
end
end
3 years ago
--skins TCoords
4 years ago
local DEFAULT_SKIN = [[Interface\AddOns\Details\images\skins\classic_skin]]
local COORDS_LEFT_BALL = {0.15625, 0.2802734375, 0.08203125, 0.2060546875} -- 160 287 84 211
local COORDS_LEFT_CONNECTOR = {0.294921875, 0.3017578125, 0.08203125, 0.2060546875} --302 84 309 211 (updated)
local COORDS_LEFT_CONNECTOR_NO_ICON = {0.587890625+0.00048828125, 0.5947265625, 0.08203125, 0.2060546875} -- 602 609 x 84 211
local COORDS_TOP_BACKGROUND = {0.15625, 0.6552734375, 0.22265625, 0.3466796875} -- 160 671 x 228 355
local COORDS_RIGHT_BALL = {0.3154296875, 0.439453125, 0.08203125, 0.2060546875} -- 323 450 x 84 211
local COORDS_LEFT_BALL_NO_ICON = {0.44921875, 0.5732421875, 0.08203125, 0.2060546875} -- 460 587 84 211
local COORDS_LEFT_SIDE_BAR = {0.765625, 0.828125, 0.001953125, 0.501953125} -- 784 2 848 514 (updated)
local COORDS_RIGHT_SIDE_BAR = {0.7001953125, 0.7626953125, 0.001953125, 0.501953125} -- --717 2 781 513
local COORDS_BOTTOM_SIDE_BAR = {0.32861328125, 0.82666015625, 0.50537109375, 0.56494140625} -- 336 517 847 579 (updated)
local COORDS_SLIDER_TOP = {0.00146484375, 0.03076171875, 0.00244140625, 0.03173828125} -- 1 2 32 33 -ok
local COORDS_SLIDER_MIDDLE = {0.00146484375, 0.03076171875, 0.03955078125, 0.10009765625} -- 1 40 32 103 -ok
local COORDS_SLIDER_DOWN = {0.00146484375, 0.03076171875, 0.10986328125, 0.13916015625} -- 1 112 32 143 -ok
local COORDS_STRETCH = {0.0009765625, 0.03125, 0.2138671875, 0.228515625} -- 1 32 219 234
local COORDS_RESIZE_RIGHT = {0.00146484375, 0.01513671875, 0.24560546875, 0.25927734375} -- 1 251 16 266 -ok
local COORDS_RESIZE_LEFT = {0.02001953125, 0.03173828125, 0.24560546875, 0.25927734375} -- 20 251 33 266 -ok
local COORDS_UNLOCK_BUTTON = {0.00146484375, 0.01513671875, 0.27197265625, 0.28564453125} -- 1 278 16 293 -ok
local COORDS_BOTTOM_BACKGROUND = {0.15673828125, 0.65478515625, 0.35400390625, 0.47705078125} -- 160 362 671 489 -ok
local COORDS_PIN_LEFT = {0.00146484375, 0.03076171875, 0.30126953125, 0.33056640625} -- 1 308 32 339 -ok
local COORDS_PIN_RIGHT = {0.03564453125, 0.06494140625, 0.30126953125, 0.33056640625} -- 36 308 67 339 -ok
local menus_backdrop = {
edgeFile = [[Interface\Buttons\WHITE8X8]],
edgeSize=1,
bgFile = [[Interface\AddOns\Details\images\background]],
tileSize=16,
tile=true,
insets = {top=0, right=0, left=0, bottom=0}
}
local menus_backdropcolor = {.2, .2, .2, 0.85}
local menus_backdropcolor_sec = {.2, .2, .2, 0.90}
local menus_bordercolor = {0, 0, 0, .25}
3 years ago
4 years ago
--menus are ignoring the value set on the profile
3 years ago
Details.menu_backdrop_config = {
4 years ago
menus_backdrop = menus_backdrop,
menus_backdropcolor = menus_backdropcolor,
menus_backdropcolor_sec = menus_backdropcolor_sec,
menus_bordercolor = menus_bordercolor,
}
3 years ago
function Details:RefreshScrollBar(x) --x = amount of bars being refreshed
local amountRowsInTheWindow = self.rows_fit_in_window
4 years ago
if (not self.barraS[1]) then --primeira vez que as barras est�o aparecendo
self.barraS[1] = 1 --primeira barra
3 years ago
if (amountRowsInTheWindow < x) then --se a quantidade a ser mostrada for maior que o que pode ser mostrado
self.barraS[2] = amountRowsInTheWindow -- B = o que pode ser mostrado
4 years ago
else
self.barraS[2] = x -- contr�rio B = o que esta sendo mostrado
end
end
3 years ago
4 years ago
if (not self.rolagem) then
3 years ago
if (x > amountRowsInTheWindow) then --show scroll bar
4 years ago
self.rows_showing = x
3 years ago
4 years ago
if (not self.baseframe.isStretching) then
self:MostrarScrollBar()
end
self.need_rolagem = true
3 years ago
self.barraS[2] = amountRowsInTheWindow --B � o total que cabe na barra
else --Do contr�rio B � o total de barras
4 years ago
self.rows_showing = x
self.barraS[2] = x
end
else
3 years ago
if (x > self.rows_showing) then --tem mais barras mostrando agora do que na �ltima atualiza��o
4 years ago
self.rows_showing = x
local nao_mostradas = self.rows_showing - self.rows_fit_in_window
3 years ago
local slider_height = nao_mostradas * self.row_height
4 years ago
self.scroll.scrollMax = slider_height
self.scroll:SetMinMaxValues(0, slider_height)
3 years ago
else --diminuiu a quantidade, acontece depois de uma coleta de lixo
4 years ago
self.rows_showing = x
local nao_mostradas = self.rows_showing - self.rows_fit_in_window
3 years ago
if (nao_mostradas < 1) then --se estiver mostrando menos do que realmente cabe n�o precisa scrollbar
4 years ago
self:EsconderScrollBar()
else
3 years ago
--contr�rio, basta atualizar o tamanho da scroll
local slider_height = nao_mostradas * self.row_height
4 years ago
self.scroll.scrollMax = slider_height
3 years ago
self.scroll:SetMinMaxValues(0, slider_height)
4 years ago
end
end
end
3 years ago
if (self.update) then
4 years ago
self.update = false
self.v_barras = true
3 years ago
return Details:EsconderBarrasNaoUsadas(self)
4 years ago
end
end
3 years ago
--self é a janela das barras
local function move_barras(self, elapsed)
4 years ago
self._move_func.time = self._move_func.time+elapsed
if (self._move_func.time > 0.01) then
3 years ago
if (self._move_func.instancia.bgdisplay_loc == self._move_func._end) then --se o tamanho atual � igual ao final declarado
self:SetScript("OnUpdate", nil)
4 years ago
self._move_func = nil
else
self._move_func.time = 0
3 years ago
self._move_func.instancia.bgdisplay_loc = self._move_func.instancia.bgdisplay_loc + self._move_func.inc --inc � -1 ou 1 e ir� crescer ou diminuir a janela
4 years ago
for index = 1, self._move_func.instancia.rows_fit_in_window do
3 years ago
self._move_func.instancia.barras [index]:SetWidth(self:GetWidth()+self._move_func.instancia.bgdisplay_loc-3)
4 years ago
end
3 years ago
self._move_func.instancia.bgdisplay:SetPoint("bottomright", self, "bottomright", self._move_func.instancia.bgdisplay_loc, 0)
4 years ago
self._move_func.instancia.bar_mod = self._move_func.instancia.bgdisplay_loc+(-3)
3 years ago
--verifica o tamanho do text
4 years ago
for i = 1, #self._move_func.instancia.barras do
local esta_barra = self._move_func.instancia.barras [i]
3 years ago
Details:name_space (esta_barra)
4 years ago
end
end
end
end
3 years ago
--self � a inst�ncia
function Details:MoveBarrasTo(destino)
4 years ago
local janela = self.baseframe
janela._move_func = {
window = self.baseframe,
instancia = self,
time = 0
}
3 years ago
4 years ago
if (destino > self.bgdisplay_loc) then
janela._move_func.inc = 1
else
janela._move_func.inc = -1
end
janela._move_func._end = destino
3 years ago
janela:SetScript("OnUpdate", move_barras)
4 years ago
end
--almost deprecated
3 years ago
function Details:MostrarScrollBar(sem_animacao)
4 years ago
if (self.rolagem) then
return
end
3 years ago
if (not Details.use_scroll) then
self.baseframe:EnableMouseWheel(true)
4 years ago
self.scroll:Enable()
3 years ago
self.scroll:SetValue(0)
4 years ago
self.rolagem = true
return
end
local main = self.baseframe
local mover_para = self.largura_scroll*-1
3 years ago
if (not sem_animacao and Details.animate_scroll) then
4 years ago
self:MoveBarrasTo (mover_para)
else
3 years ago
--set size of rows
4 years ago
for index = 1, self.rows_fit_in_window do
3 years ago
self.barras[index]:SetWidth(self.baseframe:GetWidth()+mover_para -3) ---3 distance between row end and scroll start
4 years ago
end
3 years ago
--move the semi-background to the left (which moves the scroll)
self.bgdisplay:SetPoint("bottomright", self.baseframe, "bottomright", mover_para, 0)
4 years ago
self.bar_mod = mover_para + (-3)
self.bgdisplay_loc = mover_para
3 years ago
--cancel movement if any
if (self.baseframe:GetScript("OnUpdate") and self.baseframe:GetScript("OnUpdate") == move_barras) then
self.baseframe:SetScript("OnUpdate", nil)
4 years ago
end
end
3 years ago
4 years ago
local nao_mostradas = self.rows_showing - self.rows_fit_in_window
local slider_height = nao_mostradas*self.row_height
self.scroll.scrollMax = slider_height
3 years ago
self.scroll:SetMinMaxValues(0, slider_height)
4 years ago
self.rolagem = true
self.scroll:Enable()
3 years ago
main:EnableMouseWheel(true)
4 years ago
3 years ago
self.scroll:SetValue(0) --set value pode chamar o atualizador
4 years ago
self.baseframe.button_down:Enable()
3 years ago
main.resize_direita:SetPoint("bottomright", main, "bottomright", self.largura_scroll*-1, 0)
4 years ago
if (main.isLocked) then
3 years ago
main.lock_button:SetPoint("bottomright", main, "bottomright", self.largura_scroll*-1, 0)
4 years ago
end
end
--almost deprecated
3 years ago
function Details:EsconderScrollBar (sem_animacao, force)
4 years ago
if (not self.rolagem) then
return
end
3 years ago
if (not Details.use_scroll and not force) then
4 years ago
self.scroll:Disable()
3 years ago
self.baseframe:EnableMouseWheel(false)
4 years ago
self.rolagem = false
return
end
3 years ago
4 years ago
local main = self.baseframe
3 years ago
if (not sem_animacao and Details.animate_scroll) then
self:MoveBarrasTo (self.row_info.space.right + 3) -->
4 years ago
else
for index = 1, self.rows_fit_in_window do
3 years ago
self.barras [index]:SetWidth(self.baseframe:GetWidth() - 5) ---5 space between row end and window right border
4 years ago
end
3 years ago
self.bgdisplay:SetPoint("bottomright", self.baseframe, "bottomright", 0, 0) -- voltar o background na poci��o inicial
4 years ago
self.bar_mod = 0 -- zera o bar mod, uma vez que as barras v�o estar na pocis�o inicial
self.bgdisplay_loc = -2
3 years ago
if (self.baseframe:GetScript("OnUpdate") and self.baseframe:GetScript("OnUpdate") == move_barras) then
self.baseframe:SetScript("OnUpdate", nil)
4 years ago
end
end
self.rolagem = false
self.scroll:Disable()
3 years ago
main:EnableMouseWheel(false)
main.resize_direita:SetPoint("bottomright", main, "bottomright", 0, 0)
4 years ago
if (main.isLocked) then
3 years ago
main.lock_button:SetPoint("bottomright", main, "bottomright", 0, 0)
4 years ago
end
end
3 years ago
local function OnLeaveMainWindow(instancia, self)
4 years ago
instancia.is_interacting = false
3 years ago
instancia:SetMenuAlpha(nil, nil, nil, nil, true)
instancia:SetAutoHideMenu(nil, nil, true)
4 years ago
instancia:RefreshAttributeTextSize()
3 years ago
if (instancia.modo ~= Details._detalhes_props["MODO_ALONE"] and not instancia.baseframe.isLocked) then
--resizes, lock and ungroup buttons
if (not Details.disable_lock_ungroup_buttons) then
instancia.baseframe.resize_direita:SetAlpha(0)
instancia.baseframe.resize_esquerda:SetAlpha(0)
instancia.baseframe.lock_button:SetAlpha(0)
instancia.break_snap_button:SetAlpha(0)
end
--stretch button
Details.FadeHandler.Fader(instancia.baseframe.button_stretch, "ALPHA", 0)
elseif (instancia.modo ~= Details._detalhes_props["MODO_ALONE"] and instancia.baseframe.isLocked) then
--resizes, lock and ungroup buttons
if (not Details.disable_lock_ungroup_buttons) then
instancia.baseframe.lock_button:SetAlpha(0)
instancia.break_snap_button:SetAlpha(0)
end
Details.FadeHandler.Fader(instancia.baseframe.button_stretch, "ALPHA", 0)
end
end
Details.OnLeaveMainWindow = OnLeaveMainWindow
local function OnEnterMainWindow(instancia, self)
4 years ago
instancia.is_interacting = true
3 years ago
instancia:SetMenuAlpha(nil, nil, nil, nil, true)
instancia:SetAutoHideMenu(nil, nil, true)
4 years ago
instancia:RefreshAttributeTextSize()
3 years ago
if (not instancia.last_interaction or instancia.last_interaction < Details._tempo) then
instancia.last_interaction = Details._tempo or time()
4 years ago
end
if (instancia.baseframe:GetFrameLevel() > instancia.rowframe:GetFrameLevel()) then
3 years ago
instancia.rowframe:SetFrameLevel(instancia.baseframe:GetFrameLevel())
end
if (instancia.modo ~= Details._detalhes_props["MODO_ALONE"] and not instancia.baseframe.isLocked) then
--resize, lock and ungroup buttons
if (not Details.disable_lock_ungroup_buttons) then
instancia.baseframe.resize_direita:SetAlpha(1)
instancia.baseframe.resize_esquerda:SetAlpha(1)
instancia.baseframe.lock_button:SetAlpha(1)
--ungroup
for _, instancia_id in pairs(instancia.snap) do
4 years ago
if (instancia_id) then
3 years ago
instancia.break_snap_button:SetAlpha(1)
4 years ago
break
end
end
end
3 years ago
--stretch button
if (not Details.disable_stretch_button) then
Details.FadeHandler.Fader(instancia.baseframe.button_stretch, "ALPHA", 0.4)
4 years ago
end
3 years ago
elseif (instancia.modo ~= Details._detalhes_props["MODO_ALONE"] and instancia.baseframe.isLocked) then
if (not Details.disable_lock_ungroup_buttons) then
instancia.baseframe.lock_button:SetAlpha(1)
--ungroup
for _, instancia_id in pairs(instancia.snap) do
4 years ago
if (instancia_id) then
instancia.break_snap_button:Show()
3 years ago
instancia.break_snap_button:SetAlpha(1)
4 years ago
break
end
end
end
3 years ago
if (not Details.disable_stretch_button) then
Details.FadeHandler.Fader(instancia.baseframe.button_stretch, "ALPHA", 0.4)
4 years ago
end
end
end
3 years ago
Details.OnEnterMainWindow = OnEnterMainWindow
4 years ago
local function VPL (instancia, esta_instancia)
3 years ago
--conferir esquerda
if (instancia.ponto4.x-0.5 < esta_instancia.ponto1.x) then --a janela esta a esquerda
if (instancia.ponto4.x+20 > esta_instancia.ponto1.x) then --a janela esta a menos de 20 pixels de dist�ncia
if (instancia.ponto4.y < esta_instancia.ponto1.y + 100 and instancia.ponto4.y > esta_instancia.ponto1.y - 100) then --a janela esta a +20 ou -20 pixels de dist�ncia na vertical
4 years ago
return 1
end
end
end
return nil
end
local function VPB (instancia, esta_instancia)
3 years ago
--conferir baixo
if (instancia.ponto1.y+(20 * instancia.window_scale) < esta_instancia.ponto2.y - (16 * esta_instancia.window_scale)) then --a janela esta em baixo
if (instancia.ponto1.x > esta_instancia.ponto2.x-100 and instancia.ponto1.x < esta_instancia.ponto2.x+100) then --a janela esta a 20 pixels de dist�ncia para a esquerda ou para a direita
if (instancia.ponto1.y+(20 * instancia.window_scale) > esta_instancia.ponto2.y - (36 * esta_instancia.window_scale)) then --esta a 20 pixels de dist�ncia
4 years ago
return 2
end
end
end
return nil
end
local function VPR (instancia, esta_instancia)
3 years ago
--conferir lateral direita
if (instancia.ponto2.x+0.5 > esta_instancia.ponto3.x) then --a janela esta a direita
if (instancia.ponto2.x-20 < esta_instancia.ponto3.x) then --a janela esta a menos de 20 pixels de dist�ncia
if (instancia.ponto2.y < esta_instancia.ponto3.y + 100 and instancia.ponto2.y > esta_instancia.ponto3.y - 100) then --a janela esta a +20 ou -20 pixels de dist�ncia na vertical
4 years ago
return 3
end
end
end
return nil
end
local function VPT (instancia, esta_instancia)
3 years ago
--conferir cima
if (instancia.ponto3.y - (16 * instancia.window_scale) > esta_instancia.ponto4.y + (20 * esta_instancia.window_scale)) then --a janela esta em cima
if (instancia.ponto3.x > esta_instancia.ponto4.x-100 and instancia.ponto3.x < esta_instancia.ponto4.x+100) then --a janela esta a 20 pixels de dist�ncia para a esquerda ou para a direita
4 years ago
if (esta_instancia.ponto4.y+(40 * esta_instancia.window_scale) > instancia.ponto3.y - (16 * instancia.window_scale)) then
return 4
end
end
end
return nil
end
3 years ago
Details.VPT, Details.VPR, Details.VPB, Details.VPL = VPT, VPR, VPB, VPL
4 years ago
local color_red = {1, 0.2, 0.2}
local color_green = {0.2, 1, 0.2}
local pixels_per_arrow = 50
local show_instance_ids = function()
3 years ago
for id, instance in Details:ListInstances() do
4 years ago
if (instance:IsEnabled()) then
local id_texture1 = instance.baseframe.id_texture1
if (not id_texture1) then
--instancia.
3 years ago
instance.baseframe.id_texture1 = instance.floatingframe:CreateTexture(nil, "overlay")
instance.baseframe.id_texture2 = instance.floatingframe:CreateTexture(nil, "overlay")
instance.baseframe.id_texture1:SetTexture([[Interface\Timer\BigTimerNumbers]])
instance.baseframe.id_texture2:SetTexture([[Interface\Timer\BigTimerNumbers]])
4 years ago
end
3 years ago
4 years ago
local h = instance.baseframe:GetHeight() * 0.80
3 years ago
instance.baseframe.id_texture1:SetSize(h, h)
instance.baseframe.id_texture2:SetSize(h, h)
4 years ago
local id = instance:GetId()
3 years ago
local first, second = floor(id/10), floor(id%10)
4 years ago
if (id >= 10) then
3 years ago
instance.baseframe.id_texture1:SetPoint("center", instance.baseframe, "center", -h/2/2, 0)
instance.baseframe.id_texture2:SetPoint("left", instance.baseframe.id_texture1, "right", -h/2, 0)
4 years ago
first = first + 1
3 years ago
local line = ceil(first / 4)
4 years ago
local x = ( first - ( (line-1) * 4 ) ) / 4
local l, r, t, b = x-0.25, x, 0.33 * (line-1), 0.33 * line
3 years ago
instance.baseframe.id_texture1:SetTexCoord(l, r, t, b)
4 years ago
second = second + 1
3 years ago
local line = ceil(second / 4)
4 years ago
local x = ( second - ( (line-1) * 4 ) ) / 4
local l, r, t, b = x-0.25, x, 0.33 * (line-1), 0.33 * line
3 years ago
instance.baseframe.id_texture2:SetTexCoord(l, r, t, b)
4 years ago
instance.baseframe.id_texture1:Show()
instance.baseframe.id_texture2:Show()
else
3 years ago
instance.baseframe.id_texture1:SetPoint("center", instance.baseframe, "center")
4 years ago
second = second + 1
3 years ago
local line = ceil(second / 4)
4 years ago
local x = ( second - ( (line-1) * 4 ) ) / 4
local l, r, t, b = x-0.25, x, 0.33 * (line-1), 0.33 * line
3 years ago
instance.baseframe.id_texture1:SetTexCoord(l, r, t, b)
4 years ago
instance.baseframe.id_texture1:Show()
instance.baseframe.id_texture2:Hide()
end
end
end
end
3 years ago
local update_line = function(self, target_frame)
4 years ago
local target_instance_PosX, target_instance_PosY = target_frame.instance:GetPositionOnScreen()
local moving_instance_PosX, moving_instance_PosY = self.instance:GetPositionOnScreen()
3 years ago
4 years ago
target_instance_PosX = target_instance_PosX or 0
target_instance_PosY = target_instance_PosY or 0
moving_instance_PosX = moving_instance_PosX or 0
moving_instance_PosY = moving_instance_PosY or 0
3 years ago
4 years ago
local dX = target_instance_PosX - moving_instance_PosX
local dY = target_instance_PosY - moving_instance_PosY
local distance = (dX^2 + dY^2) ^ 0.5
local angle = atan2(dY, dX)
3 years ago
local guide_balls = Details.guide_balls
4 years ago
if (not guide_balls) then
3 years ago
Details.guide_balls = {}
guide_balls = Details.guide_balls
4 years ago
end
3 years ago
for index, ball in ipairs(guide_balls) do
4 years ago
ball:Hide()
end
3 years ago
4 years ago
self.instance:AtualizaPontos()
target_frame.instance:AtualizaPontos()
3 years ago
4 years ago
local color = color_red
local _R, _T, _L, _B = VPL (self.instance, target_frame.instance), VPB (self.instance, target_frame.instance), VPR (self.instance, target_frame.instance), VPT (self.instance, target_frame.instance)
if (_R or _T or _L or _B) then
color = color_green
end
for i = 0, (distance/pixels_per_arrow) do
local x = distance - (i * pixels_per_arrow)
x = x * cos(angle)
local y = distance - (i * pixels_per_arrow)
y = y * sin(angle)
local ball = guide_balls [i]
if (not ball) then
3 years ago
ball = Details.overlay_frame:CreateTexture(nil, "Overlay")
ball:SetTexture([[Interface\AddOns\Details\images\icons]])
ball:SetSize(16, 16)
ball:SetAlpha(0.3)
ball:SetTexCoord(410/512, 426/512, 2/512, 18/512)
tinsert(guide_balls, ball)
end
4 years ago
ball:ClearAllPoints()
ball:SetPoint("CENTER", self, "CENTER", x, y) --baseframse center
ball:Show()
3 years ago
ball:SetVertexColor(unpack(color))
4 years ago
end
end
local tempo_movendo, precisa_ativar, instancia_alvo, tempo_fades, nao_anexados, flash_bounce, start_draw_lines, instance_ids_shown, need_show_group_guide
3 years ago
local movement_onupdate = function(self, elapsed)
4 years ago
if (start_draw_lines and start_draw_lines > 0.95) then
update_line (self, instancia_alvo.baseframe)
elseif (start_draw_lines) then
start_draw_lines = start_draw_lines + elapsed
end
if (instance_ids_shown and instance_ids_shown > 0.95) then
show_instance_ids()
instance_ids_shown = nil
3 years ago
4 years ago
if (need_show_group_guide and not DetailsFramework.IsTimewalkWoW()) then
3 years ago
Details.MicroButtonAlert.Text:SetText(Loc["STRING_WINDOW1ATACH_DESC"])
Details.MicroButtonAlert:SetPoint("bottom", need_show_group_guide.baseframe, "top", 0, 30)
Details.MicroButtonAlert:SetHeight(320)
Details.MicroButtonAlert:Show()
4 years ago
need_show_group_guide = nil
end
elseif (instance_ids_shown) then
instance_ids_shown = instance_ids_shown + elapsed
end
3 years ago
4 years ago
if (tempo_movendo and tempo_movendo < 0) then
3 years ago
if (precisa_ativar) then --se a inst�ncia estiver fechada
Details.FadeHandler.Fader(instancia_alvo.baseframe, "ALPHA", 0.15)
Details.FadeHandler.Fader(instancia_alvo.baseframe.cabecalho.ball, "ALPHA", 0.15)
Details.FadeHandler.Fader(instancia_alvo.baseframe.cabecalho.atributo_icon, "ALPHA", 0.15)
4 years ago
instancia_alvo:SaveMainWindowPosition()
instancia_alvo:RestoreMainWindowPosition()
precisa_ativar = false
3 years ago
4 years ago
elseif (tempo_fades) then
3 years ago
4 years ago
if (flash_bounce == 0) then
3 years ago
4 years ago
flash_bounce = 1
local tem_livre = false
3 years ago
for lado, livre in ipairs(nao_anexados) do
4 years ago
if (livre) then
if (lado == 1) then
3 years ago
4 years ago
local texture = instancia_alvo.h_esquerda.texture
texture:ClearAllPoints()
3 years ago
4 years ago
if (instancia_alvo.toolbar_side == 1) then
if (instancia_alvo.show_statusbar) then
3 years ago
texture:SetPoint("topright", instancia_alvo.baseframe, "topleft", 0, 20)
texture:SetPoint("bottomright", instancia_alvo.baseframe, "bottomleft", 0, -14)
4 years ago
else
3 years ago
texture:SetPoint("topright", instancia_alvo.baseframe, "topleft", 0, 20)
texture:SetPoint("bottomright", instancia_alvo.baseframe, "bottomleft", 0, 0)
4 years ago
end
else
if (instancia_alvo.show_statusbar) then
3 years ago
texture:SetPoint("topright", instancia_alvo.baseframe, "topleft", 0, 0)
texture:SetPoint("bottomright", instancia_alvo.baseframe, "bottomleft", 0, -34)
4 years ago
else
3 years ago
texture:SetPoint("topright", instancia_alvo.baseframe, "topleft", 0, 0)
texture:SetPoint("bottomright", instancia_alvo.baseframe, "bottomleft", 0, -20)
4 years ago
end
end
3 years ago
instancia_alvo.h_esquerda:Flash(1, 1, 2.0, false, 0, 0)
4 years ago
tem_livre = true
3 years ago
4 years ago
elseif (lado == 2) then
3 years ago
4 years ago
local texture = instancia_alvo.h_baixo.texture
texture:ClearAllPoints()
3 years ago
4 years ago
if (instancia_alvo.toolbar_side == 1) then
if (instancia_alvo.show_statusbar) then
3 years ago
texture:SetPoint("topleft", instancia_alvo.baseframe, "bottomleft", 0, -14)
texture:SetPoint("topright", instancia_alvo.baseframe, "bottomright", 0, -14)
4 years ago
else
3 years ago
texture:SetPoint("topleft", instancia_alvo.baseframe, "bottomleft", 0, 0)
texture:SetPoint("topright", instancia_alvo.baseframe, "bottomright", 0, 0)
4 years ago
end
else
if (instancia_alvo.show_statusbar) then
3 years ago
texture:SetPoint("topleft", instancia_alvo.baseframe, "bottomleft", 0, -34)
texture:SetPoint("topright", instancia_alvo.baseframe, "bottomright", 0, -34)
4 years ago
else
3 years ago
texture:SetPoint("topleft", instancia_alvo.baseframe, "bottomleft", 0, -20)
texture:SetPoint("topright", instancia_alvo.baseframe, "bottomright", 0, -20)
4 years ago
end
end
3 years ago
instancia_alvo.h_baixo:Flash(1, 1, 2.0, false, 0, 0)
4 years ago
tem_livre = true
3 years ago
4 years ago
elseif (lado == 3) then
3 years ago
4 years ago
local texture = instancia_alvo.h_direita.texture
texture:ClearAllPoints()
3 years ago
4 years ago
if (instancia_alvo.toolbar_side == 1) then
if (instancia_alvo.show_statusbar) then
3 years ago
texture:SetPoint("topleft", instancia_alvo.baseframe, "topright", 0, 20)
texture:SetPoint("bottomleft", instancia_alvo.baseframe, "bottomright", 0, -14)
4 years ago
else
3 years ago
texture:SetPoint("topleft", instancia_alvo.baseframe, "topright", 0, 20)
texture:SetPoint("bottomleft", instancia_alvo.baseframe, "bottomright", 0, 0)
4 years ago
end
else
if (instancia_alvo.show_statusbar) then
3 years ago
texture:SetPoint("topleft", instancia_alvo.baseframe, "topright", 0, 0)
texture:SetPoint("bottomleft", instancia_alvo.baseframe, "bottomright", 0, -34)
4 years ago
else
3 years ago
texture:SetPoint("topleft", instancia_alvo.baseframe, "topright", 0, 0)
texture:SetPoint("bottomleft", instancia_alvo.baseframe, "bottomright", 0, -20)
4 years ago
end
end
3 years ago
instancia_alvo.h_direita:Flash(1, 1, 2.0, false, 0, 0)
4 years ago
tem_livre = true
3 years ago
4 years ago
elseif (lado == 4) then
3 years ago
4 years ago
local texture = instancia_alvo.h_cima.texture
texture:ClearAllPoints()
3 years ago
4 years ago
if (instancia_alvo.toolbar_side == 1) then
3 years ago
texture:SetPoint("bottomleft", instancia_alvo.baseframe, "topleft", 0, 20)
texture:SetPoint("bottomright", instancia_alvo.baseframe, "topright", 0, 20)
4 years ago
else
3 years ago
texture:SetPoint("bottomleft", instancia_alvo.baseframe, "topleft", 0, 0)
texture:SetPoint("bottomright", instancia_alvo.baseframe, "topright", 0, 0)
4 years ago
end
3 years ago
instancia_alvo.h_cima:Flash(1, 1, 2.0, false, 0, 0)
4 years ago
tem_livre = true
3 years ago
4 years ago
end
end
end
3 years ago
4 years ago
if (tem_livre) then
3 years ago
if (not Details.snap_alert.playing) then
4 years ago
instancia_alvo:SnapAlert()
3 years ago
Details.snap_alert.playing = true
4 years ago
if (not DetailsFramework.IsTimewalkWoW()) then
3 years ago
Details.MicroButtonAlert.Text:SetText(string.format(Loc["STRING_ATACH_DESC"], self.instance.meu_id, instancia_alvo.meu_id))
Details.MicroButtonAlert:SetPoint("bottom", instancia_alvo.baseframe.cabecalho.modo_selecao.widget, "top", 0, 18)
Details.MicroButtonAlert:SetHeight(200)
Details.MicroButtonAlert:Show()
4 years ago
end
end
end
end
3 years ago
4 years ago
tempo_movendo = 1
else
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
tempo_movendo = 1
end
3 years ago
4 years ago
elseif (tempo_movendo) then
tempo_movendo = tempo_movendo - elapsed
end
end
3 years ago
local function move_janela(baseframe, iniciando, instancia, just_updating)
instancia_alvo = Details.tabela_instancias [instancia.meu_id-1]
if (Details.disable_window_groups) then
4 years ago
instancia_alvo = nil
end
3 years ago
4 years ago
if (iniciando) then
if (baseframe.isMoving) then
3 years ago
--ja esta em movimento
4 years ago
return
end
3 years ago
4 years ago
baseframe.isMoving = true
instancia:BaseFrameSnap()
baseframe:StartMoving()
3 years ago
4 years ago
local group = instancia:GetInstanceGroup()
3 years ago
for _, this_instance in ipairs(group) do
4 years ago
this_instance.baseframe:SetClampRectInsets (0, 0, 0, 0)
this_instance.isMoving = true
end
3 years ago
4 years ago
local _, ClampLeft, ClampRight = instancia:InstanciasHorizontais()
local _, ClampBottom, ClampTop = instancia:InstanciasVerticais()
3 years ago
4 years ago
baseframe:SetClampRectInsets (-ClampLeft, ClampRight, ClampTop, -ClampBottom)
if (instancia_alvo and (instancia_alvo.ativa or not just_updating)) then
3 years ago
4 years ago
tempo_fades = 1.0
nao_anexados = {true, true, true, true}
tempo_movendo = 1
flash_bounce = 0
instance_ids_shown = 0
start_draw_lines = 0
need_show_group_guide = nil
3 years ago
for lado, snap_to in pairs(instancia_alvo.snap) do
4 years ago
if (snap_to == instancia.meu_id) then
start_draw_lines = false
end
end
3 years ago
for lado, snap_to in pairs(instancia_alvo.snap) do
4 years ago
if (snap_to) then
if (snap_to == instancia.meu_id) then
tempo_fades = nil
break
end
nao_anexados [lado] = false
end
end
3 years ago
4 years ago
for lado = 1, 4 do
if (instancia_alvo.horizontalSnap and instancia.verticalSnap) then
nao_anexados [lado] = false
elseif (instancia_alvo.horizontalSnap and lado == 2) then
nao_anexados [lado] = false
elseif (instancia_alvo.horizontalSnap and lado == 4) then
nao_anexados [lado] = false
elseif (instancia_alvo.verticalSnap and lado == 1) then
nao_anexados [lado] = false
elseif (instancia_alvo.verticalSnap and lado == 3) then
nao_anexados [lado] = false
end
end
local need_start = not instancia_alvo.iniciada
precisa_ativar = not instancia_alvo.ativa
3 years ago
if (need_start) then --se a inst�ncia n�o tiver sido aberta ainda
local lower_instance = Details:GetLowerInstanceNumber()
instancia_alvo:RestauraJanela(instancia_alvo.meu_id, true)
4 years ago
if (instancia_alvo:IsSoloMode()) then
3 years ago
Details.SoloTables:switch()
4 years ago
end
3 years ago
4 years ago
instancia_alvo.ativa = false
3 years ago
4 years ago
instancia_alvo:SaveMainWindowPosition()
instancia_alvo:RestoreMainWindowPosition()
3 years ago
Details.FadeHandler.Fader(instancia_alvo.baseframe, 1)
Details.FadeHandler.Fader(instancia_alvo.rowframe, parseRowFrameAlpha(1))
Details.FadeHandler.Fader(instancia_alvo.baseframe.cabecalho.ball, 1)
4 years ago
need_start = false
end
3 years ago
baseframe:SetScript("OnUpdate", movement_onupdate)
4 years ago
else
3 years ago
--eh a instancia 1
4 years ago
local got_snap
3 years ago
for side, instance_id in pairs(instancia.snap) do
4 years ago
if (instance_id) then
got_snap = true
end
end
3 years ago
4 years ago
need_show_group_guide = nil
3 years ago
4 years ago
if (not got_snap) then
need_show_group_guide = instancia
end
3 years ago
4 years ago
tempo_movendo = nil
start_draw_lines = nil
instance_ids_shown = 0
3 years ago
baseframe:SetScript("OnUpdate", movement_onupdate)
4 years ago
end
3 years ago
else
4 years ago
baseframe:StopMovingOrSizing()
baseframe.isMoving = false
3 years ago
baseframe:SetScript("OnUpdate", nil)
4 years ago
3 years ago
if (Details.guide_balls) then
for index, ball in ipairs(Details.guide_balls) do
4 years ago
ball:Hide()
end
end
3 years ago
for _, ins in Details:ListInstances() do
4 years ago
if (ins.baseframe) then
ins.baseframe:SetUserPlaced (false)
if (ins.baseframe.id_texture1) then
ins.baseframe.id_texture1:Hide()
ins.baseframe.id_texture2:Hide()
end
end
end
3 years ago
--baseframe:SetClampRectInsets (unpack(_detalhes.window_clamp))
4 years ago
if (instancia_alvo and not instancia.do_not_snap and not instancia_alvo.do_not_snap) then
instancia:AtualizaPontos()
instancia_alvo:AtualizaPontos()
3 years ago
4 years ago
local esquerda, baixo, direita, cima
3 years ago
local meu_id = instancia.meu_id --id da inst�ncia que esta sendo movida
4 years ago
local isVertical = instancia_alvo.verticalSnap
local isHorizontal = instancia_alvo.horizontalSnap
3 years ago
4 years ago
local isSelfVertical = instancia.verticalSnap
local isSelfHorizontal = instancia.horizontalSnap
3 years ago
4 years ago
local _R, _T, _L, _B
3 years ago
4 years ago
if (isVertical and not isSelfHorizontal) then
_T, _B = VPB (instancia, instancia_alvo), VPT (instancia, instancia_alvo)
elseif (isHorizontal and not isSelfVertical) then
_R, _L = VPL (instancia, instancia_alvo), VPR (instancia, instancia_alvo)
elseif (not isVertical and not isHorizontal) then
_R, _T, _L, _B = VPL (instancia, instancia_alvo), VPB (instancia, instancia_alvo), VPR (instancia, instancia_alvo), VPT (instancia, instancia_alvo)
end
3 years ago
4 years ago
if (_L) then
3 years ago
if (not instancia:EstaAgrupada(instancia_alvo, _L)) then
4 years ago
esquerda = instancia_alvo.meu_id
instancia.horizontalSnap = true
instancia_alvo.horizontalSnap = true
end
end
3 years ago
4 years ago
if (_B) then
3 years ago
if (not instancia:EstaAgrupada(instancia_alvo, _B)) then
4 years ago
baixo = instancia_alvo.meu_id
instancia.verticalSnap = true
instancia_alvo.verticalSnap = true
end
end
3 years ago
4 years ago
if (_R) then
3 years ago
if (not instancia:EstaAgrupada(instancia_alvo, _R)) then
4 years ago
direita = instancia_alvo.meu_id
instancia.horizontalSnap = true
instancia_alvo.horizontalSnap = true
end
end
3 years ago
4 years ago
if (_T) then
3 years ago
if (not instancia:EstaAgrupada(instancia_alvo, _T)) then
4 years ago
cima = instancia_alvo.meu_id
instancia.verticalSnap = true
instancia_alvo.verticalSnap = true
end
end
3 years ago
4 years ago
if (esquerda or baixo or direita or cima) then
3 years ago
instancia:agrupar_janelas({esquerda, baixo, direita, cima})
--tutorial
if (not Details:GetTutorialCVar("WINDOW_GROUP_MAKING1")) then
Details:SetTutorialCVar ("WINDOW_GROUP_MAKING1", true)
local group_tutorial = CreateFrame("frame", "DetailsWindowGroupPopUp1", instancia.baseframe, "DetailsHelpBoxTemplate")
4 years ago
group_tutorial.ArrowUP:Show()
group_tutorial.ArrowGlowUP:Show()
3 years ago
group_tutorial.Text:SetText(Loc["STRING_MINITUTORIAL_WINDOWS1"])
group_tutorial:SetPoint("bottom", instancia_alvo.break_snap_button, "top", 0, 24)
4 years ago
group_tutorial:Show()
3 years ago
Details.OnEnterMainWindow(instancia_alvo)
4 years ago
end
end
3 years ago
for _, esta_instancia in ipairs(Details.tabela_instancias) do
4 years ago
if (not esta_instancia:IsAtiva() and esta_instancia.iniciada) then
esta_instancia:ResetaGump()
3 years ago
Details.FadeHandler.Fader(esta_instancia.baseframe, "in", 0.15)
Details.FadeHandler.Fader(esta_instancia.baseframe.cabecalho.ball, "in", 0.15)
Details.FadeHandler.Fader(esta_instancia.baseframe.cabecalho.atributo_icon, "in", 0.15)
4 years ago
if (esta_instancia.modo == modo_raid) then
3 years ago
Details.raid = nil
4 years ago
elseif (esta_instancia.modo == modo_alone) then
3 years ago
Details.SoloTables:switch()
Details.solo = nil
4 years ago
end
elseif (esta_instancia:IsAtiva()) then
esta_instancia:SaveMainWindowPosition()
esta_instancia:RestoreMainWindowPosition()
end
end
end
3 years ago
--salva pos de todas as janelas
for _, ins in ipairs(Details.tabela_instancias) do
4 years ago
if (ins:IsEnabled()) then
ins:SaveMainWindowPosition()
ins:RestoreMainWindowPosition()
end
end
3 years ago
4 years ago
local group = instancia:GetInstanceGroup()
3 years ago
for _, this_instance in ipairs(group) do
4 years ago
this_instance.isMoving = false
end
3 years ago
Details.snap_alert.playing = false
Details.snap_alert.animIn:Stop()
Details.snap_alert.animOut:Play()
4 years ago
if (not DetailsFramework.IsTimewalkWoW()) then
3 years ago
Details.MicroButtonAlert:Hide()
4 years ago
end
if (instancia_alvo and instancia_alvo.ativa and instancia_alvo.baseframe) then
instancia_alvo.h_esquerda:Stop()
instancia_alvo.h_baixo:Stop()
instancia_alvo.h_direita:Stop()
instancia_alvo.h_cima:Stop()
end
end
end
3 years ago
Details.move_janela_func = move_janela
4 years ago
3 years ago
local BGFrame_scripts_onenter = function(self)
OnEnterMainWindow(self._instance, self)
4 years ago
end
3 years ago
local BGFrame_scripts_onleave = function(self)
OnLeaveMainWindow(self._instance, self)
end
4 years ago
3 years ago
local BGFrame_scripts_onmousedown = function(self, button)
4 years ago
-- /run Details.disable_stretch_from_toolbar = true
3 years ago
if (self.is_toolbar and self._instance.baseframe.isLocked and button == "LeftButton" and not Details.disable_stretch_from_toolbar) then
return self._instance.baseframe.button_stretch:GetScript("OnMouseDown") (self._instance.baseframe.button_stretch, "LeftButton")
4 years ago
end
if (self._instance.baseframe.isMoving) then
3 years ago
move_janela(self._instance.baseframe, false, self._instance)
4 years ago
self._instance:SaveMainWindowPosition()
return
end
3 years ago
4 years ago
if (not self._instance.baseframe.isLocked and button == "LeftButton") then
3 years ago
move_janela(self._instance.baseframe, true, self._instance)
4 years ago
if (self.is_toolbar) then
if (self._instance.attribute_text.enabled and self._instance.attribute_text.side == 1 and self._instance.toolbar_side == 1) then
3 years ago
self._instance.menu_attribute_string:SetPoint("bottomleft", self._instance.baseframe.cabecalho.ball, "bottomright", self._instance.attribute_text.anchor [1]+1, self._instance.attribute_text.anchor [2]-1)
4 years ago
end
end
3 years ago
4 years ago
elseif (button == "RightButton") then
3 years ago
if (self.is_toolbar and not Details.disable_alldisplays_window) then
4 years ago
self._instance:ShowAllSwitch()
else
3 years ago
if (Details.switch.current_instancia and Details.switch.current_instancia == self._instance) then
Details.switch:CloseMe()
4 years ago
else
3 years ago
Details.switch:ShowMe(self._instance)
4 years ago
end
end
end
end
3 years ago
local BGFrame_scripts_onmouseup = function(self, button)
4 years ago
if (self.is_toolbar and self._instance.baseframe.isLocked and button == "LeftButton") then
if (DetailsWindowLockPopUp1 and DetailsWindowLockPopUp1:IsShown()) then
_G ["DetailsWindowLockPopUp1"]:Hide()
end
3 years ago
return self._instance.baseframe.button_stretch:GetScript("OnMouseUp") (self._instance.baseframe.button_stretch, "LeftButton")
4 years ago
end
3 years ago
4 years ago
if (self._instance.baseframe.isMoving) then
3 years ago
move_janela(self._instance.baseframe, false, self._instance) --novo movedor da janela
4 years ago
self._instance:SaveMainWindowPosition()
if (self.is_toolbar) then
if (self._instance.attribute_text.enabled and self._instance.attribute_text.side == 1 and self._instance.toolbar_side == 1) then
3 years ago
self._instance.menu_attribute_string:SetPoint("bottomleft", self._instance.baseframe.cabecalho.ball, "bottomright", self._instance.attribute_text.anchor [1], self._instance.attribute_text.anchor [2])
4 years ago
end
end
end
end
3 years ago
local function BGFrame_scripts(BG, baseframe, instancia)
4 years ago
BG._instance = instancia
3 years ago
BG:SetScript("OnEnter", BGFrame_scripts_onenter)
BG:SetScript("OnLeave", BGFrame_scripts_onleave)
BG:SetScript("OnMouseDown", BGFrame_scripts_onmousedown)
BG:SetScript("OnMouseUp", BGFrame_scripts_onmouseup)
4 years ago
end
3 years ago
function gump:RegisterForDetailsMove(frame, instancia)
frame:SetScript("OnMouseDown", function(frame, button)
4 years ago
if (not instancia.baseframe.isLocked and button == "LeftButton") then
3 years ago
move_janela(instancia.baseframe, true, instancia) --novo movedor da janela
4 years ago
end
end)
3 years ago
frame:SetScript("OnMouseUp", function(frame)
4 years ago
if (instancia.baseframe.isMoving) then
3 years ago
move_janela(instancia.baseframe, false, instancia) --novo movedor da janela
4 years ago
instancia:SaveMainWindowPosition()
end
3 years ago
end)
4 years ago
end
3 years ago
--scripts do base frame
local BFrame_scripts_onsizechange = function(self)
4 years ago
self._instance:SaveMainWindowSize()
self._instance:ReajustaGump()
self._instance.oldwith = self:GetWidth()
3 years ago
Details:SendEvent("DETAILS_INSTANCE_SIZECHANGED", nil, self._instance)
4 years ago
self._instance:RefreshAttributeTextSize()
end
3 years ago
local BFrame_scripts_onenter = function(self)
OnEnterMainWindow(self._instance, self)
4 years ago
end
3 years ago
local BFrame_scripts_onleave = function(self)
OnLeaveMainWindow(self._instance, self)
4 years ago
end
3 years ago
local BFrame_scripts_onmousedown = function(self, button)
4 years ago
if (not self.isLocked and button == "LeftButton") then
3 years ago
move_janela(self, true, self._instance)
4 years ago
end
end
3 years ago
local BFrame_scripts_onmouseup = function(self, button)
4 years ago
if (self.isMoving) then
3 years ago
move_janela(self, false, self._instance) --novo movedor da janela
4 years ago
self._instance:SaveMainWindowPosition()
end
end
local function BFrame_scripts (baseframe, instancia)
baseframe._instance = instancia
baseframe:SetScript("OnSizeChanged", BFrame_scripts_onsizechange)
baseframe:SetScript("OnEnter", BFrame_scripts_onenter)
baseframe:SetScript("OnLeave", BFrame_scripts_onleave)
3 years ago
baseframe:SetScript("OnMouseDown", BFrame_scripts_onmousedown)
baseframe:SetScript("OnMouseUp", BFrame_scripts_onmouseup)
4 years ago
end
local function backgrounddisplay_scripts (backgrounddisplay, baseframe, instancia)
3 years ago
backgrounddisplay:SetScript("OnEnter", function(self)
OnEnterMainWindow(instancia, self)
4 years ago
end)
3 years ago
backgrounddisplay:SetScript("OnLeave", function(self)
OnLeaveMainWindow(instancia, self)
4 years ago
end)
end
local function instancias_horizontais (instancia, largura, esquerda, direita)
if (esquerda) then
3 years ago
for lado, esta_instancia in pairs(instancia.snap) do
if (lado == 1) then --movendo para esquerda
local instancia = Details.tabela_instancias [esta_instancia]
instancia.baseframe:SetWidth(largura)
4 years ago
instancia.auto_resize = true
instancia:ReajustaGump()
instancia.auto_resize = false
instancias_horizontais (instancia, largura, true, false)
3 years ago
Details:SendEvent("DETAILS_INSTANCE_SIZECHANGED", nil, instancia)
4 years ago
end
end
end
3 years ago
4 years ago
if (direita) then
3 years ago
for lado, esta_instancia in pairs(instancia.snap) do
if (lado == 3) then --movendo para esquerda
local instancia = Details.tabela_instancias [esta_instancia]
instancia.baseframe:SetWidth(largura)
4 years ago
instancia.auto_resize = true
instancia:ReajustaGump()
instancia.auto_resize = false
instancias_horizontais (instancia, largura, false, true)
3 years ago
Details:SendEvent("DETAILS_INSTANCE_SIZECHANGED", nil, instancia)
4 years ago
end
end
end
end
local function instancias_verticais (instancia, altura, esquerda, direita)
if (esquerda) then
3 years ago
for lado, esta_instancia in pairs(instancia.snap) do
if (lado == 1) then --movendo para esquerda
local instancia = Details.tabela_instancias [esta_instancia]
4 years ago
if (instancia:IsEnabled()) then
3 years ago
instancia.baseframe:SetHeight(altura)
4 years ago
instancia.auto_resize = true
instancia:ReajustaGump()
instancia.auto_resize = false
instancias_verticais (instancia, altura, true, false)
3 years ago
Details:SendEvent("DETAILS_INSTANCE_SIZECHANGED", nil, instancia)
4 years ago
end
end
end
end
3 years ago
4 years ago
if (direita) then
3 years ago
for lado, esta_instancia in pairs(instancia.snap) do
if (lado == 3) then --movendo para esquerda
local instancia = Details.tabela_instancias [esta_instancia]
4 years ago
if (instancia:IsEnabled()) then
3 years ago
instancia.baseframe:SetHeight(altura)
4 years ago
instancia.auto_resize = true
instancia:ReajustaGump()
instancia.auto_resize = false
instancias_verticais (instancia, altura, false, true)
3 years ago
Details:SendEvent("DETAILS_INSTANCE_SIZECHANGED", nil, instancia)
4 years ago
end
end
end
end
end
3 years ago
local check_snap_side = function(instanceid, snap, id, container)
local instance = Details:GetInstance(instanceid)
4 years ago
if (instance and instance.snap [snap] and instance.snap [snap] == id) then
3 years ago
tinsert(container, instance)
4 years ago
return true
end
end
3 years ago
function Details:InstanciasVerticais(instance)
4 years ago
instance = self or instance
3 years ago
4 years ago
local on_top = {}
local on_bottom = {}
local id = instance:GetId()
3 years ago
4 years ago
--lower instances
3 years ago
local this_instance = Details:GetInstance(id-1)
4 years ago
if (this_instance) then
3 years ago
--top side
4 years ago
if (this_instance.snap [2] and this_instance.snap [2] == id) then
local cid = id
local snapid = 2
for i = cid-1, 1, -1 do
if (check_snap_side (i, 2, cid, on_top)) then
cid = cid - 1
else
break
end
end
3 years ago
--bottom side
4 years ago
elseif (this_instance.snap [4] and this_instance.snap [4] == id) then
local cid = id
local snapid = 4
for i = cid-1, 1, -1 do
if (check_snap_side (i, 4, cid, on_bottom)) then
cid = cid - 1
else
break
end
end
end
end
--upper instances
3 years ago
local this_instance = Details:GetInstance(id+1)
4 years ago
if (this_instance) then
3 years ago
--top side
4 years ago
if (this_instance.snap [2] and this_instance.snap [2] == id) then
local cid = id
local snapid = 2
3 years ago
for i = cid+1, Details:GetNumInstancesAmount() do
4 years ago
if (check_snap_side (i, 2, cid, on_top)) then
cid = cid + 1
else
break
end
end
3 years ago
--bottom side
4 years ago
elseif (this_instance.snap [4] and this_instance.snap [4] == id) then
local cid = id
local snapid = 4
3 years ago
for i = cid+1, Details:GetNumInstancesAmount() do
4 years ago
if (check_snap_side (i, 4, cid, on_bottom)) then
cid = cid + 1
else
break
end
end
end
end
3 years ago
--calc top clamp
4 years ago
local top_clamp = 0
local bottom_clamp = 0
3 years ago
4 years ago
if (instance.toolbar_side == 1) then
top_clamp = top_clamp + 20
elseif (instance.toolbar_side == 2) then
bottom_clamp = bottom_clamp + 20
end
if (instance.show_statusbar) then
bottom_clamp = bottom_clamp + 14
end
3 years ago
for cid, this_instance in ipairs(on_top) do
4 years ago
if (this_instance.show_statusbar) then
top_clamp = top_clamp + 14
end
top_clamp = top_clamp + 20
top_clamp = top_clamp + this_instance.baseframe:GetHeight()
end
3 years ago
for cid, this_instance in ipairs(on_bottom) do
4 years ago
if (this_instance.show_statusbar) then
bottom_clamp = bottom_clamp + 14
end
bottom_clamp = bottom_clamp + 20
bottom_clamp = bottom_clamp + this_instance.baseframe:GetHeight()
3 years ago
tinsert(on_top, this_instance)
4 years ago
end
return on_top, bottom_clamp, top_clamp
end
--[[
lado 4
-----------------------------------------
| |
lado 1 | | lado 3
| |
| |
-----------------------------------------
lado 2
--]]
3 years ago
function Details:InstanciasHorizontais(instancia)
4 years ago
instancia = self or instancia
local linha_horizontal, esquerda, direita = {}, 0, 0
3 years ago
4 years ago
local top, bottom = 0, 0
local checking = instancia
3 years ago
local check_index_anterior = Details.tabela_instancias [instancia.meu_id-1]
if (check_index_anterior and check_index_anterior:IsEnabled()) then --possiu uma inst�ncia antes de mim
if (check_index_anterior.snap[3] and check_index_anterior.snap[3] == instancia.meu_id) then --o index negativo vai para a esquerda
for i = instancia.meu_id-1, 1, -1 do
local esta_instancia = Details.tabela_instancias [i]
4 years ago
if (esta_instancia.snap[3]) then
if (esta_instancia.snap[3] == checking.meu_id) then
linha_horizontal [#linha_horizontal+1] = esta_instancia
esquerda = esquerda + esta_instancia.baseframe:GetWidth()
checking = esta_instancia
end
else
break
end
end
3 years ago
elseif (check_index_anterior.snap[1] and check_index_anterior.snap[1] == instancia.meu_id) then --o index negativo vai para a direita
for i = instancia.meu_id-1, 1, -1 do
local esta_instancia = Details.tabela_instancias [i]
4 years ago
if (esta_instancia.snap[1]) then
if (esta_instancia.snap[1] == checking.meu_id) then
linha_horizontal [#linha_horizontal+1] = esta_instancia
direita = direita + esta_instancia.baseframe:GetWidth()
checking = esta_instancia
end
else
break
end
end
end
end
3 years ago
4 years ago
checking = instancia
3 years ago
local check_index_posterior = Details.tabela_instancias [instancia.meu_id+1]
4 years ago
if (check_index_posterior and check_index_posterior:IsEnabled()) then
3 years ago
if (check_index_posterior.snap[3] and check_index_posterior.snap[3] == instancia.meu_id) then --o index posterior vai para a esquerda
for i = instancia.meu_id+1, #Details.tabela_instancias do
local esta_instancia = Details.tabela_instancias [i]
4 years ago
if (esta_instancia.snap[3]) then
if (esta_instancia.snap[3] == checking.meu_id) then
linha_horizontal [#linha_horizontal+1] = esta_instancia
esquerda = esquerda + esta_instancia.baseframe:GetWidth()
checking = esta_instancia
end
else
break
end
end
3 years ago
elseif (check_index_posterior.snap[1] and check_index_posterior.snap[1] == instancia.meu_id) then --o index posterior vai para a direita
for i = instancia.meu_id+1, #Details.tabela_instancias do
local esta_instancia = Details.tabela_instancias [i]
4 years ago
if (esta_instancia.snap[1]) then
if (esta_instancia.snap[1] == checking.meu_id) then
linha_horizontal [#linha_horizontal+1] = esta_instancia
direita = direita + esta_instancia.baseframe:GetWidth()
checking = esta_instancia
end
else
break
end
end
end
end
return linha_horizontal, esquerda, direita, bottom, top
3 years ago
4 years ago
end
local resizeTooltip = {
3 years ago
{text = "|cff33CC00Click|cffEEEEEE: ".. Loc["STRING_RESIZE_COMMON"]},
{text = "+|cff33CC00 Click|cffEEEEEE: " .. Loc["STRING_RESIZE_HORIZONTAL"]},
4 years ago
{icon = [[Interface\AddOns\Details\images\key_shift]], width = 24, height = 14, l = 0, r = 1, t = 0, b =0.640625},
3 years ago
{text = "+|cff33CC00 Click|cffEEEEEE: " .. Loc["STRING_RESIZE_VERTICAL"]},
4 years ago
{icon = [[Interface\AddOns\Details\images\key_alt]], width = 24, height = 14, l = 0, r = 1, t = 0, b =0.640625},
3 years ago
{text = "+|cff33CC00 Click|cffEEEEEE: " .. Loc["STRING_RESIZE_ALL"]},
4 years ago
{icon = [[Interface\AddOns\Details\images\key_ctrl]], width = 24, height = 14, l = 0, r = 1, t = 0, b =0.640625}
}
3 years ago
--search key: ~resizescript
4 years ago
3 years ago
local resize_scripts_onmousedown = function(self, button)
_G.GameCooltip:ShowMe(false) --Hide Cooltip
if (Details.disable_lock_ungroup_buttons) then
4 years ago
return
end
3 years ago
if (not self:GetParent().isLocked and button == "LeftButton" and self._instance.modo ~= Details._detalhes_props["MODO_ALONE"]) then
4 years ago
self:GetParent().isResizing = true
self._instance:BaseFrameSnap()
local isVertical = self._instance.verticalSnap
local isHorizontal = self._instance.horizontalSnap
3 years ago
4 years ago
local agrupadas
if (self._instance.verticalSnap) then
agrupadas = self._instance:InstanciasVerticais()
elseif (self._instance.horizontalSnap) then
agrupadas = self._instance:InstanciasHorizontais()
end
self._instance.stretchToo = agrupadas
if (self._instance.stretchToo and #self._instance.stretchToo > 0) then
3 years ago
for _, esta_instancia in ipairs(self._instance.stretchToo) do
4 years ago
esta_instancia.baseframe._place = esta_instancia:SaveMainWindowPosition()
esta_instancia.baseframe.isResizing = true
end
end
3 years ago
4 years ago
if (self._myside == "<") then
if (_IsShiftKeyDown()) then
self._instance.baseframe:StartSizing("left")
self._instance.eh_horizontal = true
3 years ago
4 years ago
elseif (_IsAltKeyDown()) then
self._instance.baseframe:StartSizing("top")
self._instance.eh_vertical = true
3 years ago
4 years ago
elseif (_IsControlKeyDown()) then
self._instance.baseframe:StartSizing("bottomleft")
self._instance.eh_tudo = true
3 years ago
4 years ago
else
self._instance.baseframe:StartSizing("bottomleft")
end
3 years ago
self:SetPoint("bottomleft", self._instance.baseframe, "bottomleft", -1, -1)
4 years ago
self.afundado = true
3 years ago
4 years ago
elseif (self._myside == ">") then
if (_IsShiftKeyDown()) then
3 years ago
self._instance.baseframe:StartSizing("right")
4 years ago
self._instance.eh_horizontal = true
3 years ago
4 years ago
elseif (_IsAltKeyDown()) then
3 years ago
self._instance.baseframe:StartSizing("top")
4 years ago
self._instance.eh_vertical = true
3 years ago
4 years ago
elseif (_IsControlKeyDown()) then
3 years ago
self._instance.baseframe:StartSizing("bottomright")
4 years ago
self._instance.eh_tudo = true
3 years ago
4 years ago
else
3 years ago
self._instance.baseframe:StartSizing("bottomright")
4 years ago
end
3 years ago
if (self._instance.rolagem and Details.use_scroll) then
self:SetPoint("bottomright", self._instance.baseframe, "bottomright", (self._instance.largura_scroll*-1) + 1, -1)
4 years ago
else
3 years ago
self:SetPoint("bottomright", self._instance.baseframe, "bottomright", 1, -1)
4 years ago
end
self.afundado = true
end
3 years ago
Details:SendEvent("DETAILS_INSTANCE_STARTRESIZE", nil, self._instance)
if (Details.update_speed > 0.3) then
Details:SetWindowUpdateSpeed(0.3, true)
Details.resize_changed_update_speed = true
4 years ago
end
3 years ago
end
4 years ago
end
3 years ago
local resizeScriptsOnMouseUp = function(self, button)
if (Details.disable_lock_ungroup_buttons) then
4 years ago
return
end
if (self.afundado) then
self.afundado = false
if (self._myside == ">") then
3 years ago
if (self._instance.rolagem and Details.use_scroll) then
self:SetPoint("bottomright", self._instance.baseframe, "bottomright", self._instance.largura_scroll*-1, 0)
4 years ago
else
3 years ago
self:SetPoint("bottomright", self._instance.baseframe, "bottomright", 0, 0)
4 years ago
end
else
3 years ago
self:SetPoint("bottomleft", self._instance.baseframe, "bottomleft", 0, 0)
4 years ago
end
end
3 years ago
if (self:GetParent().isResizing) then
4 years ago
self:GetParent():StopMovingOrSizing()
self:GetParent().isResizing = false
3 years ago
4 years ago
self._instance:RefreshBars()
self._instance:InstanceReset()
self._instance:ReajustaGump()
3 years ago
4 years ago
if (self._instance.stretchToo and #self._instance.stretchToo > 0) then
3 years ago
for _, esta_instancia in ipairs(self._instance.stretchToo) do
4 years ago
esta_instancia.baseframe:StopMovingOrSizing()
esta_instancia.baseframe.isResizing = false
esta_instancia:RefreshBars()
esta_instancia:InstanceReset()
esta_instancia:ReajustaGump()
3 years ago
Details:SendEvent("DETAILS_INSTANCE_SIZECHANGED", nil, esta_instancia)
4 years ago
end
self._instance.stretchToo = nil
3 years ago
end
4 years ago
local largura = self._instance.baseframe:GetWidth()
local altura = self._instance.baseframe:GetHeight()
3 years ago
4 years ago
if (self._instance.eh_horizontal) then
3 years ago
instancias_horizontais(self._instance, largura, true, true)
4 years ago
self._instance.eh_horizontal = nil
end
3 years ago
4 years ago
--if (instancia.eh_vertical) then
3 years ago
instancias_verticais(self._instance, altura, true, true)
4 years ago
self._instance.eh_vertical = nil
--end
3 years ago
Details:SendEvent("DETAILS_INSTANCE_ENDRESIZE", nil, self._instance)
4 years ago
if (self._instance.eh_tudo) then
3 years ago
for _, esta_instancia in ipairs(Details.tabela_instancias) do
if (esta_instancia:IsAtiva() and esta_instancia.modo ~= Details._detalhes_props["MODO_ALONE"]) then
4 years ago
esta_instancia.baseframe:ClearAllPoints()
esta_instancia:SaveMainWindowPosition()
esta_instancia:RestoreMainWindowPosition()
end
end
3 years ago
for _, esta_instancia in ipairs(Details.tabela_instancias) do
if (esta_instancia:IsAtiva() and esta_instancia ~= self._instance and esta_instancia.modo ~= Details._detalhes_props["MODO_ALONE"]) then
esta_instancia.baseframe:SetWidth(largura)
esta_instancia.baseframe:SetHeight(altura)
4 years ago
esta_instancia.auto_resize = true
esta_instancia:RefreshBars()
esta_instancia:InstanceReset()
esta_instancia:ReajustaGump()
esta_instancia.auto_resize = false
3 years ago
Details:SendEvent("DETAILS_INSTANCE_SIZECHANGED", nil, esta_instancia)
4 years ago
end
end
self._instance.eh_tudo = nil
end
3 years ago
4 years ago
self._instance:BaseFrameSnap()
3 years ago
for _, esta_instancia in ipairs(Details.tabela_instancias) do
4 years ago
if (esta_instancia:IsAtiva()) then
esta_instancia:SaveMainWindowPosition()
esta_instancia:RestoreMainWindowPosition()
end
end
3 years ago
if (Details.resize_changed_update_speed) then
Details:SetWindowUpdateSpeed(false, true)
Details.resize_changed_update_speed = nil
4 years ago
end
3 years ago
end
4 years ago
end
3 years ago
local resizeScriptsOnHide = function(self)
4 years ago
if (self.going_hide) then
3 years ago
_G.GameCooltip:ShowMe(false)
4 years ago
self.going_hide = nil
end
end
3 years ago
local resizeScriptsOnEnter = function(self)
if (Details.disable_lock_ungroup_buttons) then
4 years ago
return
end
3 years ago
if (self._instance.modo ~= Details._detalhes_props["MODO_ALONE"] and not self._instance.baseframe.isLocked and not self.mostrando) then
OnEnterMainWindow(self._instance, self)
4 years ago
3 years ago
self.texture:SetBlendMode("ADD")
4 years ago
self.mostrando = true
3 years ago
Details:CooltipPreset(2.1)
GameCooltip:AddFromTable(resizeTooltip)
GameCooltip:SetOwner(self)
4 years ago
GameCooltip:ShowCooltip()
end
end
3 years ago
local resizeScriptsOnLeave = function(self)
4 years ago
if (self.mostrando) then
self.going_hide = true
if (not self.movendo) then
3 years ago
OnLeaveMainWindow(self._instance, self)
4 years ago
end
3 years ago
self.texture:SetBlendMode("BLEND")
4 years ago
self.mostrando = false
3 years ago
GameCooltip:ShowMe(false)
4 years ago
end
end
3 years ago
local setWindowResizeScripts = function(resizer, instancia, scrollbar, side, baseframe)
4 years ago
resizer._instance = instancia
resizer._myside = side
3 years ago
resizer:SetScript("OnMouseDown", resize_scripts_onmousedown)
resizer:SetScript("OnMouseUp", resizeScriptsOnMouseUp)
resizer:SetScript("OnHide", resizeScriptsOnHide)
resizer:SetScript("OnEnter", resizeScriptsOnEnter)
resizer:SetScript("OnLeave", resizeScriptsOnLeave)
4 years ago
end
local lockButtonTooltip = {
3 years ago
{text = Loc["STRING_LOCK_DESC"]},
4 years ago
{icon = [[Interface\PetBattles\PetBattle-LockIcon]], width = 14, height = 14, l = 0.0703125, r = 0.9453125, t = 0.0546875, b = 0.9453125, color = "orange"},
}
3 years ago
local lockFunctionOnEnter = function(self)
if (Details.disable_lock_ungroup_buttons) then
4 years ago
return
end
3 years ago
if (self.instancia.modo ~= Details._detalhes_props["MODO_ALONE"] and not self.mostrando) then
OnEnterMainWindow(self.instancia, self)
4 years ago
self.mostrando = true
3 years ago
self.label:SetTextColor(1, 1, 1, .6)
Details:CooltipPreset(2.1)
GameCooltip:SetOption("FixedWidth", 180)
GameCooltip:AddFromTable(lockButtonTooltip)
4 years ago
3 years ago
GameCooltip:SetOwner(self)
4 years ago
GameCooltip:ShowCooltip()
end
end
3 years ago
local lockFunctionOnLeave = function(self)
4 years ago
if (self.mostrando) then
self.going_hide = true
3 years ago
OnLeaveMainWindow(self.instancia, self)
self.label:SetTextColor(.6, .6, .6, .7)
4 years ago
self.mostrando = false
3 years ago
GameCooltip:ShowMe(false)
4 years ago
end
end
3 years ago
local lockFunctionOnHide = function(self)
4 years ago
if (self.going_hide) then
3 years ago
GameCooltip:ShowMe(false)
4 years ago
self.going_hide = nil
end
end
3 years ago
function Details:DelayOptionsRefresh(instance, noReopen)
4 years ago
if (_G.DetailsOptionsWindow and _G.DetailsOptionsWindow:IsShown()) then
3 years ago
Details:ScheduleTimer("OpenOptionsWindow", 0.1, {instance or _G.DetailsOptionsWindow.instance, noReopen})
4 years ago
end
end
3 years ago
function Details:RefreshLockedState()
4 years ago
if (not self.baseframe and self.meu_id and self:IsEnabled()) then
3 years ago
self:ScheduleTimer("RefreshLockedState", 1)
4 years ago
return
elseif (not self.baseframe) then
return
end
3 years ago
4 years ago
if (self.baseframe.isLocked) then
3 years ago
self.baseframe.resize_direita:EnableMouse(false)
self.baseframe.resize_esquerda:EnableMouse(false)
4 years ago
else
3 years ago
self.baseframe.resize_direita:EnableMouse(true)
self.baseframe.resize_esquerda:EnableMouse(true)
4 years ago
end
3 years ago
4 years ago
return true
end
3 years ago
local lockFunctionOnClick = function(button, button_type, button2, isFromOptionsButton)
4 years ago
--isFromOptionsButton is true when the call if from the button in the display section of the options panel
3 years ago
if (Details.disable_lock_ungroup_buttons and isFromOptionsButton ~= true) then
4 years ago
return
end
if (not button:GetParent().instance) then
button = button2 --from any other button
end
local baseframe = button:GetParent()
if (baseframe.isLocked) then
baseframe.isLocked = false
baseframe.instance.isLocked = false
3 years ago
button.label:SetText(Loc["STRING_LOCK_WINDOW"])
button:SetWidth(button.label:GetStringWidth()+2)
if (not Details.disable_lock_ungroup_buttons) then
baseframe.resize_direita:SetAlpha(1)
baseframe.resize_esquerda:SetAlpha(1)
end
4 years ago
button:ClearAllPoints()
3 years ago
button:SetPoint("right", baseframe.resize_direita, "left", -1, 1.5)
4 years ago
else
3 years ago
--tutorial
if (not Details:GetTutorialCVar("WINDOW_LOCK_UNLOCK1") and not Details.initializing) then
Details:SetTutorialCVar ("WINDOW_LOCK_UNLOCK1", true)
local lock_tutorial = CreateFrame("frame", "DetailsWindowLockPopUp1", baseframe, "DetailsHelpBoxTemplate")
4 years ago
lock_tutorial.ArrowUP:Show()
lock_tutorial.ArrowGlowUP:Show()
3 years ago
lock_tutorial.Text:SetText(Loc["STRING_MINITUTORIAL_WINDOWS2"])
lock_tutorial:SetPoint("bottom", baseframe.UPFrame, "top", 0, 20)
4 years ago
lock_tutorial:Show()
3 years ago
end
4 years ago
baseframe.isLocked = true
baseframe.instance.isLocked = true
3 years ago
button.label:SetText(Loc["STRING_UNLOCK_WINDOW"])
button:SetWidth(button.label:GetStringWidth()+2)
4 years ago
button:ClearAllPoints()
3 years ago
button:SetPoint("bottomright", baseframe, "bottomright", -3, 0)
baseframe.resize_direita:SetAlpha(0)
baseframe.resize_esquerda:SetAlpha(0)
4 years ago
end
3 years ago
4 years ago
baseframe.instance:RefreshLockedState()
3 years ago
Details:DelayOptionsRefresh()
4 years ago
end
3 years ago
Details.lock_instance_function = lockFunctionOnClick
4 years ago
local unSnapButtonTooltip = {
3 years ago
{text = Loc["STRING_DETACH_DESC"]},
4 years ago
{icon = [[Interface\AddOns\Details\images\icons]], width = 14, height = 14, l = 160/512, r = 179/512, t = 142/512, b = 162/512},
}
3 years ago
local unSnapButtonOnEnter = function(self)
if (Details.disable_lock_ungroup_buttons) then
4 years ago
return
end
3 years ago
local haveSnap = false
for _, instancia_id in pairs(self.instancia.snap) do
4 years ago
if (instancia_id) then
3 years ago
haveSnap = true
4 years ago
break
end
end
3 years ago
if (not haveSnap) then
OnEnterMainWindow(self.instancia, self)
4 years ago
self.mostrando = true
return
end
3 years ago
OnEnterMainWindow(self.instancia, self)
4 years ago
self.mostrando = true
3 years ago
Details:CooltipPreset(2.1)
GameCooltip:SetOption("FixedWidth", 180)
GameCooltip:AddFromTable(unSnapButtonTooltip)
GameCooltip:ShowCooltip(self, "tooltip")
4 years ago
end
3 years ago
local unSnapButtonOnLeave = function(self)
4 years ago
if (self.mostrando) then
3 years ago
OnLeaveMainWindow(self.instancia, self)
4 years ago
self.mostrando = false
GameCooltip:Hide()
end
end
3 years ago
--this should run only when the mouse is over a instance bar
local shiftMonitor = function(self)
4 years ago
if (not self:IsMouseOver()) then
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
return
end
if (_IsShiftKeyDown()) then
if (not self.showing_allspells) then
self.showing_allspells = true
3 years ago
local instancia = Details:GetInstance(self.instance_id)
instancia:MontaTooltip(self, self.row_id, "shift")
4 years ago
end
3 years ago
4 years ago
elseif (self.showing_allspells) then
self.showing_allspells = false
3 years ago
local instancia = Details:GetInstance(self.instance_id)
instancia:MontaTooltip(self, self.row_id)
4 years ago
end
3 years ago
4 years ago
if (_IsControlKeyDown()) then
if (not self.showing_alltargets) then
self.showing_alltargets = true
3 years ago
local instancia = Details:GetInstance(self.instance_id)
instancia:MontaTooltip(self, self.row_id, "ctrl")
4 years ago
end
3 years ago
4 years ago
elseif (self.showing_alltargets) then
self.showing_alltargets = false
3 years ago
local instancia = Details:GetInstance(self.instance_id)
instancia:MontaTooltip(self, self.row_id)
4 years ago
end
3 years ago
4 years ago
if (_IsAltKeyDown()) then
if (not self.showing_allpets) then
self.showing_allpets = true
3 years ago
local instancia = Details:GetInstance(self.instance_id)
instancia:MontaTooltip(self, self.row_id, "alt")
4 years ago
end
3 years ago
4 years ago
elseif (self.showing_allpets) then
self.showing_allpets = false
3 years ago
local instancia = Details:GetInstance(self.instance_id)
instancia:MontaTooltip(self, self.row_id)
4 years ago
end
end
local barra_backdrop_onenter = {
3 years ago
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
4 years ago
tile = true, tileSize = 16,
insets = {left = 1, right = 1, top = 0, bottom = 1}
}
3 years ago
4 years ago
local barra_backdrop_onleave = {
3 years ago
bgFile = "",
4 years ago
edgeFile = "", tile = true, tileSize = 16, edgeSize = 32,
insets = {left = 1, right = 1, top = 0, bottom = 1}
}
3 years ago
--pre creating the truncate frame
Details.left_anti_truncate = CreateFrame("frame", "DetailsLeftTextAntiTruncate", UIParent,"BackdropTemplate")
Details.left_anti_truncate:SetBackdrop(defaultBackdropSt)
Details.left_anti_truncate:SetBackdropColor(0, 0, 0, 0.8)
Details.left_anti_truncate:SetFrameStrata("FULLSCREEN")
Details.left_anti_truncate.text = Details.left_anti_truncate:CreateFontString(nil, "overlay", "GameFontNormal")
Details.left_anti_truncate.text:SetPoint("left", Details.left_anti_truncate, "left", 3, 0)
4 years ago
3 years ago
--@self: instance line (row)
local lineScript_Onenter = function(self)
4 years ago
self.mouse_over = true
3 years ago
OnEnterMainWindow(self._instance, self)
4 years ago
3 years ago
self._instance:MontaTooltip(self, self.row_id)
4 years ago
3 years ago
self:SetBackdrop(barra_backdrop_onenter)
self:SetBackdropColor(0.588, 0.588, 0.588, 0.7)
if (not Details.instances_disable_bar_highlight) then
self.textura:SetBlendMode("ADD")
4 years ago
end
local lefttext = self.lineText1
if (lefttext:IsTruncated()) then
3 years ago
if (not Details.left_anti_truncate) then
end
Details:SetFontSize(Details.left_anti_truncate.text, self._instance.row_info.font_size)
Details:SetFontFace(Details.left_anti_truncate.text, self._instance.row_info.font_face_file)
Details:SetFontColor(Details.left_anti_truncate.text, lefttext:GetTextColor())
Details.left_anti_truncate:SetPoint("left", lefttext, "left", -3, 0)
Details.left_anti_truncate.text:SetText(lefttext:GetText())
Details.left_anti_truncate:SetSize(Details.left_anti_truncate.text:GetStringWidth() + 3, self._instance.row_info.height)
Details.left_anti_truncate:Show()
4 years ago
lefttext.untruncated = true
end
3 years ago
self:SetScript("OnUpdate", shiftMonitor)
local classIcon = self:GetClassIcon()
self.iconHighlight:SetTexture(classIcon:GetTexture())
self.iconHighlight:SetTexCoord(classIcon:GetTexCoord())
self.iconHighlight:SetVertexColor(classIcon:GetVertexColor())
self.iconHighlight:SetBlendMode("ADD")
self.iconHighlight:SetAlpha(0.3)
self.iconHighlight:Show()
4 years ago
end
3 years ago
local lineScript_Onleave = function(self)
4 years ago
self.mouse_over = false
3 years ago
OnLeaveMainWindow(self._instance, self)
4 years ago
--_GameTooltip:Hide()
3 years ago
GameCooltip:ShowMe(false)
self:SetBackdrop(barra_backdrop_onleave)
self:SetBackdropBorderColor(0, 0, 0, 0)
self:SetBackdropColor(0, 0, 0, 0)
self.textura:SetBlendMode("BLEND")
4 years ago
self.showing_allspells = false
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
local lefttext = self.lineText1
if (lefttext.untruncated) then
lefttext.untruncated = nil
3 years ago
Details.left_anti_truncate:Hide()
4 years ago
end
3 years ago
self.iconHighlight:Hide()
4 years ago
end
3 years ago
local lineScript_Onmousedown = function(self, button)
4 years ago
if (self.fading_in) then
return
end
3 years ago
4 years ago
local lefttext = self.lineText1
if (lefttext.untruncated) then
lefttext.untruncated = nil
3 years ago
Details.left_anti_truncate:Hide()
4 years ago
end
3 years ago
4 years ago
if (button == "RightButton") then
3 years ago
return Details.switch:ShowMe(self._instance)
4 years ago
elseif (button == "LeftButton") then
end
3 years ago
4 years ago
self._instance:HandleTextsOnMouseClick (self, "down")
3 years ago
self.mouse_down = GetTime()
4 years ago
self.button = button
local x, y = _GetCursorPosition()
3 years ago
self.x = floor(x)
self.y = floor(y)
4 years ago
if (not self._instance.baseframe.isLocked) then
GameCooltip:Hide()
3 years ago
move_janela(self._instance.baseframe, true, self._instance)
4 years ago
end
end
3 years ago
local lineScript_Onmouseup = function(self, button)
4 years ago
local is_shift_down = _IsShiftKeyDown()
local is_control_down = _IsControlKeyDown()
if (self._instance.baseframe.isMoving) then
3 years ago
move_janela(self._instance.baseframe, false, self._instance)
4 years ago
self._instance:SaveMainWindowPosition()
3 years ago
if (self._instance:MontaTooltip(self, self.row_id)) then
4 years ago
GameCooltip:Show (self, 1)
end
end
self._instance:HandleTextsOnMouseClick (self, "up")
3 years ago
4 years ago
local x, y = _GetCursorPosition()
3 years ago
x = floor(x)
y = floor(y)
4 years ago
3 years ago
if (self.mouse_down and (self.mouse_down+0.4 > GetTime() and (x == self.x and y == self.y)) or (x == self.x and y == self.y)) then
4 years ago
if (self.button == "LeftButton" or self.button == "MiddleButton") then
3 years ago
if (self._instance.atributo == 5 or is_shift_down) then
--report
4 years ago
if (self._instance.atributo == 5 and is_shift_down) then
local custom = self._instance:GetCustomObject()
if (custom and custom.on_shift_click) then
local func = loadstring (custom.on_shift_click)
if (func) then
3 years ago
local successful, errortext = pcall(func, self, self.minha_tabela, self._instance)
4 years ago
if (not successful) then
3 years ago
Details:Msg("error occurred custom script shift+click:", errortext)
4 years ago
end
return
end
end
end
3 years ago
if (Details.row_singleclick_overwrite [self._instance.atributo] and type(Details.row_singleclick_overwrite [self._instance.atributo][self._instance.sub_atributo]) == "function") then
return Details.row_singleclick_overwrite [self._instance.atributo][self._instance.sub_atributo] (_, self.minha_tabela, self._instance, is_shift_down, is_control_down)
4 years ago
end
3 years ago
return Details:ReportSingleLine (self._instance, self)
4 years ago
end
if (not self.minha_tabela) then
3 years ago
return Details:Msg("this bar is waiting update.")
4 years ago
end
3 years ago
4 years ago
self._instance:AbreJanelaInfo (self.minha_tabela, nil, nil, is_shift_down, is_control_down)
end
end
end
3 years ago
local lineScript_Onclick = function(self, button)
4 years ago
end
3 years ago
local lineScript_Onshow = function(self)
--search key: ~model
4 years ago
if (self.using_upper_3dmodels) then
3 years ago
self.modelbox_high:SetModel(self._instance.row_info.models.upper_model)
self.modelbox_high:SetAlpha(self._instance.row_info.models.upper_alpha)
4 years ago
end
3 years ago
4 years ago
if (self.using_lower_3dmodels) then
3 years ago
self.modelbox_low:SetModel(self._instance.row_info.models.lower_model)
self.modelbox_low:SetAlpha(self._instance.row_info.models.lower_alpha)
4 years ago
end
end
3 years ago
function Details:HandleTextsOnMouseClick(row, type)
4 years ago
if (self.bars_inverted) then
if (type == "down") then
3 years ago
row.lineText4:SetPoint("left", row.statusbar, "left", 2, -1)
4 years ago
if (self.row_info.no_icon) then
3 years ago
row.lineText1:SetPoint("right", row.statusbar, "right", -1, -1)
4 years ago
else
3 years ago
row.lineText1:SetPoint("right", row.icone_classe, "left", -1, -1)
4 years ago
end
3 years ago
4 years ago
elseif (type == "up") then
3 years ago
row.lineText4:SetPoint("left", row.statusbar, "left", 1, 0)
4 years ago
if (self.row_info.no_icon) then
3 years ago
row.lineText1:SetPoint("right", row.statusbar, "right", -2, 0)
4 years ago
else
3 years ago
row.lineText1:SetPoint("right", row.icone_classe, "left", -2, 0)
4 years ago
end
end
else
if (type == "down") then
3 years ago
row.lineText4:SetPoint("right", row.statusbar, "right", 1, -1)
4 years ago
if (self.row_info.no_icon) then
3 years ago
row.lineText1:SetPoint("left", row.statusbar, "left", 3, -1)
4 years ago
else
3 years ago
row.lineText1:SetPoint("left", row.icone_classe, "right", 4, -1)
4 years ago
end
3 years ago
4 years ago
elseif (type == "up") then
3 years ago
row.lineText4:SetPoint("right", row.statusbar, "right")
4 years ago
if (self.row_info.no_icon) then
3 years ago
row.lineText1:SetPoint("left", row.statusbar, "left", 2, 0)
4 years ago
else
3 years ago
row.lineText1:SetPoint("left", row.icone_classe, "right", 3, 0)
4 years ago
end
end
end
end
3 years ago
local setBarValue = function(self, value)
value = Clamp(value, 0, 100)
self.statusbar:SetValue(value)
4 years ago
self.statusbar.value = value
if (self.using_upper_3dmodels) then
local width = self:GetWidth()
local p = (width / 100) * value
3 years ago
self.modelbox_high:SetPoint("bottomright", self, "bottomright", p - width, 0)
4 years ago
end
end
-- ~talent ~icon
--code for when hovering over the class/spec icon in the player bar
3 years ago
local iconFrame_OnEnter = function(self)
4 years ago
local actor = self.row.minha_tabela
if (actor) then
if (actor.frags) then
3 years ago
4 years ago
elseif (actor.is_custom or actor.byspell or actor.damage_spellid) then
local spellid = actor.damage_spellid or actor.id or actor[1]
if (spellid) then
3 years ago
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 10)
Details:GameTooltipSetSpellByID (spellid)
4 years ago
GameTooltip:Show()
end
3 years ago
4 years ago
elseif (actor.dead_at) then
3 years ago
elseif (actor.nome) then --ensure it's an actor table
4 years ago
local serial = actor.serial
local name = actor:name()
local class = actor:class()
3 years ago
local spec = Details.cached_specs[serial] or actor.spec
local talents = Details.cached_talents[serial]
local ilvl = Details.ilevel:GetIlvl(serial)
local iconSize = 20
local instance = Details:GetInstance(self.row.instance_id)
instance:BuildInstanceBarTooltip(self)
local classIcon, classL, classR, classT, classB = Details:GetClassIcon(class)
local specId, specName, specDescription, specIcon, specRole, specClass = DetailsFramework.GetSpecializationInfoByID(spec or 0) --thanks pas06
local specL, specR, specT, specB
if (specId) then
if (Details.class_specs_coords[specId]) then
specL, specR, specT, specB = unpack(Details.class_specs_coords[specId])
4 years ago
end
end
3 years ago
GameCooltip:AddLine(name, specName)
4 years ago
if (class == "UNKNOW" or class == "UNGROUPPLAYER") then
3 years ago
GameCooltip:AddIcon([[Interface\AddOns\Details\images\classes_small_alpha]], 1, 1, iconSize, iconSize, 0, 0.25, 0.75, 1)
4 years ago
else
3 years ago
GameCooltip:AddIcon([[Interface\AddOns\Details\images\classes_small_alpha]], 1, 1, iconSize, iconSize, classL, classR, classT, classB)
4 years ago
end
3 years ago
if (specL) then
GameCooltip:AddIcon([[Interface\AddOns\Details\images\spec_icons_normal_alpha]], 1, 2, iconSize, iconSize, specL, specR, specT, specB)
4 years ago
else
3 years ago
GameCooltip:AddIcon([[Interface\GossipFrame\IncompleteQuestIcon]], 1, 2, iconSize, iconSize)
4 years ago
end
3 years ago
Details:AddTooltipHeaderStatusbar()
local talentString = ""
if (talents and not (DetailsFramework.IsTBCWow() or DetailsFramework.IsWotLKWow())) then
4 years ago
for i = 1, #talents do
3 years ago
local talentID, talentName, texture, selected, available = GetTalentInfoByID(talents [i])
4 years ago
if (texture) then
3 years ago
talentString = talentString .. " |T" .. texture .. ":" .. 24 .. ":" .. 24 ..":0:0:64:64:4:60:4:60|t"
4 years ago
end
end
end
3 years ago
local gotInfo
local localizedItemLevelString = _G.STAT_AVERAGE_ITEM_LEVEL
4 years ago
if (ilvl) then
3 years ago
GameCooltip:AddLine(localizedItemLevelString .. ":" , ilvl and "|T:" .. 24 .. ":" .. 24 ..":0:0:64:64:4:60:4:60|t" .. floor(ilvl.ilvl) or "|T:" .. 24 .. ":" .. 24 ..":0:0:64:64:4:60:4:60|t ??") --Loc from GlobalStrings.lua
GameCooltip:AddIcon([[]], 1, 1, 1, 20)
Details:AddTooltipBackgroundStatusbar()
gotInfo = true
4 years ago
else
3 years ago
GameCooltip:AddLine(localizedItemLevelString .. ":" , 0)
GameCooltip:AddIcon([[]], 1, 1, 1, 20)
Details:AddTooltipBackgroundStatusbar()
gotInfo = true
end
local localizedTalentsString = _G.TALENTS
if (talentString ~= "") then
GameCooltip:AddLine(localizedTalentsString .. ":", talentString)
GameCooltip:AddIcon([[]], 1, 1, 1, 24)
Details:AddTooltipBackgroundStatusbar()
gotInfo = true
elseif (gotInfo) then
GameCooltip:AddLine(localizedTalentsString .. ":", Loc["STRING_QUERY_INSPECT_REFRESH"])
GameCooltip:AddIcon([[]], 1, 1, 1, 24)
Details:AddTooltipBackgroundStatusbar()
end
GameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_skyline]])
GameCooltip:SetOption("MinButtonHeight", 15)
GameCooltip:SetOption("IgnoreButtonAutoHeight", false)
4 years ago
local height = 66
3 years ago
if (not gotInfo) then
GameCooltip:AddLine(Loc["STRING_QUERY_INSPECT"], nil, 1, "orange")
GameCooltip:AddIcon([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, iconSize, 8/512, 70/512, 224/512, 306/512)
4 years ago
height = 54
end
local combat = instance:GetShowingCombat()
local diff = combat:GetDifficulty()
local attribute, subattribute = instance:GetDisplay()
3 years ago
--check if is a raid encounter and if is heroic or mythic
4 years ago
if (diff and (diff == 15 or diff == 16) and (attribute == 1 or attribute == 2)) then
3 years ago
local db = Details.OpenStorage()
4 years ago
if (db) then
3 years ago
local bestRank, encounterTable = Details.storage:GetBestFromPlayer(diff, combat:GetBossInfo().id, attribute == 1 and "damage" or "healing", name, true)
4 years ago
if (bestRank) then
3 years ago
--discover which are the player position in the guild rank
local playerTable, onEncounter, rankPosition = Details.storage:GetPlayerGuildRank(diff, combat:GetBossInfo().id, attribute == 1 and "damage" or "healing", name, true)
GameCooltip:AddLine("Best Score:", Details:ToK2((bestRank[1] or 0) / encounterTable.elapsed) .. " [|cFFFFFF00Rank: " .. (rankPosition or "#") .. "|r]", 1, "white")
Details:AddTooltipBackgroundStatusbar()
GameCooltip:AddLine("|TInterface\\TUTORIALFRAME\\UI-TUTORIAL-FRAME:14:12:0:1:512:512:8:70:224:306|t Open Rank", "|TInterface\\TUTORIALFRAME\\UI-TUTORIAL-FRAME:14:12:0:1:512:512:8:70:328:409|t Refresh Talents", 1, "white", "white")
Details:AddTooltipBackgroundStatusbar()
if (not gotInfo) then
4 years ago
height = height + 25
else
height = height + 31
end
end
end
end
local actorName = actor:GetName()
local RaiderIO = _G.RaiderIO
if (RaiderIO) then
local addedInfo = false
local playerName, playerRealm = actorName:match("(%w+)%-(%w+)")
playerName = playerName or actorName
playerRealm = playerRealm or GetRealmName()
local faction = actor.enemy and Details.faction_against or UnitFactionGroup("player")
faction = faction == "Horde" and 2 or 1
local rioProfile = RaiderIO.GetProfile(playerName, playerRealm, faction)
if (rioProfile and rioProfile.mythicKeystoneProfile) then
rioProfile = rioProfile.mythicKeystoneProfile
local previousScore = rioProfile.previousScore or 0
local currentScore = rioProfile.currentScore or 0
if (previousScore > currentScore) then
GameCooltip:AddLine("M+ Score:", previousScore .. " (|cFFFFDD11" .. currentScore .. "|r)", 1, "white")
addedInfo = true
else
GameCooltip:AddLine("M+ Score:", currentScore, 1, "white")
addedInfo = true
end
else
local dungeonPlayerInfo = C_PlayerInfo.GetPlayerMythicPlusRatingSummary(actorName)
if (dungeonPlayerInfo) then
local currentScore = dungeonPlayerInfo.currentSeasonScore or 0
if (currentScore > 0) then
GameCooltip:AddLine("M+ Score:", currentScore, 1, "white")
addedInfo = true
end
end
end
if (addedInfo) then
3 years ago
GameCooltip:AddIcon([[]], 1, 1, 1, 20)
Details:AddTooltipBackgroundStatusbar()
--increase frame height
height = height + 19
end
else
if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE and C_PlayerInfo) then --is retail?
local dungeonPlayerInfo = C_PlayerInfo.GetPlayerMythicPlusRatingSummary(actorName)
if (dungeonPlayerInfo) then
local currentScore = dungeonPlayerInfo.currentSeasonScore or 0
if (currentScore > 0) then
GameCooltip:AddLine("M+ Score:", currentScore, 1, "white")
3 years ago
GameCooltip:AddIcon([[]], 1, 1, 1, 20)
Details:AddTooltipBackgroundStatusbar()
--increase frame height
height = height + 19
end
3 years ago
end
4 years ago
end
end
3 years ago
GameCooltip:SetOption("FixedHeight", height)
4 years ago
GameCooltip:ShowCooltip()
3 years ago
4 years ago
self.unitname = name
self.showing = "actor"
end
end
end
3 years ago
local iconFrame_OnLeave = function(self)
4 years ago
GameCooltip:Hide()
3 years ago
4 years ago
if (GameTooltip and GameTooltip:IsShown()) then
GameTooltip:Hide()
end
3 years ago
4 years ago
if (self.row.icone_classe:GetTexture() ~= "") then
3 years ago
--self.row.icone_classe:SetSize(self.row.icone_classe:GetWidth()-1, self.row.icone_classe:GetWidth()-1)
--self.row.icone_classe:SetBlendMode("BLEND")
4 years ago
end
3 years ago
self.row.iconHighlight:Hide()
4 years ago
end
3 years ago
local icon_frame_events = Details:CreateEventListener()
4 years ago
function icon_frame_events:EnterCombat()
3 years ago
for anim, _ in pairs(Details.icon_animations.load.in_use) do
4 years ago
anim.anim:Stop()
anim:Hide()
3 years ago
tinsert(Details.icon_animations.load.available, anim)
4 years ago
anim.icon_frame.icon_animation = nil
anim.icon_frame = nil
end
3 years ago
wipe (Details.icon_animations.load.in_use)
4 years ago
end
3 years ago
icon_frame_events:RegisterEvent("COMBAT_PLAYER_ENTER", "EnterCombat")
4 years ago
3 years ago
function icon_frame_events:CancelAnim(anim)
local frame, timeout = unpack(anim)
4 years ago
3 years ago
if (Details.icon_animations.load.in_use[frame]) then
4 years ago
if (timeout) then
3 years ago
if (not frame.question_icon) then
frame.question_icon = frame.parent:GetParent():GetParent().border:CreateTexture(nil, "overlay")
frame.question_icon:SetTexture([[Interface\GossipFrame\ActiveLegendaryQuestIcon]])
frame.question_icon:SetSize(16, 16)
4 years ago
end
3 years ago
frame.question_icon:Show()
frame.question_icon:SetPoint("center", frame.parent, "center")
if (not Details.HideBarQuestionIcon) then
function Details:HideBarQuestionIcon(frame)
4 years ago
frame.question_icon:Hide()
end
end
3 years ago
Details:ScheduleTimer("HideBarQuestionIcon", 2, frame)
4 years ago
end
3 years ago
Details.icon_animations.load.in_use[frame] = nil
tinsert(Details.icon_animations.load.available, frame)
frame.anim:Stop()
frame:Hide()
frame.icon_frame.icon_animation = nil
frame.icon_frame = nil
4 years ago
end
end
3 years ago
local icon_frame_inspect_callback = function(guid, unitid, iconFrame)
if (iconFrame.icon_animation) then
iconFrame.icon_animation.anim:Stop()
iconFrame.icon_animation:Hide()
4 years ago
end
3 years ago
local inUse = Details.icon_animations.load.in_use[iconFrame.icon_animation]
if (inUse) then
tinsert(Details.icon_animations.load.available, iconFrame.icon_animation)
Details.icon_animations.load.in_use[iconFrame.icon_animation] = nil
4 years ago
end
3 years ago
if (iconFrame:IsMouseOver()) then
iconFrame_OnEnter(iconFrame)
4 years ago
end
3 years ago
if (iconFrame.icon_animation) then
iconFrame.icon_animation.icon_frame = nil
iconFrame.icon_animation = nil
4 years ago
end
end
local icon_frame_create_animation = function()
3 years ago
local f = CreateFrame("frame", nil, UIParent)
f:SetFrameStrata("FULLSCREEN")
4 years ago
f.anim = f:CreateAnimationGroup()
3 years ago
f.rotate = f.anim:CreateAnimation("Rotation")
f.rotate:SetDegrees(360)
f.rotate:SetDuration(2)
4 years ago
f.anim:SetLooping ("repeat")
3 years ago
local t = f:CreateTexture(nil, "overlay")
t:SetTexture([[Interface\COMMON\StreamCircle]])
t:SetAlpha(0.7)
4 years ago
t:SetAllPoints()
3 years ago
tinsert(Details.icon_animations.load.available, f)
4 years ago
end
3 years ago
local icon_frame_on_click_down = function(self)
4 years ago
local instanceID = self.instance_id
3 years ago
local instanceObject = Details:GetInstance(instanceID)
self:GetParent():GetParent().icone_classe:SetPoint("left", self:GetParent():GetParent(), "left", instanceObject.row_info.icon_offset[1] + 1, instanceObject.row_info.icon_offset[2] + -1)
4 years ago
end
3 years ago
local icon_frame_on_click_up = function(self, button)
4 years ago
local instanceID = self.instance_id
3 years ago
local instanceObject = Details:GetInstance(instanceID)
self:GetParent():GetParent().icone_classe:SetPoint("left", self:GetParent():GetParent(), "left", instanceObject.row_info.icon_offset[1], instanceObject.row_info.icon_offset[2])
4 years ago
if (button == "LeftButton") then
3 years ago
--open the rank panel
local instance = Details:GetInstance(self.row.instance_id)
4 years ago
if (instance) then
local attribute, subattribute = instance:GetDisplay()
local combat = instance:GetShowingCombat()
local diff = combat:GetDifficulty()
local bossInfo = combat:GetBossInfo()
3 years ago
4 years ago
if ((attribute == 1 or attribute == 2) and bossInfo) then --if bossInfo is nil, means the combat isn't a boss
3 years ago
local db = Details.OpenStorage()
4 years ago
if (db and bossInfo.id) then
3 years ago
local haveData = Details.storage:HaveDataForEncounter (diff, bossInfo.id, true) --attempt to index local 'bossInfo' (a nil value)
4 years ago
if (haveData) then
3 years ago
Details:OpenRaidHistoryWindow (bossInfo.zone, bossInfo.id, diff, attribute == 1 and "damage" or "healing", true, 1, false, 2)
4 years ago
end
end
end
end
return
end
3 years ago
if (Details.in_combat) then
Details:Msg(Loc["STRING_QUERY_INSPECT_FAIL1"])
4 years ago
return
end
3 years ago
4 years ago
if (self.showing == "actor") then
3 years ago
if (Details.ilevel.core:HasQueuedInspec (self.unitname)) then
--icon animation
local anim = tremove(Details.icon_animations.load.available)
4 years ago
if (not anim) then
icon_frame_create_animation()
3 years ago
anim = tremove(Details.icon_animations.load.available)
4 years ago
end
3 years ago
4 years ago
local f = anim
if (not f.question_icon) then
3 years ago
f.question_icon = self:GetParent():GetParent().border:CreateTexture(nil, "overlay")
f.question_icon:SetTexture([[Interface\GossipFrame\ActiveLegendaryQuestIcon]])
f.question_icon:SetSize(16, 16)
4 years ago
end
f.question_icon:ClearAllPoints()
3 years ago
f.question_icon:SetPoint("center", self, "center")
4 years ago
f.question_icon:Show()
3 years ago
if (not Details.HideBarQuestionIcon) then
function Details:HideBarQuestionIcon (frame)
4 years ago
frame.question_icon:Hide()
end
end
3 years ago
Details:ScheduleTimer("HideBarQuestionIcon", 1, f)
4 years ago
self.icon_animation = anim
anim.icon_frame = self
3 years ago
4 years ago
local pid
3 years ago
pid = icon_frame_events:ScheduleTimer("CancelAnim", 1, {anim})
Details.icon_animations.load.in_use [anim] = pid
4 years ago
anim.parent = self
3 years ago
4 years ago
return
end
3 years ago
local does_query = Details.ilevel.core:QueryInspect (self.unitname, icon_frame_inspect_callback, self)
4 years ago
if (self.icon_animation) then
return
end
3 years ago
--icon animation
local anim = tremove(Details.icon_animations.load.available)
4 years ago
if (not anim) then
icon_frame_create_animation()
3 years ago
anim = tremove(Details.icon_animations.load.available)
4 years ago
end
3 years ago
4 years ago
anim:Show()
3 years ago
anim:SetParent(self)
4 years ago
anim:ClearAllPoints()
3 years ago
anim:SetFrameStrata("TOOLTIP")
anim:SetPoint("center", self, "center")
anim:SetSize(self:GetWidth()*1.7, self:GetHeight()*1.7)
4 years ago
anim.anim:Play()
3 years ago
4 years ago
self.icon_animation = anim
anim.icon_frame = self
3 years ago
4 years ago
local pid
if (does_query) then
3 years ago
pid = icon_frame_events:ScheduleTimer("CancelAnim", 4, {anim, true})
4 years ago
else
3 years ago
pid = icon_frame_events:ScheduleTimer("CancelAnim", 0.2, {anim})
4 years ago
end
3 years ago
Details.icon_animations.load.in_use [anim] = pid
4 years ago
anim.parent = self
3 years ago
4 years ago
if (anim.question_icon) then
anim.question_icon:Hide()
end
end
end
3 years ago
local setFrameIconScripts = function(row)
row.icon_frame:SetScript("OnEnter", iconFrame_OnEnter)
row.icon_frame:SetScript("OnLeave", iconFrame_OnLeave)
row.icon_frame:SetScript("OnMouseDown", icon_frame_on_click_down)
row.icon_frame:SetScript("OnMouseUp", icon_frame_on_click_up)
4 years ago
end
3 years ago
local setLineScripts = function(line, instance, index)
line._instance = instance
line:SetScript("OnEnter", lineScript_Onenter)
line:SetScript("OnLeave", lineScript_Onleave)
line:SetScript("OnMouseDown", lineScript_Onmousedown)
line:SetScript("OnMouseUp", lineScript_Onmouseup)
line:SetScript("OnClick", lineScript_Onclick)
line:SetScript("OnShow", lineScript_Onshow)
4 years ago
3 years ago
setFrameIconScripts(line)
line.SetValue = setBarValue
4 years ago
end
3 years ago
function Details:ReportSingleLine (instancia, barra)
4 years ago
local reportar
3 years ago
if (instancia.atributo == 5) then --custom
--dump cooltip
4 years ago
local GameCooltip = GameCooltip
if (GameCooltipFrame1:IsShown()) then
local actor_name = barra.lineText1:GetText() or ""
3 years ago
actor_name = actor_name:gsub((".*%."), "")
4 years ago
if (instancia.segmento == -1) then --overall
3 years ago
reportar = {"Details!: " .. Loc["STRING_OVERALL"] .. " " .. instancia.customName .. ": " .. actor_name .. " " .. Loc["STRING_CUSTOM_REPORT"]}
4 years ago
else
3 years ago
reportar = {"Details!: " .. instancia.customName .. ": " .. actor_name .. " " .. Loc["STRING_CUSTOM_REPORT"]}
4 years ago
end
3 years ago
4 years ago
local amt = GameCooltip.Indexes
for i = 2, amt do
local left_text, right_text = GameCooltip:GetText (i)
reportar [#reportar+1] = (i-1) .. ". " .. left_text .. " ... " .. right_text
end
else
3 years ago
reportar = {"Details!: " .. instancia.customName .. ": " .. Loc["STRING_CUSTOM_REPORT"]}
4 years ago
reportar [#reportar+1] = barra.lineText1:GetText() .. " " .. barra.lineText4:GetText()
3 years ago
4 years ago
--reportar [#reportar+1] = (i-1) .. ". " .. left_text .. " ... " .. right_text
end
3 years ago
4 years ago
else
3 years ago
reportar = {"Details!: " .. Loc["STRING_REPORT"] .. " " .. Details.sub_atributos [instancia.atributo].lista [instancia.sub_atributo]}
4 years ago
reportar [#reportar+1] = barra.lineText1:GetText() .. " " .. barra.lineText4:GetText()
end
3 years ago
return Details:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true})
4 years ago
end
-- ~stretch
local function button_stretch_scripts (baseframe, backgrounddisplay, instancia)
local button = baseframe.button_stretch
3 years ago
button:SetScript("OnEnter", function(self)
4 years ago
self.mouse_over = true
3 years ago
if (not Details.disable_stretch_button) then
Details.FadeHandler.Fader(self, "ALPHA", 1)
4 years ago
end
end)
3 years ago
button:SetScript("OnLeave", function(self)
4 years ago
self.mouse_over = false
3 years ago
Details.FadeHandler.Fader(self, "ALPHA", 0)
end)
4 years ago
3 years ago
button:SetScript("OnMouseDown", function(self, button)
4 years ago
if (button ~= "LeftButton") then
return
end
3 years ago
4 years ago
if (instancia:IsSoloMode()) then
return
end
3 years ago
instancia:EsconderScrollBar(true)
4 years ago
baseframe._place = instancia:SaveMainWindowPosition()
baseframe.isResizing = true
baseframe.isStretching = true
3 years ago
baseframe:SetFrameStrata("TOOLTIP")
instancia.rowframe:SetFrameStrata("TOOLTIP")
4 years ago
local _r, _g, _b, _a = baseframe:GetBackdropColor()
gump:GradientEffect ( baseframe, "frame", _r, _g, _b, _a, _r, _g, _b, 0.9, 1.5)
if (instancia.wallpaper.enabled) then
_r, _g, _b = baseframe.wallpaper:GetVertexColor()
_a = baseframe.wallpaper:GetAlpha()
gump:GradientEffect (baseframe.wallpaper, "texture", _r, _g, _b, _a, _r, _g, _b, 0.05, 0.5)
end
3 years ago
4 years ago
if (instancia.stretch_button_side == 1) then
3 years ago
baseframe:StartSizing("top")
4 years ago
baseframe.stretch_direction = "top"
elseif (instancia.stretch_button_side == 2) then
3 years ago
baseframe:StartSizing("bottom")
4 years ago
baseframe.stretch_direction = "bottom"
end
3 years ago
4 years ago
local linha_horizontal = {}
3 years ago
4 years ago
local checking = instancia
3 years ago
for i = instancia.meu_id-1, 1, -1 do
local esta_instancia = Details.tabela_instancias [i]
4 years ago
if ((esta_instancia.snap[1] and esta_instancia.snap[1] == checking.meu_id) or (esta_instancia.snap[3] and esta_instancia.snap[3] == checking.meu_id)) then
linha_horizontal [#linha_horizontal+1] = esta_instancia
checking = esta_instancia
else
break
end
end
3 years ago
4 years ago
checking = instancia
3 years ago
for i = instancia.meu_id+1, #Details.tabela_instancias do
local esta_instancia = Details.tabela_instancias [i]
4 years ago
if ((esta_instancia.snap[1] and esta_instancia.snap[1] == checking.meu_id) or (esta_instancia.snap[3] and esta_instancia.snap[3] == checking.meu_id)) then
linha_horizontal [#linha_horizontal+1] = esta_instancia
checking = esta_instancia
else
break
end
end
3 years ago
4 years ago
instancia.stretchToo = linha_horizontal
if (#instancia.stretchToo > 0) then
3 years ago
for _, thisInstance in ipairs(instancia.stretchToo) do
thisInstance:EsconderScrollBar(true)
thisInstance.baseframe._place = thisInstance:SaveMainWindowPosition()
thisInstance.baseframe.isResizing = true
thisInstance.baseframe.isStretching = true
thisInstance.baseframe:SetFrameStrata("TOOLTIP")
thisInstance.rowframe:SetFrameStrata("TOOLTIP")
local _r, _g, _b, _a = thisInstance.baseframe:GetBackdropColor()
gump:GradientEffect(thisInstance.baseframe, "frame", _r, _g, _b, _a, _r, _g, _b, 0.9, 1.5)
Details:SendEvent("DETAILS_INSTANCE_STARTSTRETCH", nil, thisInstance)
if (thisInstance.wallpaper.enabled) then
_r, _g, _b = thisInstance.baseframe.wallpaper:GetVertexColor()
_a = thisInstance.baseframe.wallpaper:GetAlpha()
gump:GradientEffect(thisInstance.baseframe.wallpaper, "texture", _r, _g, _b, _a, _r, _g, _b, 0.05, 0.5)
4 years ago
end
end
end
3 years ago
Details:SnapTextures (true)
Details:SendEvent("DETAILS_INSTANCE_STARTSTRETCH", nil, instancia)
--change the update speed
if (Details.update_speed > 0.3) then
Details:SetWindowUpdateSpeed(0.3, true)
Details.stretch_changed_update_speed = true
4 years ago
end
3 years ago
4 years ago
end)
3 years ago
button:SetScript("OnMouseUp", function(self, button)
4 years ago
if (button ~= "LeftButton") then
return
end
3 years ago
4 years ago
if (instancia:IsSoloMode()) then
return
end
3 years ago
if (baseframe.isResizing) then
4 years ago
baseframe:StopMovingOrSizing()
baseframe.isResizing = false
instancia:RestoreMainWindowPosition (baseframe._place)
instancia:ReajustaGump()
baseframe.isStretching = false
if (instancia.need_rolagem) then
instancia:MostrarScrollBar (true)
end
3 years ago
Details:SendEvent("DETAILS_INSTANCE_SIZECHANGED", nil, instancia)
4 years ago
instancia:RefreshBars()
instancia:InstanceReset()
instancia:ReajustaGump()
3 years ago
4 years ago
baseframe.stretch_direction = nil
3 years ago
4 years ago
if (instancia.stretchToo and #instancia.stretchToo > 0) then
3 years ago
for _, esta_instancia in ipairs(instancia.stretchToo) do
4 years ago
esta_instancia.baseframe:StopMovingOrSizing()
esta_instancia.baseframe.isResizing = false
esta_instancia:RestoreMainWindowPosition (esta_instancia.baseframe._place)
esta_instancia:ReajustaGump()
esta_instancia.baseframe.isStretching = false
if (esta_instancia.need_rolagem) then
3 years ago
esta_instancia:MostrarScrollBar(true)
4 years ago
end
3 years ago
Details:SendEvent("DETAILS_INSTANCE_SIZECHANGED", nil, esta_instancia)
4 years ago
local _r, _g, _b, _a = esta_instancia.baseframe:GetBackdropColor()
3 years ago
gump:GradientEffect(esta_instancia.baseframe, "frame", _r, _g, _b, _a, instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha, 0.5)
4 years ago
if (esta_instancia.wallpaper.enabled) then
_r, _g, _b = esta_instancia.baseframe.wallpaper:GetVertexColor()
_a = esta_instancia.baseframe.wallpaper:GetAlpha()
3 years ago
gump:GradientEffect(esta_instancia.baseframe.wallpaper, "texture", _r, _g, _b, _a, _r, _g, _b, esta_instancia.wallpaper.alpha, 1.0)
4 years ago
end
3 years ago
esta_instancia.baseframe:SetFrameStrata(esta_instancia.strata)
esta_instancia.rowframe:SetFrameStrata(esta_instancia.strata)
4 years ago
esta_instancia:StretchButtonAlwaysOnTop()
3 years ago
Details:SendEvent("DETAILS_INSTANCE_ENDSTRETCH", nil, esta_instancia.baseframe)
4 years ago
esta_instancia:RefreshBars()
esta_instancia:InstanceReset()
esta_instancia:ReajustaGump()
end
instancia.stretchToo = nil
end
3 years ago
end
4 years ago
local _r, _g, _b, _a = baseframe:GetBackdropColor()
3 years ago
gump:GradientEffect(baseframe, "frame", _r, _g, _b, _a, instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha, 0.5)
4 years ago
if (instancia.wallpaper.enabled) then
_r, _g, _b = baseframe.wallpaper:GetVertexColor()
_a = baseframe.wallpaper:GetAlpha()
3 years ago
gump:GradientEffect(baseframe.wallpaper, "texture", _r, _g, _b, _a, _r, _g, _b, instancia.wallpaper.alpha, 1.0)
4 years ago
end
3 years ago
baseframe:SetFrameStrata(instancia.strata)
instancia.rowframe:SetFrameStrata(instancia.strata)
4 years ago
instancia:StretchButtonAlwaysOnTop()
3 years ago
Details:SnapTextures (false)
Details:SendEvent("DETAILS_INSTANCE_ENDSTRETCH", nil, instancia)
4 years ago
3 years ago
if (Details.stretch_changed_update_speed) then
Details:SetWindowUpdateSpeed(false, true)
Details.stretch_changed_update_speed = nil
end
end)
4 years ago
end
local function button_down_scripts (main_frame, backgrounddisplay, instancia, scrollbar)
3 years ago
main_frame.button_down:SetScript("OnMouseDown", function(self)
4 years ago
if (not scrollbar:IsEnabled()) then
return
end
3 years ago
4 years ago
local B = instancia.barraS[2]
if (B < instancia.rows_showing) then
3 years ago
scrollbar:SetValue(scrollbar:GetValue() + instancia.row_height)
4 years ago
end
3 years ago
4 years ago
self.precionado = true
self.last_up = -0.3
3 years ago
self:SetScript("OnUpdate", function(self, elapsed)
4 years ago
self.last_up = self.last_up + elapsed
if (self.last_up > 0.03) then
self.last_up = 0
B = instancia.barraS[2]
if (B < instancia.rows_showing) then
3 years ago
scrollbar:SetValue(scrollbar:GetValue() + instancia.row_height)
4 years ago
else
self:Disable()
end
end
end)
end)
3 years ago
main_frame.button_down:SetScript("OnMouseUp", function(self)
4 years ago
self.precionado = false
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
end)
end
local function button_up_scripts (main_frame, backgrounddisplay, instancia, scrollbar)
3 years ago
main_frame.button_up:SetScript("OnMouseDown", function(self)
4 years ago
if (not scrollbar:IsEnabled()) then
return
end
3 years ago
4 years ago
local A = instancia.barraS[1]
if (A > 1) then
3 years ago
scrollbar:SetValue(scrollbar:GetValue() - instancia.row_height*2)
4 years ago
end
3 years ago
4 years ago
self.precionado = true
self.last_up = -0.3
3 years ago
self:SetScript("OnUpdate", function(self, elapsed)
4 years ago
self.last_up = self.last_up + elapsed
if (self.last_up > 0.03) then
self.last_up = 0
A = instancia.barraS[1]
if (A > 1) then
3 years ago
scrollbar:SetValue(scrollbar:GetValue() + instancia.row_height*2)
4 years ago
else
self:Disable()
end
end
end)
end)
3 years ago
main_frame.button_up:SetScript("OnMouseUp", function(self)
4 years ago
self.precionado = false
3 years ago
self:SetScript("OnUpdate", nil)
end)
4 years ago
3 years ago
main_frame.button_up:SetScript("OnEnable", function(self)
4 years ago
local current = scrollbar:GetValue()
if (current == 0) then
main_frame.button_up:Disable()
end
end)
end
function DetailsKeyBindScrollUp()
3 years ago
local last_key_pressed = Details.KeyBindScrollUpLastPressed or GetTime()-0.3
4 years ago
local to_top = false
if (last_key_pressed+0.2 > GetTime()) then
to_top = true
end
3 years ago
Details.KeyBindScrollUpLastPressed = GetTime()
for index, instance in ipairs(Details.tabela_instancias) do
4 years ago
if (instance:IsEnabled()) then
3 years ago
4 years ago
local scrollbar = instance.scroll
3 years ago
4 years ago
local A = instance.barraS[1]
if (A and A > 1) then
if (to_top) then
3 years ago
scrollbar:SetValue(0)
4 years ago
scrollbar.ultimo = 0
instance.baseframe.button_up:Disable()
else
3 years ago
scrollbar:SetValue(scrollbar:GetValue() - instance.row_height*2)
4 years ago
end
elseif (A) then
3 years ago
scrollbar:SetValue(0)
4 years ago
scrollbar.ultimo = 0
instance.baseframe.button_up:Disable()
end
3 years ago
4 years ago
end
end
end
function DetailsKeyBindScrollDown()
3 years ago
for index, instance in ipairs(Details.tabela_instancias) do
4 years ago
if (instance:IsEnabled()) then
3 years ago
4 years ago
local scrollbar = instance.scroll
3 years ago
4 years ago
local B = instance.barraS[2]
if (B and B < instance.rows_showing) then
3 years ago
scrollbar:SetValue(scrollbar:GetValue() + instance.row_height*2)
4 years ago
elseif (B) then
local _, maxValue = scrollbar:GetMinMaxValues()
3 years ago
scrollbar:SetValue(maxValue)
4 years ago
scrollbar.ultimo = maxValue
instance.baseframe.button_down:Disable()
end
3 years ago
4 years ago
end
end
end
local function iterate_scroll_scripts (backgrounddisplay, backgroundframe, baseframe, scrollbar, instancia)
3 years ago
baseframe:SetScript("OnMouseWheel",
function(self, delta)
if (delta > 0) then --rolou pra cima
4 years ago
local A = instancia.barraS[1]
if (A) then
if (A > 1) then
3 years ago
scrollbar:SetValue(scrollbar:GetValue() - instancia.row_height * Details.scroll_speed)
4 years ago
else
3 years ago
scrollbar:SetValue(0)
4 years ago
scrollbar.ultimo = 0
baseframe.button_up:Disable()
end
end
3 years ago
elseif (delta < 0) then --rolou pra baixo
4 years ago
local B = instancia.barraS[2]
if (B) then
if (B < (instancia.rows_showing or 0)) then
3 years ago
scrollbar:SetValue(scrollbar:GetValue() + instancia.row_height * Details.scroll_speed)
4 years ago
else
local _, maxValue = scrollbar:GetMinMaxValues()
3 years ago
scrollbar:SetValue(maxValue)
4 years ago
scrollbar.ultimo = maxValue
baseframe.button_down:Disable()
end
end
end
end)
3 years ago
scrollbar:SetScript("OnValueChanged", function(self)
4 years ago
local ultimo = self.ultimo
local meu_valor = self:GetValue()
3 years ago
if (ultimo == meu_valor) then --n�o mudou
4 years ago
return
end
3 years ago
--shortcut
4 years ago
local minValue, maxValue = scrollbar:GetMinMaxValues()
if (minValue == meu_valor) then
instancia.barraS[1] = 1
instancia.barraS[2] = instancia.rows_fit_in_window
3 years ago
instancia:RefreshMainWindow(instancia, true)
4 years ago
self.ultimo = meu_valor
baseframe.button_up:Disable()
return
elseif (maxValue == meu_valor) then
local min = (instancia.rows_showing or 0) -instancia.rows_fit_in_window
min = min+1
if (min < 1) then
min = 1
end
instancia.barraS[1] = min
instancia.barraS[2] = (instancia.rows_showing or 0)
3 years ago
instancia:RefreshMainWindow(instancia, true)
4 years ago
self.ultimo = meu_valor
baseframe.button_down:Disable()
return
end
3 years ago
4 years ago
if (not baseframe.button_up:IsEnabled()) then
baseframe.button_up:Enable()
end
if (not baseframe.button_down:IsEnabled()) then
baseframe.button_down:Enable()
end
3 years ago
if (meu_valor > ultimo) then --scroll down
4 years ago
local B = instancia.barraS[2]
3 years ago
if (B < (instancia.rows_showing or 0)) then --se o valor maximo n�o for o m�ximo de barras a serem mostradas
4 years ago
local precisa_passar = ((B+1) * instancia.row_height) - (instancia.row_height*instancia.rows_fit_in_window)
3 years ago
--if (meu_valor > precisa_passar) then --o valor atual passou o valor que precisa passar pra locomover
if (true) then --testing by pass row check
local diff = meu_valor - ultimo --pega a diferen�a de H
diff = diff / instancia.row_height --calcula quantas barras ele pulou
diff = ceil(diff) --arredonda para cima
4 years ago
if (instancia.barraS[2]+diff > (instancia.rows_showing or 0) and ultimo > 0) then
instancia.barraS[1] = (instancia.rows_showing or 0) - (instancia.rows_fit_in_window-1)
instancia.barraS[2] = (instancia.rows_showing or 0)
else
instancia.barraS[2] = instancia.barraS[2]+diff
instancia.barraS[1] = instancia.barraS[1]+diff
end
3 years ago
instancia:RefreshMainWindow(instancia, true)
4 years ago
end
end
3 years ago
else --scroll up
4 years ago
local A = instancia.barraS[1]
if (A > 1) then
local precisa_passar = (A-1) * instancia.row_height
--if (meu_valor < precisa_passar) then
3 years ago
if (true) then --testing by pass row check
--calcula quantas barras passou
4 years ago
local diff = ultimo - meu_valor
diff = diff / instancia.row_height
3 years ago
diff = ceil(diff)
4 years ago
if (instancia.barraS[1]-diff < 1) then
instancia.barraS[2] = instancia.rows_fit_in_window
instancia.barraS[1] = 1
else
instancia.barraS[2] = instancia.barraS[2]-diff
instancia.barraS[1] = instancia.barraS[1]-diff
end
3 years ago
instancia:RefreshMainWindow(instancia, true)
4 years ago
end
end
end
self.ultimo = meu_valor
3 years ago
end)
4 years ago
end
3 years ago
function Details:HaveInstanceAlert()
4 years ago
return self.alert:IsShown()
end
3 years ago
function Details:InstanceAlertTime (instance)
4 years ago
instance.alert:Hide()
instance.alert.rotate:Stop()
instance.alert_time = nil
end
local hide_click_func = function()
--empty
end
3 years ago
function Details:InstanceAlert (msg, icon, timeInSeconds, clickfunc, doflash, forceAlert)
if (not forceAlert and Details.streamer_config.no_alerts) then
4 years ago
--return
end
3 years ago
4 years ago
if (not self.meu_id) then
3 years ago
local lower = Details:GetLowerInstanceNumber()
4 years ago
if (lower) then
3 years ago
self = Details:GetInstance(lower)
4 years ago
else
return
end
end
3 years ago
if (type(msg) == "boolean" and not msg) then
4 years ago
self.alert:Hide()
self.alert.rotate:Stop()
self.alert_time = nil
return
end
3 years ago
4 years ago
if (msg) then
3 years ago
self.alert.text:SetText(msg)
4 years ago
else
3 years ago
self.alert.text:SetText("")
4 years ago
end
3 years ago
4 years ago
if (icon) then
3 years ago
if (type(icon) == "table") then
local texture, w, h, animate, left, right, top, bottom, r, g, b, a = unpack(icon)
self.alert.icon:SetTexture(texture)
self.alert.icon:SetWidth(w or 14)
self.alert.icon:SetHeight(h or 14)
4 years ago
if (left and right and top and bottom) then
3 years ago
self.alert.icon:SetTexCoord(left, right, top, bottom)
4 years ago
end
if (animate) then
self.alert.rotate:Play()
end
if (r and g and b) then
3 years ago
self.alert.icon:SetVertexColor(r, g, b, a or 1)
4 years ago
end
else
3 years ago
self.alert.icon:SetWidth(14)
self.alert.icon:SetHeight(14)
self.alert.icon:SetTexture(icon)
self.alert.icon:SetVertexColor(1, 1, 1, 1)
self.alert.icon:SetTexCoord(0, 1, 0, 1)
4 years ago
end
else
3 years ago
self.alert.icon:SetTexture("")
4 years ago
end
3 years ago
4 years ago
self.alert.button.func = nil
wipe (self.alert.button.func_param)
3 years ago
4 years ago
if (clickfunc) then
self.alert.button.func = clickfunc[1]
3 years ago
self.alert.button.func_param = {unpack(clickfunc, 2)}
end
timeInSeconds = timeInSeconds or 15
self.alert_time = timeInSeconds
Details:ScheduleTimer("InstanceAlertTime", timeInSeconds, self)
self.alert:SetPoint("bottom", self.baseframe, "bottom", 0, -12)
self.alert:SetPoint("left", self.baseframe, "left", 3, 0)
self.alert:SetPoint("right", self.baseframe, "right", -3, 0)
self.alert:SetFrameStrata("TOOLTIP")
self.alert.button:SetFrameStrata("TOOLTIP")
4 years ago
self.alert:Show()
3 years ago
4 years ago
if (doflash) then
self.alert:DoFlash()
end
3 years ago
self.alert:Play()
4 years ago
end
3 years ago
local alert_on_click = function(self, button)
4 years ago
if (self.func) then
3 years ago
local okey, errortext = pcall(self.func, unpack(self.func_param))
4 years ago
if (not okey) then
3 years ago
Details:Msg("error on alert function:", errortext)
4 years ago
end
end
self:GetParent():Hide()
end
3 years ago
local function CreateAlertFrame(baseframe, instancia)
local frame_upper = CreateFrame("scrollframe", "DetailsAlertFrameScroll" .. instancia.meu_id, baseframe)
frame_upper:SetPoint("bottom", baseframe, "bottom")
frame_upper:SetPoint("left", baseframe, "left", 3, 0)
frame_upper:SetPoint("right", baseframe, "right", -3, 0)
frame_upper:SetHeight(13)
frame_upper:SetFrameStrata("TOOLTIP")
4 years ago
3 years ago
local frame_lower = CreateFrame("frame", "DetailsAlertFrameScrollChild" .. instancia.meu_id, frame_upper)
frame_lower:SetHeight(25)
frame_lower:SetPoint("left", frame_upper, "left")
frame_lower:SetPoint("right", frame_upper, "right")
frame_upper:SetScrollChild(frame_lower)
4 years ago
3 years ago
local alert_bg = CreateFrame("frame", "DetailsAlertFrame" .. instancia.meu_id, frame_lower,"BackdropTemplate")
alert_bg:SetPoint("bottom", baseframe, "bottom")
alert_bg:SetPoint("left", baseframe, "left", 3, 0)
alert_bg:SetPoint("right", baseframe, "right", -3, 0)
alert_bg:SetHeight(12)
alert_bg:SetBackdrop({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16,
4 years ago
insets = {left = 0, right = 0, top = 0, bottom = 0}})
3 years ago
alert_bg:SetBackdropColor(.1, .1, .1, 1)
alert_bg:SetFrameStrata("FULLSCREEN")
alert_bg:SetFrameLevel(baseframe:GetFrameLevel() + 6)
4 years ago
alert_bg:Hide()
3 years ago
local toptexture = alert_bg:CreateTexture(nil, "background")
toptexture:SetTexture([[Interface\Challenges\challenges-main]])
--toptexture:SetTexCoord(0.1921484375, 0.523671875, 0.234375, 0.160859375)
toptexture:SetTexCoord(0.231171875, 0.4846484375, 0.0703125, 0.072265625)
toptexture:SetPoint("left", alert_bg, "left")
toptexture:SetPoint("right", alert_bg, "right")
toptexture:SetPoint("bottom", alert_bg, "top", 0, 0)
toptexture:SetHeight(1)
local text = alert_bg:CreateFontString(nil, "overlay", "GameFontNormal")
text:SetPoint("right", alert_bg, "right", -14, 0)
Details:SetFontSize(text, 10)
text:SetTextColor(1, 1, 1, 0.8)
local rotate_frame = CreateFrame("frame", "DetailsAlertFrameRotate" .. instancia.meu_id, alert_bg)
rotate_frame:SetWidth(12)
rotate_frame:SetPoint("right", alert_bg, "right", -2, 0)
rotate_frame:SetHeight(alert_bg:GetWidth())
rotate_frame:SetFrameStrata("FULLSCREEN")
local icon = rotate_frame:CreateTexture(nil, "overlay")
icon:SetPoint("center", rotate_frame, "center")
icon:SetWidth(14)
icon:SetHeight(14)
local button = CreateFrame("button", "DetailsInstance"..instancia.meu_id.."AlertButton", alert_bg)
4 years ago
button:SetAllPoints()
3 years ago
button:SetFrameStrata("FULLSCREEN")
button:SetScript("OnClick", alert_on_click)
4 years ago
button._instance = instancia
button.func_param = {}
3 years ago
4 years ago
local RotateAnimGroup = rotate_frame:CreateAnimationGroup()
3 years ago
local rotate = RotateAnimGroup:CreateAnimation("Rotation")
rotate:SetDegrees(360)
rotate:SetDuration(6)
4 years ago
RotateAnimGroup:SetLooping ("repeat")
3 years ago
4 years ago
alert_bg:Hide()
3 years ago
4 years ago
local anime = alert_bg:CreateAnimationGroup()
3 years ago
anime.group = anime:CreateAnimation("Translation")
anime.group:SetDuration(0.15)
4 years ago
anime.group:SetOffset (0, 10)
3 years ago
anime:SetScript("OnFinished", function(self)
4 years ago
alert_bg:Show()
3 years ago
alert_bg:SetPoint("bottom", baseframe, "bottom", 0, 0)
alert_bg:SetPoint("left", baseframe, "left", 3, 0)
alert_bg:SetPoint("right", baseframe, "right", -3, 0)
4 years ago
end)
3 years ago
local on_enter_alert = function(self)
text:SetTextColor(1, 0.8, 0.3, 1)
icon:SetBlendMode("ADD")
4 years ago
end
3 years ago
local on_leave_alert = function(self)
text:SetTextColor(1, 1, 1, 0.8)
icon:SetBlendMode("BLEND")
4 years ago
end
3 years ago
button:SetScript("OnEnter", on_enter_alert)
button:SetScript("OnLeave", on_leave_alert)
4 years ago
function alert_bg:Play()
anime:Play()
end
3 years ago
local flash_texture = button:CreateTexture(nil, "overlay")
flash_texture:SetTexCoord(53/512, 347/512, 58/256, 120/256)
flash_texture:SetTexture([[Interface\AchievementFrame\UI-Achievement-Alert-Glow]])
4 years ago
flash_texture:SetAllPoints()
3 years ago
flash_texture:SetBlendMode("ADD")
4 years ago
local animation = flash_texture:CreateAnimationGroup()
3 years ago
local anim1 = animation:CreateAnimation("ALPHA")
local anim2 = animation:CreateAnimation("ALPHA")
4 years ago
anim1:SetOrder (1)
3 years ago
4 years ago
anim1:SetFromAlpha (0)
anim1:SetToAlpha (1)
3 years ago
anim1:SetDuration(0.1)
4 years ago
anim2:SetOrder (2)
3 years ago
4 years ago
anim1:SetFromAlpha (1)
anim1:SetToAlpha (0)
3 years ago
anim2:SetDuration(0.2)
animation:SetScript("OnFinished", function(self)
4 years ago
flash_texture:Hide()
end)
flash_texture:Hide()
3 years ago
4 years ago
local do_flash = function()
flash_texture:Show()
animation:Play()
end
3 years ago
4 years ago
function alert_bg:DoFlash()
3 years ago
C_Timer.After(0.23, do_flash)
4 years ago
end
3 years ago
4 years ago
alert_bg.text = text
alert_bg.icon = icon
alert_bg.button = button
alert_bg.rotate = RotateAnimGroup
3 years ago
4 years ago
instancia.alert = alert_bg
3 years ago
4 years ago
return alert_bg
end
3 years ago
function Details:InstanceMsg (text, icon, textcolor, iconcoords, iconcolor)
4 years ago
if (not text) then
self.freeze_icon:Hide()
return self.freeze_texto:Hide()
end
3 years ago
self.freeze_texto:SetText(text)
self.freeze_icon:SetTexture(icon or [[Interface\CHARACTERFRAME\Disconnect-Icon]])
4 years ago
self.freeze_icon:Show()
self.freeze_texto:Show()
3 years ago
4 years ago
if (textcolor) then
3 years ago
local r, g, b, a = gump:ParseColors(textcolor)
self.freeze_texto:SetTextColor(r, g, b, a)
4 years ago
else
3 years ago
self.freeze_texto:SetTextColor(1, 1, 1, 1)
4 years ago
end
3 years ago
if (iconcoords and type(iconcoords) == "table") then
self.freeze_icon:SetTexCoord(unpack(iconcoords))
4 years ago
else
3 years ago
self.freeze_icon:SetTexCoord(0, 1, 0, 1)
4 years ago
end
3 years ago
4 years ago
if (iconcolor) then
3 years ago
local r, g, b, a = gump:ParseColors(iconcolor)
self.freeze_icon:SetVertexColor(r, g, b, a)
4 years ago
else
3 years ago
self.freeze_icon:SetVertexColor(1, 1, 1, 1)
4 years ago
end
end
3 years ago
function Details:schedule_hide_anti_overlap (self)
4 years ago
self:Hide()
self.schdule = nil
end
local function hide_anti_overlap (self)
if (self.schdule) then
3 years ago
Details:CancelTimer(self.schdule)
4 years ago
self.schdule = nil
end
3 years ago
local schdule = Details:ScheduleTimer("schedule_hide_anti_overlap", 0.3, self)
4 years ago
self.schdule = schdule
end
local function show_anti_overlap (instance, host, side)
local anti_menu_overlap = instance.baseframe.anti_menu_overlap
if (anti_menu_overlap.schdule) then
3 years ago
Details:CancelTimer(anti_menu_overlap.schdule)
4 years ago
anti_menu_overlap.schdule = nil
end
anti_menu_overlap:ClearAllPoints()
if (side == "top") then
3 years ago
anti_menu_overlap:SetPoint("bottom", host, "top")
4 years ago
elseif (side == "bottom") then
3 years ago
anti_menu_overlap:SetPoint("top", host, "bottom")
4 years ago
end
anti_menu_overlap:Show()
end
3 years ago
Details.snap_alert = CreateFrame("frame", "DetailsSnapAlertFrame", UIParent, "ActionBarButtonSpellActivationAlert")
Details.snap_alert:Hide()
Details.snap_alert:SetFrameStrata("FULLSCREEN")
4 years ago
3 years ago
function Details:SnapAlert()
Details.snap_alert:ClearAllPoints()
Details.snap_alert:SetPoint("topleft", self.baseframe.cabecalho.modo_selecao.widget, "topleft", -8, 6)
Details.snap_alert:SetPoint("bottomright", self.baseframe.cabecalho.modo_selecao.widget, "bottomright", 8, -6)
Details.snap_alert.animOut:Stop()
Details.snap_alert.animIn:Play()
4 years ago
end
do
--search key: ~tooltip
3 years ago
local tooltip_anchor = CreateFrame("frame", "DetailsTooltipAnchor", UIParent,"BackdropTemplate")
tooltip_anchor:SetSize(140, 20)
tooltip_anchor:SetAlpha(0)
tooltip_anchor:SetMovable(false)
tooltip_anchor:SetClampedToScreen(true)
4 years ago
tooltip_anchor.locked = true
3 years ago
tooltip_anchor:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], edgeSize = 10, insets = {left = 1, right = 1, top = 2, bottom = 1}})
tooltip_anchor:SetBackdropColor(0, 0, 0, 1)
4 years ago
3 years ago
tooltip_anchor:SetScript("OnEnter", function(self)
4 years ago
tooltip_anchor.alert.animIn:Stop()
tooltip_anchor.alert.animOut:Play()
3 years ago
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
4 years ago
GameTooltip:ClearLines()
3 years ago
GameTooltip:AddLine(Loc["STRING_OPTIONS_TOOLTIPS_ANCHOR_TEXT_DESC"])
4 years ago
GameTooltip:Show()
end)
3 years ago
tooltip_anchor:SetScript("OnLeave", function(self)
4 years ago
GameTooltip:Hide()
end)
3 years ago
tooltip_anchor:SetScript("OnMouseDown", function(self, button)
4 years ago
if (not self.moving and button == "LeftButton") then
self:StartMoving()
self.moving = true
end
end)
3 years ago
tooltip_anchor:SetScript("OnMouseUp", function(self, button)
4 years ago
if (self.moving) then
self:StopMovingOrSizing()
self.moving = false
3 years ago
local xofs, yofs = self:GetCenter()
4 years ago
local scale = self:GetEffectiveScale()
local UIscale = UIParent:GetScale()
xofs = xofs * scale - GetScreenWidth() * UIscale / 2
yofs = yofs * scale - GetScreenHeight() * UIscale / 2
3 years ago
Details.tooltip.anchor_screen_pos[1] = xofs / UIscale
Details.tooltip.anchor_screen_pos[2] = yofs / UIscale
4 years ago
elseif (button == "RightButton" and not self.moving) then
tooltip_anchor:MoveAnchor()
end
end)
3 years ago
4 years ago
function tooltip_anchor:MoveAnchor()
if (self.locked) then
3 years ago
self:SetAlpha(1)
self:EnableMouse(true)
self:SetMovable(true)
self:SetFrameStrata("FULLSCREEN")
4 years ago
self.locked = false
tooltip_anchor.alert.animOut:Stop()
tooltip_anchor.alert.animIn:Play()
else
3 years ago
self:SetAlpha(0)
self:EnableMouse(false)
self:SetFrameStrata("MEDIUM")
self:SetMovable(false)
4 years ago
self.locked = true
tooltip_anchor.alert.animIn:Stop()
tooltip_anchor.alert.animOut:Play()
end
end
3 years ago
4 years ago
function tooltip_anchor:Restore()
3 years ago
local x, y = Details.tooltip.anchor_screen_pos[1], Details.tooltip.anchor_screen_pos[2]
local scale = self:GetEffectiveScale()
4 years ago
local UIscale = UIParent:GetScale()
x = x * UIscale / scale
y = y * UIscale / scale
self:ClearAllPoints()
3 years ago
self:SetParent(UIParent)
self:SetPoint("center", UIParent, "center", x, y)
4 years ago
end
3 years ago
tooltip_anchor.alert = CreateFrame("frame", "DetailsTooltipAnchorAlert", UIParent, "ActionBarButtonSpellActivationAlert")
tooltip_anchor.alert:SetFrameStrata("FULLSCREEN")
4 years ago
tooltip_anchor.alert:Hide()
3 years ago
tooltip_anchor.alert:SetPoint("topleft", tooltip_anchor, "topleft", -60, 6)
tooltip_anchor.alert:SetPoint("bottomright", tooltip_anchor, "bottomright", 40, -6)
local icon = tooltip_anchor:CreateTexture(nil, "overlay")
icon:SetTexture([[Interface\AddOns\Details\images\minimap]])
icon:SetPoint("left", tooltip_anchor, "left", 4, 0)
icon:SetSize(18, 18)
local text = tooltip_anchor:CreateFontString(nil, "overlay", "GameFontHighlightSmall")
text:SetPoint("left", icon, "right", 6, 0)
text:SetText(Loc["STRING_OPTIONS_TOOLTIPS_ANCHOR_TEXT"])
4 years ago
3 years ago
tooltip_anchor:EnableMouse(false)
4 years ago
end
3 years ago
--~inicio ~janela ~window ~nova ~start
4 years ago
function gump:CriaJanelaPrincipal (ID, instancia, criando)
-- main frames -----------------------------------------------------------------------------------------------------------------------------------------------
--baseframe is the lowest frame in the window architecture
3 years ago
local baseframe = CreateFrame("scrollframe", "DetailsBaseFrame" .. ID, UIParent, "BackdropTemplate")
baseframe:SetMovable(true)
baseframe:SetResizable(true)
baseframe:SetUserPlaced(false)
baseframe:SetDontSavePosition(true)
baseframe:SetFrameStrata(baseframe_strata)
baseframe:SetFrameLevel(2)
4 years ago
baseframe.instance = instancia
local baseframeBorder = DetailsFramework:CreateFullBorder(baseframe:GetName() .. "BaseBorder", baseframe)
baseframeBorder:SetBorderSizes(1, 1, 1, 1)
baseframeBorder:UpdateSizes()
baseframeBorder:SetVertexColor(0, 0, 0, 1)
baseframe.border = baseframeBorder
baseframe.border:Hide()
local titleBar = CreateFrame("frame", baseframe:GetName() .. "TitleBar", baseframe, "BackdropTemplate")
titleBar:SetPoint("bottomleft", baseframe, "topleft", 0, 0)
titleBar:SetPoint("bottomright", baseframe, "topright", 0, 0)
titleBar:SetHeight(16)
titleBar:EnableMouse(false)
baseframe.titleBar = titleBar
titleBar.texture = titleBar:CreateTexture("$parentTexture", "artwork")
titleBar.texture:SetAllPoints()
titleBar.texture:SetTexture([[Interface\AddOns\Details\images\bar_serenity]])
titleBar.texture:SetVertexColor(0, 0, 0, 0)
--a background frame that anchors in the topleft of the title bar and bottom right of the baseframe
--this frame does not attack to statusbar (yet)
local fullWindowFrame = CreateFrame("frame", baseframe:GetName() .. "FullWindowFrame", baseframe, "BackdropTemplate")
fullWindowFrame:EnableMouse(false)
fullWindowFrame:SetPoint("topleft", titleBar, "topleft", 0, 0)
fullWindowFrame:SetPoint("bottomright", baseframe, "bottomright", 0, 0)
baseframe.fullWindowFrame = fullWindowFrame
local fullWindowBorder = DetailsFramework:CreateFullBorder(fullWindowFrame:GetName() .. "Border", fullWindowFrame)
fullWindowBorder:SetBorderSizes(1, 1, 1, 1)
fullWindowBorder:UpdateSizes()
fullWindowBorder:SetVertexColor(0, 0, 0, 1)
fullWindowFrame.border = fullWindowBorder
fullWindowFrame.border:Hide()
--background holds the wallpaper, alert strings ans textures, have setallpoints on baseframe
--backgrounddisplay is a scrollschild of backgroundframe, hence its children won't show outside its canvas
3 years ago
local backgroundframe = CreateFrame("scrollframe", "Details_WindowFrame"..ID, baseframe) --window frame
local backgrounddisplay = CreateFrame("frame", "Details_GumpFrame"..ID, backgroundframe,"BackdropTemplate") --gump frame
backgroundframe:SetFrameLevel(3)
backgrounddisplay:SetFrameLevel(3)
4 years ago
backgroundframe.instance = instancia
backgrounddisplay.instance = instancia
instancia.windowBackgroundDisplay = backgrounddisplay
3 years ago
--row frame is the parent of rows, it have setallpoints on baseframe
local rowframe = CreateFrame("frame", "DetailsRowFrame"..ID, UIParent) --row frame
rowframe:SetAllPoints(baseframe)
rowframe:SetFrameStrata(baseframe_strata)
rowframe:SetFrameLevel(3)
4 years ago
rowframe:EnableMouse(false)
instancia.rowframe = rowframe
3 years ago
function rowframe:SetFrameAlpha(value)
local value = parseRowFrameAlpha(value)
self:SetAlpha(value)
end
--right click bookmark
4 years ago
local switchbutton = CreateFrame("button", "Details_SwitchButtonFrame" .. ID, UIParent)
3 years ago
switchbutton:SetAllPoints(baseframe)
switchbutton:SetFrameStrata(baseframe_strata)
switchbutton:SetFrameLevel(4)
4 years ago
instancia.windowSwitchButton = switchbutton
3 years ago
--avoid mouse hover over a high window when the menu is open for a lower instance.
local anti_menu_overlap = CreateFrame("frame", "Details_WindowFrameAntiMenuOverlap" .. ID, UIParent)
anti_menu_overlap:SetSize(100, 13)
anti_menu_overlap:SetFrameStrata("DIALOG")
anti_menu_overlap:EnableMouse(true)
4 years ago
anti_menu_overlap:Hide()
3 years ago
--anti_menu_overlap:SetBackdrop(gump_fundo_backdrop) --debug
4 years ago
baseframe.anti_menu_overlap = anti_menu_overlap
3 years ago
--floating frame is an anchor for widgets which should be overlaying the window
local floatingframe = CreateFrame("frame", "DetailsInstance"..ID.."BorderHolder", baseframe)
floatingframe:SetFrameLevel(baseframe:GetFrameLevel()+7)
4 years ago
instancia.floatingframe = floatingframe
-- scroll bar -----------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--create the scrollbar, almost not used.
local scrollbar = CreateFrame("slider", "Details_ScrollBar"..ID, backgrounddisplay) --scroll
--scroll image-node up
baseframe.scroll_up = backgrounddisplay:CreateTexture(nil, "background")
baseframe.scroll_up:SetPoint("topleft", backgrounddisplay, "topright", 0, 0)
baseframe.scroll_up:SetTexture(DEFAULT_SKIN)
baseframe.scroll_up:SetTexCoord(unpack(COORDS_SLIDER_TOP))
baseframe.scroll_up:SetWidth(32)
baseframe.scroll_up:SetHeight(32)
--scroll image-node down
baseframe.scroll_down = backgrounddisplay:CreateTexture(nil, "background")
baseframe.scroll_down:SetPoint("bottomleft", backgrounddisplay, "bottomright", 0, 0)
baseframe.scroll_down:SetTexture(DEFAULT_SKIN)
baseframe.scroll_down:SetTexCoord(unpack(COORDS_SLIDER_DOWN))
baseframe.scroll_down:SetWidth(32)
baseframe.scroll_down:SetHeight(32)
--scroll image-node middle
baseframe.scroll_middle = backgrounddisplay:CreateTexture(nil, "background")
baseframe.scroll_middle:SetPoint("top", baseframe.scroll_up, "bottom", 0, 8)
baseframe.scroll_middle:SetPoint("bottom", baseframe.scroll_down, "top", 0, -11)
baseframe.scroll_middle:SetTexture(DEFAULT_SKIN)
baseframe.scroll_middle:SetTexCoord(unpack(COORDS_SLIDER_MIDDLE))
baseframe.scroll_middle:SetWidth(32)
baseframe.scroll_middle:SetHeight(64)
--scroll widgets
baseframe.button_up = CreateFrame("button", "DetailsScrollUp" .. instancia.meu_id, backgrounddisplay)
baseframe.button_down = CreateFrame("button", "DetailsScrollDown" .. instancia.meu_id, backgrounddisplay)
baseframe.button_up:SetWidth(29)
baseframe.button_up:SetHeight(32)
baseframe.button_up:SetNormalTexture([[Interface\BUTTONS\UI-ScrollBar-ScrollUpButton-Up]])
baseframe.button_up:SetPushedTexture([[Interface\BUTTONS\UI-ScrollBar-ScrollUpButton-Down]])
baseframe.button_up:SetDisabledTexture([[Interface\BUTTONS\UI-ScrollBar-ScrollUpButton-Disabled]])
4 years ago
baseframe.button_up:Disable()
3 years ago
baseframe.button_down:SetWidth(29)
baseframe.button_down:SetHeight(32)
baseframe.button_down:SetNormalTexture([[Interface\BUTTONS\UI-ScrollBar-ScrollDownButton-Up]])
baseframe.button_down:SetPushedTexture([[Interface\BUTTONS\UI-ScrollBar-ScrollDownButton-Down]])
baseframe.button_down:SetDisabledTexture([[Interface\BUTTONS\UI-ScrollBar-ScrollDownButton-Disabled]])
4 years ago
baseframe.button_down:Disable()
3 years ago
baseframe.button_up:SetPoint("topright", baseframe.scroll_up, "topright", -4, 3)
baseframe.button_down:SetPoint("bottomright", baseframe.scroll_down, "bottomright", -4, -6)
4 years ago
3 years ago
scrollbar:SetPoint("top", baseframe.button_up, "bottom", 0, 12)
scrollbar:SetPoint("bottom", baseframe.button_down, "top", 0, -12)
scrollbar:SetPoint("left", backgrounddisplay, "right", 3, 0)
4 years ago
scrollbar:Show()
3 years ago
--config set
scrollbar:SetOrientation("VERTICAL")
4 years ago
scrollbar.scrollMax = 0
3 years ago
scrollbar:SetMinMaxValues(0, 0)
scrollbar:SetValue(0)
4 years ago
scrollbar.ultimo = 0
3 years ago
--thumb
scrollbar.thumb = scrollbar:CreateTexture(nil, "overlay")
scrollbar.thumb:SetTexture([[Interface\Buttons\UI-ScrollBar-Knob]])
scrollbar.thumb:SetSize(29, 30)
4 years ago
scrollbar:SetThumbTexture (scrollbar.thumb)
3 years ago
--scripts
4 years ago
button_down_scripts (baseframe, backgrounddisplay, instancia, scrollbar)
button_up_scripts (baseframe, backgrounddisplay, instancia, scrollbar)
3 years ago
4 years ago
-- stretch button -----------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
baseframe.button_stretch = CreateFrame("button", "DetailsButtonStretch" .. instancia.meu_id, baseframe)
baseframe.button_stretch:SetPoint("bottom", baseframe, "top", 0, 20)
baseframe.button_stretch:SetPoint("right", baseframe, "right", -27, 0)
baseframe.button_stretch:SetFrameLevel(1)
local stretch_texture = baseframe.button_stretch:CreateTexture(nil, "overlay")
stretch_texture:SetTexture(DEFAULT_SKIN)
stretch_texture:SetTexCoord(unpack(COORDS_STRETCH))
stretch_texture:SetWidth(32)
stretch_texture:SetHeight(16)
stretch_texture:SetAllPoints(baseframe.button_stretch)
4 years ago
baseframe.button_stretch.texture = stretch_texture
3 years ago
baseframe.button_stretch:SetWidth(32)
baseframe.button_stretch:SetHeight(16)
4 years ago
baseframe.button_stretch:Show()
3 years ago
Details.FadeHandler.Fader(baseframe.button_stretch, "ALPHA", 0)
4 years ago
button_stretch_scripts (baseframe, backgrounddisplay, instancia)
-- main window config -------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
baseframe:SetClampedToScreen(true)
baseframe:SetSize(Details.new_window_size.width, Details.new_window_size.height)
baseframe:SetPoint("center", UIParent)
baseframe:EnableMouseWheel(false)
baseframe:EnableMouse(true)
if (not DetailsFramework.IsDragonflight()) then
baseframe:SetMinResize (150, 7)
baseframe:SetMaxResize (Details.max_window_size.width, Details.max_window_size.height)
else
--baseframe:SetResizeBounds(150, 7, _detalhes.max_window_size.width, _detalhes.max_window_size.height)
end
baseframe:SetBackdrop(defaultBackdropSt)
baseframe:SetBackdropColor(instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha)
4 years ago
-- background window config -------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
backgroundframe:SetAllPoints(baseframe)
backgroundframe:SetScrollChild(backgrounddisplay)
3 years ago
backgrounddisplay:SetResizable(true)
backgrounddisplay:SetPoint("topleft", baseframe, "topleft")
backgrounddisplay:SetPoint("bottomright", baseframe, "bottomright")
backgrounddisplay:SetBackdrop(defaultBackdropSt)
backgrounddisplay:SetBackdropColor(instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha)
4 years ago
-- instance mini widgets -------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--overall data warning
instancia.overall_data_warning = backgrounddisplay:CreateFontString(nil, "overlay", "GameFontHighlightSmall")
instancia.overall_data_warning:SetHeight(64)
instancia.overall_data_warning:SetPoint("center", backgrounddisplay, "center")
instancia.overall_data_warning:SetTextColor(.8, .8, .8, .5)
4 years ago
instancia.overall_data_warning:Hide()
3 years ago
instancia.overall_data_warning:SetText(Loc["STRING_TUTORIAL_OVERALL1"])
--freeze icon
instancia.freeze_icon = backgrounddisplay:CreateTexture(nil, "overlay")
instancia.freeze_icon:SetWidth(64)
instancia.freeze_icon:SetHeight(64)
instancia.freeze_icon:SetPoint("center", backgrounddisplay, "center")
instancia.freeze_icon:SetPoint("left", backgrounddisplay, "left")
4 years ago
instancia.freeze_icon:Hide()
3 years ago
instancia.freeze_texto = backgrounddisplay:CreateFontString(nil, "overlay", "GameFontHighlightSmall")
instancia.freeze_texto:SetHeight(64)
instancia.freeze_texto:SetPoint("left", instancia.freeze_icon, "right", -18, 0)
instancia.freeze_texto:SetTextColor(1, 1, 1)
4 years ago
instancia.freeze_texto:Hide()
3 years ago
--details version
instancia._version = baseframe:CreateFontString(nil, "overlay", "GameFontHighlightSmall")
--instancia._version:SetPoint("left", backgrounddisplay, "left", 20, 0)
instancia._version:SetTextColor(1, 1, 1)
instancia._version:SetText("this is a alpha version of Details\nyou can help us sending bug reports\nuse the blue button.")
if (not Details.initializing) then
4 years ago
end
instancia._version:Hide()
3 years ago
--wallpaper
baseframe.wallpaper = baseframe:CreateTexture(nil, "overlay")
4 years ago
baseframe.wallpaper:Hide()
3 years ago
--alert frame
4 years ago
baseframe.alert = CreateAlertFrame (baseframe, instancia)
3 years ago
4 years ago
-- resizers & lock button ~lock ------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--right resizer
baseframe.resize_direita = CreateFrame("button", "Details_Resize_Direita"..ID, baseframe)
local resize_direita_texture = baseframe.resize_direita:CreateTexture(nil, "overlay")
resize_direita_texture:SetWidth(16)
resize_direita_texture:SetHeight(16)
resize_direita_texture:SetTexture(DEFAULT_SKIN)
resize_direita_texture:SetTexCoord(unpack(COORDS_RESIZE_RIGHT))
resize_direita_texture:SetAllPoints(baseframe.resize_direita)
4 years ago
baseframe.resize_direita.texture = resize_direita_texture
3 years ago
baseframe.resize_direita:SetWidth(16)
baseframe.resize_direita:SetHeight(16)
baseframe.resize_direita:SetPoint("bottomright", baseframe, "bottomright", 0, 0)
baseframe.resize_direita:EnableMouse(true)
baseframe.resize_direita:SetFrameStrata("HIGH")
baseframe.resize_direita:SetFrameLevel(baseframe:GetFrameLevel() + 6)
4 years ago
baseframe.resize_direita.side = 2
3 years ago
--lock window button
baseframe.lock_button = CreateFrame("button", "Details_Lock_Button"..ID, baseframe)
baseframe.lock_button:SetPoint("right", baseframe.resize_direita, "left", -1, 1.5)
baseframe.lock_button:SetFrameLevel(baseframe:GetFrameLevel() + 6)
baseframe.lock_button:SetWidth(40)
baseframe.lock_button:SetHeight(16)
baseframe.lock_button.label = baseframe.lock_button:CreateFontString(nil, "overlay", "GameFontNormal")
baseframe.lock_button.label:SetPoint("right", baseframe.lock_button, "right")
baseframe.lock_button.label:SetTextColor(.6, .6, .6, .7)
baseframe.lock_button.label:SetJustifyH("right")
baseframe.lock_button.label:SetText(Loc["STRING_LOCK_WINDOW"])
baseframe.lock_button:SetWidth(baseframe.lock_button.label:GetStringWidth()+2)
baseframe.lock_button:SetScript("OnClick", lockFunctionOnClick)
baseframe.lock_button:SetScript("OnEnter", lockFunctionOnEnter)
baseframe.lock_button:SetScript("OnLeave", lockFunctionOnLeave)
baseframe.lock_button:SetScript("OnHide", lockFunctionOnHide)
baseframe.lock_button:SetFrameStrata("HIGH")
baseframe.lock_button:SetFrameLevel(baseframe:GetFrameLevel() + 6)
4 years ago
baseframe.lock_button.instancia = instancia
3 years ago
--left resizer
baseframe.resize_esquerda = CreateFrame("button", "Details_Resize_Esquerda"..ID, baseframe)
local resize_esquerda_texture = baseframe.resize_esquerda:CreateTexture(nil, "overlay")
resize_esquerda_texture:SetWidth(16)
resize_esquerda_texture:SetHeight(16)
resize_esquerda_texture:SetTexture(DEFAULT_SKIN)
resize_esquerda_texture:SetTexCoord(unpack(COORDS_RESIZE_LEFT))
resize_esquerda_texture:SetAllPoints(baseframe.resize_esquerda)
4 years ago
baseframe.resize_esquerda.texture = resize_esquerda_texture
3 years ago
baseframe.resize_esquerda:SetWidth(16)
baseframe.resize_esquerda:SetHeight(16)
baseframe.resize_esquerda:SetPoint("bottomleft", baseframe, "bottomleft", 0, 0)
baseframe.resize_esquerda:EnableMouse(true)
baseframe.resize_esquerda:SetFrameStrata("HIGH")
baseframe.resize_esquerda:SetFrameLevel(baseframe:GetFrameLevel() + 6)
baseframe.resize_esquerda:SetAlpha(0)
baseframe.resize_direita:SetAlpha(0)
4 years ago
if (instancia.isLocked) then
instancia.isLocked = not instancia.isLocked
lockFunctionOnClick (baseframe.lock_button, nil, nil, true)
end
3 years ago
Details.FadeHandler.Fader(baseframe.lock_button, -1, 3.0)
4 years ago
-- scripts ------------------------------------------------------------------------------------------------------------------------------------------------------------
BFrame_scripts (baseframe, instancia) --baseframe
3 years ago
BGFrame_scripts(switchbutton, baseframe, instancia) --backgroundframe
BGFrame_scripts(backgrounddisplay, baseframe, instancia)
4 years ago
iterate_scroll_scripts (backgrounddisplay, backgroundframe, baseframe, scrollbar, instancia)
3 years ago
4 years ago
-- create toolbar ----------------------------------------------------------------------------------------------------------------------------------------------------------
gump:CriaCabecalho (baseframe, instancia)
3 years ago
-- create statusbar ----------------------------------------------------------------------------------------------------------------------------------------------------------
4 years ago
gump:CriaRodape (baseframe, instancia)
-- left and right side bars ------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ~barra ~bordas ~border
3 years ago
--left
baseframe.barra_esquerda = floatingframe:CreateTexture(nil, "artwork")
baseframe.barra_esquerda:SetTexture(DEFAULT_SKIN)
baseframe.barra_esquerda:SetTexCoord(unpack(COORDS_LEFT_SIDE_BAR))
baseframe.barra_esquerda:SetWidth(64)
4 years ago
baseframe.barra_esquerda:SetHeight (512)
3 years ago
baseframe.barra_esquerda:SetPoint("topleft", baseframe, "topleft", -56, 0)
baseframe.barra_esquerda:SetPoint("bottomleft", baseframe, "bottomleft", -56, -14)
--right
baseframe.barra_direita = floatingframe:CreateTexture(nil, "artwork")
baseframe.barra_direita:SetTexture(DEFAULT_SKIN)
baseframe.barra_direita:SetTexCoord(unpack(COORDS_RIGHT_SIDE_BAR))
baseframe.barra_direita:SetWidth(64)
baseframe.barra_direita:SetHeight(512)
baseframe.barra_direita:SetPoint("topright", baseframe, "topright", 56, 0)
baseframe.barra_direita:SetPoint("bottomright", baseframe, "bottomright", 56, -14)
--bottom
baseframe.barra_fundo = floatingframe:CreateTexture(nil, "artwork")
baseframe.barra_fundo:SetTexture(DEFAULT_SKIN)
baseframe.barra_fundo:SetTexCoord(unpack(COORDS_BOTTOM_SIDE_BAR))
baseframe.barra_fundo:SetWidth(512)
baseframe.barra_fundo:SetHeight(64)
baseframe.barra_fundo:SetPoint("bottomleft", baseframe, "bottomleft", 0, -56)
baseframe.barra_fundo:SetPoint("bottomright", baseframe, "bottomright", 0, -56)
4 years ago
-- break snap button ----------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
instancia.break_snap_button = CreateFrame("button", "DetailsBreakSnapButton" .. ID, floatingframe)
instancia.break_snap_button:SetPoint("bottom", baseframe.resize_direita, "top", -1, 0)
instancia.break_snap_button:SetFrameLevel(baseframe:GetFrameLevel() + 5)
instancia.break_snap_button:SetSize(13, 13)
instancia.break_snap_button:SetAlpha(0)
4 years ago
instancia.break_snap_button.instancia = instancia
3 years ago
instancia.break_snap_button:SetScript("OnClick", function()
if (Details.disable_lock_ungroup_buttons) then
4 years ago
return
end
instancia:Desagrupar (-1)
3 years ago
--hide tutorial
4 years ago
if (DetailsWindowGroupPopUp1 and DetailsWindowGroupPopUp1:IsShown()) then
DetailsWindowGroupPopUp1:Hide()
end
end)
3 years ago
instancia.break_snap_button:SetScript("OnEnter", unSnapButtonOnEnter)
instancia.break_snap_button:SetScript("OnLeave", unSnapButtonOnLeave)
instancia.break_snap_button:SetNormalTexture(DEFAULT_SKIN)
instancia.break_snap_button:SetDisabledTexture(DEFAULT_SKIN)
instancia.break_snap_button:SetHighlightTexture(DEFAULT_SKIN, "ADD")
instancia.break_snap_button:SetPushedTexture(DEFAULT_SKIN)
instancia.break_snap_button:GetNormalTexture():SetTexCoord(unpack(COORDS_UNLOCK_BUTTON))
instancia.break_snap_button:GetDisabledTexture():SetTexCoord(unpack(COORDS_UNLOCK_BUTTON))
instancia.break_snap_button:GetHighlightTexture():SetTexCoord(unpack(COORDS_UNLOCK_BUTTON))
instancia.break_snap_button:GetPushedTexture():SetTexCoord(unpack(COORDS_UNLOCK_BUTTON))
-- scripts ------------------------------------------------------------------------------------------------------------------------------------------------------------
setWindowResizeScripts (baseframe.resize_direita, instancia, scrollbar, ">", baseframe)
setWindowResizeScripts (baseframe.resize_esquerda, instancia, scrollbar, "<", baseframe)
4 years ago
-- side bars highlights ------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--top
local fcima = CreateFrame("frame", "DetailsTopSideBarHighlight" .. instancia.meu_id, floatingframe)
4 years ago
gump:CreateFlashAnimation (fcima)
fcima:Hide()
3 years ago
instancia.h_cima = fcima:CreateTexture(nil, "overlay")
instancia.h_cima:SetTexture([[Interface\AddOns\Details\images\highlight_updown]])
instancia.h_cima:SetTexCoord(0, 1, 0.5, 1)
instancia.h_cima:SetPoint("topleft", baseframe.cabecalho.top_bg, "bottomleft", -10, 37)
instancia.h_cima:SetPoint("topright", baseframe.cabecalho.ball_r, "bottomright", -97, 37)
instancia.h_cima:SetDesaturated(true)
4 years ago
fcima.texture = instancia.h_cima
instancia.h_cima = fcima
3 years ago
--bottom
local fbaixo = CreateFrame("frame", "DetailsBottomSideBarHighlight" .. instancia.meu_id, floatingframe)
4 years ago
gump:CreateFlashAnimation (fbaixo)
fbaixo:Hide()
3 years ago
instancia.h_baixo = fbaixo:CreateTexture(nil, "overlay")
instancia.h_baixo:SetTexture([[Interface\AddOns\Details\images\highlight_updown]])
instancia.h_baixo:SetTexCoord(0, 1, 0, 0.5)
instancia.h_baixo:SetPoint("topleft", baseframe.rodape.esquerdo, "bottomleft", 16, 17)
instancia.h_baixo:SetPoint("topright", baseframe.rodape.direita, "bottomright", -16, 17)
instancia.h_baixo:SetDesaturated(true)
4 years ago
fbaixo.texture = instancia.h_baixo
instancia.h_baixo = fbaixo
3 years ago
--left
local fesquerda = CreateFrame("frame", "DetailsLeftSideBarHighlight" .. instancia.meu_id, floatingframe)
4 years ago
gump:CreateFlashAnimation (fesquerda)
fesquerda:Hide()
3 years ago
instancia.h_esquerda = fesquerda:CreateTexture(nil, "overlay")
instancia.h_esquerda:SetTexture([[Interface\AddOns\Details\images\highlight_leftright]])
instancia.h_esquerda:SetTexCoord(0.5, 1, 0, 1)
instancia.h_esquerda:SetPoint("topleft", baseframe.barra_esquerda, "topleft", 40, 0)
instancia.h_esquerda:SetPoint("bottomleft", baseframe.barra_esquerda, "bottomleft", 40, 0)
instancia.h_esquerda:SetDesaturated(true)
4 years ago
fesquerda.texture = instancia.h_esquerda
instancia.h_esquerda = fesquerda
3 years ago
--right
local fdireita = CreateFrame("frame", "DetailsRightSideBarHighlight" .. instancia.meu_id, floatingframe)
gump:CreateFlashAnimation (fdireita)
4 years ago
fdireita:Hide()
3 years ago
instancia.h_direita = fdireita:CreateTexture(nil, "overlay")
instancia.h_direita:SetTexture([[Interface\AddOns\Details\images\highlight_leftright]])
instancia.h_direita:SetTexCoord(0, 0.5, 1, 0)
instancia.h_direita:SetPoint("topleft", baseframe.barra_direita, "topleft", 8, 18)
instancia.h_direita:SetPoint("bottomleft", baseframe.barra_direita, "bottomleft", 8, 0)
instancia.h_direita:SetDesaturated(true)
4 years ago
fdireita.texture = instancia.h_direita
instancia.h_direita = fdireita
3 years ago
--done
4 years ago
if (criando) then
local CProps = {
["altura"] = 100,
["largura"] = 200,
["barras"] = 50,
["barrasvisiveis"] = 0,
["x"] = 0,
["y"] = 0,
["w"] = 0,
["h"] = 0
}
instancia.locs = CProps
end
return baseframe, backgroundframe, backgrounddisplay, scrollbar
3 years ago
4 years ago
end
3 years ago
function Details:IsShowingOverallDataWarning()
4 years ago
return self.overall_data_warning:IsShown()
end
3 years ago
function Details:ShowOverallDataWarning (state)
4 years ago
if (state) then
self.overall_data_warning:Show()
3 years ago
self.overall_data_warning:SetWidth(self:GetSize() - 20)
4 years ago
else
self.overall_data_warning:Hide()
end
end
3 years ago
function Details:SetBarFollowPlayer (follow)
4 years ago
if (follow == nil) then
follow = self.following.enabled
end
3 years ago
4 years ago
self.following.enabled = follow
3 years ago
4 years ago
self:RefreshBars()
self:InstanceReset()
self:ReajustaGump()
end
3 years ago
function Details:SetBarOrientationDirection (orientation)
4 years ago
if (orientation == nil) then
orientation = self.bars_inverted
end
self.bars_inverted = orientation
3 years ago
4 years ago
self:InstanceRefreshRows()
self:RefreshBars()
self:InstanceReset()
self:ReajustaGump()
end
3 years ago
function Details:SetBarGrowDirection (direction)
4 years ago
if (not direction) then
direction = self.bars_grow_direction
end
3 years ago
4 years ago
self.bars_grow_direction = direction
local x = self.row_info.space.left
3 years ago
local bars = self.barras or self.Bars --.Bars for third-party plugins
local baseframe = self.baseframe or self.Frame --.Frame for plugins
4 years ago
local height = self.row_height
3 years ago
if (direction == 1) then --top to bottom
for index, row in ipairs(bars) do
4 years ago
local y = height * (index - 1)
y = y * -1
row:ClearAllPoints()
3 years ago
if (self.toolbar_side == 1) then
--if titlebar is attached to the top side, don't add any midifiers
row:SetPoint("topleft", baseframe, "topleft", x, y)
4 years ago
else
3 years ago
--if the titlebar is on the bottom side, remove the gap between the baseframe and the titlebar
row:SetPoint("topleft", baseframe, "topleft", x, y - 1)
4 years ago
end
end
3 years ago
elseif (direction == 2) then --bottom to top
for index, row in ipairs(bars) do
4 years ago
local y = height * (index - 1)
row:ClearAllPoints()
3 years ago
if (self.toolbar_side == 1) then
--if the titlebar is attached to the top side, we want to align bars a little above
row:SetPoint("bottomleft", baseframe, "bottomleft", x, y + 2)
4 years ago
else
3 years ago
--the titlebar is on the bottom side, align bars on the bottom
row:SetPoint("bottomleft", baseframe, "bottomleft", x, y + 0)
4 years ago
end
end
end
3 years ago
--update all row width
4 years ago
if (self.bar_mod and self.bar_mod ~= 0) then
for index = 1, #bars do
3 years ago
bars [index]:SetWidth(baseframe:GetWidth() + self.bar_mod)
4 years ago
end
else
for index = 1, #bars do
3 years ago
bars [index]:SetWidth(baseframe:GetWidth() + self.row_info.space.right)
4 years ago
end
end
end
3 years ago
local windowLineMixin = {
SetLineTexture = function(self, texture, coords, vertexColor)
self.texture:SetTexture(texture)
self.texture:SetTexCoord(unpack(coords))
self.texture:SetVertexColor(DetailsFramework:ParseColors(vertexColor))
end,
SetLineIconTexture = function(self, texture, coords, vertexColor)
self.icon_frame:SetTexture(texture)
self.icon_frame:SetTexCoord(unpack(coords))
self.icon_frame:SetVertexColor(DetailsFramework:ParseColors(vertexColor))
self.iconHighlight:SetTexture(texture)
self.iconHighlight:SetTexCoord(unpack(coords))
self.iconHighlight:SetVertexColor(DetailsFramework:ParseColors(vertexColor))
end,
GetActor = function(self)
return self.minha_tabela
end,
GetInstanceId = function(self)
return self.instance_id
end,
GetLineId = function(self)
return self.row_id
end,
GetClassIcon = function(self)
return self.icone_classe
end,
}
Details.barras_criadas = 0
--alias
function gump:NewRow(instancia, index)
return gump:CreateNewLine(instancia, index)
4 years ago
end
3 years ago
--search key: ~row ~barra ~newbar ~createbar ~createrow
function gump:CreateNewLine(instance, index)
--instance = window object, index = row number
local baseframe = instance.baseframe
local rowframe = instance.rowframe
4 years ago
3 years ago
--create the bar with rowframe as parent
local newLine = CreateFrame("button", "DetailsBarra_" .. instance.meu_id .. "_" .. index, rowframe, "BackdropTemplate")
DetailsFramework:Mixin(newLine, windowLineMixin)
4 years ago
newLine.row_id = index
3 years ago
newLine.instance_id = instance.meu_id
newLine.animacao_fim = 0
newLine.animacao_fim2 = 0
3 years ago
newLine.isInstanceLine = true
--set point, almost irrelevant here, it recalc this on SetBarGrowDirection()
local yOffset = instance.row_height * (index-1)
if (instance.bars_grow_direction == 1) then
yOffset = yOffset * -1
newLine:SetPoint("topleft", baseframe, "topleft", instance.row_info.space.left, yOffset)
elseif (instance.bars_grow_direction == 2) then
newLine:SetPoint("bottomleft", baseframe, "bottomleft", instance.row_info.space.left, yOffset + 2)
end
--row height
newLine:SetHeight(instance.row_info.height)
newLine:SetWidth(baseframe:GetWidth()+instance.row_info.space.right)
newLine:SetFrameLevel(baseframe:GetFrameLevel() + 4)
newLine.last_value = 0
newLine.w_mod = 0
3 years ago
newLine:EnableMouse(true)
newLine:RegisterForClicks("LeftButtonDown", "RightButtonDown")
--statusbar
newLine.statusbar = CreateFrame("StatusBar", "DetailsBarra_Statusbar_" .. instance.meu_id .. "_" .. index, newLine)
newLine.statusbar.value = 0
3 years ago
newLine.statusbar:SetStatusBarColor(0, 0, 0, 0)
newLine.statusbar:SetMinMaxValues(0, 100)
newLine.statusbar:SetValue(0)
--create textures and icons
newLine.textura = newLine.statusbar:CreateTexture(nil, "artwork")
newLine.textura:SetHorizTile(false)
newLine.textura:SetVertTile(false)
newLine.statusbar:SetStatusBarTexture(newLine.textura)
--frame for hold the backdrop border
newLine.border = CreateFrame("Frame", "DetailsBarra_Border_" .. instance.meu_id .. "_" .. index, newLine.statusbar, "BackdropTemplate")
newLine.border:SetFrameLevel(newLine.statusbar:GetFrameLevel()+2)
newLine.border:SetAllPoints(newLine)
4 years ago
--border
newLine.lineBorder = DetailsFramework:CreateFullBorder(newLine:GetName() .. "Border", newLine.border)
3 years ago
--low 3d bar --search key: ~model
newLine.modelbox_low = CreateFrame("playermodel", "DetailsBarra_ModelBarLow_" .. instance.meu_id .. "_" .. index, newLine)
newLine.modelbox_low:SetFrameLevel(newLine.statusbar:GetFrameLevel()-1)
newLine.modelbox_low:SetPoint("topleft", newLine, "topleft")
newLine.modelbox_low:SetPoint("bottomright", newLine, "bottomright")
4 years ago
--high 3d bar
3 years ago
newLine.modelbox_high = CreateFrame("playermodel", "DetailsBarra_ModelBarHigh_" .. instance.meu_id .. "_" .. index, newLine)
newLine.modelbox_high:SetFrameLevel(newLine.statusbar:GetFrameLevel()+1)
newLine.modelbox_high:SetPoint("topleft", newLine, "topleft")
newLine.modelbox_high:SetPoint("bottomright", newLine, "bottomright")
--row background texture
newLine.background = newLine:CreateTexture(nil, "background")
newLine.background:SetTexture("")
newLine.background:SetAllPoints(newLine)
--overlay texture
newLine.overlayTexture = newLine.statusbar:CreateTexture(nil, "overlay")
newLine.overlayTexture:SetAllPoints()
4 years ago
3 years ago
--class icon
local classIcon = newLine.border:CreateTexture(nil, "overlay", nil, 5)
classIcon:SetHeight(instance.row_info.height)
classIcon:SetWidth(instance.row_info.height)
classIcon:SetTexture(instance.row_info.icon_file)
classIcon:SetTexCoord(.75, 1, .75, 1)
newLine.icone_classe = classIcon
--class icon highlight
local iconHightlight = newLine.border:CreateTexture(nil, "overlay", nil, 6)
iconHightlight:SetAllPoints(classIcon)
iconHightlight:Hide()
newLine.iconHighlight = iconHightlight
local iconFrame = CreateFrame("frame", "DetailsBarra_IconFrame_" .. instance.meu_id .. "_" .. index, newLine.statusbar)
iconFrame:SetPoint("topleft", classIcon, "topleft")
iconFrame:SetPoint("bottomright", classIcon, "bottomright")
iconFrame:SetFrameLevel(newLine.statusbar:GetFrameLevel()+1)
iconFrame.instance_id = instance.meu_id
iconFrame.row = newLine
newLine.icon_frame = iconFrame
classIcon:SetPoint("left", newLine, "left")
newLine.statusbar:SetPoint("topleft", classIcon, "topright")
newLine.statusbar:SetPoint("bottomright", newLine, "bottomright")
--left text 1
newLine.lineText1 = newLine.border:CreateFontString(nil, "overlay", "GameFontHighlight")
newLine.lineText1:SetPoint("left", newLine.icone_classe, "right", 3, 0)
newLine.lineText1:SetJustifyH("left")
newLine.lineText1:SetNonSpaceWrap (true)
4 years ago
--create text columns
for i = 2, 4 do
3 years ago
newLine["lineText" .. i] = newLine.border:CreateFontString(nil, "overlay", "GameFontHighlight")
end
--set the onclick, on enter scripts
setLineScripts(newLine, instance, index)
--hide
Details.FadeHandler.Fader(newLine, 1)
--adds the window container
instance.barras[index] = newLine
--set the left text
newLine.lineText1:SetText(Loc["STRING_NEWROW"])
--refresh rows
instance:InstanceRefreshRows()
Details:SendEvent("DETAILS_INSTANCE_NEWROW", nil, instance, newLine)
return newLine
4 years ago
end
3 years ago
function Details:SetBarTextSettings (size, font, fixedcolor, leftcolorbyclass, rightcolorbyclass, leftoutline, rightoutline, customrighttextenabled, customrighttext, percentage_type, showposition, customlefttextenabled, customlefttext, smalloutline_left, smalloutlinecolor_left, smalloutline_right, smalloutlinecolor_right, translittext)
--size
4 years ago
if (size) then
self.row_info.font_size = size
end
3 years ago
--font
4 years ago
if (font) then
self.row_info.font_face = font
3 years ago
self.row_info.font_face_file = SharedMedia:Fetch("font", font)
4 years ago
end
3 years ago
--fixed color
4 years ago
if (fixedcolor) then
3 years ago
local red, green, blue, alpha = gump:ParseColors(fixedcolor)
4 years ago
local c = self.row_info.fixed_text_color
c[1], c[2], c[3], c[4] = red, green, blue, alpha
end
3 years ago
--left color by class
if (type(leftcolorbyclass) == "boolean") then
4 years ago
self.row_info.textL_class_colors = leftcolorbyclass
end
3 years ago
--right color by class
if (type(rightcolorbyclass) == "boolean") then
4 years ago
self.row_info.textR_class_colors = rightcolorbyclass
end
3 years ago
--left text outline
if (type(leftoutline) == "boolean") then
4 years ago
self.row_info.textL_outline = leftoutline
end
3 years ago
--right text outline
if (type(rightoutline) == "boolean") then
4 years ago
self.row_info.textR_outline = rightoutline
end
3 years ago
4 years ago
-- left text small outline and small outline color
3 years ago
if (type(smalloutline_left) == "boolean") then
4 years ago
self.row_info.textL_outline_small = smalloutline_left
end
if (smalloutlinecolor_left) then
3 years ago
local red, green, blue, alpha = gump:ParseColors(smalloutlinecolor_left)
local color = self.row_info.textL_outline_small_color
color[1], color[2], color[3], color[4] = red, green, blue, alpha
4 years ago
end
-- right text small outline and small outline color
3 years ago
if (type(smalloutline_right) == "boolean") then
4 years ago
self.row_info.textR_outline_small = smalloutline_right
end
if (smalloutlinecolor_right) then
3 years ago
local red, green, blue, alpha = gump:ParseColors(smalloutlinecolor_right)
local color = self.row_info.textR_outline_small_color
color[1], color[2], color[3], color[4] = red, green, blue, alpha
4 years ago
end
3 years ago
--custom left text
if (type(customlefttextenabled) == "boolean") then
4 years ago
self.row_info.textL_enable_custom_text = customlefttextenabled
end
if (customlefttext) then
self.row_info.textL_custom_text = customlefttext
end
3 years ago
--custom right text
if (type(customrighttextenabled) == "boolean") then
4 years ago
self.row_info.textR_enable_custom_text = customrighttextenabled
end
if (customrighttext) then
self.row_info.textR_custom_text = customrighttext
end
3 years ago
--percent type
4 years ago
if (percentage_type) then
self.row_info.percent_type = percentage_type
end
3 years ago
--show position number
if (type(showposition) == "boolean") then
4 years ago
self.row_info.textL_show_number = showposition
end
3 years ago
--translit text by Vardex (https://github.com/Vardex May 22, 2019)
if (type(translittext) == "boolean") then
4 years ago
self.row_info.textL_translit_text = translittext
end
3 years ago
4 years ago
self:InstanceReset()
self:InstanceRefreshRows()
end
3 years ago
function Details:SetBarBackdropSettings(enabled, size, color, use_class_colors)
if (type(enabled) ~= "boolean") then
4 years ago
enabled = self.row_info.backdrop.enabled
end
4 years ago
if (not size) then
size = self.row_info.backdrop.size
end
4 years ago
if (not color) then
color = self.row_info.backdrop.color
end
if (type(use_class_colors) ~= "boolean") then
use_class_colors = self.row_info.backdrop.use_class_colors
end
3 years ago
4 years ago
self.row_info.backdrop.enabled = enabled
self.row_info.backdrop.size = size
self.row_info.backdrop.color = color
self.row_info.backdrop.use_class_colors = use_class_colors
4 years ago
self:InstanceReset()
self:InstanceRefreshRows()
self:ReajustaGump()
end
function Details:SetTitleBarSettings(shown, height, texture, color)
if (type(shown) ~= "boolean") then
shown = self.titlebar_shown
end
if (not height) then
height = self.titlebar_height
end
if (not texture) then
texture = self.titlebar_texture
end
if (not color) then
color = self.titlebar_texture_color
end
self.titlebar_shown = shown
self.titlebar_height = height
self.titlebar_texture = texture
self.titlebar_texture_color = color
end
function Details:RefreshTitleBar()
local shown = self.titlebar_shown
local height = self.titlebar_height
local texture = self.titlebar_texture
local color = self.titlebar_texture_color
local texturePath = SharedMedia:Fetch("statusbar", texture)
3 years ago
local titleBar = self.baseframe.titleBar
titleBar:SetShown(shown)
--menu_attribute_string is nil in tbc (20 jun 2022)
if (not self.menu_attribute_string) then
return
end
if (shown) then
titleBar:SetHeight(height)
titleBar.texture:SetTexture(texturePath)
titleBar.texture:SetVertexColor(DetailsFramework:ParseColors(color))
self.menu_attribute_string:SetParent(titleBar)
else
self.menu_attribute_string:SetParent(self.baseframe)
end
end
3 years ago
function Details:SetBarModel(upper_enabled, upper_model, upper_alpha, lower_enabled, lower_model, lower_alpha)
--is enabled
if (type(upper_enabled) == "boolean") then
4 years ago
self.row_info.models.upper_enabled = upper_enabled
end
3 years ago
if (type(lower_enabled) == "boolean") then
4 years ago
self.row_info.models.lower_enabled = lower_enabled
end
3 years ago
--models
4 years ago
if (upper_model) then
self.row_info.models.upper_model = upper_model
end
if (lower_model) then
self.row_info.models.lower_model = lower_model
end
3 years ago
--alpha values
4 years ago
if (upper_alpha) then
self.row_info.models.upper_alpha = upper_alpha
3 years ago
end
4 years ago
if (lower_alpha) then
self.row_info.models.lower_alpha = lower_alpha
end
3 years ago
4 years ago
self:InstanceReset()
self:InstanceRefreshRows()
self:ReajustaGump()
3 years ago
Details:RefreshMainWindow(-1, true)
4 years ago
end
-- ~spec ~icons
3 years ago
function Details:SetBarSpecIconSettings(enabled, iconfile, fulltrack)
if (type(enabled) ~= "boolean") then
4 years ago
enabled = self.row_info.use_spec_icons
end
if (not iconfile) then
iconfile = self.row_info.spec_file
end
3 years ago
4 years ago
self.row_info.use_spec_icons = enabled
self.row_info.spec_file = iconfile
3 years ago
4 years ago
if (enabled) then
3 years ago
if (not Details.track_specs) then
Details.track_specs = true
Details:TrackSpecsNow (fulltrack)
4 years ago
end
else
local have_enabled
3 years ago
for _, instance in ipairs(Details.tabela_instancias) do
4 years ago
if (instance:IsEnabled() and instance.row_info.use_spec_icons) then
have_enabled = true
break
end
end
if (not have_enabled) then
3 years ago
Details.track_specs = false
Details:ResetSpecCache(true) --force
4 years ago
end
end
3 years ago
self:InstanceReset()
self:InstanceRefreshRows()
self:ReajustaGump()
end
function Details:SetBarArenaRoleIconSettings(show_icon, icon_size_offset)
if (type(show_icon) ~= "boolean") then
show_icon = self.row_info.show_arena_role_icon
end
if (not icon_size_offset or type(icon_size_offset) ~= "number") then
icon_size_offset = self.row_info.arena_role_icon_size_offset
end
self.row_info.show_arena_role_icon = show_icon
self.row_info.arena_role_icon_size_offset = icon_size_offset
self:InstanceReset()
self:InstanceRefreshRows()
self:ReajustaGump()
end
function Details:SetBarFactionIconSettings(show_faction_icon, faction_icon_size_offset)
if (type(show_faction_icon) ~= "boolean") then
show_faction_icon = self.row_info.show_faction_icon
end
if (not faction_icon_size_offset or type(faction_icon_size_offset) ~= "number") then
faction_icon_size_offset = self.row_info.faction_icon_size_offset
end
self.row_info.show_faction_icon = show_faction_icon
self.row_info.faction_icon_size_offset = faction_icon_size_offset
4 years ago
self:InstanceReset()
self:InstanceRefreshRows()
self:ReajustaGump()
end
3 years ago
function Details:SetBarSettings(height, texture, colorclass, fixedcolor, backgroundtexture, backgroundcolorclass, backgroundfixedcolor, alpha, iconfile, barstart, spacement, texture_custom, icon_size_offset)
--bar start
if (type(barstart) == "boolean") then
4 years ago
self.row_info.start_after_icon = barstart
end
3 years ago
--icon file
4 years ago
if (iconfile) then
self.row_info.icon_file = iconfile
if (iconfile == "") then
self.row_info.no_icon = true
else
self.row_info.no_icon = false
end
end
3 years ago
--alpha
4 years ago
if (alpha) then
self.row_info.alpha = alpha
end
3 years ago
--height
4 years ago
if (height) then
self.row_info.height = height
self.row_height = height + self.row_info.space.between
end
3 years ago
--spacement
4 years ago
if (spacement) then
self.row_info.space.between = spacement
self.row_height = self.row_info.height + spacement
end
3 years ago
--texture
4 years ago
if (texture) then
self.row_info.texture = texture
3 years ago
self.row_info.texture_file = SharedMedia:Fetch("statusbar", texture)
4 years ago
end
3 years ago
4 years ago
if (texture_custom) then
self.row_info.texture_custom = texture_custom
self.row_info.texture_custom_file = "Interface\\" .. self.row_info.texture_custom
end
3 years ago
--color by class
if (type(colorclass) == "boolean") then
4 years ago
self.row_info.texture_class_colors = colorclass
end
3 years ago
--fixed color
4 years ago
if (fixedcolor) then
3 years ago
local red, green, blue = gump:ParseColors(fixedcolor)
local color = self.row_info.fixed_texture_color
color[1], color[2], color[3], color[4] = red, green, blue, self.row_info.alpha
4 years ago
end
3 years ago
--background texture
4 years ago
if (backgroundtexture) then
self.row_info.texture_background = backgroundtexture
3 years ago
self.row_info.texture_background_file = SharedMedia:Fetch("statusbar", backgroundtexture)
4 years ago
end
3 years ago
--background color by class
if (type(backgroundcolorclass) == "boolean") then
4 years ago
self.row_info.texture_background_class_color = backgroundcolorclass
end
3 years ago
--background fixed color
4 years ago
if (backgroundfixedcolor) then
3 years ago
local red, green, blue, alpha = gump:ParseColors(backgroundfixedcolor)
local color = self.row_info.fixed_texture_background_color
color[1], color[2], color[3], color[4] = red, green, blue, alpha
end
if (icon_size_offset and type(icon_size_offset) == "number") then
self.row_info.icon_size_offset = icon_size_offset
4 years ago
end
self:InstanceReset()
self:InstanceRefreshRows()
self:ReajustaGump()
end
local brackets = {
["("] = {" (", ")"},
["{"] = {" {", "}"},
["["] = {" [", "]"},
["<"] = {" <", ">"},
["NONE"] = {" ", ""},
}
local separators = {
[","] = ", ",
["."] = ". ",
[";"] = "; ",
["-"] = " - ",
["|"] = " | ",
["/"] = " / ",
["\\"] = " \\ ",
["~"] = " ~ ",
["NONE"] = "",
}
3 years ago
function Details:GetBarBracket()
return brackets[self.row_info.textR_bracket]
4 years ago
end
3 years ago
function Details:GetBarSeparator()
return separators[self.row_info.textR_separator]
4 years ago
end
3 years ago
function Details:SetBarRightTextSettings(total, persecond, percent, bracket, separator)
if (type(total) == "boolean") then
self.row_info.textR_show_data[1] = total
4 years ago
end
3 years ago
if (type(persecond) == "boolean") then
self.row_info.textR_show_data[2] = persecond
4 years ago
end
3 years ago
if (type(percent) == "boolean") then
self.row_info.textR_show_data[3] = percent
4 years ago
end
3 years ago
4 years ago
if (bracket) then
self.row_info.textR_bracket = bracket
end
if (separator) then
self.row_info.textR_separator = separator
end
self:InstanceReset()
end
--/script _detalhes:InstanceRefreshRows (_detalhes.tabela_instancias[1])
3 years ago
--onupdate function for 'Fast Updates' feature
local fastUpdatePerSecondFunc = function(self)
4 years ago
local instance = self.instance
3 years ago
4 years ago
if (not instance.showing) then
return
end
3 years ago
local combatTime = instance.showing:GetCombatTime()
local abbreviationType = Details.ps_abbreviation
local abbreviationFunc = tokFunctions[abbreviationType]
local isInLineTextEnabled = instance.use_multi_fontstrings
local instanceShowDataSettings = instance.row_info.textR_show_data
local showingAllData = instanceShowDataSettings[3] and instanceShowDataSettings[2] and instanceShowDataSettings[1]
local showingTotalAndPS = not instanceShowDataSettings[3] and instanceShowDataSettings[2] and instanceShowDataSettings[1]
local showingOnlyPS = not instanceShowDataSettings[3] and instanceShowDataSettings[2] and not instanceShowDataSettings[1]
4 years ago
if (instance.rows_fit_in_window) then
for i = 1, instance.rows_fit_in_window do --instance:GetNumRows()
local row = instance.barras [i] --instance:GetRow (i)
if (row and row:IsShown()) then
local actor = row.minha_tabela
if (actor) then
3 years ago
local currentDps = floor(actor.total / combatTime) --can also be hps
if (isInLineTextEnabled) then
if (showingAllData) then
row.lineText3:SetText(abbreviationFunc(nil, currentDps))
elseif (showingTotalAndPS or showingOnlyPS) then
row.lineText4:SetText(abbreviationFunc(nil, currentDps))
end
else
local dpsText = row.ps_text
if (dpsText) then
local formatedDps = abbreviationFunc(nil, currentDps)
row.lineText4:SetText((row.lineText4:GetText() or ""):gsub(dpsText, formatedDps))
row.ps_text = formatedDps
end
4 years ago
end
end
end
end
end
end
-- ~dps ~hps
3 years ago
--check if can start or need to stop
function Details:CheckPsUpdate()
local isEnabled = self.row_info.fast_ps_update
4 years ago
3 years ago
if (isEnabled) then
--check if the frame is created
4 years ago
if (not self.ps_update_frame) then
3 years ago
self.ps_update_frame = CreateFrame("frame", "DetailsInstance" .. self.meu_id .. "PsUpdate", self.baseframe)
4 years ago
self.ps_update_frame.instance = self
end
3 years ago
--if isn't in combat, just stop
if (not Details.in_combat) then
4 years ago
if (self.ps_update_frame.is_running) then
self.ps_update_frame.is_running = nil
self.ps_update_frame:Hide()
3 years ago
self.ps_update_frame:SetScript("OnUpdate", nil)
4 years ago
end
return
end
3 years ago
--check if needs to start
4 years ago
local attribute, sub_attribute = self:GetDisplay()
3 years ago
--check if the instance is showing damage done/dps or healing done/hps
4 years ago
if ( (attribute == 1 and (sub_attribute == 1 or sub_attribute == 2)) or (attribute == 2 and (sub_attribute == 1 or sub_attribute == 2))) then
if (not self.ps_update_frame.is_running) then
self.ps_update_frame.is_running = true
self.ps_update_frame:Show()
3 years ago
self.ps_update_frame:SetScript("OnUpdate", fastUpdatePerSecondFunc)
4 years ago
end
else
3 years ago
--check if needs to stop
4 years ago
if (self.ps_update_frame.is_running) then
self.ps_update_frame.is_running = nil
self.ps_update_frame:Hide()
3 years ago
self.ps_update_frame:SetScript("OnUpdate", nil)
4 years ago
end
end
3 years ago
4 years ago
else
if (self.ps_update_frame and self.ps_update_frame.is_running) then
self.ps_update_frame.is_running = nil
self.ps_update_frame:Hide()
3 years ago
self.ps_update_frame:SetScript("OnUpdate", nil)
4 years ago
end
end
end
-- /run _detalhes:GetInstance(1):FastPSUpdate (true)
-- /dump (_detalhes:GetInstance(1).fast_ps_update)
3 years ago
function Details:FastPSUpdate(enabled)
if (type(enabled) ~= "boolean") then
4 years ago
enabled = self.row_info.fast_ps_update
end
3 years ago
4 years ago
self.row_info.fast_ps_update = enabled
3 years ago
4 years ago
self:CheckPsUpdate()
end
function Details:AdjustInLineTextPadding()
3 years ago
for _, row in ipairs(self.barras) do
row.lineText2:SetPoint("right", row.statusbar, "right", -self.fontstrings_text2_anchor, 0)
row.lineText3:SetPoint("right", row.statusbar, "right", -self.fontstrings_text3_anchor, 0)
row.lineText4:SetPoint("right", row.statusbar, "right", -self.fontstrings_text4_anchor, 0)
end
end
4 years ago
-- search key: ~row ~bar ~updatebar
3 years ago
function Details:InstanceRefreshRows(instance)
if (instance) then
self = instance
4 years ago
end
3 years ago
4 years ago
if (not self.barras or not self.barras[1]) then
return
end
3 years ago
--mirror
local isInvertedBars = self.bars_inverted
--texture
local textureFile = SharedMedia:Fetch("statusbar", self.row_info.texture)
local textureFile2 = SharedMedia:Fetch("statusbar", self.row_info.texture_background)
--update texture files
self.row_info.texture_file = textureFile
self.row_info.texture_background_file = textureFile2
if (type(self.row_info.texture_custom) == "string" and self.row_info.texture_custom ~= "") then
textureFile = [[Interface\]] .. self.row_info.texture_custom
--update texture file
self.row_info.texture_custom_file = textureFile
end
--outline values
local left_text_outline = self.row_info.textL_outline
local right_text_outline = self.row_info.textR_outline
local textL_outline_small = self.row_info.textL_outline_small
local textL_outline_small_color = self.row_info.textL_outline_small_color
local textR_outline_small = self.row_info.textR_outline_small
local textR_outline_small_color = self.row_info.textR_outline_small_color
--texture color values
local texture_class_color = self.row_info.texture_class_colors
local texture_r, texture_g, texture_b
if (not texture_class_color) then
texture_r, texture_g, texture_b = unpack(self.row_info.fixed_texture_color)
end
4 years ago
--text color
3 years ago
local left_text_class_color = self.row_info.textL_class_colors
local right_text_class_color = self.row_info.textR_class_colors
local text_r, text_g, text_b
if (not left_text_class_color or not right_text_class_color) then
text_r, text_g, text_b = unpack(self.row_info.fixed_text_color)
end
local height = self.row_info.height
4 years ago
--alpha
3 years ago
local alpha = self.row_info.alpha
4 years ago
--icons
3 years ago
local no_icon = self.row_info.no_icon
local start_after_icon = self.row_info.start_after_icon
local isDesaturated = self.row_info.icon_grayscale
local icon_offset_x, icon_offset_y = unpack(self.row_info.icon_offset)
4 years ago
--line border
3 years ago
local lineBorderEnabled = self.row_info.backdrop.enabled
local lineBorderColor = self.row_info.backdrop.color
local lineBorderSize = self.row_info.backdrop.size
4 years ago
--font face
3 years ago
self.row_info.font_face_file = SharedMedia:Fetch("font", self.row_info.font_face)
4 years ago
--models
3 years ago
local upper_model_enabled = self.row_info.models.upper_enabled
local lower_model_enabled = self.row_info.models.lower_enabled
local upper_model = self.row_info.models.upper_model
local lower_model = self.row_info.models.lower_model
local upper_model_alpha = self.row_info.models.upper_alpha
local lower_model_alpha = self.row_info.models.lower_alpha
local overlayTexture = SharedMedia:Fetch("statusbar", self.row_info.overlay_texture)
local overlayColor = self.row_info.overlay_color
for _, row in ipairs(self.barras) do
--positioning and size
row:SetHeight(height)
row.icone_classe:SetSize(height, height)
if (isDesaturated) then
row.icone_classe:SetDesaturated(true)
row.iconHighlight:SetDesaturated(true)
4 years ago
else
3 years ago
row.icone_classe:SetDesaturated(false)
row.iconHighlight:SetDesaturated(false)
4 years ago
end
3 years ago
--icon and texture anchors
if (not isInvertedBars) then
4 years ago
row.lineText1:ClearAllPoints()
3 years ago
4 years ago
row.lineText2:ClearAllPoints()
row.lineText3:ClearAllPoints()
row.lineText4:ClearAllPoints()
3 years ago
4 years ago
row.lineText1:SetJustifyH("left")
row.lineText2:SetJustifyH("right")
row.lineText3:SetJustifyH("right")
row.lineText4:SetJustifyH("right")
if (not self.use_multi_fontstrings) then
row.lineText2:SetText("")
row.lineText3:SetText("")
end
3 years ago
4 years ago
row.lineText4:SetText("")
3 years ago
row.lineText2:SetPoint("right", row.statusbar, "right", -self.fontstrings_text2_anchor, 0)
row.lineText3:SetPoint("right", row.statusbar, "right", -self.fontstrings_text3_anchor, 0)
row.lineText4:SetPoint("right", row.statusbar, "right", -self.fontstrings_text4_anchor, 0)
4 years ago
if (no_icon) then
3 years ago
row.statusbar:SetPoint("topleft", row, "topleft")
row.statusbar:SetPoint("bottomright", row, "bottomright")
row.lineText1:SetPoint("left", row.statusbar, "left", 2, 0)
4 years ago
row.icone_classe:Hide()
3 years ago
row.iconHighlight:Hide()
4 years ago
else
row.icone_classe:ClearAllPoints()
3 years ago
row.icone_classe:SetPoint("left", row, "left", icon_offset_x, icon_offset_y)
4 years ago
row.icone_classe:Show()
3 years ago
4 years ago
if (start_after_icon) then
3 years ago
row.statusbar:SetPoint("topleft", row.icone_classe, "topright")
4 years ago
else
3 years ago
row.statusbar:SetPoint("topleft", row, "topleft")
4 years ago
end
3 years ago
row.statusbar:SetPoint("bottomright", row, "bottomright")
row.lineText1:SetPoint("left", row.icone_classe, "right", 3, 0)
4 years ago
end
else
row.lineText1:ClearAllPoints()
row.lineText2:ClearAllPoints()
row.lineText3:ClearAllPoints()
row.lineText4:ClearAllPoints()
row.lineText4:SetJustifyH("left")
row.lineText3:SetJustifyH("left")
row.lineText2:SetJustifyH("left")
row.lineText1:SetJustifyH("right")
3 years ago
row.lineText4:SetPoint("left", row.statusbar, "left", self.fontstrings_text4_anchor + 1, 0)
row.lineText3:SetPoint("left", row.statusbar, "left", self.fontstrings_text3_anchor + 1, 0)
row.lineText2:SetPoint("left", row.statusbar, "left", self.fontstrings_text2_anchor + 1, 0)
4 years ago
if (no_icon) then
3 years ago
row.statusbar:SetPoint("topleft", row, "topleft")
row.statusbar:SetPoint("bottomright", row, "bottomright")
row.lineText1:SetPoint("right", row.statusbar, "right", -2, 0)
4 years ago
row.icone_classe:Hide()
3 years ago
row.iconHighlight:Hide()
--[[ Deprecation of right_to_left_texture in favor of StatusBar:SetReverseFill 5/2/2022 - Flamanis
3 years ago
row.right_to_left_texture:SetPoint("topright", row.statusbar, "topright")
row.right_to_left_texture:SetPoint("bottomright", row.statusbar, "bottomright")]]
4 years ago
else
row.icone_classe:ClearAllPoints()
3 years ago
row.icone_classe:SetPoint("right", row, "right", icon_offset_x, icon_offset_y)
4 years ago
row.icone_classe:Show()
3 years ago
4 years ago
if (start_after_icon) then
3 years ago
row.statusbar:SetPoint("bottomright", row.icone_classe, "bottomleft")
4 years ago
else
3 years ago
row.statusbar:SetPoint("bottomright", row, "bottomright")
4 years ago
end
3 years ago
row.statusbar:SetPoint("topleft", row, "topleft")
row.lineText1:SetPoint("right", row.icone_classe, "left", -2, 0)
4 years ago
end
end
3 years ago
4 years ago
if (not self.row_info.texture_background_class_color) then
3 years ago
local color = self.row_info.fixed_texture_background_color
row.background:SetVertexColor(color[1], color[2], color[3], color[4])
4 years ago
else
3 years ago
local color = self.row_info.fixed_texture_background_color
4 years ago
local r, g, b = row.background:GetVertexColor()
3 years ago
row.background:SetVertexColor(r, g, b, color[4])
4 years ago
end
3 years ago
--outline
4 years ago
if (left_text_outline) then
3 years ago
Details:SetFontOutline(row.lineText1, left_text_outline)
4 years ago
else
3 years ago
Details:SetFontOutline(row.lineText1, nil)
4 years ago
end
3 years ago
4 years ago
if (right_text_outline) then
3 years ago
self:SetFontOutline(row.lineText2, right_text_outline)
self:SetFontOutline(row.lineText3, right_text_outline)
self:SetFontOutline(row.lineText4, right_text_outline)
4 years ago
else
3 years ago
self:SetFontOutline(row.lineText2, nil)
self:SetFontOutline(row.lineText3, nil)
self:SetFontOutline(row.lineText4, nil)
4 years ago
end
3 years ago
--small outline
4 years ago
if (textL_outline_small) then
3 years ago
local color = textL_outline_small_color
row.lineText1:SetShadowColor(color[1], color[2], color[3], color[4])
4 years ago
else
3 years ago
row.lineText1:SetShadowColor(0, 0, 0, 0)
4 years ago
end
if (textR_outline_small) then
3 years ago
local color = textR_outline_small_color
row.lineText4:SetShadowColor(color[1], color[2], color[3], color[4])
row.lineText3:SetShadowColor(color[1], color[2], color[3], color[4])
row.lineText2:SetShadowColor(color[1], color[2], color[3], color[4])
4 years ago
else
3 years ago
row.lineText4:SetShadowColor(0, 0, 0, 0)
row.lineText3:SetShadowColor(0, 0, 0, 0)
row.lineText2:SetShadowColor(0, 0, 0, 0)
end
--texture
row.textura:SetTexture(textureFile)
row.background:SetTexture(textureFile2)
row.overlayTexture:SetTexture(overlayTexture)
row.overlayTexture:SetVertexColor(unpack(overlayColor))
3 years ago
if (isInvertedBars) then
row.statusbar:SetReverseFill(true)
4 years ago
else
row.statusbar:SetReverseFill(false)
4 years ago
end
3 years ago
--texture class color: if true color changes on the fly through class refresh
4 years ago
if (not texture_class_color) then
3 years ago
row.textura:SetVertexColor(texture_r, texture_g, texture_b, alpha)
4 years ago
else
--automatically color the bar by the actor class
--forcing alpha 1 instead of use the alpha from the fixed color
local r, g, b = row.textura:GetVertexColor()
3 years ago
row.textura:SetVertexColor(r, g, b, 1) --alpha
4 years ago
end
3 years ago
--text class color: if true color changes on the fly through class refresh
4 years ago
if (not left_text_class_color) then
3 years ago
row.lineText1:SetTextColor(text_r, text_g, text_b)
4 years ago
end
if (not right_text_class_color) then
3 years ago
row.lineText4:SetTextColor(text_r, text_g, text_b)
row.lineText3:SetTextColor(text_r, text_g, text_b)
row.lineText2:SetTextColor(text_r, text_g, text_b)
end
--text size
Details:SetFontSize(row.lineText1, self.row_info.font_size or height * 0.75)
Details:SetFontSize(row.lineText2, self.row_info.font_size or height * 0.75)
Details:SetFontSize(row.lineText3, self.row_info.font_size or height * 0.75)
Details:SetFontSize(row.lineText4, self.row_info.font_size or height * 0.75)
--text font
Details:SetFontFace(row.lineText1, self.row_info.font_face_file or "GameFontHighlight")
Details:SetFontFace(row.lineText2, self.row_info.font_face_file or "GameFontHighlight")
Details:SetFontFace(row.lineText3, self.row_info.font_face_file or "GameFontHighlight")
Details:SetFontFace(row.lineText4, self.row_info.font_face_file or "GameFontHighlight")
4 years ago
--backdrop
if (lineBorderEnabled) then
row.lineBorder:Show()
row.lineBorder:SetVertexColor(unpack(lineBorderColor))
row.lineBorder:SetBorderSizes(lineBorderSize, lineBorderSize, lineBorderSize, lineBorderSize)
row.lineBorder:UpdateSizes()
else
row.lineBorder:Hide()
3 years ago
end
--models
4 years ago
if (upper_model_enabled) then
row.using_upper_3dmodels = true
row.modelbox_high:Show()
3 years ago
row.modelbox_high:SetModel(upper_model)
row.modelbox_high:SetAlpha(upper_model_alpha)
4 years ago
else
row.using_upper_3dmodels = false
row.modelbox_high:Hide()
end
3 years ago
4 years ago
if (lower_model_enabled) then
row.using_lower_3dmodels = true
row.modelbox_low:Show()
3 years ago
row.modelbox_low:SetModel(lower_model)
row.modelbox_low:SetAlpha(lower_model_alpha)
4 years ago
else
row.using_lower_3dmodels = false
row.modelbox_low:Hide()
end
end
3 years ago
4 years ago
self:SetBarGrowDirection()
self:UpdateClickThrough()
end
function Details:SetBarOverlaySettings(overlayTexture, overlayColor)
overlayTexture = overlayTexture or self.row_info.overlay_texture
overlayColor = overlayColor or self.row_info.overlay_color
self.row_info.overlay_texture = overlayTexture
self.row_info.overlay_color[1] = overlayColor[1]
self.row_info.overlay_color[2] = overlayColor[2]
self.row_info.overlay_color[3] = overlayColor[3]
self.row_info.overlay_color[4] = overlayColor[4]
self:InstanceRefreshRows()
end
3 years ago
--adjust to which frame the wallpaper texture is parented to
--dependind on the frame it can be shown above or below background textures
function Details:SetInstanceWallpaperLevel(wallpaperLevel)
if (type(wallpaperLevel) ~= "number") then
wallpaperLevel = self.wallpaper.level
end
self.wallpaper.level = wallpaperLevel
--refresh the wallpaper parent
local wallpaperTexture = self.baseframe.wallpaper
if (wallpaperLevel == 0) then
wallpaperTexture:SetParent(self.baseframe.titleBar) --framelevel +0 (parented to titleBar)
elseif (wallpaperLevel == 1) then
wallpaperTexture:SetParent(self.baseframe) --framelevel +0
elseif (wallpaperLevel == 2) then
wallpaperTexture:SetParent(self.rowframe) --framelevel +3
4 years ago
3 years ago
elseif (wallpaperLevel == 3) then
wallpaperTexture:SetParent(self.windowSwitchButton) --framelevel +4
end
end
-- search key: ~wallpaper
function Details:InstanceWallpaper(texture, anchor, alpha, texCoord, width, height, overlay)
4 years ago
local wallpaper = self.wallpaper
3 years ago
if (type(texture) == "boolean" and texture) then
texture, anchor, alpha, texCoord, width, height, overlay = wallpaper.texture, wallpaper.anchor, wallpaper.alpha, wallpaper.texcoord, wallpaper.width, wallpaper.height, wallpaper.overlay
elseif (type(texture) == "boolean" and not texture) then
4 years ago
self.wallpaper.enabled = false
3 years ago
return Details.FadeHandler.Fader(self.baseframe.wallpaper, "in")
elseif (type(texture) == "table") then
4 years ago
anchor = texture.anchor or wallpaper.anchor
alpha = texture.alpha or wallpaper.alpha
3 years ago
4 years ago
if (texture.texcoord) then
3 years ago
texCoord = {unpack(texture.texcoord)}
4 years ago
else
3 years ago
texCoord = wallpaper.texcoord
4 years ago
end
3 years ago
4 years ago
width = texture.width or wallpaper.width
height = texture.height or wallpaper.height
3 years ago
4 years ago
if (texture.overlay) then
3 years ago
overlay = {unpack(texture.overlay)}
4 years ago
else
overlay = wallpaper.overlay
end
3 years ago
if (type(texture.enabled) == "boolean") then
4 years ago
if (not texture.enabled) then
wallpaper.enabled = false
wallpaper.texture = texture.texture or wallpaper.texture
wallpaper.anchor = anchor
wallpaper.alpha = alpha
3 years ago
wallpaper.texcoord = texCoord
4 years ago
wallpaper.width = width
wallpaper.height = height
wallpaper.overlay = overlay
return self:InstanceWallpaper (false)
end
end
3 years ago
4 years ago
texture = texture.texture or wallpaper.texture
else
texture = texture or wallpaper.texture
anchor = anchor or wallpaper.anchor
alpha = alpha or wallpaper.alpha
3 years ago
texCoord = texCoord or wallpaper.texcoord
4 years ago
width = width or wallpaper.width
height = height or wallpaper.height
overlay = overlay or wallpaper.overlay
end
3 years ago
4 years ago
if (not wallpaper.texture and not texture) then
texture = "Interface\\AddOns\\Details\\images\\background"
3 years ago
texCoord = {0, 1, 0, 0.7}
4 years ago
alpha = 0.5
width, height = self:GetSize()
anchor = "all"
end
3 years ago
local wallpaperTable = self.baseframe.wallpaper
wallpaperTable:ClearAllPoints()
4 years ago
if (anchor == "all") then
3 years ago
wallpaperTable:SetPoint("topleft", self.baseframe, "topleft")
wallpaperTable:SetPoint("bottomright", self.baseframe, "bottomright")
elseif (anchor == "titlebar") then
3 years ago
wallpaperTable:SetPoint("topleft", self.baseframe.titleBar, "topleft", 0, 0)
wallpaperTable:SetPoint("bottomright", self.baseframe, "bottomright", 1, -1)
4 years ago
elseif (anchor == "center") then
3 years ago
wallpaperTable:SetPoint("center", self.baseframe, "center", 0, 4)
4 years ago
elseif (anchor == "stretchLR") then
3 years ago
wallpaperTable:SetPoint("center", self.baseframe, "center")
wallpaperTable:SetPoint("left", self.baseframe, "left")
wallpaperTable:SetPoint("right", self.baseframe, "right")
4 years ago
elseif (anchor == "stretchTB") then
3 years ago
wallpaperTable:SetPoint("center", self.baseframe, "center")
wallpaperTable:SetPoint("top", self.baseframe, "top")
wallpaperTable:SetPoint("bottom", self.baseframe, "bottom")
4 years ago
else
3 years ago
wallpaperTable:SetPoint(anchor, self.baseframe, anchor)
end
wallpaperTable:SetTexture(texture)
wallpaperTable:SetTexCoord(unpack(texCoord))
wallpaperTable:SetWidth(width)
wallpaperTable:SetHeight(height)
wallpaperTable:SetVertexColor(unpack(overlay))
4 years ago
wallpaper.enabled = true
wallpaper.texture = texture
wallpaper.anchor = anchor
wallpaper.alpha = alpha
3 years ago
wallpaper.texcoord = texCoord
4 years ago
wallpaper.width = width
wallpaper.height = height
wallpaper.overlay = overlay
3 years ago
wallpaperTable:Show()
Details.FadeHandler.Fader(wallpaperTable, "ALPHAANIM", alpha)
4 years ago
end
3 years ago
function Details:GetTextures()
local textureTable = {}
textureTable[1] = self.baseframe.rodape.esquerdo
textureTable[2] = self.baseframe.rodape.direita
textureTable[3] = self.baseframe.rodape.top_bg
textureTable[4] = self.baseframe.cabecalho.ball_r
textureTable[5] = self.baseframe.cabecalho.ball
textureTable[6] = self.baseframe.cabecalho.emenda
textureTable[7] = self.baseframe.cabecalho.top_bg
textureTable[8] = self.baseframe.barra_esquerda
textureTable[9] = self.baseframe.barra_direita
textureTable[10] = self.baseframe.UPFrame
return textureTable
end
function Details:SetWindowAlphaForInteract(alpha)
local ignoreBars = self.menu_alpha.ignorebars
4 years ago
if (self.is_interacting) then
3 years ago
--mouse entered the window
self.baseframe:SetAlpha(alpha)
self:InstanceAlpha(alpha)
self:SetIconAlpha(alpha, nil, true)
if (ignoreBars) then
self.rowframe:SetFrameAlpha(1)
4 years ago
else
3 years ago
self.rowframe:SetFrameAlpha(alpha)
4 years ago
end
else
3 years ago
--mouse left the window
if (self.combat_changes_alpha and self.combat_changes_alpha ~= 1) then --combat alpha
self:InstanceAlpha(self.combat_changes_alpha)
self:SetIconAlpha(self.combat_changes_alpha, nil, true)
self.rowframe:SetFrameAlpha(self.combat_changes_alpha) --alpha do combate � absoluta
self.baseframe:SetAlpha(self.combat_changes_alpha) --alpha do combate � absoluta
4 years ago
else
3 years ago
self:InstanceAlpha(alpha)
self:SetIconAlpha(alpha, nil, true)
if (ignoreBars) then
self.rowframe:SetFrameAlpha(1)
4 years ago
else
3 years ago
self.rowframe:SetFrameAlpha(alpha)
4 years ago
end
3 years ago
self.baseframe:SetAlpha(alpha)
4 years ago
end
end
3 years ago
if (Details.debug) then
Details:Msg("(debug) setting window alpha for SetWindowAlphaForInteract() -> ", alpha)
end
4 years ago
end
-- ~autohide �utohide
3 years ago
function Details:SetWindowAlphaForCombat(enteringInCombat, trueHide, alphaAmount)
4 years ago
local amount, rowsamount, menuamount
--get the values
3 years ago
if (enteringInCombat) then
4 years ago
amount = alphaAmount / 100
self.combat_changes_alpha = amount
rowsamount = amount
menuamount = amount
3 years ago
if (Details.pet_battle) then
4 years ago
amount = 0
rowsamount = 0
menuamount = 0
end
else
if (self.menu_alpha.enabled) then --auto transparency
if (self.is_interacting) then
amount = self.menu_alpha.onenter
menuamount = self.menu_alpha.onenter
if (self.menu_alpha.ignorebars) then
rowsamount = 1
else
rowsamount = amount
end
else
amount = self.menu_alpha.onleave
menuamount = self.menu_alpha.onleave
if (self.menu_alpha.ignorebars) then
rowsamount = 1
else
rowsamount = amount
end
end
else
amount = self.color[4]
menuamount = 1
rowsamount = 1
end
self.combat_changes_alpha = nil
end
3 years ago
4 years ago
--apply
3 years ago
if (trueHide and amount == 0) then
4 years ago
self.baseframe:Hide()
self.rowframe:Hide()
self.windowSwitchButton:Hide()
3 years ago
if (Details.debug) then
Details:Msg("(debug) hiding window SetWindowAlphaForCombat()", amount, rowsamount, menuamount)
end
4 years ago
else
self.baseframe:Show()
3 years ago
self.baseframe:SetAlpha(1)
self:InstanceAlpha(min(amount, self.color[4]))
Details.FadeHandler.Fader(self.rowframe, "ALPHAANIM", parseRowFrameAlpha(rowsamount))
4 years ago
Details.FadeHandler.Fader(self.baseframe, "ALPHAANIM", rowsamount)
end
3 years ago
4 years ago
if (self.show_statusbar) then
self.baseframe.barra_fundo:Hide()
end
if (self.hide_icon) then
self.baseframe.cabecalho.atributo_icon:Hide()
end
end
--this function is called only from SetAutoHideMenu()
3 years ago
function Details:InstanceButtonsColors(red, green, blue, alpha, noSave, onlyLeft, onlyRight)
4 years ago
if (not red) then
3 years ago
red, green, blue, alpha = unpack(self.color_buttons)
4 years ago
end
3 years ago
if (type(red) ~= "number") then
red, green, blue, alpha = gump:ParseColors(red)
4 years ago
end
3 years ago
if (not noSave) then
self.color_buttons[1] = red
self.color_buttons[2] = green
self.color_buttons[3] = blue
self.color_buttons[4] = alpha
4 years ago
end
3 years ago
4 years ago
local baseToolbar = self.baseframe.cabecalho
3 years ago
if (onlyLeft) then
4 years ago
local icons = {baseToolbar.modo_selecao, baseToolbar.segmento, baseToolbar.atributo, baseToolbar.report, baseToolbar.fechar, baseToolbar.reset, baseToolbar.fechar}
3 years ago
for _, button in ipairs(icons) do
button:SetAlpha(alpha)
4 years ago
end
if (self:IsLowerInstance()) then
3 years ago
for _, ThisButton in ipairs(Details.ToolBar.Shown) do
ThisButton:SetAlpha(alpha)
4 years ago
end
end
else
local icons = {baseToolbar.modo_selecao, baseToolbar.segmento, baseToolbar.atributo, baseToolbar.report, baseToolbar.fechar, baseToolbar.reset, baseToolbar.fechar}
3 years ago
for _, button in ipairs(icons) do
button:SetAlpha(alpha)
4 years ago
end
if (self:IsLowerInstance()) then
3 years ago
for _, ThisButton in ipairs(Details.ToolBar.Shown) do
ThisButton:SetAlpha(alpha)
4 years ago
end
end
end
end
3 years ago
function Details:InstanceAlpha(alpha)
self.baseframe.cabecalho.ball_r:SetAlpha(alpha)
self.baseframe.cabecalho.ball:SetAlpha(alpha)
local skin = Details.skins[self.skin]
4 years ago
if (not skin.icon_ignore_alpha) then
3 years ago
self.baseframe.cabecalho.atributo_icon:SetAlpha(alpha)
end
4 years ago
3 years ago
self.baseframe.cabecalho.emenda:SetAlpha(alpha)
self.baseframe.cabecalho.top_bg:SetAlpha(alpha)
self.baseframe.barra_esquerda:SetAlpha(alpha)
self.baseframe.barra_direita:SetAlpha(alpha)
self.baseframe.barra_fundo:SetAlpha(alpha)
self.baseframe.UPFrame:SetAlpha(alpha)
end
4 years ago
3 years ago
function Details:InstanceColor(red, green, blue, alpha, noSave, changeStatusbar)
4 years ago
if (not red) then
3 years ago
red, green, blue, alpha = unpack(self.color)
noSave = true
4 years ago
end
3 years ago
if (type(red) ~= "number") then
red, green, blue, alpha = gump:ParseColors(red)
4 years ago
end
3 years ago
if (not noSave) then
--saving
self.color[1] = red
self.color[2] = green
self.color[3] = blue
self.color[4] = alpha
if (changeStatusbar) then
self:StatusBarColor(red, green, blue, alpha)
4 years ago
end
else
3 years ago
--not saving
self:StatusBarColor(nil, nil, nil, alpha, true)
4 years ago
end
3 years ago
local skin = Details.skins[self.skin]
4 years ago
if (not skin) then --the skin isn't available any more
--put the skin into wait to install
local tempSkin = self:WaitForSkin()
skin = tempSkin
4 years ago
end
3 years ago
self.baseframe.cabecalho.ball_r:SetVertexColor(red, green, blue)
self.baseframe.cabecalho.ball_r:SetAlpha(alpha)
self.baseframe.cabecalho.ball:SetVertexColor(red, green, blue)
self.baseframe.cabecalho.ball:SetAlpha(alpha)
4 years ago
if (not skin.icon_ignore_alpha) then
3 years ago
self.baseframe.cabecalho.atributo_icon:SetAlpha(alpha)
4 years ago
end
3 years ago
self.baseframe.cabecalho.emenda:SetVertexColor(red, green, blue)
self.baseframe.cabecalho.emenda:SetAlpha(alpha)
self.baseframe.cabecalho.top_bg:SetVertexColor(red, green, blue)
self.baseframe.cabecalho.top_bg:SetAlpha(alpha)
4 years ago
3 years ago
self.baseframe.barra_esquerda:SetVertexColor(red, green, blue)
self.baseframe.barra_esquerda:SetAlpha(alpha)
self.baseframe.barra_direita:SetVertexColor(red, green, blue)
self.baseframe.barra_direita:SetAlpha(alpha)
self.baseframe.barra_fundo:SetVertexColor(red, green, blue)
self.baseframe.barra_fundo:SetAlpha(alpha)
4 years ago
3 years ago
self.baseframe.UPFrame:SetAlpha(alpha)
4 years ago
end
3 years ago
function Details:StatusBarAlertTime(instance)
4 years ago
instance.baseframe.statusbar:Hide()
end
3 years ago
function Details:StatusBarAlert(text, icon, color, time)
4 years ago
local statusbar = self.baseframe.statusbar
3 years ago
4 years ago
if (text) then
3 years ago
if (type(text) == "table") then
4 years ago
if (text.color) then
3 years ago
statusbar.text:SetTextColor(gump:ParseColors(text.color))
4 years ago
else
3 years ago
statusbar.text:SetTextColor(1, 1, 1, 1)
4 years ago
end
3 years ago
statusbar.text:SetText(text.text or "")
4 years ago
if (text.size) then
3 years ago
Details:SetFontSize(statusbar.text, text.size)
4 years ago
else
3 years ago
Details:SetFontSize(statusbar.text, 9)
4 years ago
end
else
3 years ago
statusbar.text:SetText(text)
statusbar.text:SetTextColor(1, 1, 1, 1)
Details:SetFontSize(statusbar.text, 9)
4 years ago
end
else
3 years ago
statusbar.text:SetText("")
4 years ago
end
3 years ago
4 years ago
if (icon) then
3 years ago
if (type(icon) == "table") then
local texture, w, h, l, r, t, b = unpack(icon)
statusbar.icon:SetTexture(texture)
statusbar.icon:SetWidth(w or 14)
statusbar.icon:SetHeight(h or 14)
4 years ago
if (l and r and t and b) then
3 years ago
statusbar.icon:SetTexCoord(l, r, t, b)
4 years ago
end
else
3 years ago
statusbar.icon:SetTexture(icon)
statusbar.icon:SetWidth(14)
statusbar.icon:SetHeight(14)
statusbar.icon:SetTexCoord(0, 1, 0, 1)
4 years ago
end
else
3 years ago
statusbar.icon:SetTexture("")
4 years ago
end
3 years ago
4 years ago
if (color) then
3 years ago
statusbar:SetBackdropColor(gump:ParseColors(color))
4 years ago
else
3 years ago
statusbar:SetBackdropColor(0, 0, 0, 1)
4 years ago
end
3 years ago
4 years ago
if (icon or text) then
statusbar:Show()
if (time) then
3 years ago
Details:ScheduleTimer("StatusBarAlertTime", time, self)
4 years ago
end
else
statusbar:Hide()
end
end
3 years ago
function gump:CriaRodape(baseframe, instancia)
4 years ago
baseframe.rodape = {}
3 years ago
--esquerdo com statusbar
baseframe.rodape.esquerdo = instancia.floatingframe:CreateTexture(nil, "overlay")
baseframe.rodape.esquerdo:SetPoint("topright", baseframe, "bottomleft", 16, 0)
baseframe.rodape.esquerdo:SetTexture(DEFAULT_SKIN)
baseframe.rodape.esquerdo:SetTexCoord(unpack(COORDS_PIN_LEFT))
baseframe.rodape.esquerdo:SetWidth(32)
baseframe.rodape.esquerdo:SetHeight(32)
--esquerdo sem statusbar
baseframe.rodape.esquerdo_nostatusbar = instancia.floatingframe:CreateTexture(nil, "overlay")
baseframe.rodape.esquerdo_nostatusbar:SetPoint("topright", baseframe, "bottomleft", 16, 14)
baseframe.rodape.esquerdo_nostatusbar:SetTexture(DEFAULT_SKIN)
baseframe.rodape.esquerdo_nostatusbar:SetTexCoord(unpack(COORDS_PIN_LEFT))
baseframe.rodape.esquerdo_nostatusbar:SetWidth(32)
baseframe.rodape.esquerdo_nostatusbar:SetHeight(32)
--direito com statusbar
baseframe.rodape.direita = instancia.floatingframe:CreateTexture(nil, "overlay")
baseframe.rodape.direita:SetPoint("topleft", baseframe, "bottomright", -16, 0)
baseframe.rodape.direita:SetTexture(DEFAULT_SKIN)
baseframe.rodape.direita:SetTexCoord(unpack(COORDS_PIN_RIGHT))
baseframe.rodape.direita:SetWidth(32)
baseframe.rodape.direita:SetHeight(32)
--direito sem statusbar
baseframe.rodape.direita_nostatusbar = instancia.floatingframe:CreateTexture(nil, "overlay")
baseframe.rodape.direita_nostatusbar:SetPoint("topleft", baseframe, "bottomright", -16, 14)
baseframe.rodape.direita_nostatusbar:SetTexture(DEFAULT_SKIN)
baseframe.rodape.direita_nostatusbar:SetTexCoord(unpack(COORDS_PIN_RIGHT))
baseframe.rodape.direita_nostatusbar:SetWidth(32)
baseframe.rodape.direita_nostatusbar:SetHeight(32)
--barra centro
baseframe.rodape.top_bg = baseframe:CreateTexture(nil, "background")
baseframe.rodape.top_bg:SetTexture(DEFAULT_SKIN)
baseframe.rodape.top_bg:SetTexCoord(unpack(COORDS_BOTTOM_BACKGROUND))
baseframe.rodape.top_bg:SetWidth(512)
baseframe.rodape.top_bg:SetHeight(128)
baseframe.rodape.top_bg:SetPoint("left", baseframe.rodape.esquerdo, "right", -16, -48)
baseframe.rodape.top_bg:SetPoint("right", baseframe.rodape.direita, "left", 16, -48)
local StatusBarLeftAnchor = CreateFrame("frame", "DetailsStatusBarAnchorLeft" .. instancia.meu_id, baseframe)
StatusBarLeftAnchor:SetPoint("left", baseframe.rodape.top_bg, "left", 5, 57)
StatusBarLeftAnchor:SetWidth(1)
StatusBarLeftAnchor:SetHeight(1)
4 years ago
baseframe.rodape.StatusBarLeftAnchor = StatusBarLeftAnchor
3 years ago
local StatusBarCenterAnchor = CreateFrame("frame", "DetailsStatusBarAnchorCenter" .. instancia.meu_id, baseframe)
StatusBarCenterAnchor:SetPoint("center", baseframe.rodape.top_bg, "center", 0, 57)
StatusBarCenterAnchor:SetWidth(1)
StatusBarCenterAnchor:SetHeight(1)
4 years ago
baseframe.rodape.StatusBarCenterAnchor = StatusBarCenterAnchor
3 years ago
--display frame
baseframe.statusbar = CreateFrame("frame", "DetailsStatusBar" .. instancia.meu_id, instancia.floatingframe,"BackdropTemplate")
baseframe.statusbar:SetFrameLevel(instancia.floatingframe:GetFrameLevel() + 2)
baseframe.statusbar:SetPoint("left", baseframe.rodape.esquerdo, "right", -13, 10)
baseframe.statusbar:SetPoint("right", baseframe.rodape.direita, "left", 13, 10)
baseframe.statusbar:SetHeight(14)
local statusbar_icon = baseframe.statusbar:CreateTexture(nil, "overlay")
statusbar_icon:SetWidth(14)
statusbar_icon:SetHeight(14)
statusbar_icon:SetPoint("left", baseframe.statusbar, "left")
local statusbar_text = baseframe.statusbar:CreateFontString(nil, "overlay", "GameFontNormal")
statusbar_text:SetPoint("left", statusbar_icon, "right", 2, 0)
baseframe.statusbar:SetBackdrop({
bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16,
insets = {left = 0, right = 0, top = 0, bottom = 0}})
baseframe.statusbar:SetBackdropColor(0, 0, 0, 1)
baseframe.statusbar.icon = statusbar_icon
baseframe.statusbar.text = statusbar_text
baseframe.statusbar.instancia = instancia
baseframe.statusbar:Hide()
--frame invis�vel
baseframe.DOWNFrame = CreateFrame("frame", "DetailsDownFrame" .. instancia.meu_id, baseframe)
baseframe.DOWNFrame:SetPoint("left", baseframe.rodape.esquerdo, "right", 0, 10)
baseframe.DOWNFrame:SetPoint("right", baseframe.rodape.direita, "left", 0, 10)
baseframe.DOWNFrame:SetHeight(14)
4 years ago
baseframe.DOWNFrame:Show()
3 years ago
baseframe.DOWNFrame:EnableMouse(true)
baseframe.DOWNFrame:SetMovable(true)
baseframe.DOWNFrame:SetResizable(true)
BGFrame_scripts(baseframe.DOWNFrame, baseframe, instancia)
4 years ago
end
3 years ago
function Details:GetMenuAnchorPoint()
4 years ago
local toolbar_side = self.toolbar_side
local menu_side = self.menu_anchor.side
3 years ago
4 years ago
if (menu_side == 1) then --left
if (toolbar_side == 1) then --top
return self.menu_points [1], "bottomleft", "bottomright"
3 years ago
4 years ago
elseif (toolbar_side == 2) then --bottom
return self.menu_points [1], "topleft", "topright"
end
3 years ago
4 years ago
elseif (menu_side == 2) then --right
if (toolbar_side == 1) then --top
return self.menu_points [2], "topleft", "bottomleft"
3 years ago
4 years ago
elseif (toolbar_side == 2) then --bottom
return self.menu_points [2], "topleft", "topleft"
end
end
end
3 years ago
--search key: ~icon
function Details:ToolbarMenuButtonsSize(size)
4 years ago
size = size or self.menu_icons_size
self.menu_icons_size = size
return self:ToolbarMenuButtons()
end
local SetIconAlphaCacheButtonsTable = {}
3 years ago
function Details:SetIconAlpha(alpha, hide, noAnimations)
4 years ago
if (self.attribute_text.enabled) then
3 years ago
if (not self.menu_attribute_string) then
--created on demand
4 years ago
self:AttributeMenu()
end
3 years ago
4 years ago
if (hide) then
3 years ago
Details.FadeHandler.Fader(self.menu_attribute_string.widget, unpack(Details.windows_fade_in))
4 years ago
else
3 years ago
if (noAnimations) then
self.menu_attribute_string:SetAlpha(alpha)
4 years ago
else
3 years ago
Details.FadeHandler.Fader(self.menu_attribute_string.widget, "ALPHAANIM", alpha)
4 years ago
end
end
end
3 years ago
table.wipe(SetIconAlphaCacheButtonsTable)
SetIconAlphaCacheButtonsTable[1] = self.baseframe.cabecalho.modo_selecao
SetIconAlphaCacheButtonsTable[2] = self.baseframe.cabecalho.segmento
SetIconAlphaCacheButtonsTable[3] = self.baseframe.cabecalho.atributo
SetIconAlphaCacheButtonsTable[4] = self.baseframe.cabecalho.report
SetIconAlphaCacheButtonsTable[5] = self.baseframe.cabecalho.reset
SetIconAlphaCacheButtonsTable[6] = self.baseframe.cabecalho.fechar
4 years ago
if (alpha == 1) then
alpha = self.menu_icons_alpha
3 years ago
--fix for old instances using 0.5 in the 'menu_icons_alpha'
if (DetailsFramework:IsNearlyEqual(self.menu_icons_alpha, 0.5)) then
self.menu_icons_alpha = Details.skins[self.skin].instance_cprops.menu_icons_alpha or self.menu_icons_alpha
alpha = self.menu_icons_alpha
end
4 years ago
end
3 years ago
for index, button in ipairs(SetIconAlphaCacheButtonsTable) do
if (self.menu_icons[index]) then
4 years ago
if (hide) then
button:Hide()
else
button:Show()
button:SetAlpha(alpha)
end
end
end
3 years ago
4 years ago
if (self:IsLowerInstance()) then
3 years ago
if (#Details.ToolBar.Shown > 0) then
for index, button in ipairs(Details.ToolBar.Shown) do
4 years ago
if (hide) then
3 years ago
Details.FadeHandler.Fader(button, unpack(Details.windows_fade_in))
4 years ago
else
3 years ago
if (noAnimations) then
button:SetAlpha(alpha)
4 years ago
else
3 years ago
Details.FadeHandler.Fader(button, "ALPHAANIM", alpha)
4 years ago
end
end
end
end
end
end
3 years ago
function Details:ToolbarMenuSetButtonsOptions(spacement, shadow)
if (type(spacement) ~= "number") then
4 years ago
spacement = self.menu_icons.space
end
3 years ago
if (type(shadow) ~= "boolean") then
4 years ago
shadow = self.menu_icons.shadow
end
3 years ago
4 years ago
self.menu_icons.space = spacement
self.menu_icons.shadow = shadow
3 years ago
4 years ago
return self:ToolbarMenuSetButtons()
end
-- search key: ~buttons ~icons
local tbuttons = {}
3 years ago
function Details:ToolbarMenuSetButtons(_mode, _segment, _attributes, _report, _reset, _close)
4 years ago
if (_mode == nil) then
_mode = self.menu_icons[1]
end
3 years ago
4 years ago
if (_segment == nil) then
_segment = self.menu_icons[2]
end
3 years ago
4 years ago
if (_attributes == nil) then
_attributes = self.menu_icons[3]
end
3 years ago
4 years ago
if (_report == nil) then
_report = self.menu_icons[4]
end
3 years ago
4 years ago
if (_reset == nil) then
_reset = self.menu_icons[5]
end
3 years ago
4 years ago
if (_close == nil) then
_close = self.menu_icons[6]
end
3 years ago
4 years ago
self.menu_icons[1] = _mode
self.menu_icons[2] = _segment
self.menu_icons[3] = _attributes
self.menu_icons[4] = _report
self.menu_icons[5] = _reset
self.menu_icons[6] = _close
3 years ago
table.wipe(tbuttons)
tbuttons[1] = self.baseframe.cabecalho.modo_selecao
tbuttons[2] = self.baseframe.cabecalho.segmento
tbuttons[3] = self.baseframe.cabecalho.atributo
tbuttons[4] = self.baseframe.cabecalho.report
tbuttons[5] = self.baseframe.cabecalho.reset
tbuttons[6] = self.baseframe.cabecalho.fechar
4 years ago
local anchor_frame, point1, point2 = self:GetMenuAnchorPoint()
local got_anchor = false
self.lastIcon = nil
self.firstIcon = nil
3 years ago
4 years ago
local size = self.menu_icons_size
local space = self.menu_icons.space
local shadow = self.menu_icons.shadow
3 years ago
4 years ago
local toolbar_icon_file = self.toolbar_icon_file
if (shadow) then
toolbar_icon_file = toolbar_icon_file .. "_shadow"
end
local total_buttons_shown = 0
3 years ago
--normal buttons
4 years ago
if (self.menu_anchor.side == 1) then
3 years ago
for index, button in ipairs(tbuttons) do
if (self.menu_icons[index]) then
4 years ago
button:ClearAllPoints()
if (got_anchor) then
3 years ago
button:SetPoint("left", self.lastIcon.widget or self.lastIcon, "right", space, 0)
4 years ago
else
3 years ago
button:SetPoint(point1, anchor_frame, point2)
4 years ago
got_anchor = button
self.firstIcon = button
end
3 years ago
4 years ago
self.lastIcon = button
3 years ago
button:SetParent(self.baseframe)
button:SetFrameLevel(self.baseframe.UPFrame:GetFrameLevel()+1)
4 years ago
button:Show()
3 years ago
button:SetSize(16 * size, 16 * size)
button:SetNormalTexture(toolbar_icon_file)
button:SetHighlightTexture(toolbar_icon_file)
button:SetPushedTexture(toolbar_icon_file)
4 years ago
total_buttons_shown = total_buttons_shown + 1
else
button:Hide()
end
end
3 years ago
4 years ago
elseif (self.menu_anchor.side == 2) then
for index = #tbuttons, 1, -1 do
local button = tbuttons [index]
if (self.menu_icons [index]) then
button:ClearAllPoints()
if (got_anchor) then
3 years ago
button:SetPoint("right", self.lastIcon.widget or self.lastIcon, "left", -space, 0)
4 years ago
else
3 years ago
button:SetPoint(point1, anchor_frame, point2)
4 years ago
got_anchor = button
self.firstIcon = button
end
self.lastIcon = button
3 years ago
button:SetParent(self.baseframe)
button:SetFrameLevel(self.baseframe.UPFrame:GetFrameLevel()+1)
4 years ago
button:Show()
3 years ago
button:SetSize(16 * size, 16 * size)
button:SetNormalTexture(toolbar_icon_file)
button:SetHighlightTexture(toolbar_icon_file)
button:SetPushedTexture(toolbar_icon_file)
4 years ago
total_buttons_shown = total_buttons_shown + 1
else
button:Hide()
end
end
end
3 years ago
--plugins buttons
4 years ago
local pluginFirstIcon = true
if (not self.baseframe.cabecalho.PluginIconsSeparator) then
3 years ago
self.baseframe.cabecalho.PluginIconsSeparator = self.baseframe:CreateTexture(nil, "overlay")
self.baseframe.cabecalho.PluginIconsSeparator:SetTexture([[Interface\FriendsFrame\StatusIcon-Offline]])
4 years ago
local color = 0
3 years ago
self.baseframe.cabecalho.PluginIconsSeparator:SetVertexColor(color, color, color)
self.baseframe.cabecalho.PluginIconsSeparator:SetAlpha(0.2)
4 years ago
local scale = 0.4
3 years ago
self.baseframe.cabecalho.PluginIconsSeparator:SetSize(16 * scale, 16 * scale)
4 years ago
end
3 years ago
4 years ago
self.baseframe.cabecalho.PluginIconsSeparator:Hide()
3 years ago
4 years ago
if (self:IsLowerInstance()) then
3 years ago
if (#Details.ToolBar.Shown > 0) then
4 years ago
local last_plugin_icon
3 years ago
if (#Details.ToolBar.Shown > 0) then
4 years ago
self.baseframe.cabecalho.PluginIconsSeparator:Show()
self.baseframe.cabecalho.PluginIconsSeparator:ClearAllPoints()
self.baseframe.cabecalho.PluginIconsSeparator.widget = self.baseframe.cabecalho.PluginIconsSeparator
end
3 years ago
for index, button in ipairs(Details.ToolBar.Shown) do
4 years ago
button:ClearAllPoints()
3 years ago
4 years ago
if (got_anchor) then
if (pluginFirstIcon) then
-- space = space + 6 --was adding an extra padding between plugin icons
end
3 years ago
4 years ago
if (self.plugins_grow_direction == 2) then --right
if (self.menu_anchor.side == 1) then --left
3 years ago
4 years ago
local temp_space = space
3 years ago
4 years ago
if (pluginFirstIcon) then
temp_space = temp_space / 3
3 years ago
self.baseframe.cabecalho.PluginIconsSeparator:SetPoint("left", last_plugin_icon or self.lastIcon.widget or self.lastIcon, "right", temp_space, 0)
4 years ago
self.lastIcon = self.baseframe.cabecalho.PluginIconsSeparator
end
3 years ago
button:SetPoint("left", self.lastIcon.widget or self.lastIcon, "right", temp_space, 0)
4 years ago
elseif (self.menu_anchor.side == 2) then --right
3 years ago
4 years ago
local temp_space = space
3 years ago
4 years ago
if (pluginFirstIcon) then
temp_space = temp_space / 3
3 years ago
self.baseframe.cabecalho.PluginIconsSeparator:SetPoint("left", last_plugin_icon or self.firstIcon.widget or self.firstIcon, "right", temp_space, 0)
4 years ago
self.lastIcon = self.baseframe.cabecalho.PluginIconsSeparator
end
3 years ago
button:SetPoint("left", last_plugin_icon or self.lastIcon.widget or self.firstIcon, "right", temp_space, 0)
4 years ago
end
3 years ago
4 years ago
elseif (self.plugins_grow_direction == 1) then --left
if (self.menu_anchor.side == 1) then --left
3 years ago
4 years ago
local temp_space = space
3 years ago
4 years ago
if (pluginFirstIcon) then
temp_space = temp_space / 3
3 years ago
self.baseframe.cabecalho.PluginIconsSeparator:SetPoint("right", last_plugin_icon or self.firstIcon.widget or self.firstIcon, "left", -temp_space, 0)
4 years ago
self.lastIcon = self.baseframe.cabecalho.PluginIconsSeparator
end
3 years ago
button:SetPoint("right", last_plugin_icon or self.lastIcon.widget or self.firstIcon, "left", -temp_space, 0)
4 years ago
elseif (self.menu_anchor.side == 2) then --right
3 years ago
4 years ago
local temp_space = space
3 years ago
4 years ago
if (pluginFirstIcon) then
temp_space = temp_space / 3
3 years ago
self.baseframe.cabecalho.PluginIconsSeparator:SetPoint("right", last_plugin_icon or self.lastIcon.widget or self.lastIcon, "left", -temp_space, 0)
4 years ago
self.lastIcon = self.baseframe.cabecalho.PluginIconsSeparator
3 years ago
4 years ago
end
3 years ago
button:SetPoint("right", last_plugin_icon or self.lastIcon.widget or self.firstIcon, "left", -temp_space, 0)
4 years ago
end
end
3 years ago
4 years ago
pluginFirstIcon = false
else
3 years ago
button:SetPoint(point1, anchor_frame, point2)
4 years ago
self.firstIcon = button
got_anchor = button
end
3 years ago
4 years ago
self.lastIcon = button
3 years ago
last_plugin_icon = button
button:SetParent(self.baseframe)
button:SetFrameLevel(self.baseframe.UPFrame:GetFrameLevel()+1)
4 years ago
button:Show()
3 years ago
button:SetSize(16*size, 16*size)
4 years ago
if (shadow and button.shadow) then
3 years ago
button:SetNormalTexture(button.__icon .. "_shadow")
button:SetPushedTexture(button.__icon .. "_shadow")
button:SetHighlightTexture(button.__icon .. "_shadow", "ADD")
4 years ago
else
3 years ago
button:SetNormalTexture(button.__icon)
button:SetPushedTexture(button.__icon)
button:SetHighlightTexture(button.__icon, "ADD")
4 years ago
end
3 years ago
4 years ago
total_buttons_shown = total_buttons_shown + 1
end
end
3 years ago
4 years ago
if (self.baseframe.cabecalho.PluginIconsSeparator:IsShown()) then
if (self.baseframe.cabecalho.modo_selecao:GetAlpha() == 0) then
self.baseframe.cabecalho.PluginIconsSeparator:Hide()
end
end
3 years ago
4 years ago
end
3 years ago
4 years ago
self.total_buttons_shown = total_buttons_shown
self:RefreshAttributeTextSize()
3 years ago
4 years ago
return true
3 years ago
4 years ago
end
3 years ago
function Details:ToolbarMenuButtons (_mode, _segment, _attributes, _report)
4 years ago
return self:ToolbarMenuSetButtons (_mode, _segment, _attributes, _report)
end
local parameters_table = {}
3 years ago
local on_leave_menu = function(self, elapsed)
4 years ago
parameters_table[2] = parameters_table[2] + elapsed
if (parameters_table[2] > 0.3) then
if (not _G.GameCooltip.mouseOver and not _G.GameCooltip.buttonOver and (not _G.GameCooltip:GetOwner() or _G.GameCooltip:GetOwner() == self)) then
3 years ago
_G.GameCooltip:ShowMe(false)
4 years ago
end
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
end
end
3 years ago
local OnClickNovoMenu = function(_, _, id, instance)
4 years ago
local is_new
3 years ago
if (not Details.tabela_instancias [id]) then
--esta criando uma nova
4 years ago
is_new = true
end
3 years ago
local ninstance = Details.CriarInstancia (_, _, id)
instance.baseframe.cabecalho.modo_selecao:GetScript("OnEnter")(instance.baseframe.cabecalho.modo_selecao, _, true)
4 years ago
if (ninstance and is_new) then
3 years ago
ninstance.baseframe.cabecalho.modo_selecao:GetScript("OnEnter")(ninstance.baseframe.cabecalho.modo_selecao, _, true)
4 years ago
end
end
3 years ago
function Details:SetTooltipMinWidth()
GameCooltip:SetOption("MinWidth", 155)
4 years ago
end
3 years ago
function Details:FormatCooltipBackdrop()
--local CoolTip = GameCooltip
--CoolTip:SetBackdrop(1, menus_backdrop, menus_backdropcolor, menus_bordercolor)
--CoolTip:SetBackdrop(2, menus_backdrop, menus_backdropcolor_sec, menus_bordercolor)
return true
4 years ago
end
3 years ago
local build_mode_list = function(self, deltaTime)
local gameCooltip = GameCooltip
local instance = parameters_table [1]
parameters_table[2] = parameters_table[2] + deltaTime
4 years ago
if (parameters_table[2] > 0.15) then
3 years ago
self:SetScript("OnUpdate", nil)
gameCooltip:Reset()
gameCooltip:SetType("menu")
gameCooltip:SetLastSelected("main", parameters_table [3])
gameCooltip:SetFixedParameter(instance)
gameCooltip:SetOption("TextSize", Details.font_sizes.menus)
gameCooltip:SetOption("TextFont", Details.font_faces.menus)
gameCooltip:SetOption("ButtonHeightModSub", -2)
gameCooltip:SetOption("ButtonHeightMod", -5)
gameCooltip:SetOption("ButtonsYModSub", -3)
gameCooltip:SetOption("ButtonsYMod", -6)
gameCooltip:SetOption("YSpacingModSub", -3)
gameCooltip:SetOption("YSpacingMod", 1)
gameCooltip:SetOption("HeighMod", 3)
gameCooltip:SetOption("SubFollowButton", true)
Details:SetTooltipMinWidth()
gameCooltip:AddLine(Loc["STRING_MODE_GROUP"])
gameCooltip:AddMenu(1, instance.AlteraModo, 2, true)
gameCooltip:AddIcon([[Interface\AddOns\Details\images\modo_icones]], 1, 1, 20, 20, 32/256, 32/256*2, 0, 1)
gameCooltip:AddLine(Loc["STRING_MODE_ALL"])
gameCooltip:AddMenu(1, instance.AlteraModo, 3, true)
gameCooltip:AddIcon([[Interface\AddOns\Details\images\modo_icones]], 1, 1, 20, 20, 32/256*2, 32/256*3, 0, 1)
gameCooltip:AddLine(Loc["STRING_OPTIONS_PLUGINS"])
gameCooltip:AddMenu(1, instance.AlteraModo, 4, true)
gameCooltip:AddIcon([[Interface\AddOns\Details\images\modo_icones]], 1, 1, 20, 20, 32/256*3, 32/256*4, 0, 1)
4 years ago
--build raid plugins list
3 years ago
local raidPlugins = Details.RaidTables:GetAvailablePlugins()
4 years ago
if (#raidPlugins >= 0) then
3 years ago
for index, ptable in ipairs(raidPlugins) do
4 years ago
--if a plugin has the member 'NoMenu', it won't be shown on menus to select plugins
if (ptable[3].__enabled and not ptable[3].NoMenu) then
--PluginName, PluginIcon, PluginObject, PluginAbsoluteName
3 years ago
gameCooltip:AddMenu(2, Details.RaidTables.EnableRaidMode, instance, ptable[4], true, ptable[1], ptable[2], true)
4 years ago
end
end
end
--build self plugins list
3 years ago
if (#Details.SoloTables.Menu > 0) then
for index, ptable in ipairs(Details.SoloTables.Menu) do
4 years ago
if (ptable[3].__enabled and not ptable[3].NoMenu) then
3 years ago
gameCooltip:AddMenu(2, Details.SoloTables.EnableSoloMode, instance, ptable[4], true, ptable[1], ptable[2], true)
4 years ago
end
end
end
3 years ago
--window control
GameCooltip:AddLine("$div")
gameCooltip:AddLine(Loc["STRING_MENU_INSTANCE_CONTROL"])
gameCooltip:AddIcon([[Interface\AddOns\Details\images\modo_icones]], 1, 1, 20, 20, 0.625, 0.75, 0, 1)
local hasClosedInstances = false
for index = 1, math.min(#Details.tabela_instancias, Details.instances_amount), 1 do
local thisInstance = Details.tabela_instancias [index]
if (not thisInstance.ativa) then
hasClosedInstances = true
4 years ago
break
end
end
3 years ago
if (Details:GetNumInstancesAmount() < Details:GetMaxInstancesAmount()) then
gameCooltip:AddMenu(2, OnClickNovoMenu, true, instance, nil, Loc["STRING_OPTIONS_WC_CREATE"], _, true)
gameCooltip:AddIcon([[Interface\Buttons\UI-AttributeButton-Encourage-Up]], 2, 1, 16, 16)
if (hasClosedInstances) then
GameCooltip:AddLine("$div", nil, 2, nil, -5, -11)
4 years ago
end
end
3 years ago
4 years ago
local ClosedInstances = 0
3 years ago
for index = 1, math.min(#Details.tabela_instancias, Details.instances_amount), 1 do
local thisInstance = Details.tabela_instancias [index]
if (not thisInstance.ativa) then
local atributo = thisInstance.atributo
local sub_atributo = thisInstance.sub_atributo
4 years ago
ClosedInstances = ClosedInstances + 1
3 years ago
if (atributo == 5) then
local CustomObject = Details.custom[sub_atributo]
4 years ago
if (not CustomObject) then
3 years ago
thisInstance:ResetAttribute()
atributo = thisInstance.atributo
sub_atributo = thisInstance.sub_atributo
gameCooltip:AddMenu(2, OnClickNovoMenu, index, instance, nil, "#".. index .. " " .. Details.atributos.lista[atributo] .. " - " .. Details.sub_atributos[atributo].lista[sub_atributo], _, true)
gameCooltip:AddIcon(Details.sub_atributos[atributo].icones[sub_atributo][1], 2, 1, 16, 16, unpack(Details.sub_atributos[atributo].icones[sub_atributo][2]))
4 years ago
else
3 years ago
gameCooltip:AddMenu(2, OnClickNovoMenu, index, instance, nil, "#".. index .. " " .. Details.atributos.lista[atributo] .. " - " .. CustomObject:GetName(), _, true)
gameCooltip:AddIcon(CustomObject.icon, 2, 1, 16, 16, 0, 1, 0, 1)
4 years ago
end
else
3 years ago
local modo = thisInstance.modo
4 years ago
if (modo == 1) then --alone
3 years ago
atributo = Details.SoloTables.Mode or 1
local SoloInfo = Details.SoloTables.Menu [atributo]
4 years ago
if (SoloInfo) then
3 years ago
gameCooltip:AddMenu(2, OnClickNovoMenu, index, instance, nil, "#".. index .. " " .. SoloInfo [1], _, true)
gameCooltip:AddIcon(SoloInfo [2], 2, 1, 16, 16, 0, 1, 0, 1)
4 years ago
else
3 years ago
gameCooltip:AddMenu(2, OnClickNovoMenu, index, instance, nil, "#".. index .. " Unknown Plugin", _, true)
4 years ago
end
3 years ago
4 years ago
elseif (modo == 4) then --raid
3 years ago
local plugin_name = thisInstance.current_raid_plugin or thisInstance.last_raid_plugin
4 years ago
if (plugin_name) then
3 years ago
local plugin_object = Details:GetPlugin (plugin_name)
4 years ago
if (plugin_object) then
3 years ago
gameCooltip:AddMenu(2, OnClickNovoMenu, index, instance, nil, "#".. index .. " " .. plugin_object.__name, _, true)
gameCooltip:AddIcon(plugin_object.__icon, 2, 1, 16, 16, 0, 1, 0, 1)
4 years ago
else
3 years ago
gameCooltip:AddMenu(2, OnClickNovoMenu, index, instance, nil, "#".. index .. " Unknown Plugin", _, true)
4 years ago
end
else
3 years ago
gameCooltip:AddMenu(2, OnClickNovoMenu, index, instance, nil, "#".. index .. " Unknown Plugin", _, true)
4 years ago
end
3 years ago
4 years ago
else
3 years ago
--CoolTip:AddMenu(2, OnClickNovoMenu, index, instancia, nil, "#".. index .. " " .. _detalhes.atributos.lista [atributo] .. " - " .. _detalhes.sub_atributos [atributo].lista [sub_atributo], _, true)
gameCooltip:AddMenu(2, OnClickNovoMenu, index, instance, nil, "#".. index .. " " .. Details.sub_atributos [atributo].lista [sub_atributo], _, true)
gameCooltip:AddIcon(Details.sub_atributos [atributo].icones[sub_atributo] [1], 2, 1, 16, 16, unpack(Details.sub_atributos [atributo].icones[sub_atributo] [2]))
4 years ago
end
end
3 years ago
gameCooltip:SetOption("TextSize", Details.font_sizes.menus)
gameCooltip:SetOption("TextFont", Details.font_faces.menus)
4 years ago
end
end
3 years ago
if (ClosedInstances > 0 or Details:GetNumInstancesAmount() < Details:GetMaxInstancesAmount()) then
GameCooltip:AddLine("$div", nil, 2, nil, -5, -11)
end
GameCooltip:AddLine(Loc["STRING_MENU_CLOSE_INSTANCE"], nil, 2, "white", nil, Details.font_sizes.menus, Details.font_faces.menus)
GameCooltip:AddIcon([[Interface\Buttons\UI-Panel-MinimizeButton-Up]], 2, 1, 14, 14, 0.2, 0.8, 0.2, 0.8)
GameCooltip:AddMenu(2, Details.close_instancia_func, instance.baseframe.cabecalho.fechar)
4 years ago
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
3 years ago
--space
GameCooltip:AddLine("$div")
--forge and history buttons
gameCooltip:AddLine(Loc["STRING_SPELLLIST"])
gameCooltip:AddMenu(1, Details.OpenForge)
gameCooltip:AddIcon([[Interface\MINIMAP\Vehicle-HammerGold-3]], 1, 1, 16, 16, 0, 1, 0, 1)
--statistics
gameCooltip:AddLine(Loc["STRING_STATISTICS"])
gameCooltip:AddMenu(1, Details.OpenRaidHistoryWindow)
gameCooltip:AddIcon([[Interface\PvPRankBadges\PvPRank08]], 1, 1, 16, 16, 0, 1, 0, 1)
--space
GameCooltip:AddLine("$div")
--options
gameCooltip:AddLine(Loc["STRING_OPTIONS_WINDOW"])
gameCooltip:AddMenu(1, Details.OpenOptionsWindow)
gameCooltip:AddIcon([[Interface\AddOns\Details\images\modo_icones]], 1, 1, 20, 20, 0.5, 0.625, 0, 1)
--finishes the menu
Details:SetMenuOwner (self, instance)
show_anti_overlap (instance, self, "top")
gameCooltip:ShowCooltip()
end
end
function Details:SetMenuOwner (self, instance)
4 years ago
local _, y = instance.baseframe:GetCenter()
local screen_height = GetScreenHeight()
if (instance.toolbar_side == 1) then
if (y+300 > screen_height) then
3 years ago
GameCooltip:SetOwner(self, "top", "bottom", 0, -10)
4 years ago
else
3 years ago
GameCooltip:SetOwner(self)
4 years ago
end
3 years ago
elseif (instance.toolbar_side == 2) then --bottom
4 years ago
local instance_height = instance.baseframe:GetHeight()
3 years ago
if (y + math.max(instance_height, 250) > screen_height) then
GameCooltip:SetOwner(self, "top", "bottom", 0, -10)
4 years ago
else
3 years ago
GameCooltip:SetOwner(self, "bottom", "top", 0, 0)
4 years ago
end
3 years ago
4 years ago
end
3 years ago
4 years ago
end
local empty_segment_color = {1, 1, 1, .4}
local segments_common_tex, segments_common_color = {0.5078125, 0.1171875, 0.017578125, 0.1953125}, {1, 1, 1, .5}
local unknown_boss_tex, unknown_boss_color = {0.14453125, 0.9296875, 0.2625, 0.6546875}, {1, 1, 1, 0.5}
local party_line_color = {170/255, 167/255, 255/255, 1}
local party_line_color_trash = {130/255, 130/255, 155/255, 1}
local party_line_color2 = {210/255, 200/255, 255/255, 1}
local party_line_color2_trash = {110/255, 110/255, 155/255, 1}
local party_wallpaper_tex, party_wallpaper_color, raid_wallpaper_tex = {0.09, 0.698125, 0, 0.833984375}, {1, 1, 1, 0.5}, {33/512, 361/512, 45/512, 295/512}
local segments_wallpaper_color = {1, 1, 1, 0.5}
local segment_color_lime = {0, 1, 0, 1}
local segment_color_red = {1, 0, 0, 1}
3 years ago
function Details:GetSegmentInfo(index)
4 years ago
local combat
3 years ago
4 years ago
if (index == -1 or index == "overall") then
3 years ago
combat = Details.tabela_overall
elseif (index == 0 or index == "current") then
combat = Details.tabela_vigente
4 years ago
else
3 years ago
combat = Details.tabela_historico.tabelas[index]
4 years ago
end
3 years ago
4 years ago
if (combat) then
3 years ago
4 years ago
local enemy
local color
local raid_type
local killed
local portrait
local background
local background_coords
local is_trash
3 years ago
4 years ago
if (combat.is_boss and combat.is_boss.name) then
3 years ago
4 years ago
if (combat.instance_type == "party") then
raid_type = "party"
enemy = combat.is_boss.name
color = party_line_color
elseif (combat.is_boss.killed) then
raid_type = "raid"
enemy = combat.is_boss.name
color = segment_color_lime
killed = true
else
raid_type = "raid"
enemy = combat.is_boss.name
color = segment_color_red
killed = false
end
3 years ago
local p = Details:GetBossPortrait(combat.is_boss.mapid, combat.is_boss.index)
4 years ago
if (p) then
portrait = p
end
3 years ago
local b = Details:GetRaidIcon (combat.is_boss.mapid)
4 years ago
if (b) then
background = b
background_coords = segment_color_lime
elseif (combat.instance_type == "party") then
local ej_id = combat.is_boss.ej_instance_id
if (ej_id) then
local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = DetailsFramework.EncounterJournal.EJ_GetInstanceInfo (ej_id)
if (bgImage) then
background = bgImage
background_coords = party_wallpaper_tex
end
end
end
3 years ago
4 years ago
elseif (combat.is_arena) then
enemy = combat.is_arena.name
3 years ago
local file, coords = Details:GetArenaInfo (combat.is_arena.mapid)
4 years ago
if (file) then
background = "Interface\\Glues\\LOADINGSCREENS\\" .. file
background_coords = coords
end
3 years ago
4 years ago
else
enemy = combat.enemy
3 years ago
4 years ago
if (combat.is_trash) then
is_trash = true
end
end
3 years ago
4 years ago
return enemy, color, raid_type, killed, is_trash, portrait, background, background_coords
end
3 years ago
4 years ago
end
3 years ago
function Details:UnpackMythicDungeonInfo(t)
4 years ago
return t.OverallSegment, t.SegmentID, t.Level, t.EJID, t.MapID, t.ZoneName, t.EncounterID, t.EncounterName, t.StartedAt, t.EndedAt, t.RunID
end
local segments_used = 0
local segments_filled = 0
-- search key: ~segments
3 years ago
local buildSegmentTooltip = function(self, deltaTime)
local gameCooltip = GameCooltip
local instance = parameters_table[1]
parameters_table[2] = parameters_table[2] + deltaTime
4 years ago
local battleground_color = {1, 0.666, 0, 1}
3 years ago
4 years ago
if (parameters_table[2] > 0.15) then
3 years ago
self:SetScript("OnUpdate", nil)
gameCooltip:Reset()
gameCooltip:SetType("menu")
gameCooltip:SetFixedParameter(instance)
gameCooltip:SetOption("FixedWidthSub", 195)
gameCooltip:SetOption("RightTextWidth", 105)
gameCooltip:SetOption("RightTextHeight", 12)
gameCooltip:SetOption("SubFollowButton", true)
4 years ago
local menuIndex = 0
3 years ago
Details.segments_amount = floor(Details.segments_amount)
local amountOfSegments = 0
local segmentsWithACombat = 0
for i = 1, Details.segments_amount do
if (Details.tabela_historico.tabelas[i]) then
segmentsWithACombat = segmentsWithACombat + 1
4 years ago
else
break
end
end
3 years ago
segmentsWithACombat = Details.segments_amount - segmentsWithACombat - 2
local fill = abs(segmentsWithACombat - Details.segments_amount)
4 years ago
segments_used = 0
segments_filled = fill
3 years ago
4 years ago
local dungeon_color = party_line_color
local dungeon_color_trash = party_line_color_trash
local dungeon_run_id = false
3 years ago
4 years ago
local isMythicDungeon = false
3 years ago
for i = Details.segments_amount, 1, -1 do
4 years ago
if (i <= fill) then
3 years ago
local thisCombat = Details.tabela_historico.tabelas[i]
4 years ago
if (thisCombat) then
local enemy = thisCombat.is_boss and thisCombat.is_boss.name
local segment_info_added = false
3 years ago
4 years ago
segments_used = segments_used + 1
if (thisCombat.is_mythic_dungeon_segment) then
if (not isMythicDungeon) then
isMythicDungeon = thisCombat.is_mythic_dungeon_run_id
else
if (isMythicDungeon ~= thisCombat.is_mythic_dungeon_run_id) then
isMythicDungeon = thisCombat.is_mythic_dungeon_run_id
end
end
3 years ago
4 years ago
local mythicDungeonInfo = thisCombat:GetMythicDungeonInfo()
3 years ago
4 years ago
if (mythicDungeonInfo) then
3 years ago
--is a boss, trash overall or run overall segment
4 years ago
local bossInfo = thisCombat.is_boss
3 years ago
local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo)
4 years ago
local combat_time = thisCombat:GetCombatTime()
3 years ago
4 years ago
if (not dungeon_run_id) then
dungeon_run_id = runID
else
if (dungeon_run_id ~= runID) then
dungeon_color = dungeon_color == party_line_color and party_line_color2 or party_line_color
dungeon_color_trash = dungeon_color_trash == party_line_color_trash and party_line_color2_trash or party_line_color_trash
dungeon_run_id = runID
end
end
3 years ago
--is mythic overall
4 years ago
if (isMythicOverallSegment) then
--mostrar o tempo da dungeon
local totalTime = combat_time
3 years ago
gameCooltip:AddLine(zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", Details.gump:IntegerToTimer(endedAt - startedAt), 1, dungeon_color)
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512)
gameCooltip:AddLine(zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", nil, 2, "white", "white")
4 years ago
else
if (segmentID == "trashoverall") then
local trashIcon = "|TInterface\\AddOns\\Details\\images\\icons:16:16:0:0:512:512:14:58:98:160|t"
3 years ago
gameCooltip:AddLine(trashIcon .. "" .. (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_TRASH"] .. ")", Details.gump:IntegerToTimer(endedAt - startedAt), 1, dungeon_color, "gray")
gameCooltip:AddLine((encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_TRASH"] .. ")", nil, 2, "white", "white")
4 years ago
else
local skull = "|TInterface\\AddOns\\Details\\images\\icons:16:16:0:0:512:512:496:512:0:16|t"
3 years ago
gameCooltip:AddLine(skull .. "" .. (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_BOSS"] .. ")", Details.gump:IntegerToTimer(combat_time), 1, dungeon_color, "gray")
gameCooltip:AddLine((encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_BOSS"] .. ")", nil, 2, "white", "white")
4 years ago
end
3 years ago
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512)
4 years ago
end
3 years ago
local portrait = (thisCombat.is_boss and thisCombat.is_boss.bossimage) or Details:GetBossPortrait(nil, nil, encounterName, EJID)
4 years ago
if (portrait) then
3 years ago
gameCooltip:AddIcon(portrait, 2, "top", 128, 64, 0, 1, 0, 0.96)
4 years ago
end
3 years ago
local backgroundImage = Details:GetRaidIcon(mapID, EJID, "party")
4 years ago
if (backgroundImage) then
3 years ago
gameCooltip:SetWallpaper(2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true)
4 years ago
end
3 years ago
--sub menu
4 years ago
local decorrido = thisCombat:GetCombatTime()
3 years ago
local minutos, segundos = floor(decorrido/60), floor(decorrido%60)
4 years ago
if (segmentID == "trashoverall") then
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TIMEINCOMBAT"] .. ":", Details.gump:IntegerToTimer(decorrido), 2, "white", "white")
4 years ago
local totalRealTime = endedAt - startedAt
local wasted = totalRealTime - decorrido
3 years ago
4 years ago
--wasted time
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_WASTED_TIME"] .. ":", "|cFFFF3300" .. Details.gump:IntegerToTimer(wasted) .. " (" .. floor(wasted / totalRealTime * 100) .. "%)|r", 2, "white", "white")
gameCooltip:AddStatusBar(100, 2, 0, 0, 0, 0.35, false, false, "Skyline")
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TOTALTIME"] .. ":", Details.gump:IntegerToTimer(endedAt - startedAt), 2, "white", "white")
4 years ago
elseif (isMythicOverallSegment) then
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TIMEINCOMBAT"] .. ":", Details.gump:IntegerToTimer(decorrido), 2, "white", "white")
4 years ago
local totalRealTime = endedAt - startedAt
local wasted = totalRealTime - decorrido
3 years ago
4 years ago
--wasted time
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_WASTED_TIME"] .. ":", "|cFFFF3300" .. Details.gump:IntegerToTimer(wasted) .. " (" .. floor(wasted / totalRealTime * 100) .. "%)|r", 2, "white", "white")
gameCooltip:AddStatusBar(100, 2, 0, 0, 0, 0.35, false, false, "Skyline")
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TOTALTIME"] .. ":", Details.gump:IntegerToTimer(totalRealTime), 2, "white", "white")
4 years ago
else
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", Details.gump:IntegerToTimer(decorrido), 2, "white", "white")
4 years ago
end
3 years ago
4 years ago
if (thisCombat.is_boss) then
3 years ago
gameCooltip:AddLine("", "", 2, "white", "white")
4 years ago
end
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat.data_inicio, 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", thisCombat.data_fim or "in progress", 2, "white", "white")
gameCooltip:AddStatusBar (100, 1, .3, .3, .3, 0.2, false, false, "Skyline")
4 years ago
else
3 years ago
--the combat has mythic dungeon tag but doesn't have a mythic dungeon table information
--so this is a trash cleanup segment
4 years ago
local trashInfo = thisCombat:GetMythicDungeonTrashInfo()
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENT_TRASH"] .. " (#" .. i .. ")", Details.gump:IntegerToTimer(thisCombat:GetCombatTime()), 1, dungeon_color_trash, "gray")
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512, nil, nil, true)
4 years ago
--submenu
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENT_TRASH"], nil, 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", Details.gump:IntegerToTimer(thisCombat:GetCombatTime()), 2, "white", "white")
gameCooltip:AddLine("", "", 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat.data_inicio, 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", thisCombat.data_fim or "in progress", 2, "white", "white")
4 years ago
if (trashInfo) then
3 years ago
local backgroundImage = Details:GetRaidIcon(trashInfo.MapID, trashInfo.EJID, "party")
4 years ago
if (backgroundImage) then
3 years ago
gameCooltip:SetWallpaper(2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true)
4 years ago
end
end
end
segment_info_added = true
3 years ago
4 years ago
elseif (thisCombat.is_boss and thisCombat.is_boss.name) then
3 years ago
4 years ago
isMythicDungeon = false
local try_number = thisCombat.is_boss.try_number
local combat_time = thisCombat:GetCombatTime()
3 years ago
4 years ago
if (thisCombat.instance_type == "party") then
3 years ago
gameCooltip:AddLine(thisCombat.is_boss.name .." (#"..i..")", _, 1, dungeon_color)
4 years ago
elseif (thisCombat.is_boss.killed) then
if (try_number) then
3 years ago
local m, s = floor(combat_time/60), floor(combat_time%60)
4 years ago
if (s < 10) then
s = "0" .. s
end
3 years ago
gameCooltip:AddLine(thisCombat.is_boss.name .." (#"..try_number.." " .. m .. ":" .. s .. ")", _, 1, "lime")
4 years ago
else
3 years ago
gameCooltip:AddLine(thisCombat.is_boss.name .." (#"..i..")", _, 1, "lime")
4 years ago
end
else
if (try_number) then
3 years ago
local m, s = floor(combat_time/60), floor(combat_time%60)
4 years ago
if (s < 10) then
s = "0" .. s
end
3 years ago
gameCooltip:AddLine(thisCombat.is_boss.name .." (#"..try_number.." " .. m .. ":" .. s .. ")", _, 1, "red")
4 years ago
else
3 years ago
gameCooltip:AddLine(thisCombat.is_boss.name .." (#"..i..")", _, 1, "red")
4 years ago
end
end
3 years ago
local portrait = Details:GetBossPortrait(thisCombat.is_boss.mapid, thisCombat.is_boss.index) or thisCombat.is_boss.bossimage
4 years ago
if (portrait) then
3 years ago
gameCooltip:AddIcon(portrait, 2, "top", 128, 64)
4 years ago
else
local encounter_name = thisCombat.is_boss.encounter
local instanceID = thisCombat.is_boss.ej_instance_id
if (encounter_name and instanceID and instanceID ~= 0) then
3 years ago
local index, name, description, encounterID, rootSectionID, link = Details:GetEncounterInfoFromEncounterName (instanceID, encounter_name)
4 years ago
if (index and name and encounterID) then
--EJ_SelectInstance (instanceID)
--creature info pode ser sempre 1, n�o usar o index do boss
local id, name, description, displayInfo, iconImage = DetailsFramework.EncounterJournal.EJ_GetCreatureInfo (1, encounterID)
if (iconImage) then
3 years ago
gameCooltip:AddIcon(iconImage, 2, "top", 128, 64)
4 years ago
end
end
end
end
3 years ago
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 16, 16, 0.96875, 1, 0, 0.03125)
if (Details.tooltip.submenu_wallpaper) then
local background = Details:GetRaidIcon (thisCombat.is_boss.mapid)
4 years ago
if (background) then
3 years ago
gameCooltip:SetWallpaper (2, background, nil, segments_wallpaper_color, true)
4 years ago
else
local ej_id = thisCombat.is_boss.ej_instance_id
if (ej_id and ej_id ~= 0) then
local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = DetailsFramework.EncounterJournal.EJ_GetInstanceInfo (ej_id)
if (name) then
if (thisCombat.instance_type == "party") then
3 years ago
gameCooltip:SetWallpaper (2, bgImage, party_wallpaper_tex, party_wallpaper_color, true)
4 years ago
else
3 years ago
gameCooltip:SetWallpaper (2, loreImage, raid_wallpaper_tex, party_wallpaper_color, true)
4 years ago
end
end
else
--CoolTip:SetWallpaper (2, [[Interface\BlackMarket\HotItemBanner]], unknown_boss_tex, unknown_boss_color, true)
end
end
else
3 years ago
--wallpaper = main window
4 years ago
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
3 years ago
4 years ago
elseif (thisCombat.is_pvp) then
isMythicDungeon = false
3 years ago
gameCooltip:AddLine(thisCombat.is_pvp.name, _, 1, battleground_color)
4 years ago
enemy = thisCombat.is_pvp.name
3 years ago
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 16, 12, 0.251953125, 0.306640625, 0.205078125, 0.248046875)
if (Details.tooltip.submenu_wallpaper) then
local file, coords = Details:GetBattlegroundInfo (thisCombat.is_pvp.mapid)
4 years ago
if (file) then
3 years ago
gameCooltip:SetWallpaper (2, "Interface\\Glues\\LOADINGSCREENS\\" .. file, coords, empty_segment_color, true)
4 years ago
end
else
3 years ago
--wallpaper = main window
4 years ago
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
3 years ago
4 years ago
elseif (thisCombat.is_arena) then
isMythicDungeon = false
3 years ago
gameCooltip:AddLine(thisCombat.is_arena.name, _, 1, "yellow")
4 years ago
enemy = thisCombat.is_arena.name
3 years ago
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 16, 12, 0.251953125, 0.306640625, 0.205078125, 0.248046875)
if (Details.tooltip.submenu_wallpaper) then
local file, coords = Details:GetArenaInfo (thisCombat.is_arena.mapid)
4 years ago
if (file) then
3 years ago
gameCooltip:SetWallpaper (2, "Interface\\Glues\\LOADINGSCREENS\\" .. file, coords, empty_segment_color, true)
4 years ago
end
else
3 years ago
--wallpaper = main window
4 years ago
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
else
isMythicDungeon = false
enemy = thisCombat.enemy
if (enemy) then
3 years ago
gameCooltip:AddLine(thisCombat.enemy .." (#"..i..")", _, 1, "yellow")
4 years ago
else
3 years ago
gameCooltip:AddLine(segmentos.past..i, _, 1, "silver")
4 years ago
end
3 years ago
4 years ago
if (thisCombat.is_trash) then
3 years ago
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 16, 12, 0.02734375, 0.11328125, 0.19140625, 0.3125)
4 years ago
else
3 years ago
gameCooltip:AddIcon([[Interface\QUESTFRAME\UI-Quest-BulletPoint]], "main", "left", 16, 16)
4 years ago
end
3 years ago
if (Details.tooltip.submenu_wallpaper) then
gameCooltip:SetWallpaper (2, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-StatsBackground]], segments_common_tex, segments_common_color, true)
4 years ago
else
3 years ago
--wallpaper = main window
4 years ago
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
3 years ago
4 years ago
end
3 years ago
gameCooltip:AddMenu(1, instance.TrocaTabela, i)
4 years ago
if (not segment_info_added) then
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENT_ENEMY"] .. ":", enemy, 2, "white", "white")
4 years ago
local decorrido = thisCombat:GetCombatTime()
3 years ago
local minutos, segundos = floor(decorrido/60), floor(decorrido%60)
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat.data_inicio, 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", thisCombat.data_fim or "in progress", 2, "white", "white")
4 years ago
end
3 years ago
amountOfSegments = amountOfSegments + 1
4 years ago
else
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENT_LOWER"] .. " #" .. i, _, 1, "gray")
gameCooltip:AddMenu(1, instance.TrocaTabela, i)
gameCooltip:AddIcon([[Interface\QUESTFRAME\UI-Quest-BulletPoint]], "main", "left", 16, 16, nil, nil, nil, nil, empty_segment_color)
gameCooltip:AddLine(Loc["STRING_SEGMENT_EMPTY"], _, 2)
gameCooltip:AddIcon([[Interface\CHARACTERFRAME\Disconnect-Icon]], 2, 1, 12, 12, 0.3125, 0.65625, 0.265625, 0.671875)
4 years ago
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
3 years ago
4 years ago
if (menuIndex) then
menuIndex = menuIndex + 1
3 years ago
if (instance.segmento == i) then
gameCooltip:SetLastSelected ("main", menuIndex)
4 years ago
menuIndex = nil
end
end
3 years ago
4 years ago
end
3 years ago
4 years ago
end
3 years ago
GameCooltip:AddLine("$div", nil, nil, -5, -13)
4 years ago
----------- current
3 years ago
local enemy = Details.tabela_vigente.is_boss and Details.tabela_vigente.is_boss.name or Details.tabela_vigente.enemy or "--x--x--"
4 years ago
local file, coords
3 years ago
local thisCombat = Details.tabela_vigente
4 years ago
local segment_info_added
3 years ago
--add the new line
gameCooltip:AddLine(segmentos.current_standard, _, 1, "white")
gameCooltip:AddMenu(1, instance.TrocaTabela, 0)
gameCooltip:AddIcon([[Interface\QUESTFRAME\UI-Quest-BulletPoint]], "main", "left", 16, 16, nil, nil, nil, nil, "orange")
4 years ago
--
3 years ago
--current segment is a dungeon mythic+?
4 years ago
if (thisCombat.is_mythic_dungeon_segment) then
local mythicDungeonInfo = thisCombat:GetMythicDungeonInfo()
3 years ago
4 years ago
if (mythicDungeonInfo) then
3 years ago
--is a boss, trash overall or run overall segment
4 years ago
local bossInfo = thisCombat.is_boss
3 years ago
local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo (mythicDungeonInfo)
4 years ago
local combat_time = thisCombat:GetCombatTime()
3 years ago
4 years ago
if (not dungeon_run_id) then
dungeon_run_id = runID
else
if (dungeon_run_id ~= runID) then
dungeon_color = dungeon_color == party_line_color and party_line_color2 or party_line_color
dungeon_color_trash = dungeon_color_trash == party_line_color_trash and party_line_color2_trash or party_line_color_trash
dungeon_run_id = runID
end
end
3 years ago
--is mythic overall
4 years ago
if (isMythicOverallSegment) then
--mostrar o tempo da dungeon
local totalTime = combat_time
3 years ago
--CoolTip:AddLine(zoneName .. " +" .. mythicLevel .. " (overall)", _detalhes.gump:IntegerToTimer(totalTime), 1, dungeon_color)
--CoolTip:AddLine(zoneName .. " +" .. mythicLevel .. " (overall)", _detalhes.gump:IntegerToTimer(endedAt - startedAt), 1, dungeon_color)
--CoolTip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512)
gameCooltip:AddLine(zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", nil, 2, "white", "white")
4 years ago
else
if (segmentID == "trashoverall") then
3 years ago
--CoolTip:AddLine(encounterName .. " (" .. Loc["STRING_SEGMENTS_LIST_TRASH"] .. ")", _detalhes.gump:IntegerToTimer(combat_time), 1, dungeon_color, "gray")
--CoolTip:AddLine(encounterName .. " (" .. Loc["STRING_SEGMENTS_LIST_TRASH"] .. ")", _detalhes.gump:IntegerToTimer(endedAt - startedAt), 1, dungeon_color, "gray")
gameCooltip:AddLine(encounterName .. " (" .. Loc["STRING_SEGMENTS_LIST_TRASH"] .. ")", nil, 2, "white", "white")
4 years ago
else
3 years ago
--CoolTip:AddLine(encounterName .. " (" .. Loc["STRING_SEGMENTS_LIST_BOSS"] .. ")", _detalhes.gump:IntegerToTimer(combat_time), 1, dungeon_color, "gray")
gameCooltip:AddLine(encounterName .. " (" .. Loc["STRING_SEGMENTS_LIST_BOSS"] .. ")", nil, 2, "white", "white")
4 years ago
end
3 years ago
--CoolTip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512)
4 years ago
end
3 years ago
local portrait = (thisCombat.is_boss and thisCombat.is_boss.bossimage) or Details:GetBossPortrait(nil, nil, encounterName, EJID)
4 years ago
if (portrait) then
3 years ago
gameCooltip:AddIcon(portrait, 2, "top", 128, 64, 0, 1, 0, 0.96)
4 years ago
end
3 years ago
local backgroundImage = Details:GetRaidIcon (mapID, EJID, "party")
4 years ago
if (backgroundImage) then
3 years ago
gameCooltip:SetWallpaper (2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true) -- party_wallpaper_tex -- {0.09, 0.698125, .17, 0.833984375}
4 years ago
end
3 years ago
--sub menu
4 years ago
local decorrido = thisCombat:GetCombatTime()
3 years ago
local minutos, segundos = floor(decorrido/60), floor(decorrido%60)
--CoolTip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
4 years ago
if (segmentID == "trashoverall") then
local totalRealTime = endedAt - startedAt
local wasted = totalRealTime - decorrido
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TIMEINCOMBAT"] .. ":", Details.gump:IntegerToTimer(decorrido), 2, "white", "white")
4 years ago
--wasted time
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_WASTED_TIME"] .. ":", "|cFFFF3300" .. Details.gump:IntegerToTimer(wasted) .. " (" .. floor(wasted / totalRealTime * 100) .. "%)|r", 2, "white", "white")
gameCooltip:AddStatusBar (100, 2, 0, 0, 0, 0.35, false, false, "Skyline")
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TOTALTIME"] .. ":", Details.gump:IntegerToTimer(endedAt - startedAt) .. " [|cFFFF3300" .. Details.gump:IntegerToTimer(totalRealTime - decorrido) .. "|r]", 2, "white", "white")
4 years ago
elseif (isMythicOverallSegment) then
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TIMEINCOMBAT"] .. ":", Details.gump:IntegerToTimer(decorrido), 2, "white", "white")
4 years ago
local totalRealTime = endedAt - startedAt
local wasted = totalRealTime - decorrido
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TOTALTIME"] .. ":", Details.gump:IntegerToTimer(totalRealTime), 2, "white", "white")
4 years ago
--wasted time
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_WASTED_TIME"] .. ":", "|cFFFF3300" .. Details.gump:IntegerToTimer(wasted) .. " (" .. floor(wasted / totalRealTime * 100) .. "%)|r", 2, "white", "white")
gameCooltip:AddStatusBar (100, 2, 0, 0, 0, 0.35, false, false, "Skyline")
4 years ago
else
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", Details.gump:IntegerToTimer(decorrido), 2, "white", "white")
4 years ago
end
3 years ago
4 years ago
if (thisCombat.is_boss) then
3 years ago
gameCooltip:AddLine("", "", 2, "white", "white")
4 years ago
end
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat.data_inicio, 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", thisCombat.data_fim or "in progress", 2, "white", "white")
4 years ago
else
3 years ago
--the combat has mythic dungeon tag but doesn't have a mythic dungeon table information
--so this is a trash cleanup segment
4 years ago
local trashInfo = thisCombat:GetMythicDungeonTrashInfo()
3 years ago
--CoolTip:AddLine(Loc["STRING_SEGMENT_TRASH"], _detalhes.gump:IntegerToTimer(thisCombat:GetCombatTime()), 1, dungeon_color_trash, "gray")
--CoolTip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 16, 12, 0.02734375, 0.11328125, 0.19140625, 0.3125, "red")
--CoolTip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512, nil, nil, true)
4 years ago
--submenu
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENT_TRASH"], nil, 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", Details.gump:IntegerToTimer(thisCombat:GetCombatTime()), 2, "white", "white")
gameCooltip:AddLine("", "", 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat.data_inicio, 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", thisCombat.data_fim or "in progress", 2, "white", "white")
4 years ago
if (trashInfo) then
3 years ago
local backgroundImage = Details:GetRaidIcon (trashInfo.MapID, trashInfo.EJID, "party")
4 years ago
if (backgroundImage) then
3 years ago
gameCooltip:SetWallpaper (2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true)
4 years ago
end
end
end
3 years ago
4 years ago
segment_info_added = true
3 years ago
elseif (Details.tabela_vigente.is_boss and Details.tabela_vigente.is_boss.name) then
local portrait = Details:GetBossPortrait(Details.tabela_vigente.is_boss.mapid, Details.tabela_vigente.is_boss.index) or Details.tabela_vigente.is_boss.bossimage
4 years ago
if (portrait) then
3 years ago
gameCooltip:AddIcon(portrait, 2, "top", 128, 64)
4 years ago
else
3 years ago
local thisCombat = Details.tabela_vigente
4 years ago
local encounter_name = thisCombat.is_boss.encounter
local instanceID = thisCombat.is_boss.ej_instance_id
3 years ago
instanceID = tonumber(instanceID)
4 years ago
if (encounter_name and instanceID and instanceID ~= 0) then
3 years ago
local index, name, description, encounterID, rootSectionID, link = Details:GetEncounterInfoFromEncounterName (instanceID, encounter_name)
4 years ago
if (index and name and encounterID) then
local id, name, description, displayInfo, iconImage = DetailsFramework.EncounterJournal.EJ_GetCreatureInfo (index, encounterID)
if (iconImage) then
3 years ago
gameCooltip:AddIcon(iconImage, 2, "top", 128, 64)
4 years ago
end
end
end
end
3 years ago
if (Details.tooltip.submenu_wallpaper) then
local background = Details:GetRaidIcon (Details.tabela_vigente.is_boss.mapid)
4 years ago
if (background) then
3 years ago
gameCooltip:SetWallpaper (2, background, nil, segments_wallpaper_color, true)
4 years ago
else
3 years ago
local ej_id = Details.tabela_vigente.is_boss.ej_instance_id
4 years ago
if (ej_id and ej_id ~= 0) then
local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = DetailsFramework.EncounterJournal.EJ_GetInstanceInfo (ej_id)
if (name) then
3 years ago
if (Details.tabela_vigente.instance_type == "party") then
gameCooltip:SetWallpaper (2, bgImage, party_wallpaper_tex, party_wallpaper_color, true)
4 years ago
else
3 years ago
gameCooltip:SetWallpaper (2, loreImage, raid_wallpaper_tex, party_wallpaper_color, true)
4 years ago
end
end
end
end
else
3 years ago
--wallpaper = main window
4 years ago
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
3 years ago
elseif (Details.tabela_vigente.is_pvp) then
enemy = Details.tabela_vigente.is_pvp.name
file, coords = Details:GetBattlegroundInfo (Details.tabela_vigente.is_pvp.mapid)
elseif (Details.tabela_vigente.is_arena) then
enemy = Details.tabela_vigente.is_arena.name
file, coords = Details:GetArenaInfo (Details.tabela_vigente.is_arena.mapid)
4 years ago
else
3 years ago
if (Details.tooltip.submenu_wallpaper) then
gameCooltip:SetWallpaper (2, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-StatsBackground]], segments_common_tex, {1, 1, 1, 0.5}, true)
4 years ago
else
3 years ago
--wallpaper = main window
4 years ago
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
3 years ago
end
4 years ago
3 years ago
if (Details.tooltip.submenu_wallpaper) then
4 years ago
if (file) then
3 years ago
gameCooltip:SetWallpaper (2, "Interface\\Glues\\LOADINGSCREENS\\" .. file, coords, empty_segment_color, true)
4 years ago
end
else
3 years ago
--wallpaper = main window
4 years ago
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
3 years ago
4 years ago
if (not segment_info_added) then
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENT_ENEMY"] .. ":", enemy, 2, "white", "white")
if (not Details.tabela_vigente:GetEndTime()) then
if (Details.in_combat) then
local decorrido = Details.tabela_vigente:GetCombatTime()
local minutos, segundos = floor(decorrido/60), floor(decorrido%60)
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
4 years ago
else
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", "--x--x--", 2, "white", "white")
4 years ago
end
else
3 years ago
local decorrido = Details.tabela_vigente:GetCombatTime()
local minutos, segundos = floor(decorrido/60), floor(decorrido%60)
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
4 years ago
end
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", Details.tabela_vigente.data_inicio, 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", Details.tabela_vigente.data_fim or "in progress", 2, "white", "white")
4 years ago
end
3 years ago
--fill � a quantidade de menu que esta sendo mostrada
if (instance.segmento == 0) then
4 years ago
if (fill - 2 == menuIndex) then
3 years ago
gameCooltip:SetLastSelected ("main", fill + 0)
4 years ago
elseif (fill - 1 == menuIndex) then
3 years ago
gameCooltip:SetLastSelected ("main", fill + 1)
4 years ago
else
3 years ago
gameCooltip:SetLastSelected ("main", fill + 2)
4 years ago
end
menuIndex = nil
end
3 years ago
4 years ago
----------- overall
3 years ago
--CoolTip:AddLine(segmentos.overall_standard, _, 1, "white") Loc["STRING_REPORT_LAST"] .. " " .. fight_amount .. " " .. Loc["STRING_REPORT_FIGHTS"]
gameCooltip:AddLine(Loc["STRING_SEGMENT_OVERALL"], _, 1, "white")
gameCooltip:AddMenu(1, instance.TrocaTabela, -1)
gameCooltip:AddIcon([[Interface\QUESTFRAME\UI-Quest-BulletPoint]], "main", "left", 16, 16, nil, nil, nil, nil, "orange")
local enemy_name = Details.tabela_overall.overall_enemy_name
gameCooltip:AddLine(Loc["STRING_SEGMENT_ENEMY"] .. ":", enemy_name, 2, "white", "white")
local combat_time = Details.tabela_overall:GetCombatTime()
local minutos, segundos = floor(combat_time / 60), floor(combat_time % 60)
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
4 years ago
--CoolTip:SetWallpaper (2, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-StatsComparisonBackground]], {0.085, 166/256, 0, 1}, {.42, .4, .4, 0.9}, true)
3 years ago
if (Details.tooltip.submenu_wallpaper) then
4 years ago
--CoolTip:SetWallpaper (2, [[Interface\PetPaperDollFrame\PetStatsBG-Hunter]], {321/512, 0, 0, 190/512}, {1, 1, 1, 0.9}, true)
--CoolTip:SetWallpaper (2, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-StatsComparisonBackground]], {166/256, 1, 0, 1}, {1, 1, 1, 0.9}, true)
else
3 years ago
--wallpaper = main window
4 years ago
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
3 years ago
gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", Details.tabela_overall.data_inicio, 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", Details.tabela_overall.data_fim, 2, "white", "white")
4 years ago
-- combats added
3 years ago
local combats_added = Details.tabela_overall.segments_added or Details.empty_table
gameCooltip:AddLine(Loc["STRING_SEGMENTS"] .. ":", #combats_added, 2, "white", "white")
4 years ago
if (#combats_added > 0) then
3 years ago
gameCooltip:AddLine("", "", 2, "white", "white")
4 years ago
end
3 years ago
for i, segment in ipairs(combats_added) do
local minutos, segundos = floor(segment.elapsed/60), floor(segment.elapsed%60)
4 years ago
local name = segment.name
if (name:len() > 20) then
name = string.sub (name, 1, #name - (#name - 20))
end
3 years ago
gameCooltip:AddLine("" .. name, minutos.."m "..segundos.."s", 2, "white", "white")
4 years ago
local segmentType = segment.type
if (segmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH) then
3 years ago
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], 2, 1, 12, 8, 479/512, 510/512, 24/512, 51/512, nil, nil, true)
4 years ago
elseif (segmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then
3 years ago
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], 2, 1, 12, 12, 0.96875, 1, 0, 0.03125, party_line_color)
4 years ago
elseif (segmentType == DETAILS_SEGMENTTYPE_RAID_TRASH or segmentType == DETAILS_SEGMENTTYPE_DUNGEON_TRASH) then
3 years ago
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], 2, 1, 10, 8, 0.02734375, 0.11328125, 0.19140625, 0.3125)
4 years ago
elseif (segmentType == DETAILS_SEGMENTTYPE_RAID_BOSS) then
3 years ago
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], 2, 1, 12, 12, 0.96875, 1, 0, 0.03125)
4 years ago
end
3 years ago
4 years ago
--CoolTip:AddStatusBar (100, 2, 0, 0, 0, 0.2, false, false, "Skyline")
end
3 years ago
--fill � a quantidade de menu que esta sendo mostrada
if (instance.segmento == -1) then
4 years ago
if (fill - 2 == menuIndex) then
3 years ago
gameCooltip:SetLastSelected ("main", fill + 1)
4 years ago
elseif (fill - 1 == menuIndex) then
3 years ago
gameCooltip:SetLastSelected ("main", fill + 2)
4 years ago
else
3 years ago
gameCooltip:SetLastSelected ("main", fill + 3)
4 years ago
end
menuIndex = nil
end
3 years ago
4 years ago
---------------------------------------------
3 years ago
Details:SetMenuOwner (self, instance)
gameCooltip:SetOption("TextSize", Details.font_sizes.menus)
gameCooltip:SetOption("TextFont", Details.font_faces.menus)
gameCooltip:SetOption("SubMenuIsTooltip", true)
gameCooltip:SetOption("ButtonHeightMod", -4)
gameCooltip:SetOption("ButtonsYMod", -10)
gameCooltip:SetOption("YSpacingMod", 1)
gameCooltip:SetOption("ButtonHeightModSub", 4)
gameCooltip:SetOption("ButtonsYModSub", 0)
gameCooltip:SetOption("YSpacingModSub", -4)
gameCooltip:SetOption("HeighMod", 12)
Details:SetTooltipMinWidth()
show_anti_overlap (instance, self, "top")
gameCooltip:ShowCooltip()
self:SetScript("OnUpdate", nil)
end
4 years ago
end
-- ~skin
3 years ago
function Details:SetUserCustomSkinFile (file)
if (type(file) ~= "string") then
error("SetUserCustomSkinFile() file must be a string.")
4 years ago
end
3 years ago
if (file:find("\\") or file:find("/")) then
error("SetUserCustomSkinFile() file must be only the file name (with out up folders) and slashes.")
4 years ago
end
3 years ago
4 years ago
self.skin_custom = file
self:ChangeSkin()
end
3 years ago
function Details:RefreshMicroDisplays()
Details.StatusBar:UpdateOptions (self)
4 years ago
end
function Details:WaitForSkin()
local skinName = self.skin
local hasSkinInCache = Details.installed_skins_cache[skinName]
if (hasSkinInCache) then
Details:InstallSkin(skinName, hasSkinInCache)
local skin = Details.skins[skinName]
if (skin) then
return skin
end
end
Details.waitingForSkins = Details.waitingForSkins or {}
Details.waitingForSkins[self:GetId()] = skinName
3 years ago
local defaultSkin = Details.default_skin_to_use
local skin = Details.skins[defaultSkin]
self.skin = defaultSkin
return skin
end
4 years ago
function Details:ChangeSkin(skin_name)
4 years ago
if (not skin_name) then
skin_name = self.skin
end
3 years ago
local this_skin = Details.skins[skin_name]
4 years ago
if (not this_skin) then
local tempSkin = Details:WaitForSkin()
this_skin = tempSkin
4 years ago
end
3 years ago
4 years ago
local just_updating = false
if (self.skin == skin_name) then
just_updating = true
end
if (not just_updating) then
3 years ago
--skin updater
4 years ago
if (self.bgframe.skin_script) then
3 years ago
self.bgframe:SetScript("OnUpdate", nil)
4 years ago
self.bgframe.skin_script = false
end
3 years ago
--reset all config
4 years ago
self:ResetInstanceConfigKeepingValues (true)
3 years ago
--overwrites
4 years ago
local overwrite_cprops = this_skin.instance_cprops
if (overwrite_cprops) then
3 years ago
4 years ago
local copy = Details.CopyTable(overwrite_cprops)
3 years ago
for cprop, value in pairs(copy) do
if (not Details.instance_skin_ignored_values [cprop]) then
if (type(value) == "table") then
for cprop2, value2 in pairs(value) do
4 years ago
if (not self[cprop]) then
self[cprop] = {}
end
self [cprop] [cprop2] = value2
end
else
self [cprop] = value
end
end
end
end
3 years ago
--reset micro frames
Details.StatusBar:Reset (self)
--customize micro frames
4 years ago
if (this_skin.micro_frames) then
if (this_skin.micro_frames.left) then
3 years ago
Details.StatusBar:SetPlugin (self, this_skin.micro_frames.left, "left")
4 years ago
end
3 years ago
4 years ago
if (this_skin.micro_frames.textxmod) then
3 years ago
Details.StatusBar:ApplyOptions (self.StatusBar.left, "textxmod", this_skin.micro_frames.textxmod)
Details.StatusBar:ApplyOptions (self.StatusBar.center, "textxmod", this_skin.micro_frames.textxmod)
Details.StatusBar:ApplyOptions (self.StatusBar.right, "textxmod", this_skin.micro_frames.textxmod)
4 years ago
end
if (this_skin.micro_frames.textymod) then
3 years ago
Details.StatusBar:ApplyOptions (self.StatusBar.left, "textymod", this_skin.micro_frames.textymod)
Details.StatusBar:ApplyOptions (self.StatusBar.center, "textymod", this_skin.micro_frames.textymod)
Details.StatusBar:ApplyOptions (self.StatusBar.right, "textymod", this_skin.micro_frames.textymod)
4 years ago
end
if (this_skin.micro_frames.hidden) then
3 years ago
Details.StatusBar:ApplyOptions (self.StatusBar.left, "hidden", this_skin.micro_frames.hidden)
Details.StatusBar:ApplyOptions (self.StatusBar.center, "hidden", this_skin.micro_frames.hidden)
Details.StatusBar:ApplyOptions (self.StatusBar.right, "hidden", this_skin.micro_frames.hidden)
4 years ago
end
if (this_skin.micro_frames.color) then
3 years ago
Details.StatusBar:ApplyOptions (self.StatusBar.left, "textcolor", this_skin.micro_frames.color)
Details.StatusBar:ApplyOptions (self.StatusBar.center, "textcolor", this_skin.micro_frames.color)
Details.StatusBar:ApplyOptions (self.StatusBar.right, "textcolor", this_skin.micro_frames.color)
4 years ago
end
if (this_skin.micro_frames.font) then
3 years ago
Details.StatusBar:ApplyOptions (self.StatusBar.left, "textface", this_skin.micro_frames.font)
Details.StatusBar:ApplyOptions (self.StatusBar.center, "textface", this_skin.micro_frames.font)
Details.StatusBar:ApplyOptions (self.StatusBar.right, "textface", this_skin.micro_frames.font)
4 years ago
end
if (this_skin.micro_frames.size) then
3 years ago
Details.StatusBar:ApplyOptions (self.StatusBar.left, "textsize", this_skin.micro_frames.size)
Details.StatusBar:ApplyOptions (self.StatusBar.center, "textsize", this_skin.micro_frames.size)
Details.StatusBar:ApplyOptions (self.StatusBar.right, "textsize", this_skin.micro_frames.size)
4 years ago
end
end
3 years ago
4 years ago
end
3 years ago
4 years ago
self.skin = skin_name
local skin_file = this_skin.file
3 years ago
--set textures
4 years ago
if (self.skin_custom ~= "") then
skin_file = "Interface\\" .. self.skin_custom
end
3 years ago
self.baseframe.cabecalho.ball:SetTexture(skin_file) --bola esquerda
self.baseframe.cabecalho.emenda:SetTexture(skin_file) --emenda que liga a bola a textura do centro
self.baseframe.cabecalho.ball_r:SetTexture(skin_file) --bola direita onde fica o bot�o de fechar
self.baseframe.cabecalho.top_bg:SetTexture(skin_file) --top background
self.baseframe.barra_esquerda:SetTexture(skin_file) --barra lateral
self.baseframe.barra_direita:SetTexture(skin_file) --barra lateral
self.baseframe.barra_fundo:SetTexture(skin_file) --barra inferior
self.baseframe.scroll_up:SetTexture(skin_file) --scrollbar parte de cima
self.baseframe.scroll_down:SetTexture(skin_file) --scrollbar parte de baixo
self.baseframe.scroll_middle:SetTexture(skin_file) --scrollbar parte do meio
self.baseframe.rodape.top_bg:SetTexture(skin_file) --rodape top background
self.baseframe.rodape.esquerdo:SetTexture(skin_file) --rodape esquerdo
self.baseframe.rodape.direita:SetTexture(skin_file) --rodape direito
self.baseframe.rodape.esquerdo_nostatusbar:SetTexture(skin_file) --rodape direito
self.baseframe.rodape.direita_nostatusbar:SetTexture(skin_file) --rodape direito
self.baseframe.button_stretch.texture:SetTexture(skin_file) --bot�o de esticar a janela
self.baseframe.resize_direita.texture:SetTexture(skin_file) --bot�o de redimencionar da direita
self.baseframe.resize_esquerda.texture:SetTexture(skin_file) --bot�o de redimencionar da esquerda
self.break_snap_button:SetNormalTexture(skin_file) --cadeado
self.break_snap_button:SetDisabledTexture(skin_file)
self.break_snap_button:SetHighlightTexture(skin_file, "ADD")
self.break_snap_button:SetPushedTexture(skin_file)
--update toolbar icons
4 years ago
local toolbar_buttons = {}
3 years ago
4 years ago
do
local toolbar_icon_file = self.toolbar_icon_file
if (not toolbar_icon_file) then
toolbar_icon_file = [[Interface\AddOns\Details\images\toolbar_icons]]
end
toolbar_buttons [1] = self.baseframe.cabecalho.modo_selecao
toolbar_buttons [2] = self.baseframe.cabecalho.segmento
toolbar_buttons [3] = self.baseframe.cabecalho.atributo
toolbar_buttons [4] = self.baseframe.cabecalho.report
toolbar_buttons [5] = self.baseframe.cabecalho.reset
toolbar_buttons [6] = self.baseframe.cabecalho.fechar
3 years ago
4 years ago
for i = 1, #toolbar_buttons do
local button = toolbar_buttons [i]
3 years ago
button:SetNormalTexture(toolbar_icon_file)
button:SetHighlightTexture(toolbar_icon_file)
button:SetPushedTexture(toolbar_icon_file)
4 years ago
end
end
3 years ago
----------icon anchor and size
4 years ago
if (self.modo == 1 or self.modo == 4 or self.atributo == 5) then -- alone e raid
local icon_anchor = this_skin.icon_anchor_plugins
3 years ago
self.baseframe.cabecalho.atributo_icon:SetPoint("topright", self.baseframe.cabecalho.ball_point, "topright", icon_anchor[1], icon_anchor[2])
4 years ago
if (self.modo == 1) then
3 years ago
if (Details.SoloTables.Plugins [1] and Details.SoloTables.Mode) then
local plugin_index = Details.SoloTables.Mode
if (plugin_index > 0 and Details.SoloTables.Menu [plugin_index]) then
self:ChangeIcon (Details.SoloTables.Menu [plugin_index] [2])
4 years ago
end
end
elseif (self.modo == 4) then
--if (_detalhes.RaidTables.Plugins [1] and _detalhes.RaidTables.Mode) then
-- local plugin_index = _detalhes.RaidTables.Mode
-- if (plugin_index and _detalhes.RaidTables.Menu [plugin_index]) then
--self:ChangeIcon (_detalhes.RaidTables.Menu [plugin_index] [2])
-- end
--end
end
else
3 years ago
local icon_anchor = this_skin.icon_anchor_main --ancora do icone do canto direito superior
self.baseframe.cabecalho.atributo_icon:SetPoint("topright", self.baseframe.cabecalho.ball_point, "topright", icon_anchor[1], icon_anchor[2])
4 years ago
self:ChangeIcon()
end
3 years ago
----------lock alpha head
4 years ago
if (not this_skin.can_change_alpha_head) then
3 years ago
self.baseframe.cabecalho.ball:SetAlpha(1)
4 years ago
else
3 years ago
self.baseframe.cabecalho.ball:SetAlpha(self.color[4])
end
----------update abbreviation function on the class files
Details.atributo_damage:UpdateSelectedToKFunction()
Details.atributo_heal:UpdateSelectedToKFunction()
Details.atributo_energy:UpdateSelectedToKFunction()
Details.atributo_misc:UpdateSelectedToKFunction()
Details.atributo_custom:UpdateSelectedToKFunction()
----------call widgets handlers
4 years ago
self:SetBarSettings (self.row_info.height)
self:SetBarBackdropSettings()
self:SetBarSpecIconSettings()
self:SetBarRightTextSettings()
3 years ago
--update toolbar
4 years ago
self:ToolbarSide()
3 years ago
--update stretch button
4 years ago
self:StretchButtonAnchor()
3 years ago
--update side bars
4 years ago
if (self.show_sidebars) then
self:ShowSideBars()
else
self:HideSideBars()
end
3 years ago
--refresh the side of the micro displays and its lock state
4 years ago
self:MicroDisplaysSide()
self:MicroDisplaysLock()
self:RefreshMicroDisplays()
3 years ago
--update statusbar
4 years ago
if (self.show_statusbar) then
self:ShowStatusBar()
else
self:HideStatusBar()
end
3 years ago
--update wallpaper
4 years ago
if (self.wallpaper.enabled) then
self:InstanceWallpaper (true)
else
self:InstanceWallpaper (false)
end
3 years ago
--update instance color
4 years ago
self:InstanceColor()
self:SetBackgroundColor()
self:SetBackgroundAlpha()
self:SetAutoHideMenu()
self:SetBackdropTexture()
3 years ago
--refresh all bars
4 years ago
self:InstanceRefreshRows()
3 years ago
--update menu saturation
4 years ago
self:DesaturateMenu()
3 years ago
--update statusbar color
4 years ago
self:StatusBarColor()
3 years ago
--update attribute string
4 years ago
self:AttributeMenu()
3 years ago
--update top menus
4 years ago
self:LeftMenuAnchorSide()
3 years ago
--update window strata level
4 years ago
self:SetFrameStrata()
3 years ago
--update the combat alphas
4 years ago
self:AdjustAlphaByContext()
3 years ago
--update icons
Details.ToolBar:ReorganizeIcons (true) --call self:SetMenuAlpha()
--refresh options panel if opened
4 years ago
if (_G.DetailsOptionsWindow and _G.DetailsOptionsWindow:IsShown() and not _G.DetailsOptionsWindow.IsLoading) then
3 years ago
Details:OpenOptionsWindow (self)
4 years ago
end
3 years ago
--auto interact
4 years ago
if (self.menu_alpha.enabled) then
3 years ago
self:SetMenuAlpha(nil, nil, nil, nil, self.is_interacting)
4 years ago
end
3 years ago
--set the scale
4 years ago
self:SetWindowScale()
3 years ago
--refresh lock buttons
4 years ago
self:RefreshLockedState()
3 years ago
--update borders
self:UpdateFullBorder()
self:UpdateRowAreaBorder()
3 years ago
--update title bar
self:RefreshTitleBar()
3 years ago
--update the wallpaper level
self:SetInstanceWallpaperLevel()
--clear any control sscript running in this instance
self.bgframe:SetScript("OnUpdate", nil)
4 years ago
self.bgframe.skin_script = nil
3 years ago
--check if the skin has control scripts to run
if (not just_updating or Details.initializing) then
4 years ago
local callbackFunc = this_skin.callback
if (callbackFunc) then
DetailsFramework:SetEnvironment(callbackFunc)
3 years ago
local okey, result = pcall(callbackFunc, this_skin, self, just_updating)
4 years ago
if (not okey) then
3 years ago
Details:Msg("|cFFFF9900error on skin callback function|r:", result)
4 years ago
end
end
3 years ago
4 years ago
if (this_skin.control_script) then
local onStartScript = this_skin.control_script_on_start
if (onStartScript) then
DetailsFramework:SetEnvironment(onStartScript)
3 years ago
local okey, result = pcall(onStartScript, this_skin, self)
4 years ago
if (not okey) then
3 years ago
Details:Msg("|cFFFF9900error on skin control on start function|r:", result)
4 years ago
end
end
3 years ago
4 years ago
local controlFunc = this_skin.control_script
DetailsFramework:SetEnvironment(controlFunc)
3 years ago
self.bgframe:SetScript("OnUpdate", controlFunc)
4 years ago
self.bgframe.skin_script = true
self.bgframe.skin = this_skin
end
end
3 years ago
4 years ago
self:UpdateClickThrough()
end
--update the window click through state
3 years ago
local updateClickThroughListener = Details:CreateEventListener()
4 years ago
function updateClickThroughListener:EnterCombat()
3 years ago
Details:InstanceCall(function(instance)
C_Timer.After(1.5, function()
4 years ago
instance:UpdateClickThrough()
end)
end)
end
function updateClickThroughListener:LeaveCombat()
3 years ago
Details:InstanceCall(function(instance)
C_Timer.After(1.5, function()
4 years ago
instance:UpdateClickThrough()
end)
end)
end
updateClickThroughListener:RegisterEvent("COMBAT_PLAYER_ENTER", "EnterCombat")
updateClickThroughListener:RegisterEvent("COMBAT_PLAYER_LEAVE", "EnterCombat")
4 years ago
3 years ago
function Details:UpdateClickThroughSettings (inCombat, window, bars, toolbaricons)
4 years ago
if (inCombat ~= nil) then
self.clickthrough_incombatonly = inCombat
end
3 years ago
4 years ago
if (window ~= nil) then
self.clickthrough_window = window
end
3 years ago
4 years ago
if (bars ~= nil) then
self.clickthrough_rows = bars
end
3 years ago
4 years ago
if (toolbaricons ~= nil) then
self.clickthrough_toolbaricons = toolbaricons
end
3 years ago
4 years ago
self:UpdateClickThrough()
end
3 years ago
function Details:UpdateClickThrough()
4 years ago
local barsClickThrough = self.clickthrough_rows
local windowClickThrough = self.clickthrough_window
local onlyInCombat = self.clickthrough_incombatonly
local toolbarIcons = not self.clickthrough_toolbaricons
if (onlyInCombat) then
if (InCombatLockdown()) then
--player bars
if (barsClickThrough) then
3 years ago
for barIndex, barObject in ipairs(self.barras) do
4 years ago
barObject:EnableMouse(false)
barObject.icon_frame:EnableMouse(false)
end
else
3 years ago
for barIndex, barObject in ipairs(self.barras) do
4 years ago
barObject:EnableMouse(true)
barObject.icon_frame:EnableMouse(true)
end
end
3 years ago
4 years ago
--window frames
if (windowClickThrough) then
3 years ago
self.baseframe:EnableMouse(false)
self.bgframe:EnableMouse(false)
self.rowframe:EnableMouse(false)
self.floatingframe:EnableMouse(false)
self.windowSwitchButton:EnableMouse(false)
self.windowBackgroundDisplay:EnableMouse(false)
self.baseframe.UPFrame:EnableMouse(false)
4 years ago
self.baseframe.DOWNFrame:EnableMouse(false)
3 years ago
4 years ago
else
3 years ago
self.baseframe:EnableMouse(true)
self.bgframe:EnableMouse(true)
self.rowframe:EnableMouse(true)
self.floatingframe:EnableMouse(true)
self.windowSwitchButton:EnableMouse(true)
self.windowBackgroundDisplay:EnableMouse(true)
self.baseframe.UPFrame:EnableMouse(true)
4 years ago
self.baseframe.DOWNFrame:EnableMouse(true)
end
3 years ago
4 years ago
--titlebar icons
local toolbar_buttons = {}
toolbar_buttons [1] = self.baseframe.cabecalho.modo_selecao
toolbar_buttons [2] = self.baseframe.cabecalho.segmento
toolbar_buttons [3] = self.baseframe.cabecalho.atributo
toolbar_buttons [4] = self.baseframe.cabecalho.report
toolbar_buttons [5] = self.baseframe.cabecalho.reset
toolbar_buttons [6] = self.baseframe.cabecalho.fechar
3 years ago
for i, button in ipairs(toolbar_buttons) do
button:EnableMouse(toolbar_buttons)
4 years ago
end
3 years ago
4 years ago
else
--player bars
3 years ago
for barIndex, barObject in ipairs(self.barras) do
barObject:EnableMouse(true)
4 years ago
barObject.icon_frame:EnableMouse(true)
end
3 years ago
4 years ago
--window frames
3 years ago
self.baseframe:EnableMouse(true)
self.bgframe:EnableMouse(true)
self.rowframe:EnableMouse(true)
self.floatingframe:EnableMouse(true)
self.windowSwitchButton:EnableMouse(true)
self.windowBackgroundDisplay:EnableMouse(true)
self.baseframe.UPFrame:EnableMouse(true)
4 years ago
self.baseframe.DOWNFrame:EnableMouse(true)
3 years ago
4 years ago
--titlebar icons, forcing true because the player isn't in combat and the inCombat setting is enabled
local toolbar_buttons = {}
toolbar_buttons [1] = self.baseframe.cabecalho.modo_selecao
toolbar_buttons [2] = self.baseframe.cabecalho.segmento
toolbar_buttons [3] = self.baseframe.cabecalho.atributo
toolbar_buttons [4] = self.baseframe.cabecalho.report
toolbar_buttons [5] = self.baseframe.cabecalho.reset
toolbar_buttons [6] = self.baseframe.cabecalho.fechar
3 years ago
for i, button in ipairs(toolbar_buttons) do
button:EnableMouse(true)
4 years ago
end
end
else
--player bars
if (barsClickThrough) then
3 years ago
for barIndex, barObject in ipairs(self.barras) do
barObject:EnableMouse(false)
4 years ago
barObject.icon_frame:EnableMouse(false)
end
else
3 years ago
for barIndex, barObject in ipairs(self.barras) do
barObject:EnableMouse(true)
4 years ago
end
end
3 years ago
4 years ago
--window frame
if (windowClickThrough) then
3 years ago
self.baseframe:EnableMouse(false)
self.bgframe:EnableMouse(false)
self.rowframe:EnableMouse(false)
self.floatingframe:EnableMouse(false)
self.windowSwitchButton:EnableMouse(false)
self.windowBackgroundDisplay:EnableMouse(false)
self.baseframe.UPFrame:EnableMouse(false)
4 years ago
self.baseframe.DOWNFrame:EnableMouse(false)
else
3 years ago
self.baseframe:EnableMouse(true)
self.bgframe:EnableMouse(true)
self.rowframe:EnableMouse(true)
self.floatingframe:EnableMouse(true)
self.windowSwitchButton:EnableMouse(true)
self.windowBackgroundDisplay:EnableMouse(true)
self.baseframe.UPFrame:EnableMouse(true)
4 years ago
self.baseframe.DOWNFrame:EnableMouse(true)
end
3 years ago
4 years ago
--titlebar icons
local toolbar_buttons = {}
toolbar_buttons [1] = self.baseframe.cabecalho.modo_selecao
toolbar_buttons [2] = self.baseframe.cabecalho.segmento
toolbar_buttons [3] = self.baseframe.cabecalho.atributo
toolbar_buttons [4] = self.baseframe.cabecalho.report
toolbar_buttons [5] = self.baseframe.cabecalho.reset
toolbar_buttons [6] = self.baseframe.cabecalho.fechar
3 years ago
for i, button in ipairs(toolbar_buttons) do
button:EnableMouse(toolbarIcons)
4 years ago
end
end
end
3 years ago
function Details:DelayedCheckCombatAlpha (instance, alpha)
4 years ago
if (UnitAffectingCombat("player") or InCombatLockdown()) then
3 years ago
instance:SetWindowAlphaForCombat(true, true, alpha) --hida a janela
instance:SetWindowAlphaForCombat(true, true, alpha) --hida a janela
4 years ago
end
end
3 years ago
function Details:DelayedCheckOutOfCombatAlpha (instance, alpha)
4 years ago
if (not UnitAffectingCombat("player") and not InCombatLockdown()) then
3 years ago
instance:SetWindowAlphaForCombat(true, true, alpha) --hida a janela
instance:SetWindowAlphaForCombat(true, true, alpha) --hida a janela
4 years ago
end
end
3 years ago
function Details:DelayedCheckOutOfCombatAndGroupAlpha (instance, alpha)
if ((Details.zone_type == "raid" or Details.zone_type == "party") and IsInInstance()) then
4 years ago
if (UnitAffectingCombat("player") or InCombatLockdown()) then
3 years ago
instance:SetWindowAlphaForCombat(false, false, alpha) --deshida a janela
4 years ago
else
3 years ago
instance:SetWindowAlphaForCombat(true, true, alpha) --hida a janela
instance:SetWindowAlphaForCombat(true, true, alpha) --hida a janela
4 years ago
end
end
end
local getAlphaByContext = function(instance, contextIndex, invert)
local alpha = instance.hide_on_context[contextIndex].value
if (invert) then
alpha = abs(alpha - 100)
end
return alpha
end
3 years ago
function Details:AdjustAlphaByContext(interacting)
4 years ago
--in combat
if (not self.meu_id) then
print("error Details! AdjustAlphaByContext()", debugstack())
end
local hasRuleEnabled = false
--not in group
if (self.hide_on_context[3].enabled) then
if (self.hide_on_context[3].inverse) then
--while in group
3 years ago
if (Details.in_group) then
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 3)) --hida a janela
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 3)) --hida a janela
4 years ago
hasRuleEnabled = true
end
else
--while not in group
3 years ago
if (not Details.in_group) then
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 3)) --hida a janela
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 3)) --hida a janela
4 years ago
hasRuleEnabled = true
end
end
end
--while not inside instance
if (self.hide_on_context[4].enabled) then
local isInInstance = IsInInstance()
3 years ago
if (not isInInstance or (not Details.zone_type == "raid" and not Details.zone_type == "party")) then
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 4)) --hida a janela
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 4)) --hida a janela
4 years ago
hasRuleEnabled = true
end
end
--while inside instance
if (self.hide_on_context[5].enabled) then
local isInInstance = IsInInstance()
3 years ago
if (isInInstance or Details.zone_type == "raid" or Details.zone_type == "party") then
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 5)) --hida a janela
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 5)) --hida a janela
4 years ago
hasRuleEnabled = true
end
end
--raid debug (inside instance + out of combat)
if (self.hide_on_context[6].enabled) then
3 years ago
if ((Details.zone_type == "raid" or Details.zone_type == "party") and IsInInstance()) then
Details:ScheduleTimer("DelayedCheckOutOfCombatAndGroupAlpha", 0.3, self, getAlphaByContext(self, 6))
4 years ago
end
end
--in arena
if (self.hide_on_context[9].enabled) then
local contextId = 9
local isInInstance = IsInInstance()
if (isInInstance and Details.zone_type == "arena") then
--player is within a pvp arena
if (not self.hide_on_context[contextId].inverse) then
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, contextId))
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, contextId))
else
3 years ago
self:SetWindowAlphaForCombat(false, false, getAlphaByContext(self, contextId)) --deshida a janela
end
hasRuleEnabled = true
else
--player is not inside an arena
if (self.hide_on_context[contextId].inverse) then
3 years ago
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, contextId))
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, contextId))
hasRuleEnabled = true
end
end
end
4 years ago
--in battleground
if (self.hide_on_context[7].enabled) then
local isInInstance = IsInInstance()
3 years ago
if (isInInstance and Details.zone_type == "pvp") then
4 years ago
--player is inside a battleground
if (not self.hide_on_context[7].inverse) then
3 years ago
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 7)) --hida a janela
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 7)) --hida a janela
4 years ago
else
3 years ago
self:SetWindowAlphaForCombat(false, false, getAlphaByContext(self, 7)) --deshida a janela
4 years ago
end
hasRuleEnabled = true
else
--player is not inside a battleground
if (not self.hide_on_context[7].inverse) then
--there's no inverse rule: do nothing
3 years ago
--self:SetWindowAlphaForCombat(false, false, getAlphaByContext(self, 7)) --deshida a janela
4 years ago
else
3 years ago
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 7)) --hida a janela
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 7)) --hida a janela
4 years ago
hasRuleEnabled = true
end
end
end
--mythic+
if (self.hide_on_context[8].enabled) then
if (_G.DetailsMythicPlusFrame and _G.DetailsMythicPlusFrame.IsDoingMythicDungeon) then
--player is inside a dungeon mythic+
if (not self.hide_on_context[8].inverse) then
3 years ago
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 8)) --hida a janela
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 8)) --hida a janela
4 years ago
else
3 years ago
self:SetWindowAlphaForCombat(false, false, getAlphaByContext(self, 8)) --deshida a janela
4 years ago
end
hasRuleEnabled = true
else
if (not self.hide_on_context[8].inverse) then
--there's no inverse rule: do nothing
3 years ago
--self:SetWindowAlphaForCombat(false, false, getAlphaByContext(self, 8)) --deshida a janela
4 years ago
else
3 years ago
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 8)) --hida a janela
self:SetWindowAlphaForCombat(true, true, getAlphaByContext(self, 8)) --hida a janela
4 years ago
hasRuleEnabled = true
end
end
end
--in combat
if (self.hide_on_context[1].enabled) then
3 years ago
Details:ScheduleTimer("DelayedCheckCombatAlpha", 0.3, self, getAlphaByContext(self, 1))
4 years ago
end
--out of combat
if (self.hide_on_context[2].enabled) then
3 years ago
Details:ScheduleTimer("DelayedCheckOutOfCombatAlpha", 0.3, self, getAlphaByContext(self, 2))
4 years ago
end
--if no rule is enabled, show the window
if (not hasRuleEnabled) then
self:SetWindowAlphaForCombat(false)
self:SetWindowAlphaForCombat(false)
end
end
3 years ago
function Details:LeftMenuAnchorSide (side)
4 years ago
if (not side) then
side = self.menu_anchor.side
end
3 years ago
4 years ago
self.menu_anchor.side = side
return self:MenuAnchor()
end
3 years ago
function Details:SetFrameStrata(strata)
4 years ago
if (not strata) then
strata = self.strata
end
3 years ago
4 years ago
self.strata = strata
3 years ago
self.rowframe:SetFrameStrata(strata)
self.windowSwitchButton:SetFrameStrata(strata)
self.baseframe:SetFrameStrata(strata)
4 years ago
if (strata == "BACKGROUND") then
3 years ago
self.break_snap_button:SetFrameStrata("LOW")
self.baseframe.resize_esquerda:SetFrameStrata("LOW")
self.baseframe.resize_direita:SetFrameStrata("LOW")
self.baseframe.lock_button:SetFrameStrata("LOW")
4 years ago
elseif (strata == "LOW") then
3 years ago
self.break_snap_button:SetFrameStrata("MEDIUM")
self.baseframe.resize_esquerda:SetFrameStrata("MEDIUM")
self.baseframe.resize_direita:SetFrameStrata("MEDIUM")
self.baseframe.lock_button:SetFrameStrata("MEDIUM")
4 years ago
elseif (strata == "MEDIUM") then
3 years ago
self.break_snap_button:SetFrameStrata("HIGH")
self.baseframe.resize_esquerda:SetFrameStrata("HIGH")
self.baseframe.resize_direita:SetFrameStrata("HIGH")
self.baseframe.lock_button:SetFrameStrata("HIGH")
4 years ago
elseif (strata == "HIGH") then
3 years ago
self.break_snap_button:SetFrameStrata("DIALOG")
self.baseframe.resize_esquerda:SetFrameStrata("DIALOG")
self.baseframe.resize_direita:SetFrameStrata("DIALOG")
self.baseframe.lock_button:SetFrameStrata("DIALOG")
4 years ago
elseif (strata == "DIALOG") then
3 years ago
self.break_snap_button:SetFrameStrata("FULLSCREEN")
self.baseframe.resize_esquerda:SetFrameStrata("FULLSCREEN")
self.baseframe.resize_direita:SetFrameStrata("FULLSCREEN")
self.baseframe.lock_button:SetFrameStrata("FULLSCREEN")
4 years ago
end
3 years ago
4 years ago
self:StretchButtonAlwaysOnTop()
end
--set and refresh the full border
function Details:UpdateFullBorder(shown, color, size)
if (type(shown) == "boolean") then
self.fullborder_shown = shown
else
shown = self.fullborder_shown
end
if (size) then
self.fullborder_size = size
else
size = self.fullborder_size
end
if (color) then
self.fullborder_color = color
else
color = self.fullborder_color
end
self.baseframe.fullWindowFrame.border:SetShown(shown)
if (shown) then
self.baseframe.fullWindowFrame.border:SetBorderSizes(size, size, size, size)
self.baseframe.fullWindowFrame.border:UpdateSizes()
self.baseframe.fullWindowFrame.border:SetVertexColor(DetailsFramework:ParseColors(color))
end
end
--set and refresh the border of the row area
function Details:UpdateRowAreaBorder(shown, color, size)
if (type(shown) == "boolean") then
self.rowareaborder_shown = shown
else
shown = self.rowareaborder_shown
end
if (size) then
self.rowareaborder_size = size
else
size = self.rowareaborder_size
end
if (color) then
self.rowareaborder_color = color
else
color = self.rowareaborder_color
end
self.baseframe.border:SetShown(shown)
if (shown) then
self.baseframe.border:SetBorderSizes(size, size, size, size)
self.baseframe.border:UpdateSizes()
self.baseframe.border:SetVertexColor(DetailsFramework:ParseColors(color))
end
end
4 years ago
-- ~attributemenu (text with attribute name)
3 years ago
function Details:RefreshAttributeTextSize()
4 years ago
if (self.attribute_text.enabled and self.total_buttons_shown and self.baseframe and self.menu_attribute_string) then
3 years ago
4 years ago
local window_width = self:GetSize()
3 years ago
4 years ago
if (self.auto_hide_menu.left and not self.is_interacting) then
3 years ago
self.menu_attribute_string:SetWidth(window_width)
self.menu_attribute_string:SetHeight(self.attribute_text.text_size + 2)
4 years ago
return
end
3 years ago
4 years ago
local buttons_shown = self.total_buttons_shown
local buttons_width, buttons_spacement = self.menu_icons_size * 16, self.menu_icons.space
3 years ago
4 years ago
local width_by_buttons = (buttons_shown * buttons_width) + (buttons_spacement * (buttons_shown - 1))
3 years ago
4 years ago
local text_size = window_width - width_by_buttons - 6
3 years ago
self.menu_attribute_string:SetWidth(text_size)
self.menu_attribute_string:SetHeight(self.attribute_text.text_size + 2)
4 years ago
end
end
-- ~encounter ~timer
3 years ago
function Details:CheckForTextTimeCounter(combatStart) --called from combat start function
if (combatStart) then
--if (Details.tabela_vigente.is_boss) then --is an encounter
local instanceId = Details:GetLowerInstanceNumber()
if (instanceId) then
local instance = Details:GetInstance(instanceId)
4 years ago
if (instance.baseframe and instance:IsEnabled()) then
3 years ago
if (instance.attribute_text.show_timer) then --can show the timer
--start a new ticker of 1 second
if (Details.instance_title_text_timer[instance:GetId()]) then
Details.Schedules.Cancel(Details.instance_title_text_timer[instance:GetId()])
4 years ago
end
3 years ago
Details.instance_title_text_timer[instance:GetId()] = Details.Schedules.NewTicker(1, Details.TitleTextTickTimer, Details, instance)
4 years ago
end
end
else
3 years ago
return --there's no open window
4 years ago
end
3 years ago
--else --boss encounter not found
-- if (Details.in_combat and Details.zone_type == "raid") then
-- Details.Schedules.NewTimer(3, Details.CheckForTextTimeCounter, Details, true)
-- end
--end
4 years ago
else
3 years ago
for instanceId, instance in Details:ListInstances() do
if (Details.instance_title_text_timer[instance:GetId()] and instance.baseframe and instance:IsEnabled() and instance.menu_attribute_string) then --check if the instance is initialized
Details.Schedules.Cancel(Details.instance_title_text_timer[instance:GetId()])
local currentText = instance:GetTitleBarText()
if (currentText) then
currentText = currentText:gsub("%[.*%] ", "")
instance:SetTitleBarText(currentText)
end
4 years ago
end
end
end
end
3 years ago
local formatTime = function(t)
local m, s = floor(t/60), floor(t%60)
4 years ago
if (m < 1) then
m = "00"
elseif (m < 10) then
m = "0" .. m
end
if (s < 10) then
s = "0" .. s
end
return "[" .. m .. ":" .. s .. "]"
end
3 years ago
local updateTimerInTheTitleBarText = function(instance, timer)
local originalText = instance.menu_attribute_string.originalText
if (originalText) then
local formattedTime = formatTime(timer)
instance:SetTitleBarText(formattedTime .. " " .. originalText)
else
local titleBarTitleText = instance:GetTitleBarText()
if (titleBarTitleText) then
if (not titleBarTitleText:find("%[.*%]")) then
instance:SetTitleBarText("[00:01] " .. titleBarTitleText)
else
local formattedTime = formatTime(timer)
titleBarTitleText = titleBarTitleText:gsub("%[.*%]", formattedTime)
instance:SetTitleBarText(titleBarTitleText)
end
end
end
end
--self is Details
--this is a ticker callback, it is called on each 1 second
function Details:TitleTextTickTimer(instance)
--hold the time value to show in the title bar
local timer
4 years ago
if (instance.attribute_text.enabled) then
3 years ago
local zoneType = Details:GetZoneType()
if (zoneType == "arena") then
if (instance.attribute_text.show_timer_arena) then
timer = GetTime() - Details:GetArenaStartTime()
end
elseif (zoneType == "pvp") then
if (instance.attribute_text.show_timer_bg) then
timer = GetTime() - Details:GetBattlegroundStartTime()
end
elseif (zoneType == "raid" or zoneType == "party") then
--always attempt to show the time during a boss encounter
if (IsEncounterInProgress) then
if (IsEncounterInProgress()) then
timer = Details:GetCurrentCombat():GetCombatTime()
end
else
if (Details.tabela_vigente.is_boss) then
timer = Details:GetCurrentCombat():GetCombatTime()
end
end
end
if (not timer) then
if (instance.attribute_text.show_timer_always) then
timer = Details:GetCurrentCombat():GetCombatTime()
end
end
if (timer) then
local combatObject = instance:GetShowingCombat()
combatObject.hasTimer = timer
updateTimerInTheTitleBarText(instance, timer)
end
end
end
function Details:RefreshTitleBarText()
local titleBarText = self.menu_attribute_string
if (titleBarText and self == titleBarText.owner_instance) then
local sName = self:GetInstanceAttributeText()
local instanceMode = self:GetMode()
if (instanceMode == DETAILS_MODE_GROUP or instanceMode == DETAILS_MODE_ALL) then
local segment = self:GetSegment()
if (segment == DETAILS_SEGMENTID_OVERALL) then
sName = sName .. " " .. Loc["STRING_OVERALL"]
elseif (segment >= 2) then
sName = sName .. " [" .. segment .. "]"
end
end
if (not Details.in_combat) then
local timer = false --self:GetShowingCombat().hasTimer
if (timer) then
local timeFormatted = formatTime(timer)
titleBarText.originalText = sName
sName = timeFormatted .. " " .. sName
titleBarText:SetText(sName)
4 years ago
else
3 years ago
titleBarText:SetText(sName)
titleBarText.originalText = sName
4 years ago
end
3 years ago
else
titleBarText:SetText(sName)
titleBarText.originalText = sName
4 years ago
end
end
end
3 years ago
function Details:SetTitleBarText(text)
if (self.menu_attribute_string) then
4 years ago
self.menu_attribute_string:SetText(text)
end
end
3 years ago
function Details:GetTitleBarText()
4 years ago
if (self.menu_attribute_string) then
return self.menu_attribute_string:GetText()
end
end
-- ~titletext
3 years ago
--@timer_bg: battleground elapsed time
--@timer_arena: arena match elapsed time
function Details:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side, shadow, timer_encounter, timer_bg, timer_arena)
if (type(enabled) ~= "boolean") then
4 years ago
enabled = self.attribute_text.enabled
end
if (not pos_x) then
pos_x = self.attribute_text.anchor [1]
end
if (not pos_y) then
pos_y = self.attribute_text.anchor [2]
end
3 years ago
4 years ago
if (not font) then
font = self.attribute_text.text_face
end
3 years ago
4 years ago
if (not size) then
size = self.attribute_text.text_size
end
3 years ago
4 years ago
if (not color) then
color = self.attribute_text.text_color
end
3 years ago
4 years ago
if (not side) then
side = self.attribute_text.side
end
3 years ago
if (type(shadow) ~= "boolean") then
4 years ago
shadow = self.attribute_text.shadow
end
3 years ago
4 years ago
if (type(self.attribute_text.show_timer) ~= "boolean") then
self.attribute_text.show_timer = true
end
if (type(timer_encounter) ~= "boolean") then
timer_encounter = self.attribute_text.show_timer
end
3 years ago
if (type(timer_bg) ~= "boolean") then
timer_bg = self.attribute_text.show_timer_bg
end
if (type(timer_arena) ~= "boolean") then
timer_arena = self.attribute_text.show_timer_arena
end
4 years ago
self.attribute_text.enabled = enabled
self.attribute_text.anchor [1] = pos_x
self.attribute_text.anchor [2] = pos_y
self.attribute_text.text_face = font
self.attribute_text.text_size = size
self.attribute_text.text_color = color
self.attribute_text.side = side
self.attribute_text.shadow = shadow
self.attribute_text.show_timer = timer_encounter
3 years ago
self.attribute_text.show_timer_bg = timer_bg
self.attribute_text.show_timer_arena = timer_arena
--enabled
4 years ago
if (not enabled and self.menu_attribute_string) then
return self.menu_attribute_string:Hide()
elseif (not enabled) then
return
end
3 years ago
--protection against failed clean up framework table
if (self.menu_attribute_string and not getmetatable(self.menu_attribute_string)) then
4 years ago
self.menu_attribute_string = nil
end
3 years ago
if (not self.menu_attribute_string) then
--local label = gump:NewLabel(self.floatingframe, nil, "DetailsAttributeStringInstance" .. self.meu_id, nil, "", "GameFontHighlightSmall")
local label = gump:NewLabel(self.baseframe, nil, "DetailsAttributeStringInstance" .. self.meu_id, nil, "", "GameFontHighlightSmall")
4 years ago
self.menu_attribute_string = label
self.menu_attribute_string.owner_instance = self
self.menu_attribute_string.Enabled = true
self.menu_attribute_string.__enabled = true
3 years ago
function self.menu_attribute_string:OnEvent(instance, attribute, subAttribute)
instance:RefreshTitleBarText()
4 years ago
end
3 years ago
Details:RegisterEvent(self.menu_attribute_string, "DETAILS_INSTANCE_CHANGEATTRIBUTE", self.menu_attribute_string.OnEvent)
Details:RegisterEvent(self.menu_attribute_string, "DETAILS_INSTANCE_CHANGEMODE", self.menu_attribute_string.OnEvent)
Details:RegisterEvent(self.menu_attribute_string, "DETAILS_INSTANCE_CHANGESEGMENT", self.menu_attribute_string.OnEvent)
self:RefreshTitleBarText()
4 years ago
end
self.menu_attribute_string:Show()
3 years ago
--anchor
if (side == 1) then --a string esta no lado de cima
4 years ago
if (self.toolbar_side == 1) then -- a toolbar esta em cima
self.menu_attribute_string:ClearAllPoints()
3 years ago
self.menu_attribute_string:SetPoint("bottomleft", self.baseframe.cabecalho.ball, "bottomright", self.attribute_text.anchor [1], self.attribute_text.anchor [2])
4 years ago
elseif (self.toolbar_side == 2) then --a toolbar esta em baixo
self.menu_attribute_string:ClearAllPoints()
3 years ago
self.menu_attribute_string:SetPoint("bottomleft", self.baseframe, "topleft", self.attribute_text.anchor [1] + 21, self.attribute_text.anchor [2])
4 years ago
end
3 years ago
elseif (side == 2) then --a string esta no lado de baixo
4 years ago
if (self.toolbar_side == 1) then --toolbar esta em cima
self.menu_attribute_string:ClearAllPoints()
3 years ago
self.menu_attribute_string:SetPoint("left", self.baseframe.rodape.StatusBarLeftAnchor, "left", self.attribute_text.anchor [1] + 16, self.attribute_text.anchor [2] - 6)
4 years ago
elseif (self.toolbar_side == 2) then --toolbar esta em baixo
3 years ago
self.menu_attribute_string:SetPoint("bottomleft", self.baseframe.cabecalho.ball, "topright", self.attribute_text.anchor [1], self.attribute_text.anchor [2] - 19)
4 years ago
end
end
3 years ago
4 years ago
--font face
3 years ago
local fontPath = SharedMedia:Fetch("font", font)
Details:SetFontFace(self.menu_attribute_string, fontPath)
4 years ago
--font size
3 years ago
Details:SetFontSize(self.menu_attribute_string, size)
4 years ago
--color
3 years ago
Details:SetFontColor(self.menu_attribute_string, color)
4 years ago
C_Timer.After(1, function()
3 years ago
Details:SetFontColor(self.menu_attribute_string, color)
4 years ago
end)
3 years ago
4 years ago
--shadow
3 years ago
Details:SetFontOutline(self.menu_attribute_string, shadow)
4 years ago
--refresh size
self:RefreshAttributeTextSize()
end
-- ~backdrop
3 years ago
function Details:SetBackdropTexture (texturename)
4 years ago
if (not texturename) then
texturename = self.backdrop_texture
end
3 years ago
4 years ago
self.backdrop_texture = texturename
3 years ago
local texture_path = SharedMedia:Fetch("background", texturename)
self.baseframe:SetBackdrop({
4 years ago
bgFile = texture_path, tile = true, tileSize = 128,
insets = {left = 0, right = 0, top = 0, bottom = 0}}
)
3 years ago
self.bgdisplay:SetBackdrop({
4 years ago
bgFile = texture_path, tile = true, tileSize = 128,
insets = {left = 0, right = 0, top = 0, bottom = 0}}
)
3 years ago
4 years ago
self:SetBackgroundAlpha (self.bg_alpha)
3 years ago
4 years ago
end
-- ~alpha (transparency of buttons on the toolbar) ~autohide �utohide ~menuauto
3 years ago
function Details:SetAutoHideMenu(left, right, interacting)
4 years ago
--30/07/2018: the separation by left and right menu icons doesn't exists for years, but it was still active in the code making
--the toolbar icons show on initialization even when the options to auto hide them enabled.
--the code to set the alpha was already updated to only one anhor (left) but this function was still calling to update the right anchor (deprecated)
if (interacting) then
if (self.is_interacting) then
if (self.auto_hide_menu.left) then
3 years ago
local r, g, b = unpack(self.color_buttons)
self:InstanceButtonsColors (r, g, b, self.menu_icons_alpha, true, true) --no save, only left
3 years ago
4 years ago
if (self.baseframe.cabecalho.PluginIconsSeparator) then
self.baseframe.cabecalho.PluginIconsSeparator:Show()
end
end
else
if (self.auto_hide_menu.left) then
3 years ago
local r, g, b = unpack(self.color_buttons)
4 years ago
self:InstanceButtonsColors (r, g, b, 0, true, true) --no save, only left
3 years ago
4 years ago
if (self.baseframe.cabecalho.PluginIconsSeparator) then
self.baseframe.cabecalho.PluginIconsSeparator:Hide()
end
end
end
return
end
if (left == nil) then
left = self.auto_hide_menu.left
end
if (right == nil) then
right = self.auto_hide_menu.right
end
self.auto_hide_menu.left = left
self.auto_hide_menu.right = right
3 years ago
local r, g, b = unpack(self.color_buttons)
4 years ago
if (not left) then
--auto hide is off
self:InstanceButtonsColors (r, g, b, self.menu_icons_alpha, true, true) --no save, only left
3 years ago
4 years ago
if (self.baseframe.cabecalho.PluginIconsSeparator) then
self.baseframe.cabecalho.PluginIconsSeparator:Show()
end
else
if (self.is_interacting) then
self:InstanceButtonsColors (r, g, b, self.menu_icons_alpha, true, true) --no save, only left
3 years ago
4 years ago
if (self.baseframe.cabecalho.PluginIconsSeparator) then
self.baseframe.cabecalho.PluginIconsSeparator:Show()
end
else
self:InstanceButtonsColors (0, 0, 0, 0, true, true) --no save, only left
3 years ago
4 years ago
if (self.baseframe.cabecalho.PluginIconsSeparator) then
self.baseframe.cabecalho.PluginIconsSeparator:Hide()
end
end
end
self:RefreshAttributeTextSize()
end
-- transparency for toolbar, borders and statusbar
3 years ago
function Details:SetMenuAlpha(enabled, onenter, onleave, ignorebars, interacting)
4 years ago
3 years ago
if (interacting) then --called from a onenter or onleave script
4 years ago
if (self.menu_alpha.enabled) then
if (self.is_interacting) then
return self:SetWindowAlphaForInteract (self.menu_alpha.onenter)
else
return self:SetWindowAlphaForInteract (self.menu_alpha.onleave)
end
end
return
end
--ignorebars
3 years ago
4 years ago
if (enabled == nil) then
enabled = self.menu_alpha.enabled
end
if (not onenter) then
onenter = self.menu_alpha.onenter
end
if (not onleave) then
onleave = self.menu_alpha.onleave
end
if (ignorebars == nil) then
ignorebars = self.menu_alpha.ignorebars
end
self.menu_alpha.enabled = enabled
self.menu_alpha.onenter = onenter
self.menu_alpha.onleave = onleave
self.menu_alpha.ignorebars = ignorebars
3 years ago
4 years ago
if (not enabled) then
3 years ago
self.baseframe:SetAlpha(1)
self.rowframe:SetFrameAlpha(1)
4 years ago
self:InstanceAlpha (self.color[4])
self:SetIconAlpha (1, nil, true)
3 years ago
return self:InstanceColor (unpack(self.color))
4 years ago
--return self:SetWindowAlphaForInteract (self.color [4])
else
3 years ago
local r, g, b = unpack(self.color)
4 years ago
self:InstanceColor (r, g, b, 1)
3 years ago
r, g, b = unpack(self.statusbar_info.overlay)
self:StatusBarColor(r, g, b, 1)
4 years ago
end
if (self.is_interacting) then
3 years ago
return self:SetWindowAlphaForInteract (onenter) --set alpha
4 years ago
else
3 years ago
return self:SetWindowAlphaForInteract (onleave) --set alpha
4 years ago
end
3 years ago
4 years ago
end
3 years ago
function Details:GetInstanceCurrentAlpha()
4 years ago
if (self.menu_alpha.enabled) then
if (self:IsInteracting()) then
return self.menu_alpha.onenter
else
return self.menu_alpha.onleave
end
else
return self.color [4]
end
end
3 years ago
function Details:GetInstanceIconsCurrentAlpha()
4 years ago
if (self.menu_alpha.enabled and self.menu_alpha.iconstoo) then
if (self:IsInteracting()) then
return self.menu_alpha.onenter
else
return self.menu_alpha.onleave
end
else
return 1
end
end
3 years ago
function Details:MicroDisplaysLock (lockstate)
4 years ago
if (lockstate == nil) then
lockstate = self.micro_displays_locked
end
self.micro_displays_locked = lockstate
3 years ago
if (lockstate) then --is locked
Details.StatusBar:LockDisplays (self, true)
4 years ago
else
3 years ago
Details.StatusBar:LockDisplays (self, false)
4 years ago
end
end
3 years ago
function Details:MicroDisplaysSide (side, fromuser)
4 years ago
if (not side) then
side = self.micro_displays_side
end
3 years ago
4 years ago
self.micro_displays_side = side
3 years ago
Details.StatusBar:ReloadAnchors (self)
if (self.micro_displays_side == 2 and not self.show_statusbar) then --bottom side
Details.StatusBar:Hide (self)
4 years ago
if (fromuser) then
3 years ago
Details:Msg(Loc["STRING_OPTIONS_MICRODISPLAYWARNING"])
4 years ago
end
elseif (self.micro_displays_side == 2) then
3 years ago
Details.StatusBar:Show (self)
4 years ago
elseif (self.micro_displays_side == 1) then
3 years ago
Details.StatusBar:Show (self)
4 years ago
end
end
3 years ago
function Details:IsGroupedWith (instance)
4 years ago
local id = instance:GetId()
3 years ago
for side, instanceId in pairs(self.snap) do
4 years ago
if (instanceId == id) then
return true
end
end
return false
end
3 years ago
function Details:GetInstanceGroup (instance_id)
4 years ago
local instance = self
3 years ago
4 years ago
if (instance_id) then
3 years ago
instance = Details:GetInstance(instance_id)
4 years ago
if (not instance or not instance:IsEnabled()) then
return
end
end
3 years ago
4 years ago
local current_group = {instance}
3 years ago
for side, insId in pairs(instance.snap) do
4 years ago
if (insId < instance:GetId()) then
local last_id = instance:GetId()
for i = insId, 1, -1 do
3 years ago
local this_instance = Details:GetInstance(i)
4 years ago
local got = false
if (this_instance and this_instance:IsEnabled()) then
3 years ago
for side, id in pairs(this_instance.snap) do
4 years ago
if (id == last_id) then
3 years ago
tinsert(current_group, this_instance)
4 years ago
got = true
last_id = i
end
end
end
if (not got) then
break
end
end
else
local last_id = instance:GetId()
3 years ago
for i = insId, Details.instances_amount do
local this_instance = Details:GetInstance(i)
4 years ago
local got = false
if (this_instance and this_instance:IsEnabled()) then
3 years ago
for side, id in pairs(this_instance.snap) do
4 years ago
if (id == last_id) then
3 years ago
tinsert(current_group, this_instance)
4 years ago
got = true
last_id = i
end
end
end
if (not got) then
break
end
end
end
end
3 years ago
4 years ago
return current_group
end
3 years ago
function Details:SetWindowScale(scale, fromOptions)
4 years ago
if (not scale) then
scale = self.window_scale
end
3 years ago
if (fromOptions) then
4 years ago
local group = self:GetInstanceGroup()
3 years ago
for _, instance in ipairs(group) do
4 years ago
instance.baseframe:SetScale(scale)
instance.rowframe:SetScale(scale)
instance.windowSwitchButton:SetScale(scale)
instance.windowBackgroundDisplay:SetScale(scale)
instance.window_scale = scale
end
else
self.window_scale = scale
self.baseframe:SetScale(scale)
self.rowframe:SetScale(scale)
self.windowSwitchButton:SetScale(scale)
self.windowBackgroundDisplay:SetScale(scale)
end
end
3 years ago
function Details:ToolbarSide (side, only_update_anchors)
4 years ago
if (not side) then
side = self.toolbar_side
end
3 years ago
4 years ago
self.toolbar_side = side
3 years ago
local skin = Details.skins [self.skin]
if (side == 1) then --top
4 years ago
local anchor_mod = not self.show_sidebars and skin.instance_cprops.show_sidebars_need_resize_by or 0
3 years ago
--icon (ball) point
4 years ago
self.baseframe.cabecalho.ball_point:ClearAllPoints()
3 years ago
local x, y = unpack(skin.icon_point_anchor)
4 years ago
x = x + (anchor_mod)
3 years ago
self.baseframe.cabecalho.ball_point:SetPoint("bottomleft", self.baseframe, "topleft", x, y)
--ball
4 years ago
if (self.hide_icon) then
3 years ago
self.baseframe.cabecalho.ball:SetTexCoord(unpack(COORDS_LEFT_BALL_NO_ICON))
self.baseframe.cabecalho.emenda:SetTexCoord(unpack(COORDS_LEFT_CONNECTOR_NO_ICON))
4 years ago
else
3 years ago
self.baseframe.cabecalho.ball:SetTexCoord(unpack(COORDS_LEFT_BALL))
self.baseframe.cabecalho.emenda:SetTexCoord(unpack(COORDS_LEFT_CONNECTOR))
4 years ago
end
3 years ago
4 years ago
self.baseframe.cabecalho.ball:ClearAllPoints()
3 years ago
local x, y = unpack(skin.left_corner_anchor)
4 years ago
x = x + (anchor_mod)
3 years ago
self.baseframe.cabecalho.ball:SetPoint("bottomleft", self.baseframe, "topleft", x, y)
4 years ago
3 years ago
--ball r
self.baseframe.cabecalho.ball_r:SetTexCoord(unpack(COORDS_RIGHT_BALL))
4 years ago
self.baseframe.cabecalho.ball_r:ClearAllPoints()
3 years ago
local x, y = unpack(skin.right_corner_anchor)
4 years ago
x = x + ((anchor_mod) * -1)
3 years ago
self.baseframe.cabecalho.ball_r:SetPoint("bottomright", self.baseframe, "topright", x, y)
--tex coords
self.baseframe.cabecalho.top_bg:SetTexCoord(unpack(COORDS_TOP_BACKGROUND))
4 years ago
3 years ago
--up frames
self.baseframe.UPFrame:SetPoint("left", self.baseframe.cabecalho.ball, "right", 0, -53)
self.baseframe.UPFrame:SetPoint("right", self.baseframe.cabecalho.ball_r, "left", 0, -53)
4 years ago
self.baseframe.UPFrameConnect:ClearAllPoints()
3 years ago
self.baseframe.UPFrameConnect:SetPoint("bottomleft", self.baseframe, "topleft", 0, -1)
self.baseframe.UPFrameConnect:SetPoint("bottomright", self.baseframe, "topright", 0, -1)
4 years ago
self.baseframe.UPFrameLeftPart:ClearAllPoints()
3 years ago
self.baseframe.UPFrameLeftPart:SetPoint("bottomleft", self.baseframe, "topleft", 0, 0)
else --bottom
4 years ago
local y = 0
if (self.show_statusbar) then
y = -14
end
3 years ago
4 years ago
local anchor_mod = not self.show_sidebars and skin.instance_cprops.show_sidebars_need_resize_by or 0
3 years ago
--ball point
4 years ago
self.baseframe.cabecalho.ball_point:ClearAllPoints()
3 years ago
local _x, _y = unpack(skin.icon_point_anchor_bottom)
4 years ago
_x = _x + (anchor_mod)
3 years ago
self.baseframe.cabecalho.ball_point:SetPoint("topleft", self.baseframe, "bottomleft", _x, _y + y)
--ball
4 years ago
self.baseframe.cabecalho.ball:ClearAllPoints()
3 years ago
local _x, _y = unpack(skin.left_corner_anchor_bottom)
4 years ago
_x = _x + (anchor_mod)
3 years ago
self.baseframe.cabecalho.ball:SetPoint("topleft", self.baseframe, "bottomleft", _x, _y + y)
local l, r, t, b = unpack(COORDS_LEFT_BALL)
self.baseframe.cabecalho.ball:SetTexCoord(l, r, b, t)
4 years ago
3 years ago
--ball r
4 years ago
self.baseframe.cabecalho.ball_r:ClearAllPoints()
3 years ago
local _x, _y = unpack(skin.right_corner_anchor_bottom)
4 years ago
_x = _x + ((anchor_mod) * -1)
3 years ago
self.baseframe.cabecalho.ball_r:SetPoint("topright", self.baseframe, "bottomright", _x, _y + y)
local l, r, t, b = unpack(COORDS_RIGHT_BALL)
self.baseframe.cabecalho.ball_r:SetTexCoord(l, r, b, t)
--tex coords
local l, r, t, b = unpack(COORDS_LEFT_CONNECTOR)
self.baseframe.cabecalho.emenda:SetTexCoord(l, r, b, t)
local l, r, t, b = unpack(COORDS_TOP_BACKGROUND)
self.baseframe.cabecalho.top_bg:SetTexCoord(l, r, b, t)
--up frames
self.baseframe.UPFrame:SetPoint("left", self.baseframe.cabecalho.ball, "right", 0, 53)
self.baseframe.UPFrame:SetPoint("right", self.baseframe.cabecalho.ball_r, "left", 0, 53)
4 years ago
self.baseframe.UPFrameConnect:ClearAllPoints()
3 years ago
self.baseframe.UPFrameConnect:SetPoint("topleft", self.baseframe, "bottomleft", 0, 1)
self.baseframe.UPFrameConnect:SetPoint("topright", self.baseframe, "bottomright", 0, 1)
4 years ago
self.baseframe.UPFrameLeftPart:ClearAllPoints()
3 years ago
self.baseframe.UPFrameLeftPart:SetPoint("topleft", self.baseframe, "bottomleft", 0, 0)
4 years ago
end
if (only_update_anchors) then
3 years ago
--ShowSideBars depends on this and creates a infinite loop
4 years ago
return
end
3 years ago
--update top menus
4 years ago
self:LeftMenuAnchorSide()
self:StretchButtonAnchor()
self:HideMainIcon() --attribute menu reseting value
3 years ago
4 years ago
if (self.show_sidebars) then
self:ShowSideBars()
end
3 years ago
4 years ago
self:AttributeMenu()
3 years ago
--update the grow direction to update the gap between the titlebar and the baseframe
4 years ago
self:SetBarGrowDirection()
end
3 years ago
function Details:StretchButtonAlwaysOnTop (on_top)
if (type(on_top) ~= "boolean") then
4 years ago
on_top = self.grab_on_top
end
3 years ago
4 years ago
self.grab_on_top = on_top
3 years ago
4 years ago
if (self.grab_on_top) then
3 years ago
self.baseframe.button_stretch:SetFrameStrata("FULLSCREEN")
4 years ago
else
3 years ago
self.baseframe.button_stretch:SetFrameStrata(self.strata)
4 years ago
end
end
3 years ago
function Details:StretchButtonAnchor (side)
4 years ago
if (not side) then
side = self.stretch_button_side
end
3 years ago
if (side == 1 or string.lower(side) == "top") then
4 years ago
self.baseframe.button_stretch:ClearAllPoints()
3 years ago
4 years ago
local y = 0
if (self.toolbar_side == 2) then --bottom
y = -20
end
3 years ago
self.baseframe.button_stretch:SetPoint("bottom", self.baseframe, "top", 0, 20 + y)
self.baseframe.button_stretch:SetPoint("right", self.baseframe, "right", -27, 0)
self.baseframe.button_stretch.texture:SetTexCoord(unpack(COORDS_STRETCH))
4 years ago
self.stretch_button_side = 1
3 years ago
elseif (side == 2 or string.lower(side) == "bottom") then
4 years ago
self.baseframe.button_stretch:ClearAllPoints()
3 years ago
4 years ago
local y = 0
if (self.toolbar_side == 2) then --bottom
y = y -20
end
if (self.show_statusbar) then
y = y -14
end
3 years ago
self.baseframe.button_stretch:SetPoint("center", self.baseframe, "center")
self.baseframe.button_stretch:SetPoint("top", self.baseframe, "bottom", 0, y)
local l, r, t, b = unpack(COORDS_STRETCH)
self.baseframe.button_stretch.texture:SetTexCoord(r, l, b, t)
4 years ago
self.stretch_button_side = 2
end
end
3 years ago
function Details:MenuAnchor (x, y)
4 years ago
if (self.toolbar_side == 1) then --top
if (not x) then
x = self.menu_anchor [1]
end
if (not y) then
y = self.menu_anchor [2]
end
self.menu_anchor [1] = x
self.menu_anchor [2] = y
3 years ago
4 years ago
elseif (self.toolbar_side == 2) then --bottom
if (not x) then
x = self.menu_anchor_down [1]
end
if (not y) then
y = self.menu_anchor_down [2]
end
self.menu_anchor_down [1] = x
self.menu_anchor_down [2] = y
end
3 years ago
4 years ago
local menu_points = self.menu_points -- = {MenuAnchorLeft, MenuAnchorRight}
3 years ago
if (self.menu_anchor.side == 1) then --left
4 years ago
menu_points [1]:ClearAllPoints()
3 years ago
if (self.toolbar_side == 1) then --top
menu_points [1]:SetPoint("bottomleft", self.baseframe.cabecalho.ball, "bottomright", x, y) -- y+2
else --bottom
menu_points [1]:SetPoint("topleft", self.baseframe.cabecalho.ball, "topright", x, (y*-1) - 4)
4 years ago
end
3 years ago
elseif (self.menu_anchor.side == 2) then --right
4 years ago
menu_points [2]:ClearAllPoints()
3 years ago
if (self.toolbar_side == 1) then --top
menu_points [2]:SetPoint("topleft", self.baseframe.cabecalho.ball_r, "bottomleft", x, y+16)
else --bottom
menu_points [2]:SetPoint("topleft", self.baseframe.cabecalho.ball_r, "topleft", x, (y*-1) - 4)
4 years ago
end
end
3 years ago
4 years ago
self:ToolbarMenuButtons()
end
3 years ago
function Details:HideMainIcon (value)
if (type(value) ~= "boolean") then
4 years ago
value = self.hide_icon
end
3 years ago
4 years ago
if (value) then
self.hide_icon = true
3 years ago
Details.FadeHandler.Fader(self.baseframe.cabecalho.atributo_icon, 1)
4 years ago
if (self.toolbar_side == 1) then
3 years ago
self.baseframe.cabecalho.ball:SetTexCoord(unpack(COORDS_LEFT_BALL_NO_ICON))
self.baseframe.cabecalho.emenda:SetTexCoord(unpack(COORDS_LEFT_CONNECTOR_NO_ICON))
4 years ago
elseif (self.toolbar_side == 2) then
3 years ago
local l, r, t, b = unpack(COORDS_LEFT_BALL_NO_ICON)
self.baseframe.cabecalho.ball:SetTexCoord(l, r, b, t)
local l, r, t, b = unpack(COORDS_LEFT_CONNECTOR_NO_ICON)
self.baseframe.cabecalho.emenda:SetTexCoord(l, r, b, t)
end
local skin = Details.skins [self.skin]
4 years ago
if (skin.icon_on_top) then
3 years ago
self.baseframe.cabecalho.atributo_icon:SetParent(self.floatingframe)
4 years ago
else
3 years ago
self.baseframe.cabecalho.atributo_icon:SetParent(self.baseframe)
4 years ago
end
3 years ago
4 years ago
else
self.hide_icon = false
3 years ago
Details.FadeHandler.Fader(self.baseframe.cabecalho.atributo_icon, 0)
4 years ago
if (self.toolbar_side == 1) then
3 years ago
self.baseframe.cabecalho.ball:SetTexCoord(unpack(COORDS_LEFT_BALL))
self.baseframe.cabecalho.emenda:SetTexCoord(unpack(COORDS_LEFT_CONNECTOR))
4 years ago
3 years ago
elseif (self.toolbar_side == 2) then
local l, r, t, b = unpack(COORDS_LEFT_BALL)
self.baseframe.cabecalho.ball:SetTexCoord(l, r, b, t)
local l, r, t, b = unpack(COORDS_LEFT_CONNECTOR)
self.baseframe.cabecalho.emenda:SetTexCoord(l, r, b, t)
4 years ago
end
end
end
3 years ago
--search key: ~desaturate
function Details:DesaturateMenu (value)
4 years ago
if (value == nil) then
value = self.desaturated_menu
end
if (value) then
self.desaturated_menu = true
3 years ago
self.baseframe.cabecalho.modo_selecao:GetNormalTexture():SetDesaturated(true)
self.baseframe.cabecalho.segmento:GetNormalTexture():SetDesaturated(true)
self.baseframe.cabecalho.atributo:GetNormalTexture():SetDesaturated(true)
self.baseframe.cabecalho.report:GetNormalTexture():SetDesaturated(true)
self.baseframe.cabecalho.reset:GetNormalTexture():SetDesaturated(true)
self.baseframe.cabecalho.fechar:GetNormalTexture():SetDesaturated(true)
4 years ago
3 years ago
if (self.meu_id == Details:GetLowerInstanceNumber()) then
for _, button in ipairs(Details.ToolBar.AllButtons) do
button:GetNormalTexture():SetDesaturated(true)
4 years ago
end
end
3 years ago
4 years ago
else
self.desaturated_menu = false
3 years ago
self.baseframe.cabecalho.modo_selecao:GetNormalTexture():SetDesaturated(false)
self.baseframe.cabecalho.segmento:GetNormalTexture():SetDesaturated(false)
self.baseframe.cabecalho.atributo:GetNormalTexture():SetDesaturated(false)
self.baseframe.cabecalho.report:GetNormalTexture():SetDesaturated(false)
self.baseframe.cabecalho.reset:GetNormalTexture():SetDesaturated(false)
self.baseframe.cabecalho.fechar:GetNormalTexture():SetDesaturated(false)
if (self.meu_id == Details:GetLowerInstanceNumber()) then
for _, button in ipairs(Details.ToolBar.AllButtons) do
button:GetNormalTexture():SetDesaturated(false)
4 years ago
end
end
end
end
3 years ago
function Details:ShowSideBars (instancia)
4 years ago
if (instancia) then
self = instancia
end
3 years ago
4 years ago
self.show_sidebars = true
3 years ago
4 years ago
self.baseframe.barra_esquerda:Show()
self.baseframe.barra_direita:Show()
3 years ago
--set default spacings
local this_skin = Details.skins [self.skin]
4 years ago
if (this_skin.instance_cprops and this_skin.instance_cprops.row_info and this_skin.instance_cprops.row_info.space) then
self.row_info.space.left = this_skin.instance_cprops.row_info.space.left
self.row_info.space.right = this_skin.instance_cprops.row_info.space.right
else
self.row_info.space.left = 3
self.row_info.space.right = -5
end
if (self.show_statusbar) then
3 years ago
self.baseframe.barra_esquerda:SetPoint("bottomleft", self.baseframe, "bottomleft", -56, -14)
self.baseframe.barra_direita:SetPoint("bottomright", self.baseframe, "bottomright", 56, -14)
4 years ago
if (self.toolbar_side == 2) then
self.baseframe.barra_fundo:Show()
3 years ago
local l, r, t, b = unpack(COORDS_BOTTOM_SIDE_BAR)
self.baseframe.barra_fundo:SetTexCoord(l, r, b, t)
4 years ago
self.baseframe.barra_fundo:ClearAllPoints()
3 years ago
self.baseframe.barra_fundo:SetPoint("bottomleft", self.baseframe, "topleft", 0, -6)
self.baseframe.barra_fundo:SetPoint("bottomright", self.baseframe, "topright", -1, -6)
4 years ago
else
self.baseframe.barra_fundo:Hide()
end
else
3 years ago
self.baseframe.barra_esquerda:SetPoint("bottomleft", self.baseframe, "bottomleft", -56, 0)
self.baseframe.barra_direita:SetPoint("bottomright", self.baseframe, "bottomright", 56, 0)
4 years ago
self.baseframe.barra_fundo:Show()
3 years ago
4 years ago
if (self.toolbar_side == 2) then --tooltbar on bottom
3 years ago
local l, r, t, b = unpack(COORDS_BOTTOM_SIDE_BAR)
self.baseframe.barra_fundo:SetTexCoord(l, r, b, t)
4 years ago
self.baseframe.barra_fundo:ClearAllPoints()
3 years ago
self.baseframe.barra_fundo:SetPoint("bottomleft", self.baseframe, "topleft", 0, -6)
self.baseframe.barra_fundo:SetPoint("bottomright", self.baseframe, "topright", -1, -6)
4 years ago
else --tooltbar on top
3 years ago
self.baseframe.barra_fundo:SetTexCoord(unpack(COORDS_BOTTOM_SIDE_BAR))
4 years ago
self.baseframe.barra_fundo:ClearAllPoints()
3 years ago
self.baseframe.barra_fundo:SetPoint("bottomleft", self.baseframe, "bottomleft", 0, -56)
self.baseframe.barra_fundo:SetPoint("bottomright", self.baseframe, "bottomright", -1, -56)
4 years ago
end
end
3 years ago
4 years ago
--self:SetBarGrowDirection()
--passando true - apenas atulizar as anchors
self:ToolbarSide (nil, true)
end
3 years ago
function Details:HideSideBars (instancia)
4 years ago
if (instancia) then
self = instancia
end
3 years ago
4 years ago
self.show_sidebars = false
3 years ago
local this_skin = Details.skins [self.skin]
4 years ago
local space_config = this_skin.instance_cprops and this_skin.instance_cprops.row_info and this_skin.instance_cprops.row_info.space
if (space_config) then
if (space_config.left_noborder) then
self.row_info.space.left = space_config.left_noborder
else
self.row_info.space.left = 0
end
3 years ago
4 years ago
if (space_config.right_noborder) then
self.row_info.space.right = space_config.right_noborder
else
self.row_info.space.right = 0
end
else
self.row_info.space.left = 0
self.row_info.space.right = 0
end
self.baseframe.barra_esquerda:Hide()
self.baseframe.barra_direita:Hide()
self.baseframe.barra_fundo:Hide()
3 years ago
4 years ago
--self:SetBarGrowDirection() --j� � chamado no toolbarside
--passando true - apenas atulizar as anchors
self:ToolbarSide (nil, true)
end
3 years ago
function Details:HideStatusBar (instancia)
4 years ago
if (instancia) then
self = instancia
end
3 years ago
4 years ago
self.show_statusbar = false
3 years ago
4 years ago
self.baseframe.rodape.esquerdo:Hide()
self.baseframe.rodape.direita:Hide()
self.baseframe.rodape.top_bg:Hide()
self.baseframe.rodape.StatusBarLeftAnchor:Hide()
self.baseframe.rodape.StatusBarCenterAnchor:Hide()
self.baseframe.DOWNFrame:Hide()
3 years ago
4 years ago
--debug
self.baseframe.rodape.direita_nostatusbar:Show()
self.baseframe.rodape.esquerdo_nostatusbar:Show()
--
3 years ago
4 years ago
if (self.toolbar_side == 2) then
self:ToolbarSide()
end
3 years ago
4 years ago
if (self.show_sidebars) then
self:ShowSideBars()
end
3 years ago
4 years ago
self:StretchButtonAnchor()
3 years ago
if (self.micro_displays_side == 2) then --bottom side
Details.StatusBar:Hide (self) --mini displays widgets
4 years ago
end
end
3 years ago
function Details:StatusBarColor(r, g, b, a, no_save)
4 years ago
if (not r) then
3 years ago
r, g, b = unpack(self.statusbar_info.overlay)
4 years ago
a = a or self.statusbar_info.alpha
end
if (not no_save) then
self.statusbar_info.overlay [1] = r
self.statusbar_info.overlay [2] = g
self.statusbar_info.overlay [3] = b
self.statusbar_info.alpha = a
end
3 years ago
self.baseframe.rodape.esquerdo:SetVertexColor(r, g, b)
self.baseframe.rodape.esquerdo:SetAlpha(a)
self.baseframe.rodape.direita:SetVertexColor(r, g, b)
self.baseframe.rodape.direita:SetAlpha(a)
self.baseframe.rodape.direita_nostatusbar:SetVertexColor(r, g, b)
self.baseframe.rodape.esquerdo_nostatusbar:SetVertexColor(r, g, b)
self.baseframe.rodape.direita_nostatusbar:SetAlpha(a)
self.baseframe.rodape.esquerdo_nostatusbar:SetAlpha(a)
self.baseframe.rodape.top_bg:SetVertexColor(r, g, b)
self.baseframe.rodape.top_bg:SetAlpha(a)
end
function Details:ShowStatusBar(instancia)
4 years ago
if (instancia) then
self = instancia
end
3 years ago
4 years ago
self.show_statusbar = true
3 years ago
4 years ago
self.baseframe.rodape.esquerdo:Show()
self.baseframe.rodape.direita:Show()
self.baseframe.rodape.top_bg:Show()
self.baseframe.rodape.StatusBarLeftAnchor:Show()
self.baseframe.rodape.StatusBarCenterAnchor:Show()
self.baseframe.DOWNFrame:Show()
3 years ago
4 years ago
--debug
--self.baseframe.rodape.direita_nostatusbar:Hide()
--self.baseframe.rodape.esquerdo_nostatusbar:Hide()
--
3 years ago
4 years ago
self:ToolbarSide()
self:StretchButtonAnchor()
3 years ago
if (self.micro_displays_side == 2) then --bottom side
Details.StatusBar:Show(self) --mini displays widgets
4 years ago
end
end
3 years ago
function Details:SetTooltipBackdrop(border_texture, border_size, border_color)
4 years ago
if (not border_texture) then
3 years ago
border_texture = Details.tooltip.border_texture
4 years ago
end
if (not border_size) then
3 years ago
border_size = Details.tooltip.border_size
4 years ago
end
if (not border_color) then
3 years ago
border_color = Details.tooltip.border_color
4 years ago
end
3 years ago
Details.tooltip.border_texture = border_texture
Details.tooltip.border_size = border_size
4 years ago
3 years ago
local c = Details.tooltip.border_color
local cc = Details.tooltip_border_color
4 years ago
c[1], c[2], c[3], c[4] = border_color[1], border_color[2], border_color[3], border_color[4] or 1
cc[1], cc[2], cc[3], cc[4] = border_color[1], border_color[2], border_color[3], border_color[4] or 1
3 years ago
Details.tooltip_backdrop.edgeFile = SharedMedia:Fetch("border", border_texture)
Details.tooltip_backdrop.edgeSize = border_size
4 years ago
end
3 years ago
--reset button functions
local reset_button_onenter = function(self, _, forced, from_click)
if (Details.instances_menu_click_to_open and not forced) then
4 years ago
return
end
local instancia = self._instance or self.widget._instance
local baseframe = instancia.baseframe
3 years ago
local gameCooltip = GameCooltip
OnEnterMainWindow(self.instance, self)
gameCooltip.buttonOver = true
4 years ago
self.instance.baseframe.cabecalho.button_mouse_over = true
3 years ago
4 years ago
if (self.instance.desaturated_menu) then
3 years ago
self:GetNormalTexture():SetDesaturated(false)
4 years ago
end
3 years ago
gameCooltip:Reset()
gameCooltip:SetType ("menu")
gameCooltip:SetOption("ButtonsYMod", -6)
gameCooltip:SetOption("HeighMod", 6)
gameCooltip:SetOption("YSpacingMod", -3)
gameCooltip:SetOption("TextHeightMod", 0)
gameCooltip:SetOption("IgnoreButtonAutoHeight", false)
Details:SetTooltipMinWidth()
gameCooltip:AddLine(Loc["STRING_ERASE_DATA_OVERALL"], nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus)
gameCooltip:AddIcon([[Interface\Buttons\UI-StopButton]], 1, 1, 14, 14, 0, 1, 0, 1, "orange")
gameCooltip:AddMenu(1, Details.tabela_historico.resetar_overall)
gameCooltip:AddLine("$div", nil, 1, nil, -5, -11)
gameCooltip:AddLine(Loc["STRING_ERASE_DATA"], nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus)
gameCooltip:AddIcon([[Interface\Buttons\UI-StopButton]], 1, 1, 14, 14, 0, 1, 0, 1, "red")
gameCooltip:AddMenu(1, Details.tabela_historico.resetar)
4 years ago
show_anti_overlap (self.instance, self, "top")
3 years ago
Details:SetMenuOwner (self, self.instance)
gameCooltip:ShowCooltip()
4 years ago
end
3 years ago
local reset_button_onleave = function(self)
OnLeaveMainWindow(self.instance, self)
4 years ago
if (self.instance.desaturated_menu) then
3 years ago
self:GetNormalTexture():SetDesaturated(true)
4 years ago
end
3 years ago
hide_anti_overlap(self.instance.baseframe.anti_menu_overlap)
4 years ago
GameCooltip.buttonOver = false
self.instance.baseframe.cabecalho.button_mouse_over = false
3 years ago
4 years ago
if (GameCooltip.active) then
parameters_table [2] = 0
3 years ago
self:SetScript("OnUpdate", on_leave_menu)
4 years ago
else
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
end
end
3 years ago
--close button functions
local close_button_onclick = function(self, button_type, button)
4 years ago
if (self and not self.instancia and button and button.instancia) then
self = button
end
3 years ago
4 years ago
self = self or button
3 years ago
4 years ago
self:Disable()
3 years ago
self.instancia:DesativarInstancia()
--n�o h� mais inst�ncias abertas, ent�o manda msg alertando
if (Details.opened_windows == 0) then
Details:Msg(Loc["STRING_CLOSEALL"])
end
--tutorial, how to fully delete a window
4 years ago
--_detalhes:SetTutorialCVar ("FULL_DELETE_WINDOW", false)
3 years ago
if (not Details:GetTutorialCVar("FULL_DELETE_WINDOW")) then
Details:SetTutorialCVar ("FULL_DELETE_WINDOW", true)
local panel = gump:Create1PxPanel(UIParent, 600, 100, "|cFFFFFFFFDetails!, the window hit the ground, bang bang...|r", nil, nil, nil, nil)
panel:SetBackdropColor(0, 0, 0, 0.9)
panel:SetPoint("center", UIParent, "center")
local s = panel:CreateFontString(nil, "overlay", "GameFontNormal")
s:SetPoint("center", panel, "center")
s:SetText(Loc["STRING_TUTORIAL_FULLY_DELETE_WINDOW"])
4 years ago
panel:Show()
end
3 years ago
4 years ago
GameCooltip:Hide()
end
3 years ago
Details.close_instancia_func = close_button_onclick
4 years ago
3 years ago
local close_button_onenter = function(self)
OnEnterMainWindow(self.instance, self, 3)
4 years ago
if (self.instance.desaturated_menu) then
3 years ago
self:GetNormalTexture():SetDesaturated(false)
4 years ago
end
3 years ago
4 years ago
local GameCooltip = GameCooltip
3 years ago
4 years ago
GameCooltip.buttonOver = true
self.instance.baseframe.cabecalho.button_mouse_over = true
3 years ago
4 years ago
GameCooltip:Reset()
GameCooltip:SetType ("menu")
3 years ago
GameCooltip:SetOption("ButtonsYMod", -7)
GameCooltip:SetOption("ButtonsYModSub", -2)
GameCooltip:SetOption("YSpacingMod", 0)
GameCooltip:SetOption("YSpacingModSub", -3)
GameCooltip:SetOption("TextHeightMod", 0)
GameCooltip:SetOption("TextHeightModSub", 0)
GameCooltip:SetOption("IgnoreButtonAutoHeight", false)
GameCooltip:SetOption("IgnoreButtonAutoHeightSub", false)
GameCooltip:SetOption("SubMenuIsTooltip", true)
GameCooltip:SetOption("FixedWidthSub", 180)
--GameCooltip:SetOption("FixedHeight", 30)
GameCooltip:SetOption("HeighMod", 9)
local font = SharedMedia:Fetch("font", "Friz Quadrata TT")
GameCooltip:AddLine(Loc["STRING_MENU_CLOSE_INSTANCE"], nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus)
GameCooltip:AddIcon([[Interface\Buttons\UI-Panel-MinimizeButton-Up]], 1, 1, 14, 14, 0.2, 0.8, 0.2, 0.8)
GameCooltip:AddMenu(1, close_button_onclick, self)
GameCooltip:AddLine(Loc["STRING_MENU_CLOSE_INSTANCE_DESC"], nil, 2, "white", nil, Details.font_sizes.menus, Details.font_faces.menus)
GameCooltip:AddIcon([[Interface\CHATFRAME\UI-ChatIcon-Minimize-Up]], 2, 1, 18, 18)
GameCooltip:AddLine(Loc["STRING_MENU_CLOSE_INSTANCE_DESC2"], nil, 2, "white", nil, Details.font_sizes.menus, Details.font_faces.menus)
GameCooltip:AddIcon([[Interface\PaperDollInfoFrame\UI-GearManager-LeaveItem-Transparent]], 2, 1, 18, 18)
GameCooltip:SetWallpaper (1, Details.tooltip.menus_bg_texture, Details.tooltip.menus_bg_coords, Details.tooltip.menus_bg_color, true)
GameCooltip:SetWallpaper (2, Details.tooltip.menus_bg_texture, Details.tooltip.menus_bg_coords, Details.tooltip.menus_bg_color, true)
GameCooltip:SetBackdrop(1, menus_backdrop, nil, menus_bordercolor)
GameCooltip:SetBackdrop(2, menus_backdrop, nil, menus_bordercolor)
4 years ago
show_anti_overlap (self.instance, self, "top")
3 years ago
Details:SetMenuOwner (self, self.instance)
4 years ago
GameCooltip:ShowCooltip()
end
3 years ago
local close_button_onleave = function(self)
OnLeaveMainWindow(self.instance, self, 3)
4 years ago
if (self.instance.desaturated_menu) then
3 years ago
self:GetNormalTexture():SetDesaturated(true)
4 years ago
end
3 years ago
4 years ago
hide_anti_overlap (self.instance.baseframe.anti_menu_overlap)
3 years ago
4 years ago
GameCooltip.buttonOver = false
self.instance.baseframe.cabecalho.button_mouse_over = false
3 years ago
4 years ago
if (GameCooltip.active) then
parameters_table [2] = 0
3 years ago
self:SetScript("OnUpdate", on_leave_menu)
4 years ago
else
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
end
end
3 years ago
4 years ago
------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--build upper menu bar
4 years ago
local menu_can_open = function()
if (GameCooltip.active) then
local owner = GameCooltip:GetOwner()
3 years ago
if (owner and owner:GetScript("OnUpdate") == on_leave_menu) then
owner:SetScript("OnUpdate", nil)
4 years ago
end
return true
end
end
3 years ago
local report_on_enter = function(self, motion, forced, from_click)
4 years ago
local is_cooltip_opened = menu_can_open() -- and not is_cooltip_opened
3 years ago
if (Details.instances_menu_click_to_open and not forced) then
4 years ago
return
end
local instancia = self._instance or self.widget._instance
local baseframe = instancia.baseframe
3 years ago
OnEnterMainWindow(instancia, self, 3)
4 years ago
if (instancia.desaturated_menu) then
3 years ago
self:GetNormalTexture():SetDesaturated(false)
4 years ago
end
3 years ago
4 years ago
GameCooltip.buttonOver = true
baseframe.cabecalho.button_mouse_over = true
3 years ago
4 years ago
GameCooltip:Reset()
3 years ago
4 years ago
GameCooltip:SetType ("menu")
3 years ago
GameCooltip:SetOption("ButtonsYMod", -6)
GameCooltip:SetOption("HeighMod", 6)
GameCooltip:SetOption("YSpacingMod", -1)
GameCooltip:SetOption("TextHeightMod", 0)
GameCooltip:SetOption("IgnoreButtonAutoHeight", false)
Details:SetTooltipMinWidth()
Details:CheckLastReportsIntegrity()
local last_reports = Details.latest_report_table
4 years ago
if (#last_reports > 0) then
local amountReports = #last_reports
amountReports = math.min (amountReports, 10)
3 years ago
4 years ago
for index = amountReports, 1, -1 do
local report = last_reports [index]
3 years ago
local instance_number, attribute, subattribute, amt, report_where, custom_name = unpack(report)
local name = Details:GetSubAttributeName (attribute, subattribute, custom_name)
local artwork = Details.GetReportIconAndColor (report_where)
GameCooltip:AddLine(name .. " (#" .. amt .. ")", nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus)
4 years ago
if (artwork) then
3 years ago
GameCooltip:AddIcon(artwork.icon, 1, 1, 14, 14, artwork.coords[1], artwork.coords[2], artwork.coords[3], artwork.coords[4], artwork.color, nil, false)
4 years ago
end
3 years ago
GameCooltip:AddMenu(1, Details.ReportFromLatest, index)
4 years ago
end
3 years ago
GameCooltip:AddLine("$div", nil, nil, -4)
4 years ago
end
3 years ago
GameCooltip:AddLine(Loc["STRING_REPORT_TOOLTIP"], nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus)
GameCooltip:AddIcon([[Interface\Addons\Details\Images\report_button]], 1, 1, 12, 19)
GameCooltip:AddMenu(1, Details.Reportar, instancia, nil, "INSTANCE" .. instancia.meu_id)
4 years ago
show_anti_overlap (instancia, self, "top")
3 years ago
Details:SetMenuOwner (self, instancia)
4 years ago
GameCooltip:ShowCooltip()
end
3 years ago
local report_on_leave = function(self, motion, forced, from_click)
4 years ago
local instancia = self._instance or self.widget._instance
local baseframe = instancia.baseframe
3 years ago
OnLeaveMainWindow(instancia, self, 3)
hide_anti_overlap(instancia.baseframe.anti_menu_overlap)
4 years ago
GameCooltip.buttonOver = false
baseframe.cabecalho.button_mouse_over = false
3 years ago
4 years ago
if (instancia.desaturated_menu) then
3 years ago
self:GetNormalTexture():SetDesaturated(true)
4 years ago
end
3 years ago
4 years ago
if (GameCooltip.active) then
parameters_table [2] = from_click and 1 or 0
3 years ago
self:SetScript("OnUpdate", on_leave_menu)
4 years ago
else
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
end
end
3 years ago
local atributo_on_enter = function(self, motion, forced, from_click)
4 years ago
local is_cooltip_opened = menu_can_open() -- and not is_cooltip_opened
3 years ago
if (Details.instances_menu_click_to_open and not forced) then
4 years ago
return
end
local instancia = self._instance or self.widget._instance
local baseframe = instancia.baseframe
3 years ago
OnEnterMainWindow(instancia, self, 3)
4 years ago
if (instancia.desaturated_menu) then
3 years ago
self:GetNormalTexture():SetDesaturated(false)
end
4 years ago
GameCooltip.buttonOver = true
baseframe.cabecalho.button_mouse_over = true
3 years ago
4 years ago
show_anti_overlap (instancia, self, "top")
GameCooltip:Reset()
GameCooltip:SetType (3)
3 years ago
GameCooltip:SetFixedParameter(instancia)
if (Details.solo and Details.solo == instancia.meu_id) then
Details:MontaSoloOption(instancia)
4 years ago
elseif (instancia:IsRaidMode()) then
3 years ago
local have_plugins = Details:MontaRaidOption(instancia)
4 years ago
if (not have_plugins) then
GameCooltip:SetType ("tooltip")
3 years ago
GameCooltip:SetOption("ButtonsYMod", 0)
GameCooltip:SetOption("TextHeightMod", 0)
GameCooltip:SetOption("IgnoreButtonAutoHeight", false)
GameCooltip:AddLine("All raid plugins already\nin use or disabled.", nil, 1, "white", nil, 10, SharedMedia:Fetch("font", "Friz Quadrata TT"))
GameCooltip:AddIcon([[Interface\GROUPFRAME\UI-GROUP-ASSISTANTICON]], 1, 1)
GameCooltip:SetWallpaper (1, Details.tooltip.menus_bg_texture, Details.tooltip.menus_bg_coords, Details.tooltip.menus_bg_color, true)
end
4 years ago
else
3 years ago
Details:MontaAtributosOption (instancia)
GameCooltip:SetOption("YSpacingMod", -1)
GameCooltip:SetOption("YSpacingModSub", -2)
end
GameCooltip:SetOption("TextSize", Details.font_sizes.menus)
Details:SetMenuOwner (self, instancia)
GameCooltip:ShowCooltip()
end
local atributo_on_leave = function(self, motion, forced, from_click)
4 years ago
local instancia = self._instance or self.widget._instance
local baseframe = instancia.baseframe
3 years ago
OnLeaveMainWindow(instancia, self, 3)
4 years ago
hide_anti_overlap (instancia.baseframe.anti_menu_overlap)
3 years ago
4 years ago
if (instancia.desaturated_menu) then
3 years ago
self:GetNormalTexture():SetDesaturated(true)
4 years ago
end
3 years ago
4 years ago
GameCooltip.buttonOver = false
baseframe.cabecalho.button_mouse_over = false
3 years ago
4 years ago
if (GameCooltip.active) then
parameters_table [2] = 0
3 years ago
self:SetScript("OnUpdate", on_leave_menu)
4 years ago
else
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
end
end
3 years ago
local segmentButton_OnEnter = function(self, motion, forced, fromClick)
if (Details.instances_menu_click_to_open and not forced) then
4 years ago
return
end
3 years ago
local instance = self._instance or self.widget._instance
local baseframe = instance.baseframe
OnEnterMainWindow(instance, self)
if (instance.desaturated_menu) then
self:GetNormalTexture():SetDesaturated(false)
4 years ago
end
3 years ago
4 years ago
GameCooltip.buttonOver = true
baseframe.cabecalho.button_mouse_over = true
3 years ago
local timeToOpen = 0
4 years ago
if (_G.GameCooltip.active) then
3 years ago
timeToOpen = 0.15
4 years ago
end
3 years ago
parameters_table[1] = instance
parameters_table[2] = fromClick and 1 or timeToOpen
self:SetScript("OnUpdate", buildSegmentTooltip)
4 years ago
end
3 years ago
local segmentButton_OnLeave = function(self, motion, forced, fromClick)
local instance = self._instance or self.widget._instance
local baseframe = instance.baseframe
4 years ago
3 years ago
OnLeaveMainWindow(instance, self)
hide_anti_overlap(instance.baseframe.anti_menu_overlap)
if (instance.desaturated_menu) then
self:GetNormalTexture():SetDesaturated(true)
4 years ago
end
3 years ago
4 years ago
GameCooltip.buttonOver = false
baseframe.cabecalho.button_mouse_over = false
3 years ago
4 years ago
if (GameCooltip.active) then
3 years ago
parameters_table[2] = 0
self:SetScript("OnUpdate", on_leave_menu)
4 years ago
else
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
end
end
3 years ago
local modo_selecao_on_enter = function(self, motion, forced, from_click)
4 years ago
local is_cooltip_opened = menu_can_open() -- not is_cooltip_opened
3 years ago
if (Details.instances_menu_click_to_open and not forced) then
4 years ago
return
end
local instancia = self._instance or self.widget._instance
local baseframe = instancia.baseframe
3 years ago
OnEnterMainWindow(instancia, self, 3)
4 years ago
if (instancia.desaturated_menu) then
3 years ago
self:GetNormalTexture():SetDesaturated(false)
4 years ago
end
3 years ago
4 years ago
GameCooltip.buttonOver = true
baseframe.cabecalho.button_mouse_over = true
3 years ago
4 years ago
local passou = 0
if (_G.GameCooltip.active) then
passou = 0.15
end
local checked
if (instancia.modo == 1) then
checked = 4
elseif (instancia.modo == 2) then
checked = 1
elseif (instancia.modo == 3) then
checked = 2
elseif (instancia.modo == 4) then
checked = 3
end
parameters_table [1] = instancia
parameters_table [2] = from_click and 1 or passou
parameters_table [3] = checked
3 years ago
self:SetScript("OnUpdate", build_mode_list)
end
4 years ago
3 years ago
local modo_selecao_on_leave = function(self)
4 years ago
local instancia = self._instance or self.widget._instance
local baseframe = instancia.baseframe
3 years ago
OnLeaveMainWindow(instancia, self, 3)
4 years ago
hide_anti_overlap (instancia.baseframe.anti_menu_overlap)
3 years ago
4 years ago
if (instancia.desaturated_menu) then
3 years ago
self:GetNormalTexture():SetDesaturated(true)
4 years ago
end
3 years ago
4 years ago
GameCooltip.buttonOver = false
baseframe.cabecalho.button_mouse_over = false
3 years ago
4 years ago
if (GameCooltip.active) then
parameters_table [2] = 0
3 years ago
self:SetScript("OnUpdate", on_leave_menu)
4 years ago
else
3 years ago
self:SetScript("OnUpdate", nil)
4 years ago
end
end
3 years ago
-- these can
4 years ago
local title_bar_icons = {
{texture = [[Interface\AddOns\Details\images\toolbar_icons]], texcoord = {0/256, 32/256, 0, 1}},
{texture = [[Interface\AddOns\Details\images\toolbar_icons]], texcoord = {32/256, 64/256, 0, 1}},
{texture = [[Interface\AddOns\Details\images\toolbar_icons]], texcoord = {66/256, 93/256, 0, 1}},
{texture = [[Interface\AddOns\Details\images\toolbar_icons]], texcoord = {96/256, 128/256, 0, 1}},
{texture = [[Interface\AddOns\Details\images\toolbar_icons]], texcoord = {128/256, 160/256, 0, 1}},
}
3 years ago
function Details:GetTitleBarIconsTexture(button, instance)
4 years ago
if (instance or self.meu_id) then
local textureFile = self.toolbar_icon_file or instance.toolbar_icon_file
local t = title_bar_icons [button]
if (t and textureFile) then
t.texture = textureFile
end
return t or title_bar_icons
end
return title_bar_icons [button] or title_bar_icons
end
3 years ago
function Details:CreateFakeWindow()
local t = CreateFrame("frame")
t:SetSize(200, 91)
t:SetBackdrop({bgFile = "Interface\\AddOns\\Details\\images\\background", tile = true, tileSize = 16 })
t:SetBackdropColor(0.0941, 0.0941, 0.0941, 0.3)
local tb = CreateFrame("frame", nil, t)
tb:SetPoint("bottomleft", t, "topleft", 0, 0)
tb:SetPoint("bottomright", t, "topright", 0, 0)
tb:SetHeight(16)
tb:SetBackdrop({bgFile = "Interface\\AddOns\\Details\\images\\background", tile = true, tileSize = 16 })
tb:SetBackdropColor(0.7, 0.7, 0.7, 0.4)
local tt = tb:CreateFontString(nil, "overlay", "GameFontNormal")
Details:SetFontColor(tt, "white")
Details:SetFontSize(tt, 10)
Details:SetFontFace(tt, LibStub:GetLibrary("LibSharedMedia-3.0"):Fetch("font", "Accidental Presidency"))
tt:SetPoint("bottomleft", tb, 3, 4)
tt:SetText("Damage Done")
4 years ago
t.TitleIcons = {}
for i = 1, 5 do
3 years ago
local b = tb:CreateTexture(nil, "overlay")
b:SetSize(12, 12)
b:SetPoint("bottomright", tb, "bottomright", -((abs(i-6)-1)*11) - 1, 2)
local button_texture_texcoord = Details:GetTitleBarIconsTexture(i)
b:SetTexture(button_texture_texcoord.texture)
b:SetTexCoord(unpack(button_texture_texcoord.texcoord))
tinsert(t.TitleIcons, b)
end
4 years ago
t.TitleBar = tb
t.TitleText = tt
3 years ago
4 years ago
return t
end
local function click_to_change_segment (instancia, buttontype)
if (buttontype == "LeftButton") then
3 years ago
4 years ago
local segmento_goal = instancia.segmento + 1
if (segmento_goal > segments_used) then
segmento_goal = -1
3 years ago
elseif (segmento_goal > Details.segments_amount) then
4 years ago
segmento_goal = -1
end
3 years ago
4 years ago
local total_shown = segments_filled+2
local goal = segmento_goal+1
3 years ago
local select_ = math.abs(goal - total_shown)
GameCooltip:Select(1, select_)
instancia:TrocaTabela(segmento_goal)
segmentButton_OnEnter (instancia.baseframe.cabecalho.segmento.widget, _, true, true)
4 years ago
elseif (buttontype == "RightButton") then
3 years ago
4 years ago
local segmento_goal = instancia.segmento - 1
if (segmento_goal < -1) then
segmento_goal = segments_used
end
3 years ago
4 years ago
local total_shown = segments_filled+2
local goal = segmento_goal+1
3 years ago
local select_ = math.abs(goal - total_shown)
GameCooltip:Select(1, select_)
instancia:TrocaTabela(segmento_goal)
segmentButton_OnEnter (instancia.baseframe.cabecalho.segmento.widget, _, true, true)
4 years ago
elseif (buttontype == "MiddleButton") then
3 years ago
4 years ago
local segmento_goal = 0
3 years ago
4 years ago
local total_shown = segments_filled+2
local goal = segmento_goal+1
3 years ago
local select_ = math.abs(goal - total_shown)
GameCooltip:Select(1, select_)
instancia:TrocaTabela(segmento_goal)
segmentButton_OnEnter (instancia.baseframe.cabecalho.segmento.widget, _, true, true)
4 years ago
end
end
function gump:CriaCabecalho (baseframe, instancia)
baseframe.cabecalho = {}
3 years ago
--FECHAR INSTANCIA ----------------------------------------------------------------------------------------------------------------------------------------------------
baseframe.cabecalho.fechar = CreateFrame("button", "DetailsCloseInstanceButton" .. instancia.meu_id, baseframe) --, "UIPanelCloseButton"
baseframe.cabecalho.fechar:SetWidth(18)
baseframe.cabecalho.fechar:SetHeight(18)
baseframe.cabecalho.fechar:SetFrameLevel(5) --altura mais alta que os demais frames
baseframe.cabecalho.fechar:SetPoint("bottomright", baseframe, "topright", 5, -6) --seta o ponto dele fixando no base frame
baseframe.cabecalho.fechar:SetNormalTexture([[Interface\AddOns\Details\images\toolbar_icons]])
baseframe.cabecalho.fechar:GetNormalTexture():SetTexCoord(160/256, 192/256, 0, 1)
baseframe.cabecalho.fechar:SetHighlightTexture([[Interface\AddOns\Details\images\toolbar_icons]])
baseframe.cabecalho.fechar:GetHighlightTexture():SetTexCoord(160/256, 192/256, 0, 1)
baseframe.cabecalho.fechar:SetPushedTexture([[Interface\AddOns\Details\images\toolbar_icons]])
baseframe.cabecalho.fechar:GetPushedTexture():SetTexCoord(160/256, 192/256, 0, 1)
--baseframe.cabecalho.fechar:SetNormalTexture([[Interface\Buttons\UI-Panel-MinimizeButton-Up]])
--baseframe.cabecalho.fechar:SetHighlightTexture([[Interface\Buttons\UI-Panel-MinimizeButton-Highlight]])
--baseframe.cabecalho.fechar:SetPushedTexture([[Interface\Buttons\UI-Panel-MinimizeButton-Down]])
4 years ago
baseframe.cabecalho.fechar.instancia = instancia
baseframe.cabecalho.fechar.instance = instancia
3 years ago
baseframe.cabecalho.fechar:SetScript("OnEnter", close_button_onenter)
baseframe.cabecalho.fechar:SetScript("OnLeave", close_button_onleave)
baseframe.cabecalho.fechar:SetScript("OnClick", close_button_onclick)
--bola do canto esquedo superior --primeiro criar a arma��o para apoiar as texturas
baseframe.cabecalho.ball_point = instancia.floatingframe:CreateTexture(nil, "overlay")
baseframe.cabecalho.ball_point:SetPoint("bottomleft", baseframe, "topleft", -37, 0)
baseframe.cabecalho.ball_point:SetWidth(64)
baseframe.cabecalho.ball_point:SetHeight(32)
--icone do atributo
--baseframe.cabecalho.atributo_icon = _detalhes.listener:CreateTexture(nil, "artwork")
baseframe.cabecalho.atributo_icon = baseframe:CreateTexture("DetailsAttributeIcon" .. instancia.meu_id, "background")
local icon_anchor = Details.skins ["WoW Interface"].icon_anchor_main
baseframe.cabecalho.atributo_icon:SetPoint("topright", baseframe.cabecalho.ball_point, "topright", icon_anchor[1], icon_anchor[2])
baseframe.cabecalho.atributo_icon:SetTexture(DEFAULT_SKIN)
baseframe.cabecalho.atributo_icon:SetWidth(32)
baseframe.cabecalho.atributo_icon:SetHeight(32)
--bola overlay
--baseframe.cabecalho.ball = _detalhes.listener:CreateTexture(nil, "overlay")
baseframe.cabecalho.ball = baseframe:CreateTexture(nil, "overlay")
baseframe.cabecalho.ball:SetPoint("bottomleft", baseframe, "topleft", -107, 0)
baseframe.cabecalho.ball:SetWidth(128)
baseframe.cabecalho.ball:SetHeight(128)
baseframe.cabecalho.ball:SetTexture(DEFAULT_SKIN)
baseframe.cabecalho.ball:SetTexCoord(unpack(COORDS_LEFT_BALL))
--emenda
baseframe.cabecalho.emenda = baseframe:CreateTexture(nil, "background")
baseframe.cabecalho.emenda:SetPoint("bottomleft", baseframe.cabecalho.ball, "bottomright")
baseframe.cabecalho.emenda:SetWidth(8)
baseframe.cabecalho.emenda:SetHeight(128)
baseframe.cabecalho.emenda:SetTexture(DEFAULT_SKIN)
baseframe.cabecalho.emenda:SetTexCoord(unpack(COORDS_LEFT_CONNECTOR))
4 years ago
baseframe.cabecalho.atributo_icon:Hide()
baseframe.cabecalho.ball:Hide()
3 years ago
--bola do canto direito superior
baseframe.cabecalho.ball_r = baseframe:CreateTexture(nil, "background")
baseframe.cabecalho.ball_r:SetPoint("bottomright", baseframe, "topright", 96, 0)
baseframe.cabecalho.ball_r:SetWidth(128)
baseframe.cabecalho.ball_r:SetHeight(128)
baseframe.cabecalho.ball_r:SetTexture(DEFAULT_SKIN)
baseframe.cabecalho.ball_r:SetTexCoord(unpack(COORDS_RIGHT_BALL))
--barra centro
baseframe.cabecalho.top_bg = baseframe:CreateTexture(nil, "background")
baseframe.cabecalho.top_bg:SetPoint("left", baseframe.cabecalho.emenda, "right", 0, 0)
baseframe.cabecalho.top_bg:SetPoint("right", baseframe.cabecalho.ball_r, "left")
baseframe.cabecalho.top_bg:SetTexture(DEFAULT_SKIN)
baseframe.cabecalho.top_bg:SetTexCoord(unpack(COORDS_TOP_BACKGROUND))
baseframe.cabecalho.top_bg:SetWidth(512)
baseframe.cabecalho.top_bg:SetHeight(128)
--frame invis�vel
baseframe.UPFrame = CreateFrame("frame", "DetailsUpFrameInstance"..instancia.meu_id, baseframe)
baseframe.UPFrame:SetPoint("left", baseframe.cabecalho.ball, "right", 0, -53)
baseframe.UPFrame:SetPoint("right", baseframe.cabecalho.ball_r, "left", 0, -53)
baseframe.UPFrame:SetHeight(20)
4 years ago
baseframe.UPFrame.is_toolbar = true
3 years ago
4 years ago
baseframe.UPFrame:Show()
3 years ago
baseframe.UPFrame:EnableMouse(true)
baseframe.UPFrame:SetMovable(true)
baseframe.UPFrame:SetResizable(true)
BGFrame_scripts(baseframe.UPFrame, baseframe, instancia)
--corrige o v�o entre o baseframe e o upframe
baseframe.UPFrameConnect = CreateFrame("frame", "DetailsAntiGap"..instancia.meu_id, baseframe)
baseframe.UPFrameConnect:SetPoint("bottomleft", baseframe, "topleft", 0, -1)
baseframe.UPFrameConnect:SetPoint("bottomright", baseframe, "topright", 0, -1)
baseframe.UPFrameConnect:SetHeight(2)
baseframe.UPFrameConnect:EnableMouse(true)
baseframe.UPFrameConnect:SetMovable(true)
baseframe.UPFrameConnect:SetResizable(true)
4 years ago
baseframe.UPFrameConnect.is_toolbar = true
3 years ago
BGFrame_scripts(baseframe.UPFrameConnect, baseframe, instancia)
baseframe.UPFrameLeftPart = CreateFrame("frame", "DetailsUpFrameLeftPart"..instancia.meu_id, baseframe)
baseframe.UPFrameLeftPart:SetPoint("bottomleft", baseframe, "topleft", 0, 0)
baseframe.UPFrameLeftPart:SetSize(22, 20)
baseframe.UPFrameLeftPart:EnableMouse(true)
baseframe.UPFrameLeftPart:SetMovable(true)
baseframe.UPFrameLeftPart:SetResizable(true)
4 years ago
baseframe.UPFrameLeftPart.is_toolbar = true
3 years ago
BGFrame_scripts(baseframe.UPFrameLeftPart, baseframe, instancia)
--anchors para os micro displays no lado de cima da janela
local StatusBarLeftAnchor = CreateFrame("frame", "DetailsStatusBarLeftAnchor" .. instancia.meu_id, baseframe)
StatusBarLeftAnchor:SetPoint("bottomleft", baseframe, "topleft", 0, 9)
StatusBarLeftAnchor:SetWidth(1)
StatusBarLeftAnchor:SetHeight(1)
4 years ago
baseframe.cabecalho.StatusBarLeftAnchor = StatusBarLeftAnchor
3 years ago
local StatusBarCenterAnchor = CreateFrame("frame", "DetailsStatusBarCenterAnchor" .. instancia.meu_id, baseframe)
StatusBarCenterAnchor:SetPoint("center", baseframe, "center")
StatusBarCenterAnchor:SetPoint("bottom", baseframe, "top", 0, 9)
StatusBarCenterAnchor:SetWidth(1)
StatusBarCenterAnchor:SetHeight(1)
baseframe.cabecalho.StatusBarCenterAnchor = StatusBarCenterAnchor
local StatusBarRightAnchor = CreateFrame("frame", "DetailsStatusBarRightAnchor" .. instancia.meu_id, baseframe)
StatusBarRightAnchor:SetPoint("bottomright", baseframe, "topright", 0, 9)
StatusBarRightAnchor:SetWidth(1)
StatusBarRightAnchor:SetHeight(1)
4 years ago
baseframe.cabecalho.StatusBarRightAnchor = StatusBarRightAnchor
3 years ago
local MenuAnchorLeft = CreateFrame("frame", "DetailsMenuAnchorLeft"..instancia.meu_id, baseframe)
MenuAnchorLeft:SetSize(1, 1)
local MenuAnchorRight = CreateFrame("frame", "DetailsMenuAnchorRight"..instancia.meu_id, baseframe)
MenuAnchorRight:SetSize(1, 1)
local Menu2AnchorRight = CreateFrame("frame", "DetailsMenu2AnchorRight"..instancia.meu_id, baseframe)
Menu2AnchorRight:SetSize(1, 1)
4 years ago
instancia.menu_points = {MenuAnchorLeft, MenuAnchorRight}
instancia.menu2_points = {Menu2AnchorRight}
3 years ago
-- bot�es
-------------------------------------------------------------------------------------------------------------------------------------------------
4 years ago
local CoolTip = _G.GameCooltip
3 years ago
--SELE��O DO MODO ----------------------------------------------------------------------------------------------------------------------------------------------------
4 years ago
local modo_selecao_button_click = function()
3 years ago
if (Details.instances_menu_click_to_open) then
4 years ago
if (instancia.LastMenuOpened == "mode" and GameCooltipFrame1:IsShown()) then
3 years ago
GameCooltip:ShowMe(false)
4 years ago
instancia.LastMenuOpened = nil
3 years ago
else
4 years ago
modo_selecao_on_enter (instancia.baseframe.cabecalho.modo_selecao.widget, _, true, true)
instancia.LastMenuOpened = "mode"
end
else
3 years ago
Details:OpenOptionsWindow (instancia)
4 years ago
end
end
3 years ago
baseframe.cabecalho.modo_selecao = gump:NewButton(baseframe, nil, "DetailsModeButton"..instancia.meu_id, nil, 16, 16, modo_selecao_button_click, nil, nil, [[Interface\AddOns\Details\images\modo_icone]])
baseframe.cabecalho.modo_selecao:SetPoint("bottomleft", baseframe.cabecalho.ball, "bottomright", instancia.menu_anchor [1], instancia.menu_anchor [2])
baseframe.cabecalho.modo_selecao:SetFrameLevel(baseframe:GetFrameLevel()+5)
4 years ago
baseframe.cabecalho.modo_selecao.widget._instance = instancia
3 years ago
baseframe.cabecalho.modo_selecao:SetScript("OnEnter", modo_selecao_on_enter)
baseframe.cabecalho.modo_selecao:SetScript("OnLeave", modo_selecao_on_leave)
4 years ago
local b = baseframe.cabecalho.modo_selecao.widget
3 years ago
b:SetNormalTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetNormalTexture():SetTexCoord(0/256, 32/256, 0, 1)
b:SetHighlightTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetHighlightTexture():SetTexCoord(0/256, 32/256, 0, 1)
b:SetPushedTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetPushedTexture():SetTexCoord(0/256, 32/256, 0, 1)
--SELECIONAR O SEGMENTO ----------------------------------------------------------------------------------------------------------------------------------------------------
local segmento_button_click = function(self, button, param1)
if (Details.instances_menu_click_to_open) then
4 years ago
if (instancia.LastMenuOpened == "segments" and GameCooltipFrame1:IsShown()) then
3 years ago
GameCooltip:ShowMe(false)
4 years ago
instancia.LastMenuOpened = nil
else
3 years ago
segmentButton_OnEnter (instancia.baseframe.cabecalho.segmento.widget, _, true, true)
4 years ago
instancia.LastMenuOpened = "segments"
end
else
click_to_change_segment (instancia, button)
end
end
3 years ago
baseframe.cabecalho.segmento = gump:NewButton(baseframe, nil, "DetailsSegmentButton"..instancia.meu_id, nil, 16, 16, segmento_button_click, nil, nil, [[Interface\AddOns\Details\images\segmentos_icone]])
baseframe.cabecalho.segmento:SetFrameLevel(baseframe.UPFrame:GetFrameLevel()+1)
4 years ago
baseframe.cabecalho.segmento.widget._instance = instancia
3 years ago
baseframe.cabecalho.segmento:SetPoint("left", baseframe.cabecalho.modo_selecao, "right", 0, 0)
--ativa bot�o do meio e direito
baseframe.cabecalho.segmento:SetClickFunction(segmento_button_click, nil, nil, "rightclick")
baseframe.cabecalho.segmento:SetScript("OnEnter", segmentButton_OnEnter)
baseframe.cabecalho.segmento:SetScript("OnLeave", segmentButton_OnLeave)
4 years ago
local b = baseframe.cabecalho.segmento.widget
3 years ago
b:SetNormalTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetNormalTexture():SetTexCoord(32/256, 64/256, 0, 1)
b:SetHighlightTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetHighlightTexture():SetTexCoord(32/256, 64/256, 0, 1)
b:SetPushedTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetPushedTexture():SetTexCoord(32/256, 64/256, 0, 1)
--SELECIONAR O ATRIBUTO ----------------------------------------------------------------------------------------------------------------------------------------------------
4 years ago
local atributo_button_click = function()
3 years ago
if (Details.instances_menu_click_to_open) then
4 years ago
if (instancia.LastMenuOpened == "attributes" and GameCooltipFrame1:IsShown()) then
3 years ago
GameCooltip:ShowMe(false)
4 years ago
instancia.LastMenuOpened = nil
else
atributo_on_enter (instancia.baseframe.cabecalho.atributo.widget, _, true, true)
instancia.LastMenuOpened = "attributes"
end
end
end
3 years ago
baseframe.cabecalho.atributo = gump:NewButton(baseframe, nil, "DetailsAttributeButton"..instancia.meu_id, nil, 16, 16, atributo_button_click)
baseframe.cabecalho.atributo:SetFrameLevel(baseframe.UPFrame:GetFrameLevel()+1)
4 years ago
baseframe.cabecalho.atributo.widget._instance = instancia
3 years ago
baseframe.cabecalho.atributo:SetPoint("left", baseframe.cabecalho.segmento.widget, "right", 0, 0)
baseframe.cabecalho.atributo:SetScript("OnEnter", atributo_on_enter)
baseframe.cabecalho.atributo:SetScript("OnLeave", atributo_on_leave)
4 years ago
local b = baseframe.cabecalho.atributo.widget
3 years ago
b:SetNormalTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetNormalTexture():SetTexCoord(66/256, 93/256, 0, 1)
b:SetHighlightTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetHighlightTexture():SetTexCoord(68/256, 93/256, 0, 1)
b:SetPushedTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetPushedTexture():SetTexCoord(68/256, 93/256, 0, 1)
--REPORTAR ~report ----------------------------------------------------------------------------------------------------------------------------------------------------
4 years ago
local report_func = function()
instancia:Reportar ("INSTANCE" .. instancia.meu_id)
GameCooltip2:Hide()
end
3 years ago
baseframe.cabecalho.report = gump:NewButton(baseframe, nil, "DetailsReportButton"..instancia.meu_id, nil, 8, 16, report_func)
baseframe.cabecalho.report:SetFrameLevel(baseframe.UPFrame:GetFrameLevel()+1)
4 years ago
baseframe.cabecalho.report.widget._instance = instancia
3 years ago
baseframe.cabecalho.report:SetPoint("left", baseframe.cabecalho.atributo, "right", -6, 0)
4 years ago
3 years ago
baseframe.cabecalho.report:SetScript("OnEnter", report_on_enter)
baseframe.cabecalho.report:SetScript("OnLeave", report_on_leave)
4 years ago
local b = baseframe.cabecalho.report.widget
3 years ago
b:SetNormalTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetNormalTexture():SetTexCoord(96/256, 128/256, 0, 1)
b:SetHighlightTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetHighlightTexture():SetTexCoord(96/256, 128/256, 0, 1)
b:SetPushedTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetPushedTexture():SetTexCoord(96/256, 128/256, 0, 1)
4 years ago
-- ~delete ~erase ~reset
3 years ago
--reset ----------------------------------------------------------------------------------------------------------------------------------------------------
4 years ago
local reset_func = function()
3 years ago
if (Details.instances_menu_click_to_open) then
4 years ago
if (instancia.LastMenuOpened == "reset" and GameCooltipFrame1:IsShown()) then
3 years ago
GameCooltip:ShowMe(false)
4 years ago
instancia.LastMenuOpened = nil
else
reset_button_onenter (instancia.baseframe.cabecalho.reset, _, true, true)
instancia.LastMenuOpened = "reset"
end
else
3 years ago
if (not Details.disable_reset_button) then
Details.tabela_historico:resetar()
4 years ago
else
3 years ago
Details:Msg(Loc["STRING_OPTIONS_DISABLED_RESET"])
4 years ago
end
end
end
3 years ago
baseframe.cabecalho.reset = CreateFrame("button", "DetailsClearSegmentsButton" .. instancia.meu_id, baseframe)
baseframe.cabecalho.reset:SetFrameLevel(baseframe.UPFrame:GetFrameLevel()+1)
baseframe.cabecalho.reset:SetSize(10, 16)
baseframe.cabecalho.reset:SetPoint("right", baseframe.cabecalho.novo, "left")
4 years ago
baseframe.cabecalho.reset.instance = instancia
baseframe.cabecalho.reset._instance = instancia
3 years ago
baseframe.cabecalho.reset:SetScript("OnClick", reset_func)
baseframe.cabecalho.reset:SetScript("OnEnter", reset_button_onenter)
baseframe.cabecalho.reset:SetScript("OnLeave", reset_button_onleave)
4 years ago
local b = baseframe.cabecalho.reset
3 years ago
b:SetNormalTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetNormalTexture():SetTexCoord(128/256, 160/256, 0, 1)
b:SetHighlightTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetHighlightTexture():SetTexCoord(128/256, 160/256, 0, 1)
b:SetPushedTexture([[Interface\AddOns\Details\images\toolbar_icons]])
b:GetPushedTexture():SetTexCoord(128/256, 160/256, 0, 1)
4 years ago
end