예제 #1
0
    def save(self):
        l = self.level
        s = os.path.normcase(
            os.path.join(os.environ["APPDATA"], self.save_file))

        with open(s, 'wb') as f:
            pickle.dump(self.seed, f, pickle.HIGHEST_PROTOCOL)
            pickle.dump(self.where, f, pickle.HIGHEST_PROTOCOL)

            self.last_level_seed = l.seed
            pickle.dump(self.last_level_seed, f, pickle.HIGHEST_PROTOCOL)

            l.save(f)
            mm.con("Game saved @ level {} to {}".format(str(l), s))
예제 #2
0
    def load(self):

        s = os.path.normcase(
            os.path.join(os.environ["APPDATA"], self.save_file))
        with open(s, 'rb') as f:
            mm.log("Game loading from {}".format(s))

            self.seed = pickle.load(f)
            self.where = pickle.load(f)
            self.last_level_seed = pickle.load(f)

            self.load_level(self.last_level_seed)
            mm.log("Game loaded @ level {} to {}".format(str(self.level), s))
            mm.con("Loaded previously saved game")

        if self.version != self.__class__.class_version:
            self.upgrade()
예제 #3
0
    def save(self):
        l = self.level
        s = os.path.normcase(
                os.path.join(os.environ["APPDATA"], self.save_file))

        with open(s, 'wb') as f:
            pickle.dump(self.seed, f, pickle.HIGHEST_PROTOCOL)
            pickle.dump(self.sdl_delay, f, pickle.HIGHEST_PROTOCOL)
            pickle.dump(self.where, f, pickle.HIGHEST_PROTOCOL)
            pickle.dump(self.move_count, f, pickle.HIGHEST_PROTOCOL)
            pickle.dump(self.moves_per_day, f, pickle.HIGHEST_PROTOCOL)
            pickle.dump(self.level_stack, f, pickle.HIGHEST_PROTOCOL)

            self.last_level_seed = l.seed
            pickle.dump(self.last_level_seed, f, pickle.HIGHEST_PROTOCOL)

            l.save(f)
            mm.con("Game saved @ chunk {0} to {1}".format(str(l), s))
예제 #4
0
    def load(self):

        s = os.path.normcase(os.path.join(os.environ["APPDATA"],
                                          self.save_file))
        with open(s, 'rb') as f:
            mm.log("Game loading from {0}".format(s))

            self.seed = pickle.load(f)
            self.sdl_delay = pickle.load(f)
            self.where = pickle.load(f)
            self.move_count = pickle.load(f)
            self.moves_per_day = pickle.load(f)
            self.level_stack = pickle.load(f)
            self.last_level_seed = pickle.load(f)

            self.load_level(self.last_level_seed)
            mm.log("Game loaded @ chunk {0} to {1}".format(str(self.level), s))
            mm.con("Loaded previously saved game")

        if self.version != self.__class__.class_version:
            self.upgrade()
예제 #5
0
 def con(self, msg):
     mm.con("Level {0}: {1}".format(str(self), msg))
예제 #6
0
 def die(self, msg):
     mm.con("".join(traceback.format_stack()))
     mm.die("p_wid {}: ERROR: {}".format(self.name, msg))
예제 #7
0
def hook_new_game():
    mm.con("New game hook")
    game.game_new()
예제 #8
0
def wid_tp_grid_on_m_over(w, x, y, button):
    mm.con("o")
    return True
예제 #9
0
def hook_new_game():
    mm.con("New game hook")
    game.game_new()
예제 #10
0
 def con(self, msg):
     mm.con("Thing {0}: {1}".format(str(self), msg))
