Skip to content

Commit 05e5859

Browse files
committed
fixed parsing of teleportation to instance worlds. TODO: determine unknown values in parse
1 parent 26cf793 commit 05e5859

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

data_parser.py

+20-10
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,8 @@ def _parse(cls, stream: BytesIO, ctx: OrderedDict):
540540
# world_id 1
541541
d["celestial_coordinates"] = CelestialCoordinates.parse(stream,
542542
ctx)
543-
flag = Byte.parse(stream, ctx)
544-
if flag == 1:
543+
d["is_teleporter"] = Byte.parse(stream, ctx)
544+
if d["is_teleporter"] == 1:
545545
d["teleporter"] = StarString.parse(stream, ctx)
546546
elif world_id == WarpWorldType.PLAYER_WORLD:
547547
# world_id 2
@@ -553,10 +553,15 @@ def _parse(cls, stream: BytesIO, ctx: OrderedDict):
553553
elif world_id == WarpWorldType.UNIQUE_WORLD:
554554
# world_id 3
555555
d["world_name"] = StarString.parse(stream, ctx)
556-
d["instance_flag"] = Byte.parse(stream, ctx)
557-
d["instance_id"] = UUID.parse(stream, ctx)
558-
d["teleporter_flag"] = Byte.parse(stream, ctx)
559-
d["teleporter"] = StarString.parse(stream, ctx)
556+
d["is_instance"] = Byte.parse(stream, ctx)
557+
if d["is_instance"] == 1:
558+
d["instance_id"] = UUID.parse(stream, ctx)
559+
d["is_something"] = Byte.parse(stream, ctx)
560+
if d["is_something"] == 1:
561+
d["something"] = BFloat32.parse(stream, ctx)
562+
d["is_teleporter"] = Byte.parse(stream, ctx)
563+
if d["is_teleporter"] == 1:
564+
d["teleporter"] = StarString.parse(stream, ctx)
560565
elif world_id == WarpWorldType.MISSION_WORLD:
561566
# world_id 4
562567
d["world_name"] = StarString.parse(stream, ctx)
@@ -592,10 +597,15 @@ def _build(cls, obj, ctx: OrderedDotDict):
592597
res += Byte.build(0)
593598
elif obj["world_id"] == WarpWorldType.UNIQUE_WORLD:
594599
res += StarString.build(obj["world_name"])
595-
res += Byte.build(obj["instance_flag"])
596-
res += UUID.build(binascii.unhexlify(obj["instance_id"]))
597-
res += Byte.build(obj["teleporter_flag"])
598-
res += StarString.build(obj["teleporter"])
600+
res += Byte.build(obj["is_instance"])
601+
if obj["is_instance"] == 1:
602+
res += UUID.build(binascii.unhexlify(obj["instance_id"]))
603+
res += Byte.build(obj["is_something"])
604+
if obj["is_something"] == 1:
605+
res += BFloat32.build(obj["something"])
606+
res += Byte.build(obj["is_teleporter"])
607+
if obj["is_teleporter"] == 1:
608+
res += StarString.build(obj["teleporter"])
599609
res += Byte.build(0)
600610
elif obj["world_id"] == WarpWorldType.MISSION_WORLD:
601611
res += StarString.build(obj["world_name"])

plugins/player_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ def _add_or_get_instance(self, data):
885885
"""
886886
instance_string = list("InstanceWorld:")
887887
instance_string.append("{}".format(data["world_name"]))
888-
if data["instance_flag"]:
888+
if data["is_instance"]:
889889
instance_string.append(":{}".format(data["instance_id"].decode(
890890
"utf-8")))
891891
else:

0 commit comments

Comments
 (0)