Skip to content

Commit 1b54a68

Browse files
Update bases.py
1 parent 530d8ba commit 1b54a68

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

internal_libs/bases.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,22 @@ def parse_logfile(log_path):
2828
current_guild['Guild'] = guild_info[0].split(': ')[1].strip()
2929
current_guild['Guild Leader'] = guild_info[1].split(': ')[1].strip()
3030
if line.startswith('Base ') and line.split(':')[0].strip() in ['Base 1', 'Base 2', 'Base 3', 'Base 4', 'Base 5', 'Base 6', 'Base 7', 'Base 8', 'Base 9', 'Base 10']:
31-
base_info = line.strip().split(':')
32-
base_key = base_info[0].strip()
33-
current_guild[base_key] = base_info[1].strip()
34-
base_keys.add(base_key)
35-
total_bases += 1
31+
base_info = line.strip().split('|')
32+
base_key = base_info[0].split(':')[0].strip()
33+
new_coords = next(
34+
(part.split('New:')[1].strip() for part in base_info if part.strip().startswith("New:")),
35+
None
36+
)
37+
if new_coords:
38+
current_guild[base_key] = new_coords
39+
base_keys.add(base_key)
40+
total_bases += 1
3641
if "Level: 55" in line:
3742
level_55_count += 1
3843
if current_guild:
3944
guild_data.append(current_guild)
4045
return guild_data, sorted(base_keys)
46+
4147
def write_csv(guild_data, base_keys, output_file):
4248
print(f"Now writing the info into csv...")
4349
fieldnames = ['Guild', 'Guild Leader'] + base_keys

0 commit comments

Comments
 (0)