| | |
| | | import GameWorld
|
| | | import FBCommon
|
| | | import ChConfig
|
| | | import IpyGameDataPY
|
| | | import random
|
| | | #---------------------------------------------------------------------
|
| | | #全局变量
|
| | | #---------------------------------------------------------------------
|
| | |
| | | tagMapID = packCMDList[0] # 目标地图id
|
| | | tagMapLineID = packCMDList[1] # 目标地图线路属性,从0开始
|
| | | resultLineID = -1 # 结果lineID
|
| | | hpPer = -1
|
| | | notifyMark = 'GeRen_chenxin_500807' #不能进的提示
|
| | | if tagMapID in ChConfig.Def_MapID_LineIDToPropertyID:
|
| | | GameWorld.Log(" DoLogic() tagMapID in ChConfig.Def_MapID_LineIDToPropertyID")
|
| | |
| | | maxPlayerCount = FBLogic.GetFBLineMaxPlayerCount(tagMapID, tagMapLineID)
|
| | |
|
| | | GameWorld.Log(" DoLogic() tagMapID=%s,tagMapLineID=%s,maxPlayerCount=%s" % (tagMapID, tagMapLineID,maxPlayerCount))
|
| | | if not maxPlayerCount:
|
| | | pass
|
| | | firstEmptyGameWorld = None
|
| | | sameLineGameWorldList = []
|
| | | sameLineGameWorldList = [] #人数未满的线路列表
|
| | | fullLineGameWorldList = [] #人数已满的线路列表
|
| | | for index in xrange(gameWorldManager.GetGameWorldCount()):
|
| | | gameWorld = IPY_GameWorld.IPY_GameWorld(index)
|
| | | playerManager = gameWorld.GetMapCopyPlayerManagerByFbIndex(index)
|
| | |
| | | firstEmptyGameWorld = gameWorld
|
| | | # 如果不是同一线路属性的,则跳过
|
| | | # 如果当前人数超过额定人数,则跳过
|
| | | if propertyID == tagMapPropertyID and curPlayerCnt < maxPlayerCount:
|
| | | sameLineGameWorldList.append([gameWorld, curPlayerCnt])
|
| | | if propertyID == tagMapPropertyID:
|
| | | if curPlayerCnt < maxPlayerCount:
|
| | | sameLineGameWorldList.append([gameWorld, curPlayerCnt])
|
| | | else:
|
| | | fullLineGameWorldList.append([gameWorld, curPlayerCnt])
|
| | | findGameWorld = None
|
| | | if sameLineGameWorldList:
|
| | | sameLineGameWorldList.sort(key=lambda asd:asd[1])
|
| | | findGameWorld = sameLineGameWorldList[0][0]
|
| | | #若是进入过副本则随机一个,否则选人数最少的一个
|
| | | enterCnt = packCMDList[2]
|
| | | if enterCnt:
|
| | | #GameWorld.DebugLog('DoLogic() sameLineGameWorldList=%s'%len(sameLineGameWorldList))
|
| | | findGameWorld = random.choice(sameLineGameWorldList)[0]
|
| | | else:
|
| | | sameLineGameWorldList.sort(key=lambda asd:asd[1])
|
| | | findGameWorld = sameLineGameWorldList[0][0]
|
| | | |
| | | elif firstEmptyGameWorld:
|
| | | findGameWorld = firstEmptyGameWorld
|
| | | elif fullLineGameWorldList:
|
| | | #线路都满人了则取个人数相对较少的
|
| | | fullLineGameWorldList.sort(key=lambda asd:asd[1])
|
| | | findGameWorld = fullLineGameWorldList[0][0]
|
| | | |
| | | if findGameWorld:
|
| | | if findGameWorld.GetPropertyID() == 0:
|
| | | findGameWorld.SetFBFirstOpen(1) # 开启副本
|
| | |
| | | # GameWorld.DebugLog(" 创建新战盟家园: tagFamilyID=%s,tagFamilyHomeLV=%s,resultLineID=%s"
|
| | | # % (tagFamilyID, tagFamilyHomeLV, resultLineID))
|
| | | #===================================================================================================
|
| | | elif tagMapID in [ChConfig.Def_FBMapID_SealDemon, ChConfig.Def_FBMapID_ZhuXianBoss]:
|
| | | elif tagMapID in [ChConfig.Def_FBMapID_HorsePetBoss, ChConfig.Def_FBMapID_SealDemon, ChConfig.Def_FBMapID_ZhuXianBoss, ChConfig.Def_FBMapID_AllFamilyBoss, ChConfig.Def_FBMapID_DemonKing]:
|
| | | tagMapPropertyID = tagMapLineID + 1 # 因为PropertyID默认是0,所以使用时从1开始
|
| | | resultLineID = -1 # 结果lineID
|
| | |
|
| | |
| | | # 如果不是同一线路属性的,则跳过
|
| | | if propertyID == tagMapPropertyID:
|
| | | if tagMapID == ChConfig.Def_FBMapID_SealDemon:
|
| | | if GameLogic_SealDemon.GetBossRemainHPPer(tagMapLineID, tick) < 15:
|
| | | findGameWord = None
|
| | | findPlayerManager = None
|
| | | notifyMark = "DemonJar_Text4"
|
| | | break
|
| | | hpPer = GameLogic_SealDemon.GetBossRemainHPPer(index, tagMapLineID, tick)
|
| | | |
| | | elif tagMapID == ChConfig.Def_FBMapID_ZhuXianBoss:
|
| | | if GameLogic_ZhuXianBoss.GetBossRemainHPPer(tagMapLineID, tick) < 15:
|
| | | findGameWord = None
|
| | | findPlayerManager = None
|
| | | notifyMark = "DemonJar_Text4"
|
| | | break
|
| | | hpPer = GameLogic_ZhuXianBoss.GetBossRemainHPPer(index, tagMapLineID, tick)
|
| | |
|
| | | findGameWord = gameWorld
|
| | | findPlayerManager = gameWorld
|
| | | findPlayerManager = playerManager
|
| | | break
|
| | | if not findGameWord and propertyID == 0:
|
| | | findGameWord = gameWorld
|
| | | findPlayerManager = gameWorld
|
| | | findPlayerManager = playerManager
|
| | |
|
| | | if findPlayerManager and tagMapID == ChConfig.Def_FBMapID_ZhuXianBoss:
|
| | | if packCMDList[3] !=-1 and not GameLogic_ZhuXianBoss.GetHasSameFamilyMerber(packCMDList[3], findPlayerManager):
|
| | |
| | | #resultLineID = tagMapLineID
|
| | | resultLineID = 0
|
| | |
|
| | | return ['%s' % packCMDList, '%d' % resultLineID, notifyMark]
|
| | | return ['%s' % packCMDList, '%d' % resultLineID, notifyMark, hpPer]
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | |
|
| | |
| | | tagMapInfo = eval(funResult[0])
|
| | | backFBID = int(funResult[1]) # 返回的切图线路id(0~N)
|
| | | notifyMark = funResult[2]
|
| | | hpPer = funResult[3]
|
| | | mapID = tagMapInfo[0] # 请求的切图id
|
| | | funcLineID = tagMapInfo[1] # 请求的场次线路id(0~6)
|
| | | GameWorld.Log("GY_Query_EnterFB DoResult() mapID=%s,funcLineID=%s,backFBID=%s" % (mapID, funcLineID, backFBID), curPlayer.GetPlayerID())
|
| | | GameWorld.Log("GY_Query_EnterFB DoResult() mapID=%s,funcLineID=%s,backFBID=%s,hpPer=%s" % (mapID, funcLineID, backFBID, hpPer), curPlayer.GetPlayerID())
|
| | |
|
| | | if backFBID == -1: # 未找到可进入的分线,则返回,提示人数已满
|
| | | PlayerControl.NotifyCode(curPlayer, notifyMark)
|
| | |
| | | #已在该地图就不让进了
|
| | | return
|
| | |
|
| | | # 非协助玩家进入需要判断boss剩余血量是否允许进入
|
| | | if hpPer >= 0 and not PlayerControl.GetAssistTagPlayerID(curPlayer):
|
| | | minHPPer = 15
|
| | | if mapID == ChConfig.Def_FBMapID_SealDemon:
|
| | | minHPPer = IpyGameDataPY.GetFuncCfg('SealDemonFirstPos', 2)
|
| | | elif mapID == ChConfig.Def_FBMapID_ZhuXianBoss:
|
| | | minHPPer = IpyGameDataPY.GetFuncCfg('ZhuXianBossCntCfg', 4)
|
| | | if hpPer < minHPPer:
|
| | | GameWorld.DebugLog("boss血量少于可进入的最低血量百分比,无法进入!hpPer=%s,minHPPer=%s" % (hpPer, minHPPer))
|
| | | PlayerControl.NotifyCode(curPlayer, "DemonJar_Text4")
|
| | | return
|
| | | |
| | | # 请求进入FB点
|
| | | ipyEnterPosInfo = FBCommon.GetFBLineEnterPosInfo(mapID, funcLineID)
|
| | | retPos = FBLogic.OnGetFBEnterPos(curPlayer, mapID, funcLineID, ipyEnterPosInfo, tick)
|