definition.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #pragma once
  2. #include <array>
  3. #include <cstddef>
  4. #include <cstdint>
  5. #include "../build_data/progressions/definition.h"
  6. namespace sunrise::state::unlocks {
  7. /** The account acquired-flag bank holds one byte per flag. */
  8. inline constexpr std::size_t kAccountFlagCapacity = 12'300;
  9. /** The profile unlock bank holds one byte per flag. */
  10. inline constexpr std::size_t kProfileFlagCapacity = 512;
  11. /** Each per-character unlock block holds one byte per flag. */
  12. inline constexpr std::size_t kCharacterFlagCapacity = 256;
  13. /** The account objective bank holds one signed value per objective. */
  14. inline constexpr std::size_t kObjectiveValueCapacity = 6'200;
  15. /** The selected-character object carries its own acquired-flag bank. */
  16. inline constexpr std::size_t kCharacterObjectFlagCapacity = 4'096;
  17. /** The selected-character object carries its own objective bank. */
  18. inline constexpr std::size_t kCharacterObjectValueCapacity = 768;
  19. /** A native progression row carries 3 signed value lanes. */
  20. inline constexpr std::size_t kProgressionLaneCount = 3;
  21. /** The value lanes of one progression. Lane 0 is the progress the level walk reads. */
  22. using ProgressionLanes = std::array<std::int32_t, kProgressionLaneCount>;
  23. /** One scope's authored progression lanes, addressed by definition index. */
  24. using ProgressionBank = std::array<ProgressionLanes, build_data::progressions::kDefinitionCapacity>;
  25. /** A set acquired flag is stored as its biased 2-bit true value. */
  26. inline constexpr std::uint8_t kFlagSet = 2;
  27. /**
  28. * A clear acquired flag is stored as zero.
  29. *
  30. * The flag is a 2-bit field and encodes redeemed state only: all four values were measured (0 and
  31. * 1 show nothing, 2 -- kFlagSet -- shows claimed, 3 shows nothing) and none of them means
  32. * claimable. Claimable is carried by the objective bank instead: a record reads claimable when its
  33. * objective value equals its completionValue while this flag stays clear. See
  34. * record_claims::apply_claimable_objectives.
  35. */
  36. inline constexpr std::uint8_t kFlagClear = 0;
  37. /**
  38. * Authored unlock policy published once for the process.
  39. * Every bank is expanded at parse time, so readers copy bytes with no run decoding.
  40. */
  41. struct Table {
  42. std::array<std::uint8_t, kAccountFlagCapacity> accountFlags{};
  43. std::array<std::uint8_t, kProfileFlagCapacity> profileFlags{};
  44. std::array<std::uint8_t, kCharacterFlagCapacity> characterFlags{};
  45. std::array<std::int32_t, kObjectiveValueCapacity> objectiveValues{};
  46. std::array<std::uint8_t, kCharacterObjectFlagCapacity> characterObjectFlags{};
  47. std::array<std::int32_t, kCharacterObjectValueCapacity> characterObjectValues{};
  48. /** Lanes published into the account object's progression bank. */
  49. ProgressionBank accountProgressions{};
  50. /** Lanes published into the selected-character object's progression bank. */
  51. ProgressionBank characterProgressions{};
  52. /** Legacy configuration field retained for parser compatibility; value gates always publish. */
  53. bool revealAllLoreBooks{true};
  54. };
  55. } // namespace sunrise::state::unlocks