Skip to content

Commit

Permalink
updating with new features and latest support
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgdevx committed Sep 6, 2024
1 parent 714c954 commit 205c936
Show file tree
Hide file tree
Showing 29 changed files with 718 additions and 2,364 deletions.
19 changes: 17 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@
"LE_PARTY_CATEGORY_INSTANCE",
"LE_PARTY_CATEGORY_HOME",
"SlashCmdList",
"hash_SlashCmdList"
]
"hash_SlashCmdList",
"ButtonFrameTemplate_HidePortrait",
"FrameUtil"
],
"Lua.runtime.version": "Lua 5.1",
"Lua.runtime.builtin": {
"basic": "disable",
"debug": "disable",
"io": "disable",
"math": "disable",
"os": "disable",
"package": "disable",
"string": "disable",
"table": "disable",
"utf8": "disable"
},
"Lua.workspace.library": ["~\\.vscode\\extensions\\ketho.wow-api-0.17.6\\Annotations"]
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Healer In Range

## [v1.1.0](https://github.com/rbgdevx/healer-in-range/releases/tag/v1.1.0) (2024-09-06)

- Refactor lib usage to match what im doing on BGWC addon to reduce needed libs and global db issues
- Made it so you can't open the settings when locked and right clicking the text
- Minor random changes based on learning from BGWC

## [v1.0.6](https://github.com/rbgdevx/healer-in-range/releases/tag/v1.0.6) (2024-05-08)

- update toc
Expand Down
70 changes: 51 additions & 19 deletions HealerInRange.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
local AddonName, NS = ...
local _, NS = ...

local Interface = NS.Interface

local LibStub = LibStub
local CreateFrame = CreateFrame

HIR = LibStub("AceAddon-3.0"):NewAddon("HIR", "AceEvent-3.0", "AceConsole-3.0")
---@type HIR
local HIR = NS.HIR
local HIRFrame = NS.HIR.frame

-- Range Checker
do
--- @class HealerInRangeFrame
--- @field inRange boolean|nil
--- @field SetScript fun(scriptType: string, handler: function|nil)

--- @type HealerInRangeFrame|Frame|nil
local healerInRangeFrame = nil
Expand All @@ -27,7 +29,7 @@ do
healerInRangeFrame.inRange = inRange
Interface.inRange = inRange

NS.ToggleVisibility(inRange, HIR.db.global.reverse)
NS.ToggleVisibility(inRange, NS.db.global.reverse)
end
end
end
Expand All @@ -42,13 +44,21 @@ do
Interface.inRange = inRange
end

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

if NS.isInGroup() then
---@type HealerInRangeFrame
healerInRangeFrame:SetScript("OnUpdate", InRangeChecker)
else
---@type HealerInRangeFrame
healerInRangeFrame:SetScript("OnUpdate", nil)
Interface.textFrame:Hide()

if NS.db.global.test then
Interface.textFrame:Show()
Interface.textFrame:SetAlpha(1)
else
Interface.textFrame:Hide()
end
end
end

Expand All @@ -57,26 +67,48 @@ do
end
end

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

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

local DEAD_EVENTS = {
"PLAYER_DEAD",
"PLAYER_UNGHOST",
}

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)
else
Interface.textFrame:SetAlpha(1)
end
else
Interface.textFrame:SetAlpha(1)
end
end

self:CheckForHealerInRange()
end

self:RegisterEvent("GROUP_ROSTER_UPDATE")
HIRFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
end

function HIR:SlashCommands(_)
LibStub("AceConfigDialog-3.0"):Open(AddonName)
end

function HIR:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("HIRDB", NS.DefaultDatabase, true)
self:SetupOptions()
self:RegisterChatCommand(AddonName, "SlashCommands")
self:RegisterChatCommand("hir", "SlashCommands")
end
function HIR:PLAYER_LOGIN()
HIRFrame:UnregisterEvent("PLAYER_LOGIN")

function HIR:OnEnable()
Interface:CreateInterface()
self:RegisterEvent("PLAYER_ENTERING_WORLD")

HIRFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
end
HIRFrame:RegisterEvent("PLAYER_LOGIN")
7 changes: 3 additions & 4 deletions HealerInRange.toc
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
## Interface: 100207
## Interface: 110002
## Title: HealerInRange
## Version: 1.0.6
## Author: Ajax
## Version: 1.1.0
## Author: RBGDEV
## Notes: Shows text if you're in or out of range of a healer
## OptionalDeps: Ace3, LibStub, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets
## IconTexture: Interface\AddOns\HealerInRange\logo.tga
## DefaultState: Enabled
## SavedVariables: HIRDB
## X-Category: Battlegrounds/PvP
## X-Credits: Ajax
Expand Down
Loading

0 comments on commit 205c936

Please sign in to comment.