Ejemplo n.º 1
0
class Config(UserDict):

    def __init__(self):
        UserDict.__init__(self)
        self.dict_file = DictFile("./data/profiles/config.mkm")
        temp = self.dict_file.read()
        for key, value in temp.items():
            self[key] = value

    def save(self):
        self.dict_file.change(self)
        self.dict_file.write()
Ejemplo n.º 2
0
class Player(UserDict):

    def __init__(self, name):
        """
        Class which serves as a placeholder for
        player's data
        """
        UserDict.__init__(self)
        self.dict_file = DictFile(name)
        temp = self.dict_file.read()
        for key, value in temp.items():
            self[key] = value
        self.buying = False

    def save(self):
        """
        Saves all changes made to the player
        dictionary (self)
        """
        self.dict_file.change(self)
        self.dict_file.write()
Ejemplo n.º 3
0
class Player(UserDict):

    def __init__(self, name):
        """
        Class which serves as a placeholder for
        player's data
        """
        UserDict.__init__(self)
        self.dict_file = DictFile(name)
        temp = self.dict_file.read()
        for key, value in temp.items():
            self[key] = value
        self.buying = False
        self.passed = 0
        self.killed = 0
        self.lpassed = 0
        self.newa = False
        self.lost = False
        self.passed = 0
        self.failed = 0
        self.collected = 0
        self.charges = 0
        self.hasscroll = 0
        self.tw = 0
        self.sp = 0
        self.paused = 1
        self["magicka"] = 0

    def debonus(self):
        self["powerup"] = 'None'

    def reset(self):
        self.buying = False
        self.passed = 0
        self.lpassed = False
        self.paused = 1
        self.killed = 0
        self.passed = 0
        self.charges = 0
        self.lost = False
        self.sp = 0
        self.tw = 0
        self.collected = 0
        self.hasscroll = 0
        self["retries"] += self.failed
        self.failed = 0
        self["magicka"] = 0

    def reward(self, prize, prizet):
        if prize == "gold":
            self["gold"]+=prizet
        else:
            pass

    def save(self):
        """
        Saves all changes made to the player
        dictionary (self)
        """
        self.dict_file.change(self)
        self.dict_file.write()