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

You should be able to provide blank values to battlecharacter_id field. #434

Open
BillTheBeast opened this issue Feb 11, 2025 · 3 comments

Comments

@BillTheBeast
Copy link

Currently you cannot provide a "blank" value (0 or -1) to the battleCharacter_id.
Instead you need to provide a valid mangodp id to battleCharacter_id field.

These blank values are needed if the player hasn't set one of the characters in charactergallery to save the states of the gallery properly.

I can try to work around this if you don't want to change this.

What is the endpoint and method? (if applicable)

Endpoint: Player/

Method: PUT

What should it do instead?

If value is 0 or -1 it should be accepted as an empty value.

@MikhailDeriabin
Copy link
Member

MikhailDeriabin commented Feb 12, 2025

@BillTheBeast

If the battleCharacter_ids field is not specified, the value of this field is an empty array.

When you are updating a player data, you do not have to specify this field (nor any of them except for _id).
When you are creating a player this field is also optional, and if not specified, an empty array will be set as a default value.

Do you still need some other value of it as null or is the empty array ok?

@BillTheBeast
Copy link
Author

An empty array is fine but the real problem is if the player has partially filled array.
I.E. Player has selected 2 characters to use in battle (first two slot of the array are filled) but for some reason hasn't selected the third (the third slot is empty/blank).

I could make it so that the data isn't sent to server if one of them is empty, but it could feel cumbersome for the player if sometimes the changes don't save properly, in what they might percieve as "for no good reason".

So yes, I could handle a lot of this clientside, but I just wanted to ask if inserting a incomplete list would be okay.

@MikhailDeriabin
Copy link
Member

@BillTheBeast

It will be ok to insert only 0-3 characters. The validation is set so that this array can be up to 3 _ids.

The only thing to notice is that, when you update player's battleCharacter_ids field, you overwrite the existing array. So it is not possible to i.e. add the last of 3 characters later without specifying all of them.

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

No branches or pull requests

2 participants