Skip to content

Commit

Permalink
Added Logging on stage enter
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbrq committed Sep 18, 2024
1 parent 8df8631 commit a14041d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
29 changes: 29 additions & 0 deletions worlds/gl/Arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,35 @@
0x113: infernal_fortress,
}

level_names: Dict[int, str] = {
0x11: "Castle Courtyard",
0x12: "Dungeon of Torment",
0x13: "Tower Armory",
0x14: "Castle Treasury",
0x15: "Chimera's Keep",
0x21: "Valley of Fire",
0x22: "Dagger Peak",
0x23: "Cliffs of Desolation",
0x24: "Lost Cave",
0x25: "Volcanic Cavern",
0x26: "Dragon's Lair",
0x71: "Poisoned Fields",
0x72: "Haunted Cemetery",
0x73: "Venomous Spire",
0x74: "Toxic Air Ship",
0x75: "Vat of the Plague Fiend",
0x81: "Gates of the Underworld",
0x91: "Arctic Docks",
0x92: "Frozen Camp",
0x93: "Crystal Mine",
0x94: "Erupting Fissure",
0x95: "Yeti's Cavern",
0xF1: "Desecrated Temple",
0x111: "Battle Trenches",
0x112: "Battle Towers",
0x113: "Infernal Fortress",
}

# Count of all spawners in a level
# Used for obj_read address offset calculation
# Vaules are spawner difficulty
Expand Down
14 changes: 13 additions & 1 deletion worlds/gl/GauntletLegendsClient.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import asyncio
import datetime
import os
import socket
import traceback
from typing import List, Optional
Expand All @@ -22,7 +24,7 @@
timers,
sounds,
colors,
vanilla,
vanilla, level_names,
)
from .Items import ItemData, items_by_id
from .Locations import LocationData
Expand Down Expand Up @@ -278,6 +280,16 @@ async def obj_read(self, mode=0):
_obj = []
b: RamChunk
if self.offset == -1:
log_arr = []
for i in range(5):
b = RamChunk(await self.socket.read(message_format(READ, f"0x{format(OBJ_ADDR, 'x')} {100}")))
b.iterate(0x3C)
log_arr += [b.split]
output_folder = 'logs'
output_file = os.path.join(output_folder, f"[{datetime.datetime.now()}] Gauntlet Legends RAMSTATE: {level_names[self.current_level[1] << 0xF + self.current_level[0]]}.txt")
with open(output_file, 'w') as f:
for arr in log_arr:
f.write(" ".join(f"{byte:02x}" for byte in arr) + '\n')
b = RamChunk(await self.socket.read(message_format(READ, f"0x{format(OBJ_ADDR, 'x')} {0x40 * 0x3C}")))
b.iterate(0x3C)
for i, obj in enumerate(b.split):
Expand Down

0 comments on commit a14041d

Please sign in to comment.