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

Feat: Area Ranks #671

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

RyanYappert
Copy link
Collaborator

@RyanYappert RyanYappert commented Dec 27, 2024

Implements Area Ranks and their associated unlocks.

  • Finishes packet structures for several area-rank related packets.
  • Adds, upgrades, and migrates from pcaps handlers for various area-rank related features:
    • Fetching Area Ranks, related unlocks, and the area spot information.
    • Fetching the Area Supply items that a player is eligible for, as well as obtaining those items from the area supply.
    • Gaining Area Points and ranking up.
  • Adds database structures for area ranks ddon_area_rank and waiting supply items ddon_area_rank_supply.
    • This migrates DB version 27 -> 28
  • Adds scheduled task for the weekly area rank support. This includes both the weekly point rollover and the distribution of supplies.
    • This occurs on Mondays at 5 am by default.
    • Adds RPC internal commands to support the notifying of non-head servers of this event.
  • Adds /areapoint [areaId] [amount] as a debug command.
  • Adds AreaRankSpotInfoAsset, AreaRankRequirementAsset, and AreaRankSupplyAsset.
    • The SpotInfo and Requirement assets are serverside copies of information the client uses in the UI without prompting. These "define" what things unlock when, and what point totals or quests are needed to progress to a certain rank. As such, these largely should not be altered.
    • The Supply asset defines the slate of area rank supply rewards for combinations of weekly point totals and area rank. These can be freely altered.
  • Adds Area Point support for quests, by the (possibly abusive) new PointType.
    • Based on wiki-crawled values, the reward for a given quest seems to be based entirely on the quest's recommended level and area. For S2/S3 areas, all quests reward a flat 500 points. For S1 areas, this curve seemed to be based on pre-relaxation values that seemed to reward very large amounts of AP relative to the rank requirements. Since the rank requirements seem roughly similar in magnitude between S1/S2/S3, the curve was flattened so that high level S1 quests do not reward such absurd AP amounts.
    • A quest's "tier" is floor(level/5). It's AP is then 5*tier^2 + 5*tier + 30.
      • The original curve is 10*tier^2 + 10*tier + 30
    • Existing world and board quests have had AP rewards added based on this curve. This is why it touches 700+ files, sorry.
      • Existing world quests will automatically get AP added to them if they don't have an entry listed. Board quests have been modified manually because they need it as part of a data structure and its a bit of a pain to sneak it in.
      • Board quests reward half as much AP as world quests.
    • EnableAreaRankSpotLocks has been added to the GameLogicSettings. When this is true, the full area rank system is implemented. When false, all spot unlocks are granted automatically; this does cause some UI weirdness with the Area List, but should be functionally fine.

To-Do:

  • AreaGetAreaQuestHintListHandler is a very bizarre system and the way that we track quests and alert the client to them is somehow not working the way it wants. Luckily, this system is dumb and terrible, and we can probably safely ignore it.
    • For the moment, this handler always returns an empty list of quest hints, which the client interprets as "this feature is currently not available" and the option in the UI is grayed out.
  • Area Rank 11 apparently releases all the unreleased warp points in an area; I or somebody has to write that map if we want to bother with that reward.
  • S1 has 47 area trials; S2 has 26, S3 has 8. Now that the systems are done, I can write those.

Checklist:

  • The project compiles
  • The PR targets develop branch

{
19 => true,
20 => false,
_ => throw new ResponseErrorException(ErrorCode.ERROR_CODE_AREAMASTER_INVALID_SUPPLY_STORAGE),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've seen this 19/20 values meaning to bag/to storage a lot, maybe it should be time to move them into an enum? 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but do we know what it really means?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides 19 meaning bag and 20 being storage, not really, maybe the mobile app has some answers

@pacampbell pacampbell mentioned this pull request Dec 27, 2024
2 tasks
{
19 => true,
20 => false,
_ => throw new ResponseErrorException(ErrorCode.ERROR_CODE_AREAMASTER_INVALID_SUPPLY_STORAGE),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but do we know what it really means?

@@ -61,8 +65,16 @@
{
"type": "MyQstFlags",
"announce_type": "Accept",
"set_flags": [ 6 ],
"check_flags": [ 1, 2, 3, 4, 5 ]
"set_flags": [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These JSON formatting changes made to all these quests makes it harder to read which is important since we are hand writing all these quests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that any change I make programmatically re-formats the JSON to "standard" JSON. Maybe there's some option in Python's json module that I'm not using, but the alternative is hand-adding rewards to 237 world quests, or doing area-points programmatically on deserializing the asset, which I didn't like conceptually.

RyanYappert added a commit to RyanYappert/Arrowgene.DragonsDogmaOnline that referenced this pull request Dec 28, 2024
…when using a master craft pawn, clean up skill assets, fix missing serializer from sebastian-heinz#671.
throw new ResponseErrorException(ErrorCode.ERROR_CODE_AREAMASTER_SUPPLY_NOT_AVAILABLE, $"No valid asset for {areaId} found in AreaRankSupply asset.");
}

var rankSupplies = areaSupplies.Where(x => x.MinRank <= rank).OrderBy(x => x.MinRank).LastOrDefault();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to use Single() instead so it also throws an exception if there's more than one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because you want the last one that you qualify for.

areaSupplies
.Where(x => x.MinRank <= rank) // Get all qualifying supply sets; this is usually multiple if your rank is higher than 4 or so, depending on area.
.OrderBy(x => x.MinRank) // Sort from lowest required rank to highest.
.LastOrDefault() // Take the highest rank qualifying supply set.

throw new ResponseErrorException(ErrorCode.ERROR_CODE_AREAMASTER_SUPPLY_NOT_AVAILABLE, $"No valid asset for {areaId}, rank {rank} found in AreaRankSupply asset.");
}

var pointSupplies = rankSupplies.SupplyItemInfoList.Where(x => x.MinAreaPoint <= points).OrderBy(x => x.MinAreaPoint).LastOrDefault();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@RyanYappert RyanYappert marked this pull request as ready for review January 17, 2025 09:09
…opagate properly; fix DC when handing in delivery quests.
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.

3 participants