예제 #11
0
def hello():
    mm.con("%%fg=yellow$" +
           "  _____                              __              __")
    mm.con("%%fg=yellow$" +
           " /     \\                            |  \\            |  \\")
    mm.con(
        "%%fg=yellow$" +
        "|  $$$$$\\  ____   __   __   _____  _| $$_     ____  | $$  ____    ____    ____"
    )
    mm.con(
        "%%fg=yellow$" +
        "| $$  \\$$ /    \\ |  \\ |  \\ /     \\|   $$ \\   |    \\ | $$ /    \\  /    \\  /    \\"
    )
    mm.con(
        "%%fg=yellow$" +
        "| $$     |  $$$$\\| $$ | $$|  $$$$$ \\$$$$$$    \\$$$$\\| $$|  $$$$\\|  $$$$\\|  $$$$\\"
    )
    mm.con(
        "%%fg=yellow$" +
        "| $$  __ | $$ \\$$| $$ | $$ \\$$  \\   | $$ __  /    $$| $$| $$  $$| $$  $$| $$ \\$$"
    )
    mm.con(
        "%%fg=yellow$" +
        "| $$_/  \\| $$    | $$_/ $$ _\\$$$$\\  | $$|  \\|  $$$$$| $$| $$$$$$| $$$$$$| $$"
    )
    mm.con(
        "%%fg=yellow$" +
        " \\$$   $$| $$     \\$$   $$|     $$   \\$$  $$ \\$$  $$| $$ \\$$   \\ \\$$   \\| $$"
    )
    mm.con(
        "%%fg=yellow$" +
        "  \\$$$$$  \\$$     _\\$$$$$$ \\$$$$$     \\$$$$   \\$$$$$ \\$$  \\$$$$$  \\$$$$$ \\$$"
    )
    mm.con("%%fg=yellow$" + "                 |  \\_| $$")
    mm.con("%%fg=yellow$" + "                  \\$$   $$")
    mm.con("%%fg=yellow$" + "                   \\$$$$$")
    mm.con("%%fg=green$Version " + mm.VERSION + "%%fg=reset$")
    mm.con(" ")
    mm.con("Press %%fg=red$<tab>%%fg=reset$ to complete commands.")
    mm.con("Press %%fg=red$?%%fg=reset$ to show command options.")
    mm.con("You can also enter raw python code here.")
예제 #12
0
 def die(self, msg):
     mm.con("".join(traceback.format_stack()))
     mm.die("Chunk {0}: ERROR: {1}".format(str(self), msg))
예제 #13
0
 def con(self, msg):
     mm.con("Chunk {0}: {1}".format(str(self), msg))
예제 #14
0
 def die(self, msg):
     mm.con("".join(traceback.format_stack()))
     mm.die("p_wid {0}: ERROR: {1}".format(self.name, msg))
예제 #15
0
 def con(self, msg):
     mm.con("p_wid {0}: {1}".format(str(self), msg))
예제 #16
0
 def err(self, msg):
     mm.con("".join(traceback.format_stack()))
     mm.err("Level {0}: ERROR: {1}".format(self, msg))
예제 #17
0
 def die(self, msg):
     mm.con("".join(traceback.format_stack()))
     mm.die("Level {0}: FATAL ERROR: {1}".format(self, msg))
예제 #18
0
 def con(self, msg):
     mm.con("Level {}: {}".format(str(self), msg))
예제 #19
0
def hook_destroy_game():
    mm.con("Destroy game hook")

    if game.g is not None:
        game.g.destroy()
예제 #20
0
 def err(self, msg):
     mm.con("".join(traceback.format_stack()))
     mm.err("Level {}: ERROR: {}".format(self, msg))
예제 #21
0
def wid_tp_grid_on_m_down_close(w, x, y, button):
    mm.con("TODO")
    return True
예제 #22
0
 def die(self, msg):
     mm.con("".join(traceback.format_stack()))
     mm.die("Level {}: FATAL ERROR: {}".format(self, msg))
예제 #23
0
def hook_destroy_game():
    mm.con("Destroy game hook")

    if game.g is not None:
        game.g.destroy()
예제 #24
0
 def con(self, msg):
     mm.con("p_wid {}: {}".format(str(self), msg))