Ejemplo n.º 1
0
 def __init__(self, fishMgr):
     super(FishArray, self).__init__(fishMgr)
     #基础速度
     self.speed = 90
     #每个环间鱼的间距
     self.interval = 2
     self.initArea = FishInitArea(Point(CENTER_X, CENTER_Y), Point(CENTER_X, CENTER_Y), Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y))
     self.initDatas = [
         #第1批
         FishArrayInit([0], self.speed, 18, 3.5), \
         #第2批
         FishArrayInit([1], self.speed, 18, 3.5), \
         #第3批
         FishArrayInit([0], self.speed, 18, 3.5), \
         #第4批
         FishArrayInit([2], self.speed, 18, 3.5), \
         #第5批
         FishArrayInit([3], self.speed, 18, 3.5), \
         #第6批
         FishArrayInit([5], self.speed, 18, 3.5), \
         #第7批
         FishArrayInit([3], self.speed, 18, 3.5), \
         #第8批
         FishArrayInit([8], self.speed, 12, 3.5), \
         #第9批
         FishArrayInit([15], self.speed, 12, 3.5), \
     ]
     self.dataIdx = 0
     self.longDist = math.sqrt((WIDTH**2) + (HEIGHT**2))/2
Ejemplo n.º 2
0
    def __init__(self, fishMgr):
        super(FishArray, self).__init__(fishMgr)
        #基础速度
        self.speed = 65
        #每个环的半径
        self.radius = 400
        #内环4鱼半径
        self.radiusInner = 160
        self.initArea = FishInitArea(Point(0, CENTER_Y), Point(0, CENTER_Y),
                                     Point(WIDTH, CENTER_Y),
                                     Point(WIDTH, CENTER_Y))
        self.initDatas = [
            #第一环
            FishArrayInit([1], self.speed, self.radius-100, 36), \
            #第二环

            FishArrayInit([10], self.speed, self.radius-90, 18), \
            #第三环

            FishArrayInit([1], self.speed, self.radius-100, 36), \
            #内环

            FishArrayInit([9, 11, 14], self.speed, self.radiusInner, 4, 45), \
        ]
        #外环大鱼与内环大鱼的平行距离
        self.offsetInOut = 460
Ejemplo n.º 3
0
    def genFishs(self):
        self.genFishDatas = []
        centerNLevelNRadius = []
        for area in self.init_areas:
            centerP, direct, endP = area.initArea.getPointNDirect()
            count = len(area.fishLevels)
            levelNedges = []
            for i in xrange(count):
                space = self.space
                level = random.choice(area.fishLevels[i])
                levelData = FISH_LEVELS_DATA[level]
                if i == count - 1:
                    centerP = centerP + (-direct) * (levelData.width/2.0)
                    levelNedges.append((level, centerP))
                else:
                    width = levelData.width
                    if i == count - 2:
                        width = width/4.0
                        space = self.space * 2
                    elif i == 0:
                        space = self.space
                    else:
                        space = self.space / 2
                    centerP = centerP + (-direct) * (width/2.0)
                    levelNedges.append((level, centerP))
                    centerP = centerP + (-direct) * (width/2.0 + space)
            levelNRadius = []
            for level, edgeP in levelNedges:
                levelNRadius.append((level, centerP.getDist(edgeP)))
            centerNLevelNRadius.append((centerP, levelNRadius))

        longestDuration = 0
        for idx, area in enumerate(self.init_areas):
            centerP, levelNRadius = centerNLevelNRadius[idx]
            initP, direct, endP = area.initArea.getPointNDirect()
            #获取初始角度
            rad = direct.toRadian()
            initRot = math.degrees(rad)
            for i in xrange(len(levelNRadius)):
                level, radius = levelNRadius[i]
                deltaAngle = (math.pi*2)/area.counts[i]
                levelData = FISH_LEVELS_DATA[level]
                for i in xrange(area.counts[i]):
                    offsetDir = direct.rotateSelfByRadian(deltaAngle*i).normalize()
                    startP = centerP + (offsetDir*radius)
                    curEndP = Point(endP.x, startP.y) + direct * (levelData.width/2.0)
                    duration = curEndP.getDist(startP)/area.speed
                    #优化,把初始化位置都设到屏幕外半个身位
                    realStartP = Point(initP.x, startP.y) + (-direct) * (levelData.width/2.0)
                    realDuration = curEndP.getDist(realStartP)/area.speed
                    if duration > longestDuration:
                        longestDuration = duration
                    self.genFishDatas.append(fish_array.FishInitData(0, level, levelData.order, initRot, \
                        realStartP.x, realStartP.y, realDuration, levelData.getMulti(), levelData.getPickedRate(), 0, \
                        pbAppendRoute([], 0, area.speed, realDuration + TOLERATE_LAG_SECS), \
                        fish_array.FISH_ARRAY_APPEAR_TICK + (duration - realDuration)*1000))

        self.duration = longestDuration + TOLERATE_LAG_SECS
        super(FishArray, self).genFishs()
