- Revamp on Death report.

- Data send to broker now is correctly formated.
- Modified the percentage method used on Comparison Panel.
- Added options panel for Encounter Details.

- New API: _detalhes:GetCurrentCombat() returns the current combat object
- New API: _detalhes:GetCombatSegments() returns a numeric table with all stored combats.
- New API: _detalhes:GetZoneType() returns the type from GetInstanceInfo().
- New API: _detalhes:InGroup()return true if Details! is considering the player inside a group.
- New API: _detalhes:GetOnlyName (string) return self.nome or string without realm name.

- New Event: ZONE_TYPE_CHANGED, it's triggered when the player change the zoze type.
- New Event: GROUP_ONENTER GROUP_ONLEAVE, trigger when the player left or enter in a group.
This commit is contained in:
tercio
2014-07-17 17:57:32 -03:00
parent 436e86b669
commit e406fe464b
18 changed files with 1949 additions and 1191 deletions
@@ -90,6 +90,7 @@ local function CreatePluginFrames (data)
--> when details finish his startup and are ready to work
elseif (event == "DETAILS_STARTED") then
--> check if details are in combat, if not check if the last fight was a boss fight
if (not EncounterDetails:IsInCombat()) then
--> get the current combat table
@@ -136,10 +137,16 @@ local function CreatePluginFrames (data)
--_detalhes:TimeDataRegister ("Raid Damage Done", damage_done_func, {last_damage = 0, max_damage = 0}, "Encounter Details", "v1.0", [[Interface\ICONS\Ability_DualWield]], true)
_detalhes:TimeDataRegister ("Raid Damage Done", string_damage_done_func, nil, "Encounter Details", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
if (EncounterDetails.db.show_icon == 4) then
EncounterDetails:ShowIcon()
elseif (EncounterDetails.db.show_icon == 5) then
EncounterDetails:AutoShowIcon()
end
elseif (event == "COMBAT_PLAYER_ENTER") then --> combat started
if (EncounterDetails.showing) then
EncounterDetails:HideIcon()
if (EncounterDetails.showing and EncounterDetails.db.hide_on_combat) then
--EncounterDetails:HideIcon()
EncounterDetails:CloseWindow()
end
@@ -151,24 +158,58 @@ local function CreatePluginFrames (data)
if (EncounterDetails.combat_boss_found) then
EncounterDetails.combat_boss_found = false
end
if (EncounterDetails.db.show_icon == 5) then
EncounterDetails:AutoShowIcon()
end
elseif (event == "COMBAT_BOSS_FOUND") then
EncounterDetails.combat_boss_found = true
if (EncounterDetails.db.show_icon == 5) then
EncounterDetails:AutoShowIcon()
end
elseif (event == "DETAILS_DATA_RESET") then
if (_G.DetailsRaidDpsGraph) then
_G.DetailsRaidDpsGraph:ResetData()
end
EncounterDetails:HideIcon()
if (EncounterDetails.db.show_icon == 5) then
EncounterDetails:AutoShowIcon()
end
--EncounterDetails:HideIcon()
EncounterDetails:CloseWindow()
--drop last combat table
EncounterDetails.LastSegmentShown = nil
elseif (event == "GROUP_ONENTER") then
if (EncounterDetails.db.show_icon == 2) then
EncounterDetails:ShowIcon()
end
elseif (event == "GROUP_ONLEAVE") then
if (EncounterDetails.db.show_icon == 2) then
EncounterDetails:HideIcon()
end
elseif (event == "ZONE_TYPE_CHANGED") then
if (EncounterDetails.db.show_icon == 1) then
if (select (1, ...) == "raid") then
EncounterDetails:ShowIcon()
else
EncounterDetails:HideIcon()
end
end
elseif (event == "PLUGIN_DISABLED") then
EncounterDetails:HideIcon()
EncounterDetails:CloseWindow()
elseif (event == "PLUGIN_ENABLED") then
--EncounterDetails:ShowIcon()
if (EncounterDetails.db.show_icon == 5) then
EncounterDetails:AutoShowIcon()
elseif (EncounterDetails.db.show_icon == 4) then
EncounterDetails:ShowIcon()
end
end
end
@@ -216,6 +257,8 @@ local function CreatePluginFrames (data)
EncounterDetails:OpenAndRefresh()
--> show
EncounterDetailsFrame:Show()
EncounterDetails.open = true
if (EncounterDetailsFrame.ShowType == "graph") then
EncounterDetails:BuildDpsGraphic()
end
@@ -223,6 +266,7 @@ local function CreatePluginFrames (data)
end
function EncounterDetails:CloseWindow()
EncounterDetails.open = false
EncounterDetailsFrame:Hide()
return true
end
@@ -674,26 +718,12 @@ function EncounterDetails:OpenAndRefresh (_, segment)
local _combat_object = _combat_object
if (segment) then
_combat_object = _detalhes.tabela_historico.tabelas [segment]
--get combat segment, 1 more recently ...25 oldest
_combat_object = EncounterDetails:GetCombat (segment)
else
_G [frame:GetName().."SegmentsDropdown"].MyObject:Select (1, true)
end
--[
if (frame.ShowType == "main") then
--frame.buttonSwitchNormal:Disable()
--if (_combat_object.DpsGraphic[1]) then
--frame.buttonSwitchGraphic:Enable()
--else
-- frame.buttonSwitchGraphic:Disable()
--end
elseif (frame.ShowType == "graph") then
--frame.buttonSwitchNormal:Enable()
--frame.buttonSwitchGraphic:Disable()
end
--]]
local boss_id
local map_id
local boss_info
@@ -708,14 +738,36 @@ function EncounterDetails:OpenAndRefresh (_, segment)
}
end
if (not _combat_object.is_boss) then
for _, combat in _ipairs (EncounterDetails:GetCombatSegments()) do
if (combat.is_boss and EncounterDetails:GetBossDetails (combat.is_boss.mapid, combat.is_boss.index)) then
_combat_object = combat
break
end
end
if (not _combat_object.is_boss) then
if (EncounterDetails.LastSegmentShown) then
_combat_object = EncounterDetails.LastSegmentShown
else
return
end
end
end
boss_id = _combat_object.is_boss.index
map_id = _combat_object.is_boss.mapid
boss_info = _detalhes:GetBossDetails (_combat_object.is_boss.mapid, _combat_object.is_boss.index)
if (not boss_info) then
return EncounterDetails:Msg (Loc ["STRING_BOSS_NOT_REGISTRED"])
if (EncounterDetails.LastSegmentShown) then
_combat_object = EncounterDetails.LastSegmentShown
else
return EncounterDetails:Msg (Loc ["STRING_BOSS_NOT_REGISTRED"])
end
end
EncounterDetails.LastSegmentShown = _combat_object
-------------- set boss name and zone name --------------
EncounterDetailsFrame.boss_name:SetText (_combat_object.is_boss.encounter)
EncounterDetailsFrame.raid_name:SetText (_combat_object.is_boss.zone)
@@ -957,10 +1009,10 @@ function EncounterDetails:OpenAndRefresh (_, segment)
for index, jogador in _ipairs (DamageContainer._ActorTable) do
--> só estou interessado nos adds, conferir pelo nome
if (adds_pool [tonumber (jogador.serial:sub(6, 10), 16)] or (jogador.flag_original and bit.band (jogador.flag_original, 0x00000040) ~= 0)) then --> é um inimigo) then
if (adds_pool [tonumber (jogador.serial:sub(6, 10), 16)] or (jogador.flag_original and bit.band (jogador.flag_original, 0x00000060) ~= 0)) then --> é um inimigo ou neutro
local nome = jogador.nome
local tabela = {total = 0, dano_em = {}, dano_em_total = 0, damage_from = {}, damage_from_total = 0}
local tabela = {nome = nome, total = 0, dano_em = {}, dano_em_total = 0, damage_from = {}, damage_from_total = 0}
--> total de dano que ele causou
tabela.total = jogador.total
@@ -1006,7 +1058,7 @@ function EncounterDetails:OpenAndRefresh (_, segment)
end
end)
adds [nome] = tabela
tinsert (adds, tabela)
end
@@ -1030,6 +1082,9 @@ function EncounterDetails:OpenAndRefresh (_, segment)
GameTooltip:AddDoubleLine ("|TInterface\\AddOns\\Details\\images\\classes_small:14:14:0:0:128:128:"..(coords[1]*128)..":"..(coords[2]*128)..":"..(coords[3]*128)..":"..(coords[4]*128).."|t "..esta_tabela[1]..": ", _detalhes:comma_value(esta_tabela[2]).." (".. _cstr ("%.1f", esta_tabela[2]/dano_em_total*100) .."%)", 1, 1, 1, 1, 1, 1)
end
GameTooltip:AddLine (" ")
GameTooltip:AddLine ("CLICK to Report")
GameTooltip:Show()
end
@@ -1055,6 +1110,9 @@ function EncounterDetails:OpenAndRefresh (_, segment)
end
end
GameTooltip:AddLine (" ")
GameTooltip:AddLine ("CLICK to Report")
GameTooltip:Show()
end
@@ -1064,7 +1122,11 @@ function EncounterDetails:OpenAndRefresh (_, segment)
local index = 1
quantidade = 0
for addName, esta_tabela in _pairs (adds) do
table.sort (adds, function (t1, t2) return t1.nome < t2.nome end)
for index, esta_tabela in _ipairs (adds) do
local addName = esta_tabela.nome
local barra = container.barras [index]
if (not barra) then
@@ -1433,24 +1495,57 @@ function EncounterDetails:OnEvent (_, event, ...)
--> create widgets
CreatePluginFrames (data)
local MINIMAL_DETAILS_VERSION_REQUIRED = 1
local PLUGIN_MINIMAL_DETAILS_VERSION_REQUIRED = 1
local PLUGIN_TYPE = "TOOLBAR"
local PLUGIN_LOCALIZED_NAME = Loc ["STRING_PLUGIN_NAME"]
local PLUGIN_REAL_NAME = "DETAILS_PLUGIN_ENCOUNTER_DETAILS"
local PLUGIN_ICON = [[Interface\Scenarios\ScenarioIcon-Boss]]
local PLUGIN_AUTHOR = "Details! Team"
local PLUGIN_VERSION = "v1.05"
local default_settings = {
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 = _G._detalhes:InstallPlugin ("TOOLBAR", Loc ["STRING_PLUGIN_NAME"], "Interface\\Scenarios\\ScenarioIcon-Boss", EncounterDetails, "DETAILS_PLUGIN_ENCOUNTER_DETAILS", MINIMAL_DETAILS_VERSION_REQUIRED, "Details! Team", "v1.05")
local install, saveddata, is_enabled = _G._detalhes:InstallPlugin (
PLUGIN_TYPE,
PLUGIN_LOCALIZED_NAME,
PLUGIN_ICON,
EncounterDetails,
PLUGIN_REAL_NAME,
PLUGIN_MINIMAL_DETAILS_VERSION_REQUIRED,
PLUGIN_AUTHOR,
PLUGIN_VERSION,
default_settings
)
if (type (install) == "table" and install.error) then
print (install.error)
end
EncounterDetails.db = saveddata
--> Register needed events
_G._detalhes:RegisterEvent (EncounterDetails, "COMBAT_PLAYER_ENTER")
_G._detalhes:RegisterEvent (EncounterDetails, "COMBAT_PLAYER_LEAVE")
_G._detalhes:RegisterEvent (EncounterDetails, "COMBAT_BOSS_FOUND")
_G._detalhes:RegisterEvent (EncounterDetails, "DETAILS_DATA_RESET")
_G._detalhes:RegisterEvent (EncounterDetails, "GROUP_ONENTER")
_G._detalhes:RegisterEvent (EncounterDetails, "GROUP_ONLEAVE")
_G._detalhes:RegisterEvent (EncounterDetails, "ZONE_TYPE_CHANGED")
end
end
elseif (event == "PLAYER_LOGOUT") then
_detalhes_databaseEncounterDetails = EncounterDetails.data
end
end
@@ -1,7 +1,6 @@
## Interface: 50400
## Title: Details Encounter (plugin)
## Notes: Plugin for Details
## SavedVariablesPerCharacter: _detalhes_databaseEncounterDetails
## RequiredDeps: Details
## OptionalDeps: Ace3
+120 -13
View File
@@ -9,7 +9,110 @@ do
local _GetSpellInfo = _detalhes.getspellinfo
_detalhes.EncounterDetailsTempWindow = function (EncounterDetails)
--> options panel
function EncounterDetails:AutoShowIcon()
local found_boss = false
for _, combat in ipairs (EncounterDetails:GetCombatSegments()) do
if (combat.is_boss) then
EncounterDetails:ShowIcon()
found_boss = true
end
end
if (EncounterDetails:GetCurrentCombat().is_boss) then
EncounterDetails:ShowIcon()
found_boss = true
end
if (not found_boss) then
EncounterDetails:HideIcon()
end
end
local build_options_panel = function()
local options_frame = CreateFrame ("frame", "EncounterDetailsOptionsWindow", UIParent, "ButtonFrameTemplate")
tinsert (UISpecialFrames, "EncounterDetailsOptionsWindow")
options_frame:SetSize (500, 200)
options_frame:SetFrameStrata ("HIGH")
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 ("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
local set = function (_, _, value)
EncounterDetails.db.show_icon = value
if (value == 1) then
if (EncounterDetails:GetZoneType() == "raid") then
EncounterDetails:ShowIcon()
else
EncounterDetails:HideIcon()
end
elseif (value == 2) then
if (EncounterDetails:InGroup()) then
EncounterDetails:ShowIcon()
else
EncounterDetails:HideIcon()
end
elseif (value == 3) then
if (EncounterDetails:GetCurrentCombat().is_boss) then
EncounterDetails:ShowIcon()
else
EncounterDetails:HideIcon()
end
elseif (value == 4) then
EncounterDetails:ShowIcon()
elseif (value == 5) then
EncounterDetails:AutoShowIcon()
end
end
local on_show_menu = {
{value = 1, label = "Inside Raid", onclick = set, desc = "Only show the icon while inside a raid."},
{value = 2, label = "In Group", onclick = set, desc = "Only show the icon while in group."},
{value = 3, label = "After Encounter", onclick = set, desc = "Show the icon after a raid boss encounter."},
{value = 4, label = "Always", onclick = set, desc = "Always show the icon."},
{value = 5, label = "Auto", onclick = set, desc = "The plugin decides when the icon needs to be shown."},
}
-- /dump DETAILS_PLUGIN_ENCOUNTER_DETAILS.db.show_icon
local menu = {
--show when dropdown
{
type = "select",
get = function() return EncounterDetails.db.show_icon end,
values = function() return on_show_menu end,
desc = "When the icon is shown in the Details! tooltip.",
name = "Show Icon"
},
{
type = "toggle",
get = function() return EncounterDetails.db.hide_on_combat end,
set = function (self, fixedparam, value) EncounterDetails.db.hide_on_combat = value end,
desc = "Encounter Details window automatically close when you enter in combat.",
name = "Hide on Combat"
},
}
DetailsFrameWork:BuildMenu (options_frame, menu, 15, -75, 260)
end
EncounterDetails.OpenOptionsPanel = function()
if (not EncounterDetailsOptionsWindow) then
build_options_panel()
end
EncounterDetailsOptionsWindow:Show()
end
function EncounterDetails:CreateRowTexture (row)
row.textura = CreateFrame ("StatusBar", nil, row)
row.textura:SetAllPoints (row)
@@ -646,11 +749,11 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156:
local backdrop = {edgeFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeSize = 1, insets = {left = 1, right = 1, top = 0, bottom = 1}}
--> Nome do Encontro
DetailsFrameWork:NewLabel (frame, frame, nil, "boss_name", "Nome do Boss Aqui", "QuestFont_Large")
DetailsFrameWork:NewLabel (frame, frame, nil, "boss_name", "Unknown Encounter", "QuestFont_Large")
frame.boss_name:SetPoint ("TOPLEFT", frame, "TOPLEFT", 100, -51)
--> Nome da Raid
DetailsFrameWork:NewLabel (frame, frame, nil, "raid_name", "Throne of Thunder", "GameFontHighlightSmall")
DetailsFrameWork:NewLabel (frame, frame, nil, "raid_name", "Unknown Raid", "GameFontHighlightSmall")
frame.raid_name:SetPoint ("CENTER", frame.boss_name, "CENTER", 0, 14)
--> Barra de Status:
@@ -703,6 +806,10 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156:
local segmentos = DetailsFrameWork:NewDropDown (frame, _, "$parentSegmentsDropdown", "segmentosDropdown", 160, 18, buildSegmentosMenu, nil)
segmentos:SetPoint ("left", segmentos_string, "right", 2, 0)
local options_button = DetailsFrameWork:NewButton (frame, _, "$parentOptionsButton", nil, 100, 18, EncounterDetails.OpenOptionsPanel, nil, nil, nil, "Options")
options_button:SetPoint ("left", segmentos, "right", 14, 0)
options_button.textalign = "<"
--> Caixa do Dano total tomado pela Raid
@@ -893,14 +1000,14 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156:
container_adds_frame:SetMovable (true)
container_adds_window:SetWidth (170)
container_adds_window:SetHeight (67)
container_adds_window:SetHeight (65)
container_adds_window:SetScrollChild (container_adds_frame)
container_adds_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 260, -117)
container_adds_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 260, -113)
DetailsFrameWork:NewLabel (container_adds_window, container_adds_window, nil, "titulo", Loc ["STRING_ADDS"], "QuestFont_Large", 16, {1, 1, 1})
container_adds_window.titulo:SetPoint ("bottomleft", container_adds_window, "topleft", 0, 4)
DetailsFrameWork:NewScrollBar (container_adds_window, container_adds_frame, 4, -9)
DetailsFrameWork:NewScrollBar (container_adds_window, container_adds_frame, 4, -13)
container_adds_window.slider:Altura (45)
container_adds_window.slider:cimaPoint (0, 1)
container_adds_window.slider:baixoPoint (0, -1)
@@ -970,14 +1077,14 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156:
container_interrupt_frame:SetMovable (true)
container_interrupt_window:SetWidth (170)
container_interrupt_window:SetHeight (67)
container_interrupt_window:SetHeight (65)
container_interrupt_window:SetScrollChild (container_interrupt_frame)
container_interrupt_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 480, -117)
container_interrupt_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 480, -113)
DetailsFrameWork:NewLabel (container_interrupt_window, container_interrupt_window, nil, "titulo", Loc ["STRING_INTERRUPTS"], "QuestFont_Large", 16, {1, 1, 1})
container_interrupt_window.titulo:SetPoint ("bottomleft", container_interrupt_window, "topleft", 0, 4)
DetailsFrameWork:NewScrollBar (container_interrupt_window, container_interrupt_frame, 4, -9)
DetailsFrameWork:NewScrollBar (container_interrupt_window, container_interrupt_frame, 4, -13)
container_interrupt_window.slider:Altura (45)
container_interrupt_window.slider:cimaPoint (0, 1)
container_interrupt_window.slider:baixoPoint (0, -1)
@@ -1041,20 +1148,20 @@ Message: ..\AddOns\Details_EncounterDetails\frames.lua line 156:
container_dispell_frame:SetAllPoints (container_dispell_window)
container_dispell_frame:SetWidth (170)
container_dispell_frame:SetHeight (67)
container_dispell_frame:SetHeight (62)
container_dispell_frame:EnableMouse (true)
container_dispell_frame:SetResizable (false)
container_dispell_frame:SetMovable (true)
container_dispell_window:SetWidth (170)
container_dispell_window:SetHeight (70)
container_dispell_window:SetHeight (68)
container_dispell_window:SetScrollChild (container_dispell_frame)
container_dispell_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 260, -235)
container_dispell_window:SetPoint ("TOPLEFT", frame, "TOPLEFT", 260, -231)
DetailsFrameWork:NewLabel (container_dispell_window, container_dispell_window, nil, "titulo", Loc ["STRING_DISPELLS"], "QuestFont_Large", 16, {1, 1, 1})
container_dispell_window.titulo:SetPoint ("bottomleft", container_dispell_window, "topleft", 0, 4)
DetailsFrameWork:NewScrollBar (container_dispell_window, container_dispell_frame, 4, -9)
DetailsFrameWork:NewScrollBar (container_dispell_window, container_dispell_frame, 4, -13)
container_dispell_window.slider:Altura (45)
container_dispell_window.slider:cimaPoint (0, 1)
container_dispell_window.slider:baixoPoint (0, -1)