def load(self): log.info(f"Loading area: {self.area_path}") with open(self.area_path, 'r') as thefile: data = thefile.read() # Load Header Data into this Area log.info(f"Loading area Header: {self.area_path}") for eachkey, eachvalue in json.loads(data).items(): setattr(self, eachkey, eachvalue) # Load each Room into this Area log.info(f"{self.name} : Loading area Rooms") roomfilepath = os.path.join(self.folder_path, f"rooms/*.json") filenames = glob.glob(roomfilepath) for eachfile in filenames: with open(eachfile, 'r') as thefile: room.Room(self, thefile.read()) # Load each Exit and attach it to a room log.info(f"{self.name} : Loading area Exits") exitfilepath = os.path.join(self.folder_path, f"exits/*.json") filenames = glob.glob(exitfilepath) for eachfile in filenames: with open(eachfile, 'r') as thefile: fullpath, direction_fn = eachfile.split('.')[0].split('-') roomvnum = fullpath.split('/')[-1:][0] attached_room = self.room_by_vnum(int(roomvnum)) if attached_room is None: log.warning( f"room_by_vnum_global failed in exit load: {roomvnum}") else: exits.Exit(attached_room, direction_fn, thefile.read()) # Load each Mobile in to the Indexes. log.info(f"{self.name} : Loading area Mobiles") mobilefilepath = os.path.join(self.folder_path, f"mobiles/*.json") filenames = glob.glob(mobilefilepath) for eachfile in filenames: with open(eachfile, 'r') as thefile: mobile.Mobile(self, thefile.read()) # Load each Object in to the Indexes. log.info(f"{self.name} : Loading area Objects") objectfilepath = os.path.join(self.folder_path, f"objects/*.json") filenames = glob.glob(objectfilepath) for eachfile in filenames: with open(eachfile, 'r') as thefile: objects.Object(self, thefile.read(), load_type="index") # Load the resets for this area. log.info(f"{self.name} : Loading area Resets") resetfilepath = os.path.join(self.folder_path, f"resets/resets.json") if os.path.exists(resetfilepath): with open(resetfilepath, 'r') as thefile: reset.Reset(self, thefile.read()) # Add this area to the area list. log.info(f"{self.name} : Appending to arealist.") arealist.append(self)
import reset x = reset.Reset() #CHECK IF THE RESET WAS SUCCESSFUL if x == 1: print("RESET SUCCESSFUL") elif x == 3: print("UNEXPECTED ERROR")
def resetconfig_button_update(self): self.close() reset.Reset()