From 04c607aa0c23cb75f4805b3bde00ebd9a5a9c587 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 21 Aug 2019 14:06:49 +0200 Subject: [PATCH] Fix more missing flags --- lihzahrd/header/bossesdefeated.py | 2 ++ lihzahrd/header/hardmodeore.py | 1 - lihzahrd/world.py | 23 ++++++++++++++++------- setup.py | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lihzahrd/header/bossesdefeated.py b/lihzahrd/header/bossesdefeated.py index 80b79ae..258faec 100644 --- a/lihzahrd/header/bossesdefeated.py +++ b/lihzahrd/header/bossesdefeated.py @@ -27,6 +27,7 @@ class BossesDefeated: santa_nk1: bool, everscream: bool, martian_madness: bool, + lunatic_cultist: bool, lunar_pillars: PillarsInfo, old_ones_army: OldOnesArmyTiers): self.eye_of_cthulhu: bool = eye_of_cthulhu @@ -55,6 +56,7 @@ class BossesDefeated: self.santa_nk1: bool = santa_nk1 self.everscream: bool = everscream self.martian_madness: bool = martian_madness + self.lunatic_cultist: bool = lunatic_cultist self.lunar_pillars: PillarsInfo = lunar_pillars self.old_ones_army: OldOnesArmyTiers = old_ones_army diff --git a/lihzahrd/header/hardmodeore.py b/lihzahrd/header/hardmodeore.py index ec0c68c..9ae180a 100644 --- a/lihzahrd/header/hardmodeore.py +++ b/lihzahrd/header/hardmodeore.py @@ -21,7 +21,6 @@ class HardmodeTier2Ore(enum.IntEnum): class HardmodeTier3Ore(enum.IntEnum): NOT_DETERMINED = -1 - NOT_DETERMINED_TOO = 16785407 # ??? ADAMANTITE = 111 TITANIUM = 223 diff --git a/lihzahrd/world.py b/lihzahrd/world.py index 2388f12..350b422 100644 --- a/lihzahrd/world.py +++ b/lihzahrd/world.py @@ -1,7 +1,6 @@ import uuid import math import typing -import multiprocessing from .fileutils import * from .header import * from .tiles import * @@ -11,7 +10,6 @@ from .npcs import * from .tileentities import * from .pressureplates import * from .townmanager import * -from .timer import Timer from .errors import InvalidFooterError @@ -255,7 +253,7 @@ class World: liquid = Liquid(type_=liquid_type, volume=fr.uint1()) else: liquid = None - if rle_compression == RLEEncoding.DOUBLE_BYTE or rle_compression == RLEEncoding.UNKNOWN_3: + if rle_compression == RLEEncoding.DOUBLE_BYTE: multiply_by = fr.uint2() + 1 elif rle_compression == RLEEncoding.SINGLE_BYTE: multiply_by = fr.uint1() + 1 @@ -391,9 +389,18 @@ class World: rain = Rain(is_active=f.bool(), time_left=f.int4(), max_rain=f.single()) - hardmode_ore_1 = HardmodeTier1Ore(f.int4()) - hardmode_ore_2 = HardmodeTier2Ore(f.int4()) - hardmode_ore_3 = HardmodeTier3Ore(f.int4()) + try: + hardmode_ore_1 = HardmodeTier1Ore(f.int4()) + except ValueError: + hardmode_ore_1 = HardmodeTier1Ore.NOT_DETERMINED + try: + hardmode_ore_2 = HardmodeTier2Ore(f.int4()) + except ValueError: + hardmode_ore_2 = HardmodeTier2Ore.NOT_DETERMINED + try: + hardmode_ore_3 = HardmodeTier3Ore(f.int4()) + except ValueError: + hardmode_ore_3 = HardmodeTier3Ore.NOT_DETERMINED altars_smashed = AltarsSmashed(count=smashed_altars_count, ore_tier1=hardmode_ore_1, ore_tier2=hardmode_ore_2, @@ -458,6 +465,7 @@ class World: defeated_duke_fishron = f.bool() defeated_martian_madness = f.bool() + defeated_lunatic_cultist = f.bool() defeated_moon_lord = f.bool() defeated_pumpking = f.bool() defeated_mourning_wood = f.bool() @@ -533,7 +541,8 @@ class World: everscream=defeated_everscream, lunar_pillars=defeated_pillars, old_ones_army=old_ones_army, - martian_madness=defeated_martian_madness) + martian_madness=defeated_martian_madness, + lunatic_cultist=defeated_lunatic_cultist) unknown_world_header_data = f.read_until(pointers.world_tiles) diff --git a/setup.py b/setup.py index 66f7441..e5de91e 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as f: setuptools.setup( name="lihzahrd", - version="1.0b3", + version="1.0b4", author="Stefano Pigozzi", author_email="ste.pigozzi@gmail.com", description="A Terraria world parser in Python",