Skip to content

Commit

Permalink
classicons: Fake unit if player is in a vehicle
Browse files Browse the repository at this point in the history
  • Loading branch information
p3lim authored and ls- committed Sep 29, 2016
1 parent 21b0a48 commit 3b9414f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions elements/classicons.lua
Expand Up @@ -71,8 +71,8 @@ local UpdateTexture = function(element)
end

local Update = function(self, event, unit, powerType)
if(not (unit == 'player' and powerType == ClassPowerType)
and not (unit == 'vehicle' and powerType == 'COMBO_POINTS')) then
if(not (unit == 'player' and powerType == ClassPowerType
or unit == 'vehicle' and powerType == 'COMBO_POINTS')) then
return
end

Expand All @@ -95,7 +95,7 @@ local Update = function(self, event, unit, powerType)
if(event ~= 'ClassPowerDisable') then
if(unit == 'vehicle') then
-- XXX: UnitPower is bugged for vehicles, always returns 0 combo points
cur = GetComboPoints('vehicle', 'target')
cur = GetComboPoints(unit)
max = MAX_COMBO_POINTS
else
cur = UnitPower('player', ClassPowerID)
Expand Down Expand Up @@ -150,6 +150,7 @@ local function Visibility(self, event, unit)

if(UnitHasVehicleUI('player')) then
shouldEnable = true
unit = 'vehicle'
elseif(ClassPowerID) then
if(not RequireSpec or RequireSpec == GetSpecialization()) then
if(not RequireSpell or IsPlayerSpell(RequireSpell)) then
Expand Down
4 changes: 4 additions & 0 deletions ouf.lua
Expand Up @@ -46,6 +46,10 @@ local updateActiveUnit = function(self, event, unit)
realUnit = 'target'
end

if(modUnit == 'pet' and realUnit ~= 'pet') then
modUnit = 'vehicle'
end

if(not UnitExists(modUnit)) then return end

-- Change the active unit and run a full update.
Expand Down

0 comments on commit 3b9414f

Please sign in to comment.