feat: support websocket connections from game client #2735
@ -1,5 +1,6 @@
 | 
			
		||||
import { getInventory } from "../../services/inventoryService.ts";
 | 
			
		||||
import { getAccountIdForRequest } from "../../services/loginService.ts";
 | 
			
		||||
import { sendWsBroadcastTo } from "../../services/wsService.ts";
 | 
			
		||||
import type { IAccountCheats } from "../../types/inventoryTypes/inventoryTypes.ts";
 | 
			
		||||
import type { RequestHandler } from "express";
 | 
			
		||||
 | 
			
		||||
@ -10,6 +11,9 @@ export const setAccountCheatController: RequestHandler = async (req, res) => {
 | 
			
		||||
    inventory[payload.key] = payload.value;
 | 
			
		||||
    await inventory.save();
 | 
			
		||||
    res.end();
 | 
			
		||||
    if (["infiniteCredits", "infinitePlatinum", "infiniteEndo", "infiniteRegalAya"].indexOf(payload.key) != -1) {
 | 
			
		||||
        sendWsBroadcastTo(accountId, { update_inventory: true, sync_inventory: true });
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
interface ISetAccountCheatRequest {
 | 
			
		||||
 | 
			
		||||
@ -2869,10 +2869,6 @@ for (const id of uiConfigs) {
 | 
			
		||||
                url: "/custom/setConfig?" + window.authz,
 | 
			
		||||
                contentType: "application/json",
 | 
			
		||||
                data: JSON.stringify({ [id]: this.checked })
 | 
			
		||||
            }).then(() => {
 | 
			
		||||
                if (["infiniteCredits", "infinitePlatinum", "infiniteEndo", "infiniteRegalAya"].indexOf(id) != -1) {
 | 
			
		||||
                    updateInventory();
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user