0

I am trying to build a SQLite DB with a lot of items, and each of those items can be crafted and take a certain amount of other items to craft them.

Currently what I've come up with are these two tables. I have all the items loaded into the items table, and then for the recipes table, I am adding all info for what is needed for those items to be crafted.

Currently in the recipes table under 'input' I am separating each item with | and doing itemid x count eg 3x20 would tell it it needs 20 wood.

This doesn't seem like the best way to set this up and would like some pointers to set this up properly. I'm probably over thinking this lol.

CREATE TABLE `Items` (
`id`    INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`name`  TEXT UNIQUE,
`price` INTEGER,
`rarity`    TEXT,
`category`  TEXT,
`icon`  TEXT,
`description`   TEXT,
`display`   TEXT,
`tags`  TEXT
);

CREATE TABLE `recipes` (
`id`    INTEGER PRIMARY KEY AUTOINCREMENT,
`name`  TEXT,
`input` TEXT,
`output`    TEXT,
`groups`    TEXT
);

Here are some sample items

INSERT INTO `Items` VALUES (1,'weaponSpear',10,'common','weapons','spear.png','its a spear','Spear','melee');
INSERT INTO `Items` VALUES (2,'stoneblock',2,'common','blocks','stone.png','stone block','Stone Block','block');
INSERT INTO `Items` VALUES (3,'woodlog',1,'common','blocks','wood.png','wooden block','Piece of wood','block');

INSERT INTO `recipes` VALUES (1,'spearRecipe','2x5|3x2','1x1','craftingstation');

Any direction on the proper way to setup this data would be much appreciated!

Thank you

Skint007
  • 195
  • 5
  • 15

0 Answers0