From 8a62868b0e701ba27c59c9e57c642e8f5e695762 Mon Sep 17 00:00:00 2001 From: Tercio Date: Mon, 14 Sep 2015 17:07:42 -0300 Subject: [PATCH] v4.0e --- .pkgmeta | 6 ++- Libs/DF/colors.lua | 12 ++++++ Libs/DF/fw.lua | 6 ++- Libs/DF/normal_bar.lua | 75 +++++++++++++++++++++++++++++++------- Libs/DF/normal_bar.xml | 8 ++++ boot.lua | 6 +-- core/parser.lua | 14 +++---- core/util.lua | 4 ++ functions/profiles.lua | 2 +- gumps/janela_principal.lua | 46 +++++++++++++++++++++++ gumps/switch.lua | 33 +++++++++++++++++ 11 files changed, 185 insertions(+), 27 deletions(-) diff --git a/.pkgmeta b/.pkgmeta index 382a2128..2525dc7a 100644 --- a/.pkgmeta +++ b/.pkgmeta @@ -11,4 +11,8 @@ move-folders: Details/plugins/Details_DungeonInfo-Warlords: Details_DungeonInfo-Warlords Details/plugins/Details_3DModelsPaths: Details_3DModelsPaths Details/plugins/Details_RaidCheck: Details_RaidCheck - Details/plugins/Details_DpsTuning: Details_DpsTuning \ No newline at end of file + Details/plugins/Details_DpsTuning: Details_DpsTuning + +required-dependencies: + - details_raidpowerbars + - details-legacy-raids-info \ No newline at end of file diff --git a/Libs/DF/colors.lua b/Libs/DF/colors.lua index ed794f9d..f52a48ac 100644 --- a/Libs/DF/colors.lua +++ b/Libs/DF/colors.lua @@ -7,6 +7,18 @@ do end DF.alias_text_colors = { + ["HUNTER"] = {0.67, 0.83, 0.45}, + ["WARLOCK"] = {0.58, 0.51, 0.79}, + ["PRIEST"] = {1.0, 1.0, 1.0}, + ["PALADIN"] = {0.96, 0.55, 0.73}, + ["MAGE"] = {0.41, 0.8, 0.94}, + ["ROGUE"] = {1.0, 0.96, 0.41}, + ["DRUID"] = {1.0, 0.49, 0.04}, + ["SHAMAN"] = {0.0, 0.44, 0.87}, + ["WARRIOR"] = {0.78, 0.61, 0.43}, + ["DEATHKNIGHT"] = {0.77, 0.12, 0.23}, + ["MONK"] = {0.0, 1.00, 0.59}, + ["aliceblue"] = {0.941176, 0.972549, 1, 1}, ["antiquewhite"] = {0.980392, 0.921569, 0.843137, 1}, ["aqua"] = {0, 1, 1, 1}, diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 51419481..1ff84ee3 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,5 @@ -local major, minor = "DetailsFramework-1.0", 8 +local major, minor = "DetailsFramework-1.0", 9 local DF, oldminor = LibStub:NewLibrary (major, minor) if (not DF) then @@ -167,6 +167,10 @@ DF.www_icons = { mmoc = {0, 0.7890625, 80/123, 123/128}, } +function DF:IntegerToTimer (value) + return "" .. floor (value/60) .. ":" .. format ("%02.f", value%60) +end + function DF:Embed (target) for k, v in pairs (embed_functions) do target[v] = self[v] diff --git a/Libs/DF/normal_bar.lua b/Libs/DF/normal_bar.lua index 4d5605fb..2c1bc751 100644 --- a/Libs/DF/normal_bar.lua +++ b/Libs/DF/normal_bar.lua @@ -509,48 +509,92 @@ local APIBarFunctions function BarMetaFunctions:OnTimerEnd() if (self.OnTimerEndHook) then - local interrupt = self.OnTimerEndHook() + local interrupt = self.OnTimerEndHook (self) if (interrupt) then return end end self.timer_texture:Hide() + self.timer_textureR:Hide() self.div_timer:Hide() self:Hide() self.timer = false end local OnUpdate = function (self, elapsed) - local timepct = (elapsed / self.tempo) * 100 - self.c = self.c - (timepct*self.width/100) + --> percent of elapsed + local pct = abs (self.end_timer - GetTime() - self.tempo) / self.tempo + if (self.inverse) then + self.t:SetWidth (self.total_size * pct) + else + self.t:SetWidth (self.total_size * abs (pct-1)) + end + + --> right text self.remaining = self.remaining - elapsed - self.righttext:SetText (_math_floor (self.remaining)) - self.timertexture:SetWidth (self.c) - if (self.c < 1) then + if (self.MyObject.RightTextIsTimer) then + self.righttext:SetText (DF:IntegerToTimer (self.remaining)) + else + self.righttext:SetText (_math_floor (self.remaining)) + end + + if (pct >= 1) then + self.righttext:SetText ("") self:SetScript ("OnUpdate", nil) self.MyObject:OnTimerEnd() end end function BarMetaFunctions:SetTimer (tempo) - - self.statusbar.width = self.statusbar:GetWidth() + + -- o que é inverso + -- barra cheia + -- barra vazia + -- o que é left to right + -- barra que faz da direita pra esquerda + -- contrário + self.statusbar.tempo = tempo self.statusbar.remaining = tempo - self.statusbar.c = self.statusbar.width + self.statusbar.total_size = self.statusbar:GetWidth() + self.statusbar.end_timer = GetTime() + tempo + self.statusbar.inverse = self.BarIsInverse - self.timer_texture:Show() - self.timer_texture:SetWidth (self.statusbar.width) - self.statusbar.t = self.timer_texture - self (1) + self (0) self.div_timer:Show() self.background:Show() self:Show() + if (self.LeftToRight) then + self.timer_texture:Hide() + self.timer_textureR:Show() + self.statusbar.t = self.timer_textureR + self.timer_textureR:ClearAllPoints() + self.timer_textureR:SetPoint ("right", self.statusbar, "right") + self.div_timer:SetPoint ("left", self.timer_textureR, "left", -14, -1) + else + self.timer_texture:Show() + self.timer_textureR:Hide() + self.statusbar.t = self.timer_texture + self.timer_texture:ClearAllPoints() + self.timer_texture:SetPoint ("left", self.statusbar, "left") + self.div_timer:SetPoint ("left", self.timer_texture, "right", -16, -1) + end + + if (self.BarIsInverse) then + self.statusbar.t:SetWidth (1) + else + self.statusbar.t:SetWidth (self.statusbar.total_size) + end + self.timer = true - self.statusbar:SetScript ("OnUpdate", OnUpdate) + DF:ScheduleTimer ("StartTimeBarAnimation", 0.1, self) + end + + function DF:StartTimeBarAnimation (timebar) + timebar.statusbar:SetScript ("OnUpdate", OnUpdate) end ------------------------------------------------------------------------------------------------------------ @@ -644,6 +688,9 @@ function DF:NewBar (parent, container, name, member, w, h, value, texture_name) BarObject.timer_texture:SetWidth (w) BarObject.timer_texture:SetHeight (h) + BarObject.timer_textureR = _G [name .. "_timerTextureR"] + BarObject.timer_textureR:Hide() + BarObject._texture = _G [name .. "_statusbarTexture"] BarObject.background = _G [name .. "_background"] BarObject._icon = _G [name .. "_icon"] diff --git a/Libs/DF/normal_bar.xml b/Libs/DF/normal_bar.xml index 919ca1e2..238f13d1 100644 --- a/Libs/DF/normal_bar.xml +++ b/Libs/DF/normal_bar.xml @@ -23,6 +23,14 @@ +