From e852ca15d3d08743c816d14d0959f274c5015573 Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期六, 22 六月 2019 16:07:46 +0800 Subject: [PATCH] 6603 【后端】【2.0】增加新版的sp和被动技能 - 修复追神摄魂计算命中个数问题 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py | 167 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 123 insertions(+), 44 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py index ab964ba..ad3c8f9 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py @@ -25,6 +25,8 @@ import IpyGameDataPY import GameWorldProcess import PlayerFairyCeremony +import PlayerNewFairyCeremony +import PlayerActLogin import EventReport import PyGameData import ItemCommon @@ -39,7 +41,6 @@ ) = range(3) #---战盟副本--- -Map_FamilyPartyFB_FamilyID = "FamilyPartyFB_FamilyID" # 对应的家族id Map_FamilyPartyFB_StartTick = "Map_FamilyPartyFB_StartTick" # 副本开始时间 GameFBDict_LastEnterFbDay = 'LastEnterFbDay_%s' #上次进入活动的开服天 FBPlayerDict_TotalExp = 'XMYH_TotalExp%s' # 获得的总经验 @@ -48,7 +49,7 @@ FBPlayerDict_HasCollect = 'XMYH_HasCollect%s' # 是否已采集 FBPlayerDict_HasSit = 'XMYH_HasSit%s' # 是否已传功 - +g_familyMapPlayerIDDict = {}#{lineid:[playerid,..]} def OnFBPlayerOnDay(curPlayer): PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt, 0) return @@ -60,7 +61,6 @@ # @remarks 开启副本 def OnOpenFB(tick): gameFB = GameWorld.GetGameFB() - gameFB.SetGameFBDict(Map_FamilyPartyFB_FamilyID, 0) gameFB.ClearAllPlayerGameFBDict() # 清除所有玩家对应的副本字典信息 gameFB.SetGameFBDict(ChConfig.Map_FBDict_NotifyStart, 0) return @@ -146,6 +146,7 @@ # @return 无意义 # @remarks 玩家进入副本 def DoEnterFB(curPlayer, tick): + global g_familyMapPlayerIDDict mapID = GameWorld.GetGameWorld().GetMapID() playerID = curPlayer.GetPlayerID() if not __CheckEnter(curPlayer, mapID): @@ -160,8 +161,6 @@ return curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, closeFB_RemainTick, True) GameWorld.DebugLog('closeFB_RemainTick=%s' % closeFB_RemainTick) - if not gameFB.GetGameFBDictByKey(Map_FamilyPartyFB_FamilyID): - gameFB.SetGameFBDict(Map_FamilyPartyFB_FamilyID, curPlayer.GetFamilyID()) openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) if gameWorld.GetGameWorldDictByKey(GameFBDict_LastEnterFbDay % playerID) != openServerDay + 1: @@ -178,8 +177,21 @@ PlayerFamily.AddFamilyActivity(curPlayer, ShareDefine.FamilyActive_Party) EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_FamilyParty, 0, ChConfig.CME_Log_Start) PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_FamilyParty, 1) + PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_FamilyParty, 1) + PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_FamilyParty, 1) + lineID = GameWorld.GetGameWorld().GetLineID() + if lineID not in g_familyMapPlayerIDDict: + g_familyMapPlayerIDDict[lineID] = [] + if playerID not in g_familyMapPlayerIDDict[lineID]: + g_familyMapPlayerIDDict[lineID].append(playerID) - DoFBHelp(curPlayer, tick) + playerManager = GameWorld.GetMapCopyPlayerManager() + for index in xrange(playerManager.GetPlayerCount()): + curPlayer = playerManager.GetPlayerByIndex(index) + if not curPlayer: + continue + DoFBHelp(curPlayer, tick, True) + return @@ -196,8 +208,12 @@ # @return 返回值无意义 # @remarks 副本定时器 def OnProcess(tick): + familyID = GameWorld.GetGameWorld().GetPropertyID() + if not familyID: + return gameFB = GameWorld.GetGameFB() fbStep = gameFB.GetFBStep() + #GameWorld.DebugLog(" OnProcess...") if fbStep == FB_Step_Open: if FBCommon.GetFBFuncOpenState(ChConfig.Def_FBMapID_FamilyParty): @@ -211,7 +227,7 @@ GameWorldProcess.CloseFB(tick) else: #FBCommon.DoLogicAreaReward("FamilyPartyAreaAward", tick) - #FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 10000) + FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 5000) mapID = GameWorld.GetMap().GetMapID() notifyIndex = gameFB.GetGameFBDictByKey(ChConfig.Map_FBDict_NotifyStart) @@ -221,7 +237,7 @@ remaindTick = max(0, __GetRemainTick(tick) - 1000) if remaindTick <= (notifySecond + 1) * 1000: #remaindSecond = remaindTick / 1000 - familyID = gameFB.GetGameFBDictByKey(Map_FamilyPartyFB_FamilyID) + PlayerControl.FamilyNotify(familyID, "Party_OverTime", [notifySecond]) GameWorld.GetGameFB().SetGameFBDict(ChConfig.Map_FBDict_NotifyStart, notifyIndex + 1) @@ -235,13 +251,13 @@ # if mapID != ChConfig.Def_FBMapID_FamilyParty: # return # - + addPoint, addExp = IpyGameDataPY.GetFuncEvalCfg('PartyReward', 2) #仙盟贡献度 PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, addPoint, True, ShareDefine.Def_AddFAVReason_FamilyParty, True) #答题经验更新 - PlayerControl.PlayerControl(curPlayer).AddExp(addExp) - + PlayerControl.PlayerControl(curPlayer).AddExp(addExp, ShareDefine.Def_ViewExpType_SysEx) + PlayerControl.FamilyNotify(curPlayer.GetFamilyID(), 'Party_Answer', [curPlayer.GetName(), addPoint]) curAnswerCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt, curAnswerCnt + 1) @@ -268,9 +284,11 @@ if mapID != ChConfig.Def_FBMapID_FamilyParty: return - if state == 1: - GameWorld.GetGameWorld().SetGameWorldDict(Map_FamilyPartyFB_StartTick, tick) - + if state: + if not GameWorld.GetGameWorld().GetGameWorldDictByKey(Map_FamilyPartyFB_StartTick): + GameWorld.GetGameWorld().SetGameWorldDict(Map_FamilyPartyFB_StartTick, tick) + else: + GameWorld.GetGameWorld().SetGameWorldDict(Map_FamilyPartyFB_StartTick, 0) return # @@ -317,7 +335,7 @@ # @param tick 时间戳 # @return 无意义 # @remarks 用于通知阵营比分条 -def DoFBHelp(curPlayer, tick): +def DoFBHelp(curPlayer, tick, isSyncPlayerID=False): #gameFB = GameWorld.GetGameFB() gameWorld = GameWorld.GetGameWorld() playerID = curPlayer.GetPlayerID() @@ -336,16 +354,17 @@ hasCollect = gameWorld.GetGameWorldDictByKey(FBPlayerDict_HasCollect % playerID) hasSit = gameWorld.GetGameWorldDictByKey(FBPlayerDict_HasSit % playerID) - getCnt = gameWorld.GetGameWorldDictByKey(ChConfig.Map_Player_AreaReward_GetCnt % playerID) - isFull = 1 if getCnt >= IpyGameDataPY.GetFuncCfg('FamilyPartyAreaAward', 3) else 0 - helpDict = {FBCommon.Help_exp:exp, FBCommon.Help_expPoint:expPoint, FBCommon.Help_score:totalPoint, "hasCollect":hasCollect, "isFullExp":isFull, "hasSit":hasSit} + helpDict = {FBCommon.Help_exp:exp, FBCommon.Help_expPoint:expPoint, FBCommon.Help_score:totalPoint, "hasCollect":hasCollect, "hasSit":hasSit} if PyGameData.g_familyPartyInfo: rankList = [] for i, info in enumerate(PyGameData.g_familyPartyInfo[0], 1): rankList.append({"rank":i, "name":info[1], "cnt":info[2]}) helpDict['familyPartyRank'] = rankList helpDict['familyPartyTop'] = {'name':PyGameData.g_familyPartyInfo[1], "cnt":PyGameData.g_familyPartyInfo[2]} - + if isSyncPlayerID: + lineID = GameWorld.GetGameWorld().GetLineID() + helpDict['familyPartyPlayer'] = g_familyMapPlayerIDDict.get(lineID, []) + GameWorld.DebugLog("DoFBHelp %s" % helpDict, playerID) FBCommon.Notify_FBHelp(curPlayer, helpDict) return @@ -393,7 +412,7 @@ #给奖励 itemAward = IpyGameDataPY.GetFuncEvalCfg('FamilyPartyDesk', 3) for itemID, itemCount, isBind in itemAward: - ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem]) + ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem]) addPoint = IpyGameDataPY.GetFuncCfg('FamilyPartyDesk') PlayerControl.NotifyCode(curPlayer, 'Party_CollectSuccess', [addPoint]) PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, addPoint, True, ShareDefine.Def_AddFAVReason_FamilyParty) @@ -404,6 +423,47 @@ DoFBHelp(curPlayer, 0) return +## 获得经验 +# @param curPlayer 当前玩家 +# @param addExp 获得的经验 +# @param expViewType 经验类型 +# @return True or False +def OnGetExp(curPlayer, addExp, expViewType): + + if expViewType != ShareDefine.Def_ViewExpType_SysEx: + return + gameWorld = GameWorld.GetGameWorld() + playerID = curPlayer.GetID() + exp = gameWorld.GetGameWorldDictByKey(FBPlayerDict_TotalExp % playerID) + expPoint = gameWorld.GetGameWorldDictByKey(FBPlayerDict_TotalExpPoint % playerID) + newTotalExp = expPoint*ChConfig.Def_PerPointValue+exp+addExp + gameWorld.SetGameWorldDict(FBPlayerDict_TotalExp % playerID, newTotalExp%ChConfig.Def_PerPointValue) + gameWorld.SetGameWorldDict(FBPlayerDict_TotalExpPoint % playerID, newTotalExp/ChConfig.Def_PerPointValue) + + + GameWorld.DebugLog("OnGetExp() addExp=%s,updTotalExp=%s" + % (addExp, newTotalExp), playerID) + + return +##玩家退出副本 +# @param curPlayer 玩家实例 +# @param tick 时间戳 +# @return 无意义 +def DoExitFB(curPlayer, tick): + global g_familyMapPlayerIDDict + __GiveSitAward(curPlayer) + lineID = GameWorld.GetGameWorld().GetLineID() + playerID = curPlayer.GetID() + if playerID in g_familyMapPlayerIDDict.get(lineID, []): + g_familyMapPlayerIDDict[lineID].remove(playerID) + if g_familyMapPlayerIDDict[lineID]: + playerManager = GameWorld.GetMapCopyPlayerManager() + for index in xrange(playerManager.GetPlayerCount()): + curPlayer = playerManager.GetPlayerByIndex(index) + if not curPlayer: + continue + DoFBHelp(curPlayer, tick, True) + return ## 副本行为 # @param curPlayer 玩家 @@ -428,33 +488,52 @@ tagPlayer = copyMapPlayerManager.FindPlayerByID(tagPlayerID) if not tagPlayer: GameWorld.DebugLog('邀请%s打坐,该玩家不在副本里' % tagPlayerID, playerID) + PlayerControl.NotifyCode(curPlayer, 'PartySitFail') return curPlayer.StopMove() curPlayer.Sit() - if tagPlayer.GetPlayerAction() not in [IPY_GameWorld.paSit, IPY_GameWorld.paPreparing]: - tagPlayer.StopMove() - tagPlayer.Sit() +# if not gameWorld.GetGameWorldDictByKey(FBPlayerDict_HasSit % tagPlayerID): +# if tagPlayer.GetPlayerAction() not in [IPY_GameWorld.paSit, IPY_GameWorld.paPreparing]: +# tagPlayer.StopMove() +# tagPlayer.Sit() elif actionType == 1: #打坐结束给奖励 - reLV = curPlayer.GetLV() - worldlv = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv) - giveLV = eval(IpyGameDataPY.GetFuncCompileCfg('FamilyPartySitAward', 2)) - addExp = 0 - if giveLV: - addExp = Item_AddLV.DoAddLVEx(curPlayer, giveLV, True, True, 0) - reLV = curPlayer.GetLV() - reExp = PlayerControl.GetPlayerReExp(curPlayer) - giveExp = eval(IpyGameDataPY.GetFuncCompileCfg('FamilyPartySitAward')) - if giveExp: - PlayerControl.PlayerControl(curPlayer).AddExp(giveExp) - exp = gameWorld.GetGameWorldDictByKey(FBPlayerDict_TotalExp % playerID) - expPoint = gameWorld.GetGameWorldDictByKey(FBPlayerDict_TotalExpPoint % playerID) - newTotalExp = expPoint*ChConfig.Def_PerPointValue+exp+giveExp+addExp - gameWorld.SetGameWorldDict(FBPlayerDict_TotalExp % playerID, newTotalExp%ChConfig.Def_PerPointValue) - gameWorld.SetGameWorldDict(FBPlayerDict_TotalExpPoint % playerID, newTotalExp/ChConfig.Def_PerPointValue) - - gameWorld.SetGameWorldDict(FBPlayerDict_HasSit % playerID, 1) + if not __GiveSitAward(curPlayer): + return + DoFBHelp(curPlayer, 0) - if curPlayer.GetPlayerAction() == IPY_GameWorld.paSit: - curPlayer.Stand() - GameWorld.DebugLog(' 传功结束,giveLV=%s, giveExp=%s, worldlv=%s' % (giveLV, giveExp, worldlv)) + + return + +def __GiveSitAward(curPlayer): + #给打坐奖励 + gameWorld = GameWorld.GetGameWorld() + playerID = curPlayer.GetID() + hasSit = gameWorld.GetGameWorldDictByKey(FBPlayerDict_HasSit % playerID) + if hasSit: + GameWorld.Log('打坐结束给奖励,玩家已打坐过一次', playerID) + return + if curPlayer.GetPlayerAction() != IPY_GameWorld.paSit: + GameWorld.Log('打坐结束给奖励,玩家不在打坐状态', playerID) + return + curPlayer.Stand() + reLV = curPlayer.GetLV() + worldlv = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv) + giveLV = eval(IpyGameDataPY.GetFuncCompileCfg('FamilyPartySitAward', 2)) + addExp = 0 + if giveLV: + addExp = Item_AddLV.DoAddLVEx(curPlayer, giveLV, True, True, 0) + reLV = curPlayer.GetLV() + reExp = PlayerControl.GetPlayerReExp(curPlayer) + giveExp = eval(IpyGameDataPY.GetFuncCompileCfg('FamilyPartySitAward')) + if giveExp: + giveExp = PlayerControl.PlayerControl(curPlayer).AddExp(giveExp) + exp = gameWorld.GetGameWorldDictByKey(FBPlayerDict_TotalExp % playerID) + expPoint = gameWorld.GetGameWorldDictByKey(FBPlayerDict_TotalExpPoint % playerID) + newTotalExp = expPoint*ChConfig.Def_PerPointValue+exp+giveExp+addExp + gameWorld.SetGameWorldDict(FBPlayerDict_TotalExp % playerID, newTotalExp%ChConfig.Def_PerPointValue) + gameWorld.SetGameWorldDict(FBPlayerDict_TotalExpPoint % playerID, newTotalExp/ChConfig.Def_PerPointValue) + + gameWorld.SetGameWorldDict(FBPlayerDict_HasSit % playerID, 1) + GameWorld.DebugLog(' 传功结束,giveLV=%s, giveExp=%s, worldlv=%s' % (giveLV, giveExp, worldlv)) + return True -- Gitblit v1.8.0