Page 1 of 1

PetTracker concerns

Posted: August 14th, 2016, 8:17 am
by Golconda
Hi all, I have been a long time pet collector, battler and love my PetTracker so much. The icons it gives to show the enemies cooldowns and moves has been fantastic.

Ever since the 7.0 update though, PetTracker has been filled with errors and conflicts. I have placed a ticket, made comments on the Curse page and still nothing from the author. The author works on a lot of addons but just wondering if anyone knew how to fix it or better yet, if there is another addon that can get me back my three enemy icons, I loved being able to see the times right away on enemy abilities.

Thanks in advance and battle on!

Re: PetTracker concerns

Posted: August 14th, 2016, 9:47 pm
by Gello
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:
https://mods.curse.com/addons/wow/derangement-pet-battle-cooldowns

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

Re: PetTracker concerns

Posted: August 14th, 2016, 10:31 pm
by Golconda
Thanks, this looks like a good fit I will check it out.

Re: PetTracker concerns

Posted: August 17th, 2016, 12:42 am
by Paladance
Anyone with the same concern, could you disable your other addons and then see how it's going?
I'm sure that it's merely a conflict.

Safe to keep: Bartender 4, DBM addons, OneBag3, Skada, HandyNotes

Re: PetTracker concerns

Posted: August 17th, 2016, 5:49 am
by Golconda
ACtually, it is mostly an error with PetTracker, there are evidently 11 pet sources now instead of 10 and the author didn't adjust it.