- Removed Lib HotCorners.

- Rewrite on profile -> skins bridge, now skins are only stored inside the profile.
- Fixed issue with healing done player details which wans't showing pets.
- Fixed unknown owner pet summon.

- New API: _detalhes:ListInstances() return ipairs of current created instances.
- New API: instance:GetPosition() return a table with .normal and .solo with .x and .y axis.
- New API: instance:GetDisplay() return attribute, sub attribute shown in the instance.
- New API: _detalhes.table.copy (t1, t2) copy values from table 't2' to 't1'.
This commit is contained in:
tercio
2014-08-07 22:34:29 -03:00
parent 4eedec39de
commit 3c3d840b65
18 changed files with 794 additions and 764 deletions
-412
View File
@@ -1,412 +0,0 @@
local major, minor = "LibHotCorners", 6
local LibHotCorners, oldminor = LibStub:NewLibrary (major, minor)
if (not LibHotCorners) then
return
end
local LBD = LibStub ("LibDataBroker-1.1")
local debug = false
local tinsert = tinsert
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> main function
LibHotCorners.embeds = LibHotCorners.embeds or {}
local embed_functions = {
"RegisterHotCornerButton",
"HideHotCornerButton",
"QuickHotCornerEnable"
}
function LibHotCorners:Embed (target)
for k, v in pairs (embed_functions) do
target[v] = self[v]
end
self.embeds [target] = true
return target
end
local CallbackHandler = LibStub:GetLibrary ("CallbackHandler-1.0")
LibHotCorners.callbacks = LibHotCorners.callbacks or CallbackHandler:New (LibHotCorners)
LibHotCorners.topleft = LibHotCorners.topleft or {widgets = {}, quickclick = false, is_enabled = false, map = {}}
LibHotCorners.bottomleft = {}
LibHotCorners.topright = {}
LibHotCorners.bottomright = {}
local function test (corner)
assert (corner == "topleft" or corner == "bottomleft" or corner == "topright" or corner == "bottomright", "LibHotCorners:RegisterAddon expects a corner on #1 argument.")
end
function LibHotCorners:RegisterHotCornerButton (name, corner, savedtable, fname, icon, tooltip, clickfunc, menus, quickfunc, onenter, onleave)
corner = string.lower (corner)
test (corner)
if (savedtable and not LibHotCorners.options) then
if (not savedtable.__cachedoptions) then
savedtable.__cachedoptions = {age = 0, clicks = {}, disabled = {}, is_enabled = true}
end
LibHotCorners.options = savedtable.__cachedoptions
LibHotCorners.options.age = LibHotCorners.options.age + 1
--> version 6
if (type (LibHotCorners.options.is_enabled) ~= "boolean") then
LibHotCorners.options.is_enabled = true
end
elseif (savedtable) then
if (LibHotCorners.options.age < savedtable.__cachedoptions.age) then
LibHotCorners.options = savedtable.__cachedoptions
LibHotCorners.options.age = LibHotCorners.options.age + 1
end
--> version 6
if (type (LibHotCorners.options.is_enabled) ~= "boolean") then
LibHotCorners.options.is_enabled = true
end
end
savedtable = savedtable or {}
tinsert (LibHotCorners [corner], {name = name, fname = fname, savedtable = savedtable, icon = icon, tooltip = tooltip, click = clickfunc, menus = menus, quickfunc = quickfunc, onenter = onenter, onleave = onleave})
LibHotCorners [corner].map [name] = #LibHotCorners [corner]
if (not savedtable.hide) then
LibHotCorners [corner].is_enabled = true
end
if (quickfunc and savedtable [corner .. "_quickclick"]) then
LibHotCorners [corner].quickfunc = quickfunc
end
return LibHotCorners [corner].map [name]
end
function LibHotCorners:QuickHotCornerEnable (name, corner, value)
corner = string.lower (corner)
test (corner)
local corner_table = LibHotCorners [corner]
local addon_table = corner_table [corner_table.map [name]]
addon_table.savedtable [corner .. "_quickclick"] = value
if (value and addon_table.quickfunc) then
corner_table.quickfunc = addon_table.quickfunc
else
local got = false
for index, button_table in ipairs (corner_table) do
if (button_table.savedtable.quickclick) then
corner_table.quickfunc = button_table.quickfunc
got = true
break
end
end
if (not got) then
corner_table.quickfunc = nil
end
end
end
function LibHotCorners:HideHotCornerButton (name, corner, value)
corner = string.lower (corner)
test (corner)
local corner_table = LibHotCorners [corner]
local addon_table = corner_table [corner_table.map [name]]
addon_table.savedtable.hide = value
--print (LibHotCorners, corner)
LibHotCorners [corner].is_enabled = false
for index, button_table in ipairs (corner_table) do
if (not button_table.savedtable.hide) then
LibHotCorners [corner].is_enabled = true
break
end
end
return true
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> data broker stuff
function LibHotCorners:DataBrokerCallback (event, name, dataobj)
if (not name or not dataobj or not dataobj.type) then
return
end
if (dataobj.icon and dataobj.OnClick and not dataobj.HotCornerIgnore) then
LibHotCorners:RegisterHotCornerButton (name, "TopLeft", nil, name .. "HotCornerLauncher", dataobj.icon, dataobj.OnTooltipShow, dataobj.OnClick, nil, nil, dataobj.OnEnter, dataobj.OnLeave)
end
end
LBD.RegisterCallback (LibHotCorners, "DataBrokerCallback")
local f = CreateFrame ("frame")
f:RegisterEvent ("PLAYER_LOGIN")
f:SetScript ("OnEvent", function()
SLASH_HOTCORNER1, SLASH_HOTCORNER2 = "/hotcorners", "/hotcorner"
function SlashCmdList.HOTCORNER (msg, editbox)
HotCornersOpenOptions (self);
end
for name, dataobj in LBD:DataObjectIterator() do
if (dataobj.type and dataobj.icon and dataobj.OnClick and not dataobj.HotCornerIgnore) then
LibHotCorners:RegisterHotCornerButton (name, "TopLeft", nil, name .. "HotCornerLauncher", dataobj.icon, dataobj.OnTooltipShow, dataobj.OnClick, nil, nil, dataobj.OnEnter, dataobj.OnLeave)
end
end
for k, v in pairs (LBD.attributestorage) do
--print (k, v)
--print ("----------------")
--vardump (v)
end
f:UnregisterEvent ("PLAYER_LOGIN")
end)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> scripts
--> background (window mode fix)
function HotCornersBackgroundOnEnter (self)
if (LibHotCornersTopLeft and LibHotCornersTopLeft:IsShown()) then
if (LibHotCornersTopLeft:GetWidth() > 2) then
HotCornersOnLeave (LibHotCornersTopLeft)
end
end
self:EnableMouse (false)
end
--> set size
local function set_size (self)
if (self.position == "topleft" or self.position == "topright") then
self:SetSize (40, GetScreenHeight())
else
self:SetSize (GetScreenWidth(), 40)
end
end
--> show tooltip
local show_tooltip = function (self)
if (self.table.tooltip) then
if (type (self.table.tooltip) == "function") then
GameTooltip:SetOwner (self, "ANCHOR_RIGHT")
self.table.tooltip (GameTooltip)
GameTooltip:Show()
elseif (type (self.table.tooltip) == "string") then
GameTooltip:SetOwner (self, "ANCHOR_RIGHT")
GameTooltip:AddLine (self.table.tooltip)
GameTooltip:Show()
end
elseif (self.table.onenter) then
self.table.onenter (self)
end
end
--> corner frame on enter
local more_clicked = function (t1, t2)
return t1[1] > t2[1]
end
function HotCornersOnEnter (self)
if (not LibHotCorners.options.is_enabled) then
return
end
if (not LibHotCorners [self.position].is_enabled) then
return
end
set_size (self)
HotCornersBackgroundFrame:EnableMouse (true)
local i = 1
local sort = {}
for index, button_table in ipairs (LibHotCorners [self.position]) do
tinsert (sort, {LibHotCorners.options.clicks [button_table.name] or 0, button_table})
end
table.sort (sort, more_clicked)
local last_button
for index, button_table in ipairs (sort) do
button_table = button_table [2]
if (not button_table.widget) then
LibHotCorners:CreateAddonWidget (self, button_table, index, self.position)
end
button_table.widget:ClearAllPoints()
if (not button_table.savedtable.hide) then
if (self.position == "topleft" or self.position == "topright") then
local y = i * 35 * -1
button_table.widget:SetPoint ("topleft", self, "topleft", 4, y)
button_table.widget.y = y
else
local x = i * 35
button_table.widget:SetPoint ("topleft", self, "topleft", x, -4)
button_table.widget.x = x
end
button_table.widget:Show()
last_button = button_table.widget
i = i + 1
else
button_table.widget:Hide()
end
end
local OptionsButton = LibHotCorners [self.position].optionsbutton
local y = i * 35 * -1
OptionsButton:SetPoint ("top", self, "top", 0, y)
OptionsButton:Show()
end
--> corner frame on leave
function HotCornersOnLeave (self)
self:SetSize (1, 1)
for index, button_table in ipairs (LibHotCorners [self.position]) do
button_table.widget:Hide()
end
local OptionsButton = LibHotCorners [self.position].optionsbutton
OptionsButton:Hide()
end
--> quick corner on click
function HotCornersOnQuickClick (self, button)
local parent_position = self:GetParent().position
if (LibHotCorners [parent_position].quickfunc) then
LibHotCorners [parent_position].quickfunc (self, button)
end
end
--> options button onenter
function HotCornersOptionsButtonOnEnter (self)
set_size (self:GetParent())
for index, button_table in ipairs (LibHotCorners [self:GetParent().position]) do
if (not button_table.savedtable.hide) then
button_table.widget:Show()
end
end
self:Show()
end
function HotCornersOpenOptions (self)
HotCornersOptionsFrame:Show()
HotCornersOptionsFrameEnableCheckBox:SetChecked (LibHotCorners.options.is_enabled)
end
function HotCornersSetEnabled (state)
LibHotCorners.options.is_enabled = state
end
--> options button onleave
function HotCornersOptionsButtonOnLeave (self)
self:GetParent():GetScript("OnLeave")(self:GetParent())
end
--> button onenter
function HotCornersButtonOnEnter (self)
set_size (self:GetParent())
for index, button_table in ipairs (LibHotCorners [self:GetParent().position]) do
if (not button_table.savedtable.hide) then
button_table.widget:Show()
end
end
show_tooltip (self)
local OptionsButton = LibHotCorners [self:GetParent().position].optionsbutton
OptionsButton:Show()
end
--> button onleave
function HotCornersButtonOnLeave (self)
GameTooltip:Hide()
if (self.table.onleave) then
self.table.onleave (self)
end
self:GetParent():GetScript("OnLeave")(self:GetParent())
local OptionsButton = LibHotCorners [self:GetParent().position].optionsbutton
OptionsButton:Hide()
end
--> button onmousedown
function HotCornersButtonOnMouseDown (self, button)
if (self:GetParent().position == "topleft" or self:GetParent().position == "topright") then
self:SetPoint ("topleft", self:GetParent(), "topleft", 5, self.y - 1)
else
self:SetPoint ("topleft", self:GetParent(), "topleft", self.x+1, -6)
end
end
--> button onmouseup
function HotCornersButtonOnMouseUp (self, button)
if (self:GetParent().position == "topleft" or self:GetParent().position == "topright") then
self:SetPoint ("topleft", self:GetParent(), "topleft", 4, self.y)
else
self:SetPoint ("topleft", self:GetParent(), "topleft", self.x, -4)
end
if (self.table.click) then
LibHotCorners.options.clicks [self.table.name] = LibHotCorners.options.clicks [self.table.name] or 0
LibHotCorners.options.clicks [self.table.name] = LibHotCorners.options.clicks [self.table.name] + 1
self.table.click (self, button)
end
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> create top left corner
local TopLeftCorner = CreateFrame ("Frame", "LibHotCornersTopLeft", nil, "HotCornersFrameCornerTemplate")
TopLeftCorner:SetPoint ("topleft", UIParent, "topleft", 0, 0)
TopLeftCorner.position = "topleft"
--fast corner button
local QuickClickButton = CreateFrame ("button", "LibHotCornersTopLeftFastButton", TopLeftCorner, "HotCornersQuickCornerButtonTemplate")
--options button
local OptionsButton = CreateFrame ("button", "LibHotCornersTopLeftOptionsButton", TopLeftCorner, "HotCornersOptionsButtonTemplate")
if (debug) then
QuickClickButton:SetSize (20, 20)
QuickClickButton:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Gold-Background]], tile = true, tileSize = 40})
QuickClickButton:SetBackdropColor (1, 0, 0, 1)
end
LibHotCorners.topleft.quickbutton = QuickClickButton
LibHotCorners.topleft.optionsbutton = OptionsButton
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> buttons
function LibHotCorners:CreateAddonWidget (frame, button_table, index, side)
--> create the button
local button = CreateFrame ("button", "LibHotCorners" .. side .. button_table.fname, frame, "HotCornersButtonTemplate")
--> write some attributes
button.index = index
button.table = button_table
button.parent = frame
button_table.widget = button
--> set the icon
button:SetNormalTexture (button_table.icon)
button:SetHighlightTexture (button_table.icon)
if (string.lower (button_table.icon):find ([[\icons\]])) then
button:GetNormalTexture():SetTexCoord (0.078125, 0.9375, 0.078125, 0.9375)
button:GetHighlightTexture():SetTexCoord (0.078125, 0.9375, 0.078125, 0.9375)
end
return button
end
-164
View File
@@ -1,164 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
<Frame name="HotCornersBackgroundFrame" frameStrata="MEDIUM" parent="UIParent">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT" x="0" y="0"/>
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT" x="0" y="0"/>
</Anchors>
<Scripts>
<OnLoad>
self:EnableMouse (false);
</OnLoad>
<OnEnter>
HotCornersBackgroundOnEnter (self);
</OnEnter>
</Scripts>
</Frame>
<Frame name="HotCornersFrameCornerTemplate" frameStrata="FULLSCREEN" virtual="true" parent="UIParent">
<Size x="1" y="1"/>
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" tile="true">
<TileSize>
<AbsValue val="40"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="0" right="0" top="0" bottom="0"/>
</BackgroundInsets>
</Backdrop>
<Scripts>
<OnEnter>
HotCornersOnEnter (self);
</OnEnter>
<OnLeave>
HotCornersOnLeave (self);
</OnLeave>
</Scripts>
</Frame>
<Frame name="HotCornersQuickCornerButtonTemplate" frameStrata="FULLSCREEN" virtual="true">
<Size x="1" y="1"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT" x="0" y="0"/>
</Anchors>
<Scripts>
<OnLoad>
self:SetFrameLevel (self:GetParent():GetFrameLevel()+2);
</OnLoad>
<OnClick>
HotCornersOnQuickClick (self, button);
</OnClick>
<OnEnter>
HotCornersOnEnter (self:GetParent());
</OnEnter>
</Scripts>
</Frame>
<Frame name="HotCornersButtonTemplate" frameStrata="FULLSCREEN" hidden="true" virtual="true">
<Size x="32" y="32"/>
<Scripts>
<OnLoad>
self:SetFrameLevel (self:GetParent():GetFrameLevel()+2);
</OnLoad>
<OnEnter>
HotCornersButtonOnEnter (self);
</OnEnter>
<OnLeave>
HotCornersButtonOnLeave (self);
</OnLeave>
<OnMouseDown>
HotCornersButtonOnMouseDown (self, button);
</OnMouseDown>
<OnMouseUp>
HotCornersButtonOnMouseUp (self, button);
</OnMouseUp>
</Scripts>
</Frame>
<Button name="HotCornersOptionsButtonTemplate" frameStrata="FULLSCREEN" hidden="false" virtual="true">
<Size x="32" y="32"/>
<Layers>
<Layer level="OVERLAY">
<FontString text="options" name="$parentText" inherits="GameFontHighlightSmall" justifyH="LEFT" nonspacewrap="true" parentKey="text">
<Anchors>
<Anchor point="CENTER" relativeTo="$parent" relativePoint="CENTER"/>
</Anchors>
<Color r="0.8" g="0.8" b="0.8" a="0.8"/>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
self:SetFrameLevel (self:GetParent():GetFrameLevel()+2);
</OnLoad>
<OnEnter>
HotCornersOptionsButtonOnEnter (self);
self.text:SetTextColor (1, 1, 1, 1);
</OnEnter>
<OnLeave>
HotCornersOptionsButtonOnLeave (self);
self.text:SetTextColor (0.8, 0.8, 0.8, 0.8);
</OnLeave>
<OnMouseDown>
self.text:SetPoint ("center", self, "center", 1, -1);
</OnMouseDown>
<OnMouseUp>
self.text:SetPoint ("center", self, "center");
HotCornersOpenOptions (self:GetParent());
</OnMouseUp>
</Scripts>
</Button>
<Frame name="HotCornersOptionsFrame" frameStrata="HIGH" movable="true" hidden="true" parent="UIParent" inherits="ButtonFrameTemplate">
<Size>
<AbsDimension x="400" y="200"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="$parent" relativePoint="CENTER" x="0" y="0"/>
</Anchors>
<Frames>
<CheckButton name="$parentEnableCheckBox" inherits="ChatConfigCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT" x="30" y="-70"/>
</Anchors>
<Scripts>
<OnLoad>
_G [self:GetName() .. "Text"]:SetText ("Enabled");
self.tooltip = "Enable or Disable HorCorners";
tinsert (UISpecialFrames, "HotCornersOptionsFrame");
</OnLoad>
<PostClick>
if (self:GetChecked()) then
HotCornersSetEnabled (true);
else
HotCornersSetEnabled (false);
end
</PostClick>
</Scripts>
</CheckButton>
</Frames>
<Scripts>
<OnLoad>
self.TitleText:SetText ("HotCorners Options");
self.portrait:SetTexture ([[Interface\FriendsFrame\FriendsFrameScrollIcon]]);
</OnLoad>
<OnMouseDown>
self:StartMoving();
</OnMouseDown>
<OnMouseUp>
self:StopMovingOrSizing();
</OnMouseUp>
</Scripts>
</Frame>
<Script file="LibHotCorners.lua"/>
</Ui>
-1
View File
@@ -11,7 +11,6 @@
<Include file="NickTag-1.0\NickTag-1.0.xml" />
<Script file="LibDataBroker-1.1\LibDataBroker-1.1.lua"/>
<Script file="LibDBIcon-1.0\LibDBIcon-1.0.lua"/>
<Include file="LibHotCorners\LibHotCorners.xml" />
<Script file="LibGraph-2.0\LibGraph-2.0.lua"/>
<Include file="LibCompress\lib.xml"/>
</Ui>
+12 -6
View File
File diff suppressed because one or more lines are too long
+67 -25
View File
@@ -1530,7 +1530,23 @@ function atributo_heal:MontaInfoHealingDone()
_table_insert (minhas_curas, {spellid, tabela.total, tabela.total/total*100, nome, icone})
end
_table_sort (minhas_curas, function(a, b) return a[2] > b[2] end)
--> add pets
local ActorPets = self.pets
--local class_color = RAID_CLASS_COLORS [self.classe] and RAID_CLASS_COLORS [self.classe].colorStr
local class_color = "FFDDDDDD"
for _, PetName in _ipairs (ActorPets) do
local PetActor = instancia.showing (class_type, PetName)
if (PetActor) then
local PetSkillsContainer = PetActor.spell_tables._ActorTable
for _spellid, _skill in _pairs (PetSkillsContainer) do --> da foreach em cada spellid do container
local nome, _, icone = _GetSpellInfo (_spellid)
_table_insert (minhas_curas, {_spellid, _skill.total, _skill.total/total*100, nome .. " (|c" .. class_color .. PetName:gsub ((" <.*"), "") .. "|r)", icone, PetActor})
end
--_table_insert (ActorSkillsSortTable, {PetName, PetActor.total, PetActor.total/ActorTotalDamage*100, PetName:gsub ((" <.*"), ""), "Interface\\AddOns\\Details\\images\\classes_small"})
end
end
_table_sort (minhas_curas, _detalhes.Sort2)
local amt = #minhas_curas
gump:JI_AtualizaContainerBarras (amt)
@@ -1549,6 +1565,8 @@ function atributo_heal:MontaInfoHealingDone()
self:FocusLock (barra, tabela[1])
barra.other_actor = tabela [6]
if (info.sub_atributo == 2) then
self:UpdadeInfoBar (barra, index, tabela[1], tabela[4], tabela[2], _detalhes:comma_value (_math_floor (tabela[2]/meu_tempo)), max_, tabela[3], tabela[5], true)
else
@@ -1565,7 +1583,7 @@ function atributo_heal:MontaInfoHealingDone()
end
end
--> SERIA TOP CURADOS
--> TOP CURADOS
local meus_inimigos = {}
tabela = self.targets._ActorTable
for _, tabela in _ipairs (tabela) do
@@ -1618,39 +1636,58 @@ function atributo_heal:MontaInfoHealingDone()
end
function atributo_heal:MontaTooltipAlvos (esta_barra, index)
function atributo_heal:MontaTooltipAlvos (esta_barra, index, instancia)
-- eu ja sei quem é o alvo a mostrar os detalhes
-- dar foreach no container de habilidades -- pegar os alvos da habilidade -- e ver se dentro do container tem o meu alvo.
local inimigo = esta_barra.nome_inimigo
local container = self.spell_tables._ActorTable
local habilidades = {}
local total = self.total
local total
local sub_atributo = info.instancia.sub_atributo
if (info.instancia.sub_atributo == 3) then --> overheal
if (sub_atributo == 3) then --> overheal
total = self.totalover
for spellid, tabela in _pairs (container) do
--> tabela = classe_damage_habilidade
local alvos = tabela.targets._ActorTable
for _, tabela in _ipairs (alvos) do
--> tabela = classe_target
if (tabela.nome == inimigo) then
habilidades [#habilidades+1] = {spellid, tabela.overheal}
end
end
end
else
for spellid, tabela in _pairs (container) do
local alvos = tabela.targets._ActorTable
for _, tabela in _ipairs (alvos) do
if (tabela.nome == inimigo) then
habilidades [#habilidades+1] = {spellid, tabela.total}
total = self.total
end
--> add spells
for spellid, tabela in _pairs (container) do
local alvos = tabela.targets._ActorTable
for _, tabela in _ipairs (alvos) do
if (tabela.nome == inimigo) then
local nome, _, icone = _GetSpellInfo (spellid)
if (sub_atributo == 3) then --> overheal
habilidades [#habilidades+1] = {nome, tabela.overheal, icone}
else
habilidades [#habilidades+1] = {nome, tabela.total, icone}
end
end
end
end
--> add pets
local ActorPets = self.pets
for _, PetName in _ipairs (ActorPets) do
local PetActor = instancia.showing (class_type, PetName)
if (PetActor) then
local PetSkillsContainer = PetActor.spell_tables._ActorTable
for _spellid, _skill in _pairs (PetSkillsContainer) do
local alvos = _skill.targets._ActorTable
for _, tabela in _ipairs (alvos) do
if (tabela.nome == inimigo) then
local nome, _, icone = _GetSpellInfo (_spellid)
if (sub_atributo == 3) then --> overheal
habilidades [#habilidades+1] = {nome .. " (" .. PetName:gsub ((" <.*"), "") .. ")", tabela.overheal, icone}
else
habilidades [#habilidades+1] = {nome .. " (" .. PetName:gsub ((" <.*"), "") .. ")", tabela.total, icone}
end
end
end
end
end
end
_table_sort (habilidades, function (a, b) return a[2] > b[2] end)
@@ -1675,7 +1712,7 @@ function atributo_heal:MontaTooltipAlvos (esta_barra, index)
end
for index, tabela in _ipairs (habilidades) do
local nome, rank, icone = _GetSpellInfo (tabela[1])
local nome, icone = tabela[1], tabela [3]
if (index < 8) then
if (is_hps) then
GameTooltip:AddDoubleLine (index..". |T"..icone..":0|t "..nome, _detalhes:comma_value (_math_floor (tabela[2]/meu_tempo)).." (".. _cstr ("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1)
@@ -1776,9 +1813,14 @@ function atributo_heal:MontaDetalhesHealingTaken (nome, barra)
end
function atributo_heal:MontaDetalhesHealingDone (spellid, barra)
--> localize-me
local esta_magia = self.spell_tables._ActorTable [spellid]
local esta_magia
if (barra.other_actor) then
esta_magia = barra.other_actor.spell_tables._ActorTable [spellid]
else
esta_magia = self.spell_tables._ActorTable [spellid]
end
if (not esta_magia) then
return
end
+258 -36
View File
@@ -208,6 +208,18 @@ function _detalhes:ResetAttribute()
end
end
function _detalhes:ListInstances()
return _ipairs (_detalhes.tabela_instancias)
end
function _detalhes:GetPosition()
return self.posicao
end
function _detalhes:GetDisplay()
return self.atributo, self.sub_atributo
end
------------------------------------------------------------------------------------------------------------------------
--> retorna se a instância esta ou não ativa
@@ -223,9 +235,30 @@ function _detalhes:IsStarted()
return self.iniciada
end
------------------------------------------------------------------------------------------------------------------------
function _detalhes:LoadLocalInstanceConfig()
local config = _detalhes.local_instances_config [self.meu_id]
if (config) then
if (not _detalhes.profile_save_pos) then
self.posicao = config.pos
end
self.ativa = config.is_open
self.atributo = config.attribute
self.sub_atributo = config.sub_attribute
self.modo = config.mode
self.segmento = config.segment
self.snap = config.snap or {}
self.horizontalSnap = config.horizontalSnap
self.verticalSnap = config.verticalSnap
self.sub_atributo_last = config.sub_atributo_last
self.isLocked = config.isLocked
end
end
function _detalhes:ShutDownAllInstances()
for index, instance in _ipairs (_detalhes.tabela_instancias) do
if (instance:IsEnabled()) then
@@ -237,6 +270,10 @@ end
function _detalhes:ShutDown()
return self:DesativarInstancia()
end
function _detalhes:GetNumWindows()
end
--> desativando a instância ela fica em stand by e apenas hida a janela
function _detalhes:DesativarInstancia()
@@ -259,9 +296,13 @@ end
self:ResetaGump()
--gump:Fade (self.baseframe.cabecalho.atributo_icon, _unpack (_detalhes.windows_fade_in))
gump:Fade (self.baseframe.cabecalho.ball, _unpack (_detalhes.windows_fade_in))
gump:Fade (self.baseframe, _unpack (_detalhes.windows_fade_in))
gump:Fade (self.rowframe, _unpack (_detalhes.windows_fade_in))
--gump:Fade (self.baseframe.cabecalho.ball, _unpack (_detalhes.windows_fade_in))
--gump:Fade (self.baseframe, _unpack (_detalhes.windows_fade_in))
--gump:Fade (self.rowframe, _unpack (_detalhes.windows_fade_in))
gump:Fade (self.baseframe.cabecalho.ball, 1)
gump:Fade (self.baseframe, 1)
gump:Fade (self.rowframe, 1)
self:Desagrupar (-1)
@@ -420,18 +461,99 @@ end
------------------------------------------------------------------------------------------------------------------------
function _detalhes:DeleteInstance (id)
local instance = _detalhes:GetInstance (id)
if (not instance) then
return false
end
--> check is is open
--if (instance:IsEnabled()) then
-- instance:ShutDown()
--end
--verifica se esta aberta
if (instance:IsEnabled()) then
instance:ShutDown()
-- deletei a janela 1
-- a janela 2 ficou com snap [1] = 1 [3] = 3
--> break snaps of previous and next window
local left_instance = _detalhes:GetInstance (id-1)
if (left_instance) then
for snap_side, instance_id in _pairs (left_instance.snap) do
if (instance_id == id) then --snap na proxima instancia
left_instance.snap [snap_side] = nil
end
end
end
local right_instance = _detalhes:GetInstance (id+1)
if (right_instance) then
for snap_side, instance_id in _pairs (right_instance.snap) do
if (instance_id == id) then --snap na proxima instancia
right_instance.snap [snap_side] = nil
end
end
end
--> re align snaps for higher instances
for i = id+1, #_detalhes.tabela_instancias do
local this_instance = _detalhes:GetInstance (i)
--fix the snaps
for snap_side, instance_id in _pairs (this_instance.snap) do
if (instance_id == i+1) then --snap na proxima instancia
this_instance.snap [snap_side] = i
elseif (instance_id == i-1 and i-2 > 0) then --snap na instancia anterior
this_instance.snap [snap_side] = i-2
else
this_instance.snap [snap_side] = nil
end
end
end
table.remove (_detalhes.tabela_instancias, id)
if (true) then
return
end
table.remove (_detalhes.local_instances_config, id)
_detalhes:SaveProfile()
_detalhes:SaveLocalInstanceConfig()
table.insert (_detalhes.tabela_instancias, 3, instance)
_detalhes:ApplyProfile (_detalhes:GetCurrentProfileName(), true)
if (true) then
return
end
--> break snaps of previous and next window
local left_instance = _detalhes:GetInstance (id-1)
if (left_instance) then
for index, instance_id in _pairs (left_instance.snap) do
if (index == id) then --snap na proxima instancia
left_instance.snap [index] = nil
end
end
end
local right_instance = _detalhes:GetInstance (id+1)
if (right_instance) then
for index, instance_id in _pairs (right_instance.snap) do
if (index == id) then --snap na proxima instancia
right_instance.snap [index] = nil
end
end
end
--> copy skins from next instances
for i = id+1, #_detalhes.tabela_instancias do
local current_instance = _detalhes:GetInstance (i-1)
local next_instance = _detalhes:GetInstance (i)
if (next_instance) then
local exported = next_instance:ExportSkin()
end
end
--fixas os snaps nas janelas superiores
for i = id+1, #_detalhes.tabela_instancias do
local this_instance = _detalhes:GetInstance (i)
@@ -449,8 +571,23 @@ end
end
end
--remover do container tabela_instancias
tremove (_detalhes.tabela_instancias, id)
-- fiz alterações das outras instancias, precisa salvar agora? // ele salva ao sair ou mudar o profile
-- remover a instancia do container deste profile
--local profile = _detalhes:GetProfile (current_profile_name)
--local saved_skins = profile.instances
--tremove (saved_skins, id)
--tremove (_detalhes.tabela_instancias, id)
--> save the current profile
_detalhes:SaveProfile()
end
@@ -471,8 +608,17 @@ end
return false
end
local new_instance = _detalhes:NovaInstancia (#_detalhes.tabela_instancias+1)
local next_id = #_detalhes.tabela_instancias+1
if (_detalhes.unused_instances [next_id]) then
local new_instance = _detalhes.unused_instances [next_id]
_detalhes.tabela_instancias [next_id] = new_instance
_detalhes.unused_instances [next_id] = nil
new_instance:AtivarInstancia()
return new_instance
end
local new_instance = _detalhes:NovaInstancia (next_id)
return new_instance
elseif (id) then
@@ -770,23 +916,6 @@ function _detalhes:agrupar_janelas (lados)
end
local function FixSnaps (instancia)
--_detalhes:DelayMsg ("DEBUG verificando snaps para instancia "..instancia.meu_id)
for snap, esta_instancia in _pairs (instancia.snap) do
if (esta_instancia) then
esta_instancia = _detalhes.tabela_instancias [esta_instancia]
--_detalhes:DelayMsg ("DEBUG janela "..instancia.meu_id.." com snap "..snap.. " em " .. esta_instancia.meu_id)
if (snap == 2) then
--instancia.baseframe.rodape.StatusBarLeftAnchor:SetPoint ("left", instancia.baseframe.rodape.top_bg, "left", 25, 10)
--instancia.baseframe.rodape.StatusBarCenterAnchor:SetPoint ("center", instancia.baseframe.rodape.top_bg, "center", 20, 10)
--instancia.baseframe.rodape.esquerdo:SetTexture ("Interface\\AddOns\\Details\\images\\bar_down_left_snap")
--instancia.baseframe.rodape.esquerdo.have_snap = true
end
end
end
end
function _detalhes:Desagrupar (instancia, lado)
if (self.meu_id) then --> significa que self é uma instancia
@@ -898,6 +1027,99 @@ end
--> cria uma janela para uma nova instância
--> search key: ~new ~nova
function _detalhes:CreateDisabledInstance (ID, skin_table)
--> first check if we can recycle a old instance
if (_detalhes.unused_instances [ID]) then
local new_instance = _detalhes.unused_instances [ID]
_detalhes.tabela_instancias [ID] = new_instance
_detalhes.unused_instances [ID] = nil
--> replace the values on recycled instance
new_instance:ResetInstanceConfig()
--> copy values from a previous skin saved
if (skin_table) then
--> copy from skin_table to new_instance
_detalhes.table.copy (new_instance, skin_table)
end
return new_instance
end
--> must create a new one
local new_instance = {
--> instance id
meu_id = ID,
--> internal stuff
barras = {}, --container que irá armazenar todas as barras
barraS = {nil, nil}, --de x até x são as barras que estão sendo mostradas na tela
rolagem = false, --barra de rolagem não esta sendo mostrada
largura_scroll = 26,
bar_mod = 0,
bgdisplay_loc = 0,
--> displaying row info
rows_created = 0,
rows_showing = 0,
rows_max = 50,
--> saved pos for normal mode and lone wolf mode
posicao = {
["normal"] = {x = 1, y = 2, w = 300, h = 200},
["solo"] = {x = 1, y = 2, w = 300, h = 200}
},
--> save information about window snaps
snap = {},
--> current state starts as normal
mostrando = "normal",
--> menu consolidated
consolidate = false, --deprecated
icons = {true, true, true, true},
--> status bar stuff
StatusBar = {options = {}},
--> more stuff
atributo = 1, --> dano
sub_atributo = 1, --> damage done
sub_atributo_last = {1, 1, 1, 1, 1},
segmento = -1, --> combate atual
modo = modo_grupo,
last_modo = modo_grupo,
LastModo = modo_grupo,
}
_setmetatable (new_instance, _detalhes)
_detalhes.tabela_instancias [#_detalhes.tabela_instancias+1] = new_instance
--> fill the empty instance with default values
new_instance:ResetInstanceConfig()
--> copy values from a previous skin saved
if (skin_table) then
--> copy from skin_table to new_instance
_detalhes.table.copy (new_instance, skin_table)
end
--> setup default wallpaper
local spec = GetSpecialization()
if (spec) then
local id, name, description, icon, _background, role = GetSpecializationInfo (spec)
if (_background) then
local bg = "Interface\\TALENTFRAME\\" .. _background
if (new_instance.wallpaper) then
new_instance.wallpaper.texture = bg
new_instance.wallpaper.texcoord = {0, 1, 0, 0.703125}
end
end
end
--> finish
return new_instance
end
function _detalhes:NovaInstancia (ID)
local new_instance = {}
@@ -938,11 +1160,11 @@ end
--> saved pos for normal mode and lone wolf mode
new_instance.posicao = {
["normal"] = {},
["solo"] = {}
["normal"] = {x = 1, y = 2, w = 300, h = 200},
["solo"] = {x = 1, y = 2, w = 300, h = 200}
}
--> save information about window snaps
new_instance.snap = {nil, nil, nil, nil}
new_instance.snap = {}
--> current state starts as normal
new_instance.mostrando = "normal"
@@ -951,6 +1173,7 @@ end
new_instance.icons = {true, true, true, true}
--> create window frames
local _baseframe, _bgframe, _bgframe_display, _scrollframe = gump:CriaJanelaPrincipal (ID, new_instance, true)
new_instance.baseframe = _baseframe
new_instance.bgframe = _bgframe
@@ -1001,12 +1224,11 @@ end
new_instance:ShowSideBars()
--local skin = fazer aqui o esquema de resgatar a skin salva no profile.
new_instance:ChangeSkin ("Default Skin")
new_instance.skin = "no skin"
new_instance:ChangeSkin ("Minimalistic")
--> apply standard skin if have one saved
--[[
if (_detalhes.standard_skin) then
local style = _detalhes.standard_skin
@@ -1028,9 +1250,10 @@ end
end
end
--]]
--> apply all changed attributes
new_instance:ChangeSkin()
--new_instance:ChangeSkin()
return new_instance
end
@@ -1092,8 +1315,7 @@ function _detalhes:RestauraJanela (index, temp, load_only)
self:EsconderScrollBar (true)
--> check snaps
self.snap = self.snap or {nil, nil, nil, nil}
FixSnaps (self)
self.snap = self.snap or {}
--> status bar stuff
self.StatusBar = {}
+4
View File
@@ -10,6 +10,10 @@ function _detalhes:ResetInstanceConfig()
self [key] = value
end
end
self.snap = {}
self.horizontalSnap = nil
self.verticalSnap = nil
self:LockInstance (false)
end
function _detalhes:LoadInstanceConfig()
+1 -1
View File
@@ -308,7 +308,6 @@
_detalhes:CatchRaidBuffUptime ("BUFF_UPTIME_IN")
_detalhes:CatchRaidDebuffUptime ("DEBUFF_UPTIME_IN")
_detalhes:UptadeRaidMembersCache()
_detalhes:HaveOneCurrentInstance()
--> hide / alpha / switch in combat
for index, instancia in ipairs (_detalhes.tabela_instancias) do
@@ -319,6 +318,7 @@
end
_detalhes:SendEvent ("COMBAT_PLAYER_ENTER", nil, _detalhes.tabela_vigente)
_detalhes:HaveOneCurrentInstance()
end
+9 -3
View File
@@ -539,6 +539,10 @@
-----------------------------------------------------------------------------------------------------------------------------------------
function parser:summon (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellName)
if (not who_name) then
who_name = "[*] " .. spellName
end
--> pet summon another pet
local sou_pet = _detalhes.tabela_pets.pets [who_serial]
if (sou_pet) then --> okey, ja é um pet
@@ -2877,6 +2881,7 @@
end
end
-- ~load
function _detalhes.parser_functions:ADDON_LOADED (...)
local addon_name = _select (1, ...)
@@ -2893,11 +2898,12 @@
--> check group
_detalhes.in_group = IsInGroup() or IsInRaid()
--> write into details object all basic keys
--> write into details object all basic keys and default profile
_detalhes:ApplyBasicKeys()
--> check if is first run
--> check if is first run, update keys for character and global data
_detalhes:LoadGlobalAndCharacterData()
--> details updated and not reopened the game client
if (_detalhes.FILEBROKEN) then
return
end
@@ -2945,7 +2951,7 @@
_detalhes.listener:SetScript ("OnEvent", _detalhes.OnEvent)
--> protected logout function
--> logout function ~save
function _detalhes:PLAYER_LOGOUT (...)
--> close info window
+13
View File
@@ -177,6 +177,19 @@
return false
end
_detalhes.table = {}
function _detalhes.table.copy (t1, t2)
local table_deepcopy = table_deepcopy
for key, value in pairs (t2) do
if (type (value) == "table") then
t1 [key] = table_deepcopy (value)
else
t1 [key] = value
end
end
end
function _detalhes:hex (num)
local hexstr = '0123456789abcdef'
local s = ''
+43 -23
View File
@@ -231,12 +231,12 @@
self.posicao[self.mostrando].h = pre_defined.altura
end
self.baseframe:SetWidth (self.posicao[self.mostrando].w)
self.baseframe:SetHeight (self.posicao[self.mostrando].h)
self.baseframe:ClearAllPoints()
self.baseframe:SetPoint ("CENTER", _UIParent, "CENTER", novo_x, novo_y)
self.baseframe:SetWidth (self.posicao[self.mostrando].w) --slider frame
self.baseframe:SetHeight (self.posicao[self.mostrando].h)
self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight() - end_window_spacement --> espaço para o final da janela
end
@@ -1518,25 +1518,28 @@
end
end
_detalhes:RegisterHotCornerButton (
--> absolute name
"Details!",
--> corner
"TOPLEFT",
--> config table
self.hotcorner_topleft,
--> frame _G name
"DetailsLeftCornerButton",
--> icon
[[Interface\AddOns\Details\images\minimap]],
--> tooltip
tooltip_hotcorner,
--> click function
on_click_on_hotcorner_button,
--> menus
nil,
--> quick click
on_click_on_quickclick_button)
if (_G.HotCorners) then
_G.HotCorners:RegisterHotCornerButton (
--> absolute name
"Details!",
--> corner
"TOPLEFT",
--> config table
_detalhes.hotcorner_topleft,
--> frame _G name
"DetailsLeftCornerButton",
--> icon
[[Interface\AddOns\Details\images\minimap]],
--> tooltip
tooltip_hotcorner,
--> click function
on_click_on_hotcorner_button,
--> menus
nil,
--> quick click
on_click_on_quickclick_button
)
end
end
--old versions dialog
@@ -1634,4 +1637,21 @@
end
_detalhes:ScheduleTimer ("ResetWarningDialog", 7)
--]]
--]]
--[[
local background_up = f:CreateTexture (nil, "background")
background_up:SetPoint ("topleft", f, "topleft")
background_up:SetSize (250, 150)
background_up:SetTexture ("Interface\\QuestionFrame\\Question-Main")
background_up:SetTexCoord (0, 420/512, 320/512, 475/512)
local background_down = f:CreateTexture (nil, "background")
background_down:SetPoint ("topleft", background_up, "bottomleft")
background_down:SetSize (250, 150)
background_down:SetTexture ("Interface\\QuestionFrame\\Question-Main")
background_down:SetTexCoord (0, 420/512, 156/512, 308/512)
background_up:SetDesaturated (true)
background_down:SetDesaturated (true)
--]]
+12 -4
View File
@@ -254,11 +254,19 @@ local DropDownMetaFunctions = {}
function DropDownMetaFunctions:IsEnabled()
return self.dropdown:IsEnabled()
end
function DropDownMetaFunctions:Enable()
return self.dropdown:Enable()
self:SetAlpha (.4)
return _rawset (self, "lockdown", false)
--return self.dropdown:Enable()
end
function DropDownMetaFunctions:Disable()
return self.dropdown:Disable()
self:SetAlpha (.4)
return _rawset (self, "lockdown", true)
--return self.dropdown:Disable()
end
--> fixed value
@@ -517,8 +525,8 @@ end
function DetailsDropDownOnMouseDown (button)
local object = button.MyObject
if (not object.opened) then --> click to open
if (not object.opened and not _rawget (object, "lockdown")) then --> click to open
local menu = object:func()
object.builtMenu = menu
+89 -30
View File
@@ -86,23 +86,33 @@ end
function _detalhes:LoadGlobalAndCharacterData()
--> check and build the default container for character database
--> it exists?
if (not _detalhes_database) then
_detalhes_database = table_deepcopy (_detalhes.default_player_data)
end
if (_detalhes_global and not _detalhes_global.profile_pool) then
_detalhes_global.profile_pool = {}
end
for key, value in pairs (_detalhes.default_player_data) do
--> load saved values
for key, value in pairs (_detalhes.default_player_data) do
--> check if key exists
--> check if key exists, e.g. a new key was added
if (_detalhes_database [key] == nil) then
if (type (value) == "table") then
_detalhes_database [key] = table_deepcopy (_detalhes.default_player_data [key])
else
_detalhes_database [key] = value
end
elseif (type (_detalhes_database [key]) == "table") then
for key2, value2 in pairs (_detalhes.default_player_data [key]) do
if (_detalhes_database [key] [key2] == nil) then
if (type (value2) == "table") then
_detalhes_database [key] [key2] = table_deepcopy (_detalhes.default_player_data [key] [key2])
else
_detalhes_database [key] [key2] = value2
end
end
end
end
--> copy the key from saved table to details object
@@ -118,7 +128,7 @@ function _detalhes:LoadGlobalAndCharacterData()
if (not _detalhes_global) then
_detalhes_global = table_deepcopy (_detalhes.default_global_data)
end
for key, value in pairs (_detalhes.default_global_data) do
--> check if key exists
@@ -228,29 +238,9 @@ end
function _detalhes:LoadConfig()
--> profile
--> instances
_detalhes.tabela_instancias = _detalhes_database.tabela_instancias or {}
--> plugins data
--> plugins data
_detalhes.plugin_database = _detalhes_database.plugin_database or {}
_detalhes:ReativarInstancias()
--> fix for the 500
if (_detalhes_database.active_profile == "") then
--> é a primeira vez que este character usa profiles, precisa copiar as keys existentes
local current_profile_name = _detalhes:GetCurrentProfileName()
_detalhes:GetProfile (current_profile_name, true)
_detalhes:SaveProfileSpecial()
end
--> load profile and active instances
local current_profile_name = _detalhes:GetCurrentProfileName()
_detalhes:GetProfile (current_profile_name, true)
_detalhes:ApplyProfile (current_profile_name, true)
--> startup
--> set the nicktag cache host
@@ -259,7 +249,6 @@ function _detalhes:LoadConfig()
--> count data
_detalhes:CountDataOnLoad()
--> solo e raid plugin
if (_detalhes_database.SoloTablesSaved) then
if (_detalhes_database.SoloTablesSaved.Mode) then
@@ -302,6 +291,76 @@ function _detalhes:LoadConfig()
_detalhes.is_version_first_run = true
end
--> profile
--> fix for the 500
if (_detalhes_database.active_profile == "") then
--> é a primeira vez que este character usa profiles, precisa copiar as keys existentes
local current_profile_name = _detalhes:GetCurrentProfileName()
_detalhes:GetProfile (current_profile_name, true)
_detalhes:SaveProfileSpecial()
end
--> load profile and active instances
local current_profile_name = _detalhes:GetCurrentProfileName()
--> check if exists, if not, create one
local profile = _detalhes:GetProfile (current_profile_name, true)
--> instances
_detalhes.tabela_instancias = _detalhes_database.tabela_instancias or {}
--> fix for version 1.21.0
if (#_detalhes.tabela_instancias > 0) then --> only happens once after the character logon
--if (current_profile_name:find (UnitName ("player"))) then
for index, saved_skin in ipairs (profile.instances) do
local instance = _detalhes.tabela_instancias [index]
if (instance) then
saved_skin.__was_opened = instance.ativa
saved_skin.__pos = table_deepcopy (instance.posicao)
saved_skin.__locked = instance.isLocked
saved_skin.__snap = table_deepcopy (instance.snap)
saved_skin.__snapH = instance.horizontalSnap
saved_skin.__snapV = instance.verticalSnap
for key, value in pairs (instance) do
if (_detalhes.instance_defaults [key] ~= nil) then
if (type (value) == "table") then
saved_skin [key] = table_deepcopy (value)
else
saved_skin [key] = value
end
end
end
end
end
for index, instance in _detalhes:ListInstances() do
_detalhes.local_instances_config [index] = {
pos = table_deepcopy (instance.posicao),
is_open = instance.ativa,
attribute = instance.atributo,
sub_attribute = instance.sub_atributo,
mode = instance.modo,
segment = instance.segmento,
snap = table_deepcopy (instance.snap),
horizontalSnap = instance.horizontalSnap,
verticalSnap = instance.verticalSnap,
sub_atributo_last = instance.sub_atributo_last,
isLocked = instance.isLocked
}
if (_detalhes.local_instances_config [index].isLocked == nil) then
_detalhes.local_instances_config [index].isLocked = false
end
end
--end
_detalhes.tabela_instancias = {}
end
--_detalhes:ReativarInstancias()
--> apply the profile
_detalhes:ApplyProfile (current_profile_name, true)
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+200 -43
View File
@@ -117,6 +117,24 @@ function _detalhes:GetProfile (name, create)
return profile
end
function _detalhes:SetProfileCProp (name, cprop, value)
if (not name) then
name = _detalhes:GetCurrentProfileName()
end
local profile = _detalhes:GetProfile (name, false)
if (profile) then
if (type (value) == "table") then
rawset (profile, cprop, table_deepcopy (value))
else
rawset (profile, cprop, value)
end
else
return
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> Profiles:
--> reset the profile
@@ -131,17 +149,7 @@ function _detalhes:ResetProfile (profile_name)
--> reset
local instances = profile.instances
for index, instance in ipairs (instances) do
for key, value in pairs (_detalhes.instance_defaults) do
if (type (value) == "table") then
instance [key] = table_deepcopy (value)
else
instance [key] = value
end
end
end
profile.instances = {}
local profile = table_deepcopy (_detalhes.default_profile)
profile.instances = instances
@@ -204,51 +212,190 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
else
_detalhes [key] = value
end
end
--> set the current profile
if (not is_copy) then
_detalhes.active_profile = profile_name
_detalhes_database.active_profile = profile_name
end
--> apply the skin
local saved_skins = profile.instances
--> first save the local instance configs
_detalhes:SaveLocalInstanceConfig()
--> we need to create instances if the profile have more saved skins then the current amount of instances
if (#_detalhes.tabela_instancias < #saved_skins) then
for i = #_detalhes.tabela_instancias+1, #saved_skins do
local saved_skins = profile.instances
local instance_limit = _detalhes.instances_amount
--> then close all opened instances
for index, instance in _detalhes:ListInstances() do
if (not getmetatable (instance)) then
instance.iniciada = false
setmetatable (instance, _detalhes)
end
if (instance:IsStarted()) then
if (instance:IsEnabled()) then
instance:ShutDown()
end
end
end
--> check if there is a skin saved or this is a empty profile
if (#saved_skins == 0) then
--> is empty profile, let's set default skin on #1 window
local instance1 = _detalhes:GetInstance (1)
if (not instance1) then
instance1 = _detalhes:CreateInstance (1)
end
--> apply default config on this instance (flat skin texture was 'ResetInstanceConfig' running).
instance1:ResetInstanceConfig()
instance1.skin = "no skin"
instance1:ChangeSkin ("Minimalistic")
--> esse inicio precisa ser em silêncio
local new_instance = _detalhes:CreateInstance (true)
if (not new_instance) then
--> release the snap and lock
instance1:LoadLocalInstanceConfig()
instance1.snap = {}
instance1.horizontalSnap = nil
instance1.verticalSnap = nil
instance1:LockInstance (false)
if (#_detalhes.tabela_instancias > 1) then
for i = #_detalhes.tabela_instancias, 2, -1 do
_detalhes.unused_instances [i] = _detalhes.tabela_instancias [i]
_detalhes.tabela_instancias [i] = nil
end
end
else
--> load skins
local instances_loaded = 0
for index, skin in ipairs (saved_skins) do
if (instance_limit < index) then
break
end
new_instance:ShutDown()
--> get the instance
local instance = _detalhes:GetInstance (index)
if (not instance) then
--> create a instance without creating its frames (not initializing)
instance = _detalhes:CreateDisabledInstance (index, skin)
end
--> copy skin
for key, value in pairs (skin) do
if (type (value) == "table") then
instance [key] = table_deepcopy (value)
else
instance [key] = value
end
end
--> reset basic config
instance.snap = {}
instance.horizontalSnap = nil
instance.verticalSnap = nil
instance:LockInstance (false)
--> load data saved for this character only
instance:LoadLocalInstanceConfig()
if (skin.__was_opened) then
instance:AtivarInstancia()
else
instance.ativa = false
end
--> load data saved again
instance:LoadLocalInstanceConfig()
--> check window positioning
if (_detalhes.profile_save_pos) then
if (skin.__pos) then
instance.posicao = table_deepcopy (skin.__pos)
else
if (not instance.posicao) then
instance.posicao = {normal = {x = 1, y = 1, w = 300, h = 200}, solo = {}}
elseif (not instance.posicao.normal) then
instance.posicao.normal = {x = 1, y = 1, w = 300, h = 200}
end
end
instance.isLocked = skin.__locked
instance.snap = table_deepcopy (skin.__snap) or {}
instance.horizontalSnap = skin.__snapH
instance.verticalSnap = skin.__snapV
else
if (not instance.posicao) then
instance.posicao = {normal = {x = 1, y = 1, w = 300, h = 200}, solo = {}}
elseif (not instance.posicao.normal) then
instance.posicao.normal = {x = 1, y = 1, w = 300, h = 200}
end
end
--> open the instance
if (instance:IsEnabled()) then
instance:LockInstance (instance.isLocked)
instance:RestoreMainWindowPosition()
instance:ReajustaGump()
instance:SaveMainWindowPosition()
instance:ChangeSkin()
else
instance.skin = skin.skin
end
instances_loaded = instances_loaded + 1
end
end
for index, instance in ipairs (_detalhes.tabela_instancias) do
local this_skin = saved_skins [index]
if (this_skin) then
if (not instance.iniciada and not _detalhes.initializing) then
instance:RestauraJanela()
instance:ApplySavedSkin (this_skin)
instance:DesativarInstancia()
elseif (instance.iniciada) then
instance:ApplySavedSkin (this_skin)
--> move unused instances for unused container
if (#_detalhes.tabela_instancias > instances_loaded) then
for i = #_detalhes.tabela_instancias, instances_loaded+1, -1 do
_detalhes.unused_instances [i] = _detalhes.tabela_instancias [i]
_detalhes.tabela_instancias [i] = nil
end
end
--> check all snaps for invalid entries
for i = 1, instances_loaded do
local instance = _detalhes:GetInstance (i)
local previous_instance_id = _detalhes:GetInstance (i-1) and _detalhes:GetInstance (i-1):GetId() or 0
local next_instance_id = _detalhes:GetInstance (i+1) and _detalhes:GetInstance (i+1):GetId() or 0
for snap_side, instance_id in pairs (instance.snap) do
if (instance_id < 1) then --> invalid instance
instance.snap [snap_side] = nil
elseif (instance_id ~= previous_instance_id and instance_id ~= next_instance_id) then --> no match
instance.snap [snap_side] = nil
end
end
end
--> auto realign windows
if (not _detalhes.initializing) then
for _, instance in _detalhes:ListInstances() do
if (instance:IsEnabled()) then
_detalhes.move_janela_func (instance.baseframe, true, instance)
_detalhes.move_janela_func (instance.baseframe, false, instance)
end
end
end
end
--> check instance amount
_detalhes.opened_windows = 0
for index = 1, _detalhes.instances_amount do
local instance = _detalhes.tabela_instancias [index]
if (instance and instance.ativa) then
_detalhes.opened_windows = _detalhes.opened_windows + 1
end
end
--> end
if (not is_copy) then
_detalhes.active_profile = profile_name
_detalhes_database.active_profile = profile_name
--_detalhes:SaveProfile()
end
return true
end
@@ -290,6 +437,12 @@ function _detalhes:SaveProfile (saveas)
for index, instance in ipairs (_detalhes.tabela_instancias) do
local exported = instance:ExportSkin()
exported.__was_opened = instance:IsEnabled()
exported.__pos = table_deepcopy (instance:GetPosition())
exported.__locked = instance.isLocked
exported.__snap = table_deepcopy (instance.snap)
exported.__snapH = instance.horizontalSnap
exported.__snapV = instance.verticalSnap
profile.instances [index] = exported
end
@@ -635,6 +788,8 @@ local default_player_data = {
RaidTablesSaved = {},
--> saved skins
savedStyles = {},
--> instance config
local_instances_config = {},
}
_detalhes.default_player_data = default_player_data
@@ -700,9 +855,11 @@ function _detalhes:SaveProfileSpecial()
--> save skins
table.wipe (profile.instances)
for index, instance in ipairs (_detalhes.tabela_instancias) do
local exported = instance:ExportSkin()
profile.instances [index] = exported
if (_detalhes.tabela_instancias) then
for index, instance in ipairs (_detalhes.tabela_instancias) do
local exported = instance:ExportSkin()
profile.instances [index] = exported
end
end
--> end
+28 -4
View File
@@ -18,14 +18,38 @@ local is_exception = {
["nick_tag_cache"] = true
}
function _detalhes:SaveLocalInstanceConfig()
for index, instance in _detalhes:ListInstances() do
local a1, a2 = instance:GetDisplay()
_detalhes.local_instances_config [index] = {
pos = table_deepcopy (instance:GetPosition()),
is_open = instance:IsEnabled(),
attribute = a1,
sub_attribute = a2,
mode = instance:GetMode(),
segment = instance:GetSegment(),
snap = table_deepcopy (instance.snap),
horizontalSnap = instance.horizontalSnap,
verticalSnap = instance.verticalSnap,
sub_atributo_last = instance.sub_atributo_last,
isLocked = instance.isLocked
}
if (_detalhes.local_instances_config [index].isLocked == nil) then
_detalhes.local_instances_config [index].isLocked = false
end
end
end
function _detalhes:SaveConfig()
--> nicktag cache
--_detalhes.copy_nick_tag = table_deepcopy (_detalhes_database.nick_tag_cache)
--> save instance configs localy
_detalhes:SaveLocalInstanceConfig()
--> cleanup
_detalhes:PrepareTablesForSave()
_detalhes_database.tabela_instancias = _detalhes.tabela_instancias
_detalhes_database.tabela_instancias = {} --_detalhes.tabela_instancias --[[instances now saves only inside the profile --]]
_detalhes_database.tabela_historico = _detalhes.tabela_historico
local name, ttype, difficulty, difficultyName, maxPlayers, playerDifficulty, isDynamicInstance, mapID, instanceGroupSize = GetInstanceInfo()
+19 -8
View File
@@ -3739,8 +3739,7 @@ function window:CreateFrame13()
profile_create_button:SetPoint ("left", profile_name, "right", 2, 0)
window:CreateLineBackground2 (frame13, profile_name, profile_name_label, Loc ["STRING_OPTIONS_PROFILES_CREATE_DESC"])
--> copy profile
local profile_selectedCopy = function (_, instance, profile_name)
--copiar o profile
@@ -3836,12 +3835,15 @@ function window:CreateFrame13()
window:CreateLineBackground2 (frame13, profile_reset_button, hiddenlabel, Loc ["STRING_OPTIONS_PROFILES_RESET_DESC"])
--profile_reset_button.button.texture:SetVertexColor (1, .8, 0)
--> save window position within profile
g:NewLabel (frame13, _, "$parentSavePosAndSizeLabel", "PosAndSizeLabel", Loc ["STRING_OPTIONS_PROFILE_POSSIZE"], "GameFontHighlightLeft")
g:NewSwitch (frame13, _, "$parentPosAndSizeSlider", "PosAndSizeSlider", 60, 20, _, _, _detalhes.profile_save_pos)
frame13.PosAndSizeSlider:SetPoint ("left", frame13.PosAndSizeLabel, "right", 2, -1)
frame13.PosAndSizeSlider.OnSwitch = function (self, _, value)
_detalhes.profile_save_pos = value
_detalhes:SetProfileCProp (nil, "profile_save_pos", value)
end
frame13.PosAndSizeSlider:SetPoint ("left", frame13.PosAndSizeLabel, "right", 3, 0)
window:CreateLineBackground2 (frame13, "PosAndSizeSlider", "PosAndSizeLabel", Loc ["STRING_OPTIONS_PROFILE_POSSIZE_DESC"])
@@ -6182,13 +6184,13 @@ function window:CreateFrame9()
end
instance:InstanceWallpaper (true)
_G.DetailsOptionsWindow9BackgroundDropdown.MyObject:Enable()
_G.DetailsOptionsWindow9BackgroundDropdown2.MyObject:Enable()
--_G.DetailsOptionsWindow9BackgroundDropdown.MyObject:Enable()
--_G.DetailsOptionsWindow9BackgroundDropdown2.MyObject:Enable()
else
instance:InstanceWallpaper (false)
_G.DetailsOptionsWindow9BackgroundDropdown.MyObject:Disable()
_G.DetailsOptionsWindow9BackgroundDropdown2.MyObject:Disable()
--_G.DetailsOptionsWindow9BackgroundDropdown.MyObject:Disable()
--_G.DetailsOptionsWindow9BackgroundDropdown2.MyObject:Disable()
end
window:update_wallpaper_info()
@@ -7664,7 +7666,16 @@ function window:update_all (editing_instance)
_G.DetailsOptionsWindow19QuickClickDropdown.MyObject:Select (_detalhes.hotcorner_topleft.quickclick_what_todo)
_G.DetailsOptionsWindow19BrokerTextDropdown.MyObject:Select (_detalhes.minimap.text_type)
if (not _G.HotCorners) then
_G.DetailsOptionsWindow19HotcornerSlider.MyObject:Disable()
_G.DetailsOptionsWindow19HotcornerActionDropdown.MyObject:Disable()
_G.DetailsOptionsWindow19HotcornerQuickClickSlider.MyObject:Disable()
_G.DetailsOptionsWindow19QuickClickDropdown.MyObject:Disable()
if (not _G.DetailsOptionsWindow19HotcornerAnchor.MyObject:GetText():find ("not installed")) then
_G.DetailsOptionsWindow19HotcornerAnchor.MyObject:SetText (_G.DetailsOptionsWindow19HotcornerAnchor.MyObject:GetText() .. " |cFFFF5555(not installed)|r")
end
end
--> window 20
_G.DetailsOptionsWindow20TooltipTextColorPick.MyObject:SetColor (unpack (_detalhes.tooltip.fontcolor))
_G.DetailsOptionsWindow20TooltipTextSizeSlider.MyObject:SetValue (_detalhes.tooltip.fontsize)
+5 -2
View File
@@ -60,7 +60,7 @@ end
-- 0.00048828125
local DEFAULT_SKIN = [[Interface\AddOns\Details\images\skins\default_skin]]
local DEFAULT_SKIN = [[Interface\AddOns\Details\images\skins\classic_skin]]
--local COORDS_LEFT_BALL = {0.15673828125, 0.27978515625, 0.08251953125, 0.20556640625} -- 160 84 287 211 (updated)
--160 84 287 211
@@ -663,6 +663,7 @@ local function move_janela (baseframe, iniciando, instancia)
end
end
_detalhes.move_janela_func = move_janela
local function BGFrame_scripts (BG, baseframe, instancia)
@@ -4518,7 +4519,7 @@ function _detalhes:ChangeSkin (skin_name)
local this_skin = _detalhes.skins [skin_name]
if (not this_skin) then
skin_name = "Default Skin"
skin_name = "Minimalistic"
this_skin = _detalhes.skins [skin_name]
end
@@ -4530,6 +4531,7 @@ function _detalhes:ChangeSkin (skin_name)
if (not just_updating) then
--> skin updater
--print ("debug", self.meu_id, self.iniciada, self.baseframe, self.bgframe)
if (self.bgframe.skin_script) then
self.bgframe:SetScript ("OnUpdate", nil)
self.bgframe.skin_script = false
@@ -4588,6 +4590,7 @@ function _detalhes:ChangeSkin (skin_name)
local skin_file = this_skin.file
--> set textures
self.baseframe.cabecalho.ball:SetTexture (skin_file) --> bola esquerda
self.baseframe.cabecalho.emenda:SetTexture (skin_file) --> emenda que liga a bola a textura do centro
+34 -2
View File
@@ -163,6 +163,10 @@ function _G._detalhes:Start()
instance:InstanceWallpaper (false)
end
end
if (instance:IsEnabled()) then
_detalhes.move_janela_func (instance.baseframe, true, instance)
_detalhes.move_janela_func (instance.baseframe, false, instance)
end
end
self.CheckWallpaperAfterStartup = nil
end
@@ -234,7 +238,7 @@ function _G._detalhes:Start()
self:ScheduleTimer ("ShowDelayMsg", 10)
--> send instance open signal
for index, instancia in ipairs (self.tabela_instancias) do
for index, instancia in _detalhes:ListInstances() do
if (instancia.ativa) then
self:SendEvent ("DETAILS_INSTANCE_OPEN", nil, instancia)
end
@@ -259,7 +263,7 @@ function _G._detalhes:Start()
--> announce alpha version
function self:AnnounceVersion()
for index, instancia in ipairs (self.tabela_instancias) do
for index, instancia in _detalhes:ListInstances() do
if (instancia.ativa) then
self.gump:Fade (instancia._version, "in", 0.1)
end
@@ -421,5 +425,33 @@ function _G._detalhes:Start()
_detalhes.schedule_chat_enter = _detalhes:ScheduleTimer ("EnterChatChannel", 30)
end
local f = CreateFrame ("frame", "DetailsSelectProfile", UIParent)
f:SetSize (250, 300)
f:SetPoint ("center", UIParent)
f:SetMovable (true)
f:SetScript ("OnMouseDown", function (self)
if (not self.moving) then
self:StartMoving()
self.moving = true
end
end)
f:SetScript ("OnMouseUp", function (self)
if (self.moving) then
self:StopMovingOrSizing()
self.moving = false
end
end)
local background = f:CreateTexture (nil, "background")
background:SetAllPoints()
background:SetTexture ([[Interface\AddOns\Details\images\welcome]])
local logo = f:CreateTexture (nil, "artwork")
logo:SetTexture ([[Interface\AddOns\Details\images\logotipo]])
logo:SetSize (256*0.8, 128*0.8)
logo:SetPoint ("center", f, "center", 0, 0)
logo:SetPoint ("top", f, "top", 20, 20)
f:Hide()
end