From 80f692a944678cc834d816483f8a82b59dfdaa0e Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Thu, 28 Mar 2013 04:34:28 +0000 Subject: [PATCH] Add ItemName() script function to be used similarly to SpellName(). git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@840 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleCompile.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/OvaleCompile.lua b/OvaleCompile.lua index ddbc7ed..1b4feb9 100644 --- a/OvaleCompile.lua +++ b/OvaleCompile.lua @@ -35,6 +35,7 @@ local strsub = string.sub local tinsert = table.insert local tremove = table.remove local wipe = table.wipe +local API_GetItemInfo = GetItemInfo local API_GetSpellInfo = GetSpellInfo local self_node = {} @@ -612,6 +613,17 @@ local function ParseCanStopChannelling(text) return "" end +local function ParseItemName(text) + local itemId = tonumber(text) + if itemId then + local item = API_GetItemInfo(spellId) or "Item " .. itemId + return '"' .. item .. '"' + else + Ovale:Printf("ItemName of %s unknown\n", text) + return nil + end +end + local function ParseSpellName(text) local spellId = tonumber(text) local spell = OvaleData:GetSpellName(spellId) @@ -653,6 +665,7 @@ local function CompileDeclarations(text) text = strgsub(text, "([%w_]+)", ReplaceDefine) -- Fonctions + text = strgsub(text, "ItemName%s*%(%s*(%w+)%s*%)", ParseItemName) text = strgsub(text, "SpellName%s*%(%s*(%w+)%s*%)", ParseSpellName) text = strgsub(text, "L%s*%(%s*(%w+)%s*%)", ParseL) -- 1.7.9.5