Ejemplo n.º 4
0
 def __init__(self, fishMgr):
     super(FishArray, self).__init__(fishMgr)
     #基础速度
     self.speed = 54
     #每个环间鱼的间距
     self.space = -20
     self.init_areas = [
         #左边的环
         FishArrayInit(FishInitArea(Point(0, CENTER_Y), Point(0, CENTER_Y), Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y)), [[3], [7], [12], [16]], self.space, self.speed, [48, 30, 12, 1]), \
         #右边的环
         FishArrayInit(FishInitArea(Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y), Point(0, CENTER_Y), Point(0, CENTER_Y)), [[3], [7], [12], [17]], self.space, self.speed, [48, 30, 12, 1]), \
     ]
Ejemplo n.º 5
0
 def __init__(self, fishMgr):
     super(FishArray, self).__init__(fishMgr)
     self.init_stop_areas = [
         StopFishArrayInit(
             FishInitArea(Point(0, CENTER_Y), Point(0, CENTER_Y),
                          Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y)),
             19, 0, 120, Point(WIDTH / 4, CENTER_Y), 10),
     ]
     self.init_rotate_areas = [
         RotateFishArrayInit(
             FishInitArea(Point(WIDTH / 4 * 3 - 100, HEIGHT),
                          Point(WIDTH / 4 * 3 - 100, HEIGHT),
                          Point(WIDTH / 4 * 3 - 100, 0),
                          Point(WIDTH / 4 * 3 - 100, 0)), 1, 1, 100,
             Point(WIDTH / 4 * 3 - 100, CENTER_Y), 1, 100, 10),
     ]
