diff --git a/HealBot.lua b/HealBot.lua index 28020e0..00befc2 100644 --- a/HealBot.lua +++ b/HealBot.lua @@ -15,6 +15,7 @@ HealBot_Delay_RecalcParty=0; -- Debugging and Error functions moved to HealBot_Controller_Comms.lua +-- HealBot_TogglePanel: Toggles visibility of a frame panel. function HealBot_TogglePanel(panel) if (not panel) then return end if ( panel:IsVisible() ) then @@ -24,6 +25,7 @@ function HealBot_TogglePanel(panel) end end +-- HealBot_StartMoving: Initiates frame dragging when unlocked. function HealBot_StartMoving(frame) if ( not frame.isMoving ) and ( frame.isLocked ~= 1 ) then frame:StartMoving(); @@ -31,6 +33,7 @@ function HealBot_StartMoving(frame) end end +-- HealBot_StopMoving: Stops frame dragging. function HealBot_StopMoving(frame) if ( frame.isMoving ) then frame:StopMovingOrSizing(); @@ -47,6 +50,7 @@ function HealBot_StopMoving(frame) end +-- HealBot_SlashCmd: Handles '/hb' or '/healbot' chat commands. function HealBot_SlashCmd(cmd) if (cmd=="") then HealBot_TogglePanel(HealBot_Action); @@ -103,6 +107,7 @@ end -- HealBot_SendAddonMessage moved to HealBot_Controller_Comms.lua +-- HealBot_TargetName: Retrieves the name of the current target, ignoring enemies. function HealBot_TargetName() if UnitIsEnemy("target","player") then return nil end -- if not UnitPlayerControlled("target") then return nil end @@ -136,14 +141,17 @@ end +-- HealBot_PackBagSlot: Combines bag and slot into a single ID. function HealBot_PackBagSlot(bag,slot) return bag*100+slot; end +-- HealBot_UnpackBagSlot: Extracts bag and slot from a combined ID. function HealBot_UnpackBagSlot(bagslot) return math.floor(bagslot/100),math.mod(bagslot,100); end +-- HealBot_GetItemName: Gets item name from bag slot link. function HealBot_GetItemName(bag,slot) local link = GetContainerItemLink(bag,slot); if not link then return nil end; @@ -152,6 +160,7 @@ function HealBot_GetItemName(bag,slot) return item,count; end +-- HealBot_GetBagSlot: Finds bag slot ID for an item name. function HealBot_GetBagSlot(item) local BagSlot,BestCount; for bag=0,NUM_BAG_FRAMES do @@ -168,6 +177,7 @@ function HealBot_GetBagSlot(item) return BagSlot; end +-- HealBot_UseItem: Uses an item from inventory. function HealBot_UseItem(item) local bagslot = HealBot_GetBagSlot(item); if not bagslot then return end; @@ -178,9 +188,24 @@ end -- Spell parsing and casting functions moved to HealBot_Controller_Spells.lua +-- HealBot_UnitClass: Returns English class string for a unit. function HealBot_UnitClass(unit) - local playerClass, englishClass = UnitClass(unit); - return englishClass; + local locClass, enClass = UnitClass(unit) + if enClass then return string.upper(enClass) end + + -- Fallback for Vanilla 1.12 where enClass is nil + if locClass == HEALBOT_DRUID then return "DRUID" + elseif locClass == HEALBOT_HUNTER then return "HUNTER" + elseif locClass == HEALBOT_MAGE then return "MAGE" + elseif locClass == HEALBOT_PALADIN then return "PALADIN" + elseif locClass == HEALBOT_PRIEST then return "PRIEST" + elseif locClass == HEALBOT_ROGUE then return "ROGUE" + elseif locClass == HEALBOT_SHAMAN then return "SHAMAN" + elseif locClass == HEALBOT_WARLOCK then return "WARLOCK" + elseif locClass == HEALBOT_WARRIOR then return "WARRIOR" + end + + return locClass end ---- HealBot_UnitAffected moved to HealBot_Controller_Aura.lua @@ -197,6 +222,7 @@ end -- SpiBonus and GetBonus functions moved to HealBot_Controller_Spells.lua +-- HealBot_FindUnitID: Finds a unit token for a given player name. function HealBot_FindUnitID(unitname) local text; for _,unit in ipairs(HealBot_Action_HealGroup) do @@ -219,6 +245,7 @@ function HealBot_FindUnitID(unitname) return nil; end +-- HealBot_PlaySound: Plays an audio alert based on ID. function HealBot_PlaySound(id) if id==1 then PlaySoundFile("Sound\\Doodad\\BellTollTribal.wav"); @@ -231,6 +258,7 @@ end -- HealBot_InitSpells moved to HealBot_Controller_Spells.lua +-- HealBot_InitData: Registers options and basic setup on variables loaded. function HealBot_InitData() HealBot_Skins = HealBot_Config.Skins; if(CT_RegisterMod) then @@ -246,6 +274,7 @@ function HealBot_InitData() HealBot_Options_Debuff_Reset() end +-- HealBot_ToggleOptions: Toggles the main options menu. function HealBot_ToggleOptions() HealBot_TogglePanel(HealBot_Options) end @@ -262,6 +291,7 @@ end do local pass = function() end local orig = UseAction + -- UseAction: Intercepts standard clicks for mouseover support. function UseAction(slot, checkCursor, onSelf) if HealBot_Config.ActionMouseover == 1 then local mouseover = HealBot_Action_TooltipUnit diff --git a/HealBotBlue.toc b/HealBotBlue.toc index 7c0d6b0..6acff89 100644 --- a/HealBotBlue.toc +++ b/HealBotBlue.toc @@ -1,6 +1,6 @@ ## Interface: 11200 ## Title: HealBotBlue -## Version: 1.6.5 +## Version: 1.7.0 ## Author: Bluewhale ## Notes: Adds panel with skinable bars for healing and decursive ## SavedVariablesPerCharacter: HealBot_Config @@ -10,6 +10,7 @@ ..\..\FrameXML\UIDropDownMenu.xml HealBot_Error.xml HealBot_Model.lua +HealBot_Integrations.lua HealBot_Controller_Range.lua HealBot_Controller_Comms.lua HealBot_Controller_Aura.lua @@ -28,3 +29,4 @@ HealBot_Options_Skins.xml HealBot_Options_Buffs.xml HealBot_Options_Chat.xml HealBot_Options_Auto.xml +HealBot_Options_Integrations.xml diff --git a/HealBot_Action.lua b/HealBot_Action.lua index ddcc0f6..69ef209 100644 --- a/HealBot_Action.lua +++ b/HealBot_Action.lua @@ -1,9 +1,11 @@ -- Status bar layout functions and tables moved to HealBot_View_Layout.lua +-- HealBot_AlwaysHeal: Returns true if healthy units should be shown. function HealBot_AlwaysHeal() return HealBot_Config.EnableHealthy==1 end +-- HealBot_MayHeal: Checks if unit is eligible for healing UI. function HealBot_MayHeal(unit) if not UnitName(unit) or not HealBot_Heals[unit] then return false end if unit ~= 'target' then return true end @@ -11,6 +13,7 @@ function HealBot_MayHeal(unit) return true; end +-- HealBot_ShouldHeal: Checks if unit needs immediate healing. function HealBot_ShouldHeal(unit) if HealBot_UnitDebuff[unit] and not UnitIsDeadOrGhost(unit) then if HealBot_Range_Check(unit, 30)==1 then @@ -21,22 +24,26 @@ function HealBot_ShouldHeal(unit) and (UnitHealth(unit) +