6459 【后端】【2.0】缥缈仙域开发单(进入跨服副本判断及坐标逻辑优化,仙草园进入支持扣除门票)
| | |
| | |
|
| | | playerIDList, dataMapID, mapID, copyMapID, funcLineID = msgData
|
| | |
|
| | | dynamicLineMapDict = IpyGameDataPY.GetFuncEvalCfg("CrossDynamicLineMap", 1)
|
| | | if dataMapID not in dynamicLineMapDict:
|
| | | return
|
| | | mapPosInfo = dynamicLineMapDict[dataMapID][0]
|
| | | posX, posY = mapPosInfo[:2]
|
| | | dist = mapPosInfo[2] if len(mapPosInfo) > 2 else 0
|
| | | if dist > 0:
|
| | | posX, posY = random.randint(posX - dist, posX + dist), random.randint(posY - dist, posY + dist)
|
| | | |
| | | for playerID in playerIDList:
|
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if not curPlayer:
|
| | | continue
|
| | | CrossRealmPlayer.SendCrossRealmReg(curPlayer, dataMapID, mapID, dataMapID, copyMapID, posX, posY, lineID=funcLineID)
|
| | | CrossRealmPlayer.SendCrossRealmReg(curPlayer, dataMapID, mapID, dataMapID, copyMapID, lineID=funcLineID)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | return realMapID, copyMapID, openState
|
| | |
|
| | | dynamicLineMapDict = IpyGameDataPY.GetFuncEvalCfg("CrossDynamicLineMap", 1)
|
| | | if mapID not in dynamicLineMapDict:
|
| | | return
|
| | | dynamicMapIDList = dynamicLineMapDict[mapID][1]
|
| | | dynamicMapIDList = dynamicLineMapDict.get(mapID, [mapID])
|
| | |
|
| | | openMapID, openCopyMapID = 0, 0
|
| | | for realMapID in dynamicMapIDList:
|
| | |
| | | callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnGetFBEnterPos"))
|
| | |
|
| | | if callFunc == None:
|
| | | return
|
| | | |
| | | posInfo = callFunc(curPlayer, mapID, lineId, ipyEnterPosInfo, tick)
|
| | | posInfo = ipyEnterPosInfo
|
| | | else:
|
| | | posInfo = callFunc(curPlayer, mapID, lineId, ipyEnterPosInfo, tick)
|
| | | |
| | | if not posInfo:
|
| | | return
|
| | | enterX, enterY = posInfo[:2]
|
| | |
| | |
|
| | | return callFunc(curPlayer, mapID, lineID)
|
| | |
|
| | | ## 进入跨服副本注册数据前逻辑
|
| | | ## @return: 是否可以注册前往跨服副本,次函数中可以写一些扣除消耗逻辑等
|
| | | def OnRegEnterCrossFB(curPlayer, mapID, lineID):
|
| | | do_FBLogic_ID = __GetFBLogic_MapID(mapID)
|
| | | |
| | | callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnRegEnterCrossFB"))
|
| | | |
| | | if callFunc == None:
|
| | | return True
|
| | | |
| | | return callFunc(curPlayer, mapID, lineID)
|
| | |
|
| | | ## 结束跨服副本
|
| | | def OnEndCrossFB(curPlayer, mapID, lineID, exData):
|
| | |
| | | return
|
| | | return callFunc()
|
| | |
|
| | | ## 是否需要做进入副本通用检查条件逻辑,默认需要检查
|
| | | def OnNeedCheckCanEnterFBComm(curPlayer, mapID, lineID):
|
| | | do_FBLogic_ID = __GetFBLogic_MapID(mapID)
|
| | | |
| | | callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnNeedCheckCanEnterFBComm"))
|
| | | |
| | | if callFunc == None:
|
| | | return True
|
| | | |
| | | return callFunc(curPlayer, mapID, lineID)
|
| | |
|
| | | def OnPlayerLVUp(curPlayer):
|
| | | ## 玩家升级
|
| | | do_FBLogic_ID = __GetFBLogic_MapID(GameWorld.GetMap().GetMapID())
|
| | |
| | | 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:
|
| | | #开服天开放检查
|
| | |
| | |
|
| | | 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
|
| | |
| | | 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):
|
| | |
| | |
|
| | | ## 客户端进入自定义场景
|
| | | 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
|
| | |
| | | import NPCCommon
|
| | | import PlayerControl
|
| | | import ChConfig
|
| | | import FBCommon
|
| | |
|
| | | def DoResetCrossGrassland(curPlayer, eventType, fdeventID):
|
| | | ## 草园重置
|
| | |
| | | NPCCommon.UpdateNPCAttackCount(curPlayer, npcID, 0)
|
| | |
|
| | | return
|
| | | |
| | | def __SetGrasslandVisitState(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 __SetGrasslandVisitState(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]
|
| | |
|
| | | ## 进入跨服副本注册数据前逻辑
|
| | | ## @return: 是否可以注册前往跨服副本,次函数中可以写一些扣除消耗逻辑等
|
| | | def OnRegEnterCrossFB(curPlayer, mapID, lineID):
|
| | | curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
|
| | | if curState == PlayerFairyDomain.FDEventState_CanVisit:
|
| | | delResult = FBCommon.DelFBEnterTicket(curPlayer, mapID, lineID)
|
| | | isOK = delResult[0]
|
| | | if not isOK:
|
| | | return False
|
| | | return PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
|
| | | |
| | | if curState == PlayerFairyDomain.FDEventState_Visiting:
|
| | | return True
|
| | | |
| | | return False
|
| | |
|
| | | ## 跨服功能线路数据缓存,下次开启同样功能线路时会用该数据进行还原之前的副本状态
|
| | | def OnGetCrossFuncLineDataCache():
|
| | |
| | |
|
| | | ## 客户端进入自定义场景
|
| | | def OnEnterCustomScene(curPlayer, mapID, lineID):
|
| | | __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
|
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
|
| | | return
|
| | |
|
| | | def DoCheckUpdateGrasslandEnd(curPlayer):
|
| | |
| | | GameWorld.DebugLog("草园宝箱怪攻击次数未用完! boxNPCID=%s,attackCount=%s < maxAttackCount=%s" % (boxNPCID, attackCount, maxAttackCount))
|
| | | return
|
| | |
|
| | | __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | GameWorld.DebugLog("设置草园已完成!mapID=%s, lineID=%s" % (mapID, lineID))
|
| | | return
|
| | |
|
| | |
| | | if ret != ShareDefine.EntFBAskRet_OK:
|
| | | return
|
| | |
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | for mapIDList in ChConfig.Def_FB_MapID.values():
|
| | | if mapID not in mapIDList:
|
| | | continue
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | if not FBLogic.OnEnterFBEvent(curPlayer, mapID, lineID, tick):
|
| | | GameWorld.DebugLog(" OnEnterFBEvent False!", curPlayer.GetPlayerID())
|
| | | NotifyCode(curPlayer, "SingleEnterDefaul")
|
| | | return
|
| | | break
|
| | | |
| | | |
| | | # 需要动态分布线路的地图,发送到跨服服务器进行分配
|
| | | if mapID in ChConfig.Def_CrossDynamicLineMap:
|
| | | extendInfo = {}
|
| | |
| | |
|
| | | return randomResultList
|
| | |
|
| | | def GetFairyDomainFBEventState(curPlayer, mapID, lineID):
|
| | | ## 获取缥缈相关副本寻访状态
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
|
| | | if not ipyData:
|
| | | return FDEventState_No
|
| | | fdeventID = ipyData.GetID()
|
| | | curState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventState % fdeventID)
|
| | | return curState
|
| | |
|
| | | def SetFairyDomainFBEventState(curPlayer, mapID, lineID, state):
|
| | | ## 设置缥缈相关副本寻访状态
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
|
| | | if not ipyData:
|
| | | return False
|
| | | fdeventID = ipyData.GetID()
|
| | | return SetFairyDomainEventState(curPlayer, fdeventID, state)
|
| | |
|
| | | def SetFairyDomainEventState(curPlayer, fdeventID, state):
|
| | | ## 设置缥缈事件状态, return 是否成功
|
| | |
| | | import CrossPlayerData
|
| | | import NetPackCommon
|
| | | import ChConfig
|
| | | import FBCommon
|
| | | import FBLogic
|
| | |
|
| | |
|
| | | #------------------------------------------------------------------------------
|
| | |
| | | if not mapID:
|
| | | return
|
| | |
|
| | | if not posX and not posY:
|
| | | fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID)
|
| | | if fbLineIpyData:
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | ipyEnterPosInfo = FBCommon.GetFBLineEnterPosInfo(mapID, lineID, fbLineIpyData)
|
| | | retPos = FBLogic.OnGetFBEnterPos(curPlayer, mapID, lineID, ipyEnterPosInfo, tick)
|
| | | if not retPos:
|
| | | GameWorld.ErrLog("未找到进入副本坐标!mapID=%s,lineID=%s" % (mapID, lineID))
|
| | | return
|
| | | posX, posY = retPos
|
| | | |
| | | if not FBLogic.OnRegEnterCrossFB(curPlayer, mapID, lineID):
|
| | | GameWorld.ErrLog("OnRegEnterCrossFB 进入跨服副本注册失败,进入条件不足!无法注册! mapID=%s,lineID=%s" % (mapID, lineID), playerID)
|
| | | return
|
| | | |
| | | #跨服前更新自己所属服务器组ID
|
| | | PlayerControl.UpdPlayerServerGroupID(curPlayer)
|
| | |
|