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:
+138
-55
@@ -444,10 +444,10 @@ function HealBot_CastSpellOnFriend(spell,target)
|
||||
end
|
||||
if (UnitCanAttack("player","target")) then
|
||||
old = "enemy";
|
||||
else
|
||||
else
|
||||
old = UnitName("target");
|
||||
if UnitName("target")~=UnitName(target) then
|
||||
ClearTarget();
|
||||
TargetUnit(target);
|
||||
else
|
||||
ttype="direct";
|
||||
end
|
||||
@@ -695,14 +695,37 @@ function HealBot_OnLoad(this)
|
||||
HealBot_SlashCmd(msg);
|
||||
end
|
||||
HealBot_AddError(HEALBOT_ADDON .. HEALBOT_LOADED);
|
||||
|
||||
-- Register MVC Observers
|
||||
HealBot_Model:RegisterObserver("UNIT_HEALTH_CHANGED", function(unitID)
|
||||
HealBot_View_DirtyUnits[unitID] = true
|
||||
end)
|
||||
HealBot_Model:RegisterObserver("UNIT_POWER_CHANGED", function(unitID)
|
||||
HealBot_View_DirtyUnits[unitID] = true
|
||||
end)
|
||||
HealBot_Model:RegisterObserver("UNIT_AURA_CHANGED", function(unitID)
|
||||
HealBot_View_DirtyUnits[unitID] = true
|
||||
end)
|
||||
HealBot_Model:RegisterObserver("ROSTER_CHANGED", function()
|
||||
Delay_RecalcParty = 1
|
||||
end)
|
||||
end
|
||||
|
||||
function HealBot_RegisterThis(this)
|
||||
|
||||
end
|
||||
|
||||
HealBot_View_DirtyUnits = {}
|
||||
local HealBot_Timer1,HealsIn_Timer = 0,0;
|
||||
function HealBot_OnUpdate(this,arg1)
|
||||
-- Process Dirty Queue for MVC View
|
||||
if next(HealBot_View_DirtyUnits) ~= nil then
|
||||
for unitID in pairs(HealBot_View_DirtyUnits) do
|
||||
HealBot_Action_RefreshButtons(unitID)
|
||||
HealBot_View_DirtyUnits[unitID] = nil
|
||||
end
|
||||
end
|
||||
|
||||
HealBot_Timer1 = HealBot_Timer1+arg1;
|
||||
if HealBot_Timer1>=2.5 then
|
||||
if not HealBot_IsFighting then
|
||||
@@ -761,62 +784,104 @@ function HealBot_OnUpdate(this,arg1)
|
||||
end
|
||||
end
|
||||
|
||||
function HealBot_OnEvent(this, event, arg1,arg2,arg3,arg4)
|
||||
if (event=="CHAT_MSG_ADDON") then
|
||||
HealBot_OnEvent_AddonMsg(this,arg1,arg2,arg3,arg4);
|
||||
elseif (event=="UNIT_HEALTH") then
|
||||
HealBot_OnEvent_UnitHealth(this,arg1);
|
||||
elseif (event=="UNIT_MANA" or event=="UNIT_RAGE" or event=="UNIT_ENERGY" or event=="UNIT_DISPLAYPOWER") then
|
||||
--------------------------------------------------------------------------------
|
||||
-- MVC Controller Layer
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local HealBot_EventHandlers = {
|
||||
["UNIT_HEALTH"] = function(this, arg1)
|
||||
if HealBot_Model:UpdateUnitHealth(arg1) then
|
||||
HealBot_Model:NotifyObservers("UNIT_HEALTH_CHANGED", arg1)
|
||||
end
|
||||
HealBot_OnEvent_UnitHealth(this, arg1)
|
||||
end,
|
||||
["UNIT_MANA"] = function(this, arg1)
|
||||
if HealBot_Model:UpdateUnitPower(arg1) then
|
||||
HealBot_Model:NotifyObservers("UNIT_POWER_CHANGED", arg1)
|
||||
end
|
||||
if (arg1=="player") then HealBot_RecalcHeals(); end
|
||||
HealBot_Action_RefreshButtons(arg1);
|
||||
elseif (event=="UNIT_AURA") then
|
||||
HealBot_OnEvent_UnitAura(this,arg1);
|
||||
elseif (event=="SPELLCAST_START") then
|
||||
HealBot_OnEvent_SpellcastStart(this,arg1,arg2);
|
||||
elseif (event=="SPELLCAST_STOP") then
|
||||
HealBot_OnEvent_SpellcastStop(this);
|
||||
elseif (event=="SPELLCAST_INTERRUPTED") then
|
||||
HealBot_OnEvent_SpellcastStop(this);
|
||||
elseif (event=="SPELLCAST_FAILED") then
|
||||
HealBot_OnEvent_SpellcastStop(this);
|
||||
elseif (event=="PLAYER_REGEN_DISABLED") then
|
||||
HealBot_OnEvent_PlayerRegenDisabled(this);
|
||||
elseif (event=="PLAYER_REGEN_ENABLED") then
|
||||
HealBot_OnEvent_PlayerRegenEnabled(this);
|
||||
elseif (event=="BAG_UPDATE_COOLDOWN") then
|
||||
HealBot_OnEvent_BagUpdateCooldown(this,arg1);
|
||||
elseif (event=="BAG_UPDATE") then
|
||||
HealBot_OnEvent_BagUpdate(this,arg1);
|
||||
elseif (event=="PARTY_MEMBER_DISABLE") then
|
||||
HealBot_OnEvent_PartyMemberDisable(this,arg1);
|
||||
elseif (event=="PARTY_MEMBER_ENABLE") then
|
||||
HealBot_OnEvent_PartyMemberEnable(this,arg1);
|
||||
elseif (event=="CHAT_MSG_SYSTEM") then
|
||||
HealBot_OnEvent_SystemMsg(this,arg1);
|
||||
elseif (event=="PARTY_MEMBERS_CHANGED") then
|
||||
HealBot_OnEvent_PartyMembersChanged(this);
|
||||
elseif (event=="PLAYER_TARGET_CHANGED") then
|
||||
HealBot_OnEvent_PlayerTargetChanged(this);
|
||||
elseif (event=="ZONE_CHANGED_NEW_AREA") then
|
||||
HealBot_OnEvent_ZoneChanged(this);
|
||||
elseif (event=="UPDATE_INVENTORY_ALERTS") then
|
||||
HealBot_OnEvent_PlayerEquipmentChanged(this);
|
||||
elseif (event=="UNIT_INVENTORY_CHANGED") then
|
||||
HealBot_OnEvent_PlayerEquipmentChanged2(this,arg1);
|
||||
elseif (event=="PET_BAR_SHOWGRID") then
|
||||
HealBot_OnEvent_PartyMembersChanged(this);
|
||||
elseif (event=="PET_BAR_HIDEGRID") then
|
||||
HealBot_OnEvent_PartyMembersChanged(this);
|
||||
elseif (event=="SPELLS_CHANGED") then
|
||||
HealBot_OnEvent_SpellsChanged(this,arg1);
|
||||
elseif (event=="PLAYER_ENTERING_WORLD") then
|
||||
HealBot_OnEvent_PlayerEnteringWorld(this);
|
||||
-- elseif (event=="CHARACTER_POINTS_CHANGED") then
|
||||
-- HealBot_OnEvent_TalentsChanged(this, arg1);
|
||||
elseif (event=="VARIABLES_LOADED") then
|
||||
HealBot_OnEvent_VariablesLoaded(this);
|
||||
end,
|
||||
["UNIT_RAGE"] = function(this, arg1)
|
||||
if HealBot_Model:UpdateUnitPower(arg1) then
|
||||
HealBot_Model:NotifyObservers("UNIT_POWER_CHANGED", arg1)
|
||||
end
|
||||
if (arg1=="player") then HealBot_RecalcHeals(); end
|
||||
HealBot_Action_RefreshButtons(arg1);
|
||||
end,
|
||||
["UNIT_ENERGY"] = function(this, arg1)
|
||||
if HealBot_Model:UpdateUnitPower(arg1) then
|
||||
HealBot_Model:NotifyObservers("UNIT_POWER_CHANGED", arg1)
|
||||
end
|
||||
if (arg1=="player") then HealBot_RecalcHeals(); end
|
||||
HealBot_Action_RefreshButtons(arg1);
|
||||
end,
|
||||
["UNIT_DISPLAYPOWER"] = function(this, arg1)
|
||||
if HealBot_Model:UpdateUnitPower(arg1) then
|
||||
HealBot_Model:NotifyObservers("UNIT_POWER_CHANGED", arg1)
|
||||
end
|
||||
if (arg1=="player") then HealBot_RecalcHeals(); end
|
||||
HealBot_Action_RefreshButtons(arg1);
|
||||
end,
|
||||
["UNIT_AURA"] = function(this, arg1)
|
||||
HealBot_Model:MarkAuraChanged(arg1)
|
||||
HealBot_Model:NotifyObservers("UNIT_AURA_CHANGED", arg1)
|
||||
HealBot_OnEvent_UnitAura(this, arg1)
|
||||
end,
|
||||
["PLAYER_TARGET_CHANGED"] = function(this)
|
||||
if HealBot_Model:UpdateUnitIdentity("target") then
|
||||
HealBot_Model:NotifyObservers("ROSTER_CHANGED", "target")
|
||||
end
|
||||
HealBot_Model:UpdateUnitStatus("target")
|
||||
HealBot_Model:UpdateUnitHealth("target")
|
||||
HealBot_Model:UpdateUnitPower("target")
|
||||
HealBot_OnEvent_PlayerTargetChanged(this)
|
||||
end,
|
||||
["PARTY_MEMBERS_CHANGED"] = function(this)
|
||||
for _, unit in ipairs(HealBot_Model.partyMembers) do
|
||||
HealBot_Model:RefreshUnit(unit)
|
||||
end
|
||||
for _, unit in ipairs(HealBot_Model.raidMembers) do
|
||||
HealBot_Model:RefreshUnit(unit)
|
||||
end
|
||||
HealBot_Model:NotifyObservers("ROSTER_CHANGED")
|
||||
HealBot_OnEvent_PartyMembersChanged(this)
|
||||
end,
|
||||
["PLAYER_ENTERING_WORLD"] = function(this)
|
||||
HealBot_Model:RefreshUnit("player")
|
||||
HealBot_Model:RefreshUnit("pet")
|
||||
HealBot_OnEvent_PlayerEnteringWorld(this)
|
||||
end,
|
||||
["VARIABLES_LOADED"] = function(this)
|
||||
HealBot_OnEvent_VariablesLoaded(this)
|
||||
end,
|
||||
-- Legacy pass-throughs
|
||||
["CHAT_MSG_ADDON"] = function(this, arg1,arg2,arg3,arg4) HealBot_OnEvent_AddonMsg(this,arg1,arg2,arg3,arg4) end,
|
||||
["SPELLCAST_START"] = function(this, arg1,arg2) HealBot_OnEvent_SpellcastStart(this,arg1,arg2) end,
|
||||
["SPELLCAST_STOP"] = function(this) HealBot_OnEvent_SpellcastStop(this) end,
|
||||
["SPELLCAST_INTERRUPTED"] = function(this) HealBot_OnEvent_SpellcastStop(this) end,
|
||||
["SPELLCAST_FAILED"] = function(this) HealBot_OnEvent_SpellcastStop(this) end,
|
||||
["PLAYER_REGEN_DISABLED"] = function(this) HealBot_OnEvent_PlayerRegenDisabled(this) end,
|
||||
["PLAYER_REGEN_ENABLED"] = function(this) HealBot_OnEvent_PlayerRegenEnabled(this) end,
|
||||
["BAG_UPDATE_COOLDOWN"] = function(this, arg1) HealBot_OnEvent_BagUpdateCooldown(this,arg1) end,
|
||||
["BAG_UPDATE"] = function(this, arg1) HealBot_OnEvent_BagUpdate(this,arg1) end,
|
||||
["PARTY_MEMBER_DISABLE"] = function(this, arg1) HealBot_OnEvent_PartyMemberDisable(this,arg1) end,
|
||||
["PARTY_MEMBER_ENABLE"] = function(this, arg1) HealBot_OnEvent_PartyMemberEnable(this,arg1) end,
|
||||
["CHAT_MSG_SYSTEM"] = function(this, arg1) HealBot_OnEvent_SystemMsg(this,arg1) end,
|
||||
["ZONE_CHANGED_NEW_AREA"] = function(this) HealBot_OnEvent_ZoneChanged(this) end,
|
||||
["UPDATE_INVENTORY_ALERTS"] = function(this) HealBot_OnEvent_PlayerEquipmentChanged(this) end,
|
||||
["UNIT_INVENTORY_CHANGED"] = function(this, arg1) HealBot_OnEvent_PlayerEquipmentChanged2(this,arg1) end,
|
||||
["PET_BAR_SHOWGRID"] = function(this) HealBot_OnEvent_PartyMembersChanged(this) end,
|
||||
["PET_BAR_HIDEGRID"] = function(this) HealBot_OnEvent_PartyMembersChanged(this) end,
|
||||
["SPELLS_CHANGED"] = function(this, arg1) HealBot_OnEvent_SpellsChanged(this,arg1) end
|
||||
}
|
||||
|
||||
function HealBot_OnEvent(this, event, arg1,arg2,arg3,arg4)
|
||||
local handler = HealBot_EventHandlers[event]
|
||||
if handler then
|
||||
handler(this, arg1, arg2, arg3, arg4)
|
||||
else
|
||||
HealBot_AddDebug("OnEvent (" .. event .. ")");
|
||||
HealBot_AddDebug("OnEvent (" .. event .. ")")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -828,8 +893,25 @@ function HealBot_OnEvent_VariablesLoaded(this)
|
||||
if not HealBot_Config[key] then
|
||||
HealBot_Config[key] = val;
|
||||
end
|
||||
if type(val) == "table" and type(HealBot_Config[key]) == "table" then
|
||||
for k, v in pairs(val) do
|
||||
if HealBot_Config[key][k] == nil then
|
||||
HealBot_Config[key][k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
end);
|
||||
|
||||
local foundModern = false
|
||||
if HealBot_Config.Skins then
|
||||
for _, skin in ipairs(HealBot_Config.Skins) do
|
||||
if skin == "Modern Flat" then foundModern = true break end
|
||||
end
|
||||
if not foundModern then
|
||||
table.insert(HealBot_Config.Skins, "Modern Flat")
|
||||
end
|
||||
end
|
||||
|
||||
HealBot_InitData();
|
||||
|
||||
if class=="PRIEST" or class=="DRUID" or class=="PALADIN" or class=="SHAMAN" then
|
||||
@@ -1589,3 +1671,4 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
## Interface: 11200
|
||||
## Title: HealBotBlue
|
||||
## Version: 1.1
|
||||
## Version: 1.2
|
||||
## Author: Bluewhale
|
||||
## Notes: Adds panel with skinable bars for healing and decursive
|
||||
## SavedVariables: HealBot_Config
|
||||
@@ -9,6 +9,7 @@
|
||||
..\..\FrameXML\UIPanelTemplates.xml
|
||||
..\..\FrameXML\UIDropDownMenu.xml
|
||||
HealBot_Error.xml
|
||||
HealBot_Model.lua
|
||||
HealBot.xml
|
||||
HealBot_Action.xml
|
||||
HealBot_Options.xml
|
||||
|
||||
+121
-40
@@ -1,3 +1,11 @@
|
||||
function HealBot_Action_SetTexture(bar, btexture)
|
||||
if not bar then return end
|
||||
if btexture == 10 then
|
||||
bar:SetStatusBarTexture("Interface\\Buttons\\WHITE8X8");
|
||||
else
|
||||
HealBot_Action_SetTexture(bar, btexture);
|
||||
end
|
||||
end
|
||||
local headerno=0;
|
||||
|
||||
HealBot_Action_HealGroup = {
|
||||
@@ -23,16 +31,24 @@ function HealBot_Action_AddDebug(msg)
|
||||
end
|
||||
|
||||
function HealBot_HealthColor(unit,hlth,maxhlth)
|
||||
if HealBot_UnitDebuff[unit] then
|
||||
if HealBot_UnitDebuff[unit] then
|
||||
local debuff, tmp, debuff_type = UnitDebuff(unit,1, 1)
|
||||
if not debuff then
|
||||
HealBot_UnitDebuff[unit] = nil;
|
||||
HealBot_UnitDebuff[unit.."_debuff_texture"]=nil
|
||||
else
|
||||
return HealBot_Config.CDCBarColour[HealBot_UnitDebuff[unit]].R,
|
||||
HealBot_Config.CDCBarColour[HealBot_UnitDebuff[unit]].G,
|
||||
HealBot_Config.CDCBarColour[HealBot_UnitDebuff[unit]].B,
|
||||
HealBot_Config.Barcola[HealBot_Config.Current_Skin];
|
||||
local dr = HealBot_Config.CDCBarColour[HealBot_UnitDebuff[unit]].R
|
||||
local dg = HealBot_Config.CDCBarColour[HealBot_UnitDebuff[unit]].G
|
||||
local db = HealBot_Config.CDCBarColour[HealBot_UnitDebuff[unit]].B
|
||||
if HealBot_Config.btexture[HealBot_Config.Current_Skin] == 10 then
|
||||
dr = dr * 4
|
||||
dg = dg * 4
|
||||
db = db * 4
|
||||
if dr > 1 then dr = 1 end
|
||||
if dg > 1 then dg = 1 end
|
||||
if db > 1 then db = 1 end
|
||||
end
|
||||
return dr, dg, db, HealBot_Config.Barcola[HealBot_Config.Current_Skin];
|
||||
end
|
||||
end
|
||||
local text = UnitName(unit);
|
||||
@@ -57,10 +73,20 @@ function HealBot_HealthColor(unit,hlth,maxhlth)
|
||||
a=HealBot_Config.bardisa[HealBot_Config.Current_Skin];
|
||||
end
|
||||
|
||||
if pct>=0.98 then r = 0.0; end
|
||||
if pct<0.98 and pct>=0.65 then r=2.94-(pct*3); end
|
||||
if pct<=0.64 and pct>0.31 then g=(pct-0.31)*3; end
|
||||
if pct<=0.31 then g = 0.0; end
|
||||
local colorMode = HealBot_Config.bcolormode[HealBot_Config.Current_Skin] or 1
|
||||
if colorMode == 2 and HealBot_Model and HealBot_Model.units[unit] and HealBot_Model.units[unit].englishClass then
|
||||
local engClass = HealBot_Model.units[unit].englishClass
|
||||
if RAID_CLASS_COLORS and RAID_CLASS_COLORS[engClass] then
|
||||
r = RAID_CLASS_COLORS[engClass].r
|
||||
g = RAID_CLASS_COLORS[engClass].g
|
||||
b = RAID_CLASS_COLORS[engClass].b
|
||||
end
|
||||
else
|
||||
if pct>=0.98 then r = 0.0; end
|
||||
if pct<0.98 and pct>=0.65 then r=2.94-(pct*3); end
|
||||
if pct<=0.64 and pct>0.31 then g=(pct-0.31)*3; end
|
||||
if pct<=0.31 then g = 0.0; end
|
||||
end
|
||||
return r,g,b,a;
|
||||
end
|
||||
|
||||
@@ -130,9 +156,14 @@ end
|
||||
|
||||
function HealBot_Action_EnableButton(button)
|
||||
local unit = button.unit;
|
||||
local hlth=UnitHealth(unit);
|
||||
local maxhlth=UnitHealthMax(unit);
|
||||
local name = UnitName(unit);
|
||||
local state = HealBot_Model.units[unit]
|
||||
if not state then return end
|
||||
|
||||
local hlth = state.health
|
||||
local maxhlth = state.maxHealth
|
||||
local name = state.name
|
||||
if not name then name = UnitName(unit) end -- fallback
|
||||
|
||||
local bar = HealBot_Action_HealthBar(button);
|
||||
local bar2 = HealBot_Action_HealthBar2(button);
|
||||
local bar3 = getglobal(button:GetName().."Bar3");
|
||||
@@ -151,19 +182,28 @@ function HealBot_Action_EnableButton(button)
|
||||
bar:SetMinMaxValues(0,maxhlth);
|
||||
bar:SetValue(hlth);
|
||||
|
||||
local _, englishClass = UnitClass(unit)
|
||||
local englishClass = state.englishClass
|
||||
local isHealer = false
|
||||
if englishClass == "PALADIN" or englishClass == "DRUID" or englishClass == "SHAMAN" or englishClass == "PRIEST" then
|
||||
isHealer = true
|
||||
end
|
||||
local pt = UnitPowerType(unit)
|
||||
local pt = state.powerType
|
||||
|
||||
if HealBot_Config.ShowManaBars == 1 and UnitManaMax(unit) > 0 and isHealer and pt == 0 then
|
||||
local showMana = false
|
||||
if HealBot_Config.ShowManaBars == 1 and state.maxMana > 0 and pt == 0 then
|
||||
if HealBot_Config.ManaBarsHealersOnly == 1 then
|
||||
if isHealer then showMana = true end
|
||||
else
|
||||
showMana = true
|
||||
end
|
||||
end
|
||||
|
||||
if showMana then
|
||||
local pr, pg, pb = 0, 0, 1
|
||||
|
||||
if bar3 then
|
||||
bar3:SetMinMaxValues(0, UnitManaMax(unit))
|
||||
bar3:SetValue(UnitMana(unit))
|
||||
bar3:SetMinMaxValues(0, state.maxMana)
|
||||
bar3:SetValue(state.mana)
|
||||
bar3:SetStatusBarColor(pr, pg, pb, HealBot_Config.Barcola[HealBot_Config.Current_Skin])
|
||||
bar3:Show()
|
||||
bar3:SetHeight(bheight * 0.2)
|
||||
@@ -186,7 +226,7 @@ function HealBot_Action_EnableButton(button)
|
||||
bar2:SetValue(0);
|
||||
end
|
||||
bar.txt = getglobal(bar:GetName().."_text");
|
||||
if (not HealBot_IsCasting and HealBot_CanHeal(unit)) then
|
||||
if (not HealBot_IsCasting and (HealBot_CanHeal(unit) or HealBot_MissingBuffs[unit])) then
|
||||
button:Enable();
|
||||
if HealBot_UnitDebuff[unit] then
|
||||
sr=HealBot_Config.btextcursecolr[HealBot_Config.Current_Skin];
|
||||
@@ -194,11 +234,11 @@ function HealBot_Action_EnableButton(button)
|
||||
sb=HealBot_Config.btextcursecolb[HealBot_Config.Current_Skin];
|
||||
sa=HealBot_Config.btextcursecola[HealBot_Config.Current_Skin];
|
||||
elseif HealBot_MissingBuffs[unit] then
|
||||
r=1.0;
|
||||
g=1.0;
|
||||
b=1.0;
|
||||
sr=0.0;
|
||||
sg=0.0;
|
||||
r=r*0.5;
|
||||
g=g*0.5;
|
||||
b=b*0.5;
|
||||
sr=1.0;
|
||||
sg=1.0;
|
||||
sb=0.0;
|
||||
end
|
||||
bar:SetStatusBarColor(r,g,b,HealBot_Config.Barcola[HealBot_Config.Current_Skin]);
|
||||
@@ -215,8 +255,22 @@ function HealBot_Action_EnableButton(button)
|
||||
if string.len(name)>textlen then
|
||||
name = string.sub(name,1,textlen-3) .. '...';
|
||||
end
|
||||
bar.txt:SetText(name);
|
||||
bar.txt:SetText(name);
|
||||
bar.txt:SetTextColor(sr,sg,sb,sa);
|
||||
local fontName, fontHeight, fontFlags = bar.txt:GetFont()
|
||||
local fontOutline = HealBot_Config.bfontoutline[HealBot_Config.Current_Skin] or 0
|
||||
if fontOutline == 1 then
|
||||
bar.txt:SetFont(fontName, fontHeight, "OUTLINE")
|
||||
else
|
||||
bar.txt:SetFont(fontName, fontHeight, "")
|
||||
end
|
||||
local fontName, fontHeight, fontFlags = bar.txt:GetFont()
|
||||
local fontOutline = HealBot_Config.bfontoutline[HealBot_Config.Current_Skin] or 0
|
||||
if fontOutline == 1 then
|
||||
bar.txt:SetFont(fontName, fontHeight, "OUTLINE")
|
||||
else
|
||||
bar.txt:SetFont(fontName, fontHeight, "")
|
||||
end
|
||||
|
||||
for i = 1, 5 do
|
||||
local icon = getglobal(button:GetName().."BarIcon"..i)
|
||||
@@ -249,14 +303,14 @@ end
|
||||
function HealBot_Action_ResetSkin()
|
||||
HealBot_Action_PartyChanged()
|
||||
if HealBot_Options:IsVisible() then
|
||||
HealBot_DiseaseColorpick:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..HealBot_Config.btexture[HealBot_Config.Current_Skin]..".tga");
|
||||
HealBot_MagicColorpick:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..HealBot_Config.btexture[HealBot_Config.Current_Skin]..".tga");
|
||||
HealBot_PoisonColorpick:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..HealBot_Config.btexture[HealBot_Config.Current_Skin]..".tga");
|
||||
HealBot_CurseColorpick:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..HealBot_Config.btexture[HealBot_Config.Current_Skin]..".tga");
|
||||
HealBot_EnTextColorpick:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..HealBot_Config.btexture[HealBot_Config.Current_Skin]..".tga");
|
||||
HealBot_EnTextColorpickin:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..HealBot_Config.btexture[HealBot_Config.Current_Skin]..".tga");
|
||||
HealBot_DisTextColorpick:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..HealBot_Config.btexture[HealBot_Config.Current_Skin]..".tga");
|
||||
HealBot_DebTextColorpick:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..HealBot_Config.btexture[HealBot_Config.Current_Skin]..".tga");
|
||||
HealBot_Action_SetTexture(HealBot_DiseaseColorpick, HealBot_Config.btexture[HealBot_Config.Current_Skin])
|
||||
HealBot_Action_SetTexture(HealBot_MagicColorpick, HealBot_Config.btexture[HealBot_Config.Current_Skin])
|
||||
HealBot_Action_SetTexture(HealBot_PoisonColorpick, HealBot_Config.btexture[HealBot_Config.Current_Skin])
|
||||
HealBot_Action_SetTexture(HealBot_CurseColorpick, HealBot_Config.btexture[HealBot_Config.Current_Skin])
|
||||
HealBot_Action_SetTexture(HealBot_EnTextColorpick, HealBot_Config.btexture[HealBot_Config.Current_Skin])
|
||||
HealBot_Action_SetTexture(HealBot_EnTextColorpickin, HealBot_Config.btexture[HealBot_Config.Current_Skin])
|
||||
HealBot_Action_SetTexture(HealBot_DisTextColorpick, HealBot_Config.btexture[HealBot_Config.Current_Skin])
|
||||
HealBot_Action_SetTexture(HealBot_DebTextColorpick, HealBot_Config.btexture[HealBot_Config.Current_Skin])
|
||||
HealBot_SetSkinColours()
|
||||
end
|
||||
end
|
||||
@@ -706,13 +760,13 @@ if not HealBot_IsFighting then
|
||||
local bar2 = HealBot_Action_HealthBar2(button);
|
||||
bar.txt = getglobal(bar:GetName().."_text");
|
||||
bar:SetHeight(bheight);
|
||||
bar:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..btexture..".tga");
|
||||
HealBot_Action_SetTexture(bar, btexture);
|
||||
bar.txt:SetTextHeight(btextheight);
|
||||
local barScale = bar:GetScale();
|
||||
bar:SetScale(barScale + 0.01);
|
||||
bar:SetScale(barScale);
|
||||
bar2:SetHeight(bheight);
|
||||
bar2:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..btexture..".tga");
|
||||
HealBot_Action_SetTexture(bar2, btexture);
|
||||
end);
|
||||
|
||||
if MaxOffsetY<OffsetY then MaxOffsetY = OffsetY; end
|
||||
@@ -736,7 +790,7 @@ if not HealBot_IsFighting then
|
||||
bar.txt = getglobal(bar:GetName().."_text");
|
||||
bar.txt:SetTextColor(sr,sg,sb,sa);
|
||||
bar.txt:SetText(HEALBOT_ACTION_ABORT);
|
||||
bar:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\images\\bar"..btexture..".tga");
|
||||
HealBot_Action_SetTexture(bar, btexture);
|
||||
bar:SetMinMaxValues(0,100);
|
||||
bar:SetValue(100);
|
||||
bar:ClearAllPoints();
|
||||
@@ -1164,11 +1218,34 @@ function HealBot_Action_OnShow(this)
|
||||
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]);
|
||||
local borderStyle = HealBot_Config.bborder[HealBot_Config.Current_Skin] or 2
|
||||
if borderStyle == 0 then
|
||||
HealBot_Action:SetBackdropBorderColor(0,0,0,0);
|
||||
elseif borderStyle == 1 then
|
||||
HealBot_Action:SetBackdrop({
|
||||
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: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: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
|
||||
end
|
||||
|
||||
function HealBot_Action_OnHide(this)
|
||||
@@ -1221,3 +1298,7 @@ function HealBot_Action_OnKey(this,key,state)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+41
-37
@@ -1,5 +1,6 @@
|
||||
HealBot_ConfigDefaults = {
|
||||
ShowManaBars=0,
|
||||
ManaBarsHealersOnly=1,
|
||||
Version = HEALBOT_VERSION,
|
||||
AlertLevel = 0.95,
|
||||
AutoClose = 1,
|
||||
@@ -173,43 +174,46 @@ HealBot_ConfigDefaults = {
|
||||
CDCRightText = {[HEALBOT_PRIEST]="None", [HEALBOT_SHAMAN]="None", [HEALBOT_DRUID]="None", [HEALBOT_PALADIN]="None",},
|
||||
Current_Skin = HEALBOT_SKINS_STD,
|
||||
Skin_ID = 1,
|
||||
Skins = {HEALBOT_SKINS_STD, "HealBot Party", "HealBot Raid", "Alteric Valley"},
|
||||
numcols = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 4, ["Alteric Valley"] = 2},
|
||||
btexture = {[HEALBOT_SKINS_STD] = 8,["HealBot Party"] = 6, ["HealBot Raid"] = 7, ["Alteric Valley"] = 9},
|
||||
bcspace = {[HEALBOT_SKINS_STD] = 4, ["HealBot Party"] = 4, ["HealBot Raid"] = 2, ["Alteric Valley"] = 2},
|
||||
brspace = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 2, ["HealBot Raid"] = 2, ["Alteric Valley"] = 1},
|
||||
bwidth = {[HEALBOT_SKINS_STD] = 122, ["HealBot Party"] = 115, ["HealBot Raid"] = 90, ["Alteric Valley"] = 85},
|
||||
bheight = {[HEALBOT_SKINS_STD] = 19, ["HealBot Party"] = 18, ["HealBot Raid"] = 14, ["Alteric Valley"] = 16},
|
||||
btextenabledcolr = {[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},
|
||||
btextenabledcolb = {[HEALBOT_SKINS_STD] = 0, ["HealBot Party"] = 0, ["HealBot Raid"] = 0, ["Alteric Valley"] = 0},
|
||||
btextenabledcola = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 1},
|
||||
btextdisbledcolr = {[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},
|
||||
btextdisbledcolb = {[HEALBOT_SKINS_STD] = 0.5, ["HealBot Party"] = 0.5, ["HealBot Raid"] = 0.5, ["Alteric Valley"] = 0.4},
|
||||
btextdisbledcola = {[HEALBOT_SKINS_STD] = 0.45, ["HealBot Party"] = 0.75, ["HealBot Raid"] = 0.75, ["Alteric Valley"] = 0},
|
||||
btextcursecolr = {[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},
|
||||
btextcursecolb = {[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},
|
||||
backcola = {[HEALBOT_SKINS_STD] = 0.05, ["HealBot Party"] = 0.25, ["HealBot Raid"] = 0.25, ["Alteric Valley"] = 0},
|
||||
Barcola = {[HEALBOT_SKINS_STD] = 0.85, ["HealBot Party"] = 0.85, ["HealBot Raid"] = 0.85, ["Alteric Valley"] = 0.85},
|
||||
BarcolaInHeal = {[HEALBOT_SKINS_STD] = 0.40, ["HealBot Party"] = 0.35, ["HealBot Raid"] = 0.35, ["Alteric Valley"] = 0.5},
|
||||
backcolr = {[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},
|
||||
backcolb = {[HEALBOT_SKINS_STD] = 0.7, ["HealBot Party"] = 0.7, ["HealBot Raid"] = 0.7, ["Alteric Valley"] = 0.2},
|
||||
borcolr = {[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},
|
||||
borcolb = {[HEALBOT_SKINS_STD] = 1, ["HealBot Party"] = 1, ["HealBot Raid"] = 1, ["Alteric Valley"] = 0.2},
|
||||
borcola = {[HEALBOT_SKINS_STD] = 0.25, ["HealBot Party"] = 0.8, ["HealBot Raid"] = 0.8, ["Alteric Valley"] = 0.1},
|
||||
btextheight = {[HEALBOT_SKINS_STD] = 10, ["HealBot Party"] = 10, ["HealBot Raid"] = 9, ["Alteric Valley"] = 10},
|
||||
bardisa = {[HEALBOT_SKINS_STD] = 0.15, ["HealBot Party"] = 0.75, ["HealBot Raid"] = 0.75, ["Alteric Valley"] = 0},
|
||||
abortsize = {[HEALBOT_SKINS_STD] = 7, ["HealBot Party"] = 10, ["HealBot Raid"] = 5, ["Alteric Valley"] = 6},
|
||||
babortcolr = {[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},
|
||||
babortcolb = {[HEALBOT_SKINS_STD] = 0.5, ["HealBot Party"] = 0.5, ["HealBot Raid"] = 0.5, ["Alteric Valley"] = 0.6},
|
||||
babortcola = {[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},
|
||||
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, ["Modern Flat"] = 1},
|
||||
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, ["Modern Flat"] = 4},
|
||||
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, ["Modern Flat"] = 122},
|
||||
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, ["Modern Flat"] = 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, ["Modern Flat"] = 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, ["Modern Flat"] = 0.5},
|
||||
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, ["Modern Flat"] = 0.5},
|
||||
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, ["Modern Flat"] = 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, ["Modern Flat"] = 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, ["Modern Flat"] = 0.8},
|
||||
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, ["Modern Flat"] = 0.6},
|
||||
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, ["Modern Flat"] = 0.1},
|
||||
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, ["Modern Flat"] = 0},
|
||||
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, ["Modern Flat"] = 0},
|
||||
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, ["Modern Flat"] = 11},
|
||||
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, ["Modern Flat"] = 8},
|
||||
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, ["Modern Flat"] = 0.1},
|
||||
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, ["Modern Flat"] = 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_ShowTarget = 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.babortcola[HealBot_Config.Current_Skin]);
|
||||
|
||||
-- removed SetBackdropColor
|
||||
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]);
|
||||
local borderStyle = HealBot_Config.bborder[HealBot_Config.Current_Skin] or 2
|
||||
if borderStyle == 0 then
|
||||
HealBot_Action:SetBackdropBorderColor(0,0,0,0);
|
||||
elseif borderStyle == 1 then
|
||||
HealBot_Action:SetBackdrop({
|
||||
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_DisTextColorpickt:SetTextHeight(btextheight);
|
||||
@@ -1453,6 +1485,16 @@ function HealBot_Options_SetSkins()
|
||||
HealBot_Options_BarAlphaDis:SetValue(HealBot_Config.bardisa[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)
|
||||
|
||||
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()
|
||||
if HealBot_Config.Current_Skin==HEALBOT_SKINS_STD then
|
||||
HealBot_Options_DeleteSkin:Disable();
|
||||
@@ -1710,3 +1752,4 @@ end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+23
-1
@@ -1592,6 +1592,27 @@
|
||||
<OnClick>HealBot_Options_ShowHeaders_OnClick(this)</OnClick>
|
||||
</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>
|
||||
|
||||
<Slider name="HealBot_Options_BarTextureS" inherits="HealBot_Options_SliderTemplate">
|
||||
<Size>
|
||||
@@ -1637,7 +1658,7 @@
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<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>
|
||||
</Scripts>
|
||||
</Slider>
|
||||
@@ -2780,3 +2801,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,12 @@ Default installation path: `C:\Program Files\World of Warcraft\Interface\AddOns\
|
||||
|
||||
### 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**
|
||||
* **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.
|
||||
|
||||
Reference in New Issue
Block a user