Skip to content

Commit

Permalink
adding new show outside option
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgdevx committed Dec 20, 2024
1 parent df18837 commit dba892d
Show file tree
Hide file tree
Showing 5 changed files with 217 additions and 62 deletions.
49 changes: 39 additions & 10 deletions HealerInRange.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local _, NS = ...
local Interface = NS.Interface

local CreateFrame = CreateFrame
local IsInInstance = IsInInstance

---@type HIR
local HIR = NS.HIR
Expand Down Expand Up @@ -95,25 +96,53 @@ local DEAD_EVENTS = {
function HIR:PLAYER_ENTERING_WORLD()
FrameUtil.RegisterFrameForEvents(HIRFrame, DEAD_EVENTS)

if NS.isInGroup() then
if NS.isDead() then
Interface.textFrame:SetAlpha(0)
else
if NS.db.global.healer then
if NS.isHealer("player") then
Interface.textFrame:SetAlpha(0)
if IsInInstance() then
if NS.isInGroup() then
if NS.isDead() then
Interface.textFrame:SetAlpha(0)
else
if NS.db.global.healer then
if NS.isHealer("player") then
Interface.textFrame:SetAlpha(0)
else
if NS.noHealersInGroup() then
Interface.textFrame:SetAlpha(0)
else
Interface.textFrame:SetAlpha(1)
end
end
else
if NS.noHealersInGroup() then
Interface.textFrame:SetAlpha(0)
else
Interface.textFrame:SetAlpha(1)
end
end
else
if NS.noHealersInGroup() then
end
end
else
if NS.db.global.showOutside then
if NS.isInGroup() then
if NS.isDead() then
Interface.textFrame:SetAlpha(0)
else
Interface.textFrame:SetAlpha(1)
if NS.db.global.healer then
if NS.isHealer("player") then
Interface.textFrame:SetAlpha(0)
else
if NS.noHealersInGroup() then
Interface.textFrame:SetAlpha(0)
else
Interface.textFrame:SetAlpha(1)
end
end
else
if NS.noHealersInGroup() then
Interface.textFrame:SetAlpha(0)
else
Interface.textFrame:SetAlpha(1)
end
end
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ local CreateFrame = CreateFrame
---@field test boolean
---@field reverse boolean
---@field healer boolean
---@field showOutside boolean
---@field fontsize number
---@field font string
---@field color ColorArray
Expand Down Expand Up @@ -58,6 +59,7 @@ NS.DefaultDatabase = {
test = true,
reverse = false,
healer = true,
showOutside = false,
fontsize = 30,
font = "Friz Quadrata TT",
color = {
Expand Down
36 changes: 28 additions & 8 deletions helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ local type = type
local next = next
local setmetatable = setmetatable
local getmetatable = getmetatable
local print = print
local IsInInstance = IsInInstance

local wipe = table.wipe
local sformat = string.format
Expand Down Expand Up @@ -94,17 +96,35 @@ NS.UpdateFont = function(frame)
end

NS.ToggleVisibility = function(inRange, reverse)
if inRange then
if reverse then
NS.Interface:ShowText(false)
if IsInInstance() then
if inRange then
if reverse then
NS.Interface:ShowText(false)
else
NS.Interface:ShowText(true)
end
else
NS.Interface:ShowText(true)
if reverse then
NS.Interface:ShowText(true)
else
NS.Interface:ShowText(false)
end
end
else
if reverse then
NS.Interface:ShowText(true)
else
NS.Interface:ShowText(false)
if NS.db.global.showOutside then
if inRange then
if reverse then
NS.Interface:ShowText(false)
else
NS.Interface:ShowText(true)
end
else
if reverse then
NS.Interface:ShowText(true)
else
NS.Interface:ShowText(false)
end
end
end
end
end
Expand Down
144 changes: 119 additions & 25 deletions interface.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local AddonName, NS = ...

local CreateFrame = CreateFrame
local LibStub = LibStub
local IsInInstance = IsInInstance

local AceConfigDialog = LibStub("AceConfigDialog-3.0")

Expand Down Expand Up @@ -96,33 +97,75 @@ function Interface:CreateInterface()
TextFrame:SetWidth(Text:GetStringWidth())
TextFrame:SetHeight(Text:GetStringHeight())

if NS.isInGroup() then
if NS.isDead() then
TextFrame:Hide()
else
if NS.db.global.healer then
if NS.isHealer("player") then
TextFrame:Hide()
if IsInInstance() then
if NS.isInGroup() then
if NS.isDead() then
TextFrame:Hide()
else
if NS.db.global.healer then
if NS.isHealer("player") then
TextFrame:Hide()
else
if NS.noHealersInGroup() then
TextFrame:Hide()
else
TextFrame:Show()
end
end
else
if NS.noHealersInGroup() then
TextFrame:Hide()
else
TextFrame:Show()
end
end
end
else
if NS.db.global.test then
TextFrame:Show()
else
if NS.noHealersInGroup() then
TextFrame:Hide()
else
TextFrame:Show()
end
TextFrame:Hide()
end
end
else
if NS.db.global.test then
TextFrame:Show()
else
TextFrame:Hide()
if NS.db.global.test then
TextFrame:Show()
else
if NS.db.global.showOutside then
if NS.isInGroup() then
if NS.isDead() then
TextFrame:Hide()
else
if NS.db.global.healer then
if NS.isHealer("player") then
TextFrame:Hide()
else
if NS.noHealersInGroup() then
TextFrame:Hide()
else
TextFrame:Show()
end
end
else
if NS.noHealersInGroup() then
TextFrame:Hide()
else
TextFrame:Show()
end
end
end
else
if NS.db.global.test then
TextFrame:Show()
else
TextFrame:Hide()
end
end
end
end
end
end
end
Expand All @@ -132,37 +175,88 @@ function Interface:ShowText(value)
if NS.isInGroup() then
if value then
Interface.textFrame:Show()
if IsInInstance() then
if NS.isInGroup() then
if value then
Interface.textFrame:Show()

if NS.isDead() then
Interface.textFrame:SetAlpha(0)
else
if NS.db.global.healer then
if NS.isHealer("player") then
Interface.textFrame:SetAlpha(0)
if NS.isDead() then
Interface.textFrame:SetAlpha(0)
else
if NS.db.global.healer then
if NS.isHealer("player") then
Interface.textFrame:SetAlpha(0)
else
if NS.noHealersInGroup() then
Interface.textFrame:SetAlpha(0)
else
Interface.textFrame:SetAlpha(1)
end
end
else
if NS.noHealersInGroup() then
Interface.textFrame:SetAlpha(0)
else
Interface.textFrame:SetAlpha(1)
end
end
else
if NS.noHealersInGroup() then
Interface.textFrame:SetAlpha(0)
else
Interface.textFrame:SetAlpha(1)
end
end
else
Interface.textFrame:Hide()
end
else
Interface.textFrame:Hide()
if NS.db.global.test then
Interface.textFrame:Show()
Interface.textFrame:SetAlpha(1)
else
Interface.textFrame:Hide()
end
end
else
if NS.db.global.test then
Interface.textFrame:Show()
Interface.textFrame:SetAlpha(1)
else
Interface.textFrame:Hide()
if NS.db.global.showOutside then
if NS.isInGroup() then
if value then
Interface.textFrame:Show()

if NS.isDead() then
Interface.textFrame:SetAlpha(0)
else
if NS.db.global.healer then
if NS.isHealer("player") then
Interface.textFrame:SetAlpha(0)
else
if NS.noHealersInGroup() then
Interface.textFrame:SetAlpha(0)
else
Interface.textFrame:SetAlpha(1)
end
end
else
if NS.noHealersInGroup() then
Interface.textFrame:SetAlpha(0)
else
Interface.textFrame:SetAlpha(1)
end
end
end
else
Interface.textFrame:Hide()
end
else
if NS.db.global.test then
Interface.textFrame:Show()
Interface.textFrame:SetAlpha(1)
else
Interface.textFrame:Hide()
end
end
end
end
end
end
Loading

0 comments on commit dba892d

Please sign in to comment.