返回提交历史
Modified
config-vanilla.json
+0
-3
Modified
src/controllers/api/inventoryController.ts
+1
-1
Modified
src/controllers/api/loginRewardsController.ts
+32
-32
Modified
src/helpers/relicHelper.ts
+3
-3
Modified
src/models/inventoryModels/inventoryModel.ts
+6
-0
Modified
src/services/configService.ts
+7
-7
Modified
src/services/missionInventoryUpdateService.ts
+1
-1
Modified
src/types/inventoryTypes/inventoryTypes.ts
+6
-0
Modified
static/webui/index.html
+28
-28
XFEstudio/XFESpaceNinjaServer
chore: move a few more cheat toggles to be per-account (#2713)
Re #2361 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2713 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
5a2fa2c2
代码差异
9 个文件
+84
-75
@@ -11,7 +11,6 @@
11
11
"administratorNames": [],
12
12
"autoCreateAccount": true,
13
13
"skipTutorial": false,
14
"skipAllDialogue": false,
15
14
"unlockAllScans": false,
16
15
"unlockAllShipFeatures": false,
17
16
"unlockAllShipDecorations": false,
@@ -27,9 +26,7 @@
27
26
"noDojoResearchCosts": false,
28
27
"noDojoResearchTime": false,
29
28
"fastClanAscension": false,
30
"missionsCanGiveAllRelics": false,
31
29
"unlockAllSimarisResearchEntries": false,
32
"disableDailyTribute": false,
33
30
"spoofMasteryRank": -1,
34
31
"relicRewardItemCountMultiplier": 1,
35
32
"nightwaveStandingMultiplier": 1,
@@ -306,7 +306,7 @@ export const getInventoryResponse = async (
306
306
inventoryResponse.PrimeTokens = 999999999;
307
307
}
308
308
309
if (config.skipAllDialogue) {
309
if (inventory.skipAllDialogue) {
310
310
inventoryResponse.TauntHistory = [
311
311
{
312
312
node: "TreasureTutorial",
@@ -8,7 +8,6 @@ import {
8
8
setAccountGotLoginRewardToday
9
9
} from "../../services/loginRewardService.ts";
10
10
import { getInventory } from "../../services/inventoryService.ts";
11
import { config } from "../../services/configService.ts";
12
11
import { sendWsBroadcastTo } from "../../services/wsService.ts";
13
12
14
13
export const loginRewardsController: RequestHandler = async (req, res) => {
@@ -17,41 +16,42 @@ export const loginRewardsController: RequestHandler = async (req, res) => {
17
16
const isMilestoneDay = account.LoginDays == 5 || account.LoginDays % 50 == 0;
18
17
const nextMilestoneDay = account.LoginDays < 5 ? 5 : (Math.trunc(account.LoginDays / 50) + 1) * 50;
19
18
20
if (today == account.LastLoginRewardDate || config.disableDailyTribute) {
21
res.json({
22
DailyTributeInfo: {
23
IsMilestoneDay: isMilestoneDay,
24
IsChooseRewardSet: isLoginRewardAChoice(account),
25
LoginDays: account.LoginDays,
26
NextMilestoneReward: "",
27
NextMilestoneDay: nextMilestoneDay
19
if (today != account.LastLoginRewardDate) {
20
const inventory = await getInventory(account._id.toString());
21
if (!inventory.disableDailyTribute) {
22
const randomRewards = getRandomLoginRewards(account, inventory);
23
const response: ILoginRewardsReponse = {
24
DailyTributeInfo: {
25
Rewards: randomRewards,
26
IsMilestoneDay: isMilestoneDay,
27
IsChooseRewardSet: randomRewards.length != 1,
28
LoginDays: account.LoginDays,
29
NextMilestoneReward: "",
30
NextMilestoneDay: nextMilestoneDay,
31
HasChosenReward: false
32
},
33
LastLoginRewardDate: today
34
};
35
if (!isMilestoneDay && randomRewards.length == 1) {
36
response.DailyTributeInfo.HasChosenReward = true;
37
response.DailyTributeInfo.ChosenReward = randomRewards[0];
38
response.DailyTributeInfo.NewInventory = await claimLoginReward(inventory, randomRewards[0]);
39
setAccountGotLoginRewardToday(account);
40
await Promise.all([inventory.save(), account.save()]);
41
42
sendWsBroadcastTo(account._id.toString(), { update_inventory: true });
28
43
}
29
} satisfies ILoginRewardsReponse);
30
return;
44
res.json(response);
45
return;
46
}
31
47
}
32
33
const inventory = await getInventory(account._id.toString());
34
const randomRewards = getRandomLoginRewards(account, inventory);
35
const response: ILoginRewardsReponse = {
48
res.json({
36
49
DailyTributeInfo: {
37
Rewards: randomRewards,
38
50
IsMilestoneDay: isMilestoneDay,
39
IsChooseRewardSet: randomRewards.length != 1,
51
IsChooseRewardSet: isLoginRewardAChoice(account),
40
52
LoginDays: account.LoginDays,
41
53
NextMilestoneReward: "",
42
NextMilestoneDay: nextMilestoneDay,
43
HasChosenReward: false
44
},
45
LastLoginRewardDate: today
46
};
47
if (!isMilestoneDay && randomRewards.length == 1) {
48
response.DailyTributeInfo.HasChosenReward = true;
49
response.DailyTributeInfo.ChosenReward = randomRewards[0];
50
response.DailyTributeInfo.NewInventory = await claimLoginReward(inventory, randomRewards[0]);
51
setAccountGotLoginRewardToday(account);
52
await Promise.all([inventory.save(), account.save()]);
53
54
sendWsBroadcastTo(account._id.toString(), { update_inventory: true });
55
}
56
res.json(response);
54
NextMilestoneDay: nextMilestoneDay
55
}
56
} satisfies ILoginRewardsReponse);
57
57
};
@@ -17,11 +17,11 @@ export const crackRelic = async (
17
17
): Promise<IRngResult> => {
18
18
const relic = ExportRelics[participant.VoidProjection];
19
19
let weights = refinementToWeights[relic.quality];
20
if (relic.quality == "VPQ_SILVER" && config.exceptionalRelicsAlwaysGiveBronzeReward) {
20
if (relic.quality == "VPQ_SILVER" && inventory.exceptionalRelicsAlwaysGiveBronzeReward) {
21
21
weights = { COMMON: 1, UNCOMMON: 0, RARE: 0, LEGENDARY: 0 };
22
} else if (relic.quality == "VPQ_GOLD" && config.flawlessRelicsAlwaysGiveSilverReward) {
22
} else if (relic.quality == "VPQ_GOLD" && inventory.flawlessRelicsAlwaysGiveSilverReward) {
23
23
weights = { COMMON: 0, UNCOMMON: 1, RARE: 0, LEGENDARY: 0 };
24
} else if (relic.quality == "VPQ_PLATINUM" && config.radiantRelicsAlwaysGiveGoldReward) {
24
} else if (relic.quality == "VPQ_PLATINUM" && inventory.radiantRelicsAlwaysGiveGoldReward) {
25
25
weights = { COMMON: 0, UNCOMMON: 0, RARE: 1, LEGENDARY: 0 };
26
26
}
27
27
logger.debug(`opening a relic of quality ${relic.quality}; rarity weights are`, weights);
@@ -1428,6 +1428,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1428
1428
accountOwnerId: Schema.Types.ObjectId,
1429
1429
1430
1430
// SNS account cheats
1431
skipAllDialogue: Boolean,
1431
1432
dontSubtractPurchaseCreditCost: Boolean,
1432
1433
dontSubtractPurchasePlatinumCost: Boolean,
1433
1434
dontSubtractPurchaseItemCost: Boolean,
@@ -1455,6 +1456,11 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1455
1456
claimingBlueprintRefundsIngredients: Boolean,
1456
1457
instantResourceExtractorDrones: Boolean,
1457
1458
noResourceExtractorDronesDamage: Boolean,
1459
missionsCanGiveAllRelics: Boolean,
1460
exceptionalRelicsAlwaysGiveBronzeReward: Boolean,
1461
flawlessRelicsAlwaysGiveSilverReward: Boolean,
1462
radiantRelicsAlwaysGiveGoldReward: Boolean,
1463
disableDailyTribute: Boolean,
1458
1464
1459
1465
SubscribedToEmails: { type: Number, default: 0 },
1460
1466
SubscribedToEmailsPersonalized: { type: Number, default: 0 },
@@ -18,7 +18,6 @@ export interface IConfig extends IConfigRemovedOptions {
18
18
administratorNames?: string[];
19
19
autoCreateAccount?: boolean;
20
20
skipTutorial?: boolean;
21
skipAllDialogue?: boolean;
22
21
unlockAllScans?: boolean;
23
22
unlockAllShipFeatures?: boolean;
24
23
unlockAllShipDecorations?: boolean;
@@ -35,12 +34,7 @@ export interface IConfig extends IConfigRemovedOptions {
35
34
noDojoResearchCosts?: boolean;
36
35
noDojoResearchTime?: boolean;
37
36
fastClanAscension?: boolean;
38
missionsCanGiveAllRelics?: boolean;
39
exceptionalRelicsAlwaysGiveBronzeReward?: boolean;
40
flawlessRelicsAlwaysGiveSilverReward?: boolean;
41
radiantRelicsAlwaysGiveGoldReward?: boolean;
42
37
unlockAllSimarisResearchEntries?: boolean;
43
disableDailyTribute?: boolean;
44
38
spoofMasteryRank?: number;
45
39
relicRewardItemCountMultiplier?: number;
46
40
nightwaveStandingMultiplier?: number;
@@ -94,6 +88,7 @@ export interface IConfig extends IConfigRemovedOptions {
94
88
}
95
89
96
90
export const configRemovedOptionsKeys = [
91
"skipAllDialogue",
97
92
"infiniteCredits",
98
93
"infinitePlatinum",
99
94
"infiniteEndo",
@@ -122,7 +117,12 @@ export const configRemovedOptionsKeys = [
122
117
"instantResourceExtractorDrones",
123
118
"noResourceExtractorDronesDamage",
124
119
"baroAlwaysAvailable",
125
"baroFullyStocked"
120
"baroFullyStocked",
121
"missionsCanGiveAllRelics",
122
"exceptionalRelicsAlwaysGiveBronzeReward",
123
"flawlessRelicsAlwaysGiveSilverReward",
124
"radiantRelicsAlwaysGiveGoldReward",
125
"disableDailyTribute"
126
126
] as const;
127
127
128
128
type IConfigRemovedOptions = {
@@ -2197,7 +2197,7 @@ function getRandomMissionDrops(
2197
2197
}
2198
2198
}
2199
2199
2200
if (config.missionsCanGiveAllRelics) {
2200
if (inventory.missionsCanGiveAllRelics) {
2201
2201
for (const drop of drops) {
2202
2202
const itemType = fromStoreItem(drop.StoreItem);
2203
2203
if (itemType in ExportRelics) {
@@ -21,6 +21,7 @@ export type InventoryDatabaseEquipment = {
21
21
22
22
// Fields specific to SNS
23
23
export interface IAccountCheats {
24
skipAllDialogue?: boolean;
24
25
dontSubtractPurchaseCreditCost?: boolean;
25
26
dontSubtractPurchasePlatinumCost?: boolean;
26
27
dontSubtractPurchaseItemCost?: boolean;
@@ -48,6 +49,11 @@ export interface IAccountCheats {
48
49
claimingBlueprintRefundsIngredients?: boolean;
49
50
instantResourceExtractorDrones?: boolean;
50
51
noResourceExtractorDronesDamage?: boolean;
52
missionsCanGiveAllRelics?: boolean;
53
exceptionalRelicsAlwaysGiveBronzeReward?: boolean;
54
flawlessRelicsAlwaysGiveSilverReward?: boolean;
55
radiantRelicsAlwaysGiveGoldReward?: boolean;
56
disableDailyTribute?: boolean;
51
57
}
52
58
53
59
export interface IInventoryDatabase
@@ -647,6 +647,10 @@
647
647
<div class="card">
648
648
<h5 class="card-header" data-loc="cheats_account"></h5>
649
649
<div class="card-body" id="account-cheats">
650
<div class="form-check">
651
<input class="form-check-input" type="checkbox" id="skipAllDialogue" />
652
<label class="form-check-label" for="skipAllDialogue" data-loc="cheats_skipAllDialogue"></label>
653
</div>
650
654
<div class="form-check">
651
655
<input class="form-check-input" type="checkbox" id="dontSubtractPurchaseCreditCost" />
652
656
<label class="form-check-label" for="dontSubtractPurchaseCreditCost" data-loc="cheats_dontSubtractPurchaseCreditCost"></label>
@@ -754,6 +758,30 @@
754
758
<div class="form-check">
755
759
<input class="form-check-input" type="checkbox" id="claimingBlueprintRefundsIngredients" />
756
760
<label class="form-check-label" for="claimingBlueprintRefundsIngredients" data-loc="cheats_claimingBlueprintRefundsIngredients"></label>
761
</div>
762
<div class="form-check">
763
<input class="form-check-input" type="checkbox" id="missionsCanGiveAllRelics" />
764
<label class="form-check-label" for="missionsCanGiveAllRelics" data-loc="cheats_missionsCanGiveAllRelics"></label>
765
</div>
766
<div class="form-check">
767
<input class="form-check-input" type="checkbox" id="exceptionalRelicsAlwaysGiveBronzeReward" />
768
<label class="form-check-label" for="exceptionalRelicsAlwaysGiveBronzeReward" data-loc="cheats_exceptionalRelicsAlwaysGiveBronzeReward"></label>
769
</div>
770
<div class="form-check">
771
<input class="form-check-input" type="checkbox" id="flawlessRelicsAlwaysGiveSilverReward" />
772
<label class="form-check-label" for="flawlessRelicsAlwaysGiveSilverReward" data-loc="cheats_flawlessRelicsAlwaysGiveSilverReward"></label>
773
</div>
774
<div class="form-check">
775
<input class="form-check-input" type="checkbox" id="radiantRelicsAlwaysGiveGoldReward" />
776
<label class="form-check-label" for="radiantRelicsAlwaysGiveGoldReward" data-loc="cheats_radiantRelicsAlwaysGiveGoldReward"></label>
777
</div>
778
<div class="form-check">
779
<input class="form-check-input" type="checkbox" id="unlockAllSimarisResearchEntries" />
780
<label class="form-check-label" for="unlockAllSimarisResearchEntries" data-loc="cheats_unlockAllSimarisResearchEntries"></label>
781
</div>
782
<div class="form-check">
783
<input class="form-check-input" type="checkbox" id="disableDailyTribute" />
784
<label class="form-check-label" for="disableDailyTribute" data-loc="cheats_disableDailyTribute"></label>
757
785
</div>
758
786
<div class="mt-2 mb-2 d-flex flex-wrap gap-2">
759
787
<button class="btn btn-primary" onclick="debounce(doUnlockAllMissions);" data-loc="cheats_unlockAllMissions"></button>
@@ -786,10 +814,6 @@
786
814
<input class="form-check-input" type="checkbox" id="skipTutorial" />
787
815
<label class="form-check-label" for="skipTutorial" data-loc="cheats_skipTutorial"></label>
788
816
</div>
789
<div class="form-check">
790
<input class="form-check-input" type="checkbox" id="skipAllDialogue" />
791
<label class="form-check-label" for="skipAllDialogue" data-loc="cheats_skipAllDialogue"></label>
792
</div>
793
817
<div class="form-check">
794
818
<input class="form-check-input" type="checkbox" id="unlockAllScans" />
795
819
<label class="form-check-label" for="unlockAllScans" data-loc="cheats_unlockAllScans"></label>
@@ -854,30 +878,6 @@
854
878
<input class="form-check-input" type="checkbox" id="fastClanAscension" />
855
879
<label class="form-check-label" for="fastClanAscension" data-loc="cheats_fastClanAscension"></label>
856
880
</div>
857
<div class="form-check">
858
<input class="form-check-input" type="checkbox" id="missionsCanGiveAllRelics" />
859
<label class="form-check-label" for="missionsCanGiveAllRelics" data-loc="cheats_missionsCanGiveAllRelics"></label>
860
</div>
861
<div class="form-check">
862
<input class="form-check-input" type="checkbox" id="exceptionalRelicsAlwaysGiveBronzeReward" />
863
<label class="form-check-label" for="exceptionalRelicsAlwaysGiveBronzeReward" data-loc="cheats_exceptionalRelicsAlwaysGiveBronzeReward"></label>
864
</div>
865
<div class="form-check">
866
<input class="form-check-input" type="checkbox" id="flawlessRelicsAlwaysGiveSilverReward" />
867
<label class="form-check-label" for="flawlessRelicsAlwaysGiveSilverReward" data-loc="cheats_flawlessRelicsAlwaysGiveSilverReward"></label>
868
</div>
869
<div class="form-check">
870
<input class="form-check-input" type="checkbox" id="radiantRelicsAlwaysGiveGoldReward" />
871
<label class="form-check-label" for="radiantRelicsAlwaysGiveGoldReward" data-loc="cheats_radiantRelicsAlwaysGiveGoldReward"></label>
872
</div>
873
<div class="form-check">
874
<input class="form-check-input" type="checkbox" id="unlockAllSimarisResearchEntries" />
875
<label class="form-check-label" for="unlockAllSimarisResearchEntries" data-loc="cheats_unlockAllSimarisResearchEntries"></label>
876
</div>
877
<div class="form-check">
878
<input class="form-check-input" type="checkbox" id="disableDailyTribute" />
879
<label class="form-check-label" for="disableDailyTribute" data-loc="cheats_disableDailyTribute"></label>
880
</div>
881
881
<form class="form-group mt-2" onsubmit="doSaveConfigInt('spoofMasteryRank'); return false;">
882
882
<label class="form-label" for="spoofMasteryRank" data-loc="cheats_spoofMasteryRank"></label>
883
883
<div class="input-group">