From ff605c7a895524d29abd2badfb38ad3f26fa8a1c Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期六, 22 十二月 2018 15:07:52 +0800
Subject: [PATCH] 5303 【后端】【1.4】仙盟宴会传功修改,开始答题时间修改

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FamilyParty.py |  112 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 80 insertions(+), 32 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 36f7afd..d40365b 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
@@ -47,7 +47,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
@@ -144,6 +144,7 @@
 # @return 无意义
 # @remarks 玩家进入副本
 def DoEnterFB(curPlayer, tick):
+    global g_familyMapPlayerIDDict
     mapID = GameWorld.GetGameWorld().GetMapID()
     playerID = curPlayer.GetPlayerID()
     if not __CheckEnter(curPlayer, mapID):
@@ -174,8 +175,19 @@
         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)
+    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
 
 
@@ -317,7 +329,7 @@
 # @param tick 时间戳
 # @return 无意义
 # @remarks 用于通知阵营比分条
-def DoFBHelp(curPlayer, tick):
+def DoFBHelp(curPlayer, tick, isSyncPlayerID=False):
     #gameFB = GameWorld.GetGameFB()
     gameWorld = GameWorld.GetGameWorld()
     playerID = curPlayer.GetPlayerID()
@@ -345,7 +357,10 @@
             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
@@ -404,6 +419,25 @@
     DoFBHelp(curPlayer, 0)
     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,38 +462,52 @@
         tagPlayer = copyMapPlayerManager.FindPlayerByID(tagPlayerID)
         if not tagPlayer:
             GameWorld.DebugLog('邀请%s打坐,该玩家不在副本里' % tagPlayerID, playerID)
+            PlayerControl.NotifyCode(curPlayer, 'PartySitFail')
             return
         curPlayer.StopMove()
         curPlayer.Sit()
-        if not gameWorld.GetGameWorldDictByKey(FBPlayerDict_HasSit % tagPlayerID):
-            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:  #打坐结束给奖励
-        hasSit = gameWorld.GetGameWorldDictByKey(FBPlayerDict_HasSit % playerID)
-        if hasSit:
-            GameWorld.Log('打坐结束给奖励,玩家已打坐过一次', playerID)
+        if not __GiveSitAward(curPlayer):
             return
-        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)
+
         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:
+        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