mirror of
https://github.com/Steffo99/lihzahrd.git
synced 2024-11-25 01:24:21 +00:00
Improve bestiary handling
This commit is contained in:
parent
d115938a11
commit
193ed2ec78
4 changed files with 748 additions and 764 deletions
|
@ -1,24 +1,19 @@
|
||||||
import typing
|
from typing import Dict, List
|
||||||
|
from ..enums import EntityType
|
||||||
|
|
||||||
|
|
||||||
class Bestiary:
|
class Bestiary:
|
||||||
"""A bestiary entry."""
|
"""A bestiary entry."""
|
||||||
|
|
||||||
__slots__ = "npc_chats_count", "npc_chats_data", "npc_kill_count", "npc_kill_data", "npc_sighting_count", "npc_sighting_data"
|
__slots__ = "chats", "kills", "sightings"
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
npc_chats_count: int,
|
chats: List[EntityType],
|
||||||
npc_chats_data: typing.Dict[str, int],
|
kills: Dict[EntityType, int],
|
||||||
npc_kill_count: int,
|
sightings: List[EntityType]):
|
||||||
npc_kill_data: typing.List[str],
|
self.chats: List[EntityType] = chats
|
||||||
npc_sighting_count: int,
|
self.kills: Dict[EntityType, int] = kills
|
||||||
npc_sighting_data: typing.List[str], ):
|
self.sightings: List[EntityType] = sightings
|
||||||
self.npc_chats_count: int = npc_chats_count
|
|
||||||
self.npc_chats_data: typing.Dict[str, int] = npc_chats_data
|
|
||||||
self.npc_kill_count: int = npc_kill_count
|
|
||||||
self.npc_kill_data: typing.List[str] = npc_kill_data
|
|
||||||
self.npc_sighting_count: int = npc_sighting_count
|
|
||||||
self.npc_sighting_data: typing.List[str] = npc_sighting_data
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<Bestiary entry: chats={self.npc_chats_count}: {self.npc_chats_data}, kills={self.npc_kill_count}: {self.npc_kill_data}, sightings={self.npc_sighting_count}: {self.npc_sighting_data}>"
|
return f"<Bestiary with {len(self.chats) + len(self.kills.keys()) + len(self.sightings)} entries>"
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5098,7 +5098,5 @@ class ItemType(enum.IntEnum):
|
||||||
CARTON_OF_MILK = 5041
|
CARTON_OF_MILK = 5041
|
||||||
COFFEE = 5042
|
COFFEE = 5042
|
||||||
|
|
||||||
COUNT = 5043
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"{self.__class__.__name__}.{self.name}"
|
return f"{self.__class__.__name__}.{self.name}"
|
||||||
|
|
|
@ -856,22 +856,16 @@ class World:
|
||||||
|
|
||||||
unknown_town_manager_data = f.read_until(pointers.bestiary)
|
unknown_town_manager_data = f.read_until(pointers.bestiary)
|
||||||
|
|
||||||
bestiary_kill_count = f.int4()
|
bestiary_kills = {}
|
||||||
bestiary_kill_data = {}
|
for _ in range(f.int4()):
|
||||||
for _ in range(bestiary_kill_count):
|
entity = EntityType[f.string()]
|
||||||
beast = f.string()
|
kills = f.int4()
|
||||||
beast_count = f.int4()
|
bestiary_kills[entity] = kills
|
||||||
bestiary_kill_data[beast] = beast_count
|
|
||||||
bestiary_sighting_count = f.int4()
|
bestiary_sightings = [EntityType[f.string()] for _ in range(f.int4())]
|
||||||
bestiary_sighting_data = [f.string() for _ in range(bestiary_sighting_count)]
|
bestiary_chats = [EntityType[f.string()] for _ in range(f.int4())]
|
||||||
bestiary_chat_count = f.int4()
|
|
||||||
bestiary_chat_data = [f.string() for _ in range(bestiary_chat_count)]
|
bestiary = Bestiary(chats=bestiary_chats, kills=bestiary_kills, sightings=bestiary_sightings)
|
||||||
bestiary = Bestiary(bestiary_chat_count,
|
|
||||||
bestiary_chat_data,
|
|
||||||
bestiary_kill_count,
|
|
||||||
bestiary_kill_data,
|
|
||||||
bestiary_sighting_count,
|
|
||||||
bestiary_sighting_data)
|
|
||||||
|
|
||||||
unknown_bestiary_data = f.read_until(pointers.journey_powers)
|
unknown_bestiary_data = f.read_until(pointers.journey_powers)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue