| | |
| | | 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():
|
| | | ''' 获取当前单人副本玩家 '''
|
| | | curPlayer = None
|