2020-12-18 17:59:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS Accounts (
|
2020-12-24 04:19:04 +00:00
|
|
|
AccountID INTEGER NOT NULL,
|
2021-08-13 04:47:09 +00:00
|
|
|
Login TEXT NOT NULL UNIQUE COLLATE NOCASE,
|
2020-12-24 04:19:04 +00:00
|
|
|
Password TEXT NOT NULL,
|
|
|
|
Selected INTEGER DEFAULT 1 NOT NULL,
|
|
|
|
AccountLevel INTEGER NOT NULL,
|
|
|
|
Created INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL,
|
|
|
|
LastLogin INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL,
|
|
|
|
BannedUntil INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
BannedSince INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
BanReason TEXT DEFAULT '' NOT NULL,
|
|
|
|
PRIMARY KEY(AccountID AUTOINCREMENT)
|
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2020-12-24 04:19:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS Players (
|
|
|
|
PlayerID INTEGER NOT NULL,
|
|
|
|
AccountID INTEGER NOT NULL,
|
|
|
|
FirstName TEXT NOT NULL COLLATE NOCASE,
|
|
|
|
LastName TEXT NOT NULL COLLATE NOCASE,
|
|
|
|
NameCheck INTEGER NOT NULL,
|
|
|
|
Slot INTEGER NOT NULL,
|
|
|
|
Created INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL,
|
|
|
|
LastLogin INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL,
|
|
|
|
Level INTEGER DEFAULT 1 NOT NULL,
|
|
|
|
Nano1 INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
Nano2 INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
Nano3 INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
AppearanceFlag INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
TutorialFlag INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
PayZoneFlag INTEGER DEFAULT 0 NOT NULL,
|
2021-03-06 18:55:37 +00:00
|
|
|
XCoordinate INTEGER NOT NULL,
|
|
|
|
YCoordinate INTEGER NOT NULL,
|
|
|
|
ZCoordinate INTEGER NOT NULL,
|
2020-12-24 04:19:04 +00:00
|
|
|
Angle INTEGER NOT NULL,
|
|
|
|
HP INTEGER NOT NULL,
|
|
|
|
FusionMatter INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
Taros INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
BatteryW INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
BatteryN INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
Mentor INTEGER DEFAULT 5 NOT NULL,
|
|
|
|
CurrentMissionID INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
WarpLocationFlag INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
SkywayLocationFlag BLOB NOT NULL,
|
|
|
|
FirstUseFlag BLOB NOT NULL,
|
|
|
|
Quests BLOB NOT NULL,
|
|
|
|
PRIMARY KEY(PlayerID AUTOINCREMENT),
|
|
|
|
FOREIGN KEY(AccountID) REFERENCES Accounts(AccountID) ON DELETE CASCADE,
|
|
|
|
UNIQUE (AccountID, Slot),
|
|
|
|
UNIQUE (FirstName, LastName)
|
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2020-12-24 04:19:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS Appearances (
|
|
|
|
PlayerID INTEGER UNIQUE NOT NULL,
|
|
|
|
Body INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
EyeColor INTEGER DEFAULT 1 NOT NULL,
|
|
|
|
FaceStyle INTEGER DEFAULT 1 NOT NULL,
|
|
|
|
Gender INTEGER DEFAULT 1 NOT NULL,
|
|
|
|
HairColor INTEGER DEFAULT 1 NOT NULL,
|
|
|
|
HairStyle INTEGER DEFAULT 1 NOT NULL,
|
|
|
|
Height INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
SkinColor INTEGER DEFAULT 1 NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE
|
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2020-12-24 04:19:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS Inventory (
|
|
|
|
PlayerID INTEGER NOT NULL,
|
|
|
|
Slot INTEGER NOT NULL,
|
|
|
|
ID INTEGER NOT NULL,
|
|
|
|
Type INTEGER NOT NULL,
|
|
|
|
Opt INTEGER NOT NULL,
|
|
|
|
TimeLimit INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE,
|
|
|
|
UNIQUE (PlayerID, Slot)
|
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2020-12-24 04:19:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS QuestItems (
|
|
|
|
PlayerID INTEGER NOT NULL,
|
|
|
|
Slot INTEGER NOT NULL,
|
|
|
|
ID INTEGER NOT NULL,
|
|
|
|
Opt INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE,
|
|
|
|
UNIQUE (PlayerID, Slot)
|
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2020-12-24 04:19:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS Nanos (
|
|
|
|
PlayerID INTEGER NOT NULL,
|
|
|
|
ID INTEGER NOT NULL,
|
|
|
|
Skill INTEGER NOT NULL,
|
|
|
|
Stamina INTEGER DEFAULT 150 NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE,
|
|
|
|
UNIQUE (PlayerID, ID)
|
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2020-12-24 04:19:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS RunningQuests (
|
|
|
|
PlayerID INTEGER NOT NULL,
|
|
|
|
TaskID INTEGER NOT NULL,
|
|
|
|
RemainingNPCCount1 INTEGER NOT NULL,
|
|
|
|
RemainingNPCCount2 INTEGER NOT NULL,
|
|
|
|
RemainingNPCCount3 INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE
|
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2020-12-24 04:19:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS Buddyships (
|
|
|
|
PlayerAID INTEGER NOT NULL,
|
|
|
|
PlayerBID INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerAID) REFERENCES Players(PlayerID) ON DELETE CASCADE,
|
|
|
|
FOREIGN KEY(PlayerBID) REFERENCES Players(PlayerID) ON DELETE CASCADE
|
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2020-12-24 04:19:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS Blocks (
|
|
|
|
PlayerID INTEGER NOT NULL,
|
|
|
|
BlockedPlayerID INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE,
|
|
|
|
FOREIGN KEY(BlockedPlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE
|
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2020-12-24 04:19:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS EmailData (
|
|
|
|
PlayerID INTEGER NOT NULL,
|
|
|
|
MsgIndex INTEGER NOT NULL,
|
|
|
|
ReadFlag INTEGER NOT NULL,
|
|
|
|
ItemFlag INTEGER NOT NULL,
|
|
|
|
SenderID INTEGER NOT NULL,
|
|
|
|
SenderFirstName TEXT NOT NULL COLLATE NOCASE,
|
|
|
|
SenderLastName TEXT NOT NULL COLLATE NOCASE,
|
|
|
|
SubjectLine TEXT NOT NULL,
|
|
|
|
MsgBody TEXT NOT NULL,
|
|
|
|
Taros INTEGER NOT NULL,
|
|
|
|
SendTime INTEGER NOT NULL,
|
|
|
|
DeleteTime INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE,
|
|
|
|
UNIQUE(PlayerID, MsgIndex)
|
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2020-12-24 04:19:04 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS EmailItems (
|
|
|
|
PlayerID INTEGER NOT NULL,
|
|
|
|
MsgIndex INTEGER NOT NULL,
|
|
|
|
Slot INTEGER NOT NULL,
|
|
|
|
ID INTEGER NOT NULL,
|
|
|
|
Type INTEGER NOT NULL,
|
|
|
|
Opt INTEGER NOT NULL,
|
|
|
|
TimeLimit INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE,
|
2021-01-19 02:44:02 +00:00
|
|
|
UNIQUE (PlayerID, MsgIndex, Slot)
|
2020-12-24 04:19:04 +00:00
|
|
|
);
|
2020-12-18 17:59:04 +00:00
|
|
|
|
2024-09-05 15:00:16 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS RaceResults (
|
2020-12-24 04:19:04 +00:00
|
|
|
EPID INTEGER NOT NULL,
|
|
|
|
PlayerID INTEGER NOT NULL,
|
|
|
|
Score INTEGER NOT NULL,
|
|
|
|
RingCount INTEGER NOT NULL,
|
|
|
|
Time INTEGER NOT NULL,
|
|
|
|
Timestamp INTEGER NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE
|
|
|
|
);
|
2021-01-19 02:44:02 +00:00
|
|
|
|
2024-09-05 15:00:16 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS RedeemedCodes (
|
2021-01-19 02:44:02 +00:00
|
|
|
PlayerID INTEGER NOT NULL,
|
|
|
|
Code TEXT NOT NULL,
|
|
|
|
FOREIGN KEY(PlayerID) REFERENCES Players(PlayerID) ON DELETE CASCADE,
|
|
|
|
UNIQUE (PlayerID, Code)
|
2024-09-05 15:00:16 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS Auth (
|
|
|
|
AccountID INTEGER NOT NULL,
|
|
|
|
Cookie TEXT NOT NULL,
|
|
|
|
Valid INTEGER DEFAULT 0 NOT NULL,
|
|
|
|
FOREIGN KEY(AccountID) REFERENCES Accounts(AccountID) ON DELETE CASCADE,
|
|
|
|
UNIQUE (AccountID)
|
|
|
|
);
|