| 
									
										
										
										
											2023-03-21 01:26:03 +09:00
										 |  |  | import typing | 
					
						
							|  |  |  | from ..checkMetadata import checkMetadataTable | 
					
						
							|  |  |  | from .constants import * | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-16 21:59:19 -05:00
										 |  |  | custom_name_replacements = { | 
					
						
							|  |  |  |     '"':"'", | 
					
						
							|  |  |  |     '_':' ', | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2023-03-21 01:26:03 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | class ItemInfo: | 
					
						
							|  |  |  |     MULTIWORLD = True | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def __init__(self, room=None, extra=None): | 
					
						
							|  |  |  |         self.item = None | 
					
						
							|  |  |  |         self._location = None | 
					
						
							|  |  |  |         self.room = room | 
					
						
							|  |  |  |         self.extra = extra | 
					
						
							|  |  |  |         self.metadata = checkMetadataTable.get(self.nameId, checkMetadataTable["None"]) | 
					
						
							|  |  |  |         self.forced_item = None | 
					
						
							|  |  |  |         self.custom_item_name = None | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         self.event = None | 
					
						
							|  |  |  |     @property | 
					
						
							|  |  |  |     def location(self): | 
					
						
							|  |  |  |         return self._location | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def setLocation(self, location): | 
					
						
							|  |  |  |         self._location = location | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-16 21:59:19 -05:00
										 |  |  |     def setCustomItemName(self, name): | 
					
						
							|  |  |  |         for key, val in custom_name_replacements.items(): | 
					
						
							|  |  |  |             name = name.replace(key, val) | 
					
						
							|  |  |  |         self.custom_item_name = name | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-21 01:26:03 +09:00
										 |  |  |     def getOptions(self): | 
					
						
							|  |  |  |         return self.OPTIONS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def configure(self, options): | 
					
						
							|  |  |  |         pass | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def read(self, rom): | 
					
						
							|  |  |  |         raise NotImplementedError() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def patch(self, rom, option, *, multiworld=None): | 
					
						
							|  |  |  |         raise NotImplementedError() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def __repr__(self): | 
					
						
							|  |  |  |         return self.__class__.__name__ | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     @property | 
					
						
							|  |  |  |     def nameId(self): | 
					
						
							|  |  |  |         return "0x%03X" % self.room if self.room is not None else "None" |