bdo-toolkit 1.0.16__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. {bdo_toolkit-1.0.16/src/bdo_toolkit.egg-info → bdo_toolkit-1.1.0}/PKG-INFO +2 -1
  2. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/README.md +1 -0
  3. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_item_state/assembly.py +128 -4
  4. bdo_toolkit-1.1.0/src/bdo_toolkit/_item_state/character_discovery.py +258 -0
  5. bdo_toolkit-1.1.0/src/bdo_toolkit/_item_state/character_models.py +128 -0
  6. bdo_toolkit-1.1.0/src/bdo_toolkit/_item_state/character_profile.py +216 -0
  7. bdo_toolkit-1.1.0/src/bdo_toolkit/_item_state/character_slots.py +70 -0
  8. bdo_toolkit-1.1.0/src/bdo_toolkit/_item_state/character_witnesses.py +431 -0
  9. bdo_toolkit-1.1.0/src/bdo_toolkit/_item_state/characters.py +415 -0
  10. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_item_state/inventory.py +6 -5
  11. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_item_state/models.py +7 -1
  12. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_item_state/session.py +40 -0
  13. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_item_state/storage.py +64 -0
  14. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_version.py +1 -1
  15. bdo_toolkit-1.1.0/src/bdo_toolkit/character_calibration.py +226 -0
  16. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/character_state.py +1 -0
  17. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/cli.py +98 -0
  18. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/item_state.py +9 -0
  19. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/profiles.py +16 -0
  20. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/_detail_learning.py +47 -16
  21. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/_details.py +1 -1
  22. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/_discovery.py +29 -0
  23. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/_live_tracker.py +17 -0
  24. bdo_toolkit-1.1.0/src/bdo_toolkit/solare/_short_board.py +116 -0
  25. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0/src/bdo_toolkit.egg-info}/PKG-INFO +2 -1
  26. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit.egg-info/SOURCES.txt +10 -0
  27. bdo_toolkit-1.1.0/tests/test_character_calibration.py +263 -0
  28. bdo_toolkit-1.1.0/tests/test_character_loadouts.py +292 -0
  29. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_character_state.py +73 -12
  30. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_solare_learning.py +4 -2
  31. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_solare_learning_adversarial.py +42 -0
  32. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_solare_replay.py +90 -0
  33. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/LICENSE +0 -0
  34. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/pyproject.toml +0 -0
  35. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/setup.cfg +0 -0
  36. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/__init__.py +0 -0
  37. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_async_sessions.py +0 -0
  38. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_async_utils.py +0 -0
  39. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/__init__.py +0 -0
  40. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/_constants.py +0 -0
  41. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/_formatting.py +0 -0
  42. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/_records.py +0 -0
  43. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/analysis.py +0 -0
  44. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/capture.py +0 -0
  45. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/companions.py +0 -0
  46. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/live.py +0 -0
  47. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/models.py +0 -0
  48. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/observations.py +0 -0
  49. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/persistence.py +0 -0
  50. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/progress.py +0 -0
  51. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/validation.py +0 -0
  52. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_calibration/workflow.py +0 -0
  53. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_capture_backend.py +0 -0
  54. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_capture_options.py +0 -0
  55. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_capture_runtime.py +0 -0
  56. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_deposit_origin.py +0 -0
  57. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_engine.py +0 -0
  58. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_framing.py +0 -0
  59. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_item_state/__init__.py +0 -0
  60. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_item_state/_constants.py +0 -0
  61. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_item_state/_records.py +0 -0
  62. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_item_state/formatting.py +0 -0
  63. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_observation_session.py +0 -0
  64. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_origin/__init__.py +0 -0
  65. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_origin/discovery.py +0 -0
  66. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_origin/manual.py +0 -0
  67. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_origin/models.py +0 -0
  68. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_origin/tracker.py +0 -0
  69. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_profile_io.py +0 -0
  70. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_profile_runtime.py +0 -0
  71. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_protocol.py +0 -0
  72. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_reassembly.py +0 -0
  73. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_record_geometry.py +0 -0
  74. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_specs.py +0 -0
  75. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_storage_destination_validation.py +0 -0
  76. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_storage_hydration.py +0 -0
  77. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/_tracked_capture.py +0 -0
  78. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/__init__.py +0 -0
  79. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/_calibration_models.py +0 -0
  80. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/_capture.py +0 -0
  81. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/_discovery.py +0 -0
  82. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/_profile.py +0 -0
  83. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/_validation.py +0 -0
  84. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/async_session.py +0 -0
  85. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/calibration.py +0 -0
  86. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/models.py +0 -0
  87. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/replay.py +0 -0
  88. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/agris/session.py +0 -0
  89. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/calibration.py +0 -0
  90. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/capture.py +0 -0
  91. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/capture_diagnosis.py +0 -0
  92. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/diagnostics.py +0 -0
  93. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/events.py +0 -0
  94. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/filters.py +0 -0
  95. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/grind/__init__.py +0 -0
  96. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/grind/_pipeline.py +0 -0
  97. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/grind/models.py +0 -0
  98. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/grind/session.py +0 -0
  99. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/origin_learning.py +0 -0
  100. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/py.typed +0 -0
  101. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/raw/__init__.py +0 -0
  102. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/raw/_collector.py +0 -0
  103. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/raw/models.py +0 -0
  104. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/raw/replay.py +0 -0
  105. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/raw/session.py +0 -0
  106. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/remote_profiles.py +0 -0
  107. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/__init__.py +0 -0
  108. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/_constants.py +0 -0
  109. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/_replay_capture.py +0 -0
  110. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/_result.py +0 -0
  111. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/_scanner.py +0 -0
  112. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/_validation.py +0 -0
  113. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/async_session.py +0 -0
  114. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/models.py +0 -0
  115. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/replay.py +0 -0
  116. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/solare/session.py +0 -0
  117. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/writers.py +0 -0
  118. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/xp/__init__.py +0 -0
  119. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/xp/_tracker.py +0 -0
  120. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/xp/models.py +0 -0
  121. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/xp/profile.py +0 -0
  122. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/xp/replay.py +0 -0
  123. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit/xp/session.py +0 -0
  124. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit.egg-info/dependency_links.txt +0 -0
  125. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit.egg-info/entry_points.txt +0 -0
  126. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit.egg-info/requires.txt +0 -0
  127. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/src/bdo_toolkit.egg-info/top_level.txt +0 -0
  128. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_agris_async.py +0 -0
  129. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_agris_cli.py +0 -0
  130. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_agris_discovery.py +0 -0
  131. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_agris_evidence.py +0 -0
  132. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_agris_models.py +0 -0
  133. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_agris_profiles.py +0 -0
  134. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_agris_replay.py +0 -0
  135. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_agris_session.py +0 -0
  136. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_async_sessions.py +0 -0
  137. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_calibration.py +0 -0
  138. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_calibration_conveniences.py +0 -0
  139. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_calibration_lifecycle.py +0 -0
  140. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_calibration_persistence.py +0 -0
  141. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_calibration_progress.py +0 -0
  142. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_calibration_retention.py +0 -0
  143. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_capture_backend.py +0 -0
  144. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_capture_diagnosis.py +0 -0
  145. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_capture_replay.py +0 -0
  146. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_capture_runtime.py +0 -0
  147. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_cli.py +0 -0
  148. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_decoder_diagnostics.py +0 -0
  149. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_deposit_origin.py +0 -0
  150. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_direction.py +0 -0
  151. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_dynamic_storage_calibration_matrix.py +0 -0
  152. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_engine.py +0 -0
  153. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_examples_and_writers.py +0 -0
  154. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_explicit_profile.py +0 -0
  155. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_fixture_catalog.py +0 -0
  156. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_fixture_regressions.py +0 -0
  157. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_framing.py +0 -0
  158. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_grind.py +0 -0
  159. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_initial_load_storage.py +0 -0
  160. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_inventory_snapshots.py +0 -0
  161. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_item_state.py +0 -0
  162. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_live_capture_session.py +0 -0
  163. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_origin_learning.py +0 -0
  164. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_package_layout.py +0 -0
  165. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_profile_validation.py +0 -0
  166. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_raw.py +0 -0
  167. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_reassembly.py +0 -0
  168. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_remote_profiles.py +0 -0
  169. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_solare_api.py +0 -0
  170. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_solare_details.py +0 -0
  171. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_solare_equipment.py +0 -0
  172. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_solare_history.py +0 -0
  173. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_solare_real_captures.py +0 -0
  174. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_solare_session.py +0 -0
  175. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_storage_destination_validation.py +0 -0
  176. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_storage_events.py +0 -0
  177. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_storage_hydration_tracker.py +0 -0
  178. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_storage_unknown_destination_calibration.py +0 -0
  179. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_toolkit_api.py +0 -0
  180. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_xp.py +0 -0
  181. {bdo_toolkit-1.0.16 → bdo_toolkit-1.1.0}/tests/test_xp_profiles.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bdo-toolkit
