mirror of
https://github.com/Bluewhale1337/HealBotBlue.git
synced 2026-07-27 09:44:44 +00:00
Refactoring monolithic code into separate implement MVC pattern for unit data management and event handling via observer pattern
This commit is contained in:
+1673
-1590
File diff suppressed because it is too large
Load Diff
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
## Interface: 11200
|
## Interface: 11200
|
||||||
## Title: HealBotBlue
|
## Title: HealBotBlue
|
||||||
## Version: 1.1
|
## Version: 1.2
|
||||||
## Author: Bluewhale
|
## Author: Bluewhale
|
||||||
## Notes: Adds panel with skinable bars for healing and decursive
|
## Notes: Adds panel with skinable bars for healing and decursive
|
||||||
## SavedVariables: HealBot_Config
|
## SavedVariables: HealBot_Config
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
..\..\FrameXML\UIPanelTemplates.xml
|
..\..\FrameXML\UIPanelTemplates.xml
|
||||||
..\..\FrameXML\UIDropDownMenu.xml
|
..\..\FrameXML\UIDropDownMenu.xml
|
||||||
HealBot_Error.xml
|
HealBot_Error.xml
|
||||||
|
HealBot_Model.lua
|
||||||
HealBot.xml
|
HealBot.xml
|
||||||
HealBot_Action.xml
|
HealBot_Action.xml
|
||||||
HealBot_Options.xml
|
HealBot_Options.xml
|
||||||
|
|||||||
+1303
-1222
File diff suppressed because it is too large
Load Diff
+41
-37
@@ -1,5 +1,6 @@
|
|||||||
HealBot_ConfigDefaults = {
|
HealBot_ConfigDefaults = {
|
||||||
ShowManaBars=0,
|
ShowManaBars=0,
|
||||||
|
ManaBarsHealersOnly=1,
|
||||||
Version = HEALBOT_VERSION,
|
Version = HEALBOT_VERSION,
|
||||||
AlertLevel = 0.95,
|
AlertLevel = 0.95,
|
||||||
AutoClose = 1,
|
AutoClose = 1,
|
||||||
@@ -173,43 +174,46 @@ HealBot_ConfigDefaults = {
|
|||||||
CDCRightText = {[HEALBOT_PRIEST]="None", [HEALBOT_SHAMAN]="None", [HEALBOT_DRUID]="None", [HEALBOT_PALADIN]="None",},
|
CDCRightText = {[HEALBOT_PRIEST]="None", [HEALBOT_SHAMAN]="None", [HEALBOT_DRUID]="None", [HEALBOT_PALADIN]="None",},
|
||||||
Current_Skin = HEALBOT_SKINS_STD,
|
Current_Skin = HEALBOT_SKINS_STD,
|
||||||
Skin_ID = 1,
|
Skin_ID = 1,
|
||||||
Skins = {HEALBOT_SKINS_STD, "HealBot Party", "HealBot Raid", "Alteric Valley"},
|
Skins = {HEALBOT_SKINS_STD, "HealBot Party", "HealBot Raid", "Alteric Valley", "Modern Flat"},
|
||||||
numcols = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 4, ["Alteric Valley"] = 2},
|
numcols = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 4, ["Alteric Valley"] = 2, ["Modern Flat"] = 1},
|
||||||
btexture = {[HEALBOT_SKINS_STD] = 8,["HealBot Party"] = 6, ["HealBot Raid"] = 7, ["Alteric Valley"] = 9},
|
btexture = {[HEALBOT_SKINS_STD] = 8,["HealBot Party"] = 6, ["HealBot Raid"] = 7, ["Alteric Valley"] = 9, ["Modern Flat"] = 10},
|
||||||
bcspace = {[HEALBOT_SKINS_STD] = 4, ["HealBot Party"] = 4, ["HealBot Raid"] = 2, ["Alteric Valley"] = 2},
|
bcspace = {[HEALBOT_SKINS_STD] = 4, ["HealBot Party"] = 4, ["HealBot Raid"] = 2, ["Alteric Valley"] = 2, ["Modern Flat"] = 4},
|
||||||
brspace = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 2, ["HealBot Raid"] = 2, ["Alteric Valley"] = 1},
|
brspace = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 2, ["HealBot Raid"] = 2, ["Alteric Valley"] = 1, ["Modern Flat"] = 2},
|
||||||
bwidth = {[HEALBOT_SKINS_STD] = 122, ["HealBot Party"] = 115, ["HealBot Raid"] = 90, ["Alteric Valley"] = 85},
|
bwidth = {[HEALBOT_SKINS_STD] = 122, ["HealBot Party"] = 115, ["HealBot Raid"] = 90, ["Alteric Valley"] = 85, ["Modern Flat"] = 122},
|
||||||
bheight = {[HEALBOT_SKINS_STD] = 19, ["HealBot Party"] = 18, ["HealBot Raid"] = 14, ["Alteric Valley"] = 16},
|
bheight = {[HEALBOT_SKINS_STD] = 19, ["HealBot Party"] = 18, ["HealBot Raid"] = 14, ["Alteric Valley"] = 16, ["Modern Flat"] = 20},
|
||||||
btextenabledcolr = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1},
|
btextenabledcolr = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1, ["Modern Flat"] = 1},
|
||||||
btextenabledcolg = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1},
|
btextenabledcolg = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1, ["Modern Flat"] = 1},
|
||||||
btextenabledcolb = {[HEALBOT_SKINS_STD] = 0, ["HealBot Party"] = 0, ["HealBot Raid"] = 0, ["Alteric Valley"] = 0},
|
btextenabledcolb = {[HEALBOT_SKINS_STD] = 0, ["HealBot Party"] = 0, ["HealBot Raid"] = 0, ["Alteric Valley"] = 0, ["Modern Flat"] = 1},
|
||||||
btextenabledcola = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1},
|
btextenabledcola = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1, ["Modern Flat"] = 1},
|
||||||
btextdisbledcolr = {[HEALBOT_SKINS_STD] = 0.5, ["HealBot Party"] = 0.5, ["HealBot Raid"] = 0.5, ["Alteric Valley"] = 0.4},
|
btextdisbledcolr = {[HEALBOT_SKINS_STD] = 0.5, ["HealBot Party"] = 0.5, ["HealBot Raid"] = 0.5, ["Alteric Valley"] = 0.4, ["Modern Flat"] = 0.5},
|
||||||
btextdisbledcolg = {[HEALBOT_SKINS_STD] = 0.5, ["HealBot Party"] = 0.5, ["HealBot Raid"] = 0.5, ["Alteric Valley"] = 0.4},
|
btextdisbledcolg = {[HEALBOT_SKINS_STD] = 0.5, ["HealBot Party"] = 0.5, ["HealBot Raid"] = 0.5, ["Alteric Valley"] = 0.4, ["Modern Flat"] = 0.5},
|
||||||
btextdisbledcolb = {[HEALBOT_SKINS_STD] = 0.5, ["HealBot Party"] = 0.5, ["HealBot Raid"] = 0.5, ["Alteric Valley"] = 0.4},
|
btextdisbledcolb = {[HEALBOT_SKINS_STD] = 0.5, ["HealBot Party"] = 0.5, ["HealBot Raid"] = 0.5, ["Alteric Valley"] = 0.4, ["Modern Flat"] = 0.5},
|
||||||
btextdisbledcola = {[HEALBOT_SKINS_STD] = 0.45, ["HealBot Party"] = 0.75, ["HealBot Raid"] = 0.75, ["Alteric Valley"] = 0},
|
btextdisbledcola = {[HEALBOT_SKINS_STD] = 0.45, ["HealBot Party"] = 0.75, ["HealBot Raid"] = 0.75, ["Alteric Valley"] = 0, ["Modern Flat"] = 0.8},
|
||||||
btextcursecolr = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1},
|
btextcursecolr = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1, ["Modern Flat"] = 1},
|
||||||
btextcursecolg = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1},
|
btextcursecolg = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1, ["Modern Flat"] = 1},
|
||||||
btextcursecolb = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1},
|
btextcursecolb = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1, ["Modern Flat"] = 1},
|
||||||
btextcursecola = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1},
|
btextcursecola = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1, ["Modern Flat"] = 1},
|
||||||
backcola = {[HEALBOT_SKINS_STD] = 0.05, ["HealBot Party"] = 0.25, ["HealBot Raid"] = 0.25, ["Alteric Valley"] = 0},
|
backcola = {[HEALBOT_SKINS_STD] = 0.05, ["HealBot Party"] = 0.25, ["HealBot Raid"] = 0.25, ["Alteric Valley"] = 0, ["Modern Flat"] = 0.8},
|
||||||
Barcola = {[HEALBOT_SKINS_STD] = 0.85, ["HealBot Party"] = 0.85, ["HealBot Raid"] = 0.85, ["Alteric Valley"] = 0.85},
|
Barcola = {[HEALBOT_SKINS_STD] = 0.85, ["HealBot Party"] = 0.85, ["HealBot Raid"] = 0.85, ["Alteric Valley"] = 0.85, ["Modern Flat"] = 1.0},
|
||||||
BarcolaInHeal = {[HEALBOT_SKINS_STD] = 0.40, ["HealBot Party"] = 0.35, ["HealBot Raid"] = 0.35, ["Alteric Valley"] = 0.5},
|
BarcolaInHeal = {[HEALBOT_SKINS_STD] = 0.40, ["HealBot Party"] = 0.35, ["HealBot Raid"] = 0.35, ["Alteric Valley"] = 0.5, ["Modern Flat"] = 0.6},
|
||||||
backcolr = {[HEALBOT_SKINS_STD] = 0.1, ["HealBot Party"] = 0.1, ["HealBot Raid"] = 0.1, ["Alteric Valley"] = 0.2},
|
backcolr = {[HEALBOT_SKINS_STD] = 0.1, ["HealBot Party"] = 0.1, ["HealBot Raid"] = 0.1, ["Alteric Valley"] = 0.2, ["Modern Flat"] = 0.1},
|
||||||
backcolg = {[HEALBOT_SKINS_STD] = 0.1, ["HealBot Party"] = 0.1, ["HealBot Raid"] = 0.1, ["Alteric Valley"] = 0.2},
|
backcolg = {[HEALBOT_SKINS_STD] = 0.1, ["HealBot Party"] = 0.1, ["HealBot Raid"] = 0.1, ["Alteric Valley"] = 0.2, ["Modern Flat"] = 0.1},
|
||||||
backcolb = {[HEALBOT_SKINS_STD] = 0.7, ["HealBot Party"] = 0.7, ["HealBot Raid"] = 0.7, ["Alteric Valley"] = 0.2},
|
backcolb = {[HEALBOT_SKINS_STD] = 0.7, ["HealBot Party"] = 0.7, ["HealBot Raid"] = 0.7, ["Alteric Valley"] = 0.2, ["Modern Flat"] = 0.1},
|
||||||
borcolr = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 0.2},
|
borcolr = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 0.2, ["Modern Flat"] = 0},
|
||||||
borcolg = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 0.2},
|
borcolg = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 0.2, ["Modern Flat"] = 0},
|
||||||
borcolb = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 0.2},
|
borcolb = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 0.2, ["Modern Flat"] = 0},
|
||||||
borcola = {[HEALBOT_SKINS_STD] = 0.25, ["HealBot Party"] = 0.8, ["HealBot Raid"] = 0.8, ["Alteric Valley"] = 0.1},
|
borcola = {[HEALBOT_SKINS_STD] = 0.25, ["HealBot Party"] = 0.8, ["HealBot Raid"] = 0.8, ["Alteric Valley"] = 0.1, ["Modern Flat"] = 1},
|
||||||
btextheight = {[HEALBOT_SKINS_STD] = 10, ["HealBot Party"] = 10, ["HealBot Raid"] = 9, ["Alteric Valley"] = 10},
|
btextheight = {[HEALBOT_SKINS_STD] = 10, ["HealBot Party"] = 10, ["HealBot Raid"] = 9, ["Alteric Valley"] = 10, ["Modern Flat"] = 11},
|
||||||
bardisa = {[HEALBOT_SKINS_STD] = 0.15, ["HealBot Party"] = 0.75, ["HealBot Raid"] = 0.75, ["Alteric Valley"] = 0},
|
bardisa = {[HEALBOT_SKINS_STD] = 0.15, ["HealBot Party"] = 0.75, ["HealBot Raid"] = 0.75, ["Alteric Valley"] = 0, ["Modern Flat"] = 0.3},
|
||||||
abortsize = {[HEALBOT_SKINS_STD] = 7, ["HealBot Party"] = 10, ["HealBot Raid"] = 5, ["Alteric Valley"] = 6},
|
abortsize = {[HEALBOT_SKINS_STD] = 7, ["HealBot Party"] = 10, ["HealBot Raid"] = 5, ["Alteric Valley"] = 6, ["Modern Flat"] = 8},
|
||||||
babortcolr = {[HEALBOT_SKINS_STD] = 0.1, ["HealBot Party"] = 0.1, ["HealBot Raid"] = 0.1, ["Alteric Valley"] = 0.2},
|
babortcolr = {[HEALBOT_SKINS_STD] = 0.1, ["HealBot Party"] = 0.1, ["HealBot Raid"] = 0.1, ["Alteric Valley"] = 0.2, ["Modern Flat"] = 0.1},
|
||||||
babortcolg = {[HEALBOT_SKINS_STD] = 0.1, ["HealBot Party"] = 0.1, ["HealBot Raid"] = 0.1, ["Alteric Valley"] = 0.2},
|
babortcolg = {[HEALBOT_SKINS_STD] = 0.1, ["HealBot Party"] = 0.1, ["HealBot Raid"] = 0.1, ["Alteric Valley"] = 0.2, ["Modern Flat"] = 0.1},
|
||||||
babortcolb = {[HEALBOT_SKINS_STD] = 0.5, ["HealBot Party"] = 0.5, ["HealBot Raid"] = 0.5, ["Alteric Valley"] = 0.6},
|
babortcolb = {[HEALBOT_SKINS_STD] = 0.5, ["HealBot Party"] = 0.5, ["HealBot Raid"] = 0.5, ["Alteric Valley"] = 0.6, ["Modern Flat"] = 0.5},
|
||||||
babortcola = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1},
|
babortcola = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1, ["Modern Flat"] = 1},
|
||||||
ShowHeader = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1},
|
ShowHeader = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1, ["Modern Flat"] = 1},
|
||||||
|
bcolormode = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1, ["Modern Flat"] = 2},
|
||||||
|
bborder = {[HEALBOT_SKINS_STD] = 2, ["HealBot Party"] = 2, ["HealBot Raid"] = 2, ["Alteric Valley"] = 2, ["Modern Flat"] = 1},
|
||||||
|
bfontoutline = {[HEALBOT_SKINS_STD] = 0, ["HealBot Party"] = 0, ["HealBot Raid"] = 0, ["Alteric Valley"] = 0, ["Modern Flat"] = 1},
|
||||||
Tooltip_ShowSpellDetail = 0,
|
Tooltip_ShowSpellDetail = 0,
|
||||||
Tooltip_ShowTarget = 1,
|
Tooltip_ShowTarget = 1,
|
||||||
Tooltip_Recommend = 1,
|
Tooltip_Recommend = 1,
|
||||||
|
|||||||
@@ -0,0 +1,220 @@
|
|||||||
|
-- HealBot_Model.lua
|
||||||
|
-- Centralized Data Store and Observer System for HealBotBlue
|
||||||
|
|
||||||
|
HealBot_Model = {
|
||||||
|
observers = {},
|
||||||
|
units = {},
|
||||||
|
|
||||||
|
-- Expose common lists for iteration
|
||||||
|
partyMembers = {},
|
||||||
|
raidMembers = {},
|
||||||
|
playerPet = nil,
|
||||||
|
target = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- Observer Pattern Implementation
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Supported Events:
|
||||||
|
-- "UNIT_HEALTH_CHANGED"
|
||||||
|
-- "UNIT_POWER_CHANGED"
|
||||||
|
-- "UNIT_AURA_CHANGED"
|
||||||
|
-- "UNIT_STATUS_CHANGED" (dead/ghost/offline)
|
||||||
|
-- "ROSTER_CHANGED"
|
||||||
|
-- "EQUIPMENT_CHANGED"
|
||||||
|
-- "INCOMING_HEAL_CHANGED"
|
||||||
|
|
||||||
|
function HealBot_Model:RegisterObserver(event, callback)
|
||||||
|
if not self.observers[event] then
|
||||||
|
self.observers[event] = {}
|
||||||
|
end
|
||||||
|
table.insert(self.observers[event], callback)
|
||||||
|
end
|
||||||
|
|
||||||
|
function HealBot_Model:NotifyObservers(event, unitID, ...)
|
||||||
|
if self.observers[event] then
|
||||||
|
local len = table.getn(self.observers[event])
|
||||||
|
for i = 1, len do
|
||||||
|
self.observers[event][i](unitID, unpack(arg))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- Model Initialization
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function HealBot_Model:Initialize()
|
||||||
|
self:InitUnitState("player")
|
||||||
|
self:InitUnitState("target")
|
||||||
|
self:InitUnitState("pet")
|
||||||
|
|
||||||
|
for i = 1, 4 do
|
||||||
|
self:InitUnitState("party"..i)
|
||||||
|
self:InitUnitState("partypet"..i)
|
||||||
|
table.insert(self.partyMembers, "party"..i)
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1, 40 do
|
||||||
|
self:InitUnitState("raid"..i)
|
||||||
|
self:InitUnitState("raidpet"..i)
|
||||||
|
table.insert(self.raidMembers, "raid"..i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function HealBot_Model:InitUnitState(unit)
|
||||||
|
if not self.units[unit] then
|
||||||
|
self.units[unit] = {
|
||||||
|
-- Base properties
|
||||||
|
name = nil,
|
||||||
|
class = nil,
|
||||||
|
englishClass = nil,
|
||||||
|
|
||||||
|
-- State tracking
|
||||||
|
health = 0,
|
||||||
|
maxHealth = 0,
|
||||||
|
mana = 0,
|
||||||
|
maxMana = 0,
|
||||||
|
powerType = 0,
|
||||||
|
|
||||||
|
-- Status tracking
|
||||||
|
isDead = false,
|
||||||
|
isGhost = false,
|
||||||
|
isConnected = true,
|
||||||
|
inRange = false,
|
||||||
|
|
||||||
|
-- Buffs/Debuffs (Auras)
|
||||||
|
debuffType = nil,
|
||||||
|
debuffTexture = nil,
|
||||||
|
missingBuff = false,
|
||||||
|
icons = {},
|
||||||
|
|
||||||
|
-- Integration
|
||||||
|
incomingHeal = 0
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- Model Updaters (Called by Controller)
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Updates base unit info (Name, Class)
|
||||||
|
function HealBot_Model:UpdateUnitIdentity(unit)
|
||||||
|
if not self.units[unit] then return false end
|
||||||
|
|
||||||
|
local oldName = self.units[unit].name
|
||||||
|
local name = UnitName(unit)
|
||||||
|
local _, englishClass = UnitClass(unit)
|
||||||
|
|
||||||
|
if oldName ~= name then
|
||||||
|
self.units[unit].name = name
|
||||||
|
self.units[unit].englishClass = englishClass
|
||||||
|
self.units[unit].class = UnitClass(unit)
|
||||||
|
return true -- Identity changed
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Updates health/maxHealth values. Returns true if changed.
|
||||||
|
function HealBot_Model:UpdateUnitHealth(unit)
|
||||||
|
if not self.units[unit] then return false end
|
||||||
|
|
||||||
|
local oldHealth = self.units[unit].health
|
||||||
|
local oldMax = self.units[unit].maxHealth
|
||||||
|
|
||||||
|
local currentHealth = UnitHealth(unit)
|
||||||
|
local maxHealth = UnitHealthMax(unit)
|
||||||
|
|
||||||
|
if oldHealth ~= currentHealth or oldMax ~= maxHealth then
|
||||||
|
self.units[unit].health = currentHealth
|
||||||
|
self.units[unit].maxHealth = maxHealth
|
||||||
|
return true -- Value changed
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Updates power values (mana, rage, energy). Returns true if changed.
|
||||||
|
function HealBot_Model:UpdateUnitPower(unit)
|
||||||
|
if not self.units[unit] then return false end
|
||||||
|
|
||||||
|
local oldMana = self.units[unit].mana
|
||||||
|
local oldMax = self.units[unit].maxMana
|
||||||
|
local oldType = self.units[unit].powerType
|
||||||
|
|
||||||
|
local currentMana = UnitMana(unit)
|
||||||
|
local maxMana = UnitManaMax(unit)
|
||||||
|
local powerType = UnitPowerType(unit)
|
||||||
|
|
||||||
|
if oldMana ~= currentMana or oldMax ~= maxMana or oldType ~= powerType then
|
||||||
|
self.units[unit].mana = currentMana
|
||||||
|
self.units[unit].maxMana = maxMana
|
||||||
|
self.units[unit].powerType = powerType
|
||||||
|
return true -- Value changed
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Updates status flags (Dead, Ghost, Offline). Returns true if changed.
|
||||||
|
function HealBot_Model:UpdateUnitStatus(unit)
|
||||||
|
if not self.units[unit] then return false end
|
||||||
|
|
||||||
|
local oldDead = self.units[unit].isDead
|
||||||
|
local oldGhost = self.units[unit].isGhost
|
||||||
|
local oldConn = self.units[unit].isConnected
|
||||||
|
|
||||||
|
local isDead = UnitIsDead(unit)
|
||||||
|
local isGhost = UnitIsGhost(unit)
|
||||||
|
local isConnected = UnitIsConnected(unit)
|
||||||
|
|
||||||
|
-- Note: Vanilla API for UnitIsConnected sometimes returns nil instead of false
|
||||||
|
if isConnected == nil then isConnected = false end
|
||||||
|
if isDead == nil then isDead = false end
|
||||||
|
if isGhost == nil then isGhost = false end
|
||||||
|
|
||||||
|
if oldDead ~= isDead or oldGhost ~= isGhost or oldConn ~= isConnected then
|
||||||
|
self.units[unit].isDead = isDead
|
||||||
|
self.units[unit].isGhost = isGhost
|
||||||
|
self.units[unit].isConnected = isConnected
|
||||||
|
return true -- Value changed
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Updates incoming heals. Returns true if changed.
|
||||||
|
function HealBot_Model:UpdateIncomingHeal(unit, amount)
|
||||||
|
if not self.units[unit] then return false end
|
||||||
|
|
||||||
|
if self.units[unit].incomingHeal ~= amount then
|
||||||
|
self.units[unit].incomingHeal = amount
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Manually mark auras as changed.
|
||||||
|
function HealBot_Model:MarkAuraChanged(unit)
|
||||||
|
-- We don't cache all auras in the model natively because it's too expensive
|
||||||
|
-- to poll every buff/debuff. The controller tells the model an aura changed,
|
||||||
|
-- and the view will resolve it if the unit is rendered.
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Force a full refresh of a unit's API data
|
||||||
|
function HealBot_Model:RefreshUnit(unit)
|
||||||
|
self:UpdateUnitIdentity(unit)
|
||||||
|
self:UpdateUnitHealth(unit)
|
||||||
|
self:UpdateUnitPower(unit)
|
||||||
|
self:UpdateUnitStatus(unit)
|
||||||
|
|
||||||
|
-- Force observers to render the initial state
|
||||||
|
self:NotifyObservers("UNIT_HEALTH_CHANGED", unit)
|
||||||
|
self:NotifyObservers("UNIT_POWER_CHANGED", unit)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Initialize the model state
|
||||||
|
HealBot_Model:Initialize()
|
||||||
+49
-6
@@ -294,12 +294,44 @@ function HealBot_SetSkinColours()
|
|||||||
HealBot_Config.babortcolb[HealBot_Config.Current_Skin],
|
HealBot_Config.babortcolb[HealBot_Config.Current_Skin],
|
||||||
HealBot_Config.babortcola[HealBot_Config.Current_Skin]);
|
HealBot_Config.babortcola[HealBot_Config.Current_Skin]);
|
||||||
|
|
||||||
-- removed SetBackdropColor
|
local borderStyle = HealBot_Config.bborder[HealBot_Config.Current_Skin] or 2
|
||||||
HealBot_Action:SetBackdropBorderColor(
|
if borderStyle == 0 then
|
||||||
HealBot_Config.borcolr[HealBot_Config.Current_Skin],
|
HealBot_Action:SetBackdropBorderColor(0,0,0,0);
|
||||||
HealBot_Config.borcolg[HealBot_Config.Current_Skin],
|
elseif borderStyle == 1 then
|
||||||
HealBot_Config.borcolb[HealBot_Config.Current_Skin],
|
HealBot_Action:SetBackdrop({
|
||||||
HealBot_Config.borcola[HealBot_Config.Current_Skin]);
|
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||||
|
edgeFile = "Interface\\Buttons\\WHITE8X8",
|
||||||
|
tile = true, tileSize = 8, edgeSize = 1,
|
||||||
|
insets = { left = 1, right = 1, top = 1, bottom = 1 }
|
||||||
|
})
|
||||||
|
HealBot_Action:SetBackdropColor(
|
||||||
|
HealBot_Config.backcolr[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.backcolg[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.backcolb[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.backcola[HealBot_Config.Current_Skin]);
|
||||||
|
HealBot_Action:SetBackdropBorderColor(
|
||||||
|
HealBot_Config.borcolr[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.borcolg[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.borcolb[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.borcola[HealBot_Config.Current_Skin]);
|
||||||
|
else
|
||||||
|
HealBot_Action:SetBackdrop({
|
||||||
|
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||||
|
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||||
|
tile = true, tileSize = 8, edgeSize = 16,
|
||||||
|
insets = { left = 4, right = 4, top = 4, bottom = 4 }
|
||||||
|
})
|
||||||
|
HealBot_Action:SetBackdropColor(
|
||||||
|
HealBot_Config.backcolr[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.backcolg[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.backcolb[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.backcola[HealBot_Config.Current_Skin]);
|
||||||
|
HealBot_Action:SetBackdropBorderColor(
|
||||||
|
HealBot_Config.borcolr[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.borcolg[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.borcolb[HealBot_Config.Current_Skin],
|
||||||
|
HealBot_Config.borcola[HealBot_Config.Current_Skin]);
|
||||||
|
end
|
||||||
|
|
||||||
HealBot_EnTextColorpickt:SetTextHeight(btextheight);
|
HealBot_EnTextColorpickt:SetTextHeight(btextheight);
|
||||||
HealBot_DisTextColorpickt:SetTextHeight(btextheight);
|
HealBot_DisTextColorpickt:SetTextHeight(btextheight);
|
||||||
@@ -1453,6 +1485,16 @@ function HealBot_Options_SetSkins()
|
|||||||
HealBot_Options_BarAlphaDis:SetValue(HealBot_Config.bardisa[HealBot_Config.Current_Skin])
|
HealBot_Options_BarAlphaDis:SetValue(HealBot_Config.bardisa[HealBot_Config.Current_Skin])
|
||||||
HealBot_Options_AbortBarSize:SetValue(HealBot_Config.abortsize[HealBot_Config.Current_Skin])
|
HealBot_Options_AbortBarSize:SetValue(HealBot_Config.abortsize[HealBot_Config.Current_Skin])
|
||||||
HealBot_Options_ShowHeaders:SetChecked(HealBot_Config.ShowHeader[HealBot_Config.Current_Skin] or 0)
|
HealBot_Options_ShowHeaders:SetChecked(HealBot_Config.ShowHeader[HealBot_Config.Current_Skin] or 0)
|
||||||
|
|
||||||
|
local isColorMode = (HealBot_Config.bcolormode[HealBot_Config.Current_Skin] == 2)
|
||||||
|
HealBot_Options_BarColorMode:SetChecked(isColorMode and 1 or nil)
|
||||||
|
|
||||||
|
local isFontOutline = (HealBot_Config.bfontoutline[HealBot_Config.Current_Skin] == 1)
|
||||||
|
HealBot_Options_FontOutline:SetChecked(isFontOutline and 1 or nil)
|
||||||
|
|
||||||
|
local is1pxBorder = (HealBot_Config.bborder[HealBot_Config.Current_Skin] == 1)
|
||||||
|
HealBot_Options_1pxBorders:SetChecked(is1pxBorder and 1 or nil)
|
||||||
|
|
||||||
HealBot_SetSkinColours()
|
HealBot_SetSkinColours()
|
||||||
if HealBot_Config.Current_Skin==HEALBOT_SKINS_STD then
|
if HealBot_Config.Current_Skin==HEALBOT_SKINS_STD then
|
||||||
HealBot_Options_DeleteSkin:Disable();
|
HealBot_Options_DeleteSkin:Disable();
|
||||||
@@ -1710,3 +1752,4 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+23
-1
@@ -1591,6 +1591,27 @@
|
|||||||
<OnLoad>HealBot_Options_ShowHeaders_OnLoad(this,HEALBOT_OPTIONS_SHOWHEADERS)</OnLoad>
|
<OnLoad>HealBot_Options_ShowHeaders_OnLoad(this,HEALBOT_OPTIONS_SHOWHEADERS)</OnLoad>
|
||||||
<OnClick>HealBot_Options_ShowHeaders_OnClick(this)</OnClick>
|
<OnClick>HealBot_Options_ShowHeaders_OnClick(this)</OnClick>
|
||||||
</Scripts>
|
</Scripts>
|
||||||
|
</CheckButton>
|
||||||
|
<CheckButton name="HealBot_Options_BarColorMode" inherits="SendMailRadioButtonTemplate">
|
||||||
|
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="290" y="-8" /></Offset></Anchor></Anchors>
|
||||||
|
<Scripts>
|
||||||
|
<OnLoad>getglobal(this:GetName().."Text"):SetText("Class Colors")</OnLoad>
|
||||||
|
<OnClick>HealBot_Config.bcolormode[HealBot_Config.Current_Skin] = (this:GetChecked() and 2 or 1); HealBot_Action_ResetSkin()</OnClick>
|
||||||
|
</Scripts>
|
||||||
|
</CheckButton>
|
||||||
|
<CheckButton name="HealBot_Options_FontOutline" inherits="SendMailRadioButtonTemplate">
|
||||||
|
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="290" y="-33" /></Offset></Anchor></Anchors>
|
||||||
|
<Scripts>
|
||||||
|
<OnLoad>getglobal(this:GetName().."Text"):SetText("Font Outline")</OnLoad>
|
||||||
|
<OnClick>HealBot_Config.bfontoutline[HealBot_Config.Current_Skin] = (this:GetChecked() and 1 or 0); HealBot_Action_ResetSkin()</OnClick>
|
||||||
|
</Scripts>
|
||||||
|
</CheckButton>
|
||||||
|
<CheckButton name="HealBot_Options_1pxBorders" inherits="SendMailRadioButtonTemplate">
|
||||||
|
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="290" y="-58" /></Offset></Anchor></Anchors>
|
||||||
|
<Scripts>
|
||||||
|
<OnLoad>getglobal(this:GetName().."Text"):SetText("1px Borders")</OnLoad>
|
||||||
|
<OnClick>HealBot_Config.bborder[HealBot_Config.Current_Skin] = (this:GetChecked() and 1 or 2); HealBot_Action_ResetSkin()</OnClick>
|
||||||
|
</Scripts>
|
||||||
</CheckButton>
|
</CheckButton>
|
||||||
|
|
||||||
<Slider name="HealBot_Options_BarTextureS" inherits="HealBot_Options_SliderTemplate">
|
<Slider name="HealBot_Options_BarTextureS" inherits="HealBot_Options_SliderTemplate">
|
||||||
@@ -1637,7 +1658,7 @@
|
|||||||
</Anchor>
|
</Anchor>
|
||||||
</Anchors>
|
</Anchors>
|
||||||
<Scripts>
|
<Scripts>
|
||||||
<OnLoad>HealBot_Options_val_OnLoad(this,HEALBOT_OPTIONS_SKINHEIGHT,10,25)</OnLoad>
|
<OnLoad>HealBot_Options_val_OnLoad(this,HEALBOT_OPTIONS_SKINHEIGHT,10,100)</OnLoad>
|
||||||
<OnValueChanged>HealBot_Options_BarHeightS_OnValueChanged(this)</OnValueChanged>
|
<OnValueChanged>HealBot_Options_BarHeightS_OnValueChanged(this)</OnValueChanged>
|
||||||
</Scripts>
|
</Scripts>
|
||||||
</Slider>
|
</Slider>
|
||||||
@@ -2780,3 +2801,4 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ Default installation path: `C:\Program Files\World of Warcraft\Interface\AddOns\
|
|||||||
|
|
||||||
### Change Log
|
### Change Log
|
||||||
|
|
||||||
|
**v1.2**
|
||||||
|
* **Class Colors & Dimming:** Frame text now inherits class colors with black outline for better visibility. Missing buffs intelligently dim the class color and turn the text yellow.
|
||||||
|
* **Modern Skin Updates:** Fixed white background bugs in modern skins and brightened debuff indicators.
|
||||||
|
* **Bug Fix (Buff Application):** Fixed a Vanilla WoW API bug where applying buffs to a target without having them explicitly selected would trigger auto-self-cast instead.
|
||||||
|
* **Bug Fix (Health Block):** Fixed a bug where the "Always Heal" option (preventing heals on full HP targets) completely blocked the ability to click frames to apply missing buffs.
|
||||||
|
|
||||||
**v1.1**
|
**v1.1**
|
||||||
* **Native Hovercasting:** Added a native Action Bar Hovercasting (Mouseover) engine. You can now cast spells on hovered targets using action bar keybinds without losing your current target. Togglable in Options -> General.
|
* **Native Hovercasting:** Added a native Action Bar Hovercasting (Mouseover) engine. You can now cast spells on hovered targets using action bar keybinds without losing your current target. Togglable in Options -> General.
|
||||||
* **Fear Ward Tracking:** Added Fear Ward to the global HoT tracker, which will display the icon directly on the unit frame.
|
* **Fear Ward Tracking:** Added Fear Ward to the global HoT tracker, which will display the icon directly on the unit frame.
|
||||||
|
|||||||
Reference in New Issue
Block a user