zengm
zengm copied to clipboard
Total stats within play by play
Attempting to do this from the TODO list:
show totals for pts/reb/ast/etc in play by play like "J. Brown Driving layup (12 pts) D. White (3 AST)" https://old.reddit.com/r/BasketballGM/comments/z99cby/monthly_suggestions_thread/j26zhxu/
Was looking in GameSim.basketball/index.ts, and thought it would make the most sense to insert it within the recordPlay
function. I think that grabbing the player information (if available) then putting the correct information into the respective play type:
Ex:
texts = ["{0} grabbed the offensive rebound"];
would become
texts = ["{0} grabbed the offensive rebound {this.team[0].player[0].stat.orb}"];
But, since the way the names are inserted into the text is not a f-string, I was thinking of doing something similar to the code here, but using different keys other than 0 and 1 (like stl? or o_pts?)
(https://github.com/zengm-games/zengm/blob/2e462a5e9054efd76b60feab24fd9ae1fff08d1b/src/worker/core/GameSim.basketball/index.ts#L2402-L2406)
However, a problem with this approach would be since that there are a number of different stats such as points, assists, etc. there would be quite a lot added with this, but if this was switched to using a f-string it would be easier to just change each of the texts