I could use some help with getting data for professions.
I've been hunting around and can not seem to find the right way to get this to work in classic (that is if it is even possible)
Here is the "Retail" code:
Code:
local proPlugin = CreateFrame('Button', nil, Datapanel)
proPlugin:RegisterEvent('PLAYER_ENTERING_WORLD')
proPlugin:SetFrameStrata('BACKGROUND')
proPlugin:SetFrameLevel(3)
proPlugin:EnableMouse(true)
proPlugin.tooltip = false
local Text = proPlugin:CreateFontString(nil, 'OVERLAY')
Text:SetFont(db.font, db.fontSize,'THINOUTLINE')
PlacePlugin(db.pro, Text)
local function Update(self)
Text:SetFormattedText(hexa.."Professions"..hexb)
self:SetAllPoints(Text)
end
proPlugin:SetScript('OnEnter', function()
local anchor, panel, xoff, yoff = DataTextTooltipAnchor(Text)
GameTooltip:SetOwner(panel, anchor, xoff, yoff)
GameTooltip:ClearLines()
GameTooltip:AddLine(hexa..PLAYER_NAME.."'s"..hexb.." Professions")
GameTooltip:AddLine' '
for i = 1, select("#", GetProfessions()) do
local v = select(i, GetProfessions());
if v ~= nil then
local name, texture, rank, maxRank = GetProfessionInfo(v)
GameTooltip:AddDoubleLine(name, rank..' / '..maxRank,.75,.9,1,.3,1,.3)
end
end
GameTooltip:AddLine' '
GameTooltip:AddLine("|cffeda55fLeft Click|r to Open Profession #1")
GameTooltip:AddLine("|cffeda55fMiddle Click|r to Open Spell Book")
GameTooltip:AddLine("|cffeda55fRight Click|r to Open Profession #2")
GameTooltip:Show()
end)
proPlugin:SetScript("OnClick",function(self,btn)
local prof1, prof2 = GetProfessions()
if btn == "LeftButton" then
if prof1 then
if(GetProfessionInfo(prof1) == ('Skinning')) then
CastSpellByName("Skinning Skills")
elseif(GetProfessionInfo(prof1) == ('Mining')) then
CastSpellByName("Mining Skills")
elseif(GetProfessionInfo(prof1) == ('Herbalism')) then
CastSpellByName("Herbalism Skills")
else
CastSpellByName((GetProfessionInfo(prof1)))
end
else
print('|cff33ff99BasicUI:|r |cffFF0000No Profession Found!|r')
end
elseif btn == 'MiddleButton' then
ToggleSpellBook(BOOKTYPE_PROFESSION)
elseif btn == "RightButton" then
if prof2 then
if(GetProfessionInfo(prof2) == ('Skinning')) then
CastSpellByName("Skinning Skills")
elseif(GetProfessionInfo(prof2) == ('Mining')) then
CastSpellByName("Mining Skills")
elseif(GetProfessionInfo(prof2) == ('Herbalism')) then
CastSpellByName("Herbalism Skills")
else
CastSpellByName((GetProfessionInfo(prof2)))
end
else
print('|cff33ff99BasicUI:|r |cffFF0000No Profession Found!|r')
end
end
end)
proPlugin:RegisterForClicks("AnyUp")
proPlugin:SetScript('OnUpdate', Update)
proPlugin:SetScript('OnLeave', function() GameTooltip:Hide() end)
Thanks for any help with this.
Coke