diff --git a/NoPELib/expansion.py b/NoPELib/expansion.py index 59b9b2a..35d8af8 100644 --- a/NoPELib/expansion.py +++ b/NoPELib/expansion.py @@ -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) \ No newline at end of file diff --git a/NoPELib/player_settings.py b/NoPELib/player_settings.py index c92cd38..dc823fa 100644 --- a/NoPELib/player_settings.py +++ b/NoPELib/player_settings.py @@ -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,27 +115,21 @@ 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): """ @@ -216,4 +213,4 @@ if __name__ == "__main__": # Modification of a players data brosef = manager["Brosef"] brosef.gameSave = [1] - print(manager["Brosef"].gameSave) \ No newline at end of file + print(manager["Brosef"].gameSave)