changeset 161:fcc95c62d232

Premade groups can now be combined into a single group to allow easier adding of a combination (e.g. all glyphs at once).
author Zerotorescue
date Sun, 23 Jan 2011 18:24:00 +0100
parents 08b887885bd5
children 60666d59a524
files Data/PremadeGroups.lua Modules/Config.lua
diffstat 2 files changed, 129 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/Data/PremadeGroups.lua	Sat Jan 22 21:30:02 2011 +0100
+++ b/Data/PremadeGroups.lua	Sun Jan 23 18:24:00 2011 +0100
@@ -15,11 +15,27 @@
 -- without this, manually removed items would be re-imported again, which we do not want)
 
 addon.defaultGroups = {
+	["Inscription - Glyphs (All)"] = {
+		["version"] = 1,
+		["isParent"] = true,
+		["childs"] = {
+			"Inscription - Glyphs by class - Death Knight",
+			"Inscription - Glyphs by class - Druid",
+			"Inscription - Glyphs by class - Hunter",
+			"Inscription - Glyphs by class - Mage",
+			"Inscription - Glyphs by class - Paladin",
+			"Inscription - Glyphs by class - Priest",
+			"Inscription - Glyphs by class - Rogue",
+			"Inscription - Glyphs by class - Shaman",
+			"Inscription - Glyphs by class - Warlock",
+			"Inscription - Glyphs by class - Warrior",
+		},
+	},
 	-- Glyphs by class
 	-- Source: http://www.wowhead.com/items=16.6?filter=cr=87;crs=12;crv=0
 	["Inscription - Glyphs by class - Death Knight"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[43533] = 1, -- Glyph of Anti-Magic Shell
 			[43534] = 1, -- Glyph of Heart Strike
 			[43535] = 1, -- Glyph of Blood Tap
@@ -52,8 +68,8 @@
 		},
 	},
 	["Inscription - Glyphs by class - Druid"] = {
-		version = 2,
-		items = {
+		["version"] = 2,
+		["items"] = {
 			[45604] = 1, -- Glyph of Savage Roar
 			[40921] = 1, -- Glyph of Starfall
 			[44928] = 1, -- Glyph of Focus
@@ -98,8 +114,8 @@
 		},
 	},
 	["Inscription - Glyphs by class - Hunter"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[42904] = 1, -- Glyph of Disengage
 			[42907] = 1, -- Glyph of Misdirection
 			[45733] = 1, -- Glyph of Master's Call
@@ -134,8 +150,8 @@
 		},
 	},
 	["Inscription - Glyphs by class - Mage"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[45739] = 1, -- Glyph of Mirror Image
 			[42748] = 1, -- Glyph of Invisibility
 			[42736] = 1, -- Glyph of Arcane Power
@@ -172,8 +188,8 @@
 		},
 	},
 	["Inscription - Glyphs by class - Paladin"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[41102] = 1, -- Glyph of Turn Evil
 			[41107] = 1, -- Glyph of the Ascetic Crusader
 			[41109] = 1, -- Glyph of Light of Dawn
@@ -212,8 +228,8 @@
 		},
 	},
 	["Inscription - Glyphs by class - Priest"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[42404] = 1, -- Glyph of Mass Dispel
 			[42407] = 1, -- Glyph of Power Word: Barrier
 			[45753] = 1, -- Glyph of Dispersion
@@ -250,8 +266,8 @@
 		},
 	},
 	["Inscription - Glyphs by class - Rogue"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[45766] = 1, -- Glyph of Fan of Knives
 			[45767] = 1, -- Glyph of Tricks of the Trade
 			[45761] = 1, -- Glyph of Vendetta
@@ -291,8 +307,8 @@
 		},
 	},
 	["Inscription - Glyphs by class - Shaman"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[45777] = 1, -- Glyph of Hex
 			[45771] = 1, -- Glyph of Feral Spirit
 			[45772] = 1, -- Glyph of Riptide
@@ -331,8 +347,8 @@
 		},
 	},
 	["Inscription - Glyphs by class - Warlock"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[45782] = 1, -- Glyph of Demonic Circle
 			[45783] = 1, -- Glyph of Shadowflame
 			[45779] = 1, -- Glyph of Haunt
@@ -370,8 +386,8 @@
 		},
 	},
 	["Inscription - Glyphs by class - Warrior"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[63481] = 1, -- Glyph of Colossus Smash
 			[43418] = 1, -- Glyph of Heroic Throw
 			[43419] = 1, -- Glyph of Intervene
@@ -414,14 +430,14 @@
 	-- Glyphs by inks
 	-- Exported with a PHP script
 	["Inscription - Glyphs by ink - Blackfallow Ink"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[63481] = 1, -- Glyph of Colossus Smash
 		},
 	},
 	["Inscription - Glyphs by ink - Midnight Ink"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[43418] = 1, -- Glyph of Heroic Throw
 			[43396] = 1, -- Glyph of Berserker Rage
 			[43395] = 1, -- Glyph of Battle
@@ -469,8 +485,8 @@
 		},
 	},
 	["Inscription - Glyphs by ink - Ink of the Sea"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[43419] = 1, -- Glyph of Intervene
 			[49084] = 1, -- Glyph of Command
 			[45794] = 1, -- Glyph of Intimidating Shout
@@ -580,8 +596,8 @@
 		},
 	},
 	["Inscription - Glyphs by ink - Ethereal Ink"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[45790] = 1, -- Glyph of Bladestorm
 			[45792] = 1, -- Glyph of Shockwave
 			[45795] = 1, -- Glyph of Spell Reflection
@@ -652,8 +668,8 @@
 		},
 	},
 	["Inscription - Glyphs by ink - Lion's Ink"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[43398] = 1, -- Glyph of Demoralizing Shout
 			[45797] = 1, -- Glyph of Shield Wall
 			[43423] = 1, -- Glyph of Slam
@@ -704,8 +720,8 @@
 		},
 	},
 	["Inscription - Glyphs by ink - Shimmering Ink"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[67482] = 1, -- Glyph of Intercept
 			[43416] = 1, -- Glyph of Bloodthirst
 			[42468] = 1, -- Glyph of Shadowburn
@@ -728,8 +744,8 @@
 		},
 	},
 	["Inscription - Glyphs by ink - Jadefire Ink"] = {
-		version = 2,
-		items = {
+		["version"] = 2,
+		["items"] = {
 			[43424] = 1, -- Glyph of Revenge
 			[67483] = 1, -- Glyph of Death Wish
 			[43422] = 1, -- Glyph of Overpower
@@ -768,8 +784,8 @@
 		},
 	},
 	["Inscription - Glyphs by ink - Celestial Ink"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[43414] = 1, -- Glyph of Cleaving
 			[45793] = 1, -- Glyph of Furious Sundering
 			[42466] = 1, -- Glyph of Soul Swap
@@ -800,8 +816,8 @@
 	-- Rare gems (Cataclysm)
 	-- Source: http://www.wowhead.com/items=3.0?filter=qu=3;minle=81;maxle=90;cr=87;crs=12;crv=0
 	["Jewelcrafting - Cata Rare Gems (Inferno Ruby)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52206] = 1, -- Bold Inferno Ruby
 			[52207] = 1, -- Brilliant Inferno Ruby
 			[52212] = 1, -- Delicate Inferno Ruby
@@ -810,8 +826,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Rare Gems (Ocean Sapphire)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52235] = 1, -- Rigid Ocean Sapphire
 			[52242] = 1, -- Solid Ocean Sapphire
 			[52244] = 1, -- Sparkling Ocean Sapphire
@@ -819,8 +835,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Rare Gems (Amberjewel)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52219] = 1, -- Fractured Amberjewel
 			[52226] = 1, -- Mystic Amberjewel
 			[52232] = 1, -- Quick Amberjewel
@@ -829,8 +845,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Rare Gems (Demonseye)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52203] = 1, -- Accurate Demonseye
 			[52210] = 1, -- Defender's Demonseye
 			[52213] = 1, -- Etched Demonseye
