Quantcast
Jewelcrafting - WoWInterface
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: 759
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,699
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,111
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: 759
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.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addon Turn any code into an addon More addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please dont PM me about addon bugs or code questions. Post a comment or forum thread instead!
  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: 759
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:33 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Read my last post and make the change I suggested. It's not a tooltip issue. Your code is still looking for the English tradeskill name "Jewelcrafting". You need to use GetSpellInfo instead.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addon Turn any code into an addon More addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please dont PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
05-05-13, 08:37 PM   #8
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
05-05-13, 09:01 PM   #9
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 759
Originally Posted by Stanzilla View Post
755 is Health Funnel, though. You want 25229.
Ahh that was it, Thanks

@ Phanx sorry posted the wrong code xD I made the edit you suggested but with the 755 as spell id

Looks realy cool now!
however now had this lua error

Code:
21x Juwe-1.0\juwe-1.0.lua:33: attempt to index field "?" (a nil value)
Juwe-1.0\juwe-1.0.lua:33: in function <Juwe\juwe.lua:25>
<in C code>
FrameXML\UIPanelTemplates.lua:354: in function "FauxScrollFrame_OnVerticalScroll"
<string>:"*:OnVerticalScroll":1: in function <string>:"*:OnVerticalScroll":1
<in C code>
<string>:"*:OnValueChanged":1: in function <string>:"*:OnValueChanged":1
<in C code>
Blizzard_TradeSkillUI\Blizzard_TradeSkillUI.lua:820: in function "TradeSkillUpdateFilterBar"
Blizzard_TradeSkillUI\Blizzard_TradeSkillUI.lua:861: in function "func"
FrameXML\UIDropDownMenu.lua:710: in function "UIDropDownMenuButton_OnClick"
<string>:"*:OnClick":1: in function <string>:"*:OnClick":1

Locals:
(*temporary) = <func> =[C]:-1
 = <func> =[C]:-1
 = <func> @Juwe\juwe.lua:25
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
05-05-13, 10:20 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Wrong spell ID was Myrroddin's fault.

As for the error, assuming the code you edited into your last post is your current actual code, that means that this line is causing the problem:

Code:
local stats = GetGemStats(_G['TradeSkillSkill' .. buttonIndex]:GetID())
Specifically, "TradeSkillSkillX", where X is the value of buttonIndex, could not be found in the global namespace. I don't have time right now to look into it in any greater detail or try it in-game, though.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addon Turn any code into an addon More addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please dont PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 05-05-13 at 10:29 PM.
  Reply With Quote
05-05-13, 10:39 PM   #11
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 759
Hmm I was not able to reproduce the error after it first appears but it I think it happend while show only skilling gems + only one frame was expended... I'll comment again if I see the error again
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
05-06-13, 09:42 AM   #12
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 759
OK just found out how to reproduce the error.
Make shure you don't have raw Jewelcrafting gems in your bag.
Look into guild roster and klick on "show all" at the Jewelcrafting.
Filter to only show gems where you have the mats, now if it shows nothing because you don't have mats the error will pop up:

Code:
10x Juwe-1.0\juwe-1.0.lua:33: attempt to index field "?" (a nil value)
Juwe-1.0\juwe-1.0.lua:33: in function <Juwe\juwe.lua:25>
<in C code>
Blizzard_TradeSkillUI\Blizzard_TradeSkillUI.lua:140: in function <Blizzard_TradeSkillUI\Blizzard_TradeSkillUI.lua:128>
<in C code>
<string>:"*:OnClick":1: in function <string>:"*:OnClick":1

Locals:
(*temporary) = <func> =[C]:-1
 = <func> =[C]:-1
 = <func> @Juwe\juwe.lua:25
Also Woud be cool to have a small button on the top left of the tradeskill window where I can disable the addon ingame without reloading - this woud e.g. help to search gems that you need for the Jewelcrafting quests.
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________

Last edited by Tonyleila : 05-06-13 at 09:55 AM.
  Reply With Quote
05-06-13, 10:55 AM   #13
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
This is kind of interesting. Is there any way to make this work for Skillet or ATSW?

Oh wait.... searches in skillets files... finds:

lua Code:
  1. --
  2. -- A hook to get text to append to the name of the recipe in the scrolling list of recipes
  3. -- If you hook this method, make sure to include any text you get from calling the hooked method.
  4. -- This will allow more than one mod to use the hook.
  5. --
  6. -- This will be called for both crafts and tradeskills, you can use Skillet:IsCraft()
  7. -- to determine if it's a craft. This avoid having to localize the tradeskill name just to
  8. -- see if it is a craft or a tradeskill.
  9. --
  10. -- Refer to the notes at the top of this file for how to hook this method.
  11. --
  12. -- @param tradeskill name of the currently selected tradeskill
  13. -- @param skill_index the index of the currently selected recipe
  14. --
  15. function Skillet:GetRecipeNameSuffix(tradeskill, skill_index)
  16. end
How can I find the item id using the profession skill index?

EDIT:
Found it, GameTooltip:SetHyperlink and GetTradeSkillItemLink

Last edited by ravagernl : 05-06-13 at 11:29 AM.
  Reply With Quote
05-07-13, 05:47 AM   #14
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 759
Any news on how to fix the error / add a button to disable addon ingame? Please woud love to update this with my UI!
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
05-07-13, 08:22 AM   #15
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,699
Edited my original post, try that.
  Reply With Quote
05-07-13, 11:20 AM   #16
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 759
Originally Posted by p3lim View Post
Edited my original post, try that.
Thanks that fixed the error! Only epic gems still show the normal names but thats OK for me.
Is there a button to disable addon if needed? Can't see it. Just the letter "J" on the top right next to the X button woud be perfect.
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
05-07-13, 01:50 PM   #17
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,699
Updated code
  Reply With Quote
05-07-13, 03:24 PM   #18
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 759
Originally Posted by p3lim View Post
Updated code
Thank you p3lim thats just perfect!
Just changed this a bit:
Code:
        button:SetPoint('TOPRIGHT', TradeSkillFrameCloseButton, 'TOPLEFT', -4, -1)
        button:SetSize(15, 15)
Will you upload it as addon here on wowUI? Or woud you mind if I upload it for you with you as the author credit?
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
05-07-13, 04:16 PM   #19
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,699
Do what ever you want with it.
  Reply With Quote
05-07-13, 06:05 PM   #20
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 759
Originally Posted by p3lim View Post
Do what ever you want with it.
Thanks uploaded!
http://www.wowinterface.com/download...adofNames.html
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote

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

Thread Tools
Display Modes

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