Ejemplo n.º 6
0
    def onFire(self, player, timestamp, dirX, dirY, bulletIds, gunType):
        print "======================================================="
        print "on fire:          player.coin:%s" % player.coin
        print "======================================================="

        _timestamp = self.__checkTimestamp(timestamp)
        if not _timestamp:
            player.invalidCounter('player[%s] game timestamp invalid.' %
                                  (player.nickname))
            return

        if len(bulletIds) not in (1, 3):
            log(
                u'player[%s] fire bulletIds[%s] is invalid.' %
                (player.nickname, bulletIds), LOG_LEVEL_RELEASE)
            return

        if gunType == GUN_TYPE_FREE and gunType != player.gunType:
            log(
                u'player[%s] fire gunType is not matched[%s != %s].' %
                (player.nickname, gunType, player.gunType), LOG_LEVEL_RELEASE)
            return

        if gunType != GUN_TYPE_FREE and player.coin < player.gunCoin:
            log(
                u'[try fire]player[%s] coin[%d]-[%d] is not enough.' %
                (player.nickname, player.coin, player.gunCoin),
                LOG_LEVEL_RELEASE)
            return

        #子弹id校验
        for bulletId in bulletIds:
            bullet = self.bulletMgr.get(bulletId)
            if bullet:
                log(
                    u'player[%s] fire bulletId[%d] already existed.' %
                    (player.nickname, bulletId), LOG_LEVEL_RELEASE)
                return

        player.gunDirX = dirX
        player.gunDirY = dirY

        for bulletId in bulletIds:
            bullet = Bullet(player.chair, player.gunLevel, player.gunCoin, \
                player.gunCoin if player.gunType != GUN_TYPE_FREE else 0, \
                timestamp, Point(0, 0), Point(dirX, dirY), \
                DOUBLE_COIN_RATE if player.gunType == GUN_TYPE_DOUBLE else 1, \
                FREEZE_SPEED_RATE if player.gunType == GUN_TYPE_FREEZE else 1)
            self.bulletMgr.add(bulletId, bullet)

        fireProto = pickfish_pb2.S_C_Fire()
        fireProto.timestamp = timestamp
        fireProto.bulletIds.extend(bulletIds)
        fireProto.side = player.chair
        fireProto.dirX = player.gunDirX
        fireProto.dirY = player.gunDirY
        fireProto.gunType = gunType
        self.sendExclude((player, ), fireProto)
        #self.sendAll(fireProto)
        # 开火之后发一次当前的金币记录
        coinRefresh = pickfish_pb2.S_C_CoinRefresh()
        coinRefresh.side = player.chair
        coinRefresh.deltaCoin = formatCoin(-bullet.realCoin)
        self.sendAll(coinRefresh)

        # 奖池代码
        # divided = float(bullet.realCoin * 0.003)
        # player.curDivied += divided
        # player.curPrizePool += int(bullet.realCoin - divided)
        # self.PrizePool += int(bullet.realCoin - divided)

        # 计算该玩家的输赢情况
        # loseCoin = player.initCoin - player.coin
        # botScore = player.initCoin * self.pump

        # print(u"玩家金币:%s, 输赢情况:%s, 机率情况:%s" % (player.coin, loseCoin, botScore))
        #uppScore = player.initCoin / 0.997
        #if loseCoin > 0:
        # 输钱
        # number = (player.chanceInterface - player.chanceDefault) / player.chanceDefault

        # 根据金币百分比或弹头百分比调整捕获
        # 预设值
        preset_value = float(self.redis.get('fish:preset:value') or 0.996)
        #  弹头场 (新手场)
        if self.server.field_type == '1':
            tpo = float(self.redis.get('test:%s:play:out' % player.uid) or 0)
            tpi = float(self.redis.get('test:%s:play:in' % player.uid) or 0)
            warhead_rate = tpo / (tpi or 1)
            if warhead_rate > preset_value:
                player.downChance()
            elif warhead_rate < preset_value:
                player.upChance()
            else:
                player.clearChance()
        # 排位场
        else:
            cpo = float(self.redis.get('user:%s:play:out' % player.uid) or 0)
            cpi = float(self.redis.get('user:%s:play:in' % player.uid) or 0)
            coin_rate = cpo / (cpi or 1)
            if coin_rate > preset_value:
                player.downChance()
            elif coin_rate < preset_value:
                player.upChance()
            else:
                player.clearChance()

        # if player.coin < botScore:
        #     player.upChance()
        # if not player.lastBotScore:
        #     player.lastBotScore = botScore
        #     if player.coin < botScore:
        #         player.upChance()
        # else:
        #     botScore = player.lastBotScore * 0.9
        #     if player.coin < botScore:
        #         player.upChance()
        #         player.lastBotScore = botScore

        # else:
        #     player.clearChance()
        #if player.coin > uppScore:
        #    player.clearChance()

        log(
            u'player[%s] fire coin[%s] timestamp[%d] bulletId[%d] dir[%f,%f].'
            % (player.nickname, player.gunCoin if gunType != GUN_TYPE_FREE else
               0, timestamp, bulletId, dirX, dirY), LOG_LEVEL_RELEASE)
