changeset 98:b980c00affcd

Added a button to cast a campfire I got a problem with newlines and merging with a non-Mercurial repository, I hope noting broke...
author contrebasse
date Fri, 20 May 2011 18:32:43 +0200
parents 61439697f8c5
children 0fd1fd1ba2d9
files CampFireButton.lua EnchantOnScroll.lua ProspectingData.lua ReagentMaker.lua ReagentMaker.toc data.lua localization.lua
diffstat 7 files changed, 755 insertions(+), 659 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CampFireButton.lua	Fri May 20 18:32:43 2011 +0200
@@ -0,0 +1,57 @@
+local addonName, A = ...
+
+local CAMPFIRE_ID = 818
+local COOKING_ID = 2550
+local btn
+local cookingName
+
+-- Create button
+function A.InitialiseCampFireBtn()
+	-- create the frame
+	btn = CreateFrame("Button", nil, TradeSkillFrame, "SecureActionButtonTemplate")
+	btn:SetNormalTexture(select(3,GetSpellInfo(CAMPFIRE_ID)))
+	btn:SetSize(24,24)
+	btn:SetPoint("BOTTOMRIGHT",TradeSkillFrame,"BOTTOMRIGHT",-10,179)
+
+	-- Set the action
+	btn:SetAttribute("type", "spell")
+	btn:SetAttribute("spell", CAMPFIRE_ID)
+
+	-- Set the tooltip
+	btn:SetScript("OnEnter",function(self)
+		GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
+		GameTooltip:SetSpellByID(CAMPFIRE_ID)
+		GameTooltip:Show()
+	end)
+	btn:SetScript("OnLeave",function() GameTooltip:Hide(); end)
+
+	-- Add cooldown
+	btn.cooldown = CreateFrame("Cooldown",nil,btn)
+	btn.cooldown:SetAllPoints(btn)
+	local CooldownFrame_SetTimer = CooldownFrame_SetTimer
+	local GetSpellCooldown = GetSpellCooldown
+	btn:SetScript("OnUpdate",function(self) CooldownFrame_SetTimer(self.cooldown,GetSpellCooldown(CAMPFIRE_ID)); end)
+
+	-- Save info
+	cookingName = GetSpellInfo(COOKING_ID)
+	
+	-- Show if needed
+	A.ManageCampFireBtn()
+end
+
+-- Hide button
+function A.HideCampFireBtn()
+	btn:Hide()
+end
+
+-- Show button if applicable
+function A.ManageCampFireBtn()
+	if not btn then return end
+	-- Display only if the tradeskill is Cooking
+	local tradeskillName = GetTradeSkillLine()
+	if tradeskillName ~= cookingName then
+		btn:Hide()
+	else
+		btn:Show()
+	end
+end
--- a/EnchantOnScroll.lua	Fri May 20 00:54:15 2011 +0200
+++ b/EnchantOnScroll.lua	Fri May 20 18:32:43 2011 +0200
@@ -1,71 +1,71 @@
-local addonName, A = ...
-
-local SCROLL_ID = 38682
-local ENCHANTING_ID = 7411
-local btn
-
-local EventsFrame = CreateFrame("Frame",nil,TradeSkillFrame) -- It will be hidden with the TradeSkillFrame
-
-local function CheckButtonAvailable(arg1)
-	if not btn then return end
-
-	-- Do not manage guild tradeskill
-	-- Check that we're still with the enchanting tradeskill
-	if IsTradeSkillGuild() or IsTradeSkillLinked() or GetTradeSkillLine() ~= GetSpellInfo(ENCHANTING_ID) then
-		btn:Hide()
-		return
-	end
-
-	-- Check that the selected recipe can be crafted, and the crafted thing is an enchant
-	local index = GetTradeSkillSelectionIndex()
-	if not index then
-		btn:Hide()
-		return
-	end
-	local _, _, numAvailable, _, serviceType = GetTradeSkillInfo(index)
-
-	-- serviceType is localised, but nil if an item is created
-	if not serviceType then
-		btn:Hide()
-		return
-	end
-	
-	-- Check that there's scrolls in the bags
-	local itemCount = GetItemCount(SCROLL_ID)
-	if not itemCount or itemCount==0 then
-		btn:Disable()
-		btn:Show()
-		btn:SetText(A.L["Enchant a scroll (0)"])
-		return
-	end
-	btn:SetText(A.L["Enchant a scroll (%d)"]:format(itemCount))
-	
-	if numAvailable==0 then
-		btn:Disable()
-		btn:Show()
-		return
-	end
-
-	-- It passed the tests
-	btn:Enable()
-	btn:Show()
-end
-EventsFrame:SetScript("OnEvent",CheckButtonAvailable)
-EventsFrame:RegisterEvent("BAG_UPDATE")
-hooksecurefunc("SelectTradeSkill",CheckButtonAvailable)
-
-function A.LoadEnchantOnScroll()
-	btn = CreateFrame("Button", nil, TradeSkillFrame, "UIPanelButtonTemplate")
-	btn:SetSize(168,22)
-	btn:SetPoint("TOPRIGHT",TradeSkillCreateButton,"TOPLEFT",0,0)
-	btn:SetText(A.L["Enchant on a scroll"])
-	btn:Show()
-	
-	btn:SetScript("OnClick",function()
-		-- from http://wowprogramming.com/utils/xmlbrowser/live/AddOns/Blizzard_TradeSkillUI/Blizzard_TradeSkillUI.xml
-		DoTradeSkill(TradeSkillFrame.selectedSkill,1)
-		
-		-- From GnomeWorks/ScrollMaking.lua
-		UseItemByName(SCROLL_ID)
-	end)
-end
+local addonName, A = ...
+
+local SCROLL_ID = 38682
+local ENCHANTING_ID = 7411
+local btn
+
+local EventsFrame = CreateFrame("Frame",nil,TradeSkillFrame) -- It will be hidden with the TradeSkillFrame
+
+local function CheckButtonAvailable(arg1)
+	if not btn then return end
+
+	-- Do not manage guild tradeskill
+	-- Check that we're still with the enchanting tradeskill
+	if IsTradeSkillGuild() or IsTradeSkillLinked() or GetTradeSkillLine() ~= GetSpellInfo(ENCHANTING_ID) then
+		btn:Hide()
+		return
+	end
+
+	-- Check that the selected recipe can be crafted, and the crafted thing is an enchant
+	local index = GetTradeSkillSelectionIndex()
+	if not index then
+		btn:Hide()
+		return
+	end
+	local _, _, numAvailable, _, serviceType = GetTradeSkillInfo(index)
+
+	-- serviceType is localised, but nil if an item is created
+	if not serviceType then
+		btn:Hide()
+		return
+	end
+	
+	-- Check that there's scrolls in the bags
+	local itemCount = GetItemCount(SCROLL_ID)
+	if not itemCount or itemCount==0 then
+		btn:Disable()
+		btn:Show()
+		btn:SetText(A.L["Enchant a scroll (0)"])
+		return
+	end
+	btn:SetText(A.L["Enchant a scroll (%d)"]:format(itemCount))
+	
+	if numAvailable==0 then
+		btn:Disable()
+		btn:Show()
+		return
+	end
+
+	-- It passed the tests
+	btn:Enable()
+	btn:Show()
+end
+EventsFrame:SetScript("OnEvent",CheckButtonAvailable)
+EventsFrame:RegisterEvent("BAG_UPDATE")
+hooksecurefunc("SelectTradeSkill",CheckButtonAvailable)
+
+function A.LoadEnchantOnScroll()
+	btn = CreateFrame("Button", nil, TradeSkillFrame, "UIPanelButtonTemplate")
+	btn:SetSize(168,22)
+	btn:SetPoint("TOPRIGHT",TradeSkillCreateButton,"TOPLEFT",0,0)
+	btn:SetText(A.L["Enchant on a scroll"])
+	btn:Show()
+	
+	btn:SetScript("OnClick",function()
+		-- from http://wowprogramming.com/utils/xmlbrowser/live/AddOns/Blizzard_TradeSkillUI/Blizzard_TradeSkillUI.xml
+		DoTradeSkill(TradeSkillFrame.selectedSkill,1)
+		
+		-- From GnomeWorks/ScrollMaking.lua
+		UseItemByName(SCROLL_ID)
+	end)
+end
--- a/ProspectingData.lua	Fri May 20 00:54:15 2011 +0200
+++ b/ProspectingData.lua	Fri May 20 18:32:43 2011 +0200
@@ -1,306 +1,306 @@
-local addonName, A = ...
-
--- Thanks to Enchantrix for the data
-
-local COPPER_ORE = 2770
-local TIN_ORE = 2771
-local IRON_ORE = 2772
-local MITHRIL_ORE = 3858
-local THORIUM_ORE = 10620
-local FEL_IRON_ORE = 23424
-local ADAMANTITE_ORE = 23425
-local COBALT_ORE = 36909
-local SARONITE_ORE = 36912
-local TITANIUM_ORE = 36910
-local OBSIDIUM_ORE = 53038
-local ELEMENTIUM_ORE = 52185
-local PYRITE_ORE = 52183
-
-local ADAMANTITEPOWDER = 24243
-local TITANIUMPOWDER = 46849
-local VOLATILE_EARTH = 52327
-
-local TIGERSEYE = 818
-local MALACHITE = 774
-local SHADOWGEM = 1210
-local LESSERMOONSTONE = 1705
-local MOSSAGATE = 1206
-local CITRINE = 3864
-local JADE = 1529
-local AQUAMARINE = 7909
-local STARRUBY = 7910
-local AZEROTHIANDIAMOND = 12800
-local BLUESAPPHIRE = 12361
-local LARGEOPAL = 12799
-local HUGEEMERALD = 12364
-local BLOODGARNET = 23077
-local FLAMESPESSARITE = 21929
-local GOLDENDRAENITE = 23112
-local DEEPPERIDOT = 23079
-local AZUREMOONSTONE = 23117
-local SHADOWDRAENITE = 23107
-local LIVINGRUBY = 23436
-local NOBLETOPAZ = 23439
-local DAWNSTONE = 23440
-local TALASITE = 23437
-local STAROFELUNE = 23438
-local NIGHTSEYE = 23441
-
--- new for WOTLK
-local CHALCEDONY = 36923
-local SHADOWCRYSTAL = 36926
-local TWILIGHTOPAL = 36927
-local HUGECITRINE = 36929
-local BLOODSTONE = 36917
-local SUNCRYSTAL = 36920
-local DARKJADE = 36932
-local FORESTEMERALD = 36933
-local SCARLETRUBY = 36918
-local MONARCHTOPAZ = 36930
-local SKYSAPPHIRE = 36924
-local AUTMNSGLOW = 36921
-
-local MAJESTICZIRCON = 36925
-local AMETRINE = 36931
-local KINGSAMBER = 36922
-local DREADSTONE = 36928
-local CARDINALRUBY = 36919
-local EYEOFZUL = 36934
-
--- new for Cataclysm
-local CARNELIAN = 52177
-local ZEPHYRITE = 52178
-local ALICITE = 52179
-local NIGHTSTONE = 52180
-local HESSONITE = 52181
-local JASPER = 52182
-
-local INFERNORUBY = 52190
-local OCEANSAPPHIRE = 52191
-local DREAMEMERALD = 52192
-local EMBERTOPAZ = 52193
-local DEMONSEYE = 52194
-local AMBERJEWEL = 52195
-
--- "Recipe" data
--- [itemID] = {
---     {reagentID, numberNeeded}
---     {reagentID, numberNeeded, minProduced, maxProduced}
---     {reagentID, numberNeeded, chanceToHaveOne}}
-A.ProspectingData = {
-	-- Vanilla
-	[MALACHITE] = {
-		{COPPER_ORE,5,0.5}},
-	[TIGERSEYE] = {
-		{COPPER_ORE,5,0.5}},
-	[SHADOWGEM] = {
-		{TIN_ORE,5,0.375},
-		{COPPER_ORE,5,0.1}},
-	[LESSERMOONSTONE] = {
-		{TIN_ORE,5,0.375},
-		{IRON_ORE,5,0.375}},
-	[MOSSAGATE] = {
-		{TIN_ORE,5,0.375}},
-	[JADE] = {
-		{IRON_ORE,5,0.375},
-		{TIN_ORE,5,0.04}},
-	[AQUAMARINE] = {
-		{MITHRIL_ORE,5,0.375},
-		{IRON_ORE,5,0.05},
-		{TIN_ORE,5,0.04}},
-	[CITRINE] = {
-		{MITHRIL_ORE,5,0.375},
-		{IRON_ORE,5,0.375},
-		{TIN_ORE,5,0.04}},
-	[STARRUBY] = {
-		{MITHRIL_ORE,5,0.375},
-		{THORIUM_ORE,5,0.15},
-		{IRON_ORE,5,0.05}},
-	[LARGEOPAL] = {
-		{THORIUM_ORE,5,0.3},
-		{MITHRIL_ORE,5,0.03}},
-	[BLUESAPPHIRE] = {
-		{THORIUM_ORE,5,0.3},
-		{MITHRIL_ORE,5,0.03}},
-	[AZEROTHIANDIAMOND] = {
-		{THORIUM_ORE,5,0.30},
-		{MITHRIL_ORE,5,0.03}},
-	[HUGEEMERALD] = {
-		{THORIUM_ORE,5,0.3},
-		{MITHRIL_ORE,5,0.03}},
-
-	-- BC
-	[BLOODGARNET] = {
-		{FEL_IRON_ORE,5,0.19},
-		{ADAMANTITE_ORE,5,0.19}},
-	[FLAMESPESSARITE] = {
-		{FEL_IRON_ORE,5,0.19},
-		{ADAMANTITE_ORE,5,0.19}},
-	[GOLDENDRAENITE] = {
-		{FEL_IRON_ORE,5,0.19},
-		{ADAMANTITE_ORE,5,0.19}},
-	[DEEPPERIDOT] = {
-		{FEL_IRON_ORE,5,0.19},
-		{ADAMANTITE_ORE,5,0.19}},
-	[AZUREMOONSTONE] = {
-		{FEL_IRON_ORE,5,0.19},
-		{ADAMANTITE_ORE,5,0.19}},
-	[SHADOWDRAENITE] = {
-		{FEL_IRON_ORE,5,0.19},
-		{ADAMANTITE_ORE,5,0.19}},
-
-	[LIVINGRUBY] = {
-		{ADAMANTITE_ORE,5,0.03},
-		{FEL_IRON_ORE,5,0.011}},
-	[NOBLETOPAZ] = {
-		{ADAMANTITE_ORE,5,0.03},
-		{FEL_IRON_ORE,5,0.011}},
-	[DAWNSTONE] = {
-		{ADAMANTITE_ORE,5,0.03},
-		{FEL_IRON_ORE,5,0.011}},
-	[TALASITE] = {
-		{ADAMANTITE_ORE,5,0.03},
-		{FEL_IRON_ORE,5,0.011}},
-	[STAROFELUNE] = {
-		{ADAMANTITE_ORE,5,0.03},
-		{FEL_IRON_ORE,5,0.011}},
-	[NIGHTSEYE] = {
-		{ADAMANTITE_ORE,5,0.03},
-		{FEL_IRON_ORE,5,0.011}},
-
-	[ADAMANTITEPOWDER] = {
-		{ADAMANTITE_ORE,5,1}},
-
-	-- WotLK
-	[CHALCEDONY] = {
-		{COBALT_ORE,5,0.25},
-		{TITANIUM_ORE,5,0.25},
-		{SARONITE_ORE,5,0.2}},
-	[HUGECITRINE] = {
-		{COBALT_ORE,5,0.25},
-		{TITANIUM_ORE,5,0.25},
-		{SARONITE_ORE,5,0.2}},
-	[BLOODSTONE] = {
-		{COBALT_ORE,5,0.25},
-		{TITANIUM_ORE,5,0.25},
-		{SARONITE_ORE,5,0.2}},
-	[SHADOWCRYSTAL] = {
-		{COBALT_ORE,5,0.25},
-		{TITANIUM_ORE,5,0.25},
-		{SARONITE_ORE,5,0.2}},
-	[SUNCRYSTAL] = {
-		{COBALT_ORE,5,0.25},
-		{TITANIUM_ORE,5,0.25},
-		{SARONITE_ORE,5,0.2}},
-	[DARKJADE] = {
-		{COBALT_ORE,5,0.25},
-		{TITANIUM_ORE,5,0.25},
-		{SARONITE_ORE,5,0.2}},
-
-	[TWILIGHTOPAL] = {
-		{TITANIUM_ORE,5,0.04},
-		{SARONITE_ORE,5,0.04},
-		{COBALT_ORE,5,0.013}},
-	[FORESTEMERALD] = {
-		{TITANIUM_ORE,5,0.04},
-		{SARONITE_ORE,5,0.04},
-		{COBALT_ORE,5,0.013}},
-	[SCARLETRUBY] = {
-		{TITANIUM_ORE,5,0.04},
-		{SARONITE_ORE,5,0.04},
-		{COBALT_ORE,5,0.013}},
-	[MONARCHTOPAZ] = {
-		{TITANIUM_ORE,5,0.04},
-		{SARONITE_ORE,5,0.04},
-		{COBALT_ORE,5,0.013}},
-	[SKYSAPPHIRE] = {
-		{TITANIUM_ORE,5,0.04},
-		{SARONITE_ORE,5,0.04},
-		{COBALT_ORE,5,0.013}},
-	[AUTMNSGLOW] = {
-		{TITANIUM_ORE,5,0.04},
-		{SARONITE_ORE,5,0.04},
-		{COBALT_ORE,5,0.013}},
-
-	[MAJESTICZIRCON] = {
-		{TITANIUM_ORE,5,0.04}},
-	[AMETRINE] = {
-		{TITANIUM_ORE,5,0.04}},
-	[KINGSAMBER] = {
-		{TITANIUM_ORE,5,0.04}},
-	[DREADSTONE] = {
-		{TITANIUM_ORE,5,0.04}},
-	[CARDINALRUBY] = {
-		{TITANIUM_ORE,5,0.04}},
-	[EYEOFZUL] = {
-		{TITANIUM_ORE,5,0.04}},
-
-	-- Cata
-	[CARNELIAN] = {
-		{OBSIDIUM_ORE,5,0.25},
-		{ELEMENTIUM_ORE,5,0.18},
-		{PYRITE_ORE,5,0.17}},
-	[ZEPHYRITE] = {
-		{OBSIDIUM_ORE,5,0.25},
-		{ELEMENTIUM_ORE,5,0.18},
-		{PYRITE_ORE,5,0.17}},
-	[ALICITE] = {
-		{OBSIDIUM_ORE,5,0.25},
-		{ELEMENTIUM_ORE,5,0.18},
-		{PYRITE_ORE,5,0.17}},
-	[NIGHTSTONE] = {
-		{OBSIDIUM_ORE,5,0.25},
-		{ELEMENTIUM_ORE,5,0.18},
-		{PYRITE_ORE,5,0.17}},
-	[HESSONITE] = {
-		{OBSIDIUM_ORE,5,0.25},
-		{ELEMENTIUM_ORE,5,0.18},
-		{PYRITE_ORE,5,0.17}},
-	[JASPER] = {
-		{OBSIDIUM_ORE,5,0.25},
-		{ELEMENTIUM_ORE,5,0.18},
-		{PYRITE_ORE,5,0.17}},
-
-	[INFERNORUBY] = {
-		{PYRITE_ORE,5,0.07},
-		{ELEMENTIUM_ORE,5,0.04},
-		{OBSIDIUM_ORE,5,0.013}},
-	[OCEANSAPPHIRE] = {
-		{PYRITE_ORE,5,0.07},
-		{ELEMENTIUM_ORE,5,0.04},
-		{OBSIDIUM_ORE,5,0.013}},
-	[DREAMEMERALD] = {
-		{PYRITE_ORE,5,0.07},
-		{ELEMENTIUM_ORE,5,0.04},
-		{OBSIDIUM_ORE,5,0.013}},
-	[EMBERTOPAZ] = {
-		{PYRITE_ORE,5,0.07},
-		{ELEMENTIUM_ORE,5,0.04},
-		{OBSIDIUM_ORE,5,0.013}},
-	[DEMONSEYE] = {
-		{PYRITE_ORE,5,0.07},
-		{ELEMENTIUM_ORE,5,0.04},
-		{OBSIDIUM_ORE,5,0.013}},
-	[AMBERJEWEL] = {
-		{PYRITE_ORE,5,0.07},
-		{ELEMENTIUM_ORE,5,0.04},
-		{OBSIDIUM_ORE,5,0.013}},
-
-	[VOLATILE_EARTH] = {
-		{PYRITE_ORE,5,2}},
-}
-
--- "Tradeskill" data
-local ProspectID = 31252
-local ProspectName = GetSpellInfo(ProspectID)
-local macroProspect = "/cast "..ProspectName.."\n/use %s"
-local ProspectLink = GetSpellLink(ProspectID)
-
--- Add "Tradeskill" data to each "recipe"
-for itemID,t in pairs(A.ProspectingData) do
-	for i,v in ipairs(t) do
-		v.macro = macroProspect
-		v.spellID = ProspectID
-		v.spellLink = ProspectLink
-	end
-end
+local addonName, A = ...
+
+-- Thanks to Enchantrix for the data
+
+local COPPER_ORE = 2770
+local TIN_ORE = 2771
+local IRON_ORE = 2772
+local MITHRIL_ORE = 3858
+local THORIUM_ORE = 10620
+local FEL_IRON_ORE = 23424
+local ADAMANTITE_ORE = 23425
+local COBALT_ORE = 36909
+local SARONITE_ORE = 36912
+local TITANIUM_ORE = 36910
+local OBSIDIUM_ORE = 53038
+local ELEMENTIUM_ORE = 52185
+local PYRITE_ORE = 52183
+
+local ADAMANTITEPOWDER = 24243
+local TITANIUMPOWDER = 46849
+local VOLATILE_EARTH = 52327
+
+local TIGERSEYE = 818
+local MALACHITE = 774
+local SHADOWGEM = 1210
+local LESSERMOONSTONE = 1705
+local MOSSAGATE = 1206
+local CITRINE = 3864
+local JADE = 1529
+local AQUAMARINE = 7909
+local STARRUBY = 7910
+local AZEROTHIANDIAMOND = 12800
+local BLUESAPPHIRE = 12361
+local LARGEOPAL = 12799
+local HUGEEMERALD = 12364
+local BLOODGARNET = 23077
+local FLAMESPESSARITE = 21929
+local GOLDENDRAENITE = 23112
+local DEEPPERIDOT = 23079
+local AZUREMOONSTONE = 23117
+local SHADOWDRAENITE = 23107
+local LIVINGRUBY = 23436
+local NOBLETOPAZ = 23439
+local DAWNSTONE = 23440
+local TALASITE = 23437
+local STAROFELUNE = 23438
+local NIGHTSEYE = 23441
+
+-- new for WOTLK
+local CHALCEDONY = 36923
+local SHADOWCRYSTAL = 36926
+local TWILIGHTOPAL = 36927
+local HUGECITRINE = 36929
+local BLOODSTONE = 36917
+local SUNCRYSTAL = 36920
+local DARKJADE = 36932
+local FORESTEMERALD = 36933
+local SCARLETRUBY = 36918
+local MONARCHTOPAZ = 36930
+local SKYSAPPHIRE = 36924
+local AUTMNSGLOW = 36921
+
+local MAJESTICZIRCON = 36925
+local AMETRINE = 36931
+local KINGSAMBER = 36922
+local DREADSTONE = 36928
+local CARDINALRUBY = 36919
+local EYEOFZUL = 36934
+
+-- new for Cataclysm
+local CARNELIAN = 52177
+local ZEPHYRITE = 52178
+local ALICITE = 52179
+local NIGHTSTONE = 52180
+local HESSONITE = 52181
+local JASPER = 52182
+
+local INFERNORUBY = 52190
+local OCEANSAPPHIRE = 52191
+local DREAMEMERALD = 52192
+local EMBERTOPAZ = 52193
+local DEMONSEYE = 52194
+local AMBERJEWEL = 52195
+
+-- "Recipe" data
+-- [itemID] = {
+--     {reagentID, numberNeeded}
+--     {reagentID, numberNeeded, minProduced, maxProduced}
+--     {reagentID, numberNeeded, chanceToHaveOne}}
+A.ProspectingData = {
+	-- Vanilla
+	[MALACHITE] = {
+		{COPPER_ORE,5,0.5}},
+	[TIGERSEYE] = {
+		{COPPER_ORE,5,0.5}},
+	[SHADOWGEM] = {
+		{TIN_ORE,5,0.375},
+		{COPPER_ORE,5,0.1}},
+	[LESSERMOONSTONE] = {
+		{TIN_ORE,5,0.375},
+		{IRON_ORE,5,0.375}},
+	[MOSSAGATE] = {
+		{TIN_ORE,5,0.375}},
+	[JADE] = {
+		{IRON_ORE,5,0.375},
+		{TIN_ORE,5,0.04}},
+	[AQUAMARINE] = {
+		{MITHRIL_ORE,5,0.375},
+		{IRON_ORE,5,0.05},
+		{TIN_ORE,5,0.04}},
+	[CITRINE] = {
+		{MITHRIL_ORE,5,0.375},
+		{IRON_ORE,5,0.375},
+		{TIN_ORE,5,0.04}},
+	[STARRUBY] = {
+		{MITHRIL_ORE,5,0.375},
+		{THORIUM_ORE,5,0.15},
+		{IRON_ORE,5,0.05}},
+	[LARGEOPAL] = {
+		{THORIUM_ORE,5,0.3},
+		{MITHRIL_ORE,5,0.03}},
+	[BLUESAPPHIRE] = {
+		{THORIUM_ORE,5,0.3},
+		{MITHRIL_ORE,5,0.03}},
+	[AZEROTHIANDIAMOND] = {
+		{THORIUM_ORE,5,0.30},
+		{MITHRIL_ORE,5,0.03}},
+	[HUGEEMERALD] = {
+		{THORIUM_ORE,5,0.3},
+		{MITHRIL_ORE,5,0.03}},
+
+	-- BC
+	[BLOODGARNET] = {
+		{FEL_IRON_ORE,5,0.19},
+		{ADAMANTITE_ORE,5,0.19}},
+	[FLAMESPESSARITE] = {
+		{FEL_IRON_ORE,5,0.19},
+		{ADAMANTITE_ORE,5,0.19}},
+	[GOLDENDRAENITE] = {
+		{FEL_IRON_ORE,5,0.19},
+		{ADAMANTITE_ORE,5,0.19}},
+	[DEEPPERIDOT] = {
+		{FEL_IRON_ORE,5,0.19},
+		{ADAMANTITE_ORE,5,0.19}},
+	[AZUREMOONSTONE] = {
+		{FEL_IRON_ORE,5,0.19},
+		{ADAMANTITE_ORE,5,0.19}},
+	[SHADOWDRAENITE] = {
+		{FEL_IRON_ORE,5,0.19},
+		{ADAMANTITE_ORE,5,0.19}},
+
+	[LIVINGRUBY] = {
+		{ADAMANTITE_ORE,5,0.03},
+		{FEL_IRON_ORE,5,0.011}},
+	[NOBLETOPAZ] = {
+		{ADAMANTITE_ORE,5,0.03},
+		{FEL_IRON_ORE,5,0.011}},
+	[DAWNSTONE] = {
+		{ADAMANTITE_ORE,5,0.03},
+		{FEL_IRON_ORE,5,0.011}},
+	[TALASITE] = {
+		{ADAMANTITE_ORE,5,0.03},
+		{FEL_IRON_ORE,5,0.011}},
+	[STAROFELUNE] = {
+		{ADAMANTITE_ORE,5,0.03},
+		{FEL_IRON_ORE,5,0.011}},
+	[NIGHTSEYE] = {
+		{ADAMANTITE_ORE,5,0.03},
+		{FEL_IRON_ORE,5,0.011}},
+
+	[ADAMANTITEPOWDER] = {
+		{ADAMANTITE_ORE,5,1}},
+
+	-- WotLK
+	[CHALCEDONY] = {
+		{COBALT_ORE,5,0.25},
+		{TITANIUM_ORE,5,0.25},
+		{SARONITE_ORE,5,0.2}},
+	[HUGECITRINE] = {
+		{COBALT_ORE,5,0.25},
+		{TITANIUM_ORE,5,0.25},
+		{SARONITE_ORE,5,0.2}},
+	[BLOODSTONE] = {
+		{COBALT_ORE,5,0.25},
+		{TITANIUM_ORE,5,0.25},
+		{SARONITE_ORE,5,0.2}},
+	[SHADOWCRYSTAL] = {
+		{COBALT_ORE,5,0.25},
+		{TITANIUM_ORE,5,0.25},
+		{SARONITE_ORE,5,0.2}},
+	[SUNCRYSTAL] = {
+		{COBALT_ORE,5,0.25},
+		{TITANIUM_ORE,5,0.25},
+		{SARONITE_ORE,5,0.2}},
+	[DARKJADE] = {
+		{COBALT_ORE,5,0.25},
+		{TITANIUM_ORE,5,0.25},
+		{SARONITE_ORE,5,0.2}},
+
+	[TWILIGHTOPAL] = {
+		{TITANIUM_ORE,5,0.04},
+		{SARONITE_ORE,5,0.04},
+		{COBALT_ORE,5,0.013}},
+	[FORESTEMERALD] = {
+		{TITANIUM_ORE,5,0.04},
+		{SARONITE_ORE,5,0.04},
+		{COBALT_ORE,5,0.013}},
+	[SCARLETRUBY] = {
+		{TITANIUM_ORE,5,0.04},
+		{SARONITE_ORE,5,0.04},
+		{COBALT_ORE,5,0.013}},
+	[MONARCHTOPAZ] = {
+		{TITANIUM_ORE,5,0.04},
+		{SARONITE_ORE,5,0.04},
+		{COBALT_ORE,5,0.013}},
+	[SKYSAPPHIRE] = {
+		{TITANIUM_ORE,5,0.04},
+		{SARONITE_ORE,5,0.04},
+		{COBALT_ORE,5,0.013}},
+	[AUTMNSGLOW] = {
+		{TITANIUM_ORE,5,0.04},
+		{SARONITE_ORE,5,0.04},
+		{COBALT_ORE,5,0.013}},
+
+	[MAJESTICZIRCON] = {
+		{TITANIUM_ORE,5,0.04}},
+	[AMETRINE] = {
+		{TITANIUM_ORE,5,0.04}},
+	[KINGSAMBER] = {
+		{TITANIUM_ORE,5,0.04}},
+	[DREADSTONE] = {
+		{TITANIUM_ORE,5,0.04}},
+	[CARDINALRUBY] = {
+		{TITANIUM_ORE,5,0.04}},
+	[EYEOFZUL] = {
+		{TITANIUM_ORE,5,0.04}},
+
+	-- Cata
+	[CARNELIAN] = {
+		{OBSIDIUM_ORE,5,0.25},
+		{ELEMENTIUM_ORE,5,0.18},
+		{PYRITE_ORE,5,0.17}},
+	[ZEPHYRITE] = {
+		{OBSIDIUM_ORE,5,0.25},
+		{ELEMENTIUM_ORE,5,0.18},
+		{PYRITE_ORE,5,0.17}},
+	[ALICITE] = {
+		{OBSIDIUM_ORE,5,0.25},
+		{ELEMENTIUM_ORE,5,0.18},
+		{PYRITE_ORE,5,0.17}},
+	[NIGHTSTONE] = {
+		{OBSIDIUM_ORE,5,0.25},
+		{ELEMENTIUM_ORE,5,0.18},
+		{PYRITE_ORE,5,0.17}},
+	[HESSONITE] = {
+		{OBSIDIUM_ORE,5,0.25},
+		{ELEMENTIUM_ORE,5,0.18},
+		{PYRITE_ORE,5,0.17}},
+	[JASPER] = {
+		{OBSIDIUM_ORE,5,0.25},
+		{ELEMENTIUM_ORE,5,0.18},
+		{PYRITE_ORE,5,0.17}},
+
+	[INFERNORUBY] = {
+		{PYRITE_ORE,5,0.07},
+		{ELEMENTIUM_ORE,5,0.04},
+		{OBSIDIUM_ORE,5,0.013}},
+	[OCEANSAPPHIRE] = {
+		{PYRITE_ORE,5,0.07},
+		{ELEMENTIUM_ORE,5,0.04},
+		{OBSIDIUM_ORE,5,0.013}},
+	[DREAMEMERALD] = {
+		{PYRITE_ORE,5,0.07},
+		{ELEMENTIUM_ORE,5,0.04},
+		{OBSIDIUM_ORE,5,0.013}},
+	[EMBERTOPAZ] = {
+		{PYRITE_ORE,5,0.07},
+		{ELEMENTIUM_ORE,5,0.04},
+		{OBSIDIUM_ORE,5,0.013}},
+	[DEMONSEYE] = {
+		{PYRITE_ORE,5,0.07},
+		{ELEMENTIUM_ORE,5,0.04},
+		{OBSIDIUM_ORE,5,0.013}},
+	[AMBERJEWEL] = {
+		{PYRITE_ORE,5,0.07},
+		{ELEMENTIUM_ORE,5,0.04},
+		{OBSIDIUM_ORE,5,0.013}},
+
+	[VOLATILE_EARTH] = {
+		{PYRITE_ORE,5,2}},
+}
+
+-- "Tradeskill" data
+local ProspectID = 31252
+local ProspectName = GetSpellInfo(ProspectID)
+local macroProspect = "/cast "..ProspectName.."\n/use %s"
+local ProspectLink = GetSpellLink(ProspectID)
+
+-- Add "Tradeskill" data to each "recipe"
+for itemID,t in pairs(A.ProspectingData) do
+	for i,v in ipairs(t) do
+		v.macro = macroProspect
+		v.spellID = ProspectID
+		v.spellLink = ProspectLink
+	end
+end
--- a/ReagentMaker.lua	Fri May 20 00:54:15 2011 +0200
+++ b/ReagentMaker.lua	Fri May 20 18:32:43 2011 +0200
@@ -1,297 +1,303 @@
-local addonName, A = ...
-
--- @todo clean the A table
--- @todo check local copy of globals functions
--- @todo add support for dez ?
--- @todo add support for hidden recipes, removing filtering
--- @todo add support for cross tradeskill, like mining + forge/ingé
--- @todo when a reagent can not be crafted and the recipe has many reagents, do like ReverseEngeneering and go to this recipe (with a one step return button)
--- @todo scroll to the selected recipe on opening (usefull also for the previous todo)
--- @todo shift+clic on a reagent name while the serachbar is focused fills the serachbar with the reagent name (idem with the crafted item)
--- @todo add a button to clear search
--- @todo add a button to cast a campfire when coocking
-
----------------------------------------------------
--- Variables
----------------------------------------------------
--- Used by findglobals
--- GLOBALS: _G, CreateFrame, DEFAULT_CHAT_FRAME
-
--- Lua functions
-
--- Wow functions
-
--- constant vars
-
----------------------------------------------------
--- Manage events
----------------------------------------------------
-A.EventsFrame = CreateFrame("Frame")
-
-local SCAN_DELAY = 0.2
-local t_throttle = SCAN_DELAY
-local function throttleScan(self, t_elapsed)
-	t_throttle = t_throttle - t_elapsed
-	if t_throttle<0 then
-		self:SetScript("OnUpdate", nil)
-
-		-- Close the external window if the tradeskill changed
-		if A.currentTradeSkill ~= GetTradeSkillLine() then
-			A.MenuFrame:Hide()
-		end
-		if IsTradeSkillGuild() or IsTradeSkillLinked() then
-			A.MenuFrame:Hide()
-			return
-		end
-
-		-- Scan availabe recipes
-		-- Rescan in case of problem
-		if not A:ScanSimpleRecipes() then
-			t_throttle = SCAN_DELAY
-			self:SetScript("OnUpdate", throttleScan)
-		end
-
-		-- Show makables reagents
-		A.updateCounts(GetTradeSkillSelectionIndex())
-	end
-end
-A.EventsFrame:SetScript("OnEvent", function(self, event)
-	if event == "TRADE_SKILL_UPDATE" then
-		t_throttle = SCAN_DELAY
-		self:SetScript("OnUpdate", throttleScan)
-
-	elseif event == "TRADE_SKILL_SHOW" then
-		A:Initialize()
-		A.EventsFrame:UnregisterEvent("TRADE_SKILL_SHOW")
-	end -- if
-end) -- function
-A.EventsFrame:RegisterEvent("TRADE_SKILL_SHOW")
-A.EventsFrame:RegisterEvent("TRADE_SKILL_UPDATE")
-
----------------------------------------------------
--- Initialize
----------------------------------------------------
-function A:Initialize()
-
-	-- Register clics on reagent's buttons
-	for i=1,7 do
-		local btn = _G["TradeSkillReagent"..i]
-		btn:HookScript("OnDoubleClick", A.ProcessReagent)
-		btn:HookScript("OnEnter", A.btnEntered)
-		btn:HookScript("OnLeave", A.btnLeft)
-		btn.SplitStack = A.SplitStack
-
-		local textureHighlight = btn:CreateTexture()
-		textureHighlight:Hide()
-		textureHighlight:SetTexture("Interface\\BUTTONS\\CheckButtonHilight")
-		textureHighlight:SetBlendMode("ADD")
-		textureHighlight:SetAllPoints("TradeSkillReagent"..i.."IconTexture")
-		btn.textureHighlight = textureHighlight
-
-		local label = btn:CreateFontString(nil,"ARTWORK","GameFontHighlight")
-		label:SetSize(100,20)
-		label:SetPoint("TOPLEFT",btn,"TOPLEFT",4,-4)
-		label:SetJustifyH("LEFT")
-		label:SetJustifyV("TOP")
-		label:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
-		btn.label = label
-	end -- for
-
-	-- Secondary Tooltip
-	A.tooltipRecipe = CreateFrame("GameTooltip", "ReagentMaker_tooltipRecipe",UIParent, "GameTooltipTemplate")
-	A.tooltipRecipe:SetFrameStrata("TOOLTIP")
-	A.tooltipRecipe:Hide()
-	
-	-- Button for enchanting directy on a scroll
-	A.LoadEnchantOnScroll()
-end -- function
-
--- Function run after selecting a item in the tradeskill window
-function A.ProcessReagent(btn, ...)
-
-	-- Do not manage guild tradeskill
-	if IsTradeSkillGuild() or IsTradeSkillLinked() then return end
-
-	-- We want no modifiers, or shift to choose the number of reagent to craft
-	if IsModifierKeyDown() and not IsShiftKeyDown() then return end
-	local chooseNumberToCraft = IsShiftKeyDown()
-
-	-- Index of the reagent in the recipe, taken from the button name
-	local reagentRecipeIndex = A.buttonNumber(btn)
-
-	-- ID of the reagent we want to craft
-	local recipeIndex = GetTradeSkillSelectionIndex()
-	local reagentID = A.link2ID(GetTradeSkillReagentItemLink(recipeIndex, reagentRecipeIndex))
-
-	-- Continue only if the reagent is known
-	if not reagentID or not A.data[reagentID] then return end
-
-	-- If only one recipe is known for the reagent, use it
-	if #(A.data[reagentID]) == 1 and not A.data[reagentID][1].macro then
-		if A.data[reagentID][1].spellName and A.data[reagentID][1].spellName ~= GetTradeSkillLine() then
-			A.Error(A.L["The recipe to make this reagent is in another tradeskill. Currently ReagentMaker can not manage such a case, sorry."])
-			return
-		end
-
-		local numMakable, reagentIndex = A.numMakable(reagentID)
-
-		-- Try to show the recipe by removing filters once if it was not found
-		if not reagentIndex then
-			A.SaveActiveFilters(A.data[reagentID][1].header)
-			numMakable, reagentIndex = A.numMakable(reagentID)
-		end
-
-		if not numMakable then
-			A.Error(A.L["The recipe to make the reagent seems to be hidden, it is not makable. Try to remove the filters on the recipes."])
-			return
-		end
-		if numMakable>0 then
-			A.craft(recipeIndex,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft)
-			return
-		end
-
-		-- If we can make the item needed to make the reagent, open a window to make it
-		-- one step recursion, enables to mill to create an ink
-		if A.data[reagentID][1][1] and A.data[A.data[reagentID][1][1]] then
-			if A.externalCraftWindow(A.data[reagentID][1][1],reagentID) ~= false then
-				return
-			end
-		end
-
-		A.Error(A.L["You do not have enough reagents to craft [%s]"]:format(GetItemInfo(reagentID) or "item #"..reagentID))
-		return
-	else
-		A.externalCraftWindow(reagentID)
-	end -- if
-	--A.RestoreActiveFilters()
-end -- function
-
-
----------------------------------------------------
--- Craft items
----------------------------------------------------
--- function used after choosing the number of reagent to craft
-function A.SplitStack(owner,split)
-	DoTradeSkill(owner.ReagentMaker_reagentIndex,tonumber(split))
-	owner.ReagentMaker_reagentIndex = nil
-end
-
--- Craft the reagent of an item, given it's position in the recipe
-function A.craft(recipeIndex,reagentRecipeIndex,reagentIndex,numReagentMakable,chooseNumber)
-	-- Look at how many we need to make one item for the selected recipe
-	local numToMake = 1
-	local _, _, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(recipeIndex, reagentRecipeIndex)
-	-- make enough reagents to craft one more item
-	numToMake = math.min(math.floor(playerReagentCount/reagentCount+1)*reagentCount-playerReagentCount,numReagentMakable)
-
-	-- take into account that some recipe craft more than one item
-	-- use the mean between min and max, but make at least one...
-	local minMade, maxMade = GetTradeSkillNumMade(reagentIndex)
-	numToMake = math.max(math.floor(2*numToMake/(maxMade+minMade)),1)
-	
-	-- Choose number or craft directly
-	if chooseNumber then
-		-- the dialog window is linked to the reagent button
-		local btn = _G["TradeSkillReagent"..reagentRecipeIndex]
-
-		-- Store info to be able to run the function later
-		btn.ReagentMaker_reagentIndex = reagentIndex
-
-		-- Open dialog
-		OpenStackSplitFrame(numReagentMakable, btn, "TOP", "BOTTOM")
-
-		-- Fill in the number to make
-		numToMake = tostring(numToMake)
-		for i = 1,numToMake:len() do
-			StackSplitFrame_OnChar(StackSplitFrame,numToMake:gsub(i,i))
-		end
-		StackSplitFrame.typing = 0 -- reinit the frame so tha the entered value will be erased on text entry
-	else
-		DoTradeSkill(reagentIndex,numToMake)
-	end -- if
-end -- function
-
-
--- Button hovering
-function A.btnEntered(btn)
-	-- Do not manage guild tradeskill
-	if IsTradeSkillGuild() or IsTradeSkillLinked() then return end
-
-	-- Index of the reagent in the recipe, taken from the button name
-	local reagentRecipeIndex = A.buttonNumber(btn)
-
-	-- ID of the reagent we want to craft
-	local reagentLink = GetTradeSkillReagentItemLink(GetTradeSkillSelectionIndex(), reagentRecipeIndex)
-	local reagentID = A.link2ID(reagentLink)
-
-	-- Continue only if the reagent is known
-	if not reagentID or not A.data[reagentID] then return end
-
-	btn.textureHighlight:Show()
-
-	-- Check if the item is made by only one recipe. If not, return
-	if not A.isRecipeUnique(A.data[reagentID]) then return end
-
-	-- Tooltips
-	local link = A.data[reagentID][1].spellLink
-	if link then
-		A.tooltipRecipe:SetOwner(btn)
-		A.tooltipRecipe:SetHyperlink(link)
-		A.tooltipRecipe:Show()
-		A.tooltipRecipe:ClearAllPoints()
-		A.tooltipRecipe:SetPoint("BOTTOMLEFT",GameTooltip,"BOTTOMRIGHT")
-	end
-end
-
-function A.btnLeft(btn)
-	btn.textureHighlight:Hide()
-	A.tooltipRecipe:Hide()
-end -- function
-
-function A.updateCounts(recipeIndex)
-	-- Needs an argument
-	if not recipeIndex then return end
-
-	-- Do not manage guild tradeskill
-	if IsTradeSkillGuild() or IsTradeSkillLinked() then
-		for reagentRecipeIndex = 1,GetTradeSkillNumReagents(recipeIndex) do
-			-- If the normal tradeskill hasn't been opened yet, the field 'label' doesn't exists yet
-			local label = _G["TradeSkillReagent"..reagentRecipeIndex].label
-			if label then
-				label:Hide()
-			end
-		end
-		return
-	end
-
-	-- Count makable items and show it
-	for reagentRecipeIndex = 1,GetTradeSkillNumReagents(recipeIndex) do
-		-- ID of the reagent we want to craft
-		local reagentLink = GetTradeSkillReagentItemLink(recipeIndex, reagentRecipeIndex)
-		local reagentID = A.link2ID(reagentLink)
-
-		local label = _G["TradeSkillReagent"..reagentRecipeIndex].label
-		if not label then break end -- Shouldn't happen...
-
-		-- Continue only if the reagent is known
-		if not reagentID or not A.data[reagentID] then
-			label:Hide()
-		else
-			-- Count and show
-			local numMakable = A.numMakable(reagentID)
-			if not numMakable or #(A.data[reagentID]) ~= 1 or A.data[reagentID][1].macro then
-				label:SetText("?")
-				label:SetTextColor(0, 0.5, 1, 1) -- blue
-			else
-				label:SetText(numMakable)
-				if numMakable==0 then
-					label:SetTextColor(1, 0, 0, 1) -- red
-				else
-					label:SetTextColor(0, 1, 0, 1) -- green
-				end
-			end -- if
-			label:Show()
-		end -- if
-	end -- for
-end -- function
-hooksecurefunc("SelectTradeSkill",A.updateCounts)
+local addonName, A = ...
+
+-- @todo clean the A table
+-- @todo check local copy of globals functions
+-- @todo add support for dez ?
+-- @todo add support for hidden recipes, removing filtering
+-- @todo add support for cross tradeskill, like mining + forge/ingé
+-- @todo when a reagent can not be crafted and the recipe has many reagents, do like ReverseEngeneering and go to this recipe (with a one step return button)
+-- @todo scroll to the selected recipe on opening (usefull also for the previous todo)
+-- @todo shift+clic on a reagent name while the serachbar is focused fills the serachbar with the reagent name (idem with the crafted item)
+-- @todo add a button to clear search
+-- @todo add a button to cast a campfire when coocking
+
+---------------------------------------------------
+-- Variables
+---------------------------------------------------
+-- Used by findglobals
+-- GLOBALS: _G, CreateFrame, DEFAULT_CHAT_FRAME
+
+-- Lua functions
+
+-- Wow functions
+
+-- constant vars
+
+---------------------------------------------------
+-- Manage events
+---------------------------------------------------
+A.EventsFrame = CreateFrame("Frame")
+
+local SCAN_DELAY = 0.2
+local t_throttle = SCAN_DELAY
+local function throttleScan(self, t_elapsed)
+	t_throttle = t_throttle - t_elapsed
+	if t_throttle<0 then
+		self:SetScript("OnUpdate", nil)
+
+		-- Close the external window if the tradeskill changed
+		if A.currentTradeSkill ~= GetTradeSkillLine() then
+			A.MenuFrame:Hide()
+		end
+		if IsTradeSkillGuild() or IsTradeSkillLinked() then
+			A.MenuFrame:Hide()
+			return
+		end
+
+		-- Scan availabe recipes
+		-- Rescan in case of problem
+		if not A:ScanSimpleRecipes() then
+			t_throttle = SCAN_DELAY
+			self:SetScript("OnUpdate", throttleScan)
+		end
+
+		-- Show makables reagents
+		A.updateCounts(GetTradeSkillSelectionIndex())
+	end
+end
+A.EventsFrame:SetScript("OnEvent", function(self, event)
+	A.ManageCampFireBtn()
+	if event == "TRADE_SKILL_UPDATE" then
+		t_throttle = SCAN_DELAY
+		self:SetScript("OnUpdate", throttleScan)
+
+	elseif event == "TRADE_SKILL_SHOW" then
+		A:Initialize()
+		A.EventsFrame:UnregisterEvent("TRADE_SKILL_SHOW")
+	end -- if
+end) -- function
+A.EventsFrame:RegisterEvent("TRADE_SKILL_SHOW")
+A.EventsFrame:RegisterEvent("TRADE_SKILL_UPDATE")
+A.EventsFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
+A.EventsFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
+
+---------------------------------------------------
+-- Initialize
+---------------------------------------------------
+function A:Initialize()
+
+	-- Register clics on reagent's buttons
+	for i=1,7 do
+		local btn = _G["TradeSkillReagent"..i]
+		btn:HookScript("OnDoubleClick", A.ProcessReagent)
+		btn:HookScript("OnEnter", A.btnEntered)
+		btn:HookScript("OnLeave", A.btnLeft)
+		btn.SplitStack = A.SplitStack
+
+		local textureHighlight = btn:CreateTexture()
+		textureHighlight:Hide()
+		textureHighlight:SetTexture("Interface\\BUTTONS\\CheckButtonHilight")
+		textureHighlight:SetBlendMode("ADD")
+		textureHighlight:SetAllPoints("TradeSkillReagent"..i.."IconTexture")
+		btn.textureHighlight = textureHighlight
+
+		local label = btn:CreateFontString(nil,"ARTWORK","GameFontHighlight")
+		label:SetSize(100,20)
+		label:SetPoint("TOPLEFT",btn,"TOPLEFT",4,-4)
+		label:SetJustifyH("LEFT")
+		label:SetJustifyV("TOP")
+		label:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
+		btn.label = label
+	end -- for
+
+	-- Secondary Tooltip
+	A.tooltipRecipe = CreateFrame("GameTooltip", "ReagentMaker_tooltipRecipe",UIParent, "GameTooltipTemplate")
+	A.tooltipRecipe:SetFrameStrata("TOOLTIP")
+	A.tooltipRecipe:Hide()
+	
+	-- Button for enchanting directy on a scroll
+	A.LoadEnchantOnScroll()
+	
+	-- Button to cast a campfire
+	A.InitialiseCampFireBtn()
+end -- function
+
+-- Function run after selecting a item in the tradeskill window
+function A.ProcessReagent(btn, ...)
+
+	-- Do not manage guild tradeskill
+	if IsTradeSkillGuild() or IsTradeSkillLinked() then return end
+
+	-- We want no modifiers, or shift to choose the number of reagent to craft
+	if IsModifierKeyDown() and not IsShiftKeyDown() then return end
+	local chooseNumberToCraft = IsShiftKeyDown()
+
+	-- Index of the reagent in the recipe, taken from the button name
+	local reagentRecipeIndex = A.buttonNumber(btn)
+
+	-- ID of the reagent we want to craft
+	local recipeIndex = GetTradeSkillSelectionIndex()
+	local reagentID = A.link2ID(GetTradeSkillReagentItemLink(recipeIndex, reagentRecipeIndex))
+
+	-- Continue only if the reagent is known
+	if not reagentID or not A.data[reagentID] then return end
+
+	-- If only one recipe is known for the reagent, use it
+	if #(A.data[reagentID]) == 1 and not A.data[reagentID][1].macro then
+		if A.data[reagentID][1].spellName and A.data[reagentID][1].spellName ~= GetTradeSkillLine() then
+			A.Error(A.L["The recipe to make this reagent is in another tradeskill. Currently ReagentMaker can not manage such a case, sorry."])
+			return
+		end
+
+		local numMakable, reagentIndex = A.numMakable(reagentID)
+
+		-- Try to show the recipe by removing filters once if it was not found
+		if not reagentIndex then
+			A.SaveActiveFilters(A.data[reagentID][1].header)
+			numMakable, reagentIndex = A.numMakable(reagentID)
+		end
+
+		if not numMakable then
+			A.Error(A.L["The recipe to make the reagent seems to be hidden, it is not makable. Try to remove the filters on the recipes."])
+			return
+		end
+		if numMakable>0 then
+			A.craft(recipeIndex,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft)
+			return
+		end
+
+		-- If we can make the item needed to make the reagent, open a window to make it
+		-- one step recursion, enables to mill to create an ink
+		if A.data[reagentID][1][1] and A.data[A.data[reagentID][1][1]] then
+			if A.externalCraftWindow(A.data[reagentID][1][1],reagentID) ~= false then
+				return
+			end
+		end
+
+		A.Error(A.L["You do not have enough reagents to craft [%s]"]:format(GetItemInfo(reagentID) or "item #"..reagentID))
+		return
+	else
+		A.externalCraftWindow(reagentID)
+	end -- if
+	--A.RestoreActiveFilters()
+end -- function
+
+
+---------------------------------------------------
+-- Craft items
+---------------------------------------------------
+-- function used after choosing the number of reagent to craft
+function A.SplitStack(owner,split)
+	DoTradeSkill(owner.ReagentMaker_reagentIndex,tonumber(split))
+	owner.ReagentMaker_reagentIndex = nil
+end
+
+-- Craft the reagent of an item, given it's position in the recipe
+function A.craft(recipeIndex,reagentRecipeIndex,reagentIndex,numReagentMakable,chooseNumber)
+	-- Look at how many we need to make one item for the selected recipe
+	local numToMake = 1
+	local _, _, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(recipeIndex, reagentRecipeIndex)
+	-- make enough reagents to craft one more item
+	numToMake = math.min(math.floor(playerReagentCount/reagentCount+1)*reagentCount-playerReagentCount,numReagentMakable)
+
+	-- take into account that some recipe craft more than one item
+	-- use the mean between min and max, but make at least one...
+	local minMade, maxMade = GetTradeSkillNumMade(reagentIndex)
+	numToMake = math.max(math.floor(2*numToMake/(maxMade+minMade)),1)
+	
+	-- Choose number or craft directly
+	if chooseNumber then
+		-- the dialog window is linked to the reagent button
+		local btn = _G["TradeSkillReagent"..reagentRecipeIndex]
+
+		-- Store info to be able to run the function later
+		btn.ReagentMaker_reagentIndex = reagentIndex
+
+		-- Open dialog
+		OpenStackSplitFrame(numReagentMakable, btn, "TOP", "BOTTOM")
+
+		-- Fill in the number to make
+		numToMake = tostring(numToMake)
+		for i = 1,numToMake:len() do
+			StackSplitFrame_OnChar(StackSplitFrame,numToMake:gsub(i,i))
+		end
+		StackSplitFrame.typing = 0 -- reinit the frame so tha the entered value will be erased on text entry
+	else
+		DoTradeSkill(reagentIndex,numToMake)
+	end -- if
+end -- function
+
+
+-- Button hovering
+function A.btnEntered(btn)
+	-- Do not manage guild tradeskill
+	if IsTradeSkillGuild() or IsTradeSkillLinked() then return end
+
+	-- Index of the reagent in the recipe, taken from the button name
+	local reagentRecipeIndex = A.buttonNumber(btn)
+
+	-- ID of the reagent we want to craft
+	local reagentLink = GetTradeSkillReagentItemLink(GetTradeSkillSelectionIndex(), reagentRecipeIndex)
+	local reagentID = A.link2ID(reagentLink)
+
+	-- Continue only if the reagent is known
+	if not reagentID or not A.data[reagentID] then return end
+
+	btn.textureHighlight:Show()
+
+	-- Check if the item is made by only one recipe. If not, return
+	if not A.isRecipeUnique(A.data[reagentID]) then return end
+
+	-- Tooltips
+	local link = A.data[reagentID][1].spellLink
+	if link then
+		A.tooltipRecipe:SetOwner(btn)
+		A.tooltipRecipe:SetHyperlink(link)
+		A.tooltipRecipe:Show()
+		A.tooltipRecipe:ClearAllPoints()
+		A.tooltipRecipe:SetPoint("BOTTOMLEFT",GameTooltip,"BOTTOMRIGHT")
+	end
+end
+
+function A.btnLeft(btn)
+	btn.textureHighlight:Hide()
+	A.tooltipRecipe:Hide()
+end -- function
+
+function A.updateCounts(recipeIndex)
+	-- Needs an argument
+	if not recipeIndex then return end
+
+	-- Do not manage guild tradeskill
+	if IsTradeSkillGuild() or IsTradeSkillLinked() then
+		for reagentRecipeIndex = 1,GetTradeSkillNumReagents(recipeIndex) do
+			-- If the normal tradeskill hasn't been opened yet, the field 'label' doesn't exists yet
+			local label = _G["TradeSkillReagent"..reagentRecipeIndex].label
+			if label then
+				label:Hide()
+			end
+		end
+		return
+	end
+
+	-- Count makable items and show it
+	for reagentRecipeIndex = 1,GetTradeSkillNumReagents(recipeIndex) do
+		-- ID of the reagent we want to craft
+		local reagentLink = GetTradeSkillReagentItemLink(recipeIndex, reagentRecipeIndex)
+		local reagentID = A.link2ID(reagentLink)
+
+		local label = _G["TradeSkillReagent"..reagentRecipeIndex].label
+		if not label then break end -- Shouldn't happen...
+
+		-- Continue only if the reagent is known
+		if not reagentID or not A.data[reagentID] then
+			label:Hide()
+		else
+			-- Count and show
+			local numMakable = A.numMakable(reagentID)
+			if not numMakable or #(A.data[reagentID]) ~= 1 or A.data[reagentID][1].macro then
+				label:SetText("?")
+				label:SetTextColor(0, 0.5, 1, 1) -- blue
+			else
+				label:SetText(numMakable)
+				if numMakable==0 then
+					label:SetTextColor(1, 0, 0, 1) -- red
+				else
+					label:SetTextColor(0, 1, 0, 1) -- green
+				end
+			end -- if
+			label:Show()
+		end -- if
+	end -- for
+end -- function
+hooksecurefunc("SelectTradeSkill",A.updateCounts)
--- a/ReagentMaker.toc	Fri May 20 00:54:15 2011 +0200
+++ b/ReagentMaker.toc	Fri May 20 18:32:43 2011 +0200
@@ -10,6 +10,7 @@
 ProspectingData.lua
 MillingData.lua
 
