arkparser 0.1.7__tar.gz → 0.1.9__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.
- {arkparser-0.1.7 → arkparser-0.1.9}/PKG-INFO +1 -1
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/__init__.py +1 -1
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/export.py +33 -5
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser.egg-info/PKG-INFO +1 -1
- {arkparser-0.1.7 → arkparser-0.1.9}/pyproject.toml +1 -1
- {arkparser-0.1.7 → arkparser-0.1.9}/LICENSE +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/README.md +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/common/__init__.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/common/binary_reader.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/common/exceptions.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/common/map_config.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/common/normalization.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/common/types.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/common/version_detection.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/data_models.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/files/__init__.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/files/base.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/files/cloud_inventory.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/files/profile.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/files/tribe.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/files/world_save.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/game_objects/__init__.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/game_objects/container.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/game_objects/game_object.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/game_objects/location.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/models/__init__.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/models/character.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/models/creature.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/models/item.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/models/player.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/models/stats.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/models/structure.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/models/tribe.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/properties/__init__.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/properties/base.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/properties/byte_property.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/properties/compound.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/properties/primitives.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/properties/registry.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/structs/__init__.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/structs/base.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/structs/colors.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/structs/misc.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/structs/property_list.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/structs/registry.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser/structs/vectors.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser.egg-info/SOURCES.txt +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser.egg-info/dependency_links.txt +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser.egg-info/requires.txt +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/arkparser.egg-info/top_level.txt +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/setup.cfg +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/tests/test_binary_reader.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/tests/test_cloud_inventory.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/tests/test_data_models.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/tests/test_export.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/tests/test_game_objects.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/tests/test_models.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/tests/test_profile.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/tests/test_tribe.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/tests/test_version_detection.py +0 -0
- {arkparser-0.1.7 → arkparser-0.1.9}/tests/test_world_save.py +0 -0
|
@@ -276,6 +276,8 @@ def export_structures(
|
|
|
276
276
|
results: list[dict[str, t.Any]] = []
|
|
277
277
|
|
|
278
278
|
struct_objs = _get_worldsave_objects(save, "get_structures", "structure_objects")
|
|
279
|
+
objects = save.objects if hasattr(save, "objects") else {}
|
|
280
|
+
obj_lookup = _build_lookup(objects)
|
|
279
281
|
|
|
280
282
|
for obj in struct_objs:
|
|
281
283
|
structure = Structure.from_game_object(obj)
|
|
@@ -288,6 +290,8 @@ def export_structures(
|
|
|
288
290
|
if mapped_loc.longitude is not None:
|
|
289
291
|
data["lon"] = mapped_loc.longitude
|
|
290
292
|
|
|
293
|
+
data["inventory"] = _get_inventory_items(obj, obj_lookup)
|
|
294
|
+
|
|
291
295
|
results.append(data)
|
|
292
296
|
|
|
293
297
|
return results
|
|
@@ -496,9 +500,18 @@ def _get_worldsave_objects(save: t.Any, getter_name: str, legacy_attr: str) -> l
|
|
|
496
500
|
|
|
497
501
|
|
|
498
502
|
def _resolve_reference(ref: t.Any, lookup: dict[t.Any, t.Any]) -> t.Any:
|
|
499
|
-
"""Resolve an object reference
|
|
503
|
+
"""Resolve an object reference to a game object.
|
|
504
|
+
|
|
505
|
+
Handles three reference forms:
|
|
506
|
+
- int or str: direct lookup (ASE object IDs, GUID strings, name strings)
|
|
507
|
+
- (type_tag, value) tuple: array-property format where type_tag is "id",
|
|
508
|
+
"name", or "path" and value is the actual lookup key
|
|
509
|
+
"""
|
|
500
510
|
if ref is None:
|
|
501
511
|
return None
|
|
512
|
+
if isinstance(ref, tuple) and len(ref) == 2:
|
|
513
|
+
_, key = ref
|
|
514
|
+
return lookup.get(key)
|
|
502
515
|
return lookup.get(ref)
|
|
503
516
|
|
|
504
517
|
|
|
@@ -594,14 +607,29 @@ def _find_status_component(obj: t.Any, lookup: dict[t.Any, t.Any]) -> t.Any:
|
|
|
594
607
|
|
|
595
608
|
|
|
596
609
|
def _get_inventory_items(obj: t.Any, lookup: dict[t.Any, t.Any]) -> list[dict[str, t.Any]]:
|
|
597
|
-
"""Get inventory items for a creature.
|
|
610
|
+
"""Get inventory items for a game object (creature or structure).
|
|
611
|
+
|
|
612
|
+
Tries two strategies in order:
|
|
613
|
+
1. MyInventoryComponent property + reference lookup (works for ASE and some ASA objects).
|
|
614
|
+
2. Iterate obj.components to find the first component whose class_name contains
|
|
615
|
+
"Inventory" (fallback for ASA, where the property may be absent).
|
|
616
|
+
"""
|
|
598
617
|
items: list[dict[str, t.Any]] = []
|
|
599
618
|
|
|
600
|
-
|
|
619
|
+
inv_obj = None
|
|
620
|
+
|
|
621
|
+
# Strategy 1: property reference
|
|
601
622
|
if hasattr(obj, "get_property_value"):
|
|
602
623
|
inv_ref = obj.get_property_value("MyInventoryComponent", default=None)
|
|
603
|
-
|
|
604
|
-
|
|
624
|
+
if inv_ref is not None:
|
|
625
|
+
inv_obj = _resolve_reference(inv_ref, lookup)
|
|
626
|
+
|
|
627
|
+
# Strategy 2: component dict (ASA or when property is absent)
|
|
628
|
+
if inv_obj is None and hasattr(obj, "components"):
|
|
629
|
+
for comp in obj.components.values():
|
|
630
|
+
if "Inventory" in getattr(comp, "class_name", ""):
|
|
631
|
+
inv_obj = comp
|
|
632
|
+
break
|
|
605
633
|
|
|
606
634
|
if inv_obj is None:
|
|
607
635
|
return items
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|