Ejemplo n.º 7
0
    def genFishs(self):
        self.genFishDatas = []
        centerLevelNPoints = [None] * len(self.initDatas)
        initP, direct, endP = self.initArea.getPointNDirect()
        centerP = initP * 1.0
        initData = self.initDatas[0]
        #获取初始角度
        rad = direct.toRadian()
        initRot = math.degrees(rad)
        level = random.choice(initData.fishLevels)
        levelData = FISH_LEVELS_DATA[level]
        centerP = centerP + (-direct) * (levelData.width / 2.0 +
                                         initData.radius)
        centerLevelNPoints[0] = (level, centerP)
        centerP = centerP + (-direct) * (levelData.width / 2.0 +
                                         initData.radius)
        initData = self.initDatas[1]
        level = random.choice(initData.fishLevels)
        centerLevelNPoints[1] = (level, centerP)
        initData = self.initDatas[3]
        level = random.choice(initData.fishLevels)
        centerLevelNPoints[3] = (level, centerP)
        initData = self.initDatas[2]
        level = random.choice(initData.fishLevels)
        levelData = FISH_LEVELS_DATA[level]
        centerP = centerP + (-direct) * (levelData.width / 2.0 +
                                         initData.radius)
        centerLevelNPoints[2] = (level, centerP)

        #外环大鱼
        fishLevelAmbient = random.choice([20, 21])
        levelDataAmbient = FISH_LEVELS_DATA[fishLevelAmbient]

        longestDuration = 0
        endIdx = len(self.initDatas) - 1
        for idx, initData in enumerate(self.initDatas):
            level, centerP = centerLevelNPoints[idx]
            deltaAngle = (math.pi * 2) / initData.count
            levelData = FISH_LEVELS_DATA[level]
            offsetRad = math.radians(initData.offsetAngle)
            for i in xrange(initData.count):
                offsetDir = direct.rotateSelfByRadian(offsetRad + deltaAngle *
                                                      i).normalize()
                startP = centerP + (offsetDir * initData.radius)
                curEndP = Point(endP.x,
                                startP.y) + direct * (levelData.width / 2.0)
                duration = curEndP.getDist(startP) / initData.speed
                #优化,把初始化位置都设到屏幕外半个身位
                realStartP = Point(
                    initP.x, startP.y) + (-direct) * (levelData.width / 2.0)
                realDuration = curEndP.getDist(realStartP) / initData.speed
                if duration > longestDuration:
                    longestDuration = duration
                self.genFishDatas.append(fish_array.FishInitData(0, level, levelData.order, initRot, \
                    realStartP.x, realStartP.y, realDuration, levelData.getMulti(), levelData.getPickedRate(), 0, \
                    pbAppendRoute([], 0, initData.speed, realDuration + TOLERATE_LAG_SECS), \
                    fish_array.FISH_ARRAY_APPEAR_TICK + (duration - realDuration)*1000))
                if idx == endIdx:
                    if i in (1, 2):
                        offsetDir = -direct
                    else:
                        offsetDir = direct
                    startP = startP + (offsetDir * self.offsetInOut)
                    curEndP = Point(
                        endP.x,
                        startP.y) + direct * (levelDataAmbient.width / 2.0)
                    duration = curEndP.getDist(startP) / initData.speed
                    #优化,把初始化位置都设到屏幕外半个身位
                    realStartP = Point(
                        initP.x,
                        startP.y) + (-direct) * (levelData.width / 2.0)
                    realDuration = curEndP.getDist(realStartP) / initData.speed
                    if duration > longestDuration:
                        longestDuration = duration
                    self.genFishDatas.append(fish_array.FishInitData(0, fishLevelAmbient, levelDataAmbient.order, initRot, \
                        realStartP.x, realStartP.y, realDuration, levelDataAmbient.getMulti(), levelDataAmbient.getPickedRate(), 0, \
                        pbAppendRoute([], 0, initData.speed, realDuration + TOLERATE_LAG_SECS), \
                        fish_array.FISH_ARRAY_APPEAR_TICK + (duration - realDuration)*1000))

        self.duration = longestDuration + TOLERATE_LAG_SECS
        super(FishArray, self).genFishs()
Ejemplo n.º 8
0
(0,0)点在屏幕左下角,屏幕分辨率1280x720

(0,720)______(1280,720)
        |屏幕|
        |____|
   (0,0)      (1280,0)

