Tiny Threat (plugin): added options to Hide the Pull Bar and Use Focus Target.

This commit is contained in:
Tercio Jose
2021-08-11 19:54:12 -03:00
parent b4b6b64504
commit 70483cd194
2 changed files with 67 additions and 16 deletions
+12 -3
View File
@@ -6,9 +6,9 @@
local version, build, date, tocversion = GetBuildInfo()
_detalhes.build_counter = 8722
_detalhes.alpha_build_counter = 8722 --if this is higher than the regular counter, use it instead
_detalhes.bcc_counter = 25
_detalhes.build_counter = 8782
_detalhes.alpha_build_counter = 8782 --if this is higher than the regular counter, use it instead
_detalhes.bcc_counter = 26
_detalhes.dont_open_news = true
_detalhes.game_version = version
_detalhes.userversion = version .. _detalhes.build_counter
@@ -33,6 +33,14 @@ do
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" )
local news = {
{"v9.1.0.8782.144", "August 11th, 2021"},
"Clicking on the minimap while the options panel is open will close it.",
"Fixed Raid Check plugin position when the window is anchored at the top of the monitor.",
"Shadow priest Void Erruption spells got merged into only one.",
"Added settings to adjust the scale or font size of the title bar menu (right click): /run Details.all_switch_config.font_size = 12; /run Details.all_switch_config.scale = 1.0;",
"Added transliteration to healing done.",
"Tiny Threat (plugin): added options to Hide the Pull Bar and Use Focus Target.",
{"v9.0.5.8637.144", "June 22nd, 2021"},
"Major update on Vanguard plugin.",
"Added utility module to Coach, this module will send interrupt, dispel, cc breaks, cooldown usege and battle resses to the Coach.",
@@ -197,6 +205,7 @@ do
_detalhes.InstancesToStoreData = { --mapId
[2296] = true, --castle narnia
[2450] = true, --sanctum of domination
[2450] = true,
}
--> armazena os escudos - Shields information for absorbs
@@ -267,11 +267,29 @@ local function CreatePluginFrames (data)
end
end
function ThreatMeter:GetUnitId()
local unitId
if (ThreatMeter.saveddata.usefocus) then
unitId = "focus"
if (not UnitExists(unitId)) then
unitId = "target"
end
else
unitId = "target"
end
return unitId
end
local Threater = function()
local options = ThreatMeter.options
if (ThreatMeter.Actived and UnitExists ("target") and not _UnitIsFriend ("player", "target")) then
local unitId = ThreatMeter:GetUnitId()
if (ThreatMeter.Actived and UnitExists(unitId) and not _UnitIsFriend("player", unitId)) then
--> get the threat of all players
if (_IsInRaid()) then
for i = 1, _GetNumGroupMembers(), 1 do
@@ -285,7 +303,7 @@ local function CreatePluginFrames (data)
return
end
local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("raid"..i, "target")
local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("raid"..i, unitId)
if (status) then
threat_table [2] = threatpct
threat_table [3] = isTanking
@@ -310,7 +328,7 @@ local function CreatePluginFrames (data)
return
end
local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("party"..i, "target")
local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("party"..i, unitId)
if (status) then
threat_table [2] = threatpct
threat_table [3] = isTanking
@@ -326,7 +344,7 @@ local function CreatePluginFrames (data)
local threat_table_index = ThreatMeter.player_list_hash [thisplayer_name]
local threat_table = ThreatMeter.player_list_indexes [threat_table_index]
local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("player", "target")
local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("player", unitId)
if (status) then
threat_table [2] = threatpct
threat_table [3] = isTanking
@@ -344,7 +362,7 @@ local function CreatePluginFrames (data)
local threat_table_index = ThreatMeter.player_list_hash [thisplayer_name]
local threat_table = ThreatMeter.player_list_indexes [threat_table_index]
local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("player", "target")
local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("player", unitId)
if (status) then
threat_table [2] = threatpct
threat_table [3] = isTanking
@@ -362,7 +380,7 @@ local function CreatePluginFrames (data)
local threat_table = ThreatMeter.player_list_indexes [threat_table_index]
if (threat_table) then
local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("pet", "target")
local isTanking, status, threatpct, rawthreatpct, threatvalue = _UnitDetailedThreatSituation ("pet", unitId)
if (status) then
threat_table [2] = threatpct
threat_table [3] = isTanking
@@ -391,14 +409,18 @@ local function CreatePluginFrames (data)
local lastIndex = 0
local shownMe = false
local firstIndex = 1
local pullRow = ThreatMeter.ShownRows [1]
local me = ThreatMeter.player_list_indexes [ ThreatMeter.player_list_hash [player] ]
if (me) then
if (me and not ThreatMeter.saveddata.hide_pull_bar) then
firstIndex = 2
local myThreat = me [6] or 0
local myRole = me [4]
local topThreat = ThreatMeter.player_list_indexes [1]
local aggro = topThreat [6] * (CheckInteractDistance ("target", 3) and 1.1 or 1.3)
local aggro = topThreat [6] * (CheckInteractDistance(unitId, 3) and 1.1 or 1.3)
aggro = max(aggro, 0.001)
pullRow:SetLeftText ("Pull Aggro At")
@@ -422,7 +444,7 @@ local function CreatePluginFrames (data)
end
for index = 2, #ThreatMeter.ShownRows do
for index = firstIndex, #ThreatMeter.ShownRows do
local thisRow = ThreatMeter.ShownRows [index]
local threat_actor = ThreatMeter.player_list_indexes [index-1]
@@ -489,19 +511,20 @@ local function CreatePluginFrames (data)
end
end
end
else
--print ("nao tem target")
end
end
function ThreatMeter:TargetChanged()
if (not ThreatMeter.Actived) then
return
end
local NewTarget = _UnitName ("target")
if (NewTarget and not _UnitIsFriend ("player", "target")) then
local unitId = ThreatMeter:GetUnitId()
local NewTarget = _UnitName(unitId)
if (NewTarget and not _UnitIsFriend("player", unitId)) then
target = NewTarget
Threater()
else
@@ -634,6 +657,23 @@ local build_options_panel = function()
},
{type = "blank"},
{
type = "toggle",
get = function() return ThreatMeter.saveddata.usefocus end,
set = function (self, fixedparam, value) ThreatMeter.saveddata.usefocus = value end,
desc = "Show threat for the focus target if there's one.",
name = "Track Focus Target (if any)"
},
{
type = "toggle",
get = function() return ThreatMeter.saveddata.hide_pull_bar end,
set = function (self, fixedparam, value) ThreatMeter.saveddata.hide_pull_bar = value end,
desc = "Hide Pull Aggro Bar",
name = "Hide Pull Aggro Bar"
},
--[=[
{
type = "toggle",
@@ -716,6 +756,8 @@ function ThreatMeter:OnEvent (_, event, ...)
ThreatMeter.saveddata.useplayercolor = ThreatMeter.saveddata.useplayercolor or false
ThreatMeter.saveddata.playercolor = ThreatMeter.saveddata.playercolor or {1, 1, 1}
ThreatMeter.saveddata.useclasscolors = ThreatMeter.saveddata.useclasscolors or false
ThreatMeter.saveddata.usefocus = ThreatMeter.saveddata.usefocus or false
ThreatMeter.saveddata.hide_pull_bar = ThreatMeter.saveddata.hide_pull_bar or false
ThreatMeter.saveddata.playSound = ThreatMeter.saveddata.playSound or false
ThreatMeter.saveddata.playSoundFile = ThreatMeter.saveddata.playSoundFile or "Details Threat Warning Volume 3"