- Plugin Tiny Threat received a options panel and also a minor revamp.

- Timeline plugin got some rework and now its window can be open while in combat.
- Plugin You Are Not Prepared, got a options panel.
- Added Data Broker for: Combat Time, Player Dps and Player Hps.
- Fixed non formatted numbers where it shows its fractional part.
- Texts on options panel now auto-resizes depending on the test's lengh.
- Slash commands now are multi language, accepting both english and the localized language.

- New API: framework:BuildMenu (parent, menu, x_offset, y_offset, height), auto build menu, similar to Ace3 GUI.
This commit is contained in:
tercio
2014-07-21 14:23:28 -03:00
parent 0b8cab413e
commit e5eff411c9
21 changed files with 1377 additions and 891 deletions
@@ -1507,13 +1507,7 @@ function EncounterDetails:OnEvent (_, event, ...)
show_icon = 5, --automatic
hide_on_combat = false, --hide the window when a new combat start
}
-- 1 = only when inside a raid map
-- 2 = only when in raid group
-- 3 = only after a boss encounter
-- 4 = always show
-- 5 = automatic show when have at least 1 encounter with boss
--> Install
local install, saveddata, is_enabled = _G._detalhes:InstallPlugin (
PLUGIN_TYPE,
+5 -4
View File
@@ -43,10 +43,11 @@ do
options_frame.TitleText:SetText ("Encounter Details Options")
options_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-BLOODELF]])
-- 1 = only when inside a raid map
-- 2 = only when in raid group
-- 3 = only after a boss encounter
-- 4 = always show
-- 1 = only when inside a raid map
-- 2 = only when in raid group
-- 3 = only after a boss encounter
-- 4 = always show
-- 5 = automatic show when have at least 1 encounter with boss
local set = function (_, _, value)
EncounterDetails.db.show_icon = value
+131 -22
View File
@@ -9,11 +9,14 @@ local _UnitDetailedThreatSituation = UnitDetailedThreatSituation
local _IsInRaid = IsInRaid --> wow api
local _IsInGroup = IsInGroup --> wow api
local _UnitGroupRolesAssigned = UnitGroupRolesAssigned --> wow api
local GetUnitName = GetUnitName
local _ipairs = ipairs --> lua api
local _table_sort = table.sort --> lua api
local _cstr = string.format --> lua api
local _unpack = unpack
local _math_floor = math.floor
local _math_abs = math.abs
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
--> Create the plugin Object
@@ -56,6 +59,7 @@ local function CreatePluginFrames (data)
ThreatMeter:Cancel()
elseif (event == "SHOW") then
instance = ThreatMeter:GetInstance (ThreatMeter.instance_id)
ThreatMeter.RowWidth = instance.baseframe:GetWidth()-6
@@ -70,6 +74,9 @@ local function CreatePluginFrames (data)
ThreatMeter.Actived = false
if (ThreatMeter:IsInCombat() or UnitAffectingCombat ("player")) then
if (not ThreatMeter.initialized) then
return
end
ThreatMeter.Actived = true
ThreatMeter:Start()
end
@@ -200,14 +207,6 @@ local function CreatePluginFrames (data)
return false
end
end
--[[
local percent = threat_actor [2]
if (percentagem >= 50) then
thisRow:SetColor ( percent/100, 1, 0, 1)
else
thisRow:SetColor ( 1, percent/100, 0, 1)
end
--]]
local Threater = function()
@@ -229,9 +228,11 @@ local function CreatePluginFrames (data)
if (status) then
threat_table [2] = threatpct
threat_table [3] = isTanking
threat_table [6] = threatvalue
else
threat_table [2] = 0
threat_table [3] = false
threat_table [6] = 0
end
end
@@ -252,9 +253,11 @@ local function CreatePluginFrames (data)
if (status) then
threat_table [2] = threatpct
threat_table [3] = isTanking
threat_table [6] = threatvalue
else
threat_table [2] = 0
threat_table [3] = false
threat_table [6] = 0
end
end
@@ -266,9 +269,11 @@ local function CreatePluginFrames (data)
if (status) then
threat_table [2] = threatpct
threat_table [3] = isTanking
threat_table [6] = threatvalue
else
threat_table [2] = 0
threat_table [3] = false
threat_table [6] = 0
end
else
@@ -282,9 +287,11 @@ local function CreatePluginFrames (data)
if (status) then
threat_table [2] = threatpct
threat_table [3] = isTanking
threat_table [6] = threatvalue
else
threat_table [2] = 0
threat_table [3] = false
threat_table [6] = 0
end
--> pet
@@ -298,9 +305,11 @@ local function CreatePluginFrames (data)
if (status) then
threat_table [2] = threatpct
threat_table [3] = isTanking
threat_table [6] = threatvalue
else
threat_table [2] = 0
threat_table [3] = false
threat_table [6] = 0
end
end
end
@@ -321,9 +330,39 @@ local function CreatePluginFrames (data)
local lastIndex = 0
local shownMe = false
for index = 1, #ThreatMeter.ShownRows do
local pullRow = ThreatMeter.ShownRows [1]
local me = ThreatMeter.player_list_indexes [ ThreatMeter.player_list_hash [player] ]
if (me) then
local myThreat = me [6] or 0
local myRole = me [4]
local topThreat = ThreatMeter.player_list_indexes [1]
local aggro = topThreat [6] * (CheckInteractDistance ("target", 3) and 1.1 or 1.3)
pullRow:SetLeftText ("Pull Aggro At")
local realPercent = _math_floor (aggro / topThreat [6] * 100)
pullRow:SetRightText ("+" .. ThreatMeter:ToK2 (aggro - myThreat) .. " (" .. _math_floor (_math_abs ((myThreat / aggro * 100) - realPercent)) .. "%)") --
--thisRow.textleft:SetTextColor ()
pullRow:SetValue (100)
local myPercentToAggro = myThreat / aggro * 100
local r, g = myPercentToAggro / 100, (100-myPercentToAggro) / 100
pullRow:SetColor (r, g, 0)
pullRow._icon:SetTexture ([[Interface\PVPFrame\Icon-Combat]])
--pullRow._icon:SetVertexColor (r, g, 0)
pullRow._icon:SetTexCoord (0, 1, 0, 1)
pullRow:Show()
else
if (pullRow) then
pullRow:Hide()
end
end
for index = 2, #ThreatMeter.ShownRows do
local thisRow = ThreatMeter.ShownRows [index]
local threat_actor = ThreatMeter.player_list_indexes [index]
local threat_actor = ThreatMeter.player_list_indexes [index-1]
if (threat_actor) then
local role = threat_actor [4]
@@ -336,15 +375,15 @@ local function CreatePluginFrames (data)
local pct = threat_actor [2]
thisRow:SetRightText (_cstr ("%.1f", pct).."%")
thisRow:SetRightText (ThreatMeter:ToK2 (threat_actor [6]) .. " (" .. _cstr ("%.1f", pct) .. "%)")
thisRow:SetValue (pct)
if (index == 1) then
thisRow:SetColor (pct*0.01, math.abs (pct-100)*0.01, 0, 1)
if (index == 2) then
thisRow:SetColor (pct*0.01, _math_abs (pct-100)*0.01, 0, 1)
else
thisRow:SetColor (pct*0.01, math.abs (pct-100)*0.01, 0, .3)
thisRow:SetColor (pct*0.01, _math_abs (pct-100)*0.01, 0, .3)
if (pct >= 50) then
thisRow:SetColor ( 1, math.abs (pct - 100)/100, 0, 1)
thisRow:SetColor ( 1, _math_abs (pct - 100)/100, 0, 1)
else
thisRow:SetColor (pct/100, 1, 0, 1)
end
@@ -371,9 +410,9 @@ local function CreatePluginFrames (data)
--thisRow.textleft:SetTextColor (unpack (RAID_CLASS_COLORS [threat_actor [5]]))
local role = threat_actor [4]
thisRow._icon:SetTexCoord (_unpack (RoleIconCoord [role]))
thisRow:SetRightText (_cstr ("%.1f", threat_actor [2]).."%")
thisRow:SetRightText (ThreatMeter:ToK2 (threat_actor [6]) .. " (" .. _cstr ("%.1f", threat_actor [2]) .. "%)")
thisRow:SetValue (threat_actor [2])
thisRow:SetColor (threat_actor [2]*0.01, math.abs (threat_actor [2]-100)*0.01, 0, .3)
thisRow:SetColor (threat_actor [2]*0.01, _math_abs (threat_actor [2]-100)*0.01, 0, .3)
end
end
end
@@ -418,7 +457,7 @@ local function CreatePluginFrames (data)
local thisplayer_name = GetUnitName ("raid"..i, true)
local role = _UnitGroupRolesAssigned (thisplayer_name)
local _, class = UnitClass (thisplayer_name)
local t = {thisplayer_name, 0, false, role, class}
local t = {thisplayer_name, 0, false, role, class, 0}
ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t
ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes
end
@@ -428,14 +467,14 @@ local function CreatePluginFrames (data)
local thisplayer_name = GetUnitName ("party"..i, true)
local role = _UnitGroupRolesAssigned (thisplayer_name)
local _, class = UnitClass (thisplayer_name)
local t = {thisplayer_name, 0, false, role, class}
local t = {thisplayer_name, 0, false, role, class, 0}
ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t
ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes
end
local thisplayer_name = GetUnitName ("player", true)
local role = _UnitGroupRolesAssigned (thisplayer_name)
local _, class = UnitClass (thisplayer_name)
local t = {thisplayer_name, 0, false, role, class}
local t = {thisplayer_name, 0, false, role, class, 0}
ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t
ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes
@@ -443,14 +482,14 @@ local function CreatePluginFrames (data)
local thisplayer_name = GetUnitName ("player", true)
local role = _UnitGroupRolesAssigned (thisplayer_name)
local _, class = UnitClass (thisplayer_name)
local t = {thisplayer_name, 0, false, role, class}
local t = {thisplayer_name, 0, false, role, class, 0}
ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t
ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes
if (UnitExists ("pet")) then
local thispet_name = GetUnitName ("pet", true) .. " *PET*"
local role = "DAMAGER"
local t = {thispet_name, 0, false, role, class}
local t = {thispet_name, 0, false, role, class, 0}
ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t
ThreatMeter.player_list_hash [thispet_name] = #ThreatMeter.player_list_indexes
end
@@ -480,6 +519,74 @@ local function CreatePluginFrames (data)
end
local build_options_panel = function()
local options_frame = CreateFrame ("frame", "ThreatMeterOptionsWindow", UIParent)
tinsert (UISpecialFrames, "ThreatMeterOptionsWindow")
options_frame:SetSize (500, 200)
options_frame:SetFrameStrata ("DIALOG")
options_frame:SetScript ("OnMouseDown", function(self, button)
if (button == "RightButton") then
if (self.moving) then
self.moving = false
self:StopMovingOrSizing()
end
return options_frame:Hide()
elseif (button == "LeftButton" and not self.moving) then
self.moving = true
self:StartMoving()
end
end)
options_frame:SetScript ("OnMouseUp", function(self)
if (self.moving) then
self.moving = false
self:StopMovingOrSizing()
end
end)
options_frame:SetMovable (true)
options_frame:EnableMouse (true)
options_frame:Hide()
options_frame:SetPoint ("center", UIParent, "center")
options_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16,
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 32,
insets = {left = 5, right = 5, top = 5, bottom = 5}})
options_frame:SetBackdropColor (.3, .3, .3, .3)
local title = ThreatMeter.gump:NewLabel (options_frame, nil, "$parentTitle", nil, "Tiny Threat Options", nil, 20, "yellow")
title:SetPoint (12, -13)
ThreatMeter:SetFontOutline (title, true)
local c = CreateFrame ("Button", nil, options_frame, "UIPanelCloseButton")
c:SetWidth (32)
c:SetHeight (32)
c:SetPoint ("TOPRIGHT", options_frame, "TOPRIGHT", -3, -3)
c:SetFrameLevel (options_frame:GetFrameLevel()+1)
local menu = {
{
type = "range",
get = function() return ThreatMeter.saveddata.updatespeed end,
set = function (self, fixedparam, value) ThreatMeter.saveddata.updatespeed = value end,
min = 0.2,
max = 3,
step = 0.2,
desc = "How fast the window get updates.",
name = "Update Speed",
usedecimals = true,
},
}
_detalhes.gump:BuildMenu (options_frame, menu, 15, -65, 260)
end
ThreatMeter.OpenOptionsPanel = function()
if (not ThreatMeterOptionsWindow) then
build_options_panel()
end
ThreatMeterOptionsWindow:Show()
end
function ThreatMeter:OnEvent (_, event, ...)
if (event == "PLAYER_TARGET_CHANGED") then
@@ -572,6 +679,8 @@ function ThreatMeter:OnEvent (_, event, ...)
end
ThreatMeter.initialized = true
end
end
@@ -1,439 +1,489 @@
local AceLocale = LibStub ("AceLocale-3.0")
local Loc = AceLocale:GetLocale ("Details_YouAreNotPrepared")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> init the plugin
--> create the plugin object
local YouAreNotPrepared = _detalhes:NewPluginObject ("Details_YouAreNotPrepared", DETAILSPLUGIN_ALWAYSENABLED)
tinsert (UISpecialFrames, "Details_YouAreNotPrepared")
--> main frame (shortcut)
local YouAreNotPreparedFrame = YouAreNotPrepared.Frame
--> 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
local function CreatePluginFrames()
--> catch Details! main object
local _detalhes = _G._detalhes
local DetailsFrameWork = _detalhes.gump
local GameCooltip = GameCooltip
local _GetSpellInfo = _detalhes.getspellinfo
local debugmode = false
YouAreNotPrepared.deaths_table = {}
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.deaths_table)
YouAreNotPrepared:Clear()
elseif (event == "PLUGIN_DISABLED") then
table.wipe (YouAreNotPrepared.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
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> init the frames
function YouAreNotPrepared:Clear()
YouAreNotPrepared.deaths_table = {}
_detalhes_databaseYANP = YouAreNotPrepared.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
local function CreatePluginFrames()
--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
YouAreNotPreparedFrame:Hide()
else
if (YouAreNotPreparedFrame.isMoving) then
YouAreNotPreparedFrame:StopMovingOrSizing()
YouAreNotPreparedFrame.isMoving = false
--> 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
end)
YouAreNotPreparedFrame:SetScript ("OnMouseDown", function (self, button)
if (button == "LeftButton") then
if (not YouAreNotPreparedFrame.isMoving) then
YouAreNotPreparedFrame:StartMoving()
YouAreNotPreparedFrame.isMoving = true
---------- 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
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, nil, 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)
--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.bars = {}
local MouseUpCloseHook = function (_, button)
if (button == "RightButton") then
YouAreNotPreparedFrame:Hide()
return true --> interrupt
end
end
function container_bars:CreateChild()
local bar_number = #self.bars + 1
--main frame
YouAreNotPreparedFrame:SetSize (424, 223)
YouAreNotPreparedFrame:SetPoint ("center", UIParent, "center")
YouAreNotPreparedFrame:EnableMouse (true)
YouAreNotPreparedFrame:SetResizable (false)
YouAreNotPreparedFrame:SetMovable (true)
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 ("OnMouseUp", MouseUpCloseHook)
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")
container_bars.bars [bar_number] = bar
return bar
end
function container_bars:UpdateChild (bar_number, data, time_of_death, max_health)
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
YouAreNotPreparedFrame:SetScript ("OnMouseUp", function (self, button)
if (button == "RightButton") then
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, nil, 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)
if (data[1]) then --> damage
if (data[3] and type (data [1]) == "boolean") then --> is a real damage, not a battle ress and its not a last cooldown line
--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.bars = {}
local MouseUpCloseHook = function (_, button)
if (button == "RightButton") then
YouAreNotPreparedFrame:Hide()
return true --> interrupt
end
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 ("OnMouseUp", MouseUpCloseHook)
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")
container_bars.bars [bar_number] = bar
return bar
end
function container_bars:UpdateChild (bar_number, data, time_of_death, max_health)
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]) then --> damage
if (data[3] and type (data [1]) == "boolean") then --> is a real damage, not a battle ress and its not a last cooldown line
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 = "red"
bar.statusbar.background:SetVertexColor (1, 0, 0, .2)
bar.statusbar.textleft:SetWidth (250 - bar.statusbar.textright:GetStringWidth() - 20)
bar.statusbar.value = hp
return true
end
else
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.textright:SetText ("+" .. YouAreNotPrepared:ToK (data [3]) .. " (" .. hp .. "%)")
bar.statusbar._icon:SetTexture (icon)
bar.statusbar.color = "red"
bar.statusbar.background:SetVertexColor (1, 0, 0, .2)
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
return true
end
else
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
return true
end
return false
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)
--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
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()
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]:Show()
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)
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
else
container_bars.bars [bar_index]:Hide()
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
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)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> functions
function YouAreNotPrepared:ShowMeFromInstanceAlert()
YouAreNotPreparedFrame:Show()
YouAreNotPrepared.select_death (1)
YouAreNotPrepared:UpdateButtons()
_detalhes:InstanceAlert (false)
end
container_bars:EnableMouse (true)
--choose death menu
YouAreNotPrepared.buttons = {}
local select_death = function (selected)
YouAreNotPrepared.s_table = YouAreNotPrepared.deaths_table [selected]
if (not YouAreNotPrepared.s_table) then
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_id) 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
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.deaths_table, 1, t)
table.remove (YouAreNotPrepared.deaths_table, 7)
--update buttons
for i = 1, 6 do
local button = YouAreNotPrepared.buttons [i]
local death_table = YouAreNotPrepared.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()
_detalhes_databaseYANP = YouAreNotPrepared.deaths_table
end
function YouAreNotPrepared:UpdateButtons()
for i = 1, 6 do
local button = YouAreNotPrepared.buttons [i]
local death_table = YouAreNotPrepared.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}, 30, {YouAreNotPrepared.ShowMeFromInstanceAlert})
end
--YouAreNotPrepared:ScheduleTimer (YouAreNotPrepared.ShowMe, 3)
end
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_id) then
_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
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
--[[ debug mode
if (not combat.is_boss) then
return YouAreNotPrepared:AddDeath ({combat.enemy or "Unknown", time_of_death, last_cooldown, death_table, max_health, time})
else
return YouAreNotPrepared:AddDeath ({combat.is_boss.name or combat.enemy or "Unknown", time_of_death, last_cooldown, death_table, max_health, time})
end
--]]
local combat = YouAreNotPrepared:GetCombat ("current")
if (combat.is_boss) then --> encounter or pvp
YouAreNotPrepared.last_death_combat_id = YouAreNotPrepared.combat_id
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
function YouAreNotPrepared:OnEvent (_, event, ...)
if (event == "ADDON_LOADED") then
local AddonName = select (1, ...)
if (AddonName == "Details_YouAreNotPrepared") then
if (alvo_name == YouAreNotPrepared.playername) then
local combat = YouAreNotPrepared:GetCombat ("current")
if (_G._detalhes) then
--> create widgets
CreatePluginFrames()
--> core version required
local MINIMAL_DETAILS_VERSION_REQUIRED = 12
--> install
local install = _G._detalhes:InstallPlugin ("TOOLBAR", Loc ["STRING_PLUGIN_NAME"], [[Interface\ICONS\Achievement_Boss_Illidan]], YouAreNotPrepared, "DETAILS_PLUGIN_YANP", MINIMAL_DETAILS_VERSION_REQUIRED, "Details! Team", "v1.01")
if (type (install) == "table" and install.error) then
print (install.error)
end
--> register needed events
_G._detalhes:RegisterEvent (YouAreNotPrepared, "DETAILS_DATA_RESET")
_G._detalhes:RegisterEvent (YouAreNotPrepared, "COMBAT_PLAYER_LEAVE")
--> register needed hooks
_G._detalhes:InstallHook (DETAILS_HOOK_DEATH, YouAreNotPrepared.OnDeath)
--> retrive saved data
YouAreNotPrepared.deaths_table = _detalhes_databaseYANP or {}
--> install slash command
SLASH_Details_YouAreNotPrepared1 = "/yanp"
function SlashCmdList.Details_YouAreNotPrepared (msg, editbox)
YouAreNotPrepared:ShowMeFromInstanceAlert()
end
if (combat.is_boss) then --> encounter or pvp
YouAreNotPrepared.last_death_combat_id = YouAreNotPrepared.combat_id
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 = "Ope the window after leave the combat.",
name = "Auto Open"
},
}
_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 == "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 = false, --
hide_on_combat = true, --
deaths_table = {}
}
--> 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", "v1.1", default_settings)
if (type (install) == "table" and install.error) then
return print (install.error)
end
YouAreNotPrepared.db = saveddata
--> register needed events
_G._detalhes:RegisterEvent (YouAreNotPrepared, "DETAILS_DATA_RESET")
_G._detalhes:RegisterEvent (YouAreNotPrepared, "COMBAT_PLAYER_LEAVE")
--> register needed hooks
_G._detalhes:InstallHook (DETAILS_HOOK_DEATH, YouAreNotPrepared.OnDeath)
--> install slash command
SLASH_Details_YouAreNotPrepared1 = "/yanp"
function SlashCmdList.Details_YouAreNotPrepared (msg, editbox)
YouAreNotPrepared:ShowMeFromInstanceAlert()
end
end
end
end
end
end
@@ -2,7 +2,6 @@
## Title: Details You Are Not Prepared (plugin)
## Notes: Plugin for Details
## RequiredDeps: Details
## SavedVariablesPerCharacter: _detalhes_databaseYANP
## OptionalDeps: Ace3
#@no-lib-strip@