Thread: Jewelcrafting
View Single Post
05-05-13, 05:04 PM   #6
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
It for me it not changing anything looks as if the addon is not there but is shown in the addon list. So this is the code how i cange it.

EDIT:
This is how the german tooltip looks like - maybe its different?


juwe.toc
Lua Code:
  1. ## Interface: 50200
  2. ## Notes: Jewelcrafting gems stats instead of names
  3. ## Version: 1.0
  4. ## Title: Juwe
  5. ## Author: p3lim
  6. juwe.lua

juwe.lua
Lua Code:
  1. local tip = CreateFrame('GameTooltip', 'GemStatsTip')
  2.     local line1 = tip:CreateFontString()
  3.     local line2 = tip:CreateFontString()
  4.     local line3 = tip:CreateFontString()
  5.      
  6.     tip:AddFontStrings(tip:CreateFontString(), tip:CreateFontString())
  7.     tip:AddFontStrings(line1, tip:CreateFontString())
  8.     tip:AddFontStrings(line2, tip:CreateFontString())
  9.     tip:AddFontStrings(line3, tip:CreateFontString())
  10.      
  11. local JEWELCRAFTING_S = GetSpellInfo(755)
  12.     local GEM_S = '%+[0-9]+.*'
  13.      
  14.     local match = string.match
  15.      
  16.     local function GetGemStats(id)
  17.         tip:SetOwner(WorldFrame, 'ANCHOR_NONE')
  18.         tip:SetTradeSkillItem(id)
  19.      
  20.         if(tip:IsShown()) then
  21.             return match(line1:GetText() or '', GEM_S) or match(line2:GetText() or '', GEM_S) or match(line3:GetText() or '', GEM_S)
  22.         end
  23.     end
  24.      
  25.     local function Update()
  26.         if(GetTradeSkillLine() ~= JEWELCRAFTING_S) then return end
  27.         if(not IsTradeSkillReady()) then return end
  28.      
  29.         local filterBar = TradeSkillFilterBar:IsShown()
  30.         for index = 1, TRADE_SKILLS_DISPLAYED, 1 do
  31.             local buttonIndex = filterBar and index + 1 or index
  32.      
  33.             local stats = GetGemStats(_G['TradeSkillSkill' .. buttonIndex]:GetID())
  34.             if(stats) then
  35.                 _G['TradeSkillSkill' .. buttonIndex .. 'Text']:SetText(stats)
  36.             end
  37.         end
  38.     end
  39.      
  40.     local f = CreateFrame('Frame')
  41.     f:RegisterEvent('ADDON_LOADED')
  42.     f:SetScript('OnEvent', function(self, event, name)
  43.         if(name == 'Blizzard_TradeSkillUI') then
  44.             hooksecurefunc('TradeSkillFrame_Update', Update)
  45.         end
  46.     end)
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________

Last edited by Tonyleila : 05-05-13 at 08:56 PM.
  Reply With Quote