| | |
| | | Map_Dogzfb_NextNeedTime = "NextNeedTime%s" # 下次刷新需要时间 参数npcid
|
| | | Map_Dogzfb_LastCheckTick = "LastCheckTick" # 上次检查时间
|
| | | Map_Dogzfb_NPCRemainCnt = 'NPCRemainCnt_%s' # NPC剩余数量
|
| | | Map_Dogzfb_CollectLostHPTick = 'CollectLostHPTick' # 采集掉线Tick
|
| | |
|
| | | Map_Dogzfb_CollectLostHPTick = 'CollectLostHPTick' # 采集掉血Tick
|
| | | Map_Dogzfb_CollectLostHPCnt = 'CollectLostHPCnt' # 采集掉血次数
|
| | |
|
| | | ## 是否能够通过活动查询进入
|
| | | # @param curPlayer 玩家实例
|
| | |
| | |
|
| | | return
|
| | |
|
| | | ## 开始采集
|
| | | # @param curPlayer 当前玩家
|
| | | # @param curNPC 当前NPC
|
| | | # @return None or False
|
| | | # @remarks 函数详细说明.
|
| | | def OnBeginCollect(curPlayer, curNPC):
|
| | | playerID = curPlayer.GetID()
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | gameFB.SetPlayerGameFBDict(playerID, Map_Dogzfb_CollectLostHPTick, tick)
|
| | | gameFB.SetPlayerGameFBDict(playerID, Map_Dogzfb_CollectLostHPCnt, 0)
|
| | | return
|
| | |
|
| | | ## 收集中
|
| | | def OnCollecting(curPlayer, tick):
|
| | | tagObj = curPlayer.GetActionObj()
|
| | |
| | |
|
| | | curNPC = GameWorld.GetNPCManager().GetNPCByIndex(tagObj.GetIndex())
|
| | | npcID = curNPC.GetNPCID()
|
| | | __DoCollectLostHP(curPlayer, npcID, tick)
|
| | | return
|
| | |
|
| | | def __DoCollectLostHP(curPlayer, npcID, tick):
|
| | | |
| | | |
| | | playerID = curPlayer.GetID()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | collectLostHPTick = gameFB.GetPlayerGameFBDictByKey(playerID, Map_Dogzfb_CollectLostHPTick)
|
| | |
|
| | | lostHPCnt = gameFB.GetPlayerGameFBDictByKey(playerID, Map_Dogzfb_CollectLostHPCnt)
|
| | | |
| | | lostCD = IpyGameDataPY.GetFuncEvalCfg('DogzFBCollect', 1, {}).get(npcID, 1)
|
| | | lostTime = (tick - collectLostHPTick) / 1000/lostCD # 掉血次数
|
| | | if lostTime >2:
|
| | | gameFB.SetPlayerGameFBDict(playerID, Map_Dogzfb_CollectLostHPTick, tick)
|
| | | return
|
| | | lostTime = (tick - collectLostHPTick) / (1000*lostCD)-lostHPCnt
|
| | |
|
| | | if not lostTime:
|
| | | return
|
| | | gameFB.SetPlayerGameFBDict(playerID, Map_Dogzfb_CollectLostHPTick, tick)
|
| | | gameFB.SetPlayerGameFBDict(playerID, Map_Dogzfb_CollectLostHPCnt, lostHPCnt+lostTime)
|
| | |
|
| | |
|
| | | lostHPPer = IpyGameDataPY.GetFuncEvalCfg('DogzFBCollect', 2, {}).get(npcID, 1)
|
| | |
| | | SkillCommon.SkillLostHP(curPlayer, skillTypeID, buffOwner, lostValue, tick)
|
| | | return
|
| | |
|
| | | ##玩家收集成功(塔, 旗)
|
| | | # @param curPlayer 玩家实例
|
| | | # @param tick 时间戳
|
| | | # @return 无意义
|
| | | # @remarks
|
| | | def OnCollectOK(curPlayer, npcID, tick):
|
| | | __DoCollectLostHP(curPlayer, npcID, tick)
|
| | | return
|
| | |
|
| | | ##---副本总逻辑计时器---
|
| | | # @param tick:时间戳
|
| | |
| | | nextNeedTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_NextNeedTime % npcID)
|
| | | return max(0, nextNeedTime - curTime + lastRefreshTime)
|
| | |
|
| | | def SyncNPCRefreshTime(playerid=0):
|
| | | curTime = int(time.time())
|
| | | def SyncNPCRefreshTime():
|
| | | syncNPCIDList = IpyGameDataPY.GetFuncEvalCfg('DogzFBRefreshCfg', 3)
|
| | | syncDict = {}
|
| | | for npcID in syncNPCIDList:
|
| | | refreshTime = GetDogzNPCRefreshTime(curTime, npcID)
|
| | | syncDict[npcID] = refreshTime
|
| | | msgStr = str([playerid, syncDict])
|
| | | gameWorldMgr = GameWorld.GetGameWorld()
|
| | | lastRefreshTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_LastRefreshTime % npcID)
|
| | | nextNeedTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_NextNeedTime % npcID)
|
| | | syncDict[npcID] = [lastRefreshTime, nextNeedTime]
|
| | | msgStr = str(syncDict)
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'DogzNPCTime', msgStr, len(msgStr))
|
| | | return
|
| | |
|