- 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
+131 -425
View File
@@ -10,22 +10,21 @@
local _
--> Event types:
_detalhes.RegistredEvents = {
--> details self events
--> instances
["DETAILS_INSTANCE_OPEN"] = {},
["DETAILS_INSTANCE_CLOSE"] = {},
["DETAILS_INSTANCE_SIZECHANGED"] = {},
["DETAILS_INSTANCE_STARTRESIZE"] = {},
["DETAILS_INSTANCE_ENDRESIZE"] = {},
["DETAILS_INSTANCE_STARTSTRETCH"] = {},
["DETAILS_INSTANCE_ENDSTRETCH"] = {},
["DETAILS_INSTANCE_CHANGESEGMENT"] = {},
["DETAILS_INSTANCE_CHANGEATTRIBUTE"] = {},
["DETAILS_INSTANCE_CHANGEMODE"] = {},
--> data
["DETAILS_DATA_RESET"] = {},
["DETAILS_DATA_SEGMENTREMOVED"] = {},
--> instances
["DETAILS_INSTANCE_OPEN"] = {},
["DETAILS_INSTANCE_CLOSE"] = {},
["DETAILS_INSTANCE_SIZECHANGED"] = {},
["DETAILS_INSTANCE_STARTRESIZE"] = {},
["DETAILS_INSTANCE_ENDRESIZE"] = {},
["DETAILS_INSTANCE_STARTSTRETCH"] = {},
["DETAILS_INSTANCE_ENDSTRETCH"] = {},
["DETAILS_INSTANCE_CHANGESEGMENT"] = {},
["DETAILS_INSTANCE_CHANGEATTRIBUTE"] = {},
["DETAILS_INSTANCE_CHANGEMODE"] = {},
--> data
["DETAILS_DATA_RESET"] = {},
["DETAILS_DATA_SEGMENTREMOVED"] = {},
--> combat
["COMBAT_PLAYER_ENTER"] = {},
@@ -33,6 +32,13 @@
["COMBAT_PLAYER_TIMESTARTED"] = {},
["COMBAT_BOSS_FOUND"] = {},
--> area
["ZONE_TYPE_CHANGED"] = {},
--> roster
["GROUP_ONENTER"] = {},
["GROUP_ONLEAVE"] = {},
--> buffs
["BUFF_UPDATE"] = {},
["BUFF_UPDATE_DEBUFFPOWER"] = {}
@@ -51,439 +57,139 @@
return false
end
local common_events = {
["DETAILS_INSTANCE_OPEN"] = true,
["DETAILS_INSTANCE_CLOSE"] = true,
["DETAILS_INSTANCE_SIZECHANGED"] = true,
["DETAILS_INSTANCE_STARTRESIZE"] = true,
["DETAILS_INSTANCE_ENDRESIZE"] = true,
["DETAILS_INSTANCE_STARTSTRETCH"] = true,
["DETAILS_INSTANCE_ENDSTRETCH"] = true,
["DETAILS_INSTANCE_CHANGESEGMENT"] = true,
["DETAILS_INSTANCE_CHANGEATTRIBUTE"] = true,
["DETAILS_INSTANCE_CHANGEMODE"] = true,
["DETAILS_DATA_RESET"] = true,
["DETAILS_DATA_SEGMENTREMOVED"] = true,
["COMBAT_PLAYER_ENTER"] = true,
["COMBAT_PLAYER_LEAVE"] = true,
["COMBAT_PLAYER_TIMESTARTED"] = true,
["COMBAT_BOSS_FOUND"] = true,
["GROUP_ONENTER"] = true,
["GROUP_ONLEAVE"] = true,
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> details api functions
--> register a event
--> Register a Event
function _detalhes:RegisterEvent (object, event, func)
-------> combat -------------------------------------------------------------------------------------------------------------------------------------------------
if (event == "COMBAT_PLAYER_ENTER") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["COMBAT_PLAYER_ENTER"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["COMBAT_PLAYER_ENTER"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["COMBAT_PLAYER_ENTER"], object)
end
return true
if (not _detalhes.RegistredEvents [event]) then
if (object.Msg) then
object:Msg ("(debug) unknown event", event)
else
return false
_detalhes:Msg ("(debug) unknown event", event)
end
elseif (event == "COMBAT_PLAYER_LEAVE") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["COMBAT_PLAYER_LEAVE"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["COMBAT_PLAYER_LEAVE"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["COMBAT_PLAYER_LEAVE"], object)
end
return true
else
return false
end
elseif (event == "COMBAT_PLAYER_TIMESTARTED") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["COMBAT_PLAYER_TIMESTARTED"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["COMBAT_PLAYER_TIMESTARTED"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["COMBAT_PLAYER_TIMESTARTED"], object)
end
return true
else
return false
end
elseif (event == "COMBAT_BOSS_FOUND") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["COMBAT_BOSS_FOUND"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["COMBAT_BOSS_FOUND"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["COMBAT_BOSS_FOUND"], object)
end
return true
else
return false
end
-------> buffs -------------------------------------------------------------------------------------------------------------------------------------------------
elseif (event == "BUFF_UPDATE") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["BUFF_UPDATE"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["BUFF_UPDATE"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["BUFF_UPDATE"], object)
end
_detalhes.Buffs:CatchBuffs()
_detalhes.RecordPlayerSelfBuffs = true
_detalhes:UpdateParserGears()
return true
else
return false
end
elseif (event == "BUFF_UPDATE_DEBUFFPOWER") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], object)
end
_detalhes.RecordPlayerAbilityWithBuffs = true
_detalhes:UpdateDamageAbilityGears()
_detalhes:UpdateParserGears()
return true
else
return false
end
-------> Addon Instances -------------------------------------------------------------------------------------------------------------------------------------------------
elseif (event == "DETAILS_INSTANCE_OPEN") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_OPEN"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_OPEN"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_OPEN"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_CLOSE") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CLOSE"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CLOSE"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CLOSE"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_SIZECHANGED") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_SIZECHANGED"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_SIZECHANGED"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_SIZECHANGED"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_STARTRESIZE") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_STARTRESIZE"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_STARTRESIZE"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_STARTRESIZE"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_ENDRESIZE") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_ENDRESIZE"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_ENDRESIZE"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_ENDRESIZE"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_ENDSTRETCH") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_ENDSTRETCH"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_ENDSTRETCH"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_ENDSTRETCH"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_STARTSTRETCH") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_STARTSTRETCH"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_STARTSTRETCH"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_STARTSTRETCH"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_CHANGESEGMENT") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGESEGMENT"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGESEGMENT"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGESEGMENT"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_CHANGEATTRIBUTE") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGEATTRIBUTE"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGEATTRIBUTE"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGEATTRIBUTE"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_CHANGEMODE") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGEMODE"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGEMODE"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGEMODE"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_DATA_RESET") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_DATA_RESET"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_DATA_RESET"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_DATA_RESET"], object)
end
return true
else
return false
end
elseif (event == "DETAILS_DATA_SEGMENTREMOVED") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_DATA_SEGMENTREMOVED"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["DETAILS_DATA_SEGMENTREMOVED"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["DETAILS_DATA_SEGMENTREMOVED"], object)
end
return true
else
return false
end
return
end
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> Unregister a Event
------------------------------------------------------------------------------------------------------------------------------------------------------------------
function _detalhes:UnregisterEvent (object, event)
-------> combat -------------------------------------------------------------------------------------------------------------------------------------------------
if (event == "COMBAT_PLAYER_ENTER") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["COMBAT_PLAYER_ENTER"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["COMBAT_PLAYER_ENTER"], index)
if (common_events [event]) then
if (not AlreadyRegistred (_detalhes.RegistredEvents [event], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents [event], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents [event], object)
end
return true
else
return false
end
elseif (event == "COMBAT_PLAYER_LEAVE") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["COMBAT_PLAYER_LEAVE"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["COMBAT_PLAYER_LEAVE"], index)
return true
else
return false
end
elseif (event == "COMBAT_PLAYER_TIMESTARTED") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["COMBAT_PLAYER_TIMESTARTED"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["COMBAT_PLAYER_TIMESTARTED"], index)
return true
else
return false
end
elseif (event == "COMBAT_BOSS_FOUND") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["COMBAT_BOSS_FOUND"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["COMBAT_BOSS_FOUND"], index)
return true
else
return false
end
-------> buffs -------------------------------------------------------------------------------------------------------------------------------------------------
elseif (event == "BUFF_UPDATE") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["BUFF_UPDATE"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["BUFF_UPDATE"], index)
if (#_detalhes.RegistredEvents ["BUFF_UPDATE"] < 1) then
else
if (event == "BUFF_UPDATE") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["BUFF_UPDATE"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["BUFF_UPDATE"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["BUFF_UPDATE"], object)
end
_detalhes.Buffs:CatchBuffs()
_detalhes.RecordPlayerSelfBuffs = true
_detalhes:UpdateParserGears()
return true
else
return false
end
return true
else
return false
end
elseif (event == "BUFF_UPDATE_DEBUFFPOWER") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], index)
if (#_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"] < 1) then
_detalhes.RecordPlayerAbilityWithBuffs = false
elseif (event == "BUFF_UPDATE_DEBUFFPOWER") then
if (not AlreadyRegistred (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], object)) then
if (func) then
tinsert (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], {object, func, __eventtable = true})
else
tinsert (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], object)
end
_detalhes.RecordPlayerAbilityWithBuffs = true
_detalhes:UpdateDamageAbilityGears()
_detalhes:UpdateParserGears()
return true
else
return false
end
return true
else
return false
end
-------> Addon Instances -------------------------------------------------------------------------------------------------------------------------------------------------
elseif (event == "DETAILS_INSTANCE_OPEN") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_OPEN"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_INSTANCE_OPEN"], index)
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_CLOSE") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CLOSE"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CLOSE"], index)
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_SIZECHANGED") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_SIZECHANGED"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_INSTANCE_SIZECHANGED"], index)
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_STARTRESIZE") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_STARTRESIZE"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_INSTANCE_STARTRESIZE"], index)
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_ENDRESIZE") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_ENDRESIZE"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_INSTANCE_ENDRESIZE"], index)
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_ENDSTRETCH") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_ENDSTRETCH"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_INSTANCE_ENDSTRETCH"], index)
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_STARTSTRETCH") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_STARTSTRETCH"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_INSTANCE_STARTSTRETCH"], index)
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_CHANGESEGMENT") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGESEGMENT"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGESEGMENT"], index)
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_CHANGEATTRIBUTE") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGEATTRIBUTE"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGEATTRIBUTE"], index)
return true
else
return false
end
elseif (event == "DETAILS_INSTANCE_CHANGEMODE") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGEMODE"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_INSTANCE_CHANGEMODE"], index)
return true
else
return false
end
elseif (event == "DETAILS_DATA_RESET") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_DATA_RESET"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_DATA_RESET"], index)
return true
else
return false
end
elseif (event == "DETAILS_DATA_SEGMENTREMOVED") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["DETAILS_DATA_SEGMENTREMOVED"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["DETAILS_DATA_SEGMENTREMOVED"], index)
return true
else
return false
end
end
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> Unregister a Event
function _detalhes:UnregisterEvent (object, event)
if (not _detalhes.RegistredEvents [event]) then
if (object.Msg) then
object:Msg ("(debug) unknown event", event)
else
_detalhes:Msg ("(debug) unknown event", event)
end
return
end
if (common_events [event]) then
local index = AlreadyRegistred (_detalhes.RegistredEvents [event], object)
if (index) then
table.remove (_detalhes.RegistredEvents [event], index)
return true
else
return false
end
else
if (event == "BUFF_UPDATE") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["BUFF_UPDATE"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["BUFF_UPDATE"], index)
if (#_detalhes.RegistredEvents ["BUFF_UPDATE"] < 1) then
_detalhes.RecordPlayerSelfBuffs = true
_detalhes:UpdateParserGears()
end
return true
else
return false
end
elseif (event == "BUFF_UPDATE_DEBUFFPOWER") then
local index = AlreadyRegistred (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], object)
if (index) then
table.remove (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], index)
if (#_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"] < 1) then
_detalhes.RecordPlayerAbilityWithBuffs = false
_detalhes:UpdateDamageAbilityGears()
_detalhes:UpdateParserGears()
end
return true
else
return false
end
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internal functions