pursuit_hold.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <cstdint>
  3. #include "account_state.h"
  4. namespace sunrise::state::account {
  5. /**
  6. * Reports whether an item is a pursuit the selected character already holds.
  7. *
  8. * A pursuit - quest, bounty, token - is unique per character. Two kinds of item are deliberately
  9. * not pursuits, because holding several of each is legitimate: gear, told apart by carrying an
  10. * equipment slot, and consumables and materials, told apart by declaring a stack larger than one.
  11. * The stack size is what separates the second group, not the instanced state: a pursuit carries no
  12. * instance data either, so it is marked stackable exactly as a consumable is.
  13. *
  14. * This lives in State because it mirrors the classification the client's native vendor-row gate
  15. * applies locally when deciding whether a row is still offered, and the two must not drift.
  16. *
  17. * @param itemDefinitionIndex Item to classify.
  18. * @return True when this is a pursuit the selected character already holds.
  19. */
  20. [[nodiscard]] bool holds_pursuit(std::uint16_t itemDefinitionIndex) noexcept;
  21. /**
  22. * The same rule, against an account view the caller already holds.
  23. *
  24. * Reading the account copies the whole of it, so a walk over many candidates - a bounty roll tests
  25. * every item in the vendor's pool - takes one view and reuses it rather than copying per candidate.
  26. *
  27. * @param account Account view to test against.
  28. * @param itemDefinitionIndex Item to classify.
  29. * @return True when this is a pursuit that view's selected character already holds.
  30. */
  31. [[nodiscard]] bool holds_pursuit(const AccountState& account,
  32. std::uint16_t itemDefinitionIndex) noexcept;
  33. } // namespace sunrise::state::account