simplify broadcastInventoryUpdate
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build / build (pull_request) Successful in 2m15s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build / build (pull_request) Successful in 2m15s
				
			This commit is contained in:
		
							parent
							
								
									370b0c19ea
								
							
						
					
					
						commit
						9a144e17f7
					
				@ -242,13 +242,16 @@ export const sendWsBroadcastEx = (data: IWsMsgToClient, accountId: string | unde
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export const broadcastInventoryUpdate = (req: Request): void => {
 | 
					export const broadcastInventoryUpdate = (req: Request): void => {
 | 
				
			||||||
    const accountId = req.query.accountId as string;
 | 
					    const accountId = req.query.accountId as string;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // for webui requests, let other tabs know. for game requests, let all tabs know.
 | 
					 | 
				
			||||||
    sendWsBroadcastEx({ update_inventory: true }, accountId, parseInt(String(req.query.wsid)));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // for webui requests, also let the game know.
 | 
					 | 
				
			||||||
    if (req.query.wsid) {
 | 
					    if (req.query.wsid) {
 | 
				
			||||||
        sendWsBroadcastTo(accountId, { sync_inventory: true });
 | 
					        // for webui requests, let other tabs and the game know
 | 
				
			||||||
 | 
					        sendWsBroadcastEx(
 | 
				
			||||||
 | 
					            { sync_inventory: true, update_inventory: true },
 | 
				
			||||||
 | 
					            accountId,
 | 
				
			||||||
 | 
					            parseInt(String(req.query.wsid))
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        // for game requests, let all webui tabs know
 | 
				
			||||||
 | 
					        sendWsBroadcastEx({ update_inventory: true }, accountId, parseInt(String(req.query.wsid))); // TODO: exclude game ws from this somehow
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user