1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-05 08:26:16 +00:00
opus/apps/itemsDB.lua
kepler155c@gmail.com 17f4f8d9c1 item db
2017-04-17 04:16:12 -04:00

42 lines
774 B
Lua

local injector = requireInjector or load(http.get('http://pastebin.com/raw/c0TWsScv').readAll())()
require = injector(getfenv(1))
local RefinedProvider = require('refinedProvider')
local TableDB = require('tableDB')
local controller = RefinedProvider()
if not controller:isValid() then
error('Refined storage controller not found')
end
local itemInfoDB = TableDB({
fileName = 'items.db'
})
itemInfoDB:load()
local items = controller:listItems()
local keys = {
'fields',
'damage',
'displayName',
'maxCount',
'maxDamage',
'name',
'nbtHash',
'rawName',
}
for _, item in pairs(items) do
local t = { }
for _,key in pairs(keys) do
t[key] = item[key]
end
itemInfoDB:add({ item.name, item.damage, item.nbtHash }, t)
end
itemInfoDB:flush()