forked from OpenWF/SpaceNinjaServer
Compare commits
1 Commits
main
...
archgun-sl
Author | SHA1 | Date | |
---|---|---|---|
7f4e5870b6 |
49
Dockerfile
49
Dockerfile
@ -5,44 +5,17 @@ ENV APP_MY_ADDRESS=localhost
|
|||||||
ENV APP_HTTP_PORT=80
|
ENV APP_HTTP_PORT=80
|
||||||
ENV APP_HTTPS_PORT=443
|
ENV APP_HTTPS_PORT=443
|
||||||
ENV APP_AUTO_CREATE_ACCOUNT=true
|
ENV APP_AUTO_CREATE_ACCOUNT=true
|
||||||
ENV APP_SKIP_TUTORIAL=false
|
ENV APP_SKIP_STORY_MODE_CHOICE=true
|
||||||
ENV APP_SKIP_ALL_DIALOGUE=false
|
ENV APP_SKIP_TUTORIAL=true
|
||||||
ENV APP_UNLOCK_ALL_SCANS=false
|
ENV APP_SKIP_ALL_DIALOGUE=true
|
||||||
ENV APP_UNLOCK_ALL_MISSIONS=false
|
ENV APP_UNLOCK_ALL_SCANS=true
|
||||||
ENV APP_INFINITE_CREDITS=false
|
ENV APP_UNLOCK_ALL_MISSIONS=true
|
||||||
ENV APP_INFINITE_PLATINUM=false
|
ENV APP_INFINITE_RESOURCES=true
|
||||||
ENV APP_INFINITE_ENDO=false
|
ENV APP_UNLOCK_ALL_SHIP_FEATURES=true
|
||||||
ENV APP_INFINITE_REGAL_AYA=false
|
ENV APP_UNLOCK_ALL_SHIP_DECORATIONS=true
|
||||||
ENV APP_INFINITE_HELMINTH_MATERIALS=false
|
ENV APP_UNLOCK_ALL_FLAVOUR_ITEMS=true
|
||||||
ENV APP_CLAIMING_BLUEPRINT_REFUNDS_INGREDIENTS=false
|
ENV APP_UNLOCK_ALL_SKINS=true
|
||||||
ENV APP_DONT_SUBTRACT_VOIDTRACES=false
|
ENV APP_UNIVERSAL_POLARITY_EVERYWHERE=true
|
||||||
ENV APP_DONT_SUBTRACT_CONSUMABLES=false
|
|
||||||
ENV APP_UNLOCK_ALL_SHIP_FEATURES=false
|
|
||||||
ENV APP_UNLOCK_ALL_SHIP_DECORATIONS=false
|
|
||||||
ENV APP_UNLOCK_ALL_FLAVOUR_ITEMS=false
|
|
||||||
ENV APP_UNLOCK_ALL_SKINS=false
|
|
||||||
ENV APP_UNLOCK_ALL_CAPTURA_SCENES=false
|
|
||||||
ENV APP_UNIVERSAL_POLARITY_EVERYWHERE=false
|
|
||||||
ENV APP_UNLOCK_DOUBLE_CAPACITY_POTATOES_EVERYWHERE=false
|
|
||||||
ENV APP_UNLOCK_EXILUS_EVERYWHERE=false
|
|
||||||
ENV APP_UNLOCK_ARCANES_EVERYWHERE=false
|
|
||||||
ENV APP_NO_DAILY_FOCUS_LIMIT=false
|
|
||||||
ENV APP_NO_ARGON_CRYSTAL_DECAY=false
|
|
||||||
ENV APP_NO_MASTERY_RANK_UP_COOLDOWN=false
|
|
||||||
ENV APP_NO_VENDOR_PURCHASE_LIMITS=true
|
|
||||||
ENV APP_NO_DEATH_MARKS=false
|
|
||||||
ENV APP_NO_KIM_COOLDOWNS=false
|
|
||||||
ENV APP_SYNDICATE_MISSIONS_REPEATABLE=false
|
|
||||||
ENV APP_INSTANT_FINISH_RIVEN_CHALLENGE=false
|
|
||||||
ENV APP_INSTANT_RESOURCE_EXTRACTOR_DRONES=false
|
|
||||||
ENV APP_NO_RESOURCE_EXTRACTOR_DRONES_DAMAGE=false
|
|
||||||
ENV APP_SKIP_CLAN_KEY_CRAFTING=false
|
|
||||||
ENV APP_NO_DOJO_ROOM_BUILD_STAGE=false
|
|
||||||
ENV APP_NO_DECO_BUILD_STAGE=false
|
|
||||||
ENV APP_FAST_DOJO_ROOM_DESTRUCTION=false
|
|
||||||
ENV APP_NO_DOJO_RESEARCH_COSTS=false
|
|
||||||
ENV APP_NO_DOJO_RESEARCH_TIME=false
|
|
||||||
ENV APP_FAST_CLAN_ASCENSION=false
|
|
||||||
ENV APP_SPOOF_MASTERY_RANK=-1
|
ENV APP_SPOOF_MASTERY_RANK=-1
|
||||||
|
|
||||||
RUN apk add --no-cache bash sed wget jq
|
RUN apk add --no-cache bash sed wget jq
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
echo Updating SpaceNinjaServer...
|
echo Updating SpaceNinjaServer...
|
||||||
|
git config remote.origin.url https://openwf.io/SpaceNinjaServer.git
|
||||||
git fetch --prune
|
git fetch --prune
|
||||||
git stash
|
git stash
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
"infiniteEndo": false,
|
"infiniteEndo": false,
|
||||||
"infiniteRegalAya": false,
|
"infiniteRegalAya": false,
|
||||||
"infiniteHelminthMaterials": false,
|
"infiniteHelminthMaterials": false,
|
||||||
"claimingBlueprintRefundsIngredients": false,
|
|
||||||
"dontSubtractVoidTraces": false,
|
|
||||||
"dontSubtractConsumables": false,
|
|
||||||
"unlockAllShipFeatures": false,
|
"unlockAllShipFeatures": false,
|
||||||
"unlockAllShipDecorations": false,
|
"unlockAllShipDecorations": false,
|
||||||
"unlockAllFlavourItems": false,
|
"unlockAllFlavourItems": false,
|
||||||
@ -38,11 +35,8 @@
|
|||||||
"noVendorPurchaseLimits": true,
|
"noVendorPurchaseLimits": true,
|
||||||
"noDeathMarks": false,
|
"noDeathMarks": false,
|
||||||
"noKimCooldowns": false,
|
"noKimCooldowns": false,
|
||||||
"syndicateMissionsRepeatable": false,
|
|
||||||
"instantFinishRivenChallenge": false,
|
|
||||||
"instantResourceExtractorDrones": false,
|
"instantResourceExtractorDrones": false,
|
||||||
"noResourceExtractorDronesDamage": false,
|
"noResourceExtractorDronesDamage": false,
|
||||||
"skipClanKeyCrafting": false,
|
|
||||||
"noDojoRoomBuildStage": false,
|
"noDojoRoomBuildStage": false,
|
||||||
"noDecoBuildStage": false,
|
"noDecoBuildStage": false,
|
||||||
"fastDojoRoomDestruction": false,
|
"fastDojoRoomDestruction": false,
|
||||||
|
@ -12,44 +12,19 @@ services:
|
|||||||
# APP_HTTP_PORT: 80
|
# APP_HTTP_PORT: 80
|
||||||
# APP_HTTPS_PORT: 443
|
# APP_HTTPS_PORT: 443
|
||||||
# APP_AUTO_CREATE_ACCOUNT: true
|
# APP_AUTO_CREATE_ACCOUNT: true
|
||||||
# APP_SKIP_TUTORIAL: false
|
# APP_SKIP_STORY_MODE_CHOICE: true
|
||||||
# APP_SKIP_ALL_DIALOGUE: false
|
# APP_SKIP_TUTORIAL: true
|
||||||
# APP_UNLOCK_ALL_SCANS: false
|
# APP_SKIP_ALL_DIALOGUE: true
|
||||||
# APP_UNLOCK_ALL_MISSIONS: false
|
# APP_UNLOCK_ALL_SCANS: true
|
||||||
# APP_INFINITE_CREDITS: false
|
# APP_UNLOCK_ALL_MISSIONS: true
|
||||||
# APP_INFINITE_PLATINUM: false
|
# APP_UNLOCK_ALL_QUESTS: true
|
||||||
# APP_INFINITE_ENDO: false
|
# APP_COMPLETE_ALL_QUESTS: true
|
||||||
# APP_INFINITE_REGAL_AYA: false
|
# APP_INFINITE_RESOURCES: true
|
||||||
# APP_INFINITE_HELMINTH_MATERIALS: false
|
# APP_UNLOCK_ALL_SHIP_FEATURES: true
|
||||||
# APP_CLAIMING_BLUEPRINT_REFUNDS_INGREDIENTS: false
|
# APP_UNLOCK_ALL_SHIP_DECORATIONS: true
|
||||||
# APP_DONT_SUBTRACT_VOIDTRACES: false
|
# APP_UNLOCK_ALL_FLAVOUR_ITEMS: true
|
||||||
# APP_DONT_SUBTRACT_CONSUMABLES: false
|
# APP_UNLOCK_ALL_SKINS: true
|
||||||
# APP_UNLOCK_ALL_SHIP_FEATURES: false
|
# APP_UNIVERSAL_POLARITY_EVERYWHERE: true
|
||||||
# APP_UNLOCK_ALL_SHIP_DECORATIONS: false
|
|
||||||
# APP_UNLOCK_ALL_FLAVOUR_ITEMS: false
|
|
||||||
# APP_UNLOCK_ALL_SKINS: false
|
|
||||||
# APP_UNLOCK_ALL_CAPTURA_SCENES: false
|
|
||||||
# APP_UNIVERSAL_POLARITY_EVERYWHERE: false
|
|
||||||
# APP_UNLOCK_DOUBLE_CAPACITY_POTATOES_EVERYWHERE: false
|
|
||||||
# APP_UNLOCK_EXILUS_EVERYWHERE: false
|
|
||||||
# APP_UNLOCK_ARCANES_EVERYWHERE: false
|
|
||||||
# APP_NO_DAILY_FOCUS_LIMIT: false
|
|
||||||
# APP_NO_ARGON_CRYSTAL_DECAY: false
|
|
||||||
# APP_NO_MASTERY_RANK_UP_COOLDOWN: false
|
|
||||||
# APP_NO_VENDOR_PURCHASE_LIMITS: true
|
|
||||||
# APP_NO_DEATH_MARKS: false
|
|
||||||
# APP_NO_KIM_COOLDOWNS: false
|
|
||||||
# APP_SYNDICATE_MISSIONS_REPEATABLE: false
|
|
||||||
# APP_INSTANT_FINISH_RIVEN_CHALLENGE: false
|
|
||||||
# APP_INSTANT_RESOURCE_EXTRACTOR_DRONES: false
|
|
||||||
# APP_NO_RESOURCE_EXTRACTOR_DRONES_DAMAGE: false
|
|
||||||
# APP_SKIP_CLAN_KEY_CRAFTING: false
|
|
||||||
# APP_NO_DOJO_ROOM_BUILD_STAGE: false
|
|
||||||
# APP_NO_DECO_BUILD_STAGE: false
|
|
||||||
# APP_FAST_DOJO_ROOM_DESTRUCTION: false
|
|
||||||
# APP_NO_DOJO_RESEARCH_COSTS: false
|
|
||||||
# APP_NO_DOJO_RESEARCH_TIME: false
|
|
||||||
# APP_FAST_CLAN_ASCENSION: false
|
|
||||||
# APP_SPOOF_MASTERY_RANK: -1
|
# APP_SPOOF_MASTERY_RANK: -1
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker-data/static:/app/static/data
|
- ./docker-data/static:/app/static/data
|
||||||
|
@ -19,6 +19,5 @@ do
|
|||||||
mv config.tmp config.json
|
mv config.tmp config.json
|
||||||
done
|
done
|
||||||
|
|
||||||
npm i --omit=dev
|
npm install
|
||||||
npm run build
|
exec npm run dev
|
||||||
exec npm run start
|
|
||||||
|
500
package-lock.json
generated
500
package-lock.json
generated
@ -13,12 +13,12 @@
|
|||||||
"@types/morgan": "^1.9.9",
|
"@types/morgan": "^1.9.9",
|
||||||
"crc-32": "^1.2.2",
|
"crc-32": "^1.2.2",
|
||||||
"express": "^5",
|
"express": "^5",
|
||||||
"json-with-bigint": "^3.4.4",
|
"json-with-bigint": "^3.2.2",
|
||||||
"mongoose": "^8.11.0",
|
"mongoose": "^8.11.0",
|
||||||
"morgan": "^1.10.0",
|
"morgan": "^1.10.0",
|
||||||
"ncp": "^2.0.0",
|
"ncp": "^2.0.0",
|
||||||
"typescript": "^5.5",
|
"typescript": "^5.5",
|
||||||
"warframe-public-export-plus": "^0.5.62",
|
"warframe-public-export-plus": "^0.5.56",
|
||||||
"warframe-riven-info": "^0.1.2",
|
"warframe-riven-info": "^0.1.2",
|
||||||
"winston": "^3.17.0",
|
"winston": "^3.17.0",
|
||||||
"winston-daily-rotate-file": "^5.0.0"
|
"winston-daily-rotate-file": "^5.0.0"
|
||||||
@ -72,9 +72,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@eslint-community/eslint-utils": {
|
"node_modules/@eslint-community/eslint-utils": {
|
||||||
"version": "4.7.0",
|
"version": "4.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.5.0.tgz",
|
||||||
"integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
|
"integrity": "sha512-RoV8Xs9eNwiDvhv7M+xcL4PWyRyIXRY/FLp3buU4h1EYfdF7unWUy3dOjPqb3C7rMUewIcqwW850PgS8h1o1yg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -249,9 +249,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mongodb-js/saslprep": {
|
"node_modules/@mongodb-js/saslprep": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.2.0.tgz",
|
||||||
"integrity": "sha512-EB0O3SCSNRUFk66iRCpI+cXzIjdswfCs7F6nOC3RAGJ7xr5YhaicvsRwJ9eyzYvYRlCSDUO/c7g4yNulxKC1WA==",
|
"integrity": "sha512-+ywrb0AqkfaYuhHs6LxKWgqbh3I72EpEgESCw37o+9qPx9WTCkgDm2B+eMrwehGtHBWHFU4GXvnSCNiFhhausg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sparse-bitfield": "^3.0.3"
|
"sparse-bitfield": "^3.0.3"
|
||||||
@ -296,22 +296,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@pkgr/core": {
|
"node_modules/@pkgr/core": {
|
||||||
"version": "0.2.4",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.2.0.tgz",
|
||||||
"integrity": "sha512-ROFF39F6ZrnzSUEmQQZUar0Jt4xVoP9WnDRdWwF4NNcXs3xBTLgBUDoOwW141y1jP+S8nahIbdxbFC7IShw9Iw==",
|
"integrity": "sha512-vsJDAkYR6qCPu+ioGScGiMYR7LvZYIXh/dlQeviqoTWNCVfKTLYD/LkNWH4Mxsv2a5vpIRc77FN5DnmK1eBggQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
|
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/pkgr"
|
"url": "https://opencollective.com/unts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rxliuli/tsgo": {
|
"node_modules/@rxliuli/tsgo": {
|
||||||
"version": "2025.5.8",
|
"version": "2025.3.31",
|
||||||
"resolved": "https://registry.npmjs.org/@rxliuli/tsgo/-/tsgo-2025.5.8.tgz",
|
"resolved": "https://registry.npmjs.org/@rxliuli/tsgo/-/tsgo-2025.3.31.tgz",
|
||||||
"integrity": "sha512-P3/qxcUgiWz6nSJslJ5mMeAEqacK8LQSoOhdvHxI1/d0Xqxt2Qp6/nmhWuOlyqnCyAaIoXgoiUshiXWBGr2jaw==",
|
"integrity": "sha512-jEistRy/+Mu79rDv/Q8xn2yIM56WF3rfQOkwrbtivumij5HBVTfY4W3EYNL3N7rop7yg9Trew3joDohDoxQ2Ow==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64",
|
"x64",
|
||||||
"ia32",
|
"ia32",
|
||||||
@ -382,13 +382,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/express": {
|
"node_modules/@types/express": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.0.tgz",
|
||||||
"integrity": "sha512-UZUw8vjpWFXuDnjFTh7/5c2TWDlQqeXHi6hcN7F2XSVT5P+WmUnnbFS3KA6Jnc6IsEqI2qCVu2bK0R0J4A8ZQQ==",
|
"integrity": "sha512-DvZriSMehGHL1ZNLzi6MidnsDhUZM/x2pRdDIKdwbUNqqwHxMlRdkxtn6/EPKyqKpHqTl/4nRZsRNLpZxZRpPQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/body-parser": "*",
|
"@types/body-parser": "*",
|
||||||
"@types/express-serve-static-core": "^5.0.0",
|
"@types/express-serve-static-core": "^5.0.0",
|
||||||
|
"@types/qs": "*",
|
||||||
"@types/serve-static": "*"
|
"@types/serve-static": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -426,12 +427,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "22.15.16",
|
"version": "22.13.10",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.16.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.10.tgz",
|
||||||
"integrity": "sha512-3pr+KjwpVujqWqOKT8mNR+rd09FqhBLwg+5L/4t0cNYBzm/yEiYGCxWttjaPBsLtAo+WFNoXzGJfolM1JuRXoA==",
|
"integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~6.21.0"
|
"undici-types": "~6.20.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/qs": {
|
"node_modules/@types/qs": {
|
||||||
@ -503,21 +504,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
"version": "8.32.0",
|
"version": "8.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.28.0.tgz",
|
||||||
"integrity": "sha512-/jU9ettcntkBFmWUzzGgsClEi2ZFiikMX5eEQsmxIAWMOn4H3D4rvHssstmAHGVvrYnaMqdWWWg0b5M6IN/MTQ==",
|
"integrity": "sha512-lvFK3TCGAHsItNdWZ/1FkvpzCxTHUVuFrdnOGLMa0GGCFIbCgQWVk3CzCGdA7kM3qGVc+dfW9tr0Z/sHnGDFyg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/regexpp": "^4.10.0",
|
"@eslint-community/regexpp": "^4.10.0",
|
||||||
"@typescript-eslint/scope-manager": "8.32.0",
|
"@typescript-eslint/scope-manager": "8.28.0",
|
||||||
"@typescript-eslint/type-utils": "8.32.0",
|
"@typescript-eslint/type-utils": "8.28.0",
|
||||||
"@typescript-eslint/utils": "8.32.0",
|
"@typescript-eslint/utils": "8.28.0",
|
||||||
"@typescript-eslint/visitor-keys": "8.32.0",
|
"@typescript-eslint/visitor-keys": "8.28.0",
|
||||||
"graphemer": "^1.4.0",
|
"graphemer": "^1.4.0",
|
||||||
"ignore": "^5.3.1",
|
"ignore": "^5.3.1",
|
||||||
"natural-compare": "^1.4.0",
|
"natural-compare": "^1.4.0",
|
||||||
"ts-api-utils": "^2.1.0"
|
"ts-api-utils": "^2.0.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
@ -533,16 +534,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "8.32.0",
|
"version": "8.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.28.0.tgz",
|
||||||
"integrity": "sha512-B2MdzyWxCE2+SqiZHAjPphft+/2x2FlO9YBx7eKE1BCb+rqBlQdhtAEhzIEdozHd55DXPmxBdpMygFJjfjjA9A==",
|
"integrity": "sha512-LPcw1yHD3ToaDEoljFEfQ9j2xShY367h7FZ1sq5NJT9I3yj4LHer1Xd1yRSOdYy9BpsrxU7R+eoDokChYM53lQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "8.32.0",
|
"@typescript-eslint/scope-manager": "8.28.0",
|
||||||
"@typescript-eslint/types": "8.32.0",
|
"@typescript-eslint/types": "8.28.0",
|
||||||
"@typescript-eslint/typescript-estree": "8.32.0",
|
"@typescript-eslint/typescript-estree": "8.28.0",
|
||||||
"@typescript-eslint/visitor-keys": "8.32.0",
|
"@typescript-eslint/visitor-keys": "8.28.0",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -558,14 +559,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/scope-manager": {
|
"node_modules/@typescript-eslint/scope-manager": {
|
||||||
"version": "8.32.0",
|
"version": "8.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.28.0.tgz",
|
||||||
"integrity": "sha512-jc/4IxGNedXkmG4mx4nJTILb6TMjL66D41vyeaPWvDUmeYQzF3lKtN15WsAeTr65ce4mPxwopPSo1yUUAWw0hQ==",
|
"integrity": "sha512-u2oITX3BJwzWCapoZ/pXw6BCOl8rJP4Ij/3wPoGvY8XwvXflOzd1kLrDUUUAIEdJSFh+ASwdTHqtan9xSg8buw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "8.32.0",
|
"@typescript-eslint/types": "8.28.0",
|
||||||
"@typescript-eslint/visitor-keys": "8.32.0"
|
"@typescript-eslint/visitor-keys": "8.28.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
@ -576,16 +577,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/type-utils": {
|
"node_modules/@typescript-eslint/type-utils": {
|
||||||
"version": "8.32.0",
|
"version": "8.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.28.0.tgz",
|
||||||
"integrity": "sha512-t2vouuYQKEKSLtJaa5bB4jHeha2HJczQ6E5IXPDPgIty9EqcJxpr1QHQ86YyIPwDwxvUmLfP2YADQ5ZY4qddZg==",
|
"integrity": "sha512-oRoXu2v0Rsy/VoOGhtWrOKDiIehvI+YNrDk5Oqj40Mwm0Yt01FC/Q7nFqg088d3yAsR1ZcZFVfPCTTFCe/KPwg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/typescript-estree": "8.32.0",
|
"@typescript-eslint/typescript-estree": "8.28.0",
|
||||||
"@typescript-eslint/utils": "8.32.0",
|
"@typescript-eslint/utils": "8.28.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"ts-api-utils": "^2.1.0"
|
"ts-api-utils": "^2.0.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
@ -600,9 +601,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/types": {
|
"node_modules/@typescript-eslint/types": {
|
||||||
"version": "8.32.0",
|
"version": "8.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.28.0.tgz",
|
||||||
"integrity": "sha512-O5Id6tGadAZEMThM6L9HmVf5hQUXNSxLVKeGJYWNhhVseps/0LddMkp7//VDkzwJ69lPL0UmZdcZwggj9akJaA==",
|
"integrity": "sha512-bn4WS1bkKEjx7HqiwG2JNB3YJdC1q6Ue7GyGlwPHyt0TnVq6TtD/hiOdTZt71sq0s7UzqBFXD8t8o2e63tXgwA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -614,20 +615,20 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree": {
|
"node_modules/@typescript-eslint/typescript-estree": {
|
||||||
"version": "8.32.0",
|
"version": "8.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.28.0.tgz",
|
||||||
"integrity": "sha512-pU9VD7anSCOIoBFnhTGfOzlVFQIA1XXiQpH/CezqOBaDppRwTglJzCC6fUQGpfwey4T183NKhF1/mfatYmjRqQ==",
|
"integrity": "sha512-H74nHEeBGeklctAVUvmDkxB1mk+PAZ9FiOMPFncdqeRBXxk1lWSYraHw8V12b7aa6Sg9HOBNbGdSHobBPuQSuA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "8.32.0",
|
"@typescript-eslint/types": "8.28.0",
|
||||||
"@typescript-eslint/visitor-keys": "8.32.0",
|
"@typescript-eslint/visitor-keys": "8.28.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"fast-glob": "^3.3.2",
|
"fast-glob": "^3.3.2",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
"minimatch": "^9.0.4",
|
"minimatch": "^9.0.4",
|
||||||
"semver": "^7.6.0",
|
"semver": "^7.6.0",
|
||||||
"ts-api-utils": "^2.1.0"
|
"ts-api-utils": "^2.0.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
@ -641,16 +642,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/utils": {
|
"node_modules/@typescript-eslint/utils": {
|
||||||
"version": "8.32.0",
|
"version": "8.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.28.0.tgz",
|
||||||
"integrity": "sha512-8S9hXau6nQ/sYVtC3D6ISIDoJzS1NsCK+gluVhLN2YkBPX+/1wkwyUiDKnxRh15579WoOIyVWnoyIf3yGI9REw==",
|
"integrity": "sha512-OELa9hbTYciYITqgurT1u/SzpQVtDLmQMFzy/N8pQE+tefOyCWT79jHsav294aTqV1q1u+VzqDGbuujvRYaeSQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.7.0",
|
"@eslint-community/eslint-utils": "^4.4.0",
|
||||||
"@typescript-eslint/scope-manager": "8.32.0",
|
"@typescript-eslint/scope-manager": "8.28.0",
|
||||||
"@typescript-eslint/types": "8.32.0",
|
"@typescript-eslint/types": "8.28.0",
|
||||||
"@typescript-eslint/typescript-estree": "8.32.0"
|
"@typescript-eslint/typescript-estree": "8.28.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
@ -665,13 +666,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/visitor-keys": {
|
"node_modules/@typescript-eslint/visitor-keys": {
|
||||||
"version": "8.32.0",
|
"version": "8.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.28.0.tgz",
|
||||||
"integrity": "sha512-1rYQTCLFFzOI5Nl0c8LUpJT8HxpwVRn9E4CkMsYfuN6ctmQqExjSTzzSk0Tz2apmXy7WU6/6fyaZVVA/thPN+w==",
|
"integrity": "sha512-hbn8SZ8w4u2pRwgQ1GlUrPKE+t2XvcCW5tTRF7j6SMYIuYG37XuzIW44JCZPa36evi0Oy2SnM664BlIaAuQcvg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "8.32.0",
|
"@typescript-eslint/types": "8.28.0",
|
||||||
"eslint-visitor-keys": "^4.2.0"
|
"eslint-visitor-keys": "^4.2.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -867,16 +868,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/body-parser": {
|
"node_modules/body-parser": {
|
||||||
"version": "2.2.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.1.0.tgz",
|
||||||
"integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==",
|
"integrity": "sha512-/hPxh61E+ll0Ujp24Ilm64cykicul1ypfwjVttduAiEdtnJFvLePSrIPk+HMImtNv5270wOGCb1Tns2rybMkoQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bytes": "^3.1.2",
|
"bytes": "^3.1.2",
|
||||||
"content-type": "^1.0.5",
|
"content-type": "^1.0.5",
|
||||||
"debug": "^4.4.0",
|
"debug": "^4.4.0",
|
||||||
"http-errors": "^2.0.0",
|
"http-errors": "^2.0.0",
|
||||||
"iconv-lite": "^0.6.3",
|
"iconv-lite": "^0.5.2",
|
||||||
"on-finished": "^2.4.1",
|
"on-finished": "^2.4.1",
|
||||||
"qs": "^6.14.0",
|
"qs": "^6.14.0",
|
||||||
"raw-body": "^3.0.0",
|
"raw-body": "^3.0.0",
|
||||||
@ -886,6 +887,21 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/body-parser/node_modules/qs": {
|
||||||
|
"version": "6.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
|
||||||
|
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"side-channel": "^1.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/brace-expansion": {
|
"node_modules/brace-expansion": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||||
@ -1121,9 +1137,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cookie": {
|
"node_modules/cookie": {
|
||||||
"version": "0.7.2",
|
"version": "0.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz",
|
||||||
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
"integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
@ -1205,6 +1221,16 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/destroy": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8",
|
||||||
|
"npm": "1.2.8000 || >= 1.4.16"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/diff": {
|
"node_modules/diff": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||||
@ -1380,14 +1406,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-plugin-prettier": {
|
"node_modules/eslint-plugin-prettier": {
|
||||||
"version": "5.4.0",
|
"version": "5.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.5.tgz",
|
||||||
"integrity": "sha512-BvQOvUhkVQM1i63iMETK9Hjud9QhqBnbtT1Zc642p9ynzBuCe5pybkOnvqZIBypXmMlsGcnU4HZ8sCTPfpAexA==",
|
"integrity": "sha512-IKKP8R87pJyMl7WWamLgPkloB16dagPIdd2FjBDbyRYPKo93wS/NbCOPh6gH+ieNLC+XZrhJt/kWj0PS/DFdmg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"prettier-linter-helpers": "^1.0.0",
|
"prettier-linter-helpers": "^1.0.0",
|
||||||
"synckit": "^0.11.0"
|
"synckit": "^0.10.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^14.18.0 || >=16.0.0"
|
"node": "^14.18.0 || >=16.0.0"
|
||||||
@ -1538,47 +1564,71 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/express": {
|
"node_modules/express": {
|
||||||
"version": "5.1.0",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/express/-/express-5.0.1.tgz",
|
||||||
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
|
"integrity": "sha512-ORF7g6qGnD+YtUG9yx4DFoqCShNMmUKiXuT5oWMHiOvt/4WFbHC6yCwQMTSBMno7AqntNCAzzcnnjowRkTL9eQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"accepts": "^2.0.0",
|
"accepts": "^2.0.0",
|
||||||
"body-parser": "^2.2.0",
|
"body-parser": "^2.0.1",
|
||||||
"content-disposition": "^1.0.0",
|
"content-disposition": "^1.0.0",
|
||||||
"content-type": "^1.0.5",
|
"content-type": "~1.0.4",
|
||||||
"cookie": "^0.7.1",
|
"cookie": "0.7.1",
|
||||||
"cookie-signature": "^1.2.1",
|
"cookie-signature": "^1.2.1",
|
||||||
"debug": "^4.4.0",
|
"debug": "4.3.6",
|
||||||
"encodeurl": "^2.0.0",
|
"depd": "2.0.0",
|
||||||
"escape-html": "^1.0.3",
|
"encodeurl": "~2.0.0",
|
||||||
"etag": "^1.8.1",
|
"escape-html": "~1.0.3",
|
||||||
"finalhandler": "^2.1.0",
|
"etag": "~1.8.1",
|
||||||
"fresh": "^2.0.0",
|
"finalhandler": "^2.0.0",
|
||||||
"http-errors": "^2.0.0",
|
"fresh": "2.0.0",
|
||||||
|
"http-errors": "2.0.0",
|
||||||
"merge-descriptors": "^2.0.0",
|
"merge-descriptors": "^2.0.0",
|
||||||
|
"methods": "~1.1.2",
|
||||||
"mime-types": "^3.0.0",
|
"mime-types": "^3.0.0",
|
||||||
"on-finished": "^2.4.1",
|
"on-finished": "2.4.1",
|
||||||
"once": "^1.4.0",
|
"once": "1.4.0",
|
||||||
"parseurl": "^1.3.3",
|
"parseurl": "~1.3.3",
|
||||||
"proxy-addr": "^2.0.7",
|
"proxy-addr": "~2.0.7",
|
||||||
"qs": "^6.14.0",
|
"qs": "6.13.0",
|
||||||
"range-parser": "^1.2.1",
|
"range-parser": "~1.2.1",
|
||||||
"router": "^2.2.0",
|
"router": "^2.0.0",
|
||||||
|
"safe-buffer": "5.2.1",
|
||||||
"send": "^1.1.0",
|
"send": "^1.1.0",
|
||||||
"serve-static": "^2.2.0",
|
"serve-static": "^2.1.0",
|
||||||
"statuses": "^2.0.1",
|
"setprototypeof": "1.2.0",
|
||||||
"type-is": "^2.0.1",
|
"statuses": "2.0.1",
|
||||||
"vary": "^1.1.2"
|
"type-is": "^2.0.0",
|
||||||
|
"utils-merge": "1.0.1",
|
||||||
|
"vary": "~1.1.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 18"
|
"node": ">= 18"
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/express"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/express/node_modules/debug": {
|
||||||
|
"version": "4.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz",
|
||||||
|
"integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "2.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"supports-color": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/express/node_modules/ms": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/fast-deep-equal": {
|
"node_modules/fast-deep-equal": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
@ -1981,12 +2031,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/iconv-lite": {
|
"node_modules/iconv-lite": {
|
||||||
"version": "0.6.3",
|
"version": "0.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz",
|
||||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
"integrity": "sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
"safer-buffer": ">= 2.1.2 < 3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
@ -2194,9 +2244,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/json-with-bigint": {
|
"node_modules/json-with-bigint": {
|
||||||
"version": "3.4.4",
|
"version": "3.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/json-with-bigint/-/json-with-bigint-3.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/json-with-bigint/-/json-with-bigint-3.2.2.tgz",
|
||||||
"integrity": "sha512-AhpYAAaZsPjU7smaBomDt1SOQshi9rEm6BlTbfVwsG1vNmeHKtEedJi62sHZzJTyKNtwzmNnrsd55kjwJ7054A==",
|
"integrity": "sha512-zbaZ+MZ2PEcAD0yINpxvlLMKzoC1GPqy5p8/ZgzRJRoB+NCczGrTX9x2ashSvkfYTitQKbV5aYQCJCiHxrzF2w==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/json5": {
|
"node_modules/json5": {
|
||||||
@ -2344,6 +2394,15 @@
|
|||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/methods": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/micromatch": {
|
"node_modules/micromatch": {
|
||||||
"version": "4.0.8",
|
"version": "4.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
|
||||||
@ -2359,21 +2418,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mime-db": {
|
"node_modules/mime-db": {
|
||||||
"version": "1.54.0",
|
"version": "1.53.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.53.0.tgz",
|
||||||
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
|
"integrity": "sha512-oHlN/w+3MQ3rba9rqFr6V/ypF10LSkdwUysQL7GkXoTgIWeV+tcXGA852TBxH+gsh8UWoyhR1hKcoMJTuWflpg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mime-types": {
|
"node_modules/mime-types": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.0.tgz",
|
||||||
"integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==",
|
"integrity": "sha512-XqoSHeCGjVClAmoGFG3lVFqQFRIrTVw2OH3axRqAcfaw+gHWIfnASS92AV+Rl/mk0MupgZTRHQOjxY6YVnzK5w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mime-db": "^1.54.0"
|
"mime-db": "^1.53.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
@ -2428,9 +2487,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mongodb": {
|
"node_modules/mongodb": {
|
||||||
"version": "6.16.0",
|
"version": "6.14.2",
|
||||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.14.2.tgz",
|
||||||
"integrity": "sha512-D1PNcdT0y4Grhou5Zi/qgipZOYeWrhLEpk33n3nm6LGtz61jvO88WlrWCK/bigMjpnOdAUKKQwsGIl0NtWMyYw==",
|
"integrity": "sha512-kMEHNo0F3P6QKDq17zcDuPeaywK/YaJVCEQRzPF3TOM/Bl9MFg64YE5Tu7ifj37qZJMhwU1tl2Ioivws5gRG5Q==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mongodb-js/saslprep": "^1.1.9",
|
"@mongodb-js/saslprep": "^1.1.9",
|
||||||
@ -2484,14 +2543,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mongoose": {
|
"node_modules/mongoose": {
|
||||||
"version": "8.14.1",
|
"version": "8.12.1",
|
||||||
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.12.1.tgz",
|
||||||
"integrity": "sha512-ijd12vjqUBr5Btqqflu0c/o8Oed5JpdaE0AKO9TjGxCgywYwnzt6ynR1ySjhgxGxrYVeXC0t1P11f1zlRiE93Q==",
|
"integrity": "sha512-UW22y8QFVYmrb36hm8cGncfn4ARc/XsYWQwRTaj0gxtQk1rDuhzDO1eBantS+hTTatfAIS96LlRCJrcNHvW5+Q==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bson": "^6.10.3",
|
"bson": "^6.10.3",
|
||||||
"kareem": "2.6.3",
|
"kareem": "2.6.3",
|
||||||
"mongodb": "~6.16.0",
|
"mongodb": "~6.14.0",
|
||||||
"mpath": "0.9.0",
|
"mpath": "0.9.0",
|
||||||
"mquery": "5.0.0",
|
"mquery": "5.0.0",
|
||||||
"ms": "2.1.3",
|
"ms": "2.1.3",
|
||||||
@ -2863,12 +2922,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/qs": {
|
"node_modules/qs": {
|
||||||
"version": "6.14.0",
|
"version": "6.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
|
||||||
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
"integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"side-channel": "^1.1.0"
|
"side-channel": "^1.0.6"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.6"
|
"node": ">=0.6"
|
||||||
@ -2922,18 +2981,16 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/readable-stream": {
|
"node_modules/raw-body/node_modules/iconv-lite": {
|
||||||
"version": "3.6.2",
|
"version": "0.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"inherits": "^2.0.3",
|
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||||
"string_decoder": "^1.1.1",
|
|
||||||
"util-deprecate": "^1.0.1"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 6"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/readdirp": {
|
"node_modules/readdirp": {
|
||||||
@ -3009,13 +3066,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/router": {
|
"node_modules/router": {
|
||||||
"version": "2.2.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/router/-/router-2.1.0.tgz",
|
||||||
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
|
"integrity": "sha512-/m/NSLxeYEgWNtyC+WtNHCF7jbGxOibVWKnn+1Psff4dJGOfoXP+MuC/f2CwSmyiHdOIzYnYFp4W6GxWfekaLA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "^4.4.0",
|
|
||||||
"depd": "^2.0.0",
|
|
||||||
"is-promise": "^4.0.0",
|
"is-promise": "^4.0.0",
|
||||||
"parseurl": "^1.3.3",
|
"parseurl": "^1.3.3",
|
||||||
"path-to-regexp": "^8.0.0"
|
"path-to-regexp": "^8.0.0"
|
||||||
@ -3097,18 +3152,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/send": {
|
"node_modules/send": {
|
||||||
"version": "1.2.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/send/-/send-1.1.0.tgz",
|
||||||
"integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==",
|
"integrity": "sha512-v67WcEouB5GxbTWL/4NeToqcZiAWEq90N888fczVArY8A79J0L4FD7vj5hm3eUMua5EpoQ59wa/oovY6TLvRUA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "^4.3.5",
|
"debug": "^4.3.5",
|
||||||
|
"destroy": "^1.2.0",
|
||||||
"encodeurl": "^2.0.0",
|
"encodeurl": "^2.0.0",
|
||||||
"escape-html": "^1.0.3",
|
"escape-html": "^1.0.3",
|
||||||
"etag": "^1.8.1",
|
"etag": "^1.8.1",
|
||||||
"fresh": "^2.0.0",
|
"fresh": "^0.5.2",
|
||||||
"http-errors": "^2.0.0",
|
"http-errors": "^2.0.0",
|
||||||
"mime-types": "^3.0.1",
|
"mime-types": "^2.1.35",
|
||||||
"ms": "^2.1.3",
|
"ms": "^2.1.3",
|
||||||
"on-finished": "^2.4.1",
|
"on-finished": "^2.4.1",
|
||||||
"range-parser": "^1.2.1",
|
"range-parser": "^1.2.1",
|
||||||
@ -3118,16 +3174,46 @@
|
|||||||
"node": ">= 18"
|
"node": ">= 18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/send/node_modules/fresh": {
|
||||||
|
"version": "0.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||||
|
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/send/node_modules/mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/send/node_modules/mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/serve-static": {
|
"node_modules/serve-static": {
|
||||||
"version": "2.2.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.1.0.tgz",
|
||||||
"integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==",
|
"integrity": "sha512-A3We5UfEjG8Z7VkDv6uItWw6HY2bBSBJT1KtVESn6EOoOr2jAxNhxWCLY3jDE2WcuHXByWju74ck3ZgLwL8xmA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"encodeurl": "^2.0.0",
|
"encodeurl": "^2.0.0",
|
||||||
"escape-html": "^1.0.3",
|
"escape-html": "^1.0.3",
|
||||||
"parseurl": "^1.3.3",
|
"parseurl": "^1.3.3",
|
||||||
"send": "^1.2.0"
|
"send": "^1.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 18"
|
"node": ">= 18"
|
||||||
@ -3297,15 +3383,6 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/string_decoder": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"safe-buffer": "~5.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/strip-ansi": {
|
"node_modules/strip-ansi": {
|
||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||||
@ -3369,20 +3446,20 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/synckit": {
|
"node_modules/synckit": {
|
||||||
"version": "0.11.4",
|
"version": "0.10.3",
|
||||||
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.11.4.tgz",
|
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.10.3.tgz",
|
||||||
"integrity": "sha512-Q/XQKRaJiLiFIBNN+mndW7S/RHxvwzuZS6ZwmRzUBqJBv/5QIKCEwkBC8GBf8EQJKYnaFs0wOZbKTXBPj8L9oQ==",
|
"integrity": "sha512-R1urvuyiTaWfeCggqEvpDJwAlDVdsT9NM+IP//Tk2x7qHCkSvBk/fwFgw/TLAHzZlrAnnazMcRw0ZD8HlYFTEQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pkgr/core": "^0.2.3",
|
"@pkgr/core": "^0.2.0",
|
||||||
"tslib": "^2.8.1"
|
"tslib": "^2.8.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^14.18.0 || >=16.0.0"
|
"node": "^14.18.0 || >=16.0.0"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/synckit"
|
"url": "https://opencollective.com/unts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/text-hex": {
|
"node_modules/text-hex": {
|
||||||
@ -3421,9 +3498,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tr46": {
|
"node_modules/tr46": {
|
||||||
"version": "5.1.1",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz",
|
||||||
"integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==",
|
"integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"punycode": "^2.3.1"
|
"punycode": "^2.3.1"
|
||||||
@ -3629,9 +3706,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/type-is": {
|
"node_modules/type-is": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.0.tgz",
|
||||||
"integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
|
"integrity": "sha512-gd0sGezQYCbWSbkZr75mln4YBidWUN60+devscpLF5mtRDUpiaTvKpBNrdaCvel1NdR2k6vclXybU5fBd2i+nw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"content-type": "^1.0.5",
|
"content-type": "^1.0.5",
|
||||||
@ -3656,9 +3733,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
"node_modules/undici-types": {
|
||||||
"version": "6.21.0",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
|
||||||
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/unpipe": {
|
"node_modules/unpipe": {
|
||||||
@ -3686,6 +3763,15 @@
|
|||||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/utils-merge": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/v8-compile-cache-lib": {
|
"node_modules/v8-compile-cache-lib": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
||||||
@ -3703,9 +3789,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/warframe-public-export-plus": {
|
"node_modules/warframe-public-export-plus": {
|
||||||
"version": "0.5.62",
|
"version": "0.5.56",
|
||||||
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.62.tgz",
|
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.56.tgz",
|
||||||
"integrity": "sha512-D8ZzjkU9rrK/59VqCfpMoV31HVmwHZV1dNZxPO85AOlcjg/G81Fu3kgITQTaw9sdNagLPLQnFaiXY58pxxRwgA=="
|
"integrity": "sha512-px+J7tUm6fkSzwKkvL73ySQReDq9oM1UrHSLM3vbYGBvELM892iBgPYG45okIhScCSdwmmXTiWZTf4x/I4qiNQ=="
|
||||||
},
|
},
|
||||||
"node_modules/warframe-riven-info": {
|
"node_modules/warframe-riven-info": {
|
||||||
"version": "0.1.2",
|
"version": "0.1.2",
|
||||||
@ -3722,12 +3808,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/whatwg-url": {
|
"node_modules/whatwg-url": {
|
||||||
"version": "14.2.0",
|
"version": "14.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.1.1.tgz",
|
||||||
"integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==",
|
"integrity": "sha512-mDGf9diDad/giZ/Sm9Xi2YcyzaFpbdLpJPr+E9fSkyQ7KpQD4SdFcugkRQYzhmfI4KeV4Qpnn2sKPdo+kmsgRQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tr46": "^5.1.0",
|
"tr46": "^5.0.0",
|
||||||
"webidl-conversions": "^7.0.0"
|
"webidl-conversions": "^7.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -3804,6 +3890,52 @@
|
|||||||
"node": ">= 12.0.0"
|
"node": ">= 12.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/winston-transport/node_modules/readable-stream": {
|
||||||
|
"version": "3.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||||
|
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"inherits": "^2.0.3",
|
||||||
|
"string_decoder": "^1.1.1",
|
||||||
|
"util-deprecate": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/winston-transport/node_modules/string_decoder": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "~5.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/winston/node_modules/readable-stream": {
|
||||||
|
"version": "3.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||||
|
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"inherits": "^2.0.3",
|
||||||
|
"string_decoder": "^1.1.1",
|
||||||
|
"util-deprecate": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/winston/node_modules/string_decoder": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "~5.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/word-wrap": {
|
"node_modules/word-wrap": {
|
||||||
"version": "1.2.5",
|
"version": "1.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
"@types/morgan": "^1.9.9",
|
"@types/morgan": "^1.9.9",
|
||||||
"crc-32": "^1.2.2",
|
"crc-32": "^1.2.2",
|
||||||
"express": "^5",
|
"express": "^5",
|
||||||
"json-with-bigint": "^3.4.4",
|
"json-with-bigint": "^3.2.2",
|
||||||
"mongoose": "^8.11.0",
|
"mongoose": "^8.11.0",
|
||||||
"morgan": "^1.10.0",
|
"morgan": "^1.10.0",
|
||||||
"ncp": "^2.0.0",
|
"ncp": "^2.0.0",
|
||||||
"typescript": "^5.5",
|
"typescript": "^5.5",
|
||||||
"warframe-public-export-plus": "^0.5.62",
|
"warframe-public-export-plus": "^0.5.56",
|
||||||
"warframe-riven-info": "^0.1.2",
|
"warframe-riven-info": "^0.1.2",
|
||||||
"winston": "^3.17.0",
|
"winston": "^3.17.0",
|
||||||
"winston-daily-rotate-file": "^5.0.0"
|
"winston-daily-rotate-file": "^5.0.0"
|
||||||
|
@ -21,13 +21,6 @@ app.use((req, _res, next) => {
|
|||||||
if (req.headers["content-encoding"] == "ezip" || req.headers["content-encoding"] == "e") {
|
if (req.headers["content-encoding"] == "ezip" || req.headers["content-encoding"] == "e") {
|
||||||
req.headers["content-encoding"] = undefined;
|
req.headers["content-encoding"] = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// U18 uses application/x-www-form-urlencoded even tho the data is JSON which Express doesn't like.
|
|
||||||
// U17 sets no Content-Type at all, which Express also doesn't like.
|
|
||||||
if (!req.headers["content-type"] || req.headers["content-type"] == "application/x-www-form-urlencoded") {
|
|
||||||
req.headers["content-type"] = "application/octet-stream";
|
|
||||||
}
|
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,18 +2,15 @@ const millisecondsPerSecond = 1000;
|
|||||||
const secondsPerMinute = 60;
|
const secondsPerMinute = 60;
|
||||||
const minutesPerHour = 60;
|
const minutesPerHour = 60;
|
||||||
const hoursPerDay = 24;
|
const hoursPerDay = 24;
|
||||||
const daysPerWeek = 7;
|
|
||||||
|
|
||||||
const unixSecond = millisecondsPerSecond;
|
const unixSecond = millisecondsPerSecond;
|
||||||
const unixMinute = secondsPerMinute * millisecondsPerSecond;
|
const unixMinute = secondsPerMinute * millisecondsPerSecond;
|
||||||
const unixHour = unixMinute * minutesPerHour;
|
const unixHour = unixMinute * minutesPerHour;
|
||||||
const unixDay = hoursPerDay * unixHour;
|
const unixDay = hoursPerDay * unixHour;
|
||||||
const unixWeek = daysPerWeek * unixDay;
|
|
||||||
|
|
||||||
export const unixTimesInMs = {
|
export const unixTimesInMs = {
|
||||||
second: unixSecond,
|
second: unixSecond,
|
||||||
minute: unixMinute,
|
minute: unixMinute,
|
||||||
hour: unixHour,
|
hour: unixHour,
|
||||||
day: unixDay,
|
day: unixDay
|
||||||
week: unixWeek
|
|
||||||
};
|
};
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import {
|
import { createVeiledRivenFingerprint, rivenRawToRealWeighted } from "@/src/helpers/rivenHelper";
|
||||||
createVeiledRivenFingerprint,
|
|
||||||
createUnveiledRivenFingerprint,
|
|
||||||
rivenRawToRealWeighted
|
|
||||||
} from "@/src/helpers/rivenHelper";
|
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { addMods, getInventory } from "@/src/services/inventoryService";
|
import { addMods, getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getRandomElement } from "@/src/services/rngService";
|
import { getRandomElement } from "@/src/services/rngService";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { ExportUpgrades } from "warframe-public-export-plus";
|
import { ExportUpgrades } from "warframe-public-export-plus";
|
||||||
import { config } from "@/src/services/configService";
|
|
||||||
|
|
||||||
export const activateRandomModController: RequestHandler = async (req, res) => {
|
export const activateRandomModController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -22,10 +17,8 @@ export const activateRandomModController: RequestHandler = async (req, res) => {
|
|||||||
ItemCount: -1
|
ItemCount: -1
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
const rivenType = getRandomElement(rivenRawToRealWeighted[request.ItemType])!;
|
const rivenType = getRandomElement(rivenRawToRealWeighted[request.ItemType]);
|
||||||
const fingerprint = config.instantFinishRivenChallenge
|
const fingerprint = createVeiledRivenFingerprint(ExportUpgrades[rivenType]);
|
||||||
? createUnveiledRivenFingerprint(ExportUpgrades[rivenType])
|
|
||||||
: createVeiledRivenFingerprint(ExportUpgrades[rivenType]);
|
|
||||||
const upgradeIndex =
|
const upgradeIndex =
|
||||||
inventory.Upgrades.push({
|
inventory.Upgrades.push({
|
||||||
ItemType: rivenType,
|
ItemType: rivenType,
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|
||||||
import { Friendship } from "@/src/models/friendModel";
|
|
||||||
import { addAccountDataToFriendInfo, addInventoryDataToFriendInfo } from "@/src/services/friendService";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
import { IFriendInfo } from "@/src/types/friendTypes";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
|
|
||||||
export const addFriendController: RequestHandler = async (req, res) => {
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
const payload = getJSONfromString<IAddFriendRequest>(String(req.body));
|
|
||||||
const promises: Promise<void>[] = [];
|
|
||||||
const newFriends: IFriendInfo[] = [];
|
|
||||||
if (payload.friend == "all") {
|
|
||||||
const [internalFriendships, externalFriendships] = await Promise.all([
|
|
||||||
Friendship.find({ owner: accountId }, "friend"),
|
|
||||||
Friendship.find({ friend: accountId }, "owner")
|
|
||||||
]);
|
|
||||||
for (const externalFriendship of externalFriendships) {
|
|
||||||
if (!internalFriendships.find(x => x.friend.equals(externalFriendship.owner))) {
|
|
||||||
promises.push(
|
|
||||||
Friendship.insertOne({
|
|
||||||
owner: accountId,
|
|
||||||
friend: externalFriendship.owner,
|
|
||||||
Note: externalFriendship.Note // TOVERIFY: Should the note be copied when accepting a friend request?
|
|
||||||
}) as unknown as Promise<void>
|
|
||||||
);
|
|
||||||
newFriends.push({
|
|
||||||
_id: toOid(externalFriendship.owner)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const externalFriendship = await Friendship.findOne({ owner: payload.friend, friend: accountId }, "Note");
|
|
||||||
if (externalFriendship) {
|
|
||||||
promises.push(
|
|
||||||
Friendship.insertOne({
|
|
||||||
owner: accountId,
|
|
||||||
friend: payload.friend,
|
|
||||||
Note: externalFriendship.Note
|
|
||||||
}) as unknown as Promise<void>
|
|
||||||
);
|
|
||||||
newFriends.push({
|
|
||||||
_id: { $oid: payload.friend }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const newFriend of newFriends) {
|
|
||||||
promises.push(addAccountDataToFriendInfo(newFriend));
|
|
||||||
promises.push(addInventoryDataToFriendInfo(newFriend));
|
|
||||||
}
|
|
||||||
await Promise.all(promises);
|
|
||||||
res.json({
|
|
||||||
Friends: newFriends
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IAddFriendRequest {
|
|
||||||
friend: string; // oid or "all" in which case all=1 is also a query parameter
|
|
||||||
}
|
|
@ -2,7 +2,7 @@ import { toOid } from "@/src/helpers/inventoryHelpers";
|
|||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { Account, Ignore } from "@/src/models/loginModel";
|
import { Account, Ignore } from "@/src/models/loginModel";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { IFriendInfo } from "@/src/types/friendTypes";
|
import { IFriendInfo } from "@/src/types/guildTypes";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
export const addIgnoredUserController: RequestHandler = async (req, res) => {
|
export const addIgnoredUserController: RequestHandler = async (req, res) => {
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|
||||||
import { Friendship } from "@/src/models/friendModel";
|
|
||||||
import { Account } from "@/src/models/loginModel";
|
|
||||||
import { addInventoryDataToFriendInfo, areFriendsOfFriends } from "@/src/services/friendService";
|
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
import { IFriendInfo } from "@/src/types/friendTypes";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
|
|
||||||
export const addPendingFriendController: RequestHandler = async (req, res) => {
|
|
||||||
const payload = getJSONfromString<IAddPendingFriendRequest>(String(req.body));
|
|
||||||
|
|
||||||
const account = await Account.findOne({ DisplayName: payload.friend });
|
|
||||||
if (!account) {
|
|
||||||
res.status(400).end();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
const inventory = await getInventory(account._id.toString(), "Settings");
|
|
||||||
if (
|
|
||||||
inventory.Settings?.FriendInvRestriction == "GIFT_MODE_NONE" ||
|
|
||||||
(inventory.Settings?.FriendInvRestriction == "GIFT_MODE_FRIENDS" &&
|
|
||||||
!(await areFriendsOfFriends(account._id, accountId)))
|
|
||||||
) {
|
|
||||||
res.status(400).send("Friend Invite Restriction");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await Friendship.insertOne({
|
|
||||||
owner: accountId,
|
|
||||||
friend: account._id,
|
|
||||||
Note: payload.message
|
|
||||||
});
|
|
||||||
|
|
||||||
const friendInfo: IFriendInfo = {
|
|
||||||
_id: toOid(account._id),
|
|
||||||
DisplayName: account.DisplayName,
|
|
||||||
LastLogin: toMongoDate(account.LastLogin),
|
|
||||||
Note: payload.message
|
|
||||||
};
|
|
||||||
await addInventoryDataToFriendInfo(friendInfo);
|
|
||||||
res.json({
|
|
||||||
Friend: friendInfo
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IAddPendingFriendRequest {
|
|
||||||
friend: string;
|
|
||||||
message: string;
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
import { getJSONfromString, regexEscape } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString, regexEscape } from "@/src/helpers/stringHelpers";
|
||||||
import { Alliance, AllianceMember, Guild, GuildMember } from "@/src/models/guildModel";
|
import { Alliance, AllianceMember, Guild, GuildMember } from "@/src/models/guildModel";
|
||||||
import { createMessage } from "@/src/services/inboxService";
|
import { createMessage } from "@/src/services/inboxService";
|
||||||
import { getEffectiveAvatarImageType, getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService";
|
import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService";
|
||||||
import { GuildPermission } from "@/src/types/guildTypes";
|
import { GuildPermission } from "@/src/types/guildTypes";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
@ -75,7 +75,7 @@ export const addToAllianceController: RequestHandler = async (req, res) => {
|
|||||||
const invitedClanOwnerMember = (await GuildMember.findOne({ guildId: guilds[0]._id, rank: 0 }))!;
|
const invitedClanOwnerMember = (await GuildMember.findOne({ guildId: guilds[0]._id, rank: 0 }))!;
|
||||||
const senderInventory = await getInventory(account._id.toString(), "ActiveAvatarImageType");
|
const senderInventory = await getInventory(account._id.toString(), "ActiveAvatarImageType");
|
||||||
const senderGuild = (await Guild.findById(allianceMember.guildId, "Name"))!;
|
const senderGuild = (await Guild.findById(allianceMember.guildId, "Name"))!;
|
||||||
const alliance = (await Alliance.findById(req.query.allianceId as string, "Name"))!;
|
const alliance = (await Alliance.findById(req.query.allianceId, "Name"))!;
|
||||||
await createMessage(invitedClanOwnerMember.accountId, [
|
await createMessage(invitedClanOwnerMember.accountId, [
|
||||||
{
|
{
|
||||||
sndr: getSuffixedName(account),
|
sndr: getSuffixedName(account),
|
||||||
@ -95,7 +95,7 @@ export const addToAllianceController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
sub: "/Lotus/Language/Menu/Mailbox_AllianceInvite_Title",
|
sub: "/Lotus/Language/Menu/Mailbox_AllianceInvite_Title",
|
||||||
icon: ExportFlavour[getEffectiveAvatarImageType(senderInventory)].icon,
|
icon: ExportFlavour[senderInventory.ActiveAvatarImageType].icon,
|
||||||
contextInfo: alliance._id.toString(),
|
contextInfo: alliance._id.toString(),
|
||||||
highPriority: true,
|
highPriority: true,
|
||||||
acceptAction: "ALLIANCE_INVITE",
|
acceptAction: "ALLIANCE_INVITE",
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import { toMongoDate } from "@/src/helpers/inventoryHelpers";
|
|
||||||
import { Guild, GuildMember } from "@/src/models/guildModel";
|
import { Guild, GuildMember } from "@/src/models/guildModel";
|
||||||
import { Account } from "@/src/models/loginModel";
|
import { Account } from "@/src/models/loginModel";
|
||||||
import { addInventoryDataToFriendInfo, areFriends } from "@/src/services/friendService";
|
import { fillInInventoryDataForGuildMember, hasGuildPermission } from "@/src/services/guildService";
|
||||||
import { hasGuildPermission } from "@/src/services/guildService";
|
|
||||||
import { createMessage } from "@/src/services/inboxService";
|
import { createMessage } from "@/src/services/inboxService";
|
||||||
import { getEffectiveAvatarImageType, getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountForRequest, getAccountIdForRequest, getSuffixedName } from "@/src/services/loginService";
|
import { getAccountForRequest, getAccountIdForRequest, getSuffixedName } from "@/src/services/loginService";
|
||||||
import { IOid } from "@/src/types/commonTypes";
|
import { IOid } from "@/src/types/commonTypes";
|
||||||
import { GuildPermission, IGuildMemberClient } from "@/src/types/guildTypes";
|
import { GuildPermission, IGuildMemberClient } from "@/src/types/guildTypes";
|
||||||
@ -24,18 +22,15 @@ export const addToGuildController: RequestHandler = async (req, res) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const senderAccount = await getAccountForRequest(req);
|
|
||||||
const inventory = await getInventory(account._id.toString(), "Settings");
|
const inventory = await getInventory(account._id.toString(), "Settings");
|
||||||
if (
|
// TODO: Also consider GIFT_MODE_FRIENDS once friends are implemented
|
||||||
inventory.Settings?.GuildInvRestriction == "GIFT_MODE_NONE" ||
|
if (inventory.Settings?.GuildInvRestriction == "GIFT_MODE_NONE") {
|
||||||
(inventory.Settings?.GuildInvRestriction == "GIFT_MODE_FRIENDS" &&
|
|
||||||
!(await areFriends(account._id, senderAccount._id)))
|
|
||||||
) {
|
|
||||||
res.status(400).json("Invite restricted");
|
res.status(400).json("Invite restricted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const guild = (await Guild.findById(payload.GuildId.$oid, "Name Ranks"))!;
|
const guild = (await Guild.findById(payload.GuildId.$oid, "Name Ranks"))!;
|
||||||
|
const senderAccount = await getAccountForRequest(req);
|
||||||
if (!(await hasGuildPermission(guild, senderAccount._id.toString(), GuildPermission.Recruiter))) {
|
if (!(await hasGuildPermission(guild, senderAccount._id.toString(), GuildPermission.Recruiter))) {
|
||||||
res.status(400).json("Invalid permission");
|
res.status(400).json("Invalid permission");
|
||||||
}
|
}
|
||||||
@ -64,7 +59,7 @@ export const addToGuildController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
sub: "/Lotus/Language/Menu/Mailbox_ClanInvite_Title",
|
sub: "/Lotus/Language/Menu/Mailbox_ClanInvite_Title",
|
||||||
icon: ExportFlavour[getEffectiveAvatarImageType(senderInventory)].icon,
|
icon: ExportFlavour[senderInventory.ActiveAvatarImageType].icon,
|
||||||
contextInfo: payload.GuildId.$oid,
|
contextInfo: payload.GuildId.$oid,
|
||||||
highPriority: true,
|
highPriority: true,
|
||||||
acceptAction: "GUILD_INVITE",
|
acceptAction: "GUILD_INVITE",
|
||||||
@ -76,11 +71,10 @@ export const addToGuildController: RequestHandler = async (req, res) => {
|
|||||||
const member: IGuildMemberClient = {
|
const member: IGuildMemberClient = {
|
||||||
_id: { $oid: account._id.toString() },
|
_id: { $oid: account._id.toString() },
|
||||||
DisplayName: account.DisplayName,
|
DisplayName: account.DisplayName,
|
||||||
LastLogin: toMongoDate(account.LastLogin),
|
|
||||||
Rank: 7,
|
Rank: 7,
|
||||||
Status: 2
|
Status: 2
|
||||||
};
|
};
|
||||||
await addInventoryDataToFriendInfo(member);
|
await fillInInventoryDataForGuildMember(member);
|
||||||
res.json({ NewMember: member });
|
res.json({ NewMember: member });
|
||||||
} else if ("RequestMsg" in payload) {
|
} else if ("RequestMsg" in payload) {
|
||||||
// Player applying to join a clan
|
// Player applying to join a clan
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { fromOid, toOid } from "@/src/helpers/inventoryHelpers";
|
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { createVeiledRivenFingerprint, rivenRawToRealWeighted } from "@/src/helpers/rivenHelper";
|
import { createVeiledRivenFingerprint, rivenRawToRealWeighted } from "@/src/helpers/rivenHelper";
|
||||||
import { addMiscItems, addMods, getInventory } from "@/src/services/inventoryService";
|
import { addMiscItems, addMods, getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getRandomElement, getRandomWeightedReward, getRandomWeightedRewardUc } from "@/src/services/rngService";
|
import { getRandomElement, getRandomWeightedReward, getRandomWeightedRewardUc } from "@/src/services/rngService";
|
||||||
import { IUpgradeFromClient } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IOid } from "@/src/types/commonTypes";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { ExportBoosterPacks, ExportUpgrades, TRarity } from "warframe-public-export-plus";
|
import { ExportBoosterPacks, ExportUpgrades, TRarity } from "warframe-public-export-plus";
|
||||||
|
|
||||||
@ -24,11 +24,11 @@ export const artifactTransmutationController: RequestHandler = async (req, res)
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
payload.Consumed.forEach(upgrade => {
|
payload.Consumed.forEach(upgrade => {
|
||||||
inventory.Upgrades.pull({ _id: fromOid(upgrade.ItemId) });
|
inventory.Upgrades.pull({ _id: upgrade.ItemId.$oid });
|
||||||
});
|
});
|
||||||
|
|
||||||
const rawRivenType = getRandomRawRivenType();
|
const rawRivenType = getRandomRawRivenType();
|
||||||
const rivenType = getRandomElement(rivenRawToRealWeighted[rawRivenType])!;
|
const rivenType = getRandomElement(rivenRawToRealWeighted[rawRivenType]);
|
||||||
const fingerprint = createVeiledRivenFingerprint(ExportUpgrades[rivenType]);
|
const fingerprint = createVeiledRivenFingerprint(ExportUpgrades[rivenType]);
|
||||||
|
|
||||||
const upgradeIndex =
|
const upgradeIndex =
|
||||||
@ -57,8 +57,8 @@ export const artifactTransmutationController: RequestHandler = async (req, res)
|
|||||||
payload.Consumed.forEach(upgrade => {
|
payload.Consumed.forEach(upgrade => {
|
||||||
const meta = ExportUpgrades[upgrade.ItemType];
|
const meta = ExportUpgrades[upgrade.ItemType];
|
||||||
counts[meta.rarity] += upgrade.ItemCount;
|
counts[meta.rarity] += upgrade.ItemCount;
|
||||||
if (fromOid(upgrade.ItemId) != "000000000000000000000000") {
|
if (upgrade.ItemId.$oid != "000000000000000000000000") {
|
||||||
inventory.Upgrades.pull({ _id: fromOid(upgrade.ItemId) });
|
inventory.Upgrades.pull({ _id: upgrade.ItemId.$oid });
|
||||||
} else {
|
} else {
|
||||||
addMods(inventory, [
|
addMods(inventory, [
|
||||||
{
|
{
|
||||||
@ -128,14 +128,24 @@ const getRandomRawRivenType = (): string => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
interface IArtifactTransmutationRequest {
|
interface IArtifactTransmutationRequest {
|
||||||
Upgrade: IUpgradeFromClient;
|
Upgrade: IAgnosticUpgradeClient;
|
||||||
LevelDiff: number;
|
LevelDiff: number;
|
||||||
Consumed: IUpgradeFromClient[];
|
Consumed: IAgnosticUpgradeClient[];
|
||||||
Cost: number;
|
Cost: number;
|
||||||
FusionPointCost: number;
|
FusionPointCost: number;
|
||||||
RivenTransmute?: boolean;
|
RivenTransmute?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IAgnosticUpgradeClient {
|
||||||
|
ItemType: string;
|
||||||
|
ItemId: IOid;
|
||||||
|
FromSKU: boolean;
|
||||||
|
UpgradeFingerprint: string;
|
||||||
|
PendingRerollFingerprint: string;
|
||||||
|
ItemCount: number;
|
||||||
|
LastAdded: IOid;
|
||||||
|
}
|
||||||
|
|
||||||
const specialModSets: string[][] = [
|
const specialModSets: string[][] = [
|
||||||
[
|
[
|
||||||
"/Lotus/Upgrades/Mods/Immortal/ImmortalOneMod",
|
"/Lotus/Upgrades/Mods/Immortal/ImmortalOneMod",
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { getRecipe } from "@/src/services/itemDataService";
|
import { getRecipe } from "@/src/services/itemDataService";
|
||||||
import { IOid, IOidWithLegacySupport } from "@/src/types/commonTypes";
|
import { IOid } from "@/src/types/commonTypes";
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { getAccountForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import {
|
import {
|
||||||
getInventory,
|
getInventory,
|
||||||
updateCurrency,
|
updateCurrency,
|
||||||
@ -17,11 +17,8 @@ import {
|
|||||||
} from "@/src/services/inventoryService";
|
} from "@/src/services/inventoryService";
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||||
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { InventorySlot, IPendingRecipeDatabase } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { toOid2 } from "@/src/helpers/inventoryHelpers";
|
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
|
||||||
import { IRecipe } from "warframe-public-export-plus";
|
|
||||||
import { config } from "@/src/services/configService";
|
|
||||||
|
|
||||||
interface IClaimCompletedRecipeRequest {
|
interface IClaimCompletedRecipeRequest {
|
||||||
RecipeIds: IOid[];
|
RecipeIds: IOid[];
|
||||||
@ -29,8 +26,10 @@ interface IClaimCompletedRecipeRequest {
|
|||||||
|
|
||||||
export const claimCompletedRecipeController: RequestHandler = async (req, res) => {
|
export const claimCompletedRecipeController: RequestHandler = async (req, res) => {
|
||||||
const claimCompletedRecipeRequest = getJSONfromString<IClaimCompletedRecipeRequest>(String(req.body));
|
const claimCompletedRecipeRequest = getJSONfromString<IClaimCompletedRecipeRequest>(String(req.body));
|
||||||
const account = await getAccountForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(account._id.toString());
|
if (!accountId) throw new Error("no account id");
|
||||||
|
|
||||||
|
const inventory = await getInventory(accountId);
|
||||||
const pendingRecipe = inventory.PendingRecipes.id(claimCompletedRecipeRequest.RecipeIds[0].$oid);
|
const pendingRecipe = inventory.PendingRecipes.id(claimCompletedRecipeRequest.RecipeIds[0].$oid);
|
||||||
if (!pendingRecipe) {
|
if (!pendingRecipe) {
|
||||||
throw new Error(`no pending recipe found with id ${claimCompletedRecipeRequest.RecipeIds[0].$oid}`);
|
throw new Error(`no pending recipe found with id ${claimCompletedRecipeRequest.RecipeIds[0].$oid}`);
|
||||||
@ -49,14 +48,40 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (req.query.cancel) {
|
if (req.query.cancel) {
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
const inventoryChanges: IInventoryChanges = {
|
||||||
await refundRecipeIngredients(inventory, inventoryChanges, recipe, pendingRecipe);
|
...updateCurrency(inventory, recipe.buildPrice * -1, false)
|
||||||
|
};
|
||||||
|
|
||||||
|
const equipmentIngredients = new Set();
|
||||||
|
for (const category of ["LongGuns", "Pistols", "Melee"] as const) {
|
||||||
|
if (pendingRecipe[category]) {
|
||||||
|
pendingRecipe[category].forEach(item => {
|
||||||
|
const index = inventory[category].push(item) - 1;
|
||||||
|
inventoryChanges[category] ??= [];
|
||||||
|
inventoryChanges[category].push(inventory[category][index].toJSON<IEquipmentClient>());
|
||||||
|
equipmentIngredients.add(item.ItemType);
|
||||||
|
|
||||||
|
occupySlot(inventory, InventorySlot.WEAPONS, false);
|
||||||
|
inventoryChanges.WeaponBin ??= { Slots: 0 };
|
||||||
|
inventoryChanges.WeaponBin.Slots -= 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const ingredient of recipe.ingredients) {
|
||||||
|
if (!equipmentIngredients.has(ingredient.ItemType)) {
|
||||||
|
combineInventoryChanges(
|
||||||
|
inventoryChanges,
|
||||||
|
await addItem(inventory, ingredient.ItemType, ingredient.ItemCount)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json(inventoryChanges); // Not a bug: In the specific case of cancelling a recipe, InventoryChanges are expected to be the root.
|
res.json(inventoryChanges); // Not a bug: In the specific case of cancelling a recipe, InventoryChanges are expected to be the root.
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Claiming Recipe", { recipe, pendingRecipe });
|
logger.debug("Claiming Recipe", { recipe, pendingRecipe });
|
||||||
|
|
||||||
let BrandedSuits: undefined | IOidWithLegacySupport[];
|
let BrandedSuits: undefined | IOid[];
|
||||||
if (recipe.secretIngredientAction == "SIA_SPECTRE_LOADOUT_COPY") {
|
if (recipe.secretIngredientAction == "SIA_SPECTRE_LOADOUT_COPY") {
|
||||||
inventory.PendingSpectreLoadouts ??= [];
|
inventory.PendingSpectreLoadouts ??= [];
|
||||||
inventory.SpectreLoadouts ??= [];
|
inventory.SpectreLoadouts ??= [];
|
||||||
@ -81,7 +106,7 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
|
|||||||
inventory.BrandedSuits!.findIndex(x => x.equals(pendingRecipe.SuitToUnbrand)),
|
inventory.BrandedSuits!.findIndex(x => x.equals(pendingRecipe.SuitToUnbrand)),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
BrandedSuits = [toOid2(pendingRecipe.SuitToUnbrand!, account.BuildLabel)];
|
BrandedSuits = [toOid(pendingRecipe.SuitToUnbrand!)];
|
||||||
}
|
}
|
||||||
|
|
||||||
let InventoryChanges: IInventoryChanges = {};
|
let InventoryChanges: IInventoryChanges = {};
|
||||||
@ -108,53 +133,10 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
|
|||||||
if (recipe.secretIngredientAction != "SIA_UNBRAND") {
|
if (recipe.secretIngredientAction != "SIA_UNBRAND") {
|
||||||
InventoryChanges = {
|
InventoryChanges = {
|
||||||
...InventoryChanges,
|
...InventoryChanges,
|
||||||
...(await addItem(
|
...(await addItem(inventory, recipe.resultType, recipe.num, false))
|
||||||
inventory,
|
|
||||||
recipe.resultType,
|
|
||||||
recipe.num,
|
|
||||||
false,
|
|
||||||
undefined,
|
|
||||||
pendingRecipe.TargetFingerprint
|
|
||||||
))
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (config.claimingBlueprintRefundsIngredients) {
|
|
||||||
await refundRecipeIngredients(inventory, InventoryChanges, recipe, pendingRecipe);
|
|
||||||
}
|
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json({ InventoryChanges, BrandedSuits });
|
res.json({ InventoryChanges, BrandedSuits });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const refundRecipeIngredients = async (
|
|
||||||
inventory: TInventoryDatabaseDocument,
|
|
||||||
inventoryChanges: IInventoryChanges,
|
|
||||||
recipe: IRecipe,
|
|
||||||
pendingRecipe: IPendingRecipeDatabase
|
|
||||||
): Promise<void> => {
|
|
||||||
updateCurrency(inventory, recipe.buildPrice * -1, false, inventoryChanges);
|
|
||||||
|
|
||||||
const equipmentIngredients = new Set();
|
|
||||||
for (const category of ["LongGuns", "Pistols", "Melee"] as const) {
|
|
||||||
if (pendingRecipe[category]) {
|
|
||||||
pendingRecipe[category].forEach(item => {
|
|
||||||
const index = inventory[category].push(item) - 1;
|
|
||||||
inventoryChanges[category] ??= [];
|
|
||||||
inventoryChanges[category].push(inventory[category][index].toJSON<IEquipmentClient>());
|
|
||||||
equipmentIngredients.add(item.ItemType);
|
|
||||||
|
|
||||||
occupySlot(inventory, InventorySlot.WEAPONS, false);
|
|
||||||
inventoryChanges.WeaponBin ??= { Slots: 0 };
|
|
||||||
inventoryChanges.WeaponBin.Slots -= 1;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const ingredient of recipe.ingredients) {
|
|
||||||
if (!equipmentIngredients.has(ingredient.ItemType)) {
|
|
||||||
combineInventoryChanges(
|
|
||||||
inventoryChanges,
|
|
||||||
await addItem(inventory, ingredient.ItemType, ingredient.ItemCount)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { addFusionPoints, getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ export const claimLibraryDailyTaskRewardController: RequestHandler = async (req,
|
|||||||
}
|
}
|
||||||
syndicate.Standing += rewardStanding;
|
syndicate.Standing += rewardStanding;
|
||||||
|
|
||||||
addFusionPoints(inventory, 80 * rewardQuantity);
|
inventory.FusionPoints += 80 * rewardQuantity;
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
import { getCalendarProgress, getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
|
|
||||||
import { getWorldState } from "@/src/services/worldStateService";
|
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
|
|
||||||
// GET request; query parameters: CompletedEventIdx=0&Iteration=4&Version=19&Season=CST_SUMMER
|
|
||||||
export const completeCalendarEventController: RequestHandler = async (req, res) => {
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
const inventory = await getInventory(accountId);
|
|
||||||
const calendarProgress = getCalendarProgress(inventory);
|
|
||||||
const currentSeason = getWorldState().KnownCalendarSeasons[0];
|
|
||||||
let inventoryChanges: IInventoryChanges = {};
|
|
||||||
let dayIndex = 0;
|
|
||||||
for (const day of currentSeason.Days) {
|
|
||||||
if (day.events.length == 0 || day.events[0].type != "CET_CHALLENGE") {
|
|
||||||
if (dayIndex == calendarProgress.SeasonProgress.LastCompletedDayIdx) {
|
|
||||||
if (day.events.length != 0) {
|
|
||||||
const selection = day.events[parseInt(req.query.CompletedEventIdx as string)];
|
|
||||||
if (selection.type == "CET_REWARD") {
|
|
||||||
inventoryChanges = (await handleStoreItemAcquisition(selection.reward!, inventory))
|
|
||||||
.InventoryChanges;
|
|
||||||
} else if (selection.type == "CET_UPGRADE") {
|
|
||||||
calendarProgress.YearProgress.Upgrades.push(selection.upgrade!);
|
|
||||||
} else if (selection.type != "CET_PLOT") {
|
|
||||||
throw new Error(`unexpected selection type: ${selection.type}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++dayIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
calendarProgress.SeasonProgress.LastCompletedDayIdx++;
|
|
||||||
await inventory.save();
|
|
||||||
res.json({
|
|
||||||
InventoryChanges: inventoryChanges,
|
|
||||||
CalendarProgress: inventory.CalendarProgress
|
|
||||||
});
|
|
||||||
};
|
|
@ -1,14 +1,8 @@
|
|||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { Guild, GuildMember } from "@/src/models/guildModel";
|
import { Guild, GuildMember } from "@/src/models/guildModel";
|
||||||
import { Account } from "@/src/models/loginModel";
|
import { Account } from "@/src/models/loginModel";
|
||||||
import {
|
import { deleteGuild, getGuildClient, hasGuildPermission, removeDojoKeyItems } from "@/src/services/guildService";
|
||||||
deleteGuild,
|
import { addRecipes, combineInventoryChanges, getInventory } from "@/src/services/inventoryService";
|
||||||
getGuildClient,
|
|
||||||
giveClanKey,
|
|
||||||
hasGuildPermission,
|
|
||||||
removeDojoKeyItems
|
|
||||||
} from "@/src/services/guildService";
|
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { getAccountForRequest, getAccountIdForRequest, getSuffixedName } from "@/src/services/loginService";
|
import { getAccountForRequest, getAccountIdForRequest, getSuffixedName } from "@/src/services/loginService";
|
||||||
import { GuildPermission } from "@/src/types/guildTypes";
|
import { GuildPermission } from "@/src/types/guildTypes";
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||||
@ -47,7 +41,14 @@ export const confirmGuildInvitationGetController: RequestHandler = async (req, r
|
|||||||
// Update inventory of new member
|
// Update inventory of new member
|
||||||
const inventory = await getInventory(account._id.toString(), "GuildId LevelKeys Recipes");
|
const inventory = await getInventory(account._id.toString(), "GuildId LevelKeys Recipes");
|
||||||
inventory.GuildId = new Types.ObjectId(req.query.clanId as string);
|
inventory.GuildId = new Types.ObjectId(req.query.clanId as string);
|
||||||
giveClanKey(inventory, inventoryChanges);
|
const recipeChanges = [
|
||||||
|
{
|
||||||
|
ItemType: "/Lotus/Types/Keys/DojoKeyBlueprint",
|
||||||
|
ItemCount: 1
|
||||||
|
}
|
||||||
|
];
|
||||||
|
addRecipes(inventory, recipeChanges);
|
||||||
|
combineInventoryChanges(inventoryChanges, { Recipes: recipeChanges });
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
|
|
||||||
const guild = (await Guild.findById(req.query.clanId as string))!;
|
const guild = (await Guild.findById(req.query.clanId as string))!;
|
||||||
@ -62,7 +63,7 @@ export const confirmGuildInvitationGetController: RequestHandler = async (req, r
|
|||||||
await guild.save();
|
await guild.save();
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
...(await getGuildClient(guild, account)),
|
...(await getGuildClient(guild, account._id.toString())),
|
||||||
InventoryChanges: inventoryChanges
|
InventoryChanges: inventoryChanges
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -95,9 +96,14 @@ export const confirmGuildInvitationPostController: RequestHandler = async (req,
|
|||||||
await GuildMember.deleteMany({ accountId: guildMember.accountId, status: 1 });
|
await GuildMember.deleteMany({ accountId: guildMember.accountId, status: 1 });
|
||||||
|
|
||||||
// Update inventory of new member
|
// Update inventory of new member
|
||||||
const inventory = await getInventory(guildMember.accountId.toString(), "GuildId LevelKeys Recipes");
|
const inventory = await getInventory(guildMember.accountId.toString(), "GuildId Recipes");
|
||||||
inventory.GuildId = new Types.ObjectId(req.query.clanId as string);
|
inventory.GuildId = new Types.ObjectId(req.query.clanId as string);
|
||||||
giveClanKey(inventory);
|
addRecipes(inventory, [
|
||||||
|
{
|
||||||
|
ItemType: "/Lotus/Types/Keys/DojoKeyBlueprint",
|
||||||
|
ItemCount: 1
|
||||||
|
}
|
||||||
|
]);
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
|
|
||||||
// Add join to clan log
|
// Add join to clan log
|
||||||
|
@ -2,7 +2,7 @@ import { toMongoDate } from "@/src/helpers/inventoryHelpers";
|
|||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { Guild } from "@/src/models/guildModel";
|
import { Guild } from "@/src/models/guildModel";
|
||||||
import { checkClanAscensionHasRequiredContributors } from "@/src/services/guildService";
|
import { checkClanAscensionHasRequiredContributors } from "@/src/services/guildService";
|
||||||
import { addFusionPoints, getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
@ -36,7 +36,7 @@ export const contributeGuildClassController: RequestHandler = async (req, res) =
|
|||||||
|
|
||||||
// Either way, endo is given to the contributor.
|
// Either way, endo is given to the contributor.
|
||||||
const inventory = await getInventory(accountId, "FusionPoints");
|
const inventory = await getInventory(accountId, "FusionPoints");
|
||||||
addFusionPoints(inventory, guild.CeremonyEndo!);
|
inventory.FusionPoints += guild.CeremonyEndo!;
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { getAccountForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { Guild, GuildMember } from "@/src/models/guildModel";
|
import { Guild, GuildMember } from "@/src/models/guildModel";
|
||||||
import { createUniqueClanName, getGuildClient, giveClanKey } from "@/src/services/guildService";
|
import { createUniqueClanName, getGuildClient } from "@/src/services/guildService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { addRecipes, getInventory } from "@/src/services/inventoryService";
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
|
||||||
|
|
||||||
export const createGuildController: RequestHandler = async (req, res) => {
|
export const createGuildController: RequestHandler = async (req, res) => {
|
||||||
const account = await getAccountForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const payload = getJSONfromString<ICreateGuildRequest>(String(req.body));
|
const payload = getJSONfromString<ICreateGuildRequest>(String(req.body));
|
||||||
|
|
||||||
// Remove pending applications for this account
|
// Remove pending applications for this account
|
||||||
await GuildMember.deleteMany({ accountId: account._id, status: 1 });
|
await GuildMember.deleteMany({ accountId, status: 1 });
|
||||||
|
|
||||||
// Create guild on database
|
// Create guild on database
|
||||||
const guild = new Guild({
|
const guild = new Guild({
|
||||||
@ -21,21 +20,32 @@ export const createGuildController: RequestHandler = async (req, res) => {
|
|||||||
|
|
||||||
// Create guild member on database
|
// Create guild member on database
|
||||||
await GuildMember.insertOne({
|
await GuildMember.insertOne({
|
||||||
accountId: account._id,
|
accountId: accountId,
|
||||||
guildId: guild._id,
|
guildId: guild._id,
|
||||||
status: 0,
|
status: 0,
|
||||||
rank: 0
|
rank: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
const inventory = await getInventory(account._id.toString(), "GuildId LevelKeys Recipes");
|
const inventory = await getInventory(accountId, "GuildId Recipes");
|
||||||
inventory.GuildId = guild._id;
|
inventory.GuildId = guild._id;
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
addRecipes(inventory, [
|
||||||
giveClanKey(inventory, inventoryChanges);
|
{
|
||||||
|
ItemType: "/Lotus/Types/Keys/DojoKeyBlueprint",
|
||||||
|
ItemCount: 1
|
||||||
|
}
|
||||||
|
]);
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
...(await getGuildClient(guild, account)),
|
...(await getGuildClient(guild, accountId)),
|
||||||
InventoryChanges: inventoryChanges
|
InventoryChanges: {
|
||||||
|
Recipes: [
|
||||||
|
{
|
||||||
|
ItemType: "/Lotus/Types/Keys/DojoKeyBlueprint",
|
||||||
|
ItemCount: 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { ICrewMemberClient } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { ICrewMemberClient } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
@ -8,23 +7,15 @@ import { Types } from "mongoose";
|
|||||||
|
|
||||||
export const crewMembersController: RequestHandler = async (req, res) => {
|
export const crewMembersController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(accountId, "CrewMembers NemesisHistory");
|
const inventory = await getInventory(accountId, "CrewMembers");
|
||||||
const data = getJSONfromString<ICrewMembersRequest>(String(req.body));
|
const data = getJSONfromString<ICrewMembersRequest>(String(req.body));
|
||||||
if (data.crewMember.SecondInCommand) {
|
const dbCrewMember = inventory.CrewMembers.id(data.crewMember.ItemId.$oid)!;
|
||||||
clearOnCall(inventory);
|
dbCrewMember.AssignedRole = data.crewMember.AssignedRole;
|
||||||
}
|
dbCrewMember.SkillEfficiency = data.crewMember.SkillEfficiency;
|
||||||
if (data.crewMember.ItemId.$oid == "000000000000000000000000") {
|
dbCrewMember.WeaponConfigIdx = data.crewMember.WeaponConfigIdx;
|
||||||
const convertedNemesis = inventory.NemesisHistory!.find(x => x.fp == data.crewMember.NemesisFingerprint)!;
|
dbCrewMember.WeaponId = new Types.ObjectId(data.crewMember.WeaponId.$oid);
|
||||||
convertedNemesis.SecondInCommand = data.crewMember.SecondInCommand;
|
dbCrewMember.Configs = data.crewMember.Configs;
|
||||||
} else {
|
dbCrewMember.SecondInCommand = data.crewMember.SecondInCommand;
|
||||||
const dbCrewMember = inventory.CrewMembers.id(data.crewMember.ItemId.$oid)!;
|
|
||||||
dbCrewMember.AssignedRole = data.crewMember.AssignedRole;
|
|
||||||
dbCrewMember.SkillEfficiency = data.crewMember.SkillEfficiency;
|
|
||||||
dbCrewMember.WeaponConfigIdx = data.crewMember.WeaponConfigIdx;
|
|
||||||
dbCrewMember.WeaponId = new Types.ObjectId(data.crewMember.WeaponId.$oid);
|
|
||||||
dbCrewMember.Configs = data.crewMember.Configs;
|
|
||||||
dbCrewMember.SecondInCommand = data.crewMember.SecondInCommand;
|
|
||||||
}
|
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json({
|
res.json({
|
||||||
crewMemberId: data.crewMember.ItemId.$oid,
|
crewMemberId: data.crewMember.ItemId.$oid,
|
||||||
@ -35,20 +26,3 @@ export const crewMembersController: RequestHandler = async (req, res) => {
|
|||||||
interface ICrewMembersRequest {
|
interface ICrewMembersRequest {
|
||||||
crewMember: ICrewMemberClient;
|
crewMember: ICrewMemberClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearOnCall = (inventory: TInventoryDatabaseDocument): void => {
|
|
||||||
for (const cm of inventory.CrewMembers) {
|
|
||||||
if (cm.SecondInCommand) {
|
|
||||||
cm.SecondInCommand = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (inventory.NemesisHistory) {
|
|
||||||
for (const cm of inventory.NemesisHistory) {
|
|
||||||
if (cm.SecondInCommand) {
|
|
||||||
cm.SecondInCommand = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
@ -62,7 +62,14 @@ export const crewShipIdentifySalvageController: RequestHandler = async (req, res
|
|||||||
} satisfies IInnateDamageFingerprint)
|
} satisfies IInnateDamageFingerprint)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
addEquipment(inventory, "CrewShipSalvagedWeapons", payload.ItemType, defaultOverwrites, inventoryChanges);
|
addEquipment(
|
||||||
|
inventory,
|
||||||
|
"CrewShipSalvagedWeapons",
|
||||||
|
payload.ItemType,
|
||||||
|
undefined,
|
||||||
|
inventoryChanges,
|
||||||
|
defaultOverwrites
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
inventoryChanges.CrewShipRawSalvage = [
|
inventoryChanges.CrewShipRawSalvage = [
|
||||||
|
@ -1,529 +1,60 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { combineInventoryChanges, getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { IEndlessXpReward, IInventoryClient, TEndlessXpCategory } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { TEndlessXpCategory } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { logger } from "@/src/utils/logger";
|
|
||||||
import { ExportRewards, ICountedStoreItem } from "warframe-public-export-plus";
|
|
||||||
import { getRandomElement } from "@/src/services/rngService";
|
|
||||||
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
|
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
|
||||||
|
|
||||||
export const endlessXpController: RequestHandler = async (req, res) => {
|
export const endlessXpController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
const inventory = await getInventory(accountId);
|
||||||
const payload = getJSONfromString<IEndlessXpRequest>(String(req.body));
|
const payload = getJSONfromString<IEndlessXpRequest>(String(req.body));
|
||||||
if (payload.Mode == "r") {
|
|
||||||
const inventory = await getInventory(accountId, "EndlessXP");
|
|
||||||
inventory.EndlessXP ??= [];
|
|
||||||
let entry = inventory.EndlessXP.find(x => x.Category == payload.Category);
|
|
||||||
if (!entry) {
|
|
||||||
entry = {
|
|
||||||
Category: payload.Category,
|
|
||||||
Earn: 0,
|
|
||||||
Claim: 0,
|
|
||||||
Choices: payload.Choices,
|
|
||||||
PendingRewards: []
|
|
||||||
};
|
|
||||||
inventory.EndlessXP.push(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
const weekStart = 1734307200_000 + Math.trunc((Date.now() - 1734307200_000) / 604800000) * 604800000;
|
inventory.EndlessXP ??= [];
|
||||||
const weekEnd = weekStart + 604800000;
|
const entry = inventory.EndlessXP.find(x => x.Category == payload.Category);
|
||||||
|
if (entry) {
|
||||||
entry.Earn = 0;
|
|
||||||
entry.Claim = 0;
|
|
||||||
entry.BonusAvailable = new Date(weekStart);
|
|
||||||
entry.Expiry = new Date(weekEnd);
|
|
||||||
entry.Choices = payload.Choices;
|
entry.Choices = payload.Choices;
|
||||||
entry.PendingRewards =
|
|
||||||
payload.Category == "EXC_HARD"
|
|
||||||
? generateHardModeRewards(payload.Choices)
|
|
||||||
: generateNormalModeRewards(payload.Choices);
|
|
||||||
|
|
||||||
await inventory.save();
|
|
||||||
res.json({
|
|
||||||
NewProgress: inventory.toJSON<IInventoryClient>().EndlessXP!.find(x => x.Category == payload.Category)!
|
|
||||||
});
|
|
||||||
} else if (payload.Mode == "c") {
|
|
||||||
const inventory = await getInventory(accountId);
|
|
||||||
const entry = inventory.EndlessXP!.find(x => x.Category == payload.Category)!;
|
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
|
||||||
for (const reward of entry.PendingRewards) {
|
|
||||||
if (entry.Claim < reward.RequiredTotalXp && reward.RequiredTotalXp <= entry.Earn) {
|
|
||||||
combineInventoryChanges(
|
|
||||||
inventoryChanges,
|
|
||||||
(
|
|
||||||
await handleStoreItemAcquisition(
|
|
||||||
reward.Rewards[0].StoreItem,
|
|
||||||
inventory,
|
|
||||||
reward.Rewards[0].ItemCount
|
|
||||||
)
|
|
||||||
).InventoryChanges
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
entry.Claim = entry.Earn;
|
|
||||||
await inventory.save();
|
|
||||||
res.json({
|
|
||||||
InventoryChanges: inventoryChanges,
|
|
||||||
ClaimedXp: entry.Claim
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
logger.debug(`data provided to ${req.path}: ${String(req.body)}`);
|
inventory.EndlessXP.push({
|
||||||
throw new Error(`unexpected endlessXp mode: ${payload.Mode}`);
|
Category: payload.Category,
|
||||||
|
Choices: payload.Choices
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
await inventory.save();
|
||||||
|
|
||||||
type IEndlessXpRequest =
|
res.json({
|
||||||
| {
|
NewProgress: {
|
||||||
Mode: "r";
|
Category: payload.Category,
|
||||||
Category: TEndlessXpCategory;
|
Earn: 0,
|
||||||
Choices: string[];
|
Claim: 0,
|
||||||
}
|
BonusAvailable: {
|
||||||
| {
|
$date: {
|
||||||
Mode: "c" | "something else";
|
$numberLong: "9999999999999"
|
||||||
Category: TEndlessXpCategory;
|
|
||||||
};
|
|
||||||
|
|
||||||
const generateRandomRewards = (deckName: string): ICountedStoreItem[] => {
|
|
||||||
const reward = getRandomElement(ExportRewards[deckName][0])!;
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
StoreItem: reward.type,
|
|
||||||
ItemCount: reward.itemCount
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
const normalModeChosenRewards: Record<string, string[]> = {
|
|
||||||
Excalibur: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ExcaliburHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ExcaliburChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Excalibur/RadialJavelinAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ExcaliburSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ExcaliburBlueprint"
|
|
||||||
],
|
|
||||||
Trinity: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/TrinityHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/TrinityChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Trinity/EnergyVampireAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/TrinitySystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/TrinityBlueprint"
|
|
||||||
],
|
|
||||||
Ember: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/EmberHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/EmberChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Ember/WorldOnFireAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/EmberSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/EmberBlueprint"
|
|
||||||
],
|
|
||||||
Loki: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/LOKIHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/LOKIChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Loki/InvisibilityAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/LOKISystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/LOKIBlueprint"
|
|
||||||
],
|
|
||||||
Mag: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MagHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MagChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Mag/CrushAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MagSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MagBlueprint"
|
|
||||||
],
|
|
||||||
Rhino: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RhinoHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RhinoChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Rhino/RhinoChargeAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RhinoSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RhinoBlueprint"
|
|
||||||
],
|
|
||||||
Ash: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/AshHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/AshChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Ninja/GlaiveAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/AshSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/AshBlueprint"
|
|
||||||
],
|
|
||||||
Frost: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/FrostHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/FrostChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Frost/IceShieldAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/FrostSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/FrostBlueprint"
|
|
||||||
],
|
|
||||||
Nyx: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NyxHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NyxChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Jade/SelfBulletAttractorAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NyxSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NyxBlueprint"
|
|
||||||
],
|
|
||||||
Saryn: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/SarynHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/SarynChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Saryn/PoisonAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/SarynSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/SarynBlueprint"
|
|
||||||
],
|
|
||||||
Vauban: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/TrapperHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/TrapperChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Trapper/LevTrapAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/TrapperSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/TrapperBlueprint"
|
|
||||||
],
|
|
||||||
Nova: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NovaHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NovaChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/AntiMatter/MolecularPrimeAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NovaSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NovaBlueprint"
|
|
||||||
],
|
|
||||||
Nekros: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NecroHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NecroChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Necro/CloneTheDeadAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NecroSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NecroBlueprint"
|
|
||||||
],
|
|
||||||
Valkyr: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/BerserkerHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/BerserkerChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Berserker/IntimidateAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/BerserkerSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/BerserkerBlueprint"
|
|
||||||
],
|
|
||||||
Oberon: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PaladinHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PaladinChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Paladin/RegenerationAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PaladinSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PaladinBlueprint"
|
|
||||||
],
|
|
||||||
Hydroid: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/HydroidHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/HydroidChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Pirate/CannonBarrageAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/HydroidSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/HydroidBlueprint"
|
|
||||||
],
|
|
||||||
Mirage: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/HarlequinHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/HarlequinChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Harlequin/LightAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/HarlequinSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/HarlequinBlueprint"
|
|
||||||
],
|
|
||||||
Limbo: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MagicianHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MagicianChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Magician/TearInSpaceAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MagicianSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MagicianBlueprint"
|
|
||||||
],
|
|
||||||
Mesa: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GunslingerHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GunslingerChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Cowgirl/GunFuPvPAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GunslingerSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GunslingerBlueprint"
|
|
||||||
],
|
|
||||||
Chroma: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ChromaHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ChromaChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Dragon/DragonLuckAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ChromaSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ChromaBlueprint"
|
|
||||||
],
|
|
||||||
Atlas: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/BrawlerHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/BrawlerChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Brawler/BrawlerPassiveAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/BrawlerSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/BrawlerBlueprint"
|
|
||||||
],
|
|
||||||
Ivara: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RangerHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RangerChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Ranger/RangerStealAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RangerSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RangerBlueprint"
|
|
||||||
],
|
|
||||||
Inaros: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MummyHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MummyChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Sandman/SandmanSwarmAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MummySystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/MummyBlueprint"
|
|
||||||
],
|
|
||||||
Titania: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/FairyHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/FairyChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Fairy/FairyFlightAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/FairySystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/FairyBlueprint"
|
|
||||||
],
|
|
||||||
Nidus: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NidusHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NidusChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Infestation/InfestPodsAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NidusSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/NidusBlueprint"
|
|
||||||
],
|
|
||||||
Octavia: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/OctaviaHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/OctaviaChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Bard/BardCharmAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/OctaviaSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/OctaviaBlueprint"
|
|
||||||
],
|
|
||||||
Harrow: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PriestHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PriestChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Priest/PriestPactAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PriestSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PriestBlueprint"
|
|
||||||
],
|
|
||||||
Gara: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GlassHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GlassChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Glass/GlassFragmentAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GlassSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GlassBlueprint"
|
|
||||||
],
|
|
||||||
Khora: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/KhoraHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/KhoraChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Khora/KhoraCrackAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/KhoraSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/KhoraBlueprint"
|
|
||||||
],
|
|
||||||
Revenant: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RevenantHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RevenantChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Revenant/RevenantMarkAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RevenantSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/RevenantBlueprint"
|
|
||||||
],
|
|
||||||
Garuda: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GarudaHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GarudaChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Garuda/GarudaUnstoppableAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GarudaSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/GarudaBlueprint"
|
|
||||||
],
|
|
||||||
Baruuk: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PacifistHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PacifistChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/Pacifist/PacifistFistAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PacifistSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/PacifistBlueprint"
|
|
||||||
],
|
|
||||||
Hildryn: [
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/IronframeHelmetBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/IronframeChassisBlueprint",
|
|
||||||
"/Lotus/StoreItems/Powersuits/IronFrame/IronFrameStripAugmentCard",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/IronframeSystemsBlueprint",
|
|
||||||
"/Lotus/StoreItems/Types/Recipes/WarframeRecipes/IronframeBlueprint"
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
const generateNormalModeRewards = (choices: string[]): IEndlessXpReward[] => {
|
|
||||||
const choiceRewards = normalModeChosenRewards[choices[0]];
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 190,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessNormalSilverRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 400,
|
|
||||||
Rewards: [
|
|
||||||
{
|
|
||||||
StoreItem: choiceRewards[0],
|
|
||||||
ItemCount: 1
|
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
},
|
Expiry: {
|
||||||
{
|
$date: {
|
||||||
RequiredTotalXp: 630,
|
$numberLong: "9999999999999"
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessNormalSilverRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 890,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessNormalMODRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 1190,
|
|
||||||
Rewards: [
|
|
||||||
{
|
|
||||||
StoreItem: choiceRewards[1],
|
|
||||||
ItemCount: 1
|
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
},
|
Choices: payload.Choices,
|
||||||
{
|
PendingRewards: [
|
||||||
RequiredTotalXp: 1540,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessNormalGoldRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 1950,
|
|
||||||
Rewards: [
|
|
||||||
{
|
{
|
||||||
StoreItem: choiceRewards[2],
|
RequiredTotalXp: 190,
|
||||||
ItemCount: 1
|
Rewards: [
|
||||||
}
|
{
|
||||||
]
|
StoreItem: "/Lotus/StoreItems/Upgrades/Mods/Aura/PlayerHealthAuraMod",
|
||||||
},
|
ItemCount: 1
|
||||||
{
|
}
|
||||||
RequiredTotalXp: 2430,
|
]
|
||||||
Rewards: [
|
|
||||||
{
|
|
||||||
StoreItem: choiceRewards[3],
|
|
||||||
ItemCount: 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 2990,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessNormalArcaneRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 3640,
|
|
||||||
Rewards: [
|
|
||||||
{
|
|
||||||
StoreItem: choiceRewards[4],
|
|
||||||
ItemCount: 1
|
|
||||||
}
|
}
|
||||||
|
// ...
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const hardModeChosenRewards: Record<string, string> = {
|
interface IEndlessXpRequest {
|
||||||
Braton: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/BratonIncarnonUnlocker",
|
Mode: string; // "r"
|
||||||
Lato: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/LatoIncarnonUnlocker",
|
Category: TEndlessXpCategory;
|
||||||
Skana: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/SkanaIncarnonUnlocker",
|
Choices: string[];
|
||||||
Paris: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/ParisIncarnonUnlocker",
|
}
|
||||||
Kunai: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/KunaiIncarnonUnlocker",
|
|
||||||
Boar: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/BoarIncarnonUnlocker",
|
|
||||||
Gammacor: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/GammacorIncarnonUnlocker",
|
|
||||||
Anku: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/AnkuIncarnonUnlocker",
|
|
||||||
Gorgon: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/GorgonIncarnonUnlocker",
|
|
||||||
Angstrum: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/AngstrumIncarnonUnlocker",
|
|
||||||
Bo: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/BoIncarnonUnlocker",
|
|
||||||
Latron: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/LatronIncarnonUnlocker",
|
|
||||||
Furis: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/FurisIncarnonUnlocker",
|
|
||||||
Furax: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/FuraxIncarnonUnlocker",
|
|
||||||
Strun: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/StrunIncarnonUnlocker",
|
|
||||||
Lex: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/LexIncarnonUnlocker",
|
|
||||||
Magistar: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/MagistarIncarnonUnlocker",
|
|
||||||
Boltor: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/BoltorIncarnonUnlocker",
|
|
||||||
Bronco: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/BroncoIncarnonUnlocker",
|
|
||||||
CeramicDagger: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/CeramicDaggerIncarnonUnlocker",
|
|
||||||
Torid: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/ToridIncarnonUnlocker",
|
|
||||||
DualToxocyst: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/DualToxocystIncarnonUnlocker",
|
|
||||||
DualIchor: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/DualIchorIncarnonUnlocker",
|
|
||||||
Miter: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/MiterIncarnonUnlocker",
|
|
||||||
Atomos: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/AtomosIncarnonUnlocker",
|
|
||||||
AckAndBrunt: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/AckAndBruntIncarnonUnlocker",
|
|
||||||
Soma: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/SomaIncarnonUnlocker",
|
|
||||||
Vasto: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/VastoIncarnonUnlocker",
|
|
||||||
NamiSolo: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/NamiSoloIncarnonUnlocker",
|
|
||||||
Burston: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/BurstonIncarnonUnlocker",
|
|
||||||
Zylok: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/ZylokIncarnonUnlocker",
|
|
||||||
Sibear: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/SibearIncarnonUnlocker",
|
|
||||||
Dread: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/DreadIncarnonUnlocker",
|
|
||||||
Despair: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/DespairIncarnonUnlocker",
|
|
||||||
Hate: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/HateIncarnonUnlocker",
|
|
||||||
Dera: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/DeraIncarnonUnlocker",
|
|
||||||
Cestra: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/CestraIncarnonUnlocker",
|
|
||||||
Okina: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Melee/OkinaIncarnonUnlocker",
|
|
||||||
Sybaris: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Primary/SybarisIncarnonUnlocker",
|
|
||||||
Sicarus: "/Lotus/StoreItems/Types/Items/MiscItems/IncarnonAdapters/Secondary/SicarusIncarnonUnlocker",
|
|
||||||
RivenPrimary: "/Lotus/StoreItems/Upgrades/Mods/Randomized/RawRifleRandomMod",
|
|
||||||
RivenSecondary: "/Lotus/StoreItems/Upgrades/Mods/Randomized/RawPistolRandomMod",
|
|
||||||
RivenMelee: "/Lotus/StoreItems/Upgrades/Mods/Randomized/RawMeleeRandomMod",
|
|
||||||
Kuva: "/Lotus/Types/Game/DuviriEndless/CircuitSteelPathBIGKuvaReward"
|
|
||||||
};
|
|
||||||
|
|
||||||
const generateHardModeRewards = (choices: string[]): IEndlessXpReward[] => {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 285,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessSteelPathSilverRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 600,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessSteelPathArcaneRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 945,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessSteelPathSilverRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 1335,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessSteelPathSilverRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 1785,
|
|
||||||
Rewards: [
|
|
||||||
{
|
|
||||||
StoreItem: hardModeChosenRewards[choices[0]],
|
|
||||||
ItemCount: 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 2310,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessSteelPathGoldRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 2925,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessSteelPathGoldRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 3645,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessSteelPathArcaneRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 4485,
|
|
||||||
Rewards: generateRandomRewards(
|
|
||||||
"/Lotus/Types/Game/MissionDecks/DuviriEndlessCircuitRewards/DuviriEndlessSteelPathSteelEssenceRewards"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
RequiredTotalXp: 5460,
|
|
||||||
Rewards: [
|
|
||||||
{
|
|
||||||
StoreItem: hardModeChosenRewards[choices[1]],
|
|
||||||
ItemCount: 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
@ -21,12 +21,10 @@ export const entratiLabConquestModeController: RequestHandler = async (req, res)
|
|||||||
inventory.EntratiVaultCountResetDate = new Date(weekEnd);
|
inventory.EntratiVaultCountResetDate = new Date(weekEnd);
|
||||||
if (inventory.EntratiLabConquestUnlocked) {
|
if (inventory.EntratiLabConquestUnlocked) {
|
||||||
inventory.EntratiLabConquestUnlocked = 0;
|
inventory.EntratiLabConquestUnlocked = 0;
|
||||||
inventory.EntratiLabConquestCacheScoreMission = 0;
|
|
||||||
inventory.EntratiLabConquestActiveFrameVariants = [];
|
inventory.EntratiLabConquestActiveFrameVariants = [];
|
||||||
}
|
}
|
||||||
if (inventory.EchoesHexConquestUnlocked) {
|
if (inventory.EchoesHexConquestUnlocked) {
|
||||||
inventory.EchoesHexConquestUnlocked = 0;
|
inventory.EchoesHexConquestUnlocked = 0;
|
||||||
inventory.EchoesHexConquestCacheScoreMission = 0;
|
|
||||||
inventory.EchoesHexConquestActiveFrameVariants = [];
|
inventory.EchoesHexConquestActiveFrameVariants = [];
|
||||||
inventory.EchoesHexConquestActiveStickers = [];
|
inventory.EchoesHexConquestActiveStickers = [];
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,7 @@ export const focusController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
res.json({
|
res.end();
|
||||||
FocusUpgrade: { ItemType: focusType }
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FocusOperation.UnlockUpgrade: {
|
case FocusOperation.UnlockUpgrade: {
|
||||||
@ -106,14 +104,13 @@ export const focusController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
case FocusOperation.SentTrainingAmplifier: {
|
case FocusOperation.SentTrainingAmplifier: {
|
||||||
const request = JSON.parse(String(req.body)) as ISentTrainingAmplifierRequest;
|
const request = JSON.parse(String(req.body)) as ISentTrainingAmplifierRequest;
|
||||||
|
const parts: string[] = [
|
||||||
|
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingGrip",
|
||||||
|
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingChassis",
|
||||||
|
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingBarrel"
|
||||||
|
];
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
const inventoryChanges = addEquipment(inventory, "OperatorAmps", request.StartingWeaponType, {
|
const inventoryChanges = addEquipment(inventory, "OperatorAmps", request.StartingWeaponType, parts);
|
||||||
ModularParts: [
|
|
||||||
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingGrip",
|
|
||||||
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingChassis",
|
|
||||||
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingBarrel"
|
|
||||||
]
|
|
||||||
});
|
|
||||||
occupySlot(inventory, InventorySlot.AMPS, false);
|
occupySlot(inventory, InventorySlot.AMPS, false);
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json((inventoryChanges.OperatorAmps as IEquipmentClient[])[0]);
|
res.json((inventoryChanges.OperatorAmps as IEquipmentClient[])[0]);
|
||||||
|
@ -1,84 +0,0 @@
|
|||||||
import { toMongoDate } from "@/src/helpers/inventoryHelpers";
|
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|
||||||
import { addMiscItem, getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { toStoreItem } from "@/src/services/itemDataService";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
import { createGarden, getPersonalRooms } from "@/src/services/personalRoomsService";
|
|
||||||
import { IMongoDate } from "@/src/types/commonTypes";
|
|
||||||
import { IMissionReward } from "@/src/types/missionTypes";
|
|
||||||
import { IPersonalRoomsClient } from "@/src/types/personalRoomsTypes";
|
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
|
||||||
import { IGardeningClient } from "@/src/types/shipTypes";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
import { dict_en, ExportResources } from "warframe-public-export-plus";
|
|
||||||
|
|
||||||
export const gardeningController: RequestHandler = async (req, res) => {
|
|
||||||
const data = getJSONfromString<IGardeningRequest>(String(req.body));
|
|
||||||
if (data.Mode != "HarvestAll") {
|
|
||||||
throw new Error(`unexpected gardening mode: ${data.Mode}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
const [inventory, personalRooms] = await Promise.all([
|
|
||||||
getInventory(accountId, "MiscItems"),
|
|
||||||
getPersonalRooms(accountId, "Apartment")
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Harvest plants
|
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
|
||||||
const rewards: Record<string, IMissionReward[][]> = {};
|
|
||||||
for (const planter of personalRooms.Apartment.Gardening.Planters) {
|
|
||||||
rewards[planter.Name] = [];
|
|
||||||
for (const plant of planter.Plants) {
|
|
||||||
const itemType =
|
|
||||||
"/Lotus/Types/Gameplay/Duviri/Resource/DuviriPlantItem" +
|
|
||||||
plant.PlantType.substring(plant.PlantType.length - 1);
|
|
||||||
const itemCount = Math.random() < 0.775 ? 2 : 4;
|
|
||||||
|
|
||||||
addMiscItem(inventory, itemType, itemCount, inventoryChanges);
|
|
||||||
|
|
||||||
rewards[planter.Name].push([
|
|
||||||
{
|
|
||||||
StoreItem: toStoreItem(itemType),
|
|
||||||
TypeName: itemType,
|
|
||||||
ItemCount: itemCount,
|
|
||||||
DailyCooldown: false,
|
|
||||||
Rarity: itemCount == 2 ? 0.7743589743589744 : 0.22564102564102564,
|
|
||||||
TweetText: `${itemCount}x ${dict_en[ExportResources[itemType].name]} (Resource)`,
|
|
||||||
ProductCategory: "MiscItems"
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Refresh garden
|
|
||||||
personalRooms.Apartment.Gardening = createGarden();
|
|
||||||
|
|
||||||
await Promise.all([inventory.save(), personalRooms.save()]);
|
|
||||||
|
|
||||||
const planter = personalRooms.Apartment.Gardening.Planters[personalRooms.Apartment.Gardening.Planters.length - 1];
|
|
||||||
const plant = planter.Plants[planter.Plants.length - 1];
|
|
||||||
res.json({
|
|
||||||
GardenTagName: planter.Name,
|
|
||||||
PlantType: plant.PlantType,
|
|
||||||
PlotIndex: plant.PlotIndex,
|
|
||||||
EndTime: toMongoDate(plant.EndTime),
|
|
||||||
InventoryChanges: inventoryChanges,
|
|
||||||
Gardening: personalRooms.toJSON<IPersonalRoomsClient>().Apartment.Gardening,
|
|
||||||
Rewards: rewards
|
|
||||||
} satisfies IGardeningResponse);
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IGardeningRequest {
|
|
||||||
Mode: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IGardeningResponse {
|
|
||||||
GardenTagName: string;
|
|
||||||
PlantType: string;
|
|
||||||
PlotIndex: number;
|
|
||||||
EndTime: IMongoDate;
|
|
||||||
InventoryChanges: IInventoryChanges;
|
|
||||||
Gardening: IGardeningClient;
|
|
||||||
Rewards: Record<string, IMissionReward[][]>;
|
|
||||||
}
|
|
@ -18,7 +18,6 @@ export const getAllianceController: RequestHandler = async (req, res) => {
|
|||||||
res.end();
|
res.end();
|
||||||
};
|
};
|
||||||
|
|
||||||
// POST request since U27
|
|
||||||
/*interface IGetAllianceRequest {
|
/*interface IGetAllianceRequest {
|
||||||
memberCount: number;
|
memberCount: number;
|
||||||
clanLeaderName: string;
|
clanLeaderName: string;
|
||||||
|
@ -1,54 +1,15 @@
|
|||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
import { Request, Response } from "express";
|
||||||
import { Friendship } from "@/src/models/friendModel";
|
|
||||||
import { addAccountDataToFriendInfo, addInventoryDataToFriendInfo } from "@/src/services/friendService";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
import { IFriendInfo } from "@/src/types/friendTypes";
|
|
||||||
import { Request, RequestHandler, Response } from "express";
|
|
||||||
|
|
||||||
// POST with {} instead of GET as of 38.5.0
|
// POST with {} instead of GET as of 38.5.0
|
||||||
export const getFriendsController: RequestHandler = async (req: Request, res: Response) => {
|
const getFriendsController = (_request: Request, response: Response): void => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
response.writeHead(200, {
|
||||||
const response: IGetFriendsResponse = {
|
//Connection: "keep-alive",
|
||||||
Current: [],
|
//"Content-Encoding": "gzip",
|
||||||
IncomingFriendRequests: [],
|
"Content-Type": "text/html",
|
||||||
OutgoingFriendRequests: []
|
// charset: "UTF - 8",
|
||||||
};
|
"Content-Length": "3"
|
||||||
const [internalFriendships, externalFriendships] = await Promise.all([
|
});
|
||||||
Friendship.find({ owner: accountId }),
|
response.end(Buffer.from([0x7b, 0x7d, 0x0a]));
|
||||||
Friendship.find({ friend: accountId }, "owner Note")
|
|
||||||
]);
|
|
||||||
for (const externalFriendship of externalFriendships) {
|
|
||||||
if (!internalFriendships.find(x => x.friend.equals(externalFriendship.owner))) {
|
|
||||||
response.IncomingFriendRequests.push({
|
|
||||||
_id: toOid(externalFriendship.owner),
|
|
||||||
Note: externalFriendship.Note
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const internalFriendship of internalFriendships) {
|
|
||||||
const friendInfo: IFriendInfo = {
|
|
||||||
_id: toOid(internalFriendship.friend)
|
|
||||||
};
|
|
||||||
if (externalFriendships.find(x => x.owner.equals(internalFriendship.friend))) {
|
|
||||||
response.Current.push(friendInfo);
|
|
||||||
} else {
|
|
||||||
response.OutgoingFriendRequests.push(friendInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const promises: Promise<void>[] = [];
|
|
||||||
for (const arr of Object.values(response)) {
|
|
||||||
for (const friendInfo of arr) {
|
|
||||||
promises.push(addAccountDataToFriendInfo(friendInfo));
|
|
||||||
promises.push(addInventoryDataToFriendInfo(friendInfo));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await Promise.all(promises);
|
|
||||||
res.json(response);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// interface IGetFriendsResponse {
|
export { getFriendsController };
|
||||||
// Current: IFriendInfo[];
|
|
||||||
// IncomingFriendRequests: IFriendInfo[];
|
|
||||||
// OutgoingFriendRequests: IFriendInfo[];
|
|
||||||
// }
|
|
||||||
type IGetFriendsResponse = Record<"Current" | "IncomingFriendRequests" | "OutgoingFriendRequests", IFriendInfo[]>;
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { Guild } from "@/src/models/guildModel";
|
import { Guild } from "@/src/models/guildModel";
|
||||||
import { getAccountForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { createUniqueClanName, getGuildClient } from "@/src/services/guildService";
|
import { createUniqueClanName, getGuildClient } from "@/src/services/guildService";
|
||||||
|
|
||||||
export const getGuildController: RequestHandler = async (req, res) => {
|
export const getGuildController: RequestHandler = async (req, res) => {
|
||||||
const account = await getAccountForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(account._id.toString(), "GuildId");
|
const inventory = await getInventory(accountId, "GuildId");
|
||||||
if (inventory.GuildId) {
|
if (inventory.GuildId) {
|
||||||
const guild = await Guild.findById(inventory.GuildId);
|
const guild = await Guild.findById(inventory.GuildId);
|
||||||
if (guild) {
|
if (guild) {
|
||||||
@ -24,7 +24,7 @@ export const getGuildController: RequestHandler = async (req, res) => {
|
|||||||
guild.CeremonyResetDate = undefined;
|
guild.CeremonyResetDate = undefined;
|
||||||
await guild.save();
|
await guild.save();
|
||||||
}
|
}
|
||||||
res.json(await getGuildClient(guild, account));
|
res.json(await getGuildClient(guild, accountId));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ import { RequestHandler } from "express";
|
|||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { Guild } from "@/src/models/guildModel";
|
import { Guild } from "@/src/models/guildModel";
|
||||||
import { getDojoClient } from "@/src/services/guildService";
|
import { getDojoClient } from "@/src/services/guildService";
|
||||||
import { Account } from "@/src/models/loginModel";
|
|
||||||
|
|
||||||
export const getGuildDojoController: RequestHandler = async (req, res) => {
|
export const getGuildDojoController: RequestHandler = async (req, res) => {
|
||||||
const guildId = req.query.guildId as string;
|
const guildId = req.query.guildId as string;
|
||||||
@ -26,8 +25,7 @@ export const getGuildDojoController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const payload: IGetGuildDojoRequest = req.body ? (JSON.parse(String(req.body)) as IGetGuildDojoRequest) : {};
|
const payload: IGetGuildDojoRequest = req.body ? (JSON.parse(String(req.body)) as IGetGuildDojoRequest) : {};
|
||||||
const account = await Account.findById(req.query.accountId as string);
|
res.json(await getDojoClient(guild, 0, payload.ComponentId));
|
||||||
res.json(await getDojoClient(guild, 0, payload.ComponentId, account?.BuildLabel));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IGetGuildDojoRequest {
|
interface IGetGuildDojoRequest {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { Account, Ignore } from "@/src/models/loginModel";
|
import { Account, Ignore } from "@/src/models/loginModel";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { IFriendInfo } from "@/src/types/friendTypes";
|
import { IFriendInfo } from "@/src/types/guildTypes";
|
||||||
import { parallelForeach } from "@/src/utils/async-utils";
|
import { parallelForeach } from "@/src/utils/async-utils";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
|
@ -2,24 +2,19 @@ import { RequestHandler } from "express";
|
|||||||
import { config } from "@/src/services/configService";
|
import { config } from "@/src/services/configService";
|
||||||
import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
|
import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { createGarden, getPersonalRooms } from "@/src/services/personalRoomsService";
|
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
||||||
|
import { getShip } from "@/src/services/shipService";
|
||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { IGetShipResponse } from "@/src/types/shipTypes";
|
import { IGetShipResponse } from "@/src/types/shipTypes";
|
||||||
import { IPersonalRoomsClient } from "@/src/types/personalRoomsTypes";
|
import { IPersonalRooms } from "@/src/types/personalRoomsTypes";
|
||||||
import { getLoadout } from "@/src/services/loadoutService";
|
import { getLoadout } from "@/src/services/loadoutService";
|
||||||
|
|
||||||
export const getShipController: RequestHandler = async (req, res) => {
|
export const getShipController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const personalRoomsDb = await getPersonalRooms(accountId);
|
const personalRoomsDb = await getPersonalRooms(accountId);
|
||||||
|
const personalRooms = personalRoomsDb.toJSON<IPersonalRooms>();
|
||||||
// Setup gardening if it's missing. Maybe should be done as part of some quest completion in the future.
|
|
||||||
if (personalRoomsDb.Apartment.Gardening.Planters.length == 0) {
|
|
||||||
personalRoomsDb.Apartment.Gardening = createGarden();
|
|
||||||
await personalRoomsDb.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
const personalRooms = personalRoomsDb.toJSON<IPersonalRoomsClient>();
|
|
||||||
const loadout = await getLoadout(accountId);
|
const loadout = await getLoadout(accountId);
|
||||||
|
const ship = await getShip(personalRoomsDb.activeShipId, "ShipAttachments SkinFlavourItem");
|
||||||
|
|
||||||
const getShipResponse: IGetShipResponse = {
|
const getShipResponse: IGetShipResponse = {
|
||||||
ShipOwnerId: accountId,
|
ShipOwnerId: accountId,
|
||||||
@ -29,8 +24,8 @@ export const getShipController: RequestHandler = async (req, res) => {
|
|||||||
ShipId: toOid(personalRoomsDb.activeShipId),
|
ShipId: toOid(personalRoomsDb.activeShipId),
|
||||||
ShipInterior: {
|
ShipInterior: {
|
||||||
Colors: personalRooms.ShipInteriorColors,
|
Colors: personalRooms.ShipInteriorColors,
|
||||||
ShipAttachments: { HOOD_ORNAMENT: "" },
|
ShipAttachments: ship.ShipAttachments,
|
||||||
SkinFlavourItem: ""
|
SkinFlavourItem: ship.SkinFlavourItem
|
||||||
},
|
},
|
||||||
FavouriteLoadoutId: personalRooms.Ship.FavouriteLoadoutId
|
FavouriteLoadoutId: personalRooms.Ship.FavouriteLoadoutId
|
||||||
? toOid(personalRooms.Ship.FavouriteLoadoutId)
|
? toOid(personalRooms.Ship.FavouriteLoadoutId)
|
||||||
|
@ -1,20 +1,14 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { applyStandingToVendorManifest, getVendorManifestByTypeName } from "@/src/services/serversideVendorsService";
|
import { getVendorManifestByTypeName } from "@/src/services/serversideVendorsService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
|
|
||||||
export const getVendorInfoController: RequestHandler = async (req, res) => {
|
export const getVendorInfoController: RequestHandler = (req, res) => {
|
||||||
let manifest = getVendorManifestByTypeName(req.query.vendor as string);
|
if (typeof req.query.vendor == "string") {
|
||||||
if (!manifest) {
|
const manifest = getVendorManifestByTypeName(req.query.vendor);
|
||||||
throw new Error(`Unknown vendor: ${req.query.vendor as string}`);
|
if (!manifest) {
|
||||||
|
throw new Error(`Unknown vendor: ${req.query.vendor}`);
|
||||||
|
}
|
||||||
|
res.json(manifest);
|
||||||
|
} else {
|
||||||
|
res.status(400).end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// For testing purposes, authenticating with this endpoint is optional here, but would be required on live.
|
|
||||||
if (req.query.accountId) {
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
const inventory = await getInventory(accountId);
|
|
||||||
manifest = applyStandingToVendorManifest(inventory, manifest);
|
|
||||||
}
|
|
||||||
|
|
||||||
res.json(manifest);
|
|
||||||
};
|
};
|
||||||
|
@ -1,19 +1,12 @@
|
|||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { Account } from "@/src/models/loginModel";
|
import { Account } from "@/src/models/loginModel";
|
||||||
import { areFriends } from "@/src/services/friendService";
|
|
||||||
import { createMessage } from "@/src/services/inboxService";
|
import { createMessage } from "@/src/services/inboxService";
|
||||||
import {
|
import { getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||||
combineInventoryChanges,
|
|
||||||
getEffectiveAvatarImageType,
|
|
||||||
getInventory,
|
|
||||||
updateCurrency
|
|
||||||
} from "@/src/services/inventoryService";
|
|
||||||
import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService";
|
import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService";
|
||||||
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
|
|
||||||
import { IOid } from "@/src/types/commonTypes";
|
import { IOid } from "@/src/types/commonTypes";
|
||||||
import { IInventoryChanges, IPurchaseParams } from "@/src/types/purchaseTypes";
|
import { IPurchaseParams } from "@/src/types/purchaseTypes";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { ExportBundles, ExportFlavour } from "warframe-public-export-plus";
|
import { ExportFlavour } from "warframe-public-export-plus";
|
||||||
|
|
||||||
export const giftingController: RequestHandler = async (req, res) => {
|
export const giftingController: RequestHandler = async (req, res) => {
|
||||||
const data = getJSONfromString<IGiftingRequest>(String(req.body));
|
const data = getJSONfromString<IGiftingRequest>(String(req.body));
|
||||||
@ -37,11 +30,8 @@ export const giftingController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cannot gift to players who have gifting disabled.
|
// Cannot gift to players who have gifting disabled.
|
||||||
const senderAccount = await getAccountForRequest(req);
|
// TODO: Also consider GIFT_MODE_FRIENDS once friends are implemented
|
||||||
if (
|
if (inventory.Settings?.GiftMode == "GIFT_MODE_NONE") {
|
||||||
inventory.Settings?.GiftMode == "GIFT_MODE_NONE" ||
|
|
||||||
(inventory.Settings?.GiftMode == "GIFT_MODE_FRIENDS" && !(await areFriends(account._id, senderAccount._id)))
|
|
||||||
) {
|
|
||||||
res.status(400).send("17").end();
|
res.status(400).send("17").end();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -50,7 +40,11 @@ export const giftingController: RequestHandler = async (req, res) => {
|
|||||||
// TODO: Cannot gift archwing items to players that have not completed the archwing quest. (Code 7)
|
// TODO: Cannot gift archwing items to players that have not completed the archwing quest. (Code 7)
|
||||||
// TODO: Cannot gift necramechs to players that have not completed heart of deimos. (Code 20)
|
// TODO: Cannot gift necramechs to players that have not completed heart of deimos. (Code 20)
|
||||||
|
|
||||||
const senderInventory = await getInventory(senderAccount._id.toString());
|
const senderAccount = await getAccountForRequest(req);
|
||||||
|
const senderInventory = await getInventory(
|
||||||
|
senderAccount._id.toString(),
|
||||||
|
"PremiumCredits PremiumCreditsFree ActiveAvatarImageType GiftsRemaining"
|
||||||
|
);
|
||||||
|
|
||||||
if (senderInventory.GiftsRemaining == 0) {
|
if (senderInventory.GiftsRemaining == 0) {
|
||||||
res.status(400).send("10").end();
|
res.status(400).send("10").end();
|
||||||
@ -58,20 +52,7 @@ export const giftingController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
senderInventory.GiftsRemaining -= 1;
|
senderInventory.GiftsRemaining -= 1;
|
||||||
|
|
||||||
const inventoryChanges: IInventoryChanges = updateCurrency(
|
updateCurrency(senderInventory, data.PurchaseParams.ExpectedPrice, true);
|
||||||
senderInventory,
|
|
||||||
data.PurchaseParams.ExpectedPrice,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
if (data.PurchaseParams.StoreItem in ExportBundles) {
|
|
||||||
const bundle = ExportBundles[data.PurchaseParams.StoreItem];
|
|
||||||
if (bundle.giftingBonus) {
|
|
||||||
combineInventoryChanges(
|
|
||||||
inventoryChanges,
|
|
||||||
(await handleStoreItemAcquisition(bundle.giftingBonus, senderInventory)).InventoryChanges
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await senderInventory.save();
|
await senderInventory.save();
|
||||||
|
|
||||||
const senderName = getSuffixedName(senderAccount);
|
const senderName = getSuffixedName(senderAccount);
|
||||||
@ -90,7 +71,7 @@ export const giftingController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
sub: "/Lotus/Language/Menu/GiftReceivedSubject",
|
sub: "/Lotus/Language/Menu/GiftReceivedSubject",
|
||||||
icon: ExportFlavour[getEffectiveAvatarImageType(senderInventory)].icon,
|
icon: ExportFlavour[senderInventory.ActiveAvatarImageType].icon,
|
||||||
gifts: [
|
gifts: [
|
||||||
{
|
{
|
||||||
GiftType: data.PurchaseParams.StoreItem
|
GiftType: data.PurchaseParams.StoreItem
|
||||||
@ -99,9 +80,7 @@ export const giftingController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
res.json({
|
res.end();
|
||||||
InventoryChanges: inventoryChanges
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IGiftingRequest {
|
interface IGiftingRequest {
|
||||||
|
@ -104,7 +104,7 @@ export const guildTechController: RequestHandler = async (req, res) => {
|
|||||||
) {
|
) {
|
||||||
throw new Error(`unexpected TechProductCategory: ${data.TechProductCategory}`);
|
throw new Error(`unexpected TechProductCategory: ${data.TechProductCategory}`);
|
||||||
}
|
}
|
||||||
if (!inventory[getSalvageCategory(data.TechProductCategory)].id(data.CategoryItemId!)) {
|
if (!inventory[getSalvageCategory(data.TechProductCategory)].id(data.CategoryItemId)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`no item with id ${data.CategoryItemId} in ${getSalvageCategory(data.TechProductCategory)} array`
|
`no item with id ${data.CategoryItemId} in ${getSalvageCategory(data.TechProductCategory)} array`
|
||||||
);
|
);
|
||||||
@ -441,9 +441,16 @@ const finishComponentRepair = (
|
|||||||
const inventoryChanges = {
|
const inventoryChanges = {
|
||||||
...(category == "CrewShipWeaponSkins"
|
...(category == "CrewShipWeaponSkins"
|
||||||
? addCrewShipWeaponSkin(inventory, salvageItem.ItemType, salvageItem.UpgradeFingerprint)
|
? addCrewShipWeaponSkin(inventory, salvageItem.ItemType, salvageItem.UpgradeFingerprint)
|
||||||
: addEquipment(inventory, category, salvageItem.ItemType, {
|
: addEquipment(
|
||||||
UpgradeFingerprint: salvageItem.UpgradeFingerprint
|
inventory,
|
||||||
})),
|
category,
|
||||||
|
salvageItem.ItemType,
|
||||||
|
undefined,
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
UpgradeFingerprint: salvageItem.UpgradeFingerprint
|
||||||
|
}
|
||||||
|
)),
|
||||||
...occupySlot(inventory, InventorySlot.RJ_COMPONENT_AND_ARMAMENTS, false)
|
...occupySlot(inventory, InventorySlot.RJ_COMPONENT_AND_ARMAMENTS, false)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,24 +1,17 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { getAccountForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { createNewSession } from "@/src/managers/sessionManager";
|
import { createNewSession } from "@/src/managers/sessionManager";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { ISession } from "@/src/types/session";
|
import { ISession } from "@/src/types/session";
|
||||||
import { JSONParse } from "json-with-bigint";
|
|
||||||
import { toOid2, version_compare } from "@/src/helpers/inventoryHelpers";
|
|
||||||
|
|
||||||
const hostSessionController: RequestHandler = async (req, res) => {
|
const hostSessionController: RequestHandler = async (req, res) => {
|
||||||
const account = await getAccountForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const hostSessionRequest = JSONParse(String(req.body)) as ISession;
|
const hostSessionRequest = JSON.parse(req.body as string) as ISession;
|
||||||
logger.debug("HostSession Request", { hostSessionRequest });
|
logger.debug("HostSession Request", { hostSessionRequest });
|
||||||
const session = createNewSession(hostSessionRequest, account._id);
|
const session = createNewSession(hostSessionRequest, accountId);
|
||||||
logger.debug(`New Session Created`, { session });
|
logger.debug(`New Session Created`, { session });
|
||||||
|
|
||||||
if (account.BuildLabel && version_compare(account.BuildLabel, "2015.03.21.08.17") < 0) {
|
res.json({ sessionId: { $oid: session.sessionId }, rewardSeed: 99999999 });
|
||||||
// U15 or below
|
|
||||||
res.send(session.sessionId.toString());
|
|
||||||
} else {
|
|
||||||
res.json({ sessionId: toOid2(session.sessionId, account.BuildLabel), rewardSeed: 99999999 });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export { hostSessionController };
|
export { hostSessionController };
|
||||||
|
@ -9,17 +9,10 @@ import {
|
|||||||
getMessage
|
getMessage
|
||||||
} from "@/src/services/inboxService";
|
} from "@/src/services/inboxService";
|
||||||
import { getAccountForRequest, getAccountFromSuffixedName, getSuffixedName } from "@/src/services/loginService";
|
import { getAccountForRequest, getAccountFromSuffixedName, getSuffixedName } from "@/src/services/loginService";
|
||||||
import {
|
import { addItems, combineInventoryChanges, getInventory } from "@/src/services/inventoryService";
|
||||||
addItems,
|
|
||||||
combineInventoryChanges,
|
|
||||||
getEffectiveAvatarImageType,
|
|
||||||
getInventory
|
|
||||||
} from "@/src/services/inventoryService";
|
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { ExportFlavour } from "warframe-public-export-plus";
|
import { ExportFlavour, ExportGear } from "warframe-public-export-plus";
|
||||||
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
|
import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
|
||||||
import { fromStoreItem, isStoreItem } from "@/src/services/itemDataService";
|
|
||||||
import { IOid } from "@/src/types/commonTypes";
|
|
||||||
|
|
||||||
export const inboxController: RequestHandler = async (req, res) => {
|
export const inboxController: RequestHandler = async (req, res) => {
|
||||||
const { deleteId, lastMessage: latestClientMessageId, messageId } = req.query;
|
const { deleteId, lastMessage: latestClientMessageId, messageId } = req.query;
|
||||||
@ -34,10 +27,10 @@ export const inboxController: RequestHandler = async (req, res) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await deleteMessageRead(parseOid(deleteId as string));
|
await deleteMessageRead(deleteId as string);
|
||||||
res.status(200).end();
|
res.status(200).end();
|
||||||
} else if (messageId) {
|
} else if (messageId) {
|
||||||
const message = await getMessage(parseOid(messageId as string));
|
const message = await getMessage(messageId as string);
|
||||||
message.r = true;
|
message.r = true;
|
||||||
await message.save();
|
await message.save();
|
||||||
|
|
||||||
@ -55,8 +48,8 @@ export const inboxController: RequestHandler = async (req, res) => {
|
|||||||
await addItems(
|
await addItems(
|
||||||
inventory,
|
inventory,
|
||||||
attachmentItems.map(attItem => ({
|
attachmentItems.map(attItem => ({
|
||||||
ItemType: isStoreItem(attItem) ? fromStoreItem(attItem) : attItem,
|
ItemType: attItem,
|
||||||
ItemCount: 1
|
ItemCount: attItem in ExportGear ? (ExportGear[attItem].purchaseQuantity ?? 1) : 1
|
||||||
})),
|
})),
|
||||||
inventoryChanges
|
inventoryChanges
|
||||||
);
|
);
|
||||||
@ -93,7 +86,7 @@ export const inboxController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
sub: "/Lotus/Language/Menu/GiftReceivedConfirmationSubject",
|
sub: "/Lotus/Language/Menu/GiftReceivedConfirmationSubject",
|
||||||
icon: ExportFlavour[getEffectiveAvatarImageType(inventory)].icon,
|
icon: ExportFlavour[inventory.ActiveAvatarImageType].icon,
|
||||||
highPriority: true
|
highPriority: true
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
@ -106,7 +99,7 @@ export const inboxController: RequestHandler = async (req, res) => {
|
|||||||
await createNewEventMessages(req);
|
await createNewEventMessages(req);
|
||||||
const messages = await Inbox.find({ ownerId: accountId }).sort({ date: 1 });
|
const messages = await Inbox.find({ ownerId: accountId }).sort({ date: 1 });
|
||||||
|
|
||||||
const latestClientMessage = messages.find(m => m._id.toString() === parseOid(latestClientMessageId as string));
|
const latestClientMessage = messages.find(m => m._id.toString() === latestClientMessageId);
|
||||||
|
|
||||||
if (!latestClientMessage) {
|
if (!latestClientMessage) {
|
||||||
logger.debug(`this should only happen after DeleteAllRead `);
|
logger.debug(`this should only happen after DeleteAllRead `);
|
||||||
@ -129,11 +122,3 @@ export const inboxController: RequestHandler = async (req, res) => {
|
|||||||
res.json({ Inbox: inbox });
|
res.json({ Inbox: inbox });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 33.6.0 has query arguments like lastMessage={"$oid":"68112baebf192e786d1502bb"} instead of lastMessage=68112baebf192e786d1502bb
|
|
||||||
const parseOid = (oid: string): string => {
|
|
||||||
if (oid[0] == "{") {
|
|
||||||
return (JSON.parse(oid) as IOid).$oid;
|
|
||||||
}
|
|
||||||
return oid;
|
|
||||||
};
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { getAccountForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { Inventory, TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
import { Inventory, TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
import { config } from "@/src/services/configService";
|
import { config } from "@/src/services/configService";
|
||||||
import allDialogue from "@/static/fixed_responses/allDialogue.json";
|
import allDialogue from "@/static/fixed_responses/allDialogue.json";
|
||||||
@ -18,22 +18,15 @@ import {
|
|||||||
addMiscItems,
|
addMiscItems,
|
||||||
allDailyAffiliationKeys,
|
allDailyAffiliationKeys,
|
||||||
cleanupInventory,
|
cleanupInventory,
|
||||||
createLibraryDailyTask,
|
createLibraryDailyTask
|
||||||
generateRewardSeed
|
|
||||||
} from "@/src/services/inventoryService";
|
} from "@/src/services/inventoryService";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { catBreadHash } from "@/src/helpers/stringHelpers";
|
import { catBreadHash } from "@/src/helpers/stringHelpers";
|
||||||
import { Types } from "mongoose";
|
|
||||||
import { getNemesisManifest } from "@/src/helpers/nemesisHelpers";
|
|
||||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
|
||||||
import { IPersonalRoomsClient } from "@/src/types/personalRoomsTypes";
|
|
||||||
import { Ship } from "@/src/models/shipModel";
|
|
||||||
import { toLegacyOid, version_compare } from "@/src/helpers/inventoryHelpers";
|
|
||||||
|
|
||||||
export const inventoryController: RequestHandler = async (request, response) => {
|
export const inventoryController: RequestHandler = async (request, response) => {
|
||||||
const account = await getAccountForRequest(request);
|
const accountId = await getAccountIdForRequest(request);
|
||||||
|
|
||||||
const inventory = await Inventory.findOne({ accountOwnerId: account._id });
|
const inventory = await Inventory.findOne({ accountOwnerId: accountId });
|
||||||
|
|
||||||
if (!inventory) {
|
if (!inventory) {
|
||||||
response.status(400).json({ error: "inventory was undefined" });
|
response.status(400).json({ error: "inventory was undefined" });
|
||||||
@ -94,7 +87,7 @@ export const inventoryController: RequestHandler = async (request, response) =>
|
|||||||
cleanupInventory(inventory);
|
cleanupInventory(inventory);
|
||||||
|
|
||||||
inventory.NextRefill = new Date((Math.trunc(Date.now() / 86400000) + 1) * 86400000);
|
inventory.NextRefill = new Date((Math.trunc(Date.now() / 86400000) + 1) * 86400000);
|
||||||
//await inventory.save();
|
await inventory.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -103,43 +96,23 @@ export const inventoryController: RequestHandler = async (request, response) =>
|
|||||||
new Date() >= inventory.InfestedFoundry.AbilityOverrideUnlockCooldown
|
new Date() >= inventory.InfestedFoundry.AbilityOverrideUnlockCooldown
|
||||||
) {
|
) {
|
||||||
handleSubsumeCompletion(inventory);
|
handleSubsumeCompletion(inventory);
|
||||||
//await inventory.save();
|
await inventory.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventory.LastInventorySync) {
|
response.json(await getInventoryResponse(inventory, "xpBasedLevelCapDisabled" in request.query));
|
||||||
const lastSyncDuviriMood = Math.trunc(inventory.LastInventorySync.getTimestamp().getTime() / 7200000);
|
|
||||||
const currentDuviriMood = Math.trunc(Date.now() / 7200000);
|
|
||||||
if (lastSyncDuviriMood != currentDuviriMood) {
|
|
||||||
logger.debug(`refreshing duviri seed`);
|
|
||||||
if (!inventory.DuviriInfo) {
|
|
||||||
inventory.DuviriInfo = {
|
|
||||||
Seed: generateRewardSeed(),
|
|
||||||
NumCompletions: 0
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
inventory.DuviriInfo.Seed = generateRewardSeed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inventory.LastInventorySync = new Types.ObjectId();
|
|
||||||
await inventory.save();
|
|
||||||
|
|
||||||
response.json(
|
|
||||||
await getInventoryResponse(inventory, "xpBasedLevelCapDisabled" in request.query, account.BuildLabel)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getInventoryResponse = async (
|
export const getInventoryResponse = async (
|
||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
xpBasedLevelCapDisabled: boolean,
|
xpBasedLevelCapDisabled: boolean
|
||||||
buildLabel: string | undefined
|
|
||||||
): Promise<IInventoryClient> => {
|
): Promise<IInventoryClient> => {
|
||||||
const [inventoryWithLoadOutPresets, ships] = await Promise.all([
|
const inventoryWithLoadOutPresets = await inventory.populate<{ LoadOutPresets: ILoadoutDatabase }>(
|
||||||
inventory.populate<{ LoadOutPresets: ILoadoutDatabase }>("LoadOutPresets"),
|
"LoadOutPresets"
|
||||||
Ship.find({ ShipOwnerId: inventory.accountOwnerId })
|
);
|
||||||
]);
|
const inventoryWithLoadOutPresetsAndShips = await inventoryWithLoadOutPresets.populate<{ Ships: IShipInventory }>(
|
||||||
const inventoryResponse = inventoryWithLoadOutPresets.toJSON<IInventoryClient>();
|
"Ships"
|
||||||
inventoryResponse.Ships = ships.map(x => x.toJSON<IShipInventory>());
|
);
|
||||||
|
const inventoryResponse = inventoryWithLoadOutPresetsAndShips.toJSON<IInventoryClient>();
|
||||||
|
|
||||||
if (config.infiniteCredits) {
|
if (config.infiniteCredits) {
|
||||||
inventoryResponse.RegularCredits = 999999999;
|
inventoryResponse.RegularCredits = 999999999;
|
||||||
@ -301,49 +274,16 @@ export const getInventoryResponse = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Omitting this field so opening the navigation resyncs the inventory which is more desirable for typical usage.
|
// Omitting this field so opening the navigation resyncs the inventory which is more desirable for typical usage.
|
||||||
inventoryResponse.LastInventorySync = undefined;
|
//inventoryResponse.LastInventorySync = toOid(new Types.ObjectId());
|
||||||
|
|
||||||
// Set 2FA enabled so trading post can be used
|
// Set 2FA enabled so trading post can be used
|
||||||
inventoryResponse.HWIDProtectEnabled = true;
|
inventoryResponse.HWIDProtectEnabled = true;
|
||||||
|
|
||||||
if (buildLabel) {
|
|
||||||
// Fix nemesis for older versions
|
|
||||||
if (
|
|
||||||
inventoryResponse.Nemesis &&
|
|
||||||
version_compare(getNemesisManifest(inventoryResponse.Nemesis.manifest).minBuild, buildLabel) < 0
|
|
||||||
) {
|
|
||||||
inventoryResponse.Nemesis = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version_compare(buildLabel, "2018.02.22.14.34") < 0) {
|
|
||||||
const personalRoomsDb = await getPersonalRooms(inventory.accountOwnerId.toString());
|
|
||||||
const personalRooms = personalRoomsDb.toJSON<IPersonalRoomsClient>();
|
|
||||||
inventoryResponse.Ship = personalRooms.Ship;
|
|
||||||
|
|
||||||
if (version_compare(buildLabel, "2016.12.21.19.13") <= 0) {
|
|
||||||
// U19.5 and below use $id instead of $oid
|
|
||||||
for (const category of equipmentKeys) {
|
|
||||||
for (const item of inventoryResponse[category]) {
|
|
||||||
toLegacyOid(item.ItemId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const upgrade of inventoryResponse.Upgrades) {
|
|
||||||
toLegacyOid(upgrade.ItemId);
|
|
||||||
}
|
|
||||||
if (inventoryResponse.BrandedSuits) {
|
|
||||||
for (const id of inventoryResponse.BrandedSuits) {
|
|
||||||
toLegacyOid(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return inventoryResponse;
|
return inventoryResponse;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addString = (arr: string[], str: string): void => {
|
const addString = (arr: string[], str: string): void => {
|
||||||
if (arr.indexOf(str) == -1) {
|
if (!arr.find(x => x == str)) {
|
||||||
arr.push(str);
|
arr.push(str);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,6 @@ import { Account } from "@/src/models/loginModel";
|
|||||||
import { createAccount, isCorrectPassword, isNameTaken } from "@/src/services/loginService";
|
import { createAccount, isCorrectPassword, isNameTaken } from "@/src/services/loginService";
|
||||||
import { IDatabaseAccountJson, ILoginRequest, ILoginResponse } from "@/src/types/loginTypes";
|
import { IDatabaseAccountJson, ILoginRequest, ILoginResponse } from "@/src/types/loginTypes";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { version_compare } from "@/src/helpers/inventoryHelpers";
|
|
||||||
|
|
||||||
export const loginController: RequestHandler = async (request, response) => {
|
export const loginController: RequestHandler = async (request, response) => {
|
||||||
const loginRequest = JSON.parse(String(request.body)) as ILoginRequest; // parse octet stream of json data to json object
|
const loginRequest = JSON.parse(String(request.body)) as ILoginRequest; // parse octet stream of json data to json object
|
||||||
@ -22,11 +21,7 @@ export const loginController: RequestHandler = async (request, response) => {
|
|||||||
|
|
||||||
const myAddress = request.host.indexOf("warframe.com") == -1 ? request.host : config.myAddress;
|
const myAddress = request.host.indexOf("warframe.com") == -1 ? request.host : config.myAddress;
|
||||||
|
|
||||||
if (
|
if (!account && config.autoCreateAccount && loginRequest.ClientType != "webui") {
|
||||||
!account &&
|
|
||||||
((config.autoCreateAccount && loginRequest.ClientType != "webui") ||
|
|
||||||
loginRequest.ClientType == "webui-register")
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
const nameFromEmail = loginRequest.email.substring(0, loginRequest.email.indexOf("@"));
|
const nameFromEmail = loginRequest.email.substring(0, loginRequest.email.indexOf("@"));
|
||||||
let name = nameFromEmail || loginRequest.email.substring(1) || "SpaceNinja";
|
let name = nameFromEmail || loginRequest.email.substring(1) || "SpaceNinja";
|
||||||
@ -41,15 +36,13 @@ export const loginController: RequestHandler = async (request, response) => {
|
|||||||
email: loginRequest.email,
|
email: loginRequest.email,
|
||||||
password: loginRequest.password,
|
password: loginRequest.password,
|
||||||
DisplayName: name,
|
DisplayName: name,
|
||||||
CountryCode: loginRequest.lang?.toUpperCase() ?? "EN",
|
CountryCode: loginRequest.lang.toUpperCase(),
|
||||||
ClientType: loginRequest.ClientType == "webui-register" ? "webui" : loginRequest.ClientType,
|
ClientType: loginRequest.ClientType,
|
||||||
CrossPlatformAllowed: true,
|
CrossPlatformAllowed: true,
|
||||||
ForceLogoutVersion: 0,
|
ForceLogoutVersion: 0,
|
||||||
ConsentNeeded: false,
|
ConsentNeeded: false,
|
||||||
TrackedSettings: [],
|
TrackedSettings: [],
|
||||||
Nonce: nonce,
|
Nonce: nonce
|
||||||
BuildLabel: buildLabel,
|
|
||||||
LastLogin: new Date()
|
|
||||||
});
|
});
|
||||||
logger.debug("created new account");
|
logger.debug("created new account");
|
||||||
response.json(createLoginResponse(myAddress, newAccount, buildLabel));
|
response.json(createLoginResponse(myAddress, newAccount, buildLabel));
|
||||||
@ -66,11 +59,6 @@ export const loginController: RequestHandler = async (request, response) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loginRequest.ClientType == "webui-register") {
|
|
||||||
response.status(400).json({ error: "account already exists" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isCorrectPassword(loginRequest.password, account.password)) {
|
if (!isCorrectPassword(loginRequest.password, account.password)) {
|
||||||
response.status(400).json({ error: "incorrect login data" });
|
response.status(400).json({ error: "incorrect login data" });
|
||||||
return;
|
return;
|
||||||
@ -83,18 +71,13 @@ export const loginController: RequestHandler = async (request, response) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (account.Nonce && account.ClientType != "webui" && !account.Dropped && !loginRequest.kick) {
|
if (account.Nonce && account.ClientType != "webui" && !account.Dropped && !loginRequest.kick) {
|
||||||
// U17 seems to handle "nonce still set" like a login failure.
|
response.status(400).json({ error: "nonce still set" });
|
||||||
if (version_compare(buildLabel, "2015.12.05.18.07") >= 0) {
|
return;
|
||||||
response.status(400).send({ error: "nonce still set" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
account.ClientType = loginRequest.ClientType;
|
account.ClientType = loginRequest.ClientType;
|
||||||
account.Nonce = nonce;
|
account.Nonce = nonce;
|
||||||
account.CountryCode = loginRequest.lang?.toUpperCase() ?? "EN";
|
account.CountryCode = loginRequest.lang.toUpperCase();
|
||||||
account.BuildLabel = buildLabel;
|
|
||||||
account.LastLogin = new Date();
|
|
||||||
}
|
}
|
||||||
await account.save();
|
await account.save();
|
||||||
|
|
||||||
@ -102,48 +85,25 @@ export const loginController: RequestHandler = async (request, response) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createLoginResponse = (myAddress: string, account: IDatabaseAccountJson, buildLabel: string): ILoginResponse => {
|
const createLoginResponse = (myAddress: string, account: IDatabaseAccountJson, buildLabel: string): ILoginResponse => {
|
||||||
const resp: ILoginResponse = {
|
return {
|
||||||
id: account.id,
|
id: account.id,
|
||||||
DisplayName: account.DisplayName,
|
DisplayName: account.DisplayName,
|
||||||
CountryCode: account.CountryCode,
|
CountryCode: account.CountryCode,
|
||||||
|
ClientType: account.ClientType,
|
||||||
|
CrossPlatformAllowed: account.CrossPlatformAllowed,
|
||||||
|
ForceLogoutVersion: account.ForceLogoutVersion,
|
||||||
AmazonAuthToken: account.AmazonAuthToken,
|
AmazonAuthToken: account.AmazonAuthToken,
|
||||||
AmazonRefreshToken: account.AmazonRefreshToken,
|
AmazonRefreshToken: account.AmazonRefreshToken,
|
||||||
|
ConsentNeeded: account.ConsentNeeded,
|
||||||
|
TrackedSettings: account.TrackedSettings,
|
||||||
Nonce: account.Nonce,
|
Nonce: account.Nonce,
|
||||||
BuildLabel: buildLabel
|
Groups: [],
|
||||||
|
IRC: config.myIrcAddresses ?? [myAddress],
|
||||||
|
platformCDNs: [`https://${myAddress}/`],
|
||||||
|
HUB: `https://${myAddress}/api/`,
|
||||||
|
NRS: config.NRS,
|
||||||
|
DTLS: 99,
|
||||||
|
BuildLabel: buildLabel,
|
||||||
|
MatchmakingBuildId: buildConfig.matchmakingBuildId
|
||||||
};
|
};
|
||||||
if (version_compare(buildLabel, "2015.02.13.10.41") >= 0) {
|
|
||||||
resp.NRS = config.NRS;
|
|
||||||
}
|
|
||||||
if (version_compare(buildLabel, "2015.05.14.16.29") >= 0) {
|
|
||||||
// U17 and up
|
|
||||||
resp.IRC = config.myIrcAddresses ?? [myAddress];
|
|
||||||
}
|
|
||||||
if (version_compare(buildLabel, "2018.11.08.14.45") >= 0) {
|
|
||||||
// U24 and up
|
|
||||||
resp.ConsentNeeded = account.ConsentNeeded;
|
|
||||||
resp.TrackedSettings = account.TrackedSettings;
|
|
||||||
}
|
|
||||||
if (version_compare(buildLabel, "2019.08.29.20.01") >= 0) {
|
|
||||||
// U25.7 and up
|
|
||||||
resp.ForceLogoutVersion = account.ForceLogoutVersion;
|
|
||||||
}
|
|
||||||
if (version_compare(buildLabel, "2019.10.31.22.42") >= 0) {
|
|
||||||
// U26 and up
|
|
||||||
resp.Groups = [];
|
|
||||||
}
|
|
||||||
if (version_compare(buildLabel, "2021.04.13.19.58") >= 0) {
|
|
||||||
resp.DTLS = 99;
|
|
||||||
}
|
|
||||||
if (version_compare(buildLabel, "2022.04.29.12.53") >= 0) {
|
|
||||||
resp.ClientType = account.ClientType;
|
|
||||||
}
|
|
||||||
if (version_compare(buildLabel, "2022.09.06.19.24") >= 0) {
|
|
||||||
resp.CrossPlatformAllowed = account.CrossPlatformAllowed;
|
|
||||||
resp.HUB = `https://${myAddress}/api/`;
|
|
||||||
resp.MatchmakingBuildId = buildConfig.matchmakingBuildId;
|
|
||||||
}
|
|
||||||
if (version_compare(buildLabel, "2023.04.25.23.40") >= 0) {
|
|
||||||
resp.platformCDNs = [`https://${myAddress}/`];
|
|
||||||
}
|
|
||||||
return resp;
|
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,7 @@ export const loginRewardsSelectionController: RequestHandler = async (req, res)
|
|||||||
StoreItemType: body.ChosenReward
|
StoreItemType: body.ChosenReward
|
||||||
};
|
};
|
||||||
inventoryChanges = (await handleStoreItemAcquisition(body.ChosenReward, inventory)).InventoryChanges;
|
inventoryChanges = (await handleStoreItemAcquisition(body.ChosenReward, inventory)).InventoryChanges;
|
||||||
if (evergreenRewards.indexOf(body.ChosenReward) == -1) {
|
if (!evergreenRewards.find(x => x == body.ChosenReward)) {
|
||||||
inventory.LoginMilestoneRewards.push(body.ChosenReward);
|
inventory.LoginMilestoneRewards.push(body.ChosenReward);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { getAccountForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { IMissionInventoryUpdateRequest } from "@/src/types/requestTypes";
|
import { IMissionInventoryUpdateRequest } from "@/src/types/requestTypes";
|
||||||
import { addMissionInventoryUpdates, addMissionRewards } from "@/src/services/missionInventoryUpdateService";
|
import { addMissionInventoryUpdates, addMissionRewards } from "@/src/services/missionInventoryUpdateService";
|
||||||
import { generateRewardSeed, getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { getInventoryResponse } from "./inventoryController";
|
import { getInventoryResponse } from "./inventoryController";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { IMissionInventoryUpdateResponse } from "@/src/types/missionTypes";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**** INPUT ****
|
**** INPUT ****
|
||||||
@ -49,11 +48,11 @@ import { IMissionInventoryUpdateResponse } from "@/src/types/missionTypes";
|
|||||||
*/
|
*/
|
||||||
//move credit calc in here, return MissionRewards: [] if no reward info
|
//move credit calc in here, return MissionRewards: [] if no reward info
|
||||||
export const missionInventoryUpdateController: RequestHandler = async (req, res): Promise<void> => {
|
export const missionInventoryUpdateController: RequestHandler = async (req, res): Promise<void> => {
|
||||||
const account = await getAccountForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const missionReport = getJSONfromString<IMissionInventoryUpdateRequest>((req.body as string).toString());
|
const missionReport = getJSONfromString<IMissionInventoryUpdateRequest>((req.body as string).toString());
|
||||||
logger.debug("mission report:", missionReport);
|
logger.debug("mission report:", missionReport);
|
||||||
|
|
||||||
const inventory = await getInventory(account._id.toString());
|
const inventory = await getInventory(accountId);
|
||||||
const firstCompletion = missionReport.SortieId
|
const firstCompletion = missionReport.SortieId
|
||||||
? inventory.CompletedSorties.indexOf(missionReport.SortieId) == -1
|
? inventory.CompletedSorties.indexOf(missionReport.SortieId) == -1
|
||||||
: false;
|
: false;
|
||||||
@ -61,17 +60,10 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
missionReport.MissionStatus !== "GS_SUCCESS" &&
|
missionReport.MissionStatus !== "GS_SUCCESS" &&
|
||||||
!(
|
!(missionReport.RewardInfo?.jobId || missionReport.RewardInfo?.challengeMissionId)
|
||||||
missionReport.RewardInfo?.jobId ||
|
|
||||||
missionReport.RewardInfo?.challengeMissionId ||
|
|
||||||
missionReport.RewardInfo?.T
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
if (missionReport.EndOfMatchUpload) {
|
|
||||||
inventory.RewardSeed = generateRewardSeed();
|
|
||||||
}
|
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
const inventoryResponse = await getInventoryResponse(inventory, true, account.BuildLabel);
|
const inventoryResponse = await getInventoryResponse(inventory, true);
|
||||||
res.json({
|
res.json({
|
||||||
InventoryJson: JSON.stringify(inventoryResponse),
|
InventoryJson: JSON.stringify(inventoryResponse),
|
||||||
MissionRewards: []
|
MissionRewards: []
|
||||||
@ -79,20 +71,11 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const { MissionRewards, inventoryChanges, credits, AffiliationMods, SyndicateXPItemReward } =
|
||||||
MissionRewards,
|
await addMissionRewards(inventory, missionReport, firstCompletion);
|
||||||
inventoryChanges,
|
|
||||||
credits,
|
|
||||||
AffiliationMods,
|
|
||||||
SyndicateXPItemReward,
|
|
||||||
ConquestCompletedMissionsCount
|
|
||||||
} = await addMissionRewards(inventory, missionReport, firstCompletion);
|
|
||||||
|
|
||||||
if (missionReport.EndOfMatchUpload) {
|
|
||||||
inventory.RewardSeed = generateRewardSeed();
|
|
||||||
}
|
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
const inventoryResponse = await getInventoryResponse(inventory, true, account.BuildLabel);
|
const inventoryResponse = await getInventoryResponse(inventory, true);
|
||||||
|
|
||||||
//TODO: figure out when to send inventory. it is needed for many cases.
|
//TODO: figure out when to send inventory. it is needed for many cases.
|
||||||
res.json({
|
res.json({
|
||||||
@ -103,9 +86,8 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
|
|||||||
...inventoryUpdates,
|
...inventoryUpdates,
|
||||||
//FusionPoints: inventoryChanges?.FusionPoints, // This in combination with InventoryJson or InventoryChanges seems to just double the number of endo shown, so unsure when this is needed.
|
//FusionPoints: inventoryChanges?.FusionPoints, // This in combination with InventoryJson or InventoryChanges seems to just double the number of endo shown, so unsure when this is needed.
|
||||||
SyndicateXPItemReward,
|
SyndicateXPItemReward,
|
||||||
AffiliationMods,
|
AffiliationMods
|
||||||
ConquestCompletedMissionsCount
|
});
|
||||||
} satisfies IMissionInventoryUpdateResponse);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -17,7 +17,7 @@ import { getDefaultUpgrades } from "@/src/services/itemDataService";
|
|||||||
import { modularWeaponTypes } from "@/src/helpers/modularWeaponHelper";
|
import { modularWeaponTypes } from "@/src/helpers/modularWeaponHelper";
|
||||||
import { IEquipmentDatabase } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
import { IEquipmentDatabase } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { getRandomInt } from "@/src/services/rngService";
|
import { getRandomInt } from "@/src/services/rngService";
|
||||||
import { ExportSentinels, ExportWeapons, IDefaultUpgrade } from "warframe-public-export-plus";
|
import { ExportSentinels, IDefaultUpgrade } from "warframe-public-export-plus";
|
||||||
import { Status } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { Status } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
|
|
||||||
interface IModularCraftRequest {
|
interface IModularCraftRequest {
|
||||||
@ -36,9 +36,7 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res)
|
|||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
|
|
||||||
let defaultUpgrades: IDefaultUpgrade[] | undefined;
|
let defaultUpgrades: IDefaultUpgrade[] | undefined;
|
||||||
const defaultOverwrites: Partial<IEquipmentDatabase> = {
|
const defaultOverwrites: Partial<IEquipmentDatabase> = {};
|
||||||
ModularParts: data.Parts
|
|
||||||
};
|
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
const inventoryChanges: IInventoryChanges = {};
|
||||||
if (category == "KubrowPets") {
|
if (category == "KubrowPets") {
|
||||||
const traits = {
|
const traits = {
|
||||||
@ -140,20 +138,8 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res)
|
|||||||
} else {
|
} else {
|
||||||
defaultUpgrades = getDefaultUpgrades(data.Parts);
|
defaultUpgrades = getDefaultUpgrades(data.Parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (category == "MoaPets") {
|
|
||||||
const weapon = ExportSentinels[data.WeaponType].defaultWeapon;
|
|
||||||
if (weapon) {
|
|
||||||
const category = ExportWeapons[weapon].productCategory;
|
|
||||||
addEquipment(inventory, category, weapon, undefined, inventoryChanges);
|
|
||||||
combineInventoryChanges(
|
|
||||||
inventoryChanges,
|
|
||||||
occupySlot(inventory, productCategoryToInventoryBin(category)!, !!data.isWebUi)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
defaultOverwrites.Configs = applyDefaultUpgrades(inventory, defaultUpgrades);
|
defaultOverwrites.Configs = applyDefaultUpgrades(inventory, defaultUpgrades);
|
||||||
addEquipment(inventory, category, data.WeaponType, defaultOverwrites, inventoryChanges);
|
addEquipment(inventory, category, data.WeaponType, data.Parts, inventoryChanges, defaultOverwrites);
|
||||||
combineInventoryChanges(
|
combineInventoryChanges(
|
||||||
inventoryChanges,
|
inventoryChanges,
|
||||||
occupySlot(inventory, productCategoryToInventoryBin(category)!, !!data.isWebUi)
|
occupySlot(inventory, productCategoryToInventoryBin(category)!, !!data.isWebUi)
|
||||||
|
@ -2,7 +2,7 @@ import { RequestHandler } from "express";
|
|||||||
import { ExportWeapons } from "warframe-public-export-plus";
|
import { ExportWeapons } from "warframe-public-export-plus";
|
||||||
import { IMongoDate } from "@/src/types/commonTypes";
|
import { IMongoDate } from "@/src/types/commonTypes";
|
||||||
import { toMongoDate } from "@/src/helpers/inventoryHelpers";
|
import { toMongoDate } from "@/src/helpers/inventoryHelpers";
|
||||||
import { SRng } from "@/src/services/rngService";
|
import { CRng } from "@/src/services/rngService";
|
||||||
import { ArtifactPolarity, EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
import { ArtifactPolarity, EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import {
|
import {
|
||||||
@ -21,11 +21,7 @@ import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
|||||||
export const modularWeaponSaleController: RequestHandler = async (req, res) => {
|
export const modularWeaponSaleController: RequestHandler = async (req, res) => {
|
||||||
const partTypeToParts: Record<string, string[]> = {};
|
const partTypeToParts: Record<string, string[]> = {};
|
||||||
for (const [uniqueName, data] of Object.entries(ExportWeapons)) {
|
for (const [uniqueName, data] of Object.entries(ExportWeapons)) {
|
||||||
if (
|
if (data.partType && data.premiumPrice) {
|
||||||
data.partType &&
|
|
||||||
data.premiumPrice &&
|
|
||||||
!data.excludeFromCodex // exclude pvp variants
|
|
||||||
) {
|
|
||||||
partTypeToParts[data.partType] ??= [];
|
partTypeToParts[data.partType] ??= [];
|
||||||
partTypeToParts[data.partType].push(uniqueName);
|
partTypeToParts[data.partType].push(uniqueName);
|
||||||
}
|
}
|
||||||
@ -45,18 +41,24 @@ export const modularWeaponSaleController: RequestHandler = async (req, res) => {
|
|||||||
const defaultUpgrades = getDefaultUpgrades(weaponInfo.ModularParts);
|
const defaultUpgrades = getDefaultUpgrades(weaponInfo.ModularParts);
|
||||||
const configs = applyDefaultUpgrades(inventory, defaultUpgrades);
|
const configs = applyDefaultUpgrades(inventory, defaultUpgrades);
|
||||||
const inventoryChanges: IInventoryChanges = {
|
const inventoryChanges: IInventoryChanges = {
|
||||||
...addEquipment(inventory, category, weaponInfo.ItemType, {
|
...addEquipment(
|
||||||
Features: EquipmentFeatures.DOUBLE_CAPACITY | EquipmentFeatures.GILDED,
|
inventory,
|
||||||
ItemName: payload.ItemName,
|
category,
|
||||||
Configs: configs,
|
weaponInfo.ItemType,
|
||||||
ModularParts: weaponInfo.ModularParts,
|
weaponInfo.ModularParts,
|
||||||
Polarity: [
|
{},
|
||||||
{
|
{
|
||||||
Slot: payload.PolarizeSlot,
|
Features: EquipmentFeatures.DOUBLE_CAPACITY | EquipmentFeatures.GILDED,
|
||||||
Value: payload.PolarizeValue
|
ItemName: payload.ItemName,
|
||||||
}
|
Configs: configs,
|
||||||
]
|
Polarity: [
|
||||||
}),
|
{
|
||||||
|
Slot: payload.PolarizeSlot,
|
||||||
|
Value: payload.PolarizeValue
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
),
|
||||||
...occupySlot(inventory, productCategoryToInventoryBin(category)!, true),
|
...occupySlot(inventory, productCategoryToInventoryBin(category)!, true),
|
||||||
...updateCurrency(inventory, weaponInfo.PremiumPrice, true)
|
...updateCurrency(inventory, weaponInfo.PremiumPrice, true)
|
||||||
};
|
};
|
||||||
@ -140,8 +142,8 @@ const getModularWeaponSale = (
|
|||||||
partTypes: string[],
|
partTypes: string[],
|
||||||
getItemType: (parts: string[]) => string
|
getItemType: (parts: string[]) => string
|
||||||
): IModularWeaponSaleInfo => {
|
): IModularWeaponSaleInfo => {
|
||||||
const rng = new SRng(day);
|
const rng = new CRng(day);
|
||||||
const parts = partTypes.map(partType => rng.randomElement(partTypeToParts[partType])!);
|
const parts = partTypes.map(partType => rng.randomElement(partTypeToParts[partType]));
|
||||||
let partsCost = 0;
|
let partsCost = 0;
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
partsCost += ExportWeapons[part].premiumPrice!;
|
partsCost += ExportWeapons[part].premiumPrice!;
|
||||||
|
@ -1,40 +1,33 @@
|
|||||||
import { version_compare } from "@/src/helpers/inventoryHelpers";
|
|
||||||
import {
|
import {
|
||||||
consumeModCharge,
|
consumeModCharge,
|
||||||
encodeNemesisGuess,
|
encodeNemesisGuess,
|
||||||
getInfNodes,
|
getInfNodes,
|
||||||
getKnifeUpgrade,
|
|
||||||
getNemesisManifest,
|
|
||||||
getNemesisPasscode,
|
getNemesisPasscode,
|
||||||
getNemesisPasscodeModTypes,
|
|
||||||
IKnifeResponse
|
IKnifeResponse
|
||||||
} from "@/src/helpers/nemesisHelpers";
|
} from "@/src/helpers/nemesisHelpers";
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
|
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
|
||||||
import { freeUpSlot, getInventory } from "@/src/services/inventoryService";
|
import { freeUpSlot, getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { SRng } from "@/src/services/rngService";
|
import { SRng } from "@/src/services/rngService";
|
||||||
import { IMongoDate, IOid } from "@/src/types/commonTypes";
|
import { IMongoDate, IOid } from "@/src/types/commonTypes";
|
||||||
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import {
|
import {
|
||||||
IInnateDamageFingerprint,
|
IInnateDamageFingerprint,
|
||||||
IInventoryClient,
|
|
||||||
INemesisClient,
|
|
||||||
InventorySlot,
|
InventorySlot,
|
||||||
IUpgradeClient,
|
IUpgradeClient,
|
||||||
IWeaponSkinClient,
|
IWeaponSkinClient,
|
||||||
LoadoutIndex,
|
LoadoutIndex,
|
||||||
TEquipmentKey,
|
TEquipmentKey
|
||||||
TNemesisFaction
|
|
||||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
export const nemesisController: RequestHandler = async (req, res) => {
|
export const nemesisController: RequestHandler = async (req, res) => {
|
||||||
const account = await getAccountForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
if ((req.query.mode as string) == "f") {
|
if ((req.query.mode as string) == "f") {
|
||||||
const body = getJSONfromString<IValenceFusionRequest>(String(req.body));
|
const body = getJSONfromString<IValenceFusionRequest>(String(req.body));
|
||||||
const inventory = await getInventory(account._id.toString(), body.Category + " WeaponBin");
|
const inventory = await getInventory(accountId, body.Category + " WeaponBin");
|
||||||
const destWeapon = inventory[body.Category].id(body.DestWeapon.$oid)!;
|
const destWeapon = inventory[body.Category].id(body.DestWeapon.$oid)!;
|
||||||
const sourceWeapon = inventory[body.Category].id(body.SourceWeapon.$oid)!;
|
const sourceWeapon = inventory[body.Category].id(body.SourceWeapon.$oid)!;
|
||||||
const destFingerprint = JSON.parse(destWeapon.UpgradeFingerprint!) as IInnateDamageFingerprint;
|
const destFingerprint = JSON.parse(destWeapon.UpgradeFingerprint!) as IInnateDamageFingerprint;
|
||||||
@ -69,7 +62,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if ((req.query.mode as string) == "p") {
|
} else if ((req.query.mode as string) == "p") {
|
||||||
const inventory = await getInventory(account._id.toString(), "Nemesis");
|
const inventory = await getInventory(accountId, "Nemesis");
|
||||||
const body = getJSONfromString<INemesisPrespawnCheckRequest>(String(req.body));
|
const body = getJSONfromString<INemesisPrespawnCheckRequest>(String(req.body));
|
||||||
const passcode = getNemesisPasscode(inventory.Nemesis!);
|
const passcode = getNemesisPasscode(inventory.Nemesis!);
|
||||||
let guessResult = 0;
|
let guessResult = 0;
|
||||||
@ -90,7 +83,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
|||||||
res.json({ GuessResult: guessResult });
|
res.json({ GuessResult: guessResult });
|
||||||
} else if (req.query.mode == "r") {
|
} else if (req.query.mode == "r") {
|
||||||
const inventory = await getInventory(
|
const inventory = await getInventory(
|
||||||
account._id.toString(),
|
accountId,
|
||||||
"Nemesis LoadOutPresets CurrentLoadOutIds DataKnives Upgrades RawUpgrades"
|
"Nemesis LoadOutPresets CurrentLoadOutIds DataKnives Upgrades RawUpgrades"
|
||||||
);
|
);
|
||||||
const body = getJSONfromString<INemesisRequiemRequest>(String(req.body));
|
const body = getJSONfromString<INemesisRequiemRequest>(String(req.body));
|
||||||
@ -106,45 +99,50 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
|||||||
encodeNemesisGuess(guess[0], result1, guess[1], result2, guess[2], result3)
|
encodeNemesisGuess(guess[0], result1, guess[1], result2, guess[2], result3)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Increase antivirus if correct antivirus mod is installed
|
// Increase antivirus
|
||||||
|
let antivirusGain = 5;
|
||||||
|
const loadout = (await Loadout.findById(inventory.LoadOutPresets, "DATAKNIFE"))!;
|
||||||
|
const dataknifeLoadout = loadout.DATAKNIFE.id(inventory.CurrentLoadOutIds[LoadoutIndex.DATAKNIFE].$oid);
|
||||||
|
const dataknifeConfigIndex = dataknifeLoadout?.s?.mod ?? 0;
|
||||||
|
const dataknifeUpgrades = inventory.DataKnives[0].Configs[dataknifeConfigIndex].Upgrades!;
|
||||||
const response: IKnifeResponse = {};
|
const response: IKnifeResponse = {};
|
||||||
if (result1 == 0 || result2 == 0 || result3 == 0) {
|
for (const upgrade of body.knife!.AttachedUpgrades) {
|
||||||
let antivirusGain = 5;
|
switch (upgrade.ItemType) {
|
||||||
const loadout = (await Loadout.findById(inventory.LoadOutPresets, "DATAKNIFE"))!;
|
case "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusAndSpeedOnUseMod":
|
||||||
const dataknifeLoadout = loadout.DATAKNIFE.id(inventory.CurrentLoadOutIds[LoadoutIndex.DATAKNIFE].$oid);
|
antivirusGain += 10;
|
||||||
const dataknifeConfigIndex = dataknifeLoadout?.s?.mod ?? 0;
|
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
||||||
const dataknifeUpgrades = inventory.DataKnives[0].Configs[dataknifeConfigIndex].Upgrades!;
|
break;
|
||||||
for (const upgrade of body.knife!.AttachedUpgrades) {
|
case "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusAndWeaponDamageOnUseMod":
|
||||||
switch (upgrade.ItemType) {
|
antivirusGain += 10;
|
||||||
case "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusAndSpeedOnUseMod":
|
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
||||||
antivirusGain += 10;
|
break;
|
||||||
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
case "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusLargeOnSingleUseMod": // Instant Secure
|
||||||
break;
|
antivirusGain += 15;
|
||||||
case "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusAndWeaponDamageOnUseMod":
|
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
||||||
antivirusGain += 10;
|
break;
|
||||||
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
case "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusOnUseMod": // Immuno Shield
|
||||||
break;
|
antivirusGain += 15;
|
||||||
case "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusLargeOnSingleUseMod": // Instant Secure
|
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
||||||
antivirusGain += 15;
|
break;
|
||||||
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
case "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusSmallOnSingleUseMod":
|
||||||
break;
|
antivirusGain += 10;
|
||||||
case "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusOnUseMod": // Immuno Shield
|
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
||||||
antivirusGain += 15;
|
break;
|
||||||
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
|
||||||
break;
|
|
||||||
case "/Lotus/Upgrades/Mods/DataSpike/Potency/GainAntivirusSmallOnSingleUseMod":
|
|
||||||
antivirusGain += 10;
|
|
||||||
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
inventory.Nemesis!.HenchmenKilled += antivirusGain;
|
|
||||||
}
|
}
|
||||||
|
inventory.Nemesis!.HenchmenKilled += antivirusGain;
|
||||||
if (inventory.Nemesis!.HenchmenKilled >= 100) {
|
if (inventory.Nemesis!.HenchmenKilled >= 100) {
|
||||||
inventory.Nemesis!.HenchmenKilled = 100;
|
inventory.Nemesis!.HenchmenKilled = 100;
|
||||||
|
inventory.Nemesis!.InfNodes = [
|
||||||
|
{
|
||||||
|
Node: "CrewBattleNode559",
|
||||||
|
Influence: 1
|
||||||
|
}
|
||||||
|
];
|
||||||
|
inventory.Nemesis!.Weakened = true;
|
||||||
|
} else {
|
||||||
|
inventory.Nemesis!.InfNodes = getInfNodes("FC_INFESTATION", 0);
|
||||||
}
|
}
|
||||||
inventory.Nemesis!.InfNodes = getInfNodes(getNemesisManifest(inventory.Nemesis!.manifest), 0);
|
|
||||||
|
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json(response);
|
res.json(response);
|
||||||
@ -154,40 +152,41 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
|||||||
res.end();
|
res.end();
|
||||||
} else {
|
} else {
|
||||||
inventory.Nemesis!.Rank += 1;
|
inventory.Nemesis!.Rank += 1;
|
||||||
inventory.Nemesis!.InfNodes = getInfNodes(
|
inventory.Nemesis!.InfNodes = getInfNodes(inventory.Nemesis!.Faction, inventory.Nemesis!.Rank);
|
||||||
getNemesisManifest(inventory.Nemesis!.manifest),
|
|
||||||
inventory.Nemesis!.Rank
|
|
||||||
);
|
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json({ RankIncrease: 1 });
|
res.json({ RankIncrease: 1 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ((req.query.mode as string) == "rs") {
|
} else if ((req.query.mode as string) == "rs") {
|
||||||
// report spawn; POST but no application data in body
|
// report spawn; POST but no application data in body
|
||||||
const inventory = await getInventory(account._id.toString(), "Nemesis");
|
const inventory = await getInventory(accountId, "Nemesis");
|
||||||
inventory.Nemesis!.LastEnc = inventory.Nemesis!.MissionCount;
|
inventory.Nemesis!.LastEnc = inventory.Nemesis!.MissionCount;
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json({ LastEnc: inventory.Nemesis!.LastEnc });
|
res.json({ LastEnc: inventory.Nemesis!.LastEnc });
|
||||||
} else if ((req.query.mode as string) == "s") {
|
} else if ((req.query.mode as string) == "s") {
|
||||||
const inventory = await getInventory(account._id.toString(), "Nemesis");
|
const inventory = await getInventory(accountId, "Nemesis");
|
||||||
const body = getJSONfromString<INemesisStartRequest>(String(req.body));
|
const body = getJSONfromString<INemesisStartRequest>(String(req.body));
|
||||||
body.target.fp = BigInt(body.target.fp);
|
body.target.fp = BigInt(body.target.fp);
|
||||||
|
|
||||||
const manifest = getNemesisManifest(body.target.manifest);
|
|
||||||
if (account.BuildLabel && version_compare(manifest.minBuild, account.BuildLabel) < 0) {
|
|
||||||
logger.warn(
|
|
||||||
`client on version ${account.BuildLabel} provided nemesis manifest ${body.target.manifest} which was expected to require ${manifest.minBuild} or above. please file a bug report.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let weaponIdx = -1;
|
let weaponIdx = -1;
|
||||||
if (body.target.Faction != "FC_INFESTATION") {
|
if (body.target.Faction != "FC_INFESTATION") {
|
||||||
const weapons: readonly string[] = manifest.weapons;
|
let weapons: readonly string[];
|
||||||
|
if (body.target.manifest == "/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifestVersionSix") {
|
||||||
|
weapons = kuvaLichVersionSixWeapons;
|
||||||
|
} else if (
|
||||||
|
body.target.manifest == "/Lotus/Types/Enemies/Corpus/Lawyers/LawyerManifestVersionFour" ||
|
||||||
|
body.target.manifest == "/Lotus/Types/Enemies/Corpus/Lawyers/LawyerManifestVersionThree"
|
||||||
|
) {
|
||||||
|
weapons = corpusVersionThreeWeapons;
|
||||||
|
} else {
|
||||||
|
throw new Error(`unknown nemesis manifest: ${body.target.manifest}`);
|
||||||
|
}
|
||||||
|
|
||||||
const initialWeaponIdx = new SRng(body.target.fp).randomInt(0, weapons.length - 1);
|
const initialWeaponIdx = new SRng(body.target.fp).randomInt(0, weapons.length - 1);
|
||||||
weaponIdx = initialWeaponIdx;
|
weaponIdx = initialWeaponIdx;
|
||||||
do {
|
do {
|
||||||
const weapon = weapons[weaponIdx];
|
const weapon = weapons[weaponIdx];
|
||||||
if (body.target.DisallowedWeapons.indexOf(weapon) == -1) {
|
if (!body.target.DisallowedWeapons.find(x => x == weapon)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
weaponIdx = (weaponIdx + 1) % weapons.length;
|
weaponIdx = (weaponIdx + 1) % weapons.length;
|
||||||
@ -208,7 +207,7 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
|||||||
k: false,
|
k: false,
|
||||||
Traded: false,
|
Traded: false,
|
||||||
d: new Date(),
|
d: new Date(),
|
||||||
InfNodes: getInfNodes(manifest, 0),
|
InfNodes: getInfNodes(body.target.Faction, 0),
|
||||||
GuessHistory: [],
|
GuessHistory: [],
|
||||||
Hints: [],
|
Hints: [],
|
||||||
HintProgress: 0,
|
HintProgress: 0,
|
||||||
@ -224,38 +223,6 @@ export const nemesisController: RequestHandler = async (req, res) => {
|
|||||||
res.json({
|
res.json({
|
||||||
target: inventory.toJSON().Nemesis
|
target: inventory.toJSON().Nemesis
|
||||||
});
|
});
|
||||||
} else if ((req.query.mode as string) == "w") {
|
|
||||||
const inventory = await getInventory(
|
|
||||||
account._id.toString(),
|
|
||||||
"Nemesis LoadOutPresets CurrentLoadOutIds DataKnives Upgrades RawUpgrades"
|
|
||||||
);
|
|
||||||
//const body = getJSONfromString<INemesisWeakenRequest>(String(req.body));
|
|
||||||
|
|
||||||
inventory.Nemesis!.InfNodes = [
|
|
||||||
{
|
|
||||||
Node: getNemesisManifest(inventory.Nemesis!.manifest).showdownNode,
|
|
||||||
Influence: 1
|
|
||||||
}
|
|
||||||
];
|
|
||||||
inventory.Nemesis!.Weakened = true;
|
|
||||||
|
|
||||||
const response: IKnifeResponse & { target: INemesisClient } = {
|
|
||||||
target: inventory.toJSON<IInventoryClient>().Nemesis!
|
|
||||||
};
|
|
||||||
|
|
||||||
// Consume charge of the correct requiem mod(s)
|
|
||||||
const loadout = (await Loadout.findById(inventory.LoadOutPresets, "DATAKNIFE"))!;
|
|
||||||
const dataknifeLoadout = loadout.DATAKNIFE.id(inventory.CurrentLoadOutIds[LoadoutIndex.DATAKNIFE].$oid);
|
|
||||||
const dataknifeConfigIndex = dataknifeLoadout?.s?.mod ?? 0;
|
|
||||||
const dataknifeUpgrades = inventory.DataKnives[0].Configs[dataknifeConfigIndex].Upgrades!;
|
|
||||||
const modTypes = getNemesisPasscodeModTypes(inventory.Nemesis!);
|
|
||||||
for (const modType of modTypes) {
|
|
||||||
const upgrade = getKnifeUpgrade(inventory, dataknifeUpgrades, modType);
|
|
||||||
consumeModCharge(response, inventory, upgrade, dataknifeUpgrades);
|
|
||||||
}
|
|
||||||
|
|
||||||
await inventory.save();
|
|
||||||
res.json(response);
|
|
||||||
} else {
|
} else {
|
||||||
logger.debug(`data provided to ${req.path}: ${String(req.body)}`);
|
logger.debug(`data provided to ${req.path}: ${String(req.body)}`);
|
||||||
throw new Error(`unknown nemesis mode: ${String(req.query.mode)}`);
|
throw new Error(`unknown nemesis mode: ${String(req.query.mode)}`);
|
||||||
@ -280,7 +247,7 @@ interface INemesisStartRequest {
|
|||||||
WeaponIdx: number;
|
WeaponIdx: number;
|
||||||
AgentIdx: number;
|
AgentIdx: number;
|
||||||
BirthNode: string;
|
BirthNode: string;
|
||||||
Faction: TNemesisFaction;
|
Faction: string;
|
||||||
Rank: number;
|
Rank: number;
|
||||||
k: boolean;
|
k: boolean;
|
||||||
Traded: boolean;
|
Traded: boolean;
|
||||||
@ -307,19 +274,48 @@ interface INemesisRequiemRequest {
|
|||||||
guess: number; // grn/crp: 4 bits | coda: 3x 4 bits
|
guess: number; // grn/crp: 4 bits | coda: 3x 4 bits
|
||||||
position: number; // grn/crp: 0-2 | coda: 0
|
position: number; // grn/crp: 0-2 | coda: 0
|
||||||
// knife field provided for coda only
|
// knife field provided for coda only
|
||||||
knife?: IKnife;
|
knife?: {
|
||||||
|
Item: IEquipmentClient;
|
||||||
|
Skins: IWeaponSkinClient[];
|
||||||
|
ModSlot: number;
|
||||||
|
CustSlot: number;
|
||||||
|
AttachedUpgrades: IUpgradeClient[];
|
||||||
|
HiddenWhenHolstered: boolean;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// interface INemesisWeakenRequest {
|
const kuvaLichVersionSixWeapons = [
|
||||||
// target: INemesisClient;
|
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Drakgoon/KuvaDrakgoon",
|
||||||
// knife: IKnife;
|
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Karak/KuvaKarak",
|
||||||
// }
|
"/Lotus/Weapons/Grineer/Melee/GrnKuvaLichScythe/GrnKuvaLichScytheWeapon",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Kohm/KuvaKohm",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Ogris/KuvaOgris",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Quartakk/KuvaQuartakk",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Tonkor/KuvaTonkor",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/Secondaries/Brakk/KuvaBrakk",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/Secondaries/Kraken/KuvaKraken",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/Secondaries/Seer/KuvaSeer",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/Secondaries/Stubba/KuvaStubba",
|
||||||
|
"/Lotus/Weapons/Grineer/HeavyWeapons/GrnHeavyGrenadeLauncher",
|
||||||
|
"/Lotus/Weapons/Grineer/LongGuns/GrnKuvaLichRifle/GrnKuvaLichRifleWeapon",
|
||||||
|
"/Lotus/Weapons/Grineer/Bows/GrnBow/GrnBowWeapon",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Hind/KuvaHind",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/Secondaries/Nukor/KuvaNukor",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Hek/KuvaHekWeapon",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Zarr/KuvaZarr",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/HeavyWeapons/Grattler/KuvaGrattler",
|
||||||
|
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Sobek/KuvaSobek"
|
||||||
|
];
|
||||||
|
|
||||||
interface IKnife {
|
const corpusVersionThreeWeapons = [
|
||||||
Item: IEquipmentClient;
|
"/Lotus/Weapons/Corpus/LongGuns/CrpBriefcaseLauncher/CrpBriefcaseLauncher",
|
||||||
Skins: IWeaponSkinClient[];
|
"/Lotus/Weapons/Corpus/BoardExec/Primary/CrpBEArcaPlasmor/CrpBEArcaPlasmor",
|
||||||
ModSlot: number;
|
"/Lotus/Weapons/Corpus/BoardExec/Primary/CrpBEFluxRifle/CrpBEFluxRifle",
|
||||||
CustSlot: number;
|
"/Lotus/Weapons/Corpus/BoardExec/Primary/CrpBETetra/CrpBETetra",
|
||||||
AttachedUpgrades: IUpgradeClient[];
|
"/Lotus/Weapons/Corpus/BoardExec/Secondary/CrpBECycron/CrpBECycron",
|
||||||
HiddenWhenHolstered: boolean;
|
"/Lotus/Weapons/Corpus/BoardExec/Secondary/CrpBEDetron/CrpBEDetron",
|
||||||
}
|
"/Lotus/Weapons/Corpus/Pistols/CrpIgniterPistol/CrpIgniterPistol",
|
||||||
|
"/Lotus/Weapons/Corpus/Pistols/CrpBriefcaseAkimbo/CrpBriefcaseAkimboPistol",
|
||||||
|
"/Lotus/Weapons/Corpus/BoardExec/Secondary/CrpBEPlinx/CrpBEPlinxWeapon",
|
||||||
|
"/Lotus/Weapons/Corpus/BoardExec/Primary/CrpBEGlaxion/CrpBEGlaxion"
|
||||||
|
];
|
||||||
|
@ -37,7 +37,6 @@ export const placeDecoInComponentController: RequestHandler = async (req, res) =
|
|||||||
const deco = component.Decos.find(x => x._id.equals(request.MoveId))!;
|
const deco = component.Decos.find(x => x._id.equals(request.MoveId))!;
|
||||||
deco.Pos = request.Pos;
|
deco.Pos = request.Pos;
|
||||||
deco.Rot = request.Rot;
|
deco.Rot = request.Rot;
|
||||||
deco.Scale = request.Scale;
|
|
||||||
} else {
|
} else {
|
||||||
const deco =
|
const deco =
|
||||||
component.Decos[
|
component.Decos[
|
||||||
@ -46,7 +45,6 @@ export const placeDecoInComponentController: RequestHandler = async (req, res) =
|
|||||||
Type: request.Type,
|
Type: request.Type,
|
||||||
Pos: request.Pos,
|
Pos: request.Pos,
|
||||||
Rot: request.Rot,
|
Rot: request.Rot,
|
||||||
Scale: request.Scale,
|
|
||||||
Name: request.Name,
|
Name: request.Name,
|
||||||
Sockets: request.Sockets
|
Sockets: request.Sockets
|
||||||
}) - 1
|
}) - 1
|
||||||
@ -115,9 +113,9 @@ interface IPlaceDecoInComponentRequest {
|
|||||||
Type: string;
|
Type: string;
|
||||||
Pos: number[];
|
Pos: number[];
|
||||||
Rot: number[];
|
Rot: number[];
|
||||||
Scale?: number;
|
|
||||||
Name?: string;
|
Name?: string;
|
||||||
Sockets?: number;
|
Sockets?: number;
|
||||||
|
Scale?: number; // only provided alongside MoveId and seems to always be 1
|
||||||
MoveId?: string;
|
MoveId?: string;
|
||||||
ShipDeco?: boolean;
|
ShipDeco?: boolean;
|
||||||
VaultDeco?: boolean;
|
VaultDeco?: boolean;
|
||||||
|
@ -2,16 +2,13 @@ import { RequestHandler } from "express";
|
|||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { addMiscItems, getInventory } from "@/src/services/inventoryService";
|
import { addMiscItems, getInventory } from "@/src/services/inventoryService";
|
||||||
import { ExportRelics, IRelic } from "warframe-public-export-plus";
|
import { ExportRelics, IRelic } from "warframe-public-export-plus";
|
||||||
import { config } from "@/src/services/configService";
|
|
||||||
|
|
||||||
export const projectionManagerController: RequestHandler = async (req, res) => {
|
export const projectionManagerController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
const request = JSON.parse(String(req.body)) as IProjectionUpgradeRequest;
|
const request = JSON.parse(String(req.body)) as IProjectionUpgradeRequest;
|
||||||
const [era, category, currentQuality] = parseProjection(request.projectionType);
|
const [era, category, currentQuality] = parseProjection(request.projectionType);
|
||||||
const upgradeCost = config.dontSubtractVoidTraces
|
const upgradeCost = (request.qualityTag - qualityKeywordToNumber[currentQuality]) * 25;
|
||||||
? 0
|
|
||||||
: (request.qualityTag - qualityKeywordToNumber[currentQuality]) * 25;
|
|
||||||
const newProjectionType = findProjection(era, category, qualityNumberToKeyword[request.qualityTag]);
|
const newProjectionType = findProjection(era, category, qualityNumberToKeyword[request.qualityTag]);
|
||||||
addMiscItems(inventory, [
|
addMiscItems(inventory, [
|
||||||
{
|
{
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
import { getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
|
|
||||||
// Basic shim handling action=sync to login on U21
|
|
||||||
export const questControlController: RequestHandler = async (req, res) => {
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
const inventory = await getInventory(accountId);
|
|
||||||
const quests: IQuestState[] = [];
|
|
||||||
for (const quest of inventory.QuestKeys) {
|
|
||||||
quests.push({
|
|
||||||
quest: quest.ItemType,
|
|
||||||
state: 3 // COMPLETE
|
|
||||||
});
|
|
||||||
}
|
|
||||||
res.json({
|
|
||||||
QuestState: quests
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IQuestState {
|
|
||||||
quest: string;
|
|
||||||
state: number;
|
|
||||||
task?: string;
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|
||||||
import { Friendship } from "@/src/models/friendModel";
|
|
||||||
import { Account } from "@/src/models/loginModel";
|
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
import { IOid } from "@/src/types/commonTypes";
|
|
||||||
import { parallelForeach } from "@/src/utils/async-utils";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
import { Types } from "mongoose";
|
|
||||||
|
|
||||||
export const removeFriendGetController: RequestHandler = async (req, res) => {
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
if (req.query.all) {
|
|
||||||
const [internalFriendships, externalFriendships] = await Promise.all([
|
|
||||||
Friendship.find({ owner: accountId }, "friend"),
|
|
||||||
Friendship.find({ friend: accountId }, "owner")
|
|
||||||
]);
|
|
||||||
const promises: Promise<void>[] = [];
|
|
||||||
const friends: IOid[] = [];
|
|
||||||
for (const externalFriendship of externalFriendships) {
|
|
||||||
if (!internalFriendships.find(x => x.friend.equals(externalFriendship.owner))) {
|
|
||||||
promises.push(Friendship.deleteOne({ _id: externalFriendship._id }) as unknown as Promise<void>);
|
|
||||||
friends.push(toOid(externalFriendship.owner));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await Promise.all(promises);
|
|
||||||
res.json({
|
|
||||||
Friends: friends
|
|
||||||
} satisfies IRemoveFriendsResponse);
|
|
||||||
} else {
|
|
||||||
const friendId = req.query.friendId as string;
|
|
||||||
await Promise.all([
|
|
||||||
Friendship.deleteOne({ owner: accountId, friend: friendId }),
|
|
||||||
Friendship.deleteOne({ owner: friendId, friend: accountId })
|
|
||||||
]);
|
|
||||||
res.json({
|
|
||||||
Friends: [{ $oid: friendId }]
|
|
||||||
} satisfies IRemoveFriendsResponse);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const removeFriendPostController: RequestHandler = async (req, res) => {
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
const data = getJSONfromString<IBatchRemoveFriendsRequest>(String(req.body));
|
|
||||||
const friends = new Set((await Friendship.find({ owner: accountId }, "friend")).map(x => x.friend));
|
|
||||||
// TOVERIFY: Should pending friendships also be kept?
|
|
||||||
|
|
||||||
// Keep friends that have been online within threshold
|
|
||||||
await parallelForeach([...friends], async friend => {
|
|
||||||
const account = (await Account.findById(friend, "LastLogin"))!;
|
|
||||||
const daysLoggedOut = (Date.now() - account.LastLogin.getTime()) / 86400_000;
|
|
||||||
if (daysLoggedOut < data.DaysLoggedOut) {
|
|
||||||
friends.delete(friend);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (data.SkipClanmates) {
|
|
||||||
const inventory = await getInventory(accountId, "GuildId");
|
|
||||||
if (inventory.GuildId) {
|
|
||||||
await parallelForeach([...friends], async friend => {
|
|
||||||
const friendInventory = await getInventory(friend.toString(), "GuildId");
|
|
||||||
if (friendInventory.GuildId?.equals(inventory.GuildId)) {
|
|
||||||
friends.delete(friend);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove all remaining friends that aren't in SkipFriendIds & give response.
|
|
||||||
const promises = [];
|
|
||||||
const response: IOid[] = [];
|
|
||||||
for (const friend of friends) {
|
|
||||||
if (!data.SkipFriendIds.find(skipFriendId => checkFriendId(skipFriendId, friend))) {
|
|
||||||
promises.push(Friendship.deleteOne({ owner: accountId, friend: friend }));
|
|
||||||
promises.push(Friendship.deleteOne({ owner: friend, friend: accountId }));
|
|
||||||
response.push(toOid(friend));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await Promise.all(promises);
|
|
||||||
res.json({
|
|
||||||
Friends: response
|
|
||||||
} satisfies IRemoveFriendsResponse);
|
|
||||||
};
|
|
||||||
|
|
||||||
// The friend ids format is a bit weird, e.g. when 6633b81e9dba0b714f28ff02 (A) is friends with 67cdac105ef1f4b49741c267 (B), A's friend id for B is 808000105ef1f40560ca079e and B's friend id for A is 8000b81e9dba0b06408a8075.
|
|
||||||
const checkFriendId = (friendId: string, b: Types.ObjectId): boolean => {
|
|
||||||
return friendId.substring(6, 6 + 8) == b.toString().substring(6, 6 + 8);
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IBatchRemoveFriendsRequest {
|
|
||||||
DaysLoggedOut: number;
|
|
||||||
SkipClanmates: boolean;
|
|
||||||
SkipFriendIds: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IRemoveFriendsResponse {
|
|
||||||
Friends: IOid[];
|
|
||||||
}
|
|
@ -1,8 +1,10 @@
|
|||||||
|
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
import { config } from "@/src/services/configService";
|
import { config } from "@/src/services/configService";
|
||||||
import { addEmailItem, getDialogue, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
import { addEmailItem, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { ICompletedDialogue } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { ICompletedDialogue, IDialogueDatabase } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||||
|
import { logger } from "@/src/utils/logger";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
export const saveDialogueController: RequestHandler = async (req, res) => {
|
export const saveDialogueController: RequestHandler = async (req, res) => {
|
||||||
@ -25,33 +27,33 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
|
|||||||
const dialogue = getDialogue(inventory, request.DialogueName);
|
const dialogue = getDialogue(inventory, request.DialogueName);
|
||||||
dialogue.Rank = request.Rank;
|
dialogue.Rank = request.Rank;
|
||||||
dialogue.Chemistry = request.Chemistry;
|
dialogue.Chemistry = request.Chemistry;
|
||||||
dialogue.QueuedDialogues = request.QueuedDialogues;
|
|
||||||
for (const bool of request.Booleans) {
|
|
||||||
dialogue.Booleans.push(bool);
|
|
||||||
if (bool == "LizzieShawzin") {
|
|
||||||
await addEmailItem(
|
|
||||||
inventory,
|
|
||||||
"/Lotus/Types/Items/EmailItems/LizzieShawzinSkinEmailItem",
|
|
||||||
inventoryChanges
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const bool of request.ResetBooleans) {
|
|
||||||
const index = dialogue.Booleans.findIndex(x => x == bool);
|
|
||||||
if (index != -1) {
|
|
||||||
dialogue.Booleans.splice(index, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const info of request.OtherDialogueInfos) {
|
|
||||||
const otherDialogue = getDialogue(inventory, info.Dialogue);
|
|
||||||
if (info.Tag != "") {
|
|
||||||
otherDialogue.QueuedDialogues.push(info.Tag);
|
|
||||||
}
|
|
||||||
otherDialogue.Chemistry += info.Value; // unsure
|
|
||||||
}
|
|
||||||
if (request.Data) {
|
if (request.Data) {
|
||||||
|
dialogue.QueuedDialogues = request.QueuedDialogues;
|
||||||
|
for (const bool of request.Booleans) {
|
||||||
|
dialogue.Booleans.push(bool);
|
||||||
|
if (bool == "LizzieShawzin") {
|
||||||
|
await addEmailItem(
|
||||||
|
inventory,
|
||||||
|
"/Lotus/Types/Items/EmailItems/LizzieShawzinSkinEmailItem",
|
||||||
|
inventoryChanges
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const bool of request.ResetBooleans) {
|
||||||
|
const index = dialogue.Booleans.findIndex(x => x == bool);
|
||||||
|
if (index != -1) {
|
||||||
|
dialogue.Booleans.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
dialogue.Completed.push(request.Data);
|
dialogue.Completed.push(request.Data);
|
||||||
dialogue.AvailableDate = new Date(tomorrowAt0Utc);
|
dialogue.AvailableDate = new Date(tomorrowAt0Utc);
|
||||||
|
for (const info of request.OtherDialogueInfos) {
|
||||||
|
const otherDialogue = getDialogue(inventory, info.Dialogue);
|
||||||
|
if (info.Tag != "") {
|
||||||
|
otherDialogue.QueuedDialogues.push(info.Tag);
|
||||||
|
}
|
||||||
|
otherDialogue.Chemistry += info.Value; // unsure
|
||||||
|
}
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json({
|
res.json({
|
||||||
InventoryChanges: inventoryChanges,
|
InventoryChanges: inventoryChanges,
|
||||||
@ -72,7 +74,7 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
|
|||||||
AvailableGiftDate: { $date: { $numberLong: tomorrowAt0Utc.toString() } }
|
AvailableGiftDate: { $date: { $numberLong: tomorrowAt0Utc.toString() } }
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
res.end();
|
logger.error(`saveDialogue request not fully handled: ${String(req.body)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -106,3 +108,26 @@ interface IOtherDialogueInfo {
|
|||||||
Tag: string;
|
Tag: string;
|
||||||
Value: number;
|
Value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getDialogue = (inventory: TInventoryDatabaseDocument, dialogueName: string): IDialogueDatabase => {
|
||||||
|
let dialogue = inventory.DialogueHistory!.Dialogues!.find(x => x.DialogueName == dialogueName);
|
||||||
|
if (!dialogue) {
|
||||||
|
dialogue =
|
||||||
|
inventory.DialogueHistory!.Dialogues![
|
||||||
|
inventory.DialogueHistory!.Dialogues!.push({
|
||||||
|
Rank: 0,
|
||||||
|
Chemistry: 0,
|
||||||
|
AvailableDate: new Date(0),
|
||||||
|
AvailableGiftDate: new Date(0),
|
||||||
|
RankUpExpiry: new Date(0),
|
||||||
|
BountyChemExpiry: new Date(0),
|
||||||
|
QueuedDialogues: [],
|
||||||
|
Gifts: [],
|
||||||
|
Booleans: [],
|
||||||
|
Completed: [],
|
||||||
|
DialogueName: dialogueName
|
||||||
|
}) - 1
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return dialogue;
|
||||||
|
};
|
||||||
|
@ -2,12 +2,11 @@ import { RequestHandler } from "express";
|
|||||||
import { ISaveLoadoutRequest } from "@/src/types/saveLoadoutTypes";
|
import { ISaveLoadoutRequest } from "@/src/types/saveLoadoutTypes";
|
||||||
import { handleInventoryItemConfigChange } from "@/src/services/saveLoadoutService";
|
import { handleInventoryItemConfigChange } from "@/src/services/saveLoadoutService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|
||||||
|
|
||||||
export const saveLoadoutController: RequestHandler = async (req, res) => {
|
export const saveLoadoutController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
|
||||||
const body: ISaveLoadoutRequest = getJSONfromString<ISaveLoadoutRequest>(String(req.body));
|
const body: ISaveLoadoutRequest = JSON.parse(req.body as string) as ISaveLoadoutRequest;
|
||||||
// console.log(util.inspect(body, { showHidden: false, depth: null, colors: true }));
|
// console.log(util.inspect(body, { showHidden: false, depth: null, colors: true }));
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
@ -8,8 +8,7 @@ import {
|
|||||||
addConsumables,
|
addConsumables,
|
||||||
freeUpSlot,
|
freeUpSlot,
|
||||||
combineInventoryChanges,
|
combineInventoryChanges,
|
||||||
addCrewShipRawSalvage,
|
addCrewShipRawSalvage
|
||||||
addFusionPoints
|
|
||||||
} from "@/src/services/inventoryService";
|
} from "@/src/services/inventoryService";
|
||||||
import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
||||||
@ -45,10 +44,7 @@ export const sellController: RequestHandler = async (req, res) => {
|
|||||||
if (payload.Items.SpaceGuns || payload.Items.SpaceMelee) {
|
if (payload.Items.SpaceGuns || payload.Items.SpaceMelee) {
|
||||||
requiredFields.add(InventorySlot.SPACEWEAPONS);
|
requiredFields.add(InventorySlot.SPACEWEAPONS);
|
||||||
}
|
}
|
||||||
if (payload.Items.MechSuits) {
|
if (payload.Items.Sentinels || payload.Items.SentinelWeapons) {
|
||||||
requiredFields.add(InventorySlot.MECHSUITS);
|
|
||||||
}
|
|
||||||
if (payload.Items.Sentinels || payload.Items.SentinelWeapons || payload.Items.MoaPets) {
|
|
||||||
requiredFields.add(InventorySlot.SENTINELS);
|
requiredFields.add(InventorySlot.SENTINELS);
|
||||||
}
|
}
|
||||||
if (payload.Items.OperatorAmps) {
|
if (payload.Items.OperatorAmps) {
|
||||||
@ -73,7 +69,7 @@ export const sellController: RequestHandler = async (req, res) => {
|
|||||||
if (payload.SellCurrency == "SC_RegularCredits") {
|
if (payload.SellCurrency == "SC_RegularCredits") {
|
||||||
inventory.RegularCredits += payload.SellPrice;
|
inventory.RegularCredits += payload.SellPrice;
|
||||||
} else if (payload.SellCurrency == "SC_FusionPoints") {
|
} else if (payload.SellCurrency == "SC_FusionPoints") {
|
||||||
addFusionPoints(inventory, payload.SellPrice);
|
inventory.FusionPoints += payload.SellPrice;
|
||||||
} else if (payload.SellCurrency == "SC_PrimeBucks") {
|
} else if (payload.SellCurrency == "SC_PrimeBucks") {
|
||||||
addMiscItems(inventory, [
|
addMiscItems(inventory, [
|
||||||
{
|
{
|
||||||
@ -139,12 +135,6 @@ export const sellController: RequestHandler = async (req, res) => {
|
|||||||
freeUpSlot(inventory, InventorySlot.SPACEWEAPONS);
|
freeUpSlot(inventory, InventorySlot.SPACEWEAPONS);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (payload.Items.MechSuits) {
|
|
||||||
payload.Items.MechSuits.forEach(sellItem => {
|
|
||||||
inventory.MechSuits.pull({ _id: sellItem.String });
|
|
||||||
freeUpSlot(inventory, InventorySlot.MECHSUITS);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (payload.Items.Sentinels) {
|
if (payload.Items.Sentinels) {
|
||||||
payload.Items.Sentinels.forEach(sellItem => {
|
payload.Items.Sentinels.forEach(sellItem => {
|
||||||
inventory.Sentinels.pull({ _id: sellItem.String });
|
inventory.Sentinels.pull({ _id: sellItem.String });
|
||||||
@ -157,12 +147,6 @@ export const sellController: RequestHandler = async (req, res) => {
|
|||||||
freeUpSlot(inventory, InventorySlot.SENTINELS);
|
freeUpSlot(inventory, InventorySlot.SENTINELS);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (payload.Items.MoaPets) {
|
|
||||||
payload.Items.MoaPets.forEach(sellItem => {
|
|
||||||
inventory.MoaPets.pull({ _id: sellItem.String });
|
|
||||||
freeUpSlot(inventory, InventorySlot.SENTINELS);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (payload.Items.OperatorAmps) {
|
if (payload.Items.OperatorAmps) {
|
||||||
payload.Items.OperatorAmps.forEach(sellItem => {
|
payload.Items.OperatorAmps.forEach(sellItem => {
|
||||||
inventory.OperatorAmps.pull({ _id: sellItem.String });
|
inventory.OperatorAmps.pull({ _id: sellItem.String });
|
||||||
@ -294,10 +278,8 @@ interface ISellRequest {
|
|||||||
SpaceSuits?: ISellItem[];
|
SpaceSuits?: ISellItem[];
|
||||||
SpaceGuns?: ISellItem[];
|
SpaceGuns?: ISellItem[];
|
||||||
SpaceMelee?: ISellItem[];
|
SpaceMelee?: ISellItem[];
|
||||||
MechSuits?: ISellItem[];
|
|
||||||
Sentinels?: ISellItem[];
|
Sentinels?: ISellItem[];
|
||||||
SentinelWeapons?: ISellItem[];
|
SentinelWeapons?: ISellItem[];
|
||||||
MoaPets?: ISellItem[];
|
|
||||||
OperatorAmps?: ISellItem[];
|
OperatorAmps?: ISellItem[];
|
||||||
Hoverboards?: ISellItem[];
|
Hoverboards?: ISellItem[];
|
||||||
Drones?: ISellItem[];
|
Drones?: ISellItem[];
|
||||||
|
@ -13,7 +13,7 @@ export const setDojoComponentSettingsController: RequestHandler = async (req, re
|
|||||||
res.json({ DojoRequestStatus: -1 });
|
res.json({ DojoRequestStatus: -1 });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const component = guild.DojoComponents.id(req.query.componentId as string)!;
|
const component = guild.DojoComponents.id(req.query.componentId)!;
|
||||||
const data = getJSONfromString<ISetDojoComponentSettingsRequest>(String(req.body));
|
const data = getJSONfromString<ISetDojoComponentSettingsRequest>(String(req.body));
|
||||||
component.Settings = data.Settings;
|
component.Settings = data.Settings;
|
||||||
await guild.save();
|
await guild.save();
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|
||||||
import { Friendship } from "@/src/models/friendModel";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
|
|
||||||
export const setFriendNoteController: RequestHandler = async (req, res) => {
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
const payload = getJSONfromString<ISetFriendNoteRequest>(String(req.body));
|
|
||||||
const friendship = await Friendship.findOne({ owner: accountId, friend: payload.FriendId }, "Note Favorite");
|
|
||||||
if (friendship) {
|
|
||||||
if ("Note" in payload) {
|
|
||||||
friendship.Note = payload.Note;
|
|
||||||
} else {
|
|
||||||
friendship.Favorite = payload.Favorite;
|
|
||||||
}
|
|
||||||
await friendship.save();
|
|
||||||
}
|
|
||||||
res.json({
|
|
||||||
Id: payload.FriendId,
|
|
||||||
SetNote: "Note" in payload,
|
|
||||||
Note: friendship?.Note,
|
|
||||||
Favorite: friendship?.Favorite
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
interface ISetFriendNoteRequest {
|
|
||||||
FriendId: string;
|
|
||||||
Note?: string;
|
|
||||||
Favorite?: boolean;
|
|
||||||
}
|
|
@ -1,4 +1,3 @@
|
|||||||
import { version_compare } from "@/src/helpers/inventoryHelpers";
|
|
||||||
import { Alliance, Guild, GuildMember } from "@/src/models/guildModel";
|
import { Alliance, Guild, GuildMember } from "@/src/models/guildModel";
|
||||||
import { hasGuildPermissionEx } from "@/src/services/guildService";
|
import { hasGuildPermissionEx } from "@/src/services/guildService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
@ -56,9 +55,5 @@ export const setGuildMotdController: RequestHandler = async (req, res) => {
|
|||||||
await guild.save();
|
await guild.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!account.BuildLabel || version_compare(account.BuildLabel, "2020.03.24.20.24") > 0) {
|
res.json({ IsLongMOTD, MOTD });
|
||||||
res.json({ IsLongMOTD, MOTD });
|
|
||||||
} else {
|
|
||||||
res.send(MOTD).end();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@ -20,7 +20,7 @@ export const setShipFavouriteLoadoutController: RequestHandler = async (req, res
|
|||||||
throw new Error(`unexpected BootLocation: ${body.BootLocation}`);
|
throw new Error(`unexpected BootLocation: ${body.BootLocation}`);
|
||||||
}
|
}
|
||||||
await personalRooms.save();
|
await personalRooms.save();
|
||||||
res.json(body);
|
res.json({});
|
||||||
};
|
};
|
||||||
|
|
||||||
interface ISetShipFavouriteLoadoutRequest {
|
interface ISetShipFavouriteLoadoutRequest {
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
||||||
import { config } from "@/src/services/configService";
|
import { config } from "@/src/services/configService";
|
||||||
import { getAccountForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
|
|
||||||
interface IStartDojoRecipeRequest {
|
interface IStartDojoRecipeRequest {
|
||||||
@ -20,10 +20,10 @@ interface IStartDojoRecipeRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const startDojoRecipeController: RequestHandler = async (req, res) => {
|
export const startDojoRecipeController: RequestHandler = async (req, res) => {
|
||||||
const account = await getAccountForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(account._id.toString(), "GuildId LevelKeys");
|
const inventory = await getInventory(accountId, "GuildId LevelKeys");
|
||||||
const guild = await getGuildForRequestEx(req, inventory);
|
const guild = await getGuildForRequestEx(req, inventory);
|
||||||
if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, account._id, GuildPermission.Architect))) {
|
if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) {
|
||||||
res.json({ DojoRequestStatus: -1 });
|
res.json({ DojoRequestStatus: -1 });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -64,5 +64,5 @@ export const startDojoRecipeController: RequestHandler = async (req, res) => {
|
|||||||
setDojoRoomLogFunded(guild, component);
|
setDojoRoomLogFunded(guild, component);
|
||||||
}
|
}
|
||||||
await guild.save();
|
await guild.save();
|
||||||
res.json(await getDojoClient(guild, 0, undefined, account.BuildLabel));
|
res.json(await getDojoClient(guild, 0));
|
||||||
};
|
};
|
||||||
|
@ -41,7 +41,7 @@ export const startRecipeController: RequestHandler = async (req, res) => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
for (let i = 0; i != recipe.ingredients.length; ++i) {
|
for (let i = 0; i != recipe.ingredients.length; ++i) {
|
||||||
if (startRecipeRequest.Ids[i] && startRecipeRequest.Ids[i][0] != "/") {
|
if (startRecipeRequest.Ids[i]) {
|
||||||
const category = ExportWeapons[recipe.ingredients[i].ItemType].productCategory;
|
const category = ExportWeapons[recipe.ingredients[i].ItemType].productCategory;
|
||||||
if (category != "LongGuns" && category != "Pistols" && category != "Melee") {
|
if (category != "LongGuns" && category != "Pistols" && category != "Melee") {
|
||||||
throw new Error(`unexpected equipment ingredient type: ${category}`);
|
throw new Error(`unexpected equipment ingredient type: ${category}`);
|
||||||
|
@ -6,9 +6,6 @@ import { handleStoreItemAcquisition } from "@/src/services/purchaseService";
|
|||||||
import { addMiscItems, combineInventoryChanges, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
import { addMiscItems, combineInventoryChanges, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||||
import { isStoreItem, toStoreItem } from "@/src/services/itemDataService";
|
import { isStoreItem, toStoreItem } from "@/src/services/itemDataService";
|
||||||
import { logger } from "@/src/utils/logger";
|
|
||||||
|
|
||||||
const nightwaveCredsItemType = ExportNightwave.rewards[ExportNightwave.rewards.length - 1].uniqueName;
|
|
||||||
|
|
||||||
export const syndicateSacrificeController: RequestHandler = async (request, response) => {
|
export const syndicateSacrificeController: RequestHandler = async (request, response) => {
|
||||||
const accountId = await getAccountIdForRequest(request);
|
const accountId = await getAccountIdForRequest(request);
|
||||||
@ -77,14 +74,10 @@ export const syndicateSacrificeController: RequestHandler = async (request, resp
|
|||||||
if (!isStoreItem(rewardType)) {
|
if (!isStoreItem(rewardType)) {
|
||||||
rewardType = toStoreItem(rewardType);
|
rewardType = toStoreItem(rewardType);
|
||||||
}
|
}
|
||||||
const rewardInventoryChanges = (await handleStoreItemAcquisition(rewardType, inventory, reward.itemCount))
|
combineInventoryChanges(
|
||||||
.InventoryChanges;
|
res.InventoryChanges,
|
||||||
if (Object.keys(rewardInventoryChanges).length == 0) {
|
(await handleStoreItemAcquisition(rewardType, inventory, reward.itemCount)).InventoryChanges
|
||||||
logger.debug(`nightwave rank up reward did not seem to get added, giving 50 creds instead`);
|
);
|
||||||
rewardInventoryChanges.MiscItems = [{ ItemType: nightwaveCredsItemType, ItemCount: 50 }];
|
|
||||||
addMiscItems(inventory, rewardInventoryChanges.MiscItems);
|
|
||||||
}
|
|
||||||
combineInventoryChanges(res.InventoryChanges, rewardInventoryChanges);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { addFusionPoints, getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
|
|
||||||
export const addCurrencyController: RequestHandler = async (req, res) => {
|
export const addCurrencyController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
const inventory = await getInventory(accountId);
|
||||||
const request = req.body as IAddCurrencyRequest;
|
const request = req.body as IAddCurrencyRequest;
|
||||||
const inventory = await getInventory(accountId, request.currency);
|
inventory[request.currency] += request.delta;
|
||||||
if (request.currency == "FusionPoints") {
|
|
||||||
addFusionPoints(inventory, request.delta);
|
|
||||||
} else {
|
|
||||||
inventory[request.currency] += request.delta;
|
|
||||||
}
|
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.end();
|
res.end();
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@ export const addItemsController: RequestHandler = async (req, res) => {
|
|||||||
const requests = req.body as IAddItemRequest[];
|
const requests = req.body as IAddItemRequest[];
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
for (const request of requests) {
|
for (const request of requests) {
|
||||||
await addItem(inventory, request.ItemType, request.ItemCount, true, undefined, undefined, true);
|
await addItem(inventory, request.ItemType, request.ItemCount, true);
|
||||||
}
|
}
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.end();
|
res.end();
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
import { getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
import { ExportArcanes, ExportUpgrades } from "warframe-public-export-plus";
|
|
||||||
|
|
||||||
export const addMissingMaxRankModsController: RequestHandler = async (req, res) => {
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
const inventory = await getInventory(accountId, "Upgrades");
|
|
||||||
|
|
||||||
const maxOwnedRanks: Record<string, number> = {};
|
|
||||||
for (const upgrade of inventory.Upgrades) {
|
|
||||||
const fingerprint = JSON.parse(upgrade.UpgradeFingerprint ?? "{}") as { lvl?: number };
|
|
||||||
if (fingerprint.lvl) {
|
|
||||||
maxOwnedRanks[upgrade.ItemType] ??= 0;
|
|
||||||
if (fingerprint.lvl > maxOwnedRanks[upgrade.ItemType]) {
|
|
||||||
maxOwnedRanks[upgrade.ItemType] = fingerprint.lvl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const [uniqueName, data] of Object.entries(ExportUpgrades)) {
|
|
||||||
if (data.fusionLimit != 0 && data.type != "PARAZON" && maxOwnedRanks[uniqueName] != data.fusionLimit) {
|
|
||||||
inventory.Upgrades.push({
|
|
||||||
ItemType: uniqueName,
|
|
||||||
UpgradeFingerprint: JSON.stringify({ lvl: data.fusionLimit })
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const [uniqueName, data] of Object.entries(ExportArcanes)) {
|
|
||||||
if (
|
|
||||||
data.name != "/Lotus/Language/Items/GenericCosmeticEnhancerName" &&
|
|
||||||
maxOwnedRanks[uniqueName] != data.fusionLimit
|
|
||||||
) {
|
|
||||||
inventory.Upgrades.push({
|
|
||||||
ItemType: uniqueName,
|
|
||||||
UpgradeFingerprint: JSON.stringify({ lvl: data.fusionLimit })
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await inventory.save();
|
|
||||||
res.end();
|
|
||||||
};
|
|
@ -1,6 +1,5 @@
|
|||||||
import { applyClientEquipmentUpdates, getInventory } from "@/src/services/inventoryService";
|
import { addGearExpByCategory, getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { IOid } from "@/src/types/commonTypes";
|
|
||||||
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
@ -12,7 +11,7 @@ export const addXpController: RequestHandler = async (req, res) => {
|
|||||||
const request = req.body as IAddXpRequest;
|
const request = req.body as IAddXpRequest;
|
||||||
for (const [category, gear] of Object.entries(request)) {
|
for (const [category, gear] of Object.entries(request)) {
|
||||||
for (const clientItem of gear) {
|
for (const clientItem of gear) {
|
||||||
const dbItem = inventory[category as TEquipmentKey].id((clientItem.ItemId as IOid).$oid);
|
const dbItem = inventory[category as TEquipmentKey].id(clientItem.ItemId.$oid);
|
||||||
if (dbItem) {
|
if (dbItem) {
|
||||||
if (dbItem.ItemType in ExportMisc.uniqueLevelCaps) {
|
if (dbItem.ItemType in ExportMisc.uniqueLevelCaps) {
|
||||||
if ((dbItem.Polarized ?? 0) < 5) {
|
if ((dbItem.Polarized ?? 0) < 5) {
|
||||||
@ -21,7 +20,7 @@ export const addXpController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
applyClientEquipmentUpdates(inventory, gear, category as TEquipmentKey);
|
addGearExpByCategory(inventory, gear, category as TEquipmentKey);
|
||||||
}
|
}
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.end();
|
res.end();
|
||||||
|
@ -10,7 +10,6 @@ import { Stats } from "@/src/models/statsModel";
|
|||||||
import { GuildMember } from "@/src/models/guildModel";
|
import { GuildMember } from "@/src/models/guildModel";
|
||||||
import { Leaderboard } from "@/src/models/leaderboardModel";
|
import { Leaderboard } from "@/src/models/leaderboardModel";
|
||||||
import { deleteGuild } from "@/src/services/guildService";
|
import { deleteGuild } from "@/src/services/guildService";
|
||||||
import { Friendship } from "@/src/models/friendModel";
|
|
||||||
|
|
||||||
export const deleteAccountController: RequestHandler = async (req, res) => {
|
export const deleteAccountController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -23,8 +22,6 @@ export const deleteAccountController: RequestHandler = async (req, res) => {
|
|||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
Account.deleteOne({ _id: accountId }),
|
Account.deleteOne({ _id: accountId }),
|
||||||
Friendship.deleteMany({ owner: accountId }),
|
|
||||||
Friendship.deleteMany({ friend: accountId }),
|
|
||||||
GuildMember.deleteMany({ accountId: accountId }),
|
GuildMember.deleteMany({ accountId: accountId }),
|
||||||
Ignore.deleteMany({ ignorer: accountId }),
|
Ignore.deleteMany({ ignorer: accountId }),
|
||||||
Ignore.deleteMany({ ignoree: accountId }),
|
Ignore.deleteMany({ ignoree: accountId }),
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
import { AllianceMember, Guild, GuildMember } from "@/src/models/guildModel";
|
import { AllianceMember, Guild, GuildMember } from "@/src/models/guildModel";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { getAccountForRequest, isAdministrator } from "@/src/services/loginService";
|
import { getAccountForRequest, isAdministrator } from "@/src/services/loginService";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
export const getAccountInfoController: RequestHandler = async (req, res) => {
|
export const getAccountInfoController: RequestHandler = async (req, res) => {
|
||||||
const account = await getAccountForRequest(req);
|
const account = await getAccountForRequest(req);
|
||||||
const inventory = await getInventory(account._id.toString(), "QuestKeys");
|
|
||||||
const info: IAccountInfo = {
|
const info: IAccountInfo = {
|
||||||
DisplayName: account.DisplayName,
|
DisplayName: account.DisplayName
|
||||||
IsAdministrator: isAdministrator(account),
|
|
||||||
CompletedVorsPrize: !!inventory.QuestKeys.find(
|
|
||||||
x => x.ItemType == "/Lotus/Types/Keys/VorsPrize/VorsPrizeQuestKeyChain"
|
|
||||||
)?.Completed
|
|
||||||
};
|
};
|
||||||
|
if (isAdministrator(account)) {
|
||||||
|
info.IsAdministrator = true;
|
||||||
|
}
|
||||||
const guildMember = await GuildMember.findOne({ accountId: account._id, status: 0 }, "guildId rank");
|
const guildMember = await GuildMember.findOne({ accountId: account._id, status: 0 }, "guildId rank");
|
||||||
if (guildMember) {
|
if (guildMember) {
|
||||||
const guild = (await Guild.findById(guildMember.guildId, "Ranks AllianceId"))!;
|
const guild = (await Guild.findById(guildMember.guildId, "Ranks AllianceId"))!;
|
||||||
@ -34,8 +31,7 @@ export const getAccountInfoController: RequestHandler = async (req, res) => {
|
|||||||
|
|
||||||
interface IAccountInfo {
|
interface IAccountInfo {
|
||||||
DisplayName: string;
|
DisplayName: string;
|
||||||
IsAdministrator: boolean;
|
IsAdministrator?: boolean;
|
||||||
CompletedVorsPrize: boolean;
|
|
||||||
GuildId?: string;
|
GuildId?: string;
|
||||||
GuildPermissions?: number;
|
GuildPermissions?: number;
|
||||||
GuildRank?: number;
|
GuildRank?: number;
|
||||||
|
@ -20,7 +20,6 @@ import {
|
|||||||
TRelicQuality
|
TRelicQuality
|
||||||
} from "warframe-public-export-plus";
|
} from "warframe-public-export-plus";
|
||||||
import archonCrystalUpgrades from "@/static/fixed_responses/webuiArchonCrystalUpgrades.json";
|
import archonCrystalUpgrades from "@/static/fixed_responses/webuiArchonCrystalUpgrades.json";
|
||||||
import allIncarnons from "@/static/fixed_responses/allIncarnonList.json";
|
|
||||||
|
|
||||||
interface ListedItem {
|
interface ListedItem {
|
||||||
uniqueName: string;
|
uniqueName: string;
|
||||||
@ -33,29 +32,6 @@ interface ListedItem {
|
|||||||
parazon?: boolean;
|
parazon?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ItemLists {
|
|
||||||
archonCrystalUpgrades: Record<string, string>;
|
|
||||||
uniqueLevelCaps: Record<string, number>;
|
|
||||||
Suits: ListedItem[];
|
|
||||||
LongGuns: ListedItem[];
|
|
||||||
Melee: ListedItem[];
|
|
||||||
ModularParts: ListedItem[];
|
|
||||||
Pistols: ListedItem[];
|
|
||||||
Sentinels: ListedItem[];
|
|
||||||
SentinelWeapons: ListedItem[];
|
|
||||||
SpaceGuns: ListedItem[];
|
|
||||||
SpaceMelee: ListedItem[];
|
|
||||||
SpaceSuits: ListedItem[];
|
|
||||||
MechSuits: ListedItem[];
|
|
||||||
miscitems: ListedItem[];
|
|
||||||
Syndicates: ListedItem[];
|
|
||||||
OperatorAmps: ListedItem[];
|
|
||||||
QuestKeys: ListedItem[];
|
|
||||||
KubrowPets: ListedItem[];
|
|
||||||
EvolutionProgress: ListedItem[];
|
|
||||||
mods: ListedItem[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const relicQualitySuffixes: Record<TRelicQuality, string> = {
|
const relicQualitySuffixes: Record<TRelicQuality, string> = {
|
||||||
VPQ_BRONZE: "",
|
VPQ_BRONZE: "",
|
||||||
VPQ_SILVER: " [Flawless]",
|
VPQ_SILVER: " [Flawless]",
|
||||||
@ -65,28 +41,23 @@ const relicQualitySuffixes: Record<TRelicQuality, string> = {
|
|||||||
|
|
||||||
const getItemListsController: RequestHandler = (req, response) => {
|
const getItemListsController: RequestHandler = (req, response) => {
|
||||||
const lang = getDict(typeof req.query.lang == "string" ? req.query.lang : "en");
|
const lang = getDict(typeof req.query.lang == "string" ? req.query.lang : "en");
|
||||||
const res: ItemLists = {
|
const res: Record<string, ListedItem[]> = {};
|
||||||
archonCrystalUpgrades,
|
res.Suits = [];
|
||||||
uniqueLevelCaps: ExportMisc.uniqueLevelCaps,
|
res.LongGuns = [];
|
||||||
Suits: [],
|
res.Melee = [];
|
||||||
LongGuns: [],
|
res.ModularParts = [];
|
||||||
Melee: [],
|
res.Pistols = [];
|
||||||
ModularParts: [],
|
res.Sentinels = [];
|
||||||
Pistols: [],
|
res.SentinelWeapons = [];
|
||||||
Sentinels: [],
|
res.SpaceGuns = [];
|
||||||
SentinelWeapons: [],
|
res.SpaceMelee = [];
|
||||||
SpaceGuns: [],
|
res.SpaceSuits = [];
|
||||||
SpaceMelee: [],
|
res.MechSuits = [];
|
||||||
SpaceSuits: [],
|
res.miscitems = [];
|
||||||
MechSuits: [],
|
res.Syndicates = [];
|
||||||
miscitems: [],
|
res.OperatorAmps = [];
|
||||||
Syndicates: [],
|
res.QuestKeys = [];
|
||||||
OperatorAmps: [],
|
res.KubrowPets = [];
|
||||||
QuestKeys: [],
|
|
||||||
KubrowPets: [],
|
|
||||||
EvolutionProgress: [],
|
|
||||||
mods: []
|
|
||||||
};
|
|
||||||
for (const [uniqueName, item] of Object.entries(ExportWarframes)) {
|
for (const [uniqueName, item] of Object.entries(ExportWarframes)) {
|
||||||
res[item.productCategory].push({
|
res[item.productCategory].push({
|
||||||
uniqueName,
|
uniqueName,
|
||||||
@ -95,7 +66,7 @@ const getItemListsController: RequestHandler = (req, response) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (const [uniqueName, item] of Object.entries(ExportSentinels)) {
|
for (const [uniqueName, item] of Object.entries(ExportSentinels)) {
|
||||||
if (item.productCategory == "Sentinels" || item.productCategory == "KubrowPets") {
|
if (item.productCategory != "SpecialItems") {
|
||||||
res[item.productCategory].push({
|
res[item.productCategory].push({
|
||||||
uniqueName,
|
uniqueName,
|
||||||
name: getString(item.name, lang),
|
name: getString(item.name, lang),
|
||||||
@ -144,28 +115,12 @@ const getItemListsController: RequestHandler = (req, response) => {
|
|||||||
let name = getString(item.name, lang);
|
let name = getString(item.name, lang);
|
||||||
if ("dissectionParts" in item) {
|
if ("dissectionParts" in item) {
|
||||||
name = getString("/Lotus/Language/Fish/FishDisplayName", lang).split("|FISH_NAME|").join(name);
|
name = getString("/Lotus/Language/Fish/FishDisplayName", lang).split("|FISH_NAME|").join(name);
|
||||||
if (item.syndicateTag == "CetusSyndicate") {
|
if (uniqueName.indexOf("Large") != -1) {
|
||||||
if (uniqueName.indexOf("Large") != -1) {
|
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeLargeAbbrev", lang));
|
||||||
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeLargeAbbrev", lang));
|
} else if (uniqueName.indexOf("Medium") != -1) {
|
||||||
} else if (uniqueName.indexOf("Medium") != -1) {
|
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeMediumAbbrev", lang));
|
||||||
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeMediumAbbrev", lang));
|
|
||||||
} else {
|
|
||||||
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeSmallAbbrev", lang));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (uniqueName.indexOf("Large") != -1) {
|
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeSmallAbbrev", lang));
|
||||||
name = name
|
|
||||||
.split("|FISH_SIZE|")
|
|
||||||
.join(getString("/Lotus/Language/SolarisVenus/RobofishAgeCategoryElderAbbrev", lang));
|
|
||||||
} else if (uniqueName.indexOf("Medium") != -1) {
|
|
||||||
name = name
|
|
||||||
.split("|FISH_SIZE|")
|
|
||||||
.join(getString("/Lotus/Language/SolarisVenus/RobofishAgeCategoryMatureAbbrev", lang));
|
|
||||||
} else {
|
|
||||||
name = name
|
|
||||||
.split("|FISH_SIZE|")
|
|
||||||
.join(getString("/Lotus/Language/SolarisVenus/RobofishAgeCategoryYoungAbbrev", lang));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@ -229,6 +184,7 @@ const getItemListsController: RequestHandler = (req, response) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.mods = [];
|
||||||
for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) {
|
for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) {
|
||||||
const mod: ListedItem = {
|
const mod: ListedItem = {
|
||||||
uniqueName,
|
uniqueName,
|
||||||
@ -286,14 +242,12 @@ const getItemListsController: RequestHandler = (req, response) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const uniqueName of allIncarnons) {
|
|
||||||
res.EvolutionProgress.push({
|
|
||||||
uniqueName,
|
|
||||||
name: getString(getItemName(uniqueName) || "", lang)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
response.json(res);
|
response.json({
|
||||||
|
archonCrystalUpgrades,
|
||||||
|
uniqueLevelCaps: ExportMisc.uniqueLevelCaps,
|
||||||
|
...res
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export { getItemListsController };
|
export { getItemListsController };
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
import { getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
|
|
||||||
export const setEvolutionProgressController: RequestHandler = async (req, res) => {
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
|
||||||
const inventory = await getInventory(accountId);
|
|
||||||
const payload = req.body as ISetEvolutionProgressRequest;
|
|
||||||
|
|
||||||
inventory.EvolutionProgress ??= [];
|
|
||||||
payload.forEach(element => {
|
|
||||||
const entry = inventory.EvolutionProgress!.find(entry => entry.ItemType === element.ItemType);
|
|
||||||
|
|
||||||
if (entry) {
|
|
||||||
entry.Progress = 0;
|
|
||||||
entry.Rank = element.Rank;
|
|
||||||
} else {
|
|
||||||
inventory.EvolutionProgress!.push({
|
|
||||||
Progress: 0,
|
|
||||||
Rank: element.Rank,
|
|
||||||
ItemType: element.ItemType
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await inventory.save();
|
|
||||||
res.end();
|
|
||||||
};
|
|
||||||
|
|
||||||
type ISetEvolutionProgressRequest = {
|
|
||||||
ItemType: string;
|
|
||||||
Rank: number;
|
|
||||||
}[];
|
|
@ -18,76 +18,64 @@ import {
|
|||||||
ITypeXPItem
|
ITypeXPItem
|
||||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { catBreadHash, getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { catBreadHash } from "@/src/helpers/stringHelpers";
|
||||||
import { ExportCustoms, ExportDojoRecipes } from "warframe-public-export-plus";
|
import { ExportCustoms, ExportDojoRecipes } from "warframe-public-export-plus";
|
||||||
import { IStatsClient } from "@/src/types/statTypes";
|
import { IStatsClient } from "@/src/types/statTypes";
|
||||||
import { toStoreItem } from "@/src/services/itemDataService";
|
import { toStoreItem } from "@/src/services/itemDataService";
|
||||||
import { FlattenMaps } from "mongoose";
|
|
||||||
|
|
||||||
const getProfileViewingDataByPlayerIdImpl = async (playerId: string): Promise<IProfileViewingData | undefined> => {
|
export const getProfileViewingDataController: RequestHandler = async (req, res) => {
|
||||||
const account = await Account.findById(playerId, "DisplayName");
|
|
||||||
if (!account) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const inventory = (await Inventory.findOne({ accountOwnerId: account._id }))!;
|
|
||||||
|
|
||||||
const result: IPlayerProfileViewingDataResult = {
|
|
||||||
AccountId: toOid(account._id),
|
|
||||||
DisplayName: account.DisplayName,
|
|
||||||
PlayerLevel: inventory.PlayerLevel,
|
|
||||||
LoadOutInventory: {
|
|
||||||
WeaponSkins: [],
|
|
||||||
XPInfo: inventory.XPInfo
|
|
||||||
},
|
|
||||||
PlayerSkills: inventory.PlayerSkills,
|
|
||||||
ChallengeProgress: inventory.ChallengeProgress,
|
|
||||||
DeathMarks: inventory.DeathMarks,
|
|
||||||
Harvestable: inventory.Harvestable,
|
|
||||||
DeathSquadable: inventory.DeathSquadable,
|
|
||||||
Created: toMongoDate(inventory.Created),
|
|
||||||
MigratedToConsole: false,
|
|
||||||
Missions: inventory.Missions,
|
|
||||||
Affiliations: inventory.Affiliations,
|
|
||||||
DailyFocus: inventory.DailyFocus,
|
|
||||||
Wishlist: inventory.Wishlist,
|
|
||||||
Alignment: inventory.Alignment
|
|
||||||
};
|
|
||||||
await populateLoadout(inventory, result);
|
|
||||||
if (inventory.GuildId) {
|
|
||||||
const guild = (await Guild.findById(inventory.GuildId, "Name Tier XP Class Emblem"))!;
|
|
||||||
populateGuild(guild, result);
|
|
||||||
}
|
|
||||||
for (const key of allDailyAffiliationKeys) {
|
|
||||||
result[key] = inventory[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
const stats = (await Stats.findOne({ accountOwnerId: account._id }))!.toJSON<Partial<TStatsDatabaseDocument>>();
|
|
||||||
delete stats._id;
|
|
||||||
delete stats.__v;
|
|
||||||
delete stats.accountOwnerId;
|
|
||||||
|
|
||||||
return {
|
|
||||||
Results: [result],
|
|
||||||
TechProjects: [],
|
|
||||||
XpComponents: [],
|
|
||||||
//XpCacheExpiryDate, some IMongoDate in the future, no clue what it's for
|
|
||||||
Stats: stats
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getProfileViewingDataGetController: RequestHandler = async (req, res) => {
|
|
||||||
if (req.query.playerId) {
|
if (req.query.playerId) {
|
||||||
const data = await getProfileViewingDataByPlayerIdImpl(req.query.playerId as string);
|
const account = await Account.findById(req.query.playerId as string, "DisplayName");
|
||||||
if (data) {
|
if (!account) {
|
||||||
res.json(data);
|
|
||||||
} else {
|
|
||||||
res.status(409).send("Could not find requested account");
|
res.status(409).send("Could not find requested account");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
const inventory = (await Inventory.findOne({ accountOwnerId: account._id }))!;
|
||||||
|
|
||||||
|
const result: IPlayerProfileViewingDataResult = {
|
||||||
|
AccountId: toOid(account._id),
|
||||||
|
DisplayName: account.DisplayName,
|
||||||
|
PlayerLevel: inventory.PlayerLevel,
|
||||||
|
LoadOutInventory: {
|
||||||
|
WeaponSkins: [],
|
||||||
|
XPInfo: inventory.XPInfo
|
||||||
|
},
|
||||||
|
PlayerSkills: inventory.PlayerSkills,
|
||||||
|
ChallengeProgress: inventory.ChallengeProgress,
|
||||||
|
DeathMarks: inventory.DeathMarks,
|
||||||
|
Harvestable: inventory.Harvestable,
|
||||||
|
DeathSquadable: inventory.DeathSquadable,
|
||||||
|
Created: toMongoDate(inventory.Created),
|
||||||
|
MigratedToConsole: false,
|
||||||
|
Missions: inventory.Missions,
|
||||||
|
Affiliations: inventory.Affiliations,
|
||||||
|
DailyFocus: inventory.DailyFocus,
|
||||||
|
Wishlist: inventory.Wishlist,
|
||||||
|
Alignment: inventory.Alignment
|
||||||
|
};
|
||||||
|
await populateLoadout(inventory, result);
|
||||||
|
if (inventory.GuildId) {
|
||||||
|
const guild = (await Guild.findById(inventory.GuildId, "Name Tier XP Class Emblem"))!;
|
||||||
|
populateGuild(guild, result);
|
||||||
|
}
|
||||||
|
for (const key of allDailyAffiliationKeys) {
|
||||||
|
result[key] = inventory[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
const stats = (await Stats.findOne({ accountOwnerId: account._id }))!.toJSON<Partial<TStatsDatabaseDocument>>();
|
||||||
|
delete stats._id;
|
||||||
|
delete stats.__v;
|
||||||
|
delete stats.accountOwnerId;
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
Results: [result],
|
||||||
|
TechProjects: [],
|
||||||
|
XpComponents: [],
|
||||||
|
//XpCacheExpiryDate, some IMongoDate in the future, no clue what it's for
|
||||||
|
Stats: stats
|
||||||
|
});
|
||||||
} else if (req.query.guildId) {
|
} else if (req.query.guildId) {
|
||||||
const guild = await Guild.findById(
|
const guild = await Guild.findById(req.query.guildId, "Name Tier XP Class Emblem TechProjects ClaimedXP");
|
||||||
req.query.guildId as string,
|
|
||||||
"Name Tier XP Class Emblem TechProjects ClaimedXP"
|
|
||||||
);
|
|
||||||
if (!guild) {
|
if (!guild) {
|
||||||
res.status(409).send("Could not find guild");
|
res.status(409).send("Could not find guild");
|
||||||
return;
|
return;
|
||||||
@ -182,28 +170,6 @@ export const getProfileViewingDataGetController: RequestHandler = async (req, re
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// For old versions, this was an authenticated POST request.
|
|
||||||
interface IGetProfileViewingDataRequest {
|
|
||||||
AccountId: string;
|
|
||||||
}
|
|
||||||
export const getProfileViewingDataPostController: RequestHandler = async (req, res) => {
|
|
||||||
const payload = getJSONfromString<IGetProfileViewingDataRequest>(String(req.body));
|
|
||||||
const data = await getProfileViewingDataByPlayerIdImpl(payload.AccountId);
|
|
||||||
if (data) {
|
|
||||||
res.json(data);
|
|
||||||
} else {
|
|
||||||
res.status(409).send("Could not find requested account");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IProfileViewingData {
|
|
||||||
Results: IPlayerProfileViewingDataResult[];
|
|
||||||
TechProjects: [];
|
|
||||||
XpComponents: [];
|
|
||||||
//XpCacheExpiryDate, some IMongoDate in the future, no clue what it's for
|
|
||||||
Stats: FlattenMaps<Partial<TStatsDatabaseDocument>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IPlayerProfileViewingDataResult extends Partial<IDailyAffiliations> {
|
interface IPlayerProfileViewingDataResult extends Partial<IDailyAffiliations> {
|
||||||
AccountId: IOid;
|
AccountId: IOid;
|
||||||
DisplayName: string;
|
DisplayName: string;
|
||||||
|
@ -27,15 +27,7 @@ const viewController: RequestHandler = async (req, res) => {
|
|||||||
for (const type of Object.keys(ExportEnemies.avatars)) {
|
for (const type of Object.keys(ExportEnemies.avatars)) {
|
||||||
if (!scans.has(type)) scans.add(type);
|
if (!scans.has(type)) scans.add(type);
|
||||||
}
|
}
|
||||||
|
responseJson.Scans ??= [];
|
||||||
// Take any existing scans and also set them to 9999
|
|
||||||
if (responseJson.Scans) {
|
|
||||||
for (const scan of responseJson.Scans) {
|
|
||||||
scans.add(scan.type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
responseJson.Scans = [];
|
|
||||||
|
|
||||||
for (const type of scans) {
|
for (const type of scans) {
|
||||||
responseJson.Scans.push({ type: type, scans: 9999 });
|
responseJson.Scans.push({ type: type, scans: 9999 });
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,7 @@ const toDatabaseAccount = (createAccount: IAccountCreation): IDatabaseAccountReq
|
|||||||
CrossPlatformAllowed: true,
|
CrossPlatformAllowed: true,
|
||||||
ForceLogoutVersion: 0,
|
ForceLogoutVersion: 0,
|
||||||
TrackedSettings: [],
|
TrackedSettings: [],
|
||||||
Nonce: 0,
|
Nonce: 0
|
||||||
LastLogin: new Date()
|
|
||||||
} satisfies IDatabaseAccountRequiredFields;
|
} satisfies IDatabaseAccountRequiredFields;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,56 +1,15 @@
|
|||||||
import { IMongoDate, IOid, IOidWithLegacySupport } from "@/src/types/commonTypes";
|
import { IMongoDate, IOid } from "@/src/types/commonTypes";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { TRarity } from "warframe-public-export-plus";
|
import { TRarity } from "warframe-public-export-plus";
|
||||||
|
|
||||||
export const version_compare = (a: string, b: string): number => {
|
|
||||||
const a_digits = a
|
|
||||||
.split("/")[0]
|
|
||||||
.split(".")
|
|
||||||
.map(x => parseInt(x));
|
|
||||||
const b_digits = b
|
|
||||||
.split("/")[0]
|
|
||||||
.split(".")
|
|
||||||
.map(x => parseInt(x));
|
|
||||||
for (let i = 0; i != a_digits.length; ++i) {
|
|
||||||
if (a_digits[i] != b_digits[i]) {
|
|
||||||
return a_digits[i] > b_digits[i] ? 1 : -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const toOid = (objectId: Types.ObjectId): IOid => {
|
export const toOid = (objectId: Types.ObjectId): IOid => {
|
||||||
return { $oid: objectId.toString() };
|
return { $oid: objectId.toString() } satisfies IOid;
|
||||||
};
|
|
||||||
|
|
||||||
export function toOid2(objectId: Types.ObjectId, buildLabel: undefined): IOid;
|
|
||||||
export function toOid2(objectId: Types.ObjectId, buildLabel: string | undefined): IOidWithLegacySupport;
|
|
||||||
export function toOid2(objectId: Types.ObjectId, buildLabel: string | undefined): IOidWithLegacySupport {
|
|
||||||
if (buildLabel && version_compare(buildLabel, "2016.12.21.19.13") <= 0) {
|
|
||||||
return { $id: objectId.toString() };
|
|
||||||
}
|
|
||||||
return { $oid: objectId.toString() };
|
|
||||||
}
|
|
||||||
|
|
||||||
export const toLegacyOid = (oid: IOidWithLegacySupport): void => {
|
|
||||||
if (!("$id" in oid)) {
|
|
||||||
oid.$id = oid.$oid;
|
|
||||||
delete oid.$oid;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const fromOid = (oid: IOidWithLegacySupport): string => {
|
|
||||||
return (oid.$oid ?? oid.$id)!;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const toMongoDate = (date: Date): IMongoDate => {
|
export const toMongoDate = (date: Date): IMongoDate => {
|
||||||
return { $date: { $numberLong: date.getTime().toString() } };
|
return { $date: { $numberLong: date.getTime().toString() } };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fromMongoDate = (date: IMongoDate): Date => {
|
|
||||||
return new Date(parseInt(date.$date.$numberLong));
|
|
||||||
};
|
|
||||||
|
|
||||||
export const kubrowWeights: Record<TRarity, number> = {
|
export const kubrowWeights: Record<TRarity, number> = {
|
||||||
COMMON: 6,
|
COMMON: 6,
|
||||||
UNCOMMON: 4,
|
UNCOMMON: 4,
|
||||||
|
@ -1,203 +1,15 @@
|
|||||||
import { ExportRegions, ExportWarframes } from "warframe-public-export-plus";
|
import { ExportRegions } from "warframe-public-export-plus";
|
||||||
import { IInfNode, TNemesisFaction } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IInfNode } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { getRewardAtPercentage, SRng } from "@/src/services/rngService";
|
import { SRng } from "@/src/services/rngService";
|
||||||
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
||||||
import { logger } from "../utils/logger";
|
import { logger } from "../utils/logger";
|
||||||
import { IOid } from "../types/commonTypes";
|
import { IOid } from "../types/commonTypes";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { addMods, generateRewardSeed } from "../services/inventoryService";
|
import { addMods } from "../services/inventoryService";
|
||||||
import { isArchwingMission } from "../services/worldStateService";
|
|
||||||
|
|
||||||
type TInnateDamageTag =
|
export const getInfNodes = (faction: string, rank: number): IInfNode[] => {
|
||||||
| "InnateElectricityDamage"
|
|
||||||
| "InnateHeatDamage"
|
|
||||||
| "InnateFreezeDamage"
|
|
||||||
| "InnateToxinDamage"
|
|
||||||
| "InnateMagDamage"
|
|
||||||
| "InnateRadDamage"
|
|
||||||
| "InnateImpactDamage";
|
|
||||||
|
|
||||||
export interface INemesisManifest {
|
|
||||||
weapons: readonly string[];
|
|
||||||
systemIndexes: readonly number[];
|
|
||||||
showdownNode: string;
|
|
||||||
ephemeraChance: number;
|
|
||||||
ephemeraTypes?: Record<TInnateDamageTag, string>;
|
|
||||||
firstKillReward: string;
|
|
||||||
firstConvertReward: string;
|
|
||||||
messageTitle: string;
|
|
||||||
messageBody: string;
|
|
||||||
minBuild: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
class KuvaLichManifest implements INemesisManifest {
|
|
||||||
weapons = [
|
|
||||||
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Drakgoon/KuvaDrakgoon",
|
|
||||||
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Karak/KuvaKarak",
|
|
||||||
"/Lotus/Weapons/Grineer/Melee/GrnKuvaLichScythe/GrnKuvaLichScytheWeapon",
|
|
||||||
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Kohm/KuvaKohm",
|
|
||||||
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Ogris/KuvaOgris",
|
|
||||||
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Quartakk/KuvaQuartakk",
|
|
||||||
"/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Tonkor/KuvaTonkor",
|
|
||||||
"/Lotus/Weapons/Grineer/KuvaLich/Secondaries/Brakk/KuvaBrakk",
|
|
||||||
"/Lotus/Weapons/Grineer/KuvaLich/Secondaries/Kraken/KuvaKraken",
|
|
||||||
"/Lotus/Weapons/Grineer/KuvaLich/Secondaries/Seer/KuvaSeer",
|
|
||||||
"/Lotus/Weapons/Grineer/KuvaLich/Secondaries/Stubba/KuvaStubba",
|
|
||||||
"/Lotus/Weapons/Grineer/HeavyWeapons/GrnHeavyGrenadeLauncher",
|
|
||||||
"/Lotus/Weapons/Grineer/LongGuns/GrnKuvaLichRifle/GrnKuvaLichRifleWeapon"
|
|
||||||
];
|
|
||||||
systemIndexes = [2, 3, 9, 11, 18];
|
|
||||||
showdownNode = "CrewBattleNode557";
|
|
||||||
ephemeraChance = 0.05;
|
|
||||||
ephemeraTypes = {
|
|
||||||
InnateElectricityDamage: "/Lotus/Upgrades/Skins/Effects/Kuva/KuvaLightningEphemera",
|
|
||||||
InnateHeatDamage: "/Lotus/Upgrades/Skins/Effects/Kuva/KuvaFireEphemera",
|
|
||||||
InnateFreezeDamage: "/Lotus/Upgrades/Skins/Effects/Kuva/KuvaIceEphemera",
|
|
||||||
InnateToxinDamage: "/Lotus/Upgrades/Skins/Effects/Kuva/KuvaToxinEphemera",
|
|
||||||
InnateMagDamage: "/Lotus/Upgrades/Skins/Effects/Kuva/KuvaMagneticEphemera",
|
|
||||||
InnateRadDamage: "/Lotus/Upgrades/Skins/Effects/Kuva/KuvaTricksterEphemera",
|
|
||||||
InnateImpactDamage: "/Lotus/Upgrades/Skins/Effects/Kuva/KuvaImpactEphemera"
|
|
||||||
};
|
|
||||||
firstKillReward = "/Lotus/StoreItems/Upgrades/Skins/Clan/LichKillerBadgeItem";
|
|
||||||
firstConvertReward = "/Lotus/StoreItems/Upgrades/Skins/Sigils/KuvaLichSigil";
|
|
||||||
messageTitle = "/Lotus/Language/Inbox/VanquishKuvaMsgTitle";
|
|
||||||
messageBody = "/Lotus/Language/Inbox/VanquishLichMsgBody";
|
|
||||||
minBuild = "2019.10.31.22.42"; // 26.0.0
|
|
||||||
}
|
|
||||||
|
|
||||||
class KuvaLichManifestVersionTwo extends KuvaLichManifest {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.ephemeraChance = 0.1;
|
|
||||||
this.minBuild = "2020.03.05.16.06"; // Unsure about this one, so using the same value as in version three.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class KuvaLichManifestVersionThree extends KuvaLichManifestVersionTwo {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.weapons.push("/Lotus/Weapons/Grineer/Bows/GrnBow/GrnBowWeapon");
|
|
||||||
this.weapons.push("/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Hind/KuvaHind");
|
|
||||||
this.weapons.push("/Lotus/Weapons/Grineer/KuvaLich/Secondaries/Nukor/KuvaNukor");
|
|
||||||
this.ephemeraChance = 0.2;
|
|
||||||
this.minBuild = "2020.03.05.16.06"; // This is 27.2.0, tho 27.1.0 should also recognise this.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class KuvaLichManifestVersionFour extends KuvaLichManifestVersionThree {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.minBuild = "2021.07.05.17.03"; // Unsure about this one, so using the same value as in version five.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class KuvaLichManifestVersionFive extends KuvaLichManifestVersionFour {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.weapons.push("/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Hek/KuvaHekWeapon");
|
|
||||||
this.weapons.push("/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Zarr/KuvaZarr");
|
|
||||||
this.weapons.push("/Lotus/Weapons/Grineer/KuvaLich/HeavyWeapons/Grattler/KuvaGrattler");
|
|
||||||
this.minBuild = "2021.07.05.17.03"; // 30.5.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class KuvaLichManifestVersionSix extends KuvaLichManifestVersionFive {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.weapons.push("/Lotus/Weapons/Grineer/KuvaLich/LongGuns/Sobek/KuvaSobek");
|
|
||||||
this.minBuild = "2024.05.15.11.07"; // 35.6.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LawyerManifest implements INemesisManifest {
|
|
||||||
weapons = [
|
|
||||||
"/Lotus/Weapons/Corpus/LongGuns/CrpBriefcaseLauncher/CrpBriefcaseLauncher",
|
|
||||||
"/Lotus/Weapons/Corpus/BoardExec/Primary/CrpBEArcaPlasmor/CrpBEArcaPlasmor",
|
|
||||||
"/Lotus/Weapons/Corpus/BoardExec/Primary/CrpBEFluxRifle/CrpBEFluxRifle",
|
|
||||||
"/Lotus/Weapons/Corpus/BoardExec/Primary/CrpBETetra/CrpBETetra",
|
|
||||||
"/Lotus/Weapons/Corpus/BoardExec/Secondary/CrpBECycron/CrpBECycron",
|
|
||||||
"/Lotus/Weapons/Corpus/BoardExec/Secondary/CrpBEDetron/CrpBEDetron",
|
|
||||||
"/Lotus/Weapons/Corpus/Pistols/CrpIgniterPistol/CrpIgniterPistol",
|
|
||||||
"/Lotus/Weapons/Corpus/Pistols/CrpBriefcaseAkimbo/CrpBriefcaseAkimboPistol"
|
|
||||||
];
|
|
||||||
systemIndexes = [1, 15, 4, 7, 8];
|
|
||||||
showdownNode = "CrewBattleNode558";
|
|
||||||
ephemeraChance = 0.2;
|
|
||||||
ephemeraTypes = {
|
|
||||||
InnateElectricityDamage: "/Lotus/Upgrades/Skins/Effects/CorpusLichEphemeraA",
|
|
||||||
InnateHeatDamage: "/Lotus/Upgrades/Skins/Effects/CorpusLichEphemeraB",
|
|
||||||
InnateFreezeDamage: "/Lotus/Upgrades/Skins/Effects/CorpusLichEphemeraC",
|
|
||||||
InnateToxinDamage: "/Lotus/Upgrades/Skins/Effects/CorpusLichEphemeraD",
|
|
||||||
InnateMagDamage: "/Lotus/Upgrades/Skins/Effects/CorpusLichEphemeraE",
|
|
||||||
InnateRadDamage: "/Lotus/Upgrades/Skins/Effects/CorpusLichEphemeraF",
|
|
||||||
InnateImpactDamage: "/Lotus/Upgrades/Skins/Effects/CorpusLichEphemeraG"
|
|
||||||
};
|
|
||||||
firstKillReward = "/Lotus/StoreItems/Upgrades/Skins/Clan/CorpusLichBadgeItem";
|
|
||||||
firstConvertReward = "/Lotus/StoreItems/Upgrades/Skins/Sigils/CorpusLichSigil";
|
|
||||||
messageTitle = "/Lotus/Language/Inbox/VanquishLawyerMsgTitle";
|
|
||||||
messageBody = "/Lotus/Language/Inbox/VanquishLichMsgBody";
|
|
||||||
minBuild = "2021.07.05.17.03"; // 30.5.0
|
|
||||||
}
|
|
||||||
|
|
||||||
class LawyerManifestVersionTwo extends LawyerManifest {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.weapons.push("/Lotus/Weapons/Corpus/BoardExec/Secondary/CrpBEPlinx/CrpBEPlinxWeapon");
|
|
||||||
this.minBuild = "2022.11.30.08.13"; // 32.2.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LawyerManifestVersionThree extends LawyerManifestVersionTwo {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.weapons.push("/Lotus/Weapons/Corpus/BoardExec/Primary/CrpBEGlaxion/CrpBEGlaxion");
|
|
||||||
this.minBuild = "2024.05.15.11.07"; // 35.6.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LawyerManifestVersionFour extends LawyerManifestVersionThree {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.minBuild = "2024.10.01.11.03"; // 37.0.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class InfestedLichManfest implements INemesisManifest {
|
|
||||||
weapons = [];
|
|
||||||
systemIndexes = [23];
|
|
||||||
showdownNode = "CrewBattleNode559";
|
|
||||||
ephemeraChance = 0;
|
|
||||||
firstKillReward = "/Lotus/StoreItems/Upgrades/Skins/Sigils/InfLichVanquishedSigil";
|
|
||||||
firstConvertReward = "/Lotus/StoreItems/Upgrades/Skins/Sigils/InfLichConvertedSigil";
|
|
||||||
messageTitle = "/Lotus/Language/Inbox/VanquishBandMsgTitle";
|
|
||||||
messageBody = "/Lotus/Language/Inbox/VanquishBandMsgBody";
|
|
||||||
minBuild = "2025.03.18.09.51"; // 38.5.0
|
|
||||||
}
|
|
||||||
|
|
||||||
const nemesisManifests: Record<string, INemesisManifest> = {
|
|
||||||
"/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifest": new KuvaLichManifest(),
|
|
||||||
"/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifestVersionTwo": new KuvaLichManifestVersionTwo(),
|
|
||||||
"/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifestVersionThree": new KuvaLichManifestVersionThree(),
|
|
||||||
"/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifestVersionFour": new KuvaLichManifestVersionFour(),
|
|
||||||
"/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifestVersionFive": new KuvaLichManifestVersionFive(),
|
|
||||||
"/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifestVersionSix": new KuvaLichManifestVersionSix(),
|
|
||||||
"/Lotus/Types/Enemies/Corpus/Lawyers/LawyerManifest": new LawyerManifest(),
|
|
||||||
"/Lotus/Types/Enemies/Corpus/Lawyers/LawyerManifestVersionTwo": new LawyerManifestVersionTwo(),
|
|
||||||
"/Lotus/Types/Enemies/Corpus/Lawyers/LawyerManifestVersionThree": new LawyerManifestVersionThree(),
|
|
||||||
"/Lotus/Types/Enemies/Corpus/Lawyers/LawyerManifestVersionFour": new LawyerManifestVersionFour(),
|
|
||||||
"/Lotus/Types/Enemies/InfestedLich/InfestedLichManifest": new InfestedLichManfest()
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getNemesisManifest = (manifest: string): INemesisManifest => {
|
|
||||||
if (manifest in nemesisManifests) {
|
|
||||||
return nemesisManifests[manifest];
|
|
||||||
}
|
|
||||||
throw new Error(`unknown nemesis manifest: ${manifest}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getInfNodes = (manifest: INemesisManifest, rank: number): IInfNode[] => {
|
|
||||||
const infNodes = [];
|
const infNodes = [];
|
||||||
const systemIndex = manifest.systemIndexes[rank];
|
const systemIndex = systemIndexes[faction][rank];
|
||||||
for (const [key, value] of Object.entries(ExportRegions)) {
|
for (const [key, value] of Object.entries(ExportRegions)) {
|
||||||
if (
|
if (
|
||||||
value.systemIndex === systemIndex &&
|
value.systemIndex === systemIndex &&
|
||||||
@ -210,7 +22,7 @@ export const getInfNodes = (manifest: INemesisManifest, rank: number): IInfNode[
|
|||||||
value.missionIndex != 42 && // not face off
|
value.missionIndex != 42 && // not face off
|
||||||
value.name.indexOf("1999NodeI") == -1 && // not stage defence
|
value.name.indexOf("1999NodeI") == -1 && // not stage defence
|
||||||
value.name.indexOf("1999NodeJ") == -1 && // not lich bounty
|
value.name.indexOf("1999NodeJ") == -1 && // not lich bounty
|
||||||
!isArchwingMission(value)
|
value.name.indexOf("Archwing") == -1
|
||||||
) {
|
) {
|
||||||
//console.log(dict_en[value.name]);
|
//console.log(dict_en[value.name]);
|
||||||
infNodes.push({ Node: key, Influence: 1 });
|
infNodes.push({ Node: key, Influence: 1 });
|
||||||
@ -219,51 +31,21 @@ export const getInfNodes = (manifest: INemesisManifest, rank: number): IInfNode[
|
|||||||
return infNodes;
|
return infNodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get a parazon 'passcode' based on the nemesis fingerprint so it's always the same for the same nemesis.
|
const systemIndexes: Record<string, number[]> = {
|
||||||
export const getNemesisPasscode = (nemesis: { fp: bigint; Faction: TNemesisFaction }): number[] => {
|
FC_GRINEER: [2, 3, 9, 11, 18],
|
||||||
const rng = new SRng(nemesis.fp);
|
FC_CORPUS: [1, 15, 4, 7, 8],
|
||||||
const choices = [0, 1, 2, 3, 5, 6, 7];
|
FC_INFESTATION: [23]
|
||||||
let choiceIndex = rng.randomInt(0, choices.length - 1);
|
|
||||||
const passcode = [choices[choiceIndex]];
|
|
||||||
if (nemesis.Faction != "FC_INFESTATION") {
|
|
||||||
choices.splice(choiceIndex, 1);
|
|
||||||
choiceIndex = rng.randomInt(0, choices.length - 1);
|
|
||||||
passcode.push(choices[choiceIndex]);
|
|
||||||
|
|
||||||
choices.splice(choiceIndex, 1);
|
|
||||||
choiceIndex = rng.randomInt(0, choices.length - 1);
|
|
||||||
passcode.push(choices[choiceIndex]);
|
|
||||||
}
|
|
||||||
return passcode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const reqiuemMods: readonly string[] = [
|
// Get a parazon 'passcode' based on the nemesis fingerprint so it's always the same for the same nemesis.
|
||||||
"/Lotus/Upgrades/Mods/Immortal/ImmortalOneMod",
|
export const getNemesisPasscode = (nemesis: { fp: bigint; Faction: string }): number[] => {
|
||||||
"/Lotus/Upgrades/Mods/Immortal/ImmortalTwoMod",
|
const rng = new SRng(nemesis.fp);
|
||||||
"/Lotus/Upgrades/Mods/Immortal/ImmortalThreeMod",
|
const passcode = [rng.randomInt(0, 7)];
|
||||||
"/Lotus/Upgrades/Mods/Immortal/ImmortalFourMod",
|
if (nemesis.Faction != "FC_INFESTATION") {
|
||||||
"/Lotus/Upgrades/Mods/Immortal/ImmortalFiveMod",
|
passcode.push(rng.randomInt(0, 7));
|
||||||
"/Lotus/Upgrades/Mods/Immortal/ImmortalSixMod",
|
passcode.push(rng.randomInt(0, 7));
|
||||||
"/Lotus/Upgrades/Mods/Immortal/ImmortalSevenMod",
|
}
|
||||||
"/Lotus/Upgrades/Mods/Immortal/ImmortalEightMod"
|
return passcode;
|
||||||
];
|
|
||||||
|
|
||||||
const antivirusMods: readonly string[] = [
|
|
||||||
"/Lotus/Upgrades/Mods/Immortal/AntivirusOneMod",
|
|
||||||
"/Lotus/Upgrades/Mods/Immortal/AntivirusTwoMod",
|
|
||||||
"/Lotus/Upgrades/Mods/Immortal/AntivirusThreeMod",
|
|
||||||
"/Lotus/Upgrades/Mods/Immortal/AntivirusFourMod",
|
|
||||||
"/Lotus/Upgrades/Mods/Immortal/AntivirusFiveMod",
|
|
||||||
"/Lotus/Upgrades/Mods/Immortal/AntivirusSixMod",
|
|
||||||
"/Lotus/Upgrades/Mods/Immortal/AntivirusSevenMod",
|
|
||||||
"/Lotus/Upgrades/Mods/Immortal/AntivirusEightMod"
|
|
||||||
];
|
|
||||||
|
|
||||||
export const getNemesisPasscodeModTypes = (nemesis: { fp: bigint; Faction: TNemesisFaction }): string[] => {
|
|
||||||
const passcode = getNemesisPasscode(nemesis);
|
|
||||||
return nemesis.Faction == "FC_INFESTATION"
|
|
||||||
? passcode.map(i => antivirusMods[i])
|
|
||||||
: passcode.map(i => reqiuemMods[i]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const encodeNemesisGuess = (
|
export const encodeNemesisGuess = (
|
||||||
@ -296,31 +78,6 @@ export interface IKnifeResponse {
|
|||||||
HasKnife?: boolean;
|
HasKnife?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getKnifeUpgrade = (
|
|
||||||
inventory: TInventoryDatabaseDocument,
|
|
||||||
dataknifeUpgrades: string[],
|
|
||||||
type: string
|
|
||||||
): { ItemId: IOid; ItemType: string } => {
|
|
||||||
if (dataknifeUpgrades.indexOf(type) != -1) {
|
|
||||||
return {
|
|
||||||
ItemId: { $oid: "000000000000000000000000" },
|
|
||||||
ItemType: type
|
|
||||||
};
|
|
||||||
}
|
|
||||||
for (const upgradeId of dataknifeUpgrades) {
|
|
||||||
if (upgradeId.length == 24) {
|
|
||||||
const upgrade = inventory.Upgrades.id(upgradeId);
|
|
||||||
if (upgrade && upgrade.ItemType == type) {
|
|
||||||
return {
|
|
||||||
ItemId: { $oid: upgradeId },
|
|
||||||
ItemType: type
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new Error(`${type} does not seem to be installed on parazon?!`);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const consumeModCharge = (
|
export const consumeModCharge = (
|
||||||
response: IKnifeResponse,
|
response: IKnifeResponse,
|
||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
@ -371,121 +128,3 @@ export const consumeModCharge = (
|
|||||||
response.UpgradeNew.push(true);
|
response.UpgradeNew.push(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getInnateDamageTag = (KillingSuit: string): TInnateDamageTag => {
|
|
||||||
return ExportWarframes[KillingSuit].nemesisUpgradeTag!;
|
|
||||||
};
|
|
||||||
|
|
||||||
const petHeads = [
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartHeadA",
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartHeadB",
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartHeadC"
|
|
||||||
] as const;
|
|
||||||
|
|
||||||
export interface INemesisProfile {
|
|
||||||
innateDamageTag: TInnateDamageTag;
|
|
||||||
innateDamageValue: number;
|
|
||||||
ephemera?: string;
|
|
||||||
petHead?: (typeof petHeads)[number];
|
|
||||||
petBody?: string;
|
|
||||||
petLegs?: string;
|
|
||||||
petTail?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const generateNemesisProfile = (
|
|
||||||
fp: bigint = generateRewardSeed(),
|
|
||||||
manifest: INemesisManifest = new LawyerManifest(),
|
|
||||||
killingSuit: string = "/Lotus/Powersuits/Ember/Ember"
|
|
||||||
): INemesisProfile => {
|
|
||||||
const rng = new SRng(fp);
|
|
||||||
rng.randomFloat(); // used for the weapon index
|
|
||||||
const WeaponUpgradeValueAttenuationExponent = 2.25;
|
|
||||||
let value = Math.pow(rng.randomFloat(), WeaponUpgradeValueAttenuationExponent);
|
|
||||||
if (value >= 0.941428) {
|
|
||||||
value = 1;
|
|
||||||
}
|
|
||||||
const profile: INemesisProfile = {
|
|
||||||
innateDamageTag: getInnateDamageTag(killingSuit),
|
|
||||||
innateDamageValue: Math.trunc(value * 0x40000000) // TODO: For -1399275245665749231n, the value should be 75306944, but we're off by 59 with 75307003.
|
|
||||||
};
|
|
||||||
if (rng.randomFloat() <= manifest.ephemeraChance && manifest.ephemeraTypes) {
|
|
||||||
profile.ephemera = manifest.ephemeraTypes[profile.innateDamageTag];
|
|
||||||
}
|
|
||||||
rng.randomFloat(); // something related to sentinel agent maybe
|
|
||||||
if (manifest instanceof LawyerManifest) {
|
|
||||||
profile.petHead = rng.randomElement(petHeads)!;
|
|
||||||
profile.petBody = rng.randomElement([
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartBodyA",
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartBodyB",
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartBodyC"
|
|
||||||
])!;
|
|
||||||
profile.petLegs = rng.randomElement([
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartLegsA",
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartLegsB",
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartLegsC"
|
|
||||||
])!;
|
|
||||||
profile.petTail = rng.randomElement([
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartTailA",
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartTailB",
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartTailC"
|
|
||||||
])!;
|
|
||||||
}
|
|
||||||
return profile;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getKillTokenRewardCount = (fp: bigint): number => {
|
|
||||||
const rng = new SRng(fp);
|
|
||||||
return rng.randomInt(10, 15);
|
|
||||||
};
|
|
||||||
|
|
||||||
// /Lotus/Types/Enemies/InfestedLich/InfestedLichRewardManifest
|
|
||||||
const infestedLichRotA = [
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/Plushies/PlushyDJRomHuman", probability: 0.046 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/Plushies/PlushyDJRomInfested", probability: 0.045 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/Plushies/PlushyDrillbitHuman", probability: 0.046 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/Plushies/PlushyDrillbitInfested", probability: 0.045 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/Plushies/PlushyHarddriveHuman", probability: 0.046 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/Plushies/PlushyHarddriveInfested", probability: 0.045 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/Plushies/PlushyPacketHuman", probability: 0.046 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/Plushies/PlushyPacketInfested", probability: 0.045 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/Plushies/PlushyZekeHuman", probability: 0.046 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/Plushies/PlushyZekeInfested", probability: 0.045 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandBillboardPosterA", probability: 0.045 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandBillboardPosterB", probability: 0.046 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandDespairPoster", probability: 0.045 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandGridPoster", probability: 0.046 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandHuddlePoster", probability: 0.045 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandJumpPoster", probability: 0.046 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandLimoPoster", probability: 0.045 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandLookingDownPosterDay", probability: 0.046 },
|
|
||||||
{
|
|
||||||
type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandLookingDownPosterNight",
|
|
||||||
probability: 0.045
|
|
||||||
},
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandSillyPoster", probability: 0.046 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandWhiteBluePoster", probability: 0.045 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/ShipDecos/BoybandPosters/BoybandWhitePinkPoster", probability: 0.045 }
|
|
||||||
];
|
|
||||||
const infestedLichRotB = [
|
|
||||||
{ type: "/Lotus/StoreItems/Upgrades/Skins/Effects/InfestedLichEphemeraA", probability: 0.072 },
|
|
||||||
{ type: "/Lotus/StoreItems/Upgrades/Skins/Effects/InfestedLichEphemeraB", probability: 0.071 },
|
|
||||||
{ type: "/Lotus/StoreItems/Upgrades/Skins/Effects/InfestedLichEphemeraC", probability: 0.072 },
|
|
||||||
{ type: "/Lotus/StoreItems/Upgrades/Skins/Effects/InfestedLichEphemeraD", probability: 0.071 },
|
|
||||||
{ type: "/Lotus/StoreItems/Upgrades/Skins/Effects/InfestedLichEphemeraE", probability: 0.072 },
|
|
||||||
{ type: "/Lotus/StoreItems/Upgrades/Skins/Effects/InfestedLichEphemeraF", probability: 0.071 },
|
|
||||||
{ type: "/Lotus/StoreItems/Upgrades/Skins/Effects/InfestedLichEphemeraG", probability: 0.071 },
|
|
||||||
{ type: "/Lotus/StoreItems/Upgrades/Skins/Effects/InfestedLichEphemeraH", probability: 0.072 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/Emotes/DanceDJRomHype", probability: 0.071 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/Emotes/DancePacketWindmillShuffle", probability: 0.072 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/Emotes/DanceHarddrivePony", probability: 0.071 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/Emotes/DanceDrillbitCrisscross", probability: 0.072 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/Emotes/DanceZekeCanthavethis", probability: 0.071 },
|
|
||||||
{ type: "/Lotus/StoreItems/Types/Items/PhotoBooth/PhotoboothTileRJLasXStadiumBossArena", probability: 0.071 }
|
|
||||||
];
|
|
||||||
export const getInfestedLichItemRewards = (fp: bigint): string[] => {
|
|
||||||
const rng = new SRng(fp);
|
|
||||||
const rotAReward = getRewardAtPercentage(infestedLichRotA, rng.randomFloat())!.type;
|
|
||||||
rng.randomFloat(); // unused afaict
|
|
||||||
const rotBReward = getRewardAtPercentage(infestedLichRotB, rng.randomFloat())!.type;
|
|
||||||
return [rotAReward, rotBReward];
|
|
||||||
};
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
export const rootDir = path.join(__dirname, "../..");
|
export const rootDir = path.join(__dirname, "../..");
|
||||||
export const isDev = path.basename(rootDir) != "build";
|
export const repoDir = path.basename(rootDir) == "build" ? path.join(rootDir, "..") : rootDir;
|
||||||
export const repoDir = isDev ? rootDir : path.join(rootDir, "..");
|
|
||||||
|
@ -31,7 +31,7 @@ export interface IFingerprintStat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const createVeiledRivenFingerprint = (meta: IUpgrade): IVeiledRivenFingerprint => {
|
export const createVeiledRivenFingerprint = (meta: IUpgrade): IVeiledRivenFingerprint => {
|
||||||
const challenge = getRandomElement(meta.availableChallenges!)!;
|
const challenge = getRandomElement(meta.availableChallenges!);
|
||||||
const fingerprintChallenge: IRivenChallenge = {
|
const fingerprintChallenge: IRivenChallenge = {
|
||||||
Type: challenge.fullName,
|
Type: challenge.fullName,
|
||||||
Progress: 0,
|
Progress: 0,
|
||||||
@ -54,11 +54,11 @@ export const createVeiledRivenFingerprint = (meta: IUpgrade): IVeiledRivenFinger
|
|||||||
|
|
||||||
export const createUnveiledRivenFingerprint = (meta: IUpgrade): IUnveiledRivenFingerprint => {
|
export const createUnveiledRivenFingerprint = (meta: IUpgrade): IUnveiledRivenFingerprint => {
|
||||||
const fingerprint: IUnveiledRivenFingerprint = {
|
const fingerprint: IUnveiledRivenFingerprint = {
|
||||||
compat: getRandomElement(meta.compatibleItems!)!,
|
compat: getRandomElement(meta.compatibleItems!),
|
||||||
lim: 0,
|
lim: 0,
|
||||||
lvl: 0,
|
lvl: 0,
|
||||||
lvlReq: getRandomInt(8, 16),
|
lvlReq: getRandomInt(8, 16),
|
||||||
pol: getRandomElement(["AP_ATTACK", "AP_DEFENSE", "AP_TACTIC"])!,
|
pol: getRandomElement(["AP_ATTACK", "AP_DEFENSE", "AP_TACTIC"]),
|
||||||
buffs: [],
|
buffs: [],
|
||||||
curses: []
|
curses: []
|
||||||
};
|
};
|
||||||
@ -81,7 +81,7 @@ export const randomiseRivenStats = (meta: IUpgrade, fingerprint: IUnveiledRivenF
|
|||||||
if (Math.random() < 0.5) {
|
if (Math.random() < 0.5) {
|
||||||
const entry = getRandomElement(
|
const entry = getRandomElement(
|
||||||
meta.upgradeEntries!.filter(x => x.canBeCurse && !fingerprint.buffs.find(y => y.Tag == x.tag))
|
meta.upgradeEntries!.filter(x => x.canBeCurse && !fingerprint.buffs.find(y => y.Tag == x.tag))
|
||||||
)!;
|
);
|
||||||
fingerprint.curses.push({ Tag: entry.tag, Value: Math.trunc(Math.random() * 0x40000000) });
|
fingerprint.curses.push({ Tag: entry.tag, Value: Math.trunc(Math.random() * 0x40000000) });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@ import { JSONParse } from "json-with-bigint";
|
|||||||
|
|
||||||
export const getJSONfromString = <T>(str: string): T => {
|
export const getJSONfromString = <T>(str: string): T => {
|
||||||
const jsonSubstring = str.substring(0, str.lastIndexOf("}") + 1);
|
const jsonSubstring = str.substring(0, str.lastIndexOf("}") + 1);
|
||||||
return JSONParse(jsonSubstring) as T;
|
return JSONParse<T>(jsonSubstring);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSubstringFromKeyword = (str: string, keyword: string): string => {
|
export const getSubstringFromKeyword = (str: string, keyword: string): string => {
|
||||||
|
@ -17,11 +17,13 @@ import https from "https";
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import { app } from "./app";
|
import { app } from "./app";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import { JSONStringify } from "json-with-bigint";
|
import { Json, JSONStringify } from "json-with-bigint";
|
||||||
import { validateConfig } from "@/src/services/configWatcherService";
|
import { validateConfig } from "@/src/services/configWatcherService";
|
||||||
|
|
||||||
// Patch JSON.stringify to work flawlessly with Bigints.
|
// Patch JSON.stringify to work flawlessly with Bigints.
|
||||||
JSON.stringify = JSONStringify;
|
JSON.stringify = (obj: Exclude<Json, undefined>, _replacer?: unknown, space?: string | number): string => {
|
||||||
|
return JSONStringify(obj, space);
|
||||||
|
};
|
||||||
|
|
||||||
validateConfig();
|
validateConfig();
|
||||||
|
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
import { ISession, IFindSessionRequest } from "@/src/types/session";
|
import { ISession, IFindSessionRequest } from "@/src/types/session";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { JSONParse } from "json-with-bigint";
|
|
||||||
import { Types } from "mongoose";
|
|
||||||
|
|
||||||
const sessions: ISession[] = [];
|
const sessions: ISession[] = [];
|
||||||
|
|
||||||
function createNewSession(sessionData: ISession, Creator: Types.ObjectId): ISession {
|
function createNewSession(sessionData: ISession, Creator: string): ISession {
|
||||||
const sessionId = new Types.ObjectId();
|
const sessionId = getNewSessionID();
|
||||||
const newSession: ISession = {
|
const newSession: ISession = {
|
||||||
sessionId,
|
sessionId,
|
||||||
creatorId: Creator,
|
creatorId: Creator,
|
||||||
@ -27,7 +25,7 @@ function createNewSession(sessionData: ISession, Creator: Types.ObjectId): ISess
|
|||||||
customSettings: sessionData.customSettings || "",
|
customSettings: sessionData.customSettings || "",
|
||||||
rewardSeed: sessionData.rewardSeed || -1,
|
rewardSeed: sessionData.rewardSeed || -1,
|
||||||
guildId: sessionData.guildId || "",
|
guildId: sessionData.guildId || "",
|
||||||
buildId: sessionData.buildId || 4920386201513015989n,
|
buildId: sessionData.buildId || 4920386201513015989,
|
||||||
platform: sessionData.platform || 0,
|
platform: sessionData.platform || 0,
|
||||||
xplatform: sessionData.xplatform || true,
|
xplatform: sessionData.xplatform || true,
|
||||||
freePublic: sessionData.freePublic || 3,
|
freePublic: sessionData.freePublic || 3,
|
||||||
@ -42,15 +40,13 @@ function getAllSessions(): ISession[] {
|
|||||||
return sessions;
|
return sessions;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSessionByID(sessionId: string | Types.ObjectId): ISession | undefined {
|
function getSessionByID(sessionId: string): ISession | undefined {
|
||||||
return sessions.find(session => session.sessionId.equals(sessionId));
|
return sessions.find(session => session.sessionId === sessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSession(
|
function getSession(sessionIdOrRequest: string | IFindSessionRequest): { createdBy: string; id: string }[] {
|
||||||
sessionIdOrRequest: string | Types.ObjectId | IFindSessionRequest
|
if (typeof sessionIdOrRequest === "string") {
|
||||||
): { createdBy: Types.ObjectId; id: Types.ObjectId }[] {
|
const session = sessions.find(session => session.sessionId === sessionIdOrRequest);
|
||||||
if (typeof sessionIdOrRequest === "string" || sessionIdOrRequest instanceof Types.ObjectId) {
|
|
||||||
const session = sessions.find(session => session.sessionId.equals(sessionIdOrRequest));
|
|
||||||
if (session) {
|
if (session) {
|
||||||
logger.debug("Found Sessions:", { session });
|
logger.debug("Found Sessions:", { session });
|
||||||
return [
|
return [
|
||||||
@ -83,15 +79,35 @@ function getSession(
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSessionByCreatorID(creatorId: string | Types.ObjectId): ISession | undefined {
|
function getSessionByCreatorID(creatorId: string): ISession | undefined {
|
||||||
return sessions.find(session => session.creatorId.equals(creatorId));
|
return sessions.find(session => session.creatorId === creatorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSession(sessionId: string | Types.ObjectId, sessionData: string): boolean {
|
function getNewSessionID(): string {
|
||||||
const session = sessions.find(session => session.sessionId.equals(sessionId));
|
const characters = "0123456789abcdef";
|
||||||
|
const maxAttempts = 100;
|
||||||
|
let sessionId = "";
|
||||||
|
|
||||||
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
||||||
|
sessionId = "64";
|
||||||
|
for (let i = 0; i < 22; i++) {
|
||||||
|
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||||
|
sessionId += characters[randomIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sessions.some(session => session.sessionId === sessionId)) {
|
||||||
|
return sessionId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error("Failed to generate a unique session ID");
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSession(sessionId: string, sessionData: string): boolean {
|
||||||
|
const session = sessions.find(session => session.sessionId === sessionId);
|
||||||
if (!session) return false;
|
if (!session) return false;
|
||||||
try {
|
try {
|
||||||
Object.assign(session, JSONParse(sessionData));
|
Object.assign(session, JSON.parse(sessionData));
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Invalid JSON string for session update.");
|
console.error("Invalid JSON string for session update.");
|
||||||
@ -99,8 +115,8 @@ function updateSession(sessionId: string | Types.ObjectId, sessionData: string):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteSession(sessionId: string | Types.ObjectId): boolean {
|
function deleteSession(sessionId: string): boolean {
|
||||||
const index = sessions.findIndex(session => session.sessionId.equals(sessionId));
|
const index = sessions.findIndex(session => session.sessionId === sessionId);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
sessions.splice(index, 1);
|
sessions.splice(index, 1);
|
||||||
return true;
|
return true;
|
||||||
@ -113,6 +129,7 @@ export {
|
|||||||
getAllSessions,
|
getAllSessions,
|
||||||
getSessionByID,
|
getSessionByID,
|
||||||
getSessionByCreatorID,
|
getSessionByCreatorID,
|
||||||
|
getNewSessionID,
|
||||||
updateSession,
|
updateSession,
|
||||||
deleteSession,
|
deleteSession,
|
||||||
getSession
|
getSession
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
import { IFriendship } from "@/src/types/friendTypes";
|
|
||||||
import { model, Schema } from "mongoose";
|
|
||||||
|
|
||||||
const friendshipSchema = new Schema<IFriendship>({
|
|
||||||
owner: { type: Schema.Types.ObjectId, required: true },
|
|
||||||
friend: { type: Schema.Types.ObjectId, required: true },
|
|
||||||
Note: String,
|
|
||||||
Favorite: Boolean
|
|
||||||
});
|
|
||||||
|
|
||||||
friendshipSchema.index({ owner: 1 });
|
|
||||||
friendshipSchema.index({ friend: 1 });
|
|
||||||
friendshipSchema.index({ owner: 1, friend: 1 }, { unique: true });
|
|
||||||
|
|
||||||
export const Friendship = model<IFriendship>("Friendship", friendshipSchema);
|
|
@ -13,8 +13,7 @@ import {
|
|||||||
IDojoLeaderboardEntry,
|
IDojoLeaderboardEntry,
|
||||||
IGuildAdDatabase,
|
IGuildAdDatabase,
|
||||||
IAllianceDatabase,
|
IAllianceDatabase,
|
||||||
IAllianceMemberDatabase,
|
IAllianceMemberDatabase
|
||||||
GuildPermission
|
|
||||||
} from "@/src/types/guildTypes";
|
} from "@/src/types/guildTypes";
|
||||||
import { Document, Model, model, Schema, Types } from "mongoose";
|
import { Document, Model, model, Schema, Types } from "mongoose";
|
||||||
import { fusionTreasuresSchema, typeCountSchema } from "./inventoryModels/inventoryModel";
|
import { fusionTreasuresSchema, typeCountSchema } from "./inventoryModels/inventoryModel";
|
||||||
@ -24,7 +23,6 @@ const dojoDecoSchema = new Schema<IDojoDecoDatabase>({
|
|||||||
Type: String,
|
Type: String,
|
||||||
Pos: [Number],
|
Pos: [Number],
|
||||||
Rot: [Number],
|
Rot: [Number],
|
||||||
Scale: Number,
|
|
||||||
Name: String,
|
Name: String,
|
||||||
Sockets: Number,
|
Sockets: Number,
|
||||||
RegularCredits: Number,
|
RegularCredits: Number,
|
||||||
@ -109,31 +107,31 @@ const defaultRanks: IGuildRank[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "/Lotus/Language/Game/Rank_General",
|
Name: "/Lotus/Language/Game/Rank_General",
|
||||||
Permissions: GuildPermission.Host | 4318
|
Permissions: 4318
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "/Lotus/Language/Game/Rank_Officer",
|
Name: "/Lotus/Language/Game/Rank_Officer",
|
||||||
Permissions: GuildPermission.Host | 4314
|
Permissions: 4314
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "/Lotus/Language/Game/Rank_Leader",
|
Name: "/Lotus/Language/Game/Rank_Leader",
|
||||||
Permissions: GuildPermission.Host | 4106
|
Permissions: 4106
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "/Lotus/Language/Game/Rank_Sage",
|
Name: "/Lotus/Language/Game/Rank_Sage",
|
||||||
Permissions: GuildPermission.Host | 4304
|
Permissions: 4304
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "/Lotus/Language/Game/Rank_Soldier",
|
Name: "/Lotus/Language/Game/Rank_Soldier",
|
||||||
Permissions: GuildPermission.Host | 4098
|
Permissions: 4098
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "/Lotus/Language/Game/Rank_Initiate",
|
Name: "/Lotus/Language/Game/Rank_Initiate",
|
||||||
Permissions: GuildPermission.Host | GuildPermission.Fabricator
|
Permissions: 4096
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "/Lotus/Language/Game/Rank_Utility",
|
Name: "/Lotus/Language/Game/Rank_Utility",
|
||||||
Permissions: GuildPermission.Host | GuildPermission.Fabricator
|
Permissions: 4096
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -38,8 +38,7 @@ import {
|
|||||||
IPeriodicMissionCompletionResponse,
|
IPeriodicMissionCompletionResponse,
|
||||||
ILoreFragmentScan,
|
ILoreFragmentScan,
|
||||||
IEvolutionProgress,
|
IEvolutionProgress,
|
||||||
IEndlessXpProgressDatabase,
|
IEndlessXpProgress,
|
||||||
IEndlessXpProgressClient,
|
|
||||||
ICrewShipCustomization,
|
ICrewShipCustomization,
|
||||||
ICrewShipWeapon,
|
ICrewShipWeapon,
|
||||||
ICrewShipWeaponEmplacements,
|
ICrewShipWeaponEmplacements,
|
||||||
@ -97,9 +96,7 @@ import {
|
|||||||
IInvasionProgressDatabase,
|
IInvasionProgressDatabase,
|
||||||
IInvasionProgressClient,
|
IInvasionProgressClient,
|
||||||
IAccolades,
|
IAccolades,
|
||||||
IHubNpcCustomization,
|
IHubNpcCustomization
|
||||||
ILotusCustomization,
|
|
||||||
IEndlessXpReward
|
|
||||||
} from "../../types/inventoryTypes/inventoryTypes";
|
} from "../../types/inventoryTypes/inventoryTypes";
|
||||||
import { IOid } from "../../types/commonTypes";
|
import { IOid } from "../../types/commonTypes";
|
||||||
import {
|
import {
|
||||||
@ -114,7 +111,6 @@ import {
|
|||||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { EquipmentSelectionSchema, oidSchema } from "./loadoutModel";
|
import { EquipmentSelectionSchema, oidSchema } from "./loadoutModel";
|
||||||
import { ICountedStoreItem } from "warframe-public-export-plus";
|
|
||||||
|
|
||||||
export const typeCountSchema = new Schema<ITypeCount>({ ItemType: String, ItemCount: Number }, { _id: false });
|
export const typeCountSchema = new Schema<ITypeCount>({ ItemType: String, ItemCount: Number }, { _id: false });
|
||||||
|
|
||||||
@ -394,8 +390,8 @@ MailboxSchema.set("toJSON", {
|
|||||||
|
|
||||||
const DuviriInfoSchema = new Schema<IDuviriInfo>(
|
const DuviriInfoSchema = new Schema<IDuviriInfo>(
|
||||||
{
|
{
|
||||||
Seed: { type: BigInt, required: true },
|
Seed: Number,
|
||||||
NumCompletions: { type: Number, required: true }
|
NumCompletions: { type: Number, default: 0 }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: false,
|
_id: false,
|
||||||
@ -784,26 +780,6 @@ const loreFragmentScansSchema = new Schema<ILoreFragmentScan>(
|
|||||||
{ _id: false }
|
{ _id: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
// const lotusCustomizationSchema = new Schema<ILotusCustomization>().add(ItemConfigSchema).add({
|
|
||||||
// Persona: String
|
|
||||||
// });
|
|
||||||
|
|
||||||
// Laxer schema for cleanupInventory
|
|
||||||
const lotusCustomizationSchema = new Schema<ILotusCustomization>(
|
|
||||||
{
|
|
||||||
Skins: [String],
|
|
||||||
pricol: colorSchema,
|
|
||||||
attcol: Schema.Types.Mixed,
|
|
||||||
sigcol: Schema.Types.Mixed,
|
|
||||||
eyecol: Schema.Types.Mixed,
|
|
||||||
facial: Schema.Types.Mixed,
|
|
||||||
cloth: Schema.Types.Mixed,
|
|
||||||
syancol: Schema.Types.Mixed,
|
|
||||||
Persona: String
|
|
||||||
},
|
|
||||||
{ _id: false }
|
|
||||||
);
|
|
||||||
|
|
||||||
const evolutionProgressSchema = new Schema<IEvolutionProgress>(
|
const evolutionProgressSchema = new Schema<IEvolutionProgress>(
|
||||||
{
|
{
|
||||||
Progress: Number,
|
Progress: Number,
|
||||||
@ -813,48 +789,14 @@ const evolutionProgressSchema = new Schema<IEvolutionProgress>(
|
|||||||
{ _id: false }
|
{ _id: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
const countedStoreItemSchema = new Schema<ICountedStoreItem>(
|
const endlessXpProgressSchema = new Schema<IEndlessXpProgress>(
|
||||||
{
|
{
|
||||||
StoreItem: String,
|
Category: String,
|
||||||
ItemCount: Number
|
Choices: [String]
|
||||||
},
|
},
|
||||||
{ _id: false }
|
{ _id: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
const endlessXpRewardSchema = new Schema<IEndlessXpReward>(
|
|
||||||
{
|
|
||||||
RequiredTotalXp: Number,
|
|
||||||
Rewards: [countedStoreItemSchema]
|
|
||||||
},
|
|
||||||
{ _id: false }
|
|
||||||
);
|
|
||||||
|
|
||||||
const endlessXpProgressSchema = new Schema<IEndlessXpProgressDatabase>(
|
|
||||||
{
|
|
||||||
Category: { type: String, required: true },
|
|
||||||
Earn: { type: Number, default: 0 },
|
|
||||||
Claim: { type: Number, default: 0 },
|
|
||||||
BonusAvailable: Date,
|
|
||||||
Expiry: Date,
|
|
||||||
Choices: { type: [String], required: true },
|
|
||||||
PendingRewards: { type: [endlessXpRewardSchema], default: [] }
|
|
||||||
},
|
|
||||||
{ _id: false }
|
|
||||||
);
|
|
||||||
|
|
||||||
endlessXpProgressSchema.set("toJSON", {
|
|
||||||
transform(_doc, ret) {
|
|
||||||
const db = ret as IEndlessXpProgressDatabase;
|
|
||||||
const client = ret as IEndlessXpProgressClient;
|
|
||||||
|
|
||||||
if (db.BonusAvailable) {
|
|
||||||
client.BonusAvailable = toMongoDate(db.BonusAvailable);
|
|
||||||
}
|
|
||||||
if (db.Expiry) {
|
|
||||||
client.Expiry = toMongoDate(db.Expiry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const crewShipWeaponEmplacementsSchema = new Schema<ICrewShipWeaponEmplacements>(
|
const crewShipWeaponEmplacementsSchema = new Schema<ICrewShipWeaponEmplacements>(
|
||||||
{
|
{
|
||||||
PRIMARY_A: EquipmentSelectionSchema,
|
PRIMARY_A: EquipmentSelectionSchema,
|
||||||
@ -1092,8 +1034,6 @@ const pendingRecipeSchema = new Schema<IPendingRecipeDatabase>(
|
|||||||
{
|
{
|
||||||
ItemType: String,
|
ItemType: String,
|
||||||
CompletionDate: Date,
|
CompletionDate: Date,
|
||||||
TargetItemId: String,
|
|
||||||
TargetFingerprint: String,
|
|
||||||
LongGuns: { type: [EquipmentSchema], default: undefined },
|
LongGuns: { type: [EquipmentSchema], default: undefined },
|
||||||
Pistols: { type: [EquipmentSchema], default: undefined },
|
Pistols: { type: [EquipmentSchema], default: undefined },
|
||||||
Melee: { type: [EquipmentSchema], default: undefined },
|
Melee: { type: [EquipmentSchema], default: undefined },
|
||||||
@ -1185,15 +1125,15 @@ const CustomMarkersSchema = new Schema<ICustomMarkers>(
|
|||||||
const calenderProgressSchema = new Schema<ICalendarProgress>(
|
const calenderProgressSchema = new Schema<ICalendarProgress>(
|
||||||
{
|
{
|
||||||
Version: { type: Number, default: 19 },
|
Version: { type: Number, default: 19 },
|
||||||
Iteration: { type: Number, required: true },
|
Iteration: { type: Number, default: 2 },
|
||||||
YearProgress: {
|
YearProgress: {
|
||||||
Upgrades: { type: [String], default: [] }
|
Upgrades: { type: [] }
|
||||||
},
|
},
|
||||||
SeasonProgress: {
|
SeasonProgress: {
|
||||||
SeasonType: { type: String, required: true },
|
SeasonType: String,
|
||||||
LastCompletedDayIdx: { type: Number, default: 0 },
|
LastCompletedDayIdx: { type: Number, default: -1 },
|
||||||
LastCompletedChallengeDayIdx: { type: Number, default: 0 },
|
LastCompletedChallengeDayIdx: { type: Number, default: -1 },
|
||||||
ActivatedChallenges: { type: [String], default: [] }
|
ActivatedChallenges: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ _id: false }
|
{ _id: false }
|
||||||
@ -1315,11 +1255,11 @@ const nemesisSchema = new Schema<INemesisDatabase>(
|
|||||||
PrevOwners: Number,
|
PrevOwners: Number,
|
||||||
SecondInCommand: Boolean,
|
SecondInCommand: Boolean,
|
||||||
Weakened: Boolean,
|
Weakened: Boolean,
|
||||||
InfNodes: { type: [infNodeSchema], default: undefined },
|
InfNodes: [infNodeSchema],
|
||||||
HenchmenKilled: Number,
|
HenchmenKilled: Number,
|
||||||
HintProgress: Number,
|
HintProgress: Number,
|
||||||
Hints: { type: [Number], default: [] },
|
Hints: [Number],
|
||||||
GuessHistory: { type: [Number], default: undefined },
|
GuessHistory: [Number],
|
||||||
MissionCount: Number,
|
MissionCount: Number,
|
||||||
LastEnc: Number
|
LastEnc: Number
|
||||||
},
|
},
|
||||||
@ -1436,7 +1376,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
//How many Gift do you have left*(gift spends the trade)
|
//How many Gift do you have left*(gift spends the trade)
|
||||||
GiftsRemaining: { type: Number, default: 8 },
|
GiftsRemaining: { type: Number, default: 8 },
|
||||||
//Curent trade info Giving or Getting items
|
//Curent trade info Giving or Getting items
|
||||||
//PendingTrades: [Schema.Types.Mixed],
|
PendingTrades: [Schema.Types.Mixed],
|
||||||
|
|
||||||
//Syndicate currently being pledged to.
|
//Syndicate currently being pledged to.
|
||||||
SupportedSyndicate: String,
|
SupportedSyndicate: String,
|
||||||
@ -1486,7 +1426,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
|
|
||||||
KubrowPetEggs: [kubrowPetEggSchema],
|
KubrowPetEggs: [kubrowPetEggSchema],
|
||||||
//Prints Cat(3 Prints)\Kubrow(2 Prints) Pets
|
//Prints Cat(3 Prints)\Kubrow(2 Prints) Pets
|
||||||
//KubrowPetPrints: [Schema.Types.Mixed],
|
KubrowPetPrints: [Schema.Types.Mixed],
|
||||||
|
|
||||||
//Item for EquippedGear example:Scaner,LoadoutTechSummon etc
|
//Item for EquippedGear example:Scaner,LoadoutTechSummon etc
|
||||||
Consumables: [typeCountSchema],
|
Consumables: [typeCountSchema],
|
||||||
@ -1532,7 +1472,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
//item like DojoKey or Boss missions key
|
//item like DojoKey or Boss missions key
|
||||||
LevelKeys: [typeCountSchema],
|
LevelKeys: [typeCountSchema],
|
||||||
//Active quests
|
//Active quests
|
||||||
//Quests: [Schema.Types.Mixed],
|
Quests: [Schema.Types.Mixed],
|
||||||
|
|
||||||
//Cosmetics like profile glyphs\Kavasa Prime Kubrow Collar\Game Theme etc
|
//Cosmetics like profile glyphs\Kavasa Prime Kubrow Collar\Game Theme etc
|
||||||
FlavourItems: [FlavourItemSchema],
|
FlavourItems: [FlavourItemSchema],
|
||||||
@ -1571,7 +1511,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
TauntHistory: { type: [tauntSchema], default: undefined },
|
TauntHistory: { type: [tauntSchema], default: undefined },
|
||||||
|
|
||||||
//noShow2FA,VisitPrimeVault etc
|
//noShow2FA,VisitPrimeVault etc
|
||||||
//WebFlags: Schema.Types.Mixed,
|
WebFlags: Schema.Types.Mixed,
|
||||||
//Id CompletedAlerts
|
//Id CompletedAlerts
|
||||||
CompletedAlerts: [String],
|
CompletedAlerts: [String],
|
||||||
|
|
||||||
@ -1591,7 +1531,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
//the color your clan requests like Items/Research/DojoColors/DojoColorPlainsB
|
//the color your clan requests like Items/Research/DojoColors/DojoColorPlainsB
|
||||||
ActiveDojoColorResearch: String,
|
ActiveDojoColorResearch: String,
|
||||||
|
|
||||||
//SentientSpawnChanceBoosters: Schema.Types.Mixed,
|
SentientSpawnChanceBoosters: Schema.Types.Mixed,
|
||||||
|
|
||||||
QualifyingInvasions: [invasionProgressSchema],
|
QualifyingInvasions: [invasionProgressSchema],
|
||||||
FactionScores: [Number],
|
FactionScores: [Number],
|
||||||
@ -1621,15 +1561,15 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
Drones: [droneSchema],
|
Drones: [droneSchema],
|
||||||
|
|
||||||
//Active profile ico
|
//Active profile ico
|
||||||
ActiveAvatarImageType: String,
|
ActiveAvatarImageType: { type: String, default: "/Lotus/Types/StoreItems/AvatarImages/AvatarImageDefault" },
|
||||||
|
|
||||||
// open location store like EidolonPlainsDiscoverable or OrbVallisCaveDiscoverable
|
// open location store like EidolonPlainsDiscoverable or OrbVallisCaveDiscoverable
|
||||||
DiscoveredMarkers: [discoveredMarkerSchema],
|
DiscoveredMarkers: [discoveredMarkerSchema],
|
||||||
//Open location mission like "JobId" + "StageCompletions"
|
//Open location mission like "JobId" + "StageCompletions"
|
||||||
//CompletedJobs: [Schema.Types.Mixed],
|
CompletedJobs: [Schema.Types.Mixed],
|
||||||
|
|
||||||
//Game mission\ivent score example "Tag": "WaterFight", "Best": 170, "Count": 1258,
|
//Game mission\ivent score example "Tag": "WaterFight", "Best": 170, "Count": 1258,
|
||||||
//PersonalGoalProgress: [Schema.Types.Mixed],
|
PersonalGoalProgress: [Schema.Types.Mixed],
|
||||||
|
|
||||||
//Setting interface Style
|
//Setting interface Style
|
||||||
ThemeStyle: String,
|
ThemeStyle: String,
|
||||||
@ -1659,13 +1599,13 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
LibraryActiveDailyTaskInfo: libraryDailyTaskInfoSchema,
|
LibraryActiveDailyTaskInfo: libraryDailyTaskInfoSchema,
|
||||||
|
|
||||||
//https://warframe.fandom.com/wiki/Invasion
|
//https://warframe.fandom.com/wiki/Invasion
|
||||||
//InvasionChainProgress: [Schema.Types.Mixed],
|
InvasionChainProgress: [Schema.Types.Mixed],
|
||||||
|
|
||||||
//CorpusLich or GrineerLich
|
//CorpusLich or GrineerLich
|
||||||
NemesisAbandonedRewards: { type: [String], default: [] },
|
NemesisAbandonedRewards: { type: [String], default: [] },
|
||||||
Nemesis: nemesisSchema,
|
Nemesis: nemesisSchema,
|
||||||
NemesisHistory: { type: [nemesisSchema], default: undefined },
|
NemesisHistory: [Schema.Types.Mixed],
|
||||||
//LastNemesisAllySpawnTime: Schema.Types.Mixed,
|
LastNemesisAllySpawnTime: Schema.Types.Mixed,
|
||||||
|
|
||||||
//TradingRulesConfirmed,ShowFriendInvNotifications(Option->Social)
|
//TradingRulesConfirmed,ShowFriendInvNotifications(Option->Social)
|
||||||
Settings: settingsSchema,
|
Settings: settingsSchema,
|
||||||
@ -1679,7 +1619,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
PlayerSkills: { type: playerSkillsSchema, default: {} },
|
PlayerSkills: { type: playerSkillsSchema, default: {} },
|
||||||
|
|
||||||
//TradeBannedUntil data
|
//TradeBannedUntil data
|
||||||
//TradeBannedUntil: Schema.Types.Mixed,
|
TradeBannedUntil: Schema.Types.Mixed,
|
||||||
|
|
||||||
//https://warframe.fandom.com/wiki/Helminth
|
//https://warframe.fandom.com/wiki/Helminth
|
||||||
InfestedFoundry: infestedFoundrySchema,
|
InfestedFoundry: infestedFoundrySchema,
|
||||||
@ -1688,7 +1628,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
|
|
||||||
//Purchase this new permanent skin from the Lotus customization options in Personal Quarters located in your Orbiter.
|
//Purchase this new permanent skin from the Lotus customization options in Personal Quarters located in your Orbiter.
|
||||||
//https://warframe.fandom.com/wiki/Lotus#The_New_War
|
//https://warframe.fandom.com/wiki/Lotus#The_New_War
|
||||||
LotusCustomization: { type: lotusCustomizationSchema, default: undefined },
|
LotusCustomization: Schema.Types.Mixed,
|
||||||
|
|
||||||
//Progress+Rank+ItemType(ZarimanPumpShotgun)
|
//Progress+Rank+ItemType(ZarimanPumpShotgun)
|
||||||
//https://warframe.fandom.com/wiki/Incarnon
|
//https://warframe.fandom.com/wiki/Incarnon
|
||||||
@ -1699,24 +1639,23 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
|
|
||||||
//Unknown and system
|
//Unknown and system
|
||||||
DuviriInfo: DuviriInfoSchema,
|
DuviriInfo: DuviriInfoSchema,
|
||||||
LastInventorySync: Schema.Types.ObjectId,
|
|
||||||
Mailbox: MailboxSchema,
|
Mailbox: MailboxSchema,
|
||||||
HandlerPoints: Number,
|
HandlerPoints: Number,
|
||||||
ChallengesFixVersion: { type: Number, default: 6 },
|
ChallengesFixVersion: { type: Number, default: 6 },
|
||||||
PlayedParkourTutorial: Boolean,
|
PlayedParkourTutorial: Boolean,
|
||||||
//ActiveLandscapeTraps: [Schema.Types.Mixed],
|
ActiveLandscapeTraps: [Schema.Types.Mixed],
|
||||||
//RepVotes: [Schema.Types.Mixed],
|
RepVotes: [Schema.Types.Mixed],
|
||||||
//LeagueTickets: [Schema.Types.Mixed],
|
LeagueTickets: [Schema.Types.Mixed],
|
||||||
HasContributedToDojo: Boolean,
|
HasContributedToDojo: Boolean,
|
||||||
HWIDProtectEnabled: Boolean,
|
HWIDProtectEnabled: Boolean,
|
||||||
LoadOutPresets: { type: Schema.Types.ObjectId, ref: "Loadout" },
|
LoadOutPresets: { type: Schema.Types.ObjectId, ref: "Loadout" },
|
||||||
CurrentLoadOutIds: [oidSchema],
|
CurrentLoadOutIds: [oidSchema],
|
||||||
RandomUpgradesIdentified: Number,
|
RandomUpgradesIdentified: Number,
|
||||||
BountyScore: Number,
|
BountyScore: Number,
|
||||||
//ChallengeInstanceStates: [Schema.Types.Mixed],
|
ChallengeInstanceStates: [Schema.Types.Mixed],
|
||||||
RecentVendorPurchases: { type: [recentVendorPurchaseSchema], default: undefined },
|
RecentVendorPurchases: { type: [recentVendorPurchaseSchema], default: undefined },
|
||||||
//Robotics: [Schema.Types.Mixed],
|
Robotics: [Schema.Types.Mixed],
|
||||||
//UsedDailyDeals: [Schema.Types.Mixed],
|
UsedDailyDeals: [Schema.Types.Mixed],
|
||||||
CollectibleSeries: { type: [collectibleEntrySchema], default: undefined },
|
CollectibleSeries: { type: [collectibleEntrySchema], default: undefined },
|
||||||
HasResetAccount: { type: Boolean, default: false },
|
HasResetAccount: { type: Boolean, default: false },
|
||||||
|
|
||||||
@ -1797,9 +1736,6 @@ inventorySchema.set("toJSON", {
|
|||||||
sn: inventoryDatabase.LockedWeaponGroup.sn ? toOid(inventoryDatabase.LockedWeaponGroup.sn) : undefined
|
sn: inventoryDatabase.LockedWeaponGroup.sn ? toOid(inventoryDatabase.LockedWeaponGroup.sn) : undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (inventoryDatabase.LastInventorySync) {
|
|
||||||
inventoryResponse.LastInventorySync = toOid(inventoryDatabase.LastInventorySync);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,9 +20,7 @@ const databaseAccountSchema = new Schema<IDatabaseAccountJson>(
|
|||||||
ConsentNeeded: { type: Boolean, required: true },
|
ConsentNeeded: { type: Boolean, required: true },
|
||||||
TrackedSettings: { type: [String], default: [] },
|
TrackedSettings: { type: [String], default: [] },
|
||||||
Nonce: { type: Number, default: 0 },
|
Nonce: { type: Number, default: 0 },
|
||||||
BuildLabel: String,
|
|
||||||
Dropped: Boolean,
|
Dropped: Boolean,
|
||||||
LastLogin: { type: Date, default: 0 },
|
|
||||||
LatestEventMessageDate: { type: Date, default: 0 },
|
LatestEventMessageDate: { type: Date, default: 0 },
|
||||||
LastLoginRewardDate: { type: Number, default: 0 },
|
LastLoginRewardDate: { type: Number, default: 0 },
|
||||||
LoginDays: { type: Number, default: 1 }
|
LoginDays: { type: Number, default: 1 }
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { colorSchema } from "@/src/models/inventoryModels/inventoryModel";
|
import { colorSchema } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
import { IOrbiter, IPersonalRoomsDatabase, PersonalRoomsModelType } from "@/src/types/personalRoomsTypes";
|
import { IOrbiter, IPersonalRoomsDatabase, PersonalRoomsModelType } from "@/src/types/personalRoomsTypes";
|
||||||
import {
|
import {
|
||||||
IFavouriteLoadoutDatabase,
|
IFavouriteLoadoutDatabase,
|
||||||
IGardeningDatabase,
|
IGardening,
|
||||||
IPlacedDecosDatabase,
|
IPlacedDecosDatabase,
|
||||||
IPictureFrameInfo,
|
IPictureFrameInfo,
|
||||||
IRoom,
|
IRoom,
|
||||||
ITailorShopDatabase,
|
ITailorShopDatabase,
|
||||||
IApartmentDatabase,
|
IApartmentDatabase
|
||||||
IPlanterDatabase,
|
|
||||||
IPlantDatabase,
|
|
||||||
IPlantClient
|
|
||||||
} from "@/src/types/shipTypes";
|
} from "@/src/types/shipTypes";
|
||||||
import { Schema, Types, model } from "mongoose";
|
import { Schema, model } from "mongoose";
|
||||||
|
|
||||||
export const pictureFrameInfoSchema = new Schema<IPictureFrameInfo>(
|
export const pictureFrameInfoSchema = new Schema<IPictureFrameInfo>(
|
||||||
{
|
{
|
||||||
@ -80,45 +77,15 @@ favouriteLoadoutSchema.set("toJSON", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const plantSchema = new Schema<IPlantDatabase>(
|
const gardeningSchema = new Schema<IGardening>({
|
||||||
{
|
Planters: [Schema.Types.Mixed] //TODO: add when implementing gardening
|
||||||
PlantType: String,
|
|
||||||
EndTime: Date,
|
|
||||||
PlotIndex: Number
|
|
||||||
},
|
|
||||||
{ _id: false }
|
|
||||||
);
|
|
||||||
|
|
||||||
plantSchema.set("toJSON", {
|
|
||||||
virtuals: true,
|
|
||||||
transform(_doc, obj) {
|
|
||||||
const client = obj as IPlantClient;
|
|
||||||
const db = obj as IPlantDatabase;
|
|
||||||
|
|
||||||
client.EndTime = toMongoDate(db.EndTime);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const planterSchema = new Schema<IPlanterDatabase>(
|
|
||||||
{
|
|
||||||
Name: { type: String, required: true },
|
|
||||||
Plants: { type: [plantSchema], default: [] }
|
|
||||||
},
|
|
||||||
{ _id: false }
|
|
||||||
);
|
|
||||||
|
|
||||||
const gardeningSchema = new Schema<IGardeningDatabase>(
|
|
||||||
{
|
|
||||||
Planters: { type: [planterSchema], default: [] }
|
|
||||||
},
|
|
||||||
{ _id: false }
|
|
||||||
);
|
|
||||||
|
|
||||||
const apartmentSchema = new Schema<IApartmentDatabase>(
|
const apartmentSchema = new Schema<IApartmentDatabase>(
|
||||||
{
|
{
|
||||||
Rooms: [roomSchema],
|
Rooms: [roomSchema],
|
||||||
FavouriteLoadouts: [favouriteLoadoutSchema],
|
FavouriteLoadouts: [favouriteLoadoutSchema],
|
||||||
Gardening: gardeningSchema
|
Gardening: gardeningSchema // TODO: ensure this is correct
|
||||||
},
|
},
|
||||||
{ _id: false }
|
{ _id: false }
|
||||||
);
|
);
|
||||||
@ -131,9 +98,7 @@ const apartmentDefault: IApartmentDatabase = {
|
|||||||
{ Name: "DuviriHallway", MaxCapacity: 1600 }
|
{ Name: "DuviriHallway", MaxCapacity: 1600 }
|
||||||
],
|
],
|
||||||
FavouriteLoadouts: [],
|
FavouriteLoadouts: [],
|
||||||
Gardening: {
|
Gardening: {}
|
||||||
Planters: []
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const orbiterSchema = new Schema<IOrbiter>(
|
const orbiterSchema = new Schema<IOrbiter>(
|
||||||
@ -153,18 +118,7 @@ const orbiterDefault: IOrbiter = {
|
|||||||
Features: ["/Lotus/Types/Items/ShipFeatureItems/EarthNavigationFeatureItem"], //TODO: potentially remove after missionstarting gear
|
Features: ["/Lotus/Types/Items/ShipFeatureItems/EarthNavigationFeatureItem"], //TODO: potentially remove after missionstarting gear
|
||||||
Rooms: [
|
Rooms: [
|
||||||
{ Name: "AlchemyRoom", MaxCapacity: 1600 },
|
{ Name: "AlchemyRoom", MaxCapacity: 1600 },
|
||||||
{
|
{ Name: "BridgeRoom", MaxCapacity: 1600 },
|
||||||
Name: "BridgeRoom",
|
|
||||||
MaxCapacity: 1600,
|
|
||||||
PlacedDecos: [
|
|
||||||
{
|
|
||||||
Type: "/Lotus/Objects/Tenno/Props/Ships/LandCraftPlayerProps/ConclaveConsolePlayerShipDeco",
|
|
||||||
Pos: [-30.082, -3.95954, -16.7913],
|
|
||||||
Rot: [-135, 0, 0],
|
|
||||||
_id: undefined as unknown as Types.ObjectId
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{ Name: "LisetRoom", MaxCapacity: 1000 },
|
{ Name: "LisetRoom", MaxCapacity: 1000 },
|
||||||
{ Name: "OperatorChamberRoom", MaxCapacity: 1600 },
|
{ Name: "OperatorChamberRoom", MaxCapacity: 1600 },
|
||||||
{ Name: "OutsideRoom", MaxCapacity: 1600 },
|
{ Name: "OutsideRoom", MaxCapacity: 1600 },
|
||||||
|
@ -28,15 +28,17 @@ shipSchema.set("toJSON", {
|
|||||||
delete returnedObject._id;
|
delete returnedObject._id;
|
||||||
delete returnedObject.__v;
|
delete returnedObject.__v;
|
||||||
delete returnedObject.ShipOwnerId;
|
delete returnedObject.ShipOwnerId;
|
||||||
|
if (shipDatabase.ShipExteriorColors) {
|
||||||
|
shipResponse.ShipExterior = {
|
||||||
|
Colors: shipDatabase.ShipExteriorColors,
|
||||||
|
ShipAttachments: shipDatabase.ShipAttachments,
|
||||||
|
SkinFlavourItem: shipDatabase.SkinFlavourItem
|
||||||
|
};
|
||||||
|
|
||||||
shipResponse.ShipExterior = {
|
delete shipDatabase.ShipExteriorColors;
|
||||||
Colors: shipDatabase.ShipExteriorColors,
|
delete shipDatabase.ShipAttachments;
|
||||||
ShipAttachments: shipDatabase.ShipAttachments,
|
delete shipDatabase.SkinFlavourItem;
|
||||||
SkinFlavourItem: shipDatabase.SkinFlavourItem
|
}
|
||||||
};
|
|
||||||
delete shipDatabase.ShipExteriorColors;
|
|
||||||
delete shipDatabase.ShipAttachments;
|
|
||||||
delete shipDatabase.SkinFlavourItem;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3,10 +3,8 @@ import { abandonLibraryDailyTaskController } from "@/src/controllers/api/abandon
|
|||||||
import { abortDojoComponentController } from "@/src/controllers/api/abortDojoComponentController";
|
import { abortDojoComponentController } from "@/src/controllers/api/abortDojoComponentController";
|
||||||
import { abortDojoComponentDestructionController } from "@/src/controllers/api/abortDojoComponentDestructionController";
|
import { abortDojoComponentDestructionController } from "@/src/controllers/api/abortDojoComponentDestructionController";
|
||||||
import { activateRandomModController } from "@/src/controllers/api/activateRandomModController";
|
import { activateRandomModController } from "@/src/controllers/api/activateRandomModController";
|
||||||
import { addFriendController } from "@/src/controllers/api/addFriendController";
|
|
||||||
import { addFriendImageController } from "@/src/controllers/api/addFriendImageController";
|
import { addFriendImageController } from "@/src/controllers/api/addFriendImageController";
|
||||||
import { addIgnoredUserController } from "@/src/controllers/api/addIgnoredUserController";
|
import { addIgnoredUserController } from "@/src/controllers/api/addIgnoredUserController";
|
||||||
import { addPendingFriendController } from "@/src/controllers/api/addPendingFriendController";
|
|
||||||
import { addToAllianceController } from "@/src/controllers/api/addToAllianceController";
|
import { addToAllianceController } from "@/src/controllers/api/addToAllianceController";
|
||||||
import { addToGuildController } from "@/src/controllers/api/addToGuildController";
|
import { addToGuildController } from "@/src/controllers/api/addToGuildController";
|
||||||
import { arcaneCommonController } from "@/src/controllers/api/arcaneCommonController";
|
import { arcaneCommonController } from "@/src/controllers/api/arcaneCommonController";
|
||||||
@ -21,7 +19,6 @@ import { claimCompletedRecipeController } from "@/src/controllers/api/claimCompl
|
|||||||
import { claimLibraryDailyTaskRewardController } from "@/src/controllers/api/claimLibraryDailyTaskRewardController";
|
import { claimLibraryDailyTaskRewardController } from "@/src/controllers/api/claimLibraryDailyTaskRewardController";
|
||||||
import { clearDialogueHistoryController } from "@/src/controllers/api/clearDialogueHistoryController";
|
import { clearDialogueHistoryController } from "@/src/controllers/api/clearDialogueHistoryController";
|
||||||
import { clearNewEpisodeRewardController } from "@/src/controllers/api/clearNewEpisodeRewardController";
|
import { clearNewEpisodeRewardController } from "@/src/controllers/api/clearNewEpisodeRewardController";
|
||||||
import { completeCalendarEventController } from "@/src/controllers/api/completeCalendarEventController";
|
|
||||||
import { completeRandomModChallengeController } from "@/src/controllers/api/completeRandomModChallengeController";
|
import { completeRandomModChallengeController } from "@/src/controllers/api/completeRandomModChallengeController";
|
||||||
import { confirmAllianceInvitationController } from "@/src/controllers/api/confirmAllianceInvitationController";
|
import { confirmAllianceInvitationController } from "@/src/controllers/api/confirmAllianceInvitationController";
|
||||||
import { confirmGuildInvitationGetController, confirmGuildInvitationPostController } from "@/src/controllers/api/confirmGuildInvitationController";
|
import { confirmGuildInvitationGetController, confirmGuildInvitationPostController } from "@/src/controllers/api/confirmGuildInvitationController";
|
||||||
@ -50,7 +47,6 @@ import { findSessionsController } from "@/src/controllers/api/findSessionsContro
|
|||||||
import { fishmongerController } from "@/src/controllers/api/fishmongerController";
|
import { fishmongerController } from "@/src/controllers/api/fishmongerController";
|
||||||
import { focusController } from "@/src/controllers/api/focusController";
|
import { focusController } from "@/src/controllers/api/focusController";
|
||||||
import { fusionTreasuresController } from "@/src/controllers/api/fusionTreasuresController";
|
import { fusionTreasuresController } from "@/src/controllers/api/fusionTreasuresController";
|
||||||
import { gardeningController } from "@/src/controllers/api/gardeningController";
|
|
||||||
import { genericUpdateController } from "@/src/controllers/api/genericUpdateController";
|
import { genericUpdateController } from "@/src/controllers/api/genericUpdateController";
|
||||||
import { getAllianceController } from "@/src/controllers/api/getAllianceController";
|
import { getAllianceController } from "@/src/controllers/api/getAllianceController";
|
||||||
import { getDailyDealStockLevelsController } from "@/src/controllers/api/getDailyDealStockLevelsController";
|
import { getDailyDealStockLevelsController } from "@/src/controllers/api/getDailyDealStockLevelsController";
|
||||||
@ -61,7 +57,6 @@ import { getGuildDojoController } from "@/src/controllers/api/getGuildDojoContro
|
|||||||
import { getGuildLogController } from "@/src/controllers/api/getGuildLogController";
|
import { getGuildLogController } from "@/src/controllers/api/getGuildLogController";
|
||||||
import { getIgnoredUsersController } from "@/src/controllers/api/getIgnoredUsersController";
|
import { getIgnoredUsersController } from "@/src/controllers/api/getIgnoredUsersController";
|
||||||
import { getNewRewardSeedController } from "@/src/controllers/api/getNewRewardSeedController";
|
import { getNewRewardSeedController } from "@/src/controllers/api/getNewRewardSeedController";
|
||||||
import { getProfileViewingDataPostController } from "@/src/controllers/dynamic/getProfileViewingDataController";
|
|
||||||
import { getShipController } from "@/src/controllers/api/getShipController";
|
import { getShipController } from "@/src/controllers/api/getShipController";
|
||||||
import { getVendorInfoController } from "@/src/controllers/api/getVendorInfoController";
|
import { getVendorInfoController } from "@/src/controllers/api/getVendorInfoController";
|
||||||
import { getVoidProjectionRewardsController } from "@/src/controllers/api/getVoidProjectionRewardsController";
|
import { getVoidProjectionRewardsController } from "@/src/controllers/api/getVoidProjectionRewardsController";
|
||||||
@ -99,11 +94,9 @@ import { playerSkillsController } from "@/src/controllers/api/playerSkillsContro
|
|||||||
import { postGuildAdvertisementController } from "@/src/controllers/api/postGuildAdvertisementController";
|
import { postGuildAdvertisementController } from "@/src/controllers/api/postGuildAdvertisementController";
|
||||||
import { projectionManagerController } from "@/src/controllers/api/projectionManagerController";
|
import { projectionManagerController } from "@/src/controllers/api/projectionManagerController";
|
||||||
import { purchaseController } from "@/src/controllers/api/purchaseController";
|
import { purchaseController } from "@/src/controllers/api/purchaseController";
|
||||||
import { questControlController } from "@/src/controllers/api/questControlController";
|
|
||||||
import { queueDojoComponentDestructionController } from "@/src/controllers/api/queueDojoComponentDestructionController";
|
import { queueDojoComponentDestructionController } from "@/src/controllers/api/queueDojoComponentDestructionController";
|
||||||
import { redeemPromoCodeController } from "@/src/controllers/api/redeemPromoCodeController";
|
import { redeemPromoCodeController } from "@/src/controllers/api/redeemPromoCodeController";
|
||||||
import { releasePetController } from "@/src/controllers/api/releasePetController";
|
import { releasePetController } from "@/src/controllers/api/releasePetController";
|
||||||
import { removeFriendGetController, removeFriendPostController } from "@/src/controllers/api/removeFriendController";
|
|
||||||
import { removeFromAllianceController } from "@/src/controllers/api/removeFromAllianceController";
|
import { removeFromAllianceController } from "@/src/controllers/api/removeFromAllianceController";
|
||||||
import { removeFromGuildController } from "@/src/controllers/api/removeFromGuildController";
|
import { removeFromGuildController } from "@/src/controllers/api/removeFromGuildController";
|
||||||
import { removeIgnoredUserController } from "@/src/controllers/api/removeIgnoredUserController";
|
import { removeIgnoredUserController } from "@/src/controllers/api/removeIgnoredUserController";
|
||||||
@ -123,7 +116,6 @@ import { setDojoComponentColorsController } from "@/src/controllers/api/setDojoC
|
|||||||
import { setDojoComponentMessageController } from "@/src/controllers/api/setDojoComponentMessageController";
|
import { setDojoComponentMessageController } from "@/src/controllers/api/setDojoComponentMessageController";
|
||||||
import { setDojoComponentSettingsController } from "@/src/controllers/api/setDojoComponentSettingsController";
|
import { setDojoComponentSettingsController } from "@/src/controllers/api/setDojoComponentSettingsController";
|
||||||
import { setEquippedInstrumentController } from "@/src/controllers/api/setEquippedInstrumentController";
|
import { setEquippedInstrumentController } from "@/src/controllers/api/setEquippedInstrumentController";
|
||||||
import { setFriendNoteController } from "@/src/controllers/api/setFriendNoteController";
|
|
||||||
import { setGuildMotdController } from "@/src/controllers/api/setGuildMotdController";
|
import { setGuildMotdController } from "@/src/controllers/api/setGuildMotdController";
|
||||||
import { setHubNpcCustomizationsController } from "@/src/controllers/api/setHubNpcCustomizationsController";
|
import { setHubNpcCustomizationsController } from "@/src/controllers/api/setHubNpcCustomizationsController";
|
||||||
import { setPlacedDecoInfoController } from "@/src/controllers/api/setPlacedDecoInfoController";
|
import { setPlacedDecoInfoController } from "@/src/controllers/api/setPlacedDecoInfoController";
|
||||||
@ -166,7 +158,6 @@ apiRouter.get("/changeDojoRoot.php", changeDojoRootController);
|
|||||||
apiRouter.get("/changeGuildRank.php", changeGuildRankController);
|
apiRouter.get("/changeGuildRank.php", changeGuildRankController);
|
||||||
apiRouter.get("/checkDailyMissionBonus.php", checkDailyMissionBonusController);
|
apiRouter.get("/checkDailyMissionBonus.php", checkDailyMissionBonusController);
|
||||||
apiRouter.get("/claimLibraryDailyTaskReward.php", claimLibraryDailyTaskRewardController);
|
apiRouter.get("/claimLibraryDailyTaskReward.php", claimLibraryDailyTaskRewardController);
|
||||||
apiRouter.get("/completeCalendarEvent.php", completeCalendarEventController);
|
|
||||||
apiRouter.get("/confirmAllianceInvitation.php", confirmAllianceInvitationController);
|
apiRouter.get("/confirmAllianceInvitation.php", confirmAllianceInvitationController);
|
||||||
apiRouter.get("/confirmGuildInvitation.php", confirmGuildInvitationGetController);
|
apiRouter.get("/confirmGuildInvitation.php", confirmGuildInvitationGetController);
|
||||||
apiRouter.get("/credits.php", creditsController);
|
apiRouter.get("/credits.php", creditsController);
|
||||||
@ -176,7 +167,6 @@ apiRouter.get("/deleteSession.php", deleteSessionController);
|
|||||||
apiRouter.get("/divvyAllianceVault.php", divvyAllianceVaultController);
|
apiRouter.get("/divvyAllianceVault.php", divvyAllianceVaultController);
|
||||||
apiRouter.get("/dojo", dojoController);
|
apiRouter.get("/dojo", dojoController);
|
||||||
apiRouter.get("/drones.php", dronesController);
|
apiRouter.get("/drones.php", dronesController);
|
||||||
apiRouter.get("/getAlliance.php", getAllianceController);
|
|
||||||
apiRouter.get("/getDailyDealStockLevels.php", getDailyDealStockLevelsController);
|
apiRouter.get("/getDailyDealStockLevels.php", getDailyDealStockLevelsController);
|
||||||
apiRouter.get("/getFriends.php", getFriendsController);
|
apiRouter.get("/getFriends.php", getFriendsController);
|
||||||
apiRouter.get("/getGuild.php", getGuildController);
|
apiRouter.get("/getGuild.php", getGuildController);
|
||||||
@ -184,10 +174,8 @@ apiRouter.get("/getGuildContributions.php", getGuildContributionsController);
|
|||||||
apiRouter.get("/getGuildDojo.php", getGuildDojoController);
|
apiRouter.get("/getGuildDojo.php", getGuildDojoController);
|
||||||
apiRouter.get("/getGuildLog.php", getGuildLogController);
|
apiRouter.get("/getGuildLog.php", getGuildLogController);
|
||||||
apiRouter.get("/getIgnoredUsers.php", getIgnoredUsersController);
|
apiRouter.get("/getIgnoredUsers.php", getIgnoredUsersController);
|
||||||
apiRouter.get("/getMessages.php", inboxController); // unsure if this is correct, but needed for U17
|
|
||||||
apiRouter.get("/getNewRewardSeed.php", getNewRewardSeedController);
|
apiRouter.get("/getNewRewardSeed.php", getNewRewardSeedController);
|
||||||
apiRouter.get("/getShip.php", getShipController);
|
apiRouter.get("/getShip.php", getShipController);
|
||||||
apiRouter.get("/getShipDecos.php", (_req, res) => { res.end(); }); // needed to log in on U22.8
|
|
||||||
apiRouter.get("/getVendorInfo.php", getVendorInfoController);
|
apiRouter.get("/getVendorInfo.php", getVendorInfoController);
|
||||||
apiRouter.get("/hub", hubController);
|
apiRouter.get("/hub", hubController);
|
||||||
apiRouter.get("/hubInstances", hubInstancesController);
|
apiRouter.get("/hubInstances", hubInstancesController);
|
||||||
@ -199,9 +187,7 @@ apiRouter.get("/marketRecommendations.php", marketRecommendationsController);
|
|||||||
apiRouter.get("/marketSearchRecommendations.php", marketRecommendationsController);
|
apiRouter.get("/marketSearchRecommendations.php", marketRecommendationsController);
|
||||||
apiRouter.get("/modularWeaponSale.php", modularWeaponSaleController);
|
apiRouter.get("/modularWeaponSale.php", modularWeaponSaleController);
|
||||||
apiRouter.get("/playedParkourTutorial.php", playedParkourTutorialController);
|
apiRouter.get("/playedParkourTutorial.php", playedParkourTutorialController);
|
||||||
apiRouter.get("/questControl.php", questControlController);
|
|
||||||
apiRouter.get("/queueDojoComponentDestruction.php", queueDojoComponentDestructionController);
|
apiRouter.get("/queueDojoComponentDestruction.php", queueDojoComponentDestructionController);
|
||||||
apiRouter.get("/removeFriend.php", removeFriendGetController);
|
|
||||||
apiRouter.get("/removeFromAlliance.php", removeFromAllianceController);
|
apiRouter.get("/removeFromAlliance.php", removeFromAllianceController);
|
||||||
apiRouter.get("/setActiveQuest.php", setActiveQuestController);
|
apiRouter.get("/setActiveQuest.php", setActiveQuestController);
|
||||||
apiRouter.get("/setActiveShip.php", setActiveShipController);
|
apiRouter.get("/setActiveShip.php", setActiveShipController);
|
||||||
@ -219,10 +205,8 @@ apiRouter.get("/updateSession.php", updateSessionGetController);
|
|||||||
// post
|
// post
|
||||||
apiRouter.post("/abortDojoComponent.php", abortDojoComponentController);
|
apiRouter.post("/abortDojoComponent.php", abortDojoComponentController);
|
||||||
apiRouter.post("/activateRandomMod.php", activateRandomModController);
|
apiRouter.post("/activateRandomMod.php", activateRandomModController);
|
||||||
apiRouter.post("/addFriend.php", addFriendController);
|
|
||||||
apiRouter.post("/addFriendImage.php", addFriendImageController);
|
apiRouter.post("/addFriendImage.php", addFriendImageController);
|
||||||
apiRouter.post("/addIgnoredUser.php", addIgnoredUserController);
|
apiRouter.post("/addIgnoredUser.php", addIgnoredUserController);
|
||||||
apiRouter.post("/addPendingFriend.php", addPendingFriendController);
|
|
||||||
apiRouter.post("/addToAlliance.php", addToAllianceController);
|
apiRouter.post("/addToAlliance.php", addToAllianceController);
|
||||||
apiRouter.post("/addToGuild.php", addToGuildController);
|
apiRouter.post("/addToGuild.php", addToGuildController);
|
||||||
apiRouter.post("/arcaneCommon.php", arcaneCommonController);
|
apiRouter.post("/arcaneCommon.php", arcaneCommonController);
|
||||||
@ -233,7 +217,6 @@ apiRouter.post("/changeDojoRoot.php", changeDojoRootController);
|
|||||||
apiRouter.post("/claimCompletedRecipe.php", claimCompletedRecipeController);
|
apiRouter.post("/claimCompletedRecipe.php", claimCompletedRecipeController);
|
||||||
apiRouter.post("/clearDialogueHistory.php", clearDialogueHistoryController);
|
apiRouter.post("/clearDialogueHistory.php", clearDialogueHistoryController);
|
||||||
apiRouter.post("/clearNewEpisodeReward.php", clearNewEpisodeRewardController);
|
apiRouter.post("/clearNewEpisodeReward.php", clearNewEpisodeRewardController);
|
||||||
apiRouter.post("/commitStoryModeDecision.php", (_req, res) => { res.end(); }); // U14 (maybe wanna actually unlock the ship features?)
|
|
||||||
apiRouter.post("/completeRandomModChallenge.php", completeRandomModChallengeController);
|
apiRouter.post("/completeRandomModChallenge.php", completeRandomModChallengeController);
|
||||||
apiRouter.post("/confirmGuildInvitation.php", confirmGuildInvitationPostController);
|
apiRouter.post("/confirmGuildInvitation.php", confirmGuildInvitationPostController);
|
||||||
apiRouter.post("/contributeGuildClass.php", contributeGuildClassController);
|
apiRouter.post("/contributeGuildClass.php", contributeGuildClassController);
|
||||||
@ -255,12 +238,10 @@ apiRouter.post("/findSessions.php", findSessionsController);
|
|||||||
apiRouter.post("/fishmonger.php", fishmongerController);
|
apiRouter.post("/fishmonger.php", fishmongerController);
|
||||||
apiRouter.post("/focus.php", focusController);
|
apiRouter.post("/focus.php", focusController);
|
||||||
apiRouter.post("/fusionTreasures.php", fusionTreasuresController);
|
apiRouter.post("/fusionTreasures.php", fusionTreasuresController);
|
||||||
apiRouter.post("/gardening.php", gardeningController);
|
|
||||||
apiRouter.post("/genericUpdate.php", genericUpdateController);
|
apiRouter.post("/genericUpdate.php", genericUpdateController);
|
||||||
apiRouter.post("/getAlliance.php", getAllianceController);
|
apiRouter.post("/getAlliance.php", getAllianceController);
|
||||||
apiRouter.post("/getFriends.php", getFriendsController);
|
apiRouter.post("/getFriends.php", getFriendsController);
|
||||||
apiRouter.post("/getGuildDojo.php", getGuildDojoController);
|
apiRouter.post("/getGuildDojo.php", getGuildDojoController);
|
||||||
apiRouter.post("/getProfileViewingData.php", getProfileViewingDataPostController);
|
|
||||||
apiRouter.post("/getVoidProjectionRewards.php", getVoidProjectionRewardsController);
|
apiRouter.post("/getVoidProjectionRewards.php", getVoidProjectionRewardsController);
|
||||||
apiRouter.post("/gifting.php", giftingController);
|
apiRouter.post("/gifting.php", giftingController);
|
||||||
apiRouter.post("/gildWeapon.php", gildWeaponController);
|
apiRouter.post("/gildWeapon.php", gildWeaponController);
|
||||||
@ -288,10 +269,8 @@ apiRouter.post("/playerSkills.php", playerSkillsController);
|
|||||||
apiRouter.post("/postGuildAdvertisement.php", postGuildAdvertisementController);
|
apiRouter.post("/postGuildAdvertisement.php", postGuildAdvertisementController);
|
||||||
apiRouter.post("/projectionManager.php", projectionManagerController);
|
apiRouter.post("/projectionManager.php", projectionManagerController);
|
||||||
apiRouter.post("/purchase.php", purchaseController);
|
apiRouter.post("/purchase.php", purchaseController);
|
||||||
apiRouter.post("/questControl.php", questControlController); // U17
|
|
||||||
apiRouter.post("/redeemPromoCode.php", redeemPromoCodeController);
|
apiRouter.post("/redeemPromoCode.php", redeemPromoCodeController);
|
||||||
apiRouter.post("/releasePet.php", releasePetController);
|
apiRouter.post("/releasePet.php", releasePetController);
|
||||||
apiRouter.post("/removeFriend.php", removeFriendPostController);
|
|
||||||
apiRouter.post("/removeFromGuild.php", removeFromGuildController);
|
apiRouter.post("/removeFromGuild.php", removeFromGuildController);
|
||||||
apiRouter.post("/removeIgnoredUser.php", removeIgnoredUserController);
|
apiRouter.post("/removeIgnoredUser.php", removeIgnoredUserController);
|
||||||
apiRouter.post("/rerollRandomMod.php", rerollRandomModController);
|
apiRouter.post("/rerollRandomMod.php", rerollRandomModController);
|
||||||
@ -306,7 +285,6 @@ apiRouter.post("/setDojoComponentColors.php", setDojoComponentColorsController);
|
|||||||
apiRouter.post("/setDojoComponentMessage.php", setDojoComponentMessageController);
|
apiRouter.post("/setDojoComponentMessage.php", setDojoComponentMessageController);
|
||||||
apiRouter.post("/setDojoComponentSettings.php", setDojoComponentSettingsController);
|
apiRouter.post("/setDojoComponentSettings.php", setDojoComponentSettingsController);
|
||||||
apiRouter.post("/setEquippedInstrument.php", setEquippedInstrumentController);
|
apiRouter.post("/setEquippedInstrument.php", setEquippedInstrumentController);
|
||||||
apiRouter.post("/setFriendNote.php", setFriendNoteController);
|
|
||||||
apiRouter.post("/setGuildMotd.php", setGuildMotdController);
|
apiRouter.post("/setGuildMotd.php", setGuildMotdController);
|
||||||
apiRouter.post("/setHubNpcCustomizations.php", setHubNpcCustomizationsController);
|
apiRouter.post("/setHubNpcCustomizations.php", setHubNpcCustomizationsController);
|
||||||
apiRouter.post("/setPlacedDecoInfo.php", setPlacedDecoInfoController);
|
apiRouter.post("/setPlacedDecoInfo.php", setPlacedDecoInfoController);
|
||||||
@ -326,7 +304,6 @@ apiRouter.post("/trainingResult.php", trainingResultController);
|
|||||||
apiRouter.post("/unlockShipFeature.php", unlockShipFeatureController);
|
apiRouter.post("/unlockShipFeature.php", unlockShipFeatureController);
|
||||||
apiRouter.post("/updateAlignment.php", updateAlignmentController);
|
apiRouter.post("/updateAlignment.php", updateAlignmentController);
|
||||||
apiRouter.post("/updateChallengeProgress.php", updateChallengeProgressController);
|
apiRouter.post("/updateChallengeProgress.php", updateChallengeProgressController);
|
||||||
apiRouter.post("/updateInventory.php", missionInventoryUpdateController); // U26 and below
|
|
||||||
apiRouter.post("/updateNodeIntros.php", genericUpdateController);
|
apiRouter.post("/updateNodeIntros.php", genericUpdateController);
|
||||||
apiRouter.post("/updateQuest.php", updateQuestController);
|
apiRouter.post("/updateQuest.php", updateQuestController);
|
||||||
apiRouter.post("/updateSession.php", updateSessionPostController);
|
apiRouter.post("/updateSession.php", updateSessionPostController);
|
||||||
|
@ -10,7 +10,6 @@ import { getAccountInfoController } from "@/src/controllers/custom/getAccountInf
|
|||||||
import { renameAccountController } from "@/src/controllers/custom/renameAccountController";
|
import { renameAccountController } from "@/src/controllers/custom/renameAccountController";
|
||||||
import { ircDroppedController } from "@/src/controllers/custom/ircDroppedController";
|
import { ircDroppedController } from "@/src/controllers/custom/ircDroppedController";
|
||||||
import { unlockAllIntrinsicsController } from "@/src/controllers/custom/unlockAllIntrinsicsController";
|
import { unlockAllIntrinsicsController } from "@/src/controllers/custom/unlockAllIntrinsicsController";
|
||||||
import { addMissingMaxRankModsController } from "@/src/controllers/custom/addMissingMaxRankModsController";
|
|
||||||
|
|
||||||
import { createAccountController } from "@/src/controllers/custom/createAccountController";
|
import { createAccountController } from "@/src/controllers/custom/createAccountController";
|
||||||
import { createMessageController } from "@/src/controllers/custom/createMessageController";
|
import { createMessageController } from "@/src/controllers/custom/createMessageController";
|
||||||
@ -18,11 +17,10 @@ import { addCurrencyController } from "@/src/controllers/custom/addCurrencyContr
|
|||||||
import { addItemsController } from "@/src/controllers/custom/addItemsController";
|
import { addItemsController } from "@/src/controllers/custom/addItemsController";
|
||||||
import { addXpController } from "@/src/controllers/custom/addXpController";
|
import { addXpController } from "@/src/controllers/custom/addXpController";
|
||||||
import { importController } from "@/src/controllers/custom/importController";
|
import { importController } from "@/src/controllers/custom/importController";
|
||||||
import { manageQuestsController } from "@/src/controllers/custom/manageQuestsController";
|
|
||||||
import { setEvolutionProgressController } from "@/src/controllers/custom/setEvolutionProgressController";
|
|
||||||
|
|
||||||
import { getConfigDataController } from "@/src/controllers/custom/getConfigDataController";
|
import { getConfigDataController } from "@/src/controllers/custom/getConfigDataController";
|
||||||
import { updateConfigDataController } from "@/src/controllers/custom/updateConfigDataController";
|
import { updateConfigDataController } from "@/src/controllers/custom/updateConfigDataController";
|
||||||
|
import { manageQuestsController } from "@/src/controllers/custom/manageQuestsController";
|
||||||
|
|
||||||
const customRouter = express.Router();
|
const customRouter = express.Router();
|
||||||
|
|
||||||
@ -36,7 +34,6 @@ customRouter.get("/getAccountInfo", getAccountInfoController);
|
|||||||
customRouter.get("/renameAccount", renameAccountController);
|
customRouter.get("/renameAccount", renameAccountController);
|
||||||
customRouter.get("/ircDropped", ircDroppedController);
|
customRouter.get("/ircDropped", ircDroppedController);
|
||||||
customRouter.get("/unlockAllIntrinsics", unlockAllIntrinsicsController);
|
customRouter.get("/unlockAllIntrinsics", unlockAllIntrinsicsController);
|
||||||
customRouter.get("/addMissingMaxRankMods", addMissingMaxRankModsController);
|
|
||||||
|
|
||||||
customRouter.post("/createAccount", createAccountController);
|
customRouter.post("/createAccount", createAccountController);
|
||||||
customRouter.post("/createMessage", createMessageController);
|
customRouter.post("/createMessage", createMessageController);
|
||||||
@ -45,7 +42,6 @@ customRouter.post("/addItems", addItemsController);
|
|||||||
customRouter.post("/addXp", addXpController);
|
customRouter.post("/addXp", addXpController);
|
||||||
customRouter.post("/import", importController);
|
customRouter.post("/import", importController);
|
||||||
customRouter.post("/manageQuests", manageQuestsController);
|
customRouter.post("/manageQuests", manageQuestsController);
|
||||||
customRouter.post("/setEvolutionProgress", setEvolutionProgressController);
|
|
||||||
|
|
||||||
customRouter.get("/config", getConfigDataController);
|
customRouter.get("/config", getConfigDataController);
|
||||||
customRouter.post("/config", updateConfigDataController);
|
customRouter.post("/config", updateConfigDataController);
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
import { aggregateSessionsController } from "@/src/controllers/dynamic/aggregateSessionsController";
|
import { aggregateSessionsController } from "@/src/controllers/dynamic/aggregateSessionsController";
|
||||||
import { getGuildAdsController } from "@/src/controllers/dynamic/getGuildAdsController";
|
import { getGuildAdsController } from "@/src/controllers/dynamic/getGuildAdsController";
|
||||||
import { getProfileViewingDataGetController } from "@/src/controllers/dynamic/getProfileViewingDataController";
|
import { getProfileViewingDataController } from "@/src/controllers/dynamic/getProfileViewingDataController";
|
||||||
import { worldStateController } from "@/src/controllers/dynamic/worldStateController";
|
import { worldStateController } from "@/src/controllers/dynamic/worldStateController";
|
||||||
|
|
||||||
const dynamicController = express.Router();
|
const dynamicController = express.Router();
|
||||||
|
|
||||||
dynamicController.get("/aggregateSessions.php", aggregateSessionsController);
|
dynamicController.get("/aggregateSessions.php", aggregateSessionsController);
|
||||||
dynamicController.get("/getGuildAds.php", getGuildAdsController);
|
dynamicController.get("/getGuildAds.php", getGuildAdsController);
|
||||||
dynamicController.get("/getProfileViewingData.php", getProfileViewingDataGetController);
|
dynamicController.get("/getProfileViewingData.php", getProfileViewingDataController);
|
||||||
dynamicController.get("/worldState.php", worldStateController);
|
dynamicController.get("/worldState.php", worldStateController);
|
||||||
|
|
||||||
export { dynamicController };
|
export { dynamicController };
|
||||||
|
@ -24,9 +24,6 @@ interface IConfig {
|
|||||||
infiniteEndo?: boolean;
|
infiniteEndo?: boolean;
|
||||||
infiniteRegalAya?: boolean;
|
infiniteRegalAya?: boolean;
|
||||||
infiniteHelminthMaterials?: boolean;
|
infiniteHelminthMaterials?: boolean;
|
||||||
claimingBlueprintRefundsIngredients?: boolean;
|
|
||||||
dontSubtractVoidTraces?: boolean;
|
|
||||||
dontSubtractConsumables?: boolean;
|
|
||||||
unlockAllShipFeatures?: boolean;
|
unlockAllShipFeatures?: boolean;
|
||||||
unlockAllShipDecorations?: boolean;
|
unlockAllShipDecorations?: boolean;
|
||||||
unlockAllFlavourItems?: boolean;
|
unlockAllFlavourItems?: boolean;
|
||||||
@ -44,11 +41,8 @@ interface IConfig {
|
|||||||
noVendorPurchaseLimits?: boolean;
|
noVendorPurchaseLimits?: boolean;
|
||||||
noDeathMarks?: boolean;
|
noDeathMarks?: boolean;
|
||||||
noKimCooldowns?: boolean;
|
noKimCooldowns?: boolean;
|
||||||
syndicateMissionsRepeatable?: boolean;
|
|
||||||
instantFinishRivenChallenge?: boolean;
|
|
||||||
instantResourceExtractorDrones?: boolean;
|
instantResourceExtractorDrones?: boolean;
|
||||||
noResourceExtractorDronesDamage?: boolean;
|
noResourceExtractorDronesDamage?: boolean;
|
||||||
skipClanKeyCrafting?: boolean;
|
|
||||||
noDojoRoomBuildStage?: boolean;
|
noDojoRoomBuildStage?: boolean;
|
||||||
noDojoDecoBuildStage?: boolean;
|
noDojoDecoBuildStage?: boolean;
|
||||||
fastDojoRoomDestruction?: boolean;
|
fastDojoRoomDestruction?: boolean;
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
import { IFriendInfo } from "../types/friendTypes";
|
|
||||||
import { getInventory } from "./inventoryService";
|
|
||||||
import { config } from "./configService";
|
|
||||||
import { Account } from "../models/loginModel";
|
|
||||||
import { Types } from "mongoose";
|
|
||||||
import { Friendship } from "../models/friendModel";
|
|
||||||
import { fromOid, toMongoDate } from "../helpers/inventoryHelpers";
|
|
||||||
|
|
||||||
export const addAccountDataToFriendInfo = async (info: IFriendInfo): Promise<void> => {
|
|
||||||
const account = (await Account.findById(fromOid(info._id), "DisplayName LastLogin"))!;
|
|
||||||
info.DisplayName = account.DisplayName;
|
|
||||||
info.LastLogin = toMongoDate(account.LastLogin);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const addInventoryDataToFriendInfo = async (info: IFriendInfo): Promise<void> => {
|
|
||||||
const inventory = await getInventory(fromOid(info._id), "PlayerLevel ActiveAvatarImageType");
|
|
||||||
info.PlayerLevel = config.spoofMasteryRank == -1 ? inventory.PlayerLevel : config.spoofMasteryRank;
|
|
||||||
info.ActiveAvatarImageType = inventory.ActiveAvatarImageType;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const areFriends = async (a: Types.ObjectId | string, b: Types.ObjectId | string): Promise<boolean> => {
|
|
||||||
const [aAddedB, bAddedA] = await Promise.all([
|
|
||||||
Friendship.exists({ owner: a, friend: b }),
|
|
||||||
Friendship.exists({ owner: b, friend: a })
|
|
||||||
]);
|
|
||||||
return Boolean(aAddedB && bAddedA);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const areFriendsOfFriends = async (a: Types.ObjectId | string, b: Types.ObjectId | string): Promise<boolean> => {
|
|
||||||
const [aInternalFriends, bInternalFriends] = await Promise.all([
|
|
||||||
Friendship.find({ owner: a }),
|
|
||||||
Friendship.find({ owner: b })
|
|
||||||
]);
|
|
||||||
for (const aInternalFriend of aInternalFriends) {
|
|
||||||
if (bInternalFriends.find(x => x.friend.equals(aInternalFriend.friend))) {
|
|
||||||
const c = aInternalFriend.friend;
|
|
||||||
const [cAcceptedA, cAcceptedB] = await Promise.all([
|
|
||||||
Friendship.exists({ owner: c, friend: a }),
|
|
||||||
Friendship.exists({ owner: c, friend: b })
|
|
||||||
]);
|
|
||||||
if (cAcceptedA && cAcceptedB) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
@ -1,6 +1,6 @@
|
|||||||
import { Request } from "express";
|
import { Request } from "express";
|
||||||
import { getAccountIdForRequest, TAccountDocument } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { addLevelKeys, addRecipes, combineInventoryChanges, getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { Alliance, AllianceMember, Guild, GuildAd, GuildMember, TGuildDatabaseDocument } from "@/src/models/guildModel";
|
import { Alliance, AllianceMember, Guild, GuildAd, GuildMember, TGuildDatabaseDocument } from "@/src/models/guildModel";
|
||||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
import {
|
import {
|
||||||
@ -19,11 +19,12 @@ import {
|
|||||||
IGuildVault,
|
IGuildVault,
|
||||||
ITechProjectDatabase
|
ITechProjectDatabase
|
||||||
} from "@/src/types/guildTypes";
|
} from "@/src/types/guildTypes";
|
||||||
import { toMongoDate, toOid, toOid2 } from "@/src/helpers/inventoryHelpers";
|
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { ExportDojoRecipes, ExportResources, IDojoBuild, IDojoResearch } from "warframe-public-export-plus";
|
import { ExportDojoRecipes, ExportResources, IDojoBuild, IDojoResearch } from "warframe-public-export-plus";
|
||||||
import { logger } from "../utils/logger";
|
import { logger } from "../utils/logger";
|
||||||
import { config } from "./configService";
|
import { config } from "./configService";
|
||||||
|
import { Account } from "../models/loginModel";
|
||||||
import { getRandomInt } from "./rngService";
|
import { getRandomInt } from "./rngService";
|
||||||
import { Inbox } from "../models/inboxModel";
|
import { Inbox } from "../models/inboxModel";
|
||||||
import { IFusionTreasure, ITypeCount } from "../types/inventoryTypes/inventoryTypes";
|
import { IFusionTreasure, ITypeCount } from "../types/inventoryTypes/inventoryTypes";
|
||||||
@ -31,7 +32,6 @@ import { IInventoryChanges } from "../types/purchaseTypes";
|
|||||||
import { parallelForeach } from "../utils/async-utils";
|
import { parallelForeach } from "../utils/async-utils";
|
||||||
import allDecoRecipes from "@/static/fixed_responses/allDecoRecipes.json";
|
import allDecoRecipes from "@/static/fixed_responses/allDecoRecipes.json";
|
||||||
import { createMessage } from "./inboxService";
|
import { createMessage } from "./inboxService";
|
||||||
import { addAccountDataToFriendInfo, addInventoryDataToFriendInfo } from "./friendService";
|
|
||||||
|
|
||||||
export const getGuildForRequest = async (req: Request): Promise<TGuildDatabaseDocument> => {
|
export const getGuildForRequest = async (req: Request): Promise<TGuildDatabaseDocument> => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -54,10 +54,7 @@ export const getGuildForRequestEx = async (
|
|||||||
return guild;
|
return guild;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGuildClient = async (
|
export const getGuildClient = async (guild: TGuildDatabaseDocument, accountId: string): Promise<IGuildClient> => {
|
||||||
guild: TGuildDatabaseDocument,
|
|
||||||
account: TAccountDocument
|
|
||||||
): Promise<IGuildClient> => {
|
|
||||||
const guildMembers = await GuildMember.find({ guildId: guild._id });
|
const guildMembers = await GuildMember.find({ guildId: guild._id });
|
||||||
|
|
||||||
const members: IGuildMemberClient[] = [];
|
const members: IGuildMemberClient[] = [];
|
||||||
@ -65,30 +62,34 @@ export const getGuildClient = async (
|
|||||||
const dataFillInPromises: Promise<void>[] = [];
|
const dataFillInPromises: Promise<void>[] = [];
|
||||||
for (const guildMember of guildMembers) {
|
for (const guildMember of guildMembers) {
|
||||||
const member: IGuildMemberClient = {
|
const member: IGuildMemberClient = {
|
||||||
_id: toOid2(guildMember.accountId, account.BuildLabel),
|
_id: toOid(guildMember.accountId),
|
||||||
Rank: guildMember.rank,
|
Rank: guildMember.rank,
|
||||||
Status: guildMember.status,
|
Status: guildMember.status,
|
||||||
Note: guildMember.RequestMsg,
|
Note: guildMember.RequestMsg,
|
||||||
RequestExpiry: guildMember.RequestExpiry ? toMongoDate(guildMember.RequestExpiry) : undefined
|
RequestExpiry: guildMember.RequestExpiry ? toMongoDate(guildMember.RequestExpiry) : undefined
|
||||||
};
|
};
|
||||||
if (guildMember.accountId.equals(account._id)) {
|
if (guildMember.accountId.equals(accountId)) {
|
||||||
missingEntry = false;
|
missingEntry = false;
|
||||||
} else {
|
} else {
|
||||||
dataFillInPromises.push(addAccountDataToFriendInfo(member));
|
dataFillInPromises.push(
|
||||||
dataFillInPromises.push(addInventoryDataToFriendInfo(member));
|
(async (): Promise<void> => {
|
||||||
|
member.DisplayName = (await Account.findById(guildMember.accountId, "DisplayName"))!.DisplayName;
|
||||||
|
})()
|
||||||
|
);
|
||||||
|
dataFillInPromises.push(fillInInventoryDataForGuildMember(member));
|
||||||
}
|
}
|
||||||
members.push(member);
|
members.push(member);
|
||||||
}
|
}
|
||||||
if (missingEntry) {
|
if (missingEntry) {
|
||||||
// Handle clans created prior to creation of the GuildMember model.
|
// Handle clans created prior to creation of the GuildMember model.
|
||||||
await GuildMember.insertOne({
|
await GuildMember.insertOne({
|
||||||
accountId: account._id,
|
accountId: accountId,
|
||||||
guildId: guild._id,
|
guildId: guild._id,
|
||||||
status: 0,
|
status: 0,
|
||||||
rank: 0
|
rank: 0
|
||||||
});
|
});
|
||||||
members.push({
|
members.push({
|
||||||
_id: toOid2(account._id, account.BuildLabel),
|
_id: { $oid: accountId },
|
||||||
Status: 0,
|
Status: 0,
|
||||||
Rank: 0
|
Rank: 0
|
||||||
});
|
});
|
||||||
@ -97,23 +98,22 @@ export const getGuildClient = async (
|
|||||||
await Promise.all(dataFillInPromises);
|
await Promise.all(dataFillInPromises);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_id: toOid2(guild._id, account.BuildLabel),
|
_id: toOid(guild._id),
|
||||||
Name: guild.Name,
|
Name: guild.Name,
|
||||||
MOTD: guild.MOTD,
|
MOTD: guild.MOTD,
|
||||||
LongMOTD: guild.LongMOTD,
|
LongMOTD: guild.LongMOTD,
|
||||||
Members: members,
|
Members: members,
|
||||||
Ranks: guild.Ranks,
|
Ranks: guild.Ranks,
|
||||||
Tier: guild.Tier,
|
Tier: guild.Tier,
|
||||||
Emblem: guild.Emblem,
|
|
||||||
Vault: getGuildVault(guild),
|
Vault: getGuildVault(guild),
|
||||||
ActiveDojoColorResearch: guild.ActiveDojoColorResearch,
|
ActiveDojoColorResearch: guild.ActiveDojoColorResearch,
|
||||||
Class: guild.Class,
|
Class: guild.Class,
|
||||||
XP: guild.XP,
|
XP: guild.XP,
|
||||||
IsContributor: !!guild.CeremonyContributors?.find(x => x.equals(account._id)),
|
IsContributor: !!guild.CeremonyContributors?.find(x => x.equals(accountId)),
|
||||||
NumContributors: guild.CeremonyContributors?.length ?? 0,
|
NumContributors: guild.CeremonyContributors?.length ?? 0,
|
||||||
CeremonyResetDate: guild.CeremonyResetDate ? toMongoDate(guild.CeremonyResetDate) : undefined,
|
CeremonyResetDate: guild.CeremonyResetDate ? toMongoDate(guild.CeremonyResetDate) : undefined,
|
||||||
AutoContributeFromVault: guild.AutoContributeFromVault,
|
AutoContributeFromVault: guild.AutoContributeFromVault,
|
||||||
AllianceId: guild.AllianceId ? toOid2(guild.AllianceId, account.BuildLabel) : undefined
|
AllianceId: guild.AllianceId ? toOid(guild.AllianceId) : undefined
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -133,11 +133,10 @@ export const getGuildVault = (guild: TGuildDatabaseDocument): IGuildVault => {
|
|||||||
export const getDojoClient = async (
|
export const getDojoClient = async (
|
||||||
guild: TGuildDatabaseDocument,
|
guild: TGuildDatabaseDocument,
|
||||||
status: number,
|
status: number,
|
||||||
componentId?: Types.ObjectId | string,
|
componentId: Types.ObjectId | string | undefined = undefined
|
||||||
buildLabel?: string
|
|
||||||
): Promise<IDojoClient> => {
|
): Promise<IDojoClient> => {
|
||||||
const dojo: IDojoClient = {
|
const dojo: IDojoClient = {
|
||||||
_id: toOid2(guild._id, buildLabel),
|
_id: { $oid: guild._id.toString() },
|
||||||
Name: guild.Name,
|
Name: guild.Name,
|
||||||
Tier: guild.Tier,
|
Tier: guild.Tier,
|
||||||
GuildEmblem: guild.Emblem,
|
GuildEmblem: guild.Emblem,
|
||||||
@ -159,8 +158,8 @@ export const getDojoClient = async (
|
|||||||
for (const dojoComponent of guild.DojoComponents) {
|
for (const dojoComponent of guild.DojoComponents) {
|
||||||
if (!componentId || dojoComponent._id.equals(componentId)) {
|
if (!componentId || dojoComponent._id.equals(componentId)) {
|
||||||
const clientComponent: IDojoComponentClient = {
|
const clientComponent: IDojoComponentClient = {
|
||||||
id: toOid2(dojoComponent._id, buildLabel),
|
id: toOid(dojoComponent._id),
|
||||||
SortId: toOid2(dojoComponent.SortId ?? dojoComponent._id, buildLabel), // always providing a SortId so decos don't need repositioning to reparent
|
SortId: toOid(dojoComponent.SortId ?? dojoComponent._id), // always providing a SortId so decos don't need repositioning to reparent
|
||||||
pf: dojoComponent.pf,
|
pf: dojoComponent.pf,
|
||||||
ppf: dojoComponent.ppf,
|
ppf: dojoComponent.ppf,
|
||||||
Name: dojoComponent.Name,
|
Name: dojoComponent.Name,
|
||||||
@ -169,15 +168,12 @@ export const getDojoClient = async (
|
|||||||
Settings: dojoComponent.Settings
|
Settings: dojoComponent.Settings
|
||||||
};
|
};
|
||||||
if (dojoComponent.pi) {
|
if (dojoComponent.pi) {
|
||||||
clientComponent.pi = toOid2(dojoComponent.pi, buildLabel);
|
clientComponent.pi = toOid(dojoComponent.pi);
|
||||||
clientComponent.op = dojoComponent.op!;
|
clientComponent.op = dojoComponent.op!;
|
||||||
clientComponent.pp = dojoComponent.pp!;
|
clientComponent.pp = dojoComponent.pp!;
|
||||||
}
|
}
|
||||||
if (dojoComponent.CompletionTime) {
|
if (dojoComponent.CompletionTime) {
|
||||||
clientComponent.CompletionTime = toMongoDate(dojoComponent.CompletionTime);
|
clientComponent.CompletionTime = toMongoDate(dojoComponent.CompletionTime);
|
||||||
clientComponent.TimeRemaining = Math.trunc(
|
|
||||||
(dojoComponent.CompletionTime.getTime() - Date.now()) / 1000
|
|
||||||
);
|
|
||||||
if (dojoComponent.CompletionLogPending && Date.now() >= dojoComponent.CompletionTime.getTime()) {
|
if (dojoComponent.CompletionLogPending && Date.now() >= dojoComponent.CompletionTime.getTime()) {
|
||||||
const entry = guild.RoomChanges?.find(x => x.componentId.equals(dojoComponent._id));
|
const entry = guild.RoomChanges?.find(x => x.componentId.equals(dojoComponent._id));
|
||||||
if (entry) {
|
if (entry) {
|
||||||
@ -213,9 +209,6 @@ export const getDojoClient = async (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
clientComponent.DestructionTime = toMongoDate(dojoComponent.DestructionTime);
|
clientComponent.DestructionTime = toMongoDate(dojoComponent.DestructionTime);
|
||||||
clientComponent.DestructionTimeRemaining = Math.trunc(
|
|
||||||
(dojoComponent.DestructionTime.getTime() - Date.now()) / 1000
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clientComponent.RegularCredits = dojoComponent.RegularCredits;
|
clientComponent.RegularCredits = dojoComponent.RegularCredits;
|
||||||
@ -225,11 +218,10 @@ export const getDojoClient = async (
|
|||||||
clientComponent.Decos = [];
|
clientComponent.Decos = [];
|
||||||
for (const deco of dojoComponent.Decos) {
|
for (const deco of dojoComponent.Decos) {
|
||||||
const clientDeco: IDojoDecoClient = {
|
const clientDeco: IDojoDecoClient = {
|
||||||
id: toOid2(deco._id, buildLabel),
|
id: toOid(deco._id),
|
||||||
Type: deco.Type,
|
Type: deco.Type,
|
||||||
Pos: deco.Pos,
|
Pos: deco.Pos,
|
||||||
Rot: deco.Rot,
|
Rot: deco.Rot,
|
||||||
Scale: deco.Scale,
|
|
||||||
Name: deco.Name,
|
Name: deco.Name,
|
||||||
Sockets: deco.Sockets,
|
Sockets: deco.Sockets,
|
||||||
PictureFrameInfo: deco.PictureFrameInfo
|
PictureFrameInfo: deco.PictureFrameInfo
|
||||||
@ -251,7 +243,6 @@ export const getDojoClient = async (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
clientDeco.CompletionTime = toMongoDate(deco.CompletionTime);
|
clientDeco.CompletionTime = toMongoDate(deco.CompletionTime);
|
||||||
clientDeco.TimeRemaining = Math.trunc((deco.CompletionTime.getTime() - Date.now()) / 1000);
|
|
||||||
} else {
|
} else {
|
||||||
clientDeco.RegularCredits = deco.RegularCredits;
|
clientDeco.RegularCredits = deco.RegularCredits;
|
||||||
clientDeco.MiscItems = deco.MiscItems;
|
clientDeco.MiscItems = deco.MiscItems;
|
||||||
@ -449,7 +440,7 @@ export const addGuildMemberShipDecoContribution = (guildMember: IGuildMemberData
|
|||||||
export const processDojoBuildMaterialsGathered = (guild: TGuildDatabaseDocument, build: IDojoBuild): void => {
|
export const processDojoBuildMaterialsGathered = (guild: TGuildDatabaseDocument, build: IDojoBuild): void => {
|
||||||
if (build.guildXpValue) {
|
if (build.guildXpValue) {
|
||||||
guild.ClaimedXP ??= [];
|
guild.ClaimedXP ??= [];
|
||||||
if (guild.ClaimedXP.indexOf(build.resultType) == -1) {
|
if (!guild.ClaimedXP.find(x => x == build.resultType)) {
|
||||||
guild.ClaimedXP.push(build.resultType);
|
guild.ClaimedXP.push(build.resultType);
|
||||||
guild.XP += build.guildXpValue;
|
guild.XP += build.guildXpValue;
|
||||||
}
|
}
|
||||||
@ -466,6 +457,12 @@ export const setDojoRoomLogFunded = (guild: TGuildDatabaseDocument, component: I
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const fillInInventoryDataForGuildMember = async (member: IGuildMemberClient): Promise<void> => {
|
||||||
|
const inventory = await getInventory(member._id.$oid, "PlayerLevel ActiveAvatarImageType");
|
||||||
|
member.PlayerLevel = config.spoofMasteryRank == -1 ? inventory.PlayerLevel : config.spoofMasteryRank;
|
||||||
|
member.ActiveAvatarImageType = inventory.ActiveAvatarImageType;
|
||||||
|
};
|
||||||
|
|
||||||
export const createUniqueClanName = async (name: string): Promise<string> => {
|
export const createUniqueClanName = async (name: string): Promise<string> => {
|
||||||
const initialDiscriminator = getRandomInt(0, 999);
|
const initialDiscriminator = getRandomInt(0, 999);
|
||||||
let discriminator = initialDiscriminator;
|
let discriminator = initialDiscriminator;
|
||||||
@ -506,7 +503,7 @@ export const hasGuildPermissionEx = (
|
|||||||
|
|
||||||
export const removePigmentsFromGuildMembers = async (guildId: string | Types.ObjectId): Promise<void> => {
|
export const removePigmentsFromGuildMembers = async (guildId: string | Types.ObjectId): Promise<void> => {
|
||||||
const members = await GuildMember.find({ guildId, status: 0 }, "accountId");
|
const members = await GuildMember.find({ guildId, status: 0 }, "accountId");
|
||||||
await parallelForeach(members, async member => {
|
for (const member of members) {
|
||||||
const inventory = await getInventory(member.accountId.toString(), "MiscItems");
|
const inventory = await getInventory(member.accountId.toString(), "MiscItems");
|
||||||
const index = inventory.MiscItems.findIndex(
|
const index = inventory.MiscItems.findIndex(
|
||||||
x => x.ItemType == "/Lotus/Types/Items/Research/DojoColors/GenericDojoColorPigment"
|
x => x.ItemType == "/Lotus/Types/Items/Research/DojoColors/GenericDojoColorPigment"
|
||||||
@ -515,7 +512,7 @@ export const removePigmentsFromGuildMembers = async (guildId: string | Types.Obj
|
|||||||
inventory.MiscItems.splice(index, 1);
|
inventory.MiscItems.splice(index, 1);
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const processGuildTechProjectContributionsUpdate = async (
|
export const processGuildTechProjectContributionsUpdate = async (
|
||||||
@ -555,7 +552,7 @@ export const setGuildTechLogState = (
|
|||||||
guild: TGuildDatabaseDocument,
|
guild: TGuildDatabaseDocument,
|
||||||
type: string,
|
type: string,
|
||||||
state: number,
|
state: number,
|
||||||
dateTime?: Date
|
dateTime: Date | undefined = undefined
|
||||||
): boolean => {
|
): boolean => {
|
||||||
guild.TechChanges ??= [];
|
guild.TechChanges ??= [];
|
||||||
const entry = guild.TechChanges.find(x => x.details == type);
|
const entry = guild.TechChanges.find(x => x.details == type);
|
||||||
@ -658,32 +655,6 @@ export const checkClanAscensionHasRequiredContributors = async (guild: TGuildDat
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const giveClanKey = (inventory: TInventoryDatabaseDocument, inventoryChanges?: IInventoryChanges): void => {
|
|
||||||
if (config.skipClanKeyCrafting) {
|
|
||||||
const levelKeyChanges = [
|
|
||||||
{
|
|
||||||
ItemType: "/Lotus/Types/Keys/DojoKey",
|
|
||||||
ItemCount: 1
|
|
||||||
}
|
|
||||||
];
|
|
||||||
addLevelKeys(inventory, levelKeyChanges);
|
|
||||||
if (inventoryChanges) {
|
|
||||||
combineInventoryChanges(inventoryChanges, { LevelKeys: levelKeyChanges });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const recipeChanges = [
|
|
||||||
{
|
|
||||||
ItemType: "/Lotus/Types/Keys/DojoKeyBlueprint",
|
|
||||||
ItemCount: 1
|
|
||||||
}
|
|
||||||
];
|
|
||||||
addRecipes(inventory, recipeChanges);
|
|
||||||
if (inventoryChanges) {
|
|
||||||
combineInventoryChanges(inventoryChanges, { Recipes: recipeChanges });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const removeDojoKeyItems = (inventory: TInventoryDatabaseDocument): IInventoryChanges => {
|
export const removeDojoKeyItems = (inventory: TInventoryDatabaseDocument): IInventoryChanges => {
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
const inventoryChanges: IInventoryChanges = {};
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import { Types } from "mongoose";
|
|||||||
import {
|
import {
|
||||||
IEquipmentClient,
|
IEquipmentClient,
|
||||||
IEquipmentDatabase,
|
IEquipmentDatabase,
|
||||||
IItemConfig,
|
|
||||||
IOperatorConfigClient,
|
IOperatorConfigClient,
|
||||||
IOperatorConfigDatabase
|
IOperatorConfigDatabase
|
||||||
} from "../types/inventoryTypes/commonInventoryTypes";
|
} from "../types/inventoryTypes/commonInventoryTypes";
|
||||||
@ -38,7 +37,6 @@ import {
|
|||||||
} from "../types/inventoryTypes/inventoryTypes";
|
} from "../types/inventoryTypes/inventoryTypes";
|
||||||
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
||||||
import { ILoadoutConfigDatabase, ILoadoutDatabase } from "../types/saveLoadoutTypes";
|
import { ILoadoutConfigDatabase, ILoadoutDatabase } from "../types/saveLoadoutTypes";
|
||||||
import { slotNames } from "../types/purchaseTypes";
|
|
||||||
|
|
||||||
const convertDate = (value: IMongoDate): Date => {
|
const convertDate = (value: IMongoDate): Date => {
|
||||||
return new Date(parseInt(value.$date.$numberLong));
|
return new Date(parseInt(value.$date.$numberLong));
|
||||||
@ -170,25 +168,10 @@ const convertPendingRecipe = (client: IPendingRecipeClient): IPendingRecipeDatab
|
|||||||
const convertNemesis = (client: INemesisClient): INemesisDatabase => {
|
const convertNemesis = (client: INemesisClient): INemesisDatabase => {
|
||||||
return {
|
return {
|
||||||
...client,
|
...client,
|
||||||
fp: BigInt(client.fp),
|
|
||||||
d: convertDate(client.d)
|
d: convertDate(client.d)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Empty objects from live may have been encoded as empty arrays because of PHP.
|
|
||||||
const convertItemConfig = <T extends IItemConfig>(client: T): T => {
|
|
||||||
return {
|
|
||||||
...client,
|
|
||||||
pricol: Array.isArray(client.pricol) ? {} : client.pricol,
|
|
||||||
attcol: Array.isArray(client.attcol) ? {} : client.attcol,
|
|
||||||
sigcol: Array.isArray(client.sigcol) ? {} : client.sigcol,
|
|
||||||
eyecol: Array.isArray(client.eyecol) ? {} : client.eyecol,
|
|
||||||
facial: Array.isArray(client.facial) ? {} : client.facial,
|
|
||||||
cloth: Array.isArray(client.cloth) ? {} : client.cloth,
|
|
||||||
syancol: Array.isArray(client.syancol) ? {} : client.syancol
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
|
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
|
||||||
for (const key of equipmentKeys) {
|
for (const key of equipmentKeys) {
|
||||||
if (client[key] !== undefined) {
|
if (client[key] !== undefined) {
|
||||||
@ -229,7 +212,20 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
|
|||||||
replaceArray<IOperatorConfigDatabase>(db[key], client[key].map(convertOperatorConfig));
|
replaceArray<IOperatorConfigDatabase>(db[key], client[key].map(convertOperatorConfig));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const key of slotNames) {
|
for (const key of [
|
||||||
|
"SuitBin",
|
||||||
|
"WeaponBin",
|
||||||
|
"SentinelBin",
|
||||||
|
"SpaceSuitBin",
|
||||||
|
"SpaceWeaponBin",
|
||||||
|
"PvpBonusLoadoutBin",
|
||||||
|
"PveBonusLoadoutBin",
|
||||||
|
"RandomModBin",
|
||||||
|
"MechBin",
|
||||||
|
"CrewMemberBin",
|
||||||
|
"OperatorAmpBin",
|
||||||
|
"CrewShipSalvageBin"
|
||||||
|
] as const) {
|
||||||
if (client[key] !== undefined) {
|
if (client[key] !== undefined) {
|
||||||
replaceSlots(db[key], client[key]);
|
replaceSlots(db[key], client[key]);
|
||||||
}
|
}
|
||||||
@ -367,7 +363,7 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
|
|||||||
db.PlayerSkills = client.PlayerSkills;
|
db.PlayerSkills = client.PlayerSkills;
|
||||||
}
|
}
|
||||||
if (client.LotusCustomization !== undefined) {
|
if (client.LotusCustomization !== undefined) {
|
||||||
db.LotusCustomization = convertItemConfig(client.LotusCustomization);
|
db.LotusCustomization = client.LotusCustomization;
|
||||||
}
|
}
|
||||||
if (client.CollectibleSeries !== undefined) {
|
if (client.CollectibleSeries !== undefined) {
|
||||||
db.CollectibleSeries = client.CollectibleSeries;
|
db.CollectibleSeries = client.CollectibleSeries;
|
||||||
@ -377,6 +373,9 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
|
|||||||
db[key] = client[key];
|
db[key] = client[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (client.EndlessXP !== undefined) {
|
||||||
|
db.EndlessXP = client.EndlessXP;
|
||||||
|
}
|
||||||
if (client.SongChallenges !== undefined) {
|
if (client.SongChallenges !== undefined) {
|
||||||
db.SongChallenges = client.SongChallenges;
|
db.SongChallenges = client.SongChallenges;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import {
|
|||||||
IKubrowPetEggDatabase,
|
IKubrowPetEggDatabase,
|
||||||
IKubrowPetEggClient,
|
IKubrowPetEggClient,
|
||||||
ILibraryDailyTaskInfo,
|
ILibraryDailyTaskInfo,
|
||||||
|
ICalendarProgress,
|
||||||
IDroneClient,
|
IDroneClient,
|
||||||
IUpgradeClient,
|
IUpgradeClient,
|
||||||
TPartialStartingGear,
|
TPartialStartingGear,
|
||||||
@ -25,11 +26,7 @@ import {
|
|||||||
ICrewMemberClient,
|
ICrewMemberClient,
|
||||||
Status,
|
Status,
|
||||||
IKubrowPetDetailsDatabase,
|
IKubrowPetDetailsDatabase,
|
||||||
ITraits,
|
ITraits
|
||||||
ICalendarProgress,
|
|
||||||
INemesisWeaponTargetFingerprint,
|
|
||||||
INemesisPetTargetFingerprint,
|
|
||||||
IDialogueDatabase
|
|
||||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdate";
|
import { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdate";
|
||||||
import { IKeyChainRequest, IMissionInventoryUpdateRequest } from "../types/requestTypes";
|
import { IKeyChainRequest, IMissionInventoryUpdateRequest } from "../types/requestTypes";
|
||||||
@ -70,8 +67,6 @@ import {
|
|||||||
import { createShip } from "./shipService";
|
import { createShip } from "./shipService";
|
||||||
import {
|
import {
|
||||||
catbrowDetails,
|
catbrowDetails,
|
||||||
fromMongoDate,
|
|
||||||
fromOid,
|
|
||||||
kubrowDetails,
|
kubrowDetails,
|
||||||
kubrowFurPatternsWeights,
|
kubrowFurPatternsWeights,
|
||||||
kubrowWeights,
|
kubrowWeights,
|
||||||
@ -83,8 +78,6 @@ import libraryDailyTasks from "@/static/fixed_responses/libraryDailyTasks.json";
|
|||||||
import { getRandomElement, getRandomInt, getRandomWeightedReward, SRng } from "./rngService";
|
import { getRandomElement, getRandomInt, getRandomWeightedReward, SRng } from "./rngService";
|
||||||
import { createMessage } from "./inboxService";
|
import { createMessage } from "./inboxService";
|
||||||
import { getMaxStanding } from "@/src/helpers/syndicateStandingHelper";
|
import { getMaxStanding } from "@/src/helpers/syndicateStandingHelper";
|
||||||
import { getWorldState } from "./worldStateService";
|
|
||||||
import { generateNemesisProfile, INemesisProfile } from "../helpers/nemesisHelpers";
|
|
||||||
|
|
||||||
export const createInventory = async (
|
export const createInventory = async (
|
||||||
accountOwnerId: Types.ObjectId,
|
accountOwnerId: Types.ObjectId,
|
||||||
@ -98,6 +91,7 @@ export const createInventory = async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
inventory.LibraryAvailableDailyTaskInfo = createLibraryDailyTask();
|
inventory.LibraryAvailableDailyTaskInfo = createLibraryDailyTask();
|
||||||
|
inventory.CalendarProgress = createCalendar();
|
||||||
inventory.RewardSeed = generateRewardSeed();
|
inventory.RewardSeed = generateRewardSeed();
|
||||||
inventory.DuviriInfo = {
|
inventory.DuviriInfo = {
|
||||||
Seed: generateRewardSeed(),
|
Seed: generateRewardSeed(),
|
||||||
@ -126,15 +120,10 @@ export const createInventory = async (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const generateRewardSeed = (): bigint => {
|
export const generateRewardSeed = (): number => {
|
||||||
const hiDword = getRandomInt(0, 0x7fffffff);
|
const min = -Number.MAX_SAFE_INTEGER;
|
||||||
const loDword = getRandomInt(0, 0xffffffff);
|
const max = Number.MAX_SAFE_INTEGER;
|
||||||
let seed = (BigInt(hiDword) << 32n) | BigInt(loDword);
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
if (Math.random() < 0.5) {
|
|
||||||
seed *= -1n;
|
|
||||||
seed -= 1n;
|
|
||||||
}
|
|
||||||
return seed;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: RawUpgrades might need to return a LastAdded
|
//TODO: RawUpgrades might need to return a LastAdded
|
||||||
@ -149,13 +138,8 @@ const awakeningRewards = [
|
|||||||
|
|
||||||
export const addStartingGear = async (
|
export const addStartingGear = async (
|
||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
startingGear?: TPartialStartingGear
|
startingGear: TPartialStartingGear | undefined = undefined
|
||||||
): Promise<IInventoryChanges> => {
|
): Promise<IInventoryChanges> => {
|
||||||
if (inventory.ReceivedStartingGear) {
|
|
||||||
throw new Error(`account has already received starting gear`);
|
|
||||||
}
|
|
||||||
inventory.ReceivedStartingGear = true;
|
|
||||||
|
|
||||||
const { LongGuns, Pistols, Suits, Melee } = startingGear || {
|
const { LongGuns, Pistols, Suits, Melee } = startingGear || {
|
||||||
LongGuns: [{ ItemType: "/Lotus/Weapons/Tenno/Rifle/Rifle" }],
|
LongGuns: [{ ItemType: "/Lotus/Weapons/Tenno/Rifle/Rifle" }],
|
||||||
Pistols: [{ ItemType: "/Lotus/Weapons/Tenno/Pistol/Pistol" }],
|
Pistols: [{ ItemType: "/Lotus/Weapons/Tenno/Pistol/Pistol" }],
|
||||||
@ -165,22 +149,23 @@ export const addStartingGear = async (
|
|||||||
|
|
||||||
//TODO: properly merge weapon bin changes it is currently static here
|
//TODO: properly merge weapon bin changes it is currently static here
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
const inventoryChanges: IInventoryChanges = {};
|
||||||
addEquipment(inventory, "LongGuns", LongGuns[0].ItemType, { IsNew: false }, inventoryChanges);
|
addEquipment(inventory, "LongGuns", LongGuns[0].ItemType, undefined, inventoryChanges);
|
||||||
addEquipment(inventory, "Pistols", Pistols[0].ItemType, { IsNew: false }, inventoryChanges);
|
addEquipment(inventory, "Pistols", Pistols[0].ItemType, undefined, inventoryChanges);
|
||||||
addEquipment(inventory, "Melee", Melee[0].ItemType, { IsNew: false }, inventoryChanges);
|
addEquipment(inventory, "Melee", Melee[0].ItemType, undefined, inventoryChanges);
|
||||||
await addPowerSuit(inventory, Suits[0].ItemType, { IsNew: false }, inventoryChanges);
|
await addPowerSuit(inventory, Suits[0].ItemType, inventoryChanges);
|
||||||
addEquipment(
|
addEquipment(
|
||||||
inventory,
|
inventory,
|
||||||
"DataKnives",
|
"DataKnives",
|
||||||
"/Lotus/Weapons/Tenno/HackingDevices/TnHackingDevice/TnHackingDeviceWeapon",
|
"/Lotus/Weapons/Tenno/HackingDevices/TnHackingDevice/TnHackingDeviceWeapon",
|
||||||
{ XP: 450_000, IsNew: false },
|
undefined,
|
||||||
inventoryChanges
|
inventoryChanges,
|
||||||
|
{ XP: 450_000 }
|
||||||
);
|
);
|
||||||
addEquipment(
|
addEquipment(
|
||||||
inventory,
|
inventory,
|
||||||
"Scoops",
|
"Scoops",
|
||||||
"/Lotus/Weapons/Tenno/Speedball/SpeedballWeaponTest",
|
"/Lotus/Weapons/Tenno/Speedball/SpeedballWeaponTest",
|
||||||
{ IsNew: false },
|
undefined,
|
||||||
inventoryChanges
|
inventoryChanges
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -204,6 +189,11 @@ export const addStartingGear = async (
|
|||||||
combineInventoryChanges(inventoryChanges, inventoryDelta);
|
combineInventoryChanges(inventoryChanges, inventoryDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inventory.ReceivedStartingGear) {
|
||||||
|
logger.warn(`account already had starting gear but asked for it again?!`);
|
||||||
|
}
|
||||||
|
inventory.ReceivedStartingGear = true;
|
||||||
|
|
||||||
return inventoryChanges;
|
return inventoryChanges;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -218,15 +208,6 @@ export const combineInventoryChanges = (InventoryChanges: IInventoryChanges, del
|
|||||||
for (const key in delta) {
|
for (const key in delta) {
|
||||||
if (!(key in InventoryChanges)) {
|
if (!(key in InventoryChanges)) {
|
||||||
InventoryChanges[key] = delta[key];
|
InventoryChanges[key] = delta[key];
|
||||||
} else if (key == "MiscItems") {
|
|
||||||
for (const deltaItem of delta[key]!) {
|
|
||||||
const existing = InventoryChanges[key]!.find(x => x.ItemType == deltaItem.ItemType);
|
|
||||||
if (existing) {
|
|
||||||
existing.ItemCount += deltaItem.ItemCount;
|
|
||||||
} else {
|
|
||||||
InventoryChanges[key]!.push(deltaItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (Array.isArray(delta[key])) {
|
} else if (Array.isArray(delta[key])) {
|
||||||
const left = InventoryChanges[key] as object[];
|
const left = InventoryChanges[key] as object[];
|
||||||
const right: object[] = delta[key];
|
const right: object[] = delta[key];
|
||||||
@ -259,7 +240,7 @@ export const combineInventoryChanges = (InventoryChanges: IInventoryChanges, del
|
|||||||
|
|
||||||
export const getInventory = async (
|
export const getInventory = async (
|
||||||
accountOwnerId: string,
|
accountOwnerId: string,
|
||||||
projection?: string
|
projection: string | undefined = undefined
|
||||||
): Promise<TInventoryDatabaseDocument> => {
|
): Promise<TInventoryDatabaseDocument> => {
|
||||||
const inventory = await Inventory.findOne({ accountOwnerId: accountOwnerId }, projection);
|
const inventory = await Inventory.findOne({ accountOwnerId: accountOwnerId }, projection);
|
||||||
|
|
||||||
@ -333,9 +314,7 @@ export const addItem = async (
|
|||||||
typeName: string,
|
typeName: string,
|
||||||
quantity: number = 1,
|
quantity: number = 1,
|
||||||
premiumPurchase: boolean = false,
|
premiumPurchase: boolean = false,
|
||||||
seed?: bigint,
|
seed?: bigint
|
||||||
targetFingerprint?: string,
|
|
||||||
exactQuantity: boolean = false
|
|
||||||
): Promise<IInventoryChanges> => {
|
): Promise<IInventoryChanges> => {
|
||||||
// Bundles are technically StoreItems but a) they don't have a normal counterpart, and b) they are used in non-StoreItem contexts, e.g. email attachments.
|
// Bundles are technically StoreItems but a) they don't have a normal counterpart, and b) they are used in non-StoreItem contexts, e.g. email attachments.
|
||||||
if (typeName in ExportBundles) {
|
if (typeName in ExportBundles) {
|
||||||
@ -425,7 +404,7 @@ export const addItem = async (
|
|||||||
changes.push({
|
changes.push({
|
||||||
ItemType: egg.ItemType,
|
ItemType: egg.ItemType,
|
||||||
ExpirationDate: { $date: { $numberLong: "2000000000000" } },
|
ExpirationDate: { $date: { $numberLong: "2000000000000" } },
|
||||||
ItemId: toOid(egg._id) // TODO: Pass on buildLabel from purchaseService
|
ItemId: toOid(egg._id)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@ -490,12 +469,6 @@ export const addItem = async (
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (typeName in ExportGear) {
|
if (typeName in ExportGear) {
|
||||||
// Multipling by purchase quantity for gear because:
|
|
||||||
// - The Saya's Vigil scanner message has it as a non-counted attachment.
|
|
||||||
// - Blueprints for Ancient Protector Specter, Shield Osprey Specter, etc. have num=1 despite giving their purchaseQuantity.
|
|
||||||
if (!exactQuantity) {
|
|
||||||
quantity *= ExportGear[typeName].purchaseQuantity ?? 1;
|
|
||||||
}
|
|
||||||
const consumablesChanges = [
|
const consumablesChanges = [
|
||||||
{
|
{
|
||||||
ItemType: typeName,
|
ItemType: typeName,
|
||||||
@ -544,13 +517,14 @@ export const addItem = async (
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (targetFingerprint) {
|
const inventoryChanges = addEquipment(
|
||||||
const targetFingerprintObj = JSON.parse(targetFingerprint) as INemesisWeaponTargetFingerprint;
|
inventory,
|
||||||
defaultOverwrites.UpgradeType = targetFingerprintObj.ItemType;
|
weapon.productCategory,
|
||||||
defaultOverwrites.UpgradeFingerprint = JSON.stringify(targetFingerprintObj.UpgradeFingerprint);
|
typeName,
|
||||||
defaultOverwrites.ItemName = targetFingerprintObj.Name;
|
[],
|
||||||
}
|
{},
|
||||||
const inventoryChanges = addEquipment(inventory, weapon.productCategory, typeName, defaultOverwrites);
|
defaultOverwrites
|
||||||
|
);
|
||||||
if (weapon.additionalItems) {
|
if (weapon.additionalItems) {
|
||||||
for (const item of weapon.additionalItems) {
|
for (const item of weapon.additionalItems) {
|
||||||
combineInventoryChanges(inventoryChanges, await addItem(inventory, item, 1));
|
combineInventoryChanges(inventoryChanges, await addItem(inventory, item, 1));
|
||||||
@ -564,27 +538,6 @@ export const addItem = async (
|
|||||||
premiumPurchase
|
premiumPurchase
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
} else if (targetFingerprint) {
|
|
||||||
// Sister's Hound
|
|
||||||
const targetFingerprintObj = JSON.parse(targetFingerprint) as INemesisPetTargetFingerprint;
|
|
||||||
const head = targetFingerprintObj.Parts[0];
|
|
||||||
const defaultOverwrites: Partial<IEquipmentDatabase> = {
|
|
||||||
ModularParts: targetFingerprintObj.Parts,
|
|
||||||
ItemName: targetFingerprintObj.Name,
|
|
||||||
Configs: applyDefaultUpgrades(inventory, ExportWeapons[head].defaultUpgrades)
|
|
||||||
};
|
|
||||||
const itemType = {
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartHeadA":
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetAPowerSuit",
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartHeadB":
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetBPowerSuit",
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartHeadC":
|
|
||||||
"/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetCPowerSuit"
|
|
||||||
}[head] as string;
|
|
||||||
return {
|
|
||||||
...addEquipment(inventory, "MoaPets", itemType, defaultOverwrites),
|
|
||||||
...occupySlot(inventory, InventorySlot.SENTINELS, premiumPurchase)
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
// Modular weapon parts
|
// Modular weapon parts
|
||||||
const miscItemChanges = [
|
const miscItemChanges = [
|
||||||
@ -631,7 +584,7 @@ export const addItem = async (
|
|||||||
}
|
}
|
||||||
if (typeName in ExportFusionBundles) {
|
if (typeName in ExportFusionBundles) {
|
||||||
const fusionPointsTotal = ExportFusionBundles[typeName].fusionPoints * quantity;
|
const fusionPointsTotal = ExportFusionBundles[typeName].fusionPoints * quantity;
|
||||||
addFusionPoints(inventory, fusionPointsTotal);
|
inventory.FusionPoints += fusionPointsTotal;
|
||||||
return {
|
return {
|
||||||
FusionPoints: fusionPointsTotal
|
FusionPoints: fusionPointsTotal
|
||||||
};
|
};
|
||||||
@ -672,9 +625,12 @@ export const addItem = async (
|
|||||||
switch (typeName.substr(1).split("/")[2]) {
|
switch (typeName.substr(1).split("/")[2]) {
|
||||||
default: {
|
default: {
|
||||||
return {
|
return {
|
||||||
...(await addPowerSuit(inventory, typeName, {
|
...(await addPowerSuit(
|
||||||
Features: premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
inventory,
|
||||||
})),
|
typeName,
|
||||||
|
{},
|
||||||
|
premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
||||||
|
)),
|
||||||
...occupySlot(inventory, InventorySlot.SUITS, premiumPurchase)
|
...occupySlot(inventory, InventorySlot.SUITS, premiumPurchase)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -791,10 +747,6 @@ export const addItem = async (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "NeutralCreatures": {
|
case "NeutralCreatures": {
|
||||||
if (inventory.Horses.length != 0) {
|
|
||||||
logger.warn("refusing to add Horse because account already has one");
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
const horseIndex = inventory.Horses.push({ ItemType: typeName });
|
const horseIndex = inventory.Horses.push({ ItemType: typeName });
|
||||||
return {
|
return {
|
||||||
Horses: [inventory.Horses[horseIndex - 1].toJSON<IEquipmentClient>()]
|
Horses: [inventory.Horses[horseIndex - 1].toJSON<IEquipmentClient>()]
|
||||||
@ -871,14 +823,9 @@ const addSentinel = (
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
const configs: IItemConfig[] = applyDefaultUpgrades(inventory, ExportSentinels[sentinelName]?.defaultUpgrades);
|
const configs: IItemConfig[] = applyDefaultUpgrades(inventory, ExportSentinels[sentinelName]?.defaultUpgrades);
|
||||||
|
|
||||||
|
const features = premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined;
|
||||||
const sentinelIndex =
|
const sentinelIndex =
|
||||||
inventory.Sentinels.push({
|
inventory.Sentinels.push({ ItemType: sentinelName, Configs: configs, XP: 0, Features: features }) - 1;
|
||||||
ItemType: sentinelName,
|
|
||||||
Configs: configs,
|
|
||||||
XP: 0,
|
|
||||||
Features: premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined,
|
|
||||||
IsNew: inventory.Sentinels.find(x => x.ItemType == sentinelName) ? undefined : true
|
|
||||||
}) - 1;
|
|
||||||
inventoryChanges.Sentinels ??= [];
|
inventoryChanges.Sentinels ??= [];
|
||||||
inventoryChanges.Sentinels.push(inventory.Sentinels[sentinelIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.Sentinels.push(inventory.Sentinels[sentinelIndex].toJSON<IEquipmentClient>());
|
||||||
|
|
||||||
@ -902,8 +849,8 @@ const addSentinelWeapon = (
|
|||||||
export const addPowerSuit = async (
|
export const addPowerSuit = async (
|
||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
powersuitName: string,
|
powersuitName: string,
|
||||||
defaultOverwrites?: Partial<IEquipmentDatabase>,
|
inventoryChanges: IInventoryChanges = {},
|
||||||
inventoryChanges: IInventoryChanges = {}
|
features: number | undefined = undefined
|
||||||
): Promise<IInventoryChanges> => {
|
): Promise<IInventoryChanges> => {
|
||||||
const powersuit = ExportWarframes[powersuitName] as IPowersuit | undefined;
|
const powersuit = ExportWarframes[powersuitName] as IPowersuit | undefined;
|
||||||
const exalted = powersuit?.exalted ?? [];
|
const exalted = powersuit?.exalted ?? [];
|
||||||
@ -917,23 +864,15 @@ export const addPowerSuit = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const suit: Omit<IEquipmentDatabase, "_id"> = Object.assign(
|
const suitIndex =
|
||||||
{
|
inventory.Suits.push({
|
||||||
ItemType: powersuitName,
|
ItemType: powersuitName,
|
||||||
Configs: [],
|
Configs: [],
|
||||||
UpgradeVer: 101,
|
UpgradeVer: 101,
|
||||||
XP: 0,
|
XP: 0,
|
||||||
|
Features: features,
|
||||||
IsNew: true
|
IsNew: true
|
||||||
},
|
}) - 1;
|
||||||
defaultOverwrites
|
|
||||||
);
|
|
||||||
if (suit.IsNew) {
|
|
||||||
suit.IsNew = !inventory.Suits.find(x => x.ItemType == powersuitName);
|
|
||||||
}
|
|
||||||
if (!suit.IsNew) {
|
|
||||||
suit.IsNew = undefined;
|
|
||||||
}
|
|
||||||
const suitIndex = inventory.Suits.push(suit) - 1;
|
|
||||||
inventoryChanges.Suits ??= [];
|
inventoryChanges.Suits ??= [];
|
||||||
inventoryChanges.Suits.push(inventory.Suits[suitIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.Suits.push(inventory.Suits[suitIndex].toJSON<IEquipmentClient>());
|
||||||
return inventoryChanges;
|
return inventoryChanges;
|
||||||
@ -943,7 +882,7 @@ export const addMechSuit = async (
|
|||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
mechsuitName: string,
|
mechsuitName: string,
|
||||||
inventoryChanges: IInventoryChanges = {},
|
inventoryChanges: IInventoryChanges = {},
|
||||||
features?: number
|
features: number | undefined = undefined
|
||||||
): Promise<IInventoryChanges> => {
|
): Promise<IInventoryChanges> => {
|
||||||
const powersuit = ExportWarframes[mechsuitName] as IPowersuit | undefined;
|
const powersuit = ExportWarframes[mechsuitName] as IPowersuit | undefined;
|
||||||
const exalted = powersuit?.exalted ?? [];
|
const exalted = powersuit?.exalted ?? [];
|
||||||
@ -964,7 +903,7 @@ export const addMechSuit = async (
|
|||||||
UpgradeVer: 101,
|
UpgradeVer: 101,
|
||||||
XP: 0,
|
XP: 0,
|
||||||
Features: features,
|
Features: features,
|
||||||
IsNew: inventory.MechSuits.find(x => x.ItemType == mechsuitName) ? undefined : true
|
IsNew: true
|
||||||
}) - 1;
|
}) - 1;
|
||||||
inventoryChanges.MechSuits ??= [];
|
inventoryChanges.MechSuits ??= [];
|
||||||
inventoryChanges.MechSuits.push(inventory.MechSuits[suitIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.MechSuits.push(inventory.MechSuits[suitIndex].toJSON<IEquipmentClient>());
|
||||||
@ -995,7 +934,7 @@ export const addSpaceSuit = (
|
|||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
spacesuitName: string,
|
spacesuitName: string,
|
||||||
inventoryChanges: IInventoryChanges = {},
|
inventoryChanges: IInventoryChanges = {},
|
||||||
features?: number
|
features: number | undefined = undefined
|
||||||
): IInventoryChanges => {
|
): IInventoryChanges => {
|
||||||
const suitIndex =
|
const suitIndex =
|
||||||
inventory.SpaceSuits.push({
|
inventory.SpaceSuits.push({
|
||||||
@ -1004,7 +943,7 @@ export const addSpaceSuit = (
|
|||||||
UpgradeVer: 101,
|
UpgradeVer: 101,
|
||||||
XP: 0,
|
XP: 0,
|
||||||
Features: features,
|
Features: features,
|
||||||
IsNew: inventory.SpaceSuits.find(x => x.ItemType == spacesuitName) ? undefined : true
|
IsNew: true
|
||||||
}) - 1;
|
}) - 1;
|
||||||
inventoryChanges.SpaceSuits ??= [];
|
inventoryChanges.SpaceSuits ??= [];
|
||||||
inventoryChanges.SpaceSuits.push(inventory.SpaceSuits[suitIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.SpaceSuits.push(inventory.SpaceSuits[suitIndex].toJSON<IEquipmentClient>());
|
||||||
@ -1086,7 +1025,7 @@ export const addKubrowPet = (
|
|||||||
Configs: configs,
|
Configs: configs,
|
||||||
XP: 0,
|
XP: 0,
|
||||||
Details: details,
|
Details: details,
|
||||||
IsNew: inventory.KubrowPets.find(x => x.ItemType == kubrowPetName) ? undefined : true
|
IsNew: true
|
||||||
}) - 1;
|
}) - 1;
|
||||||
inventoryChanges.KubrowPets ??= [];
|
inventoryChanges.KubrowPets ??= [];
|
||||||
inventoryChanges.KubrowPets.push(inventory.KubrowPets[kubrowPetIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.KubrowPets.push(inventory.KubrowPets[kubrowPetIndex].toJSON<IEquipmentClient>());
|
||||||
@ -1114,38 +1053,24 @@ const isCurrencyTracked = (usePremium: boolean): boolean => {
|
|||||||
export const updateCurrency = (
|
export const updateCurrency = (
|
||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
price: number,
|
price: number,
|
||||||
usePremium: boolean,
|
usePremium: boolean
|
||||||
inventoryChanges: IInventoryChanges = {}
|
|
||||||
): IInventoryChanges => {
|
): IInventoryChanges => {
|
||||||
|
const currencyChanges: IInventoryChanges = {};
|
||||||
if (price != 0 && isCurrencyTracked(usePremium)) {
|
if (price != 0 && isCurrencyTracked(usePremium)) {
|
||||||
if (usePremium) {
|
if (usePremium) {
|
||||||
if (inventory.PremiumCreditsFree > 0) {
|
if (inventory.PremiumCreditsFree > 0) {
|
||||||
const premiumCreditsFreeDelta = Math.min(price, inventory.PremiumCreditsFree) * -1;
|
currencyChanges.PremiumCreditsFree = Math.min(price, inventory.PremiumCreditsFree) * -1;
|
||||||
inventoryChanges.PremiumCreditsFree ??= 0;
|
inventory.PremiumCreditsFree += currencyChanges.PremiumCreditsFree;
|
||||||
inventoryChanges.PremiumCreditsFree += premiumCreditsFreeDelta;
|
|
||||||
inventory.PremiumCreditsFree += premiumCreditsFreeDelta;
|
|
||||||
}
|
}
|
||||||
inventoryChanges.PremiumCredits ??= 0;
|
currencyChanges.PremiumCredits = -price;
|
||||||
inventoryChanges.PremiumCredits -= price;
|
inventory.PremiumCredits += currencyChanges.PremiumCredits;
|
||||||
inventory.PremiumCredits -= price;
|
|
||||||
logger.debug(`currency changes `, { PremiumCredits: -price });
|
|
||||||
} else {
|
} else {
|
||||||
inventoryChanges.RegularCredits ??= 0;
|
currencyChanges.RegularCredits = -price;
|
||||||
inventoryChanges.RegularCredits -= price;
|
inventory.RegularCredits += currencyChanges.RegularCredits;
|
||||||
inventory.RegularCredits -= price;
|
|
||||||
logger.debug(`currency changes `, { RegularCredits: -price });
|
|
||||||
}
|
}
|
||||||
|
logger.debug(`currency changes `, currencyChanges);
|
||||||
}
|
}
|
||||||
return inventoryChanges;
|
return currencyChanges;
|
||||||
};
|
|
||||||
|
|
||||||
export const addFusionPoints = (inventory: TInventoryDatabaseDocument, add: number): number => {
|
|
||||||
if (inventory.FusionPoints + add > 2147483647) {
|
|
||||||
logger.warn(`capping FusionPoints balance at 2147483647`);
|
|
||||||
add = 2147483647 - inventory.FusionPoints;
|
|
||||||
}
|
|
||||||
inventory.FusionPoints += add;
|
|
||||||
return add;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const standingLimitBinToInventoryKey: Record<
|
const standingLimitBinToInventoryKey: Record<
|
||||||
@ -1259,24 +1184,20 @@ export const addEquipment = (
|
|||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
category: TEquipmentKey,
|
category: TEquipmentKey,
|
||||||
type: string,
|
type: string,
|
||||||
defaultOverwrites?: Partial<IEquipmentDatabase>,
|
modularParts: string[] | undefined = undefined,
|
||||||
inventoryChanges: IInventoryChanges = {}
|
inventoryChanges: IInventoryChanges = {},
|
||||||
|
defaultOverwrites: Partial<IEquipmentDatabase> | undefined = undefined
|
||||||
): IInventoryChanges => {
|
): IInventoryChanges => {
|
||||||
const equipment: Omit<IEquipmentDatabase, "_id"> = Object.assign(
|
const equipment = Object.assign(
|
||||||
{
|
{
|
||||||
ItemType: type,
|
ItemType: type,
|
||||||
Configs: [],
|
Configs: [],
|
||||||
XP: 0,
|
XP: 0,
|
||||||
IsNew: category != "CrewShipWeapons" && category != "CrewShipSalvagedWeapons"
|
ModularParts: modularParts,
|
||||||
|
IsNew: category != "CrewShipWeapons" && category != "CrewShipSalvagedWeapons" ? true : undefined
|
||||||
},
|
},
|
||||||
defaultOverwrites
|
defaultOverwrites
|
||||||
);
|
);
|
||||||
if (equipment.IsNew) {
|
|
||||||
equipment.IsNew = !inventory[category].find(x => x.ItemType == type);
|
|
||||||
}
|
|
||||||
if (!equipment.IsNew) {
|
|
||||||
equipment.IsNew = undefined;
|
|
||||||
}
|
|
||||||
const index = inventory[category].push(equipment) - 1;
|
const index = inventory[category].push(equipment) - 1;
|
||||||
|
|
||||||
inventoryChanges[category] ??= [];
|
inventoryChanges[category] ??= [];
|
||||||
@ -1305,16 +1226,12 @@ export const addSkin = (
|
|||||||
typeName: string,
|
typeName: string,
|
||||||
inventoryChanges: IInventoryChanges = {}
|
inventoryChanges: IInventoryChanges = {}
|
||||||
): IInventoryChanges => {
|
): IInventoryChanges => {
|
||||||
if (inventory.WeaponSkins.find(x => x.ItemType == typeName)) {
|
const index = inventory.WeaponSkins.push({ ItemType: typeName, IsNew: true }) - 1;
|
||||||
logger.debug(`refusing to add WeaponSkin ${typeName} because account already owns it`);
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
} else {
|
inventoryChanges.WeaponSkins ??= [];
|
||||||
const index = inventory.WeaponSkins.push({ ItemType: typeName, IsNew: true }) - 1;
|
(inventoryChanges.WeaponSkins as IWeaponSkinClient[]).push(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
inventory.WeaponSkins[index].toJSON<IWeaponSkinClient>()
|
||||||
inventoryChanges.WeaponSkins ??= [];
|
);
|
||||||
(inventoryChanges.WeaponSkins as IWeaponSkinClient[]).push(
|
|
||||||
inventory.WeaponSkins[index].toJSON<IWeaponSkinClient>()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return inventoryChanges;
|
return inventoryChanges;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1500,20 +1417,21 @@ export const addEmailItem = async (
|
|||||||
return inventoryChanges;
|
return inventoryChanges;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const applyClientEquipmentUpdates = (
|
//TODO: wrong id is not erroring
|
||||||
|
export const addGearExpByCategory = (
|
||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
gearArray: IEquipmentClient[],
|
gearArray: IEquipmentClient[],
|
||||||
categoryName: TEquipmentKey
|
categoryName: TEquipmentKey
|
||||||
): void => {
|
): void => {
|
||||||
const category = inventory[categoryName];
|
const category = inventory[categoryName];
|
||||||
|
|
||||||
gearArray.forEach(({ ItemId, XP, InfestationDate }) => {
|
gearArray.forEach(({ ItemId, XP }) => {
|
||||||
const item = category.id(fromOid(ItemId));
|
if (!XP) {
|
||||||
if (!item) {
|
return;
|
||||||
throw new Error(`No item with id ${fromOid(ItemId)} in ${categoryName}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XP) {
|
const item = category.id(ItemId.$oid);
|
||||||
|
if (item) {
|
||||||
item.XP ??= 0;
|
item.XP ??= 0;
|
||||||
item.XP += XP;
|
item.XP += XP;
|
||||||
|
|
||||||
@ -1528,31 +1446,9 @@ export const applyClientEquipmentUpdates = (
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InfestationDate) {
|
|
||||||
// 2147483647000 means cured, otherwise became infected
|
|
||||||
item.InfestationDate =
|
|
||||||
InfestationDate.$date.$numberLong == "2147483647000" ? new Date(0) : fromMongoDate(InfestationDate);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addMiscItem = (
|
|
||||||
inventory: TInventoryDatabaseDocument,
|
|
||||||
type: string,
|
|
||||||
count: number,
|
|
||||||
inventoryChanges: IInventoryChanges
|
|
||||||
): void => {
|
|
||||||
const miscItemChanges: IMiscItem[] = [
|
|
||||||
{
|
|
||||||
ItemType: type,
|
|
||||||
ItemCount: count
|
|
||||||
}
|
|
||||||
];
|
|
||||||
addMiscItems(inventory, miscItemChanges);
|
|
||||||
combineInventoryChanges(inventoryChanges, { MiscItems: miscItemChanges });
|
|
||||||
};
|
|
||||||
|
|
||||||
export const addMiscItems = (inventory: TInventoryDatabaseDocument, itemsArray: IMiscItem[]): void => {
|
export const addMiscItems = (inventory: TInventoryDatabaseDocument, itemsArray: IMiscItem[]): void => {
|
||||||
const { MiscItems } = inventory;
|
const { MiscItems } = inventory;
|
||||||
|
|
||||||
@ -1586,17 +1482,12 @@ export const addMiscItems = (inventory: TInventoryDatabaseDocument, itemsArray:
|
|||||||
if (MiscItems[itemIndex].ItemCount == 0) {
|
if (MiscItems[itemIndex].ItemCount == 0) {
|
||||||
MiscItems.splice(itemIndex, 1);
|
MiscItems.splice(itemIndex, 1);
|
||||||
} else if (MiscItems[itemIndex].ItemCount <= 0) {
|
} else if (MiscItems[itemIndex].ItemCount <= 0) {
|
||||||
logger.warn(`inventory.MiscItems has a negative count for ${ItemType}`);
|
logger.warn(`account now owns a negative amount of ${ItemType}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyArrayChanges = (
|
const applyArrayChanges = (arr: ITypeCount[], changes: ITypeCount[]): void => {
|
||||||
inventory: TInventoryDatabaseDocument,
|
|
||||||
key: "ShipDecorations" | "Consumables" | "CrewShipRawSalvage" | "CrewShipAmmo" | "Recipes" | "LevelKeys",
|
|
||||||
changes: ITypeCount[]
|
|
||||||
): void => {
|
|
||||||
const arr: ITypeCount[] = inventory[key];
|
|
||||||
for (const change of changes) {
|
for (const change of changes) {
|
||||||
if (change.ItemCount != 0) {
|
if (change.ItemCount != 0) {
|
||||||
let itemIndex = arr.findIndex(x => x.ItemType === change.ItemType);
|
let itemIndex = arr.findIndex(x => x.ItemType === change.ItemType);
|
||||||
@ -1608,34 +1499,34 @@ const applyArrayChanges = (
|
|||||||
if (arr[itemIndex].ItemCount == 0) {
|
if (arr[itemIndex].ItemCount == 0) {
|
||||||
arr.splice(itemIndex, 1);
|
arr.splice(itemIndex, 1);
|
||||||
} else if (arr[itemIndex].ItemCount <= 0) {
|
} else if (arr[itemIndex].ItemCount <= 0) {
|
||||||
logger.warn(`inventory.${key} has a negative count for ${change.ItemType}`);
|
logger.warn(`account now owns a negative amount of ${change.ItemType}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addShipDecorations = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
export const addShipDecorations = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
||||||
applyArrayChanges(inventory, "ShipDecorations", itemsArray);
|
applyArrayChanges(inventory.ShipDecorations, itemsArray);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addConsumables = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
export const addConsumables = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
||||||
applyArrayChanges(inventory, "Consumables", itemsArray);
|
applyArrayChanges(inventory.Consumables, itemsArray);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addCrewShipRawSalvage = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
export const addCrewShipRawSalvage = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
||||||
applyArrayChanges(inventory, "CrewShipRawSalvage", itemsArray);
|
applyArrayChanges(inventory.CrewShipRawSalvage, itemsArray);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addCrewShipAmmo = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
export const addCrewShipAmmo = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
||||||
applyArrayChanges(inventory, "CrewShipAmmo", itemsArray);
|
applyArrayChanges(inventory.CrewShipAmmo, itemsArray);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addRecipes = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
export const addRecipes = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
||||||
applyArrayChanges(inventory, "Recipes", itemsArray);
|
applyArrayChanges(inventory.Recipes, itemsArray);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addLevelKeys = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
export const addLevelKeys = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
||||||
applyArrayChanges(inventory, "LevelKeys", itemsArray);
|
applyArrayChanges(inventory.LevelKeys, itemsArray);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addMods = (inventory: TInventoryDatabaseDocument, itemsArray: IRawUpgrade[]): void => {
|
export const addMods = (inventory: TInventoryDatabaseDocument, itemsArray: IRawUpgrade[]): void => {
|
||||||
@ -1655,7 +1546,7 @@ export const addMods = (inventory: TInventoryDatabaseDocument, itemsArray: IRawU
|
|||||||
if (RawUpgrades[itemIndex].ItemCount == 0) {
|
if (RawUpgrades[itemIndex].ItemCount == 0) {
|
||||||
RawUpgrades.splice(itemIndex, 1);
|
RawUpgrades.splice(itemIndex, 1);
|
||||||
} else if (RawUpgrades[itemIndex].ItemCount <= 0) {
|
} else if (RawUpgrades[itemIndex].ItemCount <= 0) {
|
||||||
logger.warn(`inventory.RawUpgrades has a negative count for ${ItemType}`);
|
logger.warn(`account now owns a negative amount of ${ItemType}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -1670,7 +1561,7 @@ export const addFusionTreasures = (inventory: TInventoryDatabaseDocument, itemsA
|
|||||||
if (FusionTreasures[itemIndex].ItemCount == 0) {
|
if (FusionTreasures[itemIndex].ItemCount == 0) {
|
||||||
FusionTreasures.splice(itemIndex, 1);
|
FusionTreasures.splice(itemIndex, 1);
|
||||||
} else if (FusionTreasures[itemIndex].ItemCount <= 0) {
|
} else if (FusionTreasures[itemIndex].ItemCount <= 0) {
|
||||||
logger.warn(`inventory.FusionTreasures has a negative count for ${ItemType}`);
|
logger.warn(`account now owns a negative amount of ${ItemType}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FusionTreasures.push({ ItemCount, ItemType, Sockets });
|
FusionTreasures.push({ ItemCount, ItemType, Sockets });
|
||||||
@ -1837,7 +1728,7 @@ export const addKeyChainItems = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const createLibraryDailyTask = (): ILibraryDailyTaskInfo => {
|
export const createLibraryDailyTask = (): ILibraryDailyTaskInfo => {
|
||||||
const enemyTypes = getRandomElement(libraryDailyTasks)!;
|
const enemyTypes = getRandomElement(libraryDailyTasks);
|
||||||
const enemyAvatar = ExportEnemies.avatars[enemyTypes[0]];
|
const enemyAvatar = ExportEnemies.avatars[enemyTypes[0]];
|
||||||
const scansRequired = getRandomInt(2, 4);
|
const scansRequired = getRandomInt(2, 4);
|
||||||
return {
|
return {
|
||||||
@ -1851,6 +1742,20 @@ export const createLibraryDailyTask = (): ILibraryDailyTaskInfo => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const createCalendar = (): ICalendarProgress => {
|
||||||
|
return {
|
||||||
|
Version: 19,
|
||||||
|
Iteration: 2,
|
||||||
|
YearProgress: { Upgrades: [] },
|
||||||
|
SeasonProgress: {
|
||||||
|
SeasonType: "CST_SPRING",
|
||||||
|
LastCompletedDayIdx: -1,
|
||||||
|
LastCompletedChallengeDayIdx: -1,
|
||||||
|
ActivatedChallenges: []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const setupKahlSyndicate = (inventory: TInventoryDatabaseDocument): void => {
|
export const setupKahlSyndicate = (inventory: TInventoryDatabaseDocument): void => {
|
||||||
inventory.Affiliations.push({
|
inventory.Affiliations.push({
|
||||||
Title: 1,
|
Title: 1,
|
||||||
@ -1886,146 +1791,4 @@ export const cleanupInventory = (inventory: TInventoryDatabaseDocument): void =>
|
|||||||
logger.debug(`removing FreeFavorsEarned from LibrarySyndicate`);
|
logger.debug(`removing FreeFavorsEarned from LibrarySyndicate`);
|
||||||
LibrarySyndicate.FreeFavorsEarned = undefined;
|
LibrarySyndicate.FreeFavorsEarned = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventory.LotusCustomization) {
|
|
||||||
if (
|
|
||||||
Array.isArray(inventory.LotusCustomization.attcol) ||
|
|
||||||
Array.isArray(inventory.LotusCustomization.sigcol) ||
|
|
||||||
Array.isArray(inventory.LotusCustomization.eyecol) ||
|
|
||||||
Array.isArray(inventory.LotusCustomization.facial) ||
|
|
||||||
Array.isArray(inventory.LotusCustomization.cloth) ||
|
|
||||||
Array.isArray(inventory.LotusCustomization.syancol)
|
|
||||||
) {
|
|
||||||
logger.debug(`fixing empty objects represented as empty arrays in LotusCustomization`);
|
|
||||||
inventory.LotusCustomization.attcol = {};
|
|
||||||
inventory.LotusCustomization.sigcol = {};
|
|
||||||
inventory.LotusCustomization.eyecol = {};
|
|
||||||
inventory.LotusCustomization.facial = {};
|
|
||||||
inventory.LotusCustomization.cloth = {};
|
|
||||||
inventory.LotusCustomization.syancol = {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getDialogue = (inventory: TInventoryDatabaseDocument, dialogueName: string): IDialogueDatabase => {
|
|
||||||
let dialogue = inventory.DialogueHistory!.Dialogues!.find(x => x.DialogueName == dialogueName);
|
|
||||||
if (!dialogue) {
|
|
||||||
dialogue =
|
|
||||||
inventory.DialogueHistory!.Dialogues![
|
|
||||||
inventory.DialogueHistory!.Dialogues!.push({
|
|
||||||
Rank: 0,
|
|
||||||
Chemistry: 0,
|
|
||||||
AvailableDate: new Date(0),
|
|
||||||
AvailableGiftDate: new Date(0),
|
|
||||||
RankUpExpiry: new Date(0),
|
|
||||||
BountyChemExpiry: new Date(0),
|
|
||||||
QueuedDialogues: [],
|
|
||||||
Gifts: [],
|
|
||||||
Booleans: [],
|
|
||||||
Completed: [],
|
|
||||||
DialogueName: dialogueName
|
|
||||||
}) - 1
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return dialogue;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getCalendarProgress = (inventory: TInventoryDatabaseDocument): ICalendarProgress => {
|
|
||||||
const currentSeason = getWorldState().KnownCalendarSeasons[0];
|
|
||||||
|
|
||||||
if (!inventory.CalendarProgress) {
|
|
||||||
inventory.CalendarProgress = {
|
|
||||||
Version: 19,
|
|
||||||
Iteration: currentSeason.YearIteration,
|
|
||||||
YearProgress: {
|
|
||||||
Upgrades: []
|
|
||||||
},
|
|
||||||
SeasonProgress: {
|
|
||||||
SeasonType: currentSeason.Season,
|
|
||||||
LastCompletedDayIdx: 0,
|
|
||||||
LastCompletedChallengeDayIdx: 0,
|
|
||||||
ActivatedChallenges: []
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const yearRolledOver = inventory.CalendarProgress.Iteration != currentSeason.YearIteration;
|
|
||||||
if (yearRolledOver) {
|
|
||||||
inventory.CalendarProgress.Iteration = currentSeason.YearIteration;
|
|
||||||
inventory.CalendarProgress.YearProgress.Upgrades = [];
|
|
||||||
}
|
|
||||||
if (yearRolledOver || inventory.CalendarProgress.SeasonProgress.SeasonType != currentSeason.Season) {
|
|
||||||
inventory.CalendarProgress.SeasonProgress.SeasonType = currentSeason.Season;
|
|
||||||
inventory.CalendarProgress.SeasonProgress.LastCompletedDayIdx = -1;
|
|
||||||
inventory.CalendarProgress.SeasonProgress.LastCompletedChallengeDayIdx = -1;
|
|
||||||
inventory.CalendarProgress.SeasonProgress.ActivatedChallenges = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return inventory.CalendarProgress;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const giveNemesisWeaponRecipe = (
|
|
||||||
inventory: TInventoryDatabaseDocument,
|
|
||||||
weaponType: string,
|
|
||||||
nemesisName: string = "AGOR ROK",
|
|
||||||
weaponLoc?: string,
|
|
||||||
profile: INemesisProfile = generateNemesisProfile()
|
|
||||||
): void => {
|
|
||||||
if (!weaponLoc) {
|
|
||||||
weaponLoc = ExportWeapons[weaponType].name;
|
|
||||||
}
|
|
||||||
const recipeType = Object.entries(ExportRecipes).find(arr => arr[1].resultType == weaponType)![0];
|
|
||||||
addRecipes(inventory, [
|
|
||||||
{
|
|
||||||
ItemType: recipeType,
|
|
||||||
ItemCount: 1
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
inventory.PendingRecipes.push({
|
|
||||||
CompletionDate: new Date(),
|
|
||||||
ItemType: recipeType,
|
|
||||||
TargetFingerprint: JSON.stringify({
|
|
||||||
ItemType: "/Lotus/Weapons/Grineer/KuvaLich/Upgrades/InnateDamageRandomMod",
|
|
||||||
UpgradeFingerprint: {
|
|
||||||
compat: weaponType,
|
|
||||||
buffs: [
|
|
||||||
{
|
|
||||||
Tag: profile.innateDamageTag,
|
|
||||||
Value: profile.innateDamageValue
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
Name: weaponLoc + "|" + nemesisName
|
|
||||||
} satisfies INemesisWeaponTargetFingerprint)
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const giveNemesisPetRecipe = (
|
|
||||||
inventory: TInventoryDatabaseDocument,
|
|
||||||
nemesisName: string = "AGOR ROK",
|
|
||||||
profile: INemesisProfile = generateNemesisProfile()
|
|
||||||
): void => {
|
|
||||||
const head = profile.petHead!;
|
|
||||||
const body = profile.petBody!;
|
|
||||||
const legs = profile.petLegs!;
|
|
||||||
const tail = profile.petTail!;
|
|
||||||
const recipeType = Object.entries(ExportRecipes).find(arr => arr[1].resultType == head)![0];
|
|
||||||
addRecipes(inventory, [
|
|
||||||
{
|
|
||||||
ItemType: recipeType,
|
|
||||||
ItemCount: 1
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
inventory.PendingRecipes.push({
|
|
||||||
CompletionDate: new Date(),
|
|
||||||
ItemType: recipeType,
|
|
||||||
TargetFingerprint: JSON.stringify({
|
|
||||||
Parts: [head, body, legs, tail],
|
|
||||||
Name: "/Lotus/Language/Pets/ZanukaPetName|" + nemesisName
|
|
||||||
} satisfies INemesisPetTargetFingerprint)
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getEffectiveAvatarImageType = (inventory: TInventoryDatabaseDocument): string => {
|
|
||||||
return inventory.ActiveAvatarImageType ?? "/Lotus/Types/StoreItems/AvatarImages/AvatarImageDefault";
|
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,6 @@ import {
|
|||||||
dict_uk,
|
dict_uk,
|
||||||
dict_zh,
|
dict_zh,
|
||||||
ExportArcanes,
|
ExportArcanes,
|
||||||
ExportBoosters,
|
|
||||||
ExportCustoms,
|
ExportCustoms,
|
||||||
ExportDrones,
|
ExportDrones,
|
||||||
ExportGear,
|
ExportGear,
|
||||||
@ -218,30 +217,15 @@ export const convertInboxMessage = (message: IInboxMessage): IMessage => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const isStoreItem = (type: string): boolean => {
|
export const isStoreItem = (type: string): boolean => {
|
||||||
return type.startsWith("/Lotus/StoreItems/") || type in ExportBoosters;
|
return type.startsWith("/Lotus/StoreItems/");
|
||||||
};
|
};
|
||||||
|
|
||||||
export const toStoreItem = (type: string): string => {
|
export const toStoreItem = (type: string): string => {
|
||||||
if (type.startsWith("/Lotus/Types/StoreItems/Boosters/")) {
|
|
||||||
const boosterEntry = Object.entries(ExportBoosters).find(arr => arr[1].typeName == type);
|
|
||||||
if (boosterEntry) {
|
|
||||||
return boosterEntry[0];
|
|
||||||
}
|
|
||||||
throw new Error(`could not convert ${type} to a store item`);
|
|
||||||
}
|
|
||||||
return "/Lotus/StoreItems/" + type.substring("/Lotus/".length);
|
return "/Lotus/StoreItems/" + type.substring("/Lotus/".length);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fromStoreItem = (type: string): string => {
|
export const fromStoreItem = (type: string): string => {
|
||||||
if (type.startsWith("/Lotus/StoreItems/")) {
|
return "/Lotus/" + type.substring("/Lotus/StoreItems/".length);
|
||||||
return "/Lotus/" + type.substring("/Lotus/StoreItems/".length);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type in ExportBoosters) {
|
|
||||||
return ExportBoosters[type].typeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error(`${type} is not a store item`);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDefaultUpgrades = (parts: string[]): IDefaultUpgrade[] | undefined => {
|
export const getDefaultUpgrades = (parts: string[]): IDefaultUpgrade[] | undefined => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import randomRewards from "@/static/fixed_responses/loginRewards/randomRewards.json";
|
import randomRewards from "@/static/fixed_responses/loginRewards/randomRewards.json";
|
||||||
import { IInventoryChanges } from "../types/purchaseTypes";
|
import { IInventoryChanges } from "../types/purchaseTypes";
|
||||||
import { TAccountDocument } from "./loginService";
|
import { TAccountDocument } from "./loginService";
|
||||||
import { mixSeeds, SRng } from "./rngService";
|
import { CRng, mixSeeds } from "./rngService";
|
||||||
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel";
|
||||||
import { addBooster, updateCurrency } from "./inventoryService";
|
import { addBooster, updateCurrency } from "./inventoryService";
|
||||||
import { handleStoreItemAcquisition } from "./purchaseService";
|
import { handleStoreItemAcquisition } from "./purchaseService";
|
||||||
@ -49,8 +49,8 @@ const scaleAmount = (day: number, amount: number, scalingMultiplier: number): nu
|
|||||||
// Always produces the same result for the same account _id & LoginDays pair.
|
// Always produces the same result for the same account _id & LoginDays pair.
|
||||||
export const isLoginRewardAChoice = (account: TAccountDocument): boolean => {
|
export const isLoginRewardAChoice = (account: TAccountDocument): boolean => {
|
||||||
const accountSeed = parseInt(account._id.toString().substring(16), 16);
|
const accountSeed = parseInt(account._id.toString().substring(16), 16);
|
||||||
const rng = new SRng(mixSeeds(accountSeed, account.LoginDays));
|
const rng = new CRng(mixSeeds(accountSeed, account.LoginDays));
|
||||||
return rng.randomFloat() < 0.25;
|
return rng.random() < 0.25; // Using 25% as an approximate chance for pick-a-doors. More conclusive data analysis is needed.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Always produces the same result for the same account _id & LoginDays pair.
|
// Always produces the same result for the same account _id & LoginDays pair.
|
||||||
@ -59,8 +59,8 @@ export const getRandomLoginRewards = (
|
|||||||
inventory: TInventoryDatabaseDocument
|
inventory: TInventoryDatabaseDocument
|
||||||
): ILoginReward[] => {
|
): ILoginReward[] => {
|
||||||
const accountSeed = parseInt(account._id.toString().substring(16), 16);
|
const accountSeed = parseInt(account._id.toString().substring(16), 16);
|
||||||
const rng = new SRng(mixSeeds(accountSeed, account.LoginDays));
|
const rng = new CRng(mixSeeds(accountSeed, account.LoginDays));
|
||||||
const pick_a_door = rng.randomFloat() < 0.25;
|
const pick_a_door = rng.random() < 0.25; // Using 25% as an approximate chance for pick-a-doors. More conclusive data analysis is needed.
|
||||||
const rewards = [getRandomLoginReward(rng, account.LoginDays, inventory)];
|
const rewards = [getRandomLoginReward(rng, account.LoginDays, inventory)];
|
||||||
if (pick_a_door) {
|
if (pick_a_door) {
|
||||||
do {
|
do {
|
||||||
@ -73,10 +73,11 @@ export const getRandomLoginRewards = (
|
|||||||
return rewards;
|
return rewards;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getRandomLoginReward = (rng: SRng, day: number, inventory: TInventoryDatabaseDocument): ILoginReward => {
|
const getRandomLoginReward = (rng: CRng, day: number, inventory: TInventoryDatabaseDocument): ILoginReward => {
|
||||||
const reward = rng.randomReward(randomRewards)!;
|
const reward = rng.randomReward(randomRewards)!;
|
||||||
//const reward = randomRewards.find(x => x.RewardType == "RT_BOOSTER")!;
|
//const reward = randomRewards.find(x => x.RewardType == "RT_BOOSTER")!;
|
||||||
if (reward.RewardType == "RT_RANDOM_RECIPE") {
|
if (reward.RewardType == "RT_RANDOM_RECIPE") {
|
||||||
|
// Not very faithful implementation but roughly the same idea
|
||||||
const masteredItems = new Set();
|
const masteredItems = new Set();
|
||||||
for (const entry of inventory.XPInfo) {
|
for (const entry of inventory.XPInfo) {
|
||||||
masteredItems.add(entry.ItemType);
|
masteredItems.add(entry.ItemType);
|
||||||
@ -94,15 +95,15 @@ const getRandomLoginReward = (rng: SRng, day: number, inventory: TInventoryDatab
|
|||||||
}
|
}
|
||||||
const eligibleRecipes: string[] = [];
|
const eligibleRecipes: string[] = [];
|
||||||
for (const [uniqueName, recipe] of Object.entries(ExportRecipes)) {
|
for (const [uniqueName, recipe] of Object.entries(ExportRecipes)) {
|
||||||
if (!recipe.excludeFromMarket && unmasteredItems.has(recipe.resultType)) {
|
if (unmasteredItems.has(recipe.resultType)) {
|
||||||
eligibleRecipes.push(uniqueName);
|
eligibleRecipes.push(uniqueName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (eligibleRecipes.length == 0) {
|
if (eligibleRecipes.length == 0) {
|
||||||
// This account has all applicable warframes and weapons already mastered (filthy cheater), need a different reward.
|
// This account has all warframes and weapons already mastered (filthy cheater), need a different reward.
|
||||||
return getRandomLoginReward(rng, day, inventory);
|
return getRandomLoginReward(rng, day, inventory);
|
||||||
}
|
}
|
||||||
reward.StoreItemType = toStoreItem(rng.randomElement(eligibleRecipes)!);
|
reward.StoreItemType = toStoreItem(rng.randomElement(eligibleRecipes));
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
//_id: toOid(new Types.ObjectId()),
|
//_id: toOid(new Types.ObjectId()),
|
||||||
|
@ -74,7 +74,7 @@ export const getAccountForRequest = async (req: Request): Promise<TAccountDocume
|
|||||||
throw new Error("Request is missing nonce parameter");
|
throw new Error("Request is missing nonce parameter");
|
||||||
}
|
}
|
||||||
|
|
||||||
const account = await Account.findById(req.query.accountId as string);
|
const account = await Account.findById(req.query.accountId);
|
||||||
if (!account || account.Nonce != nonce) {
|
if (!account || account.Nonce != nonce) {
|
||||||
throw new Error("Invalid accountId-nonce pair");
|
throw new Error("Invalid accountId-nonce pair");
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ export const getAccountIdForRequest = async (req: Request): Promise<string> => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const isAdministrator = (account: TAccountDocument): boolean => {
|
export const isAdministrator = (account: TAccountDocument): boolean => {
|
||||||
return config.administratorNames?.indexOf(account.DisplayName) != -1;
|
return !!config.administratorNames?.find(x => x == account.DisplayName);
|
||||||
};
|
};
|
||||||
|
|
||||||
const platform_magics = [753, 639, 247, 37, 60];
|
const platform_magics = [753, 639, 247, 37, 60];
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,9 @@
|
|||||||
import { PersonalRooms } from "@/src/models/personalRoomsModel";
|
import { PersonalRooms } from "@/src/models/personalRoomsModel";
|
||||||
import { addItem, getInventory } from "@/src/services/inventoryService";
|
import { addItem, getInventory } from "@/src/services/inventoryService";
|
||||||
import { TPersonalRoomsDatabaseDocument } from "../types/personalRoomsTypes";
|
import { TPersonalRoomsDatabaseDocument } from "../types/personalRoomsTypes";
|
||||||
import { IGardeningDatabase } from "../types/shipTypes";
|
|
||||||
import { getRandomElement } from "./rngService";
|
|
||||||
|
|
||||||
export const getPersonalRooms = async (
|
export const getPersonalRooms = async (accountId: string): Promise<TPersonalRoomsDatabaseDocument> => {
|
||||||
accountId: string,
|
const personalRooms = await PersonalRooms.findOne({ personalRoomsOwnerId: accountId });
|
||||||
projection?: string
|
|
||||||
): Promise<TPersonalRoomsDatabaseDocument> => {
|
|
||||||
const personalRooms = await PersonalRooms.findOne({ personalRoomsOwnerId: accountId }, projection);
|
|
||||||
|
|
||||||
if (!personalRooms) {
|
if (!personalRooms) {
|
||||||
throw new Error(`personal rooms not found for account ${accountId}`);
|
throw new Error(`personal rooms not found for account ${accountId}`);
|
||||||
@ -30,64 +25,3 @@ export const updateShipFeature = async (accountId: string, shipFeature: string):
|
|||||||
await addItem(inventory, shipFeature, -1);
|
await addItem(inventory, shipFeature, -1);
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createGarden = (): IGardeningDatabase => {
|
|
||||||
const plantTypes = [
|
|
||||||
"/Lotus/Types/Items/Plants/MiscItems/DuvxDuviriGrowingPlantA",
|
|
||||||
"/Lotus/Types/Items/Plants/MiscItems/DuvxDuviriGrowingPlantB",
|
|
||||||
"/Lotus/Types/Items/Plants/MiscItems/DuvxDuviriGrowingPlantC",
|
|
||||||
"/Lotus/Types/Items/Plants/MiscItems/DuvxDuviriGrowingPlantD",
|
|
||||||
"/Lotus/Types/Items/Plants/MiscItems/DuvxDuviriGrowingPlantE",
|
|
||||||
"/Lotus/Types/Items/Plants/MiscItems/DuvxDuviriGrowingPlantF"
|
|
||||||
];
|
|
||||||
const endTime = new Date((Math.trunc(Date.now() / 1000) + 79200) * 1000); // Plants will take 22 hours to grow
|
|
||||||
return {
|
|
||||||
Planters: [
|
|
||||||
{
|
|
||||||
Name: "Garden0",
|
|
||||||
Plants: [
|
|
||||||
{
|
|
||||||
PlantType: getRandomElement(plantTypes)!,
|
|
||||||
EndTime: endTime,
|
|
||||||
PlotIndex: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlantType: getRandomElement(plantTypes)!,
|
|
||||||
EndTime: endTime,
|
|
||||||
PlotIndex: 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "Garden1",
|
|
||||||
Plants: [
|
|
||||||
{
|
|
||||||
PlantType: getRandomElement(plantTypes)!,
|
|
||||||
EndTime: endTime,
|
|
||||||
PlotIndex: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlantType: getRandomElement(plantTypes)!,
|
|
||||||
EndTime: endTime,
|
|
||||||
PlotIndex: 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "Garden2",
|
|
||||||
Plants: [
|
|
||||||
{
|
|
||||||
PlantType: getRandomElement(plantTypes)!,
|
|
||||||
EndTime: endTime,
|
|
||||||
PlotIndex: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlantType: getRandomElement(plantTypes)!,
|
|
||||||
EndTime: endTime,
|
|
||||||
PlotIndex: 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
updateSlots
|
updateSlots
|
||||||
} from "@/src/services/inventoryService";
|
} from "@/src/services/inventoryService";
|
||||||
import { getRandomWeightedRewardUc } from "@/src/services/rngService";
|
import { getRandomWeightedRewardUc } from "@/src/services/rngService";
|
||||||
import { applyStandingToVendorManifest, getVendorManifestByOid } from "@/src/services/serversideVendorsService";
|
import { getVendorManifestByOid } from "@/src/services/serversideVendorsService";
|
||||||
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { IPurchaseRequest, IPurchaseResponse, SlotPurchase, IInventoryChanges } from "@/src/types/purchaseTypes";
|
import { IPurchaseRequest, IPurchaseResponse, SlotPurchase, IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
@ -53,9 +53,8 @@ export const handlePurchase = async (
|
|||||||
const prePurchaseInventoryChanges: IInventoryChanges = {};
|
const prePurchaseInventoryChanges: IInventoryChanges = {};
|
||||||
let seed: bigint | undefined;
|
let seed: bigint | undefined;
|
||||||
if (purchaseRequest.PurchaseParams.Source == 7) {
|
if (purchaseRequest.PurchaseParams.Source == 7) {
|
||||||
let manifest = getVendorManifestByOid(purchaseRequest.PurchaseParams.SourceId!);
|
const manifest = getVendorManifestByOid(purchaseRequest.PurchaseParams.SourceId!);
|
||||||
if (manifest) {
|
if (manifest) {
|
||||||
manifest = applyStandingToVendorManifest(inventory, manifest);
|
|
||||||
let ItemId: string | undefined;
|
let ItemId: string | undefined;
|
||||||
if (purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson) {
|
if (purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson) {
|
||||||
ItemId = (JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson) as { ItemId: string })
|
ItemId = (JSON.parse(purchaseRequest.PurchaseParams.ExtraPurchaseInfoJson) as { ItemId: string })
|
||||||
@ -67,18 +66,6 @@ export const handlePurchase = async (
|
|||||||
if (!offer) {
|
if (!offer) {
|
||||||
throw new Error(`unknown vendor offer: ${ItemId ? ItemId : purchaseRequest.PurchaseParams.StoreItem}`);
|
throw new Error(`unknown vendor offer: ${ItemId ? ItemId : purchaseRequest.PurchaseParams.StoreItem}`);
|
||||||
}
|
}
|
||||||
if (offer.RegularPrice) {
|
|
||||||
combineInventoryChanges(
|
|
||||||
prePurchaseInventoryChanges,
|
|
||||||
updateCurrency(inventory, offer.RegularPrice[0], false)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (offer.PremiumPrice) {
|
|
||||||
combineInventoryChanges(
|
|
||||||
prePurchaseInventoryChanges,
|
|
||||||
updateCurrency(inventory, offer.PremiumPrice[0], true)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (offer.ItemPrices) {
|
if (offer.ItemPrices) {
|
||||||
handleItemPrices(
|
handleItemPrices(
|
||||||
inventory,
|
inventory,
|
||||||
@ -93,7 +80,7 @@ export const handlePurchase = async (
|
|||||||
if (!config.noVendorPurchaseLimits && ItemId) {
|
if (!config.noVendorPurchaseLimits && ItemId) {
|
||||||
inventory.RecentVendorPurchases ??= [];
|
inventory.RecentVendorPurchases ??= [];
|
||||||
let vendorPurchases = inventory.RecentVendorPurchases.find(
|
let vendorPurchases = inventory.RecentVendorPurchases.find(
|
||||||
x => x.VendorType == manifest!.VendorInfo.TypeName
|
x => x.VendorType == manifest.VendorInfo.TypeName
|
||||||
);
|
);
|
||||||
if (!vendorPurchases) {
|
if (!vendorPurchases) {
|
||||||
vendorPurchases =
|
vendorPurchases =
|
||||||
@ -183,9 +170,6 @@ export const handlePurchase = async (
|
|||||||
purchaseResponse.InventoryChanges,
|
purchaseResponse.InventoryChanges,
|
||||||
updateCurrency(inventory, offer.RegularPrice, false)
|
updateCurrency(inventory, offer.RegularPrice, false)
|
||||||
);
|
);
|
||||||
if (purchaseRequest.PurchaseParams.ExpectedPrice) {
|
|
||||||
throw new Error(`vendor purchase should not have an expected price`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const invItem: IMiscItem = {
|
const invItem: IMiscItem = {
|
||||||
ItemType: "/Lotus/Types/Items/MiscItems/PrimeBucks",
|
ItemType: "/Lotus/Types/Items/MiscItems/PrimeBucks",
|
||||||
@ -224,10 +208,10 @@ export const handlePurchase = async (
|
|||||||
purchaseResponse.Standing = [
|
purchaseResponse.Standing = [
|
||||||
{
|
{
|
||||||
Tag: syndicateTag,
|
Tag: syndicateTag,
|
||||||
Standing: favour.standingCost * purchaseRequest.PurchaseParams.Quantity
|
Standing: favour.standingCost
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
affiliation.Standing -= favour.standingCost * purchaseRequest.PurchaseParams.Quantity;
|
affiliation.Standing -= favour.standingCost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,18 +223,12 @@ export const handlePurchase = async (
|
|||||||
const vendor = ExportVendors[purchaseRequest.PurchaseParams.SourceId!];
|
const vendor = ExportVendors[purchaseRequest.PurchaseParams.SourceId!];
|
||||||
const offer = vendor.items.find(x => x.storeItem == purchaseRequest.PurchaseParams.StoreItem);
|
const offer = vendor.items.find(x => x.storeItem == purchaseRequest.PurchaseParams.StoreItem);
|
||||||
if (offer) {
|
if (offer) {
|
||||||
if (typeof offer.credits == "number") {
|
if (offer.credits) {
|
||||||
combineInventoryChanges(
|
combineInventoryChanges(
|
||||||
purchaseResponse.InventoryChanges,
|
purchaseResponse.InventoryChanges,
|
||||||
updateCurrency(inventory, offer.credits, false)
|
updateCurrency(inventory, offer.credits, false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (typeof offer.platinum == "number") {
|
|
||||||
combineInventoryChanges(
|
|
||||||
purchaseResponse.InventoryChanges,
|
|
||||||
updateCurrency(inventory, offer.platinum, true)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (offer.itemPrices) {
|
if (offer.itemPrices) {
|
||||||
handleItemPrices(
|
handleItemPrices(
|
||||||
inventory,
|
inventory,
|
||||||
@ -261,9 +239,6 @@ export const handlePurchase = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (purchaseRequest.PurchaseParams.ExpectedPrice) {
|
|
||||||
throw new Error(`vendor purchase should not have an expected price`);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 18: {
|
case 18: {
|
||||||
if (purchaseRequest.PurchaseParams.SourceId! != worldState.PrimeVaultTraders[0]._id.$oid) {
|
if (purchaseRequest.PurchaseParams.SourceId! != worldState.PrimeVaultTraders[0]._id.$oid) {
|
||||||
|
@ -6,7 +6,7 @@ export interface IRngResult {
|
|||||||
probability: number;
|
probability: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getRandomElement = <T>(arr: readonly T[]): T | undefined => {
|
export const getRandomElement = <T>(arr: T[]): T => {
|
||||||
return arr[Math.floor(Math.random() * arr.length)];
|
return arr[Math.floor(Math.random() * arr.length)];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -18,10 +18,7 @@ export const getRandomInt = (min: number, max: number): number => {
|
|||||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getRewardAtPercentage = <T extends { probability: number }>(
|
const getRewardAtPercentage = <T extends { probability: number }>(pool: T[], percentage: number): T | undefined => {
|
||||||
pool: T[],
|
|
||||||
percentage: number
|
|
||||||
): T | undefined => {
|
|
||||||
if (pool.length == 0) return;
|
if (pool.length == 0) return;
|
||||||
|
|
||||||
const totalChance = pool.reduce((accum, item) => accum + item.probability, 0);
|
const totalChance = pool.reduce((accum, item) => accum + item.probability, 0);
|
||||||
@ -86,12 +83,46 @@ export const mixSeeds = (seed1: number, seed2: number): number => {
|
|||||||
return seed >>> 0;
|
return seed >>> 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Seeded RNG with identical results to the game client. Based on work by Donald Knuth.
|
// Seeded RNG for internal usage. Based on recommendations in the ISO C standards.
|
||||||
|
export class CRng {
|
||||||
|
state: number;
|
||||||
|
|
||||||
|
constructor(seed: number = 1) {
|
||||||
|
this.state = seed;
|
||||||
|
}
|
||||||
|
|
||||||
|
random(): number {
|
||||||
|
this.state = (this.state * 1103515245 + 12345) & 0x7fffffff;
|
||||||
|
return (this.state & 0x3fffffff) / 0x3fffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
randomInt(min: number, max: number): number {
|
||||||
|
min = Math.ceil(min);
|
||||||
|
max = Math.floor(max);
|
||||||
|
return Math.floor(this.random() * (max - min + 1)) + min;
|
||||||
|
}
|
||||||
|
|
||||||
|
randomElement<T>(arr: T[]): T {
|
||||||
|
return arr[Math.floor(this.random() * arr.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
randomReward<T extends { probability: number }>(pool: T[]): T | undefined {
|
||||||
|
return getRewardAtPercentage(pool, this.random());
|
||||||
|
}
|
||||||
|
|
||||||
|
churnSeed(its: number): void {
|
||||||
|
while (its--) {
|
||||||
|
this.state = (this.state * 1103515245 + 12345) & 0x7fffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Seeded RNG for cases where we need identical results to the game client. Based on work by Donald Knuth.
|
||||||
export class SRng {
|
export class SRng {
|
||||||
state: bigint;
|
state: bigint;
|
||||||
|
|
||||||
constructor(seed: bigint | number) {
|
constructor(seed: bigint) {
|
||||||
this.state = BigInt(seed);
|
this.state = seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
randomInt(min: number, max: number): number {
|
randomInt(min: number, max: number): number {
|
||||||
@ -103,7 +134,7 @@ export class SRng {
|
|||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
randomElement<T>(arr: readonly T[]): T | undefined {
|
randomElement<T>(arr: T[]): T {
|
||||||
return arr[this.randomInt(0, arr.length - 1)];
|
return arr[this.randomInt(0, arr.length - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,19 +146,4 @@ export class SRng {
|
|||||||
randomReward<T extends { probability: number }>(pool: T[]): T | undefined {
|
randomReward<T extends { probability: number }>(pool: T[]): T | undefined {
|
||||||
return getRewardAtPercentage(pool, this.randomFloat());
|
return getRewardAtPercentage(pool, this.randomFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
churnSeed(its: number): void {
|
|
||||||
while (its--) {
|
|
||||||
this.state = (0x5851f42d4c957f2dn * this.state + 0x14057b7ef767814fn) & 0xffffffffffffffffn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shuffleArray<T>(arr: T[]): void {
|
|
||||||
for (let lastIdx = arr.length - 1; lastIdx >= 1; --lastIdx) {
|
|
||||||
const swapIdx = this.randomInt(0, lastIdx);
|
|
||||||
const tmp = arr[swapIdx];
|
|
||||||
arr[swapIdx] = arr[lastIdx];
|
|
||||||
arr[lastIdx] = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -161,11 +161,6 @@ export const handleInventoryItemConfigChange = async (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "LotusCustomization": {
|
|
||||||
logger.debug(`saved LotusCustomization`, equipmentChanges.LotusCustomization);
|
|
||||||
inventory.LotusCustomization = equipmentChanges.LotusCustomization;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
default: {
|
||||||
if (equipmentKeys.includes(equipmentName as TEquipmentKey) && equipmentName != "ValidNewLoadoutId") {
|
if (equipmentKeys.includes(equipmentName as TEquipmentKey) && equipmentName != "ValidNewLoadoutId") {
|
||||||
logger.debug(`general Item config saved of type ${equipmentName}`, {
|
logger.debug(`general Item config saved of type ${equipmentName}`, {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user