@@ -845,8 +861,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Rare Gems (Dream Emerald)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52218] = 1, -- Forceful Dream Emerald
 			[52223] = 1, -- Jagged Dream Emerald
 			[52225] = 1, -- Lightning Dream Emerald
@@ -860,8 +876,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Rare Gems (Ember Topaz)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52204] = 1, -- Adept Ember Topaz
 			[52205] = 1, -- Artful Ember Topaz
 			[52208] = 1, -- Reckless Ember Topaz
@@ -881,8 +897,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Meta Gems (Shadowspirit Diamond)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52289] = 1, -- Fleet Shadowspirit Diamond
 			[52291] = 1, -- Chaotic Shadowspirit Diamond
 			[52292] = 1, -- Bracing Shadowspirit Diamond
@@ -904,8 +920,8 @@
 	-- Common gems (Cataclysm)
 	-- Source: http://www.wowhead.com/items=3?filter=na=Nightstone;cr=87;crs=12;crv=0
 	["Jewelcrafting - Cata Common Gems (Nightstone)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52152] = 1, -- Perfect Accurate Nightstone
 			[52153] = 1, -- Perfect Veiled Nightstone
 			[52154] = 1, -- Perfect Retaliating Nightstone
@@ -931,8 +947,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Common Gems (Hessonite)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52139] = 1, -- Perfect Keen Hessonite
 			[52140] = 1, -- Perfect Artful Hessonite
 			[52141] = 1, -- Perfect Fine Hessonite
