| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package GameWorldLogic.FBProcess.GameLogic_FamilyParty  | 
| #  | 
| # @todo:Õ½ÃËÊ¢Ñç  | 
| # @author xdh  | 
| # @date 2018-04-16  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: Õ½ÃËÊ¢Ñç  | 
| #  | 
| #---------------------------------------------------------------------  | 
| """Version = 2018-04-16 17:20"""  | 
| import ShareDefine  | 
| import FBCommon  | 
| import ChConfig  | 
| import IPY_GameWorld  | 
| import PlayerControl  | 
| import GameWorld  | 
| import PlayerFamily  | 
| import IpyGameDataPY  | 
| import GameWorldProcess  | 
| import PlayerFairyCeremony  | 
| import EventReport  | 
| import PyGameData  | 
| import ItemCommon  | 
| import ItemControler  | 
| import Item_AddLV  | 
|   | 
| #µ±Ç°¸±±¾µØÍ¼µÄ״̬  | 
| (  | 
| FB_Step_Open,  # µØÍ¼¿ªÆô  | 
| FB_Step_Fighting,  # Õ½¶·ÖÐ  | 
| FB_Step_Over,  # ¸±±¾¹Ø±Õ  | 
| ) = range(3)  | 
|   | 
| #---Õ½Ã˸±±¾---  | 
| Map_FamilyPartyFB_StartTick = "Map_FamilyPartyFB_StartTick"  # ¸±±¾¿ªÊ¼Ê±¼ä  | 
| GameFBDict_LastEnterFbDay = 'LastEnterFbDay_%s'  #ÉϴνøÈë»î¶¯µÄ¿ª·þÌì  | 
| FBPlayerDict_TotalExp = 'XMYH_TotalExp%s'  # »ñµÃµÄ×ܾÑé  | 
| FBPlayerDict_TotalExpPoint = 'XMYH_TotalExpPoint%s'  # »ñµÃµÄ×ܾÑéµã  | 
| FBPlayerDict_TotalPoint = 'XMYH_TotalPoint%s'  # »ñµÃµÄ×ÜÏÉÃ˹±Ï×Öµ  | 
| FBPlayerDict_HasCollect = 'XMYH_HasCollect%s'  # ÊÇ·ñÒѲɼ¯  | 
| FBPlayerDict_HasSit = 'XMYH_HasSit%s'  # ÊÇ·ñÒÑ´«¹¦  | 
|   | 
|   | 
| def OnFBPlayerOnDay(curPlayer):  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt, 0)  | 
|     return  | 
|   | 
|   | 
| ##¿ªÆô¸±±¾  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¿ªÆô¸±±¾  | 
| def OnOpenFB(tick):  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     gameFB.ClearAllPlayerGameFBDict()  # Çå³ýËùÓÐÍæ¼Ò¶ÔÓ¦µÄ¸±±¾×ÖµäÐÅÏ¢  | 
|     gameFB.SetGameFBDict(ChConfig.Map_FBDict_NotifyStart, 0)  | 
|     return  | 
|   | 
|   | 
| ##¹Ø±Õ¸±±¾  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ÎÞÒâÒå  | 
| # @remarks   | 
| def OnCloseFB(tick):  | 
|     #¸±±¾Ìß³öÍæ¼Ò  | 
|     FBCommon.DoLogic_FBKickAllPlayer()  | 
|     return  | 
|   | 
|   | 
| ## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë  | 
| #  @param curPlayer Íæ¼ÒʵÀý  | 
| #  @param mapID µØÍ¼ID  | 
| #  @param lineID Ïß·id  | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return ²¼¶ûÖµ  | 
| def OnEnterFBEvent(curPlayer, mapID, lineID, tick):  | 
|     return __CheckEnter(curPlayer, mapID)  | 
|   | 
|   | 
| ##½øÈ븱±¾¼ì²é  | 
| #  @param curPlayer Íæ¼ÒʵÀý  | 
| #  @param mapID µØÍ¼ID  | 
| #  @param lineID Ïß·id  | 
| # @return None  | 
| def __CheckEnter(curPlayer, mapID):  | 
|       | 
|     # ÊÇ·ñÓÐÕ½ÃË  | 
|     if curPlayer.GetFamilyID() <= 0:  | 
|         GameWorld.DebugLog("ûÓÐÕ½ÃË£¬²»ÄܽøÈëÕ½ÃËboss¸±±¾£¡")  | 
|         return False  | 
|       | 
|     return True  | 
|   | 
|   | 
| ##¸±±¾Íæ¼Ò½øÈëµã  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param mapID µØÍ¼ID  | 
| # @param lineId ·ÖÏßID  | 
| # @param ipyEnterPosInfo ¹¦ÄÜÏß·IPYÅäÖÃ×ø±êÐÅÏ¢  | 
| # @param tick Ê±¼ä´Á  | 
| # @return posX, posY, Ëæ»ú°ë¾¶(¿ÉÑ¡)  | 
| def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick):  | 
|     return ipyEnterPosInfo  | 
|   | 
|      | 
| ##ÊÇ·ñ¿ÉÒÔ½øÈë  | 
| # @param ask ÇëÇó½á¹¹Ìå  | 
| # @param tick Ê±¼ä´Á  | 
| # @return  | 
| def OnChangeMapAsk(ask, tick):  | 
|     GameWorld.DebugLog("OnChangeMapAsk  CopyMapID=%s" % (ask.GetCopyMapID()))  | 
|     playerIDStr = ask.GetMsg()  | 
|     GameWorld.DebugLog("OnChangeMapAsk playerIDStr=%s" % playerIDStr)  | 
|     #Я´øÍæ¼ÒIDÈ볡  | 
|     if playerIDStr in ['', '0']:  | 
|         return IPY_GameWorld.cmeCustom  | 
|     playerID = int(playerIDStr)  | 
| #      | 
| #    # ÅжÏÊÇ·ñÒѾ½ø³¡¹ý  | 
| #    gameFB = GameWorld.GetGameFB()  | 
| #    fbStep = gameFB.GetFBStep()  | 
| #  | 
| #    GameWorld.DebugLog("OnChangeMapAsk fbStep=%s" % fbStep)  | 
| #    # ³¬¹ý×¼±¸½×¶Î£¬Èç¹ûÒѾ½øÈ¥¹ý²»ÈÃÔÙ½ø  | 
| #    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)  | 
| #    isEnter = GameWorld.GetGameWorld().GetGameWorldDictByKey(GameFBDict_LastEnterFbDay % playerID) == openServerDay + 1  | 
| #    GameWorld.DebugLog("OnChangeMapAsk isEnter=%s" % isEnter)  | 
| #    if isEnter:  | 
| #        return IPY_GameWorld.cmeCustom, "GeRen_liubo_676165"  | 
|     #¿É½øÈë  | 
|     return IPY_GameWorld.cmeAccept  | 
|   | 
|   | 
| ##Íæ¼Ò½øÈ븱±¾  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ÎÞÒâÒå  | 
| # @remarks Íæ¼Ò½øÈ븱±¾  | 
| def DoEnterFB(curPlayer, tick):  | 
|     mapID = GameWorld.GetGameWorld().GetMapID()  | 
|     playerID = curPlayer.GetPlayerID()  | 
|     if not __CheckEnter(curPlayer, mapID):  | 
|         PlayerControl.PlayerLeaveFB(curPlayer)  | 
|         return  | 
|     gameFB = GameWorld.GetGameFB()  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|       | 
|     closeFB_RemainTick = __GetRemainTick(tick)  | 
|     if not closeFB_RemainTick:  | 
|         PlayerControl.PlayerLeaveFB(curPlayer)  | 
|         return  | 
|     curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, closeFB_RemainTick, True)   | 
|     GameWorld.DebugLog('closeFB_RemainTick=%s' % closeFB_RemainTick)  | 
|          | 
|     openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)  | 
|     if gameWorld.GetGameWorldDictByKey(GameFBDict_LastEnterFbDay % playerID) != openServerDay + 1:  | 
|         gameWorld.SetGameWorldDict(GameFBDict_LastEnterFbDay % playerID, openServerDay + 1)  | 
|         gameWorld.SetGameWorldDict(FBPlayerDict_TotalExp % playerID, 0)  | 
|         gameWorld.SetGameWorldDict(FBPlayerDict_TotalExpPoint % playerID, 0)  | 
|         gameWorld.SetGameWorldDict(FBPlayerDict_TotalPoint % playerID, 0)  | 
|         gameWorld.SetGameWorldDict(FBPlayerDict_HasCollect % playerID, 0)  | 
|         gameWorld.SetGameWorldDict(FBPlayerDict_HasSit % playerID, 0)  | 
|           | 
|         FBCommon.ClearAreaRewardRecord(playerID)  | 
|           | 
|         FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_FamilyParty)  | 
|         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)  | 
|       | 
|     DoFBHelp(curPlayer, tick)  | 
|     return  | 
|   | 
|   | 
| def __GetRemainTick(tick):  | 
|     ##»î¶¯Ê£ÓàºÁÃë  | 
|     mapID = GameWorld.GetMap().GetMapID()  | 
|     startTick = GameWorld.GetGameWorld().GetGameWorldDictByKey(Map_FamilyPartyFB_StartTick)  | 
|     closeFB_RemainTick = max(0, FBCommon.GetFBLineStepTime(mapID)[0] * 1000 - (tick - startTick))  | 
|     return closeFB_RemainTick  | 
|   | 
|   | 
| ##¸±±¾¶¨Ê±Æ÷  | 
| # @param tick Ê±¼ä´Á  | 
| # @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):  | 
|             FBCommon.SetFBStep(FB_Step_Fighting, tick)  | 
|     elif fbStep == FB_Step_Fighting:  | 
|         if not FBCommon.GetFBFuncOpenState(ChConfig.Def_FBMapID_FamilyParty):  | 
|             FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)  | 
|             PyGameData.g_familyPartyInfo = []  | 
|             FBCommon.SetFBStep(FB_Step_Over, tick)  | 
|             FBCommon.DoLogic_FBKickAllPlayer()  | 
|             GameWorldProcess.CloseFB(tick)  | 
|         else:  | 
|             #FBCommon.DoLogicAreaReward("FamilyPartyAreaAward", tick)  | 
|             FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 10000)  | 
|               | 
|             mapID = GameWorld.GetMap().GetMapID()  | 
|             notifyIndex = gameFB.GetGameFBDictByKey(ChConfig.Map_FBDict_NotifyStart)  | 
|             notifySecondList = FBCommon.GetFBLineStepTime(mapID)[1]  | 
|             if notifyIndex < len(notifySecondList):  | 
|                 notifySecond = notifySecondList[notifyIndex]  | 
|                 remaindTick = max(0, __GetRemainTick(tick) - 1000)  | 
|                 if remaindTick <= (notifySecond + 1) * 1000:     | 
|                     #remaindSecond = remaindTick / 1000  | 
|                       | 
|                     PlayerControl.FamilyNotify(familyID, "Party_OverTime", [notifySecond])  | 
|                        | 
|                     GameWorld.GetGameFB().SetGameFBDict(ChConfig.Map_FBDict_NotifyStart, notifyIndex + 1)  | 
|               | 
|     return  | 
|   | 
|   | 
| def FamilyPartyAnswerRight(curPlayer):  | 
|     #»Ø´ðÕýÈ·£¬¸ø½±Àø  | 
| #    mapID = GameWorld.GetMap().GetMapID()  | 
| #    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)  | 
|       | 
|     curAnswerCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt, curAnswerCnt + 1)  | 
|   | 
|     if GameWorld.GetMap().GetMapID() == ChConfig.Def_FBMapID_FamilyParty:  | 
|         DoFBHelp(curPlayer, 0)  | 
|     return  | 
|   | 
|   | 
| def OnFamilyPartyStateChange(state, tick):  | 
|     #»î¶¯×´Ì¬±ä¸ü  | 
|     GameWorld.DebugLog('    ÏÉÃËÑç»á»î¶¯×´Ì¬±ä¸ü state=%s' % state)  | 
| #    if state == 0:  | 
| #        playerManager = GameWorld.GetPlayerManager()  | 
| #        for i in xrange(playerManager.GetPlayerCount()):  | 
| #            curPlayer = playerManager.GetPlayerByIndex(i)  | 
| #            if not curPlayer or curPlayer.IsEmpty():  | 
| #                continue  | 
| #            #´ð¶ÔÌâ»òÕß½ø¹ýͼµÄ¸ø²ÎÓë½±Àø  | 
| #            curAnswerCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt)  | 
| #            if FBCommon.GetEnterFBCount(curPlayer, ChConfig.Def_FBMapID_FamilyParty) or curAnswerCnt:  | 
| #                GiveJoinPrize(curPlayer)  | 
|       | 
|     mapID = GameWorld.GetMap().GetMapID()  | 
|     if mapID != ChConfig.Def_FBMapID_FamilyParty:  | 
|         return  | 
|   | 
|     if state == 1:  | 
|         GameWorld.GetGameWorld().SetGameWorldDict(Map_FamilyPartyFB_StartTick, tick)  | 
|       | 
|     return  | 
|   | 
| #  | 
| #def GiveJoinPrize(curPlayer):  | 
| #    #²ÎÓë½±  | 
| #    joinAward = IpyGameDataPY.GetFuncCfg('PartyReward')  | 
| #    if not joinAward:  | 
| #        return  | 
| #      | 
| #    PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, joinAward, True, ShareDefine.Def_AddFAVReason_FamilyParty)  | 
| #    return  | 
|   | 
|   | 
| ##»ñµÃÍæ¼Ò´«È븱±¾ÐèҪЯ´øµÄÐÅÏ¢  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param lineId ·ÖÏßID  | 
| # @return ×Ö·û´®  | 
| # @remarks  | 
| def GetPlayerResetWorldPosFBMsg(curPlayer, lineId):  | 
|     return '%s' % (curPlayer.GetPlayerID())  | 
|   | 
|   | 
| ##Íæ¼ÒÍ˳ö¼Ò×å´¦Àí  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| def OnLeaveFamily(curPlayer, tick):  | 
|     #GameWorld.DebugLog("OnLeaveFamily...")  | 
|     curPlayerID = curPlayer.GetPlayerID()  | 
|           | 
|     PlayerControl.PlayerLeaveFB(curPlayer)  | 
|     return  | 
|   | 
|   | 
| ## ÊÇ·ñ¸±±¾¸´»î  | 
| #  @param None  | 
| #  @return ÊÇ·ñ¸±±¾¸´»î  | 
| def OnPlayerReborn():  | 
|     return True  | 
|   | 
|   | 
| ##»ñµÃ¸±±¾°ïÖúÐÅÏ¢  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ÎÞÒâÒå  | 
| # @remarks ÓÃÓÚ֪ͨÕóÓª±È·ÖÌõ  | 
| def DoFBHelp(curPlayer, tick):  | 
|     #gameFB = GameWorld.GetGameFB()  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     playerID = curPlayer.GetPlayerID()  | 
|     totalExp = FBCommon.GetFBAreaRewardExp(gameWorld, playerID)  | 
|     curAnswerCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt)  | 
|     addPoint, addExp = IpyGameDataPY.GetFuncEvalCfg('PartyReward', 2)  | 
|     exp = gameWorld.GetGameWorldDictByKey(FBPlayerDict_TotalExp % playerID)  | 
|     expPoint = gameWorld.GetGameWorldDictByKey(FBPlayerDict_TotalExpPoint % playerID)  | 
|     totalExp = totalExp + expPoint * ChConfig.Def_PerPointValue + exp + addExp * curAnswerCnt  | 
|     exp = totalExp % ChConfig.Def_PerPointValue  | 
|     expPoint = totalExp / ChConfig.Def_PerPointValue  | 
|       | 
|     totalPoint = gameWorld.GetGameWorldDictByKey(FBPlayerDict_TotalPoint % playerID)  | 
|     #totalPoint += IpyGameDataPY.GetFuncCfg('PartyReward') #¼Ó²ÎÓë½±  | 
|     totalPoint += addPoint * curAnswerCnt  | 
|     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}  | 
|     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]}  | 
|       | 
|     GameWorld.DebugLog("DoFBHelp %s" % helpDict, playerID)  | 
|     FBCommon.Notify_FBHelp(curPlayer, helpDict)  | 
|     return  | 
|   | 
|   | 
| ##ÊÇ·ñ¿ÉÒԲɼ¯  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param curNPC NPCʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ÎÞÒâÒå  | 
| # @remarks  | 
| def OnCanCollect(curPlayer, curNPC, tick):  | 
|     hasCollect = GameWorld.GetGameWorld().GetGameWorldDictByKey(FBPlayerDict_HasCollect % curPlayer.GetID())  | 
|     if hasCollect:  | 
|         PlayerControl.NotifyCode(curPlayer, 'Party_HadCollected')  | 
|         return  | 
|     needSpace = len(IpyGameDataPY.GetFuncEvalCfg('FamilyPartyDesk', 3))  | 
|     packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)  | 
|     if needSpace > packSpace:  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")  | 
|         return  | 
|     return True  | 
|   | 
|   | 
| ##¸±±¾ÖÐ,²É¼¯ÎïÐèÒªLoadingʱ¼ä.  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param curNPC NPCʵÀý  | 
| # @return ·µ»ØÖµ, Loadingʱ¼ä  | 
| # @remarks ¸±±¾ÖÐ,²É¼¯ÎïÐèÒªLoadingʱ¼ä  | 
| def GetFBPrepareTime(curPlayer, curNPC):  | 
|     return IpyGameDataPY.GetFuncCfg('FamilyPartyDesk', 2) * 1000  | 
|   | 
|   | 
| ##Íæ¼ÒÊÕ¼¯³É¹¦(Ëþ, Æì)  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ÎÞÒâÒå  | 
| # @remarks  | 
| def OnCollectOK(curPlayer, npcID, tick):  | 
|     playerID = curPlayer.GetID()  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     gameWorld.SetGameWorldDict(FBPlayerDict_HasCollect % playerID, 1)  | 
|       | 
|     GameWorld.DebugLog('    Ñç»á²É¼¯³É¹¦£¡', playerID)  | 
|     #¸ø½±Àø  | 
|     itemAward = IpyGameDataPY.GetFuncEvalCfg('FamilyPartyDesk', 3)  | 
|     for itemID, itemCount, isBind in itemAward:  | 
|         ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem])  | 
|     addPoint = IpyGameDataPY.GetFuncCfg('FamilyPartyDesk')  | 
|     PlayerControl.NotifyCode(curPlayer, 'Party_CollectSuccess', [addPoint])  | 
|     PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, addPoint, True, ShareDefine.Def_AddFAVReason_FamilyParty)  | 
|       | 
|     totalPoint = gameWorld.GetGameWorldDictByKey(FBPlayerDict_TotalPoint % playerID)  | 
|     updPoint = totalPoint + addPoint  | 
|     gameWorld.SetGameWorldDict(FBPlayerDict_TotalPoint % playerID, updPoint)  | 
|     DoFBHelp(curPlayer, 0)  | 
|     return  | 
|   | 
|   | 
| ## ¸±±¾ÐÐΪ  | 
| #  @param curPlayer Íæ¼Ò  | 
| #  @param actionType ÐÐΪÀàÐÍ  | 
| #  @param actionInfo ÐÐΪÐÅÏ¢  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| def DoFBAction(curPlayer, actionType, actionInfo, tick):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     playerID = curPlayer.GetID()  | 
|     if actionType == 0:  #ÑûÇë´ò×ø  | 
|         tagPlayerID = actionInfo  | 
|         if curPlayer.GetPlayerAction() in [IPY_GameWorld.paSit, IPY_GameWorld.paPreparing]:  | 
|             GameWorld.DebugLog('ÑûÇë´ò×ø,Íæ¼ÒÒÑ´¦ÓÚ´ò×ø»ò²É¼¯×´Ì¬', playerID)  | 
|             return  | 
|         hasSit = gameWorld.GetGameWorldDictByKey(FBPlayerDict_HasSit % playerID)  | 
|         if hasSit:  | 
|             GameWorld.Log('ÑûÇë´ò×ø,Íæ¼ÒÒÑ´ò×ø¹ýÒ»´Î', playerID)  | 
|             return  | 
|   | 
|         copyMapPlayerManager = GameWorld.GetMapCopyPlayerManager()  | 
|         tagPlayer = copyMapPlayerManager.FindPlayerByID(tagPlayerID)  | 
|         if not tagPlayer:  | 
|             GameWorld.DebugLog('ÑûÇë%s´ò×ø,¸ÃÍæ¼Ò²»ÔÚ¸±±¾Àï' % tagPlayerID, playerID)  | 
|             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()  | 
|     elif actionType == 1:  #´ò×ø½áÊø¸ø½±Àø  | 
|         hasSit = gameWorld.GetGameWorldDictByKey(FBPlayerDict_HasSit % playerID)  | 
|         if hasSit:  | 
|             GameWorld.Log('´ò×ø½áÊø¸ø½±Àø,Íæ¼ÒÒÑ´ò×ø¹ýÒ»´Î', playerID)  | 
|             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  |