def func(self): """ This is the hook function that actually does all the work. It is called by the cmdhandler right after self.parser() finishes, and so has access to all the variables defined therein. """ characters = [ thing for thing in self.caller.location.contents if thing.player ] if "far" in self.switches: characters = [thing for thing in self.caller.search(self.args, global_search=True, ignore_errors=True) if thing.db.spirit] idle_threshhold = 180 # Three minutes minimum idle. self.caller.msg("+-Stat---Name----------------------------Sex---------Species-----------------+") for character in characters: if character.sessions: idle_time = time.time() - character.sessions[0].cmd_last_visible if idle_time > idle_threshhold: name = name = character.name + "[Idle " + utils.time_format(idle_time,1) + "]" else: name = character.name else: name = character.name + "[Zzz]" status = character.db.status if not status: status = "" line = "| %-5s| %-30s| %-10s| %-24s|" % ( character.db.status, name, character.db.sex, character.db.species ) self.caller.msg(line) self.caller.msg("+----------------------------------------------------------------------------+")
def func(self): """ This is the hook function that actually does all the work. It is called by the cmdhandler right after self.parser() finishes, and so has access to all the variables defined therein. """ characters = [ thing for thing in self.caller.location.contents if thing.player ] if "far" in self.switches: characters = [ thing for thing in self.caller.search( self.args, global_search=True, ignore_errors=True) if thing.player ] idle_threshhold = 180 # Three minutes minimum idle. self.caller.msg( "+-Stat---Name----------------------------Sex---------Species-----------------+" ) for character in characters: if character.sessions: idle_time = time.time( ) - character.sessions[0].cmd_last_visible if idle_time > idle_threshhold: name = name = character.name + "[Idle " + utils.time_format( idle_time, 1) + "]" else: name = character.name else: name = character.name + "[Zzz]" status = character.db.status if not status: status = "" line = "| %-5s| %-30s| %-10s| %-24s|" % (character.db.status, name, character.db.sex, character.db.species) self.caller.msg(line) self.caller.msg( "+----------------------------------------------------------------------------+" )
def get_idle_time(self, session): PARTIAL = 0 delta_cmd = time.time() - session.cmd_last_visible return utils.time_format(delta_cmd, PARTIAL)
def get_online_time(self, session): FULL = 1 online_time = time.time() - session.conn_time return utils.time_format(online_time, FULL)