- Fixed many DPS inacuracy when playing outside a party or raid group.

- Full cleanup done on comm message handlers.
- Created a window for update alert.
This commit is contained in:
tercio
2014-07-05 13:26:53 -03:00
parent 68557fa55f
commit 72c00a528a
9 changed files with 424 additions and 375 deletions
+2 -2
View File
@@ -10,8 +10,8 @@
_detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0", "LibHotCorners")
_detalhes.version = "v1.18.2 (core 20)"
_detalhes.userversion = "v1.18.2"
_detalhes.build_counter = 3
_detalhes.userversion = "v1.18.3"
_detalhes.build_counter = 5
_detalhes.realversion = 21
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+10 -1
View File
@@ -269,7 +269,16 @@
end
function combate:seta_tempo_decorrido()
self.end_time = _tempo
if (self.playing_solo) then
local damage_actor = self (1, _detalhes.playername)
if (damage_actor) then
self.end_time = damage_actor.last_event or _tempo
else
self.end_time = _tempo
end
else
self.end_time = _tempo
end
end
function _detalhes.refresh:r_combate (tabela_combate, shadow)
+3 -3
View File
@@ -223,7 +223,7 @@
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
--> class constructor
function atributo_damage:NovaTabela (serial, nome, link)
@@ -276,8 +276,6 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> special cases
-- dps (calculate dps for actors)
function atributo_damage:ContainerRefreshDps (container, combat_time)
@@ -1503,6 +1501,8 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown)
meu_tempo = instancia.showing:GetCombatTime()
end
--print ("time:", meu_tempo)
--add and sort
for _spellid, _skill in _pairs (ActorSkillsContainer) do
ActorSkillsSortTable [#ActorSkillsSortTable+1] = {_spellid, _skill.total, _skill.total/meu_tempo}
+4 -2
View File
@@ -354,6 +354,8 @@
-- ~end
function _detalhes:SairDoCombate (bossKilled, from_encounter_end)
--print ("=== Saiu de Combate! ===", _tempo)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) ended a combat.")
end
@@ -829,10 +831,10 @@
--> envia os dados do proprio host pra ele antes
if (host_of) then
_detalhes:SendCustomRaidData ("equalize_actors", host_of, nil, data)
_detalhes:SendRaidDataAs (_detalhes.network.ids.CLOUD_EQUALIZE, host_of, nil, data)
_detalhes:EqualizeActors()
else
_detalhes:SendRaidData ("equalize_actors", data)
_detalhes:SendRaidData (_detalhes.network.ids.CLOUD_EQUALIZE, data)
end
end
+319 -327
View File
@@ -1,321 +1,323 @@
--File Revision: 1
--Last Modification: 27/07/2013
-- Change Log:
-- 27/07/2013: Finished alpha version.
--
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local _detalhes = _G._detalhes
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local _
_detalhes.network = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _UnitName = UnitName
local _GetRealmName = GetRealmName
local _select = select
local _table_wipe = table.wipe
local _math_min = math.min
local _string_gmatch = string.gmatch
local _
local _pairs = pairs
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local CONST_DETAILS_PREFIX = "DTLS"
local CONST_HIGHFIVE_REQUEST = "HI"
local CONST_HIGHFIVE_DATA = "HF"
local CONST_VERSION_CHECK = "CV"
local CONST_CLOUD_REQUEST = "CR"
local CONST_CLOUD_FOUND = "CF"
local CONST_CLOUD_DATARQ = "CD"
local CONST_CLOUD_DATARC = "CE"
local CONST_CLOUD_EQUALIZE = "EQ"
_detalhes.network.ids = {
["HIGHFIVE_REQUEST"] = CONST_HIGHFIVE_REQUEST,
["HIGHFIVE_DATA"] = CONST_HIGHFIVE_DATA,
["VERSION_CHECK"] = CONST_VERSION_CHECK,
["CLOUD_REQUEST"] = CONST_CLOUD_REQUEST,
["CLOUD_FOUND"] = CONST_CLOUD_FOUND,
["CLOUD_DATARQ"] = CONST_CLOUD_DATARQ,
["CLOUD_DATARC"] = CONST_CLOUD_DATARC,
["CLOUD_EQUALIZE"] = CONST_CLOUD_EQUALIZE,
}
local plugins_registred = {}
local temp = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
--> comm functions
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function _detalhes:CheckDetailsUsers()
if (true) then --> disabled
function _detalhes.network.HighFive_Request()
return _detalhes:SendRaidData (CONST_HIGHFIVE_DATA, _detalhes.userversion)
end
function _detalhes.network.HighFive_DataReceived (player, realm, core_version, user_version)
if (_detalhes.sent_highfive and _detalhes.sent_highfive + 30 > GetTime()) then
_detalhes.users [#_detalhes.users+1] = {player, realm, (user_version or "") .. " (" .. core_version .. ")"}
end
end
function _detalhes.network.Update_VersionReceived (player, realm, core_version, build_number)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) received version alert ", build_number)
end
if (not _detalhes.build_counter or not _detalhes.lastUpdateWarning or not build_number) then
return
end
if (IsInRaid()) then
for i = 1, GetNumGroupMembers() do
if (_detalhes.details_users [ _UnitName ("raid"..i)]) then
if (build_number > _detalhes.build_counter) then
if (time() > _detalhes.lastUpdateWarning + 72000) then
local lower_instance = _detalhes:GetLowerInstanceNumber()
if (lower_instance) then
lower_instance = _detalhes:GetInstance (lower_instance)
if (lower_instance) then
lower_instance:InstanceAlert ("Update Available!", {[[Interface\GossipFrame\AvailableQuestIcon]], 16, 16, false}, 60, {_detalhes.OpenUpdateWindow})
end
end
_detalhes.lastUpdateWarning = time()
end
end
end
function _detalhes.network.Cloud_Request (player, realm, core_version, ...)
if (_detalhes.debug) then
_detalhes:Msg ("(debug)", player, _detalhes.host_of, _detalhes:CaptureIsAllEnabled(), core_version == _detalhes.realversion)
end
if (player ~= _detalhes.playername) then
if (not _detalhes.host_of and _detalhes:CaptureIsAllEnabled() and core_version == _detalhes.realversion) then
if (realm ~= _GetRealmName()) then
player = player .."-"..realm
end
_detalhes.host_of = player
if (_detalhes.debug) then
_detalhes:Msg ("(debug) sent 'okey' answer for a cloud parser request.")
end
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (_detalhes.network.ids.CLOUD_FOUND, _UnitName ("player"), _GetRealmName(), _detalhes.realversion), "WHISPER", player)
end
end
end
function _detalhes.network.Cloud_Found (player, realm, core_version, ...)
if (_detalhes.host_by) then
return
end
if (realm ~= _GetRealmName()) then
player = player .."-"..realm
end
_detalhes.host_by = player
if (_detalhes.debug) then
_detalhes:Msg ("(debug) cloud found for disabled captures.")
end
_detalhes.cloud_process = _detalhes:ScheduleRepeatingTimer ("RequestCloudData", 10)
_detalhes.last_data_requested = _detalhes._tempo
end
function _detalhes.network.Cloud_DataRequest (player, realm, core_version, ...)
if (not _detalhes.host_of) then
return
end
local atributo, subatributo = player, realm
local data
local atributo_name = _detalhes:GetInternalSubAttributeName (atributo, subatributo)
if (atributo == 1) then
data = _detalhes.atributo_damage:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
elseif (atributo == 2) then
data = _detalhes.atributo_heal:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
elseif (atributo == 3) then
data = _detalhes.atributo_energy:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
elseif (atributo == 4) then
data = _detalhes.atributo_misc:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
else
return
end
if (data) then
local export = temp
local container = _detalhes.tabela_vigente [atributo]._ActorTable
for i = 1, _math_min (6, #container) do
local actor = container [i]
if (actor.grupo) then
export [#export+1] = {actor.nome, actor [atributo_name]}
end
end
elseif (IsInGroup()) then
for i = 1, GetNumGroupMembers()-1 do
if (_detalhes.details_users [ _UnitName ("party"..i)]) then
if (_detalhes.debug) then
_detalhes:Msg ("(debug) requesting data from the cloud.")
end
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_CLOUD_DATARC, atributo, atributo_name, export), "WHISPER", _detalhes.host_of)
_table_wipe (temp)
end
end
function _detalhes.network.Cloud_DataReceived (player, realm, core_version, ...)
local atributo, atributo_name, data = player, realm, core_version
local container = _detalhes.tabela_vigente [atributo]
if (_detalhes.debug) then
_detalhes:Msg ("(debug) received data from the cloud.")
end
for i = 1, #data do
local _this = data [i]
local name = _this [1]
local actor = container:PegarCombatente (nil, name)
if (not actor) then
if (IsInRaid()) then
for i = 1, GetNumGroupMembers() do
if (name:find ("-")) then --> other realm
local nname, server = _UnitName ("raid"..i)
if (server and server ~= "") then
nname = nname.."-"..server
end
if (nname == name) then
actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x514, true)
break
end
else
if (_UnitName ("raid"..i) == name) then
actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x514, true)
break
end
end
end
elseif (IsInGroup()) then
for i = 1, GetNumGroupMembers()-1 do
if (name:find ("-")) then --> other realm
local nname, server = _UnitName ("party"..i)
if (server and server ~= "") then
nname = nname.."-"..server
end
if (nname == name) then
actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x514, true)
break
end
else
if (_UnitName ("party"..i) == name or _detalhes.playername == name) then
actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x514, true)
break
end
end
end
end
end
if (actor) then
actor [atributo_name] = _this [2]
container.need_refresh = true
else
if (_detalhes.debug) then
_detalhes:Msg ("(debug) actor not found on cloud data received", name, atributo_name)
end
end
end
end
local temp = {}
function _detalhes:RaidComm (_, data, _, source)
local type, player, realm, dversion, arg6, arg7 = _select (2, _detalhes:Deserialize (data))
function _detalhes.network.Cloud_Equalize (player, realm, core_version, data)
if (not _detalhes.in_combat) then
if (core_version ~= _detalhes.realversion) then
return
end
_detalhes:MakeEqualizeOnActor (player, realm, data)
end
end
_detalhes.network.functions = {
[CONST_HIGHFIVE_REQUEST] = _detalhes.network.HighFive_Request,
[CONST_HIGHFIVE_DATA] = _detalhes.network.HighFive_DataReceived,
[CONST_VERSION_CHECK] = _detalhes.network.Update_VersionReceived,
[CONST_CLOUD_REQUEST] = _detalhes.network.Cloud_Request,
[CONST_CLOUD_FOUND] = _detalhes.network.Cloud_Found,
[CONST_CLOUD_DATARQ] = _detalhes.network.Cloud_DataRequest,
[CONST_CLOUD_DATARC] = _detalhes.network.Cloud_DataReceived,
[CONST_CLOUD_EQUALIZE] = _detalhes.network.Cloud_Equalize,
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> register comm
function _detalhes:CommReceived (_, data, _, source)
local type, player, realm, dversion, arg6, arg7, arg8, arg9 = _select (2, _detalhes:Deserialize (data))
if (_detalhes.debug) then
_detalhes:Msg ("(debug) network received:", type, "length:",string.len (data))
end
if (type == "highfive") then
_detalhes:SendRaidData ("highfive_response", _detalhes.userversion)
elseif (type == "highfive_response") then
if (_detalhes.sent_highfive and _detalhes.sent_highfive+30 > GetTime()) then
_detalhes.users [#_detalhes.users+1] = {player, realm, (arg6 or "") .. " (" .. dversion .. ")"}
end
elseif (type == "check_version") then
local received_version = tonumber (arg6)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) received version alert ", arg6)
end
if (not _detalhes.build_counter or not _detalhes.lastUpdateWarning or not received_version) then
return
end
if (time() > _detalhes.lastUpdateWarning + 72000) then
--print ("received check_version", received_version)
if (received_version > _detalhes.build_counter) then
local lower_instance = _detalhes:GetLowerInstanceNumber()
if (lower_instance) then
lower_instance = _detalhes:GetInstance (lower_instance)
if (lower_instance) then
lower_instance:InstanceAlert ("Update Available!", {[[Interface\GossipFrame\AvailableQuestIcon]], 16, 16, false}, 60, {function() _detalhes:Msg ("Check curse client to download the newer version.") end})
end
end
end
_detalhes.lastUpdateWarning = time()
end
elseif (type == "petowner") then
dversion, serial, nome, owner_table = player, realm, dversion, arg6
if (dversion ~= _detalhes.realversion) then
return
end
--> check for miss timing when combat finishes
if (not _detalhes.sent_pets) then
_detalhes.sent_pets = {n = time()}
local func = _detalhes.network.functions [type]
if (func) then
func (player, realm, dversion, arg6, arg7, arg8, arg9)
else
local t = plugins_registred [type]
if (t) then
func (player, realm, dversion, t[3], arg6, arg7, arg8, arg9)
else
if (_detalhes.sent_pets.n+20 < time()) then
_table_wipe (_detalhes.sent_pets)
_detalhes.sent_pets.n = time()
end
end
_detalhes.sent_pets [serial] = true
if (not _detalhes.tabela_pets.pets [serial]) then
_detalhes.tabela_pets.pets [serial] = owner_table
local petActor = _detalhes.tabela_vigente[1]:PegarCombatente (nil, nome)
if (petActor) then
local ownerActor = _detalhes.tabela_vigente[1]:PegarCombatente (owner_table[2], owner_table[1], owner_table[3], true)
ownerActor.total = ownerActor.total + petActor.total
ownerActor.pets [#ownerActor.pets+1] = nome
if (_detalhes.debug) then
_detalhes:Msg ("(debug) received owner for pet ",nome, "assigned to", owner_table[1])
end
local combat = _detalhes:GetCombat ("current")
combat[1].need_refresh = true
end
end
elseif (type == "needpetowner") then
if (dversion ~= _detalhes.realversion) then
return
end
local petserial = arg6
local petnome = arg7
--> check for miss timing on combat finishes
if (not _detalhes.sent_pets) then
_detalhes.sent_pets = {n = time()}
else
if (_detalhes.sent_pets.n+20 < time()) then
_table_wipe (_detalhes.sent_pets)
_detalhes.sent_pets.n = time()
end
end
--> already sent
if (_detalhes.sent_pets [petserial]) then
return
else
_detalhes.sent_pets [petserial] = true
end
local owner_table = _detalhes.tabela_pets.pets [petserial]
if (owner_table) then
if (_detalhes.debug) then
_detalhes:Msg ("(debug) received pet owner request, sending owner")
end
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("petowner", _detalhes.realversion, petserial, petnome, owner_table), "RAID")
--_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("petowner", petserial, petnome, owner_table), "WHISPER", player)
end
elseif (type == "clouddatareceived") then
--local atributo, atributo_name, data = select (3, _detalhes:Deserialize (data))
local atributo, atributo_name, data = player, realm, dversion
local container = _detalhes.tabela_vigente [atributo]
for i = 1, #data do
local _this = data [i]
local name = _this [1]
local actor = container:PegarCombatente (nil, name)
if (not actor) then
if (IsInRaid()) then
for i = 1, GetNumGroupMembers() do
if (name:find ("-")) then --> other realm
local nname, server = _UnitName ("raid"..i)
if (server and server ~= "") then
nname = nname.."-"..server
end
if (nname == name) then
actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x514, true)
break
end
else
if (_UnitName ("raid"..i) == name) then
actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x514, true)
break
end
end
end
elseif (IsInGroup()) then
for i = 1, GetNumGroupMembers()-1 do
if (name:find ("-")) then --> other realm
local nname, server = _UnitName ("party"..i)
if (server and server ~= "") then
nname = nname.."-"..server
end
if (nname == name) then
actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x514, true)
break
end
else
if (_UnitName ("party"..i) == name or _detalhes.playername == name) then
actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x514, true)
break
end
end
end
end
end
if (actor) then
actor [atributo_name] = _this [2]
container.need_refresh = true
else
if (_detalhes.debug) then
_detalhes:Msg ("(debug) actor not found on cloud data received", name, atributo_name)
end
end
end
elseif (type == "clouddatarequest") then
if (not _detalhes.host_of) then
--> delayed response
return
end
local atributo, subatributo = player, realm
local data
local atributo_name = _detalhes:GetInternalSubAttributeName (atributo, subatributo)
if (atributo == 1) then
data = _detalhes.atributo_damage:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
elseif (atributo == 2) then
data = _detalhes.atributo_heal:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
elseif (atributo == 3) then
data = _detalhes.atributo_energy:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
elseif (atributo == 4) then
data = _detalhes.atributo_misc:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
else
return
end
if (data) then
local export = temp
local container = _detalhes.tabela_vigente [atributo]._ActorTable
for i = 1, _math_min (6, #container) do
local actor = container [i]
if (actor.grupo) then
export [#export+1] = {actor.nome, actor [atributo_name]}
end
end
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatareceived", atributo, atributo_name, export), "WHISPER", _detalhes.host_of)
_table_wipe (temp)
end
elseif (type == "foundcloud") then
if (_detalhes.host_by) then
return
end
if (realm ~= _GetRealmName()) then
player = player .."-"..realm
end
_detalhes.host_by = player
if (_detalhes.debug) then
_detalhes:Msg ("(debug) cloud found for disabled captures.")
end
_detalhes.cloud_process = _detalhes:ScheduleRepeatingTimer ("RequestData", 7)
_detalhes.last_data_requested = _detalhes._tempo
elseif (type == "needcloud") then
if (_detalhes.debug) then
print (player, _detalhes.host_of, _detalhes:CaptureIsAllEnabled(), dversion == _detalhes.realversion)
end
if (player ~= _detalhes.playername) then
if (not _detalhes.host_of and _detalhes:CaptureIsAllEnabled() and dversion == _detalhes.realversion) then
_detalhes:SendCloudResponse (player, realm)
end
end
elseif (type == "custom_broadcast") then
_detalhes:OnReceiveCustom (_select (3, _detalhes:Deserialize (data)))
elseif (type == "equalize_actors") then
if (not _detalhes.in_combat) then
local receivedActor = arg6
if (dversion ~= _detalhes.realversion) then
return
end
_detalhes:MakeEqualizeOnActor (player, realm, receivedActor)
_detalhes:Msg ("comm type not found:", type)
end
end
end
_detalhes:RegisterComm ("details_comm", "RaidComm")
_detalhes:RegisterComm ("DTLS", "CommReceived")
function _detalhes:SendCustomRaidData (type, player, realm, ...)
function _detalhes:RegisterPluginComm (name, prefix, func, version)
assert (type (name) == "string" and string.len (name) > 3, "RegisterPluginComm expects a string with at least 4 characters on #1 argument.")
assert (type (prefix) == "string" and string.len (prefix) == 2, "RegisterPluginComm expects a string with 2 characters on #2 argument.")
assert (type (func) == "function", "RegisterPluginComm expects a function on #3 argument.")
assert (plugins_registred [prefix] == nil, "Prefix " .. prefix .. " already in use.")
plugins_registred [prefix] = {func, name, version}
end
function _detalhes:UnregisterPluginComm (name)
local prefix
for p, t in _pairs (plugins_registred) do
if (t [2] == name) then
prefix = p
break
end
end
if (prefix) then
plugins_registred [prefix] = nil
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> send functions
function _detalhes:SendPluginCommMessage (name, channel, ...)
local prefix
for p, t in _pairs (plugins_registred) do
if (t [2] == name) then
prefix = p
break
end
end
if (prefix) then
else
self:Msg ("comm not registred:", name)
end
end
--> send as
function _detalhes:SendRaidDataAs (type, player, realm, ...)
if (not realm) then
--> check if realm is already inside player name
for _name, _realm in _string_gmatch (player, "(%w+)-(%w+)") do
@@ -329,92 +331,82 @@
--> doesn't have realm at all, so we assume the actor is in same realm as player
realm = _GetRealmName()
end
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize (type, player, realm, _detalhes.realversion, ...), "RAID")
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, player, realm, _detalhes.realversion, ...), "RAID")
end
function _detalhes:SendRaidData (type, ...)
if (IsInGroup (LE_PARTY_CATEGORY_INSTANCE) and IsInInstance()) then
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
else
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID")
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID")
end
end
function _detalhes:SendPartyData (type, ...)
if (IsInGroup (LE_PARTY_CATEGORY_INSTANCE) and IsInInstance()) then
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
else
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "PARTY")
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "PARTY")
end
end
function _detalhes:SendGuildData (type, ...)
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "GUILD")
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "GUILD")
end
function _detalhes:SendHighFive()
if (true) then --> disabled
return
end
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("highfive", _UnitName ("player"), _GetRealmName(), _detalhes.realversion), "RAID")
end
function _detalhes:SendPetOwnerRequest (petserial, petnome)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) sent request for a pet",petserial, petnome)
end
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("needpetowner", _UnitName ("player"), _GetRealmName(), _detalhes.realversion, petserial, petnome), "RAID")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> cloud
function _detalhes:SendCloudRequest()
_detalhes:SendRaidData (_detalhes.network.ids.CLOUD_REQUEST)
end
function _detalhes:ScheduleSendCloudRequest()
_detalhes:ScheduleTimer ("SendCloudRequest", 1)
end
function _detalhes:SendCloudRequest()
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("needcloud", _UnitName ("player"), _GetRealmName(), _detalhes.realversion), "RAID")
end
function _detalhes:SendCloudResponse (player, realm)
if (realm ~= _GetRealmName()) then
player = player .."-"..realm
end
_detalhes.host_of = player
if (_detalhes.debug) then
_detalhes:Msg ("(debug) sent 'okey' answer for a cloud parser request.")
end
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("foundcloud", _UnitName ("player"), _GetRealmName(), _detalhes.realversion), "WHISPER", player)
end
function _detalhes:RequestData()
function _detalhes:RequestCloudData()
_detalhes.last_data_requested = _detalhes._tempo
if (not _detalhes.host_by) then
return
end
for index = 1, #_detalhes.tabela_instancias do
local instancia = _detalhes.tabela_instancias [index]
if (instancia.ativa and _detalhes.host_by) then
if (instancia.ativa) then
local atributo = instancia.atributo
if (atributo == 1 and not _detalhes:CaptureGet ("damage")) then
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatarequest", atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
break
elseif (atributo == 2 and (not _detalhes:CaptureGet ("heal") or _detalhes:CaptureGet ("aura"))) then
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatarequest", atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
break
elseif (atributo == 3 and not _detalhes:CaptureGet ("energy")) then
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatarequest", atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
break
elseif (atributo == 4 and not _detalhes:CaptureGet ("miscdata")) then
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatarequest", atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
break
end
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> update
function _detalhes:CheckVersion()
function _detalhes:CheckVersion (send_to_guild)
if (IsInRaid()) then
_detalhes:SendRaidData ("check_version", _detalhes.build_counter)
_detalhes:SendRaidData (_detalhes.network.ids.VERSION_CHECK, _detalhes.build_counter)
elseif (IsInGroup()) then
_detalhes:SendPartyData ("check_version", _detalhes.build_counter)
_detalhes:SendPartyData (_detalhes.network.ids.VERSION_CHECK, _detalhes.build_counter)
end
if (send_to_guild) then
_detalhes:SendGuildData (_detalhes.network.ids.VERSION_CHECK, _detalhes.build_counter)
end
end
+17 -33
View File
@@ -153,13 +153,15 @@
--> check if need start an combat
if (not _in_combat) then
if ( token ~= "SPELL_PERIODIC_DAMAGE" and
if ( token ~= "SPELL_PERIODIC_DAMAGE" and
(
(who_flags and _bit_band (who_flags, AFFILIATION_GROUP) ~= 0 and _UnitAffectingCombat (who_name) )
or
(alvo_flags and _bit_band (alvo_flags, AFFILIATION_GROUP) ~= 0 and _UnitAffectingCombat (alvo_name) )
)) then
or
(not _detalhes.in_group and who_flags and _bit_band (who_flags, AFFILIATION_GROUP) ~= 0)
)
) then
--> não entra em combate se for DOT
_detalhes:EntrarEmCombate (who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags)
end
@@ -192,10 +194,6 @@
end
--if (who_name:find ("Guardian of Ancient Kings")) then --remover
-- print ("PARSER:", who_name, este_jogador.nome, este_jogador.owner, meu_dono.nome)
--end
--> his target
local jogador_alvo, alvo_dono = damage_cache [alvo_name] or damage_cache_pets [alvo_serial], damage_cache_petsOwners [alvo_serial]
@@ -319,14 +317,14 @@
if (meu_dono.end_time) then
meu_dono.end_time = nil
else
meu_dono:IniciarTempo (_tempo-3.0, meu_dono.shadow)
meu_dono:IniciarTempo (_tempo-2.5, meu_dono.shadow)
end
end
if (este_jogador.end_time) then
este_jogador.end_time = nil
else
este_jogador:IniciarTempo (_tempo-3.0, este_jogador.shadow)
este_jogador:IniciarTempo (_tempo-2.5, este_jogador.shadow)
end
if (este_jogador.nome == _detalhes.playername and token ~= "SPELL_PERIODIC_DAMAGE") then --> iniciando o dps do "PLAYER"
@@ -521,24 +519,14 @@
-----------------------------------------------------------------------------------------------------------------------------------------
function parser:summon (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellName)
--if (alvo_name == "Guardian of Ancient Kings") then
-- print ("SUMMON", who_name, alvo_serial)
--end
--> pet summon another pet
local sou_pet = _detalhes.tabela_pets.pets [who_serial]
if (sou_pet) then --> okey, ja é um pet
--if (alvo_name == "Guardian of Ancient Kings") then
-- print ("SUMMON", "inverteu")
--end
who_name, who_serial, who_flags = sou_pet[1], sou_pet[2], sou_pet[3]
end
local alvo_pet = _detalhes.tabela_pets.pets [alvo_serial]
if (alvo_pet) then
--if (alvo_name == "Guardian of Ancient Kings") then
-- print ("SUMMON", "inverteu 2")
--end
who_name, who_serial, who_flags = alvo_pet[1], alvo_pet[2], alvo_pet[3]
end
@@ -761,7 +749,7 @@
------------------------------------------------------------------------------------------------
--> buff uptime
if (_recording_buffs_and_debuffs) then
-- jade spirit doesn't send who_name, that's a shame. --print (spellname, who_name, alvo_name)
-- jade spirit doesn't send who_name, that's a shame.
if (who_name == alvo_name and raid_members_cache [who_serial] and _in_combat) then
--> call record buffs uptime
--[[not tail call, need to fix this]] parser:add_buff_uptime (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, "BUFF_UPTIME_IN")
@@ -2003,7 +1991,7 @@
--> procura a última morte do alvo na tabela do combate:
for i = 1, #_current_combat.last_events_tables do
if (_current_combat.last_events_tables [i] [3] == alvo_name) then
--print ("Adicionando Bres para "..alvo_name)
local deadLog = _current_combat.last_events_tables [i] [1]
local jaTem = false
for _, evento in _ipairs (deadLog) do
@@ -2165,8 +2153,6 @@
--> frags
if (_detalhes.only_pvp_frags and (_bit_band (alvo_flags, 0x00000400) == 0 or (_bit_band (alvo_flags, 0x00000040) == 0 and _bit_band (alvo_flags, 0x00000020) == 0))) then --byte 2 = 4 (HOSTILE) byte 3 = 4 (OBJECT_TYPE_PLAYER)
-- 10528 // 66856
-- print ("recusando actor ",alvo_name, " flag: ", _detalhes:hex (alvo_flags), " sem hex: ", alvo_flags)
return
end
@@ -2228,7 +2214,6 @@
--> adiciona a tabela da morte apenas os DANOS recentes
for index, tabela in _ipairs (dano.last_events_table) do
--print ("PARSER 3 dano", unpack (tabela))
if (tabela [4]) then
if (tabela [4] + 12 > time) then --> mostra apenas eventos recentes
esta_morte [#esta_morte+1] = tabela
@@ -2239,7 +2224,6 @@
--> adiciona a tabela da morte apenas as CURAS recentes
if (cura.last_events_table) then
for index, tabela in _ipairs (cura.last_events_table) do
--print ("PARSER 3 cura", unpack (tabela))
if (tabela [4]) then
if (tabela [4] + 12 > time) then
esta_morte [#esta_morte+1] = tabela
@@ -2330,8 +2314,6 @@
local t = {esta_morte, time, este_jogador.nome, este_jogador.classe, _UnitHealthMax (alvo_name), minutos.."m "..segundos.."s", ["dead"] = true}
--print ("A morte teve "..#esta_morte.." eventos")
_table_insert (_current_combat.last_events_tables, #_current_combat.last_events_tables+1, t)
--> reseta a pool
@@ -2345,11 +2327,6 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
--test
--function parser:spell_fail (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, spellschool, error, msg2, msg3)
-- print (token, who_name, spellid, spellname, spellschool, error, msg2, msg3)
--end
local token_list = {
-- neutral
["SPELL_SUMMON"] = parser.summon,
@@ -2694,6 +2671,13 @@
end
function _detalhes.parser_functions:PLAYER_REGEN_ENABLED (...)
--> playing alone, just finish the combat right now
if (not _IsInGroup() and not IsInRaid()) then
_detalhes.tabela_vigente.playing_solo = true
_detalhes:SairDoCombate()
end
--> aqui, tentativa de fazer o timer da janela do Solo funcionar corretamente:
if (_detalhes.solo and _detalhes.PluginCount.SOLO > 0) then
if (_detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode].Stop) then
@@ -2728,6 +2712,7 @@
instancia:SetCombatAlpha (nil, nil, true)
end
end
end
function _detalhes.parser_functions:ROLE_CHANGED_INFORM (...)
@@ -2768,7 +2753,6 @@
_detalhes:CheckSwitchOnLogon()
else
_detalhes:SchedulePetUpdate (2)
_detalhes:CheckDetailsUsers()
end
end
+1 -1
View File
@@ -669,7 +669,7 @@ function SlashCmdList.DETAILS (msg, editbox)
elseif (msg == "users") then
_detalhes.users = {}
_detalhes.sent_highfive = GetTime()
_detalhes:SendRaidData ("highfive")
_detalhes:SendRaidData (_detalhes.network.ids.HIGHFIVE_REQUEST)
print (Loc ["STRING_DETAILS1"] .. "highfive sent.")
elseif (command == "showusers") then
File diff suppressed because one or more lines are too long
+67 -5
View File
@@ -175,8 +175,6 @@ function _G._detalhes:Start()
self.details_users = {}
self.in_group = IsInGroup() or IsInRaid()
_detalhes:SendGuildData ("check_version", _detalhes.build_counter)
--> done
self.initializing = nil
@@ -209,7 +207,7 @@ function _G._detalhes:Start()
end
--> check version
_detalhes:CheckVersion()
_detalhes:CheckVersion (true)
--> restore cooltip anchor position
DetailsTooltipAnchor:Restore()
@@ -251,8 +249,7 @@ function _G._detalhes:Start()
feedback_frame.uppertext:SetFont (font, 10, flags)
feedback_frame.uppertext:SetTextColor (1, 1, 1, .8)
feedback_frame.uppertext:SetWidth (440)
local editbox = _detalhes.gump:NewTextEntry (feedback_frame, nil, "$parentTextEntry", "text", 387, 14)
editbox:SetPoint (20, -106)
editbox:SetAutoFocus (false)
@@ -950,5 +947,70 @@ function _G._detalhes:Start()
--BNSendFriendInvite ("tercio#1488")
function _detalhes:OpenUpdateWindow()
if (not _G.DetailsUpdateDialog) then
local updatewindow_frame = CreateFrame ("frame", "DetailsUpdateDialog", UIParent, "ButtonFrameTemplate")
updatewindow_frame:SetFrameStrata ("LOW")
tinsert (UISpecialFrames, "DetailsUpdateDialog")
updatewindow_frame:SetPoint ("center", UIParent, "center")
updatewindow_frame:SetSize (512, 200)
updatewindow_frame.portrait:SetTexture ([[Interface\CHARACTERFRAME\TEMPORARYPORTRAIT-FEMALE-GNOME]])
updatewindow_frame.TitleText:SetText ("A New Version Is Available!")
updatewindow_frame.midtext = updatewindow_frame:CreateFontString (nil, "artwork", "GameFontNormal")
updatewindow_frame.midtext:SetText ("Good news everyone!\nA new version has been forged and is waiting to be looted.")
updatewindow_frame.midtext:SetPoint ("topleft", updatewindow_frame, "topleft", 10, -90)
updatewindow_frame.midtext:SetJustifyH ("center")
updatewindow_frame.midtext:SetWidth (370)
updatewindow_frame.gnoma = updatewindow_frame:CreateTexture (nil, "artwork")
updatewindow_frame.gnoma:SetPoint ("topright", updatewindow_frame, "topright", -3, -59)
updatewindow_frame.gnoma:SetTexture ("Interface\\AddOns\\Details\\images\\icons2")
updatewindow_frame.gnoma:SetSize (105*1.05, 107*1.05)
updatewindow_frame.gnoma:SetTexCoord (0.2021484375, 0, 0.7919921875, 1)
local editbox = _detalhes.gump:NewTextEntry (updatewindow_frame, nil, "$parentTextEntry", "text", 387, 14)
editbox:SetPoint (20, -136)
editbox:SetAutoFocus (false)
editbox:SetHook ("OnEditFocusGained", function()
editbox.text = "http://www.curse.com/addons/wow/details"
editbox:HighlightText()
end)
editbox:SetHook ("OnEditFocusLost", function()
editbox.text = "http://www.curse.com/addons/wow/details"
editbox:HighlightText()
end)
editbox:SetHook ("OnChar", function()
editbox.text = "http://www.curse.com/addons/wow/details"
editbox:HighlightText()
end)
editbox.text = "http://www.curse.com/addons/wow/details"
updatewindow_frame.close = CreateFrame ("Button", "DetailsUpdateDialogCloseButton", updatewindow_frame, "OptionsButtonTemplate")
updatewindow_frame.close:SetPoint ("bottomleft", updatewindow_frame, "bottomleft", 8, 4)
updatewindow_frame.close:SetText ("Close")
updatewindow_frame.close:SetScript ("OnClick", function (self)
DetailsUpdateDialog:Hide()
editbox:ClearFocus()
end)
updatewindow_frame:SetScript ("OnHide", function()
editbox:ClearFocus()
end)
function _detalhes:UpdateDialogSetFocus()
DetailsUpdateDialog:Show()
DetailsUpdateDialogTextEntry.MyObject:SetFocus()
DetailsUpdateDialogTextEntry.MyObject:HighlightText()
end
_detalhes:ScheduleTimer ("UpdateDialogSetFocus", 1)
end
end
end