summaryrefslogtreecommitdiff
path: root/src/routers/vault/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/routers/vault/utils')
-rw-r--r--src/routers/vault/utils/claim.js21
-rw-r--r--src/routers/vault/utils/game_accounts.js22
2 files changed, 43 insertions, 0 deletions
diff --git a/src/routers/vault/utils/claim.js b/src/routers/vault/utils/claim.js
index dda9001..12309b2 100644
--- a/src/routers/vault/utils/claim.js
+++ b/src/routers/vault/utils/claim.js
@@ -64,6 +64,27 @@ const claim_accounts = async (req, email, vault_id, session = null) => {
legacy_char.baseLevel = char.baseLevel;
legacy_char.gender = char.sex;
+ const char_vars = await req.app.locals.legacy.char_reg.findAll({
+ where: {
+ charId: char.charId,
+ [Op.or]: [
+ {name: "TUT_var"},
+ {name: "BOSS_POINTS"},
+ ],
+ },
+ limit: 2, // for now we only use these 2 vars ^
+ });
+
+ for (const var_ of char_vars) {
+ if (var_.name === "TUT_var") {
+ legacy_char.creationTime = var_.value > 0xFF ? var_.value : 0;
+ } else if (var_.name === "BOSS_POINTS") {
+ legacy_char.bossPoints = Math.max(0, var_.value);
+ }
+
+ // in the future maybe here set the vars in a Map<name, value>
+ }
+
legacy_account.chars.push(legacy_char);
}
diff --git a/src/routers/vault/utils/game_accounts.js b/src/routers/vault/utils/game_accounts.js
index fb0e5a4..a5df144 100644
--- a/src/routers/vault/utils/game_accounts.js
+++ b/src/routers/vault/utils/game_accounts.js
@@ -2,6 +2,7 @@ const LegacyAccount = require("../types/LegacyAccount.js");
const LegacyChar = require("../types/LegacyChar.js");
const EvolAccount = require("../types/EvolAccount.js");
const EvolChar = require("../types/EvolChar.js");
+const { Op } = require("sequelize");
/**
* fetch the legacy game accounts and cache in the Session
@@ -38,6 +39,27 @@ const get_legacy_accounts = async (req, session) => {
char_.gender = char.sex;
char_.revoltId = char.revoltId;
+ const char_vars = await req.app.locals.legacy.char_reg.findAll({
+ where: {
+ charId: char.charId,
+ [Op.or]: [
+ {name: "TUT_var"},
+ {name: "BOSS_POINTS"},
+ ],
+ },
+ limit: 2, // for now we only use these 2 vars ^
+ });
+
+ for (const var_ of char_vars) {
+ if (var_.name === "TUT_var") {
+ char_.creationTime = var_.value > 0xFF ? var_.value : 0;
+ } else if (var_.name === "BOSS_POINTS") {
+ char_.bossPoints = Math.max(0, var_.value);
+ }
+
+ // in the future maybe here set the vars in a Map<name, value>
+ }
+
account.chars.push(char_);
}