XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

feat: riven IsSentinel field & filtering (#3999)

Closes #3993 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3999 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

1a787ac5
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

4 个文件 +28 -10
Modified src/controllers/api/activateRandomModController.ts +4 -2
@@ -22,9 +22,11 @@ export const activateRandomModController: RequestHandler = async (req, res) => {
22 22 }
23 23 ]);
24 24 const rivenType = getRandomElement(rivenRawToRealWeighted[request.ItemType])!;
25 const IsSentinel =
26 request.ItemType == "/Lotus/Upgrades/Mods/Randomized/RawSentinelWeaponRandomMod" ? true : undefined;
25 27 const fingerprint = inventory.instantFinishRivenChallenge
26 ? createUnveiledRivenFingerprint(ExportUpgrades[rivenType])
27 : createVeiledRivenFingerprint(ExportUpgrades[rivenType]);
28 ? createUnveiledRivenFingerprint(ExportUpgrades[rivenType], IsSentinel)
29 : createVeiledRivenFingerprint(ExportUpgrades[rivenType], IsSentinel);
28 30 const upgradeIndex =
29 31 inventory.Upgrades.push({
30 32 ItemType: rivenType,
Modified src/controllers/api/artifactTransmutationController.ts +3 -1
@@ -39,7 +39,9 @@ export const artifactTransmutationController: RequestHandler = async (req, res)
39 39
40 40 const rawRivenType = getRandomRawRivenType();
41 41 const rivenType = getRandomElement(rivenRawToRealWeighted[rawRivenType])!;
42 const fingerprint = createVeiledRivenFingerprint(ExportUpgrades[rivenType]);
42 const IsSentinel =
43 rawRivenType == "/Lotus/Upgrades/Mods/Randomized/RawSentinelWeaponRandomMod" ? true : undefined;
44 const fingerprint = createVeiledRivenFingerprint(ExportUpgrades[rivenType], IsSentinel);
43 45
44 46 const upgradeIndex =
45 47 inventory.Upgrades.push({
Modified src/controllers/api/rerollRandomModController.ts +1 -1
@@ -20,7 +20,7 @@ export const rerollRandomModController: RequestHandler = async (req, res) => {
20 20 const fingerprint = JSON.parse(upgrade.UpgradeFingerprint!) as RivenFingerprint;
21 21 if ("challenge" in fingerprint) {
22 22 upgrade.UpgradeFingerprint = JSON.stringify(
23 createUnveiledRivenFingerprint(ExportUpgrades[upgrade.ItemType])
23 createUnveiledRivenFingerprint(ExportUpgrades[upgrade.ItemType], fingerprint.IsSentinel)
24 24 );
25 25 } else {
26 26 fingerprint.rerolls ??= 0;
Modified src/helpers/rivenHelper.ts +20 -6
@@ -1,10 +1,11 @@
1 import type { IUpgrade } from "warframe-public-export-plus";
1 import { ExportWeapons, type IUpgrade } from "warframe-public-export-plus";
2 2 import { getRandomElement, getRandomInt, getRandomReward } from "../services/rngService.ts";
3 3
4 4 export type RivenFingerprint = IVeiledRivenFingerprint | IUnveiledRivenFingerprint;
5 5
6 6 export interface IVeiledRivenFingerprint {
7 7 challenge: IRivenChallenge;
8 IsSentinel?: true;
8 9 }
9 10
10 11 export interface IRivenChallenge {
@@ -23,6 +24,7 @@ export interface IUnveiledRivenFingerprint {
23 24 pol: string;
24 25 buffs: IFingerprintStat[];
25 26 curses: IFingerprintStat[];
27 IsSentinel?: true;
26 28 }
27 29
28 30 export interface IFingerprintStat {
@@ -30,7 +32,7 @@ export interface IFingerprintStat {
30 32 Value: number;
31 33 }
32 34
33 export const createVeiledRivenFingerprint = (meta: IUpgrade): IVeiledRivenFingerprint => {
35 export const createVeiledRivenFingerprint = (meta: IUpgrade, IsSentinel: true | undefined): IVeiledRivenFingerprint => {
34 36 const challenge = getRandomElement(meta.availableChallenges!)!;
35 37 const fingerprintChallenge: IRivenChallenge = {
36 38 Type: challenge.fullName,
@@ -49,18 +51,30 @@ export const createVeiledRivenFingerprint = (meta: IUpgrade): IVeiledRivenFinger
49 51 const complication = challenge.complications.find(x => x.fullName == fingerprintChallenge.Complication)!;
50 52 fingerprintChallenge.Required *= complication.countMultiplier;
51 53 }
52 return { challenge: fingerprintChallenge };
54 return { challenge: fingerprintChallenge, IsSentinel };
53 55 };
54 56
55 export const createUnveiledRivenFingerprint = (meta: IUpgrade): IUnveiledRivenFingerprint => {
57 export const createUnveiledRivenFingerprint = (
58 meta: IUpgrade,
59 IsSentinel: true | undefined
60 ): IUnveiledRivenFingerprint => {
56 61 const fingerprint: IUnveiledRivenFingerprint = {
57 compat: getRandomElement(meta.compatibleItems!)!,
62 compat: getRandomElement(
63 meta.compatibleItems!.filter(weaponType => {
64 // "Although Beast Companions had their weapons separated in Update 37.0, Veiled Companion Riven mods can still only become mods for Robotic Weapons." (https://wiki.warframe.com/w/Riven%20Mods)
65 // ^ To be faithful to this, we're checking for the SENTINEL_WEAPON compatibility tag instead of the "SentinelWeapons" productCategory.
66 const isSentinelWeapon =
67 (ExportWeapons[weaponType].compatibilityTags?.indexOf("SENTINEL_WEAPON") ?? -1) != -1;
68 return IsSentinel ? isSentinelWeapon : !isSentinelWeapon;
69 })
70 )!,
58 71 lim: 0,
59 72 lvl: 0,
60 73 lvlReq: getRandomInt(8, 16),
61 74 pol: getRandomElement(["AP_ATTACK", "AP_DEFENSE", "AP_TACTIC"])!,
62 75 buffs: [],
63 curses: []
76 curses: [],
77 IsSentinel
64 78 };
65 79 randomiseRivenStats(meta, fingerprint);
66 80 return fingerprint;