diff --git a/.gitignore b/.gitignore index 3b0f5e9f1..4a37c63a8 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ a.lua functions/pack2.lua *.json *.afphoto +wowapi.lua diff --git a/Details.toc b/Details.toc index 5727930dc..481ad8abe 100644 --- a/Details.toc +++ b/Details.toc @@ -1,4 +1,4 @@ -## Interface: 90001 +## Interface: 90002 ## Title: Details! Damage Meter ## Notes: Essential tool to impress that chick in your raid. ## SavedVariables: _detalhes_global @@ -67,6 +67,7 @@ frames\window_copy.lua frames\window_options2.lua frames\window_options2_sections.lua frames\window_api.lua +#frames\window_cdtracker.lua frames\window_playerbreakdown.lua frames\window_playerbreakdown_list.lua frames\window_report.lua diff --git a/Libs/DF/LibDFramework-1.0.toc b/Libs/DF/LibDFramework-1.0.toc index 5f5426ab1..a1ab4868d 100644 --- a/Libs/DF/LibDFramework-1.0.toc +++ b/Libs/DF/LibDFramework-1.0.toc @@ -1,4 +1,4 @@ -## Interface: 90001 +## Interface: 90002 ## Title: Lib: LibDFramework-1.0 ## Notes: Base Framework for many Addons diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index e03d3f19f..acc4593ae 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 215 +local dversion = 220 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -611,7 +611,7 @@ function DF:TruncateText (fontString, maxWidth) end end - DF:CleanTruncateUTF8String(text) + text = DF:CleanTruncateUTF8String(text) fontString:SetText (text) end @@ -3399,13 +3399,13 @@ function DF:CoreDispatch (context, func, ...) error (errortext) end - local okay, result1, result2, result3, result4 = pcall (func, ...) - - if (not okay) then - local stack = debugstack(2) - local errortext = "D!Framework (" .. context .. ") error: " .. result1 .. "\n====================\n" .. stack .. "\n====================\n" - error (errortext) - end + local okay, result1, result2, result3, result4 = xpcall(func, geterrorhandler(), ...) + + --if (not okay) then --when using pcall + --local stack = debugstack(2) + --local errortext = "D!Framework (" .. context .. ") error: " .. result1 .. "\n====================\n" .. stack .. "\n====================\n" + --error (errortext) + --end return result1, result2, result3, result4 end @@ -4204,10 +4204,9 @@ end end } - function DF:SetEnvironment(func, environmentHandle) + function DF:SetEnvironment(func, environmentHandle, newEnvironment) environmentHandle = environmentHandle or DF.DefaultSecureScriptEnvironmentHandle - - local newEnvironment = {} + newEnvironment = newEnvironment or {} setmetatable(newEnvironment, environmentHandle) _G.setfenv(func, newEnvironment) diff --git a/Libs/DF/normal_bar.lua b/Libs/DF/normal_bar.lua index ee77536ab..f37735dd4 100644 --- a/Libs/DF/normal_bar.lua +++ b/Libs/DF/normal_bar.lua @@ -534,14 +534,14 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] return end end - + local OnMouseDown = function (frame, button) local capsule = frame.MyObject local kill = capsule:RunHooksForWidget ("OnMouseDown", frame, button, capsule) if (kill) then return end - + if (not frame.MyObject.container.isLocked and frame.MyObject.container:IsMovable()) then if (not frame.isLocked and frame:IsMovable()) then frame.MyObject.container.isMoving = true @@ -549,14 +549,14 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] end end end - + local OnMouseUp = function (frame, button) local capsule = frame.MyObject local kill = capsule:RunHooksForWidget ("OnMouseUp", frame, button, capsule) if (kill) then return end - + if (frame.MyObject.container.isMoving) then frame.MyObject.container:StopMovingOrSizing() frame.MyObject.container.isMoving = false @@ -565,14 +565,14 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] ------------------------------------------------------------------------------------------------------------ --> timer - + function BarMetaFunctions:OnTimerEnd() local capsule = self local kill = capsule:RunHooksForWidget ("OnTimerEnd", self.widget, capsule) if (kill) then return end - + self.timer_texture:Hide() self.timer_textureR:Hide() self.div_timer:Hide() @@ -580,7 +580,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] self.timer = false end - function BarMetaFunctions:CancelTimerBar (no_timer_end) + function BarMetaFunctions:CancelTimerBar(no_timer_end) if (not self.HasTimer) then return end @@ -592,7 +592,11 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] self.statusbar:SetScript ("OnUpdate", nil) end end + self.righttext = "" + self.timer_texture:Hide() + self.timer_textureR:Hide() + if (not no_timer_end) then self:OnTimerEnd() end @@ -601,6 +605,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] local OnUpdate = function (self, elapsed) --> 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 @@ -624,7 +629,6 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] end function BarMetaFunctions:SetTimer (tempo, end_at) - if (end_at) then self.statusbar.tempo = end_at - tempo self.statusbar.remaining = end_at - GetTime() @@ -637,13 +641,13 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] self.statusbar.total_size = self.statusbar:GetWidth() self.statusbar.inverse = self.BarIsInverse - - self (0) - + + self(0) + self.div_timer:Show() self.background:Show() self:Show() - + if (self.LeftToRight) then self.timer_texture:Hide() self.timer_textureR:Show() @@ -659,19 +663,19 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] 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.HasTimer = true self.TimerScheduled = DF:ScheduleTimer ("StartTimeBarAnimation", 0.1, self) end - + function DF:StartTimeBarAnimation (timebar) timebar.TimerScheduled = nil timebar.statusbar:SetScript ("OnUpdate", OnUpdate) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 8a6a936ef..65713aaa9 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -5131,6 +5131,7 @@ DF.IconRowFunctions = { cooldownFrame:SetAllPoints() cooldownFrame:EnableMouse (false) cooldownFrame:SetFrameLevel (newIconFrame:GetFrameLevel()+1) + cooldownFrame:SetHideCountdownNumbers (self.options.surpress_blizzard_cd_timer) cooldownFrame.noCooldownCount = self.options.surpress_tulla_omni_cc newIconFrame.CountdownText = cooldownFrame:CreateFontString (nil, "overlay", "GameFontNormal") @@ -5224,12 +5225,15 @@ DF.IconRowFunctions = { iconFrame.CountdownText:SetPoint (self.options.text_anchor or "center", iconFrame, self.options.text_rel_anchor or "center", self.options.text_x_offset or 0, self.options.text_y_offset or 0) DF:SetFontSize (iconFrame.CountdownText, self.options.text_size) + DF:SetFontFace (iconFrame.CountdownText, self.options.text_font) + DF:SetFontOutline (iconFrame.CountdownText, self.options.text_outline) iconFrame.CountdownText:SetText (formattedTime) - iconFrame.Cooldown:SetHideCountdownNumbers (true) + else iconFrame.CountdownText:Hide() - iconFrame.Cooldown:SetHideCountdownNumbers (false) end + + iconFrame.Cooldown:SetHideCountdownNumbers (self.options.surpress_blizzard_cd_timer) else iconFrame.CountdownText:Hide() end @@ -5240,6 +5244,8 @@ DF.IconRowFunctions = { iconFrame.Desc:SetTextColor (DF:ParseColors (descText.text_color or self.options.desc_text_color)) iconFrame.Desc:SetPoint(self.options.desc_text_anchor or "bottom", iconFrame, self.options.desc_text_rel_anchor or "top", self.options.desc_text_x_offset or 0, self.options.desc_text_y_offset or 2) DF:SetFontSize (iconFrame.Desc, descText.text_size or self.options.desc_text_size) + DF:SetFontFace (iconFrame.Desc, self.options.desc_text_font) + DF:SetFontOutline (iconFrame.Desc, self.options.desc_text_outline) else iconFrame.Desc:Hide() end @@ -5250,6 +5256,8 @@ DF.IconRowFunctions = { iconFrame.StackText:SetTextColor (DF:ParseColors (self.options.desc_text_color)) iconFrame.StackText:SetPoint (self.options.stack_text_anchor or "center", iconFrame, self.options.stack_text_rel_anchor or "bottomright", self.options.stack_text_x_offset or 0, self.options.stack_text_y_offset or 0) DF:SetFontSize (iconFrame.StackText, self.options.stack_text_size) + DF:SetFontFace (iconFrame.StackText, self.options.stack_text_font) + DF:SetFontOutline (iconFrame.StackText, self.options.stack_text_outline) else iconFrame.StackText:Hide() end @@ -5330,6 +5338,8 @@ local default_icon_row_options = { show_text = true, text_color = {1, 1, 1, 1}, text_size = 12, + text_font = "Arial Narrow", + text_outline = "NONE", text_anchor = "center", text_rel_anchor = "center", text_x_offset = 0, @@ -5337,6 +5347,8 @@ local default_icon_row_options = { desc_text = true, desc_text_color = {1, 1, 1, 1}, desc_text_size = 7, + desc_text_font = "Arial Narrow", + desc_text_outline = "NONE", desc_text_anchor = "bottom", desc_text_rel_anchor = "top", desc_text_x_offset = 0, @@ -5344,6 +5356,8 @@ local default_icon_row_options = { stack_text = true, stack_text_color = {1, 1, 1, 1}, stack_text_size = 10, + stack_text_font = "Arial Narrow", + stack_text_outline = "NONE", stack_text_anchor = "center", stack_text_rel_anchor = "bottomright", stack_text_x_offset = 0, @@ -5356,6 +5370,7 @@ local default_icon_row_options = { backdrop_border_color = {0, 0, 0, 1}, anchor = {side = 6, x = 2, y = 0}, grow_direction = 1, --1 = to right 2 = to left + surpress_blizzard_cd_timer = false, surpress_tulla_omni_cc = false, } @@ -7287,6 +7302,11 @@ DF.StatusBarFunctions = { end healthBarMetaFunctions.UpdateHealth = function (self) + -- update max health regardless to avoid weird wrong values on UpdateMaxHealth sometimes + -- local maxHealth = UnitHealthMax (self.displayedUnit) + -- self:SetMinMaxValues (0, maxHealth) + -- self.currentHealthMax = maxHealth + local health = UnitHealth (self.displayedUnit) self.currentHealth = health PixelUtil.SetStatusBarValue (self, health) diff --git a/Libs/DF/slider.lua b/Libs/DF/slider.lua index a2e25fde2..c87ad1a73 100644 --- a/Libs/DF/slider.lua +++ b/Libs/DF/slider.lua @@ -847,23 +847,22 @@ local SwitchOnClick = function (self, button, forced_value, value) slider._thumb:SetPoint ("right", slider.widget, "right") end end - + if (slider.OnSwitch and not forced_value) then local value = _rawget (slider, "value") if (slider.return_func) then value = slider:return_func (value) end - - --> safe call - local success, errorText = pcall (slider.OnSwitch, slider, slider.FixedValue, value) + + local success, errorText = xpcall (slider.OnSwitch, geterrorhandler(), slider, slider.FixedValue, value) if (not success) then error ("Details! Framework: OnSwitch() " .. (button.GetName and button:GetName() or "-NONAME-") .. " error: " .. (errorText or "")) end - + --> trigger hooks slider:RunHooksForWidget ("OnSwitch", slider, slider.FixedValue, value) end - + end local default_switch_func = function (self, passed_value) diff --git a/boot.lua b/boot.lua index 33392e7d6..8745f1e99 100644 --- a/boot.lua +++ b/boot.lua @@ -4,8 +4,8 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 7950 - _detalhes.alpha_build_counter = 7950 --if this is higher than the regular counter, use it instead + _detalhes.build_counter = 8000 + _detalhes.alpha_build_counter = 8000 --if this is higher than the regular counter, use it instead _detalhes.game_version = "v9.0.1" _detalhes.userversion = "v9.0.1." .. _detalhes.build_counter _detalhes.realversion = 144 --core version, this is used to check API version for scripts and plugins (see alias below) diff --git a/classes/class_custom.lua b/classes/class_custom.lua index 2348e43cf..10a7a15f3 100644 --- a/classes/class_custom.lua +++ b/classes/class_custom.lua @@ -1,14 +1,14 @@ --> customized display script - + local _detalhes = _G._detalhes local gump = _detalhes.gump local _ - + _detalhes.custom_function_cache = {} - + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> local pointers - + local _cstr = string.format --lua local local _math_floor = math.floor --lua local local _table_sort = table.sort --lua local @@ -24,7 +24,7 @@ local _unpack = unpack --lua local local _type = type --lua local local _pcall = pcall -- lua local - + local _GetSpellInfo = _detalhes.getspellinfo -- api local local _IsInRaid = IsInRaid -- api local local _IsInGroup = IsInGroup -- api local @@ -32,34 +32,34 @@ local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers -- api local local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers -- api local local _GetUnitName = GetUnitName -- api local - + local _string_replace = _detalhes.string.replace --details api local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) - + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> constants local atributo_custom = _detalhes.atributo_custom atributo_custom.mt = {__index = atributo_custom} - + local combat_containers = { ["damagedone"] = 1, ["healdone"] = 2, } - + --> hold the mini custom objects atributo_custom._InstanceActorContainer = {} atributo_custom._InstanceLastCustomShown = {} atributo_custom._InstanceLastCombatShown = {} atributo_custom._TargetActorsProcessed = {} - + local ToKFunctions = _detalhes.ToKFunctions local SelectedToKFunction = ToKFunctions [1] local FormatTooltipNumber = ToKFunctions [8] local TooltipMaximizedMethod = 1 local UsingCustomRightText = false local UsingCustomLeftText = false - + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> core @@ -78,22 +78,22 @@ --> save the custom name in the instance instance.customName = custom_object:GetName() - + --> get the container holding the custom actor objects for this instance local instance_container = atributo_custom:GetInstanceCustomActorContainer (instance) - + local last_shown = atributo_custom._InstanceLastCustomShown [instance:GetId()] if (last_shown and last_shown ~= custom_object:GetName()) then instance_container:WipeCustomActorContainer() end atributo_custom._InstanceLastCustomShown [instance:GetId()] = custom_object:GetName() - + local last_combat_shown = atributo_custom._InstanceLastCombatShown [instance:GetId()] if (last_combat_shown and last_combat_shown ~= combat) then instance_container:WipeCustomActorContainer() end atributo_custom._InstanceLastCombatShown [instance:GetId()] = combat - + --> declare the main locals local total = 0 local top = 0 @@ -104,9 +104,9 @@ --> be save reseting the values on every refresh instance_container:ResetCustomActorContainer() - + local func - + if (_detalhes.custom_function_cache [instance.customName]) then func = _detalhes.custom_function_cache [instance.customName] else diff --git a/classes/class_damage.lua b/classes/class_damage.lua index cd8c41e4b..001ae7456 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -4708,7 +4708,10 @@ function atributo_damage:MontaDetalhesDamageDone (spellid, barra, instancia) table.wipe (data) --> GERAL - local media = esta_magia.total/total_hits + local media = 0 + if (total_hits > 0) then + media = esta_magia.total/total_hits + end local this_dps = nil if (esta_magia.counter > esta_magia.c_amt) then diff --git a/classes/container_actors.lua b/classes/container_actors.lua index d4fa262a1..18d4f590c 100644 --- a/classes/container_actors.lua +++ b/classes/container_actors.lua @@ -535,12 +535,21 @@ novo_objeto.flag_original = flag novo_objeto.serial = serial + --> seta a classe default para desconhecido, assim nenhum objeto fica com classe nil + novo_objeto.classe = "UNKNOW" + local forceClass + --get the aID (actor id) if (serial:match("^C")) then novo_objeto.aID = tostring(Details:GetNpcIdFromGuid(serial)) if (Details.immersion_special_units) then - novo_objeto.grupo = Details.Immersion.IsNpcInteresting(novo_objeto.aID) + local shouldBeInGroup, class = Details.Immersion.IsNpcInteresting(novo_objeto.aID) + novo_objeto.grupo = shouldBeInGroup + if (class) then + novo_objeto.classe = class + forceClass = novo_objeto.classe + end end elseif (serial:match("^P")) then @@ -559,14 +568,6 @@ end end - --> seta a classe default para desconhecido, assim nenhum objeto fica com classe nil - novo_objeto.classe = "UNKNOW" - ---8/11 00:57:49.096 SPELL_DAMAGE, ---Creature-0-2084-1220-24968-110715-00002BF677,"Archmage Modera",0x2111,0x0, ---Creature-0-2084-1220-24968-94688-00002BF6A7,"Diseased Grub",0x10a48,0x0, ---220128,"Frost Nova",0x10,Creature-0-2084-1220-24968-94688-00002BF6A7,0000000000000000,63802,311780,0,0,1,0,0,0,4319.26,4710.75,110,10271,-1,16,0,0,0,nil,nil,nil - -- tipo do container ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -716,8 +717,13 @@ _detalhes_global.debug_chr_log = _detalhes_global.debug_chr_log .. logLine end - end + end + --only happens with npcs from immersion feature + if (forceClass) then + novo_objeto.classe = forceClass + end + return novo_objeto, dono_do_pet, nome else return nil, nil, nil diff --git a/frames/window_cdtracker.lua b/frames/window_cdtracker.lua new file mode 100644 index 000000000..6c4173123 --- /dev/null +++ b/frames/window_cdtracker.lua @@ -0,0 +1,197 @@ + + +local Details = _G.Details +local DF = _G.DetailsFramework + +--namespace +Details.CooldownTracking = {} + +function Details:InitializeCDTrackerWindow() + local DetailsCDTrackerWindow = DF:CreateSimplePanel(UIParent, 700, 480, "Details! Online CD Tracker", "DetailsCDTrackerWindow") + DetailsCDTrackerWindow.Frame = DetailsCDTrackerWindow + DetailsCDTrackerWindow.__name = "OCD Tracker" + DetailsCDTrackerWindow.real_name = "DETAILS_CDTRACKERWINDOW" + DetailsCDTrackerWindow.__icon = [[Interface\TUTORIALFRAME\UI-TUTORIALFRAME-SPIRITREZ]] + DetailsCDTrackerWindow.__iconcoords = {130/512, 256/512, 0, 1} + DetailsCDTrackerWindow.__iconcolor = "white" + _G.DetailsPluginContainerWindow.EmbedPlugin(DetailsCDTrackerWindow, DetailsCDTrackerWindow, true) + + function DetailsCDTrackerWindow.RefreshWindow() + Details.OpenCDTrackerWindow() + end + + --check if is enabled at startup + if (Details.CooldownTracking.IsEnabled()) then + Details.CooldownTracking.RefreshScreenPanel() + end + + DetailsCDTrackerWindow:Hide() +end + +function Details.CooldownTracking.IsEnabled() + return Details.cd_tracker.enabled +end + +function Details.CooldownTracking.EnableTracker() + Details.CooldownTracking.RefreshScreenPanel() +end + +function Details.CooldownTracking.DisableTracker() + --hide the panel + if (DetailsOnlineCDTrackerScreenPanel) then + DetailsOnlineCDTrackerScreenPanel:Hide() + end + + --unregister callbacks + local libRaidStatus = LibStub("LibRaidStatus-1.0") + libRaidStatus.UnregisterCallback(Details.CooldownTracking, "CooldownListUpdate", "CooldownListUpdateFunc") + libRaidStatus.UnregisterCallback(Details.CooldownTracking, "CooldownListWiped", "CooldownListWipedFunc") + libRaidStatus.UnregisterCallback(Details.CooldownTracking, "CooldownUpdate", "CooldownUpdateFunc") + + --unregister events + +end + +function Details.CooldownTracking.CooldownListUpdateFunc() + +end + +function Details.CooldownTracking.CooldownListWipedFunc() + +end + +function Details.CooldownTracking.CooldownUpdateFunc() + +end + +function Details.CooldownTracking.RefreshScreenPanel() + if (not DetailsOnlineCDTrackerScreenPanel) then + --screen panel (goes into the UIParent and show cooldowns there) + local screenPanel = CreateFrame("frame", "DetailsOnlineCDTrackerScreenPanel", UIParent) + screenPanel:Hide() + + --register on libwindow + local libWindow = LibStub("LibWindow-1.1") + libWindow.RegisterConfig(screenPanel, _detalhes.cd_tracker.pos) + libWindow.MakeDraggable(screenPanel) + libWindow.RestorePosition(screenPanel) + end + + local screenPanel = _G.DetailsOnlineCDTrackerScreenPanel + + if (Details.cd_tracker.show_conditions.only_in_group) then + if (not IsInGroup()) then + screenPanel:Hide() + return + end + end + + if (Details.cd_tracker.show_conditions.only_inside_instance) then + local isInInstanceType = select(2, GetInstanceInfo()) + if (isInInstanceType ~= "party" and isInInstanceType ~= "raid" and isInInstanceType ~= "scenario" and isInInstanceType ~= "arena") then + screenPanel:Hide() + return + end + end + + --register callbacks from LibRaidStatus + local libRaidStatus = LibStub("LibRaidStatus-1.0") + if (libRaidStatus) then + libRaidStatus.RegisterCallback(Details.CooldownTracking, "CooldownListUpdate", "CooldownListUpdateFunc") + libRaidStatus.RegisterCallback(Details.CooldownTracking, "CooldownListWiped", "CooldownListWipedFunc") + libRaidStatus.RegisterCallback(Details.CooldownTracking, "CooldownUpdate", "CooldownUpdateFunc") + end + + --parei aqui, precisa pegar a tabela de cooldowns da library e atualizar as statusbars +end + +function Details.OpenCDTrackerWindow() + + --check if the window exists, if not create it + if (not _G.DetailsCDTrackerWindow or not _G.DetailsCDTrackerWindow.Initialized) then + _G.DetailsCDTrackerWindow.Initialized = true + local f = _G.DetailsCDTrackerWindow or DF:CreateSimplePanel(UIParent, 700, 480, "Details! Online CD Tracker", "DetailsCDTrackerWindow") + + --enabled with a toggle button + --execute to reset position + --misc configs + local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE") + local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") + local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE") + local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE") + local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE") + + local generalOptions = { + {--enable tracking + type = "toggle", + get = function() return Details.cd_tracker.enabled end, + set = function (self, fixedparam, value) + if (value) then + Details.CooldownTracking.EnableTracker() + else + Details.CooldownTracking.DisableTracker() + end + end, + name = "Enable Online Cooldown Tracker", + desc = "Enable Online Cooldown Tracker", + }, + } + DF:BuildMenu(generalOptions, f, 5, -5, 150, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template) + + + --cooldown selection + local cooldownProfile = Details.cd_tracker.cds_enabled + + local cooldownSelectionFrame = CreateFrame("frame", "$parentCooldownSelectionFrame", f, "BackdropTemplate") + cooldownSelectionFrame:SetPoint("topleft", f, "topleft", 0, -150) + cooldownSelectionFrame:SetPoint("bottomright", f, "bottomright", 0, 10) + DF:ApplyStandardBackdrop(cooldownSelectionFrame) + + --list of cooldowns to show, each one with a toggle button + local cooldownList = {} + if (LIB_RAID_STATUS_COOLDOWNS_BY_SPEC) then + for specId, cooldownTable in pairs(LIB_RAID_STATUS_COOLDOWNS_BY_SPEC) do + cooldownList[#cooldownList+1] = {type = "label", get = function() return "" .. specId end} + + for spellId, cooldownType in pairs(cooldownTable) do + local spellName, _, spellicon = GetSpellInfo(spellId) + + if (spellName) then + if (cooldownType == 3 or cooldownType == 4) then + cooldownList[#cooldownList+1] = { + type = "toggle", + get = function() + if (cooldownProfile[spellId] == nil) then + if (cooldownType == 3 or cooldownType == 4) then + cooldownProfile[spellId] = true + else + cooldownProfile[spellId] = false + end + end + return cooldownProfile[spellId] + end, + set = function (self, fixedparam, value) + cooldownProfile[spellId] = value + end, + name = spellName, + desc = spellName, + boxfirst = true, + } + end + end + end + + cooldownList[#cooldownList+1] = {type = "blank"} + end + end + + DF:BuildMenu(cooldownSelectionFrame, cooldownList, 5, -5, cooldownSelectionFrame:GetHeight(), false, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template) + + + + end + + _G.DetailsPluginContainerWindow.OpenPlugin(_G.DetailsCDTrackerWindow) + _G.DetailsCDTrackerWindow:Show() + +end \ No newline at end of file diff --git a/functions/coach.lua b/functions/coach.lua index dbe2e260f..b465d2138 100644 --- a/functions/coach.lua +++ b/functions/coach.lua @@ -41,24 +41,32 @@ end function Details.Coach.SendRLCombatStartNotify(raidLeaderName) Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CCS"), "WHISPER", raidLeaderName) - Details:Msg("sent to raid leader a combat start notification.") + if (_detalhes.debug) then + Details:Msg("sent to raid leader a combat start notification.") + end end function Details.Coach.SendRLCombatEndNotify(raidLeaderName) Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CCE"), "WHISPER", raidLeaderName) - Details:Msg("sent to raid leader a combat end notification.") + if (_detalhes.debug) then + Details:Msg("sent to raid leader a combat end notification.") + end end --the coach is no more a coach function Details.Coach.SendRaidCoachEndNotify() Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CE"), "RAID") - Details:Msg("sent to raid a coach end notification.") + if (_detalhes.debug) then + Details:Msg("sent to raid a coach end notification.") + end end --there's a new coach, notify players function Details.Coach.SendRaidCoachStartNotify() Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CS"), "RAID") - Details:Msg("sent to raid a coach start notification.") + if (_detalhes.debug) then + Details:Msg("sent to raid a coach start notification.") + end end --send data to raid leader @@ -133,7 +141,9 @@ function Details.Coach.StartUp() if (UnitIsGroupAssistant("player")) then local raidLeaderName = Details.Coach.Client.GetLeaderName() if (raidLeaderName) then - Details:Msg("i'm a raid assistant, sent combat start notification to raid leader.") + if (_detalhes.debug) then + Details:Msg("i'm a raid assistant, sent combat start notification to raid leader.") + end Details.Coach.SendRLCombatStartNotify(raidLeaderName) end end @@ -154,7 +164,9 @@ function Details.Coach.StartUp() if (UnitIsGroupAssistant("player")) then local raidLeaderName = Details.Coach.Client.GetLeaderName() if (raidLeaderName) then - Details:Msg("i'm a raid assistant, sent combat end notification to raid leader.") + if (_detalhes.debug) then + Details:Msg("i'm a raid assistant, sent combat end notification to raid leader.") + end Details.Coach.SendRLCombatEndNotify(raidLeaderName) end end @@ -170,7 +182,9 @@ function Details.Coach.StartUp() if (isInRaidZone()) then --the raid leader entered a raid instance Details.Coach.Disable() - Details:Msg("Coach feature stopped: you entered in a raid instance.") + if (_detalhes.debug) then + Details:Msg("Coach feature stopped: you entered in a raid instance.") + end end return else @@ -179,7 +193,9 @@ function Details.Coach.StartUp() if (UnitIsGroupLeader("player")) then --player is the raid leader if (not Details.Coach.Server.IsEnabled()) then --the coach feature isn't running Details.Coach.Server.EnableCoach() - Details:Msg("Coach feature is now running, if this come as surprise, use '/details coach' to disable.") + if (_detalhes.debug) then + Details:Msg("Coach feature is now running, if this come as surprise, use '/details coach' to disable.") + end end end return @@ -193,7 +209,9 @@ function Details.Coach.StartUp() if (not Details.Coach.Client.IsEnabled()) then local raidLeaderName = Details:GetRaidLeader() if (raidLeaderName) then - Details:Msg("sent ask to raid leader, is coach?") + if (_detalhes.debug) then + Details:Msg("sent ask to raid leader, is coach?") + end Details.Coach.AskRLForCoachStatus(raidLeaderName) return end @@ -248,19 +266,25 @@ end --the player used '/details coach' or it's Details! initialization function Details.Coach.Server.EnableCoach(fromStartup) if (not IsInRaid()) then - Details:Msg("cannot enabled coach: not in raid.") + if (_detalhes.debug) then + Details:Msg("cannot enabled coach: not in raid.") + end Details.coach.enabled = false Details.Coach.Server.enabled = false return elseif (not UnitIsGroupLeader("player")) then - Details:Msg("cannot enabled coach: you aren't the raid leader.") + if (_detalhes.debug) then + Details:Msg("cannot enabled coach: you aren't the raid leader.") + end Details.coach.enabled = false Details.Coach.Server.enabled = false return elseif (isInRaidZone()) then - Details:Msg("cannot enabled coach: you are inside a raid zone.") + if (_detalhes.debug) then + Details:Msg("cannot enabled coach: you are inside a raid zone.") + end Details.coach.enabled = false Details.Coach.Server.enabled = false return @@ -276,7 +300,9 @@ function Details.Coach.Server.EnableCoach(fromStartup) Details.Coach.EventFrame:RegisterEvent("GROUP_ROSTER_UPDATE") if (fromStartup) then - Details:Msg("coach feature enabled, welcome back captain!") + if (_detalhes.debug) then + Details:Msg("coach feature enabled, welcome back captain!") + end end end @@ -308,7 +334,9 @@ function Details.Coach.Client.EnableCoach(raidLeaderName) --enable group roster to know if the raid leader has changed Details.Coach.EventFrame:RegisterEvent("GROUP_ROSTER_UPDATE") - Details:Msg("there's a new coach: ", raidLeaderName) + if (_detalhes.debug) then + Details:Msg("there's a new coach: ", raidLeaderName) + end end --raid leader received a notification that a new combat has started @@ -367,7 +395,9 @@ Details.Coach.EventFrame:SetScript("OnEvent", function(event, ...) local unitName = UnitName("raid" .. i) if (_G.Ambiguate(unitName .. "-" .. GetRealmName(), "none") ~= Details.Coach.Client.coachName) then --the raid leader has changed, finish the coach feature on the client - Details:Msg("raid leader has changed, coach feature has been disabled.") + if (_detalhes.debug) then + Details:Msg("raid leader has changed, coach feature has been disabled.") + end Details.Coach.Client.CoachEnd() end break @@ -382,7 +412,9 @@ Details.Coach.EventFrame:SetScript("OnEvent", function(event, ...) if (not Details.Coach.Server.IsEnabled()) then if (IsInRaid()) then if (not isInRaidZone()) then - Details:Msg("you're now the coach of the group.") + if (_detalhes.debug) then + Details:Msg("you're now the coach of the group.") + end --delay to set the new leader to give time for SendRaidCoachEndNotify() _G.C_Timer.After(3, Details.Coach.Server.EnableCoach) end @@ -393,7 +425,9 @@ Details.Coach.EventFrame:SetScript("OnEvent", function(event, ...) --player isn't the raid leader, check if the player is the coach and disable the feature if (Details.Coach.IsEnabled()) then if (Details.Coach.Server.IsEnabled()) then - Details:Msg("you're not the raid leader, disabling the coach feature.") + if (_detalhes.debug) then + Details:Msg("you're not the raid leader, disabling the coach feature.") + end Details.Coach.Disable() end end diff --git a/functions/immersion.lua b/functions/immersion.lua index 8a916c4a8..4b781d8de 100644 --- a/functions/immersion.lua +++ b/functions/immersion.lua @@ -49,9 +49,16 @@ end) --store the GUID of the npc or player and point to the coords there the icon is local iconPath1 = [[Interface\AddOns\Details\images\special_bar_icons]] Details.Immersion.IconDatabase = { - ["167826"] = {file = iconPath1, iconId = 1, interest = true}, --lady jaina proudmoore - ["167827"] = {file = iconPath1, iconId = 2, interest = true}, --Thrall + ["167826"] = {file = iconPath1, iconId = 1, interest = true, class = "MAGE"}, --lady jaina proudmoore + ["167827"] = {file = iconPath1, iconId = 2, interest = true, class = "SHAMAN"}, --Thrall + ["157432"] = {file = iconPath1, iconId = 3, interest = true, class = "WARRIOR"}, --bloodletter phantoriax, a npc inside torghast + ["166148"] = {file = iconPath1, iconId = 4, interest = true, class = "WARRIOR"}, --sawn, a npc inside torghast + ["171996"] = {file = iconPath1, iconId = 5, interest = true, class = "WARRIOR"}, --kythekios, a npc inside torghast + ["172007"] = {file = iconPath1, iconId = 6, interest = true, class = "WARRIOR"}, --thelia, a npc inside torghast + ["172024"] = {file = iconPath1, iconId = 7, interest = true, class = "WARRIOR"}, --telethakas, a npc inside torghast + ["157406"] = {file = iconPath1, iconId = 8, interest = true, class = "WARRIOR"}, --renavyth, a npc inside torghast + ["166151"] = {file = iconPath1, iconId = 9, interest = true, class = "WARRIOR"}, --moriaz the red, a npc inside torghast } local customIconsDB = Details.Immersion.IconDatabase @@ -75,6 +82,6 @@ end function Details.Immersion.IsNpcInteresting(aID) local npcImmersion = customIconsDB[aID] if (npcImmersion and npcImmersion.interest) then - return true + return true, npcImmersion.class end end \ No newline at end of file diff --git a/functions/playerclass.lua b/functions/playerclass.lua index 4ba98aac9..a76c5554c 100644 --- a/functions/playerclass.lua +++ b/functions/playerclass.lua @@ -95,6 +95,9 @@ do function _detalhes:GetSpecIcon (spec, useAlpha) if (spec) then + if (spec > 500) then --hack to new spec ids on new leveling zones from level 1-10 + spec = 65 + end if (useAlpha) then return [[Interface\AddOns\Details\images\spec_icons_normal_alpha]], unpack (_detalhes.class_specs_coords [spec]) else diff --git a/functions/profiles.lua b/functions/profiles.lua index 88c93b9de..5ee2ffc89 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1104,6 +1104,17 @@ local default_player_data = { enabled = false, }, + --> cd tracker + cd_tracker = { + pos = {}, + enabled = false, + cds_enabled = {}, + show_conditions = { + only_in_group = true, + only_inside_instance = true, + } + }, + --> force all fonts to have this outline force_font_outline = "", diff --git a/images/special_bar_icons.tga b/images/special_bar_icons.tga new file mode 100644 index 000000000..f7cabb8a6 Binary files /dev/null and b/images/special_bar_icons.tga differ diff --git a/startup.lua b/startup.lua index 9eb4d837c..b568af1e5 100644 --- a/startup.lua +++ b/startup.lua @@ -53,6 +53,8 @@ function Details:StartMeUp() --I'll never stop! self:InitializeRunCodeWindow() self:InitializePlaterIntegrationWindow() self:InitializeMacrosWindow() + + --self:InitializeCDTrackerWindow() --custom window self.custom = self.custom or {}