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

Add limit for dragons #792

Merged
merged 5 commits into from
May 12, 2024
Merged

Add limit for dragons #792

merged 5 commits into from
May 12, 2024

Conversation

SapiensAnatis
Copy link
Owner

@SapiensAnatis SapiensAnatis commented May 12, 2024

Starts enforcing the maximum dragon limit, with excess going to the present box. Closes #670

On save import, the dragon list will be trimmed, taking the first N dragons according to the $.user_data.max_dragon_quantity. This itself is capped at 500 to prevent people from editing it to int.MaxValue. Existing saves will not be affected unless they are re-imported.

Additionally includes some refactoring of RewardService and the summoning logic. The existing 'grant multiple character/dragon' logic has been extracted into RewardService as an implementation of a new IBatchRewardHandler. SummonService now calls this from a support UnitService that handles the unique requirement of needing to know whether an added dragon was new, since this cannot be known from the reward grant result.

@SapiensAnatis SapiensAnatis merged commit 64e4d66 into main May 12, 2024
7 checks passed
@SapiensAnatis SapiensAnatis deleted the fix/dragon-limit branch May 12, 2024 20:30
SapiensAnatis added a commit that referenced this pull request May 12, 2024
The changes in #792 introduced a global query filter to PlayerUserData
which is being hit in the OAuthCallback, but throwing an exception in
IPlayerIdentityService as there is no ViewerId claim at this point in
the auth code.

Fix that by ignoring query filters since there is a filter here anyway.
SapiensAnatis added a commit that referenced this pull request May 13, 2024
This is based on player feedback from the changes to save import in
#792 to provide a more clear warning about what will happen when
importing a save with an excess number of dragons. Since we are not
currently able to show feedback on the save import process, we will
settle for introducing a dialog in the save export page where most
players who end up reimporting their save will have to go first.
SapiensAnatis added a commit that referenced this pull request May 13, 2024
This is based on player feedback from the changes to save import in #792
to provide a more clear warning about what will happen when importing a
save with an excess number of dragons. Since we are not currently able
to show feedback on the save import process, we will settle for
introducing a dialog in the save export page where most players who end
up reimporting their save will have to go first.
SapiensAnatis added a commit that referenced this pull request May 16, 2024
More fallout from #792 - I forgot that you can trade for multiple
dragons at once in treasure trade. After #792 this only gives 1 dragon
and scams the player. This is actually quite tricky to handle since
each dragon could put you over the limit.

This change special-cases dragon trades and splits them up to be sent
to the batch reward handler which can process each one individually.
To accomplish this the BatchGrantReward method has been expanded to
use a fallback for non-batchable entities instead of just throwing.
SapiensAnatis added a commit that referenced this pull request May 16, 2024
More fallout from #792 - I forgot that you can trade for multiple
dragons at once in treasure trade. After #792 this only gives 1 dragon
and scams the player, as DragonHandler ignores `Entity.Quantity`. This
is actually quite tricky to handle since each dragon could put you over
the limit.

This change special-cases dragon trades and splits them up to be sent to
the batch reward handler one-by-one which can process each one
individually. To accomplish this the BatchGrantReward method has been
expanded to use a fallback for non-batchable entities instead of just
throwing.
SapiensAnatis added a commit that referenced this pull request Jun 30, 2024
Starts enforcing the maximum dragon limit, with excess going to the
present box. Closes
#670

On save import, the dragon list will be trimmed, taking the first N
dragons according to the `$.user_data.max_dragon_quantity`. This itself
is capped at 500 to prevent people from editing it to `int.MaxValue`.
Existing saves will not be affected unless they are re-imported.

Additionally includes some refactoring of `RewardService` and the
summoning logic. The existing 'grant multiple character/dragon' logic
has been extracted into `RewardService` as an implementation of a new
`IBatchRewardHandler`. `SummonService` now calls this from a support
`UnitService` that handles the unique requirement of needing to know
whether an added dragon was new, since this cannot be known from the
reward grant result.
SapiensAnatis added a commit that referenced this pull request Jun 30, 2024
The changes in #792 introduced a global query filter to PlayerUserData
which is being hit in the OAuthCallback, but throwing an exception in
IPlayerIdentityService as there is no ViewerId claim at this point in
the auth code.

Fix that by ignoring query filters since there is a filter here anyway.
SapiensAnatis added a commit that referenced this pull request Jun 30, 2024
This is based on player feedback from the changes to save import in #792
to provide a more clear warning about what will happen when importing a
save with an excess number of dragons. Since we are not currently able
to show feedback on the save import process, we will settle for
introducing a dialog in the save export page where most players who end
up reimporting their save will have to go first.
SapiensAnatis added a commit that referenced this pull request Jun 30, 2024
More fallout from #792 - I forgot that you can trade for multiple
dragons at once in treasure trade. After #792 this only gives 1 dragon
and scams the player, as DragonHandler ignores `Entity.Quantity`. This
is actually quite tricky to handle since each dragon could put you over
the limit.

This change special-cases dragon trades and splits them up to be sent to
the batch reward handler one-by-one which can process each one
individually. To accomplish this the BatchGrantReward method has been
expanded to use a fallback for non-batchable entities instead of just
throwing.
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

Successfully merging this pull request may close these issues.

Limit the number of dragons players can own according to their stated inventory capacity
1 participant