| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package Player.PlayerFairyCeremony  | 
| #  | 
| # @todo:ÏɽçÊ¢µä  | 
| # @author xdh  | 
| # @date 2018-07-23 16:50  | 
| # @version 1.0  | 
| #  | 
| #  | 
| # ÏêϸÃèÊö: ÏɽçÊ¢µä  | 
| #  | 
| #---------------------------------------------------------------------  | 
| """Version = 2018-07-23 16:50"""  | 
| #---------------------------------------------------------------------  | 
|   | 
| import ChPyNetSendPack  | 
| import GameWorld  | 
| import PlayerDBGSEvent  | 
| import ShareDefine  | 
| import NetPackCommon  | 
| import PlayerBillboard  | 
| import IpyGameDataPY  | 
| import PlayerCompensation  | 
|   | 
| (  | 
| Def_FC_Recharge, #³äÖµ´óÀñ  | 
| Def_FC_Fireworks, #ÑÌ»¨  | 
| Def_FC_Party, #È«ÃñÀ´àË  | 
| Def_FC_RechargeRank, #¾ø°æ½µÁÙ  | 
| ) = range(1, 5)  | 
|   | 
| def ResetFairyCeremony():  | 
|     ##»î¶¯¿ªÊ¼ ÖØÖÃÅÅÐаñÐÅÏ¢  | 
|     # Çå³ýÅÅÐаñ  | 
|       | 
|     PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_FCCostGold)  | 
|     return  | 
|   | 
| def OnFairyCeremonyEnd():  | 
|     #»î¶¯½áÊø  ¾ø°æ½µÁÙ¸ø½±Àø  | 
|     billBoard = GameWorld.GetBillboard().FindBillboard(ShareDefine.Def_BT_FCCostGold)  | 
|     if not billBoard:  | 
|         return  | 
|     worldLvNum = __GetFCWorldLVIndex(Def_FC_RechargeRank)  | 
|       | 
|     billboardCnt = billBoard.GetCount()  | 
|       | 
|     for index in range(0, billboardCnt):  | 
|         ipyData = IpyGameDataPY.GetIpyGameData('UniquenessArrive', worldLvNum, index + 1)  | 
|         if not ipyData:  | 
|             break  | 
|         objBillboard = billBoard.At(index)  | 
|         playerID = objBillboard.GetID()  | 
|         awardInfoDict = ipyData.GetAward()  | 
|         job = objBillboard.GetType2() % 10  | 
|         if str(job) not in awardInfoDict:  | 
|             GameWorld.ErrLog('    ¾ø°æ½µÁÙ¸ø½±Àø UniquenessArrive Î´ÅäÖøÃÖ°Òµ job=%s' % job, playerID)  | 
|             continue  | 
|           | 
|         awardList = awardInfoDict[str(job)]  | 
|         PlayerCompensation.SendMailByKey('CeremonyRank', [playerID], awardList, [objBillboard.GetName1(), index + 1])  | 
|           | 
|     GameWorld.DebugLog('    »î¶¯½áÊø  ¾ø°æ½µÁÙ¸ø½±Àø  worldLvNum=%s, billboardCnt=%s' % (worldLvNum, billboardCnt))  | 
|     return  | 
|   | 
| def __GetFCWorldLVIndex(fcType):  | 
|     #»ñÈ¡»î¶¯ÊÀ½çµÈ¼¶µµ  | 
|     playerFCWorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OActWorldLV % ShareDefine.OperationActionName_FairyCeremony)  | 
|     fcWorldlvDict = IpyGameDataPY.GetFuncEvalCfg('CeremonyWorldLv', 1, {})  | 
|     if str(fcType) not in fcWorldlvDict:  | 
|         return 0  | 
|     worldLVIndex = 0  | 
|     worldlvList = fcWorldlvDict[str(fcType)]  | 
|     for index, lvinfo in enumerate(worldlvList):  | 
|         minlv, maxlv = lvinfo  | 
|         if minlv <= playerFCWorldLV <= maxlv:  | 
|             worldLVIndex = index  | 
|             break  | 
|     return worldLVIndex  | 
|   | 
| def Sync_OperationAction_FairyCeremony(ipyData, curPlayer=None):  | 
|     ## Í¨ÖªÏɽçÊ¢µä»î¶¯ÐÅÏ¢  | 
|     if not ipyData:  | 
|         return  | 
|       | 
|     startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)  | 
|     fairyCeremonyInfo = ChPyNetSendPack.tagGCFairyCeremonyInfo()  | 
|     fairyCeremonyInfo.Clear()  | 
|     fairyCeremonyInfo.StartDate = startDateStr  | 
|     fairyCeremonyInfo.EndtDate = endDateStr  | 
|     fairyCeremonyInfo.WorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OActWorldLV % ShareDefine.OperationActionName_FairyCeremony)  | 
|     fairyCeremonyInfo.LimitLV = ipyData.GetLVLimit()  | 
|     fairyCeremonyInfo.ResetType = ipyData.GetResetType()  | 
|     if not curPlayer:  | 
|         # È«·þ¹ã²¥ÔÚÏßÍæ¼Ò  | 
|         playerManager = GameWorld.GetPlayerManager()  | 
|         for i in xrange(playerManager.GetPlayerCount()):  | 
|             curPlayer = playerManager.GetPlayerByIndex(i)  | 
|             if curPlayer == None or not curPlayer.GetInitOK():  | 
|                 continue  | 
|             NetPackCommon.SendFakePack(curPlayer, fairyCeremonyInfo)  | 
|     else:  | 
|         NetPackCommon.SendFakePack(curPlayer, fairyCeremonyInfo)  | 
|     return  |