Skip to content

Instantly share code, notes, and snippets.

@ambethia

ambethia/Njor.lua

Created Nov 17, 2020
Embed
What would you like to do?
local ADDON, NS = ...
local LibCopyPaste = LibStub("LibCopyPaste-1.0")
local Njor = CreateFrame("Frame", ADDON .. "Frame")
Njor:SetScript(
"OnEvent",
function(self, event, ...)
if self[event] then
return self[event](self, ...)
end
end
)
function PrintSpells()
local data = {}
for tabIndex = 2, GetNumSpellTabs() do
local tabName, tabTexture, tabOffset, numEntries = GetSpellTabInfo(tabIndex)
for spellIndex = tabOffset + 1, tabOffset + numEntries do
local spellName, spellSubName = GetSpellBookItemName(spellIndex, BOOKTYPE_SPELL)
local skillType, special = GetSpellBookItemInfo(spellIndex, BOOKTYPE_SPELL)
local isPassive = IsPassiveSpell(spellIndex, BOOKTYPE_SPELL) and "true" or "false"
if skillType == "FUTURESPELL" then
skillType = "SPELL"
end
tinsert(data, strjoin(";", "Ability", tabName, spellName, (spellSubName or ''), isPassive, skillType, special))
end
end
for specIndex = 1, GetNumSpecializations() do
for tier = 1, MAX_TALENT_TIERS do
for column = 1, NUM_TALENT_COLUMNS do
local specName = select(2, GetSpecializationInfo(specIndex))
local talentID, name, texture, selected, available, spellID, unknown, row, column, known, grantedByAura = GetTalentInfoBySpecialization(specIndex, tier, column)
local isPassive = IsPassiveSpell(spellID) and "true" or "false"
tinsert(data, strjoin(";", "Talent", specName, name, isPassive, 'Tier ' .. row, "SPELL", spellID))
end
end
end
LibCopyPaste:Copy("Spells", table.concat(data, "\n"))
end
function Njor:PLAYER_ENTERING_WORLD()
PrintSpells()
end
Njor:RegisterEvent("PLAYER_ENTERING_WORLD")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment