| | |
| | | import ChItem
|
| | |
|
| | | FBDict_IsOver = 'FBDict_IsOver' #是否已结算, 结算时的tick
|
| | | FBDict_IsPlayerOver = 'IsPlayerOver_%s' #玩家是否已经结算掉落的,参数playerID
|
| | |
|
| | | g_ownerInfo = {} # 归属者信息 {funcLineID:[ownerID, ownerName], }
|
| | |
|
| | | def __SetDemonKingVisitState(curPlayer, mapID, lineID, state):
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
|
| | | if not ipyData:
|
| | | return False
|
| | | eventID = ipyData.GetID()
|
| | | if not PlayerFairyDomain.SetFairyDomainEventState(curPlayer, eventID, state):
|
| | | return False
|
| | | return True
|
| | | ## 是否需要做进入副本通用检查条件逻辑,默认需要检查
|
| | | def OnNeedCheckCanEnterFBComm(curPlayer, mapID, lineID):
|
| | | curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
|
| | | return curState != PlayerFairyDomain.FDEventState_Visiting
|
| | |
|
| | | ## 是否能够通过活动查询进入
|
| | | def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
|
| | | if not __SetDemonKingVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting):
|
| | | return False
|
| | | return True
|
| | | curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
|
| | | return curState in [PlayerFairyDomain.FDEventState_CanVisit, PlayerFairyDomain.FDEventState_Visiting]
|
| | |
|
| | | ## 查询是否可以进入地图
|
| | | def OnChangeMapAsk(ask, tick):
|
| | | return IPY_GameWorld.cmeAccept
|
| | |
|
| | | ## 开启副本
|
| | | def OnOpenFB(tick):
|
| | | return
|
| | |
|
| | | ## 副本玩家进入点
|
| | | # @return posX, posY, 随机半径(可选)
|
| | | def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick):
|
| | | return ipyEnterPosInfo
|
| | | ## 进入跨服副本注册数据前逻辑
|
| | | ## @return: 是否可以注册前往跨服副本,次函数中可以写一些扣除消耗逻辑等
|
| | | def OnRegEnterCrossFB(curPlayer, mapID, lineID):
|
| | | curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
|
| | | if curState == PlayerFairyDomain.FDEventState_CanVisit:
|
| | | return PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
|
| | | |
| | | if curState == PlayerFairyDomain.FDEventState_Visiting:
|
| | | return True
|
| | | |
| | | return False
|
| | |
|
| | | def GetCurFBLineBOSSID(mapID=-1, lineID=-1):
|
| | | #该分线刷的BOSSID
|
| | |
| | | def GetCurFBFuncLineID():
|
| | | ## 获取本线路功能线路ID
|
| | | if GameWorld.IsCrossServer():
|
| | | return GameWorld.GetGameWorld().GetPropertyID() % 10000 / 10
|
| | | return FBCommon.GetCrossDynamicLineMapFuncLineID()
|
| | | return GameWorld.GetGameWorld().GetPropertyID() - 1
|
| | |
|
| | | def GetCurFBLineZoneID():
|
| | | ## 获取本线路所属跨服分区
|
| | | if GameWorld.IsCrossServer():
|
| | | return GameWorld.GetGameWorld().GetPropertyID() / 10000
|
| | | return FBCommon.GetCrossDynamicLineMapZoneID()
|
| | | return 0
|
| | |
|
| | | ## 进副本
|
| | |
| | | zoneID = GetCurFBLineZoneID()
|
| | | funcLineID = GetCurFBFuncLineID()
|
| | | bossID = GetCurFBLineBOSSID(lineID=funcLineID)
|
| | | visitCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainVisitCnt)
|
| | | GameWorld.Log("DoEnterFB zoneID=%s,funcLineID=%s,bossID=%s,visitCount=%s" % (zoneID, funcLineID, bossID, visitCount), playerID)
|
| | | GameWorld.Log("DoEnterFB zoneID=%s,funcLineID=%s,bossID=%s" % (zoneID, funcLineID, bossID), playerID)
|
| | | PyGameData.g_fbPickUpItemDict.pop(playerID, 0)
|
| | | if not GameWorld.IsCrossServer():
|
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, ChConfig.Def_FBMapID_DemonKing, funcLineID, PlayerFairyDomain.FDEventState_Visiting)
|
| | | |
| | | gameFB = GameWorld.GetGameFB()
|
| | | ## 副本已经结束,但是没有结算掉落的玩家直接通知结束
|
| | | if gameFB.GetGameFBDictByKey(FBDict_IsOver) and not gameFB.GetGameFBDictByKey(FBDict_IsPlayerOver % playerID):
|
| | | __NotifyFBOver(curPlayer, 0)
|
| | | return
|
| | |
|
| | | ## 副本总逻辑计时器
|
| | |
| | |
|
| | | ## 关闭副本
|
| | | def OnCloseFB(tick):
|
| | | global g_ownerInfo
|
| | | funcLineID = GetCurFBFuncLineID()
|
| | | g_ownerInfo.pop(funcLineID, None)
|
| | | GameWorld.GetGameWorld().SetPropertyID(0)
|
| | |
| | |
|
| | | ## 执行副本杀怪逻辑
|
| | | def __FBNPCOnKilled(curNPC, tick):
|
| | | global g_ownerInfo
|
| | | |
| | | bossID = curNPC.GetNPCID()
|
| | | funcLineID = GetCurFBFuncLineID()
|
| | | if bossID != GetCurFBLineBOSSID(lineID=funcLineID):
|
| | |
| | | if not curPlayer:
|
| | | continue
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | gameFB.SetGameFBDict(FBDict_IsPlayerOver % playerID, 1)
|
| | | isOwner = playerID == ownerID
|
| | | if isOwner:
|
| | | ownerName = curPlayer.GetPlayerName()
|
| | |
| | | ChItem.DoMapDropItem(curPlayer, giveItemList, bossID, dropPosX, dropPosY, isOnlySelfSee=True, isDropDisperse=True)
|
| | | #curPlayer.Sync_TimeTick(ChConfig.tttPickupItem, 0, ChConfig.Def_FBPickupItemTime, True)
|
| | | if not isCrossServer:
|
| | | __SetDemonKingVisitState(curPlayer, mapID, funcLineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, funcLineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | else:
|
| | | serverGroupID = PlayerControl.GetPlayerServerGroupID(curPlayer)
|
| | | if serverGroupID not in serverGroupIDList:
|
| | |
| | |
|
| | | ## 结束跨服副本
|
| | | def OnEndCrossFB(curPlayer, mapID, lineID, exData):
|
| | | __SetDemonKingVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | return
|
| | |
|
| | | def OnPickUpItem(curPlayer, curItem, tick):
|
| | |
| | | if not isItemAllPickUp:
|
| | | return
|
| | |
|
| | | isPass = 1
|
| | | __NotifyFBOver(curPlayer, 1)
|
| | | return
|
| | |
|
| | | def __NotifyFBOver(curPlayer, isPass):
|
| | | global g_ownerInfo
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | mapID = ChConfig.Def_FBMapID_CrossDemonKing if GameWorld.IsCrossServer() else ChConfig.Def_FBMapID_DemonKing
|
| | | funcLineID = GetCurFBFuncLineID()
|
| | | leaveTick = FBCommon.GetFBLineStepTime(mapID, funcLineID) * 1000
|
| | | ownerID, ownerName = g_ownerInfo.pop(funcLineID, [0, ""])
|
| | | ownerID, ownerName = g_ownerInfo.get(funcLineID, [0, ""])
|
| | | jsonItemList = PyGameData.g_fbPickUpItemDict.pop(playerID, [])
|
| | | overDict = {FBCommon.Over_ownerID:ownerID, FBCommon.Over_ownerName:ownerName, FBCommon.Over_itemInfo:jsonItemList}
|
| | | FBCommon.NotifyFBOver(curPlayer, mapID, funcLineID, isPass, overDict)
|
| | |
| | |
|
| | | ## 客户端进入自定义场景
|
| | | def OnEnterCustomScene(curPlayer, mapID, lineID):
|
| | | __SetDemonKingVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
|
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
|
| | | return
|
| | |
|
| | | ## 客户端发送刷新自定义副本奖励
|
| | |
| | | if visitCount > fakeImmortalCount:
|
| | | GameWorld.DebugLog("当前寻访次数不能获取自定义副本奖励!visitCount=%s" % visitCount)
|
| | | return []
|
| | | if not __SetDemonKingVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting):
|
| | | if not PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting):
|
| | | GameWorld.DebugLog("寻访状态异常不能获取自定义副本奖励!")
|
| | | return []
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
|
| | |
| | | ## 给自定义副本奖励后续处理
|
| | | ## @return: 返回结算副本over信息字典,不含jsonItem信息
|
| | | def OnGiveCustomFBPrizeOK(curPlayer, mapID, lineID):
|
| | | __SetDemonKingVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | ownerID, ownerName = curPlayer.GetPlayerID(), curPlayer.GetPlayerName()
|
| | | overDict = {FBCommon.Over_ownerID:ownerID, FBCommon.Over_ownerName:ownerName}
|
| | | return overDict
|