- 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
+14 -5
View File
File diff suppressed because one or more lines are too long
+118 -1
View File
@@ -411,4 +411,121 @@
if (send_to_guild) then
_detalhes:SendGuildData (_detalhes.network.ids.VERSION_CHECK, _detalhes.build_counter)
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> sharer
--> entrar no canal após logar no servidor
function _detalhes:EnterChatChannel()
if (_detalhes.schedule_chat_leave) then
_detalhes:CancelTimer (_detalhes.schedule_chat_leave)
end
_detalhes.schedule_chat_enter = nil
local realm = GetRealmName()
realm = realm or ""
if (realm ~= "Azralon") then
return
end
--> room name
local room_name = "Details"
--> already in?
for room_index = 1, 10 do
local _, name = GetChannelName (room_index)
if (name == room_name) then
return --> already in the room
end
end
--> enter
--print ("entrando no canal")
JoinChannelByName (room_name)
end
function _detalhes:LeaveChatChannel()
if (_detalhes.schedule_chat_enter) then
_detalhes:CancelTimer (_detalhes.schedule_chat_enter)
end
_detalhes.schedule_chat_leave = nil
local realm = GetRealmName()
realm = realm or ""
if (realm ~= "Azralon") then
return
end
--> room name
local room_name = "Details"
local is_in = false
--> already in?
for room_index = 1, 10 do
local _, name = GetChannelName (room_index)
if (name == room_name) then
is_in = true
end
end
if (is_in) then
--print ("saindo do canal")
LeaveChannelByName (room_name)
end
end
--> sair do canal quando estiver em grupo
local event_handler = {Enabled = true, __enabled = true, teste = " teste"}
function event_handler:ZONE_TYPE_CHANGED (zone_type)
--print (zone_type)
if (zone_type == "none") then
if (not _detalhes:InGroup()) then
if (_detalhes.schedule_chat_leave) then
_detalhes:CancelTimer (_detalhes.schedule_chat_leave)
end
if (not _detalhes.schedule_chat_enter) then
_detalhes.schedule_chat_enter = _detalhes:ScheduleTimer ("EnterChatChannel", 2)
end
end
else
if (_detalhes:InGroup()) then
if (_detalhes.schedule_chat_enter) then
_detalhes:CancelTimer (_detalhes.schedule_chat_enter)
end
if (not _detalhes.schedule_chat_leave) then
_detalhes.schedule_chat_leave = _detalhes:ScheduleTimer ("LeaveChatChannel", 2)
end
end
end
end
function event_handler:GROUP_ONENTER()
if (zone_type ~= "none") then
if (_detalhes.schedule_chat_enter) then
_detalhes:CancelTimer (_detalhes.schedule_chat_enter)
end
if (not _detalhes.schedule_chat_leave) then
_detalhes.schedule_chat_leave = _detalhes:ScheduleTimer ("LeaveChatChannel", 2)
end
end
end
function event_handler:GROUP_ONLEAVE()
if (zone_type == "none") then
if (_detalhes.schedule_chat_leave) then
_detalhes:CancelTimer (_detalhes.schedule_chat_leave)
end
if (not _detalhes.schedule_chat_enter) then
_detalhes.schedule_chat_enter = _detalhes:ScheduleTimer ("EnterChatChannel", 2)
end
end
end
_detalhes:RegisterEvent (event_handler, "GROUP_ONENTER", "GROUP_ONENTER")
_detalhes:RegisterEvent (event_handler, "GROUP_ONLEAVE", "GROUP_ONLEAVE")
_detalhes:RegisterEvent (event_handler, "ZONE_TYPE_CHANGED", "ZONE_TYPE_CHANGED")
+53 -37
View File
@@ -2239,43 +2239,9 @@
end
end
--parser:safe_sort_dead (esta_morte)
_table_sort (esta_morte, _detalhes.Sort4)
--[[
_table_sort (esta_morte, function (table1, table2)
if (not table1) then
print (1)
return false
elseif (not table2) then
print (2)
return false
elseif (table1 [4] == table2 [4]) then --> os 2 tem o mesmo tempo
if (type (table1 [1]) == "boolean" and table1 [1] and type (table2 [1]) == "boolean" and table2) then --> ambos sao dano
print (3)
return table1 [5] > table2 [5] --> joga pra cima quem tem mais vida
elseif (type (table1 [1]) == "boolean" and not table1 [1] and type (table2 [1]) == "boolean" and not table2) then --> ambos sao cura
print (4)
return table1 [5] < table2 [5] --> joga pra cima quem tem menos vida
else
if (type (table1 [1]) == "boolean" and table1 and type (table2 [1]) == "boolean" and table2) then --> primeiro é dano e segundo é heal
print (5)
return true --> passa o dano pra frente
elseif (type (table2 [1]) == "boolean" and table2 and type (table1 [1]) == "boolean" and table1) then --> primeiro é heal e o segundo é dano
print (6)
return false --> passa o heal pra frente
else
print (7)
return table1 [5] < table2 [5] --> passa quem tem menos vida
end
end
else
print (8)
return table1 [4] < table2 [4]
end
end)
--]]
if (_hook_deaths) then
--> send event to registred functions
local death_at = _tempo - _current_combat.start_time
@@ -2331,6 +2297,57 @@
end
end
local sort_dead = function (table1, table2)
if (not table1) then
--print (1)
return false
elseif (not table2) then
--print (2)
return false
elseif (table1 [4] == table2 [4]) then --> os 2 tem o mesmo tempo
if (type (table1 [1]) == "boolean" and table1 [1] and type (table2 [1]) == "boolean" and table2) then --> ambos sao dano
--print (3)
return table1 [5] > table2 [5] --> joga pra cima quem tem mais vida
elseif (type (table1 [1]) == "boolean" and not table1 [1] and type (table2 [1]) == "boolean" and not table2) then --> ambos sao cura
--print (4)
return table1 [5] < table2 [5] --> joga pra cima quem tem menos vida
else
if (type (table1 [1]) == "boolean" and table1 and type (table2 [1]) == "boolean" and table2) then --> primeiro é dano e segundo é heal
--print (5)
return true --> passa o dano pra frente
elseif (type (table2 [1]) == "boolean" and table2 and type (table1 [1]) == "boolean" and table1) then --> primeiro é heal e o segundo é dano
--print (6)
return false --> passa o heal pra frente
else
--print (7)
return table1 [5] < table2 [5] --> passa quem tem menos vida
end
end
else
--print (8)
return table1 [4] < table2 [4]
end
end
local function sort_error (error)
return error
end
local death_table
function do_death_sort()
_table_sort (death_table, sort_dead)
end
function parser:safe_sort_dead (t)
death_table = t
local status, error = xpcall (do_death_sort, sort_error)
if (not status) then
_table_sort (t, _detalhes.Sort4)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
@@ -2517,7 +2534,6 @@
end
function _detalhes.parser_functions:ZONE_CHANGED_NEW_AREA (...)
local zoneName, zoneType, _, _, _, _, _, zoneMapID = _GetInstanceInfo()
if (_detalhes.last_zone_type ~= zoneType) then
_detalhes:SendEvent ("ZONE_TYPE_CHANGED", nil, zoneType)
_detalhes.last_zone_type = zoneType
+1 -1
View File
@@ -126,7 +126,7 @@
end
--> no changes
function _detalhes:NoToK (numero)
return numero
return _math_floor (numero)
end
-- thanks http://richard.warburton.it
function _detalhes:comma_value (n)
+11 -9
View File
@@ -963,6 +963,8 @@
f:Hide()
end
--> feed back request
function _detalhes:ShowFeedbackRequestWindow()
local feedback_frame = CreateFrame ("FRAME", "DetailsFeedbackWindow", UIParent, "ButtonFrameTemplate")
@@ -1048,7 +1050,7 @@
end
--> interface menu
--> interface menu
local f = CreateFrame ("frame", "DetailsInterfaceOptionsPanel", UIParent)
f.name = "Details"
f.logo = f:CreateTexture (nil, "overlay")
@@ -1077,7 +1079,7 @@
_detalhes:CriarInstancia (_, true)
end)
--> row text editor
--> row text editor
local panel = _detalhes.gump:NewPanel (UIParent, nil, "DetailsWindowOptionsBarTextEditor", nil, 650, 200)
panel:SetPoint ("center", UIParent, "center")
panel:Hide()
@@ -1107,9 +1109,9 @@
local textentry = _detalhes.gump:NewSpecialLuaEditorEntry (panel.widget, 450, 180, "editbox", "$parentEntry", true)
textentry:SetPoint ("topleft", panel.widget, "topleft", 10, -10)
local arg1_button = _detalhes.gump:NewButton (panel, nil, "$parentButton1", nil, 80, 20, function() textentry.editbox:Insert ("{data1}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "1"))
local arg2_button = _detalhes.gump:NewButton (panel, nil, "$parentButton2", nil, 80, 20, function() textentry.editbox:Insert ("{data2}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "2"))
local arg3_button = _detalhes.gump:NewButton (panel, nil, "$parentButton3", nil, 80, 20, function() textentry.editbox:Insert ("{data3}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "3"))
local arg1_button = _detalhes.gump:NewButton (panel, nil, "$parentButton1", nil, 80, 20, function() textentry.editbox:Insert ("{data1}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "1"), 1)
local arg2_button = _detalhes.gump:NewButton (panel, nil, "$parentButton2", nil, 80, 20, function() textentry.editbox:Insert ("{data2}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "2"), 1)
local arg3_button = _detalhes.gump:NewButton (panel, nil, "$parentButton3", nil, 80, 20, function() textentry.editbox:Insert ("{data3}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "3"), 1)
arg1_button:SetPoint ("topright", panel, "topright", -10, -14)
arg2_button:SetPoint ("topright", panel, "topright", -10, -36)
arg3_button:SetPoint ("topright", panel, "topright", -10, -58)
@@ -1230,7 +1232,7 @@
ColorSelection ( textentry.editbox, "|c" .. hex)
end
local func_button = _detalhes.gump:NewButton (panel, nil, "$parentButton4", nil, 80, 20, function() textentry.editbox:Insert ("{func local player = ...; return 0;}") end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_FUNC"])
local func_button = _detalhes.gump:NewButton (panel, nil, "$parentButton4", nil, 80, 20, function() textentry.editbox:Insert ("{func local player = ...; return 0;}") end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_FUNC"], 1)
local color_button = _detalhes.gump:NewColorPickButton (panel, "$parentButton5", nil, color_func)
color_button:SetSize (80, 20)
func_button:SetPoint ("topright", panel, "topright", -10, -80)
@@ -1276,17 +1278,17 @@
panel:Hide()
end
local ok_button = _detalhes.gump:NewButton (panel, nil, "$parentButtonOk", nil, 80, 20, done, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_DONE"])
local ok_button = _detalhes.gump:NewButton (panel, nil, "$parentButtonOk", nil, 80, 20, done, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_DONE"], 1)
ok_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_DONE_TOOLTIP"]
ok_button:InstallCustomTexture()
ok_button:SetPoint ("topright", panel, "topright", -10, -174)
local reset_button = _detalhes.gump:NewButton (panel, nil, "$parentDefaultOk", nil, 80, 20, function() textentry.editbox:SetText (panel.default) end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_RESET"])
local reset_button = _detalhes.gump:NewButton (panel, nil, "$parentDefaultOk", nil, 80, 20, function() textentry.editbox:SetText (panel.default) end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_RESET"], 1)
reset_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_RESET_TOOLTIP"]
reset_button:InstallCustomTexture()
reset_button:SetPoint ("topright", panel, "topright", -100, -152)
local cancel_button = _detalhes.gump:NewButton (panel, nil, "$parentDefaultCancel", nil, 80, 20, function() textentry.editbox:SetText (panel.default_text); done(); end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_CANCEL"])
local cancel_button = _detalhes.gump:NewButton (panel, nil, "$parentDefaultCancel", nil, 80, 20, function() textentry.editbox:SetText (panel.default_text); done(); end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_CANCEL"], 1)
cancel_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_CANCEL_TOOLTIP"]
cancel_button:InstallCustomTexture()
cancel_button:SetPoint ("topright", panel, "topright", -100, -174)
+48 -1
View File
@@ -401,6 +401,30 @@ local ButtonMetaFunctions = {}
else
self.icon:SetVertexColor (1, 1, 1, 1)
end
local w = self.button:GetWidth()
local iconw = self.icon:GetWidth()
local text_width = self.button.text:GetStringWidth()
if (text_width > w-15-iconw) then
if (not short_method) then
local new_width = text_width+15+iconw
self.button:SetWidth (new_width)
elseif (short_method == 1) then
local loop = true
local textsize = 11
while (loop) do
if (text_width+15+iconw < w or textsize < 8) then
loop = false
break
else
_detalhes:SetFontSize (self.button.text, textsize)
text_width = self.button.text:GetStringWidth()
textsize = textsize - 1
end
end
end
end
end
-- frame stratas
@@ -691,7 +715,7 @@ local ButtonMetaFunctions = {}
------------------------------------------------------------------------------------------------------------
--> object constructor
function gump:NewButton (parent, container, name, member, w, h, func, param1, param2, texture, text)
function gump:NewButton (parent, container, name, member, w, h, func, param1, param2, texture, text, short_method)
if (not name) then
return nil
@@ -766,11 +790,34 @@ function gump:NewButton (parent, container, name, member, w, h, func, param1, pa
ButtonObject.button.text:SetText (text)
ButtonObject.button.text:SetPoint ("center", ButtonObject.button, "center")
local text_width = ButtonObject.button.text:GetStringWidth()
if (text_width > w-15) then
if (not short_method) then
local new_width = text_width+15
ButtonObject.button:SetWidth (new_width)
elseif (short_method == 1) then
local loop = true
local textsize = 11
while (loop) do
if (text_width+15 < w or textsize < 8) then
loop = false
break
else
_detalhes:SetFontSize (ButtonObject.button.text, textsize)
text_width = ButtonObject.button.text:GetStringWidth()
textsize = textsize - 1
end
end
end
end
ButtonObject.func = func or cleanfunction
ButtonObject.funcright = cleanfunction
ButtonObject.param1 = param1
ButtonObject.param2 = param2
ButtonObject.short_method = short_method
--> hooks
ButtonObject.button:SetScript ("OnEnter", OnEnter)
ButtonObject.button:SetScript ("OnLeave", OnLeave)
+15
View File
@@ -165,6 +165,21 @@ function gump:BuildMenu (parent, menu, x_offset, y_offset, height)
switch:SetPoint ("left", label, "right", 2)
label:SetPoint (cur_x, cur_y)
local size = label.widget:GetStringWidth() + 60 + 4
if (size > max_x) then
max_x = size
end
elseif (widget_table.type == "range" or widget_table.type == "slider") then
local is_decimanls = widget_table.usedecimals
local slider = self:NewSlider (parent, nil, "$parentWidget" .. index, nil, 140, 20, widget_table.min, widget_table.max, widget_table.step, widget_table.get(), is_decimanls)
slider.tooltip = widget_table.desc
slider:SetHook ("OnValueChange", widget_table.set)
local label = self:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name, "GameFontNormal", 12)
slider:SetPoint ("left", label, "right", 2)
label:SetPoint (cur_x, cur_y)
local size = label.widget:GetStringWidth() + 60 + 4
if (size > max_x) then
max_x = size
+10 -9
View File
@@ -1,5 +1,6 @@
local _detalhes = _G._detalhes
local g = _detalhes.gump
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local _
local window = g:NewPanel (UIParent, nil, "DetailsImageEdit", nil, 100, 100, false)
@@ -219,20 +220,20 @@ local _
window [side.."Slider"]:Show()
end
local leftTexCoordButton = g:NewButton (buttonsBackground, nil, "$parentLeftTexButton", nil, 100, 20, enableTexEdit, "left", nil, nil, "Crop Left")
local leftTexCoordButton = g:NewButton (buttonsBackground, nil, "$parentLeftTexButton", nil, 100, 20, enableTexEdit, "left", nil, nil, Loc ["STRING_IMAGEEDIT_CROPLEFT"], 1)
leftTexCoordButton:SetPoint ("topright", buttonsBackground, "topright", -8, -10)
local rightTexCoordButton = g:NewButton (buttonsBackground, nil, "$parentRightTexButton", nil, 100, 20, enableTexEdit, "right", nil, nil, "Crop Right")
local rightTexCoordButton = g:NewButton (buttonsBackground, nil, "$parentRightTexButton", nil, 100, 20, enableTexEdit, "right", nil, nil, Loc ["STRING_IMAGEEDIT_CROPRIGHT"], 1)
rightTexCoordButton:SetPoint ("topright", buttonsBackground, "topright", -8, -30)
local topTexCoordButton = g:NewButton (buttonsBackground, nil, "$parentTopTexButton", nil, 100, 20, enableTexEdit, "top", nil, nil, "Crop Top")
local topTexCoordButton = g:NewButton (buttonsBackground, nil, "$parentTopTexButton", nil, 100, 20, enableTexEdit, "top", nil, nil, Loc ["STRING_IMAGEEDIT_CROPTOP"], 1)
topTexCoordButton:SetPoint ("topright", buttonsBackground, "topright", -8, -50)
local bottomTexCoordButton = g:NewButton (buttonsBackground, nil, "$parentBottomTexButton", nil, 100, 20, enableTexEdit, "bottom", nil, nil, "Crop Bottom")
local bottomTexCoordButton = g:NewButton (buttonsBackground, nil, "$parentBottomTexButton", nil, 100, 20, enableTexEdit, "bottom", nil, nil, Loc ["STRING_IMAGEEDIT_CROPBOTTOM"], 1)
bottomTexCoordButton:SetPoint ("topright", buttonsBackground, "topright", -8, -70)
leftTexCoordButton:InstallCustomTexture()
rightTexCoordButton:InstallCustomTexture()
topTexCoordButton:InstallCustomTexture()
bottomTexCoordButton:InstallCustomTexture()
local Alpha = g:NewButton (buttonsBackground, nil, "$parentBottomAlphaButton", nil, 100, 20, alpha, nil, nil, nil, "Transparency")
local Alpha = g:NewButton (buttonsBackground, nil, "$parentBottomAlphaButton", nil, 100, 20, alpha, nil, nil, nil, Loc ["STRING_IMAGEEDIT_ALPHA"], 1)
Alpha:SetPoint ("topright", buttonsBackground, "topright", -8, -115)
Alpha:InstallCustomTexture()
@@ -283,7 +284,7 @@ local _
end
end
local changeColorButton = g:NewButton (buttonsBackground, nil, "$parentOverlayColorButton", nil, 100, 20, changeColor, nil, nil, nil, "Overlay Color")
local changeColorButton = g:NewButton (buttonsBackground, nil, "$parentOverlayColorButton", nil, 100, 20, changeColor, nil, nil, nil, Loc ["STRING_IMAGEEDIT_COLOR"], 1)
changeColorButton:SetPoint ("topright", buttonsBackground, "topright", -8, -95)
changeColorButton:InstallCustomTexture()
@@ -392,11 +393,11 @@ local _
end
end
local flipButtonH = g:NewButton (buttonsBackground, nil, "$parentFlipButton", nil, 100, 20, flip, 1, nil, nil, "Flip Horizontal")
local flipButtonH = g:NewButton (buttonsBackground, nil, "$parentFlipButton", nil, 100, 20, flip, 1, nil, nil, Loc ["STRING_IMAGEEDIT_FLIPH"], 1)
flipButtonH:SetPoint ("topright", buttonsBackground, "topright", -8, -140)
flipButtonH:InstallCustomTexture()
--
local flipButtonV = g:NewButton (buttonsBackground, nil, "$parentFlipButton2", nil, 100, 20, flip, 2, nil, nil, "Flip Vertical")
local flipButtonV = g:NewButton (buttonsBackground, nil, "$parentFlipButton2", nil, 100, 20, flip, 2, nil, nil, Loc ["STRING_IMAGEEDIT_FLIPV"], 1)
flipButtonV:SetPoint ("topright", buttonsBackground, "topright", -8, -160)
flipButtonV:InstallCustomTexture()
@@ -432,7 +433,7 @@ local _
return window.callback_func (edit_texture.width, edit_texture.height, {edit_texture:GetVertexColor()}, edit_texture:GetAlpha(), coords, window.extra_param)
end
local acceptButton = g:NewButton (buttonsBackground, nil, "$parentAcceptButton", nil, 100, 20, window.accept, nil, nil, nil, "DONE")
local acceptButton = g:NewButton (buttonsBackground, nil, "$parentAcceptButton", nil, 100, 20, window.accept, nil, nil, nil, Loc ["STRING_IMAGEEDIT_DONE"], 1)
acceptButton:SetPoint ("topright", buttonsBackground, "topright", -8, -200)
acceptButton:InstallCustomTexture()
+2 -1
View File
@@ -338,7 +338,8 @@ local SliderMetaFunctions = {}
slider.thumb:SetAlpha (1)
if (slider.MyObject.have_tooltip and slider.MyObject.have_tooltip ~= Loc ["STRING_RIGHTCLICK_TYPEVALUE"]) then
GameCooltip:Reset()
--GameCooltip:Reset()
_detalhes:CooltipPreset (2)
GameCooltip:AddLine (slider.MyObject.have_tooltip)
GameCooltip:ShowCooltip (slider, "tooltip")
else
+4 -5
View File
@@ -76,18 +76,19 @@ local common_events = {
["COMBAT_BOSS_FOUND"] = true,
["GROUP_ONENTER"] = true,
["GROUP_ONLEAVE"] = true,
["ZONE_TYPE_CHANGED"] = true,
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> register a event
function _detalhes:RegisterEvent (object, event, func)
if (not _detalhes.RegistredEvents [event]) then
if (object.Msg) then
object:Msg ("(debug) unknown event", event)
object:DelayMsg ("(debug) unknown event", event)
else
_detalhes:Msg ("(debug) unknown event", event)
_detalhes:DelayMsg ("(debug) unknown event", event)
end
return
end
@@ -197,12 +198,10 @@ local common_events = {
function _detalhes:SendEvent (event, object, ...)
--> send event to all registred plugins
if (event == "PLUGIN_DISABLED" or event == "PLUGIN_ENABLED") then
return object:OnDetailsEvent (event, ...)
elseif (not object) then
for _, PluginObject in ipairs (_detalhes.RegistredEvents[event]) do
if (PluginObject.__eventtable) then
if (PluginObject [1].Enabled and PluginObject [1].__enabled) then
+10 -11
View File
@@ -16,19 +16,19 @@ function SlashCmdList.DETAILS (msg, editbox)
local command, rest = msg:match("^(%S*)%s*(.-)$")
if (command == Loc ["STRING_SLASH_NEW"]) then
if (command == Loc ["STRING_SLASH_NEW"] or command == "new") then
_detalhes:CriarInstancia (nil, true)
elseif (command == Loc ["STRING_SLASH_HIDE"] or command == Loc ["STRING_SLASH_HIDE_ALIAS1"]) then
elseif (command == Loc ["STRING_SLASH_HIDE"] or command == Loc ["STRING_SLASH_HIDE_ALIAS1"] or command == "hide") then
_detalhes:ShutDownAllInstances()
elseif (command == Loc ["STRING_SLASH_SHOW"] or command == Loc ["STRING_SLASH_SHOW_ALIAS1"]) then
elseif (command == Loc ["STRING_SLASH_SHOW"] or command == Loc ["STRING_SLASH_SHOW_ALIAS1"] or command == "show") then
_detalhes:ReabrirTodasInstancias()
elseif (command == Loc ["STRING_SLASH_WIPECONFIG"]) then
elseif (command == Loc ["STRING_SLASH_WIPECONFIG"] or command == "reinstall") then
_detalhes:WipeConfig()
elseif (command == Loc ["STRING_SLASH_DISABLE"]) then
elseif (command == Loc ["STRING_SLASH_DISABLE"] or command == "disable") then
_detalhes:CaptureSet (false, "damage", true)
_detalhes:CaptureSet (false, "heal", true)
@@ -37,7 +37,7 @@ function SlashCmdList.DETAILS (msg, editbox)
_detalhes:CaptureSet (false, "aura", true)
print (Loc ["STRING_DETAILS1"] .. Loc ["STRING_SLASH_CAPTUREOFF"])
elseif (command == Loc ["STRING_SLASH_ENABLE"]) then
elseif (command == Loc ["STRING_SLASH_ENABLE"] or command == "enable") then
_detalhes:CaptureSet (true, "damage", true)
_detalhes:CaptureSet (true, "heal", true)
@@ -46,7 +46,7 @@ function SlashCmdList.DETAILS (msg, editbox)
_detalhes:CaptureSet (true, "aura", true)
print (Loc ["STRING_DETAILS1"] .. Loc ["STRING_SLASH_CAPTUREON"])
elseif (command == Loc ["STRING_SLASH_OPTIONS"]) then
elseif (command == Loc ["STRING_SLASH_OPTIONS"] or command == "options") then
if (rest and tonumber (rest)) then
local instanceN = tonumber (rest)
@@ -66,7 +66,7 @@ function SlashCmdList.DETAILS (msg, editbox)
end
elseif (command == Loc ["STRING_SLASH_WORLDBOSS"]) then
elseif (command == Loc ["STRING_SLASH_WORLDBOSS"] or command == "worldboss") then
--local questIds = {Galleon = 32098, Sha = 32099, Oondasta = 32519, Celestials = 33117, Ordos = 33118, Nalak = 32518}
local questIds = {{"The Celestials", 33117}, {"Ordos", 33118}, {"Nalak", 32518}, {"Oondasta", 32519}, {"Salyis's Warband (Galleon)", 32098}, {"Sha of Anger", 32099}}
@@ -74,14 +74,13 @@ function SlashCmdList.DETAILS (msg, editbox)
print (format ("%s: \124cff%s\124r", _table [1], IsQuestFlaggedCompleted (_table [2]) and "ff0000"..Loc ["STRING_KILLED"] or "00ff00"..Loc ["STRING_ALIVE"]))
end
elseif (command == Loc ["STRING_SLASH_CHANGES"] or command == Loc ["STRING_SLASH_CHANGES_ALIAS1"] or command == Loc ["STRING_SLASH_CHANGES_ALIAS2"]) then
elseif (command == Loc ["STRING_SLASH_CHANGES"] or command == Loc ["STRING_SLASH_CHANGES_ALIAS1"] or command == Loc ["STRING_SLASH_CHANGES_ALIAS2"] or command == "news" or command == "updates") then
_detalhes:OpenNewsWindow()
-------- debug ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif (msg == "chatmsg") then
elseif (msg == "chat") then
SendChatMessage("[RCELVA]"..RC.version.."_"..id.."_announce_"..time().."_", "CHANNEL", nil, RC:getChanID(GetChannelList()))
elseif (msg == "chaticon") then
_detalhes:Msg ("|TInterface\\AddOns\\Details\\images\\icones_barra:" .. 14 .. ":" .. 14 .. ":0:0:256:32:0:32:0:32|tteste")
+58 -18
View File
@@ -7,6 +7,7 @@
local _
local _detalhes = _G._detalhes
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
--> mantain the enabled time captures
_detalhes.timeContainer = {}
@@ -231,31 +232,70 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> broker dps stuff
function _detalhes:BrokerTick()
local texttype = _detalhes.minimap.text_type
if (texttype == 1) then --dps
local time = _detalhes.tabela_vigente:GetCombatTime()
local broker_functions = {
-- raid dps [1]
function()
local combat = _detalhes.tabela_vigente
local time = combat:GetCombatTime()
if (not time or time == 0) then
_detalhes.databroker.text = 0
return 0
else
_detalhes.databroker.text = _detalhes:comma_value (_math_floor (_detalhes.tabela_vigente.totals_grupo[1] / time))
return _detalhes:comma_value (_math_floor (combat.totals_grupo[1] / time))
end
elseif (texttype == 2) then --hps
local time = _detalhes.tabela_vigente:GetCombatTime()
end,
-- raid hps [2]
function()
local combat = _detalhes.tabela_vigente
local time = combat:GetCombatTime()
if (not time or time == 0) then
_detalhes.databroker.text = 0
return 0
else
_detalhes.databroker.text = _detalhes:comma_value (_math_floor (_detalhes.tabela_vigente.totals_grupo[2] / time))
return _detalhes:comma_value (_math_floor (combat.totals_grupo[2] / time))
end
end,
-- elapsed time
function()
local combat_time = _detalhes.tabela_vigente:GetCombatTime()
local minutos, segundos = _math_floor (combat_time / 60), _math_floor (combat_time % 60)
return minutos .. "m " .. segundos .. "s"
end,
-- player dps
function()
local player_actor = _detalhes.tabela_vigente (1, _detalhes.playername)
if (player_actor) then
local combat_time = _detalhes.tabela_vigente:GetCombatTime()
return Loc ["STRING_ATTRIBUTE_DAMAGE_DPS"] .. ": " .. _math_floor (player_actor.total / combat_time)
else
return 0
end
end,
-- player hps
function()
local player_actor = _detalhes.tabela_vigente (2, _detalhes.playername)
if (player_actor) then
local combat_time = _detalhes.tabela_vigente:GetCombatTime()
return Loc ["STRING_ATTRIBUTE_HEAL_HPS"] .. ": " .. _math_floor (player_actor.total / combat_time)
else
return 0
end
end,
}
local broker_generic_func = function()
local func = _detalhes.minimap.text_func
if (func) then
return func()
else
if (_detalhes.minimap.text_func) then
_detalhes.databroker.text = _detalhes.minimap.text_func()
else
_detalhes.databroker.text = 0
end
return 0
end
end
function _detalhes:BrokerTick()
local func = broker_functions [_detalhes.minimap.text_type]
if (func) then
_detalhes.databroker.text = func()
else
_detalhes.databroker.text = broker_generic_func()
end
end
+97 -58
View File
@@ -286,7 +286,7 @@ function _detalhes:OpenOptionsWindow (instance, no_reopen)
local hide_3d_world = CreateFrame ("CheckButton", "DetailsOptionsWindowDisable3D", window.widget, "ChatConfigCheckButtonTemplate")
hide_3d_world:SetPoint ("bottomleft", window.widget, "bottomleft", 28, 7)
DetailsOptionsWindowDisable3DText:SetText ("Interface Edit Mode")
DetailsOptionsWindowDisable3DText:SetText (Loc ["STRING_OPTIONS_INTERFACEDIT"])
DetailsOptionsWindowDisable3DText:ClearAllPoints()
DetailsOptionsWindowDisable3DText:SetPoint ("left", hide_3d_world, "right", -2, 1)
DetailsOptionsWindowDisable3DText:SetTextColor (1, 0.8, 0)
@@ -377,7 +377,7 @@ function _detalhes:OpenOptionsWindow (instance, no_reopen)
end
end
local fillbars = g:NewButton (window, _, "$parentCreateExampleBarsButton", nil, 110, 14, fill_bars, nil, nil, nil, "Create Test Bars")
local fillbars = g:NewButton (window, _, "$parentCreateExampleBarsButton", nil, 110, 14, fill_bars, nil, nil, nil, Loc ["STRING_OPTIONS_TESTBARS"])
fillbars:SetPoint ("bottomleft", window.widget, "bottomleft", 200, 12)
--fillbars:InstallCustomTexture()
@@ -390,36 +390,41 @@ function _detalhes:OpenOptionsWindow (instance, no_reopen)
--_detalhes:SetFontSize (right_click_close.widget, 12)
--> left panel buttons
local menus = { --labels nos menus
{"Display", "Combat", "Tooltips", "Data Feed", "Profiles"},
{"Skin Selection", "Row Settings", "Row Texts", "Show & Hide Settings", "Window Settings", "Title Text", "Menus: Left Buttons", "Menus: Right Buttons", "Wallpaper", "Miscellaneous"},
{"Data Collector", "Performance Tweaks", "Plugins Management", "Spell Customization", "Data for Charts"}
{Loc ["STRING_OPTIONSMENU_DISPLAY"], Loc ["STRING_OPTIONSMENU_COMBAT"], Loc ["STRING_OPTIONSMENU_TOOLTIP"], Loc ["STRING_OPTIONSMENU_DATAFEED"], Loc ["STRING_OPTIONSMENU_PROFILES"]},
{Loc ["STRING_OPTIONSMENU_SKIN"], Loc ["STRING_OPTIONSMENU_ROWSETTINGS"], Loc ["STRING_OPTIONSMENU_ROWTEXTS"], Loc ["STRING_OPTIONSMENU_SHOWHIDE"],
Loc ["STRING_OPTIONSMENU_WINDOW"], Loc ["STRING_OPTIONSMENU_TITLETEXT"], Loc ["STRING_OPTIONSMENU_LEFTMENU"], Loc ["STRING_OPTIONSMENU_RIGHTMENU"],
Loc ["STRING_OPTIONSMENU_WALLPAPER"], Loc ["STRING_OPTIONSMENU_MISC"]},
{Loc ["STRING_OPTIONSMENU_DATACOLLECT"], Loc ["STRING_OPTIONSMENU_PERFORMANCE"], Loc ["STRING_OPTIONSMENU_PLUGINS"], Loc ["STRING_OPTIONSMENU_SPELLS"],
Loc ["STRING_OPTIONSMENU_DATACHART"]}
}
local menus2 = {
"Display", --1
"Combat", --2
"Skin Selection", --3
"Row Settings", --4
"Row Texts", --5
"Window Settings", --6
"Menus: Left Buttons", --7
"Menus: Right Buttons", --8
"Wallpaper", --9
"Performance Tweaks",--10
"Data Collector", --11
"Plugins Management",--12
"Profiles", --13
"Title Text", --14
"Spell Customization", --15
"Data for Charts", --16
"Show & Hide Settings", --17
"Miscellaneous", --18
"Data Feed", --19
"Tooltip", --20
}
local menus2 = {
Loc ["STRING_OPTIONSMENU_DISPLAY"], --1
Loc ["STRING_OPTIONSMENU_COMBAT"], --2
Loc ["STRING_OPTIONSMENU_SKIN"], --3
Loc ["STRING_OPTIONSMENU_ROWSETTINGS"], --4
Loc ["STRING_OPTIONSMENU_ROWTEXTS"], --5
Loc ["STRING_OPTIONSMENU_WINDOW"], --6
Loc ["STRING_OPTIONSMENU_LEFTMENU"], --7
Loc ["STRING_OPTIONSMENU_RIGHTMENU"], --8
Loc ["STRING_OPTIONSMENU_WALLPAPER"], --9
Loc ["STRING_OPTIONSMENU_PERFORMANCE"],--10
Loc ["STRING_OPTIONSMENU_DATACOLLECT"], --11
Loc ["STRING_OPTIONSMENU_PLUGINS"],--12
Loc ["STRING_OPTIONSMENU_PROFILES"], --13
Loc ["STRING_OPTIONSMENU_TITLETEXT"], --14
Loc ["STRING_OPTIONSMENU_SPELLS"], --15
Loc ["STRING_OPTIONSMENU_DATACHART"], --16
Loc ["STRING_OPTIONSMENU_SHOWHIDE"], --17
Loc ["STRING_OPTIONSMENU_MISC"], --18
Loc ["STRING_OPTIONSMENU_DATAFEED"], --19
Loc ["STRING_OPTIONSMENU_TOOLTIP"], --20
}
local select_options = function (options_type, true_index)
window:hide_all_options()
@@ -688,7 +693,7 @@ local menus = { --labels nos menus
container_slave:SetMovable (true)
container_window:SetWidth (663)
container_window:SetHeight (500)
container_window:SetHeight (470)
container_window:SetScrollChild (container_slave)
container_window:SetPoint ("TOPLEFT", window.widget, "TOPLEFT", 198, -88)
@@ -923,10 +928,24 @@ local menus = { --labels nos menus
end
return f
end
end
function window:CreateLineBackground2 (frame, widget_name, label_name, desc_loc, icon, is_button1, is_button2)
local label
if (type (label_name) == "table") then
label = label_name
else
label = frame [label_name]
end
if (label:GetObjectType() == "FontString") then
if (label:GetStringWidth() > 200) then
_detalhes:SetFontSize (label, 10)
elseif (label:GetStringWidth() > 150) then
_detalhes:SetFontSize (label, 11)
end
end
if (type (widget_name) == "table") then
widget_name.info = desc_loc
widget_name.have_tooltip = desc_loc
@@ -1457,7 +1476,7 @@ function window:CreateFrame19()
--> broker
--anchor
g:NewLabel (frame19, _, "$parentHotcornerAnchor", "brokerAnchorLabel", Loc ["STRING_OPTIONS_DATABROKER"], "GameFontNormal")
--broker text
do
g:NewLabel (frame19, _, "$parentBrokerTextLabel", "brokerTextLabel", Loc ["STRING_OPTIONS_DATABROKER_TEXT"], "GameFontHighlightLeft")
@@ -1466,8 +1485,16 @@ function window:CreateFrame19()
end
local build_menu = function()
return {
--raid dps
{value = 1, label = Loc ["STRING_OPTIONS_DATABROKER_TEXT1"], onclick = on_select, icon = "Interface\\AddOns\\Details\\images\\atributos_icones", texcoord = {0, 0.125, 0, 1}},
--raid hps
{value = 2, label = Loc ["STRING_OPTIONS_DATABROKER_TEXT2"], onclick = on_select, icon = "Interface\\AddOns\\Details\\images\\atributos_icones", texcoord = {0.125, 0.25, 0, 1}},
--combat time
{value = 3, label = Loc ["STRING_OPTIONS_DATABROKER_TEXT3"], onclick = on_select, icon = [[Interface\COMMON\mini-hourglass]], texcoord = {0, 1, 0, 1}},
--player dps
{value = 4, label = Loc ["STRING_OPTIONS_DATABROKER_TEXT4"], onclick = on_select, icon = _detalhes.sub_atributos[1].icones[2][1], texcoord = _detalhes.sub_atributos[1].icones[2][2]},
--player hps
{value = 5, label = Loc ["STRING_OPTIONS_DATABROKER_TEXT5"], onclick = on_select, icon = _detalhes.sub_atributos[2].icones[2][1], texcoord = _detalhes.sub_atributos[2].icones[2][2]},
}
end
local dropdown = g:NewDropDown (frame19, _, "$parentBrokerTextDropdown", "brokerTextDropdown", 160, 20, build_menu, _detalhes.minimap.text_type)
@@ -3060,8 +3087,8 @@ function window:CreateFrame1()
--> Max Segments
local titulo_display = g:NewLabel (frame1, _, "$parentTituloDisplay", "tituloDisplayLabel", "Display", "GameFontNormal", 16) --> localize-me
local titulo_display_desc = g:NewLabel (frame1, _, "$parentTituloDisplay2", "tituloDisplay2Label", "Preferencial adjustments of instances (windows).", "GameFontNormal", 9, "white") --> localize-me
local titulo_display = g:NewLabel (frame1, _, "$parentTituloDisplay", "tituloDisplayLabel", Loc ["STRING_OPTIONSMENU_DISPLAY"], "GameFontNormal", 16) --> localize-me
local titulo_display_desc = g:NewLabel (frame1, _, "$parentTituloDisplay2", "tituloDisplay2Label", Loc ["STRING_OPTIONSMENU_DISPLAY_DESC"], "GameFontNormal", 9, "white") --> localize-me
titulo_display_desc.width = 320
g:NewLabel (frame1, _, "$parentSliderLabel", "segmentsLabel", Loc ["STRING_OPTIONS_MAXSEGMENTS"], "GameFontHighlightLeft")
@@ -3146,14 +3173,14 @@ function window:CreateFrame1()
local icon = [[Interface\COMMON\mini-hourglass]]
local iconcolor = {1, 1, 1, .5}
local abbreviationOptions = {
{value = 1, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_NONE"], desc = "Example: 305.500 -> 305500", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 2, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOK"], desc = "Example: 305.500 -> 305.5K", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 3, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOK2"], desc = "Example: 305.500 -> 305K", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 4, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOK0"], desc = "Example: 25.305.500 -> 25M", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 5, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOKMIN"], desc = "Example: 305.500 -> 305.5k", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 6, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOK2MIN"], desc = "Example: 305.500 -> 305k", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 7, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOK0MIN"], desc = "Example: 25.305.500 -> 25m", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 8, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_COMMA"], desc = "Example: 25305500 -> 25.305.500", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor} --, desc = ""
{value = 1, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_NONE"], desc = Loc ["STRING_EXAMPLE"] .. ": 305.500 -> 305500", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 2, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOK"], desc = Loc ["STRING_EXAMPLE"] .. ": 305.500 -> 305.5K", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 3, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOK2"], desc = Loc ["STRING_EXAMPLE"] .. ": 305.500 -> 305K", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 4, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOK0"], desc = Loc ["STRING_EXAMPLE"] .. ": 25.305.500 -> 25M", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 5, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOKMIN"], desc = Loc ["STRING_EXAMPLE"] .. ": 305.500 -> 305.5k", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 6, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOK2MIN"], desc = Loc ["STRING_EXAMPLE"] .. ": 305.500 -> 305k", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 7, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_TOK0MIN"], desc = Loc ["STRING_EXAMPLE"] .. ": 25.305.500 -> 25m", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor}, --, desc = ""
{value = 8, label = Loc ["STRING_OPTIONS_PS_ABBREVIATE_COMMA"], desc = Loc ["STRING_EXAMPLE"] .. ": 25305500 -> 25.305.500", onclick = onSelectTimeAbbreviation, icon = icon, iconcolor = iconcolor} --, desc = ""
}
local buildAbbreviationMenu = function()
return abbreviationOptions
@@ -3223,7 +3250,7 @@ function window:CreateFrame1()
local buttons_width = 140
--lock unlock
g:NewButton (frame1, _, "$parentLockButton", "LockButton", buttons_width, 18, _detalhes.lock_instance_function, nil, nil, nil, Loc ["STRING_OPTIONS_WC_LOCK"])
g:NewButton (frame1, _, "$parentLockButton", "LockButton", buttons_width, 18, _detalhes.lock_instance_function, nil, nil, nil, Loc ["STRING_OPTIONS_WC_LOCK"], 1)
frame1.LockButton:InstallCustomTexture()
window:CreateLineBackground2 (frame1, "LockButton", "LockButton", Loc ["STRING_OPTIONS_WC_LOCK_DESC"], nil, {1, 0.8, 0}, {1, 1, 1})
@@ -3231,7 +3258,7 @@ function window:CreateFrame1()
frame1.LockButton:SetTextColor (1, 1, 1, 1)
--break snap
g:NewButton (frame1, _, "$parentBreakSnapButton", "BreakSnapButton", buttons_width, 18, _G.DetailsOptionsWindow.instance.Desagrupar, -1, nil, nil, Loc ["STRING_OPTIONS_WC_UNSNAP"])
g:NewButton (frame1, _, "$parentBreakSnapButton", "BreakSnapButton", buttons_width, 18, _G.DetailsOptionsWindow.instance.Desagrupar, -1, nil, nil, Loc ["STRING_OPTIONS_WC_UNSNAP"], 1)
frame1.BreakSnapButton:InstallCustomTexture()
window:CreateLineBackground2 (frame1, "BreakSnapButton", "BreakSnapButton", Loc ["STRING_OPTIONS_WC_UNSNAP_DESC"], nil, {1, 0.8, 0}, {1, 1, 1})
@@ -3239,7 +3266,7 @@ function window:CreateFrame1()
frame1.BreakSnapButton:SetTextColor (1, 1, 1, 1)
--close
g:NewButton (frame1, _, "$parentCloseButton", "CloseButton", buttons_width, 18, _detalhes.close_instancia_func, _G.DetailsOptionsWindow.instance, nil, nil, Loc ["STRING_OPTIONS_WC_CLOSE"])
g:NewButton (frame1, _, "$parentCloseButton", "CloseButton", buttons_width, 18, _detalhes.close_instancia_func, _G.DetailsOptionsWindow.instance, nil, nil, Loc ["STRING_OPTIONS_WC_CLOSE"], 1)
frame1.CloseButton:InstallCustomTexture()
window:CreateLineBackground2 (frame1, "CloseButton", "CloseButton", Loc ["STRING_OPTIONS_WC_CLOSE_DESC"], nil, {1, 0.8, 0}, {1, 1, 1})
@@ -3247,7 +3274,7 @@ function window:CreateFrame1()
frame1.CloseButton:SetTextColor (1, 1, 1, 1)
--create
g:NewButton (frame1, _, "$parentCreateWindowButton", "CreateWindowButton", buttons_width, 18, function() _detalhes.CriarInstancia (nil, nil, true) end, nil, nil, nil, Loc ["STRING_OPTIONS_WC_CREATE"])
g:NewButton (frame1, _, "$parentCreateWindowButton", "CreateWindowButton", buttons_width, 18, function() _detalhes.CriarInstancia (nil, nil, true) end, nil, nil, nil, Loc ["STRING_OPTIONS_WC_CREATE"], 1)
frame1.CreateWindowButton:InstallCustomTexture()
window:CreateLineBackground2 (frame1, "CreateWindowButton", "CreateWindowButton", Loc ["STRING_OPTIONS_WC_CREATE_DESC"], nil, {1, 0.8, 0}, {1, 1, 1})
@@ -4061,7 +4088,7 @@ function window:CreateFrame3()
_detalhes:Msg (Loc ["STRING_OPTIONS_SAVELOAD_STDSAVE"])
end
g:NewButton (frame3, _, "$parentToAllStyleButton", "applyToAll", 160, 18, applyToAll, nil, nil, nil, Loc ["STRING_OPTIONS_SAVELOAD_APPLYTOALL"])
g:NewButton (frame3, _, "$parentToAllStyleButton", "applyToAll", 160, 18, applyToAll, nil, nil, nil, Loc ["STRING_OPTIONS_SAVELOAD_APPLYTOALL"], 1)
frame3.applyToAll:InstallCustomTexture()
g:NewButton (frame3, _, "$parentMakeDefaultButton", "makeDefault", 160, 18, makeDefault, nil, nil, nil, Loc ["STRING_OPTIONS_SAVELOAD_MAKEDEFAULT"])
frame3.makeDefault:InstallCustomTexture()
@@ -6367,10 +6394,7 @@ function window:CreateFrame9()
close:SetSize (32, 32)
close:SetPoint ("topright", f, "topright", -3, -1)
local okey = CreateFrame ("button", "DetailsLoadWallpaperImageOkey", f, "OptionsButtonTemplate")
okey:SetPoint ("left", editbox.widget, "right", 2, 0)
okey:SetText (Loc ["STRING_OPTIONS_WALLPAPER_LOAD_OKEY"])
okey:SetScript ("OnClick", function()
local okey_func = function()
local text = editbox:GetText()
if (text == "") then
return
@@ -6382,18 +6406,21 @@ function window:CreateFrame9()
instance:InstanceWallpaper (path, "all", 0.50, {0, 1, 0, 1}, 256, 256, {1, 1, 1, 1})
_detalhes:OpenOptionsWindow (instance)
window:update_wallpaper_info()
end)
end
local okey = g:NewButton (f, _, "$parentOkeyButton", nil, 105, 20, okey_func, nil, nil, nil, Loc ["STRING_OPTIONS_WALLPAPER_LOAD_OKEY"], 1)
okey:SetPoint ("left", editbox.widget, "right", 2, 0)
okey:InstallCustomTexture()
local throubleshoot = CreateFrame ("button", "DetailsLoadWallpaperImageOkey", f, "OptionsButtonTemplate")
throubleshoot:SetPoint ("left", okey, "right", 2, 0)
throubleshoot:SetText (Loc ["STRING_OPTIONS_WALLPAPER_LOAD_TROUBLESHOOT"])
throubleshoot:SetScript ("OnClick", function()
local throubleshoot_func = function()
if (t:GetText() == Loc ["STRING_OPTIONS_WALLPAPER_LOAD_EXCLAMATION"]) then
t:SetText (Loc ["STRING_OPTIONS_WALLPAPER_LOAD_TROUBLESHOOT_TEXT"])
else
DetailsLoadWallpaperImage.t:SetText (Loc ["STRING_OPTIONS_WALLPAPER_LOAD_EXCLAMATION"])
end
end)
end
local throubleshoot = g:NewButton (f, _, "$parentThroubleshootButton", nil, 105, 20, throubleshoot_func, nil, nil, nil, Loc ["STRING_OPTIONS_WALLPAPER_LOAD_TROUBLESHOOT"], 1)
throubleshoot:SetPoint ("left", okey, "right", 2, 0)
throubleshoot:InstallCustomTexture()
end
DetailsLoadWallpaperImage.t:SetText (Loc ["STRING_OPTIONS_WALLPAPER_LOAD_EXCLAMATION"])
@@ -7026,6 +7053,12 @@ function window:CreateFrame12()
end
end
if (pluginObject.OpenOptionsPanel) then
g:NewButton (bframe, nil, "$parentOptionsButton"..i, "OptionsButton"..i, 86, 16, pluginObject.OpenOptionsPanel, nil, nil, nil, Loc ["STRING_OPTIONS_PLUGINS_OPTIONS"])
bframe ["OptionsButton"..i]:SetPoint ("topleft", frame4, "topleft", 510, y-2)
bframe ["OptionsButton"..i]:InstallCustomTexture()
end
i = i + 1
y = y - 20
end
@@ -7097,6 +7130,12 @@ function window:CreateFrame12()
end
end
if (pluginObject.OpenOptionsPanel) then
g:NewButton (bframe, nil, "$parentOptionsButton"..i, "OptionsButton"..i, 86, 16, pluginObject.OpenOptionsPanel, nil, nil, nil, Loc ["STRING_OPTIONS_PLUGINS_OPTIONS"])
bframe ["OptionsButton"..i]:SetPoint ("topleft", frame4, "topleft", 510, y-2)
bframe ["OptionsButton"..i]:InstallCustomTexture()
end
i = i + 1
y = y - 20
end
File diff suppressed because one or more lines are too long
+304 -272
View File
File diff suppressed because it is too large Load Diff
@@ -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@
+2 -23
View File
@@ -374,30 +374,9 @@ function _G._detalhes:Start()
--BNSendFriendInvite ("tercio#1488")
function _detalhes:EnterChatChannel()
local realm = GetRealmName()
realm = realm or ""
if (realm ~= "Azralon") then
return
end
--> room name
local room_name = "Details"
--> already in?
for room_index = 1, 10 do
local _, name = GetChannelName (room_index)
if (name == room_name) then
return --> already in the room
end
end
--> enter
JoinChannelByName (room_name)
if (not _detalhes.schedule_chat_enter and not _detalhes.schedule_chat_leave) then
_detalhes.schedule_chat_enter = _detalhes:ScheduleTimer ("EnterChatChannel", 30)
end
_detalhes:ScheduleTimer ("EnterChatChannel", 30)
end