From 2c25f53ddf418bdedd94c6142b03c80e49fc584d Mon Sep 17 00:00:00 2001 From: gumi Date: Fri, 14 Feb 2020 12:18:00 -0500 Subject: add support for Vault + major refactor --- src/routers/vault/models/evol/char.js | 364 ++++++++++++++++++++++ src/routers/vault/models/evol/char_reservation.js | 14 + src/routers/vault/models/evol/login.js | 94 ++++++ 3 files changed, 472 insertions(+) create mode 100644 src/routers/vault/models/evol/char.js create mode 100644 src/routers/vault/models/evol/char_reservation.js create mode 100644 src/routers/vault/models/evol/login.js (limited to 'src/routers/vault/models/evol') diff --git a/src/routers/vault/models/evol/char.js b/src/routers/vault/models/evol/char.js new file mode 100644 index 0000000..b905fde --- /dev/null +++ b/src/routers/vault/models/evol/char.js @@ -0,0 +1,364 @@ +const Sequelize = require("sequelize"); // from npm registry + +module.exports = { + fields: { + charId: { + type: Sequelize.INTEGER.UNSIGNED, + primaryKey: true, + allowNull: false, + autoIncrement: true, + }, + accountId: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + charNum: { + type: Sequelize.INTEGER, + allowNull: false, + defaultValue: 0, + }, + name: { // char name + type: Sequelize.STRING(30), + allowNull: false, + defaultValue: "", + }, + class: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + baseLevel: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 1, + }, + jobLevel: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 1, + }, + baseExp: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + jobExp: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + zeny: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + str: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 1, + }, + agi: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 1, + }, + vit: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 1, + }, + int: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 1, + }, + dex: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 1, + }, + luk: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 1, + }, + maxHp: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + hp: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 1, + }, + maxSp: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + sp: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + statusPoint: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 48, + }, + skillPoint: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + option: { + type: Sequelize.INTEGER, + allowNull: false, + defaultValue: 0, + }, + karma: { + type: Sequelize.INTEGER, + allowNull: false, + defaultValue: 0, + }, + manner: { + type: Sequelize.INTEGER, + allowNull: false, + defaultValue: 0, + }, + partyId: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + guildId: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + clanId: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + petId: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + homunId: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + elementalId: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + hair: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 1, + }, + hairColor: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + clothesColor: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + body: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + weapon: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + shield: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + headTop: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + headMid: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + headBottom: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + robe: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + lastLogin: { + type: Sequelize.INTEGER, + allowNull: false, + defaultValue: 0, + }, + lastMap: { + type: Sequelize.STRING(11), + allowNull: false, + defaultValue: "000-0", + }, + lastX: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 22, + }, + lastY: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 24, + }, + saveMap: { + type: Sequelize.STRING(11), + allowNull: false, + defaultValue: "000-0", + }, + saveX: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 22, + }, + saveY: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 24, + }, + partnerId: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + online: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + father: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + mother: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + child: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + fame: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + rename: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + deleteDate: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + slotchange: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + charOpt: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + font: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + unbanTime: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + uniqueitemCounter: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + sex: { + type: Sequelize.ENUM("M", "F", "U"), + allowNull: false, + defaultValue: "U", + }, + hotkeyRowshift: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + hotkeyRowshift2: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + attendanceTimer: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + titleId: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + inventorySize: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 100, + }, + }, + options: { + engine: "InnoDB", + initialAutoIncrement: 150000, + indexes: [ + { + fields: ["name"], + unique: true, + }, + { + fields: ["account_id"], + }, + { + fields: ["party_id"], + }, + { + fields: ["guild_id"], + }, + { + fields: ["online"], + }, + ] + } +}; diff --git a/src/routers/vault/models/evol/char_reservation.js b/src/routers/vault/models/evol/char_reservation.js new file mode 100644 index 0000000..f22c960 --- /dev/null +++ b/src/routers/vault/models/evol/char_reservation.js @@ -0,0 +1,14 @@ +const Sequelize = require("sequelize"); // from npm registry + +module.exports = { + fields: { + name: { // char name + type: Sequelize.STRING(30), + primaryKey: true, + allowNull: false, + }, + }, + options: { + engine: "InnoDB", + } +}; diff --git a/src/routers/vault/models/evol/login.js b/src/routers/vault/models/evol/login.js new file mode 100644 index 0000000..be37f07 --- /dev/null +++ b/src/routers/vault/models/evol/login.js @@ -0,0 +1,94 @@ +const Sequelize = require("sequelize"); // from npm registry + +module.exports = { + fields: { + accountId: { + type: Sequelize.INTEGER.UNSIGNED, + primaryKey: true, + autoIncrement: true, + allowNull: false, + }, + userid: { // username + type: Sequelize.STRING(23), + allowNull: false, + defaultValue: "", + }, + userPass: { // plaintext + type: Sequelize.STRING(32), + allowNull: false, + defaultValue: "", + }, + sex: { // NOTE: we must exclude S + type: Sequelize.ENUM("M", "F", "S"), // TODO: add N when evol-hercules supports it + allowNull: false, + defaultValue: "M", // TODO: change to N + }, + email: { // limited email length + type: Sequelize.STRING(39), + allowNull: false, + defaultValue: "", + }, + groupId: { + type: Sequelize.INTEGER, + allowNull: false, + defaultValue: 0, + }, + state: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + unbanTime: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + expirationTime: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + logincount: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + lastlogin: { + type: Sequelize.DATE, + allowNull: true, + }, + lastIp: { + type: Sequelize.STRING(100), + allowNull: false, + defaultValue: "", + }, + birthdate: { + type: Sequelize.DATE, + allowNull: true, + }, + characterSlots: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, // 0 means MAX_CHARS(12) + }, + pincode: { + type: Sequelize.STRING(4), // TODO: use this for TOTP + allowNull: false, + defaultValue: "", + }, + pincodeChange: { + type: Sequelize.INTEGER.UNSIGNED, + allowNull: false, + defaultValue: 0, + }, + }, + options: { + engine: "InnoDB", + initialAutoIncrement: 2000000, + indexes: [ + { + fields: ["userid"], + } + ] + } +}; -- cgit v1.2.3-70-g09d2