Multiple changes, read more
* Implemented HeartbeatUtility * simplified the SQL files * Added a dummy inventory button
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
/* Copyright: (c) Kayne Ruse 2013-2016
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
-------------------------
|
||||
--fill the global tables with gameplay data
|
||||
-------------------------
|
||||
|
||||
INSERT OR IGNORE INTO InventoryItems (name, type, durability) VALUES
|
||||
("sword", "weapon", 100),
|
||||
("dagger", "weapon", 100),
|
||||
("staff", "weapon", 100),
|
||||
("shield", "armour", 100),
|
||||
("potion", "consumable", 100)
|
||||
;
|
||||
|
||||
--DEBUG: Test cases
|
||||
INSERT INTO LiveCharacters
|
||||
|
||||
--DEBUG: this is supposed to archive the dead characters
|
||||
--Insert into DeadCharacters From LiveCharacters all characters who's HP has reached zero or below
|
||||
INSERT INTO DeadCharacters (uid, owner, handle, avatar, birth)
|
||||
SELECT uid, owner, handle, avatar, birth FROM LiveCharacters WHERE
|
||||
SELECT character FROM CharacterStatistics WHERE
|
||||
SELECT uid FROM CombatStatistics WHERE health <= 0;
|
||||
|
||||
DELETE FROM LiveCharacters WHERE uid IN (SELECT uid FROM DeadCharacters);
|
||||
@@ -57,7 +57,23 @@ CREATE TABLE IF NOT EXISTS LiveCharacters (
|
||||
--physically exists in the world
|
||||
roomIndex INTEGER DEFAULT 0,
|
||||
originX INTEGER DEFAULT 0,
|
||||
originY INTEGER DEFAULT 0
|
||||
originY INTEGER DEFAULT 0,
|
||||
|
||||
--combat stats
|
||||
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,
|
||||
accuracy INTEGER DEFAULT 0,
|
||||
evasion INTEGER DEFAULT 0,
|
||||
speed INTEGER DEFAULT 0,
|
||||
luck INTEGER DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS DeadCharacters (
|
||||
@@ -68,23 +84,21 @@ CREATE TABLE IF NOT EXISTS DeadCharacters (
|
||||
handle varchar(100),
|
||||
avatar varchar(100),
|
||||
birth timestamp NOT NULL,
|
||||
death timestamp NOT NULL DEFAULT (datetime())
|
||||
);
|
||||
death timestamp NOT NULL DEFAULT (datetime()),
|
||||
|
||||
CREATE TABLE IF NOT EXISTS LiveCreatures (
|
||||
uid INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
||||
--metadata
|
||||
handle varchar(100) UNIQUE,
|
||||
avatar varchar(100),
|
||||
|
||||
--actions
|
||||
-- script
|
||||
|
||||
--physically exists in the world
|
||||
roomIndex INTEGER DEFAULT 0,
|
||||
originX INTEGER DEFAULT 0,
|
||||
originY INTEGER DEFAULT 0
|
||||
--combat stats
|
||||
level INTEGER DEFAULT 0,
|
||||
exp INTEGER DEFAULT 0,
|
||||
maxHP INTEGER DEFAULT 0,
|
||||
maxMP INTEGER DEFAULT 0,
|
||||
attack INTEGER DEFAULT 0,
|
||||
defence INTEGER DEFAULT 0,
|
||||
intelligence INTEGER DEFAULT 0,
|
||||
resistance INTEGER DEFAULT 0,
|
||||
accuracy INTEGER DEFAULT 0,
|
||||
evasion INTEGER DEFAULT 0,
|
||||
speed INTEGER DEFAULT 0,
|
||||
luck INTEGER DEFAULT 0
|
||||
);
|
||||
|
||||
-------------------------
|
||||
@@ -105,49 +119,4 @@ CREATE TABLE IF NOT EXISTS InventoryItems (
|
||||
--member tables
|
||||
-------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS CombatStatistics (
|
||||
--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,
|
||||
accuracy REAL DEFAULT 0.0,
|
||||
evasion REAL DEFAULT 0.0,
|
||||
speed INTEGER DEFAULT 0,
|
||||
luck REAL DEFAULT 0.0
|
||||
);
|
||||
|
||||
-------------------------
|
||||
--cross reference tables
|
||||
-------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS CharacterStatistics (
|
||||
character INTEGER,
|
||||
statistic INTEGER,
|
||||
FOREIGN KEY (character) REFERENCES LiveCharacters(uid),
|
||||
FOREIGN KEY (statistic) REFERENCES CombatStatistics(uid)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS CharacterItems (
|
||||
character INTEGER,
|
||||
item INTEGER,
|
||||
FOREIGN KEY (character) REFERENCES LiveCharacters(uid),
|
||||
FOREIGN KEY (item) REFERENCES InventoryItem(uid)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS CharacterEquipment (
|
||||
character INTEGER,
|
||||
item INTEGER,
|
||||
FOREIGN KEY (character) REFERENCES LiveCharacters(uid),
|
||||
FOREIGN KEY (item) REFERENCES InventoryItem(uid)
|
||||
);
|
||||
|
||||
--TODO
|
||||
Reference in New Issue
Block a user