Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions modules/classic_professions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@ local LibQTip = LibStub('LibQTip-1.0')
local L = LibStub('AceLocale-3.0'):GetLocale(addonName)
local options

local professionMapping = {
[171] = 'Alchemy',
[164] = 'Blacksmithing',
[333] = 'Enchanting',
[202] = 'Engineering',
[773] = 'Inscription',
[755] = 'Jewelcrafting',
[165] = 'Leatherworking',
[197] = 'Tailoring',
[182] = 'Herbalism',
[186] = 'Mining',
[393] = 'Skinning',
[185] = 'Cooking',
[356] = 'Fishing',
[129] = 'First Aid',
[794] = 'Archaeology'
}

local module = 'classic_professions'
local labelRows = {
profession1CDs = {
Expand Down Expand Up @@ -54,21 +72,18 @@ end
-- Need to rewrite most of this stuff. I hate the classic API
local function UpdateProfessions(charInfo)
charInfo.professions = charInfo.professions or {}

local professions = {}
local updated = false
for skillLine = 1, GetNumSkillLines() do
local name, _, _, skillRank, _, _, skillMaxRank, isProfession = GetSkillLineInfo(skillLine)
if isProfession then
if skillRank < skillMaxRank then
updated = true
end
tinsert(professions, {name = name, skillRank = skillRank, skillMaxRank = skillMaxRank})
end
end

local professions = {}
local updated = false
local prof1, prof2, _, _, _ = GetProfessions()
local professionsTemp = {prof1, prof2}
for _, professionIndex in ipairs(professionsTemp) do
local name, _, skillRank, skillMaxRank, _, _, skillLine, _, _, _ = GetProfessionInfo(professionIndex)
if skillRank < skillMaxRank then
updated = true
end
tinsert(professions, {name = professionMapping[skillLine], skillRank = skillRank, skillMaxRank = skillMaxRank})
end
charInfo.professions = professions

if updated then
PermoksAccountManager:SendCharacterUpdate('professions')
end
Expand Down