- Implemented a sync for encounter with phases.

- Shout button on custom panel is now working.
- New API function GetAllActors (combat, actorname) return all the 4 types.
- New API widget _detalhes:Ask (askWhat, callback, ...)
- Added some information for know bugs.
This commit is contained in:
Tercio
2013-08-15 23:26:31 -03:00
parent 04dfb1c73f
commit 34c53c1a2c
12 changed files with 300 additions and 26 deletions
+1
View File
@@ -87,6 +87,7 @@ core\plugins_solo.lua
core\gears.lua
core\windows.lua
core\meta.lua
core\network.lua
core\parser.lua
startup.lua
+3 -3
View File
@@ -5,9 +5,9 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> global name declaration
_detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0")
_detalhes.version = "Alpha 001"
_detalhes.realversion = 1
_detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0")
_detalhes.version = "Alpha 002"
_detalhes.realversion = 2
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> initialization stuff
+1 -1
View File
@@ -69,7 +69,7 @@ function atributo_custom:RefreshWindow (instancia, _combat, forcar, exportar)
end
elseif (_IsInGroup()) then
for i = 1, _GetNumGroupMembers()-1, 1 do
local nome = _GetUnitName ("raid"..i, true):gsub (("%s+"), "")
local nome = _GetUnitName ("party"..i, true):gsub (("%s+"), "")
local Actor = _combat (CustomObject.attribute, nome)
if (Actor) then
Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target)
+131 -13
View File
@@ -220,19 +220,31 @@
end
end
_detalhes.tabela_vigente.enemy = inimigo
else
_detalhes.tabela_vigente.enemy = _detalhes.tabela_vigente.is_boss.encounter
_detalhes:CaptureSet (false, "damage", false, 30)
_detalhes:CaptureSet (false, "heal", false, 30)
if (_detalhes.debug) then
print ("Details found a boss on last fight, freezing parser for 30 seconds.")
_detalhes:EqualizeActors()
end
else
local bossFunction, bossFunctionType = _detalhes:GetBossFunction (_detalhes.tabela_vigente.is_boss.mapid, _detalhes.tabela_vigente.is_boss.index)
if (bossFunction) then
if (_bit_band (bossFunctionType, 0x2) ~= 0) then --end of combat
bossFunction()
if (_detalhes:GetBossDetails (_detalhes.tabela_vigente.is_boss.mapid, _detalhes.tabela_vigente.is_boss.index)) then
_detalhes.tabela_vigente.enemy = _detalhes.tabela_vigente.is_boss.encounter
_detalhes:CaptureSet (false, "damage", false, 30)
_detalhes:CaptureSet (false, "heal", false, 30)
if (_detalhes.debug) then
print ("Details found a boss on last fight, freezing parser for 30 seconds.")
end
local bossFunction, bossFunctionType = _detalhes:GetBossFunction (_detalhes.tabela_vigente.is_boss.mapid, _detalhes.tabela_vigente.is_boss.index)
if (bossFunction) then
if (_bit_band (bossFunctionType, 0x2) ~= 0) then --end of combat
bossFunction()
end
end
_detalhes:EqualizeActors()
else
if (_detalhes.debug) then
_detalhes:EqualizeActors()
end
end
end
@@ -256,14 +268,15 @@
_detalhes.tabela_vigente:seta_tempo_decorrido() --> salva o end_time
_detalhes.tabela_overall:seta_tempo_decorrido() --seta o end_time
local tempo_do_combate = _detalhes.tabela_vigente.end_time - _detalhes.tabela_vigente.start_time
if (_detalhes.solo) then
--> debuffs need a checkup, not well functional right now
_detalhes.CloseSoloDebuffs()
end
if ( tempo_do_combate >= _detalhes.minimum_combat_time) then --> tempo minimo precisa ser 5 segundos pra acrecentar a tabela ao historico
local tempo_do_combate = _detalhes.tabela_vigente.end_time - _detalhes.tabela_vigente.start_time
--if ( tempo_do_combate >= _detalhes.minimum_combat_time) then --> tempo minimo precisa ser 5 segundos pra acrecentar a tabela ao historico
if ( tempo_do_combate >= 10) then --> tempo minimo precisa ser 5 segundos pra acrecentar a tabela ao historico
_detalhes.tabela_historico:adicionar (_detalhes.tabela_vigente) --move a tabela atual para dentro do histórico
else
--> this is a little bit complicated, need a specific function for combat cancellation
@@ -282,6 +295,13 @@
_detalhes.tabela_vigente = _detalhes.combate:NovaTabela (false, _detalhes.tabela_overall) --cria uma nova tabela de combate caso não tenha nenhuma no historico
end
if (_detalhes.tabela_vigente.start_time == 0) then
_detalhes.tabela_vigente.start_time = _detalhes._tempo
_detalhes.tabela_vigente.end_time = _detalhes._tempo
end
_detalhes.tabela_vigente.resincked = true
--> tabela foi descartada, precisa atualizar os baseframes // precisa atualizer todos ou apenas o overall?
_detalhes:InstanciaCallFunction (_detalhes.AtualizarJanela)
@@ -311,6 +331,104 @@
_detalhes:SendEvent ("COMBAT_PLAYER_LEAVE", nil, _detalhes.tabela_vigente)
end
function _detalhes:MakeEqualizeOnActor (player, realm, receivedActor)
local damage, heal, energy, misc = _detalhes:GetAllActors ("current", player)
if (not damage and not heal) then
--> add server name
damage, heal, energy, misc = _detalhes:GetAllActors ("current", player.."-"..realm)
end
local combat = _detalhes:GetCombat ("current")
combat[1].need_refresh = true
combat[2].need_refresh = true
combat[3].need_refresh = true
combat[4].need_refresh = true
if (damage) then
if (damage.total < receivedActor [1][1]) then
damage.total = receivedActor [1][1]
end
if (damage.damage_taken < receivedActor [1][2]) then
damage.damage_taken = receivedActor [1][2]
end
if (damage.friendlyfire_total < receivedActor [1][3]) then
damage.friendlyfire_total = receivedActor [1][3]
end
end
if (heal) then
if (heal.total < receivedActor [2][1]) then
heal.total = receivedActor [2][1]
end
if (heal.totalover < receivedActor [2][2]) then
heal.totalover = receivedActor [2][2]
end
if (heal.healing_taken < receivedActor [2][3]) then
heal.healing_taken = receivedActor [2][3]
end
end
if (energy) then
if (energy.mana and (receivedActor [3][1] > 0 and energy.mana < receivedActor [3][1])) then
energy.mana = receivedActor [3][1]
end
if (energy.e_rage and (receivedActor [3][2] > 0 and energy.e_rage < receivedActor [3][2])) then
energy.e_rage = receivedActor [3][2]
end
if (energy.e_energy and (receivedActor [3][3] > 0 and energy.e_energy < receivedActor [3][3])) then
energy.e_energy = receivedActor [3][3]
end
if (energy.runepower and (receivedActor [3][4] > 0 and energy.runepower < receivedActor [3][4])) then
energy.runepower = receivedActor [3][4]
end
end
if (misc) then
if (misc.interrupt and (receivedActor [4][1] > 0 and misc.interrupt < receivedActor [4][1])) then
misc.interrupt = receivedActor [4][1]
end
if (misc.dispell and (receivedActor [4][2] > 0 and misc.dispell < receivedActor [4][2])) then
misc.dispell = receivedActor [4][2]
end
end
end
function _detalhes:EqualizeActors()
local damage, heal, energy, misc = _detalhes:GetAllActors ("current", UnitName ("player"))
if (damage) then
damage = {damage.total, damage.damage_taken, damage.friendlyfire_total}
else
damage = {0, 0, 0}
end
if (heal) then
heal = {heal.total, heal.totalover, heal.healing_taken}
else
heal = {0, 0, 0}
end
if (energy) then
energy = {energy.mana or 0, energy.e_rage or 0, energy.e_energy or 0, energy.runepower or 0}
else
energy = {0, 0, 0, 0}
end
if (misc) then
misc = {misc.interrupt or 0, misc.dispell or 0}
else
misc = {0, 0}
end
local data = {damage, heal, energy, misc}
_detalhes:SendRaidData ("equalize_actors", data)
end
function _detalhes:FlagActorsOnBossFight()
for class_type, container in _ipairs (_detalhes.tabela_vigente) do
for _, actor in _ipairs (container._ActorTable) do
+2
View File
@@ -141,6 +141,8 @@
if (#tabelas_de_combate > 0) then
for index, combate in _ipairs (tabelas_de_combate) do
combate.hasSaved = true
if (combate.end_time and combate.start_time) then
tabela_overall.start_time = tabela_overall.start_time - (combate.end_time - combate.start_time)
end
+47
View File
@@ -0,0 +1,47 @@
--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 pointers
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> api
function _detalhes:RaidComm (_, data, _, source)
local type = select (2, _detalhes:Deserialize (data))
if (_detalhes.debug) then
print ("comm received", type)
end
if (type == "custom_broadcast") then
_detalhes:OnReceiveCustom (select (3, _detalhes:Deserialize (data)))
elseif (type == "equalize_actors") then
if (not _detalhes.in_combat) then
local player, realm, dversion, receivedActor = select (3, _detalhes:Deserialize (data))
if (dversion ~= _detalhes.realversion) then
return
end
_detalhes:MakeEqualizeOnActor (player, realm, receivedActor)
end
end
end
_detalhes:RegisterComm ("details_comm", "RaidComm")
function _detalhes:SendRaidData (type, ...)
_detalhes:SendCommMessage ("details_comm", _detalhes:Serialize (type, UnitName ("player"), GetRealmName(), _detalhes.realversion, ...), "RAID")
end
+38 -1
View File
@@ -192,6 +192,39 @@
--> record death log
local t = jogador_alvo.last_events_table
local i = t.n
if (not i) then
local isOriginal = jogador_alvo.last_events_table.original
if (isOriginal) then
isOriginal = "IsOriginal = TRUE"
else
isOriginal = "IsOriginal = FALSE"
end
local indexes = #jogador_alvo.last_events_table
if (not indexes) then
indexes = "Indexes = NIL"
else
indexes = "Indexes = "..indexes
end
local resync = _detalhes.tabela_vigente.resincked
if (resync) then
resync = "resync = TRUE"
else
resync = "resync = FALSE"
end
local saved = _detalhes.tabela_vigente.hasSaved
if (saved) then
saved = "saved = TRUE"
else
saved = "saved = FALSE"
end
print ("Report the lines shown, click on reset button and type /reload")
print ("We are investigation this issue, this information is important to us.")
assert (false, "Please Report This Error on the Blue Button: Parser 194: " .. isOriginal .. " " .. indexes .. " " .. resync .. " " .. saved)
end
t.n = i + 1
t = t [i]
@@ -605,7 +638,7 @@
-----------------------------------------------------------------------------------------------------------------------------------------
--> BUFFS & DEBUFFS serach key: ~buff |
--> BUFFS & DEBUFFS serach key: ~buff ~aura ~shield |
-----------------------------------------------------------------------------------------------------------------------------------------
function parser:buff (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellname, _, tipo, amount)
@@ -1953,6 +1986,10 @@
return nil
end
function _detalhes:GetAllActors (_combat, _actorname)
return _detalhes:GetActor (_combat, 1, _actorname), _detalhes:GetActor (_combat, 2, _actorname), _detalhes:GetActor (_combat, 3, _actorname), _detalhes:GetActor (_combat, 4, _actorname)
end
--> get an actor
function _detalhes:GetActor (_combat, _attribute, _actorname)
+19
View File
@@ -65,6 +65,25 @@ function SlashCmdList.DETAILS (msg, editbox)
_G.DetailsCopy.MyObject.text:HighlightText()
_G.DetailsCopy.MyObject.text:SetFocus()
elseif (msg == "comm") then
--_detalhes:SendData ("RAID", "Hello There!")
local s = _detalhes:Serialize ("tercio", "jose")
local d, e, f = _detalhes:Deserialize (s)
print (d, e, f)
elseif (msg == "visao") then
--_detalhes:VisiblePlayers()
--local a, b = GetUnitName ("player")
--print (a,GetRealmName())
--print (time())
--print (math.floor (time()/10))
assert (false, "teste")
elseif (msg == "yesno") then
--_detalhes:Show()
elseif (msg == "imageedit") then
local callback = function (width, height, overlayColor, alpha, texCoords)
+22 -3
View File
@@ -903,12 +903,31 @@ local function CreateCustomWindow()
-------------------------> Install CoolTip on Shout Button
local addCustomReceived = function (param1)
_detalhes.custom [#_detalhes.custom+1] = param1
print (Loc ["STRING_CUSTOM_CREATED"])
end
function _detalhes:OnReceiveCustom (source, realm, dversion, _customTable)
if (dversion ~= _detalhes.realversion) then
print (Loc ["STRING_TOOOLD2"])
return
end
for index, custom in _ipairs (_detalhes.custom) do
if (_customTable.name == custom.name) then
return
end
end
_detalhes:Ask (source .. "-" .. realm .. " " .. Loc ["STRING_CUSTOM_ACCETP_CUSTOM"], addCustomReceived, _customTable)
end
--> testing
local ShoutFunc = function (_, _, CustomIndex)
AceComm:SendCommMessage ("DETAILS", AceSerializer:Serialize ( _detalhes.custom [CustomIndex] ), "RAID")
print (Loc ["STRING_CUSTOM_BROADCASTSENT"])
GameCooltip:Close()
--AceComm:SendCommMessage ("DETAILS", AceSerializer:Serialize ( _detalhes.custom [CustomIndex] ), "WHISPER", UnitName ("player"))
_detalhes:SendRaidData ("custom_broadcast", _detalhes.custom [CustomIndex])
print (Loc ["STRING_CUSTOM_BROADCASTSENT"])
end
local CreateCustomListForShout = function()
+5 -1
View File
@@ -5,11 +5,15 @@ if not Loc then return end
Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails:|r " --> color and details name
Loc ["STRING_YES"] = "Yes"
Loc ["STRING_NO"] = "No"
Loc ["STRING_AUTO"] = "auto"
Loc ["STRING_LEFT"] = "left"
Loc ["STRING_CENTER"] = "center"
Loc ["STRING_RIGHT"] = "right"
Loc ["STRING_TOOOLD"] = "could not be installed because your Details! version is too old."
Loc ["STRING_TOOOLD2"] = "your Details! version isn't the same."
Loc ["STRING_RIGHTCLICK_CLOSE_SHORT"] = "Right click to close."
Loc ["STRING_RIGHTCLICK_CLOSE_MEDIUM"] = "Use right click to close this window."
@@ -81,7 +85,7 @@ if not Loc then return end
Loc ["STRING_CUSTOM_HELP2"] = "Choose here the attribute type of the spell, if your spell is a Healing spell, you may click on Heal."
Loc ["STRING_CUSTOM_HELP3"] = "Custom name will be used on Details attribute menu, and also, shown when reporting.\n\nOn spell id field, type some letters to filter spell names, you can also choose a spell from encounter menu on the right.\n\nOver source field, type where Details will serach for the spell, more info at his tooltip."
Loc ["STRING_CUSTOM_HELP4"] = "You can choose a spell from a raid encounter, mouse over this button and the options will be shown to you."
Loc ["STRING_CUSTOM_"] = ""
Loc ["STRING_CUSTOM_ACCETP_CUSTOM"] = "sent a custom display to you, Do you want add this to your custom library?"
--> Switch Window
+5 -1
View File
@@ -5,11 +5,15 @@ if not Loc then return end
Loc ["STRING_DETAILS1"] = "|cffffaeaeDetalhes:|r " --> color and details name
Loc ["STRING_YES"] = "Sim"
Loc ["STRING_NO"] = "Nao"
Loc ["STRING_AUTO"] = "auto"
Loc ["STRING_LEFT"] = "esquerda"
Loc ["STRING_CENTER"] = "centro"
Loc ["STRING_RIGHT"] = "direita"
Loc ["STRING_TOOOLD"] = "nao pode ser instalado pois sua versao do Details! e muito antiga."
Loc ["STRING_TOOOLD2"] = "a sua versao do Details! nao e a mesma."
Loc ["STRING_RIGHTCLICK_CLOSE_SHORT"] = "Botao direito para fechar."
Loc ["STRING_RIGHTCLICK_CLOSE_MEDIUM"] = "Use o botao direito para fechar esta janela."
@@ -81,7 +85,7 @@ if not Loc then return end
Loc ["STRING_CUSTOM_HELP2"] = "Escolha aqui o atributo, se a sua magia for de curar, voce deve escolher cura."
Loc ["STRING_CUSTOM_HELP3"] = "O nome da customizacao e usado no menu de atributos do Detalhes, e tambem mostrado no relatorio ao reportar."
Loc ["STRING_CUSTOM_HELP4"] = "Voce pode escolher uma magia de algum encontro de uma raide, basta deixar o ponteiro do mouse sobre o botao para que o menu seja mostrado."
Loc ["STRING_CUSTOM_"] = ""
Loc ["STRING_CUSTOM_ACCETP_CUSTOM"] = "lhe enviou um display customizado. Voce deseja adicionar esta customizacao a sua biblioteca de displays customizados?"
--> Switch Window
+24 -1
View File
@@ -8,7 +8,7 @@ function _G._detalhes:Start()
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> details defaults
-- _detalhes.debug = true
_detalhes.debug = false
--> who is
self.playername = UnitName ("player")
@@ -149,6 +149,29 @@ function _G._detalhes:Start()
--> copy and paste window
self:CreateCopyPasteWindow()
self.CreateCopyPasteWindow = nil
--> yesno frame
self.yesNo = self.gump:NewPanel (UIParent, _, "DetailsYesNoWindow", _, 500, 80)
self.yesNo:SetPoint ("center", UIParent, "center")
self.gump:NewLabel (self.yesNo, _, "$parentAsk", "ask", "")
self.yesNo ["ask"]:SetPoint ("center", self.yesNo, "center", 0, 25)
self.yesNo ["ask"]:SetWidth (480)
self.yesNo ["ask"]:SetJustifyH ("center")
self.yesNo ["ask"]:SetHeight (22)
local Loc = LibStub ("AceLocale-3.0"):GetLocale ("Details")
self.gump:NewButton (self.yesNo, _, "$parentNo", "no", 100, 30, function() self.yesNo:Hide() end, nil, nil, nil, Loc ["STRING_NO"])
self.gump:NewButton (self.yesNo, _, "$parentYes", "yes", 100, 30, nil, nil, nil, nil, Loc ["STRING_YES"])
self.yesNo ["no"]:SetPoint (10, -45)
self.yesNo ["yes"]:SetPoint (390, -45)
self.yesNo ["no"]:InstallCustomTexture()
self.yesNo ["yes"]:InstallCustomTexture()
self.yesNo ["yes"]:SetHook ("OnMouseUp", function() self.yesNo:Hide() end)
function _detalhes:Ask (msg, func, ...)
self.yesNo ["ask"].text = msg
local p1, p2 = ...
self.yesNo ["yes"]:SetClickFunction (func, p1, p2)
self.yesNo:Show()
end
self.yesNo:Hide()
--> start instances
if (self:QuantasInstancias() == 0) then