From ac4f3139e69d4671a46a299df51159f018a5da13 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期二, 26 十一月 2019 11:35:00 +0800 Subject: [PATCH] 8346 【恺英】【后端】协助系统(封包、表) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py | 184 +++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 166 insertions(+), 18 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py index 24fb0bf..a8a08f3 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py @@ -18,9 +18,11 @@ import IPY_GameWorld import PlayerControl import GameWorldProcess -import PlayerMergeEvent +import CrossRealmPlayer +import PlayerSuccess import ReadChConfig import ShareDefine +import PyGameData import FBCommon import GameMap import GameObj @@ -270,6 +272,12 @@ # @return None # @remarks 函数详细说明. def DoFB_Player_KillNPC(curPlayer , curNPC , tick): + mapID = PlayerControl.GetCustomMapID(curPlayer) + lineID = PlayerControl.GetCustomLineID(curPlayer) + if mapID: + DoCustomScene_Player_KillNPC(curPlayer, curNPC, mapID, lineID) + return + do_FBLogic_ID = __GetFBLogic_MapID(GameWorld.GetMap().GetMapID()) callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "DoFB_Player_KillNPC")) @@ -325,13 +333,13 @@ return -## 副本中召唤兽死亡(被击杀或者时间到等) +## 副本中NPC死亡(被击杀或者时间到等) # @param curNPC # @return None. -def DoFB_SummonNPCDead(curNPC): +def DoFB_NPCDead(curNPC): do_FBLogic_ID = __GetFBLogic_MapID(GameWorld.GetMap().GetMapID()) - callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "DoFB_SummonNPCDead")) + callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "DoFB_NPCDead")) if callFunc: callFunc(curNPC) @@ -484,6 +492,29 @@ def DoEnterFBLogic(curPlayer, tick): curPlayerID = curPlayer.GetID() + if GameWorld.IsCrossServer(): + mapID = GameWorld.GetMap().GetMapID() + mapID = FBCommon.GetRecordMapID(mapID) + if mapID in ChConfig.Def_CrossDynamicLineMap: + fbZoneID = FBCommon.GetCrossDynamicLineMapZoneID() + fbFuncLineID = FBCommon.GetCrossDynamicLineMapFuncLineID() + playerZoneID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqCrossFBZoneID) + playerFuncLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqCrossFBFuncLine) + if fbZoneID != playerZoneID or fbFuncLineID != playerFuncLineID: + GameWorld.ErrLog("DoEnterFB 玩家与当前副本线路所属分区或功能分线不同,踢出玩家!fbZoneID=%s,playerZoneID=%s,fbFuncLineID=%s,playerFuncLineID=%s" + % (fbZoneID, playerZoneID, fbFuncLineID, playerFuncLineID), curPlayerID) + CrossRealmPlayer.PlayerExitCrossServer(curPlayer) + return + GameWorld.Log("玩家进入跨服副本动态分配的线路: fbZoneID=%s,playerZoneID=%s,fbFuncLineID=%s,playerFuncLineID=%s" + % (fbZoneID, playerZoneID, fbFuncLineID, playerFuncLineID), curPlayerID) + + gameWorld = GameWorld.GetGameWorld() + copyMapID = gameWorld.GetCopyMapID() + if copyMapID not in PyGameData.g_crossPlayerServerGroupIDInfo: + PyGameData.g_crossPlayerServerGroupIDInfo[copyMapID] = {} + playerServerGroupIDDict = PyGameData.g_crossPlayerServerGroupIDInfo[copyMapID] + playerServerGroupIDDict[curPlayerID] = PlayerControl.GetPlayerServerGroupID(curPlayer) + # 自伸缩副本根据玩家进入开启,主动调用一次,避免间隔调用时机未触发导致逻辑错乱 GameWorldProcess.EnterOpenFB(tick) @@ -494,9 +525,8 @@ gameMap = GameWorld.GetMap() gameMapID = gameMap.GetMapID() - #如果已经设置过副本功能线路属性,则进入时同步玩家,一般下线重登或者非第一个进入该副本的玩家(如队友)会收到该包 - if FBCommon.GetHadSetFBPropertyMark(): - PlayerControl.SetFBFuncLineID(curPlayer, FBCommon.GetFBPropertyMark()) + reqFuncLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine) + PlayerControl.SetFBFuncLineID(curPlayer, reqFuncLineID) #成长NPC所需数据初始化 InitFBNPCStrengthenData(curPlayer, gameMap) @@ -508,6 +538,10 @@ if gameMap.GetMapFBType() == IPY_GameWorld.fbtNull: return + #进入副本默认回满血 + if curPlayer.GetHP() < curPlayer.GetMaxHP(): + curPlayer.SetHP(curPlayer.GetMaxHP()) + #副本管理器 gameFBMgr = GameWorld.GetGameFB() @@ -517,12 +551,15 @@ #注册玩家离开副本时间 gameFBMgr.SetPlayerLogoffTick(0) + PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FeastRedPack_EnterMap, 1, [gameMapID]) + if gameFBMgr.HaveFBPlayer(curPlayerID): #已经注册了这个玩家, 不清除已注册的玩家的字典信息 return #注册进入这个副本的玩家 gameFBMgr.AddFBPlayer(curPlayerID) + return def DoEnterFB(curPlayer, tick): @@ -533,6 +570,9 @@ if callFunc != None: GameWorld.Log("DoEnterFBLogic...", curPlayer.GetPlayerID()) callFunc(curPlayer, tick) + #扣费一般都是在进入副本逻辑里处理,免费只有一次性的,所以放在后面进行重置,防止一直免费 + if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFBFree): + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_EnterFBFree, 0) return def OnCallHelpBattleOK(curPlayer, tick): @@ -696,9 +736,6 @@ #GameWorld.Log("副本逻辑不可使用 GameLogic_%d"%(mapID)) callFunc(curPlayer , tick) - #有玩家离开副本广播一次 - PlayerMergeEvent.BroadcastMergePlayerEvent() - #如果是最后一个人离开副本, 那么设置副本的离开时间, 5分钟后副本关闭 __PlayerLeaveSetPlayerLogoffTick(curPlayer, tick) return @@ -763,6 +800,18 @@ #执行副本逻辑 return callFunc(curPlayer, mapID, lineID) + +## 是否可以获得副本地图区域经验 +def OnCanGetAreaExp(curPlayer, mapID): + do_FBLogic_ID = __GetFBLogic_MapID(mapID) + + callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnCanGetAreaExp")) + + if callFunc == None: + return True + + #执行副本逻辑 + return callFunc(curPlayer) ## 是否可以开始收集 # @param curPlayer 当前玩家 @@ -1229,7 +1278,11 @@ def PlayerLoginInFBCheck(curPlayer, tick): gameMap = GameWorld.GetMap() #如果此地图是自动释放的, 需要检查这个玩家 - if gameMap.GetMapFBType() == 0: + if gameMap.GetMapFBType() in [IPY_GameWorld.fbtNull]: + return False + + #跨服服务器是直接注册的地图ID数据,地图肯定没有该玩家,所以不判断 + if GameWorld.IsCrossServer(): return False #玩家 在副本中,并且副本不踢出玩家下线 @@ -1263,9 +1316,6 @@ # @return mapID # @remarks 函数详细说明. def __GetFBLogic_MapID(mapID): - #ManorWarMapIDList = ReadChConfig.GetEvalChConfig("ManorWarMapID") - #if mapID in ManorWarMapIDList: - # return 'ManorWar' mapID = FBCommon.GetRecordMapID(mapID) for key, value in ChConfig.Def_FB_MapID.items(): if mapID in value: @@ -1474,6 +1524,17 @@ return callFunc(curPlayer, mapID, lineID, cnt, isFinish, dataEx) +## 副本助战扫荡结果 +def OnPlayerFBHelpBattleSweepResult(curPlayer, mapID, lineID, helpBattlePlayerDict, addXianyuanCoin, reason): + do_FBLogic_ID = __GetFBLogic_MapID(mapID) + + callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnPlayerFBHelpBattleSweepResult")) + + if callFunc == None: + return False + + return callFunc(curPlayer, mapID, lineID, helpBattlePlayerDict, addXianyuanCoin, reason) + ## 开始公共CD副本扫荡 def OnStartPubCDFBSweep(curPlayer, mapID, lineID, cnt, dataEx): do_FBLogic_ID = __GetFBLogic_MapID(mapID) @@ -1527,7 +1588,7 @@ callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnEnterFBEvent")) if callFunc == None: - return False + return True return callFunc(curPlayer, mapID, lineID, tick) @@ -1543,9 +1604,10 @@ 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] @@ -2131,6 +2193,92 @@ return callFunc(curPlayer, tick) +## 客户端进入自定义场景 +def OnEnterCustomScene(curPlayer, mapID, lineID): + do_FBLogic_ID = __GetFBLogic_MapID(mapID) + + callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnEnterCustomScene")) + + if callFunc == None: + return + + return callFunc(curPlayer, mapID, lineID) + +## 判断可否召唤木桩怪 +def OnCanSummonPriWoodPile(curPlayer, mapID, lineID, npcID, count): + do_FBLogic_ID = __GetFBLogic_MapID(mapID) + + callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnCanSummonPriWoodPile")) + + if callFunc == None: + return True + + return callFunc(curPlayer, mapID, lineID, npcID, count) + +## 自定义场景副本击杀NPC +def DoCustomScene_Player_KillNPC(curPlayer, curNPC, mapID, lineID): + do_FBLogic_ID = __GetFBLogic_MapID(mapID) + + callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "DoCustomScene_Player_KillNPC")) + + if callFunc: + callFunc(curPlayer, curNPC, mapID, lineID) + + return + +## 自定义场景采集OK,需自带是否允许采集的判断 +def OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID): + do_FBLogic_ID = __GetFBLogic_MapID(mapID) + + callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnCustomSceneCollectOK")) + + if callFunc: + return callFunc(curPlayer, mapID, lineID, npcID) + + return + +## 进入跨服副本注册数据前逻辑 +## @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): + do_FBLogic_ID = __GetFBLogic_MapID(mapID) + + callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnEndCrossFB")) + + if callFunc == None: + return + + return callFunc(curPlayer, mapID, lineID, exData) + +## 跨服功能线路数据缓存,下次开启同样功能线路时会用该数据进行还原之前的副本状态 +def OnGetCrossFuncLineDataCache(): + do_FBLogic_ID = __GetFBLogic_MapID(GameWorld.GetMap().GetMapID()) + callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnGetCrossFuncLineDataCache")) + if callFunc == None: + 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()) -- Gitblit v1.8.0