diff --git a/boot.lua b/boot.lua index 71b75f49..412648bd 100644 --- a/boot.lua +++ b/boot.lua @@ -8,9 +8,9 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0", "LibHotCorners") - _detalhes.userversion = "v1.16.3b" - _detalhes.version = "Alpha 019" - _detalhes.realversion = 19 + _detalhes.userversion = "v1.17.0" + _detalhes.version = "Alpha 020" + _detalhes.realversion = 20 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> initialization stuff diff --git a/classes/classe_combate.lua b/classes/classe_combate.lua index 608adfe6..f8c3370b 100644 --- a/classes/classe_combate.lua +++ b/classes/classe_combate.lua @@ -148,6 +148,9 @@ --> record last event before dead esta_tabela.last_events_tables = {} + --> players in the raid + esta_tabela.raid_roster = {} + --> frags esta_tabela.frags = {} esta_tabela.frags_need_refresh = false diff --git a/classes/classe_custom.lua b/classes/classe_custom.lua index ebd43a38..4e0a38d6 100644 --- a/classes/classe_custom.lua +++ b/classes/classe_custom.lua @@ -1,137 +1,1353 @@ -local _detalhes = _G._detalhes -local AceLocale = LibStub ("AceLocale-3.0") -local Loc = AceLocale:GetLocale ( "Details" ) +--> customized display script ---lua locals -local _cstr = string.format -local _math_floor = math.floor -local _table_sort = table.sort -local _table_insert = table.insert -local _table_size = table.getn -local _setmetatable = setmetatable -local _ipairs = ipairs -local _pairs = pairs -local _rawget= rawget -local _math_min = math.min -local _math_max = math.max -local _bit_band = bit.band -local _unpack = unpack -local _type = type - ---api locals -local _GetSpellInfo = _detalhes.getspellinfo -local _IsInRaid = IsInRaid -local _IsInGroup = IsInGroup -local _GetNumGroupMembers = GetNumGroupMembers -local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers -local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers -local _GetUnitName = GetUnitName - -local gump = _detalhes.gump -local _ - -local atributo_custom = _detalhes.atributo_custom - -function atributo_custom:RefreshWindow (instancia, _combat, forcar, exportar) - - --> partir do principio que: - -- sempre vai ter um SPELLID - -- não vai ter target ou input output - --> instancia.sub_atributo armazena o index da tabela de custons + local _detalhes = _G._detalhes + local gump = _detalhes.gump + local _ - local CustomObject = _detalhes.custom [instancia.sub_atributo] +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> local pointers - _combat.totals [CustomObject.name] = 0 - instancia.customName = CustomObject.name + local _cstr = string.format --lua local + local _math_floor = math.floor --lua local + local _table_sort = table.sort --lua local + local _table_insert = table.insert --lua local + local _table_size = table.getn --lua local + local _setmetatable = setmetatable --lua local + local _ipairs = ipairs --lua local + local _pairs = pairs --lua local + local _rawget= rawget --lua local + local _math_min = math.min --lua local + local _math_max = math.max --lua local + local _bit_band = bit.band --lua local + local _unpack = unpack --lua local + local _type = type --lua local - --print (CustomObject) - --print (CustomObject.source) - --print ("source: " .. CustomObject.source) + local _GetSpellInfo = _detalhes.getspellinfo -- api local + local _IsInRaid = IsInRaid -- api local + local _IsInGroup = IsInGroup -- api local + local _GetNumGroupMembers = GetNumGroupMembers -- api local + local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers -- api local + local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers -- api local + local _GetUnitName = GetUnitName -- api local + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> constants + + local atributo_custom = _detalhes.atributo_custom + atributo_custom.mt = {__index = atributo_custom} - if (not CustomObject.source) then - print ("Sem Source") - return - elseif (CustomObject.source == "") then - print ("Source esta em branco") - return + local combat_containers = { + ["damagedone"] = 1, + ["healdone"] = 2, + } + + --> hold the mini custom objects + atributo_custom._InstanceActorContainer = {} + atributo_custom._InstanceLastCustomShown = {} + atributo_custom._InstanceLastCombatShown = {} + atributo_custom._TargetActorsProcessed = {} + + local ToKFunctions = _detalhes.ToKFunctions + local SelectedToKFunction = ToKFunctions [1] + local UsingCustomRightText = false + local FormatTooltipNumber = ToKFunctions [8] + local TooltipMaximizedMethod = 1 + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> core + +function atributo_custom:GetCombatContainerIndex (attribute) + return combat_containers [attribute] +end + +function atributo_custom:RefreshWindow (instance, combat, force, export) + + --> get the custom object + local custom_object = instance:GetCustomObject() + + if (not custom_object) then + return instance:ResetAttribute() end - - --print ("atributo " .. CustomObject.attribute) - - if (CustomObject.source == "[raid]") then - if (_IsInRaid()) then - for i = 1, _GetNumGroupMembers(), 1 do - local nome = _GetUnitName ("raid"..i, true):gsub (("%s+"), "") - local Actor = _combat (CustomObject.attribute, nome) - if (Actor) then - Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target) - end - end - elseif (_IsInGroup()) then - for i = 1, _GetNumGroupMembers()-1, 1 do - local nome = _GetUnitName ("party"..i, true):gsub (("%s+"), "") - local Actor = _combat (CustomObject.attribute, nome) - if (Actor) then - Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target) - end - end - local Actor = _combat (CustomObject.attribute, _detalhes.playername) - if (Actor) then - Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target) - end - else - local Actor = _combat (CustomObject.attribute, _detalhes.playername) - if (Actor) then - Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target) - end - end - elseif (CustomObject.source == "[all]") then - for _, Actor in _ipairs (_combat [CustomObject.attribute]._ActorTable) do - Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target) - end + --> save the custom name in the instance + instance.customName = custom_object:GetName() - elseif (CustomObject.source == "[player]") then - local Actor = _combat (CustomObject.attribute, _detalhes.playername) - if (Actor) then - Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target) + --> get the container holding the custom actor objects for this instance + local instance_container = atributo_custom:GetInstanceCustomActorContainer (instance) + + local last_shown = atributo_custom._InstanceLastCustomShown [instance:GetId()] + if (last_shown and last_shown ~= custom_object:GetName()) then + instance_container:WipeCustomActorContainer() + end + atributo_custom._InstanceLastCustomShown [instance:GetId()] = custom_object:GetName() + + local last_combat_shown = atributo_custom._InstanceLastCombatShown [instance:GetId()] + if (last_combat_shown and last_combat_shown ~= combat) then + instance_container:WipeCustomActorContainer() + end + atributo_custom._InstanceLastCombatShown [instance:GetId()] = combat + + --> declare the main locals + local total = 0 + local top = 0 + local amount = 0 + + --> check if is a custom script + if (custom_object:IsScripted()) then + + --> be save reseting the values on every refresh + instance_container:ResetCustomActorContainer() + + --> todo: cache custom scripts + local func = loadstring (custom_object.script) + + if (not func) then + print ("error building the function.", func) end + --> call the loop function + total, top, amount = func (combat, instance_container, instance) + else - local _thisActor = _combat (CustomObject.attribute, CustomObject.source) - if (_thisActor) then - _thisActor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target) + --> get the attribute + local attribute = custom_object:GetAttribute() + + --> get the custom function (actor, source, target, spellid) + local func = atributo_custom [attribute] + + --> get the combat container + local container_index = self:GetCombatContainerIndex (attribute) + local combat_container = combat [container_index]._ActorTable + + --> build container + total, top, amount = atributo_custom:BuildActorList (func, custom_object.source, custom_object.target, custom_object.spellid, combat, combat_container, container_index, instance_container, instance, custom_object) + + end + + if (custom_object:IsSpellTarget()) then + amount = atributo_custom._TargetActorsProcessedAmt + total = atributo_custom._TargetActorsProcessedTotal + top = atributo_custom._TargetActorsProcessedTop + end + + if (amount == 0) then + if (force) then + if (instance:IsGroupMode()) then + for i = 1, instance.rows_fit_in_window do + gump:Fade (instance.barras [i], "in", 0.3) + end + end end + instance:EsconderScrollBar() + return _detalhes:EndRefresh (instance, total, combat, combat [container_index]) end - --> agora result tem os atores que usaram a habilidade - if (CustomObject.attribute == 1) then - return _detalhes.atributo_damage:RefreshWindow (instancia, _combat, forcar, exportar) - elseif (CustomObject.attribute == 2) then - return _detalhes.atributo_heal:RefreshWindow (instancia, _combat, forcar, exportar) + combat.totals [custom_object:GetName()] = total + + instance_container:Sort() + instance_container:Remap() + + if (export) then + return total, instance_container._ActorTable, top, amount end - --> aqui precisa fazer algo para retornar algo pro report reconhecer a tabela + instance:AtualizarScrollBar (amount) + + atributo_custom:Refresh (instance, instance_container, combat, force, total, top) + + return _detalhes:EndRefresh (instance, total, combat, combat [container_index]) end - - - - - - - - - - - - - - - - - +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> refresh functions + + function atributo_custom:Refresh (instance, instance_container, combat, force, total, top) + + local qual_barra = 1 + local barras_container = instance.barras + local percentage_type = instance.row_info.percent_type + + local combat_time = combat:GetCombatTime() + UsingCustomRightText = instance.row_info.textR_enable_custom_text + + --> total bar + local use_total_bar = false + if (instance.total_bar.enabled) then + use_total_bar = true + if (instance.total_bar.only_in_group and (not _IsInGroup() and not _IsInRaid())) then + use_total_bar = false + end + end + + if (instance.bars_sort_direction == 1) then --top to bottom + + if (use_total_bar and instance.barraS[1] == 1) then + + qual_barra = 2 + local iter_last = instance.barraS[2] + if (iter_last == instance.rows_fit_in_window) then + iter_last = iter_last - 1 + end + + local row1 = barras_container [1] + row1.minha_tabela = nil + row1.texto_esquerdo:SetText (Loc ["STRING_TOTAL"]) + row1.texto_direita:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")") + + row1.statusbar:SetValue (100) + local r, b, g = unpack (instance.total_bar.color) + row1.textura:SetVertexColor (r, b, g) + + row1.icone_classe:SetTexture (instance.total_bar.icon) + row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) + + gump:Fade (row1, "out") + + for i = instance.barraS[1], iter_last, 1 do + instance_container._ActorTable[i]:UpdateBar (barras_container, qual_barra, percentage_type, i, total, top, instance, force) + qual_barra = qual_barra+1 + end + + else + for i = instance.barraS[1], instance.barraS[2], 1 do + instance_container._ActorTable[i]:UpdateBar (barras_container, qual_barra, percentage_type, i, total, top, instance, force) + qual_barra = qual_barra+1 + end + end + + elseif (instance.bars_sort_direction == 2) then --bottom to top + + if (use_total_bar and instance.barraS[1] == 1) then + + qual_barra = 2 + local iter_last = instance.barraS[2] + if (iter_last == instance.rows_fit_in_window) then + iter_last = iter_last - 1 + end + + local row1 = barras_container [1] + row1.minha_tabela = nil + row1.texto_esquerdo:SetText (Loc ["STRING_TOTAL"]) + row1.texto_direita:SetText (_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")") + + row1.statusbar:SetValue (100) + local r, b, g = unpack (instance.total_bar.color) + row1.textura:SetVertexColor (r, b, g) + + row1.icone_classe:SetTexture (instance.total_bar.icon) + row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) + + gump:Fade (row1, "out") + + for i = iter_last, instance.barraS[1], -1 do --> vai atualizar só o range que esta sendo mostrado + instance_container._ActorTable[i]:UpdateBar (barras_container, qual_barra, percentage_type, i, total, top, instance, force) + qual_barra = qual_barra+1 + end + + else + for i = instance.barraS[2], instance.barraS[1], -1 do --> vai atualizar só o range que esta sendo mostrado + instance_container._ActorTable[i]:UpdateBar (barras_container, qual_barra, percentage_type, i, total, top, instance, force) + qual_barra = qual_barra+1 + end + end + + end + + if (force) then + if (instance:IsGroupMode()) then + for i = qual_barra, instance.rows_fit_in_window do + gump:Fade (instance.barras [i], "in", 0.3) + end + end + end + end + + function atributo_custom:BuildActorList (func, source, target, spellid, combat, combat_container, container_index, instance_container, instance, custom_object) + + --> do the loop + + local total = 0 + local top = 0 + local amount = 0 + + --> check if is a spell target custom + if (custom_object:IsSpellTarget()) then + table.wipe (atributo_custom._TargetActorsProcessed) + atributo_custom._TargetActorsProcessedAmt = 0 + atributo_custom._TargetActorsProcessedTotal = 0 + atributo_custom._TargetActorsProcessedTop = 0 + + instance_container:ResetCustomActorContainer() + end + + if (source == "[all]") then + + for _, actor in _ipairs (combat_container) do + local actortotal = func (_, actor, source, target, spellid, combat, instance_container) + if (actortotal > 0) then + total = total + actortotal + amount = amount + 1 + + if (actortotal > top) then + top = actortotal + end + + instance_container:SetValue (actor, actortotal) + end + end + + elseif (source == "[raid]") then + + if (_detalhes.in_combat and instance.segmento == 0 and not export) then + if (container_index == 1) then + combat_container = _detalhes.cache_damage_group + elseif (container_index == 2) then + combat_container = _detalhes.cache_healing_group + end + end + + for _, actor in _ipairs (combat_container) do + if (actor.grupo) then + local actortotal = func (_, actor, source, target, spellid, combat, instance_container) + + if (actortotal > 0) then + total = total + actortotal + amount = amount + 1 + + if (actortotal > top) then + top = actortotal + end + + instance_container:SetValue (actor, actortotal) + end + end + end + + elseif (source == "[player]") then + local pindex = combat [container_index]._NameIndexTable [_detalhes.playername] + if (pindex) then + local actor = combat [container_index]._ActorTable [pindex] + local actortotal = func (_, actor, source, target, spellid, combat, instance_container) + + if (actortotal > 0) then + total = total + actortotal + amount = amount + 1 + + if (actortotal > top) then + top = actortotal + end + + instance_container:SetValue (actor, actortotal) + end + end + else + + local pindex = combat [container_index]._NameIndexTable [source] + if (pindex) then + local actor = combat [container_index]._ActorTable [pindex] + local actortotal = func (_, actor, source, target, spellid, combat, instance_container) + + if (actortotal > 0) then + total = total + actortotal + amount = amount + 1 + + if (actortotal > top) then + top = actortotal + end + + instance_container:SetValue (actor, actortotal) + end + end + end + + return total, top, amount + end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> attributes functions + + --> damage done + function atributo_custom:damagedoneTooltip (actor, target, spellid, combat, instance) + + if (spellid) then + + if (instance:GetCustomObject():IsSpellTarget()) then + local targetname = actor.nome + local this_actor = combat (1, targetname) + + if (this_actor) then + for name, _ in _pairs (this_actor.damage_from) do + local aggressor = combat (1, name) + if (aggressor) then + local spell = aggressor.spell_tables._ActorTable [spellid] + if (spell) then + local on_me = spell.targets._NameIndexTable [targetname] + if (on_me) then + on_me = spell.targets._ActorTable [on_me] + GameCooltip:AddLine (aggressor.nome, FormatTooltipNumber (_, on_me.total)) + end + end + end + end + end + + return + else + local name, _, icon = _GetSpellInfo (spellid) + GameCooltip:AddLine (name) + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + + GameCooltip:AddLine ("Damage: ", spell.total) --> localize-me + GameCooltip:AddLine ("Hits: ", spell.counter) --> localize-me + GameCooltip:AddLine ("Critical Hits: ", spell.c_amt) --> localize-me + end + + elseif (target) then + + if (target == "[all]") then + actor.targets:SortByKey ("total") + for _, target_object in _ipairs (actor.targets._ActorTable) do + GameCooltip:AddLine (target_object.nome, FormatTooltipNumber (_, target_object.total)) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon ([[Interface\FriendsFrame\StatusIcon-Offline]], 1, 1, 14, 14) + end + + elseif (target == "[raid]") then + local roster = combat.raid_roster + actor.targets:SortByKey ("total") + for _, target_object in _ipairs (actor.targets._ActorTable) do + if (roster [target_object.nome]) then + GameCooltip:AddLine (target_object.nome, FormatTooltipNumber (_, target_object.total)) + end + end + + elseif (target == "[player]") then + local targetactor = actor.targets._NameIndexTable [_detalhes.playername] + if (targetactor) then + targetactor = actor.targets._ActorTable [targetactor] + GameCooltip:AddLine (targetactor.nome, FormatTooltipNumber (_, targetactor.total)) + end + else + local targetactor = actor.targets._NameIndexTable [target] + if (targetactor) then + targetactor = actor.targets._ActorTable [targetactor] + GameCooltip:AddLine (target, FormatTooltipNumber (_, targetactor.total)) + end + end + + else + actor:ToolTip_DamageDone (instance) + end + end + + function atributo_custom:damagedone (actor, source, target, spellid, combat, instance_container) + + if (spellid) then --> spell is always damage done + local spell = actor.spell_tables._ActorTable [spellid] + if (spell) then + if (target) then + if (target == "[all]") then + for _, targetactor in _ipairs (spell.targets._ActorTable) do + --> add amount + instance_container:AddValue (targetactor, targetactor.total, true) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + --> add to processed container + if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then + atributo_custom._TargetActorsProcessed [targetactor.nome] = true + atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 + end + end + return 0, true + + elseif (target == "[raid]") then + local roster = combat.raid_roster + for _, targetactor in _ipairs (spell.targets._ActorTable) do + if (roster [targetactor.nome]) then + --> add amount + instance_container:AddValue (targetactor, targetactor.total) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + --> add to processed container + if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then + atributo_custom._TargetActorsProcessed [targetactor.nome] = true + atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 + end + end + end + return 0, true + + elseif (target == "[player]") then + local targetactor = spell.targets._NameIndexTable [_detalhes.playername] + if (targetactor) then + targetactor = spell.targets._ActorTable [targetactor] + --> add amount + instance_container:AddValue (targetactor, targetactor.total) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + --> add to processed container + if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then + atributo_custom._TargetActorsProcessed [targetactor.nome] = true + atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 + end + end + return 0, true + + else + local targetactor = actor.targets._NameIndexTable [target] + if (targetactor) then + targetactor = spell.targets._ActorTable [targetactor] + --> add amount + instance_container:AddValue (targetactor, targetactor.total) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + --> add to processed container + if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then + atributo_custom._TargetActorsProcessed [targetactor.nome] = true + atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 + end + end + return 0, true + end + else + return spell.total + end + else + return 0 + end + + elseif (target) then + + if (target == "[all]") then + return actor.targets:GetTotal() + + elseif (target == "[raid]") then + return actor.targets:GetTotalOnRaid (nil, combat) + + elseif (target == "[player]") then + local targetactor = actor.targets._NameIndexTable [_detalhes.playername] + if (targetactor) then + return actor.targets._ActorTable [targetactor].total + else + return 0 + end + + else + local targetactor = actor.targets._NameIndexTable [target] + if (targetactor) then + return actor.targets._ActorTable [targetactor].total + else + return 0 + end + end + else + return actor.total or 0 + + end + + end + + --> healing done + + function atributo_custom:healdoneTooltip (actor, target, spellid, combat, instance) + + if (spellid) then + + if (instance:GetCustomObject():IsSpellTarget()) then + local targetname = actor.nome + local this_actor = combat (2, targetname) + + if (this_actor) then + for name, _ in _pairs (this_actor.healing_from) do + local healer = combat (2, name) + if (healer) then + local spell = healer.spell_tables._ActorTable [spellid] + if (spell) then + local on_me = spell.targets._NameIndexTable [targetname] + if (on_me) then + on_me = spell.targets._ActorTable [on_me] + GameCooltip:AddLine (healer.nome, FormatTooltipNumber (_, on_me.total)) + end + end + end + end + end + + return + else + local name, _, icon = _GetSpellInfo (spellid) + GameCooltip:AddLine (name) + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + + GameCooltip:AddLine ("Healing: ", spell.total) --> localize-me + GameCooltip:AddLine ("Hits: ", spell.counter) --> localize-me + GameCooltip:AddLine ("Critical Hits: ", spell.c_amt) --> localize-me + end + + elseif (target) then + + if (target == "[all]") then + actor.targets:SortByKey ("total") + for _, target_object in _ipairs (actor.targets._ActorTable) do + GameCooltip:AddLine (target_object.nome, FormatTooltipNumber (_, target_object.total)) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon ([[Interface\FriendsFrame\StatusIcon-Offline]], 1, 1, 14, 14) + end + + elseif (target == "[raid]") then + local roster = combat.raid_roster + actor.targets:SortByKey ("total") + for _, target_object in _ipairs (actor.targets._ActorTable) do + if (roster [target_object.nome]) then + GameCooltip:AddLine (target_object.nome, FormatTooltipNumber (_, target_object.total)) + end + end + + elseif (target == "[player]") then + local targetactor = actor.targets._NameIndexTable [_detalhes.playername] + if (targetactor) then + targetactor = actor.targets._ActorTable [targetactor] + GameCooltip:AddLine (targetactor.nome, FormatTooltipNumber (_, targetactor.total)) + end + else + local targetactor = actor.targets._NameIndexTable [target] + if (targetactor) then + targetactor = actor.targets._ActorTable [targetactor] + GameCooltip:AddLine (target, FormatTooltipNumber (_, targetactor.total)) + end + end + + else + actor:ToolTip_DamageDone (instance) + end + end + + function atributo_custom:healdone (actor, source, target, spellid, combat, instance_container) + + if (spellid) then --> spell is always healing done + local spell = actor.spell_tables._ActorTable [spellid] + local melee = actor.spell_tables._ActorTable [1] + if (spell) then + if (target) then + if (target == "[all]") then + for _, targetactor in _ipairs (spell.targets._ActorTable) do + --> add amount + instance_container:AddValue (targetactor, targetactor.total, true) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + --> add to processed container + if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then + atributo_custom._TargetActorsProcessed [targetactor.nome] = true + atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 + end + end + return 0, true + + elseif (target == "[raid]") then + local roster = combat.raid_roster + for _, targetactor in _ipairs (spell.targets._ActorTable) do + if (roster [targetactor.nome]) then + --> add amount + instance_container:AddValue (targetactor, targetactor.total) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + --> add to processed container + if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then + atributo_custom._TargetActorsProcessed [targetactor.nome] = true + atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 + end + end + end + return 0, true + + elseif (target == "[player]") then + local targetactor = spell.targets._NameIndexTable [_detalhes.playername] + if (targetactor) then + targetactor = spell.targets._ActorTable [targetactor] + --> add amount + instance_container:AddValue (targetactor, targetactor.total) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + --> add to processed container + if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then + atributo_custom._TargetActorsProcessed [targetactor.nome] = true + atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 + end + end + return 0, true + + else + local targetactor = actor.targets._NameIndexTable [target] + if (targetactor) then + targetactor = spell.targets._ActorTable [targetactor] + --> add amount + instance_container:AddValue (targetactor, targetactor.total) + atributo_custom._TargetActorsProcessedTotal = atributo_custom._TargetActorsProcessedTotal + targetactor.total + --> add to processed container + if (not atributo_custom._TargetActorsProcessed [targetactor.nome]) then + atributo_custom._TargetActorsProcessed [targetactor.nome] = true + atributo_custom._TargetActorsProcessedAmt = atributo_custom._TargetActorsProcessedAmt + 1 + end + end + return 0, true + end + else + return spell.total + end + else + return 0 + end + + elseif (target) then + + if (target == "[all]") then + return actor.targets:GetTotal() + + elseif (target == "[raid]") then + return actor.targets:GetTotalOnRaid (nil, combat) + + elseif (target == "[player]") then + local targetactor = actor.targets._NameIndexTable [_detalhes.playername] + if (targetactor) then + return actor.targets._ActorTable [targetactor].total + else + return 0 + end + + else + local targetactor = actor.targets._NameIndexTable [target] + if (targetactor) then + return actor.targets._ActorTable [targetactor].total + else + return 0 + end + end + else + return actor.total or 0 + + end + + end + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> custom object functions + + local actor_class_color_r, actor_class_color_g, actor_class_color_b + + function atributo_custom:UpdateBar (row_container, index, percentage_type, rank, total, top, instance, is_forced) + + local row = row_container [index] + + local previous_table = row.minha_tabela + row.colocacao = rank + row.minha_tabela = self + self.minha_barra = row + + local percent + + if (percentage_type == 1) then + percent = _cstr ("%.1f", self.value / total * 100) + elseif (percentage_type == 2) then + percent = _cstr ("%.1f", self.value / top * 100) + end + + local formated_value = SelectedToKFunction (_, self.value) + + if (UsingCustomRightText) then + row.texto_direita:SetText (instance.row_info.textR_custom_text:ReplaceData (formated_value, "", percent, self)) + else + row.texto_direita:SetText (formated_value .. " (" .. percent .. "%)") + end + + local row_value = _math_floor ((self.value / top) * 100) + + --tooltip function-- + + actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor() + + self:RefreshBarra2 (row, instance, previous_table, is_forced, row_value, index, row_container) + + end + + function atributo_custom:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container) + + --> primeiro colocado + if (esta_barra.colocacao == 1) then + if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then + esta_barra.statusbar:SetValue (100) + + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then + gump:Fade (esta_barra, "out") + end + + return self:RefreshBarra (esta_barra, instancia) + else + return + end + else + + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then + + esta_barra.statusbar:SetValue (esta_porcentagem) + gump:Fade (esta_barra, "out") + + if (instancia.row_info.texture_class_colors) then + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.row_info.texture_background_class_color) then + esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + return self:RefreshBarra (esta_barra, instancia) + + else + --> agora esta comparando se a tabela da barra é diferente da tabela na atualização anterior + if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then --> aqui diz se a barra do jogador mudou de posição ou se ela apenas será atualizada + + esta_barra.statusbar:SetValue (esta_porcentagem) + + esta_barra.last_value = esta_porcentagem --> reseta o ultimo valor da barra + + if (_detalhes.is_using_row_animations and forcar) then + esta_barra.tem_animacao = 0 + esta_barra:SetScript ("OnUpdate", nil) + end + + return self:RefreshBarra (esta_barra, instancia) + + elseif (esta_porcentagem ~= esta_barra.last_value) then --> continua mostrando a mesma tabela então compara a porcentagem + --> apenas atualizar + if (_detalhes.is_using_row_animations) then + + local upRow = barras_container [qual_barra-1] + if (upRow) then + if (upRow.statusbar:GetValue() < esta_barra.statusbar:GetValue()) then + esta_barra.statusbar:SetValue (esta_porcentagem) + else + instancia:AnimarBarra (esta_barra, esta_porcentagem) + end + else + instancia:AnimarBarra (esta_barra, esta_porcentagem) + end + else + esta_barra.statusbar:SetValue (esta_porcentagem) + end + esta_barra.last_value = esta_porcentagem + end + end + + end + + end + + function atributo_custom:RefreshBarra (esta_barra, instancia, from_resize) + + if (from_resize) then + actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor() + end + + if (instancia.row_info.texture_class_colors) then + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.row_info.texture_background_class_color) then + esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + if (self.classe == "UNKNOW") then + esta_barra.icone_classe:SetTexture ("Interface\\LFGFRAME\\LFGROLE_BW") + esta_barra.icone_classe:SetTexCoord (.25, .5, 0, 1) + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + + elseif (self.classe == "UNGROUPPLAYER") then + if (self.enemy) then + if (_detalhes.faction_against == "Horde") then + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Orc_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + else + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Human_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + end + else + if (_detalhes.faction_against == "Horde") then + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Human_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + else + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Orc_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + end + end + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + + elseif (self.classe == "PET") then + esta_barra.icone_classe:SetTexture (instancia.row_info.icon_file) + esta_barra.icone_classe:SetTexCoord (0.25, 0.49609375, 0.75, 1) + esta_barra.icone_classe:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + + else + esta_barra.icone_classe:SetTexture (instancia.row_info.icon_file) + esta_barra.icone_classe:SetTexCoord (_unpack (CLASS_ICON_TCOORDS [self.classe])) --very slow method + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + end + + if (self.enemy) then + if (self.arena_enemy) then + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao .. ".|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName) + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + else + if (_detalhes.faction_against == "Horde") then + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". |TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA + else + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". |TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.row_info.height..":"..instancia.row_info.height..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY + end + + if (instancia.row_info.texture_class_colors) then + esta_barra.textura:SetVertexColor (0.94117, 0, 0.01960, 1) + end + end + else + if (self.arena_ally) then + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao .. ".|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" .. instancia.row_info.height .. ":" .. instancia.row_info.height .. ":0:0:256:256:" .. _detalhes.role_texcoord [self.role or "NONE"] .. "|t" .. self.displayName) + else + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". "..self.displayName) --seta o texto da esqueda + end + end + + if (instancia.row_info.textL_class_colors) then + esta_barra.texto_esquerdo:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.row_info.textR_class_colors) then + esta_barra.texto_direita:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15) + + end + + function atributo_custom:CreateCustomActorContainer() + return _setmetatable ({ + _NameIndexTable = {}, + _ActorTable = {} + }, {__index = atributo_custom}) + end + + function atributo_custom:ResetCustomActorContainer() + for _, actor in _ipairs (self._ActorTable) do + actor.value = 0 + end + end + + function atributo_custom:WipeCustomActorContainer() + table.wipe (self._ActorTable) + table.wipe (self._NameIndexTable) + end + + function atributo_custom:AddValue (actor, actortotal, checktop) + local actor_table = self:GetActorTable (actor) + actor_table.my_actor = actor + actor_table.value = actor_table.value + actortotal + + if (checktop) then + if (actor_table.value > atributo_custom._TargetActorsProcessedTop) then + atributo_custom._TargetActorsProcessedTop = actor_table.value + end + end + end + + function atributo_custom:SetValue (actor, actortotal) + local actor_table = self:GetActorTable (actor) + actor_table.my_actor = actor + actor_table.value = actortotal + end + + function atributo_custom:UpdateClass (actors) + actors.new_actor.classe = actors.actor.classe + end + + function atributo_custom:GetActorTable (actor) + local index = self._NameIndexTable [actor.nome] + if (index) then + return self._ActorTable [index] + else + local new_actor = _setmetatable ({ + nome = actor.nome, + classe = actor.classe, + value = 0, + }, atributo_custom.mt) + + new_actor.displayName = new_actor.nome + + if (not new_actor.classe) then + new_actor.classe = _detalhes:GetClass (actor.nome) or "UNKNOW" + end + if (new_actor.classe == "UNGROUPPLAYER") then + atributo_custom:ScheduleTimer ("UpdateClass", 5, {new_actor = new_actor, actor = actor}) + end + + index = #self._ActorTable+1 + + self._ActorTable [index] = new_actor + self._NameIndexTable [actor.nome] = index + return new_actor + end + end + + function atributo_custom:GetInstanceCustomActorContainer (instance) + if (not atributo_custom._InstanceActorContainer [instance:GetId()]) then + atributo_custom._InstanceActorContainer [instance:GetId()] = self:CreateCustomActorContainer() + end + return atributo_custom._InstanceActorContainer [instance:GetId()] + end + + function atributo_custom:CreateCustomDisplayObject() + return _setmetatable ({ + name = "new custom", + icon = [[Interface\ICONS\TEMP]], + author = "unknown", + attribute = "damagedone", + source = "[all]", + target = "[all]", + spellid = false, + script = false, + }, {__index = atributo_custom}) + end + + local custom_sort = function (t1, t2) + return t1.value > t2.value + end + function atributo_custom:Sort (container) + container = container or self + _table_sort (container._ActorTable, custom_sort) + end + + function atributo_custom:Remap() + local map = self._NameIndexTable + local actors = self._ActorTable + for i = 1, #actors do + map [actors[i].nome] = i + end + end + + function atributo_custom:ToolTip (instance, bar_number, row_object, keydown) + + --> get the custom object + local custom_object = instance:GetCustomObject() + + --> get the actor + local actor = self.my_actor + + local r, g, b = actor:GetClassColor() + + _detalhes:AddTooltipSpellHeaderText (custom_object:GetName(), "yellow", 1, 0, 0, 0) + GameCooltip:AddIcon (custom_object:GetIcon(), 1, 1, 14, 14, 0.90625, 0.109375, 0.15625, 0.875) + GameCooltip:AddStatusBar (100, 1, r, g, b, 1) + + if (custom_object:IsScripted()) then + if (custom_object.tooltip) then + local func = loadstring (custom_object.tooltip) + func (actor, instance.showing, instance) + end + else + --> get the attribute + local attribute = custom_object:GetAttribute() + local container_index = atributo_custom:GetCombatContainerIndex (attribute) + + --> get the tooltip function + local func = atributo_custom [attribute .. "Tooltip"] + + --> build the tooltip + func (_, actor, custom_object.target, custom_object.spellid, instance.showing, instance) + end + + return true + end + + function atributo_custom:GetName() + return self.name + end + function atributo_custom:GetIcon() + return self.icon + end + function atributo_custom:GetAuthor() + return self.author + end + function atributo_custom:GetDesc() + return self.desc + end + function atributo_custom:GetAttribute() + return self.attribute + end + function atributo_custom:GetSource() + return self.source + end + function atributo_custom:GetTarget() + return self.target + end + function atributo_custom:GetSpellId() + return self.spellid + end + function atributo_custom:GetScript() + return self.script + end + function atributo_custom:GetScriptToolip() + return self.tooltip + end + + function atributo_custom:SetName (name) + self.name = name + end + function atributo_custom:SetIcon (path) + self.icon = path + end + function atributo_custom:SetAuthor (author) + self.author = author + end + function atributo_custom:SetDesc (desc) + self.desc = desc + end + function atributo_custom:SetAttribute (newattribute) + self.attribute = newattribute + end + function atributo_custom:SetSource (source) + self.source = source + end + function atributo_custom:SetTarget (target) + self.target = target + end + function atributo_custom:SetSpellId (spellid) + self.spellid = spellid + end + function atributo_custom:SetScript (code) + self.script = code + end + function atributo_custom:SetScriptToolip (code) + self.tooltip = code + end + + function atributo_custom:IsScripted() + return self.script and true or false + end + + function atributo_custom:IsSpellTarget() + return self.spellid and self.target and true + end + + function _detalhes.refresh:r_atributo_custom() + for _, custom_object in _ipairs (_detalhes.custom) do + _setmetatable (custom_object, atributo_custom) + custom_object.__index = atributo_custom + end + end + + function _detalhes.clear:c_atributo_custom() + for _, custom_object in _ipairs (_detalhes.custom) do + custom_object.__index = nil + end + end + + function atributo_custom:UpdateSelectedToKFunction() + SelectedToKFunction = ToKFunctions [_detalhes.ps_abbreviation] + FormatTooltipNumber = ToKFunctions [_detalhes.tooltip.abbreviation] + TooltipMaximizedMethod = _detalhes.tooltip.maximize_method + end + + + function _detalhes:AddDefaultCustomDisplays() + + local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) + + local PotionUsed = { + name = Loc ["STRING_CUSTOM_POT_DEFAULT"], + icon = [[Interface\ICONS\Trade_Alchemy_PotionD4]], + attribute = false, + spellid = false, + author = "Details!", + desc = Loc ["STRING_CUSTOM_POT_DEFAULT_DESC"], + source = false, + target = false, + script = [[ + --init: + local combat, instance_container, instance = ... + local total, top, amount = 0, 0, 0 + + --get the misc actor container + local misc_container = combat:GetActorList ( DETAILS_ATTRIBUTE_MISC ) + + --do the loop: + for _, player in ipairs ( misc_container ) do + + --only player in group + if (player:IsGroupPlayer()) then + + local found_potion = false + + --get the spell debuff uptime container + local debuff_uptime_container = player.debuff_uptime and player.debuff_uptime_spell_tables and player.debuff_uptime_spell_tables._ActorTable + if (debuff_uptime_container) then + --potion of focus (can't use as pre-potion, so, its amount is always 1 + local focus_potion = debuff_uptime_container [105701] + if (focus_potion) then + total = total + 1 + found_potion = true + if (top < 1) then + top = 1 + end + --add amount to the player + instance_container:AddValue (player, 1) + end + end + + --get the spell buff uptime container + local buff_uptime_container = player.buff_uptime and player.buff_uptime_spell_tables and player.buff_uptime_spell_tables._ActorTable + if (buff_uptime_container) then + + --potion of the jade serpent + local jade_serpent_potion = buff_uptime_container [105702] + if (jade_serpent_potion) then + local used = jade_serpent_potion.activedamt + if (used > 0) then + total = total + used + found_potion = true + if (used > top) then + top = used + end + --add amount to the player + instance_container:AddValue (player, used) + end + end + + --potion of mogu power + local mogu_power_potion = buff_uptime_container [105706] + if (mogu_power_potion) then + local used = mogu_power_potion.activedamt + if (used > 0) then + total = total + used + found_potion = true + if (used > top) then + top = used + end + --add amount to the player + instance_container:AddValue (player, used) + end + end + + --virmen's bite + local virmens_bite_potion = buff_uptime_container [105697] + if (virmens_bite_potion) then + local used = virmens_bite_potion.activedamt + if (used > 0) then + total = total + used + found_potion = true + if (used > top) then + top = used + end + --add amount to the player + instance_container:AddValue (player, used) + end + end + + --potion of the mountains + local mountains_potion = buff_uptime_container [105698] + if (mountains_potion) then + local used = mountains_potion.activedamt + if (used > 0) then + total = total + used + found_potion = true + if (used > top) then + top = used + end + --add amount to the player + instance_container:AddValue (player, used) + end + end + end + + if (found_potion) then + amount = amount + 1 + end + end + end + + --return: + return total, top, amount + ]], + tooltip = [[ + --init: + local player, combat, instance = ... + + --get the debuff container for potion of focus + local debuff_uptime_container = player.debuff_uptime and player.debuff_uptime_spell_tables and player.debuff_uptime_spell_tables._ActorTable + if (debuff_uptime_container) then + local focus_potion = debuff_uptime_container [105701] + if (focus_potion) then + local name, _, icon = GetSpellInfo (105701) + GameCooltip:AddLine (name, 1) --> can use only 1 focus potion (can't be pre-potion) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + end + + --get the buff container for all the others potions + local buff_uptime_container = player.buff_uptime and player.buff_uptime_spell_tables and player.buff_uptime_spell_tables._ActorTable + if (buff_uptime_container) then + --potion of the jade serpent + local jade_serpent_potion = buff_uptime_container [105702] + if (jade_serpent_potion) then + local name, _, icon = GetSpellInfo (105702) + GameCooltip:AddLine (name, jade_serpent_potion.activedamt) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + + --potion of mogu power + local mogu_power_potion = buff_uptime_container [105706] + if (mogu_power_potion) then + local name, _, icon = GetSpellInfo (105706) + GameCooltip:AddLine (name, mogu_power_potion.activedamt) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + + --virmen's bite + local virmens_bite_potion = buff_uptime_container [105697] + if (virmens_bite_potion) then + local name, _, icon = GetSpellInfo (105697) + GameCooltip:AddLine (name, virmens_bite_potion.activedamt) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + + --potion of the mountains + local mountains_potion = buff_uptime_container [105698] + if (mountains_potion) then + local name, _, icon = GetSpellInfo (105698) + GameCooltip:AddLine (name, mountains_potion.activedamt) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + end + ]] + } + + setmetatable (PotionUsed, _detalhes.atributo_custom) + PotionUsed.__index = _detalhes.atributo_custom + + self.custom [#self.custom+1] = PotionUsed + + local Healthstone = { + name = Loc ["STRING_CUSTOM_HEALTHSTONE_DEFAULT"], + icon = [[Interface\ICONS\warlock_ healthstone]], + attribute = "healdone", + spellid = 6262, + author = "Details!", + desc = Loc ["STRING_CUSTOM_HEALTHSTONE_DEFAULT_DESC"], + source = "[raid]", + target = "[raid]", + script = false, + tooltip = false + } + + setmetatable (Healthstone, _detalhes.atributo_custom) + Healthstone.__index = _detalhes.atributo_custom + + self.custom [#self.custom+1] = Healthstone + + + + end diff --git a/classes/classe_damage.lua b/classes/classe_damage.lua index aaa9f14f..5d315670 100644 --- a/classes/classe_damage.lua +++ b/classes/classe_damage.lua @@ -127,6 +127,10 @@ return amount end end + +--[[ exported]] function _detalhes:IsGroupPlayer() + return self.grupo + end --[[ exported]] function _detalhes:IsPlayer() if (self.flag_original) then @@ -210,7 +214,7 @@ return _unpack (_detalhes.class_colors.ARENA_ALLY) else - if (not is_player_class [actor.classe] and _bit_band (actor.flag_original, 0x00000020) ~= 0) then --> neutral + if (not is_player_class [actor.classe] and actor.flag_original and _bit_band (actor.flag_original, 0x00000020) ~= 0) then --> neutral return _unpack (_detalhes.class_colors.NEUTRAL) else return _unpack (_detalhes.class_colors [actor.classe]) diff --git a/classes/classe_energy.lua b/classes/classe_energy.lua index 09bd98ec..c634b3f1 100644 --- a/classes/classe_energy.lua +++ b/classes/classe_energy.lua @@ -269,7 +269,7 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex showing:remapear() if (exportar) then - return total, keyName, instancia.top + return total, keyName, instancia.top, amount end if (amount < 1) then --> não há barras para mostrar diff --git a/classes/classe_heal.lua b/classes/classe_heal.lua index d9c42390..ebc6f96a 100644 --- a/classes/classe_heal.lua +++ b/classes/classe_heal.lua @@ -359,7 +359,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo showing:remapear() if (exportar) then - return total, keyName, instancia.top + return total, keyName, instancia.top, amount end if (amount < 1) then --> não há barras para mostrar diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua index 631cfed2..ffb2fc9e 100644 --- a/classes/classe_instancia.lua +++ b/classes/classe_instancia.lua @@ -158,6 +158,10 @@ function _detalhes:IsRaidMode() return self.modo == _detalhes._detalhes_props["MODO_RAID"] end +function _detalhes:IsGroupMode() + return self.modo == _detalhes._detalhes_props["MODO_GROUP"] +end + function _detalhes:IsNormalMode() if (self:GetInstanceId() == 2 or self:GetInstanceId() == 3) then return true @@ -166,6 +170,19 @@ function _detalhes:IsNormalMode() end end +function _detalhes:GetCustomObject() + return _detalhes.custom [self.sub_atributo] +end + +function _detalhes:ResetAttribute() + if (self.iniciada) then + self:TrocaTabela (nil, 1, 1, true) + else + self.atributo = 1 + self.sub_atributo = 1 + end +end + ------------------------------------------------------------------------------------------------------------------------ --> retorna se a instância esta ou não ativa @@ -1312,7 +1329,10 @@ function _detalhes:InstanceReset (instance) self:AtualizaSegmentos (self) self:AtualizaSoloMode_AfertReset() self:ResetaGump() - _detalhes:AtualizaGumpPrincipal (self, true) --atualiza todas as instancias + + if (not _detalhes.initializing) then + _detalhes:AtualizaGumpPrincipal (self, true) --atualiza todas as instancias + end end function _detalhes:RefreshBars (instance) @@ -1737,6 +1757,7 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini instancia.sub_atributo = sub_atributo if (sub_attribute_click) then + --print ("aqui", instancia.sub_atributo) instancia.sub_atributo_last [instancia.atributo] = instancia.sub_atributo end @@ -1928,21 +1949,32 @@ function _detalhes:MontaAtributosOption (instancia, func) --> custom CoolTip:AddMenu (1, func, nil, 5, nil, atributos.lista[5], nil, true) CoolTip:AddIcon ("Interface\\AddOns\\Details\\images\\atributos_icones", 1, 1, 20, 20, p*(5-1), p*(5), 0, 1) - CoolTip:AddMenu (2, _detalhes.OpenCustomWindow, nil, nil, nil, Loc ["STRING_CUSTOM_NEW"], "Interface\\PaperDollInfoFrame\\Character-Plus", true) + CoolTip:AddMenu (2, _detalhes.OpenCustomDisplayWindow, nil, nil, nil, Loc ["STRING_CUSTOM_NEW"], "Interface\\PaperDollInfoFrame\\Character-Plus", true) for index, custom in _ipairs (_detalhes.custom) do - CoolTip:AddMenu (2, func, nil, 5, index, custom.name, custom.icon, true) + CoolTip:AddLine (custom.name, nil, 2) + CoolTip:AddMenu (2, func, true, 5, index) + CoolTip:AddIcon (custom.icon, 2, 1, 16, 16) end + + --> set the wallpaper on custom + GameCooltip:SetWallpaper (2, [[Interface\TALENTFRAME\WarriorArm-TopLeft]], {1, 0, 0, 1}, {1, 1, 1, 0.1}) if (#_detalhes.custom == 0) then CoolTip:SetLastSelected (2, 5, 1) else - CoolTip:SetLastSelected (2, 5, instancia.sub_atributo_last [5]+1) + if (instancia.atributo == 5) then + CoolTip:SetLastSelected (2, 5, instancia.sub_atributo+1) + else + CoolTip:SetLastSelected (2, 5, instancia.sub_atributo_last [5]+1) + end end + CoolTip:SetOption ("StatusBarTexture", [[Interface\AddOns\Details\images\bar4_vidro]]) + CoolTip:SetLastSelected (1, atributo_ativo) - CoolTip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + CoolTip:SetWallpaper (1, [[Interface\SPELLBOOK\DeathKnightBlood-TopLeft]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) --CoolTip:SetWallpaper (1, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-Parchment-Horizontal-Desaturated]], nil, {1, 1, 1, 0.3}) return menu_principal, sub_menus @@ -2235,7 +2267,8 @@ function _detalhes:monta_relatorio (este_relatorio, custom) if (not is_current) then --> assumindo que self é sempre uma instância aqui. - local total, keyName, keyNameSec, first, container_amount + local total, keyName, keyNameSec, first + local container_amount = 0 local atributo = self.atributo local container = self.showing [atributo]._ActorTable @@ -2261,6 +2294,7 @@ function _detalhes:monta_relatorio (este_relatorio, custom) end elseif (atributo == 2) then --> heal total, keyName, first, container_amount = _detalhes.atributo_heal:RefreshWindow (self, self.showing, true, true) + if (self.sub_atributo == 1) then keyNameSec = "hps" end @@ -2281,10 +2315,8 @@ function _detalhes:monta_relatorio (este_relatorio, custom) elseif (atributo == 5) then --> custom if (_detalhes.custom [self.sub_atributo]) then - total, keyName, first, container_amount = _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 + total, container, first, container_amount = _detalhes.atributo_custom:RefreshWindow (self, self.showing, true, true) + keyName = "value" else total, keyName, first, container_amount = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true) total = 1 @@ -2294,10 +2326,11 @@ function _detalhes:monta_relatorio (este_relatorio, custom) --print (total, keyName, first, atributo, container_amount) end - amt = math.min (amt, container_amount) + amt = math.min (amt, container_amount or 0) for i = 1, amt do local _thisActor = container [i] + if (_thisActor) then local amount = _thisActor [keyName] @@ -2403,7 +2436,7 @@ function _detalhes:monta_relatorio (este_relatorio, custom) atributo = _detalhes.custom [self.sub_atributo].attribute end - local this_amt = math.min (#container, container_amount, amt) + local this_amt = math.min (#container, container_amount or 0, amt) this_amt = #container - this_amt for i = container_amount, this_amt, -1 do diff --git a/classes/classe_others.lua b/classes/classe_others.lua index a0179e9e..58970d47 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -566,7 +566,7 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo showing:remapear() if (exportar) then - return total, keyName, instancia.top + return total, keyName, instancia.top, amount end if (amount < 1) then --> não há barras para mostrar diff --git a/classes/container_combatentes.lua b/classes/container_combatentes.lua index e8e45ce3..d7d1276f 100644 --- a/classes/container_combatentes.lua +++ b/classes/container_combatentes.lua @@ -12,6 +12,7 @@ local _setmetatable = setmetatable --lua local local _getmetatable = getmetatable --lua local local _bit_band = bit.band --lua local + local _table_sort = table.sort --lua local local _ipairs = ipairs --lua local local _pairs = pairs --lua local @@ -62,6 +63,29 @@ return 0 end end + + function container_combatentes:GetTotal (key) + local total = 0 + key = key or "total" + for _, actor in _ipairs (self._ActorTable) do + total = total + (actor [key] or 0) + end + + return total + end + + function container_combatentes:GetTotalOnRaid (key, combat) + local total = 0 + key = key or "total" + local roster = combat.raid_roster + for _, actor in _ipairs (self._ActorTable) do + if (roster [actor.nome]) then + total = total + (actor [key] or 0) + end + end + + return total + end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> internals @@ -435,7 +459,6 @@ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -- grava o objeto no mapa do container - local size = #self._ActorTable+1 self._ActorTable [size] = novo_objeto --> grava na tabela de indexes self._NameIndexTable [nome] = size --> grava no hash map o index deste jogador @@ -490,6 +513,21 @@ end end + local bykey + local sort = function (t1, t2) + return t1 [bykey] > t2 [bykey] + end + + function container_combatentes:SortByKey (key) + bykey = key + _table_sort (self._ActorTable, sort) + self:remapear() + end + + function container_combatentes:Remap() + return self:remapear() + end + function container_combatentes:remapear() local mapa = self._NameIndexTable local conteudo = self._ActorTable diff --git a/classes/container_pets.lua b/classes/container_pets.lua index 5a2e4f8f..4c4a2777 100644 --- a/classes/container_pets.lua +++ b/classes/container_pets.lua @@ -132,6 +132,7 @@ function container_pets:BuscarPets() end end end + elseif (_IsInGroup()) then for i = 1, _GetNumGroupMembers()-1, 1 do local pet_serial = _UnitGUID ("partypet"..i) @@ -149,6 +150,21 @@ function container_pets:BuscarPets() end end end + + local pet_serial = _UnitGUID ("pet") + if (pet_serial) then + if (not _detalhes.tabela_pets.pets [pet_serial]) then + _detalhes.tabela_pets:Adicionar (pet_serial, _UnitName ("pet"), 0x1114, _UnitGUID ("player"), _detalhes.playername, 0x514) + end + end + + else + local pet_serial = _UnitGUID ("pet") + if (pet_serial) then + if (not _detalhes.tabela_pets.pets [pet_serial]) then + _detalhes.tabela_pets:Adicionar (pet_serial, _UnitName ("pet"), 0x1114, _UnitGUID ("player"), _detalhes.playername, 0x514) + end + end end end diff --git a/core/meta.lua b/core/meta.lua index a167ab89..00ff1f45 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -57,6 +57,8 @@ --> reaplica indexes e metatables function _detalhes:RestauraMetaTables() + _detalhes.refresh:r_atributo_custom() + --> container de pets e histórico _detalhes.refresh:r_container_pets (_detalhes.tabela_pets) _detalhes.refresh:r_historico (_detalhes.tabela_historico) @@ -577,6 +579,8 @@ esta_instancia.waiting_pid = nil end + + _detalhes.clear:c_atributo_custom() end diff --git a/core/parser.lua b/core/parser.lua index 6747e199..cb7289ec 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -9,6 +9,7 @@ local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) local _tempo = time() local _ + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> local pointers @@ -16,7 +17,8 @@ local _UnitHealth = UnitHealth --wow api local local _UnitHealthMax = UnitHealthMax --wow api local local _UnitIsFeignDeath = UnitIsFeignDeath --wow api local - local _UnitGUID = UnitGUID + local _UnitGUID = UnitGUID --wow api local + local _GetUnitName = GetUnitName --wow api local local _GetInstanceInfo = GetInstanceInfo --wow api local local _IsInRaid = IsInRaid --wow api local local _IsInGroup = IsInGroup --wow api local @@ -34,7 +36,7 @@ local _table_sort = table.sort --lua local local _type = type --lua local local _math_ceil = math.ceil --lua local - local _table_wipe = table.wipe + local _table_wipe = table.wipe --lua local local escudo = _detalhes.escudos --details local local parser = _detalhes.parser --details local @@ -2822,6 +2824,7 @@ end end end + function _detalhes.parser_functions:PET_BATTLE_CLOSE (...) _detalhes.pet_battle = false for index, instance in _ipairs (_detalhes.tabela_instancias) do @@ -2831,6 +2834,10 @@ end end + function _detalhes.parser_functions:UNIT_NAME_UPDATE (...) + _detalhes:SchedulePetUpdate (5) + end + local parser_functions = _detalhes.parser_functions function _detalhes:OnEvent (evento, ...) @@ -2933,34 +2940,52 @@ _table_wipe (raid_members_cache) _table_wipe (tanks_members_cache) + local roster = _detalhes.tabela_vigente.raid_roster + if (_IsInRaid()) then for i = 1, _GetNumGroupMembers() do + local name = _GetUnitName ("raid"..i, true) + raid_members_cache [_UnitGUID ("raid"..i)] = true - local role = _UnitGroupRolesAssigned (GetUnitName ("raid"..i, true)) + roster [name] = true + + local role = _UnitGroupRolesAssigned (name) if (role == "TANK") then tanks_members_cache [_UnitGUID ("raid"..i)] = true - - --print ("tank detected:", GetUnitName ("raid"..i, true)) end end elseif (_IsInGroup()) then + --party for i = 1, _GetNumGroupMembers()-1 do + local name = _GetUnitName ("party"..i, true) + raid_members_cache [_UnitGUID ("party"..i)] = true - local role = _UnitGroupRolesAssigned (GetUnitName ("party"..i, true)) + roster [name] = true + + local role = _UnitGroupRolesAssigned (name) if (role == "TANK") then tanks_members_cache [_UnitGUID ("party"..i)] = true end end + --player + local name = GetUnitName ("player", true) + raid_members_cache [_UnitGUID ("player")] = true - local role = _UnitGroupRolesAssigned (GetUnitName ("player", true)) + roster [name] = true + + local role = _UnitGroupRolesAssigned (name) if (role == "TANK") then tanks_members_cache [_UnitGUID ("player")] = true end else + local name = GetUnitName ("player", true) + raid_members_cache [_UnitGUID ("player")] = true - local role = _UnitGroupRolesAssigned (GetUnitName ("player", true)) + roster [name] = true + + local role = _UnitGroupRolesAssigned (name) if (role == "TANK") then tanks_members_cache [_UnitGUID ("player")] = true end diff --git a/core/windows.lua b/core/windows.lua index f1c3268d..79a9c197 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -1,12 +1,7 @@ ---File Revision: 1 ---Last Modification: 27/07/2013 --- Change Log: - -- 27/07/2013: Finished alpha version. +--> this file controls the window position, size and others panels ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - - local _detalhes = _G._detalhes - local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) + local _detalhes = _G._detalhes + local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> local pointers @@ -25,7 +20,6 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> core - function _detalhes:AnimarSplit (barra, goal) barra.inicio = barra.split.barra:GetValue() barra.fim = goal @@ -35,16 +29,6 @@ end function _detalhes:FazerAnimacaoSplit (elapsed) - - --[[ - local velocidade = 0.1 - local distancia = self.inicio - self.fim - if (distancia > 40 or distancia < -40) then - velocidade = 0.8 - elseif (distancia > 20 or distancia < -20) then - velocidade = 0.4 - end - --]] local velocidade = 0.8 if (self.fim > self.inicio) then @@ -137,60 +121,23 @@ if (instance) then self = instance end - local mostrando = self.mostrando - --local baseframe_width = math.floor (self.baseframe:GetWidth()) - --local baseframe_height = math.floor (self.baseframe:GetHeight()) + -- local baseframe_width = self.baseframe:GetWidth() local baseframe_height = self.baseframe:GetHeight() - if (not baseframe_width) then return _detalhes:ScheduleTimer ("SaveMainWindowPosition", 1, self) end - - --[[ - if (baseframe_width % 2 ~= 0) then - if (self.posicao[mostrando].w > baseframe_width) then - baseframe_width = baseframe_width +1 - else - baseframe_width = baseframe_width -1 - end - end - self.baseframe:SetWidth (baseframe_width) - if (baseframe_height % 2 ~= 0) then - if (self.posicao[mostrando].h > baseframe_height) then - baseframe_height = baseframe_height +1 - else - baseframe_height = baseframe_height -1 - end - end - self.baseframe:SetHeight (baseframe_height) - --]] - + -- local xOfs, yOfs = self.baseframe:GetCenter() - if (not xOfs) then - --> this is a small and unknow bug when resizing all windows throgh crtl key (all) the last window of a horizontal row can't 'GetCenter'. - --> so, the trick is we start a timer to save pos later. return _detalhes:ScheduleTimer ("SaveMainWindowPosition", 1, self) end - - --xOfs = math.floor (xOfs) - --yOfs = math.floor (yOfs) - - if (xOfs % 2 ~= 0) then - --xOfs = xOfs -1 - end - if (yOfs % 2 ~= 0) then - --yOfs = yOfs -1 - end - - local q, w = self.baseframe:GetCenter() - + -- local _scale = self.baseframe:GetEffectiveScale() local _UIscale = _UIParent:GetScale() - + -- xOfs = xOfs*_scale - _GetScreenWidth()*_UIscale/2 yOfs = yOfs*_scale - _GetScreenHeight()*_UIscale/2 @@ -217,7 +164,7 @@ self.ponto3 = {x = _x + metade_largura, y = _y - metade_altura + statusbar_y_mod} --bottomright self.ponto4 = {x = _x + metade_largura, y = _y + metade_altura + (statusbar_y_mod*-1)} --topright - self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight()-4 --> isso aqui não sei o que esta fazendo aqui + self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight()-4 --> checar isso return {altura = self.baseframe:GetHeight(), largura = self.baseframe:GetWidth(), x = xOfs/_UIscale, y = yOfs/_UIscale} end @@ -243,7 +190,7 @@ self.baseframe:SetWidth (self.posicao[self.mostrando].w) --slider frame self.baseframe:SetHeight (self.posicao[self.mostrando].h) - self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight()-4 --> ????? + self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight()-4 --> checar isso end function _detalhes:RestoreMainWindowPositionNoResize (pre_defined, x, y) @@ -266,7 +213,7 @@ self.baseframe:ClearAllPoints() self.baseframe:SetPoint ("CENTER", _UIParent, "CENTER", novo_x + x, novo_y + y) - self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight()-4 --> ????? + self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight()-4 --> checar isso end function _detalhes:ResetaGump (instancia, tipo, segmento) @@ -338,28 +285,12 @@ end end - --[ --disabled consolidate menu - if (_detalhes.lower_instance == self.meu_id or self.consolidate) then - if (not self.consolidate) then - --if (self.baseframe:GetWidth() < 180) then - --> consolidate menus - --self:ConsolidateIcons() --disabled - --end - else - if (self.baseframe:GetWidth() > 180 or _detalhes.lower_instance ~= self.meu_id) then - --> un consolidade menus - self:UnConsolidateIcons() - end - end - end - --]] - if (self.stretch_button_side == 2) then self:StretchButtonAnchor (2) end + --> reajusta o freeze if (self.freezed) then - --> reajusta o freeze _detalhes:Freeze (self) end @@ -369,7 +300,6 @@ local T = self.rows_fit_in_window if (not T) then --> primeira vez que o gump esta sendo reajustado T = _math_floor (self.baseframe.BoxBarrasAltura / self.row_height) - -- o que mais precisa por aqui? end --> reajustar o local do relógio @@ -378,28 +308,26 @@ self.rows_fit_in_window = _math_floor ( self.baseframe.BoxBarrasAltura / self.row_height) - --if (not _detalhes.initializing) then - - if (self.rows_fit_in_window > #self.barras) then--> verifica se precisa criar mais barras - for i = #self.barras+1, self.rows_fit_in_window, 1 do - gump:CriaNovaBarra (self, i, 30) --> cria nova barra - end - self.rows_created = #self.barras + --> verifica se precisa criar mais barras + if (self.rows_fit_in_window > #self.barras) then--> verifica se precisa criar mais barras + for i = #self.barras+1, self.rows_fit_in_window, 1 do + gump:CriaNovaBarra (self, i, 30) --> cria nova barra end - - --> seta a largura das barras - if (self.bar_mod and self.bar_mod ~= 0) then - for index = 1, self.rows_fit_in_window do - self.barras [index]:SetWidth (self.baseframe:GetWidth()+self.bar_mod) - end - else - for index = 1, self.rows_fit_in_window do - self.barras [index]:SetWidth (self.baseframe:GetWidth()+self.row_info.space.right) - end - end - - --end + self.rows_created = #self.barras + end + --> seta a largura das barras + if (self.bar_mod and self.bar_mod ~= 0) then + for index = 1, self.rows_fit_in_window do + self.barras [index]:SetWidth (self.baseframe:GetWidth()+self.bar_mod) + end + else + for index = 1, self.rows_fit_in_window do + self.barras [index]:SetWidth (self.baseframe:GetWidth()+self.row_info.space.right) + end + end + + --> verifica se precisa esconder ou mostrar alguma barra local A = self.barraS[1] if (not A) then --> primeira vez que o resize esta sendo usado, no caso no startup do addon ou ao criar uma nova instância --> hida as barras não usadas @@ -520,8 +448,64 @@ end end - --> cria o frame de wait for plugin +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> panels + +--> cooltip presets + function _detalhes:CooltipPreset (preset) + local GameCooltip = GameCooltip + GameCooltip:Reset() + + if (preset == 1) then + GameCooltip:SetOption ("TextFont", "Friz Quadrata TT") + GameCooltip:SetOption ("TextColor", "orange") + GameCooltip:SetOption ("TextSize", 12) + GameCooltip:SetOption ("ButtonsYMod", -4) + GameCooltip:SetOption ("YSpacingMod", -4) + GameCooltip:SetOption ("IgnoreButtonAutoHeight", true) + GameCooltip:SetColor (1, 0.5, 0.5, 0.5, 0.5) + + elseif (preset == 2) then + GameCooltip:SetOption ("TextFont", "Friz Quadrata TT") + GameCooltip:SetOption ("TextColor", "orange") + GameCooltip:SetOption ("TextSize", 12) + GameCooltip:SetOption ("FixedWidth", 220) + GameCooltip:SetOption ("ButtonsYMod", -4) + GameCooltip:SetOption ("YSpacingMod", -4) + GameCooltip:SetOption ("IgnoreButtonAutoHeight", true) + GameCooltip:SetColor (1, 0.5, 0.5, 0.5, 0.5) + + end + end + +--> yes no panel + + do + _detalhes.yesNo = _detalhes.gump:NewPanel (UIParent, _, "DetailsYesNoWindow", _, 500, 80) + _detalhes.yesNo:SetPoint ("center", UIParent, "center") + _detalhes.gump:NewLabel (_detalhes.yesNo, _, "$parentAsk", "ask", "") + _detalhes.yesNo ["ask"]:SetPoint ("center", _detalhes.yesNo, "center", 0, 25) + _detalhes.yesNo ["ask"]:SetWidth (480) + _detalhes.yesNo ["ask"]:SetJustifyH ("center") + _detalhes.yesNo ["ask"]:SetHeight (22) + _detalhes.gump:NewButton (_detalhes.yesNo, _, "$parentNo", "no", 100, 30, function() _detalhes.yesNo:Hide() end, nil, nil, nil, Loc ["STRING_NO"]) + _detalhes.gump:NewButton (_detalhes.yesNo, _, "$parentYes", "yes", 100, 30, nil, nil, nil, nil, Loc ["STRING_YES"]) + _detalhes.yesNo ["no"]:SetPoint (10, -45) + _detalhes.yesNo ["yes"]:SetPoint (390, -45) + _detalhes.yesNo ["no"]:InstallCustomTexture() + _detalhes.yesNo ["yes"]:InstallCustomTexture() + _detalhes.yesNo ["yes"]:SetHook ("OnMouseUp", function() _detalhes.yesNo:Hide() end) + function _detalhes:Ask (msg, func, ...) + _detalhes.yesNo ["ask"].text = msg + local p1, p2 = ... + _detalhes.yesNo ["yes"]:SetClickFunction (func, p1, p2) + _detalhes.yesNo:Show() + end + _detalhes.yesNo:Hide() + end + +--> cria o frame de wait for plugin function _detalhes:CreateWaitForPlugin() local WaitForPluginFrame = CreateFrame ("frame", "DetailsWaitForPluginFrame" .. self.meu_id, UIParent) @@ -673,8 +657,8 @@ end end +--> tutorial bubbles do - --[1] criar nova instancia --[2] esticar janela --[3] resize e trava @@ -781,151 +765,151 @@ --> create bubble - local f = CreateFrame ("frame", "DetailsBubble", UIParent) - f:SetPoint ("center", UIParent, "center") - f:SetSize (100, 100) - f:SetFrameStrata ("TOOLTIP") - f.isHorizontalFlipped = false - f.isVerticalFlipped = false - - local t = f:CreateTexture (nil, "artwork") - t:SetTexture ([[Interface\AddOns\Details\images\icons]]) - t:SetSize (131 * 1.2, 81 * 1.2) - --377 328 508 409 0.0009765625 - t:SetTexCoord (0.7373046875, 0.9912109375, 0.6416015625, 0.7978515625) - t:SetPoint ("center", f, "center") - - local line1 = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") - line1:SetPoint ("topleft", t, "topleft", 24, -10) - _detalhes:SetFontSize (line1, 9) - line1:SetTextColor (.9, .9, .9, 1) - line1:SetSize (110, 12) - line1:SetJustifyV ("center") - line1:SetJustifyH ("center") - - local line2 = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") - line2:SetPoint ("topleft", t, "topleft", 11, -20) - _detalhes:SetFontSize (line2, 9) - line2:SetTextColor (.9, .9, .9, 1) - line2:SetSize (140, 12) - line2:SetJustifyV ("center") - line2:SetJustifyH ("center") - - local line3 = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") - line3:SetPoint ("topleft", t, "topleft", 7, -30) - _detalhes:SetFontSize (line3, 9) - line3:SetTextColor (.9, .9, .9, 1) - line3:SetSize (144, 12) - line3:SetJustifyV ("center") - line3:SetJustifyH ("center") - - local line4 = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") - line4:SetPoint ("topleft", t, "topleft", 11, -40) - _detalhes:SetFontSize (line4, 9) - line4:SetTextColor (.9, .9, .9, 1) - line4:SetSize (140, 12) - line4:SetJustifyV ("center") - line4:SetJustifyH ("center") - - local line5 = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") - line5:SetPoint ("topleft", t, "topleft", 24, -50) - _detalhes:SetFontSize (line5, 9) - line5:SetTextColor (.9, .9, .9, 1) - line5:SetSize (110, 12) - line5:SetJustifyV ("center") - line5:SetJustifyH ("center") - - f.lines = {line1, line2, line3, line4, line5} - - --t:SetPoint ("center", UIParent, "center") - - function f:FlipHorizontal() - if (not f.isHorizontalFlipped) then - if (f.isVerticalFlipped) then - t:SetTexCoord (0.9912109375, 0.7373046875, 0.7978515625, 0.6416015625) - else - t:SetTexCoord (0.9912109375, 0.7373046875, 0.6416015625, 0.7978515625) - end - f.isHorizontalFlipped = true - else - if (f.isVerticalFlipped) then - t:SetTexCoord (0.7373046875, 0.9912109375, 0.7978515625, 0.6416015625) - else - t:SetTexCoord (0.7373046875, 0.9912109375, 0.6416015625, 0.7978515625) - end - f.isHorizontalFlipped = false - end - end - - function f:FlipVertical() - - if (not f.isVerticalFlipped) then - if (f.isHorizontalFlipped) then - t:SetTexCoord (0.7373046875, 0.9912109375, 0.7978515625, 0.6416015625) - else - t:SetTexCoord (0.9912109375, 0.7373046875, 0.7978515625, 0.6416015625) - end - f.isVerticalFlipped = true - else - if (f.isHorizontalFlipped) then - t:SetTexCoord (0.7373046875, 0.9912109375, 0.6416015625, 0.7978515625) - else - t:SetTexCoord (0.9912109375, 0.7373046875, 0.6416015625, 0.7978515625) - end - f.isVerticalFlipped = false - end - end - - function f:TextConfig (fontsize, fontface, fontcolor) - for i = 1, 5 do - - local line = f.lines [i] - - _detalhes:SetFontSize (line, fontsize or 9) - _detalhes:SetFontFace (line, fontface or [[Fonts\FRIZQT__.TTF]]) - _detalhes:SetFontColor (line, fontcolor or {.9, .9, .9, 1}) - - end - end - - function f:SetBubbleText (line1, line2, line3, line4, line5) - if (not line1) then - for _, line in ipairs (f.lines) do - line:SetText ("") - end - return - end - - if (line1:find ("\n")) then - line1, line2, line3, line4, line5 = strsplit ("\n", line1) - end - - f.lines[1]:SetText (line1) - f.lines[2]:SetText (line2) - f.lines[3]:SetText (line3) - f.lines[4]:SetText (line4) - f.lines[5]:SetText (line5) - end - - function f:SetOwner (frame, myPoint, hisPoint, x, y, alpha) - f:ClearAllPoints() - f:TextConfig() - f:SetBubbleText (nil) - t:SetTexCoord (0.7373046875, 0.9912109375, 0.6416015625, 0.7978515625) + do + local f = CreateFrame ("frame", "DetailsBubble", UIParent) + f:SetPoint ("center", UIParent, "center") + f:SetSize (100, 100) + f:SetFrameStrata ("TOOLTIP") f.isHorizontalFlipped = false f.isVerticalFlipped = false - f:SetPoint (myPoint or "bottom", frame, hisPoint or "top", x or 0, y or 0) - t:SetAlpha (alpha or 1) - end - - function f:ShowBubble() - f:Show() - end - - function f:HideBubble() + + local t = f:CreateTexture (nil, "artwork") + t:SetTexture ([[Interface\AddOns\Details\images\icons]]) + t:SetSize (131 * 1.2, 81 * 1.2) + --377 328 508 409 0.0009765625 + t:SetTexCoord (0.7373046875, 0.9912109375, 0.6416015625, 0.7978515625) + t:SetPoint ("center", f, "center") + + local line1 = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + line1:SetPoint ("topleft", t, "topleft", 24, -10) + _detalhes:SetFontSize (line1, 9) + line1:SetTextColor (.9, .9, .9, 1) + line1:SetSize (110, 12) + line1:SetJustifyV ("center") + line1:SetJustifyH ("center") + + local line2 = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + line2:SetPoint ("topleft", t, "topleft", 11, -20) + _detalhes:SetFontSize (line2, 9) + line2:SetTextColor (.9, .9, .9, 1) + line2:SetSize (140, 12) + line2:SetJustifyV ("center") + line2:SetJustifyH ("center") + + local line3 = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + line3:SetPoint ("topleft", t, "topleft", 7, -30) + _detalhes:SetFontSize (line3, 9) + line3:SetTextColor (.9, .9, .9, 1) + line3:SetSize (144, 12) + line3:SetJustifyV ("center") + line3:SetJustifyH ("center") + + local line4 = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + line4:SetPoint ("topleft", t, "topleft", 11, -40) + _detalhes:SetFontSize (line4, 9) + line4:SetTextColor (.9, .9, .9, 1) + line4:SetSize (140, 12) + line4:SetJustifyV ("center") + line4:SetJustifyH ("center") + + local line5 = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + line5:SetPoint ("topleft", t, "topleft", 24, -50) + _detalhes:SetFontSize (line5, 9) + line5:SetTextColor (.9, .9, .9, 1) + line5:SetSize (110, 12) + line5:SetJustifyV ("center") + line5:SetJustifyH ("center") + + f.lines = {line1, line2, line3, line4, line5} + + function f:FlipHorizontal() + if (not f.isHorizontalFlipped) then + if (f.isVerticalFlipped) then + t:SetTexCoord (0.9912109375, 0.7373046875, 0.7978515625, 0.6416015625) + else + t:SetTexCoord (0.9912109375, 0.7373046875, 0.6416015625, 0.7978515625) + end + f.isHorizontalFlipped = true + else + if (f.isVerticalFlipped) then + t:SetTexCoord (0.7373046875, 0.9912109375, 0.7978515625, 0.6416015625) + else + t:SetTexCoord (0.7373046875, 0.9912109375, 0.6416015625, 0.7978515625) + end + f.isHorizontalFlipped = false + end + end + + function f:FlipVertical() + + if (not f.isVerticalFlipped) then + if (f.isHorizontalFlipped) then + t:SetTexCoord (0.7373046875, 0.9912109375, 0.7978515625, 0.6416015625) + else + t:SetTexCoord (0.9912109375, 0.7373046875, 0.7978515625, 0.6416015625) + end + f.isVerticalFlipped = true + else + if (f.isHorizontalFlipped) then + t:SetTexCoord (0.7373046875, 0.9912109375, 0.6416015625, 0.7978515625) + else + t:SetTexCoord (0.9912109375, 0.7373046875, 0.6416015625, 0.7978515625) + end + f.isVerticalFlipped = false + end + end + + function f:TextConfig (fontsize, fontface, fontcolor) + for i = 1, 5 do + + local line = f.lines [i] + + _detalhes:SetFontSize (line, fontsize or 9) + _detalhes:SetFontFace (line, fontface or [[Fonts\FRIZQT__.TTF]]) + _detalhes:SetFontColor (line, fontcolor or {.9, .9, .9, 1}) + + end + end + + function f:SetBubbleText (line1, line2, line3, line4, line5) + if (not line1) then + for _, line in ipairs (f.lines) do + line:SetText ("") + end + return + end + + if (line1:find ("\n")) then + line1, line2, line3, line4, line5 = strsplit ("\n", line1) + end + + f.lines[1]:SetText (line1) + f.lines[2]:SetText (line2) + f.lines[3]:SetText (line3) + f.lines[4]:SetText (line4) + f.lines[5]:SetText (line5) + end + + function f:SetOwner (frame, myPoint, hisPoint, x, y, alpha) + f:ClearAllPoints() + f:TextConfig() + f:SetBubbleText (nil) + t:SetTexCoord (0.7373046875, 0.9912109375, 0.6416015625, 0.7978515625) + f.isHorizontalFlipped = false + f.isVerticalFlipped = false + f:SetPoint (myPoint or "bottom", frame, hisPoint or "top", x or 0, y or 0) + t:SetAlpha (alpha or 1) + end + + function f:ShowBubble() + f:Show() + end + + function f:HideBubble() + f:Hide() + end + + f:SetBubbleText (nil) + f:Hide() - end - - f:SetBubbleText (nil) - - f:Hide() \ No newline at end of file + end \ No newline at end of file diff --git a/framework/button.lua b/framework/button.lua index b7a83fbf..ec34d8f9 100644 --- a/framework/button.lua +++ b/framework/button.lua @@ -502,8 +502,10 @@ local ButtonMetaFunctions = {} end end - if (button.MyObject.have_tooltip) then - _detalhes.popup:ShowMe (false) + if (button.MyObject.have_tooltip) then + if (GameCooltip:GetText (1) == button.MyObject.have_tooltip) then + GameCooltip:Hide() + end end local parent = button:GetParent().MyObject diff --git a/framework/cooltip.lua b/framework/cooltip.lua index 9f401fb2..44259734 100644 --- a/framework/cooltip.lua +++ b/framework/cooltip.lua @@ -805,7 +805,7 @@ function DetailsCreateCoolTip() end function CoolTip:StatusBar (menuButton, StatusBar) - + if (StatusBar) then menuButton.statusbar:SetValue (StatusBar [1]) @@ -899,7 +899,8 @@ function DetailsCreateCoolTip() CoolTip.LeftIconTableSub [mainMenuIndex] and CoolTip.LeftIconTableSub [mainMenuIndex] [index], CoolTip.RightIconTableSub [mainMenuIndex] and CoolTip.RightIconTableSub [mainMenuIndex] [index], true) --> setup statusbar - CoolTip:StatusBar (menuButton, CoolTip.StatusBarTable [mainMenuIndex] and CoolTip.StatusBarTable [mainMenuIndex] [index]) + CoolTip:StatusBar (menuButton, CoolTip.StatusBarTableSub [mainMenuIndex] and CoolTip.StatusBarTableSub [mainMenuIndex] [index]) + --> click menuButton:RegisterForClicks ("LeftButtonDown") @@ -1493,7 +1494,7 @@ function DetailsCreateCoolTip() end - end + end function CoolTip:GetText (buttonIndex) local button1 = frame1.Lines [buttonIndex] diff --git a/framework/panel.lua b/framework/panel.lua index 836d34bb..8ee9a0d3 100644 --- a/framework/panel.lua +++ b/framework/panel.lua @@ -875,22 +875,26 @@ function gump:ColorPick (frame, r, g, b, alpha, callback) end ------------icon pick -function gump:IconPick (callback) +function gump:IconPick (callback, close_when_select) if (not gump.IconPickFrame) then + local string_lower = string.lower + gump.IconPickFrame = CreateFrame ("frame", "DetailsIconPickFrame", UIParent) tinsert (UISpecialFrames, "DetailsIconPickFrame") gump.IconPickFrame:SetFrameStrata ("DIALOG") gump.IconPickFrame:SetPoint ("center", UIParent, "center") gump.IconPickFrame:SetWidth (350) - gump.IconPickFrame:SetHeight (200) + gump.IconPickFrame:SetHeight (227) gump.IconPickFrame:EnableMouse (true) gump.IconPickFrame:SetMovable (true) gump.IconPickFrame:SetBackdrop ({bgFile = "Interface\\AddOns\\Details\\images\\background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 32, edgeSize = 32, insets = {left = 5, right = 5, top = 5, bottom = 5}}) + --local title = gump.IconPickFrame:CreateTitleRegion() + gump.IconPickFrame:SetBackdropBorderColor (170/255, 170/255, 170/255) gump.IconPickFrame:SetBackdropColor (24/255, 24/255, 24/255, .8) gump.IconPickFrame:SetFrameLevel (1) @@ -898,11 +902,29 @@ function gump:IconPick (callback) gump.IconPickFrame.emptyFunction = function() end gump.IconPickFrame.callback = gump.IconPickFrame.emptyFunction + gump.IconPickFrame.preview = gump:NewImage (gump.IconPickFrame, nil, 76, 76) + + gump.IconPickFrame.searchLabel = gump:NewLabel (gump.IconPickFrame, nil, "$parentSearchBoxLabel", nil, "search:", font, size, color) + gump.IconPickFrame.searchLabel:SetPoint ("topleft", gump.IconPickFrame, "topleft", 12, -20) + gump.IconPickFrame.search = gump:NewTextEntry (gump.IconPickFrame, nil, "$parentSearchBox", nil, 140, 20) + gump.IconPickFrame.search:SetPoint ("left", gump.IconPickFrame.searchLabel, "right", 2, 0) + gump.IconPickFrame.search:SetHook ("OnTextChanged", function() + gump.IconPickFrame.searching = gump.IconPickFrame.search:GetText() + if (gump.IconPickFrame.searching == "") then + gump.IconPickFrameScroll:Show() + gump.IconPickFrame.searching = nil + gump.IconPickFrame.updateFunc() + else + gump.IconPickFrameScroll:Hide() + gump.IconPickFrame.updateFunc() + end + end) + --> close button local close_button = CreateFrame ("button", nil, gump.IconPickFrame, "UIPanelCloseButton") close_button:SetWidth (32) close_button:SetHeight (32) - close_button:SetPoint ("TOPRIGHT", gump.IconPickFrame, "TOPRIGHT", -3, 20) + close_button:SetPoint ("TOPRIGHT", gump.IconPickFrame, "TOPRIGHT", -8, -7) close_button:SetFrameLevel (close_button:GetFrameLevel()+2) local MACRO_ICON_FILENAMES = {} @@ -911,7 +933,6 @@ function gump:IconPick (callback) MACRO_ICON_FILENAMES = {}; MACRO_ICON_FILENAMES[1] = "INV_MISC_QUESTIONMARK"; local index = 2; - local numFlyouts = 0; for i = 1, GetNumSpellTabs() do local tab, tabTex, offset, numSpells, _ = GetSpellTabInfo(i); @@ -957,44 +978,69 @@ function gump:IconPick (callback) local OnClickFunction = function (index) local button = gump.IconPickFrame.buttons [index] local texture = button:GetNormalTexture() - gump.IconPickFrame.callback ("INTERFACE\\ICONS\\"..MACRO_ICON_FILENAMES [button.IconID]) + gump.IconPickFrame.callback (button.icon_texture) + if (gump.IconPickFrame.click_close) then + close_button:Click() + end + end + + local onenter = function (self) + gump.IconPickFrame.preview:SetPoint ("bottom", self, "top", 0, 2) + gump.IconPickFrame.preview:SetTexture (self.icon_texture) + gump.IconPickFrame.preview:SetParent (self) + gump.IconPickFrame.preview:Show() + end + local onleave = function (self) + gump.IconPickFrame.preview:Hide() end for i = 0, 9 do local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i+1, i+1, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..(i+1)) - newcheck:SetPoint ("topleft", gump.IconPickFrame, "topleft", 12+(i*30), -13) + newcheck:SetPoint ("topleft", gump.IconPickFrame, "topleft", 12 + (i*30), -40) newcheck:SetID (i+1) gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck + newcheck.MouseOnEnterHook = onenter + newcheck.MouseOnLeaveHook = onleave end for i = 11, 20 do local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..i) newcheck:SetPoint ("topleft", "DetailsIconPickFrameButton"..(i-10), "bottomleft", 0, -1) newcheck:SetID (i) gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck + newcheck.MouseOnEnterHook = onenter + newcheck.MouseOnLeaveHook = onleave end for i = 21, 30 do local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..i) newcheck:SetPoint ("topleft", "DetailsIconPickFrameButton"..(i-10), "bottomleft", 0, -1) newcheck:SetID (i) gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck + newcheck.MouseOnEnterHook = onenter + newcheck.MouseOnLeaveHook = onleave end for i = 31, 40 do local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..i) newcheck:SetPoint ("topleft", "DetailsIconPickFrameButton"..(i-10), "bottomleft", 0, -1) newcheck:SetID (i) gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck + newcheck.MouseOnEnterHook = onenter + newcheck.MouseOnLeaveHook = onleave end for i = 41, 50 do local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..i) newcheck:SetPoint ("topleft", "DetailsIconPickFrameButton"..(i-10), "bottomleft", 0, -1) newcheck:SetID (i) gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck + newcheck.MouseOnEnterHook = onenter + newcheck.MouseOnLeaveHook = onleave end for i = 51, 60 do local newcheck = gump:NewDetailsButton (gump.IconPickFrame, gump.IconPickFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconPickFrameButton"..i) newcheck:SetPoint ("topleft", "DetailsIconPickFrameButton"..(i-10), "bottomleft", 0, -1) newcheck:SetID (i) gump.IconPickFrame.buttons [#gump.IconPickFrame.buttons+1] = newcheck + newcheck.MouseOnEnterHook = onenter + newcheck.MouseOnLeaveHook = onleave end local scroll = CreateFrame ("ScrollFrame", "DetailsIconPickFrameScroll", gump.IconPickFrame, "ListScrollFrameTemplate") @@ -1008,27 +1054,65 @@ function gump:IconPick (callback) -- Icon list local texture; - for i = 1, 60 do - macroPopupIcon = _G["DetailsIconPickFrameButton"..i]; - macroPopupButton = _G["DetailsIconPickFrameButton"..i]; - index = (macroPopupOffset * 10) + i; - texture = MACRO_ICON_FILENAMES [index] - if ( index <= numMacroIcons and texture ) then - macroPopupButton:ChangeIcon ("INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture) - macroPopupButton.IconID = index - macroPopupButton:Show(); - else - macroPopupButton:Hide(); + + local filter + if (gump.IconPickFrame.searching) then + filter = string_lower (gump.IconPickFrame.searching) + end + + if (filter and filter ~= "") then + local i = 1 + for o = 1, numMacroIcons do + local text = string_lower (MACRO_ICON_FILENAMES [o]) + if (text:find (filter)) then + macroPopupIcon = _G ["DetailsIconPickFrameButton"..i] + macroPopupButton = _G ["DetailsIconPickFrameButton"..i] + local texture = MACRO_ICON_FILENAMES [o] + macroPopupButton:ChangeIcon ("INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture) + macroPopupButton.IconID = index + macroPopupButton.icon_texture = "INTERFACE\\ICONS\\"..texture + macroPopupButton:Show(); + + i = i + 1 + if (i > 60) then + break + end + end + end + + if (i == 1) then --no resutls + macroPopupButton = _G ["DetailsIconPickFrameButton"..i] + macroPopupButton:Hide() + end + + for o = i+1, 60 do + macroPopupButton = _G ["DetailsIconPickFrameButton"..o] + macroPopupButton:Hide() + end + else + for i = 1, 60 do + macroPopupIcon = _G ["DetailsIconPickFrameButton"..i] + macroPopupButton = _G ["DetailsIconPickFrameButton"..i] + index = (macroPopupOffset * 10) + i; + texture = MACRO_ICON_FILENAMES [index] + if ( index <= numMacroIcons and texture ) then + macroPopupButton:ChangeIcon ("INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture) + macroPopupButton.IconID = index + macroPopupButton.icon_texture = "INTERFACE\\ICONS\\"..texture + macroPopupButton:Show() + else + macroPopupButton:Hide() + end end - end -- Scrollbar stuff FauxScrollFrame_Update (scroll, ceil (numMacroIcons / 10) , 5, 20 ); end + + gump.IconPickFrame.updateFunc = ChecksFrame_Update - - scroll:SetPoint ("topleft", gump.IconPickFrame, "topleft", -18, -10) + scroll:SetPoint ("topleft", gump.IconPickFrame, "topleft", -18, -37) scroll:SetWidth (330) scroll:SetHeight (178) scroll:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (scroll, offset, 20, ChecksFrame_Update) end) @@ -1041,5 +1125,6 @@ function gump:IconPick (callback) gump.IconPickFrame:Show() gump.IconPickFrameScroll.update (gump.IconPickFrameScroll) gump.IconPickFrame.callback = callback or gump.IconPickFrame.emptyFunction + gump.IconPickFrame.click_close = close_when_select end diff --git a/framework/textentry.lua b/framework/textentry.lua index 8473a177..36a2db32 100644 --- a/framework/textentry.lua +++ b/framework/textentry.lua @@ -248,6 +248,29 @@ local TextEntryMetaFunctions = {} end end + function TextEntryMetaFunctions:Enable() + if (not self.editbox:IsEnabled()) then + self.editbox:Enable() + self.editbox:SetBackdropBorderColor (unpack (self.enabled_border_color)) + self.editbox:SetBackdropColor (unpack (self.enabled_backdrop_color)) + self.editbox:SetTextColor (unpack (self.enabled_text_color)) + end + end + + function TextEntryMetaFunctions:Disable() + if (self.editbox:IsEnabled()) then + self.enabled_border_color = {self.editbox:GetBackdropBorderColor()} + self.enabled_backdrop_color = {self.editbox:GetBackdropColor()} + self.enabled_text_color = {self.editbox:GetTextColor()} + + self.editbox:Disable() + + self.editbox:SetBackdropBorderColor (.5, .5, .5, .5) + self.editbox:SetBackdropColor (.5, .5, .5, .5) + self.editbox:SetTextColor (.5, .5, .5, .5) + end + end + ------------------------------------------------------------------------------------------------------------ --> scripts local OnEnter = function (textentry) @@ -269,7 +292,7 @@ local TextEntryMetaFunctions = {} if (textentry:IsEnabled()) then textentry.current_bordercolor = textentry.current_bordercolor or {textentry:GetBackdropBorderColor()} - textentry:SetBackdropBorderColor (0.5, 0.5, 0.5, 1) + textentry:SetBackdropBorderColor (1, 1, 1, 1) end local parent = textentry:GetParent().MyObject @@ -527,16 +550,15 @@ function gump:NewTextEntry (parent, container, name, member, w, h, func, param1, TextEntryObject.editbox:SetJustifyH ("center") TextEntryObject.editbox:EnableMouse (true) TextEntryObject.editbox:SetText ("") - - --TextEntryObject.editbox:SetBackdrop ({bgFile = "Interface\\ChatFrame\\ChatFrameBackground", - --edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", - --tile = true, edgeSize = 1, tileSize = 5}) - - --TextEntryObject.editbox:SetBackdropColor (0, 0, 0, 0.5) - --TextEntryObject.editbox:SetBackdropBorderColor (0.3, 0.3, 0.30, 0.80) - TextEntryObject.editbox.current_bordercolor = {1, 1, 1, 1} + TextEntryObject.editbox:SetAutoFocus (false) TextEntryObject.editbox:SetFontObject ("GameFontHighlightSmall") + + TextEntryObject.editbox.current_bordercolor = {1, 1, 1, 0.7} + TextEntryObject.editbox:SetBackdropBorderColor (1, 1, 1, 0.7) + TextEntryObject.enabled_border_color = {TextEntryObject.editbox:GetBackdropBorderColor()} + TextEntryObject.enabled_backdrop_color = {TextEntryObject.editbox:GetBackdropColor()} + TextEntryObject.enabled_text_color = {TextEntryObject.editbox:GetTextColor()} TextEntryObject.func = func TextEntryObject.param1 = param1 diff --git a/functions/boss.lua b/functions/boss.lua index 46c3f274..6f0e5b51 100644 --- a/functions/boss.lua +++ b/functions/boss.lua @@ -31,6 +31,11 @@ do end end + --> return the EJ boss id + function _detalhes:GetEncounterIdFromBossIndex (mapid, index) + return _detalhes.EncounterInformation [mapid] and _detalhes.EncounterInformation [mapid].encounter_ids and _detalhes.EncounterInformation [mapid].encounter_ids [index] + end + --> return the table which contain information about the start of a encounter function _detalhes:GetEncounterStartInfo (mapid, encounterid) local bossindex = _detalhes.EncounterInformation [mapid] and _detalhes.EncounterInformation [mapid].encounter_ids and _detalhes.EncounterInformation [mapid].encounter_ids [encounterid] @@ -83,6 +88,11 @@ do return _detalhes.EncounterInformation [mapid] and _detalhes.EncounterInformation [mapid].encounters [bossindex] end + --> return a table with all names of boss enemies + function _detalhes:GetEncounterActors (mapid, bossindex) + + end + --> return a table with spells id of specified encounter function _detalhes:GetEncounterSpells (mapid, bossindex) local encounter = _detalhes:GetBossDetails (mapid, bossindex) @@ -108,6 +118,13 @@ do return _detalhes.EncounterInformation [mapid] and _detalhes.EncounterInformation [mapid].boss_ids end + function _detalhes:InstanceIsRaid (mapid) + return _detalhes:InstanceisRaid (mapid) + end + function _detalhes:InstanceisRaid (mapid) + return _detalhes.EncounterInformation [mapid] and _detalhes.EncounterInformation [mapid].is_raid + end + --> return a table with all encounter names present in raid instance function _detalhes:GetBossNames (mapid) return _detalhes.EncounterInformation [mapid] and _detalhes.EncounterInformation [mapid].boss_names @@ -150,6 +167,24 @@ do end end + --> return a list with names of adds and bosses + function _detalhes:GetEncounterActorsName (EJ_EncounterID) + --code snippet from wowpedia + local actors = {} + local stack, encounter, _, _, curSectionID = {}, EJ_GetEncounterInfo (EJ_EncounterID) + repeat + local title, description, depth, abilityIcon, displayInfo, siblingID, nextSectionID, filteredByDifficulty, link, startsOpen, flag1, flag2, flag3, flag4 = EJ_GetSectionInfo (curSectionID) + if (displayInfo ~= 0 and abilityIcon == "") then + actors [title] = {model = displayInfo, info = description} + end + table.insert (stack, siblingID) + table.insert (stack, nextSectionID) + curSectionID = table.remove (stack) + until not curSectionID + + return actors + end + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> core diff --git a/functions/classes.lua b/functions/classes.lua index e3a3278a..92c9579a 100644 --- a/functions/classes.lua +++ b/functions/classes.lua @@ -104,7 +104,13 @@ do return self.nome or actor.nome end function _detalhes:GetName (actor) - return actor.nome or self.nome + return self.nome or actor.nome + end + function _detalhes:GetDisplayName (actor) + return self.displayName or actor.displayName + end + function _detalhes:Class (actor) + return self.classe or actor.classe end end diff --git a/functions/loaddata.lua b/functions/loaddata.lua index bb3827e7..2b236695 100644 --- a/functions/loaddata.lua +++ b/functions/loaddata.lua @@ -288,6 +288,7 @@ function _detalhes:LoadConfig() --> custom _detalhes.custom = _detalhes_global.custom + _detalhes.refresh:r_atributo_custom() --> initialize parser _detalhes.capture_current = {} diff --git a/functions/playerclass.lua b/functions/playerclass.lua index 7e2b5ae3..c1451408 100644 --- a/functions/playerclass.lua +++ b/functions/playerclass.lua @@ -8,6 +8,7 @@ do local _ipairs = ipairs local _UnitClass = UnitClass local _select = select + local _unpack = unpack -- try get the class from actor name function _detalhes:GetClass (name) @@ -28,15 +29,46 @@ do end end + local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS + function _detalhes:GetClassIcon (class) + + local c + + if (self.classe) then + c = self.classe + elseif (type (class) == "table" and class.classe) then + c = class.classe + elseif (type (class) == "string") then + c = class + else + c = "UNKNOW" + end + + if (c == "UNKNOW") then + return [[Interface\LFGFRAME\LFGROLE_BW]], 0.25, 0.5, 0, 1 + elseif (c == "UNGROUPPLAYER") then + return [[Interface\ICONS\Achievement_Character_Orc_Male]], 0, 1, 0, 1 + elseif (c == "PET") then + return [[Interface\AddOns\Details\images\classes_small]], 0.25, 0.49609375, 0.75, 1 + else + return [[Interface\AddOns\Details\images\classes_small]], _unpack (CLASS_ICON_TCOORDS [c]) + end + end + + local default_color = {1, 1, 1, 1} function _detalhes:GetClassColor (class) if (self.classe) then - return _detalhes.class_colors [class.classe] + return unpack (_detalhes.class_colors [self.classe] or default_color) elseif (type (class) == "table" and class.classe) then - return _detalhes.class_colors [class.classe] + return unpack (_detalhes.class_colors [class.classe] or default_color) + + elseif (type (class) == "string") then + return unpack (_detalhes.class_colors [class] or default_color) + else + unpack (default_color) end - return _detalhes.class_colors [class] end function _detalhes:GuessClass (t) diff --git a/functions/savedata.lua b/functions/savedata.lua index e8ffc154..70ab2a82 100644 --- a/functions/savedata.lua +++ b/functions/savedata.lua @@ -12,154 +12,9 @@ function _detalhes:SaveData() end function _detalhes:SaveDataOnLogout() - -if (true) then - return -end - -if (_detalhes.wipe_full_config) then - _detalhes_global = nil - _detalhes_database = nil - return -end - ---> cleanup tables - _detalhes:PrepareTablesForSave() - ---> get data - --- On Character - - --> nicktag cache - _detalhes_database.nick_tag_cache = _detalhes.nick_tag_cache - _detalhes_database.only_pvp_frags = _detalhes.only_pvp_frags - - --> minimap - _detalhes_database.minimap = _detalhes.minimap - - --> plugin data - _detalhes_database.plugin_database = _detalhes.plugin_database - - --> save instances (windows) - _detalhes_database.tabela_instancias = _detalhes.tabela_instancias - _detalhes_database.class_icons_small = _detalhes.class_icons_small - _detalhes_database.class_coords = _detalhes.class_coords - _detalhes_database.class_colors = _detalhes.class_colors - --> character info - _detalhes_database.character_data = _detalhes.character_data - --> options data - --window size - _detalhes_database.max_window_size = _detalhes.max_window_size - _detalhes_database.new_window_size = _detalhes.new_window_size - _detalhes_database.window_clamp = _detalhes.window_clamp - --> text sizes - _detalhes_database.font_sizes = _detalhes.font_sizes - _detalhes_database.ps_abbreviation = _detalhes.ps_abbreviation - -- max segments - _detalhes_database.segments_amount = _detalhes.segments_amount - _detalhes_database.segments_amount_to_save = _detalhes.segments_amount_to_save - _detalhes_database.instances_amount = _detalhes.instances_amount - _detalhes_database.clear_ungrouped = _detalhes.clear_ungrouped - _detalhes_database.clear_graphic = _detalhes.clear_graphic - -- row animation - _detalhes_database.use_row_animations = _detalhes.use_row_animations - _detalhes_database.animate_scroll = _detalhes.animate_scroll - _detalhes_database.use_scroll = _detalhes.use_scroll - -- death log - _detalhes_database.deadlog_limit = _detalhes.deadlog_limit - -- report - _detalhes_database.report_lines = _detalhes.report_lines - _detalhes_database.report_to_who = _detalhes.report_to_who - -- colors - _detalhes_database.default_bg_color = _detalhes.default_bg_color - _detalhes_database.default_bg_alpha = _detalhes.default_bg_alpha - -- fades - _detalhes_database.row_fade_in = _detalhes.row_fade_in - _detalhes_database.windows_fade_in = _detalhes.windows_fade_in - _detalhes_database.row_fade_out = _detalhes.row_fade_out - _detalhes_database.windows_fade_out = _detalhes.windows_fade_out - -- modes - _detalhes_database.solo = _detalhes.solo - _detalhes_database.tank = _detalhes.raid - -- switch - _detalhes_database.switch = {} - _detalhes_database.switch.slots = _detalhes.switch.slots - _detalhes_database.switch.table = _detalhes.switch.table - -- capture - _detalhes_database.capture_real = _detalhes.capture_real - _detalhes_database.cloud_capture = _detalhes.cloud_capture - _detalhes_database.minimum_combat_time = _detalhes.minimum_combat_time - --> combat data - -- segments table - _detalhes_database.tabela_historico = _detalhes.tabela_historico - -- combat id - _detalhes_database.combat_id = _detalhes.combat_id - -- modes - _detalhes_database.SoloTables = {} - _detalhes_database.RaidTables = {} - --> precisa pegar o nome do plugin - if (_detalhes.SoloTables.Mode) then - _detalhes_database.SoloTables.Mode = _detalhes.SoloTables.Mode - if (_detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode]) then - _detalhes_database.SoloTables.LastSelected = _detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode].real_name - end - end - if (_detalhes.RaidTables.Mode) then - _detalhes_database.RaidTables.Mode = _detalhes.RaidTables.Mode - if (_detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode]) then - _detalhes_database.RaidTables.LastSelected = _detalhes.RaidTables.Plugins [_detalhes.RaidTables.Mode].real_name - end - end - --> buff data - _detalhes.Buffs:SaveBuffs() - - --> customs - _detalhes_database.custom = _detalhes.custom - - --> version - _detalhes_database.last_realversion = _detalhes.realversion --> core number - _detalhes_database.last_version = _detalhes.userversion --> version - --- 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 - --max segments - _detalhes_global.segments_amount = _detalhes.segments_amount - _detalhes_global.segments_amount_to_save = _detalhes.segments_amount_to_save - _detalhes_global.segments_panic_mode = _detalhes.segments_panic_mode - -- animations - _detalhes_global.use_row_animations = _detalhes.use_row_animations - _detalhes_global.animate_scroll = _detalhes.animate_scroll - -- scrollbar - _detalhes_global.use_scroll = _detalhes.use_scroll - -- core - _detalhes_global.clear_ungrouped = _detalhes.clear_ungrouped - _detalhes_global.update_speed = _detalhes.update_speed - _detalhes_global.time_type = _detalhes.time_type - _detalhes_global.memory_threshold = _detalhes.memory_threshold - _detalhes_global.memory_ram = _detalhes.memory_ram - _detalhes_global.remove_realm_from_name = _detalhes.remove_realm_from_name - _detalhes_global.trash_concatenate = _detalhes.trash_concatenate - _detalhes_global.trash_auto_remove = _detalhes.trash_auto_remove - - _detalhes_global.SpellOverwriteUser = _detalhes.SpellOverwriteUser - - --tutorial - _detalhes_global.tutorial = _detalhes.tutorial - - --profiles - _detalhes_global.__profiiles = _detalhes.__profiiles - - return true - + if (true) then + return + end end local force_reset = function() diff --git a/functions/slash.lua b/functions/slash.lua index a9243b3d..cf1cd466 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -201,6 +201,55 @@ function SlashCmdList.DETAILS (msg, editbox) --instance.baseframe:SetPoint ("CENTER", UIParent, "CENTER", 300, 100) instance.baseframe:SetPoint ("left", DetailsWelcomeWindow, "right", 10, 0) + elseif (msg == "model") then + local frame = CreateFrame ("PlayerModel"); + frame:SetPoint("center",UIParent,"center"); + frame:SetHeight(600); + frame:SetWidth(300); + frame:SetDisplayInfo (49585); + + elseif (msg == "ej2") then + + --[[ get the EJ_ raid id + local wantRaids = true -- set false to get 5-man list + for i=1,1000 do + instanceID,name,description,bgImage,buttonImage,loreImage, dungeonAreaMapID, link = EJ_GetInstanceByIndex(i,wantRaids) + if not instanceID then break end + DEFAULT_CHAT_FRAME:AddMessage( instanceID.." "..name ,1,0.7,0.5) + end + --]] + + local iid=362 + + for i=1, 100 do + local name, description, encounterID, rootSectionID, link = EJ_GetEncounterInfoByIndex (i, iid) + + if not encounterID then break end + local msg = encounterID .. " , " .. name .. ", ".. rootSectionID.. ", "..link + DEFAULT_CHAT_FRAME:AddMessage(msg, 1,0.7,0.5) + end + + elseif (msg == "ej") then + function PrintAllEncounterSections(encounterID, difficultyID) + EJ_SetDifficulty(difficultyID) + local stack, encounter, _, _, curSectionID = {}, EJ_GetEncounterInfo(encounterID) + print(stack, encounter, _, _, curSectionID) + repeat + local title, desc, depth, icon, model, siblingID, nextSectionID, filteredByDifficulty, link, _, f1, f2, f3, f4 = EJ_GetSectionInfo(curSectionID) + if not filteredByDifficulty then + --print((" "):rep(depth) .. link .. ": " .. desc) + --npcs nao tem icone e possuel modelo diferente de zero. + --spells tem icone e possuel modelo = zero + print (title, icon, model, siblingID) + end + table.insert(stack, siblingID) + table.insert(stack, nextSectionID) + curSectionID = table.remove(stack) + until not curSectionID + end + + -- Print everything in 25-man Normal Madness of Deathwing: + PrintAllEncounterSections (869, 4) elseif (msg == "time") then print ("GetTime()", GetTime()) diff --git a/gumps/janela_custom.lua b/gumps/janela_custom.lua index cf318a9d..9e07ffe7 100644 --- a/gumps/janela_custom.lua +++ b/gumps/janela_custom.lua @@ -1,940 +1,1623 @@ -local _detalhes = _G._detalhes +--> custom window -local AceComm = LibStub ("AceComm-3.0") -local AceSerializer = LibStub ("AceSerializer-3.0") - -local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) - -local gump = _detalhes.gump -local _ -local atributos = _detalhes.atributos -local sub_atributos = _detalhes.sub_atributos ---lua locals -local _cstr = string.format -local _math_ceil = math.ceil -local _math_floor = math.floor -local _ipairs = ipairs -local _pairs = pairs -local _string_lower = string.lower -local _table_sort = table.sort -local _table_insert = table.insert -local _unpack = unpack - ---api locals -local _GetSpellInfo = _detalhes.getspellinfo -local _CreateFrame = CreateFrame -local _GetTime = GetTime -local _GetCursorPosition = GetCursorPosition -local _GameTooltip = GameTooltip -local _UIParent = UIParent -local _GetScreenWidth = GetScreenWidth -local _GetScreenHeight = GetScreenHeight -local _IsAltKeyDown = IsAltKeyDown -local _IsShiftKeyDown = IsShiftKeyDown -local _IsControlKeyDown = IsControlKeyDown - -local CLASS_ICON_TCOORDS = _G.CLASS_ICON_TCOORDS - -local class_type_dano = _detalhes.atributos.dano -local class_type_misc = _detalhes.atributos.misc -local tabela_do_combate - -local master_container - -local function CreateCustomWindow() + local _detalhes = _G._detalhes + local gump = _detalhes.gump + local _ - local gump_fundo_backdrop = { - bgFile = "Interface\\AddOns\\Details\\images\\background", - edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", - tile = true, tileSize = 16, edgeSize = 4, - insets = {left = 0, right = 0, top = 0, bottom = 0}} + local AceComm = LibStub ("AceComm-3.0") + local AceSerializer = LibStub ("AceSerializer-3.0") + local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) - local frame = CreateFrame ("frame", "DetailsCustomPanel", UIParent) - frame:SetPoint ("center", UIParent, "center", 100, -100) - frame:SetWidth (512) - frame:SetHeight (183) - frame:EnableMouse (true) - frame:SetMovable (true) - frame:SetFrameLevel (1) - - local frameD = CreateFrame ("frame", "DetailsCustomPanelDisable", frame) - frameD:SetPoint ("center", frame, "center") - frameD:SetWidth (512) - frameD:SetHeight (183) - frameD:EnableMouse (true) - frameD:SetFrameStrata ("fullscreen") - frameD:SetBackdrop ({ - bgFile = "Interface\\AddOns\\Details\\images\\background", - edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", - tile = true, tileSize = 16, edgeSize = 4}) - frameD:SetBackdropColor (0, 0, 0, .8) - frameD.string = frameD:CreateFontString (nil, "overlay", "GameFontNormal") - frameD.string:SetPoint ("center", frameD, "center") - frameD.string:SetText ("There is a problem connecting some nether tubes\nOur ethereal engineers are already working to fix this issue,\n\nTo avoid mana wyrms proliferation, this panel is disabled for now.\n(Press Escape To Close)") - --frameD:Hide() - - frame.fundo = frame:CreateTexture (nil, "border") - frame.fundo:SetTexture ("Interface\\AddOns\\Details\\images\\custom_bg") - frame.fundo:SetPoint ("topleft", frame, "topleft") - - frame.move = gump:NewDetailsButton (frame, frame, _, function() end, nil, nil, 1, 1, "", "", "", "", nil, "DetailsCustomPanelMoveFrame") - frame.move:SetPoint ("topleft", frame, "topleft") - frame.move:SetPoint ("bottomright", frame, "bottomright") - frame.move:SetFrameLevel (frame:GetFrameLevel()+1) - - --> botão de fechar - frame.fechar = _CreateFrame ("Button", nil, frame, "UIPanelCloseButton") - frame.fechar:SetWidth (32) - frame.fechar:SetHeight (32) - frame.fechar:SetPoint ("TOPRIGHT", frame, "TOPRIGHT", -1, -8) - frame.fechar:SetText ("X") - frame.fechar:SetFrameLevel (frame:GetFrameLevel()+2) - - frame.fechar:SetScript ("OnClick", function() - _detalhes:CloseCustomWindow() - end) - - frame:SetScript ("OnHide", function() - _detalhes:CloseCustomWindow() - end) - - --> help button - local helpButton = CreateFrame ("button", "DetailsCustomPanelHelpButton", frame, "MainHelpPlateButton") - helpButton:SetWidth (36) - helpButton:SetHeight (36) - helpButton.I:SetWidth (25) - helpButton.I:SetHeight (25) - helpButton.Ring:SetWidth (36) - helpButton.Ring:SetHeight (36) - helpButton.Ring:SetPoint ("center", 7, -7) - helpButton:SetPoint ("topright", frame, "topright", -20, -7) - helpButton:SetFrameLevel (frame.fechar:GetFrameLevel()) +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> local pointers - local customHelp = { - FramePos = {x = 0, y = -30}, - FrameSize = {width = 512, height = 120}, - - [1] ={HighLightBox = {x = 15, y = -39, width = 100, height = 70}, - ButtonPos = { x = 43, y = -50}, - ToolTipDir = "LEFT", - ToolTipText = Loc ["STRING_CUSTOM_HELP1"] - }, - [2] ={HighLightBox = {x = 120, y = -9, width = 170, height = 95}, - ButtonPos = { x = 182, y = -30}, - ToolTipDir = "RIGHT", - ToolTipText = Loc ["STRING_CUSTOM_HELP2"] - }, - [3] ={HighLightBox = {x = 295, y = -9, width = 170, height = 75}, - ButtonPos = { x = 363, y = -25}, - ToolTipDir = "RIGHT", - ToolTipText = Loc ["STRING_CUSTOM_HELP3"] - }, - [4] ={HighLightBox = {x = 470, y = -25, width = 30, height = 25}, - ButtonPos = { x = 485, y = -15}, - ToolTipDir = "RIGHT", - ToolTipText = Loc ["STRING_CUSTOM_HELP4"] - } - } - helpButton:SetScript ("OnClick", function() - if (not HelpPlate_IsShowing (customHelp)) then - HelpPlate_Show (customHelp, frame, helpButton, true) - else - HelpPlate_Hide (true) + local _cstr = string.format --lua local + local _math_ceil = math.ceil --lua local + local _math_floor = math.floor --lua local + local _ipairs = ipairs --lua local + local _pairs = pairs --lua local + local _string_lower = string.lower --lua local + local _table_sort = table.sort --lua local + local _table_insert = table.insert --lua local + local _unpack = unpack --lua local + local _setmetatable = setmetatable --lua local + + local _GetSpellInfo = _detalhes.getspellinfo --api local + local _CreateFrame = CreateFrame --api local + local _GetTime = GetTime --api local + local _GetCursorPosition = GetCursorPosition --api local + local _GameTooltip = GameTooltip --api local + local _UIParent = UIParent --api local + local _GetScreenWidth = GetScreenWidth --api local + local _GetScreenHeight = GetScreenHeight --api local + local _IsAltKeyDown = IsAltKeyDown --api local + local _IsShiftKeyDown = IsShiftKeyDown --api local + local _IsControlKeyDown = IsControlKeyDown --api local + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> constants + + local atributos = _detalhes.atributos + local sub_atributos = _detalhes.sub_atributos + + local CLASS_ICON_TCOORDS = _G.CLASS_ICON_TCOORDS + + local class_type_dano = _detalhes.atributos.dano + local class_type_misc = _detalhes.atributos.misc + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> create the window + + function _detalhes:CloseCustomDisplayWindow() + + --> cancel editing or creation + if (DetailsCustomPanel.CodeEditing) then + DetailsCustomPanel:CancelFunc() end - end) - - --> titulo - gump:NewLabel (frame, frame, nil, "titulo", "Custom Display", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) - frame.titulo:SetPoint ("center", frame, "center") - frame.titulo:SetPoint ("top", frame, "top", 0, -18) - - --> icone no canto esquerdo superior - frame.classe_icone = frame:CreateTexture (nil, "BACKGROUND") - frame.classe_icone:SetPoint ("TOPLEFT", frame, "TOPLEFT", 4, 0) - frame.classe_icone:SetWidth (64) - frame.classe_icone:SetHeight (64) - frame.classe_icone:SetDrawLayer ("BACKGROUND", 1) - frame.classe_icone:SetTexture ("Interface\\AddOns\\Details\\images\\classes_plus") - frame.classe_icone:SetTexCoord (0, 0.25, 0.25, 0.5) - - -------------------------------------------------------------------------------------------------------------------------------------------------------- - - frame.atributo = nil - frame.sub_atributo = nil - - local SubMenu = function (atributo) - frame.sub_atributo = atributo - - end - - - local LeftButtons = frame.fechar:CreateTexture (nil, "overlay") - LeftButtons:SetWidth (56) - LeftButtons:SetHeight (70) - LeftButtons:SetPoint ("left", frame, "left", 15, -29) - LeftButtons:SetTexture ("Interface\\Glues\\CHARACTERCREATE\\AlternateForm") - LeftButtons:SetTexCoord (0, 1, 0, 0.62890625) - LeftButtons:SetDrawLayer ("overlay", 4) - - --> botão de deletar um custom - local DeleteButton = gump:NewDetailsButton (frame, frame, _, function()end, nil, nil, 60, 15, "", "", "", "", nil, "DetailsCustomPanelDeleteButton") - DeleteButton.text:SetText (Loc ["STRING_CUSTOM_REMOVE"]) - DeleteButton.text:SetJustifyH ("left") - DeleteButton.text:SetPoint ("left", DeleteButton, "left", 0, -1) - DeleteButton:SetPoint ("topleft", LeftButtons, "topleft", 34, -10) - DeleteButton:SetFrameLevel (frame:GetFrameLevel()+2) - DeleteButton:InstallCustomTexture (_, {x1 = -20, x2 = 0, y1 = -2, y2 = -2}) - --DeleteButton. - - local removeTexture = frame.fechar:CreateTexture (nil, "overlay") - removeTexture:SetWidth (23) - removeTexture:SetHeight (23) - removeTexture:SetTexture ("Interface\\ICONS\\Spell_BrokenHeart") - removeTexture:SetTexCoord (5/64, 60/64, 4/64, 62/64) - removeTexture:SetPoint ("topleft", LeftButtons, "topleft", 6, -8) - removeTexture:SetDrawLayer ("overlay", 3) - - --> botão de dar broadcast em um custom - local BroadcastButton = gump:NewDetailsButton (frame, frame, _, function()end, nil, nil, 60, 15, "", "", "", "", nil, "DetailsCustomPanelBroadcastButton") - BroadcastButton.text:SetText (Loc ["STRING_CUSTOM_BROADCAST"]) - BroadcastButton.text:SetJustifyH ("left") - BroadcastButton.text:SetPoint ("left", BroadcastButton, "left", 0, -1) - BroadcastButton:SetPoint ("topleft", LeftButtons, "topleft", 34, -42) - BroadcastButton:SetFrameLevel (frame:GetFrameLevel()+2) - BroadcastButton:InstallCustomTexture (_, {x1 = -20, x2 = 0, y1 = -2, y2 = -2}) - - local broadcastTexture = frame.fechar:CreateTexture (nil, "overlay") - broadcastTexture:SetWidth (23) - broadcastTexture:SetHeight (23) - broadcastTexture:SetTexture ("Interface\\ICONS\\Ability_Warrior_RallyingCry") - broadcastTexture:SetTexCoord (5/64, 60/64, 4/64, 62/64) - broadcastTexture:SetPoint ("topleft", LeftButtons, "topleft", 6, -40) - broadcastTexture:SetDrawLayer ("overlay", 3) - - - local fundoBrilha = frame:CreateTexture (nil, "overlay") - fundoBrilha:SetWidth (140) - fundoBrilha:SetHeight (36) - fundoBrilha:SetTexture ("Interface\\PetBattles\\Weather-Sunlight") - fundoBrilha:SetTexCoord (.3, 1, 0, 1) - - local MainMenu = function (atributo) - - frame.atributo = atributo - frame.sub_atributo = 1 - - fundoBrilha:SetPoint ("left", frame.MainMenu [atributo].icon , "right", -20, -10) - - frame.selectAttributeDropdown:Select (1, true) - end - - frame.MainMenu = {} - frame.SubMenu = {} - - do - - local x = 140 - local x2 = 170 - - local y = -17 - - local OnEnterHook = function (button) - button.text:SetTextColor (1, 1, 1) + if (DetailsCustomPanel.IsEditing) then + DetailsCustomPanel:CancelFunc() end - local OnLeaveHook = function (button) - button.text:SetTextColor (button.textColor.r, button.textColor.g, button.textColor.b ) - end - - --> 4 atributos principais + DetailsCustomPanel:Reset() - local half = 0.00048828125 - local size = 0.03125 - - local att_names = {Loc ["STRING_CUSTOM_ATT1"], Loc ["STRING_CUSTOM_ATT2"], Loc ["STRING_CUSTOM_ATT3"], Loc ["STRING_CUSTOM_ATT4"]} - - for i = 1, 4 do - - local button = gump:NewDetailsButton (frame, frame, _, MainMenu, i, nil, 120, 15, "", "", "", "", nil, "DetailsCustomPanelAttributeButton"..i) - button.MouseOnEnterHook = OnEnterHook - button.MouseOnLeaveHook = OnLeaveHook - - button.textura = button:CreateTexture (nil, "overlay") - button.textura:SetPoint ("right", button, "left", 60, 0) - button.icon = button:CreateTexture (nil, "background") - button.icon:SetPoint ("center", button.textura, "center", 2, 0) - button.icon:SetTexture ("Interface\\AddOns\\Details\\images\\skins\\default_skin") - button.icon:SetWidth (22) - button.icon:SetHeight (22) - - button.icon:SetTexCoord ( (0.03125 * (i-1)) + half, (0.03125 * i) - half, 0.35693359375, 0.38720703125) - - if (i == 1) then - button.textura:SetTexture ("Interface\\ExtraButton\\ChampionLight") - --button.icon:SetTexCoord (32/256 * (1-1), 32/256 * 1, 0, 1) - - elseif (i == 2) then - button.textura:SetTexture ("Interface\\ExtraButton\\Ysera") - --button.icon:SetTexCoord (32/256 * (2-1), 32/256 * 2, 0, 1) - --button.icon:SetPoint ("center", button.textura, "center", 3, 0) - - elseif (i == 3) then - button.textura:SetTexture ("Interface\\ExtraButton\\FengShroud") - --button.icon:SetTexCoord (32/256 * (3-1), 32/256 * 3, 0, 1) - - elseif (i == 4) then - button.textura:SetTexture ("Interface\\ExtraButton\\BrewmoonKeg") - --button.icon:SetTexCoord (32/256 * (4-1), 32/256 * 4, 0, 1) - - end - - button.textura:SetWidth (76) - button.textura:SetHeight (40) - button:SetPoint ("topleft", frame, "topleft", x, i*-33 + (y)) - button.text:SetText (att_names [i]) - button.text:SetPoint ("left", button, "left", 65, 0) - button:SetFrameLevel (frame:GetFrameLevel()+2) - - frame.MainMenu [i] = button - end - - frame.atributo = 1 - frame.sub_atributo = 1 - fundoBrilha:SetPoint ("left", frame.MainMenu [1].icon , "right", -20, -10) - - --> 5 atributos secundarios - - --[[ - for i = 1, 5 do - local button = gump:NewDetailsButton (frame, frame, _, SubMenu, i, nil, 60, 15, "", "", "", "") - button:SetPoint ("topleft", frame, "topleft", x2, i*-15) - button.text:SetPoint ("left", button, "left", 5, 0) - button.text:SetText ("sub menu "..i) - button:SetFrameLevel (frame:GetFrameLevel()+2) - frame.SubMenu [i] = button - end - --]] + --> hide the frame + _G.DetailsCustomPanel:Hide() end - -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---> Edit Boxes - - local xStart = 290 - local WidthMax = 220 ---> labels - local name_text = gump:NewLabel (frame, nil, "$parentNameBoxLabel", nil, Loc ["STRING_CUSTOM_NAME"], "GameFontHighlightLeft", 11) - local spell_text = gump:NewLabel (frame, nil, "$parentSpellBoxLabel", nil, Loc ["STRING_CUSTOM_SPELLID"]) - local source_text = gump:NewLabel (frame, nil, "$parentSourceBoxLabel", nil, Loc ["STRING_CUSTOM_SOURCE"]) - local target_text = gump:NewLabel (frame, nil, "$parentTargetBoxLabel", nil, Loc ["STRING_CUSTOM_TARGET"]) - local subattribute_text = gump:NewLabel (frame, nil, "$parentSubAttributeBoxLabel", nil, Loc ["STRING_CUSTOM_ATTRIBUTE"]) - - name_text:SetPoint ("topleft", frame, "topleft", xStart, -45) - subattribute_text:SetPoint ("topleft", frame, "topleft", xStart, -65) - source_text:SetPoint ("topleft", frame, "topleft", xStart, -85) - target_text:SetPoint ("topleft", frame, "topleft", xStart, -105) - spell_text:SetPoint ("topleft", frame, "topleft", xStart, -125) + function _detalhes:OpenCustomDisplayWindow() ---> name entry - local name_entry = gump:NewTextEntry (frame, frame, "$parentNameEntry", "TextMyNameEntry", 140, 20) - name_entry:SetFrameLevel (frame:GetFrameLevel()+2) - name_entry:SetPoint ("left", name_text, "right", 2, 0) - ---> sub attribute - - local on_choose_attribute = function (_, _, attribute_number) - frame.sub_atributo = attribute_number - end - local build_attribute_menu = function() - local menu = {} - - local attributes = _detalhes.sub_atributos [frame.atributo].lista - local icons = _detalhes.sub_atributos [frame.atributo].icones - - for index, attribute_name in ipairs (attributes) do - menu [#menu+1] = {value = index, label = attribute_name, onclick = on_choose_attribute, icon = icons [index] [1], texcoord = icons [index] [2]} - end - - return menu - end + if (not _G.DetailsCustomPanel) then - local select_attribute = gump:NewDropDown (frame, frame, "$parentAttributeDropdown", "selectAttributeDropdown", 140, 20, build_attribute_menu) - select_attribute:SetFrameLevel (frame:GetFrameLevel()+2) - select_attribute:SetPoint ("left", subattribute_text, "right", 2, 0) + local GameCooltip = GameCooltip ---> spell id entry - local SpellIDSelected = function (param1, param2, texto, editbox) - local _ThisSpellName, _, _ThisSpellIcon = _GetSpellInfo (tonumber (texto)) - if (_ThisSpellName) then - frame.IconTexture = _ThisSpellIcon - frame.icon:SetTexture (frame.IconTexture) + --> main frame + local custom_window = _CreateFrame ("frame", "DetailsCustomPanel", UIParent) + custom_window:SetPoint ("center", UIParent, "center") + custom_window:SetSize (850, 370) + custom_window:EnableMouse (true) + custom_window:SetMovable (true) + custom_window:SetScript ("OnMouseDown", function (self) + if (not self.moving) then + self.moving = true + self:StartMoving() + end + end) + custom_window:SetScript ("OnMouseUp", function (self) + if (self.moving) then + self.moving = false + self:StopMovingOrSizing() + end + end) + custom_window:SetScript ("OnShow", function() + GameCooltip:Hide() + end) - if (frame ["TextMyNameEntry"].text == "") then - frame ["TextMyNameEntry"].text = _ThisSpellName - frame ["TextMyNameEntry"]:SetText (_ThisSpellName) - end - end - end - - local spellid_entry = gump:NewSpellEntry (frame, SpellIDSelected, 140, 20, nil, nil, "TextSpellIDEntry", "$parentSpellidEntry") - spellid_entry:SetPoint ("left", spell_text, "right", 2, 0) - frame ["TextSpellIDEntry"]:SetFrameLevel (frame:GetFrameLevel()+2) - - local frameEncounterSkill = CreateFrame ("frame", nil, frame) - frameEncounterSkill:SetPoint ("left", frame ["TextSpellIDEntry"].widget, "right") - frameEncounterSkill:SetWidth (20) - frameEncounterSkill:SetHeight (20) - frameEncounterSkill:SetFrameLevel (frame:GetFrameLevel()+2) - local frameEncounterSkillImage = frameEncounterSkill:CreateTexture (nil, "overlay") - frameEncounterSkillImage:SetPoint ("center", frameEncounterSkill) - frameEncounterSkillImage:SetTexture ("Interface\\Buttons\\UI-MicroButton-Raid-Up") - frameEncounterSkillImage:SetTexCoord (0.046875, 0.90625, 0.40625, 0.953125) - frameEncounterSkillImage:SetWidth (20) - frameEncounterSkillImage:SetHeight (16) - - local GameCooltip = GameCooltip - - local spellsFrame = gump:NewPanel (frame, _, "DetailsCustomSpellsFrame", "spellsFrame", 1, 1) - spellsFrame:SetPoint ("bottomleft", frame, "topleft", 62, -14) - spellsFrame:Hide() - - local selectedEncounterSpell = function (spellId) - local nome_magia, _, icone_magia = _GetSpellInfo (spellId) - frame ["TextMyNameEntry"]:SetText (nome_magia) - frame ["TextMyNameEntry"]:PressEnter() - frame ["TextSpellIDEntry"]:SetText (spellId) - frame ["TextSpellIDEntry"]:PressEnter() - frame ["TextSourceEntry"]:SetText ("[all]") - frame ["TextSourceEntry"]:PressEnter() - frame.icon:SetTexture (icone_magia) - spellsFrame:Hide() - end - - local spellsFrameButtons = {} - - local buttonMouseOver = function (button) - button.MyObject.image:SetBlendMode ("ADD") - button.MyObject.line:SetBlendMode ("ADD") - button.MyObject.label:SetTextColor (1, 1, 1, 1) - local OnEnterColors = button:GetParent().Gradient.OnEnter - local _r, _g, _b, _a = button:GetParent():GetBackdropColor() - gump:GradientEffect (button:GetParent(), "frame", _r, _g, _b, _a, OnEnterColors[1], OnEnterColors[2], OnEnterColors[3], OnEnterColors[4], .3) - end - local buttonMouseOut = function (button) - button.MyObject.image:SetBlendMode ("BLEND") - button.MyObject.line:SetBlendMode ("BLEND") - button.MyObject.label:SetTextColor (.8, .8, .8, .8) - local _r, _g, _b, _a = button:GetParent():GetBackdropColor() - if (_r) then - local OnLeaveColors = button:GetParent().Gradient.OnLeave - gump:GradientEffect (button:GetParent(), "frame", _r, _g, _b, _a, OnLeaveColors[1], OnLeaveColors[2], OnLeaveColors[3], OnLeaveColors[4], .3) - end - end - - local EncounterSelect = function (_, _, instanceId, bossIndex) - - spellsFrame:Show() - - local spells = _detalhes:GetEncounterSpells (instanceId, bossIndex) - - local x = 10 - local y = 10 - local i = 1 - - for spell, _ in pairs (spells) do - - local thisButton = spellsFrameButtons [i] + tinsert (UISpecialFrames, "DetailsCustomPanel") - if (not thisButton) then - thisButton = gump:NewButton (spellsFrame.frame, spellsFrame.frame, "DetailsCustomSpellsFrameButton"..i, "button"..i, 80, 20, selectedEncounterSpell) - thisButton:SetPoint ("topleft", "DetailsCustomSpellsFrame", "topleft", x, -y) - local t = gump:NewImage (thisButton, nil, 20, 20, nil, nil, "image", "DetailsCustomEncounterImageButton"..i) - t:SetPoint ("left", thisButton) - thisButton:SetHook ("OnEnter", buttonMouseOver) - thisButton:SetHook ("OnLeave", buttonMouseOut) + --> background texture + custom_window.background = custom_window:CreateTexture (nil, "border") + custom_window.background:SetTexture ([[Interface\AddOns\Details\images\custom_bg]]) + custom_window.background:SetPoint ("topleft", custom_window, "topleft") + --custom_window.background:Hide() + + local bigdog = gump:NewImage (custom_window, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180*0.7, 200*0.7, "overlay", {0, 1, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog") + bigdog:SetPoint ("bottomleft", custom_window, "bottomleft", 15, 9) + bigdog:SetAlpha (0.5) - local text = gump:NewLabel (thisButton, nil, "DetailsCustomSpellsFrameButton"..i.."Label", "label", "Spell", nil, 9.5, {.8, .8, .8, .8}) - text:SetPoint ("left", t.image, "right", 2, 0) - text:SetWidth (73) - text:SetHeight (10) + --> close button + custom_window.close = _CreateFrame ("button", nil, custom_window, "UIPanelCloseButton") + custom_window.close:SetSize (32, 32) + custom_window.close:SetPoint ("topright", custom_window, "topright", 5, -8) + custom_window.close:SetFrameLevel (custom_window:GetFrameLevel()+2) + custom_window.close:SetScript ("OnClick", function() + _detalhes:CloseCustomDisplayWindow() + end) + custom_window.close:SetScript ("OnHide", function() + _detalhes:CloseCustomDisplayWindow() + end) + + --> title + custom_window.title = gump:NewLabel (custom_window, nil, nil, nil, "Custom Display", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) + custom_window.title:SetPoint ("center", custom_window, "center") + custom_window.title:SetPoint ("top", custom_window, "top", 0, -18) + + --> icon + custom_window.icon = custom_window:CreateTexture (nil, "background") + custom_window.icon:SetPoint ("topleft", custom_window, "topleft", 4, 0) + custom_window.icon:SetSize (64, 64) + custom_window.icon:SetDrawLayer ("background", 1) + custom_window.icon:SetTexture ([[Interface\AddOns\Details\images\classes_plus]]) + custom_window.icon:SetTexCoord (0, 0.25, 0.25, 0.5) + + DetailsCustomPanel.BoxType = 1 + DetailsCustomPanel.IsEditing = false + DetailsCustomPanel.CodeEditing = false + DetailsCustomPanel.current_attribute = "damagedone" + + DetailsCustomPanel.code1_default = [[ + --get the parameters passed + local combat, instance_container, instance = ... + --declade the values to return + local total, top, amount = 0, 0, 0 + + --do the loop + + --loop end + + --return the values + return total, top, amount + ]] + DetailsCustomPanel.code1 = DetailsCustomPanel.code1_default + + DetailsCustomPanel.code2_default = [[ + --get the parameters passed + local actor, combat, instance = ... + + --get the cooltip object (we dont use the convencional GameTooltip here) + local GameCooltip = GameCooltip + + --Cooltip code + ]] + DetailsCustomPanel.code2 = DetailsCustomPanel.code2_default + + function DetailsCustomPanel:Reset() + self.name_field:SetText ("") + self.icon_image:SetTexture ([[Interface\ICONS\TEMP]]) + self.desc_field:SetText ("") - local border = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 40, 38, nil, nil, "border", "DetailsCustomEncounterBorderButton"..i) - border:SetTexCoord (0.00390625, 0.27734375, 0.44140625,0.69531250) - border:SetDrawLayer ("background") - border:SetPoint ("topleft", thisButton.button, "topleft", -9, 9) + self.author_field:SetText (UnitName ("player") .. "-" .. GetRealmName()) + self.author_field:Enable() - local line = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 84, 25, nil, nil, "line", "DetailsCustomEncounterLineButton"..i) - line:SetTexCoord (0.31250000, 0.96484375, 0.37109375, 0.52343750) - line:SetDrawLayer ("background") - line:SetPoint ("left", thisButton.button, "right", -60, -3) + self.source_dropdown:Select (1, true) + self.source_field:SetText ("") - table.insert (spellsFrameButtons, #spellsFrameButtons+1, thisButton) + self.target_dropdown:Select (1, true) + self.target_field:SetText ("") + + self.spellid_entry:SetText ("") + + DetailsCustomPanel.code1 = DetailsCustomPanel.code1_default + DetailsCustomPanel.code2 = DetailsCustomPanel.code2_default + + DetailsCustomPanel.current_attribute = "damagedone" + DetailsCustomPanelAttributeMenu1:Click() end - y = y + 20 - if (y >= 110) then - y = 10 - x = x + 100 - end - - local nome_magia, _, icone_magia = _GetSpellInfo (spell) - thisButton.image:SetTexture (icone_magia) - thisButton.label:SetText (nome_magia) - thisButton:SetClickFunction (selectedEncounterSpell, spell) - thisButton:Show() - i = i + 1 - end - - for maxIndex = i, #spellsFrameButtons do - spellsFrameButtons [maxIndex]:Hide() - end - - i = i-1 - spellsFrame:SetSize (math.ceil (i/5)*110, math.min (i*20 + 10, 120)) - - end - - local BuildEncounterMenu = function() - - GameCooltip:Reset() - GameCooltip:SetType ("menu") - GameCooltip:SetOwner (frameEncounterSkill) - - for instanceId, instanceTable in pairs (_detalhes.EncounterInformation) do - - GameCooltip:AddLine (instanceTable.name, _, 1, "white") - GameCooltip:AddIcon (instanceTable.icon, 1, 1, 64, 32) - - for index, encounterName in ipairs (instanceTable.boss_names) do - GameCooltip:AddMenu (2, EncounterSelect, instanceId, index, nil, encounterName, nil, true) - local L, R, T, B, Texture = _detalhes:GetBossIcon (instanceId, index) - GameCooltip:AddIcon (Texture, 2, 1, 20, 20, L, R, T, B) - end - end - - GameCooltip:SetOption ("HeightAnchorMod", -10) - GameCooltip:ShowCooltip() - end - - frameEncounterSkill:SetScript ("OnEnter", function() - frameEncounterSkillImage:SetBlendMode ("ADD") - BuildEncounterMenu() - end) - - frameEncounterSkill:SetScript ("OnLeave", function() - frameEncounterSkillImage:SetBlendMode ("BLEND") - end) - - local _string_lower = string.lower - local _string_sub = string.sub - ---> source - local SourceSelected = function (param1, param2, texto, editbox) end - - local source_entry = gump:NewTextEntry (frame, frame, "$parentSourceEntry", "TextSourceEntry", 140, 20) - - frame ["TextSourceEntry"]:SetFrameLevel (frame:GetFrameLevel()+2) - frame ["TextSourceEntry"]:SetPoint ("left", source_text, "right", 2, 0) - - frame ["TextSourceEntry"].InputHook = function() - local texto = frame ["TextSourceEntry"]:GetText() - texto:gsub ("[raid]", "|cFFFF00FF|r[raid]") - texto:gsub ("[all]", "|cFF0000FF|r[all]") - texto:gsub ("[player]", "|cFFFF0000|r[player]") - frame ["TextSourceEntry"]:SetText (texto) - end - frame ["TextSourceEntry"].EnterHook = function() - local texto = frame ["TextSourceEntry"]:GetText() - if (texto:find ("%[raid%]")) then - frame ["TextSourceEntry"]:SetText ("[raid]") - elseif (texto:find ("%[all%]")) then - frame ["TextSourceEntry"]:SetText ("[all]") - elseif (texto:find ("%[player%]")) then - frame ["TextSourceEntry"]:SetText ("[player]") - end - end - ---> target - - local target_entry = gump:NewTextEntry (frame, frame, "$parentTargetEntry", "TextActorNameEntry", 140, 20) - frame ["TextActorNameEntry"]:SetFrameLevel (frame:GetFrameLevel()+2) - frame ["TextActorNameEntry"]:SetPoint ("left", target_text, "right", 2, 0) - - --> Tab Order - frame ["TextMyNameEntry"]:SetNext (frame ["TextSourceEntry"]) - frame ["TextSourceEntry"]:SetNext (frame ["TextActorNameEntry"]) - frame ["TextActorNameEntry"]:SetNext (frame ["TextSpellIDEntry"]) - frame ["TextSpellIDEntry"]:SetNext (frame ["TextMyNameEntry"]) - - --> Tooltips - --> localize-me - frame ["TextMyNameEntry"].tooltip = Loc ["STRING_CUSTOM_TOOLTIPNAME"] - frame ["TextSpellIDEntry"].tooltip = Loc ["STRING_CUSTOM_TOOLTIPSPELL"] - frame ["TextSourceEntry"].tooltip = Loc ["STRING_CUSTOM_TOOLTIPSOURCE"] - frame ["TextActorNameEntry"].tooltip = Loc ["STRING_CUSTOM_TOOLTIPTARGET"] -- .."\n|cFFFF0000"..Loc ["STRING_CUSTOM_TOOLTIPNOTWORKING"] - - frame.IconTexture = "Interface\\Icons\\TEMP" - - local ChooseIcon = function() - if (not frame.IconFrame) then - - frame.IconFrame = CreateFrame ("frame", "DetailsCustomPanelIcons", frame) - - frame.IconFrame:SetPoint ("bottomright", frame, "topright", 0, 0) - frame.IconFrame:SetWidth (182) - frame.IconFrame:SetHeight (160) - frame.IconFrame:EnableMouse (true) - frame.IconFrame:SetMovable (true) - frame.IconFrame:SetBackdrop (gump_fundo_backdrop) - frame.IconFrame:SetBackdropBorderColor (170/255, 170/255, 170/255) - frame.IconFrame:SetBackdropColor (24/255, 24/255, 24/255, .8) - frame.IconFrame:SetFrameLevel (1) - - local MACRO_ICON_FILENAMES = {}; - frame.IconFrame:SetScript ("OnShow", function() - - MACRO_ICON_FILENAMES = {}; - MACRO_ICON_FILENAMES[1] = "INV_MISC_QUESTIONMARK"; - local index = 2; - local numFlyouts = 0; - - for i = 1, GetNumSpellTabs() do - local tab, tabTex, offset, numSpells, _ = GetSpellTabInfo(i); - offset = offset + 1; - local tabEnd = offset + numSpells; - for j = offset, tabEnd - 1 do - --to get spell info by slot, you have to pass in a pet argument - local spellType, ID = GetSpellBookItemInfo(j, "player"); - if (spellType ~= "FUTURESPELL") then - local spellTexture = strupper(GetSpellBookItemTexture(j, "player")); - if ( not string.match( spellTexture, "INTERFACE\\BUTTONS\\") ) then - MACRO_ICON_FILENAMES[index] = gsub( spellTexture, "INTERFACE\\ICONS\\", ""); - index = index + 1; - end - end - if (spellType == "FLYOUT") then - local _, _, numSlots, isKnown = GetFlyoutInfo(ID); - if (isKnown and numSlots > 0) then - for k = 1, numSlots do - local spellID, overrideSpellID, isKnown = GetFlyoutSlotInfo(ID, k) - if (isKnown) then - MACRO_ICON_FILENAMES[index] = gsub( strupper(GetSpellTexture(spellID)), "INTERFACE\\ICONS\\", ""); - index = index + 1; - end - end - end - end + function DetailsCustomPanel:RemoveDisplay (custom_object, index) + table.remove (_detalhes.custom, index) + + for _, instance in _ipairs (_detalhes.tabela_instancias) do + if (instance.atributo == 5 and instance.sub_atributo == index) then + instance:ResetAttribute() + elseif (instance.atributo == 5 and instance.sub_atributo > index) then + instance.sub_atributo = instance.sub_atributo - 1 + instance.sub_atributo_last [5] = 1 + else + instance.sub_atributo_last [5] = 1 end end - GetMacroIcons (MACRO_ICON_FILENAMES) - GetMacroItemIcons (MACRO_ICON_FILENAMES ) + _detalhes.switch:OnRemoveCustom (index) + end + + function DetailsCustomPanel:StartEdit (custom_object) - end) - - frame.IconFrame:SetScript ("OnHide", function() - MACRO_ICON_FILENAMES = nil; - collectgarbage() - end) - - frame.IconFrame.buttons = {} - - local OnClickFunction = function (index) - local button = frame.IconFrame.buttons [index] - local texture = button:GetNormalTexture() - frame.IconTexture = "INTERFACE\\ICONS\\"..MACRO_ICON_FILENAMES [button.IconID] - frame.icon:SetTexture (frame.IconTexture) - frame.IconFrame:Hide() - end - - for i = 0, 4 do - local newcheck = gump:NewDetailsButton (frame.IconFrame, frame.IconFrame, _, OnClickFunction, i+1, i+1, 30, 28, "", "", "", "", _, "DetailsIconCheckFrame"..(i+1)) - newcheck:SetPoint ("topleft", frame.IconFrame, "topleft", 3+(i*30), -13) - newcheck:SetID (i+1) - frame.IconFrame.buttons [#frame.IconFrame.buttons+1] = newcheck - end - for i = 6, 10 do - local newcheck = gump:NewDetailsButton (frame.IconFrame, frame.IconFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconCheckFrame"..i) - newcheck:SetPoint ("topleft", "DetailsIconCheckFrame"..(i-5), "bottomleft", 0, -1) - newcheck:SetID (i) - frame.IconFrame.buttons [#frame.IconFrame.buttons+1] = newcheck - end - for i = 11, 15 do - local newcheck = gump:NewDetailsButton (frame.IconFrame, frame.IconFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconCheckFrame"..i) - newcheck:SetPoint ("topleft", "DetailsIconCheckFrame"..(i-5), "bottomleft", 0, -1) - newcheck:SetID (i) - frame.IconFrame.buttons [#frame.IconFrame.buttons+1] = newcheck - end - for i = 16, 20 do - local newcheck = gump:NewDetailsButton (frame.IconFrame, frame.IconFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconCheckFrame"..i) - newcheck:SetPoint ("topleft", "DetailsIconCheckFrame"..(i-5), "bottomleft", 0, -1) - newcheck:SetID (i) - frame.IconFrame.buttons [#frame.IconFrame.buttons+1] = newcheck - end - for i = 21, 25 do - local newcheck = gump:NewDetailsButton (frame.IconFrame, frame.IconFrame, _, OnClickFunction, i, i, 30, 28, "", "", "", "", _, "DetailsIconCheckFrame"..i) - newcheck:SetPoint ("topleft", "DetailsIconCheckFrame"..(i-5), "bottomleft", 0, -1) - newcheck:SetID (i) - frame.IconFrame.buttons [#frame.IconFrame.buttons+1] = newcheck - end - - local scroll = CreateFrame ("ScrollFrame", "DetailsIconsFrame", frame.IconFrame, "ListScrollFrameTemplate") - - local ChecksFrame_Update = function (self) - --self = self or MacroPopupFrame; - local numMacroIcons = #MACRO_ICON_FILENAMES; - local macroPopupIcon, macroPopupButton; - local macroPopupOffset = FauxScrollFrame_GetOffset (scroll); - local index; + DetailsCustomPanel:Reset() + DetailsCustomPanel.IsEditing = custom_object - -- Icon list - local texture; - for i = 1, 25 do - macroPopupIcon = _G["DetailsIconCheckFrame"..i]; - macroPopupButton = _G["DetailsIconCheckFrame"..i]; - index = (macroPopupOffset * 5) + i; - texture = MACRO_ICON_FILENAMES [index] - if ( index <= numMacroIcons and texture ) then - macroPopupButton:ChangeIcon ("INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture, "INTERFACE\\ICONS\\"..texture) - macroPopupButton.IconID = index - macroPopupButton:Show(); - else - macroPopupButton:Hide(); - end - - end + self.name_field:SetText (custom_object:GetName()) + self.desc_field:SetText (custom_object:GetDesc()) + self.icon_image:SetTexture (custom_object:GetIcon()) - -- Scrollbar stuff - FauxScrollFrame_Update (scroll, ceil (numMacroIcons / 5) , 5, 20 ); - end - - - scroll:SetPoint ("topleft", frame.IconFrame, "topleft", -18, -10) - scroll:SetWidth (170) - scroll:SetHeight (148) - scroll:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (scroll, offset, 20, ChecksFrame_Update) end) - scroll.update = ChecksFrame_Update - frame.IconFrameScroll = scroll - frame.IconFrame:Hide() - end - - frame.IconFrame:Show() - frame.IconFrameScroll.update (frame.IconFrameScroll) - - end - - local Icon - - local reset = function() - frame ["TextMyNameEntry"]:SetText ("") - frame ["TextSpellIDEntry"]:SetText ("") - frame ["TextActorNameEntry"]:SetText ("") - frame ["TextSourceEntry"]:SetText ("") - Icon:SetTexture ("Interface\\Icons\\TEMP") - frame.atributo = 1 - frame.sub_atributo = 1 - fundoBrilha:SetPoint ("left", frame.MainMenu [1].icon , "right", -20, -10) - end - - --> Create Button - local CreateFunction = function() - - local Atributo = frame.atributo --> healing - local SubAtributo = frame.sub_atributo --> healing done - - if (not Atributo or not SubAtributo) then - print (Loc ["STRING_CUSTOM_NOATTRIBUTO"]) - return - end - - if (frame ["TextMyNameEntry"]:HasFocus()) then - frame ["TextMyNameEntry"]:PressEnter() - elseif (frame ["TextSpellIDEntry"]:HasFocus())then - frame ["TextSpellIDEntry"]:PressEnter() - elseif (frame ["TextActorNameEntry"]:HasFocus())then - frame ["TextActorNameEntry"]:PressEnter() - elseif (frame ["TextSourceEntry"]:HasFocus())then - frame ["TextSourceEntry"]:PressEnter() - end - - local CustomName = frame ["TextMyNameEntry"].text - local SpellID = tonumber (frame ["TextSpellIDEntry"].text) - local Actor = frame ["TextActorNameEntry"].text - local Source = frame ["TextSourceEntry"].text - - if (not CustomName or string.len (CustomName) < 5) then - print (Loc ["STRING_CUSTOM_SHORTNAME"]) - --print ("Nome da customizacao precisa ter pelo menos 5 letras") - frame ["TextMyNameEntry"]:Blink() - return - elseif (string.len (CustomName) > 32) then - --print ("Nome da customizacao nao pode ter mais de 32 letras") - print (Loc ["STRING_CUSTOM_LONGNAME"]) - frame ["TextMyNameEntry"]:Blink() - return - end - - --if (string.len (SpellID) < 1) then - -- --print ("Sem id da magia") - -- print (Loc ["STRING_CUSTOM_NOSPELL"]) - -- frame ["TextSpellIDEntry"]:Blink() - -- return - --end - - _detalhes.custom [#_detalhes.custom+1] = {name = CustomName, spell = SpellID, target = Actor, source = Source, icon = frame.IconTexture, attribute = Atributo, sattribute = SubAtributo} - --print (CustomName, Actor, Source, SpellID, frame.IconTexture, Atributo, SubAtributo) - _detalhes:Msg (Loc ["STRING_CUSTOM_CREATED"]) - _detalhes:CloseCustomWindow() - reset() - end - - local IconButton = gump:NewDetailsButton (frame, frame, _, ChooseIcon, nil, nil, 80, 15, "", "", "", "", nil, "DetailsCustomPanelIconButton") - IconButton.text:SetText (Loc ["STRING_CUSTOM_ICON"]) - IconButton.text:SetPoint ("left", IconButton, "left", 3, 0) - IconButton:SetPoint ("topleft", frame, "topleft", xStart+21, -158) - IconButton:SetFrameLevel (frame:GetFrameLevel()+2) - IconButton:InstallCustomTexture (_, {x1 = -20, x2 = 0, y1 = 0, y2 = 0}) - frame.iconbutton = IconButton - - Icon = IconButton:CreateTexture (nil, "overlay") - Icon:SetTexture (frame.IconTexture) - Icon:SetPoint ("right", IconButton, "left", 0, 0) - Icon:SetWidth (22) - Icon:SetHeight (22) - frame.icon = Icon - - local CreateButton = gump:NewDetailsButton (frame, frame, _, CreateFunction, nil, nil, 80, 15, "", "", "", "", nil, "DetailsCustomPanelCreateButton") - CreateButton.text:SetText (Loc ["STRING_CUSTOM_CREATE"]) - CreateButton:SetPoint ("topleft", frame, "topleft", 413, -158) - CreateButton:SetFrameLevel (frame:GetFrameLevel()+2) - CreateButton:InstallCustomTexture (_, {x1 = -20, x2 = 0, y1 = 0, y2 = 0}) - - local CreateIcon = CreateButton:CreateTexture (nil, "overlay") - CreateIcon:SetTexture ("Interface\\Icons\\Ability_Paladin_HammeroftheRighteous") - CreateIcon:SetWidth (22) - CreateIcon:SetHeight (22) - CreateIcon:SetPoint ("right", CreateButton, "left") - ---------> Install CoolTip on Remove Button - local DeleteFunc = function (_, _, CustomIndex) - table.remove (_detalhes.custom, CustomIndex) - for _, instancia in _ipairs (_detalhes.tabela_instancias) do - if (instancia.atributo == 5 and instancia.sub_atributo == CustomIndex) then - if (instancia.iniciada) then - instancia:TrocaTabela (nil, 1, 1, true) - else - instancia.atributo = 1 - instancia.sub_atributo = 1 - end - elseif (instancia.atributo == 5 and instancia.sub_atributo > CustomIndex) then - instancia.sub_atributo = instancia.sub_atributo - 1 - instancia.sub_atributo_last [5] = 1 + self.author_field:SetText (custom_object:GetAuthor()) + self.author_field:Disable() + + if (custom_object:IsScripted()) then + + custom_window.script_button_attribute:Click() + + DetailsCustomPanel.code1 = custom_object:GetScript() + DetailsCustomPanel.code2 = custom_object:GetScriptToolip() + else - instancia.sub_atributo_last [5] = 1 + + local attribute = custom_object:GetAttribute() + if (attribute == "damagedone") then + DetailsCustomPanelAttributeMenu1:Click() + elseif (attribute == "healdone") then + DetailsCustomPanelAttributeMenu2:Click() + end + + local source = custom_object:GetSource() + if (source == "[all]") then + self.source_dropdown:Select (1, true) + self.source_field:SetText ("") + self.source_field:Disable() + elseif (source == "[raid]") then + self.source_dropdown:Select (2, true) + self.source_field:SetText ("") + self.source_field:Disable() + elseif (source == "[player]") then + self.source_dropdown:Select (3, true) + self.source_field:SetText ("") + self.source_field:Disable() + else + self.source_dropdown:Select (4, true) + self.source_field:SetText (source) + self.source_field:Enable() + end + + local target = custom_object:GetTarget() + + if (not target) then + self.target_dropdown:Select (5, true) + self.target_field:SetText ("") + self.target_field:Disable() + elseif (target == "[all]") then + self.target_dropdown:Select (1, true) + self.target_field:SetText ("") + self.target_field:Disable() + elseif (target == "[raid]") then + self.target_dropdown:Select (2, true) + self.target_field:SetText ("") + self.target_field:Disable() + elseif (target == "[player]") then + self.target_dropdown:Select (3, true) + self.target_field:SetText ("") + self.target_field:Disable() + else + self.target_dropdown:Select (4, true) + self.target_field:SetText (target) + self.target_field:Enable() + end + + self.spellid_entry:SetText (custom_object:GetSpellId() or "") + end + + DetailsCustomPanel:SetAcceptButtonText (Loc ["STRING_CUSTOM_SAVE"]) end - if (#_detalhes.custom > 0) then - _detalhes.popup:ExecFunc (DeleteButton) - else - GameCooltip:Close() - end - _detalhes.switch:OnRemoveCustom (CustomIndex) - end + + function DetailsCustomPanel:CreateNewCustom() + + local name = self.name_field:GetText() + + if (string.len (name) < 5) then + return false, _detalhes:Msg (Loc ["STRING_CUSTOM_SHORTNAME"]) + elseif (string.len (name) > 32) then + return false, _detalhes:Msg (Loc ["STRING_CUSTOM_LONGNAME"]) + end + + local icon = self.icon_image:GetTexture() + local desc = self.desc_field:GetText() + local author = self.author_field:GetText() + + if (DetailsCustomPanel.BoxType == 1) then + local source = self.source_dropdown:GetValue() + local target = self.target_dropdown:GetValue() + local spellid = self.spellid_entry:GetText() + + if (not source) then + source = self.source_field:GetText() + end + + if (not target) then + target = self.target_field:GetText() + elseif (target == "[none]") then + target = false + end + + if (spellid == "") then + spellid = false + end - local CreateCustomList = function() - for index, custom in _ipairs (_detalhes.custom) do - GameCooltip:AddMenu (1, DeleteFunc, index, nil, nil, custom.name, _, true) - GameCooltip:AddIcon (custom.icon, 1, 1, 20, 20, 0, 1, 0, 1) - end - end - - DeleteButton.CoolTip = { - Type = "menu", - BuildFunc = CreateCustomList, - Options = {NoLastSelectedBar = true, TextSize = 9.5, HeightAnchorMod = -10}} - _detalhes.popup:CoolTipInject (DeleteButton, true) + if (DetailsCustomPanel.IsEditing) then + local object = DetailsCustomPanel.IsEditing + object.name = name + object.icon = icon + object.desc = desc + object.author = author + object.attribute = DetailsCustomPanel.current_attribute + object.source = source + object.target = target + object.spellid = tonumber (spellid) + object.script = false + object.tooltip = false + + DetailsCustomPanel.IsEditing = false + _detalhes:Msg (Loc ["STRING_CUSTOM_SAVED"]) + self.author_field:Enable() + return true + else + local new_custom_object = { + ["name"] = name, + ["icon"] = icon, + ["desc"] = desc, + ["author"] = author, + ["attribute"] = DetailsCustomPanel.current_attribute, + ["source"] = source, + ["target"] = target, + ["spellid"] = tonumber (spellid), + ["script"] = false, + ["tooltip"] = false, + } + + tinsert (_detalhes.custom, new_custom_object) + _setmetatable (new_custom_object, _detalhes.atributo_custom) + new_custom_object.__index = _detalhes.atributo_custom + _detalhes:Msg (Loc ["STRING_CUSTOM_CREATED"]) + end + + DetailsCustomPanel:Reset() + + elseif (DetailsCustomPanel.BoxType == 2) then + + local main_code = DetailsCustomPanel.code1 + local tooltip_code = DetailsCustomPanel.code2 + + if (DetailsCustomPanel.IsEditing) then + local object = DetailsCustomPanel.IsEditing + object.name = name + object.icon = icon + object.desc = desc + object.author = author + object.attribute = false + object.source = false + object.target = false + object.spellid = false + object.script = main_code + object.tooltip = tooltip_code + + DetailsCustomPanel.IsEditing = false + _detalhes:Msg (Loc ["STRING_CUSTOM_SAVED"]) + self.author_field:Enable() + return true + else + local new_custom_object = { + ["name"] = name, + ["icon"] = icon, + ["desc"] = desc, + ["author"] = author, + ["attribute"] = false, + ["source"] = false, + ["target"] = false, + ["spellid"] = false, + ["script"] = main_code, + ["tooltip"] = tooltip_code, + } + + tinsert (_detalhes.custom, new_custom_object) + _setmetatable (new_custom_object, _detalhes.atributo_custom) + new_custom_object.__index = _detalhes.atributo_custom + _detalhes:Msg (Loc ["STRING_CUSTOM_CREATED"]) + end + + DetailsCustomPanel:Reset() + + end - ------------------------- - - -------------------------> Install CoolTip on Shout Button - - local addCustomReceived = function (param1) - _detalhes.custom [#_detalhes.custom+1] = param1 - print (Loc ["STRING_CUSTOM_CREATED"]) - end - - function _detalhes:OnReceiveCustom (source, realm, dversion, _customTable) - - if (dversion ~= _detalhes.realversion) then - print (Loc ["STRING_TOOOLD2"]) - return end - - for index, custom in _ipairs (_detalhes.custom) do - if (_customTable.name == custom.name) then + + function DetailsCustomPanel:AcceptFunc() + + if (DetailsCustomPanel.CodeEditing) then + --> close the edit box saving the text + if (DetailsCustomPanel.CodeEditing == 1) then + DetailsCustomPanel.code1 = custom_window.codeeditor:GetText() + elseif (DetailsCustomPanel.CodeEditing == 2) then + DetailsCustomPanel.code2 = custom_window.codeeditor:GetText() + end + + DetailsCustomPanel.CodeEditing = false + if (DetailsCustomPanel.IsEditing) then + DetailsCustomPanel:SetAcceptButtonText (Loc ["STRING_CUSTOM_SAVE"]) + else + DetailsCustomPanel:SetAcceptButtonText (Loc ["STRING_CUSTOM_CREATE"]) + end + custom_window.codeeditor:Hide() + + elseif (DetailsCustomPanel.IsEditing) then + + local succesful_edit = DetailsCustomPanel:CreateNewCustom() + if (succesful_edit) then + DetailsCustomPanel.IsEditing = false + DetailsCustomPanel:SetAcceptButtonText (Loc ["STRING_CUSTOM_CREATE"]) + DetailsCustomPanel:Reset() + end + else + DetailsCustomPanel:CreateNewCustom() + end + + end + + function DetailsCustomPanel:CancelFunc() + + if (DetailsCustomPanel.CodeEditing) then + --> close the edit box without save + custom_window.codeeditor:Hide() + DetailsCustomPanel.CodeEditing = false + + if (DetailsCustomPanel.IsEditing) then + DetailsCustomPanel:SetAcceptButtonText (Loc ["STRING_CUSTOM_SAVE"]) + else + DetailsCustomPanel:SetAcceptButtonText (Loc ["STRING_CUSTOM_CREATE"]) + end + + elseif (DetailsCustomPanel.IsEditing) then + DetailsCustomPanel.IsEditing = false + DetailsCustomPanel:SetAcceptButtonText (Loc ["STRING_CUSTOM_CREATE"]) + DetailsCustomPanel:Reset() + + else + _detalhes:CloseCustomDisplayWindow() + end + + end + + function DetailsCustomPanel:SetAcceptButtonText (text) + custom_window.box0.acceptbutton:SetText (text) + end + + function select_attribute (self) + + if (not self.attribute_table) then return end - end - _detalhes:Ask (source .. "-" .. realm .. " " .. Loc ["STRING_CUSTOM_ACCETP_CUSTOM"], addCustomReceived, _customTable) - end - - --> testing - local ShoutFunc = function (_, _, CustomIndex) - GameCooltip:Close() - _detalhes:SendRaidData ("custom_broadcast", _detalhes.custom [CustomIndex]) - print (Loc ["STRING_CUSTOM_BROADCASTSENT"]) - end - - local CreateCustomListForShout = function() - for index, custom in _ipairs (_detalhes.custom) do - GameCooltip:AddMenu (1, ShoutFunc, index, nil, nil, custom.name, _, true) - GameCooltip:AddIcon (custom.icon, 1, 1, 20, 20, 0, 1, 0, 1) - end - end - - BroadcastButton.CoolTip = { - Type = "menu", - BuildFunc = CreateCustomListForShout, - Options = {NoLastSelectedBar = true, TextSize = 9.5, HeightAnchorMod = -10}} + + custom_window.selected_left:SetPoint ("topleft", self, "topleft") + custom_window.selected_right:SetPoint ("topright", self, "topright") + + DetailsCustomPanel.current_attribute = self.attribute_table.attribute - GameCooltip:CoolTipInject (BroadcastButton, true) + if (not self.attribute_table.attribute) then + --is scripted + DetailsCustomPanel.BoxType = 2 + custom_window.box1:Hide() + custom_window.box2:Show() - function _detalhes:CommReceive (prefix, Msgs, distribution, target) - --print (prefix, Msgs, distribution, target) + else + --no scripted + --> check if is editing the code + if (DetailsCustomPanel.CodeEditing) then + DetailsCustomPanel.AcceptFunc() + end + + DetailsCustomPanel.BoxType = 1 + custom_window.box1:Show() + custom_window.box2:Hide() + custom_window.codeeditor:Hide() + end + end + + function DetailsCustomPanel.StartEditCode (code) + if (code == 1) then --> edit main code + + custom_window.codeeditor:SetText (DetailsCustomPanel.code1) + + elseif (code == 2) then --> edit tooltip code + + custom_window.codeeditor:SetText (DetailsCustomPanel.code2) + + end + + custom_window.codeeditor:Show() + DetailsCustomPanel.CodeEditing = code + DetailsCustomPanel:SetAcceptButtonText (Loc ["STRING_CUSTOM_DONE"]) + end + + + + --> left menu + custom_window.menu = {} + local menu_start = -50 + local menu_up_frame = _CreateFrame ("frame", nil, custom_window) + menu_up_frame:SetFrameLevel (custom_window:GetFrameLevel()+2) + + local onenter = function (self) + self.icontexture:SetVertexColor (1, 1, 1, 1) + end + local onleave = function (self) + self.icontexture:SetVertexColor (.9, .9, .9, 1) + end + + function custom_window:CreateMenuButton (label, icon, clickfunc, param1, param2, tooltip, name, coords) + + local index = #custom_window.menu+1 + + local circle = menu_up_frame:CreateTexture (nil, "overlay") + circle:SetSize (128*0.5, 82*0.5) + circle:SetPoint ("topleft", self, "topleft", 13, ((82*0.5)*index*-1) + menu_start) + circle:SetTexture ("Interface\\Glues\\CHARACTERCREATE\\AlternateForm") + circle:SetTexCoord (0, 1, 0, 0.3203125) + circle:SetDrawLayer ("overlay", 4) + + local texture = menu_up_frame:CreateTexture (nil, "overlay") + texture:SetSize (128*0.23, 82*0.32) + texture:SetTexture (icon) + --texture:SetDesaturated (true) + texture:SetVertexColor (.9, .9, .9, 1) + if (coords) then + texture:SetTexCoord (unpack (coords)) + else + texture:SetTexCoord (5/64, 60/64, 4/64, 62/64) + end + texture:SetPoint ("topleft", circle, "topleft", 5, -9) + texture:SetDrawLayer ("overlay", 3) + + local fillgap = menu_up_frame:CreateTexture (nil, "overlay") + fillgap:SetDrawLayer ("overlay", 2) + fillgap:SetTexture (0, 0, 0, 1) + fillgap:SetSize (2, 10) + fillgap:SetPoint ("left", texture, "right") + + local button = gump:NewButton (self, nil, "$parent" .. name, nil, 110, 20, clickfunc, param1, param2, nil, label) + button:SetPoint ("topleft", circle, "topright", -32, -14) + button:InstallCustomTexture() + button:SetHook ("OnEnter", onenter) + button:SetHook ("OnLeave", onleave) + button.widget.icontexture = texture + button.tooltip = tooltip + + custom_window.menu [index] = {circle = circle, icon = texture, button = button} + end + + local build_menu = function (func, param2, self) + GameCooltip:Reset() + + for index, custom_object in _ipairs (_detalhes.custom) do + GameCooltip:AddLine (custom_object:GetName()) + GameCooltip:AddIcon (custom_object:GetIcon()) + GameCooltip:AddMenu (1, func, custom_object, index, true) + end + + GameCooltip:SetOption ("ButtonsYMod", -2) + GameCooltip:SetOption ("YSpacingMod", 0) + GameCooltip:SetOption ("TextHeightMod", 0) + GameCooltip:SetOption ("IgnoreButtonAutoHeight", false) + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + + GameCooltip:SetType ("menu") + GameCooltip:SetHost (self, "left", "right", -7, 0) + GameCooltip:Show() + end + + --> edit button + local start_edit = function (_, _, custom_object, index) + GameCooltip:Hide() + DetailsCustomPanel:StartEdit (custom_object) + end + --custom_window:CreateMenuButton ("Edit", "Interface\\ICONS\\INV_Feather_06", build_menu, start_edit, nil, "Select a display to edit.", "Edit", {0.93, 0.07, 0.07, 0.93}) --> localize + custom_window:CreateMenuButton (Loc ["STRING_CUSTOM_EDIT"], "Interface\\ICONS\\INV_Inscription_RunescrollOfFortitude_Red", build_menu, start_edit, nil, nil, "Edit", {0.07, 0.93, 0.07, 0.93}) --> localize + + --> remove button + local remove_display = function (_, _, custom_object, index) + GameCooltip:Hide() + DetailsCustomPanel:RemoveDisplay (custom_object, index) + end + custom_window:CreateMenuButton (Loc ["STRING_CUSTOM_REMOVE"], "Interface\\ICONS\\Spell_BrokenHeart", build_menu, remove_display, nil, nil, "Remove", {1, 0, 0, 1}) --> localize + + --> export button + local export_display = function (_, _, custom_object, index) + GameCooltip:Hide() + --DetailsCustomPanel:RemoveDisplay (custom_object, index) + end + custom_window:CreateMenuButton (Loc ["STRING_CUSTOM_EXPORT"], "Interface\\ICONS\\INV_Misc_Gift_01", build_menu, export_display, nil, nil, "Export", {0.00, 0.9, 0.07, 0.93}) --> localize + DetailsCustomPanelExport:Disable() + + --> import buttonRaceChange + local import_display = function (_, _, custom_object, index) + GameCooltip:Hide() + --DetailsCustomPanel:RemoveDisplay (custom_object, index) + end + custom_window:CreateMenuButton (Loc ["STRING_CUSTOM_IMPORT"], "Interface\\ICONS\\INV_MISC_NOTE_02", build_menu, import_display, nil, nil, "Import", {0.00, 0.9, 0.07, 0.93}) --> localize + DetailsCustomPanelImport:Disable() + + local box_types = { + {}, --normal + {}, --custom script + } + + local attributes = { + {icon = [[Interface\ICONS\Spell_Fire_Fireball02]], label = Loc ["STRING_CUSTOM_ATTRIBUTE_DAMAGE"], box = 1, attribute = "damagedone", boxtype = 1}, + {icon = [[Interface\ICONS\SPELL_NATURE_HEALINGTOUCH]], label = Loc ["STRING_CUSTOM_ATTRIBUTE_HEAL"], box = 1, attribute = "healdone", boxtype = 1}, + {icon = [[Interface\ICONS\INV_Inscription_Scroll]], label = Loc ["STRING_CUSTOM_ATTRIBUTE_SCRIPT"], box = 2, attribute = false, boxtype = 2}, + + --{icon = [[Interface\ICONS\INV_Inscription_Scroll]], label = "Custom Script", box = 2, attribute = false, boxtype = 2}, + --{icon = [[Interface\ICONS\INV_Inscription_Scroll]], label = "Custom Script", box = 2, attribute = false, boxtype = 2}, + --{icon = [[Interface\ICONS\INV_Inscription_Scroll]], label = "Custom Script", box = 2, attribute = false, boxtype = 2}, + --{icon = [[Interface\ICONS\INV_Inscription_Scroll]], label = "Custom Script", box = 2, attribute = false, boxtype = 2}, + --{icon = [[Interface\ICONS\INV_Inscription_Scroll]], label = "Custom Script", box = 2, attribute = false, boxtype = 2}, + --{icon = [[Interface\ICONS\INV_Inscription_Scroll]], label = "Custom Script", box = 2, attribute = false, boxtype = 2}, + --{icon = [[Interface\ICONS\INV_Inscription_Scroll]], label = "Custom Script", box = 2, attribute = false, boxtype = 2}, + --{icon = [[Interface\ICONS\INV_Inscription_Scroll]], label = "Custom Script", box = 2, attribute = false, boxtype = 2}, + --{icon = [[Interface\ICONS\INV_Inscription_Scroll]], label = "Custom Script", box = 2, attribute = false, boxtype = 2}, + } + + --> create box + local attribute_box = _CreateFrame ("frame", nil, custom_window) + attribute_box:SetPoint ("topleft", custom_window, "topleft", 200, -60) + attribute_box:SetSize (180, 260) + --attribute_box:SetBackdrop ({ + -- bgFile = "Interface\\AddOns\\Details\\images\\background", + -- tile = true, tileSize = 16}) + --attribute_box:SetBackdropColor (1, 1, 1, 1) + + local button_onenter = function (self) + self:SetBackdropColor (.3, .3, .3, .3) + self.icon:SetBlendMode ("ADD") + end + local button_onleave = function (self) + self:SetBackdropColor (0, 0, 0, .2) + self.icon:SetBlendMode ("BLEND") + end + + --960 1020 68 101 + + local selected_left = attribute_box:CreateTexture (nil, "overlay") + selected_left:SetTexture ([[Interface\Store\Store-Main]]) + selected_left:SetSize (50, 20) + selected_left:SetVertexColor (1, .8, 0, 1) + selected_left:SetTexCoord (960/1024, 1020/1024, 68/1024, 101/1024) + custom_window.selected_left = selected_left + + local selected_right = attribute_box:CreateTexture (nil, "overlay") + selected_right:SetTexture ([[Interface\Store\Store-Main]]) + selected_right:SetSize (31, 20) + selected_right:SetVertexColor (1, .8, 0, 1) + selected_right:SetTexCoord (270/1024, 311/1024, 873/1024, 906/1024) + custom_window.selected_right = selected_right + + local selected_center = attribute_box:CreateTexture (nil, "overlay") + selected_center:SetTexture ([[Interface\Store\Store-Main]]) + selected_center:SetSize (49, 20) + selected_center:SetVertexColor (1, .8, 0, 1) + selected_center:SetTexCoord (956/1024, 1004/1024, 164/1024, 197/1024) + + selected_center:SetPoint ("left", selected_left, "right") + selected_center:SetPoint ("right", selected_right, "left") + + --selected_center:SetHorizTile (true) + --selected_center:SetVertTile (true) + + local p = 0.0625 --> 32/512 + + for i = 1, 10 do + + if (attributes [i]) then + + local button = _CreateFrame ("button", "DetailsCustomPanelAttributeMenu" .. i, attribute_box) + button:SetPoint ("topleft", attribute_box, "topleft", 2, ((i-1)*23*-1) + (-26)) + button:SetPoint ("topright", attribute_box, "topright", 2, ((i-1)*23*-1) + (-26)) + button:SetHeight (20) + + button:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16}) + button:SetBackdropColor (0, 0, 0, .2) + + button:SetScript ("OnEnter", button_onenter) + button:SetScript ("OnLeave", button_onleave) + + button.attribute_table = attributes [i] + + if (attributes [i] and not attributes [i].attribute) then + custom_window.script_button_attribute = button + end + + button:SetScript ("OnClick", select_attribute) + + button.icon = button:CreateTexture (nil, "overlay") + button.icon:SetPoint ("left", button, "left", 6, 0) + button.icon:SetSize (22, 22) + button.icon:SetTexture ([[Interface\AddOns\Details\images\custom_icones]]) + button.icon:SetTexCoord (p*(i-1), p*(i), 0, 1) + + button.text = button:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + button.text:SetPoint ("left", button.icon, "right", 4, 0) + button.text:SetText (attributes [i] and attributes [i].label or "") + button.text:SetTextColor (.9, .9, .9, 1) + + end + end + + --> create box 0, holds the name, author, desc and icon + local box0 = _CreateFrame ("frame", "DetailsCustomPanelBox0", custom_window) + custom_window.box0 = box0 + box0:SetSize (450, 360) + --box0:SetBackdrop ({ + -- bgFile = "Interface\\AddOns\\Details\\images\\background", + -- edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", + -- tile = true, tileSize = 16, edgeSize = 12}) + --box0:SetBackdropColor (0, 0, 0, .5) + box0:SetPoint ("topleft", attribute_box, "topright", 26, 10) + + --name + local name_label = gump:NewLabel (box0, box0, "$parenNameLabel", "name", Loc ["STRING_CUSTOM_NAME"], "GameFontHighlightLeft") --> localize-me + name_label:SetPoint ("topleft", box0, "topleft", 10, -20) + + local name_field = gump:NewTextEntry (box0, nil, "$parentNameEntry", "nameentry", 200, 20) + name_field:SetPoint ("left", name_label, "left", 62, 0) + custom_window.name_field = name_field + + --author + local author_label = gump:NewLabel (box0, box0, "$parenAuthorLabel", "author", Loc ["STRING_CUSTOM_AUTHOR"], "GameFontHighlightLeft") --> localize-me + author_label:SetPoint ("topleft", name_label, "bottomleft", 0, -12) + + local author_field = gump:NewTextEntry (box0, nil, "$parentAuthorEntry", "authorentry", 200, 20) + author_field:SetPoint ("left", author_label, "left", 62, 0) + author_field:SetText (UnitName ("player") .. "-" .. GetRealmName()) + custom_window.author_field = author_field + + --description + local desc_label = gump:NewLabel (box0, box0, "$parenDescLabel", "desc", Loc ["STRING_CUSTOM_DESCRIPTION"], "GameFontHighlightLeft") --> localize-me + desc_label:SetPoint ("topleft", author_label, "bottomleft", 0, -12) + + local desc_field = gump:NewTextEntry (box0, nil, "$parentDescEntry", "descentry", 200, 20) + desc_field:SetPoint ("left", desc_label, "left", 62, 0) + custom_window.desc_field = desc_field + + --icon + local icon_label = gump:NewLabel (box0, box0, "$parenIconLabel", "icon", Loc ["STRING_CUSTOM_ICON"], "GameFontHighlightLeft") --> localize-me + icon_label:SetPoint ("topleft", desc_label, "bottomleft", 0, -12) + + local pickicon_callback = function (texture) + box0.icontexture:SetTexture (texture) + end + local pickicon = function() + gump:IconPick (pickicon_callback, true) + end + local icon_image = gump:NewImage (box0, [[Interface\ICONS\TEMP]], 20, 20, nil, nil, "icontexture", "$parentIconTexture") + local icon_button = gump:NewButton (box0, nil, "$parentIconButton", "IconButton", 20, 20, pickicon) + icon_button:InstallCustomTexture() + icon_button:SetPoint ("left", icon_label, "left", 64, 0) + icon_image:SetPoint ("left", icon_label, "left", 64, 0) + custom_window.icon_image = icon_image + + --cancel + local cancel_button = gump:NewButton (box0, nil, "$parentCancelButton", "cancelbutton", 130, 20, DetailsCustomPanel.CancelFunc, nil, nil, nil, Loc ["STRING_CUSTOM_CANCEL"]) + cancel_button:SetPoint ("bottomleft", attribute_box, "bottomright", 37, -10) + cancel_button:InstallCustomTexture() + + --accept + local accept_button = gump:NewButton (box0, nil, "$parentAcceptButton", "acceptbutton", 130, 20, DetailsCustomPanel.AcceptFunc, nil, nil, nil, Loc ["STRING_CUSTOM_CREATE"]) + accept_button:SetPoint ("left", cancel_button, "right", 2, 0) + accept_button:InstallCustomTexture() + + + + --> create box type 1 + local box1 = _CreateFrame ("frame", "DetailsCustomPanelBox1", custom_window) + custom_window.box1 = box1 + box1:SetSize (450, 180) + --box1:SetBackdrop ({ + -- bgFile = "Interface\\AddOns\\Details\\images\\background", + -- edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", + -- tile = true, tileSize = 16, edgeSize = 12}) + --box1:SetBackdropColor (1, 0, 0, .9) + box1:SetPoint ("topleft", icon_label.widget, "bottomleft", -10, -20) + + box1:SetFrameLevel (box0:GetFrameLevel()+1) + + --source + local source_label = gump:NewLabel (box1, box1, "$parenSourceLabel", "source", Loc ["STRING_CUSTOM_SOURCE"], "GameFontHighlightLeft") --> localize-me + source_label:SetPoint ("topleft", box1, "topleft", 10, 0) + + local disable_source_field = function() + box1.sourceentry:Disable() + end + local enable_source_field = function() + box1.sourceentry:Enable() + box1.sourceentry:SetFocus (true) + end + + local source_icon = [[Interface\COMMON\Indicator-Yellow]] + + local targeting_options = { + {value = "[all]", label = "All Characters", desc = "Search for matches in all characters.", onclick = disable_source_field, icon = source_icon}, + {value = "[raid]", label = "Raid or Party Group", desc = "Search for matches in all characters which is part of your party or raid group.", onclick = disable_source_field, icon = source_icon}, + {value = "[player]", label = "Only You", desc = "Search for matches only in your character.", onclick = disable_source_field, icon = source_icon}, + {value = false, label = "Specific Character", desc = "Type the name of the character used to search.", onclick = enable_source_field, icon = source_icon}, + } + local build_source_list = function() return targeting_options end + local source_dropdown = gump:NewDropDown (box1, nil, "$parentSourceDropdown", "sourcedropdown", 178, 20, build_source_list, 1) + source_dropdown:SetPoint ("left", source_label, "left", 62, 0) + custom_window.source_dropdown = source_dropdown + + local source_field = gump:NewTextEntry (box1, nil, "$parentSourceEntry", "sourceentry", 201, 20) + source_field:SetPoint ("topleft", source_dropdown, "bottomleft", 0, -2) + source_field:Disable() + custom_window.source_field = source_field + + local adds_boss = CreateFrame ("frame", nil, box1) + adds_boss:SetPoint ("left", source_dropdown.widget, "right", 2, 0) + adds_boss:SetSize (20, 20) + + local adds_boss_image = adds_boss:CreateTexture (nil, "overlay") + adds_boss_image:SetPoint ("center", adds_boss) + adds_boss_image:SetTexture ("Interface\\Buttons\\UI-MicroButton-Raid-Up") + adds_boss_image:SetTexCoord (0.046875, 0.90625, 0.40625, 0.953125) + adds_boss_image:SetWidth (20) + adds_boss_image:SetHeight (16) + + local actorsFrame = gump:NewPanel (custom_window, _, "DetailsCustomActorsFrame2", "actorsFrame", 1, 1) + actorsFrame:SetPoint ("topleft", custom_window, "topright", 5, -60) + actorsFrame:Hide() + + local modelFrame = _CreateFrame ("playermodel", "DetailsCustomActorsFrame2Model", custom_window) + modelFrame:SetSize (138, 261) + modelFrame:SetPoint ("topright", actorsFrame.widget, "topleft", -15, -8) + modelFrame:Hide() + local modelFrameTexture = modelFrame:CreateTexture (nil, "background") + modelFrameTexture:SetAllPoints() + + local modelFrameBackground = custom_window:CreateTexture (nil, "artwork") + modelFrameBackground:SetSize (138, 261) + modelFrameBackground:SetPoint ("topright", actorsFrame.widget, "topleft", -15, -8) + modelFrameBackground:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-GuildAchievement-Parchment-Horizontal-Desaturated]]) + modelFrameBackground:SetRotation (90) + modelFrameBackground:SetVertexColor (.5, .5, .5, 0.5) + + local modelFrameBackgroundIcon = custom_window:CreateTexture (nil, "overlay") + modelFrameBackgroundIcon:SetPoint ("center", modelFrameBackground, "center") + modelFrameBackgroundIcon:SetTexture ([[Interface\CHARACTERFRAME\Disconnect-Icon]]) + modelFrameBackgroundIcon:SetVertexColor (.5, .5, .5, 0.7) + + + local selectedEncounterActor = function (actorName, model) + source_field:SetText (actorName) + source_dropdown:Select (4, true) + box1.sourceentry:Enable() + actorsFrame:Hide() + GameCooltip:Hide() + end + + local actorsFrameButtons = {} + + local buttonMouseOver = function (button) + button.MyObject.image:SetBlendMode ("ADD") + button.MyObject.line:SetBlendMode ("ADD") + button.MyObject.label:SetTextColor (1, 1, 1, 1) + local OnEnterColors = button:GetParent().Gradient.OnEnter + local _r, _g, _b, _a = button:GetParent():GetBackdropColor() + gump:GradientEffect (button:GetParent(), "frame", _r, _g, _b, _a, OnEnterColors[1], OnEnterColors[2], OnEnterColors[3], OnEnterColors[4], .3) + GameTooltip:SetOwner (button, "ANCHOR_TOPLEFT") + GameTooltip:AddLine (button.MyObject.actor) + GameTooltip:Show() + + local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = EJ_GetInstanceInfo (button.MyObject.ej_id) + + modelFrameTexture:SetTexture (bgImage) + modelFrameTexture:SetTexCoord (3/512, 370/512, 5/512, 429/512) + modelFrame:Show() + + modelFrame:SetDisplayInfo (button.MyObject.model) + end + local buttonMouseOut = function (button) + button.MyObject.image:SetBlendMode ("BLEND") + button.MyObject.line:SetBlendMode ("BLEND") + button.MyObject.label:SetTextColor (.8, .8, .8, .8) + local _r, _g, _b, _a = button:GetParent():GetBackdropColor() + if (_r) then + local OnLeaveColors = button:GetParent().Gradient.OnLeave + gump:GradientEffect (button:GetParent(), "frame", _r, _g, _b, _a, OnLeaveColors[1], OnLeaveColors[2], OnLeaveColors[3], OnLeaveColors[4], .3) + end + GameTooltip:Hide() + modelFrame:Hide() + end + + local EncounterSelect = function (_, _, instanceId, bossIndex, ej_id) + + DetailsCustomSpellsFrame:Hide() + DetailsCustomActorsFrame:Hide() + DetailsCustomActorsFrame2:Show() + GameCooltip:Hide() + + local encounterID = _detalhes:GetEncounterIdFromBossIndex (instanceId, bossIndex) + + if (encounterID) then + local actors = _detalhes:GetEncounterActorsName (encounterID) + + local x = 10 + local y = 10 + local i = 1 + + for actor, actorTable in pairs (actors) do + + local thisButton = actorsFrameButtons [i] + + if (not thisButton) then + thisButton = gump:NewButton (actorsFrame.frame, actorsFrame.frame, "DetailsCustomActorsFrame2Button"..i, "button"..i, 130, 20, selectedEncounterSpell) + thisButton:SetPoint ("topleft", "DetailsCustomActorsFrame2", "topleft", x, -y) + thisButton:SetHook ("OnEnter", buttonMouseOver) + thisButton:SetHook ("OnLeave", buttonMouseOut) + + local t = gump:NewImage (thisButton, nil, 20, 20, nil, nil, "image", "DetailsCustomActors2EncounterImageButton"..i) + t:SetPoint ("left", thisButton) + t:SetTexture ([[Interface\MINIMAP\TRACKING\Target]]) + t:SetDesaturated (true) + t:SetSize (20, 20) + t:SetAlpha (0.7) + + local text = gump:NewLabel (thisButton, nil, "DetailsCustomActorsFrame2Button"..i.."Label", "label", "Spell", nil, 9.5, {.8, .8, .8, .8}) + text:SetPoint ("left", t.image, "right", 2, 0) + text:SetWidth (123) + text:SetHeight (10) + + local border = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 40, 38, nil, nil, "border", "DetailsCustomActors2EncounterBorderButton"..i) + border:SetTexCoord (0.00390625, 0.27734375, 0.44140625,0.69531250) + border:SetDrawLayer ("background") + border:SetPoint ("topleft", thisButton.button, "topleft", -9, 9) + + local line = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 134, 25, nil, nil, "line", "DetailsCustomActors2EncounterLineButton"..i) + line:SetTexCoord (0.31250000, 0.96484375, 0.37109375, 0.52343750) + line:SetDrawLayer ("background") + line:SetPoint ("left", thisButton.button, "right", -110, -3) + + table.insert (actorsFrameButtons, #actorsFrameButtons+1, thisButton) + end + + y = y + 20 + if (y >= 260) then + y = 10 + x = x + 150 + end + + thisButton.label:SetText (actor) + thisButton:SetClickFunction (selectedEncounterActor, actor, actorTable.model) + thisButton.actor = actor + thisButton.ej_id = ej_id + thisButton.model = actorTable.model + thisButton:Show() + i = i + 1 + end + + for maxIndex = i, #actorsFrameButtons do + actorsFrameButtons [maxIndex]:Hide() + end + + i = i-1 + actorsFrame:SetSize (math.ceil (i/13)*160, math.min (i*20 + 20, 280)) + + end + end + + local BuildEncounterMenu = function() + + GameCooltip:Reset() + GameCooltip:SetType ("menu") + GameCooltip:SetOwner (adds_boss) + + for instanceId, instanceTable in pairs (_detalhes.EncounterInformation) do + + if (_detalhes:InstanceIsRaid (instanceId)) then + + GameCooltip:AddLine (instanceTable.name, _, 1, "white") + GameCooltip:AddIcon (instanceTable.icon, 1, 1, 64, 32) + + for index, encounterName in ipairs (instanceTable.boss_names) do + GameCooltip:AddMenu (2, EncounterSelect, instanceId, index, instanceTable.ej_id, encounterName, nil, true) + local L, R, T, B, Texture = _detalhes:GetBossIcon (instanceId, index) + GameCooltip:AddIcon (Texture, 2, 1, 20, 20, L, R, T, B) + end + + GameCooltip:SetWallpaper (2, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + + end + end + + GameCooltip:SetOption ("HeightAnchorMod", -10) + GameCooltip:SetOption ("ButtonsYMod", -2) + GameCooltip:SetOption ("YSpacingMod", 0) + GameCooltip:SetOption ("TextHeightMod", 0) + GameCooltip:SetOption ("IgnoreButtonAutoHeight", false) + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + + GameCooltip:ShowCooltip() + end + + adds_boss:SetScript ("OnEnter", function() + adds_boss_image:SetBlendMode ("ADD") + BuildEncounterMenu() + end) + + adds_boss:SetScript ("OnLeave", function() + adds_boss_image:SetBlendMode ("BLEND") + end) + + --target + local target_label = gump:NewLabel (box1, box1, "$parenTargetLabel", "target", Loc ["STRING_CUSTOM_TARGET"], "GameFontHighlightLeft") + target_label:SetPoint ("topleft", source_label, "bottomleft", 0, -40) + + local disable_target_field = function() + box1.targetentry:Disable() + end + local enable_target_field = function() + box1.targetentry:Enable() + box1.targetentry:SetFocus (true) + end + + local target_icon = [[Interface\COMMON\Indicator-Yellow]] + local target_icon2 = [[Interface\COMMON\Indicator-Gray]] + + local targeting_options = { + {value = "[all]", label = "All Characters", desc = "Search for matches in all characters.", onclick = disable_target_field, icon = target_icon}, + {value = "[raid]", label = "Raid or Party Group", desc = "Search for matches in all characters which is part of your party or raid group.", onclick = disable_target_field, icon = target_icon}, + {value = "[player]", label = "Only You", desc = "Search for matches only in your character.", onclick = disable_target_field, icon = target_icon}, + {value = false, label = "Specific Character", desc = "Type the name of the character used to search.", onclick = enable_target_field, icon = target_icon}, + {value = "[none]", label = "No Target", desc = "Do not search for targets.", onclick = disable_target_field, icon = target_icon2}, + } + local build_target_list = function() return targeting_options end + local target_dropdown = gump:NewDropDown (box1, nil, "$parentTargetDropdown", "targetdropdown", 178, 20, build_target_list, 1) + target_dropdown:SetPoint ("left", target_label, "left", 62, 0) + custom_window.target_dropdown = target_dropdown + + local target_field = gump:NewTextEntry (box1, nil, "$parentTargetEntry", "targetentry", 201, 20) + target_field:SetPoint ("topleft", target_dropdown, "bottomleft", 0, -2) + target_field:Disable() + custom_window.target_field = target_field + -- + + local adds_boss = CreateFrame ("frame", nil, box1) + adds_boss:SetPoint ("left", target_dropdown.widget, "right", 2, 0) + adds_boss:SetSize (20, 20) + local adds_boss_image = adds_boss:CreateTexture (nil, "overlay") + adds_boss_image:SetPoint ("center", adds_boss) + adds_boss_image:SetTexture ("Interface\\Buttons\\UI-MicroButton-Raid-Up") + adds_boss_image:SetTexCoord (0.046875, 0.90625, 0.40625, 0.953125) + adds_boss_image:SetWidth (20) + adds_boss_image:SetHeight (16) + + local actorsFrame = gump:NewPanel (custom_window, _, "DetailsCustomActorsFrame", "actorsFrame", 1, 1) + actorsFrame:SetPoint ("topleft", custom_window, "topright", 5, -60) + actorsFrame:Hide() + + local modelFrame = _CreateFrame ("playermodel", "DetailsCustomActorsFrameModel", custom_window) + modelFrame:SetSize (138, 261) + modelFrame:SetPoint ("topright", actorsFrame.widget, "topleft", -15, -8) + modelFrame:Hide() + local modelFrameTexture = modelFrame:CreateTexture (nil, "background") + modelFrameTexture:SetAllPoints() + + local selectedEncounterActor = function (actorName) + target_field:SetText (actorName) + target_dropdown:Select (4, true) + box1.targetentry:Enable() + actorsFrame:Hide() + GameCooltip:Hide() + end + + local actorsFrameButtons = {} + + local buttonMouseOver = function (button) + button.MyObject.image:SetBlendMode ("ADD") + button.MyObject.line:SetBlendMode ("ADD") + button.MyObject.label:SetTextColor (1, 1, 1, 1) + local OnEnterColors = button:GetParent().Gradient.OnEnter + local _r, _g, _b, _a = button:GetParent():GetBackdropColor() + gump:GradientEffect (button:GetParent(), "frame", _r, _g, _b, _a, OnEnterColors[1], OnEnterColors[2], OnEnterColors[3], OnEnterColors[4], .3) + GameTooltip:SetOwner (button, "ANCHOR_TOPLEFT") + GameTooltip:AddLine (button.MyObject.actor) + GameTooltip:Show() + + local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = EJ_GetInstanceInfo (button.MyObject.ej_id) + + modelFrameTexture:SetTexture (bgImage) + modelFrameTexture:SetTexCoord (3/512, 370/512, 5/512, 429/512) + modelFrame:Show() + + modelFrame:SetDisplayInfo (button.MyObject.model) + end + local buttonMouseOut = function (button) + button.MyObject.image:SetBlendMode ("BLEND") + button.MyObject.line:SetBlendMode ("BLEND") + button.MyObject.label:SetTextColor (.8, .8, .8, .8) + local _r, _g, _b, _a = button:GetParent():GetBackdropColor() + if (_r) then + local OnLeaveColors = button:GetParent().Gradient.OnLeave + gump:GradientEffect (button:GetParent(), "frame", _r, _g, _b, _a, OnLeaveColors[1], OnLeaveColors[2], OnLeaveColors[3], OnLeaveColors[4], .3) + end + GameTooltip:Hide() + + modelFrame:Hide() + end + + local EncounterSelect = function (_, _, instanceId, bossIndex, ej_id) + + DetailsCustomSpellsFrame:Hide() + DetailsCustomActorsFrame:Show() + DetailsCustomActorsFrame2:Hide() + GameCooltip:Hide() + + local encounterID = _detalhes:GetEncounterIdFromBossIndex (instanceId, bossIndex) + if (encounterID) then + local actors = _detalhes:GetEncounterActorsName (encounterID) + + local x = 10 + local y = 10 + local i = 1 + + for actor, actorTable in pairs (actors) do + + local thisButton = actorsFrameButtons [i] + + if (not thisButton) then + thisButton = gump:NewButton (actorsFrame.frame, actorsFrame.frame, "DetailsCustomActorsFrameButton"..i, "button"..i, 130, 20, selectedEncounterSpell) + thisButton:SetPoint ("topleft", "DetailsCustomActorsFrame", "topleft", x, -y) + thisButton:SetHook ("OnEnter", buttonMouseOver) + thisButton:SetHook ("OnLeave", buttonMouseOut) + + local t = gump:NewImage (thisButton, nil, 20, 20, nil, nil, "image", "DetailsCustomActorsEncounterImageButton"..i) + t:SetPoint ("left", thisButton) + t:SetTexture ([[Interface\MINIMAP\TRACKING\Target]]) + t:SetDesaturated (true) + t:SetSize (20, 20) + t:SetAlpha (0.7) + + local text = gump:NewLabel (thisButton, nil, "DetailsCustomActorsFrameButton"..i.."Label", "label", "Spell", nil, 9.5, {.8, .8, .8, .8}) + text:SetPoint ("left", t.image, "right", 2, 0) + text:SetWidth (123) + text:SetHeight (10) + + local border = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 40, 38, nil, nil, "border", "DetailsCustomActorsEncounterBorderButton"..i) + border:SetTexCoord (0.00390625, 0.27734375, 0.44140625,0.69531250) + border:SetDrawLayer ("background") + border:SetPoint ("topleft", thisButton.button, "topleft", -9, 9) + + local line = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 84, 25, nil, nil, "line", "DetailsCustomActorsEncounterLineButton"..i) + line:SetTexCoord (0.31250000, 0.96484375, 0.37109375, 0.52343750) + line:SetDrawLayer ("background") + line:SetPoint ("left", thisButton.button, "right", -110, -3) + + table.insert (actorsFrameButtons, #actorsFrameButtons+1, thisButton) + end + + y = y + 20 + if (y >= 260) then + y = 10 + x = x + 150 + end + + thisButton.label:SetText (actor) + thisButton:SetClickFunction (selectedEncounterActor, actor) + thisButton.actor = actor + thisButton.ej_id = ej_id + thisButton.model = actorTable.model + thisButton:Show() + i = i + 1 + end + + for maxIndex = i, #actorsFrameButtons do + actorsFrameButtons [maxIndex]:Hide() + end + + i = i-1 + actorsFrame:SetSize (math.ceil (i/13)*160, math.min (i*20 + 20, 280)) + + end + end + + local BuildEncounterMenu = function() + + GameCooltip:Reset() + GameCooltip:SetType ("menu") + GameCooltip:SetOwner (adds_boss) + + for instanceId, instanceTable in pairs (_detalhes.EncounterInformation) do + + if (_detalhes:InstanceIsRaid (instanceId)) then + + GameCooltip:AddLine (instanceTable.name, _, 1, "white") + GameCooltip:AddIcon (instanceTable.icon, 1, 1, 64, 32) + + for index, encounterName in ipairs (instanceTable.boss_names) do + GameCooltip:AddMenu (2, EncounterSelect, instanceId, index, instanceTable.ej_id, encounterName, nil, true) + local L, R, T, B, Texture = _detalhes:GetBossIcon (instanceId, index) + GameCooltip:AddIcon (Texture, 2, 1, 20, 20, L, R, T, B) + end + + GameCooltip:SetWallpaper (2, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + + end + end + + GameCooltip:SetOption ("HeightAnchorMod", -10) + GameCooltip:SetOption ("ButtonsYMod", -2) + GameCooltip:SetOption ("YSpacingMod", 0) + GameCooltip:SetOption ("TextHeightMod", 0) + GameCooltip:SetOption ("IgnoreButtonAutoHeight", false) + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + GameCooltip:ShowCooltip() + end + + adds_boss:SetScript ("OnEnter", function() + adds_boss_image:SetBlendMode ("ADD") + BuildEncounterMenu() + end) + + adds_boss:SetScript ("OnLeave", function() + adds_boss_image:SetBlendMode ("BLEND") + end) + + --spellid + local spellid_label = gump:NewLabel (box1, box1, "$parenSpellidLabel", "spellid", Loc ["STRING_CUSTOM_SPELLID"], "GameFontHighlightLeft") --> localize-me + spellid_label:SetPoint ("topleft", target_label, "bottomleft", 0, -40) + + local spellid_entry = gump:NewSpellEntry (box1, function()end, 178, 20, nil, nil, "spellidentry", "$parentSpellIdEntry") + spellid_entry:SetPoint ("left", spellid_label, "left", 62, 0) + custom_window.spellid_entry = spellid_entry + + local spell_id_boss = CreateFrame ("frame", nil, box1) + spell_id_boss:SetPoint ("left", spellid_entry.widget, "right", 2, 0) + spell_id_boss:SetSize (20, 20) + local spell_id_boss_image = spell_id_boss:CreateTexture (nil, "overlay") + spell_id_boss_image:SetPoint ("center", spell_id_boss) + spell_id_boss_image:SetTexture ("Interface\\Buttons\\UI-MicroButton-Raid-Up") + spell_id_boss_image:SetTexCoord (0.046875, 0.90625, 0.40625, 0.953125) + spell_id_boss_image:SetWidth (20) + spell_id_boss_image:SetHeight (16) + + local spellsFrame = gump:NewPanel (custom_window, _, "DetailsCustomSpellsFrame", "spellsFrame", 1, 1) + spellsFrame:SetPoint ("topleft", custom_window, "topright", 5, 0) + spellsFrame:Hide() + + local selectedEncounterSpell = function (spellId) + local _, _, icon = _GetSpellInfo (spellId) + spellid_entry:SetText (spellId) + box0.icontexture:SetTexture (icon) + spellsFrame:Hide() + GameCooltip:Hide() + end + + local spellsFrameButtons = {} + + local buttonMouseOver = function (button) + button.MyObject.image:SetBlendMode ("ADD") + button.MyObject.line:SetBlendMode ("ADD") + button.MyObject.label:SetTextColor (1, 1, 1, 1) + local OnEnterColors = button:GetParent().Gradient.OnEnter + local _r, _g, _b, _a = button:GetParent():GetBackdropColor() + gump:GradientEffect (button:GetParent(), "frame", _r, _g, _b, _a, OnEnterColors[1], OnEnterColors[2], OnEnterColors[3], OnEnterColors[4], .3) + + GameTooltip:SetOwner (button, "ANCHOR_TOPLEFT") + GameTooltip:SetSpellByID (button.MyObject.spellid) + GameTooltip:Show() + end + local buttonMouseOut = function (button) + button.MyObject.image:SetBlendMode ("BLEND") + button.MyObject.line:SetBlendMode ("BLEND") + button.MyObject.label:SetTextColor (.8, .8, .8, .8) + local _r, _g, _b, _a = button:GetParent():GetBackdropColor() + if (_r) then + local OnLeaveColors = button:GetParent().Gradient.OnLeave + gump:GradientEffect (button:GetParent(), "frame", _r, _g, _b, _a, OnLeaveColors[1], OnLeaveColors[2], OnLeaveColors[3], OnLeaveColors[4], .3) + end + GameTooltip:Hide() + end + + local EncounterSelect = function (_, _, instanceId, bossIndex) + + DetailsCustomSpellsFrame:Show() + DetailsCustomActorsFrame:Hide() + DetailsCustomActorsFrame2:Hide() + + GameCooltip:Hide() + + local spells = _detalhes:GetEncounterSpells (instanceId, bossIndex) + + local x = 10 + local y = 10 + local i = 1 + + for spell, _ in pairs (spells) do + + local thisButton = spellsFrameButtons [i] + + if (not thisButton) then + thisButton = gump:NewButton (spellsFrame.frame, spellsFrame.frame, "DetailsCustomSpellsFrameButton"..i, "button"..i, 80, 20, selectedEncounterSpell) + thisButton:SetPoint ("topleft", "DetailsCustomSpellsFrame", "topleft", x, -y) + thisButton:SetHook ("OnEnter", buttonMouseOver) + thisButton:SetHook ("OnLeave", buttonMouseOut) + + local t = gump:NewImage (thisButton, nil, 20, 20, nil, nil, "image", "DetailsCustomEncounterImageButton"..i) + t:SetPoint ("left", thisButton) + + local text = gump:NewLabel (thisButton, nil, "DetailsCustomSpellsFrameButton"..i.."Label", "label", "Spell", nil, 9.5, {.8, .8, .8, .8}) + text:SetPoint ("left", t.image, "right", 2, 0) + text:SetWidth (73) + text:SetHeight (10) + + local border = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 40, 38, nil, nil, "border", "DetailsCustomEncounterBorderButton"..i) + border:SetTexCoord (0.00390625, 0.27734375, 0.44140625,0.69531250) + border:SetDrawLayer ("background") + border:SetPoint ("topleft", thisButton.button, "topleft", -9, 9) + + local line = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 84, 25, nil, nil, "line", "DetailsCustomEncounterLineButton"..i) + line:SetTexCoord (0.31250000, 0.96484375, 0.37109375, 0.52343750) + line:SetDrawLayer ("background") + line:SetPoint ("left", thisButton.button, "right", -60, -3) + + table.insert (spellsFrameButtons, #spellsFrameButtons+1, thisButton) + end + + y = y + 20 + if (y >= 400) then + y = 10 + x = x + 100 + end + + local nome_magia, _, icone_magia = _GetSpellInfo (spell) + thisButton.image:SetTexture (icone_magia) + thisButton.label:SetText (nome_magia) + thisButton:SetClickFunction (selectedEncounterSpell, spell) + thisButton.spellid = spell + thisButton:Show() + i = i + 1 + end + + for maxIndex = i, #spellsFrameButtons do + spellsFrameButtons [maxIndex]:Hide() + end + + i = i-1 + spellsFrame:SetSize (math.ceil (i/20)*110, math.min (i*20 + 20, 420)) + + end + + local BuildEncounterMenu = function() + + GameCooltip:Reset() + GameCooltip:SetType ("menu") + GameCooltip:SetOwner (spell_id_boss) + + for instanceId, instanceTable in pairs (_detalhes.EncounterInformation) do + + if (_detalhes:InstanceisRaid (instanceId)) then + + GameCooltip:AddLine (instanceTable.name, _, 1, "white") + GameCooltip:AddIcon (instanceTable.icon, 1, 1, 64, 32) + + for index, encounterName in ipairs (instanceTable.boss_names) do + GameCooltip:AddMenu (2, EncounterSelect, instanceId, index, nil, encounterName, nil, true) + local L, R, T, B, Texture = _detalhes:GetBossIcon (instanceId, index) + GameCooltip:AddIcon (Texture, 2, 1, 20, 20, L, R, T, B) + end + + GameCooltip:SetWallpaper (2, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + + end + end + + GameCooltip:SetOption ("ButtonsYMod", -2) + GameCooltip:SetOption ("YSpacingMod", 0) + GameCooltip:SetOption ("TextHeightMod", 0) + GameCooltip:SetOption ("IgnoreButtonAutoHeight", false) + GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) + + GameCooltip:SetOption ("HeightAnchorMod", -10) + GameCooltip:ShowCooltip() + end + + spell_id_boss:SetScript ("OnEnter", function() + spell_id_boss_image:SetBlendMode ("ADD") + BuildEncounterMenu() + end) + + spell_id_boss:SetScript ("OnLeave", function() + spell_id_boss_image:SetBlendMode ("BLEND") + end) + + --select target + --select spell + + --> create box type 2 + local box2 = _CreateFrame ("frame", "DetailsCustomPanelBox2", custom_window) + custom_window.box2 = box2 + box2:SetSize (450, 180) + --box2:SetBackdrop ({ + -- bgFile = "Interface\\AddOns\\Details\\images\\background", + -- edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", + -- tile = true, tileSize = 16, edgeSize = 12}) + --box2:SetBackdropColor (1, 0, 0, .9) + box2:SetPoint ("topleft", icon_label.widget, "bottomleft", -10, -20) + + box2:SetFrameLevel (box0:GetFrameLevel()+1) + + --edit main code + local maincode_button = gump:NewButton (box2, nil, "$parentMainCodeButton", "maiccodebutton", 160, 20, DetailsCustomPanel.StartEditCode, 1, nil, nil, Loc ["STRING_CUSTOM_EDIT_SEARCH_CODE"]) + maincode_button:SetPoint ("topleft", box2, "topleft", 10, -25) + maincode_button:InstallCustomTexture() + + --edit tooltip code + local tooltipcode_button = gump:NewButton (box2, nil, "$parentTooltipCodeButton", "tooltipcodebutton", 160, 20, DetailsCustomPanel.StartEditCode, 2, nil, nil, Loc ["STRING_CUSTOM_EDIT_TOOLTIP_CODE"]) + tooltipcode_button:SetPoint ("topleft", maincode_button, "bottomleft", 0, -10) + tooltipcode_button:InstallCustomTexture() + + box2:Hide() + + --> create the code editbox + local code_editor = gump:NewSpecialLuaEditorEntry (custom_window, 420, 238, "codeeditor", "$parentCodeEditor") + code_editor:SetPoint ("topleft", attribute_box, "topright", 30, 0) + code_editor:SetFrameLevel (custom_window:GetFrameLevel()+4) + code_editor:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], + tile = 1, tileSize = 16, edgeSize = 16, insets = {left = 5, right = 5, top = 5, bottom = 5}}) + code_editor:SetBackdropColor (0, 0, 0, 1) + code_editor:Hide() + + --> select damage + DetailsCustomPanelAttributeMenu1:Click() + else + _G.DetailsCustomPanel:Show() + end + end + + --[[ +--init: +local combat, instance_container, instance = ... +local total, top, amount = 0, 0, 0 + +--get the misc actor container +local misc_container = combat:GetActorList ( DETAILS_ATTRIBUTE_MISC ) + +--do the loop: +for _, player in ipairs ( misc_container ) do + + --only player in group + if (player:IsGroupPlayer()) then + + local found_potion = false + + --get the spell debuff uptime container + local debuff_uptime_container = player.debuff_uptime and player.debuff_uptime_spell_tables and player.debuff_uptime_spell_tables._ActorTable + if (debuff_uptime_container) then + --potion of focus (can't use as pre-potion, so, its amount is always 1) + local focus_potion = debuff_uptime_container [105701] + if (focus_potion) then + total = total + 1 + found_potion = true + if (top < 1) then + top = 1 + end + --add amount to the player + instance_container:AddValue (player, 1) + end end - _detalhes:RegisterComm ("DETAILS", "CommReceive") - ------------------------- - - _detalhes.CustomFrame = frame - - tinsert (UISpecialFrames, "DetailsCustomPanel") - _detalhes.CustomFrame.oponed = false - frame:Hide() -end + --get the spell buff uptime container + local buff_uptime_container = player.buff_uptime and player.buff_uptime_spell_tables and player.buff_uptime_spell_tables._ActorTable + if (buff_uptime_container) then -function _detalhes:InitCustom() - CreateCustomWindow() - return true -end + --potion of the jade serpent + local jade_serpent_potion = buff_uptime_container [105702] + if (jade_serpent_potion) then + local used = jade_serpent_potion.activedamt + if (used > 0) then + total = total + used + found_potion = true + if (used > top) then + top = used + end + --add amount to the player + instance_container:AddValue (player, used) + end + end + + --potion of mogu power + local mogu_power_potion = buff_uptime_container [105706] + if (mogu_power_potion) then + local used = mogu_power_potion.activedamt + if (used > 0) then + total = total + used + found_potion = true + if (used > top) then + top = used + end + --add amount to the player + instance_container:AddValue (player, used) + end + end -function _detalhes:OpenCustomWindow() - --if (InCombatLockdown()) then - -- print ("|cffFF2222"..Loc ["STRING_CUSTOM_INCOMBAT"]) - -- return - --end + --virmen's bite + local virmens_bite_potion = buff_uptime_container [105697] + if (virmens_bite_potion) then + local used = virmens_bite_potion.activedamt + if (used > 0) then + total = total + used + found_potion = true + if (used > top) then + top = used + end + --add amount to the player + instance_container:AddValue (player, used) + end + end + + --potion of the mountains + local mountains_potion = buff_uptime_container [105698] + if (mountains_potion) then + local used = mountains_potion.activedamt + if (used > 0) then + total = total + used + found_potion = true + if (used > top) then + top = used + end + --add amount to the player + instance_container:AddValue (player, used) + end + end + end - if (not _detalhes.CustomFrame.oponed) then - _detalhes.CustomFrame.oponed = true - --_detalhes:BuildSpellList() - _detalhes.CustomFrame:Show() + if (found_potion) then + amount = amount + 1 + end end end -function _detalhes:CloseCustomWindow() - _detalhes.CustomFrame.oponed = false - --_detalhes:ClearSpellList() - _detalhes.CustomFrame:Hide() -end +--return: +return total, top, amount + +tooltip = + --init: + local player, combat, instance = ... + + --get the debuff container for potion of focus + local debuff_uptime_container = player.debuff_uptime and player.debuff_uptime_spell_tables and player.debuff_uptime_spell_tables._ActorTable + if (debuff_uptime_container) then + local focus_potion = debuff_uptime_container [105701] + if (focus_potion) then + local name, _, icon = GetSpellInfo (105701) + GameCooltip:AddLine (name, 1) --> can use only 1 focus potion (can't be pre-potion) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + end + + --get the buff container for all the others potions + local buff_uptime_container = player.buff_uptime and player.buff_uptime_spell_tables and player.buff_uptime_spell_tables._ActorTable + if (buff_uptime_container) then + --potion of the jade serpent + local jade_serpent_potion = buff_uptime_container [105702] + if (jade_serpent_potion) then + local name, _, icon = GetSpellInfo (105702) + GameCooltip:AddLine (name, jade_serpent_potion.activedamt) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + + --potion of mogu power + local mogu_power_potion = buff_uptime_container [105706] + if (mogu_power_potion) then + local name, _, icon = GetSpellInfo (105706) + GameCooltip:AddLine (name, mogu_power_potion.activedamt) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + --virmen's bite + local virmens_bite_potion = buff_uptime_container [105697] + if (virmens_bite_potion) then + local name, _, icon = GetSpellInfo (105697) + GameCooltip:AddLine (name, virmens_bite_potion.activedamt) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + + --potion of the mountains + local mountains_potion = buff_uptime_container [105698] + if (mountains_potion) then + local name, _, icon = GetSpellInfo (105698) + GameCooltip:AddLine (name, mountains_potion.activedamt) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon (icon, 1, 1, 14, 14) + end + end + + local spell = actor.spell_tables._ActorTable [15407] + spell.targets:SortByKey ("total") + for _, target in ipairs (spell.targets._ActorTable) do + GameCooltip:AddLine (target.nome, _detalhes.ToKFunctions [_detalhes.tooltip.abbreviation] (_, target.total)) + _detalhes:AddTooltipBackgroundStatusbar() + GameCooltip:AddIcon ("Interface\\FriendsFrame\\StatusIcon-Offline", 1, 1, 14, 14) + end + + + --]] \ No newline at end of file diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index 0e330a2e..83cab465 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -183,14 +183,18 @@ function _detalhes:OpenOptionsWindow (instance) local sub_atributo = _this_instance.sub_atributo if (atributo == 5) then --> custom + local CustomObject = _detalhes.custom [sub_atributo] - if (CustomObject) then - InstanceList [#InstanceList+1] = {value = index, label = _detalhes.atributos.lista [atributo] .. " - " .. CustomObject.name, onclick = onSelectInstance, icon = CustomObject.icon} + if (not CustomObject) then + _this_instance:ResetAttribute() + atributo = _this_instance.atributo + sub_atributo = _this_instance.sub_atributo + InstanceList [#InstanceList+1] = {value = index, label = "#".. index .. " " .. _detalhes.atributos.lista [atributo] .. " - " .. _detalhes.sub_atributos [atributo].lista [sub_atributo], onclick = onSelectInstance, icon = _detalhes.sub_atributos [atributo].icones[sub_atributo] [1], texcoord = _detalhes.sub_atributos [atributo].icones[sub_atributo] [2]} else - InstanceList [#InstanceList+1] = {value = index, label = "unknown" .. " - " .. " invalid custom", onclick = onSelectInstance, icon = [[Interface\COMMON\VOICECHAT-MUTED]]} + InstanceList [#InstanceList+1] = {value = index, label = "#".. index .. " " .. CustomObject.name, onclick = onSelectInstance, icon = CustomObject.icon} end - + else local modo = _this_instance.modo @@ -1031,6 +1035,7 @@ function window:CreateFrame20() _detalhes.atributo_heal:UpdateSelectedToKFunction() _detalhes.atributo_energy:UpdateSelectedToKFunction() _detalhes.atributo_misc:UpdateSelectedToKFunction() + _detalhes.atributo_custom:UpdateSelectedToKFunction() end local icon = [[Interface\COMMON\mini-hourglass]] @@ -1067,6 +1072,7 @@ function window:CreateFrame20() _detalhes.atributo_heal:UpdateSelectedToKFunction() _detalhes.atributo_energy:UpdateSelectedToKFunction() _detalhes.atributo_misc:UpdateSelectedToKFunction() + _detalhes.atributo_custom:UpdateSelectedToKFunction() end local icon = [[Interface\Buttons\UI-Panel-BiggerButton-Up]] @@ -3010,6 +3016,7 @@ function window:CreateFrame1() _detalhes.atributo_heal:UpdateSelectedToKFunction() _detalhes.atributo_energy:UpdateSelectedToKFunction() _detalhes.atributo_misc:UpdateSelectedToKFunction() + _detalhes.atributo_custom:UpdateSelectedToKFunction() _detalhes:AtualizaGumpPrincipal (-1, true) end @@ -3294,10 +3301,115 @@ function window:CreateFrame2() -- window:CreateLineBackground2 (frame2, "OverallNewChallengeSlider", "OverallNewChallengeLabel", Loc ["STRING_OPTIONS_OVERALL_CHALLENGE_DESC"]) + --> captures + + --> icons + g:NewImage (frame2, [[Interface\AddOns\Details\images\atributos_captures]], 20, 20, nil, nil, "damageCaptureImage", "$parentCaptureDamage") + frame2.damageCaptureImage:SetTexCoord (0, 0.125, 0, 1) + + g:NewImage (frame2, [[Interface\AddOns\Details\images\atributos_captures]], 20, 20, nil, nil, "healCaptureImage", "$parentCaptureHeal") + frame2.healCaptureImage:SetTexCoord (0.125, 0.25, 0, 1) + + g:NewImage (frame2, [[Interface\AddOns\Details\images\atributos_captures]], 20, 20, nil, nil, "energyCaptureImage", "$parentCaptureEnergy") + frame2.energyCaptureImage:SetTexCoord (0.25, 0.375, 0, 1) + + g:NewImage (frame2, [[Interface\AddOns\Details\images\atributos_captures]], 20, 20, nil, nil, "miscCaptureImage", "$parentCaptureMisc") + frame2.miscCaptureImage:SetTexCoord (0.375, 0.5, 0, 1) + + g:NewImage (frame2, [[Interface\AddOns\Details\images\atributos_captures]], 20, 20, nil, nil, "auraCaptureImage", "$parentCaptureAura") + frame2.auraCaptureImage:SetTexCoord (0.5, 0.625, 0, 1) + + --> labels + g:NewLabel (frame2, _, "$parentCaptureDamageLabel", "damageCaptureLabel", Loc ["STRING_OPTIONS_CDAMAGE"], "GameFontHighlightLeft") + frame2.damageCaptureLabel:SetPoint ("left", frame2.damageCaptureImage, "right", 2) + + g:NewLabel (frame2, _, "$parentCaptureHealLabel", "healCaptureLabel", Loc ["STRING_OPTIONS_CHEAL"], "GameFontHighlightLeft") + frame2.healCaptureLabel:SetPoint ("left", frame2.healCaptureImage, "right", 2) + + g:NewLabel (frame2, _, "$parentCaptureEnergyLabel", "energyCaptureLabel", Loc ["STRING_OPTIONS_CENERGY"], "GameFontHighlightLeft") + frame2.energyCaptureLabel:SetPoint ("left", frame2.energyCaptureImage, "right", 2) + + g:NewLabel (frame2, _, "$parentCaptureMiscLabel", "miscCaptureLabel", Loc ["STRING_OPTIONS_CMISC"], "GameFontHighlightLeft") + frame2.miscCaptureLabel:SetPoint ("left", frame2.miscCaptureImage, "right", 2) + + g:NewLabel (frame2, _, "$parentCaptureAuraLabel", "auraCaptureLabel", Loc ["STRING_OPTIONS_CAURAS"], "GameFontHighlightLeft") + frame2.auraCaptureLabel:SetPoint ("left", frame2.auraCaptureImage, "right", 2) + + --> switches + + local switch_icon_color = function (icon, on_off) + icon:SetDesaturated (not on_off) + end + + g:NewSwitch (frame2, _, "$parentCaptureDamageSlider", "damageCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["damage"]) + frame2.damageCaptureSlider:SetPoint ("left", frame2.damageCaptureLabel, "right", 2) + frame2.damageCaptureSlider.OnSwitch = function (self, _, value) + _detalhes:CaptureSet (value, "damage", true) + switch_icon_color (frame2.damageCaptureImage, value) + end + switch_icon_color (frame2.damageCaptureImage, _detalhes.capture_real ["damage"]) + + window:CreateLineBackground2 (frame2, "damageCaptureSlider", "damageCaptureLabel", Loc ["STRING_OPTIONS_CDAMAGE_DESC"], frame2.damageCaptureImage) + + g:NewSwitch (frame2, _, "$parentCaptureHealSlider", "healCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["heal"]) + frame2.healCaptureSlider:SetPoint ("left", frame2.healCaptureLabel, "right", 2) + frame2.healCaptureSlider.OnSwitch = function (self, _, value) + _detalhes:CaptureSet (value, "heal", true) + switch_icon_color (frame2.healCaptureImage, value) + end + switch_icon_color (frame2.healCaptureImage, _detalhes.capture_real ["heal"]) + + window:CreateLineBackground2 (frame2, "healCaptureSlider", "healCaptureLabel", Loc ["STRING_OPTIONS_CHEAL_DESC"], frame2.healCaptureImage) + + g:NewSwitch (frame2, _, "$parentCaptureEnergySlider", "energyCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["energy"]) + frame2.energyCaptureSlider:SetPoint ("left", frame2.energyCaptureLabel, "right", 2) + + frame2.energyCaptureSlider.OnSwitch = function (self, _, value) + _detalhes:CaptureSet (value, "energy", true) + switch_icon_color (frame2.energyCaptureImage, value) + end + switch_icon_color (frame2.energyCaptureImage, _detalhes.capture_real ["energy"]) + + window:CreateLineBackground2 (frame2, "energyCaptureSlider", "energyCaptureLabel", Loc ["STRING_OPTIONS_CENERGY_DESC"], frame2.energyCaptureImage) + + g:NewSwitch (frame2, _, "$parentCaptureMiscSlider", "miscCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["miscdata"]) + frame2.miscCaptureSlider:SetPoint ("left", frame2.miscCaptureLabel, "right", 2) + frame2.miscCaptureSlider.OnSwitch = function (self, _, value) + _detalhes:CaptureSet (value, "miscdata", true) + switch_icon_color (frame2.miscCaptureImage, value) + end + switch_icon_color (frame2.miscCaptureImage, _detalhes.capture_real ["miscdata"]) + + window:CreateLineBackground2 (frame2, "miscCaptureSlider", "miscCaptureLabel", Loc ["STRING_OPTIONS_CMISC_DESC"], frame2.miscCaptureImage) + + g:NewSwitch (frame2, _, "$parentCaptureAuraSlider", "auraCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["aura"]) + frame2.auraCaptureSlider:SetPoint ("left", frame2.auraCaptureLabel, "right", 2) + frame2.auraCaptureSlider.OnSwitch = function (self, _, value) + _detalhes:CaptureSet (value, "aura", true) + switch_icon_color (frame2.auraCaptureImage, value) + end + switch_icon_color (frame2.auraCaptureImage, _detalhes.capture_real ["aura"]) + + window:CreateLineBackground2 (frame2, "auraCaptureSlider", "auraCaptureLabel", Loc ["STRING_OPTIONS_CAURAS_DESC"], frame2.auraCaptureImage) + + --> cloud capture + g:NewLabel (frame2, _, "$parentCloudCaptureLabel", "cloudCaptureLabel", Loc ["STRING_OPTIONS_CLOUD"], "GameFontHighlightLeft") + + g:NewSwitch (frame2, _, "$parentCloudAuraSlider", "cloudCaptureSlider", 60, 20, _, _, _detalhes.cloud_capture) + frame2.cloudCaptureSlider:SetPoint ("left", frame2.cloudCaptureLabel, "right", 2) + frame2.cloudCaptureSlider.OnSwitch = function (self, _, value) + _detalhes.cloud_capture = value + end + + window:CreateLineBackground2 (frame2, "cloudCaptureSlider", "cloudCaptureLabel", Loc ["STRING_OPTIONS_CLOUD_DESC"] ) + --> anchors + --general anchor g:NewLabel (frame2, _, "$parentGeneralAnchor", "GeneralAnchorLabel", Loc ["STRING_OPTIONS_GENERAL_ANCHOR"], "GameFontNormal") - + --captures anchor + g:NewLabel (frame2, _, "$parentDataCollectAnchor", "DataCollectAnchorLabel", Loc ["STRING_OPTIONS_DATACOLLECT_ANCHOR"], "GameFontNormal") + local x = window.left_start_at titulo_combattweeks:SetPoint (x, -30) @@ -3320,6 +3432,20 @@ function window:CreateFrame2() window:arrange_menu (frame2, left_side, x, window.top_start_at) + local x = window.right_start_at + + local right_side = { + {"DataCollectAnchorLabel", 1, true}, + {"damageCaptureImage", 2}, + {"healCaptureImage", 3}, + {"energyCaptureImage", 4}, + {"miscCaptureImage", 5}, + {"auraCaptureImage", 6}, + {"cloudCaptureLabel", 7, true}, + } + + window:arrange_menu (frame2, right_side, x, -90) + end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- General Settings - Profiles ~13 @@ -6110,131 +6236,7 @@ function window:CreateFrame11() local frame10 = window.options [10][1] local frame11 = window.options [11][1] - local titulo_performance_captures = g:NewLabel (frame11, _, "$parentTituloPerformanceCaptures", "tituloPerformanceCaptures", Loc ["STRING_OPTIONS_PERFORMANCECAPTURES"], "GameFontNormal", 16) - local titulo_performance_captures_desc = g:NewLabel (frame11, _, "$parentTituloPersonaCaptures2", "tituloPersonaCaptures2Label", Loc ["STRING_OPTIONS_PERFORMANCECAPTURES_DESC"], "GameFontNormal", 9, "white") - titulo_performance_captures_desc.width = 320 - - --------------- Captures - g:NewImage (frame11, [[Interface\AddOns\Details\images\atributos_captures]], 20, 20, nil, nil, "damageCaptureImage", "$parentCaptureDamage") - frame11.damageCaptureImage:SetTexCoord (0, 0.125, 0, 1) - - g:NewImage (frame11, [[Interface\AddOns\Details\images\atributos_captures]], 20, 20, nil, nil, "healCaptureImage", "$parentCaptureHeal") - frame11.healCaptureImage:SetTexCoord (0.125, 0.25, 0, 1) - - g:NewImage (frame11, [[Interface\AddOns\Details\images\atributos_captures]], 20, 20, nil, nil, "energyCaptureImage", "$parentCaptureEnergy") - frame11.energyCaptureImage:SetTexCoord (0.25, 0.375, 0, 1) - - g:NewImage (frame11, [[Interface\AddOns\Details\images\atributos_captures]], 20, 20, nil, nil, "miscCaptureImage", "$parentCaptureMisc") - frame11.miscCaptureImage:SetTexCoord (0.375, 0.5, 0, 1) - - g:NewImage (frame11, [[Interface\AddOns\Details\images\atributos_captures]], 20, 20, nil, nil, "auraCaptureImage", "$parentCaptureAura") - frame11.auraCaptureImage:SetTexCoord (0.5, 0.625, 0, 1) - - g:NewLabel (frame11, _, "$parentCaptureDamageLabel", "damageCaptureLabel", Loc ["STRING_OPTIONS_CDAMAGE"], "GameFontHighlightLeft") - frame11.damageCaptureLabel:SetPoint ("left", frame11.damageCaptureImage, "right", 2) - - g:NewLabel (frame11, _, "$parentCaptureHealLabel", "healCaptureLabel", Loc ["STRING_OPTIONS_CHEAL"], "GameFontHighlightLeft") - frame11.healCaptureLabel:SetPoint ("left", frame11.healCaptureImage, "right", 2) - - g:NewLabel (frame11, _, "$parentCaptureEnergyLabel", "energyCaptureLabel", Loc ["STRING_OPTIONS_CENERGY"], "GameFontHighlightLeft") - frame11.energyCaptureLabel:SetPoint ("left", frame11.energyCaptureImage, "right", 2) - - g:NewLabel (frame11, _, "$parentCaptureMiscLabel", "miscCaptureLabel", Loc ["STRING_OPTIONS_CMISC"], "GameFontHighlightLeft") - frame11.miscCaptureLabel:SetPoint ("left", frame11.miscCaptureImage, "right", 2) - - g:NewLabel (frame11, _, "$parentCaptureAuraLabel", "auraCaptureLabel", Loc ["STRING_OPTIONS_CAURAS"], "GameFontHighlightLeft") - frame11.auraCaptureLabel:SetPoint ("left", frame11.auraCaptureImage, "right", 2) - - local switch_icon_color = function (icon, on_off) - icon:SetDesaturated (not on_off) - end - - g:NewSwitch (frame11, _, "$parentCaptureDamageSlider", "damageCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["damage"]) - frame11.damageCaptureSlider:SetPoint ("left", frame11.damageCaptureLabel, "right", 2) - frame11.damageCaptureSlider.OnSwitch = function (self, _, value) - _detalhes:CaptureSet (value, "damage", true) - switch_icon_color (frame11.damageCaptureImage, value) - end - switch_icon_color (frame11.damageCaptureImage, _detalhes.capture_real ["damage"]) - - window:CreateLineBackground2 (frame11, "damageCaptureSlider", "damageCaptureLabel", Loc ["STRING_OPTIONS_CDAMAGE_DESC"], frame11.damageCaptureImage) - - g:NewSwitch (frame11, _, "$parentCaptureHealSlider", "healCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["heal"]) - frame11.healCaptureSlider:SetPoint ("left", frame11.healCaptureLabel, "right", 2) - frame11.healCaptureSlider.OnSwitch = function (self, _, value) - _detalhes:CaptureSet (value, "heal", true) - switch_icon_color (frame11.healCaptureImage, value) - end - switch_icon_color (frame11.healCaptureImage, _detalhes.capture_real ["heal"]) - - window:CreateLineBackground2 (frame11, "healCaptureSlider", "healCaptureLabel", Loc ["STRING_OPTIONS_CHEAL_DESC"], frame11.healCaptureImage) - - g:NewSwitch (frame11, _, "$parentCaptureEnergySlider", "energyCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["energy"]) - frame11.energyCaptureSlider:SetPoint ("left", frame11.energyCaptureLabel, "right", 2) - frame11.energyCaptureSlider.OnSwitch = function (self, _, value) - _detalhes:CaptureSet (value, "energy", true) - switch_icon_color (frame11.energyCaptureImage, value) - end - switch_icon_color (frame11.energyCaptureImage, _detalhes.capture_real ["energy"]) - - window:CreateLineBackground2 (frame11, "energyCaptureSlider", "energyCaptureLabel", Loc ["STRING_OPTIONS_CENERGY_DESC"], frame11.energyCaptureImage) - - g:NewSwitch (frame11, _, "$parentCaptureMiscSlider", "miscCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["miscdata"]) - frame11.miscCaptureSlider:SetPoint ("left", frame11.miscCaptureLabel, "right", 2) - frame11.miscCaptureSlider.OnSwitch = function (self, _, value) - _detalhes:CaptureSet (value, "miscdata", true) - switch_icon_color (frame11.miscCaptureImage, value) - end - switch_icon_color (frame11.miscCaptureImage, _detalhes.capture_real ["miscdata"]) - - window:CreateLineBackground2 (frame11, "miscCaptureSlider", "miscCaptureLabel", Loc ["STRING_OPTIONS_CMISC_DESC"], frame11.miscCaptureImage) - - g:NewSwitch (frame11, _, "$parentCaptureAuraSlider", "auraCaptureSlider", 60, 20, _, _, _detalhes.capture_real ["aura"]) - frame11.auraCaptureSlider:SetPoint ("left", frame11.auraCaptureLabel, "right", 2) - frame11.auraCaptureSlider.OnSwitch = function (self, _, value) - _detalhes:CaptureSet (value, "aura", true) - switch_icon_color (frame11.auraCaptureImage, value) - end - switch_icon_color (frame11.auraCaptureImage, _detalhes.capture_real ["aura"]) - - window:CreateLineBackground2 (frame11, "auraCaptureSlider", "auraCaptureLabel", Loc ["STRING_OPTIONS_CAURAS_DESC"], frame11.auraCaptureImage) - - --------------- Cloud Capture - - g:NewLabel (frame11, _, "$parentCloudCaptureLabel", "cloudCaptureLabel", Loc ["STRING_OPTIONS_CLOUD"], "GameFontHighlightLeft") - - g:NewSwitch (frame11, _, "$parentCloudAuraSlider", "cloudCaptureSlider", 60, 20, _, _, _detalhes.cloud_capture) - frame11.cloudCaptureSlider:SetPoint ("left", frame11.cloudCaptureLabel, "right", 2) - frame11.cloudCaptureSlider.OnSwitch = function (self, _, value) - _detalhes.cloud_capture = value - end - - window:CreateLineBackground2 (frame11, "cloudCaptureSlider", "cloudCaptureLabel", Loc ["STRING_OPTIONS_CLOUD_DESC"] ) - - --> Anchors - - --general anchor - g:NewLabel (frame11, _, "$parentDataCollectAnchor", "DataCollectAnchorLabel", Loc ["STRING_OPTIONS_DATACOLLECT_ANCHOR"], "GameFontNormal") - - local x = window.left_start_at - - titulo_performance_captures:SetPoint (x, -30) - titulo_performance_captures_desc:SetPoint (x, -50) - - local left_side = { - {"DataCollectAnchorLabel", 1, true}, - {"damageCaptureImage", 2}, - {"healCaptureImage", 3}, - {"energyCaptureImage", 4}, - {"miscCaptureImage", 5}, - {"auraCaptureImage", 6}, - {"cloudCaptureLabel", 7, true}, - } - - window:arrange_menu (frame11, left_side, x, -90) - - -- end window.creating = nil end @@ -6570,6 +6572,13 @@ function window:update_all (editing_instance) _G.DetailsOptionsWindow2OverallNewBossSlider.MyObject:SetValue (_detalhes.overall_clear_newboss) _G.DetailsOptionsWindow2OverallNewChallengeSlider.MyObject:SetValue (_detalhes.overall_clear_newchallenge) + _G.DetailsOptionsWindow2CaptureDamageSlider.MyObject:SetValue (_detalhes.capture_real ["damage"]) + _G.DetailsOptionsWindow2CaptureHealSlider.MyObject:SetValue (_detalhes.capture_real ["heal"]) + _G.DetailsOptionsWindow2CaptureEnergySlider.MyObject:SetValue (_detalhes.capture_real ["energy"]) + _G.DetailsOptionsWindow2CaptureMiscSlider.MyObject:SetValue (_detalhes.capture_real ["miscdata"]) + _G.DetailsOptionsWindow2CaptureAuraSlider.MyObject:SetValue (_detalhes.capture_real ["aura"]) + _G.DetailsOptionsWindow2CloudAuraSlider.MyObject:SetValue (_detalhes.cloud_capture) + --> window 3 local skin = editing_instance.skin @@ -6731,12 +6740,7 @@ function window:update_all (editing_instance) _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) + --> window 13 _G.DetailsOptionsWindow13SelectProfileDropdown.MyObject:Select (_detalhes:GetCurrentProfileName()) diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index 2379bb15..f060f4d7 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -4425,6 +4425,7 @@ function _detalhes:ChangeSkin (skin_name) _detalhes.atributo_heal:UpdateSelectedToKFunction() _detalhes.atributo_energy:UpdateSelectedToKFunction() _detalhes.atributo_misc:UpdateSelectedToKFunction() + _detalhes.atributo_custom:UpdateSelectedToKFunction() ----------> call widgets handlers self:SetBarSettings (self.row_info.height) @@ -6037,11 +6038,17 @@ function gump:CriaCabecalho (baseframe, instancia) local CustomObject = _detalhes.custom [sub_atributo] - --> as addmenu dont support textcoords we need to add in parts, first adding text and menu, after we add the icon - --> text and menu can be added in one call if doesnt need more details like color or right text - CoolTip:AddMenu (1, OnClickNovoMenu, index, nil, nil, "#".. index .. " " .. _detalhes.atributos.lista [atributo] .. " - " .. CustomObject.name, _, true) - CoolTip:AddIcon (CustomObject.icon, 1, 1, 20, 20, 0, 1, 0, 1) - + if (not CustomObject) then + _this_instance:ResetAttribute() + atributo = _this_instance.atributo + sub_atributo = _this_instance.sub_atributo + CoolTip:AddMenu (1, OnClickNovoMenu, index, nil, nil, "#".. index .. " " .. _detalhes.atributos.lista [atributo] .. " - " .. _detalhes.sub_atributos [atributo].lista [sub_atributo], _, true) + CoolTip:AddIcon (_detalhes.sub_atributos [atributo].icones[sub_atributo] [1], 1, 1, 20, 20, unpack (_detalhes.sub_atributos [atributo].icones[sub_atributo] [2])) + else + CoolTip:AddMenu (1, OnClickNovoMenu, index, nil, nil, "#".. index .. " " .. _detalhes.atributos.lista [atributo] .. " - " .. CustomObject:GetName(), _, true) + CoolTip:AddIcon (CustomObject.icon, 1, 1, 20, 20, 0, 1, 0, 1) + end + else local modo = _this_instance.modo diff --git a/images/custom_bg.tga b/images/custom_bg.tga index c5db4a74..9b71e06e 100644 Binary files a/images/custom_bg.tga and b/images/custom_bg.tga differ diff --git a/images/custom_icones.tga b/images/custom_icones.tga new file mode 100644 index 00000000..17c19187 Binary files /dev/null and b/images/custom_icones.tga differ diff --git a/locales/Details-enUS.lua b/locales/Details-enUS.lua index 1f4f3e93..5fe10ced 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"] = "|cFFFFFF00a1.16.0 - a1.16.1 - a1.16.3b (|cFFFFCC00Jun 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed row creation while resizing where sometimes it was broking the last row in the window.\n\n|cFFFFFF00-|r Fixed small involuntary resizes after resizing a window. |cFF999999(thanks @Morimvudu-Nemesis)|r\n\n|cFFFFFF00-|r Fixed frame strata after stretching the window where was setting its strata to Medium.\n\n|cFFFFFF00-|r Fixed Vanguard strata where it wasnt following the strata from its host window.\n\n|cFFFFFF00-|r Mode menu now have a sub menu for raid plugins.\n\n|cFFFFFF00-|r Red and Green colors under comparison frame has been inverted. |cFF999999(thanks @skmzarn-mmochampion forum)|r\n\n|cFFFFFF00-|r Fixed some report issues with dps and hps, also almost all reports now have guide lines. |cFF999999(thanks @sosleapy-mmochampion forum)|r\n\n|cFFFFFF00-|r Pet dispell and interrupt count also for its owner as well. |cFF999999(thanks @skmzarn-mmochampion forum)|r\n\n|cFFFFFF00-|r Few fixes on comparison panel over Player Details Window.\n\n|cFFFFFF00-|r Added option to be able to save the windows size and position within the profile. |cFF999999(thanks @Torchler-mmochampion forum)|r\n\n|cFFFFFF00-|r Added performance profile settings. |cFF999999(thanks @SlippyCheeze-mmochampion forum)|r\n\n|cFFFFFF00-|r Added auto switch based on group roles also a switch for wipe. |cFF999999(thanks @SlippyCheeze-mmochampion forum)|r\n\n|cFFFFFF00-|r Fixed a bug where sometimes all non boss segments was considered boss encounters.\n\n|cFFFFFF00v1.15.4 (|cFFFFCC00Jun 06, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added a compare tab under Player Details Window:\nThis new tab showns up when there is too characters with the same class and spec.\nIts useful to compare skills used, uptimes and targets.\n\n|cFFFFFF00-|r Few improvements on Default and ElvUI skins.\n\n|cFFFFFF00-|r Added a button for auto align two windows within right chat window when ElvUI skin is active.\n\n|cFFFFFF00-|r Fixed problem with Damage -> Enemies display.\n\n|cFFFFFF00-|r Fixed report Player Detail Window report buttons.\n\n|cFFFFFF00-|r Fixed some report lines where the numbers wasnt properly formatted.\n\n|cFFFFFF00-|r Fixed a rare bug where the owner of some pets wasnt detected.\n\n|cFFFFFF00-|r Fixed issue in dungeons where capture data get paused after a boss kill.\n\n|cFFFFFF00-|r Fixed issue with Encounter Details showing its icon for dungeons bosses.\n\n|cFFFFFF00-|r Fixed a rare bug where the capture of damage stops after erasing a trash segment.\n\n|cFFFFFF00v1.15.0 - v1.15.3 - v1.15.3b (|cFFFFCC00Jun 03, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Emergencial fix for death logs which sometimes was breaking the addon data capture.\n\n|cFFFFFF00-|r Fixed window alerts which was showing behind the bars.\n\n|cFFFFFF00-|r Fixed death log issue with friendly fire hits.\n\n|cFFFFFF00-|r Fixed a issue where Details! windows wasn't hidden when a pet battle starts.\n\n|cFFFFFF00-|r Fixed a issue with segments menu when a window is placed on the right side of the screen.\n\n|cFFFFFF00-|r Damage -> Enemies now also show neutral creatures.\n\n|cFFFFFF00-|r Added support to dungeons, bosses and trash mobs are now recognized.\n\n|cFFFFFF00-|r Added target information for each spell in Player Detail Window.\n\n|cFFFFFF00-|r Added options for change the location of tooltips.\n\n|cFFFFFF00-|r Added options for change the Overall Data functionality.\n\n|cFFFFFF00-|r Added tooltips for lock and detach buttons.\n\n|cFFFFFF00-|r Added new row texture: Details Vidro.\n\n|cFFFFFF00-|r Revamp on death log tooltips.\n\n|cFFFFFF00-|r Improved the visual effect for the instance which current moving window can snap to.\n\n|cFFFFFF00v1.14.5 - 1.14.6 (|cFFFFCC00May 24, 2014|r|cFFFFFF00):|r\n\n|cFFFFFF00-|r Added option for lock segments display, so, when a segment is chosen, the other windows also change it.\n\n|cFFFFFF00-|r Added option for show the total amount of spells, targets and pets in tooltips.\n\n|cFFFFFF00-|r Finished another revamp on options panel.\n\n|cFFFFFF00-|r Now its possible open more then 1 Raid Plugins at once on diferent windows.\n\n|cFFFFFF00-|r Added a large text editor for make changes on custom texts.\n\n|cFFFFFF00-|r Added new option for enable borders on the bars.\n\n|cFFFFFF00-|r Added Death Barrier as a absorb spell.\n\n|cFFFFFF00-|r Fixed a bug on overheal tooltip where was showing the Hps instead of overheal.\n\n|cFFFFFF00v1.14.0 - v1.14.0b (|cFFFFCC00May 17, 2014|r|cFFFFFF00):\n\n|cFFFFFF00-|r Added a new tab on options panel for tooltip configuration.\n\n|cFFFFFF00-|r Added a new tab on options panel for broker config.\n\n|cFFFFFF00-|r Added new abbreviation method called comma.\n\n|cFFFFFF00-|r All instances now have a delete button.\n\n|cFFFFFF00-|r Full re-write on the instance, delete and close buttons.\n\n|cFFFFFF00-|r HotCorners now sort icons according with most used.\n\n|cFFFFFF00-|r Few changes on all skins in order to fit on the new right menu buttons.\n\n|cFFFFFF00-|r Added Horde avatars.\n\n|cFFFFFF00-|r Fixed issue where shortcut panel shows below thw windows when its in Dialog strata.\n\n|cFFFFFF00v1.13.8 - v1.13.8a (|cFFFFCC00May 09, 2014|r|cFFFFFF00):\n\n|cFFFFFF00-|r Fixed issue with Vanguard where it wasn't showing debuffs stacks on the tanks if you are a healer os dps.\n\n|cFFFFFF00-|r Added option for put stretch button on the fullscreen strata which makes it always on top of others frames.\n\n|cFFFFFF00-|r Added background and dialog stratas.\n\n|cFFFFFF00-|r Added option for percentage: follow the combat totals or the first player total.\n\n|cFFFFFF00-|r Added option for show or hide the left buttons on menu bar.\n\n|cFFFFFF00-|r Added option for change the left buttons size in the menu bar.\n\n|cFFFFFF00-|r Added option for delete a instance.\n\n|cFFFFFF00-|r Instance Segment Mini display now is more accuracy about telling the enemy in the segment.\n\n|cFFFFFF00-|r Player Details Window now show all pet abilities instead of just the total pet damage.\n\n|cFFFFFF00-|r Rework done on report texts, now the title is more shorter and also format Dps and Hps numbers.\n\n|cFFFFFF00-|r Simple Gray and again ElvUI skins got some rework.\n\n|cFFFFFF00-|r Lib HotCorner now is data broker based and shows up all broker plugins in the bar.\n\n|cFFFFFF00v1.13.5 / v1.13.5a (|cFFFFCC00May 02, 2014|r|cFFFFFF00):|r\n\n|cFFFFFF00-|r Added keybinds to reset segments and scroll up/down.\n\n|cFFFFFF00-|r Added Spell Customization options where icon and the name of a spell can be changed.\n\n|cFFFFFF00-|r Added option to change the micro displays side, now it can be shown on the window top side.\n\n|cFFFFFF00-|r Micro Displays, also, should now give less problems and be more dynamic.\n\n|cFFFFFF00-|r Added options to change the transparency when out of combat and out of a group.\n\n|cFFFFFF00-|r Added and Still under development the panel for create data captures for charts.\n\n|cFFFFFF00-|r Fixed a issue with flat skin where the close button was just too big." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00a1.17.0 (|cFFFFCC00Jun 21, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Support for Custom Displays has been rewrited, to access the new panel go to Sword Menu -> Custom -> Create New Display.\n\n|cFFFFFF00-|r Added a custom display for show potion usage.\n\n|cFFFFFF00-|r Fixed a bug where the player pet wasnt being tracked after logon in the game. This bug was affecting directly classes with pets playing out of a raid group.\n\n|cFFFFFF00-|r Fixed the report bug on healing, energy and misc attributes |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00a1.16.0 - a1.16.1 - a1.16.3b (|cFFFFCC00Jun 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed row creation while resizing where sometimes it was broking the last row in the window.\n\n|cFFFFFF00-|r Fixed small involuntary resizes after resizing a window. |cFF999999(thanks @Morimvudu-Nemesis)|r\n\n|cFFFFFF00-|r Fixed frame strata after stretching the window where was setting its strata to Medium.\n\n|cFFFFFF00-|r Fixed Vanguard strata where it wasnt following the strata from its host window.\n\n|cFFFFFF00-|r Mode menu now have a sub menu for raid plugins.\n\n|cFFFFFF00-|r Red and Green colors under comparison frame has been inverted. |cFF999999(thanks @skmzarn-mmochampion forum)|r\n\n|cFFFFFF00-|r Fixed some report issues with dps and hps, also almost all reports now have guide lines. |cFF999999(thanks @sosleapy-mmochampion forum)|r\n\n|cFFFFFF00-|r Pet dispell and interrupt count also for its owner as well. |cFF999999(thanks @skmzarn-mmochampion forum)|r\n\n|cFFFFFF00-|r Few fixes on comparison panel over Player Details Window.\n\n|cFFFFFF00-|r Added option to be able to save the windows size and position within the profile. |cFF999999(thanks @Torchler-mmochampion forum)|r\n\n|cFFFFFF00-|r Added performance profile settings. |cFF999999(thanks @SlippyCheeze-mmochampion forum)|r\n\n|cFFFFFF00-|r Added auto switch based on group roles also a switch for wipe. |cFF999999(thanks @SlippyCheeze-mmochampion forum)|r\n\n|cFFFFFF00-|r Fixed a bug where sometimes all non boss segments was considered boss encounters.\n\n|cFFFFFF00v1.15.4 (|cFFFFCC00Jun 06, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added a compare tab under Player Details Window:\nThis new tab showns up when there is too characters with the same class and spec.\nIts useful to compare skills used, uptimes and targets.\n\n|cFFFFFF00-|r Few improvements on Default and ElvUI skins.\n\n|cFFFFFF00-|r Added a button for auto align two windows within right chat window when ElvUI skin is active.\n\n|cFFFFFF00-|r Fixed problem with Damage -> Enemies display.\n\n|cFFFFFF00-|r Fixed report Player Detail Window report buttons.\n\n|cFFFFFF00-|r Fixed some report lines where the numbers wasnt properly formatted.\n\n|cFFFFFF00-|r Fixed a rare bug where the owner of some pets wasnt detected.\n\n|cFFFFFF00-|r Fixed issue in dungeons where capture data get paused after a boss kill.\n\n|cFFFFFF00-|r Fixed issue with Encounter Details showing its icon for dungeons bosses.\n\n|cFFFFFF00-|r Fixed a rare bug where the capture of damage stops after erasing a trash segment.\n\n|cFFFFFF00v1.15.0 - v1.15.3 - v1.15.3b (|cFFFFCC00Jun 03, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Emergencial fix for death logs which sometimes was breaking the addon data capture.\n\n|cFFFFFF00-|r Fixed window alerts which was showing behind the bars.\n\n|cFFFFFF00-|r Fixed death log issue with friendly fire hits.\n\n|cFFFFFF00-|r Fixed a issue where Details! windows wasn't hidden when a pet battle starts.\n\n|cFFFFFF00-|r Fixed a issue with segments menu when a window is placed on the right side of the screen.\n\n|cFFFFFF00-|r Damage -> Enemies now also show neutral creatures.\n\n|cFFFFFF00-|r Added support to dungeons, bosses and trash mobs are now recognized.\n\n|cFFFFFF00-|r Added target information for each spell in Player Detail Window.\n\n|cFFFFFF00-|r Added options for change the location of tooltips.\n\n|cFFFFFF00-|r Added options for change the Overall Data functionality.\n\n|cFFFFFF00-|r Added tooltips for lock and detach buttons.\n\n|cFFFFFF00-|r Added new row texture: Details Vidro.\n\n|cFFFFFF00-|r Revamp on death log tooltips.\n\n|cFFFFFF00-|r Improved the visual effect for the instance which current moving window can snap to.\n\n|cFFFFFF00v1.14.5 - 1.14.6 (|cFFFFCC00May 24, 2014|r|cFFFFFF00):|r\n\n|cFFFFFF00-|r Added option for lock segments display, so, when a segment is chosen, the other windows also change it.\n\n|cFFFFFF00-|r Added option for show the total amount of spells, targets and pets in tooltips.\n\n|cFFFFFF00-|r Finished another revamp on options panel.\n\n|cFFFFFF00-|r Now its possible open more then 1 Raid Plugins at once on diferent windows.\n\n|cFFFFFF00-|r Added a large text editor for make changes on custom texts.\n\n|cFFFFFF00-|r Added new option for enable borders on the bars.\n\n|cFFFFFF00-|r Added Death Barrier as a absorb spell.\n\n|cFFFFFF00-|r Fixed a bug on overheal tooltip where was showing the Hps instead of overheal.\n\n|cFFFFFF00v1.14.0 - v1.14.0b (|cFFFFCC00May 17, 2014|r|cFFFFFF00):\n\n|cFFFFFF00-|r Added a new tab on options panel for tooltip configuration.\n\n|cFFFFFF00-|r Added a new tab on options panel for broker config.\n\n|cFFFFFF00-|r Added new abbreviation method called comma.\n\n|cFFFFFF00-|r All instances now have a delete button.\n\n|cFFFFFF00-|r Full re-write on the instance, delete and close buttons.\n\n|cFFFFFF00-|r HotCorners now sort icons according with most used.\n\n|cFFFFFF00-|r Few changes on all skins in order to fit on the new right menu buttons.\n\n|cFFFFFF00-|r Added Horde avatars.\n\n|cFFFFFF00-|r Fixed issue where shortcut panel shows below thw windows when its in Dialog strata.\n\n|cFFFFFF00v1.13.8 - v1.13.8a (|cFFFFCC00May 09, 2014|r|cFFFFFF00):\n\n|cFFFFFF00-|r Fixed issue with Vanguard where it wasn't showing debuffs stacks on the tanks if you are a healer os dps.\n\n|cFFFFFF00-|r Added option for put stretch button on the fullscreen strata which makes it always on top of others frames.\n\n|cFFFFFF00-|r Added background and dialog stratas.\n\n|cFFFFFF00-|r Added option for percentage: follow the combat totals or the first player total.\n\n|cFFFFFF00-|r Added option for show or hide the left buttons on menu bar.\n\n|cFFFFFF00-|r Added option for change the left buttons size in the menu bar.\n\n|cFFFFFF00-|r Added option for delete a instance.\n\n|cFFFFFF00-|r Instance Segment Mini display now is more accuracy about telling the enemy in the segment.\n\n|cFFFFFF00-|r Player Details Window now show all pet abilities instead of just the total pet damage.\n\n|cFFFFFF00-|r Rework done on report texts, now the title is more shorter and also format Dps and Hps numbers.\n\n|cFFFFFF00-|r Simple Gray and again ElvUI skins got some rework.\n\n|cFFFFFF00-|r Lib HotCorner now is data broker based and shows up all broker plugins in the bar.\n\n|cFFFFFF00v1.13.5 / v1.13.5a (|cFFFFCC00May 02, 2014|r|cFFFFFF00):|r\n\n|cFFFFFF00-|r Added keybinds to reset segments and scroll up/down.\n\n|cFFFFFF00-|r Added Spell Customization options where icon and the name of a spell can be changed.\n\n|cFFFFFF00-|r Added option to change the micro displays side, now it can be shown on the window top side.\n\n|cFFFFFF00-|r Micro Displays, also, should now give less problems and be more dynamic." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails:|r " --> color and details name @@ -129,39 +129,48 @@ if not Loc then return end --> Custom Window + Loc ["STRING_CUSTOM_EDIT"] = "Edit" Loc ["STRING_CUSTOM_REMOVE"] = "Remove" - Loc ["STRING_CUSTOM_BROADCAST"] = "Shout" + Loc ["STRING_CUSTOM_EXPORT"] = "Export" + Loc ["STRING_CUSTOM_IMPORT"] = "Import" + + --Loc ["STRING_CUSTOM_EDIT_DESC"] = "make changes on a\nalready created display" + --Loc ["STRING_CUSTOM_REMOVE_DESC"] = "removes a " + --Loc ["STRING_CUSTOM_EXPORT_DESC"] = "Select a display to edit." + --Loc ["STRING_CUSTOM_IMPORT_DESC"] = "Select a display to edit." + Loc ["STRING_CUSTOM_NAME"] = "Name:" - Loc ["STRING_CUSTOM_SPELLID"] = "Spell Id:" + Loc ["STRING_CUSTOM_AUTHOR"] = "Author:" + Loc ["STRING_CUSTOM_DESCRIPTION"] = "Desc:" + Loc ["STRING_CUSTOM_ICON"] = "Icon:" + + Loc ["STRING_CUSTOM_CREATE"] = "Create" + Loc ["STRING_CUSTOM_SAVE"] = "Save Changes" + Loc ["STRING_CUSTOM_CANCEL"] = "Cancel" + Loc ["STRING_CUSTOM_DONE"] = "Done" + Loc ["STRING_CUSTOM_SOURCE"] = "Source:" Loc ["STRING_CUSTOM_TARGET"] = "Target:" - Loc ["STRING_CUSTOM_ATTRIBUTE"] = "Attribute:" + Loc ["STRING_CUSTOM_SPELLID"] = "Spell Id:" - Loc ["STRING_CUSTOM_ATT1"] = "Damage" - Loc ["STRING_CUSTOM_ATT2"] = "Heal" - Loc ["STRING_CUSTOM_ATT3"] = "Energy" - Loc ["STRING_CUSTOM_ATT4"] = "Misc" + Loc ["STRING_CUSTOM_EDIT_SEARCH_CODE"] = "Edit Search Code" + Loc ["STRING_CUSTOM_EDIT_TOOLTIP_CODE"] = "Edit Tooltip Code" + + Loc ["STRING_CUSTOM_ATTRIBUTE_DAMAGE"] = "Damage" + Loc ["STRING_CUSTOM_ATTRIBUTE_HEAL"] = "Heal" + Loc ["STRING_CUSTOM_ATTRIBUTE_SCRIPT"] = "Custom Script" - Loc ["STRING_CUSTOM_TOOLTIPNAME"] = "Insert here the name of your custom display.\nAllow letters and numbers, minimum of 5 characters and 32 max." - Loc ["STRING_CUSTOM_TOOLTIPSPELL"] = "Select a boss ability from the menu on the right\nor type the spell name to filter." - Loc ["STRING_CUSTOM_TOOLTIPSOURCE"] = "Source is who is triggering the attribute chosen.\nIt allows (maintain the brackets):\n\n|cFF00FF00[all]|r: search for matches in all characters.\n|cFFFFFF00[raid]|r: search only in your raid or party members.\n|cFF33CCFF[player]|r: only you are checked during the search for results.\n\nAny other text is considered an spesific character." - Loc ["STRING_CUSTOM_TOOLTIPTARGET"] = "Source target." - Loc ["STRING_CUSTOM_TOOLTIPNOTWORKING"] = "Ouch, some gnome engineer touched this and broke it =(" - Loc ["STRING_CUSTOM_BROADCASTSENT"] = "Sent" Loc ["STRING_CUSTOM_CREATED"] = "The new display has been created." - Loc ["STRING_CUSTOM_ICON"] = "Icon" - Loc ["STRING_CUSTOM_CREATE"] = "Create" - Loc ["STRING_CUSTOM_INCOMBAT"] = "You are in combat." - Loc ["STRING_CUSTOM_NOATTRIBUTO"] = "No attribute has been selected." + Loc ["STRING_CUSTOM_SAVED"] = "The display has been saved." + Loc ["STRING_CUSTOM_SHORTNAME"] = "Name need at least 5 characters." Loc ["STRING_CUSTOM_LONGNAME"] = "Name too long, maximum allowed 32 characters." - Loc ["STRING_CUSTOM_NOSPELL"] = "Spell field cannot be empty." - Loc ["STRING_CUSTOM_HELP1"] = "When you mouse over the Remove button, a menu is shown asking which one of previously created customs you want to erase.\n\nThe send button shows up a menu for broadcast your custom to your raid group." - Loc ["STRING_CUSTOM_HELP2"] = "Choose here the attribute type of the spell, if your spell is a Healing spell, you may click on Heal." - Loc ["STRING_CUSTOM_HELP3"] = "Custom name will be used on Details attribute menu, and also, shown when reporting.\n\nOn spell id field, type some letters to filter spell names, you can also choose a spell from encounter menu on the right.\n\nOver source field, type where Details will serach for the spell, more info at his tooltip." - Loc ["STRING_CUSTOM_HELP4"] = "You can choose a spell from a raid encounter, mouse over this button and the options will be shown to you." - Loc ["STRING_CUSTOM_ACCETP_CUSTOM"] = "sent a custom display to you, Do you want add this to your custom library?" - + + Loc ["STRING_CUSTOM_POT_DEFAULT"] = "Potion Used" + Loc ["STRING_CUSTOM_POT_DEFAULT_DESC"] = "Show who in your raid used a potion during the encounter." + Loc ["STRING_CUSTOM_HEALTHSTONE_DEFAULT"] = "Healthstone Used" + Loc ["STRING_CUSTOM_HEALTHSTONE_DEFAULT_DESC"] = "Show who in your raid group used the healthstone." + --> Switch Window Loc ["STRING_SWITCH_CLICKME"] = "left click me" @@ -330,7 +339,7 @@ if not Loc then return end --> Details Instances Loc ["STRING_SOLO_SWITCHINCOMBAT"] = "Cannot switch while in combat" - Loc ["STRING_CUSTOM_NEW"] = "Create New" + Loc ["STRING_CUSTOM_NEW"] = "Create New Display" Loc ["STRING_CUSTOM_REPORT"] = "(custom)" Loc ["STRING_REPORT"] = "for" Loc ["STRING_REPORT_LEFTCLICK"] = "Click to open report dialog" diff --git a/locales/Details-ptBR.lua b/locales/Details-ptBR.lua index 714e1cd3..8771bc93 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"] = "|cFFFFFF00a1.16.0 - a1.16.1 - a1.16.3b (|cFFFFCC00Jun 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed row creation while resizing where sometimes it was broking the last row in the window.\n\n|cFFFFFF00-|r Fixed small involuntary resizes after resizing a window. |cFF999999(thanks @Morimvudu-Nemesis)|r\n\n|cFFFFFF00-|r Fixed frame strata after stretching the window where was setting its strata to Medium.\n\n|cFFFFFF00-|r Fixed Vanguard strata where it wasnt following the strata from its host window.\n\n|cFFFFFF00-|r Mode menu now have a sub menu for raid plugins.\n\n|cFFFFFF00-|r Red and Green colors under comparison frame has been inverted. |cFF999999(thanks @skmzarn-mmochampion forum)|r\n\n|cFFFFFF00-|r Fixed some report issues with dps and hps, also almost all reports now have guide lines. |cFF999999(thanks @sosleapy-mmochampion forum)|r\n\n|cFFFFFF00-|r Pet dispell and interrupt count also for its owner as well. |cFF999999(thanks @skmzarn-mmochampion forum)|r\n\n|cFFFFFF00-|r Few fixes on comparison panel over Player Details Window.\n\n|cFFFFFF00-|r Added option to be able to save the windows size and position within the profile. |cFF999999(thanks @Torchler-mmochampion forum)|r\n\n|cFFFFFF00-|r Added performance profile settings. |cFF999999(thanks @SlippyCheeze-mmochampion forum)|r\n\n|cFFFFFF00-|r Added auto switch based on group roles also a switch for wipe. |cFF999999(thanks @SlippyCheeze-mmochampion forum)|r\n\n|cFFFFFF00-|r Fixed a bug where sometimes all non boss segments was considered boss encounters.\n\n|cFFFFFF00v1.15.4 (|cFFFFCC00Jun 06, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added a compare tab under Player Details Window:\nThis new tab showns up when there is too characters with the same class and spec.\nIts useful to compare skills used, uptimes and targets.\n\n|cFFFFFF00-|r Few improvements on Default and ElvUI skins.\n\n|cFFFFFF00-|r Added a button for auto align two windows within right chat window when ElvUI skin is active.\n\n|cFFFFFF00-|r Fixed problem with Damage -> Enemies display.\n\n|cFFFFFF00-|r Fixed report Player Detail Window report buttons.\n\n|cFFFFFF00-|r Fixed some report lines where the numbers wasnt properly formatted.\n\n|cFFFFFF00-|r Fixed a rare bug where the owner of some pets wasnt detected.\n\n|cFFFFFF00-|r Fixed issue in dungeons where capture data get paused after a boss kill.\n\n|cFFFFFF00-|r Fixed issue with Encounter Details showing its icon for dungeons bosses.\n\n|cFFFFFF00-|r Fixed a rare bug where the capture of damage stops after erasing a trash segment.\n\n|cFFFFFF00v1.15.0 - v1.15.3 - v1.15.3b (|cFFFFCC00Jun 03, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Emergencial fix for death logs which sometimes was breaking the addon data capture.\n\n|cFFFFFF00-|r Fixed window alerts which was showing behind the bars.\n\n|cFFFFFF00-|r Fixed death log issue with friendly fire hits.\n\n|cFFFFFF00-|r Fixed a issue where Details! windows wasn't hidden when a pet battle starts.\n\n|cFFFFFF00-|r Fixed a issue with segments menu when a window is placed on the right side of the screen.\n\n|cFFFFFF00-|r Damage -> Enemies now also show neutral creatures.\n\n|cFFFFFF00-|r Added support to dungeons, bosses and trash mobs are now recognized.\n\n|cFFFFFF00-|r Added target information for each spell in Player Detail Window.\n\n|cFFFFFF00-|r Added options for change the location of tooltips.\n\n|cFFFFFF00-|r Added options for change the Overall Data functionality.\n\n|cFFFFFF00-|r Added tooltips for lock and detach buttons.\n\n|cFFFFFF00-|r Added new row texture: Details Vidro.\n\n|cFFFFFF00-|r Revamp on death log tooltips.\n\n|cFFFFFF00-|r Improved the visual effect for the instance which current moving window can snap to.\n\n|cFFFFFF00v1.14.5 - 1.14.6 (|cFFFFCC00May 24, 2014|r|cFFFFFF00):|r\n\n|cFFFFFF00-|r Added option for lock segments display, so, when a segment is chosen, the other windows also change it.\n\n|cFFFFFF00-|r Added option for show the total amount of spells, targets and pets in tooltips.\n\n|cFFFFFF00-|r Finished another revamp on options panel.\n\n|cFFFFFF00-|r Now its possible open more then 1 Raid Plugins at once on diferent windows.\n\n|cFFFFFF00-|r Added a large text editor for make changes on custom texts.\n\n|cFFFFFF00-|r Added new option for enable borders on the bars.\n\n|cFFFFFF00-|r Added Death Barrier as a absorb spell.\n\n|cFFFFFF00-|r Fixed a bug on overheal tooltip where was showing the Hps instead of overheal.\n\n|cFFFFFF00v1.14.0 - v1.14.0b (|cFFFFCC00May 17, 2014|r|cFFFFFF00):\n\n|cFFFFFF00-|r Added a new tab on options panel for tooltip configuration.\n\n|cFFFFFF00-|r Added a new tab on options panel for broker config.\n\n|cFFFFFF00-|r Added new abbreviation method called comma.\n\n|cFFFFFF00-|r All instances now have a delete button.\n\n|cFFFFFF00-|r Full re-write on the instance, delete and close buttons.\n\n|cFFFFFF00-|r HotCorners now sort icons according with most used.\n\n|cFFFFFF00-|r Few changes on all skins in order to fit on the new right menu buttons.\n\n|cFFFFFF00-|r Added Horde avatars.\n\n|cFFFFFF00-|r Fixed issue where shortcut panel shows below thw windows when its in Dialog strata.\n\n|cFFFFFF00v1.13.8 - v1.13.8a (|cFFFFCC00May 09, 2014|r|cFFFFFF00):\n\n|cFFFFFF00-|r Fixed issue with Vanguard where it wasn't showing debuffs stacks on the tanks if you are a healer os dps.\n\n|cFFFFFF00-|r Added option for put stretch button on the fullscreen strata which makes it always on top of others frames.\n\n|cFFFFFF00-|r Added background and dialog stratas.\n\n|cFFFFFF00-|r Added option for percentage: follow the combat totals or the first player total.\n\n|cFFFFFF00-|r Added option for show or hide the left buttons on menu bar.\n\n|cFFFFFF00-|r Added option for change the left buttons size in the menu bar.\n\n|cFFFFFF00-|r Added option for delete a instance.\n\n|cFFFFFF00-|r Instance Segment Mini display now is more accuracy about telling the enemy in the segment.\n\n|cFFFFFF00-|r Player Details Window now show all pet abilities instead of just the total pet damage.\n\n|cFFFFFF00-|r Rework done on report texts, now the title is more shorter and also format Dps and Hps numbers.\n\n|cFFFFFF00-|r Simple Gray and again ElvUI skins got some rework.\n\n|cFFFFFF00-|r Lib HotCorner now is data broker based and shows up all broker plugins in the bar.\n\n|cFFFFFF00v1.13.5 / v1.13.5a (|cFFFFCC00May 02, 2014|r|cFFFFFF00):|r\n\n|cFFFFFF00-|r Added keybinds to reset segments and scroll up/down.\n\n|cFFFFFF00-|r Added Spell Customization options where icon and the name of a spell can be changed.\n\n|cFFFFFF00-|r Added option to change the micro displays side, now it can be shown on the window top side.\n\n|cFFFFFF00-|r Micro Displays, also, should now give less problems and be more dynamic.\n\n|cFFFFFF00-|r Added options to change the transparency when out of combat and out of a group.\n\n|cFFFFFF00-|r Added and Still under development the panel for create data captures for charts.\n\n|cFFFFFF00-|r Fixed a issue with flat skin where the close button was just too big." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00a1.17.0 (|cFFFFCC00Jun 21, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Support for Custom Displays has been rewrited, to access the new panel go to Sword Menu -> Custom -> Create New Display.\n\n|cFFFFFF00-|r Added a custom display for show potion usage.\n\n|cFFFFFF00-|r Fixed a bug where the player pet wasnt being tracked after logon in the game. This bug was affecting directly classes with pets playing out of a raid group.\n\n|cFFFFFF00-|r Fixed the report bug on healing, energy and misc attributes |cFF999999(thanks @skmzarn-mmochampion forum)|r.\n\n|cFFFFFF00a1.16.0 - a1.16.1 - a1.16.3b (|cFFFFCC00Jun 14, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Fixed row creation while resizing where sometimes it was broking the last row in the window.\n\n|cFFFFFF00-|r Fixed small involuntary resizes after resizing a window. |cFF999999(thanks @Morimvudu-Nemesis)|r\n\n|cFFFFFF00-|r Fixed frame strata after stretching the window where was setting its strata to Medium.\n\n|cFFFFFF00-|r Fixed Vanguard strata where it wasnt following the strata from its host window.\n\n|cFFFFFF00-|r Mode menu now have a sub menu for raid plugins.\n\n|cFFFFFF00-|r Red and Green colors under comparison frame has been inverted. |cFF999999(thanks @skmzarn-mmochampion forum)|r\n\n|cFFFFFF00-|r Fixed some report issues with dps and hps, also almost all reports now have guide lines. |cFF999999(thanks @sosleapy-mmochampion forum)|r\n\n|cFFFFFF00-|r Pet dispell and interrupt count also for its owner as well. |cFF999999(thanks @skmzarn-mmochampion forum)|r\n\n|cFFFFFF00-|r Few fixes on comparison panel over Player Details Window.\n\n|cFFFFFF00-|r Added option to be able to save the windows size and position within the profile. |cFF999999(thanks @Torchler-mmochampion forum)|r\n\n|cFFFFFF00-|r Added performance profile settings. |cFF999999(thanks @SlippyCheeze-mmochampion forum)|r\n\n|cFFFFFF00-|r Added auto switch based on group roles also a switch for wipe. |cFF999999(thanks @SlippyCheeze-mmochampion forum)|r\n\n|cFFFFFF00-|r Fixed a bug where sometimes all non boss segments was considered boss encounters.\n\n|cFFFFFF00v1.15.4 (|cFFFFCC00Jun 06, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Added a compare tab under Player Details Window:\nThis new tab showns up when there is too characters with the same class and spec.\nIts useful to compare skills used, uptimes and targets.\n\n|cFFFFFF00-|r Few improvements on Default and ElvUI skins.\n\n|cFFFFFF00-|r Added a button for auto align two windows within right chat window when ElvUI skin is active.\n\n|cFFFFFF00-|r Fixed problem with Damage -> Enemies display.\n\n|cFFFFFF00-|r Fixed report Player Detail Window report buttons.\n\n|cFFFFFF00-|r Fixed some report lines where the numbers wasnt properly formatted.\n\n|cFFFFFF00-|r Fixed a rare bug where the owner of some pets wasnt detected.\n\n|cFFFFFF00-|r Fixed issue in dungeons where capture data get paused after a boss kill.\n\n|cFFFFFF00-|r Fixed issue with Encounter Details showing its icon for dungeons bosses.\n\n|cFFFFFF00-|r Fixed a rare bug where the capture of damage stops after erasing a trash segment.\n\n|cFFFFFF00v1.15.0 - v1.15.3 - v1.15.3b (|cFFFFCC00Jun 03, 2014|r|cFFFFFF00)|r:\n\n|cFFFFFF00-|r Emergencial fix for death logs which sometimes was breaking the addon data capture.\n\n|cFFFFFF00-|r Fixed window alerts which was showing behind the bars.\n\n|cFFFFFF00-|r Fixed death log issue with friendly fire hits.\n\n|cFFFFFF00-|r Fixed a issue where Details! windows wasn't hidden when a pet battle starts.\n\n|cFFFFFF00-|r Fixed a issue with segments menu when a window is placed on the right side of the screen.\n\n|cFFFFFF00-|r Damage -> Enemies now also show neutral creatures.\n\n|cFFFFFF00-|r Added support to dungeons, bosses and trash mobs are now recognized.\n\n|cFFFFFF00-|r Added target information for each spell in Player Detail Window.\n\n|cFFFFFF00-|r Added options for change the location of tooltips.\n\n|cFFFFFF00-|r Added options for change the Overall Data functionality.\n\n|cFFFFFF00-|r Added tooltips for lock and detach buttons.\n\n|cFFFFFF00-|r Added new row texture: Details Vidro.\n\n|cFFFFFF00-|r Revamp on death log tooltips.\n\n|cFFFFFF00-|r Improved the visual effect for the instance which current moving window can snap to.\n\n|cFFFFFF00v1.14.5 - 1.14.6 (|cFFFFCC00May 24, 2014|r|cFFFFFF00):|r\n\n|cFFFFFF00-|r Added option for lock segments display, so, when a segment is chosen, the other windows also change it.\n\n|cFFFFFF00-|r Added option for show the total amount of spells, targets and pets in tooltips.\n\n|cFFFFFF00-|r Finished another revamp on options panel.\n\n|cFFFFFF00-|r Now its possible open more then 1 Raid Plugins at once on diferent windows.\n\n|cFFFFFF00-|r Added a large text editor for make changes on custom texts.\n\n|cFFFFFF00-|r Added new option for enable borders on the bars.\n\n|cFFFFFF00-|r Added Death Barrier as a absorb spell.\n\n|cFFFFFF00-|r Fixed a bug on overheal tooltip where was showing the Hps instead of overheal.\n\n|cFFFFFF00v1.14.0 - v1.14.0b (|cFFFFCC00May 17, 2014|r|cFFFFFF00):\n\n|cFFFFFF00-|r Added a new tab on options panel for tooltip configuration.\n\n|cFFFFFF00-|r Added a new tab on options panel for broker config.\n\n|cFFFFFF00-|r Added new abbreviation method called comma.\n\n|cFFFFFF00-|r All instances now have a delete button.\n\n|cFFFFFF00-|r Full re-write on the instance, delete and close buttons.\n\n|cFFFFFF00-|r HotCorners now sort icons according with most used.\n\n|cFFFFFF00-|r Few changes on all skins in order to fit on the new right menu buttons.\n\n|cFFFFFF00-|r Added Horde avatars.\n\n|cFFFFFF00-|r Fixed issue where shortcut panel shows below thw windows when its in Dialog strata.\n\n|cFFFFFF00v1.13.8 - v1.13.8a (|cFFFFCC00May 09, 2014|r|cFFFFFF00):\n\n|cFFFFFF00-|r Fixed issue with Vanguard where it wasn't showing debuffs stacks on the tanks if you are a healer os dps.\n\n|cFFFFFF00-|r Added option for put stretch button on the fullscreen strata which makes it always on top of others frames.\n\n|cFFFFFF00-|r Added background and dialog stratas.\n\n|cFFFFFF00-|r Added option for percentage: follow the combat totals or the first player total.\n\n|cFFFFFF00-|r Added option for show or hide the left buttons on menu bar.\n\n|cFFFFFF00-|r Added option for change the left buttons size in the menu bar.\n\n|cFFFFFF00-|r Added option for delete a instance.\n\n|cFFFFFF00-|r Instance Segment Mini display now is more accuracy about telling the enemy in the segment.\n\n|cFFFFFF00-|r Player Details Window now show all pet abilities instead of just the total pet damage.\n\n|cFFFFFF00-|r Rework done on report texts, now the title is more shorter and also format Dps and Hps numbers.\n\n|cFFFFFF00-|r Simple Gray and again ElvUI skins got some rework.\n\n|cFFFFFF00-|r Lib HotCorner now is data broker based and shows up all broker plugins in the bar.\n\n|cFFFFFF00v1.13.5 / v1.13.5a (|cFFFFCC00May 02, 2014|r|cFFFFFF00):|r\n\n|cFFFFFF00-|r Added keybinds to reset segments and scroll up/down.\n\n|cFFFFFF00-|r Added Spell Customization options where icon and the name of a spell can be changed.\n\n|cFFFFFF00-|r Added option to change the micro displays side, now it can be shown on the window top side.\n\n|cFFFFFF00-|r Micro Displays, also, should now give less problems and be more dynamic." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetalhes:|r " --> color and details name @@ -144,6 +144,9 @@ if not Loc then return end Loc ["STRING_CUSTOM_HELP4"] = "Voce pode escolher uma magia de algum encontro de uma raide, basta deixar o ponteiro do mouse sobre o botao para que o menu seja mostrado." Loc ["STRING_CUSTOM_ACCETP_CUSTOM"] = "lhe enviou um display customizado. Voce deseja adicionar esta customizacao a sua biblioteca de displays customizados?" + Loc ["STRING_CUSTOM_POT_DEFAULT"] = "Pocao Usada" + Loc ["STRING_CUSTOM_HEALTHSTONE_DEFAULT"] = "Pedra de Vida Usada" + --> Switch Window Loc ["STRING_SWITCH_CLICKME"] = "clique-me" diff --git a/startup.lua b/startup.lua index a9ed0e55..dc81a940 100644 --- a/startup.lua +++ b/startup.lua @@ -1,5 +1,3 @@ ---no inicio da luta gravar tabela com os coolsdowns de cada jogador e ir anotando quando eles sao usados. - --File Revision: 1 --Last Modification: 27/07/2013 -- Change Log: @@ -7,51 +5,10 @@ function _G._detalhes:Start() ---teste de box ---[[ - local f = CreateFrame ("frame", "TestBoxFrame", UIParent) - f:SetPoint ("center", UIParent, "center") - f:SetSize (256, 256) - f:SetMovable (true) - - local t = f:CreateTexture (nil, "artwork") - t:SetSize (90, 90) - t:SetPoint ("topleft", f, "topleft") - t:SetTexture ("Interface\\Addons\\Details\\box") - t:SetTexCoord (0.29296875, 0.64453125, 0.265625-0.001953125, 0.6171875+0.001953125) -- 75 68 165 158 0.001953125 // - - local left = f:CreateFontString (nil, "overlay", "GameFontNormal") - local right = f:CreateFontString (nil, "overlay", "GameFontNormal") - local top = f:CreateFontString (nil, "overlay", "GameFontNormal") - local bottom = f:CreateFontString (nil, "overlay", "GameFontNormal") - - left:SetPoint ("right", t, "left", -20, 0) - right:SetPoint ("left", t, "right", 20, 0) - top:SetPoint ("bottom", t, "top", 0, 20) - bottom:SetPoint ("top", t, "bottom", 0, -20) - - function f:UpdateLeftRight() - left:SetText ("left: " .. string.format ("%.3f", t:GetLeft())) - right:SetText ("right: " .. string.format ("%.3f", t:GetRight())) - top:SetText ("top: " .. string.format ("%.3f", t:GetTop())) - bottom:SetText ("bottom: " .. string.format ("%.3f", t:GetBottom())) - end - f:UpdateLeftRight() - - f:SetScript ("OnMouseDown", function() f:StartMoving(); f:SetScript("OnUpdate", function() f:UpdateLeftRight() end) end) - f:SetScript ("OnMouseUp", function() f:StopMovingOrSizing(); f:SetScript("OnUpdate", nil); f:UpdateLeftRight() end) - - function _detalhes:updatetestbox() - f:UpdateLeftRight() - end - _detalhes:ScheduleTimer("updatetestbox", 5) - ---]] + local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> details defaults - - --> parse all config - --_detalhes:CountDataOnLoad() --> single click row function replace --damage, dps, damage taken, friendly fire @@ -64,7 +21,7 @@ function _G._detalhes:Start() self.row_singleclick_overwrite [4] = {true, true, true, true, self.atributo_misc.ReportSingleDeadLine, self.atributo_misc.ReportSingleCooldownLine, self.atributo_misc.ReportSingleBuffUptimeLine, self.atributo_misc.ReportSingleDebuffUptimeLine} self.click_to_report_color = {1, 0.8, 0, 1} - --self.click_to_report_color = {0, 1, 0, 1} + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> initialize @@ -74,60 +31,38 @@ function _G._detalhes:Start() if (self.switch.InitSwitch) then self.switch:InitSwitch() end + --> custom window self.custom = self.custom or {} - self:InitCustom() + --self:InitCustom() + --> actor info self.janela_info = self.gump:CriaJanelaInfo() self.gump:Fade (self.janela_info, 1) + --> copy and paste window self:CreateCopyPasteWindow() self.CreateCopyPasteWindow = nil - --> yesno frame - self.yesNo = self.gump:NewPanel (UIParent, _, "DetailsYesNoWindow", _, 500, 80) - self.yesNo:SetPoint ("center", UIParent, "center") - self.gump:NewLabel (self.yesNo, _, "$parentAsk", "ask", "") - self.yesNo ["ask"]:SetPoint ("center", self.yesNo, "center", 0, 25) - self.yesNo ["ask"]:SetWidth (480) - self.yesNo ["ask"]:SetJustifyH ("center") - self.yesNo ["ask"]:SetHeight (22) - local Loc = LibStub ("AceLocale-3.0"):GetLocale ("Details") - self.gump:NewButton (self.yesNo, _, "$parentNo", "no", 100, 30, function() self.yesNo:Hide() end, nil, nil, nil, Loc ["STRING_NO"]) - self.gump:NewButton (self.yesNo, _, "$parentYes", "yes", 100, 30, nil, nil, nil, nil, Loc ["STRING_YES"]) - self.yesNo ["no"]:SetPoint (10, -45) - self.yesNo ["yes"]:SetPoint (390, -45) - self.yesNo ["no"]:InstallCustomTexture() - self.yesNo ["yes"]:InstallCustomTexture() - self.yesNo ["yes"]:SetHook ("OnMouseUp", function() self.yesNo:Hide() end) - function _detalhes:Ask (msg, func, ...) - self.yesNo ["ask"].text = msg - local p1, p2 = ... - self.yesNo ["yes"]:SetClickFunction (func, p1, p2) - self.yesNo:Show() - end - self.yesNo:Hide() - + --> start instances - --_detalhes.custom = {} - --_detalhes.tabela_instancias = {} - if (self:QuantasInstancias() == 0) then self:CriarInstancia() - else - --self:ReativarInstancias() end self:GetLowerInstanceNumber() self:CheckConsolidates() --> start time machine + self.timeMachine:Ligar() --> update abbreviation shorcut + self.atributo_damage:UpdateSelectedToKFunction() self.atributo_heal:UpdateSelectedToKFunction() self.atributo_energy:UpdateSelectedToKFunction() self.atributo_misc:UpdateSelectedToKFunction() + self.atributo_custom:UpdateSelectedToKFunction() --> start instances updater @@ -187,9 +122,9 @@ function _G._detalhes:Start() end self:ScheduleTimer ("RefreshAfterStartup", 5) - --> start garbage collector + self.ultima_coleta = 0 self.intervalo_coleta = 720 --self.intervalo_coleta = 10 @@ -204,8 +139,7 @@ function _G._detalhes:Start() --> load parser capture options self:CaptureRefresh() --> register parser events - --self.listener:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") - self.parser_frame:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") + self.listener:RegisterEvent ("PLAYER_REGEN_DISABLED") self.listener:RegisterEvent ("PLAYER_REGEN_ENABLED") self.listener:RegisterEvent ("SPELL_SUMMON") @@ -224,354 +158,277 @@ function _G._detalhes:Start() self.listener:RegisterEvent ("ENCOUNTER_END") self.listener:RegisterEvent ("START_TIMER") - --self.listener:RegisterEvent ("ARENA_PREP_OPPONENT_SPECIALIZATIONS") - --self.listener:RegisterEvent ("ARENA_OPPONENT_UPDATE") - + self.listener:RegisterEvent ("UNIT_NAME_UPDATE") + self.listener:RegisterEvent ("PET_BATTLE_OPENING_START") self.listener:RegisterEvent ("PET_BATTLE_CLOSE") - - --self.listener:RegisterAllEvents() - - -- self.listener:RegisterEvent ("SPELL_CAST_START") - -- self.listener:RegisterEvent ("UNIT_SPELLCAST_STOP") - -- self.listener:RegisterEvent ("UNIT_SPELLCAST_SUCCEEDED") - -- self.listener:RegisterEvent ("UNIT_SPELLCAST_FAILED") - -- self.listener:RegisterEvent ("UNIT_SPELLCAST_FAILED_QUIET") - -- self.listener:RegisterEvent ("UNIT_SPELLCAST_INTERRUPTED") - ---------------------------------------------------------------------------------------------------------------------------------------- + + self.parser_frame:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") - function _detalhes:CooltipPreset (preset) - - local GameCooltip = GameCooltip - - GameCooltip:Reset() - - if (preset == 1) then - GameCooltip:SetOption ("TextFont", "Friz Quadrata TT") - GameCooltip:SetOption ("TextColor", "orange") - GameCooltip:SetOption ("TextSize", 12) - GameCooltip:SetOption ("ButtonsYMod", -4) - GameCooltip:SetOption ("YSpacingMod", -4) - GameCooltip:SetOption ("IgnoreButtonAutoHeight", true) - GameCooltip:SetColor (1, 0.5, 0.5, 0.5, 0.5) - - elseif (preset == 2) then - GameCooltip:SetOption ("TextFont", "Friz Quadrata TT") - GameCooltip:SetOption ("TextColor", "orange") - GameCooltip:SetOption ("TextSize", 12) - GameCooltip:SetOption ("FixedWidth", 220) - GameCooltip:SetOption ("ButtonsYMod", -4) - GameCooltip:SetOption ("YSpacingMod", -4) - GameCooltip:SetOption ("IgnoreButtonAutoHeight", true) - GameCooltip:SetColor (1, 0.5, 0.5, 0.5, 0.5) - - end - end - - --> done - self.initializing = nil - --> group - self.details_users = {} - self.in_group = IsInGroup() or IsInRaid() - + self.details_users = {} + self.in_group = IsInGroup() or IsInRaid() + + --> done + self.initializing = nil + + --> scan pets + _detalhes:SchedulePetUpdate (1) + --> send messages gathered on initialization - self:ScheduleTimer ("ShowDelayMsg", 10) + self:ScheduleTimer ("ShowDelayMsg", 10) --> send instance open signal - for index, instancia in ipairs (self.tabela_instancias) do - if (instancia.ativa) then - self:SendEvent ("DETAILS_INSTANCE_OPEN", nil, instancia) - --instancia:SetBarGrowDirection() + for index, instancia in ipairs (self.tabela_instancias) do + if (instancia.ativa) then + self:SendEvent ("DETAILS_INSTANCE_OPEN", nil, instancia) + end end - end - --> all done, send started signal and we are ready - function self:AnnounceStartup() - self:SendEvent ("DETAILS_STARTED", "SEND_TO_ALL") - end - self:ScheduleTimer ("AnnounceStartup", 5) - + --> send details startup done signal + function self:AnnounceStartup() + self:SendEvent ("DETAILS_STARTED", "SEND_TO_ALL") + end + self:ScheduleTimer ("AnnounceStartup", 5) + --> announce alpha version - function self:AnnounceVersion() - for index, instancia in ipairs (self.tabela_instancias) do - if (instancia.ativa) then - self.gump:Fade (instancia._version, "in", 0.1) + function self:AnnounceVersion() + for index, instancia in ipairs (self.tabela_instancias) do + if (instancia.ativa) then + self.gump:Fade (instancia._version, "in", 0.1) + end end end - end + + --> restore cooltip anchor position + DetailsTooltipAnchor:Restore() - --> cooltip anchor - DetailsTooltipAnchor:Restore() + --> check is this is the first run + if (self.is_first_run) then + _detalhes:OpenWelcomeWindow() + + if (#self.custom == 0) then + _detalhes:AddDefaultCustomDisplays() + end + + _detalhes:FillUserCustomSpells() + end + + --> start tutorial if this is first run + if (self.tutorial.logons < 2 and self.is_first_run) then + self:StartTutorial() + end + + --> send feedback panel if the user got 100 or more logons with details + if (self.tutorial.logons > 100) then -- and self.tutorial.logons < 104 - --[[ - 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) - instancia._version:SetText ("Details! Alpha " .. _detalhes.userversion .. " (core: " .. self.realversion .. ")") - instancia._version:SetPoint ("bottomleft", instancia.baseframe, "bottomleft", 0, 1) - self.gump:Fade (instancia._version, "in", 10) + if (not self.tutorial.feedback_window1) then + self.tutorial.feedback_window1 = true + + local feedback_frame = CreateFrame ("FRAME", "DetailsFeedbackWindow", UIParent, "ButtonFrameTemplate") + tinsert (UISpecialFrames, "DetailsFeedbackWindow") + feedback_frame:SetPoint ("center", UIParent, "center") + feedback_frame:SetSize (512, 200) + feedback_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-GNOME]]) + + feedback_frame.TitleText:SetText ("Details! Need Your Help!") + + feedback_frame.uppertext = feedback_frame:CreateFontString (nil, "artwork", "GameFontNormal") + feedback_frame.uppertext:SetText ("Tell us about your experience using Details!, what you liked most, where we could improve, what things you want to see in the future?") + feedback_frame.uppertext:SetPoint ("topleft", feedback_frame, "topleft", 60, -32) + local font, _, flags = feedback_frame.uppertext:GetFont() + feedback_frame.uppertext:SetFont (font, 10, flags) + feedback_frame.uppertext:SetTextColor (1, 1, 1, .8) + feedback_frame.uppertext:SetWidth (440) - if (instancia.auto_switch_to_old) then - instancia:SwitchBack() - end - end - end - end - --]] - - - - if (self.is_first_run) then - - _detalhes:OpenWelcomeWindow() - - if (#self.custom == 0) then - local Healthstone = { - ["attribute"] = 2, - ["spell"] = "6262", - ["name"] = "Healthstone", - ["sattribute"] = 1, - ["target"] = "", - ["source"] = "[raid]", - ["icon"] = "Interface\\Icons\\warlock_ healthstone", - } - self.custom [#self.custom+1] = Healthstone - local HealingPotion = { - ["attribute"] = 2, - ["spell"] = "105708", - ["name"] = "Healing Potion", - ["sattribute"] = 1, - ["target"] = "", - ["source"] = "[raid]", - ["icon"] = "Interface\\Icons\\trade_alchemy_potiond3", - } - self.custom [#self.custom+1] = HealingPotion - end - - _detalhes:FillUserCustomSpells() - - end - - -- _detalhes:OpenWelcomeWindow() - - --desligado por precaução - if (self.tutorial.logons < 2 and self.is_first_run) then - self:StartTutorial() - end - - --> feedback trhead - if (self.tutorial.logons > 100) then -- and self.tutorial.logons < 104 - - --desligado por preocaução - - if (not self.tutorial.feedback_window1) then - self.tutorial.feedback_window1 = true - - local feedback_frame = CreateFrame ("FRAME", "DetailsFeedbackWindow", UIParent, "ButtonFrameTemplate") - tinsert (UISpecialFrames, "DetailsFeedbackWindow") - feedback_frame:SetPoint ("center", UIParent, "center") - feedback_frame:SetSize (512, 200) - feedback_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-GNOME]]) - - feedback_frame.TitleText:SetText ("Details! Need Your Help!") - - feedback_frame.uppertext = feedback_frame:CreateFontString (nil, "artwork", "GameFontNormal") - feedback_frame.uppertext:SetText ("Tell us about your experience using Details!, what you liked most, where we could improve, what things you want to see in the future?") - feedback_frame.uppertext:SetPoint ("topleft", feedback_frame, "topleft", 60, -32) - local font, _, flags = feedback_frame.uppertext:GetFont() - feedback_frame.uppertext:SetFont (font, 10, flags) - feedback_frame.uppertext:SetTextColor (1, 1, 1, .8) - feedback_frame.uppertext:SetWidth (440) - - - local editbox = _detalhes.gump:NewTextEntry (feedback_frame, nil, "$parentTextEntry", "text", 387, 14) - editbox:SetPoint (20, -106) - editbox:SetAutoFocus (false) - editbox:SetHook ("OnEditFocusGained", function() - editbox.text = "http://www.mmo-champion.com/threads/1480721-New-damage-meter-%28Details!%29-need-help-with-tests-and-feedbacks" - editbox:HighlightText() - end) - editbox:SetHook ("OnEditFocusLost", function() - editbox.text = "http://www.mmo-champion.com/threads/1480721-New-damage-meter-%28Details!%29-need-help-with-tests-and-feedbacks" - editbox:HighlightText() - end) - editbox:SetHook ("OnChar", function() + local editbox = _detalhes.gump:NewTextEntry (feedback_frame, nil, "$parentTextEntry", "text", 387, 14) + editbox:SetPoint (20, -106) + editbox:SetAutoFocus (false) + editbox:SetHook ("OnEditFocusGained", function() + editbox.text = "http://www.mmo-champion.com/threads/1480721-New-damage-meter-%28Details!%29-need-help-with-tests-and-feedbacks" + editbox:HighlightText() + end) + editbox:SetHook ("OnEditFocusLost", function() + editbox.text = "http://www.mmo-champion.com/threads/1480721-New-damage-meter-%28Details!%29-need-help-with-tests-and-feedbacks" + editbox:HighlightText() + end) + editbox:SetHook ("OnChar", function() + editbox.text = "http://www.mmo-champion.com/threads/1480721-New-damage-meter-%28Details!%29-need-help-with-tests-and-feedbacks" + editbox:HighlightText() + end) editbox.text = "http://www.mmo-champion.com/threads/1480721-New-damage-meter-%28Details!%29-need-help-with-tests-and-feedbacks" - editbox:HighlightText() - end) - editbox.text = "http://www.mmo-champion.com/threads/1480721-New-damage-meter-%28Details!%29-need-help-with-tests-and-feedbacks" - - - feedback_frame.midtext = feedback_frame:CreateFontString (nil, "artwork", "GameFontNormal") - feedback_frame.midtext:SetText ("visit the link above and let's make Details! stronger!") - feedback_frame.midtext:SetPoint ("center", editbox.widget, "center") - feedback_frame.midtext:SetPoint ("top", editbox.widget, "bottom", 0, -2) - feedback_frame.midtext:SetJustifyH ("center") - local font, _, flags = feedback_frame.midtext:GetFont() - feedback_frame.midtext:SetFont (font, 10, flags) - --feedback_frame.midtext:SetTextColor (1, 1, 1, 1) - feedback_frame.midtext:SetWidth (440) - - - feedback_frame.gnoma = feedback_frame:CreateTexture (nil, "artwork") - feedback_frame.gnoma:SetPoint ("topright", feedback_frame, "topright", -1, -59) - feedback_frame.gnoma:SetTexture ("Interface\\AddOns\\Details\\images\\icons2") - feedback_frame.gnoma:SetSize (105*1.05, 107*1.05) - feedback_frame.gnoma:SetTexCoord (0.2021484375, 0, 0.7919921875, 1) + + + feedback_frame.midtext = feedback_frame:CreateFontString (nil, "artwork", "GameFontNormal") + feedback_frame.midtext:SetText ("visit the link above and let's make Details! stronger!") + feedback_frame.midtext:SetPoint ("center", editbox.widget, "center") + feedback_frame.midtext:SetPoint ("top", editbox.widget, "bottom", 0, -2) + feedback_frame.midtext:SetJustifyH ("center") + local font, _, flags = feedback_frame.midtext:GetFont() + feedback_frame.midtext:SetFont (font, 10, flags) + --feedback_frame.midtext:SetTextColor (1, 1, 1, 1) + feedback_frame.midtext:SetWidth (440) + + + feedback_frame.gnoma = feedback_frame:CreateTexture (nil, "artwork") + feedback_frame.gnoma:SetPoint ("topright", feedback_frame, "topright", -1, -59) + feedback_frame.gnoma:SetTexture ("Interface\\AddOns\\Details\\images\\icons2") + feedback_frame.gnoma:SetSize (105*1.05, 107*1.05) + feedback_frame.gnoma:SetTexCoord (0.2021484375, 0, 0.7919921875, 1) - feedback_frame.close = CreateFrame ("Button", "DetailsFeedbackWindowCloseButton", feedback_frame, "OptionsButtonTemplate") - feedback_frame.close:SetPoint ("bottomleft", feedback_frame, "bottomleft", 8, 4) - feedback_frame.close:SetText ("Close") - feedback_frame.close:SetScript ("OnClick", function (self) - editbox:ClearFocus() - feedback_frame:Hide() - end) + feedback_frame.close = CreateFrame ("Button", "DetailsFeedbackWindowCloseButton", feedback_frame, "OptionsButtonTemplate") + feedback_frame.close:SetPoint ("bottomleft", feedback_frame, "bottomleft", 8, 4) + feedback_frame.close:SetText ("Close") + feedback_frame.close:SetScript ("OnClick", function (self) + editbox:ClearFocus() + feedback_frame:Hide() + end) + + feedback_frame.postpone = CreateFrame ("Button", "DetailsFeedbackWindowPostPoneButton", feedback_frame, "OptionsButtonTemplate") + feedback_frame.postpone:SetPoint ("bottomright", feedback_frame, "bottomright", -10, 4) + feedback_frame.postpone:SetText ("Remind-me Later") + feedback_frame.postpone:SetScript ("OnClick", function (self) + editbox:ClearFocus() + feedback_frame:Hide() + _detalhes.tutorial.feedback_window1 = false + end) + feedback_frame.postpone:SetWidth (130) + + feedback_frame:SetScript ("OnHide", function() + editbox:ClearFocus() + end) + + --0.0009765625 512 + function _detalhes:FeedbackSetFocus() + DetailsFeedbackWindow:Show() + DetailsFeedbackWindowTextEntry.MyObject:SetFocus() + DetailsFeedbackWindowTextEntry.MyObject:HighlightText() + end + _detalhes:ScheduleTimer ("FeedbackSetFocus", 5) - feedback_frame.postpone = CreateFrame ("Button", "DetailsFeedbackWindowPostPoneButton", feedback_frame, "OptionsButtonTemplate") - feedback_frame.postpone:SetPoint ("bottomright", feedback_frame, "bottomright", -10, 4) - feedback_frame.postpone:SetText ("Remind-me Later") - feedback_frame.postpone:SetScript ("OnClick", function (self) - editbox:ClearFocus() - feedback_frame:Hide() - _detalhes.tutorial.feedback_window1 = false - end) - feedback_frame.postpone:SetWidth (130) - - feedback_frame:SetScript ("OnHide", function() - editbox:ClearFocus() - end) - - --0.0009765625 512 - function _detalhes:FeedbackSetFocus() - DetailsFeedbackWindow:Show() - DetailsFeedbackWindowTextEntry.MyObject:SetFocus() - DetailsFeedbackWindowTextEntry.MyObject:HighlightText() end - _detalhes:ScheduleTimer ("FeedbackSetFocus", 5) - + end + + --> check is this is the first run of this version + if (self.is_version_first_run) then - end - - if (self.is_version_first_run) then - - local enable_reset_warning = true - - local lower_instance = _detalhes:GetLowerInstanceNumber() - if (lower_instance) then - lower_instance = _detalhes:GetInstance (lower_instance) + local enable_reset_warning = true + + local lower_instance = _detalhes:GetLowerInstanceNumber() if (lower_instance) then - lower_instance:InstanceAlert (Loc ["STRING_VERSION_UPDATE"], {[[Interface\GossipFrame\AvailableQuestIcon]], 16, 16, false}, 60, {_detalhes.OpenNewsWindow}) + lower_instance = _detalhes:GetInstance (lower_instance) + if (lower_instance) then + lower_instance:InstanceAlert (Loc ["STRING_VERSION_UPDATE"], {[[Interface\GossipFrame\AvailableQuestIcon]], 16, 16, false}, 60, {_detalhes.OpenNewsWindow}) + end end - end - - _detalhes:FillUserCustomSpells() - - if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < 18 and enable_reset_warning) then - --print ("Last Version:", _detalhes_database.last_version, "Last Interval Version:", _detalhes_database.last_realversion) + _detalhes:FillUserCustomSpells() + + if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < 20 and enable_reset_warning) then + table.wipe (self.custom) + _detalhes:AddDefaultCustomDisplays() + end + + if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < 18 and enable_reset_warning) then + + --print ("Last Version:", _detalhes_database.last_version, "Last Interval Version:", _detalhes_database.last_realversion) - local resetwarning_frame = CreateFrame ("FRAME", "DetailsResetConfigWarningDialog", UIParent, "ButtonFrameTemplate") - resetwarning_frame:SetFrameStrata ("LOW") - tinsert (UISpecialFrames, "DetailsResetConfigWarningDialog") - resetwarning_frame:SetPoint ("center", UIParent, "center") - resetwarning_frame:SetSize (512, 200) - resetwarning_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-GNOME]]) - resetwarning_frame:SetScript ("OnHide", function() - DetailsBubble:HideBubble() - end) - - resetwarning_frame.TitleText:SetText ("Noooooooooooo!!!") + local resetwarning_frame = CreateFrame ("FRAME", "DetailsResetConfigWarningDialog", UIParent, "ButtonFrameTemplate") + resetwarning_frame:SetFrameStrata ("LOW") + tinsert (UISpecialFrames, "DetailsResetConfigWarningDialog") + resetwarning_frame:SetPoint ("center", UIParent, "center") + resetwarning_frame:SetSize (512, 200) + resetwarning_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-GNOME]]) + resetwarning_frame:SetScript ("OnHide", function() + DetailsBubble:HideBubble() + end) + + resetwarning_frame.TitleText:SetText ("Noooooooooooo!!!") - resetwarning_frame.midtext = resetwarning_frame:CreateFontString (nil, "artwork", "GameFontNormal") - resetwarning_frame.midtext:SetText ("A pack of murlocs has attacked Details! tech center, our gnomes engineers are working on fixing the damage.\n\n If something is messed in your Details!, especially the close, instance and reset buttons, you can either 'Reset Skin' or access the options panel.") - resetwarning_frame.midtext:SetPoint ("topleft", resetwarning_frame, "topleft", 10, -90) - resetwarning_frame.midtext:SetJustifyH ("center") - resetwarning_frame.midtext:SetWidth (370) + resetwarning_frame.midtext = resetwarning_frame:CreateFontString (nil, "artwork", "GameFontNormal") + resetwarning_frame.midtext:SetText ("A pack of murlocs has attacked Details! tech center, our gnomes engineers are working on fixing the damage.\n\n If something is messed in your Details!, especially the close, instance and reset buttons, you can either 'Reset Skin' or access the options panel.") + resetwarning_frame.midtext:SetPoint ("topleft", resetwarning_frame, "topleft", 10, -90) + resetwarning_frame.midtext:SetJustifyH ("center") + resetwarning_frame.midtext:SetWidth (370) + + resetwarning_frame.gnoma = resetwarning_frame:CreateTexture (nil, "artwork") + resetwarning_frame.gnoma:SetPoint ("topright", resetwarning_frame, "topright", -3, -80) + resetwarning_frame.gnoma:SetTexture ("Interface\\AddOns\\Details\\images\\icons2") + resetwarning_frame.gnoma:SetSize (89*1.00, 97*1.00) + --resetwarning_frame.gnoma:SetTexCoord (0.212890625, 0.494140625, 0.798828125, 0.99609375) -- 109 409 253 510 + resetwarning_frame.gnoma:SetTexCoord (0.17578125, 0.001953125, 0.59765625, 0.787109375) -- 1 306 90 403 + + resetwarning_frame.close = CreateFrame ("Button", "DetailsFeedbackWindowCloseButton", resetwarning_frame, "OptionsButtonTemplate") + resetwarning_frame.close:SetPoint ("bottomleft", resetwarning_frame, "bottomleft", 8, 4) + resetwarning_frame.close:SetText ("Close") + resetwarning_frame.close:SetScript ("OnClick", function (self) + resetwarning_frame:Hide() + end) - resetwarning_frame.gnoma = resetwarning_frame:CreateTexture (nil, "artwork") - resetwarning_frame.gnoma:SetPoint ("topright", resetwarning_frame, "topright", -3, -80) - resetwarning_frame.gnoma:SetTexture ("Interface\\AddOns\\Details\\images\\icons2") - resetwarning_frame.gnoma:SetSize (89*1.00, 97*1.00) - --resetwarning_frame.gnoma:SetTexCoord (0.212890625, 0.494140625, 0.798828125, 0.99609375) -- 109 409 253 510 - resetwarning_frame.gnoma:SetTexCoord (0.17578125, 0.001953125, 0.59765625, 0.787109375) -- 1 306 90 403 - - resetwarning_frame.close = CreateFrame ("Button", "DetailsFeedbackWindowCloseButton", resetwarning_frame, "OptionsButtonTemplate") - resetwarning_frame.close:SetPoint ("bottomleft", resetwarning_frame, "bottomleft", 8, 4) - resetwarning_frame.close:SetText ("Close") - resetwarning_frame.close:SetScript ("OnClick", function (self) - resetwarning_frame:Hide() - end) - - resetwarning_frame.see_updates = CreateFrame ("Button", "DetailsResetWindowSeeUpdatesButton", resetwarning_frame, "OptionsButtonTemplate") - resetwarning_frame.see_updates:SetPoint ("bottomright", resetwarning_frame, "bottomright", -10, 4) - resetwarning_frame.see_updates:SetText ("Update Info") - resetwarning_frame.see_updates:SetScript ("OnClick", function (self) - _detalhes.OpenNewsWindow() - DetailsBubble:HideBubble() - --resetwarning_frame:Hide() - end) - resetwarning_frame.see_updates:SetWidth (130) - - resetwarning_frame.reset_skin = CreateFrame ("Button", "DetailsResetWindowResetSkinButton", resetwarning_frame, "OptionsButtonTemplate") - resetwarning_frame.reset_skin:SetPoint ("right", resetwarning_frame.see_updates, "left", -5, 0) - resetwarning_frame.reset_skin:SetText ("Reset Skin") - resetwarning_frame.reset_skin:SetScript ("OnClick", function (self) - --do the reset - for index, instance in ipairs (_detalhes.tabela_instancias) do - if (not instance.iniciada) then - instance:RestauraJanela() - local skin = instance.skin - instance:ChangeSkin ("Default Skin") - instance:ChangeSkin ("Minimalistic") - instance:ChangeSkin (skin) - instance:DesativarInstancia() - else - local skin = instance.skin - instance:ChangeSkin ("Default Skin") - instance:ChangeSkin ("Minimalistic") - instance:ChangeSkin (skin) + resetwarning_frame.see_updates = CreateFrame ("Button", "DetailsResetWindowSeeUpdatesButton", resetwarning_frame, "OptionsButtonTemplate") + resetwarning_frame.see_updates:SetPoint ("bottomright", resetwarning_frame, "bottomright", -10, 4) + resetwarning_frame.see_updates:SetText ("Update Info") + resetwarning_frame.see_updates:SetScript ("OnClick", function (self) + _detalhes.OpenNewsWindow() + DetailsBubble:HideBubble() + --resetwarning_frame:Hide() + end) + resetwarning_frame.see_updates:SetWidth (130) + + resetwarning_frame.reset_skin = CreateFrame ("Button", "DetailsResetWindowResetSkinButton", resetwarning_frame, "OptionsButtonTemplate") + resetwarning_frame.reset_skin:SetPoint ("right", resetwarning_frame.see_updates, "left", -5, 0) + resetwarning_frame.reset_skin:SetText ("Reset Skin") + resetwarning_frame.reset_skin:SetScript ("OnClick", function (self) + --do the reset + for index, instance in ipairs (_detalhes.tabela_instancias) do + if (not instance.iniciada) then + instance:RestauraJanela() + local skin = instance.skin + instance:ChangeSkin ("Default Skin") + instance:ChangeSkin ("Minimalistic") + instance:ChangeSkin (skin) + instance:DesativarInstancia() + else + local skin = instance.skin + instance:ChangeSkin ("Default Skin") + instance:ChangeSkin ("Minimalistic") + instance:ChangeSkin (skin) + end end - end - end) - resetwarning_frame.reset_skin:SetWidth (130) + end) + resetwarning_frame.reset_skin:SetWidth (130) + + resetwarning_frame.open_options = CreateFrame ("Button", "DetailsResetWindowOpenOptionsButton", resetwarning_frame, "OptionsButtonTemplate") + resetwarning_frame.open_options:SetPoint ("right", resetwarning_frame.reset_skin, "left", -5, 0) + resetwarning_frame.open_options:SetText ("Options Panel") + resetwarning_frame.open_options:SetScript ("OnClick", function (self) + local lower_instance = _detalhes:GetLowerInstanceNumber() + 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) + resetwarning_frame.open_options:SetWidth (130) - resetwarning_frame.open_options = CreateFrame ("Button", "DetailsResetWindowOpenOptionsButton", resetwarning_frame, "OptionsButtonTemplate") - resetwarning_frame.open_options:SetPoint ("right", resetwarning_frame.reset_skin, "left", -5, 0) - resetwarning_frame.open_options:SetText ("Options Panel") - resetwarning_frame.open_options:SetScript ("OnClick", function (self) - local lower_instance = _detalhes:GetLowerInstanceNumber() - if (not lower_instance) then - local instance = _detalhes:GetInstance (1) - _detalhes.CriarInstancia (_, _, 1) - _detalhes:OpenOptionsWindow (instance) - else - _detalhes:OpenOptionsWindow (_detalhes:GetInstance (lower_instance)) + function _detalhes:ResetWarningDialog() + DetailsResetConfigWarningDialog:Show() + DetailsBubble:SetOwner (resetwarning_frame.gnoma, "bottomright", "topleft", 30, -37, 1) + DetailsBubble:FlipHorizontal() + DetailsBubble:SetBubbleText ("", "", "WWHYYYYYYYYY!!!!", "", "") + DetailsBubble:TextConfig (14, nil, "deeppink") + DetailsBubble:ShowBubble() + + end - end) - resetwarning_frame.open_options:SetWidth (130) - - function _detalhes:ResetWarningDialog() - DetailsResetConfigWarningDialog:Show() - DetailsBubble:SetOwner (resetwarning_frame.gnoma, "bottomright", "topleft", 30, -37, 1) - DetailsBubble:FlipHorizontal() - DetailsBubble:SetBubbleText ("", "", "WWHYYYYYYYYY!!!!", "", "") - DetailsBubble:TextConfig (14, nil, "deeppink") - DetailsBubble:ShowBubble() - - + _detalhes:ScheduleTimer ("ResetWarningDialog", 7) + end - _detalhes:ScheduleTimer ("ResetWarningDialog", 7) - end - end --> interface menu local f = CreateFrame ("frame", "DetailsInterfaceOptionsPanel", UIParent) @@ -1053,6 +910,7 @@ function _G._detalhes:Start() --_detalhes:OpenWelcomeWindow() --for debug end _detalhes:ScheduleTimer ("OpenOptionsWindowAtStart", 2) + --_detalhes:OpenCustomDisplayWindow() --BNSendFriendInvite ("tercio#1488")