Example #1
0
 def do_player_ex_getMasterInfo(self):
     try:
         userId, err = self.checkBaseParams()
         if err:
             return err.pack()
         ftlog.debug('do_player_ex_getMasterInfo', 
                     'userId=', userId)
         response = PlayerControl.getMasterInfo(userId)
         return response.pack()
     except:
         ftlog.error()
         return PlayerControl.makeResponse(userId, ErrorEnum.ERR_UNKNOWN).pack()
Example #2
0
    def check(self, gameId, userId, clientId, timestamp, **kwargs):

        mo = PlayerControl.getMasterInfo(userId)
        if not mo:
            return False

        masterinfo = mo.getResult('rating')
        ftlog.debug('UserConditionErdayiMasterscore.check', 'userId=', userId,
                    'mo.code=', mo.getResult('code'), 'masterinfo=',
                    masterinfo)
        if not masterinfo:
            return False

        ok = True
        g = float(masterinfo.get('g', '0.0'))
        s = float(masterinfo.get('s', '0.0'))
        r = float(masterinfo.get('r', '0.0'))

        ftlog.debug('UserConditionErdayiMasterscore.check', 'userId=', userId,
                    'minScoreG=', self.minScoreG, 'maxScoreG=', self.maxScoreG,
                    'minScoreS=', self.minScoreS, 'maxScoreS=', self.maxScoreS,
                    'minScoreR=', self.minScoreR, 'maxScoreR=', self.maxScoreR,
                    'g=', g, 's=', s, 'r=', r)

        if (self.minScoreG != None) and self.minScoreG > g:
            ok = False
        if (self.maxScoreG != None) and self.maxScoreG < g:
            ok = False

        if (self.minScoreS != None) and self.minScoreS > s:
            ok = False
        if (self.maxScoreS != None) and self.maxScoreS < s:
            ok = False

        if (self.minScoreR != None) and self.minScoreR > r:
            ok = False
        if (self.maxScoreR != None) and self.maxScoreR < r:
            ok = False

        ftlog.debug('UserConditionErdayiMasterscore.check', 'userId=', userId,
                    'ok=', ok)
        return ok