xdh
2018-12-22 ff605c7a895524d29abd2badfb38ad3f26fa8a1c
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,6 +357,9 @@
            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)
@@ -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,18 +462,35 @@
        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:  #打坐结束给奖励
        if not __GiveSitAward(curPlayer):
            return
        DoFBHelp(curPlayer, 0)
    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))
@@ -458,8 +509,5 @@
            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
    return True