Skip to content

Commit 56b2f28

Browse files
Update planet_builder.py
1 parent c112b1a commit 56b2f28

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

src/hd2api/builders/planet_builder.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def generate_planet_name(seed) -> str:
211211
structures = {
212212
"prefix+root+suffix": "{prefix}{root}{suffix}",
213213
"prefix+connector+root+suffix": "{prefix}{connector}{root_cap}{suffix}",
214-
"prefix+root+suffix": "{root_cap}{connector}{root_cap2}{suffix}",
214+
"prefix+root+suffix2": "{root_cap}{connector}{root_cap2}{suffix}",
215215
"modifier+connector+prefix+root+suffix": "{modifier}{connector}{prefix}{root}{suffix}",
216216
}
217217

@@ -262,7 +262,8 @@ def build_planet_basic(
262262
"""
263263
planet_base = gstatic.planets.get(index, None)
264264
if not planet_base:
265-
# Just in case one doesn't exist.
265+
# If a planet doesn't exist for whatever reason, generate
266+
# a temporary name for it.
266267
hash = planetInfo.settingsHash
267268
name = f"{generate_planet_name(hash)}-{int(hash**0.5)}-TEMP"
268269
planet_base = PlanetStatic(
@@ -297,9 +298,7 @@ def build_planet_basic(
297298
weather = [gstatic.environmentals.get(e, None) for e in planet_base.weather_effects]
298299
env.extend(weather)
299300
# Build Statistics
300-
stats_new = statistics_builder(
301-
stats, planetStatus.players, planetStatus.retrieved_at
302-
)
301+
stats_new = statistics_builder(stats, planetStatus.players, planetStatus.retrieved_at)
303302
# Position can come from planetInfo OR planetStatus
304303
pos = planetInfo.position
305304
if planetStatus.position is not None:
@@ -335,9 +334,7 @@ def check_compare_value(key, value, target: List[Dict[str, Any]]):
335334
return None
336335

337336

338-
def check_compare_value_list(
339-
keys: List[str], values: List[Any], target: List[Dict[str, Any]]
340-
):
337+
def check_compare_value_list(keys: List[str], values: List[Any], target: List[Dict[str, Any]]):
341338
values = []
342339
for s in target:
343340
if all(s[key] == value for key, value in zip(keys, values)):
@@ -350,14 +347,12 @@ def get_time(status: WarStatus, info: WarInfo) -> dt.datetime:
350347

351348
# Get datetime diveharder object was retrieved at
352349
now = status.retrieved_at
353-
gametime = dt.datetime.fromtimestamp(
354-
info.startDate, tz=dt.timezone.utc
355-
) + dt.timedelta(seconds=status.time)
350+
gametime = dt.datetime.fromtimestamp(info.startDate, tz=dt.timezone.utc) + dt.timedelta(
351+
seconds=status.time
352+
)
356353
deviation = now - gametime
357354
# print(deviation)
358-
relative_game_start = (
359-
dt.datetime.fromtimestamp(info.startDate, tz=dt.timezone.utc) + deviation
360-
)
355+
relative_game_start = dt.datetime.fromtimestamp(info.startDate, tz=dt.timezone.utc) + deviation
361356
return relative_game_start
362357

363358

@@ -483,9 +478,7 @@ def build_planet_2(planetIndex: int, warall: DiveharderAll, statics: StaticAll):
483478
summary: Optional[WarSummary] = warall.planet_stats
484479

485480
regions = build_all_regions(warall, statics)
486-
planet = build_planet_full(
487-
planetIndex, status, info, summary, statics, regions=regions
488-
)
481+
planet = build_planet_full(planetIndex, status, info, summary, statics, regions=regions)
489482
return planet
490483

491484

0 commit comments

Comments
 (0)