|
|
|
@@ -28,407 +28,121 @@ local Characters = addon.Characters
|
|
|
|
|
local size = 22
|
|
|
|
|
local inset = 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ns:Update()
|
|
|
|
|
local VisibleLines = 20
|
|
|
|
|
local frame = "AltoholicFrameSkills"
|
|
|
|
|
local entry = frame.."Entry"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local DS = DataStore
|
|
|
|
|
|
|
|
|
|
local offset = FauxScrollFrame_GetOffset( _G[ frame.."ScrollFrame" ] );
|
|
|
|
|
local DisplayedCount = 0
|
|
|
|
|
local VisibleCount = 0
|
|
|
|
|
local DrawRealm
|
|
|
|
|
local i=1
|
|
|
|
|
-- CoA: vertical list. For each visible character a header row, then one row per known
|
|
|
|
|
-- profession / secondary skill (icon + name + rank/max), top to bottom (like the other detail views).
|
|
|
|
|
local SECONDARY = { 2550, 3273, 7733 } -- Cooking, First Aid, Fishing (spell id -> icon + GetSpellInfo name)
|
|
|
|
|
local items = {}
|
|
|
|
|
for _, viewLine in pairs(Characters:GetView()) do
|
|
|
|
|
if Characters:GetLineType(viewLine) == INFO_CHARACTER_LINE then
|
|
|
|
|
local character = DS:GetCharacter( Characters:GetInfo(viewLine) )
|
|
|
|
|
items[#items + 1] = { kind = "header", viewLine = viewLine, character = character }
|
|
|
|
|
|
|
|
|
|
for _, line in pairs(Characters:GetView()) do
|
|
|
|
|
local lineType = Characters:GetLineType(line)
|
|
|
|
|
local profs = Characters:GetField(viewLine, "professions")
|
|
|
|
|
if profs then
|
|
|
|
|
for _, p in ipairs(profs) do
|
|
|
|
|
items[#items + 1] = { kind = "skill", viewLine = viewLine, character = character,
|
|
|
|
|
spellID = p.spellID, name = p.name, rank = p.rank or 0, maxRank = p.maxRank or 0 }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
for _, sid in ipairs(SECONDARY) do
|
|
|
|
|
local sName = GetSpellInfo(sid)
|
|
|
|
|
if sName then
|
|
|
|
|
local cur, max = DS:GetSkillInfo(character, sName)
|
|
|
|
|
if cur and cur > 0 then
|
|
|
|
|
items[#items + 1] = { kind = "skill", viewLine = viewLine, character = character,
|
|
|
|
|
spellID = sid, name = sName, rank = cur, maxRank = max or 0 }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local riding = Characters:GetField(viewLine, "riding") or 0
|
|
|
|
|
if riding > 0 then
|
|
|
|
|
items[#items + 1] = { kind = "skill", viewLine = viewLine, character = character,
|
|
|
|
|
spellID = 33388, name = (L and L["Riding"]) or "Riding", rank = riding, maxRank = 300 }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if (offset > 0) or (DisplayedCount >= VisibleLines) then -- if the line will not be visible
|
|
|
|
|
if lineType == INFO_REALM_LINE then -- then keep track of counters
|
|
|
|
|
if Characters:GetField(line, "isCollapsed") == false then
|
|
|
|
|
DrawRealm = true
|
|
|
|
|
local offset = FauxScrollFrame_GetOffset( _G[ frame.."ScrollFrame" ] )
|
|
|
|
|
for i = 1, VisibleLines do
|
|
|
|
|
local e = entry..i
|
|
|
|
|
local btn = _G[e]
|
|
|
|
|
local item = items[i + offset]
|
|
|
|
|
if item then
|
|
|
|
|
_G[e.."Collapse"]:Hide()
|
|
|
|
|
_G[e.."Skill1NormalText"]:SetText("")
|
|
|
|
|
_G[e.."CookingNormalText"]:SetText("")
|
|
|
|
|
_G[e.."FirstAidNormalText"]:SetText("")
|
|
|
|
|
_G[e.."FishingNormalText"]:SetText("")
|
|
|
|
|
_G[e.."RidingNormalText"]:SetText("")
|
|
|
|
|
|
|
|
|
|
if item.kind == "header" then
|
|
|
|
|
-- character header: colored name + (class) across the row, no rank column
|
|
|
|
|
_G[e.."Name"]:SetPoint("TOPLEFT", 15, 0)
|
|
|
|
|
_G[e.."Name"]:SetWidth(420)
|
|
|
|
|
_G[e.."NameNormalText"]:SetWidth(420)
|
|
|
|
|
local locClass, engClass = DS:GetCharacterClass(item.character)
|
|
|
|
|
local className = Altoholic:GetCoAClassName(engClass) or locClass or "" -- CoA: PROPHET->Venomancer, MONK->Templar, …
|
|
|
|
|
_G[e.."NameNormalText"]:SetText( (DS:GetColoredCharacterName(item.character) or "?") .. " " .. WHITE .. "(" .. className .. ")" )
|
|
|
|
|
_G[e.."Level"]:SetText("")
|
|
|
|
|
else
|
|
|
|
|
DrawRealm = false
|
|
|
|
|
-- profession row: [icon] name in the Name cell (indented), rank/max in its own column
|
|
|
|
|
local iconEsc = ""
|
|
|
|
|
if item.spellID then
|
|
|
|
|
iconEsc = addon:TextureToFontstring2(addon:GetSpellIcon(item.spellID), size, size, inset, inset, inset, inset) .. " "
|
|
|
|
|
end
|
|
|
|
|
VisibleCount = VisibleCount + 1
|
|
|
|
|
offset = offset - 1 -- no further control, nevermind if it goes negative
|
|
|
|
|
elseif DrawRealm then
|
|
|
|
|
VisibleCount = VisibleCount + 1
|
|
|
|
|
offset = offset - 1 -- no further control, nevermind if it goes negative
|
|
|
|
|
end
|
|
|
|
|
else -- line will be displayed
|
|
|
|
|
if lineType == INFO_REALM_LINE then
|
|
|
|
|
local _, realm, account = Characters:GetInfo(line)
|
|
|
|
|
_G[e.."Name"]:SetPoint("TOPLEFT", 38, 0)
|
|
|
|
|
_G[e.."Name"]:SetWidth(200)
|
|
|
|
|
_G[e.."NameNormalText"]:SetWidth(200)
|
|
|
|
|
_G[e.."NameNormalText"]:SetText( iconEsc .. WHITE .. item.name )
|
|
|
|
|
|
|
|
|
|
if Characters:GetField(line, "isCollapsed") == false then
|
|
|
|
|
_G[ entry..i.."Collapse" ]:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up");
|
|
|
|
|
DrawRealm = true
|
|
|
|
|
local cap = (item.maxRank > 0) and item.maxRank or 450
|
|
|
|
|
_G[e.."Level"]:SetPoint("TOPLEFT", 250, 0)
|
|
|
|
|
_G[e.."Level"]:SetWidth(120)
|
|
|
|
|
_G[e.."Level"]:SetJustifyH("LEFT")
|
|
|
|
|
_G[e.."Level"]:SetText( ns:GetColor(item.rank, cap) .. item.rank .. " / " .. item.maxRank )
|
|
|
|
|
end
|
|
|
|
|
btn.coaItem = item
|
|
|
|
|
btn:SetID(item.viewLine or 0)
|
|
|
|
|
btn:Show()
|
|
|
|
|
else
|
|
|
|
|
_G[ entry..i.."Collapse" ]:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up");
|
|
|
|
|
DrawRealm = false
|
|
|
|
|
end
|
|
|
|
|
_G[entry..i.."Collapse"]:Show()
|
|
|
|
|
_G[entry..i.."Name"]:SetWidth(300)
|
|
|
|
|
_G[entry..i.."Name"]:SetPoint("TOPLEFT", 25, 0)
|
|
|
|
|
_G[entry..i.."NameNormalText"]:SetWidth(300)
|
|
|
|
|
if account == "Default" then -- saved as default, display as localized.
|
|
|
|
|
_G[entry..i.."NameNormalText"]:SetText(format("%s (%s".. L["Account"]..": %s%s|r)", realm, WHITE, GREEN, L["Default"]))
|
|
|
|
|
else
|
|
|
|
|
local last = addon:GetLastAccountSharingInfo(realm, account)
|
|
|
|
|
_G[entry..i.."NameNormalText"]:SetText(format("%s (%s".. L["Account"]..": %s%s %s%s|r)", realm, WHITE, GREEN, account, YELLOW, last or ""))
|
|
|
|
|
end
|
|
|
|
|
_G[entry..i.."Level"]:SetText("")
|
|
|
|
|
_G[entry..i.."Skill1NormalText"]:SetText("")
|
|
|
|
|
_G[entry..i.."CookingNormalText"]:SetText("")
|
|
|
|
|
_G[entry..i.."FirstAidNormalText"]:SetText("")
|
|
|
|
|
_G[entry..i.."FishingNormalText"]:SetText("")
|
|
|
|
|
_G[entry..i.."RidingNormalText"]:SetText("")
|
|
|
|
|
|
|
|
|
|
_G[ entry..i ]:SetID(line)
|
|
|
|
|
_G[ entry..i ]:Show()
|
|
|
|
|
i = i + 1
|
|
|
|
|
VisibleCount = VisibleCount + 1
|
|
|
|
|
DisplayedCount = DisplayedCount + 1
|
|
|
|
|
elseif DrawRealm then
|
|
|
|
|
if (lineType == INFO_CHARACTER_LINE) then
|
|
|
|
|
local character = DS:GetCharacter( Characters:GetInfo(line) )
|
|
|
|
|
|
|
|
|
|
local icon
|
|
|
|
|
if DS:GetCharacterFaction(character) == "Alliance" then
|
|
|
|
|
-- icon = addon:TextureToFontstring(ICON_FACTION_ALLIANCE, size, size) .. " "
|
|
|
|
|
icon = addon:TextureToFontstring2(ICON_FACTION_ALLIANCE, size, size, inset, inset, inset, inset) .. " "
|
|
|
|
|
else
|
|
|
|
|
-- icon = addon:TextureToFontstring(ICON_FACTION_HORDE, size, size) .. " "
|
|
|
|
|
icon = addon:TextureToFontstring2(ICON_FACTION_HORDE, size, size, inset, inset, inset, inset) .. " "
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
_G[entry..i.."Collapse"]:Hide()
|
|
|
|
|
_G[entry..i.."Name"]:SetWidth(170)
|
|
|
|
|
_G[entry..i.."Name"]:SetPoint("TOPLEFT", 10, 0)
|
|
|
|
|
_G[entry..i.."NameNormalText"]:SetWidth(170)
|
|
|
|
|
addon:SetCharacterRowNameLevel(entry, i, icon, character)
|
|
|
|
|
|
|
|
|
|
-- CoA: render ALL primary professions the character knows into the
|
|
|
|
|
-- single wide Professions cell, as a row of icon+rank segments.
|
|
|
|
|
-- The list is precomputed in Characters.lua (field "professions")
|
|
|
|
|
-- and may be empty (unscanned char) -> cell renders blank. Every
|
|
|
|
|
-- value is guarded with "or 0" before GetColor/concat.
|
|
|
|
|
local professions = Characters:GetField(line, "professions")
|
|
|
|
|
local profText = ""
|
|
|
|
|
if professions then
|
|
|
|
|
for idx, p in ipairs(professions) do
|
|
|
|
|
if idx > 6 then profText = profText .. YELLOW .. "+" .. (#professions - 6) .. "|r"; break end -- CoA: cap inline profs so the strip fits its 325px cell
|
|
|
|
|
local rank = p.rank or 0
|
|
|
|
|
local profIcon = ""
|
|
|
|
|
if p.spellID then
|
|
|
|
|
profIcon = addon:TextureToFontstring2(addon:GetSpellIcon(p.spellID), size, size, inset, inset, inset, inset) .. " "
|
|
|
|
|
end
|
|
|
|
|
profText = profText .. profIcon .. ns:GetColor(rank) .. rank .. "|r "
|
|
|
|
|
btn.coaItem = nil
|
|
|
|
|
btn:SetID(0)
|
|
|
|
|
btn:Hide()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
_G[entry..i.."Skill1NormalText"]:SetText(profText)
|
|
|
|
|
|
|
|
|
|
local field
|
|
|
|
|
-- cooking
|
|
|
|
|
-- icon = addon:TextureToFontstring(addon:GetSpellIcon(2550), size, size) .. " "
|
|
|
|
|
icon = addon:TextureToFontstring2(addon:GetSpellIcon(2550), size, size, inset, inset, inset, inset) .. " "
|
|
|
|
|
field = Characters:GetField(line, "cooking") or 0
|
|
|
|
|
_G[entry..i.."CookingNormalText"]:SetText(icon .. ns:GetColor(field) .. field)
|
|
|
|
|
|
|
|
|
|
-- first aid
|
|
|
|
|
-- icon = addon:TextureToFontstring(addon:GetSpellIcon(3273), size, size) .. " "
|
|
|
|
|
icon = addon:TextureToFontstring2(addon:GetSpellIcon(3273), size, size, inset, inset, inset, inset) .. " "
|
|
|
|
|
field = Characters:GetField(line, "firstaid") or 0
|
|
|
|
|
_G[entry..i.."FirstAidNormalText"]:SetText(icon .. ns:GetColor(field) .. field)
|
|
|
|
|
|
|
|
|
|
-- fishing
|
|
|
|
|
-- icon = addon:TextureToFontstring(addon:GetSpellIcon(7733), size, size) .. " "
|
|
|
|
|
icon = addon:TextureToFontstring2(addon:GetSpellIcon(7733), size, size, inset, inset, inset, inset) .. " "
|
|
|
|
|
field = Characters:GetField(line, "fishing") or 0
|
|
|
|
|
_G[entry..i.."FishingNormalText"]:SetText(icon .. ns:GetColor(field) .. field)
|
|
|
|
|
|
|
|
|
|
-- riding
|
|
|
|
|
field = Characters:GetField(line, "riding") or 0
|
|
|
|
|
if field >= 300 then
|
|
|
|
|
-- icon = addon:TextureToFontstring("Interface\\Icons\\Ability_Mount_Gryphon_01", size, size) .. " "
|
|
|
|
|
icon = addon:TextureToFontstring2("Interface\\Icons\\ability_mount_drake_bronze", size, size, inset, inset, inset, inset)
|
|
|
|
|
|
|
|
|
|
for _,spId in pairs({63956, 63963, 60024, 72808, 72807, 63796, 40192, 69395, 60021, 59976, 64927, 67336, 65439, 49193, 71810, 44317, 44744, 58615, 37015, 3363, 32345}) do
|
|
|
|
|
-- IsPetKnown(character, companionType, spellID)
|
|
|
|
|
if DS:IsPetKnown(character, "MOUNT", spId) then
|
|
|
|
|
icon = addon:TextureToFontstring2("Interface\\Icons\\inv_misc_enggizmos_03", size, size, inset, inset, inset, inset)
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif field >= 225 then
|
|
|
|
|
icon = addon:TextureToFontstring2("Interface\\Icons\\ability_mount_goldengryphon", size, size, inset, inset, inset, inset)
|
|
|
|
|
elseif field >= 150 then
|
|
|
|
|
icon = addon:TextureToFontstring2("Interface\\Icons\\ability_mount_charger", size, size, inset, inset, inset, inset)
|
|
|
|
|
elseif field >= 75 then
|
|
|
|
|
icon = addon:TextureToFontstring2("Interface\\Icons\\spell_nature_swiftness", size, size, inset, inset, inset, inset)
|
|
|
|
|
else
|
|
|
|
|
icon = addon:TextureToFontstring2("Interface\\Icons\\inv_boots_03", size, size, inset, inset, inset, inset)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if DS:IsSpellKnown(character, 54197) then -- KNOWS [Cold Weather Flying]
|
|
|
|
|
-- Interface\Icons\Spell_Frost_FrostShock
|
|
|
|
|
-- icon = addon:TextureToFontstring(addon:GetSpellIcon(54197), size, size) .. " "
|
|
|
|
|
-- TextureToFontstringHalfSquare(name, side, inset, isRight)
|
|
|
|
|
-- icon = addon:TextureToFontstringHalfSquare(addon:GetSpellIcon(54197), size, inset, true) .. " "
|
|
|
|
|
-- icon = icon .. addon:TextureToFontstringHalfSquare(addon:GetSpellIcon(54197), size, inset, 0.7, 1.0) .. " "
|
|
|
|
|
|
|
|
|
|
-- TextureToFontstringCut(name, heightOrig, widthOrig, insetLeft, insetRight, insetTop, insetBottom)
|
|
|
|
|
-- local sTemp = size+2*inset
|
|
|
|
|
-- icon = icon .. addon:TextureToFontstringCut(addon:GetSpellIcon(54197), sTemp, sTemp, floor(0.7*sTemp), floor(0.1*sTemp), inset, inset) .. " "
|
|
|
|
|
icon = addon:TextureToFontstring(addon:GetSpellIcon(54197), size, size) .. " " .. icon .. " "
|
|
|
|
|
|
|
|
|
|
else -- DOES NOT KNOW [Cold Weather Flying]
|
|
|
|
|
icon = format("|T%s:%s:%s:0:0:%s:%s:%s:%s:%s:%s|t", addon:GetSpellIcon(54197), size, size, size, size, 0, 0, 0, 0) .. " " .. icon .. " "
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
_G[entry..i.."RidingNormalText"]:SetText(icon .. ns:GetColor(field, 300) .. field)
|
|
|
|
|
elseif (lineType == INFO_TOTAL_LINE) then
|
|
|
|
|
_G[entry..i.."Collapse"]:Hide()
|
|
|
|
|
_G[entry..i.."Name"]:SetWidth(200)
|
|
|
|
|
_G[entry..i.."Name"]:SetPoint("TOPLEFT", 15, 0)
|
|
|
|
|
_G[entry..i.."NameNormalText"]:SetWidth(200)
|
|
|
|
|
_G[entry..i.."NameNormalText"]:SetText(L["Totals"])
|
|
|
|
|
_G[entry..i.."Level"]:SetText(Characters:GetField(line, "level"))
|
|
|
|
|
_G[entry..i.."Skill1NormalText"]:SetText("")
|
|
|
|
|
_G[entry..i.."CookingNormalText"]:SetText("")
|
|
|
|
|
_G[entry..i.."FirstAidNormalText"]:SetText("")
|
|
|
|
|
_G[entry..i.."FishingNormalText"]:SetText("")
|
|
|
|
|
_G[entry..i.."RidingNormalText"]:SetText("")
|
|
|
|
|
end
|
|
|
|
|
_G[ entry..i ]:SetID(line)
|
|
|
|
|
_G[ entry..i ]:Show()
|
|
|
|
|
i = i + 1
|
|
|
|
|
VisibleCount = VisibleCount + 1
|
|
|
|
|
DisplayedCount = DisplayedCount + 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
while i <= VisibleLines do
|
|
|
|
|
_G[ entry..i ]:SetID(0)
|
|
|
|
|
_G[ entry..i ]:Hide()
|
|
|
|
|
i = i + 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
FauxScrollFrame_Update( _G[ frame.."ScrollFrame" ], VisibleCount, VisibleLines, 18);
|
|
|
|
|
FauxScrollFrame_Update( _G[ frame.."ScrollFrame" ], #items, VisibleLines, 18 )
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ns:OnEnter(frame)
|
|
|
|
|
local line = frame:GetParent():GetID()
|
|
|
|
|
local lineType = Characters:GetLineType(line)
|
|
|
|
|
if lineType ~= INFO_CHARACTER_LINE then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local id = frame:GetID()
|
|
|
|
|
local skillName, rank, suggestion
|
|
|
|
|
|
|
|
|
|
local DS = DataStore
|
|
|
|
|
local character = DS:GetCharacter(Characters:GetInfo(line))
|
|
|
|
|
|
|
|
|
|
-- CoA: id 1 is now the combined "Professions" cell -> list every known primary
|
|
|
|
|
-- profession with rank/max and recipe counts in a single tooltip.
|
|
|
|
|
if id == 1 then
|
|
|
|
|
local professions = Characters:GetField(line, "professions")
|
|
|
|
|
local item = frame:GetParent() and frame:GetParent().coaItem
|
|
|
|
|
if not item or item.kind ~= "skill" then return end
|
|
|
|
|
AltoTooltip:ClearLines()
|
|
|
|
|
AltoTooltip:SetOwner(frame, "ANCHOR_RIGHT")
|
|
|
|
|
AltoTooltip:AddLine(L["Professions"] or "Professions", 1, 1, 1)
|
|
|
|
|
if not professions or #professions == 0 then
|
|
|
|
|
AltoTooltip:AddLine(L["No data"])
|
|
|
|
|
AltoTooltip:AddLine(WHITE .. item.name, 1, 1, 1)
|
|
|
|
|
local cap = (item.maxRank > 0) and item.maxRank or 450
|
|
|
|
|
AltoTooltip:AddLine( ns:GetColor(item.rank, cap) .. item.rank .. " / " .. item.maxRank, 1, 1, 1 )
|
|
|
|
|
AltoTooltip:Show()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
for _, p in ipairs(professions) do
|
|
|
|
|
local pName = p.name
|
|
|
|
|
local curRank, maxRank = DS:GetSkillInfo(character, pName)
|
|
|
|
|
curRank, maxRank = curRank or 0, maxRank or 0
|
|
|
|
|
local rankText = ns:GetColor(curRank) .. curRank .. "/" .. maxRank
|
|
|
|
|
local recipeText = ""
|
|
|
|
|
local prof = DS:GetProfession(character, pName)
|
|
|
|
|
if prof and DS:GetNumCraftLines(prof) > 0 then
|
|
|
|
|
local orange, yellow, green, grey = DS:GetNumRecipesByColor(prof)
|
|
|
|
|
recipeText = WHITE .. " (" .. (orange + yellow + green + grey) .. " " .. TRADESKILL_SERVICE_LEARN .. ")"
|
|
|
|
|
end
|
|
|
|
|
-- localized display name where possible
|
|
|
|
|
local displayName = pName
|
|
|
|
|
local spellID = DS:GetProfessionSpellID(pName)
|
|
|
|
|
if spellID then
|
|
|
|
|
displayName = GetSpellInfo(spellID) or pName
|
|
|
|
|
end
|
|
|
|
|
AltoTooltip:AddDoubleLine(WHITE .. displayName, rankText .. recipeText)
|
|
|
|
|
end
|
|
|
|
|
AltoTooltip:Show()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if id == 3 then
|
|
|
|
|
skillName = GetSpellInfo(2550) -- cooking
|
|
|
|
|
elseif id == 4 then
|
|
|
|
|
skillName = GetSpellInfo(3273) -- First Aid
|
|
|
|
|
elseif id == 5 then
|
|
|
|
|
skillName = GetSpellInfo(24303) -- Fishing
|
|
|
|
|
elseif id == 6 then
|
|
|
|
|
skillName = L["Riding"]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local curRank, maxRank = DS:GetSkillInfo(character, skillName)
|
|
|
|
|
curRank, maxRank = curRank or 0, maxRank or 0 -- CoA: getter returns no value for skills DataStore_Skills hasn't scanned
|
|
|
|
|
local profession = DS:GetProfession(character, skillName)
|
|
|
|
|
|
|
|
|
|
if (id >= 3) and (id <= 6) then
|
|
|
|
|
if id == 6 then -- riding
|
|
|
|
|
rank = ns:GetColor(curRank, 300) .. curRank .. "/" .. maxRank
|
|
|
|
|
else
|
|
|
|
|
rank = ns:GetColor(curRank) .. curRank .. "/" .. maxRank
|
|
|
|
|
end
|
|
|
|
|
suggestion = addon:GetSuggestion(skillName, curRank)
|
|
|
|
|
elseif id == 7 then -- class
|
|
|
|
|
local _, class = DS:GetCharacterClass(character)
|
|
|
|
|
if class ~= "ROGUE" then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
skillName = L["Rogue Proficiencies"]
|
|
|
|
|
|
|
|
|
|
local curLock, maxLock = DS:GetSkillInfo(character, L["Lockpicking"])
|
|
|
|
|
curLock, maxLock = curLock or 0, maxLock or 0 -- CoA: guard unscanned lockpicking
|
|
|
|
|
rank = TEAL .. L["Lockpicking"] .. " " .. curLock .. "/" .. maxLock
|
|
|
|
|
suggestion = addon:GetSuggestion(L["Lockpicking"], curLock)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
AltoTooltip:ClearLines();
|
|
|
|
|
AltoTooltip:SetOwner(frame, "ANCHOR_RIGHT");
|
|
|
|
|
AltoTooltip:AddLine(skillName,1,1,1);
|
|
|
|
|
AltoTooltip:AddLine(GREEN..rank,1,1,1);
|
|
|
|
|
|
|
|
|
|
if (id == 3) or (id == 4) then -- crafting secondary skills (Cooking, First Aid); skips fishing/riding
|
|
|
|
|
if skillName ~= GetSpellInfo(13614) and skillName ~= GetSpellInfo(8613) then -- no display for herbalism & skinning
|
|
|
|
|
AltoTooltip:AddLine(" ");
|
|
|
|
|
|
|
|
|
|
if not profession then
|
|
|
|
|
AltoTooltip:AddLine(L["No data"]);
|
|
|
|
|
AltoTooltip:Show();
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if DS:GetNumCraftLines(profession) == 0 then
|
|
|
|
|
AltoTooltip:AddLine(L["No data"].. ": 0 " .. TRADESKILL_SERVICE_LEARN,1,1,1);
|
|
|
|
|
else
|
|
|
|
|
local orange, yellow, green, grey = DS:GetNumRecipesByColor(profession)
|
|
|
|
|
|
|
|
|
|
AltoTooltip:AddLine(orange+yellow+green+grey .. " " .. TRADESKILL_SERVICE_LEARN,1,1,1);
|
|
|
|
|
AltoTooltip:AddLine(format(WHITE .. "%d " .. RECIPE_GREEN .. "Green|r /"
|
|
|
|
|
.. WHITE .. " %d " .. YELLOW .. "Yellow|r /"
|
|
|
|
|
.. WHITE .. " %d " .. RECIPE_ORANGE .. "Orange",
|
|
|
|
|
green, yellow, orange))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local skillCap = 450
|
|
|
|
|
if id == 6 then
|
|
|
|
|
skillCap = 300
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
AltoTooltip:AddLine(" ");
|
|
|
|
|
AltoTooltip:AddLine(RECIPE_GREY .. L["Grey"] .. "|r " .. L["up to"] .. " " .. (floor(skillCap*0.25)-1),1,1,1);
|
|
|
|
|
AltoTooltip:AddLine(RED .. RED_GEM .. "|r " .. L["up to"] .. " " .. (floor(skillCap*0.50)-1),1,1,1);
|
|
|
|
|
AltoTooltip:AddLine(ORANGE .. BI["Orange"] .. "|r " .. L["up to"] .. " " .. (floor(skillCap*0.75)-1),1,1,1);
|
|
|
|
|
AltoTooltip:AddLine(YELLOW .. YELLOW_GEM .. "|r " .. L["up to"] .. " " .. (skillCap-1),1,1,1);
|
|
|
|
|
AltoTooltip:AddLine(GREEN .. BI["Green"] .. "|r " .. L["at"] .. " "..skillCap.." " .. L["and above"],1,1,1);
|
|
|
|
|
|
|
|
|
|
if suggestion then
|
|
|
|
|
AltoTooltip:AddLine(" ",1,1,1);
|
|
|
|
|
AltoTooltip:AddLine(L["Suggestion"] .. ": ",1,1,1);
|
|
|
|
|
AltoTooltip:AddLine(TEAL .. suggestion,1,1,1);
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- parse profession cooldowns
|
|
|
|
|
if id ~= 7 and profession then
|
|
|
|
|
DS:ClearExpiredCooldowns(profession)
|
|
|
|
|
local numCooldows = DS:GetNumActiveCooldowns(profession)
|
|
|
|
|
|
|
|
|
|
if numCooldows == 0 then
|
|
|
|
|
AltoTooltip:AddLine(" ",1,1,1);
|
|
|
|
|
AltoTooltip:AddLine(L["All cooldowns are up"],1,1,1);
|
|
|
|
|
else
|
|
|
|
|
AltoTooltip:AddLine(" ",1,1,1);
|
|
|
|
|
for i = 1, numCooldows do
|
|
|
|
|
local craftName, expiresIn = DS:GetCraftCooldownInfo(profession, i)
|
|
|
|
|
AltoTooltip:AddDoubleLine(craftName, addon:GetTimeString(expiresIn));
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
AltoTooltip:Show();
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local VIEW_MOUNTS = 8
|
|
|
|
|
|
|
|
|
|
function ns:OnClick(frame, button)
|
|
|
|
|
local line = frame:GetParent():GetID()
|
|
|
|
|
local lineType = Characters:GetLineType(line)
|
|
|
|
|
if lineType ~= INFO_CHARACTER_LINE then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local id = frame:GetID()
|
|
|
|
|
if id == 5 then return end -- fishing ? do nothing
|
|
|
|
|
|
|
|
|
|
addon:SetCurrentCharacter( Characters:GetInfo(line) )
|
|
|
|
|
|
|
|
|
|
local skillName
|
|
|
|
|
if id == 1 then
|
|
|
|
|
-- CoA: id 1 is the combined Professions cell. A single click can't pick one
|
|
|
|
|
-- of several professions, so default to the first known primary profession
|
|
|
|
|
-- (opens its recipes / supplies its trade link on shift-click).
|
|
|
|
|
local professions = Characters:GetField(line, "professions")
|
|
|
|
|
if professions and professions[1] then
|
|
|
|
|
skillName = professions[1].name
|
|
|
|
|
end
|
|
|
|
|
elseif id == 3 then
|
|
|
|
|
skillName = GetSpellInfo(2550) -- cooking
|
|
|
|
|
elseif id == 4 then
|
|
|
|
|
skillName = GetSpellInfo(3273) -- First Aid
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local DS = DataStore
|
|
|
|
|
local character = DS:GetCharacter(Characters:GetInfo(line))
|
|
|
|
|
local profession = DS:GetProfession(character, skillName)
|
|
|
|
|
|
|
|
|
|
if skillName then
|
|
|
|
|
if not profession or DS:GetNumCraftLines(profession) == 0 then -- if profession hasn't been scanned (or scan failed), exit
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local charName, realm, account = addon:GetCurrentCharacter()
|
|
|
|
|
local chat = ChatEdit_GetLastActiveWindow()
|
|
|
|
|
|
|
|
|
|
if chat:IsShown() and IsShiftKeyDown() and realm == GetRealmName() and id ~= 6 then
|
|
|
|
|
-- if shift-click, then display the profession link and exit
|
|
|
|
|
local link = profession.FullLink
|
|
|
|
|
if link and link:match("trade:") then
|
|
|
|
|
chat:Insert(link);
|
|
|
|
|
end
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
addon.Tabs.Characters:SetCurrent(charName, realm, account)
|
|
|
|
|
-- CoA: clicking a profession row opens that character's profession recipe list, if available.
|
|
|
|
|
local item = frame:GetParent() and frame:GetParent().coaItem
|
|
|
|
|
if not item or item.kind ~= "skill" or not item.character then return end
|
|
|
|
|
if addon.Tabs and addon.Tabs.Characters and addon.Tabs.Characters.ViewCharInfo then
|
|
|
|
|
local name, realm, account = Characters:GetInfo(item.viewLine)
|
|
|
|
|
addon:SetCurrentCharacter(name, realm, account)
|
|
|
|
|
addon.Tabs.Characters:SetCurrent(name, realm, account)
|
|
|
|
|
addon.Tabs:OnClick(2)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if id == 6 then
|
|
|
|
|
addon.Tabs.Characters:ViewCharInfo(VIEW_MOUNTS)
|
|
|
|
|
else
|
|
|
|
|
addon.Tabs.Characters:ViewRecipes(skillName)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local skillColors = { RECIPE_GREY, RED, ORANGE, YELLOW, GREEN }
|
|
|
|
|
|
|
|
|
@@ -443,3 +157,4 @@ function ns:GetColor(rank, skillCap)
|
|
|
|
|
if index > #skillColors then index = #skillColors end
|
|
|
|
|
return skillColors[index]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|