Originally Posted by Ketho
|
I tested IsSpellKnown() again and it works for new active spells from PvP talents, but don't work for pasive talents and for new spells that replace others (for example
Ice Form that replaces
Icy Veins); the latter is what I had tested and that is why I assumed it never worked.
Originally Posted by Ketho
|
Ohh yes, IsPlayerSpell() is the key, works like a charm, it has worked for me for all the PvP talents I have tested
Good point about the SPELLS_CHANGED event, seems to fire always when PvP talents go ON or OFF (although obviously it can also be triggered on many other occasions, it's ok for what I needed)
Originally Posted by Ketho
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
|
Yes, warmode off disable the PvP talents and they cannot be activated with /pvp, but they are automatic activated when you enter in PvP combat, and automatic disabled some seconds after you leave the PvP combat.
I used your function with minor modifications:
Lua Code:
local function ArePvpTalentsActive()
local inInstance, instanceType = IsInInstance()
if inInstance and (instanceType == "pvp" or instanceType == "arena") then
return true
elseif inInstance and (instanceType == "party" or instanceType == "raid" or instanceType == "scenario") then
return false
else
local talents = C_SpecializationInfo.GetAllSelectedPvpTalentIDs()
for _, pvptalent in pairs(talents) do
local spellID = select(6, GetPvpTalentInfoByID(pvptalent))
if IsPlayerSpell(spellID) then
return true
end
end
end
end
local function OnEvent(self, event, ...)
local status = ArePvpTalentsActive() and "active" or "not active"
print("PvP Talents are "..status)
end
local f = CreateFrame("Frame")
f:RegisterEvent("SPELLS_CHANGED")
f:SetScript("OnEvent", OnEvent)
I add a previous check of IsInInstance() to fast-check if the player is in PvP instance or PvE instance, where as far as I know the PvP talents are always enabled and disabled respectively. Surely this is not necessary, but it seems better to me this way.
Thank you a lot, greetings