| | |
| | | def CheckCanEnterFBComm(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, reqEnterCnt=1, isNotify=True, isTeamAsk=False):
|
| | | # 可否进入副本通用检查, 扫荡通用
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | |
| | | if not FBLogic.OnNeedCheckCanEnterFBComm(curPlayer, mapID, lineID):
|
| | | return ShareDefine.EntFBAskRet_OK
|
| | | |
| | | # 总表通用检查
|
| | | if fbIpyData:
|
| | | #开服天开放检查
|
| | |
| | | # @return
|
| | | def SetFBPropertyMark(propertyMark, setPlayer=None):
|
| | | GameWorld.GetGameFB().SetGameFBDict(ChConfig.Map_FBDict_PropertyMark, propertyMark + 1) # 存储时+1才能判断是否存储过
|
| | | if setPlayer != None:
|
| | | PlayerControl.SetFBFuncLineID(setPlayer, propertyMark)
|
| | | GameWorld.DebugLog("SetFBPropertyMark 设置玩家副本功能线路ID: %s" % propertyMark, setPlayer.GetPlayerID())
|
| | | return
|
| | | |
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for index in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(index)
|
| | | if not curPlayer.GetPlayerID():
|
| | | continue
|
| | | PlayerControl.SetFBFuncLineID(curPlayer, propertyMark)
|
| | | GameWorld.DebugLog("SetFBPropertyMark 广播玩家副本功能线路ID: %s" % propertyMark, curPlayer.GetPlayerID())
|
| | | # if setPlayer != None:
|
| | | # PlayerControl.SetFBFuncLineID(setPlayer, propertyMark)
|
| | | # GameWorld.DebugLog("SetFBPropertyMark 设置玩家副本功能线路ID: %s" % propertyMark, setPlayer.GetPlayerID())
|
| | | # return
|
| | | # |
| | | # playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | # for index in xrange(playerManager.GetPlayerCount()):
|
| | | # curPlayer = playerManager.GetPlayerByIndex(index)
|
| | | # if not curPlayer.GetPlayerID():
|
| | | # continue
|
| | | # PlayerControl.SetFBFuncLineID(curPlayer, propertyMark)
|
| | | # GameWorld.DebugLog("SetFBPropertyMark 广播玩家副本功能线路ID: %s" % propertyMark, curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | ## 是否已经扣除入场券/进入次数等
|
| | |
| | | # @return
|
| | | def SetHadDelTicket(curPlayer, delSign=1):
|
| | | GameWorld.GetGameFB().SetPlayerGameFBDict(curPlayer.GetID(), ChConfig.FBPlayerDict_IsDelTicket, delSign)
|
| | | return
|
| | |
|
| | | def SetCustomSceneStart(curPlayer, mapID, lineID):
|
| | | ''' 设置前端自定义场景副本开始时间
|
| | | 某些自定义场景进入可能需要处理某些逻辑,比如扣门票、设置某些状态、完成成就等,这些逻辑在单次进入只能触发一次
|
| | | 需要记录一个开始状态,只在设置成功的时候进行处理这些逻辑,防止断线重连或重登重新进入自定义场景时,重复执行逻辑
|
| | | 该状态设置了一个有效期,暂时设定为15分钟,未完成场景有效期内重复进入不会重复触发
|
| | | 做超时是为了防止玩家没有正常结束场景导致未来的某个时间再次进入场景时无法正常触发进入需要额外处理的逻辑
|
| | | 需根据副本结束时机配置函数 SetCustomSceneOver 设置结束状态
|
| | | @return: 设置成功返回True
|
| | | '''
|
| | | if GetCustomSceneState(curPlayer, mapID, lineID) == ChConfig.CustomSceneState_Fight:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_CustomSceneStartTime % (mapID, lineID), int(time.time()))
|
| | | return True
|
| | |
|
| | | def GetCustomSceneState(curPlayer, mapID, lineID):
|
| | | '''获取前端自定义场景状态
|
| | | @return: 0-无,1-进行中,2-已结束
|
| | | '''
|
| | | startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_CustomSceneStartTime % (mapID, lineID))
|
| | | if not startTime:
|
| | | return ChConfig.CustomSceneState_None
|
| | | if startTime == ChConfig.CustomSceneState_Over:
|
| | | return ChConfig.CustomSceneState_Over
|
| | | # 保留15分钟
|
| | | curTime = int(time.time())
|
| | | return ChConfig.CustomSceneState_Fight if curTime - startTime < 15 * 60 else ChConfig.CustomSceneState_None
|
| | |
|
| | | def SetCustomSceneOver(curPlayer, mapID, lineID):
|
| | | ## 设置前端自定义场景副本结束
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_CustomSceneStartTime % (mapID, lineID), ChConfig.CustomSceneState_Over)
|
| | | return
|
| | |
|
| | | def GetCurSingleFBPlayer():
|
| | |
| | | #可以进入
|
| | | return True
|
| | | #---------------------------------------------------------------------
|
| | | def Sync_FBNPC(mapID=0, npcIDList=[], curPlayer=None):
|
| | | ## 同步当前副本NPC给副本中的所有玩家
|
| | | if not mapID:
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | mapID = GetRecordMapID(mapID)
|
| | | npcCntDict = {}
|
| | | gameNPCManager = GameWorld.GetNPCManager()
|
| | | for index in xrange(gameNPCManager.GetNPCCount()):
|
| | | curNPC = gameNPCManager.GetNPCByIndex(index)
|
| | | npcID = curNPC.GetNPCID()
|
| | | if not npcID:
|
| | | continue
|
| | | if curNPC.GetGameNPCObjType() == IPY_GameWorld.gnotPet:
|
| | | continue
|
| | | if npcIDList and npcID not in npcIDList:
|
| | | continue
|
| | | npcCntDict[npcID] = npcCntDict.get(npcID, 0) + 1
|
| | | |
| | | if curPlayer:
|
| | | NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCntDict)
|
| | | else:
|
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for i in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(i)
|
| | | if curPlayer.GetID() == 0:
|
| | | continue
|
| | | NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCntDict)
|
| | | return npcCntDict
|
| | |
|
| | | ##获得地图上的NPC列表
|
| | | # @param 无参数
|
| | | # @return 返回值, NPC实例列表[curNPC,curNPC,,,,,]
|
| | |
| | | def AddFbEncourageBuff(curPlayer, key, tick, ownerID=0):
|
| | | curPlayerID = curPlayer.GetID()
|
| | | GameWorld.Log("AddFbEncourageBuff() curPlayerID=%s" % curPlayerID)
|
| | | |
| | | ownerID = ownerID or curPlayer.GetID()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | encourageLV = gameFB.GetPlayerGameFBDictByKey(ownerID, key)
|
| | | if not encourageLV:
|
| | |
| | | fbHelpFunc(curPlayer, tick)
|
| | | return
|
| | |
|
| | | def GetCrossDynamicLineMapZoneID():
|
| | | ## 获取跨服动态线路地图本线路跨服分区
|
| | | return GameWorld.GetGameWorld().GetPropertyID() / 10000
|
| | |
|
| | | def GetCrossDynamicLineMapFuncLineID():
|
| | | ## 获取跨服动态线路地图本线路功能线路ID
|
| | | return GameWorld.GetGameWorld().GetPropertyID() % 10000 / 10
|
| | |
|