@@ -962,8 +978,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Common Gems (Jasper)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52129] = 1, -- Perfect Sensei's Jasper
 			[52130] = 1, -- Perfect Zen Jasper
 			[52131] = 1, -- Perfect Puissant Jasper
@@ -987,8 +1003,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Common Gems (Alicite)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52163] = 1, -- Perfect Fractured Alicite
 			[52164] = 1, -- Perfect Quick Alicite
 			[52165] = 1, -- Perfect Mystic Alicite
@@ -1002,8 +1018,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Common Gems (Carnelian)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52172] = 1, -- Perfect Precise Carnelian
 			[52173] = 1, -- Perfect Brilliant Carnelian
 			[52174] = 1, -- Perfect Flashing Carnelian
@@ -1017,8 +1033,8 @@
 		},
 	},
 	["Jewelcrafting - Cata Common Gems (Zephyrite)"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[52168] = 1, -- Perfect Rigid Zephyrite
 			[52169] = 1, -- Perfect Stormy Zephyrite
 			[52170] = 1, -- Perfect Sparkling Zephyrite
@@ -1035,8 +1051,8 @@
 	-- Epic gems (WotLK)
 	-- Source: http://www.wowhead.com/items=3?filter=na=Ametrine;cr=87;crs=12;crv=0
 	["Jewelcrafting - Epic Gems (Ametrine)"] = {
-		version = 2,
-		items = {
+		["version"] = 2,
+		["items"] = {
 			[40142] = 1, -- Inscribed Ametrine
 			[40144] = 1, -- Champion's Ametrine
 			[40145] = 1, -- Resplendent Ametrine
@@ -1056,8 +1072,8 @@
 		},
 	},
 	["Jewelcrafting - Epic Gems (Cardinal Ruby)"] = {
-		version = 2,
-		items = {
+		["version"] = 2,
+		["items"] = {
 			[40111] = 1, -- Bold Cardinal Ruby
 			[40112] = 1, -- Delicate Cardinal Ruby
 			[40113] = 1, -- Brilliant Cardinal Ruby
@@ -1068,8 +1084,8 @@
 		},
 	},
 	["Jewelcrafting - Epic Gems (Dreadstone)"] = {
-		version = 2,
-		items = {
+		["version"] = 2,
+		["items"] = {
 			[40129] = 1, -- Sovereign Dreadstone
 			[40130] = 1, -- Shifting Dreadstone
 			[40131] = -2, -- Glinting Dreadstone
@@ -1093,8 +1109,8 @@
 		},
 	},
 	["Jewelcrafting - Epic Gems (Eye of Zul)"] = {
-		version = 2,
-		items = {
+		["version"] = 2,
+		["items"] = {
 			[40138] = -2, -- Regal Eye of Zul
 			[40140] = -2, -- Jagged Eye of Zul
 			[40165] = 1, -- Jagged Eye of Zul
@@ -1116,8 +1132,8 @@
 		},
 	},
 	["Jewelcrafting - Epic Gems (King's Amber)"] = {
-		version = 2,
-		items = {
+		["version"] = 2,
+		["items"] = {
 			[40115] = 1, -- Subtle King's Amber
 			[40117] = -2, -- Smooth King's Amber
 			[40124] = 1, -- Smooth King's Amber
@@ -1127,8 +1143,8 @@
 		},
 	},
 	["Jewelcrafting - Epic Gems (Majestic Zircon)"] = {
-		version = 2,
-		items = {
+		["version"] = 2,
+		["items"] = {
 			[40119] = 1, -- Solid Majestic Zircon
 			[40120] = 1, -- Sparkling Majestic Zircon
 			[40121] = -2, -- Sparkling Majestic Zircon
@@ -1144,8 +1160,8 @@
 	-- Enchants (Heirlooms)
 	-- Source: manual retrieved from Wowhead
 	["Enchanting - Enchants - Heirlooms"] = {
-		version = 1,
-		items = {
+		["version"] = 1,
+		["items"] = {
 			[38873] = 1, -- Enchant Weapon - Crusader
 			[38838] = 1, -- Enchant Weapon - Fiery Weapon
 			[38896] = 1, -- Enchant Weapon - 2H Weapon - Agility
@@ -1166,8 +1182,8 @@
 	},
 	-- Source: http://www.wowhead.com/items=0.6?filter=na=enchant;cr=82;crs=1;crv=30300
 	["Enchanting - Enchants - Cataclysm"] = {
-		version = 2,
-		items = {
+		["version"] = 2,
+		["items"] = {
 			[52747] = 1, -- Enchant Weapon - Mending
 			[54447] = -2, -- Enchanted Spellthread                Removed in version 2 as this isn't a real enchant
 			[38916] = 1, -- Scroll of Enchant Weapon - Major Spirit
--- a/Modules/Config.lua	Sat Jan 22 21:30:02 2011 +0100
+++ b/Modules/Config.lua	Sun Jan 23 18:24:00 2011 +0100
@@ -241,6 +241,35 @@
 	end
 end
 
+local function ImportPremadeItemsGroup(groupName, name)
+	local premadeItemGroup = addon.defaultGroups[name];
+	
+	addon:Print(("Importing items from the premade group \"|cfffed000%s|r\"."):format(name));
+
+	-- Remember we imported this group and it's version so if it is ever changed, people can be notified
+	if not addon.db.profile.groups[groupName].premadeGroups then
+		addon.db.profile.groups[groupName].premadeGroups = {};
+	end
+	addon.db.profile.groups[groupName].premadeGroups[name] = premadeItemGroup.version;
+
+	for itemId, version in pairs(premadeItemGroup.items) do
+		if version > 0 then
+			-- Sanity check
+			itemId = itemId and tonumber(itemId);
+			
+			local itemData = addon.ItemData:New(itemId);
+			
+			if not itemId then
+				addon:Print(("\"|cfffed000%s|r\" is not a number."):format(name), addon.Colors.Red);
+			elseif itemData:InGroup() then
+				addon:Print(("Skipping |cfffed000%s|r as it is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ), addon.Colors.Red);
+			elseif itemData:AddToGroup(groupName) then
+				addon:Print(("Added %s to the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), groupName ), addon.Colors.Green);
+			end
+		end
+	end
+end
+
 -- Default group
 local defaultGroup = {
 	order = 0,
@@ -987,29 +1016,14 @@
 							set = function(info, value)
 								local groupName = groupIdToName[info[2]];
 								
-								addon:Print(("Importing items from the premade group \"|cfffed000%s|r\"."):format(value));
+								local premadeItemGroup = addon.defaultGroups[value];
 								
-								-- Remember we imported this group and it's version so if it is ever changed, people can be notified
-								if not addon.db.profile.groups[groupName].premadeGroups then
-									addon.db.profile.groups[groupName].premadeGroups = {};
-								end
-								addon.db.profile.groups[groupName].premadeGroups[value] = addon.defaultGroups[value].version;
-								
-								for itemId, version in pairs(addon.defaultGroups[value].items) do
-									if version > 0 then
-										-- Sanity check
-										itemId = itemId and tonumber(itemId);
-										
-										local itemData = addon.ItemData:New(itemId);
-										
-										if not itemId then
-											addon:Print(("\"|cfffed000%s|r\" is not a number."):format(value), addon.Colors.Red);
-										elseif itemData:InGroup() then
-											addon:Print(("Skipping |cfffed000%s|r as it is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ), addon.Colors.Red);
-										elseif itemData:AddToGroup(groupName) then
-											addon:Print(("Added %s to the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), groupName ), addon.Colors.Green);
-										end
+								if premadeItemGroup.isParent and premadeItemGroup.childs then
+									for _, premadeItemGroupName in pairs(premadeItemGroup.childs) do
+										ImportPremadeItemsGroup(groupName, premadeItemGroupName);
 									end
+								else
+									ImportPremadeItemsGroup(groupName, value);
 								end
 								
 								if AceConfigRegistry then