Ejemplo n.º 1
0
    def acceptGuildApply(self, operator, characterId):
        '''同意角色的入会申请
        @param operator: 操作者的id
        @param characterId: int 申请人的id
        '''
        president = self.get('president')
        veteranList = eval('[' + self.guildinfo['veterans'] + ']')
        staffList = eval('[' + self.guildinfo['staffOfficers'] + ']')
        senatorsList = eval('[' + self.guildinfo['senators'] + ']')
        #获取操作者的权限
        if operator == president:
            operatorpost = Lg().g(520)
        elif operator in veteranList:
            operatorpost = Lg().g(519)
        elif operator in staffList:
            operatorpost = Lg().g(518)
        elif operator in senatorsList:
            operatorpost = Lg().g(517)

        managementGroup = veteranList + staffList + senatorsList

        if not dbGuild.checkHasApply(self.id, characterId):
            return -4
        if operator != self.president and operator not in managementGroup:
            return -1  #权限不够
        if dbGuild.checkCharacterHasGuild(characterId):
            return -2  #已经加入了行会
        curMenberNum = dbGuild.countGuildMenberNum(self.id)
        info = self.guildinfo
        maxMemberCount = 20 + ((info['emblemLevel'] - 1) * 30)
        if curMenberNum >= maxMemberCount:
            return -3  #成员数量达到上限
        result = dbGuild.insertCharacterGuildInfo(characterId, self.id)
        dbGuild.delCharacterAllApply(characterId)
        if result:
            player = PlayersManager().getPlayerByID(operator)
            content = Lg().g(532)\
            %(self.guildinfo.get('name',''),operatorpost,\
                player.baseInfo.getNickName(),self.guildinfo.get('name',''))
            title = Lg().g(526)
            m = Mail( title=title,type =0, senderId =-1, receiverId=characterId,\
                            sender = Lg().g(128),content=content)
            m.mailIntoDB()
            player = PlayersManager().getPlayerByID(characterId)
            if player:
                player.guild.updateID(self.id)
                chatnoderemote.callRemote('updateGuild', characterId, self.id,
                                          1)  #同步聊天角色中的行会
                player.updatePlayerInfo()
            return 1  #同意申请成功
        return 0  #同意申请失败
Ejemplo n.º 2
0
 def acceptGuildApply(self,operator,characterId):
     '''同意角色的入会申请
     @param operator: 操作者的id
     @param characterId: int 申请人的id
     '''
     president = self.get('president')
     veteranList = eval('['+self.guildinfo['veterans']+']')
     staffList = eval('['+self.guildinfo['staffOfficers']+']')
     senatorsList = eval('['+self.guildinfo['senators']+']')
     #获取操作者的权限
     if operator==president:
         operatorpost =Lg().g(520)
     elif operator in veteranList:
         operatorpost = Lg().g(519)
     elif operator in staffList:
         operatorpost = Lg().g(518)
     elif operator in senatorsList:
         operatorpost = Lg().g(517)
     
     managementGroup = veteranList + staffList + senatorsList
     
     if not dbGuild.checkHasApply(self.id, characterId):
         return -4
     if operator!=self.president and operator not in managementGroup:
         return -1#权限不够
     if dbGuild.checkCharacterHasGuild(characterId):
         return -2#已经加入了行会
     curMenberNum = dbGuild.countGuildMenberNum(self.id)
     info = self.guildinfo
     maxMemberCount = 20 + ((info['emblemLevel']-1)*30)
     if curMenberNum>=maxMemberCount:
         return -3#成员数量达到上限
     result = dbGuild.insertCharacterGuildInfo(characterId, self.id)
     dbGuild.delCharacterAllApply(characterId)
     if result:
         player = PlayersManager().getPlayerByID(operator)
         content = Lg().g(532)\
         %(self.guildinfo.get('name',''),operatorpost,\
             player.baseInfo.getNickName(),self.guildinfo.get('name',''))
         title = Lg().g(526)
         m = Mail( title=title,type =0, senderId =-1, receiverId=characterId,\
                         sender = Lg().g(128),content=content)
         m.mailIntoDB()
         player = PlayersManager().getPlayerByID(characterId)
         if player:
             player.guild.updateID(self.id)
             chatnoderemote.callRemote('updateGuild',characterId,self.id,1)#同步聊天角色中的行会
             player.updatePlayerInfo()
         return 1#同意申请成功
     return 0#同意申请失败
 def AppliJionGuild(self,guildId):
     '''申请加入国'''
     if self.getID():
         return {'result':False,'message':Lg().g(340)}
     surplushours = self.getCanJoinTime()
     if surplushours:
         return {'result':False,'message':Lg().g(647)%surplushours}
     if dbGuild.checkHasApply(guildId, self._owner.baseInfo.id):
         return {'result':False,'message':Lg().g(341)}
     guild = GuildManager().getGuildById(guildId)
     if self._owner.level.getLevel()<guild.levelrequired:
         return {'result':False,'message':Lg().g(342)}
     if not guild:
         return {'result':False,'message':Lg().g(343)}
     result = guild.JointGuild(self._owner.baseInfo.id)
     self._owner.quest.specialTaskHandle(ADDGUILDTASKTYPE)
     return result
