Slight change in the organization
This commit is contained in:
@ -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)
|
||||
@ -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)
|
||||
print(manager["Brosef"].gameSave)
|
||||
|
||||
Reference in New Issue
Block a user