3
- Version: 1.0.16
3
+ Version: 1.1.0
4
4
  Summary: Passive, read-only BDO packet parsing toolkit for app developers.
5
5
  Author: bdo-toolkit contributors
6
6
  License-Expression: MIT
@@ -68,6 +68,7 @@ combines supported observations in one live session.
68
68
  | --- | --- | --- | --- |
69
69
  | Item activity | A continuing stream of typed `BDOEvent` objects for supported loot, gathering, inventory, and storage changes | [Item events](https://ychwu.github.io/bdo-toolkit/#item-overview) | Stable |
70
70
  | Inventory and town storage | A finite `ItemStateSnapshot` assembled from character-load traffic, with inventory, known balances, and observed town storage | [Inventory & town storage](https://ychwu.github.io/bdo-toolkit/#item-state-overview) | Beta |
71
+ | Character inventories and equipment | Per-character bags, equipped gear and life-skill gear from a normal world login | [Character loadouts and calibration](CHARACTER_LOADOUTS.md) | Experimental |
71
72
  | Arena of Solare leaderboards | A finite `SolareCaptureResult` containing overall rankings, class tables, and player statistics when the capture is complete | [Arena of Solare](https://ychwu.github.io/bdo-toolkit/#solare-overview) | Beta |
72
73
  | Grind tracking | One capture for confirmed mob drops, with optional profile-based Agris and solo XP | [GrindSession](https://ychwu.github.io/bdo-toolkit/#grind-session) | Experimental |
73
74
  | Raw server messages | Every length-framed server-to-client message, opcode-free and undecoded, for protocol research | [Raw server messages](https://ychwu.github.io/bdo-toolkit/#raw-messages) | Experimental |
@@ -41,6 +41,7 @@ combines supported observations in one live session.
41
41
  | --- | --- | --- | --- |
42
42
  | Item activity | A continuing stream of typed `BDOEvent` objects for supported loot, gathering, inventory, and storage changes | [Item events](https://ychwu.github.io/bdo-toolkit/#item-overview) | Stable |
43
43
  | Inventory and town storage | A finite `ItemStateSnapshot` assembled from character-load traffic, with inventory, known balances, and observed town storage | [Inventory & town storage](https://ychwu.github.io/bdo-toolkit/#item-state-overview) | Beta |
44
+ | Character inventories and equipment | Per-character bags, equipped gear and life-skill gear from a normal world login | [Character loadouts and calibration](CHARACTER_LOADOUTS.md) | Experimental |
44
45
  | Arena of Solare leaderboards | A finite `SolareCaptureResult` containing overall rankings, class tables, and player statistics when the capture is complete | [Arena of Solare](https://ychwu.github.io/bdo-toolkit/#solare-overview) | Beta |
45
46
  | Grind tracking | One capture for confirmed mob drops, with optional profile-based Agris and solo XP | [GrindSession](https://ychwu.github.io/bdo-toolkit/#grind-session) | Experimental |
46
47
  | Raw server messages | Every length-framed server-to-client message, opcode-free and undecoded, for protocol research | [Raw server messages](https://ychwu.github.io/bdo-toolkit/#raw-messages) | Experimental |
@@ -3,12 +3,13 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import hashlib
6
+ from collections import OrderedDict
6
7
  from dataclasses import replace
7
8
  from pathlib import Path
8
9
  from threading import RLock
9
10
  from typing import Any, Iterable, Optional
10
11
 
11
- from .._engine import toolkit_event_from_record
12
+ from .._engine import _ITEM_MAX_ACTIVE_FLOWS, toolkit_event_from_record
12
13
  from .._protocol import (
13
14
  BDOFrame,
14
15
  EventSpec,
@@ -24,6 +25,9 @@ from ._records import (
24
25
  _frame_flow_generation_key,
25
26
  _frame_key,
26
27
  )
28
+ from .character_profile import CharacterLayoutProfile, NOVEMBER
29
+ from . import characters
30
+ from .character_models import CharacterRoster
27
31
  from .inventory import _assemble_inventory, _latest_inventory_generation
28
32
  from .models import (
29
33
  CharacterStateSnapshot,
@@ -39,16 +43,21 @@ from .storage import (
39
43
  _assemble_storage,
40
44
  _character_storage_snapshot_fallback,
41
45
  _reconcile_split_storage_hydration,
46
+ _small_character_storage_fallback,
42
47
  )
43
48
 
44
49
 
45
50
  class _CharacterStateAccumulator:
51
+
46
52
  def __init__(
47
53
  self,
48
54
  *,
49
55
  profile_source: str,
50
56
  specs: Iterable[EventSpec],
51
57
  capture_mode: str = "unknown",
58
+ include_characters: bool = False,
59
+ character_profile: CharacterLayoutProfile | None = None,
60
+ character_profile_error: str | None = None,
52
61
  input_path: str | Path | None = None,
53
62
  saved_capture_path: str | Path | None = None,
54
63
  capture_limits: Optional[ItemStateCaptureLimits] = None,
@@ -57,6 +66,14 @@ class _CharacterStateAccumulator:
57
66
  capture_limits, ItemStateCaptureLimits
58
67
  ):
59
68
  raise TypeError("capture_limits must be an ItemStateCaptureLimits or None")
69
+ if not isinstance(include_characters, bool):
70
+ raise TypeError("include_characters must be a bool")
71
+ self.include_characters = include_characters or character_profile is not None
72
+ self.character_profile_error = character_profile_error
73
+ self.character_profile = character_profile or NOVEMBER
74
+ self.character_tables = {
75
+ t.opcode: t for t in self.character_profile.tables.values()
76
+ }
60
77
  self.profile_source = profile_source
61
78
  self.capture_mode = capture_mode
62
79
  self.input_path = str(input_path) if input_path is not None else None
@@ -74,6 +91,21 @@ class _CharacterStateAccumulator:
74
91
  self.relevant_opcodes = {
75
92
  spec.opcode for spec in self.inventory_specs + self.storage_specs
76
93
  }
94
+ self.character_layout_supported = character_profile is not None or (
95
+ include_characters
96
+ and any(
97
+ spec.opcode == 0x14BE
98
+ and spec.repeat_stride == 224
99
+ and spec.item_offset == 29
100
+ for spec in self.inventory_specs
101
+ )
102
+ )
103
+ if self.character_layout_supported and self.relevant_opcodes.intersection(self.character_tables):
104
+ self.character_profile_error = "Character layout conflicts with an item decoder opcode."
105
+ if self.character_profile_error:
106
+ self.character_layout_supported = False
107
+ if self.character_layout_supported:
108
+ self.relevant_opcodes.update(self.character_tables)
77
109
  self._lock = RLock()
78
110
  self._frames_seen = 0
79
111
  self._relevant_frames_retained = 0
@@ -82,6 +114,10 @@ class _CharacterStateAccumulator:
82
114
  self._limit_error: Optional[ItemStateCaptureLimitError] = None
83
115
  self._frames: list[BDOFrame] = []
84
116
  self._seen_frames: set[tuple[_FrameKey, bytes]] = set()
117
+ # Stream positions only. Non-character payloads need not be retained.
118
+ self._last_frame_end: OrderedDict[tuple[str, int, str, int, int], tuple[int, bool]] = OrderedDict()
119
+ self._remote_starts: set[_FrameKey] = set()
120
+ self._remote_ends: set[_FrameKey] = set()
85
121
  self._inventory_events: list[BDOEvent] = []
86
122
  self._storage_events: list[BDOEvent] = []
87
123
  self._neutral_storage_events: list[BDOEvent] = []
@@ -97,6 +133,8 @@ class _CharacterStateAccumulator:
97
133
  self._frames_seen += 1
98
134
  if self._limit_error is not None:
99
135
  raise self._limit_error
136
+ if self.character_layout_supported:
137
+ self._observe_remote_boundary(frame)
100
138
  if frame.opcode not in self.relevant_opcodes:
101
139
  return
102
140
  digest = hashlib.blake2b(frame.message, digest_size=16).digest()
@@ -117,11 +155,34 @@ class _CharacterStateAccumulator:
117
155
  self.capture_limits.max_relevant_bytes,
118
156
  attempted_bytes,
119
157
  )
158
+ if (
159
+ self.character_layout_supported
160
+ and frame.opcode in self.character_tables
161
+ ):
162
+ cost = characters.record_cost(frame,self.character_tables[frame.opcode])
163
+ attempted = self._snapshot_records_retained + cost + len(self._live_storage_boundaries)
164
+ if attempted > self.capture_limits.max_snapshot_records:
165
+ self._raise_limit("max_snapshot_records", self.capture_limits.max_snapshot_records, attempted)
166
+ self._snapshot_records_retained += cost
120
167
  self._seen_frames.add(dedupe_key)
121
168
  self._frames.append(frame)
122
169
  self._relevant_frames_retained = attempted_frames
123
170
  self._relevant_bytes_retained = attempted_bytes
124
171
 
172
+ def _observe_remote_boundary(self, frame: BDOFrame) -> None:
173
+ flow = _frame_flow_generation_key(frame)
174
+ previous = self._last_frame_end.pop(flow, None)
175
+ start = frame.stream_sequence
176
+ if start is None:
177
+ return
178
+ remote = frame.opcode == self.character_profile.tables["remote"].opcode
179
+ if previous is not None and previous[0] == start and previous[1] != remote:
180
+ boundary = self._remote_starts if remote else self._remote_ends
181
+ boundary.add(_frame_key(frame))
182
+ self._last_frame_end[flow] = (start + len(frame.message), remote)
183
+ if len(self._last_frame_end) > _ITEM_MAX_ACTIVE_FLOWS:
184
+ self._last_frame_end.popitem(last=False)
185
+
125
186
  def observe_record(self, record: Any, raw_message: bytes) -> None:
126
187
  del raw_message
127
188
  self.observe_event(toolkit_event_from_record(record))
@@ -132,7 +193,8 @@ class _CharacterStateAccumulator:
132
193
  with self._lock:
133
194
  if self._limit_error is not None:
134
195
  raise self._limit_error
135
- if event.event_type not in {
196
+ withdrawal = event.event_type == "item_received" and event.source == "Storage"
197
+ if not withdrawal and event.event_type not in {
136
198
  "inventory_snapshot",
137
199
  "storage_snapshot",
138
200
  "storage_record",
@@ -154,7 +216,7 @@ class _CharacterStateAccumulator:
154
216
  self._inventory_events.append(event)
155
217
  elif event.event_type == "storage_snapshot":
156
218
  self._storage_events.append(event)
157
- elif event.event_type == "storage_delta":
219
+ elif event.event_type == "storage_delta" or withdrawal:
158
220
  # A proven live mutation is not snapshot content, but it is a
159
221
  # semantic boundary: neutral records on opposite sides must
160
222
  # never be reconciled into one character-load sweep.
@@ -186,6 +248,8 @@ class _CharacterStateAccumulator:
186
248
  relevant_bytes_retained = self._relevant_bytes_retained
187
249
  snapshot_records_retained = self._snapshot_records_retained
188
250
  frames = tuple(self._frames)
251
+ remote_starts = self._remote_starts.copy()
252
+ remote_ends = self._remote_ends.copy()
189
253
  inventory_events = tuple(self._inventory_events)
190
254
  storage_events = tuple(self._storage_events)
191
255
  neutral_storage_events = tuple(self._neutral_storage_events)
@@ -200,6 +264,27 @@ class _CharacterStateAccumulator:
200
264
  inventory_anchors = inventory_generation.anchors
201
265
  generation_start = inventory_generation.start
202
266
  generations_seen = inventory_generation.generations_observed
267
+ character_frames: tuple[BDOFrame, ...] = ()
268
+ if self.character_layout_supported and generation_start is not None:
269
+ # The active portrait immediately precedes the inventory burst. On
270
+ # later generations do not borrow a portrait from an earlier load.
271
+ character_frames = tuple(
272
+ frame
273
+ for frame in frames
274
+ if frame.opcode in self.character_tables
275
+ and _frame_flow_generation_key(frame)
276
+ == inventory_generation.flow_generation_key
277
+ and generation_start
278
+ - (
279
+ 1
280
+ if self.character_tables[frame.opcode]
281
+ is self.character_profile.tables.get("portrait")
282
+ and generations_seen == 1
283
+ else 0
284
+ )
285
+ <= frame.context.timestamp
286
+ <= generation_start + 30
287
+ )
203
288
  if generation_start is not None:
204
289
  # Current captures send the compact inventory hydration first and
205
290
  # storage hydration afterward. It is therefore a clean boundary
@@ -236,6 +321,7 @@ class _CharacterStateAccumulator:
236
321
  fallback_observations: Optional[
237
322
  tuple[_StorageGroupObservation, ...]
238
323
  ] = None
324
+ small_fallback_used = False
239
325
  sparse_fallback_used = False
240
326
  split_reconciliation_used = False
241
327
  if not storage_events:
@@ -251,6 +337,16 @@ class _CharacterStateAccumulator:
251
337
  fallback_observations = selected_observations
252
338
  sparse_fallback_used = True
253
339
 
340
+ if (
341
+ not storage_events
342
+ and fallback_observations is None
343
+ and (decoder_health is None or decoder_health.storage_status != "incompatible")
344
+ ):
345
+ storage_events = _small_character_storage_fallback(
346
+ neutral_storage_events, inventory_anchors, live_storage_boundaries,
347
+ )
348
+ small_fallback_used = bool(storage_events)
349
+
254
350
  if storage_events and neutral_storage_events:
255
351
  (
256
352
  reconciled_events,
@@ -260,7 +356,7 @@ class _CharacterStateAccumulator:
260
356
  frames,
261
357
  storage_events,
262
358
  neutral_storage_events,
263
- live_storage_boundaries,
359
+ tuple(e for e in live_storage_boundaries if e.event_type == "storage_delta"),
264
360
  inventory_anchors,
265
361
  self.storage_specs,
266
362
  )
@@ -326,6 +422,19 @@ class _CharacterStateAccumulator:
326
422
  "wrappers; the empty current state is preserved, but no record-level "
327
423
  "container metadata was available."
328
424
  )
425
+ if small_fallback_used:
426
+ warnings.append(
427
+ "Sparse storage state was inferred from one identity-complete cohort "
428
+ "within the dedicated character-load boundary, with no preceding "
429
+ "or intervening recognized storage mutation. Only observed towns "
430
+ "are included; this is not proof of account-wide completeness. "
431
+ "The ordinary live stream remained fail-neutral."
432
+ )
433
+ elif not storage_events and neutral_storage_events:
434
+ warnings.append(
435
+ "Storage records decoded, but there was insufficient unambiguous "
436
+ "character-load evidence to accept them as current storage state."
437
+ )
329
438
  if sparse_fallback_used:
330
439
  warnings.append(
331
440
  "Storage hydration was proven by the dedicated character-load "
@@ -447,7 +556,22 @@ class _CharacterStateAccumulator:
447
556
  generation_selection = "all_observed_storage_no_inventory_boundary"
448
557
  else:
449
558
  generation_selection = "none_no_hydration_boundary"
559
+ roster = None
560
+ if self.include_characters:
561
+ if self.character_layout_supported:
562
+ roster = characters.assemble_characters(
563
+ character_frames, inventory, self.character_profile,
564
+ remote_starts=remote_starts, remote_ends=remote_ends,
565
+ )
566
+ else:
567
+ roster = CharacterRoster(
568
+ warnings=(
569
+ self.character_profile_error
570
+ or "Character layout unsupported for this inventory profile.",
571
+ )
572
+ )
450
573
  return CharacterStateSnapshot(
574
+ characters=roster,
451
575
  inventory=inventory,
452
576
  storages=StorageContents(storages),
453
577
  provenance=ItemStateProvenance(
@@ -0,0 +1,258 @@
1
+ """Structural discovery of the remote-inventory family, without known owner IDs."""
2
+
3
+ from __future__ import annotations
4
+ from collections import defaultdict
5
+ from dataclasses import dataclass
6
+ from typing import Iterable, Iterator
7
+ from ..raw.models import RawMessage
8
+ from .character_profile import CharacterLayoutProfile, CharacterTable
9
+
10
+
11
+ def uint(b: bytes) -> int:
12
+ return int.from_bytes(b, "little")
13
+
14
+
15
+ @dataclass
16
+ class Candidate:
17
+ opcode: int
18
+ header: int
19
+ stride: int
20
+ count: int
21
+ rows: list[bytes]
22
+
23
+ def layout(self, **fields: int) -> CharacterTable:
24
+ return CharacterTable(
25
+ self.opcode, self.header, self.stride, self.count, None, fields
26
+ )
27
+
28
+
29
+ def counted(
30
+ messages: list[bytes], low: int, high: int, min_rows: int
31
+ ) -> Iterator[Candidate]:
32
+ first = messages[0]
33
+ for offset in range(5, min(30, len(first) - 1)):
34
+ n = uint(first[offset : offset + 2])
35
+ if n < min_rows:
36
+ continue
37
+ for stride in range(low, high + 1):
38
+ header = len(first) - n * stride
39
+ if not offset + 2 <= header <= 48:
40
+ continue
41
+ if all(
42
+ len(b) == header + stride * uint(b[offset : offset + 2])
43
+ for b in messages
44
+ ):
45
+ rows = [
46
+ b[p : p + stride]
47
+ for b in messages
48
+ for p in range(header, len(b), stride)
49
+ ]
50
+ yield Candidate(uint(first[3:5]), header, stride, offset, rows)
51
+
52
+
53
+ @dataclass
54
+ class Evidence:
55
+ remote: CharacterTable
56
+ roster: CharacterTable
57
+ stat_candidates: list[tuple[Candidate, int]]
58
+ chunk: Candidate
59
+ neighbors: list[RawMessage]
60
+
61
+
62
+ def _small(
63
+ frames: list[RawMessage],
64
+ ) -> Iterator[tuple[Candidate, int, frozenset[bytes]]]:
65
+ for f in frames:
66
+ if not 75 <= f.length <= 4096:
67
+ continue
68
+ for t in counted([f.message], 9, 36, 6):
69
+ if len(t.rows) > 128:
70
+ continue
71
+ for pos in range(t.stride - 7):
72
+ ids = frozenset(r[pos : pos + 8] for r in t.rows)
73
+ if len(ids) == len(t.rows) and bytes(8) not in ids:
74
+ yield t, pos, ids
75
+
76
+
77
+ def _bursts(frames: list[RawMessage]) -> Iterator[list[RawMessage]]:
78
+ groups: dict[tuple, list[RawMessage]] = defaultdict(list)
79
+ for f in frames:
80
+ groups[f.flow, f.connection_epoch, f.opcode].append(f)
81
+ for group in groups.values():
82
+ burst: list[RawMessage] = []
83
+ for f in sorted(group, key=lambda x: x.observed_at):
84
+ if burst and f.observed_at - burst[0].observed_at > 1:
85
+ yield burst
86
+ burst = []
87
+ burst.append(f)
88
+ if burst:
89
+ yield burst
90
+
91
+
92
+ def _remote_fields(t: Candidate, o: int) -> Iterator[CharacterTable]:
93
+ for c in range(t.stride):
94
+ if {r[c] for r in t.rows} != {0, 1, 17}:
95
+ continue
96
+ for s in range(t.stride):
97
+ if s == c or any(r[s] > 63 for r in t.rows if r[c] == 1):
98
+ continue
99
+ if len({(r[o : o + 8], r[c], r[s]) for r in t.rows}) != len(t.rows):
100
+ continue
101
+ qty = [
102
+ p
103
+ for p in range(t.stride - 7)
104
+ if all(
105
+ 1 <= uint(r[p : p + 8]) <= 2**40
106
+ and (r[c] != 1 or uint(r[p : p + 8]) == 1)
107
+ for r in t.rows
108
+ )
109
+ and any(uint(r[p : p + 8]) > 1 for r in t.rows)
110
+ ]
111
+ items = [
112
+ p
113
+ for p in range(t.stride - 3)
114
+ if all(
115
+ 0 < uint(r[p : p + 3]) < 0x400000 and r[p + 3] <= 32 for r in t.rows
116
+ )
117
+ and len({r[p : p + 4] for r in t.rows}) > len(t.rows) // 8
118
+ ]
119
+ for i in items:
120
+ for q in qty:
121
+ spans = [
122
+ range(o, o + 8),
123
+ range(c, c + 1),
124
+ range(s, s + 1),
125
+ range(i, i + 4),
126
+ range(q, q + 8),
127
+ ]
128
+ if len({v for span in spans for v in span}) == 22:
129
+ yield t.layout(owner=o, container=c, slot=s, item=i, quantity=q)
130
+
131
+
132
+ def _metadata_col(t: Candidate, owner: int) -> dict[str, int]:
133
+ cols = []
134
+ for p in range(t.stride - 1):
135
+ if p < owner + 8 and owner < p + 2:
136
+ continue
137
+ values = {uint(r[p : p + 2]) for r in t.rows}
138
+ if (
139
+ 65535 in values
140
+ and len(values) >= 3
141
+ and all(v == 65535 or v < 64 for v in values)
142
+ ):
143
+ cols.append(p)
144
+ return {"metadata": cols[0]} if len(cols) == 1 else {}
145
+
146
+
147
+ def discover_core(
148
+ frames: list[RawMessage], previous: CharacterLayoutProfile | None = None
149
+ ) -> list[Evidence]:
150
+ results = []
151
+ geometry_checks = 0
152
+ for burst in _bursts(frames):
153
+ blind = (
154
+ len({f.length for f in burst}) >= 2 and max(f.length for f in burst) > 4096
155
+ )
156
+ old = previous.tables["remote"] if previous else None
157
+ geometries: Iterable[Candidate]
158
+ if blind:
159
+ geometries = counted([f.message for f in burst], 48, 112, 6)
160
+ elif old and burst[0].opcode == old.opcode and old.count_offset is not None:
161
+ # A trusted layout can be checked with a single chunk. It still
162
+ # has to pass the independent owner, inventory and slot proofs.
163
+ try:
164
+ rows = [row for frame in burst for row in old.rows(frame.message)]
165
+ except ValueError:
166
+ continue
167
+ geometries = (
168
+ Candidate(old.opcode, old.header, old.stride, old.count_offset, rows),
169
+ )
170
+ else:
171
+ continue
172
+ anchor = burst[0]
173
+ near: list[RawMessage] | None = None
174
+ for t in geometries:
175
+ if near is None:
176
+ near = [
177
+ f
178
+ for f in frames
179
+ if f.flow == anchor.flow
180
+ and f.connection_epoch == anchor.connection_epoch
181
+ and abs(f.observed_at - anchor.observed_at) <= 30
182
+ ]
183
+ geometry_checks += 1
184
+ if geometry_checks > 128 or len(t.rows) > 32768:
185
+ raise ValueError(
186
+ "character calibration candidate search limit exceeded"
187
+ )
188
+ small = []
189
+ id_cells = 0
190
+ for candidate in _small(near):
191
+ id_cells += len(candidate[2])
192
+ if id_cells > 131072:
193
+ raise ValueError(
194
+ "character calibration owner-table search limit exceeded"
195
+ )
196
+ small.append(candidate)
197
+ for o in range(t.stride - 7):
198
+ ids = frozenset(r[o : o + 8] for r in t.rows)
199
+ if bytes(8) in ids or not 4 <= len(ids) <= min(128, len(t.rows) // 3):
200
+ continue
201
+ exact = [
202
+ (tab, pos)
203
+ for tab, pos, values in small
204
+ if values == ids and tab.opcode != t.opcode
205
+ ]
206
+ supersets: dict[frozenset[bytes], list[tuple[Candidate, int]]] = (
207
+ defaultdict(list)
208
+ )
209
+ for tab, pos, values in small:
210
+ if ids < values and tab.opcode != t.opcode:
211
+ supersets[values].append((tab, pos))
212
+ corroborated = [
213
+ group
214
+ for group in supersets.values()
215
+ if len({v.opcode for v, _ in group}) >= 2
216
+ ]
217
+ if not exact or len(corroborated) != 1:
218
+ continue
219
+ group = corroborated[0]
220
+ # Identify the compact roster by its independently varying uint16 field.
221
+ rosters = [
222
+ (tab, pos, col)
223
+ for tab, pos in group
224
+ if (col := _metadata_col(tab, pos))
225
+ ]
226
+ choices = {
227
+ (
228
+ tab.opcode,
229
+ tab.header,
230
+ tab.stride,
231
+ tab.count,
232
+ pos,
233
+ col["metadata"],
234
+ )
235
+ for tab, pos, col in rosters
236
+ }
237
+ if len(choices) != 1:
238
+ continue
239
+ tab, pos, col = rosters[0]
240
+ stats = [
241
+ (st, offset)
242
+ for st, offset in exact
243
+ if st.opcode not in {g.opcode for g, _ in group}
244
+ ]
245
+ if not stats:
246
+ continue
247
+ for remote in _remote_fields(t, o):
248
+ if not blind and (
249
+ old is None
250
+ or any(old.fields.get(k) != v for k, v in remote.fields.items())
251
+ ):
252
+ continue
253
+ results.append(
254
+ Evidence(remote, tab.layout(owner=pos, **col), stats, t, near)
255
+ )
256
+ if len(results) > 1:
257
+ return results
258
+ return results
@@ -0,0 +1,128 @@
1
+ """Typed experimental character inventories observed during one login."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import asdict, dataclass
6
+
7
+
8
+ @dataclass(frozen=True)
9
+ class CharacterItem:
10
+ """One item in a source-specific raw slot, with any embedded lightstones."""
11
+
12
+ raw_item_id: int
13
+ quantity: int
14
+ source: str
15
+ raw_slot: int | None
16
+ raw_container: int | None = None
17
+ role: str | None = None
18
+ activity: str | None = None
19
+ # Tuple positions preserve sockets, including an unoccupied first socket.
20
+ lightstones: tuple[int | None, ...] = ()
21
+ role_inferred: bool = False
22
+
23
+ @property
24
+ def base_item_id(self) -> int:
25
+ return self.raw_item_id & 0xFFFFFF
26
+
27
+ def to_dict(self) -> dict[str, object]:
28
+ return {
29
+ **asdict(self),
30
+ "base_item_id": self.base_item_id,
31
+ "lightstones": list(self.lightstones),
32
+ }
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class CharacterSection:
37
+ """An available section can replace saved items, including with zero rows."""
38
+
39
+ items: tuple[CharacterItem, ...] = ()
40
+ observed_sources: tuple[str, ...] = ()
41
+ complete: bool = True
42
+
43
+ @property
44
+ def observed(self) -> bool:
45
+ return self.complete and bool(self.observed_sources)
46
+
47
+ @property
48
+ def status(self) -> str:
49
+ return "available" if self.observed else "unavailable"
50
+
51
+ def for_activity(self, activity: str) -> tuple[CharacterItem, ...]:
52
+ return tuple(item for item in self.items if item.activity == activity)
53
+
54
+ def by_role(
55
+ self, role: str, *, activity: str | None = None
56
+ ) -> tuple[CharacterItem, ...]:
57
+ """Return observed occupants, optionally scoped to one life activity."""
58
+ return tuple(
59
+ item
60
+ for item in self.items
61
+ if item.role == role and (activity is None or item.activity == activity)
62
+ )
63
+
64
+ def to_dict(self) -> dict[str, object]:
65
+ return {
66
+ "status": self.status,
67
+ "observed": self.observed,
68
+ "observed_sources": list(self.observed_sources),
69
+ "items": [item.to_dict() for item in self.items],
70
+ }
71
+
72
+
73
+ @dataclass(frozen=True)
74
+ class CharacterLoadout:
75
+ owner_id: str
76
+ name: str | None
77
+ is_active: bool | None
78
+ main_inventory: CharacterSection
79
+ pearl_inventory: CharacterSection
80
+ gear: CharacterSection
81
+ life_skills: CharacterSection
82
+ other_inventory: CharacterSection
83
+ dp: float | None = None
84
+ ap: float | None = None
85
+ awakening_ap: float | None = None
86
+ character_class: str | None = None
87
+ level: int | None = None
88
+ raw_metadata_value: int | None = None
89
+
90
+ def to_dict(self) -> dict[str, object]:
91
+ return {
92
+ "owner_id": self.owner_id,
93
+ "name": self.name,
94
+ "is_active": self.is_active,
95
+ "character_class": self.character_class,
96
+ "level": self.level,
97
+ "raw_metadata_value": self.raw_metadata_value,
98
+ "dp": self.dp,
99
+ "ap": self.ap,
100
+ "awakening_ap": self.awakening_ap,
101
+ "main_inventory": self.main_inventory.to_dict(),
102
+ "pearl_inventory": self.pearl_inventory.to_dict(),
103
+ "gear": self.gear.to_dict(),
104
+ "life_skills": self.life_skills.to_dict(),
105
+ "other_inventory": self.other_inventory.to_dict(),
106
+ }
107
+
108
+
109
+ @dataclass(frozen=True)
110
+ class CharacterRoster:
111
+ members: tuple[CharacterLoadout, ...] = ()
112
+ warnings: tuple[str, ...] = ()
113
+
114
+ @property
115
+ def status(self) -> str:
116
+ return "available" if self.members else "unavailable"
117
+
118
+ def by_id(self, owner_id: str) -> CharacterLoadout | None:
119
+ return next(
120
+ (member for member in self.members if member.owner_id == owner_id), None
121
+ )
122
+
123
+ def to_dict(self) -> dict[str, object]:
124
+ return {
125
+ "status": self.status,
126
+ "by_id": {member.owner_id: member.to_dict() for member in self.members},
127
+ "warnings": list(self.warnings),
128
+ }