Ejemplo n.º 4
0
    def refuseGuildApply(self, operator, characterId):
        '''拒绝角色的入会申请
        @param operator: 操作者的id
        @param characterId: int 申请人的id
        '''
        president = self.get('president')
        veteranList = eval('[' + self.guildinfo['veterans'] + ']')
        staffList = eval('[' + self.guildinfo['staffOfficers'] + ']')
        senatorsList = eval('[' + self.guildinfo['senators'] + ']')
        #获取操作者的权限
        if operator == president:
            operatorpost = Lg().g(520)
        elif operator in veteranList:
            operatorpost = Lg().g(519)
        elif operator in staffList:
            operatorpost = Lg().g(518)
        elif operator in senatorsList:
            operatorpost = Lg().g(517)

        managementGroup = veteranList + staffList + senatorsList
        if not dbGuild.checkHasApply(self.id, characterId):
            return -4
        if operator != self.president and operator not in managementGroup:
            return -1  #权限不够
        result = dbGuild.delGuildApplyJoinRecord(self.id, characterId)
        if result:
            player = PlayersManager().getPlayerByID(operator)
            content = Lg().g(533) % (player.baseInfo.getName(), operatorpost,
                                     self.guildinfo.get('nickname', ''))
            title = Lg().g(526)
            m = Mail( title=title,type =0, senderId =-1, receiverId=characterId,\
                            sender = Lg().g(128),content=content)
            m.mailIntoDB()
            tplayer = PlayersManager().getPlayerByID(characterId)
            if tplayer:
                tplayer.quest.specialTaskHandle(ADDGUILDTASKTYPE)
        return 1
Ejemplo n.º 5
0
 def refuseGuildApply(self,operator,characterId):
     '''拒绝角色的入会申请
     @param operator: 操作者的id
     @param characterId: int 申请人的id
     '''
     president = self.get('president')
     veteranList = eval('['+self.guildinfo['veterans']+']')
     staffList = eval('['+self.guildinfo['staffOfficers']+']')
     senatorsList = eval('['+self.guildinfo['senators']+']')
     #获取操作者的权限
     if operator==president:
         operatorpost =Lg().g(520)
     elif operator in veteranList:
         operatorpost = Lg().g(519)
     elif operator in staffList:
         operatorpost = Lg().g(518)
     elif operator in senatorsList:
         operatorpost = Lg().g(517)
     
     managementGroup = veteranList + staffList + senatorsList
     if not dbGuild.checkHasApply(self.id, characterId):
         return -4
     if operator!=self.president and operator not in managementGroup:
         return -1#权限不够
     result = dbGuild.delGuildApplyJoinRecord(self.id, characterId)
     if result:
         player = PlayersManager().getPlayerByID(operator)
         content = Lg().g(533)%(player.baseInfo.getName(),operatorpost,self.guildinfo.get('nickname',''))
         title = Lg().g(526)
         m = Mail( title=title,type =0, senderId =-1, receiverId=characterId,\
                         sender = Lg().g(128),content=content)
         m.mailIntoDB()
         tplayer = PlayersManager().getPlayerByID(characterId)
         if tplayer:
             tplayer.quest.specialTaskHandle(ADDGUILDTASKTYPE)
     return 1
 def UnsubscribeJionGuild(self,guildId):
     '''取消申请'''
     if not dbGuild.checkHasApply(guildId, self._owner.baseInfo.id):
         return {'result':False,'message':Lg().g(344)}
     dbGuild.delGuildApplyJoinRecord(guildId, self._owner.baseInfo.id)
     return {'result':True}