Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgdevx committed Jan 3, 2024
0 parents commit 6930915
Show file tree
Hide file tree
Showing 60 changed files with 14,547 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"Lua.diagnostics.globals": [
"SELECTED_CHAT_FRAME",
"DEFAULT_CHAT_FRAME",
"NORMAL_FONT_COLOR",
"GameFontNormal",
"GameFontHighlight",
"ACCEPT",
"CANCEL",
"Settings",
"InterfaceOptions_AddCategory",
"GameFontHighlightLarge",
"GameFontHighlightSmall",
"CLOSE",
"GameFontDisableSmall",
"GameFontNormalSmall",
"FONT_COLOR_CODE_CLOSE",
"SetDesaturation",
"ColorPickerFrame",
"OpacitySliderFrame",
"ChatFontNormal",
"OKAY",
"NOT_BOUND",
"InterfaceOptionsFrame_OpenToCategory",
"NORMAL_FONT_COLOR_CODE",
"LE_PARTY_CATEGORY_INSTANCE",
"LE_PARTY_CATEGORY_HOME"
]
}
79 changes: 79 additions & 0 deletions HealerInRange.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
local _, NS = ...

local Interface = NS.Interface

local LibStub = LibStub
local CreateFrame = CreateFrame
local IsInRaid = IsInRaid
local IsInGroup = IsInGroup

HIR = LibStub("AceAddon-3.0"):NewAddon("HIR", "AceEvent-3.0")

-- Range Checker
do
--- @class HealerInRangeFrame
--- @field inRange boolean|nil

--- @type HealerInRangeFrame|Frame|nil
local healerInRangeFrame = nil
local timeElapsed = 0

local function InRangeChecker(_, elapsed)
timeElapsed = timeElapsed + elapsed
if timeElapsed > 0.1 then
timeElapsed = 0

local inRange = NS.isHealerInRange()

if healerInRangeFrame and healerInRangeFrame.inRange ~= inRange then
healerInRangeFrame.inRange = inRange
Interface.inRange = inRange

NS.ToggleVisibility(inRange, HIR.db.global.reverse)
end
end
end

function HIR:CheckForHealerInRange()
local inRange = NS.isHealerInRange()

if not healerInRangeFrame then
healerInRangeFrame = CreateFrame("Frame")
--- @cast healerInRangeFrame HealerInRangeFrame
healerInRangeFrame.inRange = inRange
Interface.inRange = inRange
end

NS.ToggleVisibility(inRange, HIR.db.global.reverse)

if IsInRaid() or IsInGroup() then
healerInRangeFrame:SetScript("OnUpdate", InRangeChecker)
else
healerInRangeFrame:SetScript("OnUpdate", nil)
Interface.textFrame:Hide()
end
end

function HIR:GROUP_ROSTER_UPDATE()
self:CheckForHealerInRange()
end
end

function HIR:PLAYER_ENTERING_WORLD()
if IsInRaid() or IsInGroup() then
self:CheckForHealerInRange()
end

self:RegisterEvent("GROUP_ROSTER_UPDATE")
end

function HIR:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("HIRDB", NS.DefaultDatabase, true)
self:SetupOptions()
end

function HIR:OnEnable()
Interface:CreateInterface()

self:RegisterEvent("PLAYER_ENTERING_WORLD")
end
23 changes: 23 additions & 0 deletions HealerInRange.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Interface: 100200
## Title: HealerInRange
## Version: 1.0.0
## Author: Ajax
## Notes: Shows text if you're in range of a healer
## X-Flavor: Mainline
## X-Category: Battlegrounds/PvP
## X-Credits: Ajax
## X-License: All Rights Reserved
## X-Website: https://www.curseforge.com/wow/addons/healer-in-range
## IconTexture: Interface\AddOns\HealerInRange\logo.tga
## X-Curse-Project-ID: 957193
## X-Wago-ID:
## X-WoWI-ID:
## DefaultState: Enabled
## SavedVariables: HIRDB

embeds.xml
config.lua
helpers.lua
interface.lua
HealerInRange.lua
options.lua
Loading

0 comments on commit 6930915

Please sign in to comment.