Mercurial > wow > reagentmaker
changeset 100:0fd1fd1ba2d9
Automated merge with ssh://hg.wowace.com/wow/reagentmaker/mainline
author | contrebasse |
---|---|
date | Fri, 20 May 2011 19:29:13 +0200 |
parents | b980c00affcd (diff) 4d376d031f8d (current diff) |
children | 060f5d0f7a35 |
files | EnchantOnScroll.lua |
diffstat | 11 files changed, 826 insertions(+), 423 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Fri May 20 19:28:20 2011 +0200 +++ b/.hgtags Fri May 20 19:29:13 2011 +0200 @@ -6,3 +6,5 @@ 6a91e19275c8c6933b0a8096a6adc795710514fb v1.0beta5 8dd86b6b76d8f5aa3aab735d404c643c6b2ed4f9 v1.0beta6 d2b4b378bea46074467cc4298a399e92ec141a40 v1.0beta7 +e1484cc77f016f1f97892457827cf7a2effb167a v1.0beta8 +e3147b41ea9deaa7e46178c31eeda171e6e32c13 v1.0beta9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CampFireButton.lua Fri May 20 19:29:13 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CommonData.lua Fri May 20 19:29:13 2011 +0200 @@ -0,0 +1,56 @@ +local addonName, A = ... + +A.CommonData = { + [10939] = {{10938, 3, 1,spellID=13361}}, -- Lesser to Greater Magic Essence + [11082] = {{10998, 3, 1,spellID=13497}}, -- Lesser to Greater Astral Essence + [11135] = {{11134, 3, 1,spellID=13632}}, -- Lesser to Greater Mystic Essence + [11175] = {{11174, 3, 1,spellID=13739}}, -- Lesser to Greater Nether Essence + [16203] = {{16202, 3, 1,spellID=20039}}, -- Lesser to Greater Eternal Essence + [22446] = {{22447, 3, 1,spellID=32977}}, -- Lesser to Greater Planar Essence + [34055] = {{34056, 3, 1,spellID=44123}}, -- Lesser to Greater Cosmic Essence + [52719] = {{52718, 3, 1,spellID=74186}}, -- Lesser to Greater Celestial Essence + + [10938] = {{10939, 1, 3,spellID=13362}}, -- Greater to Lesser Magic Essence + [10998] = {{11082, 1, 3,spellID=13498}}, -- Greater to Lesser Astral Essence + [11134] = {{11135, 1, 3,spellID=13633}}, -- Greater to Lesser Mystic Essence + [11174] = {{11175, 1, 3,spellID=13740}}, -- Greater to Lesser Nether Essence + [16202] = {{16203, 1, 3,spellID=20040}}, -- Greater to Lesser Eternal Essence + [22447] = {{22446, 1, 3,spellID=32978}}, -- Greater to Lesser Planar Essence + [34056] = {{34055, 1, 3,spellID=44122}}, -- Greater to Lesser Cosmic Essence + [52718] = {{52719, 1, 3,spellID=74187}}, -- Greater to Lesser Celestial Essence + + [52721] = {{52720, 3, 1,spellID=74188}}, -- Small Heavenly Shard to Heavenly Shard + [34052] = {{34053, 3, 1,spellID=61755}}, -- Small Dream Shard to Dream Shard + + [33568] = {{33567, 5, 1,spellID=59926}}, -- Borean Leather Scraps to Borean Leather + [52976] = {{52977, 5, 1,spellID=74493}}, -- Savage Leather Scraps to Savage Leather + + [22451] = {{22572,10, 1,spellID=28100}}, -- Mote of Air to Primal Air + [22452] = {{22573,10, 1,spellID=28101}}, -- Mote of Earth to Primal Earth + [21884] = {{22574,10, 1,spellID=28102}}, -- Mote of Fire to Primal Fire + [21886] = {{22575,10, 1,spellID=28106}}, -- Mote of Life to Primal Life + [22457] = {{22576,10, 1,spellID=28105}}, -- Mote of Mana to Primal Mana + [22456] = {{22577,10, 1,spellID=28104}}, -- Mote of Shadow to Primal Shadow + [21885] = {{22578,10, 1,spellID=28103}}, -- Mote of Water to Primal Water + + [35623] = {{37700,10, 1,spellID=49234}}, -- Crystallized to Eternal Air + [35624] = {{37701,10, 1,spellID=49248}}, -- Crystallized to Eternal Earth + [36860] = {{37702,10, 1,spellID=49244}}, -- Crystallized to Eternal Fire + [35625] = {{37704,10, 1,spellID=49247}}, -- Crystallized to Eternal Life + [35627] = {{37703,10, 1,spellID=49246}}, -- Crystallized to Eternal Shadow + [35622] = {{37705,10, 1,spellID=49245}}, -- Crystallized to Eternal Water + + [37700] = {{35623, 1,10,spellID=56045}}, -- Eternal to Crystallized Air + [37701] = {{35624, 1,10,spellID=56041}}, -- Eternal to Crystallized Earth + [37702] = {{36860, 1,10,spellID=56042}}, -- Eternal to Crystallized Fire + [37704] = {{35625, 1,10,spellID=56043}}, -- Eternal to Crystallized Life + [37703] = {{35627, 1,10,spellID=56044}}, -- Eternal to Crystallized Shadow + [37705] = {{35622, 1,10,spellID=56040}}, -- Eternal to Crystallized Water +} + +-- Add "Tradeskill" data to each "recipe" +for itemID,t in pairs(A.CommonData) do + t[1].macro = "/use %s" + --t[1].spellName = GetSpellInfo(t[1].spellID) + t[1].spellLink = GetSpellLink(t[1].spellID) +end
--- a/EnchantOnScroll.lua Fri May 20 19:28:20 2011 +0200 +++ b/EnchantOnScroll.lua Fri May 20 19:29:13 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/MillingData.lua Fri May 20 19:28:20 2011 +0200 +++ b/MillingData.lua Fri May 20 19:29:13 2011 +0200 @@ -138,7 +138,6 @@ for i,v in ipairs(t) do v.macro = macroMill v.spellID = MillID - v.spellName = MillName v.spellLink = MillLink end end
--- a/ProspectingData.lua Fri May 20 19:28:20 2011 +0200 +++ b/ProspectingData.lua Fri May 20 19:29:13 2011 +0200 @@ -1,6 +1,86 @@ local addonName, A = ... --- @todo: complete prospecting items +-- 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] = { @@ -8,50 +88,206 @@ -- {reagentID, numberNeeded, minProduced, maxProduced} -- {reagentID, numberNeeded, chanceToHaveOne}} A.ProspectingData = { - -- Prospect - [774] = { -- Malachite - {2770,5,0.5}}, -- Copper Ore - [818] = { -- Tigerseye - {2770,5,0.5}}, -- Copper Ore - [1210] = { -- Shadowgem - {2771,5,0.38}, -- Tin Ore - {2770,5,0.1}}, -- Copper Ore - [1705] = { -- Lesser Moonstone - {2771,5,0.38}, -- Tin Ore - {2772,5,0.35}}, -- Iron Ore - [1206] = { -- Moss Agate - {2771,5,0.37}}, -- Tin Ore - [1529] = { -- Jade - {2772,5,0.35}, -- Iron Ore - {2771,5,0.03}}, -- Tin Ore - [7909] = { -- Aquamarine - {3858,5,0.35}, -- Mithril Ore - {2772,5,0.05}, -- Iron Ore - {2771,5,0.03}}, -- Tin Ore - [3864] = { -- Citrine - {2772,5,0.36}, -- Iron Ore - {3858,5,0.35}, -- Mithril Ore - {2771,5,0.03}}, -- Tin Ore - [7910] = { -- Star Ruby - {3858,5,0.36}, -- Mithril Ore - {10620,5,0.15}, -- Thorium Ore - {2772,5,0.05}}, -- Iron Ore - [12799] = { -- Large Opal - {10620,5,0.31}, -- Thorium Ore - {3858,5,0.03}}, -- Mithril Ore - [12361] = { -- Blue Sapphire - {10620,5,0.31}, -- Thorium Ore - {3858,5,0.02}}, -- Mithril Ore - [12800] = { -- Azerothian Diamond - {10620,5,0.31}, -- Thorium Ore - {3858,5,0.02}}, -- Mithril Ore - [12364] = { -- Huge Emerald - {10620,5,0.31}, -- Thorium Ore - {3858,5,0.02}}, -- Mithril Ore - [23112] = { -- Golden Draenite - {23424,5,0.19}, -- Fel Iron Ore - {23425,5,0.18}}, -- Adamantite Ore - -- To be continued... + -- 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 @@ -65,7 +301,6 @@ for i,v in ipairs(t) do v.macro = macroProspect v.spellID = ProspectID - v.spellName = ProspectName v.spellLink = ProspectLink end end
--- a/ReagentMaker.lua Fri May 20 19:28:20 2011 +0200 +++ b/ReagentMaker.lua Fri May 20 19:29:13 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 ~= 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 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 (not A.data[reagentID][1].manyReagents) 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 19:28:20 2011 +0200 +++ b/ReagentMaker.toc Fri May 20 19:29:13 2011 +0200 @@ -6,9 +6,11 @@ localization.lua +CommonData.lua ProspectingData.lua MillingData.lua +CampFireButton.lua utils.lua data.lua SecureMenu.lua
--- a/SecureMenu.lua Fri May 20 19:28:20 2011 +0200 +++ b/SecureMenu.lua Fri May 20 19:29:13 2011 +0200 @@ -118,7 +118,7 @@ GameTooltip:SetOwner(btn,"ANCHOR_LEFT") GameTooltip:SetHyperlink(btn.reagentLink) GameTooltip:Show() - if btn.spellLink then + if btn.spellLink and btn.spellLink~=btn.reagentLink then A.tooltipRecipe:SetOwner(GameTooltip) A.tooltipRecipe:SetHyperlink(btn.spellLink) A.tooltipRecipe:Show() @@ -191,7 +191,11 @@ end local function WarnNotMakable(btn) - A.Error(A.L["You do not have enough [%s] to craft [%s]"]:format(btn.itemNameString,TitleText:GetText())) + if not btn.reagentID then + A.Error(A.L["You do not have enough reagents to craft [%s]"]:format(TitleText:GetText())) + else + A.Error(A.L["You do not have enough [%s] to craft [%s]"]:format(btn.itemNameString,TitleText:GetText())) + end end -- Update counts and button actions @@ -255,22 +259,38 @@ end -- Set text and icon - local name, link, _, _, _, _, _, _, _, texture = GetItemInfo(reagent[1]) - if not (name and link and texture) then - -- Will be retried on next OnUpdate - return + local name, link, texture, _ + if reagent[1] then + name, link, _, _, _, _, _, _, _, texture = GetItemInfo(reagent[1]) + if not (name and link and texture) then + -- Will be retried on next OnUpdate + return + end + elseif reagent.spellLink then + --name, rank, icon, powerCost, isFunnel, powerType, castingTime, minRange, maxRange = GetSpellInfo(id) + name, _, texture = GetSpellInfo(A.link2ID(reagent.spellLink)) + if not (name and texture) then + -- Will be retried on next OnUpdate + return + end + link = reagent.spellLink end + btn.itemName:SetText(name) btn.icon:SetTexture(texture) -- Set chance to have the item or the number of items created + btn.resultNumber:Hide() if reagent[3] then if reagent[3]<1 then btn.resultNumber:SetText((reagent[3]*100).."%") + btn.resultNumber:Show() elseif reagent[4] and reagent[3]~=reagent[4] then btn.resultNumber:SetText(math.min(reagent[3],reagent[4]).."-"..math.max(reagent[3],reagent[4])) + btn.resultNumber:Show() elseif reagent[3]>1 then btn.resultNumber:SetText(reagent[3]) + btn.resultNumber:Show() end end @@ -339,7 +359,7 @@ noSkipped = menuAddItem(reagent.macro,itemID,reagent) and noSkipped else -- Standard tradeskill spell - if reagent.spellName == A.currentTradeSkill then + if not reagent.spellName or reagent.spellName == A.currentTradeSkill then existsValidEntries = true noSkipped = menuAddItem(A.craft,itemID,reagent) and noSkipped end
--- a/data.lua Fri May 20 19:28:20 2011 +0200 +++ b/data.lua Fri May 20 19:29:13 2011 +0200 @@ -3,7 +3,7 @@ -- @todo: enchants, elementals, prospecting -- @todo improve scanning -A.data = {} +A.data = A.CommonData do -- lua functions @@ -70,11 +70,16 @@ -- item ID local itemID = A.link2ID(GetTradeSkillItemLink(i)) - -- reagent ID, valid only if there's only one reagent as we take only the first one - local reagentID = A.link2ID(GetTradeSkillReagentItemLink(i, 1)) + local numReagents = GetTradeSkillNumReagents(i) + local reagentID, reagentCount + if numReagents==1 then + -- reagent ID + reagentID = A.link2ID(GetTradeSkillReagentItemLink(i, 1)) - -- reagent number needed - local _, _, reagentCount, _ = GetTradeSkillReagentInfo(i, 1) + + -- reagent number needed + reagentCount = select(3,GetTradeSkillReagentInfo(i, 1)) + end -- number of reagent created by the recipe local minMade, maxMade = GetTradeSkillNumMade(i) @@ -83,7 +88,7 @@ local recipeLink = GetTradeSkillRecipeLink(i) -- error checking - if itemID and reagentID and reagentCount and minMade and maxMade and recipeLink then + if itemID and (numReagents ~= 1 or (reagentID and reagentCount)) and minMade and maxMade and recipeLink then -- remove unneeded minMade/maxMade if maxMade==minMade then maxMade = nil @@ -111,7 +116,6 @@ spell.spellName = tradeskillName spell.spellLink = recipeLink spell.header = lastHeader - spell.manyReagents = GetTradeSkillNumReagents(i)>1 tinsert(A.data[itemID],spell) end @@ -122,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 19:28:20 2011 +0200 +++ b/localization.lua Fri May 20 19:29:13 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