Thread Tools Display Modes
05-05-13, 12:15 PM   #1
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Jewelcrafting

Searching for the right gem realy sucks. I always know the stats I need but not the name of the gem. So GemHelper looks like a nice addon but its realy too much for my needs.

Cool woud be a namechange inside the original skill window. Instead of the gem name it shoud show the stats of the gem but the name is still searchable. Anyone know an addon like this or know if this is even possible?
Other idea woud be to show the gem tooltip on mouseover so you don't have to klick each gem to know the stats.

Woud look like the right one:
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
05-05-13, 01:41 PM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Code:
local disabled = true
local button

local tip = CreateFrame('GameTooltip', 'GemStatsTip')
local line1 = tip:CreateFontString()
local line2 = tip:CreateFontString()
local line3 = tip:CreateFontString()

tip:AddFontStrings(tip:CreateFontString(), tip:CreateFontString())
tip:AddFontStrings(line1, tip:CreateFontString())
tip:AddFontStrings(line2, tip:CreateFontString())
tip:AddFontStrings(line3, tip:CreateFontString())

local JEWELCRAFTING_S = GetSpellInfo(25229)
local GEM_S = '%+[0-9]+.*'

local match = string.match

local function GetGemStats(id)
	tip:SetOwner(WorldFrame, 'ANCHOR_NONE')
	tip:SetTradeSkillItem(id)

	if(tip:IsShown()) then
		return match(line1:GetText() or '', GEM_S) or match(line2:GetText() or '', GEM_S) or match(line3:GetText() or '', GEM_S)
	end
end

local function Update()
	if(GetTradeSkillLine() ~= JEWELCRAFTING_S) then
		if(button) then
			button:Hide()
		end

		return
	else
		button:Show()
	end

	if(not IsTradeSkillReady()) then return end
	if(disabled) then return end

	local filterBar = TradeSkillFilterBar:IsShown()
	for index = 1, TRADE_SKILLS_DISPLAYED, 1 do
		local buttonIndex = filterBar and index + 1 or index

		local button = _G['TradeSkillSkill' .. buttonIndex]
		if(button) then
			local stats = GetGemStats(button:GetID())
			if(stats) then
				_G['TradeSkillSkill' .. buttonIndex .. 'Text']:SetText(stats)
			end
		end
	end
end

local f = CreateFrame('Frame')
f:RegisterEvent('ADDON_LOADED')
f:SetScript('OnEvent', function(self, event, name)
	if(name == 'Blizzard_TradeSkillUI') then
		button = CreateFrame('Button', 'SomeRandomButton123', TradeSkillFrame, 'UIPanelButtonTemplate')
		button:SetPoint('TOPRIGHT', TradeSkillFrameCloseButton, 'TOPLEFT', 4, -6)
		button:SetSize(22, 20)
		button:SetText('J')
		button:SetScript('OnClick', function()
			disabled = not disabled
			TradeSkillFrame_Update()
		end)

		hooksecurefunc('TradeSkillFrame_Update', Update)
	end
end)


Keep in mind you have to change JEWELCRAFTING_S to whatever "Jewelcrafting" is in your locale.
And the search function doesn't see this, it still looks for the name.

Last edited by p3lim : 05-07-13 at 01:50 PM.
  Reply With Quote
05-05-13, 02:08 PM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Originally Posted by p3lim View Post
Keep in mind you have to change JEWELCRAFTING_S to whatever "Jewelcrafting" is in your locale.
Lua Code:
  1. local jewelcrafting = GetSpellInfo(755)
  Reply With Quote
05-05-13, 02:44 PM   #4
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
thank you both! But can't get this to work on german client :/
Can anyone post full lua file again?
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
05-05-13, 04:40 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
In p3lim's code, replace this:
Code:
local JEWELCRAFTING_S = 'Jewelcrafting'
with this:
Code:
local JEWELCRAFTING_S = GetSpellInfo(755)
If that still doesn't work, please be more specific about what isn't working in German, and make sure you have BugSack turned on to catch errors.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
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
05-05-13, 08:37 PM   #7
Stanzilla
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 34
Originally Posted by Phanx View Post
In p3lim's code, replace this:
Code:
local JEWELCRAFTING_S = 'Jewelcrafting'
with this:
Code:
local JEWELCRAFTING_S = GetSpellInfo(755)
If that still doesn't work, please be more specific about what isn't working in German, and make sure you have BugSack turned on to catch errors.
755 is Health Funnel, though. You want 25229.

Last edited by Stanzilla : 05-05-13 at 08:39 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Jewelcrafting


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off