item db
This commit is contained in:
41
apps/itemsDB.lua
Normal file
41
apps/itemsDB.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user