------------------------------------------------------
Fizzwidget AutoCraft
by Gazmik Fizzwidget
http://www.fizzwidget.com/autocraft
gazmik@fizzwidget.com
------------------------------------------------------

So, I was playing my favorite strategy game with my good friend Marin Noggenfogger the other day, and I was struck with a brilliant idea for how to design a device that keeps track of what things you'll build next! I had to run off to my workshop and get started on it right away. (Besides, good old Marin was never going to find my last peon anyway...)

The result: the Automatronic Craftobot 100! (Or AutoCraft, for short.) This handy automaton takes care of repetitive crafting tasks for you!

------------------------------------------------------

INSTALLATION: Put this folder into your World Of Warcraft/Interface/AddOns folder and launch WoW.

FEATURES: 
- This addon changes the "Create" and "Create All" buttons in the trade skill window to become "Queue" and "Queue All". They work just as before... except you can also them click them again once you're already working on a product, and they'll queue the additional item(s) to be automatically produced as soon as the current item(s) are finished. 
- There's also a "Queue Everything" button -- click it to automatically queue up all the items you can currently create. ("Everything" actually means "everything currently in the window"... for example, if you're a tailor, switch to showing only the Trade Goods group and hit "Queue Everything" and it'll convert all your cloth to bolts without trying to also do something else.) 
- You can queue several items you have the reagents for even if you're currently unable to produce them (e.g. on a wind rider or gryphon, a smith away from a forge) and then make them all once you're ready, or pause queued work and resume it later if you need to stop for a break. The "Run Queue Automatically" checkbox controls whether we'll try to start working on items as soon as they're queued or wait until you press the "Run Queue" button yourself.
- There's also a "Buy" button; if you speak to a vendor while keeping your tradeskill window open, clicking this will automatically find and buy whatever reagents are needed for the selected item. (It works like the "Queue" button, too, so you can type in a number and buy enough reagents for that many items.) For example, a tailor who wants to make five Mageweave Bags and has three Silken Thread on hand can type "5" in the text box and press "Buy", and we'll automatically buy seven Silken Thread (assuming they have Mageweave Bag selected and are talking to a vendor who sells Silken Thread).

Queued items are shown as icons above the crafting progress bar, and you can click an icon to cancel production of the item(s) it represents. 

CAVEATS, KNOWN BUGS, ETC.: 
	- Doesn't work with Enchanting. (At least, not yet. I'm not sure it's worth it, either, as there aren't many items created by enchanting, much less situations where one often wants to create several in a row.)
	- "Queue Everything" works from bottom to top, so it may not actually end up trying to make everything that shows as available as of when you click the button. For example, if your beginning tailor has one Bolt of Linen Cloth and one Coarse Thread, the window will show Brown Linen Vest, Simple Linen Pants, and Linen Cloak as available... but if you click "Queue Everything", we'll start on the Linen Cloak, which will use up all the reagents we have on hand, so we won't queue Simple Linen Pants or Brown Linen Vest. Alt-clicking (or Option-clicking) the button will reverse the order -- working from the top to the bottom of the list -- but the same logic applies; once something is queued, the reagents it uses are unavailable for further queueing.
	
------------------------------------------------------
VERSION HISTORY

v. 1800.8 - 2005/11/18
- The previous release's fix for "Buy Reagents" broke buying things that come in stacks (e.g. vials in pack of 5)... Fixed.

v. 1800.7 - 2005/11/18
- The "Buy Reagents" button formerly didn't work right if buying a large quantity of an item that a merchant sells singly. (e.g. trying to by 24 [Hot Spices].) Fixed.
- Includes refinements to code shared with other GFW mods.

v. 1800.6 - 2005/10/22
- Fixed a syntax error in the localization.lua file. Oops!