+CampFireButton.lua
 utils.lua
 data.lua
 SecureMenu.lua
--- a/data.lua	Fri May 20 00:54:15 2011 +0200
+++ b/data.lua	Fri May 20 18:32:43 2011 +0200
@@ -76,6 +76,7 @@
 					-- reagent ID
 					reagentID = A.link2ID(GetTradeSkillReagentItemLink(i, 1))
 
+
 					-- reagent number needed
 					reagentCount = select(3,GetTradeSkillReagentInfo(i, 1))
 				end
@@ -125,8 +126,6 @@
 				end -- if
 			end -- if
 		end -- for
-
-		zzz = A.data
 		-- the scanning is complete
 		return true
 	end -- function
--- a/localization.lua	Fri May 20 00:54:15 2011 +0200
+++ b/localization.lua	Fri May 20 18:32:43 2011 +0200
@@ -1,17 +1,17 @@
-local addonName, A = ...
-
-local L = setmetatable({}, {
-	__index = function(self, key)
-		return tostring(key)
-	end,
-})
-A.L = L
-
---@localization(locale="enUS", format="lua_additive_table", handle-unlocalized="english")@
-
-local locale = GetLocale()
-if locale == 'frFR' then
-
---@localization(locale="frFR", format="lua_additive_table", handle-unlocalized="comment")@
-
+local addonName, A = ...
+
+local L = setmetatable({}, {
+	__index = function(self, key)
+		return tostring(key)
+	end,
+})
+A.L = L
+
+--@localization(locale="enUS", format="lua_additive_table", handle-unlocalized="english")@
+
+local locale = GetLocale()
+if locale == 'frFR' then
+
+--@localization(locale="frFR", format="lua_additive_table", handle-unlocalized="comment")@
+
 end
\ No newline at end of file