/* Copyright: (c) Kayne Ruse 2013-2015 * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source * distribution. */ --TODO: (3) An archive table of all dead characters CREATE TABLE IF NOT EXISTS UserAccounts ( uid INTEGER PRIMARY KEY AUTOINCREMENT, username varchar(100) UNIQUE, --TODO: (3) Swap username for email address --server-client security -- passhash varchar(100), -- passsalt varchar(100), --server controls blacklisted BIT DEFAULT 0, whitelisted BIT DEFAULT 1, mod BIT DEFAULT 0, admin BIT DEFAULT 0 ); CREATE TABLE IF NOT EXISTS LiveCharacters ( uid INTEGER PRIMARY KEY AUTOINCREMENT, --metadata owner INTEGER REFERENCES Accounts(uid), handle varchar(100) UNIQUE, avatar varchar(100), birth timestamp NOT NULL DEFAULT (datetime()), --physically exists in the world roomIndex INTEGER DEFAULT 0, originX INTEGER DEFAULT 0, originY INTEGER DEFAULT 0, boundsX INTEGER DEFAULT 0, boundsY INTEGER DEFAULT 0, boundsW INTEGER DEFAULT 0, boundsH INTEGER DEFAULT 0 --TODO: statistics -- baseStats INTEGER REFERENCES StatisticSets(uid) --TODO: equipment -- weapon INTEGER REFERENCES WornEquipment(uid) -- helmet INTEGER REFERENCES WornEquipment(uid) -- armour INTEGER REFERENCES WornEquipment(uid) --etc. ); CREATE TABLE IF NOT EXISTS DeadCharacters ( uid INTEGER PRIMARY KEY AUTOINCREMENT ); CREATE TABLE IF NOT EXISTS LiveMonsters ( uid INTEGER PRIMARY KEY AUTOINCREMENT ); CREATE TABLE IF NOT EXISTS DeadMonsters ( uid INTEGER PRIMARY KEY AUTOINCREMENT ); ------------------------- --Utility tables ------------------------- CREATE TABLE IF NOT EXISTS StatisticSets ( --metadata uid INTEGER PRIMARY KEY AUTOINCREMENT, --general use statistics level INTEGER DEFAULT 0, exp INTEGER DEFAULT 0, maxHP INTEGER DEFAULT 0, health INTEGER DEFAULT 0, maxMP INTEGER DEFAULT 0, mana INTEGER DEFAULT 0, attack INTEGER DEFAULT 0, defence INTEGER DEFAULT 0, intelligence INTEGER DEFAULT 0, resistance INTEGER DEFAULT 0, speed INTEGER DEFAULT 0, accuracy REAL DEFAULT 0.0, evasion REAL DEFAULT 0.0, luck REAL DEFAULT 0.0 ); CREATE TABLE IF NOT EXISTS InWorldItems ( --metadata uid INTEGER PRIMARY KEY AUTOINCREMENT, itemType INTEGER, --position in the world roomIndex INTEGER DEFAULT 0, originX INTEGER DEFAULT 0, originY INTEGER DEFAULT 0, --unique information stackSize INTEGER DEFAULT 0, durability INTEGER DEFAULT 0, stats INTEGER REFERENCES StatisticSets(uid) ); CREATE TABLE IF NOT EXISTS InventoryItems ( --metadata uid INTEGER PRIMARY KEY AUTOINCREMENT, owner INTEGER REFERENCES Characters(uid), itemType INTEGER, --unique information stackSize INTEGER DEFAULT 0, durability INTEGER DEFAULT 0, stats INTEGER REFERENCES StatisticSets(uid) ); CREATE TABLE IF NOT EXISTS WornEquipment ( --metadata uid INTEGER PRIMARY KEY AUTOINCREMENT, owner INTEGER REFERENCES Characters(uid), itemType INTEGER, --unique information durability INTEGER DEFAULT 0, stats INTEGER REFERENCES StatisticSets(uid) --attached script? );