Slight change in the organization

This commit is contained in:
2025-06-16 16:04:47 -04:00
parent a1a77f0f95
commit 8f7b524c45
2 changed files with 11 additions and 25 deletions

View File

@ -5,14 +5,3 @@ class Expansion:
class PlayerExpansion:
def __init__(self, player, localConfig):
pass
import PDOLib
def receive_punisment(value):
expansion_available = self.expansion
getattr(PDFLib, expansion_available).punish(value)
player.receive_punishment(0.5)

View File

@ -15,6 +15,9 @@ _log = logging.getLogger('NoPE-Lib')
class PlayersManager:
"""
Manager of players for a given game.
This class implements most methods available to classic dict.
Attributes:
gameID (str): The gameID of the active game
@ -112,28 +115,22 @@ class PlayersManager:
self._currentGameID = None
self._player_data = {name: Player(name, self, **cfg) for name, cfg in self._cfg["players"].items()}
def save(self):
with open(self._playersPath, 'w') as f:
self._cfg = json.dump(f, self._cfg)
def keys(self):
"""
Iterator of the active players' names
"""
""" Iterator of the active players' names """
return self._player_data.keys()
def values(self):
"""
Iterator of the active players' objects
"""
""" Iterator of the active players' objects """
return self._player_data.keys()
def items(self):
"""
Two iterators of the activate players' names and object
"""
""" Two iterators of the activate players' names and object """
return self._player_data.items()
def save(self):
with open(self._playersPath, 'w') as f:
self._cfg = json.dump(f, self._cfg)
def addExpansion(self, expansion):
"""
Adds an expansion, used by things like PDO-Lib.