| 
									
										
										
										
											2023-02-13 18:06:43 -06:00
										 |  |  | from BaseClasses import Region, Entrance, Item, Tutorial, ItemClassification | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  | from .Items import ChecksFinderItem, item_table, required_items | 
					
						
							|  |  |  | from .Locations import ChecksFinderAdvancement, advancement_table, exclusion_table | 
					
						
							| 
									
										
										
										
											2022-06-17 03:23:27 +02:00
										 |  |  | from .Options import checksfinder_options | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  | from .Rules import set_rules, set_completion_rules | 
					
						
							| 
									
										
										
										
											2022-05-11 13:05:53 -05:00
										 |  |  | from ..AutoWorld import World, WebWorld | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | client_version = 7 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-11 13:05:53 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | class ChecksFinderWeb(WebWorld): | 
					
						
							|  |  |  |     tutorials = [Tutorial( | 
					
						
							|  |  |  |         "Multiworld Setup Tutorial", | 
					
						
							|  |  |  |         "A guide to setting up the Archipelago ChecksFinder software on your computer. This guide covers " | 
					
						
							|  |  |  |         "single-player, multiworld, and related software.", | 
					
						
							|  |  |  |         "English", | 
					
						
							|  |  |  |         "checksfinder_en.md", | 
					
						
							|  |  |  |         "checksfinder/en", | 
					
						
							|  |  |  |         ["Mewlif"] | 
					
						
							|  |  |  |     )] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  | class ChecksFinderWorld(World): | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     ChecksFinder is a game where you avoid mines and find checks inside the board | 
					
						
							|  |  |  |     with the mines! You win when you get all your items and beat the board! | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     game: str = "ChecksFinder" | 
					
						
							| 
									
										
										
										
											2022-08-15 16:46:59 -05:00
										 |  |  |     option_definitions = checksfinder_options | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  |     topology_present = True | 
					
						
							| 
									
										
										
										
											2022-05-11 13:05:53 -05:00
										 |  |  |     web = ChecksFinderWeb() | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     item_name_to_id = {name: data.code for name, data in item_table.items()} | 
					
						
							|  |  |  |     location_name_to_id = {name: data.id for name, data in advancement_table.items()} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     data_version = 4 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def _get_checksfinder_data(self): | 
					
						
							|  |  |  |         return { | 
					
						
							| 
									
										
										
										
											2023-02-02 01:14:23 +01:00
										 |  |  |             'world_seed': self.multiworld.per_slot_randoms[self.player].getrandbits(32), | 
					
						
							| 
									
										
										
										
											2022-10-31 21:41:21 -05:00
										 |  |  |             'seed_name': self.multiworld.seed_name, | 
					
						
							|  |  |  |             'player_name': self.multiworld.get_player_name(self.player), | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  |             'player_id': self.player, | 
					
						
							|  |  |  |             'client_version': client_version, | 
					
						
							| 
									
										
										
										
											2022-10-31 21:41:21 -05:00
										 |  |  |             'race': self.multiworld.is_race, | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-07 16:44:01 +02:00
										 |  |  |     def create_items(self): | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         # Generate item pool | 
					
						
							|  |  |  |         itempool = [] | 
					
						
							|  |  |  |         # Add all required progression items | 
					
						
							|  |  |  |         for (name, num) in required_items.items(): | 
					
						
							|  |  |  |             itempool += [name] * num | 
					
						
							|  |  |  |         # Add the map width and height stuff | 
					
						
							|  |  |  |         itempool += ["Map Width"] * (10-5) | 
					
						
							|  |  |  |         itempool += ["Map Height"] * (10-5) | 
					
						
							|  |  |  |         # Add the map bombs | 
					
						
							|  |  |  |         itempool += ["Map Bombs"] * (20-5) | 
					
						
							|  |  |  |         # Convert itempool into real items | 
					
						
							|  |  |  |         itempool = [item for item in map(lambda name: self.create_item(name), itempool)] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-31 21:41:21 -05:00
										 |  |  |         self.multiworld.itempool += itempool | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def set_rules(self): | 
					
						
							| 
									
										
										
										
											2022-10-31 21:41:21 -05:00
										 |  |  |         set_rules(self.multiworld, self.player) | 
					
						
							|  |  |  |         set_completion_rules(self.multiworld, self.player) | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def create_regions(self): | 
					
						
							| 
									
										
										
										
											2023-02-13 18:06:43 -06:00
										 |  |  |         menu = Region("Menu", self.player, self.multiworld) | 
					
						
							|  |  |  |         board = Region("Board", self.player, self.multiworld) | 
					
						
							| 
									
										
										
										
											2023-10-29 19:47:37 +01:00
										 |  |  |         board.locations += [ChecksFinderAdvancement(self.player, loc_name, loc_data.id, board) | 
					
						
							|  |  |  |                             for loc_name, loc_data in advancement_table.items() if loc_data.region == board.name] | 
					
						
							| 
									
										
										
										
											2023-02-13 18:06:43 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |         connection = Entrance(self.player, "New Board", menu) | 
					
						
							|  |  |  |         menu.exits.append(connection) | 
					
						
							|  |  |  |         connection.connect(board) | 
					
						
							|  |  |  |         self.multiworld.regions += [menu, board] | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def fill_slot_data(self): | 
					
						
							|  |  |  |         slot_data = self._get_checksfinder_data() | 
					
						
							|  |  |  |         for option_name in checksfinder_options: | 
					
						
							| 
									
										
										
										
											2022-10-31 21:41:21 -05:00
										 |  |  |             option = getattr(self.multiworld, option_name)[self.player] | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  |             if slot_data.get(option_name, None) is None and type(option.value) in {str, int}: | 
					
						
							|  |  |  |                 slot_data[option_name] = int(option.value) | 
					
						
							|  |  |  |         return slot_data | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def create_item(self, name: str) -> Item: | 
					
						
							|  |  |  |         item_data = item_table[name] | 
					
						
							| 
									
										
										
										
											2022-06-17 03:23:27 +02:00
										 |  |  |         item = ChecksFinderItem(name, | 
					
						
							|  |  |  |                                 ItemClassification.progression if item_data.progression else ItemClassification.filler, | 
					
						
							|  |  |  |                                 item_data.code, self.player) | 
					
						
							| 
									
										
										
										
											2022-03-22 18:30:10 -04:00
										 |  |  |         return item |