def gm_get(self, name): """ 获取角色gm类 """ pid = PlayerData.name_to_id(name) p = self.player._game.player_mgr.get_player(pid) if not p: self.log(u'获取玩家(%s)失败', name) else: return GMPlayer(self, p)
def get_id_by_name(self, name): """ 根据名称获取对应玩家id """ try: return self.name2pids[name] except KeyError: pid_rid = PlayerData.name_to_id(name) if pid_rid is None: return self._add_name_id(pid_rid[0], name, pid_rid[1]) return pid_rid[0]
def get_id_by_name(self, name): """ 根据名称获取对应玩家id """ try: return self.name2pids[name] except KeyError: pid_rid = PlayerData.name_to_id(name) if pid_rid is None: return self._add_name_id(pid_rid[0], name, pid_rid[1]) return pid_rid[0]
def gm_get_pid_by_name(self, name): """ 通过角色名获取pid """ pid = PlayerData.name_to_id(name) self.log(u'玩家PID:%s', pid[0])
def gm_del(self, name): """ 删除指定名称的玩家数据 """ pid = PlayerData.name_to_id(name) self.gm_del_pid(pid)