示例#1
0
 def runTest(self):
     self.randomizer_options_instance = \
         randomizer_options.RandomizerOptions(0, 0, 0, 0, 0, 0, 0, "DARK SOULS: Prepare To Die Edition", 1)
     assert self.randomizer_options_instance.as_string() == \
         "Randomizer Settings:\n" \
         "  Game Version: DARK SOULS: Prepare To Die Edition\n" \
         "  Difficulty: Fair\n" \
         "  Fashion Souls: Off\n" \
         "  Key Difficulty: Not Shuffled\n" \
         "  Senile Gwynevere: Off\n" \
         "  Senile Primordial Serpents: Off\n" \
         "  Soul Items: Shuffled\n" \
         "  Starting Items: Shield & 1H Weapon\n" \
         "  Laundromat Mixup: On\n" \
         , \
         "Expected: \n" \
         "Randomizer Settings:\n" \
         "  Game Version: DARK SOULS: Prepare To Die Edition\n" \
         "  Difficulty: Fair\n" \
         "  Fashion Souls: Off\n" \
         "  Key Difficulty: Not Shuffled\n" \
         "  Senile Gwynevere: Off\n" \
         "  Senile Primordial Serpents: Off\n" \
         "  Soul Items: Shuffled\n" \
         "  Starting Items: Shield & 1H Weapon\n" \
         "  Laundromat Mixup: On\n"
    def randomize_data(self, chr_init_data):
        options = rngopts.RandomizerOptions(self.diff.get(),
                                            self.fashion_bool.get(),
                                            self.key_diff.get(),
                                            self.use_lordvessel.get(),
                                            self.use_lord_souls.get(),
                                            self.soul_diff.get(),
                                            self.start_items_diff.get(),
                                            self.game_version.get(),
                                            self.npc_armor_bool.get())

        rng = random.Random()
        rng.seed(
            int(
                hashlib.sha256(
                    self.seed_string.get().encode('utf-8')).hexdigest(), 16))
        return (options,
                randomize_item_table.build_table(options, rng,
                                                 chr_init_data), rng)
    def randomize_data(self, chr_init_data):
        options = rngopts.RandomizerOptions(self.diff.get(),
                                            self.fashion_bool.get(),
                                            self.key_diff.get(),
                                            self.use_lordvessel.get(),
                                            self.use_lord_souls.get(),
                                            self.soul_diff.get(),
                                            self.start_items_diff.get(),
                                            self.game_version.get(),
                                            self.npc_armor_bool.get(),
                                            self.ascend_weapons_bool.get())

        if self.save_options.get():
            ini_parser.save_ini(
                INI_FILE, options)  #save options right before creating seed

        rng = random.Random()
        rng.seed(
            int(
                hashlib.sha256(
                    self.seed_string.get().encode('utf-8')).hexdigest(), 16))
        return (options,
                randomize_item_table.build_table(options, rng,
                                                 chr_init_data), rng)
示例#4
0
if __name__ == "__main__":
    import random
    import sys

    if len(sys.argv) < 2:
        print("Usage: " + str(sys.argv[0]) + " <seed>")
        sys.exit(1)

    seed = sys.argv[1]

    #logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
    logging.basicConfig(stream=sys.stdout, level=logging.WARN)
    options = rng_opt.RandomizerOptions(
        rng_opt.RandOptDifficulty.EASY, True,
        rng_opt.RandOptKeyDifficulty.SPEEDRUN_MODE, True, True,
        rng_opt.RandOptSoulItemsDifficulty.SHUFFLE,
        rng_opt.RandOptStartItemsDifficulty.COMBINED_POOL_AND_2H,
        rng_opt.RandOptGameVersion.PTDE, False)

    rng = random.Random()
    rng.seed(seed)
    (table, _) = build_table(options, rng)
    #result_ilp = table.build_itemlotparam()
    #result_slp = table.build_shoplineup()
    #cheat_string = table.build_cheatsheet(show_event_flags = True)
    hint_string = table.build_hintsheet()
    #ilp_binary_export = result_ilp.export_as_binary()
    #slp_binary_export = result_slp.export_as_binary()

    #with open("ItemLotParam.param", 'wb') as f:
    #    f.write(ilp_binary_export)