Created
September 6, 2019 18:26
-
-
Save Rochet2/1228891a555b3eded669bde0a2bc5b52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local run = false | |
local tabid = 1 | |
local talentid = 1 | |
local learned = false | |
local GetFreeTalentPoints = GetUnspentTalentPoints or GetNumUnspentTalents | |
assert(GetFreeTalentPoints, "No function set for getting unspent talents!") | |
local function ONUPDATE(self, diff) | |
if (not run) then | |
return | |
end | |
if(GetFreeTalentPoints() >= 1) then | |
if (tabid <= 3) then | |
while (talentid <= GetNumTalents(tabid)) do | |
local _, _, tier, column, currentRank, maxRank, _, _ = GetTalentInfo(tabid, talentid) | |
if (currentRank < maxRank) then | |
LearnTalent(tabid, talentid) | |
learned = true | |
end | |
talentid = talentid + 1 | |
if (talentid <= GetNumTalents(tabid)) then | |
local _, _, nexttier, nextcolumn, nextcurrentRank, nextmaxRank, _, _ = GetTalentInfo(tabid, talentid) | |
if (learned and tier < nexttier) then | |
talentid = talentid - column | |
learned = false | |
return | |
end | |
else | |
if (learned) then | |
talentid = talentid - column | |
learned = false | |
return | |
end | |
end | |
if (learned) then | |
return | |
end | |
end | |
tabid = tabid + 1 | |
talentid = 1 | |
learned = false | |
return | |
end | |
end | |
run = false | |
tabid = 1 | |
talentid = 1 | |
runid = 1 | |
end | |
local timer = CreateFrame("Frame") | |
timer:SetScript("OnUpdate", ONUPDATE) | |
local function StartRunning(self) | |
run = true | |
end | |
assert(LoadAddOn("Blizzard_TalentUI")) | |
local Button = CreateFrame("Button", "Learn 255 Talents", PlayerTalentFrame, "UIPanelButtonTemplate") | |
Button:SetPoint("TOP", PlayerTalentFrame, "TOP", 0, -40) | |
Button:SetText("Learn all talents") | |
Button:SetSize(120, 25) | |
Button:SetScript("OnMouseUp", StartRunning) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Interface: 30300 | |
## Title: Talent learning addon | |
## Notes: Adds a button to talent frame for learning all talents | |
## Author: Rochet2 | |
Timmy.lua |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment