- Added casted amount for healing and damage spells. The result is shown on Player Detail Window.
- Added uptime amount for healing spells on Player Detail Window. - Added an option to disable lock/resize/ungroup buttons. It's under miscellaneous bracket on Options Panel. - Wallpaper for menus on title bar got a customization option under tooltips bracket on Options Panel. - Updated spell list for Crowd Control and class detection. - Improved Weakaura creation tool under Encounter Details Plugin.
This commit is contained in:
@@ -6,7 +6,6 @@ move-folders:
|
||||
Details/plugins/Details_TimeAttack: Details_TimeAttack
|
||||
Details/plugins/Details_TinyThreat: Details_TinyThreat
|
||||
Details/plugins/Details_Vanguard: Details_Vanguard
|
||||
Details/plugins/Details_YouAreNotPrepared: Details_YouAreNotPrepared
|
||||
Details/plugins/Details_RaidInfo-BlackrockFoundry: Details_RaidInfo-BlackrockFoundry
|
||||
Details/plugins/Details_RaidInfo-Highmaul: Details_RaidInfo-Highmaul
|
||||
Details/plugins/Details_DataStorage: Details_DataStorage
|
||||
|
||||
+147
-45
@@ -2137,6 +2137,7 @@ function gump:CriaJanelaInfo()
|
||||
end
|
||||
table.sort (player_1_skills, _detalhes.Sort2)
|
||||
local player_1_top = player_1_skills [1] [2]
|
||||
bar1 [2]:SetStatusBarColor (1, 1, 1, 1)
|
||||
|
||||
-- player 2
|
||||
local player_2_skills = {}
|
||||
@@ -2151,6 +2152,7 @@ function gump:CriaJanelaInfo()
|
||||
end
|
||||
table.sort (player_2_skills, _detalhes.Sort2)
|
||||
player_2_top = player_2_skills [1] [2]
|
||||
bar2 [2]:SetStatusBarColor (1, 1, 1, 1)
|
||||
end
|
||||
|
||||
-- player 3
|
||||
@@ -2166,6 +2168,7 @@ function gump:CriaJanelaInfo()
|
||||
end
|
||||
table.sort (player_3_skills, _detalhes.Sort2)
|
||||
player_3_top = player_3_skills [1] [2]
|
||||
bar3 [2]:SetStatusBarColor (1, 1, 1, 1)
|
||||
end
|
||||
|
||||
-- build tooltip
|
||||
@@ -2191,8 +2194,10 @@ function gump:CriaJanelaInfo()
|
||||
bar [2].lefttext:SetText (index .. ". " .. name)
|
||||
bar [2].righttext:SetText (_detalhes:ToK2Min (spell [2]))
|
||||
bar [2]:SetValue (spell [2]/player_1_top*100)
|
||||
bar [2].bg:Show()
|
||||
|
||||
if (player_2) then
|
||||
|
||||
local player_2_skill
|
||||
local found_skill = false
|
||||
for this_index, this_spell in _ipairs (player_2_skills) do
|
||||
@@ -2204,6 +2209,7 @@ function gump:CriaJanelaInfo()
|
||||
|
||||
bar [1]:SetTexture (icon)
|
||||
bar [2].lefttext:SetText (this_index .. ". " .. name)
|
||||
bar [2].bg:Show()
|
||||
|
||||
if (spell [2] > this_spell [2]) then
|
||||
local diff = spell [2] - this_spell [2]
|
||||
@@ -2237,6 +2243,7 @@ function gump:CriaJanelaInfo()
|
||||
bar [1]:SetTexture (nil)
|
||||
bar [2].lefttext:SetText ("")
|
||||
bar [2].righttext:SetText ("")
|
||||
bar [2].bg:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2252,6 +2259,7 @@ function gump:CriaJanelaInfo()
|
||||
|
||||
bar [1]:SetTexture (icon)
|
||||
bar [2].lefttext:SetText (this_index .. ". " .. name)
|
||||
bar [2].bg:Show()
|
||||
|
||||
if (spell [2] > this_spell [2]) then
|
||||
local diff = spell [2] - this_spell [2]
|
||||
@@ -2285,6 +2293,7 @@ function gump:CriaJanelaInfo()
|
||||
bar [1]:SetTexture (nil)
|
||||
bar [2].lefttext:SetText ("")
|
||||
bar [2].righttext:SetText ("")
|
||||
bar [2].bg:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2352,6 +2361,7 @@ function gump:CriaJanelaInfo()
|
||||
local player3_misc = info.instancia.showing (4, player3)
|
||||
|
||||
local player1_uptime
|
||||
local player1_casts
|
||||
|
||||
if (bar1[2].righttext:GetText()) then
|
||||
bar1[2]:SetStatusBarColor (1, 1, 1, 1)
|
||||
@@ -2361,6 +2371,8 @@ function gump:CriaJanelaInfo()
|
||||
frame1.tooltip.crit_label2:SetText (critical .. "%")
|
||||
|
||||
if (player1_misc) then
|
||||
|
||||
--uptime
|
||||
local spell = player1_misc.debuff_uptime_spells and player1_misc.debuff_uptime_spells._ActorTable and player1_misc.debuff_uptime_spells._ActorTable [spellid]
|
||||
if (spell) then
|
||||
local minutos, segundos = _math_floor (spell.uptime/60), _math_floor (spell.uptime%60)
|
||||
@@ -2369,6 +2381,29 @@ function gump:CriaJanelaInfo()
|
||||
else
|
||||
frame1.tooltip.uptime_label2:SetText ("--x--x--")
|
||||
end
|
||||
|
||||
--total casts
|
||||
local amt_casts = player1_misc.spell_cast and player1_misc.spell_cast [spellid]
|
||||
if (amt_casts) then
|
||||
frame1.tooltip.casts_label2:SetText (amt_casts)
|
||||
player1_casts = amt_casts
|
||||
else
|
||||
local spellname = GetSpellInfo (spellid)
|
||||
local extra_search_found
|
||||
for casted_spellid, amount in _pairs (player1_misc.spell_cast) do
|
||||
local casted_spellname = GetSpellInfo (casted_spellid)
|
||||
if (casted_spellname == spellname) then
|
||||
frame1.tooltip.casts_label2:SetText (amount)
|
||||
player1_casts = amount
|
||||
extra_search_found = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if (not extra_search_found) then
|
||||
frame1.tooltip.casts_label2:SetText ("?")
|
||||
end
|
||||
end
|
||||
else
|
||||
frame1.tooltip.uptime_label2:SetText ("--x--x--")
|
||||
end
|
||||
@@ -2436,6 +2471,8 @@ function gump:CriaJanelaInfo()
|
||||
end
|
||||
|
||||
if (player2_misc) then
|
||||
|
||||
--uptime
|
||||
local spell = player2_misc.debuff_uptime_spells and player2_misc.debuff_uptime_spells._ActorTable and player2_misc.debuff_uptime_spells._ActorTable [spellid]
|
||||
if (spell and spell.uptime) then
|
||||
local minutos, segundos = _math_floor (spell.uptime/60), _math_floor (spell.uptime%60)
|
||||
@@ -2463,8 +2500,47 @@ function gump:CriaJanelaInfo()
|
||||
else
|
||||
frame2.tooltip.uptime_label2:SetText ("--x--x--")
|
||||
end
|
||||
|
||||
--total casts
|
||||
local amt_casts = player2_misc.spell_cast and player2_misc.spell_cast [spellid]
|
||||
if (not amt_casts) then
|
||||
local spellname = GetSpellInfo (spellid)
|
||||
for casted_spellid, amount in _pairs (player2_misc.spell_cast) do
|
||||
local casted_spellname = GetSpellInfo (casted_spellid)
|
||||
if (casted_spellname == spellname) then
|
||||
amt_casts = amount
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (amt_casts) then
|
||||
|
||||
if (not player1_casts) then
|
||||
frame2.tooltip.casts_label2:SetText (amt_casts)
|
||||
elseif (player1_casts > amt_casts) then
|
||||
local diff = player1_casts - amt_casts
|
||||
local up = diff / amt_casts * 100
|
||||
up = _math_floor (up)
|
||||
if (up > 999) then
|
||||
up = ">" .. 999
|
||||
end
|
||||
frame2.tooltip.casts_label2:SetText (amt_casts .. " |c" .. minor .. up .. "%)|r")
|
||||
else
|
||||
local diff = amt_casts - player1_casts
|
||||
local down = diff / player1_casts * 100
|
||||
down = _math_floor (down)
|
||||
if (down > 999) then
|
||||
down = ">" .. 999
|
||||
end
|
||||
frame2.tooltip.casts_label2:SetText (amt_casts .. " |c" .. plus .. down .. "%)|r")
|
||||
end
|
||||
else
|
||||
frame2.tooltip.casts_label2:SetText ("?")
|
||||
end
|
||||
else
|
||||
frame2.tooltip.uptime_label2:SetText ("--x--x--")
|
||||
|
||||
end
|
||||
|
||||
frame2.tooltip:Show()
|
||||
@@ -2531,6 +2607,8 @@ function gump:CriaJanelaInfo()
|
||||
end
|
||||
|
||||
if (player3_misc) then
|
||||
|
||||
--uptime
|
||||
local spell = player3_misc.debuff_uptime_spells and player3_misc.debuff_uptime_spells._ActorTable and player3_misc.debuff_uptime_spells._ActorTable [spellid]
|
||||
if (spell and spell.uptime) then
|
||||
local minutos, segundos = _math_floor (spell.uptime/60), _math_floor (spell.uptime%60)
|
||||
@@ -2558,6 +2636,45 @@ function gump:CriaJanelaInfo()
|
||||
else
|
||||
frame3.tooltip.uptime_label2:SetText ("--x--x--")
|
||||
end
|
||||
|
||||
--total casts
|
||||
local amt_casts = player3_misc.spell_cast and player3_misc.spell_cast [spellid]
|
||||
if (not amt_casts) then
|
||||
local spellname = GetSpellInfo (spellid)
|
||||
for casted_spellid, amount in _pairs (player3_misc.spell_cast) do
|
||||
local casted_spellname = GetSpellInfo (casted_spellid)
|
||||
if (casted_spellname == spellname) then
|
||||
amt_casts = amount
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (amt_casts) then
|
||||
|
||||
if (not player1_casts) then
|
||||
frame3.tooltip.casts_label2:SetText (amt_casts)
|
||||
elseif (player1_casts > amt_casts) then
|
||||
local diff = player1_casts - amt_casts
|
||||
local up = diff / amt_casts * 100
|
||||
up = _math_floor (up)
|
||||
if (up > 999) then
|
||||
up = ">" .. 999
|
||||
end
|
||||
frame3.tooltip.casts_label2:SetText (amt_casts .. " |c" .. minor .. up .. "%)|r")
|
||||
else
|
||||
local diff = amt_casts - player1_casts
|
||||
local down = diff / player1_casts * 100
|
||||
down = _math_floor (down)
|
||||
if (down > 999) then
|
||||
down = ">" .. 999
|
||||
end
|
||||
frame3.tooltip.casts_label2:SetText (amt_casts .. " |c" .. plus .. down .. "%)|r")
|
||||
end
|
||||
else
|
||||
frame3.tooltip.casts_label2:SetText ("?")
|
||||
end
|
||||
|
||||
else
|
||||
frame3.tooltip.uptime_label2:SetText ("--x--x--")
|
||||
end
|
||||
@@ -2706,57 +2823,28 @@ function gump:CriaJanelaInfo()
|
||||
tooltip.uptime_label2:SetJustifyH ("right")
|
||||
|
||||
local bg_color = {0.5, 0.5, 0.5}
|
||||
local bg_texture = [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]]
|
||||
local bg_alpha = 0.3
|
||||
local bg_height = 20
|
||||
local bg_texture = [[Interface\AddOns\Details\images\bar_background]]
|
||||
local bg_alpha = 1
|
||||
local bg_height = 12
|
||||
local colors = {{26/255, 26/255, 26/255}, {19/255, 19/255, 19/255}, {26/255, 26/255, 26/255}, {34/255, 39/255, 42/255}, {42/255, 51/255, 60/255}}
|
||||
|
||||
local bg_line1 = tooltip:CreateTexture (nil, "artwork")
|
||||
bg_line1:SetTexture (bg_texture)
|
||||
bg_line1:SetPoint ("topleft", tooltip, "topleft", 5, -10)
|
||||
bg_line1:SetPoint ("topright", tooltip, "topright", -5, -10)
|
||||
bg_line1:SetHeight (bg_height)
|
||||
bg_line1:SetAlpha (bg_alpha)
|
||||
bg_line1:SetVertexColor (unpack (bg_color))
|
||||
|
||||
local bg_line2 = tooltip:CreateTexture (nil, "artwork")
|
||||
bg_line2:SetTexture (bg_texture)
|
||||
bg_line2:SetPoint ("topleft", tooltip, "topleft", 5, -22)
|
||||
bg_line2:SetPoint ("topright", tooltip, "topright", -5, -22)
|
||||
bg_line2:SetHeight (bg_height)
|
||||
bg_line2:SetAlpha (bg_alpha)
|
||||
bg_line2:SetVertexColor (unpack (bg_color))
|
||||
|
||||
local bg_line3 = tooltip:CreateTexture (nil, "artwork")
|
||||
bg_line3:SetTexture (bg_texture)
|
||||
bg_line3:SetPoint ("topleft", tooltip, "topleft", 5, -34)
|
||||
bg_line3:SetPoint ("topright", tooltip, "topright", -5, -34)
|
||||
bg_line3:SetHeight (bg_height)
|
||||
bg_line3:SetAlpha (bg_alpha)
|
||||
bg_line3:SetVertexColor (unpack (bg_color))
|
||||
|
||||
local bg_line4 = tooltip:CreateTexture (nil, "artwork")
|
||||
bg_line4:SetTexture (bg_texture)
|
||||
bg_line4:SetPoint ("topleft", tooltip, "topleft", 5, -46)
|
||||
bg_line4:SetPoint ("topright", tooltip, "topright", -5, -46)
|
||||
bg_line4:SetHeight (bg_height)
|
||||
bg_line4:SetAlpha (bg_alpha)
|
||||
bg_line4:SetVertexColor (unpack (bg_color))
|
||||
|
||||
local bg_line5 = tooltip:CreateTexture (nil, "artwork")
|
||||
bg_line5:SetTexture (bg_texture)
|
||||
bg_line5:SetPoint ("topleft", tooltip, "topleft", 5, -56)
|
||||
bg_line5:SetPoint ("topright", tooltip, "topright", -5, -56)
|
||||
bg_line5:SetHeight (bg_height)
|
||||
bg_line5:SetAlpha (bg_alpha)
|
||||
bg_line5:SetVertexColor (unpack (bg_color))
|
||||
for i = 1, 5 do
|
||||
local bg_line1 = tooltip:CreateTexture (nil, "artwork")
|
||||
bg_line1:SetTexture (bg_texture)
|
||||
bg_line1:SetPoint ("topleft", tooltip, "topleft", 5, -9 + (((i-1) * 12) * -1))
|
||||
bg_line1:SetPoint ("topright", tooltip, "topright", -5, -9 + (((i-1) * 12) * -1))
|
||||
bg_line1:SetHeight (bg_height)
|
||||
bg_line1:SetAlpha (bg_alpha)
|
||||
bg_line1:SetVertexColor (unpack (colors[i]))
|
||||
end
|
||||
|
||||
return tooltip
|
||||
end
|
||||
|
||||
local create_tooltip_target = function (name)
|
||||
local tooltip = CreateFrame ("frame", name, UIParent)
|
||||
tooltip:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], tile = true, tileSize = 16, edgeSize = 12, insets = {left = 1, right = 1, top = 1, bottom = 1},})
|
||||
tooltip:SetBackdropColor (0, 0, 0, 1)
|
||||
tooltip:SetBackdrop (_detalhes.tooltip_backdrop)
|
||||
tooltip:SetBackdropColor (unpack (_detalhes.tooltip_border_color))
|
||||
tooltip:SetSize (175, 67)
|
||||
tooltip:SetFrameStrata ("tooltip")
|
||||
tooltip.bars = {}
|
||||
@@ -2767,9 +2855,12 @@ function gump:CriaJanelaInfo()
|
||||
bar [2].lefttext:SetText ("")
|
||||
bar [2].righttext:SetText ("")
|
||||
bar [2]:SetValue (0)
|
||||
bar [2].bg:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local bars_colors = {{19/255, 19/255, 19/255}, {26/255, 26/255, 26/255}}
|
||||
|
||||
function tooltip:CreateBar (index)
|
||||
|
||||
if (index) then
|
||||
@@ -2794,7 +2885,7 @@ function gump:CriaJanelaInfo()
|
||||
bar:SetPoint ("topleft", spellicon, "topright", 0, 0)
|
||||
bar:SetPoint ("topright", parent, "topright", -4, y)
|
||||
bar:SetStatusBarTexture ([[Interface\AddOns\Details\images\bar_serenity]])
|
||||
bar:SetStatusBarColor (.5, .5, .5, 1)
|
||||
bar:SetStatusBarColor (.68, .68, .68, 1)
|
||||
bar:SetMinMaxValues (0, 100)
|
||||
bar:SetValue (0)
|
||||
bar:SetHeight (14)
|
||||
@@ -2824,6 +2915,17 @@ function gump:CriaJanelaInfo()
|
||||
bar.righttext:SetJustifyH ("right")
|
||||
bar.righttext:SetTextColor (1, 1, 1, 1)
|
||||
|
||||
local bg_line1 = bar:CreateTexture (nil, "artwork")
|
||||
bg_line1:SetTexture ([[Interface\AddOns\Details\images\bar_background]])
|
||||
bg_line1:SetAllPoints()
|
||||
bg_line1:SetAlpha (0.7)
|
||||
if (index % 2 == 0) then
|
||||
bg_line1:SetVertexColor (_unpack (bars_colors [2]))
|
||||
else
|
||||
bg_line1:SetVertexColor (_unpack (bars_colors [2]))
|
||||
end
|
||||
bar.bg = bg_line1
|
||||
|
||||
local object = {spellicon, bar}
|
||||
tinsert (tooltip.bars, object)
|
||||
return object
|
||||
|
||||
Binary file not shown.
@@ -1,627 +0,0 @@
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> init the plugin
|
||||
|
||||
--> localization
|
||||
local Loc = LibStub ("AceLocale-3.0"):GetLocale ("Details_YouAreNotPrepared")
|
||||
--> create the plugin object
|
||||
local YouAreNotPrepared = _detalhes:NewPluginObject ("Details_YouAreNotPrepared", DETAILSPLUGIN_ALWAYSENABLED)
|
||||
tinsert (UISpecialFrames, "Details_YouAreNotPrepared")
|
||||
--> main frame (shortcut)
|
||||
local YouAreNotPreparedFrame = YouAreNotPrepared.Frame
|
||||
|
||||
local debugmode = false
|
||||
|
||||
YouAreNotPrepared:SetPluginDescription ("Tracks your deaths during raid encounters and shows it for you right after the fight end.")
|
||||
YouAreNotPrepared.version = "v1.1.3"
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> init the frames
|
||||
|
||||
local function CreatePluginFrames()
|
||||
|
||||
--> catch Details! main object
|
||||
local _detalhes = _G._detalhes
|
||||
local DetailsFrameWork = _detalhes.gump
|
||||
|
||||
local GameCooltip = GameCooltip
|
||||
local _GetSpellInfo = _detalhes.getspellinfo
|
||||
|
||||
YouAreNotPrepared.last_death_combat_id = -1
|
||||
|
||||
---------- event parser -------------
|
||||
function YouAreNotPrepared:OnDetailsEvent (event, ...)
|
||||
if (event == "HIDE") then --> plugin hidded, disabled
|
||||
self.open = false
|
||||
|
||||
elseif (event == "SHOW") then --> plugin hidded, disabled
|
||||
self.open = true
|
||||
|
||||
elseif (event == "COMBAT_PLAYER_ENTER") then --> combat started
|
||||
|
||||
elseif (event == "COMBAT_PLAYER_LEAVE") then --> combat ended
|
||||
YouAreNotPrepared:EndCombat()
|
||||
|
||||
elseif (event == "DETAILS_DATA_RESET") then
|
||||
table.wipe (YouAreNotPrepared.db.deaths_table)
|
||||
YouAreNotPrepared:Clear()
|
||||
|
||||
elseif (event == "PLUGIN_DISABLED") then
|
||||
table.wipe (YouAreNotPrepared.db.deaths_table)
|
||||
YouAreNotPrepared:Clear()
|
||||
YouAreNotPreparedFrame:Hide()
|
||||
|
||||
elseif (event == "PLUGIN_ENABLED") then
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
---------- build frames -------------
|
||||
|
||||
local BAR_HEIGHT = 13
|
||||
local BAR_AMOUNT = 10
|
||||
local BUTTON_AMOUNT = 6
|
||||
|
||||
function YouAreNotPrepared:Clear()
|
||||
table.wipe (YouAreNotPrepared.db.deaths_table)
|
||||
|
||||
for i = 1, BUTTON_AMOUNT do
|
||||
local button = YouAreNotPrepared.buttons [i]
|
||||
button:Disable()
|
||||
button.widget.b_texture:SetDesaturated (true)
|
||||
button.lefttext.text = "#" .. i
|
||||
end
|
||||
|
||||
for bar_index = 1, BAR_AMOUNT do
|
||||
YouAreNotPrepared.container_bars.bars [bar_index]:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
--main frame
|
||||
YouAreNotPreparedFrame:SetSize (424, 223)
|
||||
YouAreNotPreparedFrame:SetPoint ("center", UIParent, "center")
|
||||
YouAreNotPreparedFrame:EnableMouse (true)
|
||||
YouAreNotPreparedFrame:SetResizable (false)
|
||||
YouAreNotPreparedFrame:SetMovable (true)
|
||||
|
||||
YouAreNotPreparedFrame:SetScript ("OnMouseUp", function (self, button)
|
||||
if (button == "RightButton") then
|
||||
YouAreNotPrepared.db.rightclick_closed = true
|
||||
YouAreNotPreparedFrame:Hide()
|
||||
else
|
||||
if (YouAreNotPreparedFrame.isMoving) then
|
||||
YouAreNotPreparedFrame:StopMovingOrSizing()
|
||||
YouAreNotPreparedFrame.isMoving = false
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
YouAreNotPreparedFrame:SetScript ("OnMouseDown", function (self, button)
|
||||
if (button == "LeftButton") then
|
||||
if (not YouAreNotPreparedFrame.isMoving) then
|
||||
YouAreNotPreparedFrame:StartMoving()
|
||||
YouAreNotPreparedFrame.isMoving = true
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
--close button
|
||||
local c = CreateFrame ("Button", nil, YouAreNotPreparedFrame, "UIPanelCloseButton")
|
||||
c:SetWidth (32)
|
||||
c:SetHeight (32)
|
||||
c:SetPoint ("TOPRIGHT", YouAreNotPreparedFrame, "TOPRIGHT", 1, -15)
|
||||
c:SetFrameLevel (YouAreNotPreparedFrame:GetFrameLevel()+1)
|
||||
|
||||
--background image
|
||||
local b = DetailsFrameWork:NewImage (YouAreNotPreparedFrame, [[Interface\AddOns\Details_YouAreNotPrepared\background]], 512, 256, "background", nil, nil, "$parentBackground")
|
||||
b:SetPoint ("topleft", YouAreNotPreparedFrame, "topleft")
|
||||
|
||||
--title
|
||||
local t = DetailsFrameWork:NewLabel (YouAreNotPreparedFrame, nil, "$parentTitle", nil, Loc ["STRING_PLUGIN_NAME"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
|
||||
|
||||
t:SetPoint ("top", YouAreNotPreparedFrame, "top", 20, -26)
|
||||
t:SetPoint ("center", YouAreNotPreparedFrame, "center", 0, 0)
|
||||
|
||||
local on_mouse_down = function (self, button)
|
||||
if (button == "RightButton" and not YouAreNotPreparedFrame.isMoving) then
|
||||
YouAreNotPrepared.db.rightclick_closed = true
|
||||
YouAreNotPreparedFrame:Hide()
|
||||
else
|
||||
if (not YouAreNotPreparedFrame.isMoving) then
|
||||
YouAreNotPreparedFrame:StartMoving()
|
||||
YouAreNotPreparedFrame.isMoving = true
|
||||
end
|
||||
end
|
||||
end
|
||||
local on_mouse_up = function (self, button)
|
||||
if (YouAreNotPreparedFrame.isMoving) then
|
||||
YouAreNotPreparedFrame:StopMovingOrSizing()
|
||||
YouAreNotPreparedFrame.isMoving = false
|
||||
end
|
||||
end
|
||||
|
||||
--bar container
|
||||
local container_bars = CreateFrame ("frame", "Details_YouAreNotPrepared_FauxScroll_Box", YouAreNotPreparedFrame)
|
||||
container_bars:SetPoint ("topleft", YouAreNotPreparedFrame, "topleft", 23, -80)
|
||||
container_bars:SetSize (252, 137)
|
||||
container_bars:SetBackdrop ({bgFile = "Interface\\AddOns\\Details\\images\\background", tile = true, tileSize = 16,
|
||||
insets = {left = 0, right = 0, top = 0, bottom = 0}})
|
||||
container_bars:SetBackdropColor (.1, .1, .1, .2)
|
||||
YouAreNotPrepared.container_bars = container_bars
|
||||
|
||||
container_bars:SetScript ("OnMouseDown", on_mouse_down)
|
||||
container_bars:SetScript ("OnMouseUp", on_mouse_up)
|
||||
|
||||
container_bars.bars = {}
|
||||
|
||||
local MouseDownCloseHook = function (_, button)
|
||||
if (button == "RightButton") then
|
||||
YouAreNotPrepared.db.rightclick_closed = true
|
||||
YouAreNotPreparedFrame:Hide()
|
||||
return true --> interrupt hook
|
||||
end
|
||||
end
|
||||
|
||||
local on_enter_bar = function (self)
|
||||
if (self.MyObject.spellid) then
|
||||
GameTooltip:SetOwner (self, "ANCHOR_TOPLEFT")
|
||||
GameTooltip:SetSpellByID (self.MyObject.spellid)
|
||||
GameTooltip:Show()
|
||||
end
|
||||
end
|
||||
local on_leave_bar = function (self)
|
||||
GameTooltip:Hide()
|
||||
end
|
||||
|
||||
function container_bars:CreateChild()
|
||||
|
||||
local bar_number = #self.bars + 1
|
||||
|
||||
local bar = DetailsFrameWork:NewPanel (self, YouAreNotPreparedFrame, "$parentBar" .. bar_number, nil, 250, BAR_HEIGHT)
|
||||
bar:SetPoint ("topleft", self, "topleft", 1, bar_number*13*-1+9)
|
||||
bar:SetHook ("OnMouseDown", MouseDownCloseHook)
|
||||
bar.locked = false
|
||||
bar.backdrop = nil
|
||||
bar.hide = true
|
||||
|
||||
local statusbar = DetailsFrameWork:NewBar (bar, nil, "$parentStatusbar", "statusbar", 250, BAR_HEIGHT)
|
||||
statusbar:SetPoint ("left", bar, "left")
|
||||
statusbar.fontsize = 9
|
||||
statusbar.textleft:SetHeight (16)
|
||||
YouAreNotPrepared:SetFontFace (statusbar.textleft, "GameFontHighlightSmall")
|
||||
YouAreNotPrepared:SetFontFace (statusbar.textleft, "GameFontNormal")
|
||||
|
||||
statusbar:SetHook ("OnEnter", on_enter_bar)
|
||||
statusbar:SetHook ("OnLeave", on_leave_bar)
|
||||
statusbar:SetHook ("OnMouseDown", on_mouse_down)
|
||||
statusbar:SetHook ("OnMouseUp", on_mouse_up)
|
||||
|
||||
bar:SetHook ("OnMouseDown", on_mouse_down)
|
||||
bar:SetHook ("OnMouseUp", on_mouse_up)
|
||||
|
||||
container_bars.bars [bar_number] = bar
|
||||
|
||||
return bar
|
||||
end
|
||||
|
||||
function container_bars:UpdateChild (bar_number, data, time_of_death, max_health)
|
||||
|
||||
--> death parser
|
||||
|
||||
local spellname, _, icon = _GetSpellInfo (data[2])
|
||||
local bar = container_bars.bars [bar_number]
|
||||
|
||||
if (spellname) then
|
||||
|
||||
local hp = math.floor (data[5] / max_health * 100)
|
||||
if (hp > 100) then
|
||||
hp = 100
|
||||
end
|
||||
|
||||
if (data[1] and type (data [1]) == "boolean") then --> damage
|
||||
bar.statusbar.textleft:SetText (string.format ("%.1f", data [4] - time_of_death) .. "s " .. spellname .. " (" .. data [6] .. ")")
|
||||
bar.statusbar.textright:SetText ("-" .. YouAreNotPrepared:ToK (data [3]) .. " (" .. hp .. "%)")
|
||||
bar.statusbar._icon:SetTexture (icon)
|
||||
if (data [9]) then
|
||||
bar.statusbar.color = "darkorange"
|
||||
else
|
||||
bar.statusbar.color = "red"
|
||||
end
|
||||
bar.statusbar.background:SetVertexColor (1, 0, 0, .2)
|
||||
bar.statusbar.textleft:SetWidth (250 - bar.statusbar.textright:GetStringWidth() - 20)
|
||||
bar.statusbar.value = hp
|
||||
bar.statusbar.spellid = data[2]
|
||||
return true
|
||||
|
||||
elseif (not data[1] and type (data [1]) == "boolean") then --> healing
|
||||
bar.statusbar.textleft:SetText (string.format ("%.1f", data [4] - time_of_death) .. "s " .. spellname .. " (" .. data [6] .. ")")
|
||||
bar.statusbar.textright:SetText ("+" .. YouAreNotPrepared:ToK (data [3]) .. " (" .. hp .. "%)")
|
||||
bar.statusbar._icon:SetTexture (icon)
|
||||
bar.statusbar.color = "green"
|
||||
bar.statusbar.background:SetVertexColor (0, 1, 0, .2)
|
||||
bar.statusbar.textleft:SetWidth (250 - bar.statusbar.textright:GetStringWidth() - 20)
|
||||
bar.statusbar.value = hp
|
||||
bar.statusbar.spellid = data[2]
|
||||
return true
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
--create 10 childs (bars)
|
||||
for i = 1, 10 do
|
||||
container_bars:CreateChild()
|
||||
end
|
||||
|
||||
--create scrollbar
|
||||
|
||||
local refresh_function = function (self)
|
||||
local offset = FauxScrollFrame_GetOffset (self)
|
||||
|
||||
for bar_index = 1, BAR_AMOUNT do
|
||||
local data = YouAreNotPrepared.s_table[4] [bar_index + offset] --bar_index + offset ---------- preciso pegar os dados de uma pool
|
||||
|
||||
if (data) then
|
||||
local successful = container_bars:UpdateChild (bar_index, data, YouAreNotPrepared.s_table[6], YouAreNotPrepared.s_table[5]) --index, death table, clock time of death, max health
|
||||
if (not successful) then
|
||||
container_bars.bars [bar_index]:Hide()
|
||||
else
|
||||
container_bars.bars [bar_index]:Show()
|
||||
end
|
||||
else
|
||||
container_bars.bars [bar_index]:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local scrollbar = CreateFrame ("scrollframe", "Details_YouAreNotPrepared_FauxScroll", container_bars, "FauxScrollFrameTemplate")
|
||||
scrollbar:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, BAR_HEIGHT, refresh_function) end)
|
||||
scrollbar:SetPoint ("topleft", YouAreNotPreparedFrame, "topleft", 23, -80)
|
||||
scrollbar:SetSize (250, 138)
|
||||
scrollbar:SetScript ("OnMouseDown", function (self, button)
|
||||
if (button == "RightButton" and not YouAreNotPreparedFrame.isMoving) then
|
||||
YouAreNotPrepared.db.rightclick_closed = true
|
||||
YouAreNotPreparedFrame:Hide()
|
||||
else
|
||||
if (not YouAreNotPreparedFrame.isMoving) then
|
||||
YouAreNotPreparedFrame:StartMoving()
|
||||
YouAreNotPreparedFrame.isMoving = true
|
||||
end
|
||||
end
|
||||
end)
|
||||
scrollbar:SetScript ("OnMouseUp", function (self, button)
|
||||
if (button == "LeftButton") then
|
||||
if (YouAreNotPreparedFrame.isMoving) then
|
||||
YouAreNotPreparedFrame:StopMovingOrSizing()
|
||||
YouAreNotPreparedFrame.isMoving = false
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
container_bars:EnableMouse (true)
|
||||
|
||||
--choose death menu
|
||||
|
||||
YouAreNotPrepared.buttons = {}
|
||||
|
||||
local select_death = function (selected)
|
||||
YouAreNotPrepared.s_table = YouAreNotPrepared.db.deaths_table [selected]
|
||||
if (not YouAreNotPrepared.s_table) then
|
||||
return
|
||||
end
|
||||
FauxScrollFrame_Update (scrollbar, #YouAreNotPrepared.s_table[4], BAR_AMOUNT, BAR_HEIGHT)
|
||||
refresh_function (scrollbar)
|
||||
end
|
||||
YouAreNotPrepared.select_death = select_death
|
||||
|
||||
function YouAreNotPrepared:CreateDeathButton()
|
||||
local button_number = #self.buttons + 1
|
||||
|
||||
local button = DetailsFrameWork:NewButton (YouAreNotPreparedFrame, _, "$parentButton" .. button_number, nil, 113, 20, select_death, button_number)
|
||||
button:SetPoint ("topleft", YouAreNotPreparedFrame, "topleft", 300, -59 + (button_number*23*-1))
|
||||
button:Disable()
|
||||
|
||||
local b_texture = button:CreateTexture (nil, "artwork")
|
||||
b_texture:SetTexture ([[Interface\AddOns\Details\images\icons]])
|
||||
b_texture:SetTexCoord (0.297851, 0.444335, 0.004882, 0.040039) --152 228 2 21 0.0009765625
|
||||
b_texture:SetPoint ("topleft", button.widget, "topleft")
|
||||
b_texture:SetSize (113, 20)
|
||||
b_texture:SetDesaturated (true)
|
||||
button.widget.b_texture = b_texture
|
||||
|
||||
local icon = DetailsFrameWork:NewImage (button, nil, 20, 20, nil, nil, "icon", "$parentIcon")
|
||||
icon:SetTexCoord (0, 0.4921875, 0, 0.4921875) --0.0078125
|
||||
icon:SetPoint ("left", button, "left", 1, 0)
|
||||
icon.texture = [[Interface\WorldStateFrame\SkullBones]]
|
||||
icon:SetBlendMode ("ADD")
|
||||
icon:SetAlpha (.5)
|
||||
|
||||
button:SetHook ("OnMouseDown", function (self, button)
|
||||
self.b_texture:SetPoint ("topleft", self, "topleft", 1, -1)
|
||||
--self.MyObject.lefttext:SetPoint ("left", self.MyObject.icon, "right", 2, 0)
|
||||
self.MyObject.icon:SetPoint ("left", self, "left", 2, -1)
|
||||
end)
|
||||
button:SetHook ("OnMouseUp", function (self, button)
|
||||
self.b_texture:SetPoint ("topleft", self, "topleft")
|
||||
--self.MyObject.lefttext:SetPoint ("left", self.MyObject.icon, "right", 2, 0)
|
||||
self.MyObject.icon:SetPoint ("left", self, "left", 1, 0)
|
||||
end)
|
||||
button:SetHook ("OnEnter", function (self, button)
|
||||
self.b_texture:SetBlendMode ("ADD")
|
||||
end)
|
||||
button:SetHook ("OnLeave", function (self, button)
|
||||
self.b_texture:SetBlendMode ("BLEND")
|
||||
end)
|
||||
|
||||
local lefttext = DetailsFrameWork:NewLabel (button, nil, "$parentLeftText", "lefttext", "", "GameFontHighlightSmall", 9)
|
||||
lefttext:SetPoint ("left", icon, "right", 2)
|
||||
lefttext.width = 80
|
||||
lefttext.height = 13
|
||||
|
||||
local righttext = DetailsFrameWork:NewLabel (button, nil, "$parentRightText", "righttext", " ", "GameFontHighlightSmall", 9)
|
||||
righttext:SetPoint ("right", button, "right", -1)
|
||||
|
||||
YouAreNotPrepared.buttons [button_number] = button
|
||||
|
||||
return bar
|
||||
end
|
||||
|
||||
for i = 1, 6 do
|
||||
YouAreNotPrepared:CreateDeathButton()
|
||||
end
|
||||
|
||||
function YouAreNotPrepared:AddDeath (t)
|
||||
|
||||
--> t = [1] = enemy name [2] = time of death [3] = last cooldown [4] = death table [5] = max health [6] = clock time of the death
|
||||
|
||||
--add and remove
|
||||
table.insert (YouAreNotPrepared.db.deaths_table, 1, t)
|
||||
table.remove (YouAreNotPrepared.db.deaths_table, 7)
|
||||
|
||||
--update buttons
|
||||
for i = 1, 6 do
|
||||
local button = YouAreNotPrepared.buttons [i]
|
||||
local death_table = YouAreNotPrepared.db.deaths_table [i]
|
||||
if (death_table) then
|
||||
button:Enable()
|
||||
button.widget.b_texture:SetDesaturated (false)
|
||||
button.lefttext.text = "#" .. i .. " " .. death_table [1]
|
||||
else
|
||||
button:Disable()
|
||||
button.widget.b_texture:SetDesaturated (true)
|
||||
button.lefttext.text = "#" .. i
|
||||
end
|
||||
end
|
||||
|
||||
YouAreNotPrepared:DeathWarning()
|
||||
end
|
||||
|
||||
function YouAreNotPrepared:UpdateButtons()
|
||||
for i = 1, 6 do
|
||||
local button = YouAreNotPrepared.buttons [i]
|
||||
local death_table = YouAreNotPrepared.db.deaths_table [i]
|
||||
if (death_table) then
|
||||
button:Enable()
|
||||
button.widget.b_texture:SetDesaturated (false)
|
||||
button.lefttext.text = "#" .. i .. " " .. death_table [1]
|
||||
else
|
||||
button:Disable()
|
||||
button.widget.b_texture:SetDesaturated (true)
|
||||
button.lefttext.text = "#" .. i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function YouAreNotPrepared:ShowMe() --> used for debug
|
||||
YouAreNotPreparedFrame:Show()
|
||||
|
||||
YouAreNotPrepared:UpdateButtons()
|
||||
|
||||
_detalhes:InstanceAlert (Loc ["STRING_PLUGIN_ALERT"], {[[Interface\ICONS\Achievement_Boss_Illidan]], 14, 14, false, 0.8984375, 0.0546875, 0.0546875, 0.8984375}, YouAreNotPrepared.db.shown_time, {YouAreNotPrepared.ShowMeFromInstanceAlert})
|
||||
end
|
||||
|
||||
--auto open box
|
||||
local autoopen_checkbox = CreateFrame ("CheckButton", "YANP_AutoOpenCheckBox", YouAreNotPreparedFrame, "ChatConfigCheckButtonTemplate")
|
||||
autoopen_checkbox:SetPoint ("bottomleft", container_bars, "topleft", 45, -1)
|
||||
local text = _G ["YANP_AutoOpenCheckBoxText"]
|
||||
text:SetText ("Auto Open")
|
||||
autoopen_checkbox:SetFrameLevel (YouAreNotPreparedFrame:GetFrameLevel()+5)
|
||||
--YouAreNotPrepared:SetFontSize (text, 10)
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint ("left", autoopen_checkbox, "right", -2, 1)
|
||||
--checkbox.tooltip = Loc ["STRING_REPORTFRAME_CURRENTINFO"]
|
||||
autoopen_checkbox:SetHitRectInsets (0, -60, 0, 0)
|
||||
autoopen_checkbox:SetScript ("PostClick", function(self)
|
||||
if (self:GetChecked()) then
|
||||
YouAreNotPrepared.db.auto_open = true
|
||||
else
|
||||
YouAreNotPrepared.db.auto_open = false
|
||||
end
|
||||
end)
|
||||
YouAreNotPrepared:SetFontColor (text, "greenyellow")
|
||||
|
||||
--> open options
|
||||
local options_button = CreateFrame ("button", nil, YouAreNotPreparedFrame)
|
||||
options_button:SetPoint ("left", text, "right", 2, 0)
|
||||
options_button:SetSize (18, 18)
|
||||
options_button:SetAlpha (0.8)
|
||||
options_button:SetNormalTexture ([[Interface\Buttons\UI-OptionsButton]])
|
||||
options_button:SetHighlightTexture ([[Interface\Buttons\UI-OptionsButton]])
|
||||
options_button:SetPushedTexture ([[Interface\Buttons\UI-OptionsButton]])
|
||||
options_button:SetScript ("OnClick", YouAreNotPrepared.OpenOptionsPanel)
|
||||
local right_text = YouAreNotPrepared.gump:CreateLabel (YouAreNotPreparedFrame, "Options", nil, "greenyellow", "GameFontHighlight", "optionstext", "$parentOptionsText")
|
||||
right_text:SetPoint ("left", options_button, "right", 2, 0)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> functions
|
||||
|
||||
function YouAreNotPrepared:ShowMeFromInstanceAlert()
|
||||
YouAreNotPreparedFrame:Show()
|
||||
YouAreNotPrepared.select_death (1)
|
||||
YouAreNotPrepared:UpdateButtons()
|
||||
_detalhes:InstanceAlert (false)
|
||||
end
|
||||
|
||||
function YouAreNotPrepared:DeathWarning()
|
||||
_detalhes:InstanceAlert (Loc ["STRING_PLUGIN_ALERT"], {[[Interface\ICONS\Achievement_Boss_Illidan]], 14, 14, false, 0.8984375, 0.0546875, 0.0546875, 0.8984375} , 15, {YouAreNotPrepared.ShowMeFromInstanceAlert})
|
||||
end
|
||||
|
||||
function YouAreNotPrepared:EndCombat()
|
||||
if (YouAreNotPrepared.last_death_combat_id == YouAreNotPrepared.combat_counter) then
|
||||
if (YouAreNotPrepared.db.auto_open) then
|
||||
YouAreNotPrepared.ShowMeFromInstanceAlert()
|
||||
else
|
||||
_detalhes:InstanceAlert (Loc ["STRING_PLUGIN_ALERT"], {[[Interface\ICONS\Achievement_Boss_Illidan]], 14, 14, false, 0.8984375, 0.0546875, 0.0546875, 0.8984375} , 25, {YouAreNotPrepared.ShowMeFromInstanceAlert})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function YouAreNotPrepared:OnDeath (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, death_table, last_cooldown, time_of_death, max_health)
|
||||
--> hooks run inside parser and do not check if the plugin is enabled or not.
|
||||
--> we need to check this here before continue.
|
||||
if (not YouAreNotPrepared.__enabled) then
|
||||
return
|
||||
end
|
||||
|
||||
if (alvo_name == YouAreNotPrepared.playername) then
|
||||
local combat = YouAreNotPrepared:GetCombat ("current")
|
||||
|
||||
--> store death
|
||||
local d = YouAreNotPrepared:reverse_table (death_table)
|
||||
death_table = d
|
||||
|
||||
if (combat.is_boss) then --> encounter or pvp
|
||||
YouAreNotPrepared.last_death_combat_id = YouAreNotPrepared.combat_counter
|
||||
return YouAreNotPrepared:AddDeath ({combat.is_boss.name or combat.enemy or "Unknown", time_of_death, last_cooldown, death_table, max_health, time})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local build_options_panel = function()
|
||||
local options_frame = CreateFrame ("frame", "YouAreNotPreparedOptionsWindow", UIParent, "ButtonFrameTemplate")
|
||||
tinsert (UISpecialFrames, "YouAreNotPreparedOptionsWindow")
|
||||
options_frame:SetSize (500, 200)
|
||||
options_frame:SetFrameStrata ("DIALOG")
|
||||
options_frame:SetScript ("OnMouseDown", function(self) self:StartMoving()end)
|
||||
options_frame:SetScript ("OnMouseUp", function(self) self:StopMovingOrSizing()end)
|
||||
options_frame:SetMovable (true)
|
||||
options_frame:EnableMouse (true)
|
||||
options_frame:Hide()
|
||||
options_frame:SetPoint ("center", UIParent, "center")
|
||||
options_frame.TitleText:SetText ("You Are Not Prepared Options")
|
||||
options_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-BLOODELF]])
|
||||
|
||||
local menu = {
|
||||
--show when dropdown
|
||||
{
|
||||
type = "range",
|
||||
get = function() return YouAreNotPrepared.db.shown_time end,
|
||||
set = function (self, fixedparam, value) YouAreNotPrepared.db.shown_time = value end,
|
||||
min = 15,
|
||||
max = 120,
|
||||
step = 1,
|
||||
desc = "How much time the alert stay shown in the window.",
|
||||
name = "Alert Timeout"
|
||||
},
|
||||
{
|
||||
type = "toggle",
|
||||
get = function() return YouAreNotPrepared.db.auto_open end,
|
||||
set = function (self, fixedparam, value) YouAreNotPrepared.db.auto_open = value end,
|
||||
desc = "Open the window after leave the combat.",
|
||||
name = "Auto Open"
|
||||
},
|
||||
{
|
||||
type = "toggle",
|
||||
get = function() return YouAreNotPrepared.db.auto_close end,
|
||||
set = function (self, fixedparam, value) YouAreNotPrepared.db.auto_close = value end,
|
||||
desc = "Closes the window when you release or are resurrected.",
|
||||
name = "Auto Close"
|
||||
},
|
||||
}
|
||||
|
||||
_detalhes.gump:BuildMenu (options_frame, menu, 15, -75, 260)
|
||||
|
||||
end
|
||||
YouAreNotPrepared.OpenOptionsPanel = function()
|
||||
if (not YouAreNotPreparedOptionsWindow) then
|
||||
build_options_panel()
|
||||
end
|
||||
YouAreNotPreparedOptionsWindow:Show()
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> events
|
||||
|
||||
function YouAreNotPrepared:OnEvent (_, event, ...)
|
||||
|
||||
if (event == "PLAYER_ALIVE" or event == "PLAYER_UNGHOST") then
|
||||
if (YouAreNotPrepared.db.auto_close and YouAreNotPreparedFrame:IsShown()) then
|
||||
if (YouAreNotPreparedFrame.isMoving) then
|
||||
YouAreNotPreparedFrame:StopMovingOrSizing()
|
||||
YouAreNotPreparedFrame.isMoving = false
|
||||
end
|
||||
YouAreNotPreparedFrame:Hide()
|
||||
end
|
||||
|
||||
elseif (event == "ADDON_LOADED") then
|
||||
local AddonName = select (1, ...)
|
||||
if (AddonName == "Details_YouAreNotPrepared") then
|
||||
|
||||
if (_G._detalhes) then
|
||||
|
||||
--> create widgets
|
||||
CreatePluginFrames()
|
||||
|
||||
--> core version required
|
||||
local MINIMAL_DETAILS_VERSION_REQUIRED = 12
|
||||
|
||||
local default_settings = {
|
||||
shown_time = 30,
|
||||
auto_open = true,
|
||||
hide_on_combat = true,
|
||||
rightclick_closed = false,
|
||||
deaths_table = {},
|
||||
auto_close = true,
|
||||
}
|
||||
|
||||
--> install
|
||||
local install, saveddata, is_enabled = _G._detalhes:InstallPlugin ("TOOLBAR", Loc ["STRING_PLUGIN_NAME"], [[Interface\ICONS\Achievement_Boss_Illidan]], YouAreNotPrepared, "DETAILS_PLUGIN_YANP", MINIMAL_DETAILS_VERSION_REQUIRED, "Details! Team", YouAreNotPrepared.version, default_settings)
|
||||
if (type (install) == "table" and install.error) then
|
||||
return print (install.error)
|
||||
end
|
||||
|
||||
YouAreNotPrepared.db = saveddata
|
||||
|
||||
YANP_AutoOpenCheckBox:SetChecked (saveddata.auto_open)
|
||||
|
||||
--> register needed events
|
||||
_G._detalhes:RegisterEvent (YouAreNotPrepared, "DETAILS_DATA_RESET")
|
||||
_G._detalhes:RegisterEvent (YouAreNotPrepared, "COMBAT_PLAYER_LEAVE")
|
||||
|
||||
YouAreNotPreparedFrame:RegisterEvent ("PLAYER_ALIVE")
|
||||
YouAreNotPreparedFrame:RegisterEvent ("PLAYER_UNGHOST")
|
||||
|
||||
--> register needed hooks
|
||||
_G._detalhes:InstallHook (DETAILS_HOOK_DEATH, YouAreNotPrepared.OnDeath)
|
||||
|
||||
--> create right click to close
|
||||
if (not YouAreNotPrepared.db.rightclick_closed) then
|
||||
local right_click = YouAreNotPrepared.gump:NewImage (YouAreNotPreparedFrame, [[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 16, 18, "overlay", {8/512, 70/512, 328/512, 409/512})
|
||||
right_click:SetPoint ("left", _G [YouAreNotPreparedFrame:GetName() .. "OptionsText"], "right", 2, 0)
|
||||
local right_text = YouAreNotPrepared.gump:CreateLabel (YouAreNotPreparedFrame, "Right Click to Close", nil, "greenyellow", "GameFontHighlight", "rightclicktext", "$parentRightClickText")
|
||||
right_text:SetPoint ("left", right_click, "right", 2, 0)
|
||||
end
|
||||
|
||||
--> install slash command
|
||||
SLASH_Details_YouAreNotPrepared1 = "/yanp"
|
||||
function SlashCmdList.Details_YouAreNotPrepared (msg, editbox)
|
||||
YouAreNotPrepared:ShowMeFromInstanceAlert()
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,13 +0,0 @@
|
||||
## Interface: 60100
|
||||
## Title: Details You Are Not Prepared (plugin)
|
||||
## Notes: Plugin for Details
|
||||
## RequiredDeps: Details
|
||||
## OptionalDeps: Ace3
|
||||
|
||||
#@no-lib-strip@
|
||||
embeds.xml
|
||||
#@end-no-lib-strip@
|
||||
|
||||
enUS.lua
|
||||
ptBR.lua
|
||||
Details_YouAreNotPrepared.lua
|
||||
@@ -1,137 +0,0 @@
|
||||
--- **AceLocale-3.0** manages localization in addons, allowing for multiple locale to be registered with fallback to the base locale for untranslated strings.
|
||||
-- @class file
|
||||
-- @name AceLocale-3.0
|
||||
-- @release $Id: AceLocale-3.0.lua 1035 2011-07-09 03:20:13Z kaelten $
|
||||
local MAJOR,MINOR = "AceLocale-3.0", 6
|
||||
|
||||
local AceLocale, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not AceLocale then return end -- no upgrade needed
|
||||
|
||||
-- Lua APIs
|
||||
local assert, tostring, error = assert, tostring, error
|
||||
local getmetatable, setmetatable, rawset, rawget = getmetatable, setmetatable, rawset, rawget
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
-- GLOBALS: GAME_LOCALE, geterrorhandler
|
||||
|
||||
local gameLocale = GetLocale()
|
||||
if gameLocale == "enGB" then
|
||||
gameLocale = "enUS"
|
||||
end
|
||||
|
||||
AceLocale.apps = AceLocale.apps or {} -- array of ["AppName"]=localetableref
|
||||
AceLocale.appnames = AceLocale.appnames or {} -- array of [localetableref]="AppName"
|
||||
|
||||
-- This metatable is used on all tables returned from GetLocale
|
||||
local readmeta = {
|
||||
__index = function(self, key) -- requesting totally unknown entries: fire off a nonbreaking error and return key
|
||||
rawset(self, key, key) -- only need to see the warning once, really
|
||||
geterrorhandler()(MAJOR..": "..tostring(AceLocale.appnames[self])..": Missing entry for '"..tostring(key).."'")
|
||||
return key
|
||||
end
|
||||
}
|
||||
|
||||
-- This metatable is used on all tables returned from GetLocale if the silent flag is true, it does not issue a warning on unknown keys
|
||||
local readmetasilent = {
|
||||
__index = function(self, key) -- requesting totally unknown entries: return key
|
||||
rawset(self, key, key) -- only need to invoke this function once
|
||||
return key
|
||||
end
|
||||
}
|
||||
|
||||
-- Remember the locale table being registered right now (it gets set by :NewLocale())
|
||||
-- NOTE: Do never try to register 2 locale tables at once and mix their definition.
|
||||
local registering
|
||||
|
||||
-- local assert false function
|
||||
local assertfalse = function() assert(false) end
|
||||
|
||||
-- This metatable proxy is used when registering nondefault locales
|
||||
local writeproxy = setmetatable({}, {
|
||||
__newindex = function(self, key, value)
|
||||
rawset(registering, key, value == true and key or value) -- assigning values: replace 'true' with key string
|
||||
end,
|
||||
__index = assertfalse
|
||||
})
|
||||
|
||||
-- This metatable proxy is used when registering the default locale.
|
||||
-- It refuses to overwrite existing values
|
||||
-- Reason 1: Allows loading locales in any order
|
||||
-- Reason 2: If 2 modules have the same string, but only the first one to be
|
||||
-- loaded has a translation for the current locale, the translation
|
||||
-- doesn't get overwritten.
|
||||
--
|
||||
local writedefaultproxy = setmetatable({}, {
|
||||
__newindex = function(self, key, value)
|
||||
if not rawget(registering, key) then
|
||||
rawset(registering, key, value == true and key or value)
|
||||
end
|
||||
end,
|
||||
__index = assertfalse
|
||||
})
|
||||
|
||||
--- Register a new locale (or extend an existing one) for the specified application.
|
||||
-- :NewLocale will return a table you can fill your locale into, or nil if the locale isn't needed for the players
|
||||
-- game locale.
|
||||
-- @paramsig application, locale[, isDefault[, silent]]
|
||||
-- @param application Unique name of addon / module
|
||||
-- @param locale Name of the locale to register, e.g. "enUS", "deDE", etc.
|
||||
-- @param isDefault If this is the default locale being registered (your addon is written in this language, generally enUS)
|
||||
-- @param silent If true, the locale will not issue warnings for missing keys. Must be set on the first locale registered. If set to "raw", nils will be returned for unknown keys (no metatable used).
|
||||
-- @usage
|
||||
-- -- enUS.lua
|
||||
-- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "enUS", true)
|
||||
-- L["string1"] = true
|
||||
--
|
||||
-- -- deDE.lua
|
||||
-- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "deDE")
|
||||
-- if not L then return end
|
||||
-- L["string1"] = "Zeichenkette1"
|
||||
-- @return Locale Table to add localizations to, or nil if the current locale is not required.
|
||||
function AceLocale:NewLocale(application, locale, isDefault, silent)
|
||||
|
||||
-- GAME_LOCALE allows translators to test translations of addons without having that wow client installed
|
||||
local gameLocale = GAME_LOCALE or gameLocale
|
||||
|
||||
local app = AceLocale.apps[application]
|
||||
|
||||
if silent and app and getmetatable(app) ~= readmetasilent then
|
||||
geterrorhandler()("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' must be specified for the first locale registered")
|
||||
end
|
||||
|
||||
if not app then
|
||||
if silent=="raw" then
|
||||
app = {}
|
||||
else
|
||||
app = setmetatable({}, silent and readmetasilent or readmeta)
|
||||
end
|
||||
AceLocale.apps[application] = app
|
||||
AceLocale.appnames[app] = application
|
||||
end
|
||||
|
||||
if locale ~= gameLocale and not isDefault then
|
||||
return -- nop, we don't need these translations
|
||||
end
|
||||
|
||||
registering = app -- remember globally for writeproxy and writedefaultproxy
|
||||
|
||||
if isDefault then
|
||||
return writedefaultproxy
|
||||
end
|
||||
|
||||
return writeproxy
|
||||
end
|
||||
|
||||
--- Returns localizations for the current locale (or default locale if translations are missing).
|
||||
-- Errors if nothing is registered (spank developer, not just a missing translation)
|
||||
-- @param application Unique name of addon / module
|
||||
-- @param silent If true, the locale is optional, silently return nil if it's not found (defaults to false, optional)
|
||||
-- @return The locale table for the current language.
|
||||
function AceLocale:GetLocale(application, silent)
|
||||
if not silent and not AceLocale.apps[application] then
|
||||
error("Usage: GetLocale(application[, silent]): 'application' - No locales registered for '"..tostring(application).."'", 2)
|
||||
end
|
||||
return AceLocale.apps[application]
|
||||
end
|
||||
@@ -1,4 +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">
|
||||
<Script file="AceLocale-3.0.lua"/>
|
||||
</Ui>
|
||||
@@ -1,51 +0,0 @@
|
||||
-- $Id: LibStub.lua 76 2007-09-03 01:50:17Z mikk $
|
||||
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
|
||||
-- LibStub is hereby placed in the Public Domain
|
||||
-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
|
||||
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
|
||||
local LibStub = _G[LIBSTUB_MAJOR]
|
||||
|
||||
-- Check to see is this version of the stub is obsolete
|
||||
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
|
||||
LibStub = LibStub or {libs = {}, minors = {} }
|
||||
_G[LIBSTUB_MAJOR] = LibStub
|
||||
LibStub.minor = LIBSTUB_MINOR
|
||||
|
||||
-- LibStub:NewLibrary(major, minor)
|
||||
-- major (string) - the major version of the library
|
||||
-- minor (string or number ) - the minor version of the library
|
||||
--
|
||||
-- returns nil if a newer or same version of the lib is already present
|
||||
-- returns empty library object or old library object if upgrade is needed
|
||||
function LibStub:NewLibrary(major, minor)
|
||||
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
|
||||
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
|
||||
|
||||
local oldminor = self.minors[major]
|
||||
if oldminor and oldminor >= minor then return nil end
|
||||
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
|
||||
return self.libs[major], oldminor
|
||||
end
|
||||
|
||||
-- LibStub:GetLibrary(major, [silent])
|
||||
-- major (string) - the major version of the library
|
||||
-- silent (boolean) - if true, library is optional, silently return nil if its not found
|
||||
--
|
||||
-- throws an error if the library can not be found (except silent is set)
|
||||
-- returns the library object if found
|
||||
function LibStub:GetLibrary(major, silent)
|
||||
if not self.libs[major] and not silent then
|
||||
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
|
||||
end
|
||||
return self.libs[major], self.minors[major]
|
||||
end
|
||||
|
||||
-- LibStub:IterateLibraries()
|
||||
--
|
||||
-- Returns an iterator for the currently registered libraries
|
||||
function LibStub:IterateLibraries()
|
||||
return pairs(self.libs)
|
||||
end
|
||||
|
||||
setmetatable(LibStub, { __call = LibStub.GetLibrary })
|
||||
end
|
||||
@@ -1,13 +0,0 @@
|
||||
## Interface: 40200
|
||||
## Title: Lib: LibStub
|
||||
## Notes: Universal Library Stub
|
||||
## Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel
|
||||
## X-Website: http://www.wowace.com/addons/libstub/
|
||||
## X-Category: Library
|
||||
## X-License: Public Domain
|
||||
## X-Curse-Packaged-Version: r95
|
||||
## X-Curse-Project-Name: LibStub
|
||||
## X-Curse-Project-ID: libstub
|
||||
## X-Curse-Repository-ID: wow/libstub/mainline
|
||||
|
||||
LibStub.lua
|
||||
@@ -1,41 +0,0 @@
|
||||
debugstack = debug.traceback
|
||||
strmatch = string.match
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
local lib, oldMinor = LibStub:NewLibrary("Pants", 1) -- make a new thingy
|
||||
assert(lib) -- should return the library table
|
||||
assert(not oldMinor) -- should not return the old minor, since it didn't exist
|
||||
|
||||
-- the following is to create data and then be able to check if the same data exists after the fact
|
||||
function lib:MyMethod()
|
||||
end
|
||||
local MyMethod = lib.MyMethod
|
||||
lib.MyTable = {}
|
||||
local MyTable = lib.MyTable
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 1) -- try to register a library with the same version, should silently fail
|
||||
assert(not newLib) -- should not return since out of date
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 0) -- try to register a library with a previous, should silently fail
|
||||
assert(not newLib) -- should not return since out of date
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 2) -- register a new version
|
||||
assert(newLib) -- library table
|
||||
assert(rawequal(newLib, lib)) -- should be the same reference as the previous
|
||||
assert(newOldMinor == 1) -- should return the minor version of the previous version
|
||||
|
||||
assert(rawequal(lib.MyMethod, MyMethod)) -- verify that values were saved
|
||||
assert(rawequal(lib.MyTable, MyTable)) -- verify that values were saved
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 3 Blah") -- register a new version with a string minor version (instead of a number)
|
||||
assert(newLib) -- library table
|
||||
assert(newOldMinor == 2) -- previous version was 2
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 4 and please ignore 15 Blah") -- register a new version with a string minor version (instead of a number)
|
||||
assert(newLib)
|
||||
assert(newOldMinor == 3) -- previous version was 3 (even though it gave a string)
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 5) -- register a new library, using a normal number instead of a string
|
||||
assert(newLib)
|
||||
assert(newOldMinor == 4) -- previous version was 4 (even though it gave a string)
|
||||
@@ -1,27 +0,0 @@
|
||||
debugstack = debug.traceback
|
||||
strmatch = string.match
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
for major, library in LibStub:IterateLibraries() do
|
||||
-- check that MyLib doesn't exist yet, by iterating through all the libraries
|
||||
assert(major ~= "MyLib")
|
||||
end
|
||||
|
||||
assert(not LibStub:GetLibrary("MyLib", true)) -- check that MyLib doesn't exist yet by direct checking
|
||||
assert(not pcall(LibStub.GetLibrary, LibStub, "MyLib")) -- don't silently fail, thus it should raise an error.
|
||||
local lib = LibStub:NewLibrary("MyLib", 1) -- create the lib
|
||||
assert(lib) -- check it exists
|
||||
assert(rawequal(LibStub:GetLibrary("MyLib"), lib)) -- verify that :GetLibrary("MyLib") properly equals the lib reference
|
||||
|
||||
assert(LibStub:NewLibrary("MyLib", 2)) -- create a new version
|
||||
|
||||
local count=0
|
||||
for major, library in LibStub:IterateLibraries() do
|
||||
-- check that MyLib exists somewhere in the libraries, by iterating through all the libraries
|
||||
if major == "MyLib" then -- we found it!
|
||||
count = count +1
|
||||
assert(rawequal(library, lib)) -- verify that the references are equal
|
||||
end
|
||||
end
|
||||
assert(count == 1) -- verify that we actually found it, and only once
|
||||
@@ -1,14 +0,0 @@
|
||||
debugstack = debug.traceback
|
||||
strmatch = string.match
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
local proxy = newproxy() -- non-string
|
||||
|
||||
assert(not pcall(LibStub.NewLibrary, LibStub, proxy, 1)) -- should error, proxy is not a string, it's userdata
|
||||
local success, ret = pcall(LibStub.GetLibrary, proxy, true)
|
||||
assert(not success or not ret) -- either error because proxy is not a string or because it's not actually registered.
|
||||
|
||||
assert(not pcall(LibStub.NewLibrary, LibStub, "Something", "No number in here")) -- should error, minor has no string in it.
|
||||
|
||||
assert(not LibStub:GetLibrary("Something", true)) -- shouldn't've created it from the above statement
|
||||
@@ -1,41 +0,0 @@
|
||||
debugstack = debug.traceback
|
||||
strmatch = string.match
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
|
||||
-- Pretend like loaded libstub is old and doesn't have :IterateLibraries
|
||||
assert(LibStub.minor)
|
||||
LibStub.minor = LibStub.minor - 0.0001
|
||||
LibStub.IterateLibraries = nil
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
assert(type(LibStub.IterateLibraries)=="function")
|
||||
|
||||
|
||||
-- Now pretend that we're the same version -- :IterateLibraries should NOT be re-created
|
||||
LibStub.IterateLibraries = 123
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
assert(LibStub.IterateLibraries == 123)
|
||||
|
||||
|
||||
-- Now pretend that a newer version is loaded -- :IterateLibraries should NOT be re-created
|
||||
LibStub.minor = LibStub.minor + 0.0001
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
assert(LibStub.IterateLibraries == 123)
|
||||
|
||||
|
||||
-- Again with a huge number
|
||||
LibStub.minor = LibStub.minor + 1234567890
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
assert(LibStub.IterateLibraries == 123)
|
||||
|
||||
|
||||
print("OK")
|
||||
Binary file not shown.
@@ -1,7 +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">
|
||||
|
||||
<Script file="Libs\LibStub\LibStub.lua"/>
|
||||
<Include file="Libs\AceLocale-3.0\AceLocale-3.0.xml" />
|
||||
|
||||
</Ui>
|
||||
@@ -1,9 +0,0 @@
|
||||
local Loc = LibStub("AceLocale-3.0"):NewLocale ("Details_YouAreNotPrepared", "enUS", true)
|
||||
|
||||
if (not Loc) then
|
||||
return
|
||||
end
|
||||
|
||||
Loc ["STRING_PLUGIN_NAME"] = "You Are Not Prepared"
|
||||
Loc ["STRING_PLUGIN_ALERT"] = "|cFFFFFF00YANP|r: click to see the death log "
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
local Loc = LibStub("AceLocale-3.0"):NewLocale ("Details_YouAreNotPrepared", "ptBR")
|
||||
|
||||
if (not Loc) then
|
||||
return
|
||||
end
|
||||
|
||||
Loc ["STRING_PLUGIN_NAME"] = "You Are Not Prepared"
|
||||
Loc ["STRING_PLUGIN_ALERT"] = "YANP: clique para ver o registro da morte"
|
||||
Reference in New Issue
Block a user