sync inventory when focus schools were unlocked
This commit is contained in:
parent
88f343f39a
commit
d52cbb9ac4
@ -62,6 +62,7 @@ interface IWsMsgFromClient {
|
||||
nonce: number;
|
||||
};
|
||||
logout?: boolean;
|
||||
sync_inventory?: boolean;
|
||||
}
|
||||
|
||||
interface IWsMsgToClient {
|
||||
@ -168,16 +169,24 @@ const wsOnConnect = (ws: WebSocket, req: http.IncomingMessage): void => {
|
||||
}
|
||||
if (data.logout) {
|
||||
const accountId = (ws as IWsCustomData).accountId;
|
||||
(ws as IWsCustomData).accountId = undefined;
|
||||
await Account.updateOne(
|
||||
{
|
||||
_id: accountId,
|
||||
ClientType: "webui"
|
||||
},
|
||||
{
|
||||
Nonce: 0
|
||||
}
|
||||
);
|
||||
if (accountId) {
|
||||
(ws as IWsCustomData).accountId = undefined;
|
||||
await Account.updateOne(
|
||||
{
|
||||
_id: accountId,
|
||||
ClientType: "webui"
|
||||
},
|
||||
{
|
||||
Nonce: 0
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
if (data.sync_inventory) {
|
||||
const accountId = (ws as IWsCustomData).accountId;
|
||||
if (accountId) {
|
||||
sendWsBroadcastToGame(accountId, { sync_inventory: true });
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
logError(e as Error, `processing websocket message`);
|
||||
|
||||
@ -2993,6 +2993,9 @@ function doUnlockAllFocusSchools() {
|
||||
toast(loc("code_focusAllUnlocked"));
|
||||
} else {
|
||||
toast(loc("code_focusUnlocked").split("|COUNT|").join(Object.keys(missingFocusUpgrades).length));
|
||||
if (ws_is_open) {
|
||||
window.ws.send(JSON.stringify({ sync_inventory: true }));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user