aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ywalk/types.py
diff options
context:
space:
mode:
authorWolfgang Müller2021-11-14 18:55:52 +0100
committerWolfgang Müller2021-11-14 18:55:52 +0100
commit0fb4fc20559c9a5de5a10c74c1247635a1523255 (patch)
treedbd27ffd7e5d09af732e973455bea1e47e46609f /ywalk/types.py
downloadywalk-trunk.tar.gz
Initial commitHEAD0.1.0trunk
Diffstat (limited to 'ywalk/types.py')
-rw-r--r--ywalk/types.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/ywalk/types.py b/ywalk/types.py
new file mode 100644
index 0000000..33048cd
--- /dev/null
+++ b/ywalk/types.py
@@ -0,0 +1,46 @@
+from dataclasses import dataclass
+from enum import Enum
+
+class Mode(Enum):
+ ALMSIVI = 'Almsivi Intervention', 'invoke Almsivi Intervention', True, 0.25
+ BOAT = 'Boat', 'take the Boat', False, 0
+ CARAVAN = 'Caravan', 'use the Caravan', False, 0
+ DIVINE = 'Divine Intervention', 'invoke Divine Intervention', True, 0.25
+ FOOT = 'Foot', 'walk', False, 0.75
+ GUIDE = 'Guild Guide', 'take the Guild Guide', True, 0.5
+ PROPYLON = 'Propylon Index', 'travel by Propylon', True, 0.5
+ RECALL = 'Recall', 'recall', True, 0
+ RIVER_STRIDER = 'River Strider', 'take the River Strider', False, 0
+ SILT_STRIDER = 'Silt Strider', 'take the Silt Strider', False, 0
+
+ def __new__(cls, value, pretty, teleport, weight):
+ obj = object.__new__(cls)
+ obj._value_ = value
+ obj.pretty = pretty
+ obj.weight = weight
+ obj.teleport = teleport
+ return obj
+
+ def __str__(self) -> str:
+ return self.value
+
+@dataclass(frozen=True)
+class Place:
+ name: str
+
+ def __str__(self) -> str:
+ return self.name
+
+@dataclass(frozen=True)
+class Connection:
+ origin: Place
+ destination: Place
+ mode: Mode
+ time: int
+
+ def __str__(self) -> str:
+ time = 'instantaneous'
+ if self.time > 0:
+ time = f'{self.time} {"hour" if self.time == 1 else "hours"}'
+
+ return f'{self.origin} -> {self.destination} ({self.mode}, {time})'