diff --git a/Addons/DataToColor/Constants.lua b/Addons/DataToColor/Constants.lua index ec40c264..693d5e31 100644 --- a/Addons/DataToColor/Constants.lua +++ b/Addons/DataToColor/Constants.lua @@ -82,3 +82,5 @@ DataToColor.C.MIRRORTIMER.BREATH = "BREATH" DataToColor.C.ActionType.Spell = "spell" DataToColor.C.ActionType.Macro = "macro" + +DataToColor.C.PET_MODE_DEFENSIVE = "PET_MODE_DEFENSIVE" \ No newline at end of file diff --git a/Addons/DataToColor/DataToColor.toc b/Addons/DataToColor/DataToColor.toc index bdb341b4..6807b2c8 100644 --- a/Addons/DataToColor/DataToColor.toc +++ b/Addons/DataToColor/DataToColor.toc @@ -3,7 +3,7 @@ ## Title: DataToColor ## Author: FreeHongKongMMO ## Notes: Displays data as colors -## Version: 1.7.62 +## Version: 1.7.63 ## RequiredDeps: ## OptionalDeps: Ace3, LibRangeCheck, LibClassicCasterino ## SavedVariables: diff --git a/Addons/DataToColor/Query.lua b/Addons/DataToColor/Query.lua index 70693746..c74f0621 100644 --- a/Addons/DataToColor/Query.lua +++ b/Addons/DataToColor/Query.lua @@ -52,6 +52,8 @@ local UnitRangedDamage = UnitRangedDamage local GameMenuFrame = GameMenuFrame +local HasPetUI = HasPetUI + -- bits local UnitAffectingCombat = UnitAffectingCombat @@ -164,7 +166,8 @@ function DataToColor:Bits2() ((DataToColor.autoFollow) and 2 or 0) ^ 19 + ((GameMenuFrame:IsShown() and 2 or 0)) ^ 20 + ((IsFlying() and 2 or 0)) ^ 21 + - ((DataToColor.moving and 2 or 0)) ^ 22 + ((DataToColor.moving and 2 or 0)) ^ 22 + + ((DataToColor:PetIsDefensive() and 2 or 0)) ^ 23 end function DataToColor:Bits3() @@ -611,3 +614,18 @@ function DataToColor:IsUnitHostile(unit, unittarget) (UnitReaction(unit, unittarget) or 0) <= 4 and not UnitIsFriend(unit, unittarget) end + +function DataToColor:PetIsDefensive() + if not HasPetUI() then + return false + end + + for i = 1, 10 do + local name, _, _, isActive = GetPetActionInfo(i) + if isActive and name == DataToColor.C.PET_MODE_DEFENSIVE then + return true + end + end + + return false +end \ No newline at end of file