v. 1800.5 - 2005/10/22
- The previous release included a bit of code to prepare for the WoW 1.9 patch (in which we'll be set up to load dynamically whenever Blizzard_TradeSkillUI does), which turned out to be buggy. This normally wouldn't matter to 1.8 users, except that several third-party addons are forcing the Blizzard_TradeSkillUI to load on login -- generally, this is a bad thing, as it negates the reduced RAM usage and login time benefits of patch 1.8 and could lead to worse addon conflicts in the future. This release fixes the AutoCraft error on login caused by that situation... however, if you were experiencing this error in 1800.4, I strongly recommend going through your addons to find out which are causing Blizzard_TradeSkillUI to load on login and hounding their authors for proper patch 1.8 compatibility.
- Included a partial French localization by Khisanth.

v. 1800.4 - 2005/10/20
- Changed the way we hook the TradeSkill window for recalculating available reagents... this should finally do away with the "freeze on opening TradeSkill window" problem. Really this time! (Note: There may be a delay of several seconds when showing a TradeSkill window for the first time, as we tend to cause the WoW client to request extra information from the server that it may not already be cached. This delay should only happen once for each profession, or for as long as your WDB cache is intact.)
- Reversed the default and alt-click behavior of "Queue Everything", as many users were requesting the alt-click behavior without realizing it was there. Now, "Queue Everything" will work from the bottom of the list to the top by default (which, for example, journeyman miners might find useful as it'll automatically queue Smelt Copper and Smelt Tin followed by Smelt Bronze). Alt-clicking "Queue Everything" will work from top to bottom.
- Recipes that produce a quantity of items each time they're crafted are now accounted for when being considered as reagents. (For example, an engineer can queue Silver Contact once and then be able to queue five Small Bronze Bombs.) For recipes that can produce a variable quantity (e.g. EZ-Throw Dynamite, which randomly creates 1-3 individual explosives), we assume the minimum quantity will be produced -- otherwise it might be possible to queue more work than you'd have the materials for.
- Fixed an issue where we'd lose track of whether you're currently crafting a queued item sometimes (such as if you filled up your inventory) and become unable to resume crafting.
- Tooltips should now show up correctly for the second row of queue icons (if you queue six or more different items).
- If you queue more than ten items, the tenth icon will become a question mark, and mousing over it will show a tooltip listing the additional items.

v. 1800.3 - 2005/10/14
- Tweaked our caching of hooked function return values; the "freeze on opening tradeskill window" issue should be gone now. (At least, I can't replicate it on any of several characters with varous trade skills.)
- Fixed a nil error that sometimes appeared while crafting. 

v. 1800.2 - 2005/10/12
- Actually works on WoW patch 1.8 now.
- Should now be functionally locale-independent; we now get the "You create <something>" (which we need in order to figure out how your queue in progressing) from WoW's own localized strings file. Still localized only in English and (partially) German.
- Fixed a problem where we'd fail to detect when an item was finished. 
- Fixed a problem where advancing the queue too fast after crafting one item that was needed as an ingredient for the next would fail (possibly due to client/server lag; WoW was thinking the first item hadn't been crafted yet by the time we tried to start on the second).
- Fixed a problem where the tradeskill window could sometimes show incorrect or nonsensical numbers for required or available reagents. 
- Fixed an "attempt to compare number with nil" error message that sometimes appeared when showing the tradeskill window.
- Should now properly handle cases where more than one recipe can produce the same item (e.g. Transmute Life to Earth, Transmute Fire to Earth).
- Should now be compatible with other mods that alter the height of the TradeSkillFrame.

v. 1800.1 - 2005/10/11
- Updated for WoW patch 1.8.
- New Feature: You can pause and resume the queue (and control whether it starts automatically when you add to it), and switch among multiple trade skill windows without losing track of what's queued up. Unfortunately, there's no way for us to auotmatically switch to the apporpriate skill when it's needed in the queue; so, for example, if you're a miner/smith and queue a bunch of smelting followed by some smithing, we'll automatically pause the queue when we get done with the smelting and ask you to switch to your Blacksmithing window.
- New Feature: We now account for queued items when calculating what trade skill actions are available. For example, if you're a miner, you can queue your copper and tin for smelting and then queue Smelt Bronze without waiting for the copper and tin to finish. Also, this means you can't queue more items than you can make; for example, a leatherworker who queues up enough Heavy Armor Kits to use up all his Heavy Leather won't be able to queue any Heavy Leather Balls. (At least, not until he gets more leather or unqueues some of the armor kits.)
- New Feature: There's now a "Buy" button which allows you to purchase vendor-supplied reagents automatically.
- There's a little background behind all the extra TradeSkillFrame widgets so they don't look so ugly hanging off the bottom.
- General improvements to utility code shared with other Fizzwidget addons (GFWUtils and GFWTable).

v. 1700.1 - 2005/09/13
- Updated TOC for WoW patch 1.7.
- Cleaned up code shared with other Fizzwidget mods; should no longer produce cryptic error messages if you don't have the latest versions of everything (starting with version 1700.1 of all mods).

v. 1600.4 - 2005/08/27
- Code cleanup and standardization among Fizzwidget mods.
- Supports wowguru.com's UI updater utility (and potentially others).

v. 1600.3 - 2005/08/05
- Compatible with French WoW. (Not yet localized.)
- Partial German localization. (Uncomment some stuff in localization.lua for a fuller translation, but then you'll have text that overflows buttons. Got a better idea? I'm listening.)

v. 1600.2 - 2005/07/27
- Buttons should now appear in the correct (usable) places if you're using EnhancedTradeSkill or other addons that modify the geometry of TradeSkillFrame.
- Beginnings of locale compatibility; should now work with the German WoW client (not yet actually translated, though). Savvy users of other languages feel free to look at localization.lua; please contact me with your translations and I'll include them in the next release.

v. 1600.1 - 2005/07/25
- Initial release.
