Skip to content

Commit

Permalink
Tiny Threat (plugin): added options to Hide the Pull Bar and Use Focu…
Browse files Browse the repository at this point in the history
…s Target.
  • Loading branch information
Tercioo committed Aug 11, 2021
1 parent b4b6b64 commit 70483cd
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 16 deletions.
15 changes: 12 additions & 3 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.",
Expand Down Expand Up @@ -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
Expand Down
68 changes: 55 additions & 13 deletions plugins/Details_TinyThreat/Details_TinyThreat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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]

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 70483cd

Please sign in to comment.