forked from OpenWF/SpaceNinjaServer
		
	chore(webui): refresh inventory when crafting/buying/gilding kitguns (#2486)
Reviewed-on: OpenWF/SpaceNinjaServer#2486 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: Animan8000 <animan8000@noreply.localhost> Co-committed-by: Animan8000 <animan8000@noreply.localhost>
This commit is contained in:
		
							parent
							
								
									ba3df4bdbc
								
							
						
					
					
						commit
						f6cb8414c1
					
				@ -1,5 +1,6 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
 | 
					import { sendWsBroadcastTo } from "@/src/services/wsService";
 | 
				
			||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
					import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			||||||
import { addMiscItems, getInventory } from "@/src/services/inventoryService";
 | 
					import { addMiscItems, getInventory } from "@/src/services/inventoryService";
 | 
				
			||||||
import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
@ -73,4 +74,5 @@ export const gildWeaponController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        InventoryChanges: inventoryChanges,
 | 
					        InventoryChanges: inventoryChanges,
 | 
				
			||||||
        AffiliationMods: affiliationMods
 | 
					        AffiliationMods: affiliationMods
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					    sendWsBroadcastTo(accountId, { update_inventory: true });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
 | 
					import { sendWsBroadcastTo } from "@/src/services/wsService";
 | 
				
			||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
					import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    getInventory,
 | 
					    getInventory,
 | 
				
			||||||
@ -194,4 +195,5 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res)
 | 
				
			|||||||
            MiscItems: miscItemChanges
 | 
					            MiscItems: miscItemChanges
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					    sendWsBroadcastTo(accountId, { update_inventory: true });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@ import {
 | 
				
			|||||||
} from "@/src/services/inventoryService";
 | 
					} from "@/src/services/inventoryService";
 | 
				
			||||||
import { getDefaultUpgrades } from "@/src/services/itemDataService";
 | 
					import { getDefaultUpgrades } from "@/src/services/itemDataService";
 | 
				
			||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
 | 
					import { sendWsBroadcastTo } from "@/src/services/wsService";
 | 
				
			||||||
import { modularWeaponTypes } from "@/src/helpers/modularWeaponHelper";
 | 
					import { modularWeaponTypes } from "@/src/helpers/modularWeaponHelper";
 | 
				
			||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
					import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
				
			||||||
import { EquipmentFeatures } from "@/src/types/equipmentTypes";
 | 
					import { EquipmentFeatures } from "@/src/types/equipmentTypes";
 | 
				
			||||||
@ -68,6 +69,7 @@ export const modularWeaponSaleController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        res.json({
 | 
					        res.json({
 | 
				
			||||||
            InventoryChanges: inventoryChanges
 | 
					            InventoryChanges: inventoryChanges
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					        sendWsBroadcastTo(accountId, { update_inventory: true });
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        throw new Error(`unknown modularWeaponSale op: ${String(req.query.op)}`);
 | 
					        throw new Error(`unknown modularWeaponSale op: ${String(req.query.op)}`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user