- debug player table creation.
- fix akaari's soul.
This commit is contained in:
@@ -691,6 +691,8 @@
|
||||
|
||||
if ((tempo_do_combate >= _detalhes.minimum_combat_time or not _detalhes.tabela_historico.tabelas[1]) and not _detalhes.tabela_vigente.discard_segment) then
|
||||
_detalhes.tabela_historico:adicionar (_detalhes.tabela_vigente) --move a tabela atual para dentro do histórico
|
||||
|
||||
_detalhes:CanSendMissData()
|
||||
else
|
||||
invalid_combat = _detalhes.tabela_vigente
|
||||
|
||||
@@ -922,6 +924,116 @@
|
||||
|
||||
end
|
||||
|
||||
local validSpells = {
|
||||
[220893] = {class = "ROGUE", spec = 261, maxPercent = 0.075, container = 1, commID = "MISSDATA_ROGUE_SOULRIP"},
|
||||
--[11366] = {class = "MAGE", spec = 63, maxPercent = 0.9, container = 1, commID = "MISSDATA_ROGUE_SOULRIP"},
|
||||
}
|
||||
function _detalhes:CanSendMissData()
|
||||
if (not IsInRaid() and not IsInGroup()) then
|
||||
return
|
||||
end
|
||||
local _, playerClass = UnitClass ("player")
|
||||
local specIndex = GetSpecialization()
|
||||
local playerSpecID
|
||||
if (specIndex) then
|
||||
playerSpecID = GetSpecializationInfo (specIndex)
|
||||
end
|
||||
|
||||
if (playerSpecID and playerClass) then
|
||||
for spellID, t in pairs (validSpells) do
|
||||
if (playerClass == t.class and playerSpecID == t.spec) then
|
||||
_detalhes:SendMissData (spellID, t.container, _detalhes.network.ids [t.commID])
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function _detalhes:SendMissData (spellID, containerType, commID)
|
||||
local combat = _detalhes.tabela_vigente
|
||||
if (combat) then
|
||||
local damageActor = combat (containerType, _detalhes.playername)
|
||||
if (damageActor) then
|
||||
local spell = damageActor.spells:GetSpell (spellID)
|
||||
if (spell) then
|
||||
local data = {
|
||||
[1] = containerType,
|
||||
[2] = spellID,
|
||||
[3] = spell.total,
|
||||
[4] = spell.counter
|
||||
}
|
||||
|
||||
if (_detalhes.debug) then
|
||||
_detalhes:Msg ("(debug) sending miss data packet:", spellID, containerType, commID)
|
||||
end
|
||||
|
||||
_detalhes:SendRaidOrPartyData (commID, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes.HandleMissData (playerName, data)
|
||||
local combat = _detalhes.tabela_vigente
|
||||
|
||||
if (_detalhes.debug) then
|
||||
_detalhes:Msg ("(debug) miss data received from:", playerName, "spellID:", data [2], data [3], data [4])
|
||||
end
|
||||
|
||||
if (combat) then
|
||||
local containerType = data[1]
|
||||
if (type (containerType) ~= "number" or containerType < 1 or containerType > 4) then
|
||||
return
|
||||
end
|
||||
|
||||
local damageActor = combat (containerType, playerName)
|
||||
if (damageActor) then
|
||||
local spellID = data[2] --a spellID has been passed?
|
||||
if (not spellID or type (spellID) ~= "number") then
|
||||
return
|
||||
end
|
||||
|
||||
local validateSpell = validSpells [spellID]
|
||||
if (not validateSpell) then --is a valid spell?
|
||||
return
|
||||
end
|
||||
|
||||
--does the target player fit in the spell requirement on OUR end?
|
||||
local class, spec, maxPercent = validateSpell.class, validateSpell.spec, validateSpell.maxPercent
|
||||
if (class ~= damageActor.classe or spec ~= damageActor.spec) then
|
||||
return
|
||||
end
|
||||
|
||||
local total, counter = data[3], data[4]
|
||||
if (type (total) ~= "number" or type (counter) ~= "number") then
|
||||
return
|
||||
end
|
||||
|
||||
if (total > (damageActor.total * maxPercent)) then
|
||||
return
|
||||
end
|
||||
|
||||
local spellObject = damageActor.spells:PegaHabilidade (spellID, true)
|
||||
if (spellObject) then
|
||||
if (spellObject.total < total and total > 0 and damageActor.nome ~= _detalhes.playername) then
|
||||
local difference = total - spellObject.total
|
||||
if (difference > 0) then
|
||||
spellObject.total = total
|
||||
spellObject.counter = counter
|
||||
damageActor.total = damageActor.total + difference
|
||||
|
||||
combat [containerType].need_refresh = true
|
||||
|
||||
if (_detalhes.debug) then
|
||||
_detalhes:Msg ("(debug) miss data successful added from:", playerName, data [2], "difference:", difference)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes:MakeEqualizeOnActor (player, realm, receivedActor)
|
||||
|
||||
local combat = _detalhes:GetCombat ("current")
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
local CONST_CLOUD_DATARC = "CE"
|
||||
local CONST_CLOUD_EQUALIZE = "EQ"
|
||||
|
||||
local CONST_ROGUE_SR = "SR" --soul rip from akaari's soul (LEGION ONLY)
|
||||
|
||||
_detalhes.network.ids = {
|
||||
["HIGHFIVE_REQUEST"] = CONST_HIGHFIVE_REQUEST,
|
||||
["HIGHFIVE_DATA"] = CONST_HIGHFIVE_DATA,
|
||||
@@ -51,7 +53,10 @@
|
||||
["CLOUD_DATARQ"] = CONST_CLOUD_DATARQ,
|
||||
["CLOUD_DATARC"] = CONST_CLOUD_DATARC,
|
||||
["CLOUD_EQUALIZE"] = CONST_CLOUD_EQUALIZE,
|
||||
|
||||
["WIPE_CALL"] = CONST_WIPE_CALL,
|
||||
|
||||
["MISSDATA_ROGUE_SOULRIP"] = CONST_ROGUE_SR, --soul rip from akaari's soul (LEGION ONLY)
|
||||
}
|
||||
|
||||
local plugins_registred = {}
|
||||
@@ -258,6 +263,29 @@
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes.network.HandleMissData (player, realm, core_version, data)
|
||||
|
||||
-- [1] - container
|
||||
-- [2] - spellid
|
||||
-- [3] - spell total
|
||||
-- [4] - spell counter
|
||||
|
||||
core_version = tonumber (core_version) or 0
|
||||
if (core_version ~= _detalhes.realversion) then
|
||||
if (core_version > _detalhes.realversion) then
|
||||
_detalhes:Msg ("your Details! is out dated and cannot communicate with other players.")
|
||||
end
|
||||
return
|
||||
end
|
||||
if (type (player) ~= "string") then
|
||||
return
|
||||
end
|
||||
local playerName = _detalhes:GetCLName (player)
|
||||
if (playerName) then
|
||||
_detalhes.HandleMissData (playerName, data)
|
||||
end
|
||||
end
|
||||
|
||||
_detalhes.network.functions = {
|
||||
[CONST_HIGHFIVE_REQUEST] = _detalhes.network.HighFive_Request,
|
||||
[CONST_HIGHFIVE_DATA] = _detalhes.network.HighFive_DataReceived,
|
||||
@@ -270,6 +298,8 @@
|
||||
[CONST_CLOUD_DATARC] = _detalhes.network.Cloud_DataReceived,
|
||||
[CONST_CLOUD_EQUALIZE] = _detalhes.network.Cloud_Equalize,
|
||||
[CONST_WIPE_CALL] = _detalhes.network.Wipe_Call,
|
||||
|
||||
[CONST_ROGUE_SR] = _detalhes.network.HandleMissData, --soul rip from akaari's soul (LEGION ONLY)
|
||||
}
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -433,6 +463,14 @@
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes:SendRaidOrPartyData (type, ...)
|
||||
if (IsInRaid()) then
|
||||
_detalhes:SendRaidData (type, ...)
|
||||
elseif (IsInGroup()) then
|
||||
_detalhes:SendPartyData (type, ...)
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes:SendGuildData (type, ...)
|
||||
if not IsInGuild() then return end --> fix from Tim@WoWInterface
|
||||
_detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "GUILD")
|
||||
|
||||
Reference in New Issue
Block a user