def getMyTeamNumb(self):
     '''获取队伍人数'''
     team = TeamManager().getTeamByID(self._teamId)
     if not team:
         return -1
     else:
         team.getTeamMemberNumber()
 def amITeamLeader(self):
     '''判断自己是否是队长'''
     team = TeamManager().getTeamByID(self._teamId)
     if not team:
         return False
     if team.getLeader() == self._owner.baseInfo.id:
         return True
     return False
 def IsMyTeamMember(self, memberId):
     '''判断是否是自己队伍的成员'''
     team = TeamManager().getTeamByID(self._teamId)
     if not team:
         return False
     teamMemberIdlist = team.getTeamMembers()
     if memberId in teamMemberIdlist:
         return True
     return False
 def pushTeamMemberInfo(self):
     '''推送队伍成员信息'''
     if self._teamId == -1:
         pushObjectNetInterface.pushUpdatePlayerInfo(self._owner.getDynamicId())
         return
     team = TeamManager().getTeamByID(self._teamId)
     if team :
         team.pushTeamMemberInfo()
     else:
         self._owner.updatePlayerInfo()
 def pushTeamMemberInfo(self):
     '''推送队伍成员信息'''
     if self._teamId == -1:
         pushObjectNetInterface.pushUpdatePlayerInfo(
             self._owner.getDynamicId())
         return
     team = TeamManager().getTeamByID(self._teamId)
     if team:
         team.pushTeamMemberInfo()
     else:
         self._owner.updatePlayerInfo()
 def FireMember(self, memberId):
     '''踢出成员'''
     if not self.amITeamLeader():
         return {'result': False, 'message': Lg().g(492)}
     team = TeamManager().getTeamByID(self._teamId)
     result = team.dropMenber(memberId)
     if not result['result']:
         return result
     teamerNumber = team.getTeamMemberNumber()
     if teamerNumber < 2:
         TeamManager().dropTeamById(self._teamId)
         self.setTeam(-1)
     return {'result': True, 'message': Lg().g(112)}
 def amITeamMember(self):
     '''判断是否在队伍中'''
     if self._teamId == -1:
         return False
     team = TeamManager().getTeamByID(self._teamId)
     if team:
         return True
     return False
 def startCopyScene(self,characterId,vipMatrix):
     '''开始副本
     @param chracterId: 角色的ID
     '''
     if characterId != self.roomowner:
         return {'result':False,'message':u'只有房主有权限'}
     if not self.areAllReady():
         return {'result':False,'message':u'还有玩家没有准备好'}
     player = PlayersManager().getPlayerByID(characterId)
     
     if vipMatrix ==1:
         if player.finance.getCoin()>=5000:
             self.matrix.setNowEffect(vipMatrix)
             player.finance.updateCoin(player.finance.getCoin() -5000)
     elif vipMatrix ==2:
         if player.finance.getGold()>=10:
             self.matrix.setNowEffect(vipMatrix)
             player.finance.updateGold(player.finance.getGold() -10)
     elif vipMatrix ==3 :
         if player.finance.getGold()>=50:
             self.matrix.setNowEffect(vipMatrix)
             player.finance.updateGold(player.finance.getGold() -50)
     
     sendList = []
     if len([member for member in self.members.values() if member])>1:
         team = TeamManager().creatTeam(characterId)
         team.setMatrix(self.matrix)
         for member in self.members.values():
             if member:
                 pp = PlayersManager().getPlayerByID(member['id'])
                 if pp:
                     sendList.append(pp.getDynamicId())
                 team.addMember(member['id'])
     data = enterInstance1(0, characterId, self.copySceneId)
     if data['result']:
         player = PlayersManager().getPlayerByID(characterId)
         dynamicId = player.getDynamicId()
         pushQuitHallMessage(sendList)
         pushEnterPlace(data['data'].get('placeId'), [dynamicId])
     return data
 def addTeamMember(self, characterId):
     '''添加队伍成员'''
     if characterId == self._owner.baseInfo.id:
         return {'result': False, 'message': Lg().g(491)}
     if self._teamId == -1:
         team = TeamManager().creatTeam(self._owner.baseInfo.id)
     else:
         team = TeamManager().getTeamByID(self._teamId)
     result = team.addMember(characterId)
     team.pushTeamMemberInfo()
     return result
Exemple #10
0
    def startCopyScene(self, characterId, vipMatrix):
        '''开始副本
        @param chracterId: 角色的ID
        '''
        if characterId != self.roomowner:
            return {'result': False, 'message': u'只有房主有权限'}
        if not self.areAllReady():
            return {'result': False, 'message': u'还有玩家没有准备好'}
        player = PlayersManager().getPlayerByID(characterId)

        if vipMatrix == 1:
            if player.finance.getCoin() >= 5000:
                self.matrix.setNowEffect(vipMatrix)
                player.finance.updateCoin(player.finance.getCoin() - 5000)
        elif vipMatrix == 2:
            if player.finance.getGold() >= 10:
                self.matrix.setNowEffect(vipMatrix)
                player.finance.updateGold(player.finance.getGold() - 10)
        elif vipMatrix == 3:
            if player.finance.getGold() >= 50:
                self.matrix.setNowEffect(vipMatrix)
                player.finance.updateGold(player.finance.getGold() - 50)

        sendList = []
        if len([member for member in self.members.values() if member]) > 1:
            team = TeamManager().creatTeam(characterId)
            team.setMatrix(self.matrix)
            for member in self.members.values():
                if member:
                    pp = PlayersManager().getPlayerByID(member['id'])
                    if pp:
                        sendList.append(pp.getDynamicId())
                    team.addMember(member['id'])
        data = enterInstance1(0, characterId, self.copySceneId)
        if data['result']:
            player = PlayersManager().getPlayerByID(characterId)
            dynamicId = player.getDynamicId()
            pushQuitHallMessage(sendList)
            pushEnterPlace(data['data'].get('placeId'), [dynamicId])
        return data
 def getMyTeamLeader(self):
     '''获取队伍中的队长队长'''
     team = TeamManager().getTeamByID(self._teamId)
     if team:
         return team.getLeader()
     return self._owner
 def amisteam(self):
     '''判断自己是否在队伍中'''
     team = TeamManager().getTeamByID(self._teamId)
     if team:
         return True
     return False
 def getTeam(self):
     '''获取队伍'''
     team = TeamManager().getTeamByID(self._teamId)
     if team:
         return team
     return None
 def exitTeam(self):
     '''退出队伍'''
     team = TeamManager().getTeamByID(self._teamId)
     if not team:
         return False
 def getMyTeamMember(self):
     '''获取队伍成员信息'''
     team = TeamManager().getTeamByID(self._teamId)
     if team:
         return team._teamMembers
     return None