def load(self): dictinfo = flatFileParse(self.filename) self.name = textRead(dictinfo['name']) self.password = textRead(dictinfo['password']) self.capability = listRead(dictinfo['capability']) self.lasthost = textRead(dictinfo['lasthost']) self.lasttime = textRead(dictinfo['lasttime']) newroom = int(textRead(dictinfo['location'])) newroom = area.roomByVnum(newroom) self.location = newroom self.move(newroom) self.long_description = textRead(dictinfo['long description']) self.short_description = textRead(dictinfo['short description']) self.race = races.racebyname(textRead(dictinfo['race'])) self.age = int(textRead(dictinfo['age'])) self.gender = textRead(dictinfo['gender']) self.level = int(textRead(dictinfo['level'])) self.alignment = textRead(dictinfo['alignment']) self.money = dictRead(dictinfo['money']) self.height = dictRead(dictinfo['height']) self.weight = int(textRead(dictinfo['weight'])) self.maxhp = int(textRead(dictinfo['maxhp'])) self.currenthp = int(textRead(dictinfo['currenthp'])) self.maxmovement = int(textRead(dictinfo['maxmovement'])) self.currentmovement = int(textRead(dictinfo['currentmovement'])) self.maxwillpower = int(textRead(dictinfo['maxwillpower'])) self.currentwillpower = int(textRead(dictinfo['currentwillpower'])) self.totalmemoryslots = dictRead(dictinfo['totalmemoryslots']) self.memorizedspells = dictRead(dictinfo['memorizedspells']) self.hitroll = int(textRead(dictinfo['hitroll'])) self.damroll = int(textRead(dictinfo['damroll'])) self.wimpy = int(textRead(dictinfo['wimpy'])) self.title = textRead(dictinfo['title']) self.guild = textRead(dictinfo['guild']) self.council = textRead(dictinfo['council']) self.family = textRead(dictinfo['family']) self.clan = textRead(dictinfo['clan']) self.deity = textRead(dictinfo['deity']) self.skillpoints = int(textRead(dictinfo['skillpoints'])) self.seen_as = textRead(dictinfo['seen as']) self.maximum_stat = dictRead(dictinfo['maximum stat']) self.current_stat = dictRead(dictinfo['current stat']) self.discipline = textRead(dictinfo['discipline']) self.aesthetic = textRead(dictinfo['aesthetic']) self.exp = dictRead(dictinfo['exp']) self.inventory = listRead(dictinfo['inventory']) self.worn = dictRead(dictinfo['worn']) self.baceac = dictRead(dictinfo['baceac']) self.currentac = dictRead(dictinfo['currentac']) self.hunger = int(textRead(dictinfo['hunger'])) self.thirst = int(textRead(dictinfo['thirst'])) self.position = textRead(dictinfo['position']) self.aid = textRead(dictinfo['aid']) self.knownpeople = dictRead(dictinfo['known people']) self.prompt = textRead(dictinfo['prompt']) self.alias = dictRead(dictinfo['alias'])
def get_race(self, inp): inp = inp.lower() if inp in list(races.racesdict.keys()): self.newchar['race'] = races.racebyname(inp) self.newchar['aid'] = int(time.time()) self.sock.dispatch("Available genders are: male female") self.sock.dispatch('Please choose a gender: ', trail=False) self.interp = self.get_gender else: self.sock.dispatch('That is not a valid race.') self.show_races() self.sock.dispatch('Please choose a race: ', trail=False)
def load(self, data): for eachkey, eachvalue in json.loads(data).items(): setattr(self, eachkey, eachvalue) log.debug(f"Loading mobile: {self.vnum}") self.location = None self.race = races.racebyname(self.race) if not self.equipped: self.equipped = {k: None for k in self.race.wearlocations} if self.index: self.populate_index() else: self.populate_real()
async def get_race(self, inp): inp = inp.lower() if inp in races.racesdict: self.newchar['race'] = races.racebyname(inp) await self.sock.dispatch('') await self.sock.dispatch("Available genders are: {BFemale Male{x") await self.sock.dispatch('Please choose a gender: ', trail=False) self.interp = self.get_gender elif len(inp.split()) > 1: if inp.split()[0] == 'help' and inp.split()[1] in races.racesdict: self.sock.query_db('help', inp.split()[1]) await self.show_races() await self.sock.dispatch('Please choose a race: ', trail=False) else: await self.sock.dispatch('That is not a valid race.') await self.show_races() await self.sock.dispatch('Please choose a race: ', trail=False)
async def load(self): if os.path.exists(self.filename): with open(self.filename, "r") as thefile: player_file_dict = json.loads(thefile.read()) for eachkey, eachvalue in player_file_dict.items(): setattr(self, eachkey, eachvalue) log.debug(f"Loading player: {self.name}") if self.contents: self.contents = {k: objects.Object(None, v, load_type="inventory") for k, v in self.contents.items()} self.race = races.racebyname(self.race) if not self.equipped: self.equipped = {k: None for k in self.race.wearlocations} self.location = area.room_by_vnum_global(self.location) await self.move(self.location)