From e3e63dcd673531ae58e1e80045fb06a0954aee5a Mon Sep 17 00:00:00 2001 From: Tercio Date: Thu, 16 Aug 2018 22:05:10 -0300 Subject: [PATCH] - bug fixes. --- Libs/DF/panel.lua | 23 +++++++++++++++-------- boot.lua | 7 +++++-- core/control.lua | 19 ++++++++++++++----- core/gears.lua | 8 ++++++-- core/network.lua | 38 ++++++++++++++++++++++++++++++++++---- core/parser.lua | 33 ++++++++++++++++++--------------- functions/slash.lua | 2 +- 7 files changed, 93 insertions(+), 37 deletions(-) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index f550a48b..d544fb85 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -2009,25 +2009,32 @@ end function DF:ShowPromptPanel (message, func_true, func_false) if (not DF.prompt_panel) then - local f = CreateFrame ("frame", "DetailsFrameworkPrompt", UIParent) - f:SetSize (400, 65) + local f = CreateFrame ("frame", "DetailsFrameworkPromptSimple", UIParent) + f:SetSize (400, 80) f:SetFrameStrata ("DIALOG") f:SetPoint ("center", UIParent, "center", 0, 300) f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) f:SetBackdropColor (0, 0, 0, 0.8) f:SetBackdropBorderColor (0, 0, 0, 1) + tinsert (UISpecialFrames, "DetailsFrameworkPromptSimple") + + DF:CreateTitleBar (f, "Prompt!") + DF:ApplyStandardBackdrop (f) local prompt = f:CreateFontString (nil, "overlay", "GameFontNormal") - prompt:SetPoint ("top", f, "top", 0, -15) + prompt:SetPoint ("top", f, "top", 0, -28) prompt:SetJustifyH ("center") f.prompt = prompt - local button_true = DF:CreateButton (f, nil, 60, 20, "Yes") - button_true:SetPoint ("bottomleft", f, "bottomleft", 5, 5) + local button_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE") + local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") + + local button_true = DF:CreateButton (f, nil, 60, 20, "Yes", nil, nil, nil, nil, nil, nil, options_dropdown_template) + button_true:SetPoint ("bottomright", f, "bottomright", -5, 5) f.button_true = button_true - - local button_false = DF:CreateButton (f, nil, 60, 20, "No") - button_false:SetPoint ("bottomright", f, "bottomright", -5, 5) + + local button_false = DF:CreateButton (f, nil, 60, 20, "No", nil, nil, nil, nil, nil, nil, options_dropdown_template) + button_false:SetPoint ("bottomleft", f, "bottomleft", 5, 5) f.button_false = button_false button_true:SetClickFunction (function() diff --git a/boot.lua b/boot.lua index 6db6648e..5272e306 100644 --- a/boot.lua +++ b/boot.lua @@ -3,9 +3,9 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 6177 + _detalhes.build_counter = 6189 _detalhes.userversion = "v8.0.1." .. _detalhes.build_counter - _detalhes.realversion = 132 --core version + _detalhes.realversion = 133 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" _detalhes.BFACORE = 131 Details = _detalhes @@ -116,6 +116,9 @@ do _detalhes.encounter_table = {} _detalhes.encounter_counter = {} _detalhes.encounter_dungeons = {} + --> reliable char data sources + --> actors that are using details! and sent character data, we don't need query inspect on these actors + _detalhes.trusted_characters = {} --> informa��es sobre a arena atual _detalhes.arena_table = {} _detalhes.arena_info = { diff --git a/core/control.lua b/core/control.lua index f746ac6e..6996a348 100644 --- a/core/control.lua +++ b/core/control.lua @@ -443,6 +443,19 @@ end end + function _detalhes:ScheduleSyncPlayerActorData() + if ((IsInGroup() or IsInRaid()) and (_detalhes.zone_type == "party" or _detalhes.zone_type == "raid")) then + --> do not sync if in battleground or arena + _detalhes:SendCharacterData() + end + end + + function _detalhes:EndCombat() + if (_detalhes.in_combat) then + _detalhes:SairDoCombate() + end + end + -- ~end ~leave function _detalhes:SairDoCombate (bossKilled, from_encounter_end) @@ -573,11 +586,7 @@ end --> send item level after a combat if is in raid or party group - if (IsInGroup() or IsInRaid()) then - C_Timer.After (1, function() - _detalhes:SentMyItemLevel() - end) - end + C_Timer.After (1, _detalhes.ScheduleSyncPlayerActorData) if (not _detalhes.tabela_vigente.is_boss) then diff --git a/core/gears.lua b/core/gears.lua index 2c420b93..c4be031e 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -1726,6 +1726,9 @@ function _detalhes:IlvlFromNetwork (player, realm, core, serialNumber, itemLevel return end + --> won't inspect this actor + _detalhes.trusted_characters [serialNumber] = true + if (type (serialNumber) ~= "string") then return end @@ -2063,7 +2066,8 @@ function ilvl_core:Loop() return end - if (inspecting [guid]) then + --> if already inspecting or the actor is in the list of trusted actors + if (inspecting [guid] or _detalhes.trusted_characters [guid]) then return end @@ -2107,7 +2111,7 @@ end function ilvl_core:OnEnter() if (IsInRaid()) then - _detalhes:SentMyItemLevel() + _detalhes:SendCharacterData() end if (can_start_loop()) then diff --git a/core/network.lua b/core/network.lua index 7ae49902..bc7017df 100644 --- a/core/network.lua +++ b/core/network.lua @@ -76,7 +76,7 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> item level - function _detalhes:SentMyItemLevel() + function _detalhes:SendCharacterData() --> only send if in group if (not IsInGroup() and not IsInRaid()) then return @@ -124,7 +124,18 @@ --> get the character serial number local serial = UnitGUID ("player") - _detalhes:SendRaidData (CONST_ITEMLEVEL_DATA, serial, equipped, talents, currentSpec) + if (IsInRaid()) then + _detalhes:SendRaidData (CONST_ITEMLEVEL_DATA, serial, equipped, talents, currentSpec) + if (_detalhes.debug) then + _detalhes:Msg ("(debug) sent ilevel data to Raid") + end + + elseif (IsInGroup()) then + _detalhes:SendPartyData (CONST_ITEMLEVEL_DATA, serial, equipped, talents, currentSpec) + if (_detalhes.debug) then + _detalhes:Msg ("(debug) sent ilevel data to Party") + end + end _detalhes.LastPlayerInfoSync = GetTime() end @@ -624,19 +635,38 @@ end function _detalhes:SendRaidData (type, ...) - if (IsInRaid (LE_PARTY_CATEGORY_INSTANCE) and IsInInstance()) then + + local isInInstanceGroup = IsInRaid (LE_PARTY_CATEGORY_INSTANCE) + + if (isInInstanceGroup) then _detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT") + if (_detalhes.debug) then + _detalhes:Msg ("(debug) sent comm to INSTANCE raid group") + end else _detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID") + if (_detalhes.debug) then + _detalhes:Msg ("(debug) sent comm to LOCAL raid group") + end end end function _detalhes:SendPartyData (type, ...) - if (IsInGroup (LE_PARTY_CATEGORY_INSTANCE) and IsInInstance()) then + + local isInInstanceGroup = IsInGroup (LE_PARTY_CATEGORY_INSTANCE) + + if (isInInstanceGroup) then _detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT") + if (_detalhes.debug) then + _detalhes:Msg ("(debug) sent comm to INSTANCE party group") + end else _detalhes:SendCommMessage (CONST_DETAILS_PREFIX, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "PARTY") + if (_detalhes.debug) then + _detalhes:Msg ("(debug) sent comm to LOCAL party group") + end end + end function _detalhes:SendRaidOrPartyData (type, ...) diff --git a/core/parser.lua b/core/parser.lua index dd4ebe53..3a98fd7d 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -4051,19 +4051,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 return _detalhes.parser_functions:ZONE_CHANGED_NEW_AREA (...) end - function _detalhes.parser_functions:PLAYER_SPECIALIZATION_CHANGED() - local specIndex = GetSpecialization() - if (specIndex) then - local specID = GetSpecializationInfo (specIndex) - if (specID and specID ~= 0) then - local guid = UnitGUID ("player") - if (guid) then - _detalhes.cached_specs [guid] = specID - end - end - end - end - -- ~encounter function _detalhes.parser_functions:ENCOUNTER_START (...) if (_detalhes.debug) then @@ -4361,18 +4348,29 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes.SendTalentTimer:Cancel() end _detalhes.SendTalentTimer = C_Timer.NewTimer (11, function() - _detalhes:SentMyItemLevel() + _detalhes:SendCharacterData() end) end end function _detalhes.parser_functions:PLAYER_SPECIALIZATION_CHANGED() + local specIndex = GetSpecialization() + if (specIndex) then + local specID = GetSpecializationInfo (specIndex) + if (specID and specID ~= 0) then + local guid = UnitGUID ("player") + if (guid) then + _detalhes.cached_specs [guid] = specID + end + end + end + if (IsInGroup() or IsInRaid()) then if (_detalhes.SendTalentTimer and not _detalhes.SendTalentTimer._cancelled) then _detalhes.SendTalentTimer:Cancel() end _detalhes.SendTalentTimer = C_Timer.NewTimer (11, function() - _detalhes:SentMyItemLevel() + _detalhes:SendCharacterData() end) end end @@ -4459,6 +4457,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes:SendEvent ("GROUP_ONENTER") _detalhes:DispatchAutoRunCode ("on_groupchange") + + wipe (_detalhes.trusted_characters) + C_Timer.After (5, _detalhes.ScheduleSyncPlayerActorData) end else _detalhes.in_group = IsInGroup() or IsInRaid() @@ -4473,6 +4474,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes:SendEvent ("GROUP_ONLEAVE") _detalhes:DispatchAutoRunCode ("on_groupchange") + + wipe (_detalhes.trusted_characters) else _detalhes:SchedulePetUpdate (2) end diff --git a/functions/slash.lua b/functions/slash.lua index 5a3f658f..36f90d5a 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -1440,7 +1440,7 @@ Damage Update Status: @INSTANCEDAMAGESTATUS elseif (msg == "senditemlevel") then - _detalhes:SentMyItemLevel() + _detalhes:SendCharacterData() print ("Item level dispatched.") elseif (msg == "talents") then