The hardest part would be determining what type of weapon you have equipped, which is not entirely hard it will just require work on your part. In its simplest form, this will work:
in the xml:
<GameTooltip name="WeaponSkillTooltip" inherits="GameTooltipTemplate" parent="UIParent" hidden="true"/>
in the lua:
function GetWeaponSkill(slot)
local equipped,skillname,cur_skill,mod_skill,max_skill,i
WeaponSkillTooltip:SetInventoryItem("player",slot)
equipped = WeaponSkillTooltipTextRight3:GetText()
for i=1,GetNumSkillLines() do skill,_,_,cur_skill,_,mod_skill,max_skill = GetSkillLineInfo(i)
skill = string.gsub(skill,"s$","")
if equipped==skill then i = GetNumSkillLines()
else cur_skill = nil
end
end
return cur_skill,mod_skill,max_skill
end
This will return the skill of the slot you give it if the name of the skill (minus any trailing S if there is one -- Dagger
s = Dagger) matches the name of the weapon type on the right of the third line of its tooltip. So it won't work for Staves. Staff != Stave
You will probably want to set up a table:
WeaponTypes = {
["Daggers"] = "Dagger",
["Staves"] = "Staff",
["Swords"] = "Sword",
-- etc
}
then something like
for i=1,GetNumSkillLines() do
skill,_,_,cur_skill,_,mod_skill,max_skill = GetSkillLineInfo(i)
for j=1,6 do if WeaponTypes[skill] and WeaponTypes[skill]==getglobal("WeaponSkillTooltipTextRight"..j):GetText() then i,j = GetNumSkillLines(),6 -- end loop
skill = nil
end
end
if skill then cur_skill = nil
end
return cur_skill,mod_skill,max_skill
end
to scan the right side of the tooltip for a matching weapon type and skill type.