Skip to content

Commit

Permalink
Addon: 1.7.63: Extract PetDefensive info
Browse files Browse the repository at this point in the history
  • Loading branch information
Xian55 committed Jan 11, 2025
1 parent 6bb14b9 commit eb0cba6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Addons/DataToColor/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion Addons/DataToColor/DataToColor.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 19 additions & 1 deletion Addons/DataToColor/Query.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ local UnitRangedDamage = UnitRangedDamage

local GameMenuFrame = GameMenuFrame

local HasPetUI = HasPetUI

-- bits

local UnitAffectingCombat = UnitAffectingCombat
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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

0 comments on commit eb0cba6

Please sign in to comment.