Add socketed items parsing

This commit is contained in:
2023-10-24 20:56:55 +02:00
parent c170241746
commit a48a833707
3 changed files with 37 additions and 18 deletions

View File

@@ -17,6 +17,7 @@
import json
import os
import re
from typing import Optional
from bitarray import bitarray
from dataclasses import dataclass
from enum import Enum
@@ -108,7 +109,7 @@ class Item:
defense: int | None = None
durability: int | None = None
max_durability: int | None = None
sockets: int | None = None
sockets: list[Optional["Item"]] | None = None
quantity: int | None = None
stats: list[Stat] | None = None
@@ -157,8 +158,13 @@ class Item:
" " * indent,
f"Durability: {self.durability} out of {self.max_durability}",
)
if self.sockets:
print(" " * indent, f"Num Sockets: {self.sockets}")
if self.is_socketed:
print(" " * indent, f"{len(self.sockets)} sockets:")
for socket in self.sockets:
if socket:
socket.print(indent + 4)
else:
print(" " * (indent + 4), "Empty")
if self.quantity:
print(" " * indent, f"Quantity: {self.quantity}")
if self.stats: