add sendWsBroadcastToGame
This commit is contained in:
parent
922e0fb124
commit
370b0c19ea
@ -20,7 +20,7 @@ import {
|
|||||||
applyCheatsToInfestedFoundry,
|
applyCheatsToInfestedFoundry,
|
||||||
handleSubsumeCompletion
|
handleSubsumeCompletion
|
||||||
} from "../../services/infestedFoundryService.ts";
|
} from "../../services/infestedFoundryService.ts";
|
||||||
import { sendWsBroadcastTo } from "../../services/wsService.ts";
|
import { sendWsBroadcastToGame } from "../../services/wsService.ts";
|
||||||
|
|
||||||
export const infestedFoundryController: RequestHandler = async (req, res) => {
|
export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||||
const account = await getAccountForRequest(req);
|
const account = await getAccountForRequest(req);
|
||||||
@ -364,7 +364,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
|||||||
);
|
);
|
||||||
addRecipes(inventory, recipeChanges);
|
addRecipes(inventory, recipeChanges);
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
sendWsBroadcastTo(account._id.toString(), { sync_inventory: true });
|
sendWsBroadcastToGame(account._id.toString(), { sync_inventory: true });
|
||||||
}
|
}
|
||||||
res.end();
|
res.end();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import type { RequestHandler } from "express";
|
|||||||
import { ExportResources, ExportVirtuals } from "warframe-public-export-plus";
|
import { ExportResources, ExportVirtuals } from "warframe-public-export-plus";
|
||||||
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
||||||
import { addItem, getInventory } from "../../services/inventoryService.ts";
|
import { addItem, getInventory } from "../../services/inventoryService.ts";
|
||||||
import { sendWsBroadcastTo } from "../../services/wsService.ts";
|
import { sendWsBroadcastToGame } from "../../services/wsService.ts";
|
||||||
|
|
||||||
export const unlockAllCapturaScenesController: RequestHandler = async (req, res) => {
|
export const unlockAllCapturaScenesController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -19,7 +19,7 @@ export const unlockAllCapturaScenesController: RequestHandler = async (req, res)
|
|||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.end();
|
res.end();
|
||||||
if (needSync) {
|
if (needSync) {
|
||||||
sendWsBroadcastTo(accountId, { sync_inventory: true });
|
sendWsBroadcastToGame(accountId, { sync_inventory: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { getInventory } from "../../services/inventoryService.ts";
|
import { getInventory } from "../../services/inventoryService.ts";
|
||||||
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
||||||
import type { RequestHandler } from "express";
|
import type { RequestHandler } from "express";
|
||||||
import { sendWsBroadcastTo } from "../../services/wsService.ts";
|
import { sendWsBroadcastToGame } from "../../services/wsService.ts";
|
||||||
|
|
||||||
export const unlockAllIntrinsicsController: RequestHandler = async (req, res) => {
|
export const unlockAllIntrinsicsController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -17,5 +17,5 @@ export const unlockAllIntrinsicsController: RequestHandler = async (req, res) =>
|
|||||||
inventory.PlayerSkills.LPS_DRIFT_ENDURANCE = 10;
|
inventory.PlayerSkills.LPS_DRIFT_ENDURANCE = 10;
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.end();
|
res.end();
|
||||||
sendWsBroadcastTo(accountId, { sync_inventory: true });
|
sendWsBroadcastToGame(accountId, { sync_inventory: true });
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { getInventory } from "../../services/inventoryService.ts";
|
import { getInventory } from "../../services/inventoryService.ts";
|
||||||
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
||||||
import type { RequestHandler } from "express";
|
import type { RequestHandler } from "express";
|
||||||
import { sendWsBroadcastTo } from "../../services/wsService.ts";
|
import { sendWsBroadcastToGame } from "../../services/wsService.ts";
|
||||||
|
|
||||||
const allEudicoHeistJobs = [
|
const allEudicoHeistJobs = [
|
||||||
"/Lotus/Types/Gameplay/Venus/Jobs/Heists/HeistProfitTakerBountyOne",
|
"/Lotus/Types/Gameplay/Venus/Jobs/Heists/HeistProfitTakerBountyOne",
|
||||||
@ -22,5 +22,5 @@ export const unlockAllProfitTakerStagesController: RequestHandler = async (req,
|
|||||||
}
|
}
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.end();
|
res.end();
|
||||||
sendWsBroadcastTo(accountId, { sync_inventory: true });
|
sendWsBroadcastToGame(accountId, { sync_inventory: true });
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import type { RequestHandler } from "express";
|
import type { RequestHandler } from "express";
|
||||||
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
||||||
import { getInventory } from "../../services/inventoryService.ts";
|
import { getInventory } from "../../services/inventoryService.ts";
|
||||||
import { sendWsBroadcastTo } from "../../services/wsService.ts";
|
import { sendWsBroadcastToGame } from "../../services/wsService.ts";
|
||||||
|
|
||||||
export const unlockAllSimarisResearchEntriesController: RequestHandler = async (req, res) => {
|
export const unlockAllSimarisResearchEntriesController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -18,5 +18,5 @@ export const unlockAllSimarisResearchEntriesController: RequestHandler = async (
|
|||||||
].map(type => ({ TargetType: type, Scans: 10, Completed: true }));
|
].map(type => ({ TargetType: type, Scans: 10, Completed: true }));
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.end();
|
res.end();
|
||||||
sendWsBroadcastTo(accountId, { sync_inventory: true });
|
sendWsBroadcastToGame(accountId, { sync_inventory: true });
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { getInventory } from "../../services/inventoryService.ts";
|
|||||||
import type { WeaponTypeInternal } from "../../services/itemDataService.ts";
|
import type { WeaponTypeInternal } from "../../services/itemDataService.ts";
|
||||||
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
||||||
import type { RequestHandler } from "express";
|
import type { RequestHandler } from "express";
|
||||||
import { sendWsBroadcastTo } from "../../services/wsService.ts";
|
import { sendWsBroadcastToGame } from "../../services/wsService.ts";
|
||||||
|
|
||||||
export const updateFingerprintController: RequestHandler = async (req, res) => {
|
export const updateFingerprintController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -23,7 +23,7 @@ export const updateFingerprintController: RequestHandler = async (req, res) => {
|
|||||||
await inventory.save();
|
await inventory.save();
|
||||||
}
|
}
|
||||||
res.end();
|
res.end();
|
||||||
sendWsBroadcastTo(accountId, { sync_inventory: true });
|
sendWsBroadcastToGame(accountId, { sync_inventory: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IUpdateFingerPrintRequest {
|
interface IUpdateFingerPrintRequest {
|
||||||
|
|||||||
@ -222,6 +222,15 @@ export const sendWsBroadcastTo = (accountId: string, data: IWsMsgToClient): void
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const sendWsBroadcastToGame = (accountId: string, data: IWsMsgToClient): void => {
|
||||||
|
const msg = JSON.stringify(data);
|
||||||
|
forEachClient(client => {
|
||||||
|
if (client.isGame && client.accountId == accountId) {
|
||||||
|
client.send(msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const sendWsBroadcastEx = (data: IWsMsgToClient, accountId: string | undefined, excludeWsid: number): void => {
|
export const sendWsBroadcastEx = (data: IWsMsgToClient, accountId: string | undefined, excludeWsid: number): void => {
|
||||||
const msg = JSON.stringify(data);
|
const msg = JSON.stringify(data);
|
||||||
forEachClient(client => {
|
forEachClient(client => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user