- debug player table creation.

- fix akaari's soul.
This commit is contained in:
Tercio
2016-10-09 20:57:11 -03:00
parent 2932a9b3d9
commit 5773dc14b5
5 changed files with 185 additions and 13 deletions
+6 -11
View File
File diff suppressed because one or more lines are too long
+13 -1
View File
@@ -454,7 +454,7 @@
--> não achou, criar
elseif (criar) then
local novo_objeto = self.funcao_de_criacao (_, serial, nome)
novo_objeto.nome = nome
novo_objeto.flag_original = flag
@@ -606,6 +606,18 @@
novo_objeto.pvp = true
end
if (_detalhes.debug) then
if (_detalhes.debug_chr and nome:find (_detalhes.debug_chr) and self.tipo == 1) then
local logLine = ""
local when = "[" .. date ("%H:%M:%S") .. format (".%4f", GetTime()-floor (GetTime())) .. "]"
local log = "actor created - class: " .. (novo_objeto.classe or "noclass")
local from = debugstack (2, 1, 0)
logLine = logLine .. when .. " " .. log .. " " .. from .. "\n"
_detalhes_global.debug_chr_log = _detalhes_global.debug_chr_log .. logLine
end
end
return novo_objeto, dono_do_pet, nome
else
return nil, nil, nil
+112
View File
@@ -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")
+38
View File
@@ -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")
+16 -1
View File
@@ -886,13 +886,26 @@ function SlashCmdList.DETAILS (msg, editbox)
end
--> debug
elseif (msg == "debug") then
elseif (command == "debug") then
if (_detalhes.debug) then
_detalhes.debug = false
print (Loc ["STRING_DETAILS1"] .. "diagnostic mode has been turned off.")
return
else
_detalhes.debug = true
print (Loc ["STRING_DETAILS1"] .. "diagnostic mode has been turned on.")
if (rest and rest ~= "") then
if (rest == "-clear") then
_detalhes_global.debug_chr_log = ""
print (Loc ["STRING_DETAILS1"] .. "log for characters has been wiped.")
return
end
_detalhes.debug_chr = rest
_detalhes_global.debug_chr_log = _detalhes_global.debug_chr_log or ""
print (Loc ["STRING_DETAILS1"] .. "diagnostic for character " .. rest .. " turned on.")
return
end
end
--> debug combat log
@@ -1368,3 +1381,5 @@ function _detalhes:CreateListPanel()
return _detalhes.ListPanel
end
--endd elsee