Quantcast

Added code to re-splice item info into one file for use in offline scanner

Kevin Lyles [07-04-10 - 18:23]
Added code to re-splice item info into one file for use in offline scanner
Filename
.gitignore
splice-item-info.lua
diff --git a/.gitignore b/.gitignore
index 8289898..45a7fe5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 *~
 Todo
 .dotest/
+full-item-info
diff --git a/splice-item-info.lua b/splice-item-info.lua
new file mode 100644
index 0000000..c498b45
--- /dev/null
+++ b/splice-item-info.lua
@@ -0,0 +1,32 @@
+local LENGTH = 5
+local INCREMENT = 1000
+
+local function padInteger(num)
+	return string.rep("0", LENGTH - tostring(num):len()) .. num
+end
+
+item_info = {}
+
+local i = 0
+local start = padInteger(i)
+local finish = padInteger(i + INCREMENT - 1)
+
+local func = loadfile(string.format("scanned/item-info-%s_%s.lua", start, finish))
+while func do
+	func()
+
+	for k, v in pairs(_G[string.format("IS_item_info_%s_%s", start, finish)]) do
+		item_info[k] = v
+	end
+
+	i = i + INCREMENT
+	start = padInteger(i)
+	finish = padInteger(i + INCREMENT - 1)
+	func = loadfile(string.format("scanned/item-info-%s_%s.lua", start, finish))
+end
+
+loadfile("sort.lua")()
+
+io.output("full-item-info")
+sort(item_info, "item_info")
+io.close()