WIDTH       =   1280
HEIGHT      =   720
CENTER_X    =   WIDTH/2
CENTER_Y    =   HEIGHT/2
"""

FISh_INIT_AREAS = [
    #左下角靠左
    FishInitArea(Point(0, 0), Point(0, 320), Point(WIDTH, CENTER_Y), Point(WIDTH, HEIGHT)), \
    #下方1

    FishInitArea(Point(265, 0), Point(425, 0), Point(0, HEIGHT), Point(WIDTH-320, HEIGHT)), \
    #下方2

    FishInitArea(Point(665, 0), Point(845, 0), Point(320, HEIGHT), Point(WIDTH, HEIGHT)), \
    #右下角靠下

    FishInitArea(Point(1065, 0), Point(WIDTH, 0), Point(0, HEIGHT), Point(CENTER_X, HEIGHT)), \
    #右下角靠右

    FishInitArea(Point(WIDTH, 0), Point(WIDTH, 190), Point(0, CENTER_Y), Point(0, HEIGHT)), \
    #正右

    FishInitArea(Point(WIDTH, CENTER_Y-100), Point(WIDTH, CENTER_Y+100), Point(0, 0), Point(0, HEIGHT)), \
Ejemplo n.º 9
0
    def __init__(self, fishMgr):
        super(FishArray, self).__init__(fishMgr)
        #横向队列间距
        self.spacePerHori = 300
        #横向队列移动速度
        self.speedPerHori = 72
        #竖向队列间距
        self.spacePerVert = 120
        #竖向队列移动速度
        self.speedPerVert = 144
        self.init_areas = [
            #横向第一条阵列
            fish_array.FishArrayInit(FishInitArea(Point(0 - HORI_WAITTING_VERT_TIME*self.speedPerHori, CENTER_Y-150), Point(0 - HORI_WAITTING_VERT_TIME*self.speedPerHori, CENTER_Y-150), Point(WIDTH, CENTER_Y-150), Point(WIDTH, CENTER_Y-150)), [7,7,7,10,10,10,11,11,11,13,13,13], self.speedPerHori), \
            #横向第二条阵列

            fish_array.FishArrayInit(FishInitArea(Point(-175 - HORI_WAITTING_VERT_TIME*self.speedPerHori, CENTER_Y), Point(-175 - HORI_WAITTING_VERT_TIME*self.speedPerHori, CENTER_Y), Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y)), [16,31,17,18], self.speedPerHori), \
            #横向第三条阵列

            fish_array.FishArrayInit(FishInitArea(Point(0 - HORI_WAITTING_VERT_TIME*self.speedPerHori, CENTER_Y+150), Point(0 - HORI_WAITTING_VERT_TIME*self.speedPerHori, CENTER_Y+150), Point(WIDTH, CENTER_Y+150), Point(WIDTH, CENTER_Y+150)), [7,7,7,10,10,10,11,11,11,13,13,13], self.speedPerHori), \
            #横向第四条阵列
            # fish_array.FishArrayInit(FishInitArea(Point(-175, 585), Point(-175, 585), Point(WIDTH, 585), Point(WIDTH, 585)), [9, 11, 15, 16, 17, 18], self.speedPerHori), \
            #竖向第一条队列



            fish_array.FishArrayInit(FishInitArea(Point(210, HEIGHT), Point(210, HEIGHT), Point(210, 0), Point(210, 0)), [3, 4, 9, 0], self.speedPerVert), \
            #竖向第二条队列

            fish_array.FishArrayInit(FishInitArea(Point(430, 0), Point(430, 0), Point(430, HEIGHT), Point(430, HEIGHT)), [3, 4, 9, 0], self.speedPerVert), \
            #竖向第三条队列

            fish_array.FishArrayInit(FishInitArea(Point(640, HEIGHT), Point(640, HEIGHT), Point(640, 0), Point(640, 0)), [3, 4, 9, 0], self.speedPerVert), \
            #竖向第四条队列

            fish_array.FishArrayInit(FishInitArea(Point(850, 0), Point(850, 0), Point(850, HEIGHT), Point(850, HEIGHT)), [3, 4, 9, 0], self.speedPerVert), \
            #竖向第五条队列

            fish_array.FishArrayInit(FishInitArea(Point(1068, HEIGHT), Point(1068, HEIGHT), Point(1068, 0), Point(1068, 0)), [3, 4, 9, 0], self.speedPerVert), \
        ]
Ejemplo n.º 10
0
    def __init__(self, fishMgr):
        super(FishArray, self).__init__(fishMgr)
        #左到右队列间距
        self.L2RPerHori = 14
        #左到右队列移动速度
        self.L2RSpeedPerVert = 144
        #右到左队列间距
        self.R2LPerHori = 24
        #右到左队列移动速度
        self.R2LSpeedPerVert = 144
        self.init_areas = [
            #右到左第一条阵列
            fish_array.FishArrayInit(FishInitArea(Point(WIDTH, CENTER_Y+WINDTH_AROUND+WINDTH_LNR), Point(WIDTH, CENTER_Y+WINDTH_AROUND+WINDTH_LNR), Point(0, CENTER_Y+WINDTH_AROUND+WINDTH_LNR), Point(0, CENTER_Y+WINDTH_AROUND+WINDTH_LNR)), [3], self.R2LSpeedPerVert), \
            #左到右第一条阵列

            fish_array.FishArrayInit(FishInitArea(Point(0, CENTER_Y+WINDTH_AROUND), Point(0, CENTER_Y+WINDTH_AROUND), Point(WIDTH, CENTER_Y+WINDTH_AROUND), Point(WIDTH, CENTER_Y+WINDTH_AROUND)), [0], self.L2RSpeedPerVert), \
            #左到右第二条阵列

            fish_array.FishArrayInit(FishInitArea(Point(0, CENTER_Y-WINDTH_AROUND), Point(0, CENTER_Y-WINDTH_AROUND), Point(WIDTH, CENTER_Y-WINDTH_AROUND), Point(WIDTH, CENTER_Y-WINDTH_AROUND)), [0], self.L2RSpeedPerVert), \
            #右到左第二条阵列

            fish_array.FishArrayInit(FishInitArea(Point(WIDTH, CENTER_Y-WINDTH_AROUND-WINDTH_LNR), Point(WIDTH, CENTER_Y-WINDTH_AROUND-WINDTH_LNR), Point(0, CENTER_Y-WINDTH_AROUND-WINDTH_LNR), Point(0, CENTER_Y-WINDTH_AROUND-WINDTH_LNR)), [3], self.R2LSpeedPerVert), \
        ]
        for i, areaData in enumerate(self.init_areas):
            if i in (0, 3):
                areaData.spacePerHori = self.R2LPerHori
            else:
                areaData.spacePerHori = self.L2RPerHori
        self.other_init_areas = [
            FishArrayInit(FishInitArea(Point(0, CENTER_Y), Point(0, CENTER_Y), Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y)), [11], [18/2,0], self.L2RSpeedPerVert/2, [2,1]), \
            FishArrayInit(FishInitArea(Point(-CENTER_X+80, CENTER_Y), Point(-CENTER_X+80, CENTER_Y), Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y)), [2], [30,250], self.L2RSpeedPerVert/2, [3,2]), \
            FishArrayInit(FishInitArea(Point(-CENTER_X+80, CENTER_Y), Point(-CENTER_X+80, CENTER_Y), Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y)), [2], [80,35], self.L2RSpeedPerVert/2, [2,7]), \
            FishArrayInit(FishInitArea(Point(-CENTER_X+310, CENTER_Y), Point(-CENTER_X+310, CENTER_Y), Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y)), [18], [0,0], self.L2RSpeedPerVert/2, [1,1]), \
            FishArrayInit(FishInitArea(Point(-WIDTH+350, CENTER_Y), Point(-WIDTH+350, CENTER_Y), Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y)), [15], [0,0], self.L2RSpeedPerVert/2, [1,1]), \
            FishArrayInit(FishInitArea(Point(-WIDTH+235, CENTER_Y), Point(-WIDTH+235, CENTER_Y), Point(WIDTH, CENTER_Y), Point(WIDTH, CENTER_Y)), [9], [50,0], self.L2RSpeedPerVert/2, [2,1]), \
        ]
Ejemplo n.º 11
0
    def onFire(self, player, timestamp, dirX, dirY, bulletIds, gunType):
        _timestamp = self.__checkTimestamp(timestamp)
        if not _timestamp:
            player.invalidCounter('player[%s] game timestamp invalid.'%(player.nickname))
            return

        if len(bulletIds) not in (1, 3):
            log(u'player[%s] fire bulletIds[%s] is invalid.'%(player.nickname, bulletIds), LOG_LEVEL_RELEASE)
            return

        if gunType == GUN_TYPE_FREE and gunType != player.gunType:
            log(u'player[%s] fire gunType is not matched[%s != %s].'%(player.nickname, gunType, player.gunType), LOG_LEVEL_RELEASE)
            return

        if gunType != GUN_TYPE_FREE and player.coin < player.gunCoin:
            log(u'[try fire]player[%s] coin[%d]-[%d] is not enough.'%(player.nickname, player.coin, player.gunCoin), LOG_LEVEL_RELEASE)
            return

        #子弹id校验
        for bulletId in bulletIds:
            bullet = self.bulletMgr.get(bulletId)
            if bullet:
                log(u'player[%s] fire bulletId[%d] already existed.'%(player.nickname, bulletId), LOG_LEVEL_RELEASE)
                return

        player.gunDirX = dirX
        player.gunDirY = dirY

        for bulletId in bulletIds:
            bullet = Bullet(player.chair, player.gunLevel, player.gunCoin, \
                player.gunCoin if player.gunType != GUN_TYPE_FREE else 0, \
                timestamp, Point(0, 0), Point(dirX, dirY), \
                DOUBLE_COIN_RATE if player.gunType == GUN_TYPE_DOUBLE else 1, \
                FREEZE_SPEED_RATE if player.gunType == GUN_TYPE_FREEZE else 1)
            self.bulletMgr.add(bulletId, bullet)

        fireProto = pickfish_pb2.S_C_Fire()
        fireProto.timestamp = timestamp
        fireProto.bulletIds.extend(bulletIds)
        fireProto.side = player.chair
        fireProto.dirX = player.gunDirX
        fireProto.dirY = player.gunDirY
        fireProto.gunType = gunType
        self.sendExclude((player,), fireProto)
        # 开火之后发一次当前的金币记录
        coinRefresh = pickfish_pb2.S_C_CoinRefresh()
        coinRefresh.side = player.chair
        coinRefresh.deltaCoin = formatCoin(-bullet.realCoin)
        self.sendAll(coinRefresh)

        # 奖池代码
        divided = float(bullet.realCoin * 0.003)
        player.curDivied += divided
        player.curPrizePool += int(bullet.realCoin - divided)
        self.PrizePool += int(bullet.realCoin - divided)

        # 计算该玩家的输赢情况
        loseCoin = player.initCoin - player.coin
        botScore = player.initCoin * self.pump

        print(u"玩家金币:%s, 输赢情况:%s, 机率情况:%s" % (player.coin, loseCoin, botScore))
        #uppScore = player.initCoin / 0.997
        #if loseCoin > 0:
            # 输钱
            # number = (player.chanceInterface - player.chanceDefault) / player.chanceDefault
        if player.coin < botScore:
            player.upChance()
            # if not player.lastBotScore:
            #     player.lastBotScore = botScore
            #     if player.coin < botScore:
            #         player.upChance()
            # else:
            #     botScore = player.lastBotScore * 0.9
            #     if player.coin < botScore:
            #         player.upChance()
            #         player.lastBotScore = botScore

        else:
            player.clearChance()
            #if player.coin > uppScore:
            #    player.clearChance()

        log(u'player[%s] fire coin[%s] timestamp[%d] bulletId[%d] dir[%f,%f].'%(player.nickname, player.gunCoin if gunType != GUN_TYPE_FREE else 0, timestamp, bulletId, dirX, dirY), LOG_LEVEL_RELEASE)