| | |
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2019-04-15 16:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import GameWorldProcess
|
| | | import PlayerFairyDomain
|
| | | import NPCCustomRefresh
|
| | | import IpyGameDataPY
|
| | | import PyGameData
|
| | | import NPCCommon
|
| | | import PlayerControl
|
| | | import ChConfig
|
| | | import FBCommon
|
| | |
|
| | | FBDict_SyncFBNPC = 'SyncFBNPC' #是否需要同步副本NPC
|
| | |
|
| | | def DoResetCrossGrassland(curPlayer, eventType, fdeventID):
|
| | | ## 草园重置
|
| | | |
| | | resetCollectType = 10 + eventType
|
| | | NPCCommon.DoResetCollectNPCTimeByType(curPlayer, [resetCollectType])
|
| | | |
| | | # 宝箱怪次数重置
|
| | | if eventType == PlayerFairyDomain.FDEventType_GrasslandXian:
|
| | | npcID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
|
| | | if npcID:
|
| | | NPCCommon.UpdateNPCAttackCount(curPlayer, npcID, 0)
|
| | | |
| | | return
|
| | |
|
| | | ## 是否需要做进入副本通用检查条件逻辑,默认需要检查
|
| | | def OnNeedCheckCanEnterFBComm(curPlayer, mapID, lineID):
|
| | | curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
|
| | | return curState != PlayerFairyDomain.FDEventState_Visiting
|
| | |
|
| | | def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
|
| | | 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():
|
| | | refreshNPCInfo = NPCCustomRefresh.GetCopyMapRandomRefreshNPCInfo()
|
| | | return refreshNPCInfo
|
| | |
|
| | | ## 开启副本
|
| | | def OnOpenFB(tick):
|
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | realMapID, copyMapID = gameWorld.GetRealMapID(), gameWorld.GetCopyMapID()
|
| | | key = (realMapID, copyMapID)
|
| | | if key in PyGameData.g_crossFuncLineDataCache:
|
| | | refreshNPCInfo = PyGameData.g_crossFuncLineDataCache.pop(key)
|
| | | GameWorld.DebugLog("副本开启根据保存的虚拟线路标试点刷怪信息刷怪: realMapID=%s,copyMapID=%s,refreshNPCInfo=%s" % (realMapID, copyMapID, refreshNPCInfo))
|
| | | NPCCustomRefresh.OnFBOpenSetRandomRefreshNPCInfo(refreshNPCInfo, tick)
|
| | | |
| | | return
|
| | |
|
| | | ## 进副本
|
| | | def DoEnterFB(curPlayer, tick):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | zoneID = FBCommon.GetCrossDynamicLineMapZoneID()
|
| | | funcLineID = FBCommon.GetCrossDynamicLineMapFuncLineID()
|
| | | crossMapID = PlayerControl.GetCrossMapID(curPlayer)
|
| | | GameWorld.Log("DoEnterFB zoneID=%s,funcLineID=%s,crossMapID=%s" % (zoneID, funcLineID, crossMapID), playerID)
|
| | | FBCommon.Sync_FBNPC(curPlayer=curPlayer)
|
| | | if crossMapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
|
| | | boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
|
| | | if boxNPCID:
|
| | | NPCCommon.SyncNPCAttackCount(curPlayer, [boxNPCID])
|
| | | return
|
| | |
|
| | | ## 副本总逻辑计时器
|
| | | def OnProcess(tick):
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | if gameFB.GetGameFBDictByKey(FBDict_SyncFBNPC):
|
| | | gameFB.SetGameFBDict(FBDict_SyncFBNPC, 0)
|
| | | FBCommon.Sync_FBNPC()
|
| | | |
| | | return
|
| | | #
|
| | | ### 关闭副本
|
| | | #def OnCloseFB(tick):
|
| | | # return
|
| | | #
|
| | | ### 玩家退出副本
|
| | | #def DoExitFB(curPlayer, tick):
|
| | | # return
|
| | |
|
| | | ##玩家主动离开副本.
|
| | | def DoPlayerLeaveFB(curPlayer, tick):
|
| | | |
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | #最后一人退出副本则关闭地图
|
| | | if gameWorld.GetMapCopyPlayerManager().GetPlayerCount() == 1:
|
| | | GameWorldProcess.CloseFB(tick)
|
| | | |
| | | return
|
| | |
|
| | | ## 客户端进入自定义场景
|
| | | def OnEnterCustomScene(curPlayer, mapID, lineID):
|
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
|
| | | return
|
| | |
|
| | | def DoCheckUpdateGrasslandEnd(curPlayer):
|
| | | ## 检查更新草园已拜访完成
|
| | | |
| | | grasslandMapIDList = [ChConfig.Def_FBMapID_CrossGrasslandLing, ChConfig.Def_FBMapID_CrossGrasslandXian]
|
| | | crossMapID = PlayerControl.GetCrossMapID(curPlayer)
|
| | | clientCustomSceneMapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID)
|
| | | if crossMapID in grasslandMapIDList:
|
| | | mapID = crossMapID
|
| | | lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqCrossFBFuncLine)
|
| | | elif clientCustomSceneMapID in grasslandMapIDList:
|
| | | mapID = clientCustomSceneMapID
|
| | | lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID)
|
| | | else:
|
| | | return
|
| | | |
| | | # 采集次数是否已用完
|
| | | collNPCIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("MapRefreshNPC", mapID)
|
| | | if not collNPCIpyDataList:
|
| | | return
|
| | | |
| | | for collIpyData in collNPCIpyDataList:
|
| | | npcIDList = collIpyData.GetNPCIDList()
|
| | | for npcID in npcIDList:
|
| | | collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
|
| | | if not collectNPCIpyData:
|
| | | return
|
| | | limitMaxTime = collectNPCIpyData.GetMaxCollectCount()
|
| | | totalCollTime = NPCCommon.GetTodayCollectCount(curPlayer, npcID)
|
| | | if totalCollTime < limitMaxTime:
|
| | | GameWorld.DebugLog("草园NPC采集次数未用完! npcID=%s,totalCollTime=%s < limitMaxTime=%s" % (npcID, totalCollTime, limitMaxTime))
|
| | | return
|
| | | |
| | | # 宝箱怪攻击次数是否已用完
|
| | | if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
|
| | | boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
|
| | | boxNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("TreasureNPC", boxNPCID)
|
| | | if not boxNPCIpyData:
|
| | | return
|
| | | attackCountDropWeightInfo = boxNPCIpyData.GetAttackCountDropWeightInfo()
|
| | | if not attackCountDropWeightInfo:
|
| | | return
|
| | | maxAttackCount = max(attackCountDropWeightInfo)
|
| | | attackCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCAttackCount % boxNPCID)
|
| | | if attackCount < maxAttackCount:
|
| | | GameWorld.DebugLog("草园宝箱怪攻击次数未用完! boxNPCID=%s,attackCount=%s < maxAttackCount=%s" % (boxNPCID, attackCount, maxAttackCount))
|
| | | return
|
| | | |
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | GameWorld.DebugLog("设置草园已完成!mapID=%s, lineID=%s" % (mapID, lineID))
|
| | | return
|
| | |
|
| | | def DoFB_NPCDead(curNPC):
|
| | | #GameWorld.DebugLog("DoFB_NPCDead 设置需要同步副本NPC!")
|
| | | GameWorld.GetGameFB().SetGameFBDict(FBDict_SyncFBNPC, 1)
|
| | | return
|
| | |
|
| | | def OnNPCRebornInFB(curNPC):
|
| | | #GameWorld.DebugLog("OnNPCRebornInFB 设置需要同步副本NPC!")
|
| | | GameWorld.GetGameFB().SetGameFBDict(FBDict_SyncFBNPC, 1)
|
| | | return
|
| | |
|