From 1ea73e1885835466265ce788d93556b7030ee0e8 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期日, 30 十二月 2018 18:42:00 +0800 Subject: [PATCH] 5424 【后端】【1.4】跨服竞技场开发(GM工具增加子服服务器维护,文字翻译版) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py | 97 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 94 insertions(+), 3 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py index dc8ef28..f9d5821 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py @@ -88,13 +88,17 @@ __OnHelpBattleCheckInResult(curPlayer, msgList, tick) # 刷新 - if cmd == "Refresh": + elif cmd == "Refresh": __OnHelpBattleRefreshResult(curPlayer, msgList, tick) # 助战记录 - if cmd == "HelpRecord": + elif cmd == "HelpRecord": __OnHelpBattleRecord(curPlayer, msgList, tick) + # 扫荡召唤 + elif cmd == "SweepCall": + __OnHelpBattleSweepCallResult(curPlayer, msgList, tick) + return #// B1 05 助战登记 #tagCMHelpBattleCheckIn @@ -394,6 +398,81 @@ NetPackCommon.SendFakePack(curPlayer, helpPlayerListPack) return +def SendGameServer_SweepCallHelpBattlePlayer(curPlayer, mapID, funcLineID): + ## 发送GameServer请求扫荡助战玩家 + ipyData = IpyGameDataPY.GetIpyGameData("FBHelpBattle", mapID, funcLineID) + if not ipyData: + return + playerID = curPlayer.GetPlayerID() + msgInfo = str(["SweepCall", mapID, funcLineID]) + GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "FBHelpBattle", msgInfo, len(msgInfo)) + GameWorld.Log("SendGameServer_SweepCallHelpBattlePlayer %s" % (msgInfo), playerID) + return + +def __OnHelpBattleSweepCallResult(curPlayer, msgList, tick): + ## 助战扫荡结果处理 + cmd, mapID, funcLineID, helpBattlePlayerDict = msgList + playerID = curPlayer.GetPlayerID() + GameWorld.DebugLog("__OnHelpBattleSweepCallResult %s,mapID=%s,funcLineID=%s,helpBattlePlayerDict=%s" + % (cmd, mapID, funcLineID, helpBattlePlayerDict), playerID) + + fbFuncIpyData = IpyGameDataPY.GetIpyGameData("FBFunc", mapID) + if not fbFuncIpyData: + return + + reason = 0 + addCoinRate = 10000 # 基础倍率 + baseFBPoint = fbFuncIpyData.GetFBPoint() # 过关 - 基础仙缘币 + + xianyuanCoinUpper = IpyGameDataPY.GetFuncCfg("HelpBattlePoint", 1) # 每日仙缘币上限 + relationCoinAddDict = IpyGameDataPY.GetFuncEvalCfg("HelpBattlePoint", 2, {}) # 社交关系加成 {"社交关系":[过关加成, 助战加成], ...} + todayXianyuanCoin = PlayerControl.GetTodayXianyuanCoin(curPlayer) # 今日已获得仙缘币 + playerXianyuanCoinUpper = xianyuanCoinUpper + if curPlayer.GetVIPLv(): + playerXianyuanCoinUpper += PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_XianyuanCoinUpperAdd) + addCoinRate += PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_XianyuanCoinAddPer) + + relation, relationAdd = 0, 0 + for helpPlayerInfoDict in helpBattlePlayerDict.values(): + relation = helpPlayerInfoDict.get("Relation", 0) + if not relation: + continue + relationAddList = relationCoinAddDict.get(str(relation), []) + relationAdd += relationAddList[0] if len(relationAddList) == 2 else 0 + + coinAdd = 0 + if baseFBPoint: + coinAdd = int((baseFBPoint + relationAdd) * addCoinRate / 10000.0) + canAddMax = max(playerXianyuanCoinUpper - todayXianyuanCoin, 0) + coinAddReal = min(coinAdd, canAddMax) # 实际加仙缘币 + if canAddMax == 0 and not reason: + reason = 2 + + GameWorld.DebugLog("扫荡副本增加仙缘币: baseFBPoint=%s,relationAdd=%s,addCoinRate=%s,coinAdd=%s,canAddMax=%s,coinAddReal=%s" + % (baseFBPoint, relationAdd, addCoinRate, coinAdd, canAddMax, coinAddReal), playerID) + if coinAddReal: + addDataDict = {"MapID":mapID, "FuncLineID":funcLineID, "IsSweep":1} + PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_XianyuanCoin, coinAddReal, addDataDict=addDataDict) + PlayerControl.AddTodayXianyuanCoin(curPlayer, coinAddReal) + + #扫荡结果给奖励等 + FBLogic.OnPlayerFBHelpBattleSweepResult(curPlayer, mapID, funcLineID, helpBattlePlayerDict, coinAddReal, reason) + + # 通知自己获得仙缘币 + msgPack = ChPyNetSendPack.tagMCAddXianyuanCoinMsg() + msgPack.MapID = mapID + msgPack.FuncLineID = funcLineID + msgPack.Relation = relation + msgPack.RelationCoinAdd = relationAdd + msgPack.XianyuanCoinAdd = coinAddReal + msgPack.Reason = reason + #msgPack.CallPlayerID = relationPlayerID + #msgPack.CallPlayerName = relationPlayerName + msgPack.NameLen = len(msgPack.CallPlayerName) + msgPack.IsSweep = 1 + NetPackCommon.SendFakePack(curPlayer, msgPack) + return + def __OnHelpBattleRecord(curPlayer, msgList, tick): ## 助战记录同步 cmd, helpRecordList, isLogin = msgList @@ -519,6 +598,10 @@ if canAddMax == 0 and not reason: reason = 2 + if isHelp and not relationPlayerID: + relationPlayerID = 1 + #GameWorld.DebugLog("没有助战目标则设置relationPlayerID为1,标记是助战的!") + GameWorld.DebugLog("挑战副本增加仙缘币: baseFBPoint=%s,relationAdd=%s,addCoinRate=%s,coinAdd=%s,canAddMax=%s,coinAddReal=%s,relationPlayerID=%s" % (baseFBPoint, relationAdd, addCoinRate, coinAdd, canAddMax, coinAddReal, relationPlayerID), playerID) if coinAddReal: @@ -558,9 +641,12 @@ familyID = curPlayer.GetFamilyID() if isHelp: # 助战的随便取一位优先级最高的即可 + defaultRelationPlayerID = 0 for memPlayerID, memFamilyID in memFamilyIDDict.items(): memRelation, relationPlayerID = __GetTemMemRelation(playerManager, playerID, familyID, memPlayerID, memFamilyID, relationList, friendList, leavePlayerID) if not memRelation: + if not defaultRelationPlayerID and relationPlayerID: + defaultRelationPlayerID = relationPlayerID continue relation = memRelation relationAddList = relationCoinAddDict.get(str(memRelation), []) @@ -568,6 +654,9 @@ relationPlayerName = memNameDict[relationPlayerID] return relation, relationAdd, relationPlayerID, relationPlayerName + relationPlayerID = defaultRelationPlayerID + relationPlayerName = memNameDict.get(relationPlayerID, "") + GameWorld.DebugLog("助战默认无关系队员: relationPlayerID=%s,relationPlayerName=%s" % (relationPlayerID, relationPlayerName), playerID) else: # 非助战享受所有队员加成 for memPlayerID, memFamilyID in memFamilyIDDict.items(): @@ -587,6 +676,8 @@ ## 离线玩家不算社交关系 if leavePlayerID and memPlayerID == leavePlayerID: return 0, 0 + if playerID == memPlayerID: + return 0, 0 memPlayer = playerManager.FindPlayerByID(memPlayerID) if memPlayer == None or memPlayer.IsEmpty(): return 0, 0 @@ -597,7 +688,7 @@ if checkRelation == 2: if playerID != memPlayerID and familyID and familyID == memFamilyID: return checkRelation, memPlayerID - return 0, 0 + return 0, memPlayerID def RefershTeamFBMemRelation(tick, leavePlayerID=0): ## 刷新组队副本队员关系 -- Gitblit v1.8.0