From 6ac6d7fd712a7f47472453e32edb38932a9afdd9 Mon Sep 17 00:00:00 2001 From: tercio Date: Wed, 9 Apr 2014 18:44:12 -0300 Subject: [PATCH] Added support to Profiles, now you can share the same config between two or more characters Added support for BattleTag friends over report window. Added pet threat to Tiny Threat plugin when out of a party or raid group. Fixed a issue with close button where it disappear without close the window when toolbar is in bottom side. Also fixed a issue where swapping toolbar positioning was sometimes making close button disappear. Fixed a problem opening options panel through minimap when there is no window opened. --- Details.toc | 3 + boot.lua | 13 +- classes/classe_instancia.lua | 151 +++- classes/classe_instancia_include.lua | 2 +- core/meta.lua | 44 ++ core/parser.lua | 42 +- framework/dropdown.lua | 7 + framework/label.lua | 2 + functions/loaddata.lua | 310 +++++++++ functions/profiles.lua | 644 ++++++++++++++++++ functions/savedata.lua | 212 +++--- functions/skins.lua | 4 +- functions/slash.lua | 18 +- gumps/janela_options.lua | 389 +++++++++-- gumps/janela_principal.lua | 107 ++- gumps/janela_report.lua | 119 +++- gumps/janela_welcome.lua | 4 +- locales/Details-enUS.lua | 23 +- locales/Details-ptBR.lua | 2 +- .../SiegeOfOrgrimmar.lua | 2 +- .../Details_TinyThreat/Details_TinyThreat.lua | 86 ++- .../Details_TinyThreat/Details_TinyThreat.toc | 1 - plugins/Details_TinyThreat/enUS.lua | 11 +- startup.lua | 117 ++-- 24 files changed, 1975 insertions(+), 338 deletions(-) create mode 100644 functions/loaddata.lua create mode 100644 functions/profiles.lua diff --git a/Details.toc b/Details.toc index 3653607c..f22d79b7 100644 --- a/Details.toc +++ b/Details.toc @@ -14,6 +14,7 @@ locales\Details-enUS.lua boot.lua core\util.lua +functions\profiles.lua functions\hooks.lua functions\skins.lua functions\boss.lua @@ -96,4 +97,6 @@ core\network.lua core\parser.lua +functions\loaddata.lua + startup.lua \ No newline at end of file diff --git a/boot.lua b/boot.lua index b484be93..7fe65552 100644 --- a/boot.lua +++ b/boot.lua @@ -8,7 +8,7 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.userversion = "v1.11.10" + _detalhes.userversion = "v1.12.00" _detalhes.version = "Alpha 016" _detalhes.realversion = 16 @@ -25,6 +25,7 @@ do _detalhes.__index = _detalhes _detalhes._tempo = time() _detalhes.debug = false + _detalhes.opened_windows = 0 --> containers --> armazenas as funções do parser - All parse functions @@ -76,7 +77,7 @@ do _detalhes.RaidTables.Plugins = {} --> name to plugin object _detalhes.RaidTables.NameTable = {} - + --> solo ------------------------------------------------------------------- --> general functions for solo mode plugins _detalhes.SoloTables = {} @@ -245,8 +246,12 @@ do --> print messages function _detalhes:Msg (_string, arg1, arg2, arg3, arg4) - - print (Loc ["STRING_DETAILS1"] .. _string, arg1 or "", arg2 or "", arg3 or "", arg4 or "") + if (self.__name) then + --> yes, we have a name! + print ("|cffffaeae" .. self.__name .. "|r |cffcc7c7c(plugin)|r: " .. _string, arg1 or "", arg2 or "", arg3 or "", arg4 or "") + else + print (Loc ["STRING_DETAILS1"] .. _string, arg1 or "", arg2 or "", arg3 or "", arg4 or "") + end end end diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua index c2cdbe26..ce667515 100644 --- a/classes/classe_instancia.lua +++ b/classes/classe_instancia.lua @@ -36,6 +36,10 @@ local sub_atributos = _detalhes.sub_atributos local segmentos = _detalhes.segmentos --> STARTUP reativa as instancias e regenera as tabelas das mesmas + function _detalhes:RestartInstances() + return _detalhes:ReativarInstancias() + end + function _detalhes:ReativarInstancias() _detalhes.opened_windows = 0 for index = #_detalhes.tabela_instancias, 1, -1 do @@ -152,6 +156,10 @@ end ------------------------------------------------------------------------------------------------------------------------ + function _detalhes:ShutDown() + return self:DesativarInstancia() + end + --> desativando a instância ela fica em stand by e apenas hida a janela function _detalhes:DesativarInstancia() @@ -320,16 +328,22 @@ end ------------------------------------------------------------------------------------------------------------------------ --> cria uma nova instância e a joga para o container de instâncias + + function _detalhes:CreateInstance (id) + return _detalhes:CriarInstancia (_, id) + end + function _detalhes:CriarInstancia (_, id) if (id and _type (id) == "boolean") then if (#_detalhes.tabela_instancias >= _detalhes.instances_amount) then - return _detalhes:Msg (Loc ["STRING_INSTANCE_LIMIT"]) + _detalhes:Msg (Loc ["STRING_INSTANCE_LIMIT"]) + return false end local new_instance = _detalhes:NovaInstancia (#_detalhes.tabela_instancias+1) - _detalhes.tabela_instancias [#_detalhes.tabela_instancias+1] = new_instance + return new_instance elseif (id) then @@ -353,7 +367,6 @@ end end local new_instance = _detalhes:NovaInstancia (#_detalhes.tabela_instancias+1) - _detalhes.tabela_instancias [#_detalhes.tabela_instancias+1] = new_instance if (not _detalhes.initializing) then _detalhes:SendEvent ("DETAILS_INSTANCE_OPEN", nil, new_instance) @@ -700,7 +713,8 @@ end local new_instance = {} _setmetatable (new_instance, _detalhes) - + _detalhes.tabela_instancias [#_detalhes.tabela_instancias+1] = new_instance + --> instance number new_instance.meu_id = ID @@ -788,6 +802,8 @@ end new_instance:ShowSideBars() + --local skin = fazer aqui o esquema de resgatar a skin salva no profile. + --> apply standard skin if have one saved if (_detalhes.standard_skin) then @@ -818,7 +834,7 @@ end ------------------------------------------------------------------------------------------------------------------------ --> ao reiniciar o addon esta função é rodada para recriar a janela da instância ---> search key: ~restaura ~inicio +--> search key: ~restaura ~inicio ~start function _detalhes:RestauraJanela (index, temp) --> load @@ -845,13 +861,26 @@ function _detalhes:RestauraJanela (index, temp) self.row_height = self.row_info.height + self.row_info.space.between --> create frames - local _baseframe, _bgframe, _bgframe_display, _scrollframe = gump:CriaJanelaPrincipal (self.meu_id, self) - self.baseframe = _baseframe - self.bgframe = _bgframe - self.bgdisplay = _bgframe_display - self.scroll = _scrollframe - _baseframe:EnableMouseWheel (false) - self.alturaAntiga = _baseframe:GetHeight() + local instance_baseframe = _G ["DetailsBaseFrame" .. self.meu_id] + if (instance_baseframe) then + local _baseframe, _bgframe, _bgframe_display, _scrollframe = instance_baseframe, _G ["Details_WindowFrame" .. self.meu_id], _G ["Details_GumpFrame" .. self.meu_id], _G ["Details_ScrollBar" .. self.meu_id] + self.baseframe = _baseframe + self.bgframe = _bgframe + self.bgdisplay = _bgframe_display + self.scroll = _scrollframe + _baseframe:EnableMouseWheel (false) + self.alturaAntiga = _baseframe:GetHeight() + else + local _baseframe, _bgframe, _bgframe_display, _scrollframe = gump:CriaJanelaPrincipal (self.meu_id, self) + self.baseframe = _baseframe + self.bgframe = _bgframe + self.bgdisplay = _bgframe_display + self.scroll = _scrollframe + _baseframe:EnableMouseWheel (false) + self.alturaAntiga = _baseframe:GetHeight() + end + + --> change the attribute _detalhes:TrocaTabela (self, self.segmento, self.atributo, self.sub_atributo, true) --> passando true no 5º valor para a função ignorar a checagem de valores iguais @@ -931,6 +960,52 @@ function _detalhes:RestauraJanela (index, temp) end +function _detalhes:ExportSkin() + + local exported = { + version = _detalhes.preset_version --skin version + } + + for key, value in pairs (self) do + if (_detalhes.instance_defaults [key]) then + if (type (value) == "table") then + exported [key] = table_deepcopy (value) + else + exported [key] = value + end + end + end + + return exported + +end + +function _detalhes:ApplySavedSkin (style) + + if (not style.version or _detalhes.preset_version > style.version) then + return _detalhes:Msg (Loc ["STRING_OPTIONS_PRESETTOOLD"]) + end + + --> set skin preset + local skin = style.skin + self.skin = "" + self:ChangeSkin (skin) + + --> overwrite all instance parameters with saved ones + for key, value in pairs (style) do + if (key ~= "skin") then + if (type (value) == "table") then + self [key] = table_deepcopy (value) + else + self [key] = value + end + end + end + + --> apply all changed attributes + self:ChangeSkin() +end + ------------------------------------------------------------------------------------------------------------------------ function _detalhes:InstanceReset (instance) @@ -1502,15 +1577,17 @@ function _detalhes:ChangeIcon (icon) if (self.atributo == 5) then --> custom - local icon = _detalhes.custom [self.sub_atributo].icon - self.baseframe.cabecalho.atributo_icon:SetTexture (icon) - self.baseframe.cabecalho.atributo_icon:SetTexCoord (5/64, 60/64, 3/64, 62/64) - - local icon_size = skin.icon_plugins_size - self.baseframe.cabecalho.atributo_icon:SetWidth (icon_size[1]) - self.baseframe.cabecalho.atributo_icon:SetHeight (icon_size[2]) - local icon_anchor = skin.icon_anchor_plugins - self.baseframe.cabecalho.atributo_icon:SetPoint ("TOPRIGHT", self.baseframe.cabecalho.ball_point, "TOPRIGHT", icon_anchor[1], icon_anchor[2]) + if (_detalhes.custom [self.sub_atributo]) then + local icon = _detalhes.custom [self.sub_atributo].icon + self.baseframe.cabecalho.atributo_icon:SetTexture (icon) + self.baseframe.cabecalho.atributo_icon:SetTexCoord (5/64, 60/64, 3/64, 62/64) + + local icon_size = skin.icon_plugins_size + self.baseframe.cabecalho.atributo_icon:SetWidth (icon_size[1]) + self.baseframe.cabecalho.atributo_icon:SetHeight (icon_size[2]) + local icon_anchor = skin.icon_anchor_plugins + self.baseframe.cabecalho.atributo_icon:SetPoint ("TOPRIGHT", self.baseframe.cabecalho.ball_point, "TOPRIGHT", icon_anchor[1], icon_anchor[2]) + end else --> normal local half = 0.00048828125 @@ -1786,11 +1863,18 @@ function _detalhes:monta_relatorio (este_relatorio, custom) total, keyName, first = _detalhes.atributo_misc:RefreshWindow (self, self.showing, true, true) end elseif (atributo == 5) then --> custom - total, keyName, first = _detalhes.atributo_custom:RefreshWindow (self, self.showing, true, {key = "custom"}) - total = self.showing.totals [self.customName] - atributo = _detalhes.custom [self.sub_atributo].attribute - container = self.showing [atributo]._ActorTable - + + if (_detalhes.custom [self.sub_atributo]) then + total, keyName, first = _detalhes.atributo_custom:RefreshWindow (self, self.showing, true, {key = "custom"}) + total = self.showing.totals [self.customName] + atributo = _detalhes.custom [self.sub_atributo].attribute + container = self.showing [atributo]._ActorTable + else + total, keyName, first = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true) + total = 1 + atributo = 1 + container = self.showing [atributo]._ActorTable + end --print (total, keyName, first, atributo) end @@ -2058,7 +2142,9 @@ function _detalhes:envia_relatorio (linhas, custom) end local to_who = _detalhes.report_where - local channel = to_who:find ("|") + + local channel = to_who:find ("CHANNEL") + local is_btag = to_who:find ("REALID") if (channel) then @@ -2069,6 +2155,17 @@ function _detalhes:envia_relatorio (linhas, custom) end return + + elseif (is_btag) then + + local id = to_who:gsub ((".*|"), "") + local presenceID = tonumber (id) + + for i = 1, #linhas do + BNSendWhisper (presenceID, linhas[i]) + end + + return elseif (to_who == "WHISPER") then --> whisper diff --git a/classes/classe_instancia_include.lua b/classes/classe_instancia_include.lua index c6cbc11f..8af001e2 100644 --- a/classes/classe_instancia_include.lua +++ b/classes/classe_instancia_include.lua @@ -61,7 +61,7 @@ _detalhes.instance_defaults = { --sort direction is the direction of results on bars (1 = top to bottom 2 = bottom to top) bars_sort_direction = 1, --reset button info - resetbutton_info = {text_color = {1, 0.82, 0, 1}, text_face = "Friz Quadrata TT", text_size = 12, color_overlay = {1, 1, 1, 1}, always_small = false}, + resetbutton_info = {text_color = {1, 0.82, 0, 1}, text_color_small = {1, 0.82, 0, 1}, text_face = "Friz Quadrata TT", text_size = 12, color_overlay = {1, 1, 1, 1}, always_small = false}, --instance button info instancebutton_info = {text_color = {1, 0.82, 0, 1}, text_face = "Friz Quadrata TT", text_size = 12, color_overlay = {1, 1, 1, 1}}, --close button info diff --git a/core/meta.lua b/core/meta.lua index a535d31b..1322d026 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -560,6 +560,50 @@ end end + + function _detalhes:ClearInstances() + for _, esta_instancia in _ipairs (_detalhes.tabela_instancias) do + --> detona a janela do Solo Mode + + if (esta_instancia.StatusBar.left) then + esta_instancia.StatusBarSaved = { + ["left"] = esta_instancia.StatusBar.left.real_name or "NONE", + ["center"] = esta_instancia.StatusBar.center.real_name or "NONE", + ["right"] = esta_instancia.StatusBar.right.real_name or "NONE", + ["options"] = esta_instancia.StatusBar.options + } + end + + --> erase all widgets frames + + esta_instancia.scroll = nil + esta_instancia.baseframe = nil + esta_instancia.bgframe = nil + esta_instancia.bgdisplay = nil + esta_instancia.freeze_icon = nil + esta_instancia.freeze_texto = nil + esta_instancia.barras = nil + esta_instancia.showing = nil + esta_instancia.agrupada_a = nil + esta_instancia.grupada_pos = nil + esta_instancia.agrupado = nil + esta_instancia._version = nil + + esta_instancia.h_baixo = nil + esta_instancia.h_esquerda = nil + esta_instancia.h_direita = nil + esta_instancia.h_cima = nil + esta_instancia.botao_separar = nil + esta_instancia.alert = nil + + esta_instancia.StatusBar = nil + esta_instancia.consolidateFrame = nil + esta_instancia.consolidateButtonTexture = nil + esta_instancia.consolidateButton = nil + esta_instancia.lastIcon = nil + + end + end function _detalhes:reset_window (instancia) if (instancia.segmento == -1) then diff --git a/core/parser.lua b/core/parser.lua index f4347965..44d149fb 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -2566,7 +2566,7 @@ -- PARSER - --serach key: ~parser ~event + --serach key: ~parser ~event ~start ~inicio function _detalhes:OnEvent (evento, ...) @@ -2783,14 +2783,50 @@ _detalhes.can_panic_mode = true end - return _detalhes:SaveData() + --if (UnitName ("player") == "Tiranaa" or UnitName ("player") == "Triciclo") then + _detalhes:SaveConfig() + + _detalhes:SaveProfile() + + --_detalhes_global = nil + --_detalhes_database = nil + + --else + -- return _detalhes:SaveData() + --end + elseif (evento == "ADDON_LOADED") then local addon_name = _select (1, ...) if (addon_name == "Details") then - _detalhes:LoadData() + + --> cooltip + if (not _G.GameCooltip) then + _detalhes.popup = DetailsCreateCoolTip() + else + _detalhes.popup = _G.GameCooltip + end + + --> write into details object all basic keys + _detalhes:ApplyBasicKeys() + + --if (_detalhes_global and _detalhes_global.profile_pool and _detalhes_global.profile_pool [UnitGUID ("player")]) then + --> apply basic startup + _detalhes:ApplyBasicKeys() + --> check if is first run + _detalhes:IsFirstRun() + --> load all the saved combats + _detalhes:LoadCombatTables() + --> load the profiles + _detalhes:LoadConfig() + + --else + --> load the addon + -- _detalhes:LoadData() + --end + _detalhes:UpdateParserGears() _detalhes:Start() end diff --git a/framework/dropdown.lua b/framework/dropdown.lua index e1e9285b..fea17401 100644 --- a/framework/dropdown.lua +++ b/framework/dropdown.lua @@ -293,6 +293,7 @@ function DropDownMetaFunctions:Select (optionName, byOptionNumber) local menu = self.func() if (byOptionNumber and type (optionName) == "number") then + --print ("selected", optionName) return self:Selected (menu [optionName]) end @@ -489,6 +490,12 @@ function DetailsDropDownOnMouseDown (button) _this_row.label:SetPoint ("left", _this_row.statusbar, "left", 2, 0) end + if (_table.iconsize) then + _this_row.icon:SetSize (_table.iconsize[1], _table.iconsize[2]) + else + _this_row.icon:SetSize (20, 20) + end + if (_table.font) then _this_row.label:SetFont (_table.font, 10.5) else diff --git a/framework/label.lua b/framework/label.lua index d8d68964..c9c57923 100644 --- a/framework/label.lua +++ b/framework/label.lua @@ -246,6 +246,8 @@ function gump:NewLabel (parent, container, name, member, text, font, size, color LabelObject.label = parent:CreateFontString (name, "OVERLAY", font) LabelObject.widget = LabelObject.label + LabelObject.label.MyObject = LabelObject + if (not APILabelFunctions) then APILabelFunctions = true local idx = getmetatable (LabelObject.label).__index diff --git a/functions/loaddata.lua b/functions/loaddata.lua new file mode 100644 index 00000000..2014022f --- /dev/null +++ b/functions/loaddata.lua @@ -0,0 +1,310 @@ +--File Revision: 1 +--Last Modification: 07/04/2014 +-- Change Log: + -- 07/04/2014: File Created. + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + + local _detalhes = _G._detalhes + local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) + local _ + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> On Details! Load: + --> load default keys into the main object + +function _detalhes:ApplyBasicKeys() + + --> we are not in debug mode + self.debug = false + + --> who is + self.playername = UnitName ("player") + self.playerserial = UnitGUID ("player") + + --> player faction and enemy faction + self.faction = UnitFactionGroup ("player") + if (self.faction == PLAYER_FACTION_GROUP[0]) then --> player is horde + self.faction_against = PLAYER_FACTION_GROUP[1] --> ally + elseif (self.faction == PLAYER_FACTION_GROUP[1]) then --> player is alliance + self.faction_against = PLAYER_FACTION_GROUP[0] --> horde + end + + self.zone_type = nil + _detalhes.temp_table1 = {} + + --> combat + self.encounter = {} + self.in_combat = false + self.combat_id = 0 + + --> instances (windows) + self.solo = self.solo or nil + self.raid = self.raid or nil + self.opened_windows = 0 + + self.default_texture = [[Interface\AddOns\Details\images\bar4]] + self.default_texture_name = "Details D'ictum" + + self.tooltip_max_targets = 3 + self.tooltip_max_abilities = 3 + self.tooltip_max_pets = 1 + + self.class_coords_version = 1 + self.class_colors_version = 1 + + self.school_colors = { + [1] = {1.00, 1.00, 0.00}, + [2] = {1.00, 0.90, 0.50}, + [4] = {1.00, 0.50, 0.00}, + [8] = {0.30, 1.00, 0.30}, + [16] = {0.50, 1.00, 1.00}, + [32] = {0.50, 0.50, 1.00}, + [64] = {1.00, 0.50, 1.00}, + ["unknown"] = {0.5, 0.75, 0.75, 1} + } + + --> load default profile keys + for key, value in pairs (_detalhes.default_profile) do + if (type (value) == "table") then + local ctable = table_deepcopy (value) + self [key] = ctable + else + self [key] = value + end + end + + --> end + return true + +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> On Details! Load: + --> check if this is a first run, reset, or else. + +function _detalhes:IsFirstRun() + + --> check and build the default container for character database + if (not _detalhes_database) then + _detalhes_database = table_deepcopy (_detalhes.default_player_data) + end + + if (_detalhes_global and not _detalhes_global.profile_pool) then + _detalhes_global.profile_pool = {} + end + + for key, value in pairs (_detalhes.default_player_data) do + if (_detalhes_database [key] == nil) then + if (type (value) == "table") then + _detalhes_database [key] = table_deepcopy (_detalhes.default_player_data [key]) + else + _detalhes_database [key] = value + end + end + + if (type (value) == "table") then + _detalhes [key] = table_deepcopy (_detalhes_database [key]) + else + _detalhes [key] = value + end + + end + + --> check and build the default container for account database + if (not _detalhes_global) then + _detalhes_global = table_deepcopy (_detalhes.default_global_data) + end + + for key, value in pairs (_detalhes.default_global_data) do + if (_detalhes_global [key] == nil) then + if (type (value) == "table") then + _detalhes_global [key] = table_deepcopy (_detalhes.default_global_data [key]) + else + _detalhes_global [key] = value + end + end + + if (type (value) == "table") then + _detalhes [key] = table_deepcopy (_detalhes_global [key]) + else + _detalhes [key] = value + end + + end + + --> end + return true +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> On Details! Load: + --> load previous saved combat data + +function _detalhes:LoadCombatTables() + + --> if isn't nothing saved, build a new one + if (not _detalhes_database.tabela_historico) then + _detalhes.tabela_historico = _detalhes.historico:NovoHistorico() + _detalhes.tabela_pets = _detalhes.container_pets:NovoContainer() + _detalhes.tabela_overall = _detalhes.combate:NovaTabela() + _detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall) + + else + + --> build basic containers + -- segments + _detalhes.tabela_historico = _detalhes_database.tabela_historico or _detalhes.historico:NovoHistorico() + -- overall + _detalhes.tabela_overall = _detalhes.combate:NovaTabela() + -- pets + _detalhes.tabela_pets = _detalhes_database.tabela_pets or _detalhes.container_pets:NovoContainer() + + --> if the core revision was incremented, reset all combat data + if (_detalhes.last_realversion < _detalhes.realversion) then + --> details was been hard upgraded + _detalhes.tabela_historico = _detalhes.historico:NovoHistorico() + _detalhes.tabela_pets = _detalhes.container_pets:NovoContainer() + _detalhes.tabela_overall = _detalhes.combate:NovaTabela() + _detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall) + end + + --> re-build all indexes and metatables + _detalhes:RestauraMetaTables() + + --> get last combat table + local historico_UM = _detalhes.tabela_historico.tabelas[1] + + if (historico_UM) then + _detalhes.tabela_vigente = historico_UM --> significa que elas eram a mesma tabela, então aqui elas se tornam a mesma tabela + else + _detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall) + end + + --> need refresh for all containers + for _, container in ipairs (_detalhes.tabela_overall) do + container.need_refresh = true + end + for _, container in ipairs (_detalhes.tabela_vigente) do + container.need_refresh = true + end + + --> erase combat data from the database + _detalhes_database.tabela_vigente = nil + _detalhes_database.tabela_historico = nil + _detalhes_database.tabela_pets = nil + end +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> On Details! Load: + --> load the saved config on the addon + +function _detalhes:LoadConfig() + + --> profile + + --> instances + _detalhes.tabela_instancias = _detalhes_database.tabela_instancias or {} + --> plugins data + _detalhes.plugin_database = _detalhes_database.plugin_database or {} + + _detalhes:ReativarInstancias() + + --> fix for the 500 + if (_detalhes_database.active_profile == "") then + --> é a primeira vez que este character usa profiles, precisa copiar as keys existentes + local current_profile_name = _detalhes:GetCurrentProfileName() + _detalhes:GetProfile (current_profile_name, true) + _detalhes:SaveProfileSpecial() + end + + --> load profile and active instances + local current_profile_name = _detalhes:GetCurrentProfileName() + _detalhes:GetProfile (current_profile_name, true) + + _detalhes:ApplyProfile (current_profile_name, true) + + --> startup + + --> set the nicktag cache host + _detalhes:NickTagSetCache (_detalhes_database.nick_tag_cache) + + --> count data + _detalhes:CountDataOnLoad() + + + --> solo e raid plugin + if (_detalhes_database.SoloTablesSaved) then + if (_detalhes_database.SoloTablesSaved.Mode) then + _detalhes.SoloTables.Mode = _detalhes_database.SoloTablesSaved.Mode + _detalhes.SoloTables.LastSelected = _detalhes_database.SoloTablesSaved.LastSelected + else + _detalhes.SoloTables.Mode = 1 + end + end + + if (_detalhes_database.RaidTablesSaved) then + if (_detalhes_database.RaidTablesSaved.Mode) then + _detalhes.RaidTables.Mode = _detalhes_database.RaidTablesSaved.Mode + _detalhes.RaidTables.LastSelected = _detalhes_database.RaidTablesSaved.LastSelected + else + _detalhes.RaidTables.Mode = 1 + end + end + + --> switch tables + _detalhes.switch.slots = _detalhes_database.switchSaved.slots + _detalhes.switch.table = _detalhes_database.switchSaved.table + + --> buffs + _detalhes.savedbuffs = _detalhes_database.savedbuffs + _detalhes.Buffs:BuildTables() + + --> custom + _detalhes.custom = _detalhes_global.custom + + --> parser + _detalhes.capture_current = {} + for captureType, captureValue in pairs (_detalhes.capture_real) do + _detalhes.capture_current [captureType] = captureValue + end + + --> spells overwrite + _detalhes.SpellOverwriteUser = _detalhes_global.SpellOverwriteUser or _detalhes.SpellOverwriteUser + + --> version first run + if (not _detalhes_database.last_version or _detalhes_database.last_version ~= _detalhes.userversion) then + _detalhes.is_version_first_run = true + end + +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> On Details! Load: + --> count logons, tutorials, etc + +function _detalhes:CountDataOnLoad() + + --> basic + if (not _detalhes_global.got_first_run) then + _detalhes.is_first_run = true + end + + --> tutorial + self.tutorial = self.tutorial or {} + + self.tutorial.logons = self.tutorial.logons or 0 + self.tutorial.logons = self.tutorial.logons + 1 + + self.tutorial.unlock_button = self.tutorial.unlock_button or 0 + self.tutorial.version_announce = self.tutorial.version_announce or 0 + self.tutorial.main_help_button = self.tutorial.main_help_button or 0 + self.tutorial.alert_frames = self.tutorial.alert_frames or {false, false, false, false, false, false} + + self.tutorial.main_help_button = self.tutorial.main_help_button + 1 + + self.character_data = self.character_data or {logons = 0} + self.character_data.logons = self.character_data.logons + 1 + +end \ No newline at end of file diff --git a/functions/profiles.lua b/functions/profiles.lua new file mode 100644 index 00000000..22780ec4 --- /dev/null +++ b/functions/profiles.lua @@ -0,0 +1,644 @@ +--File Revision: 1 +--Last Modification: 07/04/2014 +-- Change Log: + -- 07/04/2014: File Created. + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + + local _detalhes = _G._detalhes + local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) + local _ + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> Profiles: + --> return the current profile name + +function _detalhes:GetCurrentProfileName() + + --> check is have a profile name + if (_detalhes_database.active_profile == "") then + local character_key = UnitName ("player") .. "-" .. GetRealmName() + _detalhes_database.active_profile = character_key + end + + --> end + return _detalhes_database.active_profile +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> Profiles: + --> create a new profile + +function _detalhes:CreateProfile (name) + + if (not name or type (name) ~= "string" or name == "") then + return false + end + + --> check if already exists + if (_detalhes_global.__profiles [name]) then + return false + end + + --> copy the default table + local new_profile = table_deepcopy (_detalhes.default_profile) + new_profile.instances = {} + + --> add to global container + _detalhes_global.__profiles [name] = new_profile + + --> end + return new_profile + +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> Profiles: + --> return the list os all profiles + +function _detalhes:GetProfileList() + + --> build the table + local t = {} + for name, profile in pairs (_detalhes_global.__profiles) do + t [#t + 1] = name + end + + --> end + return t +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> Profiles: + --> delete a profile + +function _detalhes:EraseProfile (profile_name) + + --> erase profile table + _detalhes_global.__profiles [profile_name] = nil + + if (_detalhes_database.active_profile == profile_name) then + + local character_key = UnitName ("player") .. "-" .. GetRealmName() + + local my_profile = _detalhes:GetProfile (character_key) + + if (my_profile) then + _detalhes:ApplyProfile (character_key, true) + else + local profile = _detalhes:CreateProfile (character_key) + _detalhes:ApplyProfile (character_key, true) + end + + end + + --> end + return true +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> Profiles: + --> return the profile table requested + +function _detalhes:GetProfile (name, create) + + --> get the profile, create and return + local profile = _detalhes_global.__profiles [name] + + if (not profile and not create) then + return false + + elseif (not profile and create) then + profile = _detalhes:CreateProfile (name) + + end + + --> end + return profile +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> Profiles: + --> reset the profile +function _detalhes:ResetProfile (profile_name) + + --> get the profile + local profile = _detalhes:GetProfile (profile_name, true) + + if (not profile) then + return false + end + + --> reset + + local instances = profile.instances + for index, instance in ipairs (instances) do + for key, value in pairs (_detalhes.instance_defaults) do + if (type (value) == "table") then + instance [key] = table_deepcopy (value) + else + instance [key] = value + end + end + end + + local profile = table_deepcopy (_detalhes.default_profile) + profile.instances = instances + + _detalhes:ApplyProfile (profile_name, true) + + --> end + return true +end +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> Profiles: + --> return the profile table requested + +function _detalhes:ApplyProfile (profile_name, nosave, is_copy) + + --> get the profile + local profile = _detalhes:GetProfile (profile_name, true) + + --> if the profile doesn't exist, just quit + if (not profile) then + _detalhes:Msg ("Profile Not Found.") + return false + end + + --> always save the previous profile, except if nosave flag is up + if (not nosave) then + --> salva o profile ativo no momento + _detalhes:SaveProfile() + end + + --> update profile keys before go + for key, value in pairs (_detalhes.default_profile) do + if (profile [key] == nil) then + if (type (value) == "table") then + profile [key] = table_deepcopy (_detalhes.default_profile [key]) + else + profile [key] = value + end + + elseif (type (value) == "table") then + for key2, value2 in pairs (value) do + if (profile [key] [key2] == nil) then + if (type (value2) == "table") then + profile [key] [key2] = table_deepcopy (_detalhes.default_profile [key] [key2]) + else + profile [key] [key2] = value2 + end + end + end + + end + end + + --> apply the profile values + for key, _ in pairs (_detalhes.default_profile) do + local value = profile [key] + + if (type (value) == "table") then + local ctable = table_deepcopy (value) + _detalhes [key] = ctable + else + _detalhes [key] = value + end + + end + + --> apply the skin + + local saved_skins = profile.instances + + --> we need to create instances if the profile have more saved skins then the current amount of instances + if (#_detalhes.tabela_instancias < #saved_skins) then + for i = #_detalhes.tabela_instancias+1, #saved_skins do + + --> esse inicio precisa ser em silêncio + + local new_instance = _detalhes:CreateInstance (true) + if (not new_instance) then + break + end + + new_instance:ShutDown() + end + end + + for index, instance in ipairs (_detalhes.tabela_instancias) do + + local this_skin = saved_skins [index] + + if (this_skin) then + if (not instance.iniciada and not _detalhes.initializing) then + instance:RestauraJanela() + instance:ApplySavedSkin (this_skin) + instance:DesativarInstancia() + elseif (instance.iniciada) then + instance:ApplySavedSkin (this_skin) + end + end + end + + --> end + + if (not is_copy) then + _detalhes.active_profile = profile_name + _detalhes_database.active_profile = profile_name + --_detalhes:SaveProfile() + end + + return true +end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> Profiles: + --> return the profile table requested + +function _detalhes:SaveProfile (saveas) + + --> get the current profile + + local profile_name + + if (saveas) then + profile_name = saveas + else + profile_name = _detalhes:GetCurrentProfileName() + end + + local profile = _detalhes:GetProfile (profile_name, true) + + --> save default keys + + for key, _ in pairs (_detalhes.default_profile) do + + local current_value = _detalhes [key] + + if (type (current_value) == "table") then + local ctable = table_deepcopy (current_value) + profile [key] = ctable + else + profile [key] = current_value + end + + end + + --> save skins + table.wipe (profile.instances) + + for index, instance in ipairs (_detalhes.tabela_instancias) do + local exported = instance:ExportSkin() + profile.instances [index] = exported + end + + --> end + return profile +end + +local default_profile = { + + --> class icons and colors + class_icons_small = [[Interface\AddOns\Details\images\classes_small]], + class_coords = { + ["HUNTER"] = { + 0, -- [1] + 0.25, -- [2] + 0.25, -- [3] + 0.5, -- [4] + }, + ["WARRIOR"] = { + 0, -- [1] + 0.25, -- [2] + 0, -- [3] + 0.25, -- [4] + }, + ["ROGUE"] = { + 0.49609375, -- [1] + 0.7421875, -- [2] + 0, -- [3] + 0.25, -- [4] + }, + ["MAGE"] = { + 0.25, -- [1] + 0.49609375, -- [2] + 0, -- [3] + 0.25, -- [4] + }, + ["PET"] = { + 0.25, -- [1] + 0.49609375, -- [2] + 0.75, -- [3] + 1, -- [4] + }, + ["DRUID"] = { + 0.7421875, -- [1] + 0.98828125, -- [2] + 0, -- [3] + 0.25, -- [4] + }, + ["MONK"] = { + 0.5, -- [1] + 0.73828125, -- [2] + 0.5, -- [3] + 0.75, -- [4] + }, + ["DEATHKNIGHT"] = { + 0.25, -- [1] + 0.5, -- [2] + 0.5, -- [3] + 0.75, -- [4] + }, + ["UNKNOW"] = { + 0.5, -- [1] + 0.75, -- [2] + 0.75, -- [3] + 1, -- [4] + }, + ["PRIEST"] = { + 0.49609375, -- [1] + 0.7421875, -- [2] + 0.25, -- [3] + 0.5, -- [4] + }, + ["UNGROUPPLAYER"] = { + 0.5, -- [1] + 0.75, -- [2] + 0.75, -- [3] + 1, -- [4] + }, + ["Alliance"] = { + 0.49609375, -- [1] + 0.7421875, -- [2] + 0.75, -- [3] + 1, -- [4] + }, + ["WARLOCK"] = { + 0.7421875, -- [1] + 0.98828125, -- [2] + 0.25, -- [3] + 0.5, -- [4] + }, + ["ENEMY"] = { + 0, -- [1] + 0.25, -- [2] + 0.75, -- [3] + 1, -- [4] + }, + ["Horde"] = { + 0.7421875, -- [1] + 0.98828125, -- [2] + 0.75, -- [3] + 1, -- [4] + }, + ["PALADIN"] = { + 0, -- [1] + 0.25, -- [2] + 0.5, -- [3] + 0.75, -- [4] + }, + ["MONSTER"] = { + 0, -- [1] + 0.25, -- [2] + 0.75, -- [3] + 1, -- [4] + }, + ["SHAMAN"] = { + 0.25, -- [1] + 0.49609375, -- [2] + 0.25, -- [3] + 0.5, -- [4] + }, + }, + + class_colors = { + ["HUNTER"] = { + 0.67, -- [1] + 0.83, -- [2] + 0.45, -- [3] + }, + ["WARRIOR"] = { + 0.78, -- [1] + 0.61, -- [2] + 0.43, -- [3] + }, + ["PALADIN"] = { + 0.96, -- [1] + 0.55, -- [2] + 0.73, -- [3] + }, + ["SHAMAN"] = { + 0, -- [1] + 0.44, -- [2] + 0.87, -- [3] + }, + ["MAGE"] = { + 0.41, -- [1] + 0.8, -- [2] + 0.94, -- [3] + }, + ["ROGUE"] = { + 1, -- [1] + 0.96, -- [2] + 0.41, -- [3] + }, + ["UNKNOW"] = { + 0.2, -- [1] + 0.2, -- [2] + 0.2, -- [3] + }, + ["PRIEST"] = { + 1, -- [1] + 1, -- [2] + 1, -- [3] + }, + ["WARLOCK"] = { + 0.58, -- [1] + 0.51, -- [2] + 0.79, -- [3] + }, + ["UNGROUPPLAYER"] = { + 0.4, -- [1] + 0.4, -- [2] + 0.4, -- [3] + }, + ["ENEMY"] = { + 0.94117, -- [1] + 0, -- [2] + 0.0196, -- [3] + 1, -- [4] + }, + ["version"] = 1, + ["PET"] = { + 0.3, -- [1] + 0.4, -- [2] + 0.5, -- [3] + }, + ["DRUID"] = { + 1, -- [1] + 0.49, -- [2] + 0.04, -- [3] + }, + ["MONK"] = { + 0, -- [1] + 1, -- [2] + 0.59, -- [3] + }, + ["DEATHKNIGHT"] = { + 0.77, -- [1] + 0.12, -- [2] + 0.23, -- [3] + }, + }, + + --> minimap + minimap = {hide = false, radius = 160, minimapPos = 220}, + --> PvP + only_pvp_frags = false, + + --> window size + max_window_size = {width = 480, height = 450}, + new_window_size = {width = 300, height = 95}, + window_clamp = {-8, 0, 21, -14}, + + --> segments + segments_amount = 12, + segments_amount_to_save = 5, + segments_panic_mode = true, + --> max instances + instances_amount = 12, + --> if clear ungroup characters when logout + clear_ungrouped = true, + --> if clear graphic data when logout + clear_graphic = true, + + --> text sizes + font_sizes = {menus = 10}, + ps_abbreviation = 3, + + --> performance + use_row_animations = false, + animate_scroll = false, + use_scroll = false, + update_speed = 1, + time_type = 2, + memory_threshold = 3, + memory_ram = 64, + remove_realm_from_name = true, + trash_concatenate = false, + trash_auto_remove = true, + + --> death log + deadlog_limit = 12, + + --> report + report_lines = 5, + report_to_who = "", + + --> colors + default_bg_color = 0.0941, + default_bg_alpha = 0.5, + + --> fades + row_fade_in = {"in", 0.2}, + windows_fade_in = {"in", 0.2}, + row_fade_out = {"out", 0.2}, + windows_fade_out = {"out", 0.2}, + + --> captures + capture_real = { + ["damage"] = true, + ["heal"] = true, + ["energy"] = false, + ["miscdata"] = true, + ["aura"] = true, + ["spellcast"] = true, + }, + + --> cloud capture + cloud_capture = true, + --> combat time mim + minimum_combat_time = 5, + + --> skins + standard_skin = false, --? + skin = "Default Skin", --? + --> modes + + --> switch + +} + +_detalhes.default_profile = default_profile + +-- aqui fica as propriedades do jogador que não serão armazenadas no profile +local default_player_data = { + --> current combat number + combat_id = 0, + --> nicktag cache + nick_tag_cache = {}, + --> plugin data + plugin_database = {}, + --> information about this character + character_data = {logons = 0}, + --> version + last_realversion = _detalhes.realversion, + last_version = "v1.0.0", + --> profile + active_profile = "", + --> plugins tables + SoloTablesSaved = {}, + RaidTablesSaved = {}, + --> switch tables + switchSaved = {slots = 6, table = {}}, + --> saved skins + savedStyles = {}, +} + +_detalhes.default_player_data = default_player_data + +local default_global_data = { + + --> profile pool + __profiles = {}, + custom = {}, + savedStyles = {}, + tutorial = {logons = 0, unlock_button = 0, version_announce = 0, main_help_button = 0, alert_frames = {false, false, false, false, false, false}, }, +} + +_detalhes.default_global_data = default_global_data + + + +function _detalhes:SaveProfileSpecial() + + --> get the current profile + local profile_name = _detalhes:GetCurrentProfileName() + local profile = _detalhes:GetProfile (profile_name, true) + + --> save default keys + for key, _ in pairs (_detalhes.default_profile) do + + local current_value = _detalhes_database [key] or _detalhes_global [key] or _detalhes.default_player_data [key] or _detalhes.default_global_data [key] + + if (type (current_value) == "table") then + local ctable = table_deepcopy (current_value) + profile [key] = ctable + else + profile [key] = current_value + end + + end + + --> save skins + table.wipe (profile.instances) + + for index, instance in ipairs (_detalhes.tabela_instancias) do + local exported = instance:ExportSkin() + profile.instances [index] = exported + end + + --> end + return profile +end \ No newline at end of file diff --git a/functions/savedata.lua b/functions/savedata.lua index c41d0c7f..006c09f0 100644 --- a/functions/savedata.lua +++ b/functions/savedata.lua @@ -119,6 +119,11 @@ end -- On Account _detalhes_global = _detalhes_global or {} + + --> profiles + _detalhes_global.__profiiles = _detalhes.__profiiles + + --> skins _detalhes_global.savedStyles = _detalhes.savedStyles _detalhes_global.standard_skin = _detalhes.standard_skin _detalhes_global.got_first_run = true @@ -146,11 +151,15 @@ end --tutorial _detalhes_global.tutorial = _detalhes.tutorial + --profiles + _detalhes_global.__profiiles = _detalhes.__profiiles + return true end local force_reset = function() + print ("Check Point: Force reset.") _detalhes.tabela_instancias = {} _detalhes.tabela_historico = _detalhes.historico:NovoHistorico() _detalhes.tabela_pets = _detalhes.container_pets:NovoContainer() @@ -171,20 +180,20 @@ end --]] if (_detalhes_database) then + ---------------------------------------------------------------------------------------- + --> fora dos profiles + ---------------------------------------------------------------------------------------- + --> nicktag cache _detalhes.nick_tag_cache = _detalhes_database.nick_tag_cache or {} _detalhes:NickTagSetCache (_detalhes.nick_tag_cache) - _detalhes.only_pvp_frags = _detalhes_database.only_pvp_frags - - --> minimap - _detalhes.minimap = _detalhes_database.minimap --> plugin data _detalhes.plugin_database = _detalhes_database.plugin_database - + --> character info _detalhes.character_data = _detalhes_database.character_data - + --> build basic containers _detalhes.tabela_historico = _detalhes_database.tabela_historico or _detalhes.historico:NovoHistorico() -- segments _detalhes.tabela_overall = _detalhes.combate:NovaTabela() -- overall @@ -205,16 +214,10 @@ end --]] if (_detalhes.last_version ~= _detalhes.userversion) then _detalhes.is_version_first_run = true end - + --> re-build all indexes and metatables _detalhes:RestauraMetaTables() - - --> instances (windows) - _detalhes.tabela_instancias = _detalhes_database.tabela_instancias or {} - _detalhes.class_icons_small = _detalhes_database.class_icons_small - _detalhes.class_coords = _detalhes_database.class_coords - _detalhes.class_colors = _detalhes_database.class_colors - + --> get last combat table local historico_UM = _detalhes.tabela_historico.tabelas[1] @@ -225,6 +228,22 @@ end --]] end _detalhes.combat_id = _detalhes_database.combat_id + + ---------------------------------------------------------------------------------------- + --> estão nos profiles + ---------------------------------------------------------------------------------------- + + --> minimap + _detalhes.minimap = _detalhes_database.minimap + --> PvP + _detalhes.only_pvp_frags = _detalhes_database.only_pvp_frags + + --> instances (windows) + + _detalhes.tabela_instancias = _detalhes_database.tabela_instancias or {} + _detalhes.class_icons_small = _detalhes_database.class_icons_small + _detalhes.class_coords = _detalhes_database.class_coords + _detalhes.class_colors = _detalhes_database.class_colors if (_detalhes_database.SoloTables) then if (_detalhes_database.SoloTables.Mode) then @@ -303,12 +322,12 @@ end --]] _detalhes_database.tabela_pets = nil else - _detalhes.tabela_instancias = {} - _detalhes.tabela_historico = _detalhes.historico:NovoHistorico() - _detalhes.tabela_pets = _detalhes.container_pets:NovoContainer() - _detalhes.tabela_overall = _detalhes.combate:NovaTabela() - _detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall) - _detalhes_database = {} + _detalhes.tabela_instancias = {} + _detalhes.tabela_historico = _detalhes.historico:NovoHistorico() + _detalhes.tabela_pets = _detalhes.container_pets:NovoContainer() + _detalhes.tabela_overall = _detalhes.combate:NovaTabela() + _detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall) + _detalhes_database = {} end -- capture @@ -333,7 +352,6 @@ end --]] _detalhes.cloud_capture = _detalhes_database.cloud_capture _detalhes.minimum_combat_time = _detalhes_database.minimum_combat_time - -- On Account local _detalhes_global = _G._detalhes_global @@ -342,6 +360,8 @@ end --]] --saved styles --vardump (_detalhes_global.savedStyles) + _detalhes.__profiiles = _detalhes_global.__profiiles + _detalhes.savedStyles = _detalhes_global.savedStyles or _detalhes.savedStyles _detalhes.standard_skin = _detalhes_global.standard_skin @@ -371,6 +391,10 @@ end --]] --tutorial _detalhes.tutorial = _detalhes_global.tutorial + + --profiles + _detalhes.__profiiles = _detalhes_global.__profiiles + else _detalhes.is_first_run = true end @@ -391,115 +415,53 @@ function _detalhes:WipeConfig() end -function _detalhes:ApplyConfigDataOnLoad() - - --> basic - self.instances_amount = self.instances_amount or 12 - self.segments_amount = self.segments_amount or 12 - self.segments_amount_to_save = self.segments_amount_to_save or 5 - self.memory_threshold = self.memory_threshold or 3 - self.memory_ram = self.memory_ram or 64 - self.deadlog_limit = self.deadlog_limit or 12 - self.minimum_combat_time = self.minimum_combat_time or 5 - self.update_speed = self.update_speed or 1 - self.time_type = self.time_type or 2 - self.row_fade_in = self.row_fade_in or {"in", 0.2} - self.row_fade_out = self.row_fade_out or {"out", 0.2} - self.windows_fade_in = self.windows_fade_in or {"in", 0.2} - self.windows_fade_out = self.windows_fade_out or {"out", 0.2} - self.default_bg_color = self.default_bg_color or 0.0941 - self.default_bg_alpha = self.default_bg_alpha or 0.7 - self.new_window_size = self.new_window_size or {width = 300, height = 95} - self.max_window_size = self.max_window_size or {width = 480, height = 450} - self.window_clamp = self.window_clamp or {-8, 0, 21, -14} - self.window_clamp = {-8, 0, 21, -14} - self.report_lines = self.report_lines or 5 - self.report_to_who = self.report_to_who or "" - self.animate_scroll = self.animate_scroll or false - self.use_scroll = self.use_scroll or false - self.font_sizes = self.font_sizes or {menus = 10} - self.minimap = self.minimap or {hide = false, radius = 160, minimapPos = 220} +function _detalhes:SaveConfig() - self.ps_abbreviation = self.ps_abbreviation or 3 + --> cleanup + _detalhes:PrepareTablesForSave() + _detalhes_database.tabela_instancias = _detalhes.tabela_instancias + + --> buffs + _detalhes.Buffs:SaveBuffs() - self.plugin_database = self.plugin_database or {} - - --> tutorial - self.tutorial = self.tutorial or {} - self.tutorial.logons = self.tutorial.logons or 0 - self.tutorial.unlock_button = self.tutorial.unlock_button or 0 - self.tutorial.version_announce = self.tutorial.version_announce or 0 - self.tutorial.main_help_button = self.tutorial.main_help_button or 0 - self.tutorial.alert_frames = self.tutorial.alert_frames or {false, false, false, false, false, false} - self.tutorial.logons = self.tutorial.logons + 1 - self.tutorial.main_help_button = self.tutorial.main_help_button + 1 - self.character_data = self.character_data or {logons = 0} - self.character_data.logons = self.character_data.logons + 1 - - --> class colors - if (not self.class_colors or not self.class_colors.version or self.class_colors.version < self.class_colors_version) then - self.class_colors = {version = 1} - for classe, tabela_cor in pairs ( RAID_CLASS_COLORS ) do - self.class_colors [classe] = {tabela_cor.r, tabela_cor.g, tabela_cor.b} + --> salva o container do personagem + for key, value in pairs (_detalhes.default_player_data) do + _detalhes_database [key] = _detalhes [key] end - self.class_colors ["UNKNOW"] = {0.2, 0.2, 0.2} - self.class_colors ["UNGROUPPLAYER"] = {0.4, 0.4, 0.4} - self.class_colors ["PET"] = {0.3, 0.4, 0.5} - self.class_colors ["ENEMY"] = {0.94117, 0, 0.01960, 1} - end - self.class_icons_small = self.class_icons_small or [[Interface\AddOns\Details\images\classes_small]] - - --> class coords - if (not self.class_coords or not self.class_coords.version or self.class_coords.version < self.class_coords_version) then - self.class_coords = {} - for class, tcoord in pairs (_G.CLASS_ICON_TCOORDS) do - self.class_coords [class] = tcoord + --> salva o container das globais + for key, value in pairs (_detalhes.default_global_data) do + if (key ~= "__profiles") then + _detalhes_global [key] = _detalhes [key] + end end - self.class_coords ["Alliance"] = {0.49609375, 0.7421875, 0.75, 1} - self.class_coords ["Horde"] = {0.7421875, 0.98828125, 0.75, 1} - self.class_coords ["PET"] = {0.25, 0.49609375, 0.75, 1} - self.class_coords ["MONSTER"] = {0, 0.25, 0.75, 1} - self.class_coords ["ENEMY"] = {0, 0.25, 0.75, 1} - self.class_coords ["UNKNOW"] = {0.5, 0.75, 0.75, 1} - self.class_coords ["UNGROUPPLAYER"] = {0.5, 0.75, 0.75, 1} - end + --> solo e raid mode + if (_detalhes.SoloTables.Mode) then + _detalhes_database.SoloTablesSaved = {} + _detalhes_database.SoloTablesSaved.Mode = _detalhes.SoloTables.Mode + if (_detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode]) then + _detalhes_database.SoloTablesSaved.LastSelected = _detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode].real_name + end + end + if (_detalhes.RaidTables.Mode) then + _detalhes_database.RaidTablesSaved = {} + _detalhes_database.RaidTablesSaved.Mode = _detalhes.RaidTables.Mode + if (_detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode]) then + _detalhes_database.RaidTablesSaved.LastSelected = _detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode].real_name + end + end + + --> salva switch tables + _detalhes_database.switchSaved.slots = _detalhes.switch.slots + _detalhes_database.switchSaved.table = _detalhes.switch.table + + --> last versions + _detalhes_database.last_realversion = _detalhes.realversion --> core number + _detalhes_database.last_version = _detalhes.userversion --> version + _detalhes_global.got_first_run = true - --> booleans - if (type (self.trash_concatenate) ~= "boolean") then - self.trash_concatenate = false - end - if (type (self.trash_auto_remove) ~= "boolean") then - self.trash_auto_remove = true - end + --> overwrite spells + _detalhes_global.SpellOverwriteUser = _detalhes.SpellOverwriteUser - if (type (self.only_pvp_frags) ~= "boolean") then - self.only_pvp_frags = false - end - - if (type (self.remove_realm_from_name) ~= "boolean") then - self.remove_realm_from_name = true - end - - if (type (self.cloud_capture) ~= "boolean") then - self.cloud_capture = true - end - - if (type (self.segments_panic_mode) ~= "boolean") then - self.segments_panic_mode = true - end - - if (type (self.clear_graphic) ~= "boolean") then - self.clear_graphic = self.clear_graphic or true - end - - if (type (self.clear_ungrouped) ~= "boolean") then - self.clear_ungrouped = self.clear_ungrouped or true - end - - if (type (self.use_row_animations) ~= "boolean") then - self.use_row_animations = self.use_row_animations or false - end - -end \ No newline at end of file +end diff --git a/functions/skins.lua b/functions/skins.lua index 8d9c4b78..5ac61f5f 100644 --- a/functions/skins.lua +++ b/functions/skins.lua @@ -97,7 +97,7 @@ local _ menu_anchor = {-18, 1}, instance_button_anchor = {-12, 3}, instancebutton_info = {text_color = {.8, .6, .0, 0.8}, text_face = "Friz Quadrata TT", text_size = 10, color_overlay = {1, 1, 1, 1}}, - resetbutton_info = {text_color = {.8, .8, .8, 0.8}, text_face = "Friz Quadrata TT", text_size = 12, color_overlay = {1, 1, 1, 1}, always_small = true}, + resetbutton_info = {text_color = {.8, .8, .8, 0.8}, text_color_small = {0, 0, 0, 0}, text_face = "Friz Quadrata TT", text_size = 12, color_overlay = {1, 1, 1, 1}, always_small = true}, show_sidebars = false, show_statusbar = false, color = {.3, .3, .3, 1}, @@ -381,7 +381,7 @@ local _ --[[ when a skin is selected, all customized properties of the window is reseted and then the overwrites are applied]] --[[ for the complete cprop list see the file classe_instancia_include.lua]] instance_cprops = { - resetbutton_info = {text_color = {0.7, 0.7, 0.7, 1}, text_face = "Friz Quadrata TT", text_size = 12, color_overlay = {1, 1, 1, 1}}, + resetbutton_info = {text_color = {0.7, 0.7, 0.7, 1}, text_color_small = {0, 0, 0, 0}, text_face = "Friz Quadrata TT", text_size = 12, color_overlay = {1, 1, 1, 1}}, instancebutton_info = {text_color = {.7, .7, .7, 1}, text_face = "Friz Quadrata TT", text_size = 12, color_overlay = {1, 1, 1, 1}}, menu_anchor = {-18, 1}, instance_button_anchor = {-27, 3}, diff --git a/functions/slash.lua b/functions/slash.lua index 09f1a695..cadf79dc 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -69,8 +69,14 @@ function SlashCmdList.DETAILS (msg, editbox) end else local lower_instance = _detalhes:GetLowerInstanceNumber() - print (_detalhes:GetInstance (lower_instance)) - _detalhes:OpenOptionsWindow (_detalhes:GetInstance (lower_instance)) + if (not lower_instance) then + local instance = _detalhes:GetInstance (1) + _detalhes.CriarInstancia (_, _, 1) + _detalhes:OpenOptionsWindow (instance) + else + _detalhes:OpenOptionsWindow (_detalhes:GetInstance (lower_instance)) + end + end elseif (command == Loc ["STRING_SLASH_WORLDBOSS"]) then @@ -418,6 +424,14 @@ function SlashCmdList.DETAILS (msg, editbox) end end end + + elseif (command == "profile") then + + local profile = rest:match("^(%S*)%s*(.-)$") + + print ("Force apply profile: ", profile) + + _detalhes:ApplyProfile (profile, false) elseif (msg == "users") then _detalhes.users = {} diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index d84b5efb..0e30f8b3 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -9,6 +9,7 @@ local LDBIcon = LDB and LibStub ("LibDBIcon-1.0", true) local g = _detalhes.gump local _ local preset_version = 3 +_detalhes.preset_version = preset_version function _detalhes:OpenOptionsWindow (instance) @@ -128,7 +129,12 @@ function _detalhes:OpenOptionsWindow (instance) if (atributo == 5) then --> custom local CustomObject = _detalhes.custom [sub_atributo] - InstanceList [#InstanceList+1] = {value = index, label = _detalhes.atributos.lista [atributo] .. " - " .. CustomObject.name, onclick = onSelectInstance, icon = CustomObject.icon} + + if (CustomObject) then + InstanceList [#InstanceList+1] = {value = index, label = _detalhes.atributos.lista [atributo] .. " - " .. CustomObject.name, onclick = onSelectInstance, icon = CustomObject.icon} + else + InstanceList [#InstanceList+1] = {value = index, label = "unknown" .. " - " .. " invalid custom", onclick = onSelectInstance, icon = [[Interface\COMMON\VOICECHAT-MUTED]]} + end else local modo = _this_instance.modo @@ -159,6 +165,9 @@ function _detalhes:OpenOptionsWindow (instance) return InstanceList end + --local profile_string = g:NewLabel (window, nil, nil, "instancetext", "Current Profile:", "GameFontNormal", 12) + --profile_string:SetPoint ("bottomleft", window, "bottomleft", 27, 11) + local instances = g:NewDropDown (window, _, "$parentInstanceSelectDropdown", "instanceDropdown", 200, 18, buildInstanceMenu, nil) instances:SetPoint ("bottomright", window, "bottomright", -17, 09) @@ -169,13 +178,44 @@ function _detalhes:OpenOptionsWindow (instance) --instances_string:Hide() --> left panel buttons - local select_options = function (options_type) + + local menu_indexes = { + [1] = "General Settings", + [2] = "General Settings", + [13] = "General Settings", + [3] = "Appearance", + [4] = "Appearance", + [5] = "Appearance", + [6] = "Appearance", + [7] = "Appearance", + [8] = "Appearance", + [9] = "Appearance", + [10] = "Performance", + [11] = "Performance", + [12] = "Skins", + } + + local menus = { + {"Display", "Combat", "Profiles"}, + {"Skin Selection", "Row Settings", "Row Texts", "Window Settings", "Menu Bar", "Reset/Instance/Close", "Wallpaper"}, + {"Performance Tweaks", "Data Collector"}, + {"Plugins Management"} + } + + local menus2 = { + "Display", "Combat", + "Skin Selection", "Row Settings", "Row Texts", "Window Settings", "Menu Bar", "Reset/Instance/Close", "Wallpaper", + "Performance Tweaks", "Data Collector", + "Plugins Management", "Profiles" + } + + local select_options = function (options_type, true_index) window:hide_all_options() window:un_hide_options (options_type) - editing.text = editing.options [options_type] + editing.text = menus2 [options_type] -- ~altura if (options_type == 12) then @@ -234,13 +274,8 @@ function _detalhes:OpenOptionsWindow (instance) local g_performance_texture = g:NewImage (window, _, "$parentPluginsSettingsTexture", "PluginsSettingsTexture", 160, 33, [[Interface\AddOns\Details\images\options_window]]) g_performance_texture:SetTexCoord (0, 0.15625, 0.78515625, 0.8173828125) g_performance_texture:SetPoint ("topleft", g_plugin, "topleft", 0, 0) - - local menus = { - {"Display", "Combat"}, - {"Skin", "Row", "Row Texts", "Window Settings", "Top Menu Bar", "Reset/Instance/Close", "Wallpaper"}, - {"Performance Tweaks", "Data Collector"}, - {"Plugins Management"} - } + + local menus_settings = {1, 2, 13, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} --> create menus local anchors = {g_settings, g_appearance, g_performance, g_plugin} @@ -274,7 +309,7 @@ function _detalhes:OpenOptionsWindow (instance) texture:SetPoint (38, y-2) texture:SetVertexColor (1, 1, 1, .5) - local button = g:NewButton (window, _, "$parentButton_" .. index .. "_" .. i, nil, 150, 18, select_options, true_index, nil, "", menus [index] [i]) + local button = g:NewButton (window, _, "$parentButton_" .. index .. "_" .. i, nil, 150, 18, select_options, menus_settings [true_index], true_index, "", menus [index] [i]) button:SetPoint (40, y) button.textalign = "<" button.textcolor = textcolor @@ -306,6 +341,7 @@ function _detalhes:OpenOptionsWindow (instance) [10] = {}, [11] = {}, [12] = {}, + [13] = {}, --profiles } --> vai armazenar os frames das opções @@ -327,7 +363,7 @@ function _detalhes:OpenOptionsWindow (instance) container:SetBackdrop({ edgeFile = "Interface\\DialogFrame\\UI-DialogBox-gold-Border", tile = true, tileSize = 16, edgeSize = 5, - insets = {left = 1, right = 1, top = 0, bottom = 1},}) + insets = {left = 1, right = 1, top = 0, bottom = 1},}) container:SetBackdropBorderColor (0, 0, 0, 0) container:SetBackdropColor (0, 0, 0, 0) @@ -415,6 +451,7 @@ function _detalhes:OpenOptionsWindow (instance) table.insert (window.options [10], window:create_box_no_scroll (10)) table.insert (window.options [11], window:create_box_no_scroll (11)) table.insert (window.options [12], window:create_box (12)) + table.insert (window.options [13], window:create_box_no_scroll (13)) function window:hide_all_options() for _, frame in ipairs (window.options) do @@ -436,6 +473,10 @@ function _detalhes:OpenOptionsWindow (instance) end end + --local yellow_point = window:CreateTexture (nil, "overlay") + --yellow_point:SetSize (16, 16) + --yellow_point:SetTexture ([[Interface\QUESTFRAME\UI-Quest-BulletPoint]]) + local background_on_enter = function (self) if (self.background_frame) then self = self.background_frame @@ -445,6 +486,14 @@ function _detalhes:OpenOptionsWindow (instance) info_text.active = true info_text.text = self.parent.info end + + self.label:SetTextColor (1, .8, 0) + + --self:SetBackdrop ({edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 16, edgeSize = 8, + --insets = {left = 1, right = 1, top = 0, bottom = 1},}) + + --yellow_point:Show() + --yellow_point:SetPoint ("right", self, "left", 5, -1) end local background_on_leave = function (self) if (self.background_frame) then @@ -455,6 +504,13 @@ function _detalhes:OpenOptionsWindow (instance) info_text.active = false --info_text.text = "" end + + self.label:SetTextColor (1, 1, 1) + + --self:SetBackdrop (nil) + + --yellow_point:ClearAllPoints() + --yellow_point:Hide() end function window:create_line_background (frameX, label, parent) @@ -466,6 +522,7 @@ function _detalhes:OpenOptionsWindow (instance) f:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) f:SetBackdropColor (0, 0, 0, 0) f.parent = parent + f.label = label if (parent.widget) then parent.widget.background_frame = f else @@ -684,15 +741,65 @@ function _detalhes:OpenOptionsWindow (instance) frame1.avatarPreview2.texcoord = cords frame1.avatarPreview2:SetVertexColor (unpack (color)) + --> animate bars + + g:NewLabel (frame1, _, "$parentAnimateLabel", "animateLabel", Loc ["STRING_OPTIONS_ANIMATEBARS"], "GameFontHighlightLeft") + g:NewSwitch (frame1, _, "$parentAnimateSlider", "animateSlider", 60, 20, _, _, _detalhes.use_row_animations) -- ltext, rtext, defaultv + frame1.animateSlider:SetPoint ("left",frame1.animateLabel, "right", 2, 0) + frame1.animateSlider.info = Loc ["STRING_OPTIONS_ANIMATEBARS_DESC"] + frame1.animateSlider.OnSwitch = function (self, _, value) --> slider, fixedValue, sliderValue (false, true) + _detalhes.use_row_animations = value + end + + window:create_line_background (frame1, frame1.animateLabel, frame1.animateSlider) + frame1.animateSlider:SetHook ("OnEnter", background_on_enter) + frame1.animateSlider:SetHook ("OnLeave", background_on_leave) + + --> update speed + + g:NewSlider (frame1, _, "$parentSliderUpdateSpeed", "updatespeedSlider", SLIDER_WIDTH, 20, 0.3, 3, 0.1, _detalhes.update_speed, true) + g:NewLabel (frame1, _, "$parentUpdateSpeedLabel", "updatespeedLabel", Loc ["STRING_OPTIONS_WINDOWSPEED"], "GameFontHighlightLeft") + -- + frame1.updatespeedSlider:SetPoint ("left", frame1.updatespeedLabel, "right", 2, 0) + frame1.updatespeedSlider:SetThumbSize (50) + frame1.updatespeedSlider.useDecimals = true + local updateColor = function (slider, value) + if (value < 1) then + slider.amt:SetTextColor (1, value, 0) + elseif (value > 1) then + slider.amt:SetTextColor (-(value-3), 1, 0) + else + slider.amt:SetTextColor (1, 1, 0) + end + end + frame1.updatespeedSlider:SetHook ("OnValueChange", function (self, _, amount) + _detalhes:CancelTimer (_detalhes.atualizador) + _detalhes.update_speed = amount + _detalhes.atualizador = _detalhes:ScheduleRepeatingTimer ("AtualizaGumpPrincipal", _detalhes.update_speed, -1) + updateColor (self, amount) + end) + updateColor (frame1.updatespeedSlider, _detalhes.update_speed) + + frame1.updatespeedSlider.info = Loc ["STRING_OPTIONS_WINDOWSPEED_DESC"] + + window:create_line_background (frame1, frame1.updatespeedLabel, frame1.updatespeedSlider) + frame1.updatespeedSlider:SetHook ("OnEnter", background_on_enter) + frame1.updatespeedSlider:SetHook ("OnLeave", background_on_leave) + + --> anchors + titulo_display:SetPoint (10, -200) titulo_display_desc:SetPoint (10, -220) - frame1.segmentsLabel:SetPoint (10, -260) - frame1.scrollLabel:SetPoint (10, -285) - frame1.maxInstancesLabel:SetPoint (10, -310) - frame1.minimapLabel:SetPoint (10, -335) - frame1.dpsAbbreviateLabel:SetPoint (10, -360) - frame1.realmNameLabel:SetPoint (10, -385) + frame1.animateLabel:SetPoint (10, -260) + frame1.updatespeedLabel:SetPoint (10, -285) + + frame1.segmentsLabel:SetPoint (10, -310) + frame1.scrollLabel:SetPoint (10, -335) + frame1.maxInstancesLabel:SetPoint (10, -360) + frame1.minimapLabel:SetPoint (10, -385) + frame1.dpsAbbreviateLabel:SetPoint (10, -410) + frame1.realmNameLabel:SetPoint (10, -435) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -853,7 +960,165 @@ function _detalhes:OpenOptionsWindow (instance) frame2.hideOnCombatAlphaLabel:SetPoint (10, -160) frame2.autoSwitchLabel:SetPoint (10, -195) frame2.autoCurrentLabel:SetPoint (10, -220) --auto current + +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- General Settings - Profiles +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + + local frame13 = window.options [13][1] + + --> profiles title + local titulo_profiles = g:NewLabel (frame13, _, "$parentTituloProfiles", "tituloProfilesLabel", Loc ["STRING_OPTIONS_PROFILES_TITLE"], "GameFontNormal", 16) + local titulo_profiles_desc = g:NewLabel (frame13, _, "$parentTituloProfiles2", "tituloProfiles2Label", Loc ["STRING_OPTIONS_PROFILES_TITLE_DESC"], "GameFontNormal", 9, "white") + titulo_profiles_desc.width = 320 + + --> current profile + local current_profile_label = g:NewLabel (frame13, _, "$parentCurrentProfileLabel1", "currentProfileLabel1", Loc ["STRING_OPTIONS_PROFILES_CURRENT"], "GameFontHighlightLeft") + local current_profile_label2 = g:NewLabel (frame13, _, "$parentCurrentProfileLabel2", "currentProfileLabel2", "", "GameFontNormal") + current_profile_label2:SetPoint ("left", current_profile_label, "right", 3, 0) + local info_holder_frame = CreateFrame ("frame", nil, frame13.widget or frame13) + info_holder_frame:SetPoint ("topleft", current_profile_label.widget, "topleft") + info_holder_frame:SetPoint ("bottomright", current_profile_label2.widget, "bottomright") + + info_holder_frame.info = Loc ["STRING_OPTIONS_PROFILES_CURRENT_DESC"] + window:create_line_background (frame13, current_profile_label.widget, info_holder_frame) + info_holder_frame:SetScript ("OnEnter", background_on_enter) + info_holder_frame:SetScript ("OnLeave", background_on_leave) + + --> select profile + local profile_selected = function (_, instance, profile_name) + _detalhes:ApplyProfile (profile_name) + _detalhes:Msg ("Profile loaded:", profile_name) + _detalhes:OpenOptionsWindow (instance) + end + local build_profile_menu = function() + local menu = {} + + for index, profile_name in ipairs (_detalhes:GetProfileList()) do + menu [#menu+1] = {value = profile_name, label = profile_name, onclick = profile_selected, icon = "Interface\\MINIMAP\\Vehicle-HammerGold-3"} + end + + return menu + end + local select_profile_dropdown = g:NewDropDown (frame13, _, "$parentSelectProfileDropdown", "selectProfileDropdown", 160, 20, build_profile_menu, 1) + local select_profile_label = g:NewLabel (frame13, _, "$parentSelectProfileLabel", "selectProfileLabel", Loc ["STRING_OPTIONS_PROFILES_SELECT"], "GameFontHighlightLeft") + select_profile_dropdown:SetPoint ("left", select_profile_label, "right", 2, 0) + + select_profile_dropdown.info = Loc ["STRING_OPTIONS_PROFILES_SELECT_DESC"] + window:create_line_background (frame13, select_profile_label, select_profile_dropdown) + select_profile_dropdown:SetHook ("OnEnter", background_on_enter) + select_profile_dropdown:SetHook ("OnLeave", background_on_leave) + + --> new profile + local profile_name = g:NewTextEntry (frame13, _, "$parentProfileNameEntry", "profileNameEntry", 120, 20) + local profile_name_label = g:NewLabel (frame13, _, "$parentProfileNameLabel", "profileNameLabel", Loc ["STRING_OPTIONS_PROFILES_CREATE"], "GameFontHighlightLeft") + profile_name:SetPoint ("left", profile_name_label, "right", 2, 0) + + local create_profile = function() + local text = profile_name:GetText() + if (text == "") then + return _detalhes:Msg ("Name field is empty.") + end + + local new_profile = _detalhes:CreateProfile (text) + if (new_profile) then + _detalhes:ApplyProfile (text) + _detalhes:OpenOptionsWindow (window.instance) + else + return _detalhes:Msg ("Profile not created.") + end + end + local profile_create_button = g:NewButton (frame13, _, "$parentProfileCreateButton", "profileCreateButton", 50, 19, create_profile, nil, nil, nil, Loc ["STRING_OPTIONS_SAVELOAD_SAVE"]) + profile_create_button:InstallCustomTexture() + profile_create_button:SetPoint ("left", profile_name, "right", 2, 0) + + profile_name.info = Loc ["STRING_OPTIONS_PROFILES_CREATE_DESC"] + window:create_line_background (frame13, profile_name_label, profile_name) + profile_name:SetHook ("OnEnter", background_on_enter) + profile_name:SetHook ("OnLeave", background_on_leave) + + + --> copy profile + local profile_selectedCopy = function (_, instance, profile_name) + --copiar o profile + local current_instance = window.instance + _detalhes:ApplyProfile (profile_name, nil, true) + _detalhes:OpenOptionsWindow (current_instance) + end + local build_copy_menu = function() + local menu = {} + + for index, profile_name in ipairs (_detalhes:GetProfileList()) do + menu [#menu+1] = {value = profile_name, label = profile_name, onclick = profile_selectedCopy, icon = "Interface\\MINIMAP\\Vehicle-HammerGold-2"} + end + + return menu + end + local select_profileCopy_dropdown = g:NewDropDown (frame13, _, "$parentSelectProfileCopyDropdown", "selectProfileCopyDropdown", 160, 20, build_copy_menu, 1) + local select_profileCopy_label = g:NewLabel (frame13, _, "$parentSelectProfileCopyLabel", "selectProfileCopyLabel", Loc ["STRING_OPTIONS_PROFILES_COPY"], "GameFontHighlightLeft") + select_profileCopy_dropdown:SetPoint ("left", select_profileCopy_label, "right", 2, 0) + + select_profileCopy_dropdown.info = Loc ["STRING_OPTIONS_PROFILES_COPY_DESC"] + window:create_line_background (frame13, select_profileCopy_label, select_profileCopy_dropdown) + select_profileCopy_dropdown:SetHook ("OnEnter", background_on_enter) + select_profileCopy_dropdown:SetHook ("OnLeave", background_on_leave) + + --> erase profile + local profile_selectedErase = function (_, instance, profile_name) + local current_instance = window.instance + _detalhes:EraseProfile (profile_name) + _detalhes:OpenOptionsWindow (current_instance) + end + local build_erase_menu = function() + local menu = {} + + for index, profile_name in ipairs (_detalhes:GetProfileList()) do + menu [#menu+1] = {value = profile_name, label = profile_name, onclick = profile_selectedErase, icon = "Interface\\MINIMAP\\Vehicle-HammerGold-1", color = {1, 1, 1}, iconcolor = {1, .90, .90}} + end + + return menu + end + local select_profileErase_dropdown = g:NewDropDown (frame13, _, "$parentSelectProfileEraseDropdown", "selectProfileEraseDropdown", 160, 20, build_erase_menu, 1) + local select_profileErase_label = g:NewLabel (frame13, _, "$parentSelectProfileEraseLabel", "selectProfileLabel", Loc ["STRING_OPTIONS_PROFILES_ERASE"], "GameFontHighlightLeft") + select_profileErase_dropdown:SetPoint ("left", select_profileErase_label, "right", 2, 0) + + select_profileErase_dropdown.info = Loc ["STRING_OPTIONS_PROFILES_ERASE_DESC"] + window:create_line_background (frame13, select_profileErase_label, select_profileErase_dropdown) + select_profileErase_dropdown:SetHook ("OnEnter", background_on_enter) + select_profileErase_dropdown:SetHook ("OnLeave", background_on_leave) + + --> reset profile + + local reset_profile = function() + local current_instance = window.instance + _detalhes:ResetProfile (_detalhes:GetCurrentProfileName()) + _detalhes:OpenOptionsWindow (current_instance) + end + + local profile_reset_button = g:NewButton (frame13, _, "$parentProfileResetButton", "profileResetButton", 128, 19, reset_profile, nil, nil, nil, Loc ["STRING_OPTIONS_PROFILES_RESET"]) + profile_reset_button:InstallCustomTexture() + + local hiddenlabel = g:NewLabel (frame13, _, "$parentProfileResetButtonLabel", "profileResetButtonLabel", "", "GameFontHighlightLeft") + hiddenlabel:SetPoint ("left", profile_reset_button, "left") + + profile_reset_button.info = Loc ["STRING_OPTIONS_PROFILES_RESET_DESC"] + window:create_line_background (frame13, hiddenlabel, profile_reset_button) + profile_reset_button:SetHook ("OnEnter", background_on_enter) + profile_reset_button:SetHook ("OnLeave", background_on_leave) + + profile_reset_button.button.texture:SetVertexColor (1, .8, 0) + + --> anchors + titulo_profiles:SetPoint (10, -10) + titulo_profiles_desc:SetPoint (10, -30) + + current_profile_label:SetPoint (10, -90) + select_profile_label:SetPoint (10, -125) + profile_name_label:SetPoint (10, -150) + select_profileCopy_label:SetPoint (10, -185) + select_profileErase_label:SetPoint (10, -210) + profile_reset_button:SetPoint (10, -245) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Appearance - Skin --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -2477,8 +2742,7 @@ function _detalhes:OpenOptionsWindow (instance) --------------- Memory g:NewSlider (frame10, _, "$parentSliderSegmentsSave", "segmentsSliderToSave", SLIDER_WIDTH, 20, 1, 5, 1, _detalhes.segments_amount_to_save) - g:NewSlider (frame10, _, "$parentSliderUpdateSpeed", "updatespeedSlider", SLIDER_WIDTH, 20, 0.3, 3, 0.1, _detalhes.update_speed, true) - + g:NewLabel (frame10, _, "$parentLabelMemory", "memoryLabel", Loc ["STRING_OPTIONS_MEMORYT"], "GameFontHighlightLeft") g:NewSlider (frame10, _, "$parentSliderMemory", "memorySlider", SLIDER_WIDTH, 20, 1, 4, 1, _detalhes.memory_threshold) @@ -2551,18 +2815,7 @@ function _detalhes:OpenOptionsWindow (instance) frame10.panicModeSlider:SetHook ("OnLeave", background_on_leave) --------------- Animate Rows - g:NewLabel (frame10, _, "$parentAnimateLabel", "animateLabel", Loc ["STRING_OPTIONS_ANIMATEBARS"], "GameFontHighlightLeft") - - g:NewSwitch (frame10, _, "$parentAnimateSlider", "animateSlider", 60, 20, _, _, _detalhes.use_row_animations) -- ltext, rtext, defaultv - frame10.animateSlider:SetPoint ("left",frame10.animateLabel, "right", 2, 0) - frame10.animateSlider.info = Loc ["STRING_OPTIONS_ANIMATEBARS_DESC"] - frame10.animateSlider.OnSwitch = function (self, _, value) --> slider, fixedValue, sliderValue (false, true) - _detalhes.use_row_animations = value - end - window:create_line_background (frame10, frame10.animateLabel, frame10.animateSlider) - frame10.animateSlider:SetHook ("OnEnter", background_on_enter) - frame10.animateSlider:SetHook ("OnLeave", background_on_leave) --------------- Animate scroll bar g:NewLabel (frame10, _, "$parentAnimateScrollLabel", "animatescrollLabel", Loc ["STRING_OPTIONS_ANIMATESCROLL"], "GameFontHighlightLeft") @@ -2580,34 +2833,7 @@ function _detalhes:OpenOptionsWindow (instance) frame10.animatescrollSlider:SetHook ("OnLeave", background_on_leave) --------------- Update Speed - g:NewLabel (frame10, _, "$parentUpdateSpeedLabel", "updatespeedLabel", Loc ["STRING_OPTIONS_WINDOWSPEED"], "GameFontHighlightLeft") - - -- - frame10.updatespeedSlider:SetPoint ("left", frame10.updatespeedLabel, "right", 2, 0) - frame10.updatespeedSlider:SetThumbSize (50) - frame10.updatespeedSlider.useDecimals = true - local updateColor = function (slider, value) - if (value < 1) then - slider.amt:SetTextColor (1, value, 0) - elseif (value > 1) then - slider.amt:SetTextColor (-(value-3), 1, 0) - else - slider.amt:SetTextColor (1, 1, 0) - end - end - frame10.updatespeedSlider:SetHook ("OnValueChange", function (self, _, amount) - _detalhes:CancelTimer (_detalhes.atualizador) - _detalhes.update_speed = amount - _detalhes.atualizador = _detalhes:ScheduleRepeatingTimer ("AtualizaGumpPrincipal", _detalhes.update_speed, -1) - updateColor (self, amount) - end) - updateColor (frame10.updatespeedSlider, _detalhes.update_speed) - - frame10.updatespeedSlider.info = Loc ["STRING_OPTIONS_WINDOWSPEED_DESC"] - - window:create_line_background (frame10, frame10.updatespeedLabel, frame10.updatespeedSlider) - frame10.updatespeedSlider:SetHook ("OnEnter", background_on_enter) - frame10.updatespeedSlider:SetHook ("OnLeave", background_on_leave) + --------------- Erase Trash g:NewLabel (frame10, _, "$parentEraseTrash", "eraseTrashLabel", Loc ["STRING_OPTIONS_CLEANUP"], "GameFontHighlightLeft") @@ -2629,10 +2855,10 @@ function _detalhes:OpenOptionsWindow (instance) frame10.memoryLabel:SetPoint (10, -70) frame10.segmentsSaveLabel:SetPoint (10, -95) frame10.panicModeLabel:SetPoint (10, -120) - frame10.animateLabel:SetPoint (10, -145) + --frame10.animateLabel:SetPoint (10, -145) --frame10.animatescrollLabel:SetPoint (10, -170) - frame10.updatespeedLabel:SetPoint (10, -170) - frame10.eraseTrashLabel:SetPoint (10, -195) + --frame10.updatespeedLabel:SetPoint (10, -170) + frame10.eraseTrashLabel:SetPoint (10, -145) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Performance - Captures @@ -3006,6 +3232,41 @@ end ---------------------------------------------------------------------------------------- --> Show + --> window 1 + _G.DetailsOptionsWindow1RealmNameSlider.MyObject:SetValue (_detalhes.remove_realm_from_name) + _G.DetailsOptionsWindow1Slider.MyObject:SetValue (_detalhes.segments_amount) --segments + _G.DetailsOptionsWindow1UseScrollSlider.MyObject:SetValue (_detalhes.use_scroll) + _G.DetailsOptionsWindow1SliderMaxInstances.MyObject:SetValue (_detalhes.instances_amount) + _G.DetailsOptionsWindow1MinimapSlider.MyObject:SetValue (not _detalhes.minimap.hide) + _G.DetailsOptionsWindow1AbbreviateDropdown.MyObject:Select (_detalhes.ps_abbreviation) + _G.DetailsOptionsWindow1SliderUpdateSpeed.MyObject:SetValue (_detalhes.update_speed) + _G.DetailsOptionsWindow1AnimateSlider.MyObject:SetValue (_detalhes.use_row_animations) + + --> window 2 + _G.DetailsOptionsWindow2FragsPvpSlider.MyObject:SetValue (_detalhes.only_pvp_frags) + _G.DetailsOptionsWindow2TTDropdown.MyObject:Select (_detalhes.time_type) + + --> window 13 + _G.DetailsOptionsWindow13SelectProfileDropdown.MyObject:Select (_detalhes:GetCurrentProfileName()) + _G.DetailsOptionsWindow13SelectProfileDropdown.MyObject:SetFixedParameter (instance) + + --> window 10 + _G.DetailsOptionsWindow10SliderMemory.MyObject:SetValue (_detalhes.memory_threshold) + _G.DetailsOptionsWindow10PanicModeSlider.MyObject:SetValue (_detalhes.segments_panic_mode) + _G.DetailsOptionsWindow10ClearAnimateScrollSlider.MyObject:SetValue (_detalhes.animate_scroll) + _G.DetailsOptionsWindow10SliderSegmentsSave.MyObject:SetValue (_detalhes.segments_amount_to_save) + + + + --> window 11 + _G.DetailsOptionsWindow11CaptureDamageSlider.MyObject:SetValue (_detalhes.capture_real ["damage"]) + _G.DetailsOptionsWindow11CaptureHealSlider.MyObject:SetValue (_detalhes.capture_real ["heal"]) + _G.DetailsOptionsWindow11CaptureEnergySlider.MyObject:SetValue (_detalhes.capture_real ["energy"]) + _G.DetailsOptionsWindow11CaptureMiscSlider.MyObject:SetValue (_detalhes.capture_real ["miscdata"]) + _G.DetailsOptionsWindow11CaptureAuraSlider.MyObject:SetValue (_detalhes.capture_real ["aura"]) + _G.DetailsOptionsWindow11CloudAuraSlider.MyObject:SetValue (_detalhes.cloud_capture) + + ---------- _G.DetailsOptionsWindow8ResetTextColorPick.MyObject:SetColor (unpack (instance.resetbutton_info.text_color)) _G.DetailsOptionsWindow8ResetTextSizeSlider.MyObject:SetValue (instance.resetbutton_info.text_size) _G.DetailsOptionsWindow8ResetTextFontDropdown.MyObject:Select (instance.resetbutton_info.text_face) @@ -3176,6 +3437,10 @@ end _G.DetailsOptionsWindow4IconFileEntry:SetText (instance.row_info.icon_file) + --profiles + _G.DetailsOptionsWindow13CurrentProfileLabel2.MyObject:SetText (_detalhes_database.active_profile) + + window:Show() local avatar = NickTag:GetNicknameAvatar (UnitGUID ("player"), NICKTAG_DEFAULT_AVATAR, true) diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index cf5770dc..f667686f 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -1989,12 +1989,14 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando) --> details version instancia._version = baseframe:CreateFontString (nil, "overlay", "GameFontHighlightSmall") - instancia._version:SetPoint ("left", backgrounddisplay, "left", 20, 0) + --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 _detalhes.initializing) then - instancia._version:Hide() + end + instancia._version:Hide() + --> wallpaper baseframe.wallpaper = backgrounddisplay:CreateTexture (nil, "overlay") @@ -2822,7 +2824,6 @@ function _detalhes:StatusBarAlert (text, icon, color, time) end function _detalhes:SetCloseButtonSettings (overlaycolor) - if (overlaycolor == "reset") then overlaycolor = {1, 1, 1, 1} end @@ -2849,7 +2850,7 @@ function _detalhes:SetInstanceButtonSettings (textfont, textsize, textcolor, ove textcolor = {1, 0.81, 0, 1} overlaycolor = {1, 1, 1, 1} end - + --> text color if (textcolor) then local r, g, b, a = gump:ParseColors (textcolor) @@ -2891,7 +2892,7 @@ function _detalhes:SetInstanceButtonSettings (textfont, textsize, textcolor, ove self.baseframe.cabecalho.novo.Right:SetVertexColor (r, g, b, a) end -function _detalhes:SetDeleteButtonSettings (textfont, textsize, textcolor, overlaycolor, alwaysminimized) +function _detalhes:SetDeleteButtonSettings (textfont, textsize, textcolor, overlaycolor, alwaysminimized, smalltextcolor) if (textfont == "reset") then --print ("text color:", _G.DetailsResetButton1Text:GetTextColor()) @@ -2901,10 +2902,11 @@ function _detalhes:SetDeleteButtonSettings (textfont, textsize, textcolor, overl textfont = "Friz Quadrata TT" textsize = 12 textcolor = {1, 0.81, 0, 1} + smalltextcolor = {1, 0.81, 0, 1} overlaycolor = {1, 1, 1, 1} alwaysminimized = false end - + --> text color if (textcolor) then local r, g, b, a = gump:ParseColors (textcolor) @@ -2914,9 +2916,21 @@ function _detalhes:SetDeleteButtonSettings (textfont, textsize, textcolor, overl self.resetbutton_info.text_color [4] = a end + if (smalltextcolor) then + local r, g, b, a = gump:ParseColors (smalltextcolor) + self.resetbutton_info.text_color_small [1] = r + self.resetbutton_info.text_color_small [2] = g + self.resetbutton_info.text_color_small [3] = b + self.resetbutton_info.text_color_small [4] = a + end + + if (not self.resetbutton_info.text_color_small) then + self.resetbutton_info.text_color_small = {1, 0.81, 0, 1} + end + if (_detalhes.ResetButtonInstance == self.meu_id) then _G.DetailsResetButton1Text:SetTextColor (unpack (self.resetbutton_info.text_color)) - _G.DetailsResetButton2Text2:SetTextColor (unpack (self.resetbutton_info.text_color)) + _G.DetailsResetButton2Text2:SetTextColor (unpack (self.resetbutton_info.text_color_small)) end --> text font @@ -3561,6 +3575,60 @@ local botao_fechar_on_leave = function (self) OnLeaveMainWindow (self.instancia, self, 3) end +function SetCloseButtonAnchors (self, this_skin) + if (self.toolbar_side == 1) then --top + + self.baseframe.cabecalho.fechar:SetScript ("OnMouseDown", function() + self.baseframe.cabecalho.fechar:ClearAllPoints() + self.baseframe.cabecalho.fechar:SetPoint ("bottomright", self.baseframe, "topright", this_skin.close_button_anchor[1]+1, this_skin.close_button_anchor[2]-1) + end) + + self.baseframe.cabecalho.fechar:SetScript ("OnMouseUp", function() + self.baseframe.cabecalho.fechar:ClearAllPoints() + self.baseframe.cabecalho.fechar:SetPoint ("bottomright", self.baseframe, "topright", this_skin.close_button_anchor[1], this_skin.close_button_anchor[2]) + + self.baseframe.cabecalho.fechar:Disable() + self:DesativarInstancia() + + if (_detalhes.opened_windows == 0) then + print (Loc ["STRING_CLOSEALL"]) + end + end) + + elseif (self.toolbar_side == 2) then --bottom + + self.baseframe.cabecalho.fechar:SetScript ("OnMouseDown", function() + local y = 0 + if (self.show_statusbar) then + y = -14 + end + + local _x, _y = unpack (this_skin.close_button_anchor_bottom) + self.baseframe.cabecalho.fechar:ClearAllPoints() + self.baseframe.cabecalho.fechar:SetPoint ("topright", self.baseframe, "bottomright", _x + 1, _y + y - 1) + end) + + self.baseframe.cabecalho.fechar:SetScript ("OnMouseUp", function() + local y = 0 + if (self.show_statusbar) then + y = -14 + end + + local _x, _y = unpack (this_skin.close_button_anchor_bottom) + self.baseframe.cabecalho.fechar:ClearAllPoints() + self.baseframe.cabecalho.fechar:SetPoint ("topright", self.baseframe, "bottomright", _x, _y + y) + + self.baseframe.cabecalho.fechar:Disable() + self:DesativarInstancia() + + if (_detalhes.opened_windows == 0) then + print (Loc ["STRING_CLOSEALL"]) + end + end) + + end +end + -- ~skin function _detalhes:ChangeSkin (skin_name) @@ -3598,10 +3666,10 @@ function _detalhes:ChangeSkin (skin_name) if (_detalhes.ResetButtonInstance == self.meu_id) then self:SetDeleteButtonSettings ("reset") end + DetailsResetButton2Text2:SetText ("-") --> reset close button self:SetCloseButtonSettings ("reset") - DetailsResetButton2Text2:SetText ("-") --> overwrites local overwrite_cprops = this_skin.instance_cprops @@ -3686,8 +3754,10 @@ function _detalhes:ChangeSkin (skin_name) _detalhes:DisableUIPanelButton (_detalhes.ResetButton2) end else - _detalhes:RestoreUIPanelButton (_detalhes.ResetButton) - _detalhes:RestoreUIPanelButton (_detalhes.ResetButton2) + if (_detalhes.ResetButtonInstance == self.meu_id) then + _detalhes:RestoreUIPanelButton (_detalhes.ResetButton) + _detalhes:RestoreUIPanelButton (_detalhes.ResetButton2) + end end ----------> custom instance button @@ -3731,12 +3801,7 @@ function _detalhes:ChangeSkin (skin_name) self.baseframe.cabecalho.fechar:SetSize (18, 18) end - self.baseframe.cabecalho.fechar:SetScript ("OnMouseDown", function() - self.baseframe.cabecalho.fechar:SetPoint ("bottomright", self.baseframe, "topright", this_skin.close_button_anchor[1]+1, this_skin.close_button_anchor[2]-1) - end) - self.baseframe.cabecalho.fechar:SetScript ("OnMouseUp", function() - self.baseframe.cabecalho.fechar:SetPoint ("bottomright", self.baseframe, "topright", this_skin.close_button_anchor[1], this_skin.close_button_anchor[2]) - end) + SetCloseButtonAnchors (self, this_skin) else self.baseframe.cabecalho.fechar:SetDisabledTexture ([[Interface\Buttons\UI-Panel-MinimizeButton-Disabled]]) @@ -3868,6 +3933,7 @@ function _detalhes:ChangeSkin (skin_name) --> refresh options panel if opened if (_G.DetailsOptionsWindow and _G.DetailsOptionsWindow:IsShown()) then + --print (self.meu_id) _detalhes:OpenOptionsWindow (self) end @@ -3911,6 +3977,9 @@ function _detalhes:ToolbarSide (side) --> botão fechar self.baseframe.cabecalho.fechar:ClearAllPoints() self.baseframe.cabecalho.fechar:SetPoint ("bottomright", self.baseframe, "topright", unpack (skin.close_button_anchor)) + if (skin.close_button_coords) then + SetCloseButtonAnchors (self, skin) + end --> ball r self.baseframe.cabecalho.ball_r:SetTexCoord (unpack (COORDS_RIGHT_BALL)) self.baseframe.cabecalho.ball_r:ClearAllPoints() @@ -3948,6 +4017,9 @@ function _detalhes:ToolbarSide (side) self.baseframe.cabecalho.fechar:ClearAllPoints() local _x, _y = unpack (skin.close_button_anchor_bottom) self.baseframe.cabecalho.fechar:SetPoint ("topright", self.baseframe, "bottomright", _x, _y + y) + if (skin.close_button_coords) then + SetCloseButtonAnchors (self, skin) + end --> ball r self.baseframe.cabecalho.ball_r:ClearAllPoints() local _x, _y = unpack (skin.right_corner_anchor_bottom) @@ -4893,7 +4965,8 @@ function gump:CriaCabecalho (baseframe, instancia) --> Botão de Ajuda ---------------------------------------------------------------------------------------------------------------------------------------------------- - if (instancia.meu_id == 1 and _detalhes.tutorial.logons < 3) then + --> disabled + if (instancia.meu_id == 1 and _detalhes.tutorial.logons < 0) then --> help button local helpButton = CreateFrame ("button", "DetailsMainWindowHelpButton", baseframe, "MainHelpPlateButton") diff --git a/gumps/janela_report.lua b/gumps/janela_report.lua index f769aa53..4f7cdbb1 100644 --- a/gumps/janela_report.lua +++ b/gumps/janela_report.lua @@ -202,28 +202,86 @@ local _UISpecialFrames = UISpecialFrames --> wow api locals --> dropdown menus - local function cria_drop_down (este_gump) +local function cria_drop_down (este_gump) - local selecionar = _CreateFrame ("Button", "Details_Report_DropDown", este_gump, "UIDropDownMenuTemplate") - este_gump.select = selecionar - - selecionar:SetPoint ("topleft", este_gump, "topleft", 93, -53) + --local selecionar = _CreateFrame ("Button", "Details_Report_DropDown", este_gump, "UIDropDownMenuTemplate") + --este_gump.select = selecionar + --selecionar:SetPoint ("topleft", este_gump, "topleft", 93, -53) - local function OnClick (self) - _UIDropDownMenu_SetSelectedID (selecionar, self:GetID()) - _detalhes.report_where = self.value + --local function OnClick (self) + -- _UIDropDownMenu_SetSelectedID (selecionar, self:GetID()) + -- _detalhes.report_where = self.value + --end + +--[[ +Emote: 255 251 255 +Yell: 255 63 64 +Guild Chat: 64 251 64 +Officer Chat: 64 189 64 +Achievement: 255 251 0 +Whisper: 255 126 255 +RealID: 0 251 246 +Party: 170 167 255 +Party Lead: 118 197 255 +Raid: 255 125 0 +Raid Warning: 255 71 0 +Raid Lead: 255 71 9 +BG Leader: 255 216 183 +General/Trade: 255 189 192 +--]] + +local iconsize = {16, 16} + +local lista = { +{Loc ["STRING_REPORTFRAME_PARTY"], "PARTY", function() return GetNumSubgroupMembers() > 0 end, {iconsize = iconsize, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], coords = {0.53125, 0.7265625, 0.078125, 0.40625}, color = {0.66, 0.65, 1}}}, +{Loc ["STRING_REPORTFRAME_RAID"], "RAID", _IsInRaid, {iconsize = iconsize, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], coords = {0.53125, 0.7265625, 0.078125, 0.40625}, color = {1, 0.49, 0}}}, +{Loc ["STRING_REPORTFRAME_GUILD"], "GUILD", _IsInGuild, {iconsize = iconsize, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], coords = {0.8046875, 0.96875, 0.125, 0.390625}, color = {0.25, 0.98, 0.25}}}, +{Loc ["STRING_REPORTFRAME_OFFICERS"], "OFFICER", _IsInGuild, {iconsize = iconsize, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], coords = {0.8046875, 0.96875, 0.125, 0.390625}, color = {0.25, 0.74, 0.25}}}, +{Loc ["STRING_REPORTFRAME_WHISPER"], "WHISPER", nil, {iconsize = iconsize, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], coords = {0.0546875, 0.1953125, 0.625, 0.890625}, color = {1, 0.49, 1}}}, +{Loc ["STRING_REPORTFRAME_WHISPERTARGET"], "WHISPER2", nil, {iconsize = iconsize, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], coords = {0.0546875, 0.1953125, 0.625, 0.890625}, color = {1, 0.49, 1}}}, +{Loc ["STRING_REPORTFRAME_SAY"], "SAY", nil, {iconsize = iconsize, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], coords = {0.0390625, 0.203125, 0.09375, 0.375}, color = {1, 1, 1}}}, +{Loc ["STRING_REPORTFRAME_COPY"], "COPY", nil, {iconsize = iconsize, icon = [[Interface\Buttons\UI-GuildButton-PublicNote-Disabled]], coords = {0, 1, 0, 1}, color = {1, 1, 1}}}, +} + + local on_click = function (self, fixedParam, selectedOutput) + _detalhes.report_where = selectedOutput end + + local build_list = function() + + local output_array = {} + + for index, case in ipairs (lista) do + if (not case [3] or case [3]()) then + output_array [#output_array + 1] = {iconsize = case [4].iconsize, value = case [2], label = case [1], onclick = on_click, icon = case [4].icon, texcoord = case [4].coords, iconcolor = case [4].color} + end + end + + local channels = {_GetChannelList()} --> coloca o resultado em uma tabela .. {id1, canal1, id2, canal2} + for i = 1, #channels, 2 do --> total de canais + + output_array [#output_array + 1] = {iconsize = iconsize, value = "CHANNEL|"..channels [i+1], label = channels [i]..". "..channels [i+1], onclick = on_click, icon = [[Interface\FriendsFrame\UI-Toast-ToastIcons]], texcoord = {0.3046875, 0.4453125, 0.109375, 0.390625}, iconcolor = {149/255, 112/255, 112/255}} + + --lista [#lista+1] = {channels [i]..". "..channels [i+1], "CHANNEL|"..channels [i+1]} + end + + local bnet_friends = {} + + local BnetFriends = BNGetNumFriends() + for i = 1, BnetFriends do + local presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, broadcastTime, canSoR = BNGetFriendInfo (i) + if (isOnline) then + output_array [#output_array + 1] = {iconsize = iconsize, value = "REALID|" .. presenceID, label = presenceName, onclick = on_click, icon = [[Interface\FriendsFrame\Battlenet-Battleneticon]], texcoord = {0.125, 0.875, 0.125, 0.875}, iconcolor = {1, 1, 1}} + end + end + + return output_array + end + + local select_output = gump:NewDropDown (este_gump, _, "$parentOutputDropdown", "select", 185, 20, build_list, 1) + select_output:SetPoint ("topleft", este_gump, "topleft", 107, -55) + este_gump.select = select_output.widget - local lista = { - {Loc ["STRING_REPORTFRAME_PARTY"], "PARTY", function() return GetNumSubgroupMembers() > 0 end}, - {Loc ["STRING_REPORTFRAME_RAID"], "RAID", _IsInRaid}, - {Loc ["STRING_REPORTFRAME_GUILD"], "GUILD", _IsInGuild}, - {Loc ["STRING_REPORTFRAME_OFFICERS"], "OFFICER", _IsInGuild}, - {Loc ["STRING_REPORTFRAME_WHISPER"], "WHISPER"}, - {Loc ["STRING_REPORTFRAME_WHISPERTARGET"], "WHISPER2"}, - {Loc ["STRING_REPORTFRAME_SAY"], "SAY"}, - {Loc ["STRING_REPORTFRAME_COPY"], "COPY"}, - } local function initialize (self, level) local info = _UIDropDownMenu_CreateInfo() @@ -236,6 +294,16 @@ local _UISpecialFrames = UISpecialFrames --> wow api locals for i = 1, #channels, 2 do --> total de canais lista [#lista+1] = {channels [i]..". "..channels [i+1], "CHANNEL|"..channels [i+1]} end + + local BnetFriends = BNGetNumFriends() + for i = 1, BnetFriends do + local presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, broadcastTime, canSoR = BNGetFriendInfo (i) + if (isOnline) then + lista [#lista+1] = {presenceName, "REALID|" .. presenceID, nil, [[Interface\FriendsFrame\Battlenet-Battleneticon]]} + end + end + + --BNSendWhisper for index, v in _pairs (lista) do @@ -243,18 +311,19 @@ local _UISpecialFrames = UISpecialFrames --> wow api locals info = _UIDropDownMenu_CreateInfo() info.text = v[1] info.value = v[2] + + if (v[4]) then + info.icon = v[4] + end + info.func = OnClick _UIDropDownMenu_AddButton (info, level) end end end - _UIDropDownMenu_Initialize (selecionar, initialize) - _UIDropDownMenu_SetWidth (selecionar, 165) - _UIDropDownMenu_SetButtonWidth (selecionar, 120) - _UIDropDownMenu_SetSelectedValue (selecionar, "WHISPER") _detalhes.report_where = "WHISPER" - _UIDropDownMenu_JustifyText (selecionar, "LEFT") + end --> slider @@ -331,7 +400,7 @@ local _UISpecialFrames = UISpecialFrames --> wow api locals este_gump.wisp_who:SetText (Loc ["STRING_REPORTFRAME_WHISPER"] .. ":") este_gump.wisp_who:SetTextColor (1, 1, 1, 1) - este_gump.wisp_who:SetPoint ("topleft", este_gump.select, "topleft", 28, -30) + este_gump.wisp_who:SetPoint ("topleft", este_gump.select, "topleft", 14, -30) _detalhes:SetFontSize (este_gump.wisp_who, 10) @@ -342,7 +411,7 @@ local _UISpecialFrames = UISpecialFrames --> wow api locals editbox:SetAutoFocus (false) editbox:SetFontObject ("GameFontHighlightSmall") - editbox:SetPoint ("TOPLEFT", este_gump.select, "TOPLEFT", 78, -28) + editbox:SetPoint ("TOPLEFT", este_gump.select, "TOPLEFT", 64, -28) editbox:SetHeight (14) editbox:SetWidth (120) diff --git a/gumps/janela_welcome.lua b/gumps/janela_welcome.lua index fe3c22ce..a36c2780 100644 --- a/gumps/janela_welcome.lua +++ b/gumps/janela_welcome.lua @@ -319,7 +319,7 @@ function _detalhes:OpenWelcomeWindow () if (_detalhes.time_type == 1) then --> chronometer chronometer:SetChecked (true) continuous:SetChecked (false) - elseif (_detalhes.time_type == 1) then --> continuous + elseif (_detalhes.time_type == 2) then --> continuous chronometer:SetChecked (false) continuous:SetChecked (true) end @@ -701,6 +701,8 @@ function _detalhes:OpenWelcomeWindow () skin_dropdown:SetPoint ("left", skin_label, "right", 2) skin_label:SetPoint ("topleft", window, "topleft", 30, -140) + skin_dropdown:Select ("Default Skin") + --wallpapper --> agora cria os 2 dropdown da categoria e wallpaper diff --git a/locales/Details-enUS.lua b/locales/Details-enUS.lua index fef8a29d..408085d4 100644 --- a/locales/Details-enUS.lua +++ b/locales/Details-enUS.lua @@ -3,7 +3,7 @@ if not Loc then return end -------------------------------------------------------------------------------------------------------------------------------------------- - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v1.11.10|r\n\n|cFFFFFF00-|r Accuracy with warcraftlogs.com now is very high and okey with worldoflogs.com. Make sure the option |cFFFFDD00Time Measure|r under General Settings -> Combat is set to |cFFFFDD00Effective Time|r.\n\n|cFFFFFF00-|r Options Window has been revamped, again.\n\n|cFFFFFF00-|r Added a option for change the class icons.\n\n|cFFFFFF00-|r Added options for show Total Bar and configure it.\n\n|cFFFFFF00-|r Added a option for save a Standard Skin, new windows opened use this skin.\n\n|cFFFFFF00-|r Added a new skin: ElvUI Frame Style.\n\n|cFFFFFF00-|r When hover a spell icon under Player Details Window, the spell description is shown.\n\n|cFFFFFF00-|r Pressing Shift key on a spell bar over the Encounter Details Window, shows up the spell description.\n\n|cFFFFFF00v1.11.6|r\n\n|cFFFFFF00-|r Added new skin: Minimalistic, a very clean one.\n\n|cFFFFFF00-|r Added a new tab called avoidance on Player Details window for tanks.\n\n|cFFFFFF00-|r Added Copy & Paste option on report window. Now you can share your dps on twitter and facebook!\n\n|cFFFFFF00-|r Added a new option for auto switch what a window shows when you enter in a combat.\n\n|cFFFFFF00-|r Fixed issue with window background alpha which was changing the value everytime the options window is opened.\n\n|cFFFFFF00-|r Fixed the gap between the bar and the window background when disabling borders.\n\n|cFFFFFF00-|r Make some improvements on Tiny Threat plugin.\n\n|cFFFFFF00v1.11.3|r\n\n|cFFFFFF00-|r Fixed more known issues with skins.\n\n|cFFFFFF00-|r Fixed an issue where plugin icons wasn't hiding after close all windows.\n\n|cFFFFFF00v1.11.2|r\n\n|cFFFFFF00-|r Fixed bugs where Details! stop working if no plugin is actived on Wow addon panel.\n\n|cFFFFFF00v1.11.0|r\n\n|cFFFFFF00-|r Added an option for abbreviate Dps and Hps.\n\n|cFFFFFF00-|r Fixed issue where the window icon fade away when reopening the window.\n\n|cFFFFFF00-|r Improvements in class recognition.\n\n|cFFFFFF00-|r Added follow spells as defensive cooldowns:\nHealing Tide Totem, Spirit Link Totem, Demoralizing Banner, Mass Spell Reflection and Shield Block.\n\n|cFFFFFF00-|r More improvements done in Encounter Details plugin.\n\n|cFFFFFF00-|r Improvements made in the downloadable plugins: Timeline and Advanced Death Logs.\n\n|cFFFFFF00v1.10.0|r\n\n|cFFFFFF00-|r Fixed a issue with overall data Dps when have only one segment.\n\n|cFFFFFF00-|r Changed colors and added some backgrounds for menus.\n\n|cFFFFFF00-|r Options panel has his height size increased.\n\n|cFFFFFF00-|r Added options for hide the window or change the transparency when in combat.\n\n|cFFFFFF00-|r Added a control panel for plugins, where you can enable or disable then.\n\n|cFFFFFF00v1.9.5|r\n\n|cFFFFFF00-|r More fixes on Skins support and new tools for plugins.|r\n\n|cFFFFFF00v1.9.4|r\n\n|cFFFFFF00-|r Minor bug fixes and improvements on Welcome Screen.\n\n|cFFFFFF00v1.9.3|r\n\n|cFFFFFF00-|r The bar now starts after the icon instead of left window border.\n\n|cFFFFFF00-|r Welcome window now is localizated to others languages\n\n|cFFFFFF00-|r Fixed issue with Damage Rank Plugin.\n\n|cFFFFFF00v1.9.1|r\n\n|cFFFFFF00-|r fixed issue with main window icon when no plugin installed. \n\n|cFFFFFF00-|r fixed issue with some options button text which where out of positioning." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v1.12.0|r\n\n|cFFFFFF00-|r Added support to Profiles, now you can share the same config between two or more characters.\n\n|cFFFFFF00-|r Added support for BattleTag friends over report window.\n\n|cFFFFFF00-|r Added pet threat to Tiny Threat plugin when out of a party or raid group.\n\n|cFFFFFF00-|r Fixed a issue with close button where it disappear without close the window when toolbar is in bottom side.\n\n|cFFFFFF00-|r Also fixed a issue where swapping toolbar positioning was sometimes making close button disappear.\n\n|cFFFFFF00-|r Fixed a problem opening options panel through minimap when there is no window opened.\n\n|cFFFFFF00v1.11.10|r\n\n|cFFFFFF00-|r Accuracy with warcraftlogs.com now is very high and okey with worldoflogs.com. Make sure the option |cFFFFDD00Time Measure|r under General Settings -> Combat is set to |cFFFFDD00Effective Time|r.\n\n|cFFFFFF00-|r Options Window has been revamped, again.\n\n|cFFFFFF00-|r Added a option for change the class icons.\n\n|cFFFFFF00-|r Added options for show Total Bar and configure it.\n\n|cFFFFFF00-|r Added a option for save a Standard Skin, new windows opened use this skin.\n\n|cFFFFFF00-|r Added a new skin: ElvUI Frame Style.\n\n|cFFFFFF00-|r When hover a spell icon under Player Details Window, the spell description is shown.\n\n|cFFFFFF00-|r Pressing Shift key on a spell bar over the Encounter Details Window, shows up the spell description.\n\n|cFFFFFF00v1.11.6|r\n\n|cFFFFFF00-|r Added new skin: Minimalistic, a very clean one.\n\n|cFFFFFF00-|r Added a new tab called avoidance on Player Details window for tanks.\n\n|cFFFFFF00-|r Added Copy & Paste option on report window. Now you can share your dps on twitter and facebook!\n\n|cFFFFFF00-|r Added a new option for auto switch what a window shows when you enter in a combat.\n\n|cFFFFFF00-|r Fixed issue with window background alpha which was changing the value everytime the options window is opened.\n\n|cFFFFFF00-|r Fixed the gap between the bar and the window background when disabling borders.\n\n|cFFFFFF00-|r Make some improvements on Tiny Threat plugin.\n\n|cFFFFFF00v1.11.3|r\n\n|cFFFFFF00-|r Fixed more known issues with skins.\n\n|cFFFFFF00-|r Fixed an issue where plugin icons wasn't hiding after close all windows.\n\n|cFFFFFF00v1.11.2|r\n\n|cFFFFFF00-|r Fixed bugs where Details! stop working if no plugin is actived on Wow addon panel.\n\n|cFFFFFF00v1.11.0|r\n\n|cFFFFFF00-|r Added an option for abbreviate Dps and Hps.\n\n|cFFFFFF00-|r Fixed issue where the window icon fade away when reopening the window.\n\n|cFFFFFF00-|r Improvements in class recognition.\n\n|cFFFFFF00-|r Added follow spells as defensive cooldowns:\nHealing Tide Totem, Spirit Link Totem, Demoralizing Banner, Mass Spell Reflection and Shield Block.\n\n|cFFFFFF00-|r More improvements done in Encounter Details plugin.\n\n|cFFFFFF00-|r Improvements made in the downloadable plugins: Timeline and Advanced Death Logs.\n\n|cFFFFFF00v1.10.0|r\n\n|cFFFFFF00-|r Fixed a issue with overall data Dps when have only one segment.\n\n|cFFFFFF00-|r Changed colors and added some backgrounds for menus.\n\n|cFFFFFF00-|r Options panel has his height size increased.\n\n|cFFFFFF00-|r Added options for hide the window or change the transparency when in combat.\n\n|cFFFFFF00-|r Added a control panel for plugins, where you can enable or disable then.\n\n|cFFFFFF00v1.9.5|r\n\n|cFFFFFF00-|r More fixes on Skins support and new tools for plugins.|r\n\n|cFFFFFF00v1.9.4|r\n\n|cFFFFFF00-|r Minor bug fixes and improvements on Welcome Screen." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails:|r " --> color and details name @@ -638,6 +638,27 @@ Loc ["STRING_OPTIONS_BARGROW_DIRECTION_DESC"] = "Change the bars grow method.." Loc ["STRING_OPTIONS_BARSORT_DIRECTION"] = "Sort Direction" Loc ["STRING_OPTIONS_BARSORT_DIRECTION_DESC"] = "Change the order which characters are shown within the bars." +Loc ["STRING_OPTIONS_PROFILES_TITLE"] = "Profiles" +Loc ["STRING_OPTIONS_PROFILES_TITLE_DESC"] = "This options allow you share the same settings between different characters." + +Loc ["STRING_OPTIONS_PROFILES_CURRENT"] = "Current Profile:" +Loc ["STRING_OPTIONS_PROFILES_CURRENT_DESC"] = "This is the current actived profile name." + +Loc ["STRING_OPTIONS_PROFILES_SELECT"] = "Select Profile" +Loc ["STRING_OPTIONS_PROFILES_SELECT_DESC"] = "Allows you change the current profile overwriting all your current settings.\n\nProfiles are useful if you desire shared settings between more then one character." + +Loc ["STRING_OPTIONS_PROFILES_CREATE"] = "Create Profile" +Loc ["STRING_OPTIONS_PROFILES_CREATE_DESC"] = "Create a new empty profile." + +Loc ["STRING_OPTIONS_PROFILES_COPY"] = "Copy Profile From" +Loc ["STRING_OPTIONS_PROFILES_COPY_DESC"] = "Copy all settings from the selected profile to current profile overwriting all values." + +Loc ["STRING_OPTIONS_PROFILES_ERASE"] = "Remove Profile" +Loc ["STRING_OPTIONS_PROFILES_ERASE_DESC"] = "Remove the selected profile." + +Loc ["STRING_OPTIONS_PROFILES_RESET"] = "Reset Current Profile" +Loc ["STRING_OPTIONS_PROFILES_RESET_DESC"] = "Reset all settings." + Loc ["STRING_OPTIONS_WP"] = "Wallpaper Settings" Loc ["STRING_OPTIONS_WP_DESC"] = "This options control the wallpaper of instance." diff --git a/locales/Details-ptBR.lua b/locales/Details-ptBR.lua index fa9b5a79..5b020652 100644 --- a/locales/Details-ptBR.lua +++ b/locales/Details-ptBR.lua @@ -3,7 +3,7 @@ if not Loc then return end -------------------------------------------------------------------------------------------------------------------------------------------- - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v1.11.10|r\n\n|cFFFFFF00-|r Accuracy with warcraftlogs.com now is very high and okey with worldoflogs.com. Make sure the option |cFFFFDD00Time Measure|r under General Settings -> Combat is set to |cFFFFDD00Effective Time|r.\n\n|cFFFFFF00-|r Options Window has been revamped, again.\n\n|cFFFFFF00-|r Added a option for change the class icons.\n\n|cFFFFFF00-|r Added options for show Total Bar and configure it.\n\n|cFFFFFF00-|r Added a option for save a Standard Skin, new windows opened use this skin.\n\n|cFFFFFF00-|r Added a new skin: ElvUI Frame Style.\n\n|cFFFFFF00-|r When hover a spell icon under Player Details Window, the spell description is shown.\n\n|cFFFFFF00-|r Pressing Shift key on a spell bar over the Encounter Details Window, shows up the spell description.\n\n|cFFFFFF00v1.11.6|r\n\n|cFFFFFF00-|r Adicionado nova skin: Minimalistic.\n\n|cFFFFFF00-|r Adicionado nova aba chamada avoidance no painel de detalhes do jogador apenas para tanques.\n\n|cFFFFFF00-|r Adicionado opcao de Copiar e Coloar na janela de criar relatorios. Agora voce pode dizer seu dps aos seus amigos no twitter e facebook!\n\n|cFFFFFF00-|r Adicionada nova opcao de troca o que uma janela esta mostrando quando voce entrar em combate.\n\n|cFFFFFF00-|r Corrigido problema com a transparencia da janela onde ela mudava sozinha sempre que a janela de opcoes eta aberta.\n\n|cFFFFFF00-|r Corrigido o vao em branco que ficava entre o inicio de uma barra e o fundo da janela quando as bordas eram desligadas.\n\n|cFFFFFF00-|r Feito algumas melhorias no plugin Tiny Threat.\n\n|cFFFFFF00v1.11.3|r\n\n|cFFFFFF00-|r Corrigido mais problemas conhecidos com as Skins.\n\n|cFFFFFF00-|r Corrigido problema onde os icones dos plugins nao eram escondidos apos fechar todas as janelas.\n\n|cFFFFFF00v1.11.2|r\n\n|cFFFFFF00-|r Corrigido problemas onde o Details! parava de funcionar se nenhum plugin estiver ligado no painel de addons do Wow.|cFFFFFF00v1.11.0|r\n\n|cFFFFFF00-|r Adicionado opcao para abreviar o Dps e o Hps.\n\n|cFFFFFF00-|r Corrigido um problema onde o icone da janela desaparecia ao reabri-la.\n\n|cFFFFFF00-|r Melhorias no reconhecimento das classes.\n\n|cFFFFFF00-|r As seguintes magias foram adicionadas como cooldowns: Healing Tide Totem, Spirit Link Totem, Demoralizing Banner, Mass Spell Reflection and Shield Block.\n\n|cFFFFFF00-|r Mais melhorias feitas no plugin Encounter Details.\n\n|cFFFFFF00-|r Melhorias feitas nos plugins disponiveis para download: Timeline e Advanced Death Logs.\n\n|cFFFFFF00v1.10.0|r\n\n|cFFFFFF00-|r Corrigido um problema no Dps no segmento total quando existia apenas 1 segmento.\n\n|cFFFFFF00-|r Cores e imagem de fundo dos menus foram alterados.\n\n|cFFFFFF00-|r A altura do painel de opcoes foi aumentada.\n\n|cFFFFFF00-|r Adicionada opcao para esconder ou alterar a transparencia da janela quando estiver em combate.\n\n|cFFFFFF00-|r Adicionado um painel de controle de plugins para ativar ou desativa-los.\n\n|cFFFFFF00v1.9.5|r\n\n|cFFFFFF00-|rMais correcoes para as Skins e suporte a novos plugins.|r\n\n|cFFFFFF00v1.9.4|r\n\n|cFFFFFF00-|r Pequenas correcoes e melhorias na tela de boas vindas.\n\n|cFFFFFF00v1.9.3|r\n\n|cFFFFFF00-|r A barra agora comeca apos o icone e nao mais na borda esquerda da janela.\n\n|cFFFFFF00-|r Janela de boas vindas agora esta traduzida para outros idiomas.\n\n|cFFFFFF00-|r Corrigido o problema que estava afetando o plugin de Rank de Dano.\n\n|cFFFFFF00v1.9.1|r\n\n|cFFFFFF00-|r corrigido problema do icone na janela principal quando nao havia nenhum plugin instalado. \n\n|cFFFFFF00-|r corrigido problema com alguns botoes no painel de opcoes onde o texto estava fora do lugar.\n\n|cFFFFFF00-|r corrigido a posicao dos sub menus quando proximos a borda direita do monitor.\n\n|cFFFFFF00-|r corrigida a posicao do botao de fechar do skin padrao.\n\n|cFFFFFF00-|r corrigido um erro nas skins ao selecionar um plugin de raide ou solo.|cFFFFFF00v1.9.0|r\n\n|cFFFFFF00-|r Corrigido o problema de nao movimentar o botao no minimapa.\n\n|cFFFFFF00-|r Suporte a skins foi reescrito e agora ficou mais flexivel.\n\n|cFFFFFF00-|r Adicionadas mais de 20 opcoes de customizacao no painel de opcoes.\n\n|cFFFFFF00v1.8.4|r\n\n|cFFFFFF00-|r Adicionado comando 'details reinstalar' no qual limpa a configuracao do Details! em caso de erros.\n\n|cFFFFFF00v1.8.3|r\n\n|cFFFFFF00-|r Adicionada nova skin: Simple Gray.\n\n|cFFFFFF00-|r Adicionado botoes para o Details! no minimapa e menu de addons no painel de intercace.\n\n|cFFFFFF00-|r Adicionados novas bolhas de tutoriais para aspectos basicos das janelas do Details!.\n\n|cFFFFFF00-|r Corrigido o Modo Panico aonde as vezes ele nao era disparado." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v1.12.0|r\n\n|cFFFFFF00-|r Added support to Profiles, now you can share the same config between two or more characters.\n\n|cFFFFFF00-|r Added support for BattleTag friends over report window.\n\n|cFFFFFF00-|r Added pet threat to Tiny Threat plugin when out of a party or raid group.\n\n|cFFFFFF00-|r Fixed a issue with close button where it disappear without close the window when toolbar is in bottom side.\n\n|cFFFFFF00-|r Also fixed a issue where swapping toolbar positioning was sometimes making close button disappear.\n\n|cFFFFFF00-|r Fixed a problem opening options panel through minimap when there is no window opened.\n\n|cFFFFFF00v1.11.10|r\n\n|cFFFFFF00-|r Accuracy with warcraftlogs.com now is very high and okey with worldoflogs.com. Make sure the option |cFFFFDD00Time Measure|r under General Settings -> Combat is set to |cFFFFDD00Effective Time|r.\n\n|cFFFFFF00-|r Options Window has been revamped, again.\n\n|cFFFFFF00-|r Added a option for change the class icons.\n\n|cFFFFFF00-|r Added options for show Total Bar and configure it.\n\n|cFFFFFF00-|r Added a option for save a Standard Skin, new windows opened use this skin.\n\n|cFFFFFF00-|r Added a new skin: ElvUI Frame Style.\n\n|cFFFFFF00-|r When hover a spell icon under Player Details Window, the spell description is shown.\n\n|cFFFFFF00-|r Pressing Shift key on a spell bar over the Encounter Details Window, shows up the spell description.\n\n|cFFFFFF00v1.11.6|r\n\n|cFFFFFF00-|r Adicionado nova skin: Minimalistic.\n\n|cFFFFFF00-|r Adicionado nova aba chamada avoidance no painel de detalhes do jogador apenas para tanques.\n\n|cFFFFFF00-|r Adicionado opcao de Copiar e Coloar na janela de criar relatorios. Agora voce pode dizer seu dps aos seus amigos no twitter e facebook!\n\n|cFFFFFF00-|r Adicionada nova opcao de troca o que uma janela esta mostrando quando voce entrar em combate.\n\n|cFFFFFF00-|r Corrigido problema com a transparencia da janela onde ela mudava sozinha sempre que a janela de opcoes eta aberta.\n\n|cFFFFFF00-|r Corrigido o vao em branco que ficava entre o inicio de uma barra e o fundo da janela quando as bordas eram desligadas.\n\n|cFFFFFF00-|r Feito algumas melhorias no plugin Tiny Threat.\n\n|cFFFFFF00v1.11.3|r\n\n|cFFFFFF00-|r Corrigido mais problemas conhecidos com as Skins.\n\n|cFFFFFF00-|r Corrigido problema onde os icones dos plugins nao eram escondidos apos fechar todas as janelas.\n\n|cFFFFFF00v1.11.2|r\n\n|cFFFFFF00-|r Corrigido problemas onde o Details! parava de funcionar se nenhum plugin estiver ligado no painel de addons do Wow.|cFFFFFF00v1.11.0|r\n\n|cFFFFFF00-|r Adicionado opcao para abreviar o Dps e o Hps.\n\n|cFFFFFF00-|r Corrigido um problema onde o icone da janela desaparecia ao reabri-la.\n\n|cFFFFFF00-|r Melhorias no reconhecimento das classes.\n\n|cFFFFFF00-|r As seguintes magias foram adicionadas como cooldowns: Healing Tide Totem, Spirit Link Totem, Demoralizing Banner, Mass Spell Reflection and Shield Block.\n\n|cFFFFFF00-|r Mais melhorias feitas no plugin Encounter Details.\n\n|cFFFFFF00-|r Melhorias feitas nos plugins disponiveis para download: Timeline e Advanced Death Logs.\n\n|cFFFFFF00v1.10.0|r\n\n|cFFFFFF00-|r Corrigido um problema no Dps no segmento total quando existia apenas 1 segmento.\n\n|cFFFFFF00-|r Cores e imagem de fundo dos menus foram alterados.\n\n|cFFFFFF00-|r A altura do painel de opcoes foi aumentada.\n\n|cFFFFFF00-|r Adicionada opcao para esconder ou alterar a transparencia da janela quando estiver em combate.\n\n|cFFFFFF00-|r Adicionado um painel de controle de plugins para ativar ou desativa-los.\n\n|cFFFFFF00v1.9.5|r\n\n|cFFFFFF00-|rMais correcoes para as Skins e suporte a novos plugins.|r\n\n|cFFFFFF00v1.9.4|r\n\n|cFFFFFF00-|r Pequenas correcoes e melhorias na tela de boas vindas.\n\n|cFFFFFF00v1.9.3|r\n\n|cFFFFFF00-|r A barra agora comeca apos o icone e nao mais na borda esquerda da janela.\n\n|cFFFFFF00-|r Janela de boas vindas agora esta traduzida para outros idiomas.\n\n|cFFFFFF00-|r Corrigido o problema que estava afetando o plugin de Rank de Dano.\n\n|cFFFFFF00v1.9.1|r\n\n|cFFFFFF00-|r corrigido problema do icone na janela principal quando nao havia nenhum plugin instalado. \n\n|cFFFFFF00-|r corrigido problema com alguns botoes no painel de opcoes onde o texto estava fora do lugar.\n\n|cFFFFFF00-|r corrigido a posicao dos sub menus quando proximos a borda direita do monitor.\n\n|cFFFFFF00-|r corrigida a posicao do botao de fechar do skin padrao.\n\n|cFFFFFF00-|r corrigido um erro nas skins ao selecionar um plugin de raide ou solo.|cFFFFFF00v1.9.0|r\n\n|cFFFFFF00-|r Corrigido o problema de nao movimentar o botao no minimapa.\n\n|cFFFFFF00-|r Suporte a skins foi reescrito e agora ficou mais flexivel.\n\n|cFFFFFF00-|r Adicionadas mais de 20 opcoes de customizacao no painel de opcoes." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetalhes:|r " --> color and details name diff --git a/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua b/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua index c865c9ed..257a4fca 100644 --- a/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua +++ b/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua @@ -385,7 +385,7 @@ local siege_of_orgrimmar = { portrait = [[Interface\EncounterJournal\UI-EJ-BOSS-Norushen]], --combat_end = {1, 72276}, - encounter_start = {delay = 25}, + encounter_start = {delay = 0}, equalize = true, spell_mechanics = { diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.lua b/plugins/Details_TinyThreat/Details_TinyThreat.lua index a0b4c3e7..4dc266f9 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.lua +++ b/plugins/Details_TinyThreat/Details_TinyThreat.lua @@ -288,6 +288,8 @@ local function CreatePluginFrames (data) end else + + --> player local thisplayer_name = GetUnitName ("player", true) local threat_table_index = ThreatMeter.player_list_hash [thisplayer_name] local threat_table = ThreatMeter.player_list_indexes [threat_table_index] @@ -300,6 +302,24 @@ local function CreatePluginFrames (data) threat_table [2] = 0 threat_table [3] = false end + + --> pet + if (UnitExists ("pet")) then + local thisplayer_name = GetUnitName ("pet", true) .. " *PET*" + local threat_table_index = ThreatMeter.player_list_hash [thisplayer_name] + local threat_table = ThreatMeter.player_list_indexes [threat_table_index] + + if (threat_table) then + local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("pet", "target") + if (status) then + threat_table [2] = threatpct + threat_table [3] = isTanking + else + threat_table [2] = 0 + threat_table [3] = false + end + end + end end --> sort @@ -314,10 +334,6 @@ local function CreatePluginFrames (data) return end - --and ThreatMeter.player_list_indexes [1] [2] > 0 - -- ThreatMeter.player_list_indexes = {} - -- ThreatMeter.player_list_hash = {} - local lastIndex = 0 local shownMe = false @@ -447,9 +463,16 @@ local function CreatePluginFrames (data) ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes + if (UnitExists ("pet")) then + local thispet_name = GetUnitName ("pet", true) .. " *PET*" + local role = "DAMAGER" + local t = {thispet_name, 0, false, role, class} + ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t + ThreatMeter.player_list_hash [thispet_name] = #ThreatMeter.player_list_indexes + end end - local job_thread = ThreatMeter:ScheduleRepeatingTimer ("Tick", 1) + local job_thread = ThreatMeter:ScheduleRepeatingTimer ("Tick", ThreatMeter.options.updatespeed) ThreatMeter.job_thread = job_thread end end @@ -500,7 +523,7 @@ function ThreatMeter:OnEvent (_, event, ...) local MINIMAL_DETAILS_VERSION_REQUIRED = 1 --> Install - local install = _G._detalhes:InstallPlugin ("TANK", Loc ["STRING_PLUGIN_NAME"], "Interface\\Icons\\Ability_Paladin_ShieldofVengeance", ThreatMeter, "DETAILS_PLUGIN_TINY_THREAT", MINIMAL_DETAILS_VERSION_REQUIRED, "Details! Team", "v1.02") + local install, saveddata = _G._detalhes:InstallPlugin ("TANK", Loc ["STRING_PLUGIN_NAME"], "Interface\\Icons\\Ability_Paladin_ShieldofVengeance", ThreatMeter, "DETAILS_PLUGIN_TINY_THREAT", MINIMAL_DETAILS_VERSION_REQUIRED, "Details! Team", "v1.04") if (type (install) == "table" and install.error) then print (install.error) end @@ -516,12 +539,57 @@ function ThreatMeter:OnEvent (_, event, ...) ThreatMeterFrame:RegisterEvent ("PLAYER_TARGET_CHANGED") ThreatMeterFrame:RegisterEvent ("PLAYER_REGEN_DISABLED") ThreatMeterFrame:RegisterEvent ("PLAYER_REGEN_ENABLED") + + --> Saved data + ThreatMeter.saveddata = saveddata or {} + + ThreatMeter.saveddata.updatespeed = ThreatMeter.saveddata.updatespeed or 1 + ThreatMeter.saveddata.animate = ThreatMeter.saveddata.animate or false + ThreatMeter.saveddata.showamount = ThreatMeter.saveddata.showamount or false + + ThreatMeter.options = ThreatMeter.saveddata + + --> Register slash commands + SLASH_DETAILS_TINYTHREAT1, SLASH_DETAILS_TINYTHREAT2 = "/tinythreat", "/tt" + + function SlashCmdList.DETAILS_TINYTHREAT (msg, editbox) + + local command, rest = msg:match("^(%S*)%s*(.-)$") + + if (command == Loc ["STRING_SLASH_ANIMATE"]) then + + elseif (command == Loc ["STRING_SLASH_SPEED"]) then + + if (rest) then + local speed = tonumber (rest) + if (speed) then + if (speed > 3) then + speed = 3 + elseif (speed < 0.3) then + speed = 0.3 + end + + ThreatMeter.saveddata.updatespeed = speed + ThreatMeter:Msg (Loc ["STRING_SLASH_SPEED_CHANGED"] .. speed) + else + ThreatMeter:Msg (Loc ["STRING_SLASH_SPEED_CURRENT"] .. ThreatMeter.saveddata.updatespeed) + end + end + + elseif (command == Loc ["STRING_SLASH_AMOUNT"]) then + + else + + ThreatMeter:Msg (Loc ["STRING_COMMAND_LIST"]) + print ("|cffffaeae/tinythreat " .. Loc ["STRING_SLASH_SPEED"] .. "|r: " .. Loc ["STRING_SLASH_SPEED_DESC"]) + + end + + + end end end - elseif (event == "PLAYER_LOGOUT") then - _detalhes_databaseThreat = ThreatMeter.data - end end diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.toc b/plugins/Details_TinyThreat/Details_TinyThreat.toc index 3285696e..4cc2d7fe 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.toc +++ b/plugins/Details_TinyThreat/Details_TinyThreat.toc @@ -1,7 +1,6 @@ ## Interface: 50400 ## Title: Details Tiny Threat (plugin) ## Notes: Plugin for Details -## SavedVariablesPerCharacter: _detalhes_databaseThreat ## RequiredDeps: Details ## OptionalDeps: Ace3 diff --git a/plugins/Details_TinyThreat/enUS.lua b/plugins/Details_TinyThreat/enUS.lua index 551f1354..a3002fed 100644 --- a/plugins/Details_TinyThreat/enUS.lua +++ b/plugins/Details_TinyThreat/enUS.lua @@ -4,4 +4,13 @@ if (not Loc) then return end -Loc ["STRING_PLUGIN_NAME"] = "Tiny Threat" \ No newline at end of file +Loc ["STRING_PLUGIN_NAME"] = "Tiny Threat" + +Loc ["STRING_SLASH_ANIMATE"] = "animate" +Loc ["STRING_SLASH_SPEED"] = "speed" +Loc ["STRING_SLASH_AMOUNT"] = "amount" + +Loc ["STRING_COMMAND_LIST"] = "Available Commands:" +Loc ["STRING_SLASH_SPEED_DESC"] = "Changes the frequency (in seconds) which the window is updated, allow values between 0.1 and 3.0" +Loc ["STRING_SLASH_SPEED_CHANGED"] = "Update Speed changed to " +Loc ["STRING_SLASH_SPEED_CURRENT"] = "Update Speed current value is " \ No newline at end of file diff --git a/startup.lua b/startup.lua index 390117df..29a4cff4 100644 --- a/startup.lua +++ b/startup.lua @@ -11,56 +11,9 @@ function _G._detalhes:Start() ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> details defaults - _detalhes.debug = false - local _ - --> who is - self.playername = UnitName ("player") - self.playerserial = UnitGUID ("player") - - --> player faction and enemy faction - self.faction = UnitFactionGroup ("player") - if (self.faction == PLAYER_FACTION_GROUP[0]) then --> player is horde - self.faction_against = PLAYER_FACTION_GROUP[1] --> ally - elseif (self.faction == PLAYER_FACTION_GROUP[1]) then --> player is alliance - self.faction_against = PLAYER_FACTION_GROUP[0] --> horde - end - - self.zone_type = nil - _detalhes.temp_table1 = {} - - --> combat - self.encounter = {} - self.in_combat = false - self.combat_id = self.combat_id or 0 - - --> instances (windows) - self.solo = self.solo or nil - self.raid = self.raid or nil - self.opened_windows = 0 - - self.default_texture = [[Interface\AddOns\Details\images\bar4]] - self.default_texture_name = "Details D'ictum" - - self.tooltip_max_targets = 3 - self.tooltip_max_abilities = 3 - self.tooltip_max_pets = 1 - - self.class_coords_version = 1 - self.class_colors_version = 1 - - self.school_colors = { - [1] = {1.00, 1.00, 0.00}, - [2] = {1.00, 0.90, 0.50}, - [4] = {1.00, 0.50, 0.00}, - [8] = {0.30, 1.00, 0.30}, - [16] = {0.50, 1.00, 1.00}, - [32] = {0.50, 0.50, 1.00}, - [64] = {1.00, 0.50, 1.00}, - ["unknown"] = {0.5, 0.75, 0.75, 1} - } --> parse all config - _detalhes:ApplyConfigDataOnLoad() + --_detalhes:CountDataOnLoad() --> single click row function replace --damage, dps, damage taken, friendly fire @@ -76,8 +29,7 @@ function _G._detalhes:Start() --> initialize --> build frames - --> cooltip - self.popup = DetailsCreateCoolTip() + --> fast switch if (self.switch.InitSwitch) then self.switch:InitSwitch() @@ -123,7 +75,7 @@ function _G._detalhes:Start() if (self:QuantasInstancias() == 0) then self:CriarInstancia() else - self:ReativarInstancias() + --self:ReativarInstancias() end self:GetLowerInstanceNumber() self:CheckConsolidates() @@ -242,15 +194,17 @@ function _G._detalhes:Start() function self:AnnounceVersion() for index, instancia in ipairs (self.tabela_instancias) do if (instancia.ativa) then - self.gump:Fade (instancia._version, "in", 5) + self.gump:Fade (instancia._version, "in", 0.1) end end end + --[[ if (self.tutorial.version_announce < 4) then self:ScheduleTimer ("AnnounceVersion", 20) self.tutorial.version_announce = self.tutorial.version_announce + 1 else + for index, instancia in ipairs (self.tabela_instancias) do if (instancia.ativa) then self.gump:Fade (instancia._version, 0) @@ -264,6 +218,7 @@ function _G._detalhes:Start() end end end + --]] if (self.is_first_run) then @@ -296,13 +251,16 @@ function _G._detalhes:Start() --_detalhes:OpenWelcomeWindow() + --desligado por preocaução if (self.tutorial.logons < 2) then - self:StartTutorial() + --self:StartTutorial() end --> feedback trhead - if (self.tutorial.logons > 100) then -- and self.tutorial.logons < 104 + if (self.tutorial.logons > 100 and false) then -- and self.tutorial.logons < 104 + --desligado por preocaução + if (not self.tutorial.feedback_window1) then self.tutorial.feedback_window1 = true @@ -407,6 +365,7 @@ function _G._detalhes:Start() local LDBIcon = LDB and LibStub ("LibDBIcon-1.0", true) if LDB then + local minimapIcon = LDB:NewDataObject ("Details!", { type = "data source", icon = [[Interface\AddOns\Details\images\minimap]], @@ -414,8 +373,15 @@ function _G._detalhes:Start() OnClick = function (self, button) if (button == "LeftButton") then + local lower_instance = _detalhes:GetLowerInstanceNumber() - _detalhes:OpenOptionsWindow (_detalhes:GetInstance (lower_instance)) + if (not lower_instance) then + local instance = _detalhes:GetInstance (1) + _detalhes.CriarInstancia (_, _, 1) + _detalhes:OpenOptionsWindow (instance) + else + _detalhes:OpenOptionsWindow (_detalhes:GetInstance (lower_instance)) + end elseif (button == "RightButton") then @@ -484,6 +450,7 @@ function _G._detalhes:Start() if (minimapIcon and not LDBIcon:IsRegistered ("Details!")) then LDBIcon:Register ("Details!", minimapIcon, self.minimap) + end end @@ -670,6 +637,46 @@ function _G._detalhes:Start() f:Hide() + local lower = _detalhes:GetLowerInstanceNumber() + if (lower) then + local instance = _detalhes:GetInstance (lower) + if (instance) then + + --in development + local dev_icon = instance.bgdisplay:CreateTexture (nil, "overlay") + dev_icon:SetWidth (40) + dev_icon:SetHeight (40) + dev_icon:SetPoint ("bottomleft", instance.baseframe, "bottomleft", 4, 8) + dev_icon:SetTexture ([[Interface\DialogFrame\UI-Dialog-Icon-AlertOther]]) + dev_icon:SetAlpha (.3) + + local dev_text = instance.bgdisplay:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + dev_text:SetHeight (64) + dev_text:SetPoint ("left", dev_icon, "right", 5, 0) + dev_text:SetTextColor (1, 1, 1) + dev_text:SetText ("Details is Under\nDevelopment") + dev_text:SetAlpha (.3) + + --version + self.gump:Fade (instance._version, 0) + instance._version:SetText ("Details! Alpha " .. _detalhes.userversion .. " (core: " .. self.realversion .. ")") + instance._version:SetPoint ("bottomleft", instance.baseframe, "bottomleft", 5, 1) + + if (instance.auto_switch_to_old) then + instance:SwitchBack() + end + + function _detalhes:FadeStartVersion() + _detalhes.gump:Fade (dev_icon, "in", 2) + _detalhes.gump:Fade (dev_text, "in", 2) + self.gump:Fade (instance._version, "in", 2) + end + + _detalhes:ScheduleTimer ("FadeStartVersion", 7) + + end + end + end