def _doCreateClub(self, user_info, club_game_type, club_name, club_params_dict, avatar_mb=None): club_name = utility.filter_emoji(club_name) club_name = club_name[:const.CLUB_NAME_LENGTH] self.clubCount += 1 club_id = utility.gen_club_id(self.clubCount) user_id = user_info["userId"] owner_info = { 'userId': user_info["userId"], 'uuid': user_info["uuid"], 'sex': user_info["sex"], 'nickname': user_info["name"], 'head_icon': user_info["head_icon"], 'accountName': user_info["accountName"], 'isAgent': user_info["isAgent"], } log_info = { 'login_time': user_info['login_time'], 'logout_time': user_info['logout_time'] } # 开房时候需要, 这里就直接填上 club_params_dict['club_id'] = club_id club_params_dict['owner_uid'] = user_id params = { 'clubId': club_id, 'name': club_name, 'owner': owner_info, 'gameType': club_game_type, 'roomParams': club_params_dict, } INFO_MSG("ClubStub player{} createClub {}".format(user_id, params)) club = KBEngine.createEntityLocally("Club", params) if club: club.writeToDB(Functor(self._onClubSaved, avatar_mb, owner_info, log_info))
def updateUserInfo(self, info): name = info['nickname'] self.name = utility.filter_emoji(name) self.head_icon = info['head_icon'] self.sex = info['sex'] self.userId = info['userId'] if info['userId'] > 0 else self.userId DEBUG_MSG("Avatar client call updateUserInfo:{}".format(info))
def updateUserInfo(self, info): if switch.DEBUG_BASE: self.isAgent = 1 if self.userId != 0: return name = info['nickname'] self.name = utility.filter_emoji(name) or str(self.userId) self.head_icon = info['head_icon'] self.sex = info['sex'] else: name = info['nickname'] self.name = utility.filter_emoji(name) or str(self.userId) self.head_icon = info['head_icon'] self.sex = info['sex'] self.isAgent = info['isAgent'] DEBUG_MSG("Avatar client call updateUserInfo:{}".format(info))
def createClub(self, avatar_mb, club_name, club_params_dict): if avatar_mb.isAgent != 1: avatar_mb.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) return club_name = utility.filter_emoji(club_name) club_name = club_name[:const.CLUB_NAME_LENGTH] self.clubCount += 1 club_id = utility.gen_club_id(self.clubCount) owner_info = { 'userId': avatar_mb.userId, 'uuid': avatar_mb.uuid, 'sex': avatar_mb.sex, 'nickname': avatar_mb.name, 'head_icon': avatar_mb.head_icon, 'accountName': avatar_mb.accountName, } params = { 'clubId': club_id, 'name': club_name, 'owner': owner_info, 'roomType': club_params_dict, } INFO_MSG("ClubStub player{} createClub {}".format( avatar_mb.userId, params)) club = KBEngine.createBaseLocally("Club", params) if club: club.writeToDB(Functor(self._onClubSaved, avatar_mb, owner_info))
def updateUserInfo(self, info): name = info['nickname'] self.name = utility.filter_emoji(name) info['nickname'] = self.name self.head_icon = info['head_icon'] self.sex = info['sex'] KBEngine.globalData["GameWorld"].updateCacheDict(self.userId, {'name': self.name, 'head_icon': self.head_icon, 'sex': self.sex}) DEBUG_MSG("Avatar client call updateUserInfo:{}".format(info))
def setMemberNotes(self, avatar_mb, target_uid, notes): mem = self.members.get(target_uid) if mem: notes = utility.filter_emoji(notes) notes = notes[:const.MEMBER_NOTES_LENGTH] mem['notes'] = notes avatar_mb.gotClubMembers(self.getMembers()) else: avatar_mb.showTip("成员不存在") avatar_mb.gotClubMembers(self.getMembers())
def setMemberNotes(self, avatar_mb, target_uid, notes): mem = self.members.get(target_uid) if mem: notes = utility.filter_emoji(notes) notes = notes[:const.MEMBER_NOTES_LENGTH] mem['notes'] = notes # avatar_mb.gotClubMembers(self.clubId, self.getMembers()) data = { 'ts': utility.get_cur_timestamp(), 'op': const.CLUB_MEMBER_OP_UPDATE, 'online': self.member_status[target_uid]['online'], 'free': self.member_status[target_uid]['free'] } data.update(mem) self.event_mgr.push_event(Events.EVENT_CLUB_MEMBER_CHANGE, data) else: avatar_mb.showTip("成员不存在")
def setClubNotice(self, avatar_mb, new_notice): new_notice = utility.filter_emoji(new_notice) new_notice = new_notice[:const.CLUB_NOTICE_LENGTH] self.notice = new_notice avatar_mb.setClubNoticeSucceed(self.clubId, new_notice)
def setClubName(self, avatar_mb, new_name): new_name = utility.filter_emoji(new_name) new_name = new_name[:const.CLUB_NAME_LENGTH] self.name = new_name avatar_mb.setClubNameSucceed(self.clubId, new_name)
def setClubNotice(self, avatar_mb, new_notice): new_notice = utility.filter_emoji(new_notice) new_notice = new_notice[:const.CLUB_NOTICE_LENGTH] self.notice = new_notice avatar_mb.setClubNoticeSucceed(self.clubId, new_notice) self.event_mgr.push_event(Events.EVENT_CLUB_NOTICE_CHANGE)
def setClubName(self, avatar_mb, new_name): new_name = utility.filter_emoji(new_name) new_name = new_name[:const.CLUB_NAME_LENGTH] self.name = new_name avatar_mb.setClubNameSucceed(self.clubId, new_name) self.event_mgr.push_event(Events.EVENT_CLUB_NAME_CHANGE)