| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #pragma once
- #include "../../../../middleware/content/packages/reader/reader.h"
- #include "../../../../middleware/content/packages/tables/definition_index_table.h"
- #include "../../../../state/account/account_state.h"
- #include "../../../../state/build_data/rewards/definition.h"
- namespace sunrise::client::content::items::packages {
- struct SlotMaps;
- /** Resolves expression references and unlock slots once for a package pass. */
- class RewardConditions {
- public:
- [[nodiscard]] bool load(const middleware::content::packages::reader::Source& source,
- middleware::content::packages::reader::Scratch& scratch,
- std::span<const std::byte> root,
- const SlotMaps& maps) noexcept;
- [[nodiscard]] bool bind(state::build_data::rewards::Instruction& instruction) const noexcept;
- [[nodiscard]] bool read(std::span<const std::byte> blob,
- std::size_t at,
- std::vector<state::build_data::rewards::Instruction>& bank,
- state::build_data::rewards::Range& range) const noexcept;
- [[nodiscard]] bool read_list(std::span<const std::byte> blob,
- std::size_t at,
- std::span<state::build_data::rewards::Instruction> output,
- std::size_t& count) const noexcept;
- private:
- [[nodiscard]] bool append_expression(std::span<const std::byte> blob,
- std::size_t at,
- std::vector<state::build_data::rewards::Instruction>& bank,
- std::size_t depth) const noexcept;
- void load_class_flags(const middleware::content::packages::reader::Source& source,
- middleware::content::packages::reader::Scratch& scratch,
- std::span<const std::byte> root) noexcept;
- std::array<std::uint16_t, state::kCharacterClassCount> classFlags_{};
- const SlotMaps* maps_{};
- std::vector<std::byte> flags_;
- std::vector<std::byte> values_;
- std::vector<std::byte> expressions_;
- middleware::content::packages::tables::Array flagRows_{};
- middleware::content::packages::tables::Array valueRows_{};
- middleware::content::packages::tables::Array expressionRows_{};
- };
- /** Reward metadata collected alongside the existing item-definition walk. */
- class RewardBuild {
- public:
- RewardConditions conditions;
- [[nodiscard]] bool load(const middleware::content::packages::reader::Source& source,
- middleware::content::packages::reader::Scratch& scratch,
- std::span<const std::byte> root,
- const SlotMaps& maps) noexcept;
- [[nodiscard]] bool begin_items(std::size_t count) noexcept;
- void item(std::uint16_t index, std::uint32_t hash, std::span<const std::byte> blob) noexcept;
- [[nodiscard]] bool publish() noexcept;
- private:
- [[nodiscard]] bool entry(std::span<const std::byte> blob, std::size_t at) noexcept;
- [[nodiscard]] bool read_item(std::uint32_t hash,
- std::span<const std::byte> blob,
- state::build_data::rewards::Item& item) noexcept;
- bool loaded_{};
- std::vector<state::build_data::rewards::Pool> pools_;
- std::vector<state::build_data::rewards::Entry> entries_;
- std::vector<state::build_data::rewards::Item> items_;
- std::vector<state::build_data::rewards::Instruction> instructions_;
- std::vector<state::build_data::rewards::Modifier> modifiers_;
- std::vector<state::build_data::rewards::SocketOverride> sockets_;
- };
- /** Progression rewards and pool entries use the same socket-override layout. */
- [[nodiscard]] bool read_reward_sockets(std::span<const std::byte> blob,
- std::size_t at,
- std::span<state::build_data::rewards::SocketOverride> output,
- std::size_t& count) noexcept;
- } // namespace sunrise::client::content::items::packages
|