Quantcast

Add ItemList(name id ...) that sets ``name'' to a list of item IDs.

Johnny C. Lam [03-05-13 - 06:05]
Add ItemList(name id ...) that sets ``name'' to a list of item IDs.

This works in the same fashion as SpellList(name id ...) for assigning a
single name to a list of spell IDs.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@722 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleCompile.lua
OvaleData.lua
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index 2ddd8ef..10197a1 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -22,6 +22,7 @@ local missingSpellList = {}
 local ipairs, pairs, tonumber = ipairs, pairs, tonumber
 local strfind, strgmatch, strgsub = string.find, string.gmatch, string.gsub
 local strlen, strlower, strmatch, strsub = string.len, string.lower, string.match, string.sub
+local tinsert = table.insert
 --</private-static-properties>

 --<public-static-properties>
@@ -309,6 +310,15 @@ local function ParseSpellList(name, params)
 	end
 end

+local function ParseItemList(name, params)
+	OvaleData.itemList[name] = {}
+	local i = 1
+	for v in strgmatch(params, "(%d+)") do
+		OvaleData.itemList[name][i] = tonumber(v)
+		i = i + 1
+	end
+end
+
 local function ParseIf(a, b)
 	local newNode = {type="if", a=node[tonumber(a)], b=node[tonumber(b)]}
 	return AddNode(newNode)
@@ -585,6 +595,7 @@ local function CompileDeclarations(text)
 	text = strgsub(text, "SpellInfo%s*%((.-)%)", ParseSpellInfo)
 	text = strgsub(text, "ScoreSpells%s*%((.-)%)", ParseScoreSpells)
 	text = strgsub(text, "SpellList%s*%(%s*([%w_]+)%s*(.-)%)", ParseSpellList)
+	text = strgsub(text, "ItemList%s*%(%s*([%w_]+)%s*(.-)%)", ParseItemList)

 	-- On vire les espaces en trop
 	text = strgsub(text, "\n", " ")
diff --git a/OvaleData.lua b/OvaleData.lua
index 255e235..e25464b 100644
--- a/OvaleData.lua
+++ b/OvaleData.lua
@@ -35,6 +35,7 @@ local SPELL_POWER_SOUL_SHARDS = SPELL_POWER_SOUL_SHARDS

 --<public-static-properties>
 OvaleData.spellList = {}
+OvaleData.itemList = {}
 OvaleData.className = nil
 OvaleData.level = nil
 --allows to fill the player talent tables on first use