View Single Post
03-17-21, 09:11 AM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
There does not appear to be a convenient API for that, but I'd like to be proven wrong.

Originally Posted by millanzarreta View Post
I have tested the IsSpellKnown function to detect if an ability is known, but the result is always "false" even if you have selected it and with war mode on, and even if this is an active spell and not a passive spell.

IsSpellKnown() works for me with the spell ID returned by the aforementioned GetPvpTalentInfoByID()
For example the Holy Priest [Greater Heal] pvp talent:
Lua Code:
  1. "|cff71d5ff|Hpvptal:112|h[Greater Heal]|h|r"
  2. "|cff71d5ff|Hspell:289666:0|h[Greater Heal]|h|r"
  3. /dump GetPvpTalentInfoByID(112) -- 6th return is the spell id
  4. /dump IsSpellKnown(289666) -- returns true when usable and false when not

IsPlayerSpell() seems to work for both passive/non-passive pvp talents, while IsSpellKnown() only works for non-passive pvp talents.

Lua Code:
  1. local function ArePvpTalentsActive()
  2.     local talents = C_SpecializationInfo.GetAllSelectedPvpTalentIDs()
  3.     for _, pvptalent in pairs(talents) do
  4.         local spellID = select(6, GetPvpTalentInfoByID(pvptalent))
  5.         if IsPlayerSpell(spellID) then
  6.             return true
  7.         end
  8.     end
  9. end
  10.  
  11.  
  12. local function OnEvent(self, event, ...)
  13.     local status = ArePvpTalentsActive() and "active" or "not active"
  14.     print("PvP Talents are "..status)
  15. end
  16.  
  17. local f = CreateFrame("Frame")
  18. f:RegisterEvent("SPELLS_CHANGED")
  19. f:SetScript("OnEvent", OnEvent)

Originally Posted by millanzarreta View Post
since even without War Mode you can activate PvP to enter combat with other players (it can be activated manually, or it also remains activated for 5 minutes when you deactivate WarMode in a city ).

Activating it manually with warmode off and using /pvp did not seem to activate the pvp talents for me. But I assume it does indeed get activated when you enter combat with other players.

Last edited by Ketho : 03-17-21 at 09:39 AM.
  Reply With Quote