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

SpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/SpaceNinjaServer

feat: nemesis henchmen kills multiplier cheat (#2806)

Co-authored-by: AlexisinGit <136088944+AlexisinGit@users.noreply.github.com> Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2806 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AlexisinGit <alexisingit@noreply.localhost> Co-committed-by: AlexisinGit <alexisingit@noreply.localhost>

fc38f818
AlexisinGit <alexisingit@noreply.localhost>
提交于

代码差异

14 个文件 +191 -9
Modified src/controllers/api/nemesisController.ts +4 -1
@@ -149,7 +149,10 @@ export const nemesisController: RequestHandler = async (req, res) => {
149 149 break;
150 150 }
151 151 }
152 inventory.Nemesis!.HenchmenKilled += antivirusGain;
152 const antivirusGainMultiplier = (
153 await getInventory(account._id.toString(), "nemesisAntivirusGainMultiplier")
154 ).nemesisAntivirusGainMultiplier;
155 inventory.Nemesis!.HenchmenKilled += antivirusGain * (antivirusGainMultiplier ?? 1);
153 156 if (inventory.Nemesis!.HenchmenKilled >= 100) {
154 157 inventory.Nemesis!.HenchmenKilled = 100;
155 158
Modified src/controllers/custom/setAccountCheatController.ts +9 -2
@@ -3,12 +3,19 @@ import { getAccountIdForRequest } from "../../services/loginService.ts";
3 3 import { sendWsBroadcastTo } from "../../services/wsService.ts";
4 4 import type { IAccountCheats } from "../../types/inventoryTypes/inventoryTypes.ts";
5 5 import type { RequestHandler } from "express";
6 import { logger } from "../../utils/logger.ts";
6 7
7 8 export const setAccountCheatController: RequestHandler = async (req, res) => {
8 9 const accountId = await getAccountIdForRequest(req);
9 10 const payload = req.body as ISetAccountCheatRequest;
10 11 const inventory = await getInventory(accountId, payload.key);
11 inventory[payload.key] = payload.value;
12
13 if (payload.value == undefined) {
14 logger.warn(`Aborting setting ${payload.key} as undefined!`);
15 return;
16 }
17
18 inventory[payload.key] = payload.value as never;
12 19 await inventory.save();
13 20 res.end();
14 21 if (["infiniteCredits", "infinitePlatinum", "infiniteEndo", "infiniteRegalAya"].indexOf(payload.key) != -1) {
@@ -18,5 +25,5 @@ export const setAccountCheatController: RequestHandler = async (req, res) => {
18 25
19 26 interface ISetAccountCheatRequest {
20 27 key: keyof IAccountCheats;
21 value: boolean;
28 value: IAccountCheats[keyof IAccountCheats];
22 29 }
Modified src/models/inventoryModels/inventoryModel.ts +6 -0
@@ -1462,6 +1462,12 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1462 1462 flawlessRelicsAlwaysGiveSilverReward: Boolean,
1463 1463 radiantRelicsAlwaysGiveGoldReward: Boolean,
1464 1464 disableDailyTribute: Boolean,
1465 nemesisHenchmenKillsMultiplierGrineer: Number,
1466 nemesisHenchmenKillsMultiplierCorpus: Number,
1467 nemesisAntivirusGainMultiplier: Number,
1468 nemesisHintProgressMultiplierGrineer: Number,
1469 nemesisHintProgressMultiplierCorpus: Number,
1470 nemesisExtraWeapon: Number,
1465 1471
1466 1472 SubscribedToEmails: { type: Number, default: 0 },
1467 1473 SubscribedToEmailsPersonalized: { type: Number, default: 0 },
Modified src/services/missionInventoryUpdateService.ts +41 -4
@@ -210,10 +210,29 @@ export const addMissionInventoryUpdates = async (
210 210 inventory.NemesisAbandonedRewards = inventoryUpdates.RewardInfo.NemesisAbandonedRewards;
211 211 }
212 212 if (inventoryUpdates.RewardInfo.NemesisHenchmenKills && inventory.Nemesis) {
213 inventory.Nemesis.HenchmenKilled += inventoryUpdates.RewardInfo.NemesisHenchmenKills;
213 let HenchmenKilledMultiplier = 1;
214 switch (inventory.Nemesis.Faction) {
215 case "FC_GRINEER":
216 HenchmenKilledMultiplier = inventory.nemesisHenchmenKillsMultiplierGrineer ?? 1;
217 break;
218 case "FC_CORPUS":
219 HenchmenKilledMultiplier = inventory.nemesisHenchmenKillsMultiplierCorpus ?? 1;
220 break;
221 }
222 inventory.Nemesis.HenchmenKilled +=
223 inventoryUpdates.RewardInfo.NemesisHenchmenKills * HenchmenKilledMultiplier;
214 224 }
215 225 if (inventoryUpdates.RewardInfo.NemesisHintProgress && inventory.Nemesis) {
216 inventory.Nemesis.HintProgress += inventoryUpdates.RewardInfo.NemesisHintProgress;
226 let HintProgressMultiplier = 1;
227 switch (inventory.Nemesis.Faction) {
228 case "FC_GRINEER":
229 HintProgressMultiplier = inventory.nemesisHintProgressMultiplierGrineer ?? 1;
230 break;
231 case "FC_CORPUS":
232 HintProgressMultiplier = inventory.nemesisHintProgressMultiplierCorpus ?? 1;
233 break;
234 }
235 inventory.Nemesis.HintProgress += inventoryUpdates.RewardInfo.NemesisHintProgress * HintProgressMultiplier;
217 236 if (inventory.Nemesis.Faction != "FC_INFESTATION" && inventory.Nemesis.Hints.length != 3) {
218 237 const progressNeeded = [35, 60, 100][inventory.Nemesis.Hints.length];
219 238 if (inventory.Nemesis.HintProgress >= progressNeeded) {
@@ -819,6 +838,8 @@ export const addMissionInventoryUpdates = async (
819 838 const att: string[] = [];
820 839 let countedAtt: ITypeCount[] | undefined;
821 840
841 const extraWeaponCheat = inventory.nemesisExtraWeapon ?? 0; // 0 means no extra weapon and token
842
822 843 if (value.killed) {
823 844 if (
824 845 value.weaponLoc &&
@@ -827,6 +848,20 @@ export const addMissionInventoryUpdates = async (
827 848 const weaponType = manifest.weapons[inventory.Nemesis.WeaponIdx];
828 849 giveNemesisWeaponRecipe(inventory, weaponType, value.nemesisName, value.weaponLoc, profile);
829 850 att.push(weaponType);
851 if (extraWeaponCheat >= 1) {
852 for (let i = 0; i < extraWeaponCheat; i++) {
853 const randomIndex = Math.floor(Math.random() * manifest.weapons.length);
854 const randomWeapon = manifest.weapons[randomIndex];
855 giveNemesisWeaponRecipe(
856 inventory,
857 randomWeapon,
858 value.nemesisName,
859 undefined,
860 profile
861 );
862 att.push(randomWeapon);
863 }
864 }
830 865 }
831 866 //if (value.petLoc) {
832 867 if (profile.petHead) {
@@ -870,7 +905,7 @@ export const addMissionInventoryUpdates = async (
870 905 countedAtt = [
871 906 {
872 907 ItemType: "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
873 ItemCount: getKillTokenRewardCount(inventory.Nemesis.fp)
908 ItemCount: getKillTokenRewardCount(inventory.Nemesis.fp) * (extraWeaponCheat + 1)
874 909 }
875 910 ];
876 911 addMiscItems(inventory, countedAtt);
@@ -1400,7 +1435,9 @@ export const addMissionRewards = async (
1400 1435
1401 1436 if (inventory.Nemesis.Faction == "FC_INFESTATION") {
1402 1437 inventory.Nemesis.MissionCount += 1;
1403 inventory.Nemesis.HenchmenKilled = Math.min(inventory.Nemesis.HenchmenKilled + 5, 95); // 5 progress per mission until 95
1438 let antivirusGain = 5;
1439 antivirusGain *= inventory.nemesisAntivirusGainMultiplier ?? 1;
1440 inventory.Nemesis.HenchmenKilled = Math.min(inventory.Nemesis.HenchmenKilled + antivirusGain, 95); // 5 progress per mission until 95
1404 1441
1405 1442 inventoryChanges.Nemesis.MissionCount ??= 0;
1406 1443 inventoryChanges.Nemesis.MissionCount += 1;
Modified src/types/inventoryTypes/inventoryTypes.ts +6 -0
@@ -55,6 +55,12 @@ export interface IAccountCheats {
55 55 flawlessRelicsAlwaysGiveSilverReward?: boolean;
56 56 radiantRelicsAlwaysGiveGoldReward?: boolean;
57 57 disableDailyTribute?: boolean;
58 nemesisHenchmenKillsMultiplierGrineer?: number;
59 nemesisHenchmenKillsMultiplierCorpus?: number;
60 nemesisAntivirusGainMultiplier?: number;
61 nemesisHintProgressMultiplierGrineer?: number;
62 nemesisHintProgressMultiplierCorpus?: number;
63 nemesisExtraWeapon?: number;
58 64 }
59 65
60 66 export interface IInventoryDatabase
Modified static/webui/index.html +43 -1
@@ -1015,6 +1015,48 @@
1015 1015 <input class="form-check-input" type="checkbox" id="finishInvasionsInOneMission" />
1016 1016 <label class="form-check-label" for="finishInvasionsInOneMission" data-loc="cheats_finishInvasionsInOneMission"></label>
1017 1017 </div>
1018 <form class="form-group mt-2">
1019 <label class="form-label" for="nemesisHenchmenKillsMultiplierGrineer" data-loc="cheats_nemesisHenchmenKillsMultiplierGrineer"></label>
1020 <div class="input-group">
1021 <input class="form-control" id="nemesisHenchmenKillsMultiplierGrineer" type="number" min="0" max="65535" data-default="1" />
1022 <button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
1023 </div>
1024 </form>
1025 <form class="form-group mt-2">
1026 <label class="form-label" for="nemesisHenchmenKillsMultiplierCorpus" data-loc="cheats_nemesisHenchmenKillsMultiplierCorpus"></label>
1027 <div class="input-group">
1028 <input class="form-control" id="nemesisHenchmenKillsMultiplierCorpus" type="number" min="0" max="65535" data-default="1" />
1029 <button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
1030 </div>
1031 </form>
1032 <form class="form-group mt-2">
1033 <label class="form-label" for="nemesisAntivirusGainMultiplier" data-loc="cheats_nemesisAntivirusGainMultiplier"></label>
1034 <div class="input-group">
1035 <input class="form-control" id="nemesisAntivirusGainMultiplier" type="number" min="0" max="65535" data-default="1" />
1036 <button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
1037 </div>
1038 </form>
1039 <form class="form-group mt-2">
1040 <label class="form-label" for="nemesisHintProgressMultiplierGrineer" data-loc="cheats_nemesisHintProgressMultiplierGrineer"></label>
1041 <div class="input-group">
1042 <input class="form-control" id="nemesisHintProgressMultiplierGrineer" type="number" min="0" max="65535" data-default="1" />
1043 <button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
1044 </div>
1045 </form>
1046 <form class="form-group mt-2">
1047 <label class="form-label" for="nemesisHintProgressMultiplierCorpus" data-loc="cheats_nemesisHintProgressMultiplierCorpus"></label>
1048 <div class="input-group">
1049 <input class="form-control" id="nemesisHintProgressMultiplierCorpus" type="number" min="0" max="65535" data-default="1" />
1050 <button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
1051 </div>
1052 </form>
1053 <form class="form-group mt-2">
1054 <label class="form-label" for="nemesisExtraWeapon" data-loc="cheats_nemesisExtraWeapon"></label>
1055 <div class="input-group">
1056 <input class="form-control" id="nemesisExtraWeapon" type="number" min="0" max="65535" data-default="0" />
1057 <button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
1058 </div>
1059 </form>
1018 1060 <div class="mt-2 mb-2 d-flex flex-wrap gap-2">
1019 1061 <button class="btn btn-primary" onclick="debounce(doUnlockAllShipFeatures);" data-loc="cheats_unlockAllShipFeatures"></button>
1020 1062 <button class="btn btn-primary" onclick="debounce(unlockAllMissions);" data-loc="cheats_unlockAllMissions"></button>
@@ -1033,7 +1075,7 @@
1033 1075 <label class="form-label" for="changeSyndicate" data-loc="cheats_changeSupportedSyndicate"></label>
1034 1076 <div class="input-group">
1035 1077 <select class="form-control" id="changeSyndicate"></select>
1036 <button class="btn btn-primary" type="submit" data-loc="cheats_changeButton"></button>
1078 <button class="btn btn-secondary" type="submit" data-loc="cheats_changeButton"></button>
1037 1079 </div>
1038 1080 </form>
1039 1081 </div>
Modified static/webui/script.js +40 -1
@@ -1991,7 +1991,11 @@ function updateInventory() {
1991 1991 }
1992 1992
1993 1993 for (const elm of accountCheats) {
1994 elm.checked = !!data[elm.id];
1994 if (elm.type === "checkbox") {
1995 elm.checked = !!data[elm.id];
1996 } else if (elm.type === "number") {
1997 elm.value = data[elm.id] !== undefined ? data[elm.id] : elm.getAttribute("data-default") || "";
1998 }
1995 1999 }
1996 2000 });
1997 2001 });
@@ -3208,6 +3212,41 @@ document.querySelectorAll("#account-cheats input[type=checkbox]").forEach(elm =>
3208 3212 };
3209 3213 });
3210 3214
3215 document.querySelectorAll("#account-cheats .input-group").forEach(grp => {
3216 const input = grp.querySelector("input");
3217 const select = grp.querySelector("select");
3218 const btn = grp.querySelector("button");
3219 if (input) {
3220 input.oninput = input.onchange = function () {
3221 btn.classList.remove("btn-secondary");
3222 btn.classList.add("btn-primary");
3223 };
3224 }
3225 if (select) {
3226 select.oninput = select.onchange = function () {
3227 btn.classList.remove("btn-secondary");
3228 btn.classList.add("btn-primary");
3229 };
3230 }
3231 btn.onclick = function () {
3232 btn.classList.remove("btn-primary");
3233 btn.classList.add("btn-secondary");
3234 const input = btn.closest(".input-group").querySelector('input[type="number"]');
3235 if (!input) return;
3236 revalidateAuthz().then(() => {
3237 const value = input.value;
3238 $.post({
3239 url: "/custom/setAccountCheat?" + window.authz,
3240 contentType: "application/json",
3241 data: JSON.stringify({
3242 key: input.id,
3243 value: parseInt(value)
3244 })
3245 });
3246 });
3247 };
3248 });
3249
3211 3250 document.querySelectorAll("#guild-cheats input[type=checkbox]").forEach(elm => {
3212 3251 elm.onchange = function () {
3213 3252 revalidateAuthz().then(() => {
Modified static/webui/translations/de.js +6 -0
@@ -257,6 +257,12 @@ dict = {
257 257 cheats_changeButton: `Ändern`,
258 258 cheats_markAllAsRead: `Posteingang als gelesen markieren`,
259 259 cheats_finishInvasionsInOneMission: `[UNTRANSLATED] Finish Invasions in One Mission`,
260 cheats_nemesisHenchmenKillsMultiplierGrineer: `[UNTRANSLATED] Rage Progess Multiplier (Grineer)`,
261 cheats_nemesisHenchmenKillsMultiplierCorpus: `[UNTRANSLATED] Rage Progess Multiplier (Corpus)`,
262 cheats_nemesisAntivirusGainMultiplier: `[UNTRANSLATED] Antivirus Progress Multiplier`,
263 cheats_nemesisHintProgressMultiplierGrineer: `[UNTRANSLATED] Hint Progress Multiplier (Grineer)`,
264 cheats_nemesisHintProgressMultiplierCorpus: `[UNTRANSLATED] Hint Progress Multiplier (Corpus)`,
265 cheats_nemesisExtraWeapon: `[UNTRANSLATED] Extra Nemesis Weapon / Token On Vanquish (0 to disable)`,
260 266
261 267 worldState: `Weltstatus`,
262 268 worldState_creditBoost: `Event Booster: Credit`,
Modified static/webui/translations/en.js +6 -0
@@ -256,6 +256,12 @@ dict = {
256 256 cheats_changeButton: `Change`,
257 257 cheats_markAllAsRead: `Mark Inbox As Read`,
258 258 cheats_finishInvasionsInOneMission: `Finish Invasions in One Mission`,
259 cheats_nemesisHenchmenKillsMultiplierGrineer: `Rage Progess Multiplier (Grineer)`,
260 cheats_nemesisHenchmenKillsMultiplierCorpus: `Rage Progess Multiplier (Corpus)`,
261 cheats_nemesisAntivirusGainMultiplier: `Antivirus Progress Multiplier`,
262 cheats_nemesisHintProgressMultiplierGrineer: `Hint Progress Multiplier (Grineer)`,
263 cheats_nemesisHintProgressMultiplierCorpus: `Hint Progress Multiplier (Corpus)`,
264 cheats_nemesisExtraWeapon: `Extra Nemesis Weapon / Token On Vanquish (0 to disable)`,
259 265
260 266 worldState: `World State`,
261 267 worldState_creditBoost: `Credit Boost`,
Modified static/webui/translations/es.js +6 -0
@@ -257,6 +257,12 @@ dict = {
257 257 cheats_changeButton: `Cambiar`,
258 258 cheats_markAllAsRead: `Marcar bandeja de entrada como leída`,
259 259 cheats_finishInvasionsInOneMission: `Finaliza Invasión en una mision`,
260 cheats_nemesisHenchmenKillsMultiplierGrineer: `[UNTRANSLATED] Rage Progess Multiplier (Grineer)`,
261 cheats_nemesisHenchmenKillsMultiplierCorpus: `[UNTRANSLATED] Rage Progess Multiplier (Corpus)`,
262 cheats_nemesisAntivirusGainMultiplier: `[UNTRANSLATED] Antivirus Progress Multiplier`,
263 cheats_nemesisHintProgressMultiplierGrineer: `[UNTRANSLATED] Hint Progress Multiplier (Grineer)`,
264 cheats_nemesisHintProgressMultiplierCorpus: `[UNTRANSLATED] Hint Progress Multiplier (Corpus)`,
265 cheats_nemesisExtraWeapon: `[UNTRANSLATED] Extra Nemesis Weapon / Token On Vanquish (0 to disable)`,
260 266
261 267 worldState: `Estado del mundo`,
262 268 worldState_creditBoost: `Potenciador de Créditos`,
Modified static/webui/translations/fr.js +6 -0
@@ -257,6 +257,12 @@ dict = {
257 257 cheats_changeButton: `Changer`,
258 258 cheats_markAllAsRead: `Marquer la boîte de réception comme lue`,
259 259 cheats_finishInvasionsInOneMission: `Compléter les invasions en une mission.`,
260 cheats_nemesisHenchmenKillsMultiplierGrineer: `[UNTRANSLATED] Rage Progess Multiplier (Grineer)`,
261 cheats_nemesisHenchmenKillsMultiplierCorpus: `[UNTRANSLATED] Rage Progess Multiplier (Corpus)`,
262 cheats_nemesisAntivirusGainMultiplier: `[UNTRANSLATED] Antivirus Progress Multiplier`,
263 cheats_nemesisHintProgressMultiplierGrineer: `[UNTRANSLATED] Hint Progress Multiplier (Grineer)`,
264 cheats_nemesisHintProgressMultiplierCorpus: `[UNTRANSLATED] Hint Progress Multiplier (Corpus)`,
265 cheats_nemesisExtraWeapon: `[UNTRANSLATED] Extra Nemesis Weapon / Token On Vanquish (0 to disable)`,
260 266
261 267 worldState: `Carte Solaire`,
262 268 worldState_creditBoost: `Booster de Crédit`,
Modified static/webui/translations/ru.js +6 -0
@@ -257,6 +257,12 @@ dict = {
257 257 cheats_changeButton: `Изменить`,
258 258 cheats_markAllAsRead: `Пометить все входящие как прочитанные`,
259 259 cheats_finishInvasionsInOneMission: `Завершать вторжение за одну миссию`,
260 cheats_nemesisHenchmenKillsMultiplierGrineer: `[UNTRANSLATED] Rage Progess Multiplier (Grineer)`,
261 cheats_nemesisHenchmenKillsMultiplierCorpus: `[UNTRANSLATED] Rage Progess Multiplier (Corpus)`,
262 cheats_nemesisAntivirusGainMultiplier: `[UNTRANSLATED] Antivirus Progress Multiplier`,
263 cheats_nemesisHintProgressMultiplierGrineer: `[UNTRANSLATED] Hint Progress Multiplier (Grineer)`,
264 cheats_nemesisHintProgressMultiplierCorpus: `[UNTRANSLATED] Hint Progress Multiplier (Corpus)`,
265 cheats_nemesisExtraWeapon: `[UNTRANSLATED] Extra Nemesis Weapon / Token On Vanquish (0 to disable)`,
260 266
261 267 worldState: `Состояние мира`,
262 268 worldState_creditBoost: `Глобальный бустер Кредитов`,
Modified static/webui/translations/uk.js +6 -0
Modified static/webui/translations/zh.js +6 -0