- added extra tooltip for the icon on player's bar.

This commit is contained in:
Tercio
2015-06-03 19:58:52 -03:00
parent f771a42cde
commit 557a25305a
9 changed files with 342 additions and 24 deletions
+18 -9
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -824,6 +824,7 @@
nome = actor.nome,
classe = class,
value = _detalhes:GetOrderNumber (actor.nome),
is_custom = true,
}, atributo_custom.mt)
new_actor.name_complement = name_complement
+9 -2
View File
@@ -1034,9 +1034,9 @@
end
end
function _detalhes:MontaTooltip (frame, qual_barra, keydown)
function _detalhes:BuildInstanceBarTooltip (frame)
local GameCooltip = GameCooltip
GameCooltip:Reset()
GameCooltip:SetType ("tooltip")
@@ -1063,7 +1063,14 @@
else
GameCooltip:SetHost (DetailsTooltipAnchor, myPoint, anchorPoint, x_Offset, y_Offset)
end
end
function _detalhes:MontaTooltip (frame, qual_barra, keydown)
self:BuildInstanceBarTooltip (frame)
local GameCooltip = GameCooltip
local esta_barra = self.barras [qual_barra] --> barra que o mouse passou em cima e irá mostrar o tooltip
local objeto = esta_barra.minha_tabela --> pega a referencia da tabela --> retorna a classe_damage ou classe_heal
if (not objeto) then --> a barra não possui um objeto
+109 -9
View File
@@ -702,17 +702,17 @@ function _detalhes:StoreEncounter (combat)
print (myrole, mybest and mybest[1], mybest and mybest[2], mybest and mybest[3], onencounter and onencounter.date)
if (mybest) then
local done = 0
local d_one = 0
if (myrole == "DAMAGER" or myrole == "TANK") then
done = combat (1, _detalhes.playername) and combat (1, _detalhes.playername).total
d_one = combat (1, _detalhes.playername) and combat (1, _detalhes.playername).total
elseif (myrole == "HEALER") then
done = combat (2, _detalhes.playername) and combat (2, _detalhes.playername).total
d_one = combat (2, _detalhes.playername) and combat (2, _detalhes.playername).total
end
if (mybest[1] > done) then
print (Loc ["STRING_DETAILS1"] .. format (Loc ["STRING_SCORE_NOTBEST"], _detalhes:comma_value (done), mybest[1], onencounter.date, mybest[2]))
if (mybest[1] > d_one) then
print (Loc ["STRING_DETAILS1"] .. format (Loc ["STRING_SCORE_NOTBEST"], _detalhes:comma_value (d_one), mybest[1], onencounter.date, mybest[2]))
else
print (Loc ["STRING_DETAILS1"] .. format (Loc ["STRING_SCORE_BEST"], _detalhes:comma_value (done)))
print (Loc ["STRING_DETAILS1"] .. format (Loc ["STRING_SCORE_BEST"], _detalhes:comma_value (d_one)))
end
end
@@ -725,6 +725,7 @@ end
_detalhes.ilevel = {}
local ilvl_core = _detalhes:CreateEventListener()
ilvl_core.amt_inspecting = 0
_detalhes.ilevel.core = ilvl_core
ilvl_core:RegisterEvent ("GROUP_ONENTER", "OnEnter")
ilvl_core:RegisterEvent ("GROUP_ONLEAVE", "OnLeave")
@@ -733,6 +734,15 @@ ilvl_core:RegisterEvent ("COMBAT_PLAYER_LEAVE", "LeaveCombat")
ilvl_core:RegisterEvent ("ZONE_TYPE_CHANGED", "ZoneChanged")
local inspecting = {}
ilvl_core.forced_inspects = {}
function ilvl_core:HasQueuedInspec (unitName)
local guid = UnitGUID (unitName)
if (guid) then
return ilvl_core.forced_inspects [guid]
end
end
local inspect_frame = CreateFrame ("frame")
inspect_frame:RegisterEvent ("INSPECT_READY")
@@ -812,6 +822,44 @@ function ilvl_core:CalcItemLevel (unitid, guid, shout)
_detalhes.item_level_pool [guid] = {name = name, ilvl = average, time = time()}
end
end
local spec = GetInspectSpecialization (unitid)
if (spec and spec ~= 0) then
_detalhes.cached_specs [guid] = spec
end
--------------------------------------------------------------------------------------------------------
local talents = {}
for i = 1, 7 do
for o = 1, 3 do
local talentID, name, texture, selected, available = GetTalentInfo (i, o, 1, true, unitid)
if (selected) then
tinsert (talents, talentID)
break
end
end
end
if (talents [1]) then
_detalhes.cached_talents [guid] = talents
--print (UnitName (unitid), "talents:", unpack (talents))
end
--------------------------------------------------------------------------------------------------------
if (ilvl_core.forced_inspects [guid]) then
if (type (ilvl_core.forced_inspects [guid].callback) == "function") then
local okey, errortext = pcall (ilvl_core.forced_inspects[guid].callback, guid, unitid, ilvl_core.forced_inspects[guid].param1, ilvl_core.forced_inspects[guid].param2)
if (not okey) then
_detalhes:Msg ("Error on QueryInspect callback: " .. errortext)
end
end
ilvl_core.forced_inspects [guid] = nil
end
--------------------------------------------------------------------------------------------------------
end
end
_detalhes.ilevel.CalcItemLevel = ilvl_core.CalcItemLevel
@@ -843,12 +891,21 @@ function ilvl_core:InspectTimeOut (guid)
ilvl_core.amt_inspecting = ilvl_core.amt_inspecting - 1
end
function ilvl_core:GetItemLevel (unitid, guid)
function ilvl_core:ReGetItemLevel (t)
local unitid, guid, is_forced = unpack (t)
return ilvl_core:GetItemLevel (unitid, guid, is_forced)
end
function ilvl_core:GetItemLevel (unitid, guid, is_forced)
--> ddouble check
if (UnitAffectingCombat ("player") or InCombatLockdown()) then
if (not is_forced and (UnitAffectingCombat ("player") or InCombatLockdown())) then
return
end
if (not unitid or not CanInspect (unitid) or not CheckInteractDistance (unitid, 1)) then
if (is_forced) then
ilvl_core:ScheduleTimer ("ReGetItemLevel", 3, {unitid, guid, is_forced})
end
return
end
@@ -888,6 +945,42 @@ function ilvl_core:Reset()
end
end
function ilvl_core:QueryInspect (unitName, callback, param1)
local unitid
if (IsInRaid()) then
for i = 1, GetNumGroupMembers() do
if (GetUnitName ("raid" .. i, true) == unitName) then
unitid = "raid" .. i
break
end
end
elseif (IsInGroup()) then
for i = 1, GetNumGroupMembers()-1 do
if (GetUnitName ("party" .. i, true) == unitName) then
unitid = "party" .. i
break
end
end
end
if (not unitid) then
return
end
local guid = UnitGUID (unitid)
if (not guid or ilvl_core.forced_inspects [guid]) then
return
end
if (inspecting [guid]) then
return
end
ilvl_core.forced_inspects [guid] = {callback = callback, param1 = param1}
ilvl_core:GetItemLevel (unitid, guid, true)
end
function ilvl_core:Loop()
if (ilvl_core.amt_inspecting >= MAX_INSPECT_AMOUNT) then
return
@@ -898,7 +991,14 @@ function ilvl_core:Loop()
ilvl_core.raid_id = 1
end
local unitid = "raid" .. ilvl_core.raid_id
local unitid
if (IsInRaid()) then
unitid = "raid" .. ilvl_core.raid_id
elseif (IsInGroup()) then
unitid = "party" .. ilvl_core.raid_id
else
return
end
local guid = UnitGUID (unitid)
if (not guid) then
+6
View File
@@ -988,6 +988,12 @@ _detalhes.default_profile = default_profile
-- aqui fica as propriedades do jogador que não serão armazenadas no profile
local default_player_data = {
--> current combat number
cached_specs = {},
cached_talents = {},
last_day = date ("%d"),
combat_id = 0,
combat_counter = 0,
last_instance_id = 0,
+3
View File
@@ -85,6 +85,9 @@ function _detalhes:SaveConfig()
--> buffs
xpcall (_detalhes.Buffs.SaveBuffs, _detalhes.saver_error_func)
--> date
_detalhes.last_day = date ("%d")
--> salva o container do personagem
for key, value in pairs (_detalhes.default_player_data) do
if (not is_exception [key]) then
+1 -1
View File
@@ -5,7 +5,7 @@ local g = _detalhes.gump
local _
function _detalhes:DumpTable (text_to_show, dumpvalues, keeptext)
return _detalhes:OpenNewsWindow (text_to_show, dumpvalues, keeptext)
return _detalhes:OpenNewsWindow (text_to_show, true, keeptext)
end
function _detalhes:OpenNewsWindow (text_to_show, dumpvalues, keeptext)
+185 -1
View File
@@ -2054,6 +2054,181 @@ local set_bar_value = function (self, value)
end
end
local icon_frame_on_enter = function (self)
local actor = self.row.minha_tabela
if (actor) then
if (actor.is_custom) then
elseif (actor.dead_at) then
else
local serial = actor.serial
local name = actor:name()
local class = actor:class()
local spec = _detalhes.cached_specs [serial] or actor.spec
local talents = _detalhes.cached_talents [serial]
local ilvl = _detalhes.ilevel:GetIlvl (serial)
local instance = _detalhes:GetInstance (self.row.instance_id)
instance:BuildInstanceBarTooltip (self)
local class_icon, class_L, class_R, class_T, class_B = _detalhes:GetClassIcon (class)
local spec_id, spec_name, spec_description, spec_icon, spec_background, spec_role, spec_class = GetSpecializationInfoByID (spec or 0)
local spec_L, spec_R, spec_T, spec_B
if (spec_id) then
spec_L, spec_R, spec_T, spec_B = unpack (_detalhes.class_specs_coords [spec])
end
GameCooltip:AddLine (name, spec_name)
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small_alpha]], 1, 1, 16, 16, class_L, class_R, class_T, class_B)
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\spec_icons_normal_alpha]], 1, 2, 16, 16, spec_L, spec_R, spec_T, spec_B)
GameCooltip:AddLine ("")
local talent_string = ""
if (talents) then
for i = 1, #talents do
local talentID, name, texture, selected, available = GetTalentInfoByID (talents [i])
talent_string = talent_string .. " |T" .. texture .. ":16:16:0:0:64:64:4:60:4:60|t"
end
end
GameCooltip:AddLine ("Talents:", talent_string)
GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.3)
GameCooltip:AddLine ("Item Level:", ilvl and format ("%.1f", ilvl.ilvl) or "??")
GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.3)
GameCooltip:AddLine ("Class:", LOCALIZED_CLASS_NAMES_MALE [class])
GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.3)
--
local damage = instance.showing (1, name)
local healing = instance.showing (2, name)
GameCooltip:AddLine ("Damage:", _detalhes:ToK2 (damage and damage.total or 0))
GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.3)
GameCooltip:AddLine ("Healing:", _detalhes:ToK2 (healing and healing.total or 0))
GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.3)
--
GameCooltip:AddLine ("")
GameCooltip:AddLine (Loc ["STRING_QUERY_INSPECT"], nil, 1, "orange")
--|TInterface\\TUTORIALFRAME\\UI-TUTORIAL-FRAME:14:14:0:1:512:512:8:70:224:306|t
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 8/512, 70/512, 224/512, 306/512)
GameCooltip:SetOption ("StatusBarTexture", [[Interface\AddOns\Details\images\bar_skyline]])
GameCooltip:ShowCooltip()
self.unitname = name
self.showing = "actor"
end
end
end
local icon_frame_on_leave = function (self)
GameCooltip:Hide()
GameTooltip:Hide()
end
local icon_frame_events = _detalhes:CreateEventListener()
function icon_frame_events:EnterCombat()
for anim, _ in pairs (_detalhes.icon_animations.load.in_use) do
anim.anim:Stop()
anim:Hide()
tinsert (_detalhes.icon_animations.load.available, anim)
end
wipe (_detalhes.icon_animations.load.in_use)
end
icon_frame_events:RegisterEvent ("COMBAT_PLAYER_ENTER", "EnterCombat")
function icon_frame_events:CancelAnim (anim)
if (_detalhes.icon_animations.load.in_use [anim]) then
_detalhes.icon_animations.load.in_use [anim] = nil
tinsert (_detalhes.icon_animations.load.available, anim)
anim.anim:Stop()
anim:Hide()
end
end
local icon_frame_inspect_callback = function (guid, unitid, icon_frame)
local is_in_use = _detalhes.icon_animations.load.in_use [icon_frame.icon_animation]
if (is_in_use) then
tinsert (_detalhes.icon_animations.load.available, icon_frame.icon_animation)
_detalhes.icon_animations.load.in_use [icon_frame.icon_animation] = nil
end
icon_frame.icon_animation.anim:Stop()
icon_frame.icon_animation:Hide()
if (icon_frame:IsMouseOver()) then
icon_frame_on_enter (icon_frame)
end
end
local icon_frame_create_animation = function()
local f = CreateFrame ("frame", nil, UIParent)
f:SetFrameStrata ("FULLSCREEN")
f.anim = f:CreateAnimationGroup()
f.rotate = f.anim:CreateAnimation ("Rotation")
f.rotate:SetDegrees (360)
f.rotate:SetDuration (2)
f.anim:SetLooping ("repeat")
local t = f:CreateTexture (nil, "overlay")
t:SetTexture ([[Interface\COMMON\StreamCircle]])
t:SetAlpha (0.7)
t:SetAllPoints()
tinsert (_detalhes.icon_animations.load.available, f)
end
local icon_frame_on_click = function (self)
if (_detalhes.in_combat) then
_detalhes:Msg (Loc ["STRING_QUERY_INSPECT_FAIL1"])
return
end
if (self.showing == "actor") then
if (_detalhes.ilevel.core:HasQueuedInspec (self.unitname)) then
return
end
_detalhes.ilevel.core:QueryInspect (self.unitname, icon_frame_inspect_callback, self)
--> icon animation
local anim = tremove (_detalhes.icon_animations.load.available)
if (not anim) then
icon_frame_create_animation()
anim = tremove (_detalhes.icon_animations.load.available)
end
anim:Show()
anim:SetParent (self)
anim:ClearAllPoints()
anim:SetFrameStrata ("TOOLTIP")
anim:SetPoint ("center", self, "center")
anim:SetSize (self:GetWidth()*1.7, self:GetHeight()*1.7)
anim.anim:Play()
self.icon_animation = anim
local pid = icon_frame_events:ScheduleTimer ("CancelAnim", 4, anim)
_detalhes.icon_animations.load.in_use [anim] = pid
end
end
local set_frame_icon_scripts = function (row)
row.icon_frame:SetScript ("OnEnter", icon_frame_on_enter)
row.icon_frame:SetScript ("OnLeave", icon_frame_on_leave)
row.icon_frame:SetScript ("OnMouseUp", icon_frame_on_click)
end
local function barra_scripts (esta_barra, instancia, i)
esta_barra._instance = instancia
@@ -2065,6 +2240,8 @@ local function barra_scripts (esta_barra, instancia, i)
esta_barra:SetScript ("OnShow", barra_scripts_onshow)
set_frame_icon_scripts (esta_barra)
esta_barra.SetValue = set_bar_value
end
@@ -3458,7 +3635,14 @@ function gump:CriaNovaBarra (instancia, index)
icone_classe:SetTexture (instancia.row_info.icon_file)
icone_classe:SetTexCoord (.75, 1, .75, 1)
new_row.icone_classe = icone_classe
local icon_frame = CreateFrame ("frame", "DetailsBarra_IconFrame_" .. instancia.meu_id .. "_" .. index, new_row.statusbar)
icon_frame:SetPoint ("topleft", icone_classe, "topleft")
icon_frame:SetPoint ("bottomright", icone_classe, "bottomright")
icon_frame:SetFrameLevel (new_row.statusbar:GetFrameLevel()+1)
icon_frame.row = new_row
new_row.icon_frame = icon_frame
icone_classe:SetPoint ("left", new_row, "left")
new_row.statusbar:SetPoint ("topleft", icone_classe, "topright")
new_row.statusbar:SetPoint ("bottomright", new_row, "bottomright")
+10 -2
View File
@@ -494,14 +494,22 @@ function _G._detalhes:Start()
--boss mobs callbacks
_detalhes:ScheduleTimer ("BossModsLink", 5)
--> limit item level life for 24Hs
local now = time()
for guid, t in pairs (_detalhes.item_level_pool) do
if (t.time+3600 < now) then
if (t.time+86400 < now) then
_detalhes.item_level_pool [guid] = nil
end
end
--> dailly reset of the cache for talents and specs.
local today = date ("%d")
if (_detalhes.last_day ~= today) then
wipe (_detalhes.cached_specs)
wipe (_detalhes.cached_talents)
end
--[[
function _detalhes:TestResize()
_detalhes:OpenNewsWindow ("TESTE, |TInterface\\AddOns\\Details\\images\\key_shift:20:40:0:0:64:64:0:64:0:40|t")