Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for Player Faces to be a part of Global Settings, similar to Player Photos #440

Open
tomkennedy22 opened this issue Mar 2, 2023 · 3 comments

Comments

@tomkennedy22
Copy link
Contributor

It'd be cool if we could import a player photo JSON into the Global Settings screen to have a fixed cartoon player face, similar to player photos. Either by a user who creates a cartoon face themselves, or dedicated user who make entire libraries of them. Similar to screenshot below, bottom right text input box.

image

I might be able to take this issue on, but wanted any thoughts on the subject, if you think it's a good idea at all

@dumbmatter
Copy link
Member

It's a good idea.

Player photos is currently (in TypeScript terms) Record<string, string> but instead it could be Record<string, string | Face>, to support either URLs or face objects, or even both mixed together. typeof x === "string" can distinguish if it's a URL (string) or a face (object).

I think basically the only part of code that'd need to change is

if (realPlayerPhotos[p.srID] !== undefined) {
p.imgURL = realPlayerPhotos[p.srID];
} else {
const name = p.name ?? `${p.firstName} ${p.lastName}`;
// Keep in sync with bbgm-rosters
const key = `dp_${p.draft.year}_${name
.replace(/ /g, "_")
.toLowerCase()}`;
if (realPlayerPhotos[key] !== undefined) {
p.imgURL = realPlayerPhotos[key];
}
}
- check if the player's photo entry is a string or an object, and then update both p.imgURL and p.face.

Please feel free to give it a shot!

@tomkennedy22
Copy link
Contributor Author

Cool, I'll take a look.
Do you have an opinion on the scenario: if a player has both photo URL & and face JSON present in player profile, which to use? In the game currently, users can decide in player profiles, just wanted to see if you would prefer a default.

@dumbmatter
Copy link
Member

Currently I believe it uses the URL if present, and the face otherwise. No need to change that here unless that behavior is a problem. Cause if real player photos is Record<string, string | Face> then it's only one of the two that will be added - but if it's a Face you would need to delete any existing imgURL so it doesn't get overridden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants