I don't use it but Derangement's Pet Battle Cooldowns should work fine with Legion while waiting for PetTracker to get updated. You'll need to load out of date addons; the author commented recently that he'll be updating it soon:
If you want something more basic, copy and paste the following into http://addon.bool.no/ to make an addon that only puts the three buttons near the bottom of the screen like Pet Tracker does. It doesn't handle pvp opponent cooldowns, however.
Code: Select all
local frame = CreateFrame("Frame","BattlePetOpponentButtons",UIParent)
frame:SetSize(142,42)
frame:SetPoint("BOTTOM",0,128)
frame:Hide()
frame.buttons = {}
frame.vulnerabilities = {{4,5},{1,3},{6,8},{5,2},{8,7},{2,9},{9,10},{10,1},{3,4},{7,6}}
frame:SetScript("OnEvent",function(self,event,...)
if self[event] then
self[event](...)
end
if frame.readyToUpdate then
self:UpdateOpponentAbilityButtons()
end
end)
frame:RegisterEvent("PLAYER_LOGIN")
function frame:PLAYER_LOGIN()
for i=1,3 do
frame.buttons[i] = CreateFrame("Button",nil,frame)
local button = frame.buttons[i]
button:SetID(i)
button:SetSize(42,42)
button:SetPoint("LEFT",(i-1)*50,0)
button.icon = button:CreateTexture(nil,"BACKGROUND")
button.icon:SetAllPoints(true)
button.icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark")
button.hint = button:CreateTexture(nil,"BORDER")
button.hint:SetSize(20,20)
button.hint:SetPoint("BOTTOMRIGHT")
button.hint:SetTexture("Interface\\PetBattles\\BattleBar-AbilityBadge-Strong")
button.cooldown = button:CreateFontString(nil,"ARTWORK","GameFontNormalHuge")
button.cooldown:SetPoint("CENTER")
button:SetScript("OnEnter",frame.OpponentAbilityButtonOnEnter)
button:SetScript("OnLeave",frame.OpponentAbilityButtonOnLeave)
button:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
end
frame:RegisterEvent("PET_BATTLE_OPENING_DONE")
if IsAddOnLoaded("Blizzard_PetBattleUI") then
frame:HookSelectionFrame()
else
frame:RegisterEvent("ADDON_LOADED")
end
if C_PetBattles.IsInBattle() then
frame:PET_BATTLE_OPENING_DONE()
else
frame:PET_BATTLE_CLOSE()
end
end
function frame:ADDON_LOADED(addon)
if addon=="Blizzard_PetBattleUI" then
frame:UnregisterEvent("ADDON_LOADED")
frame:HookSelectionFrame()
end
end
function frame:PET_BATTLE_CLOSE()
frame:UnregisterEvent("PET_BATTLE_ABILITY_CHANGED")
frame:UnregisterEvent("PET_BATTLE_CLOSE")
frame:UnregisterEvent("PET_BATTLE_PET_CHANGED")
frame:UnregisterEvent("PET_BATTLE_TURN_STARTED")
frame:UnregisterEvent("PET_BATTLE_PET_ROUND_PLAYBACK_COMPLETE")
frame:Hide()
end
function frame:PET_BATTLE_OPENING_DONE()
frame:RegisterEvent("PET_BATTLE_PET_ROUND_PLAYBACK_COMPLETE")
frame:RegisterEvent("PET_BATTLE_ABILITY_CHANGED")
frame:RegisterEvent("PET_BATTLE_CLOSE")
frame:RegisterEvent("PET_BATTLE_PET_CHANGED")
frame:RegisterEvent("PET_BATTLE_TURN_STARTED")
frame:Show()
end
function frame:UpdateOpponentAbilityButtons()
local petIndex = C_PetBattles.GetActivePet(2)
for abilityIndex=1,3 do
local button = frame.buttons[abilityIndex]
local _,_,abilityIcon,_,_,_,petType,noHints = C_PetBattles.GetAbilityInfo(2,petIndex,abilityIndex)
if abilityIcon then
button.icon:SetTexture(abilityIcon)
button.cooldown:Hide()
button.hint:Hide()
local isUsable,currentCooldown,currentLockdown = C_PetBattles.GetAbilityState(2,petIndex,abilityIndex)
if isUsable then
button.icon:SetDesaturated(false)
button.icon:SetVertexColor(1,1,1,1)
else
button.icon:SetDesaturated(true)
button.icon:SetVertexColor(.3,.3,.3)
local cooldown = max(currentCooldown,currentLockdown)
if cooldown>0 then
button.cooldown:SetText(cooldown)
button.cooldown:Show()
end
end
if not noHints then
local myPetType = C_PetBattles.GetPetType(1,C_PetBattles.GetActivePet(1))
if frame.vulnerabilities[myPetType][1]==petType then
button.hint:SetTexture("Interface\\PetBattles\\BattleBar-AbilityBadge-Strong")
button.hint:Show()
end
if frame.vulnerabilities[myPetType][2]==petType then
button.hint:SetTexture("Interface\\PetBattles\\BattleBar-AbilityBadge-Weak")
button.hint:Show()
end
end
button:Show()
else
button:Hide()
end
end
end
function frame:OpponentAbilityButtonOnEnter()
local tooltip = PetBattlePrimaryAbilityTooltip
PetBattleAbilityTooltip_SetAbility(2,C_PetBattles.GetActivePet(2),self:GetID())
tooltip:ClearAllPoints()
tooltip:SetPoint("BOTTOM",self,"TOP",0,6)
tooltip:Show()
end
function frame:OpponentAbilityButtonOnLeave()
PetBattlePrimaryAbilityTooltip:Hide()
end
function frame:HookSelectionFrame()
hooksecurefunc("PetBattlePetSelectionFrame_Show",function() frame:ClearAllPoints() frame:SetPoint("TOP",0,-96) end)
hooksecurefunc("PetBattlePetSelectionFrame_Hide",function() frame:ClearAllPoints() frame:SetPoint("BOTTOM",0,128) end)
frame.readyToUpdate = true
end