@@ -51,6 +51,8 @@ local UnitAttackSpeed = UnitAttackSpeed
5151local UnitRangedDamage = UnitRangedDamage
5252
5353local GameMenuFrame = GameMenuFrame
54+ local LootFrame = LootFrame
55+ local ChatFrame1EditBox = ChatFrame1EditBox
5456
5557local HasPetUI = HasPetUI
5658
@@ -124,11 +126,11 @@ function DataToColor:Bits1()
124126 (UnitIsVisible (DataToColor .C .unitPet ) and not UnitIsDead (DataToColor .C .unitPet ) and 2 or 0 ) ^ 6 +
125127 (mainHandEnchant and 2 or 0 ) ^ 7 +
126128 (offHandEnchant and 2 or 0 ) ^ 8 +
127- DataToColor :GetInventoryBroken () ^ 9 +
129+ ( DataToColor :GetInventoryBroken () ^ 9 ) +
128130 (UnitOnTaxi (DataToColor .C .unitPlayer ) and 2 or 0 ) ^ 10 +
129131 (IsSwimming () and 2 or 0 ) ^ 11 +
130- (GetPetHappiness () == 3 and 2 or 0 ) ^ 12 +
131- (GetInventoryItemCount ( DataToColor . C . unitPlayer , ammoSlot ) > 0 and 2 or 0 ) ^ 13 +
132+ (DataToColor : PetHappy () and 2 or 0 ) ^ 12 +
133+ (DataToColor : HasAmmo () and 2 or 0 ) ^ 13 +
132134 (UnitAffectingCombat (DataToColor .C .unitPlayer ) and 2 or 0 ) ^ 14 +
133135 (DataToColor :IsUnitsTargetIsPlayerOrPet (DataToColor .C .unitTarget , DataToColor .C .unitTargetTarget ) and 2 or 0 ) ^ 15 +
134136 (IsAutoRepeatSpell (DataToColor .C .Spell .AutoShotId ) and 2 or 0 ) ^ 16 +
@@ -163,11 +165,11 @@ function DataToColor:Bits2()
163165 (DataToColor :IsUnitsTargetIsPlayerOrPet (DataToColor .C .unitmouseover , DataToColor .C .unitmouseovertarget ) and 2 or 0 ) ^ 16 +
164166 (UnitPlayerControlled (DataToColor .C .unitmouseover ) and 2 or 0 ) ^ 17 +
165167 (UnitPlayerControlled (DataToColor .C .unitTarget ) and 2 or 0 ) ^ 18 +
166- (( DataToColor .autoFollow ) and 2 or 0 ) ^ 19 +
167- (( GameMenuFrame :IsShown () and 2 or 0 ) ) ^ 20 +
168- (( IsFlying () and 2 or 0 ) ) ^ 21 +
169- (( DataToColor .moving and 2 or 0 ) ) ^ 22 +
170- (( DataToColor :PetIsDefensive () and 2 or 0 ) ) ^ 23
168+ (DataToColor .autoFollow and 2 or 0 ) ^ 19 +
169+ (GameMenuFrame :IsShown () and 2 or 0 ) ^ 20 +
170+ (IsFlying () and 2 or 0 ) ^ 21 +
171+ (DataToColor .moving and 2 or 0 ) ^ 22 +
172+ (DataToColor :PetIsDefensive () and 2 or 0 ) ^ 23
171173end
172174
173175function DataToColor :Bits3 ()
@@ -180,7 +182,9 @@ function DataToColor:Bits3()
180182 (UnitIsTapDenied (DataToColor .C .unitSoftInteract ) and 2 or 0 ) ^ 4 +
181183 (UnitAffectingCombat (DataToColor .C .unitSoftInteract ) and 2 or 0 ) ^ 5 +
182184 (DataToColor :IsUnitHostile (DataToColor .C .unitPlayer , DataToColor .C .unitSoftInteract ) and 2 or 0 ) ^ 6 +
183- ((DataToColor .channeling and 2 or 0 )) ^ 7
185+ (DataToColor .channeling and 2 or 0 ) ^ 7 +
186+ (LootFrame :IsShown () and 2 or 0 ) ^ 8 +
187+ (ChatFrame1EditBox :IsVisible () and 2 or 0 ) ^ 9
184188 )
185189end
186190
@@ -602,6 +606,25 @@ function DataToColor:UnitTargetsPartyOrPet(unittarget)
602606 return false
603607end
604608
609+ function DataToColor :HasAmmo ()
610+ -- After Cataclysm, ammo slot was removed
611+ if DataToColor :IsClassicPreCata () == false then
612+ return true
613+ end
614+
615+ local count = GetInventoryItemCount (DataToColor .C .unitPlayer , ammoSlot )
616+ return count > 0
617+ end
618+
619+ function DataToColor :PetHappy ()
620+ -- After Cataclysm, pet always happy :)
621+ if DataToColor :IsClassicPreCata () == false then
622+ return true
623+ end
624+
625+ return GetPetHappiness () == 3
626+ end
627+
605628-- Returns true if target of our target is us
606629function DataToColor :IsUnitsTargetIsPlayerOrPet (unit , unittarget )
607630 local x = DataToColor :UnitsTargetAsNumber (unit , unittarget )
0 commit comments