| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package Player.PlayerFeastWish  | 
| #  | 
| # @todo:½ÚÈÕ×£¸£  | 
| # @author hxp  | 
| # @date 2021-01-29  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: ½ÚÈÕ×£¸£  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2021-01-29 11:30"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
| import ItemCommon  | 
| import PyGameData  | 
| import ShareDefine  | 
| import PlayerControl  | 
| import IpyGameDataPY  | 
| import ItemControler  | 
| import ChPyNetSendPack  | 
| import IPY_GameWorld  | 
| import NetPackCommon  | 
| import GameWorld  | 
| import ChConfig  | 
|   | 
| import random  | 
|   | 
| def OnPlayerLogin(curPlayer):  | 
|     isReset = __CheckPlayerFeastWishAction(curPlayer)  | 
|     if not isReset:  | 
|         actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})  | 
|         # »î¶¯ÖÐͬ²½»î¶¯ÐÅÏ¢  | 
|         if actInfo.get(ShareDefine.ActKey_State):  | 
|             Sync_FeastWishActionInfo(curPlayer)  | 
|             Sync_FeastWishPlayerInfo(curPlayer)  | 
|     return  | 
|   | 
| def RefreshFeastWishActionInfo():  | 
|     ## ÊÕµ½GameServerͬ²½µÄ»î¶¯ÐÅÏ¢£¬Ë¢Ð»ÐÅÏ¢  | 
|     playerManager = GameWorld.GetPlayerManager()  | 
|     for index in xrange(playerManager.GetPlayerCount()):  | 
|         curPlayer = playerManager.GetPlayerByIndex(index)  | 
|         if curPlayer.GetID() == 0:  | 
|             continue  | 
|         __CheckPlayerFeastWishAction(curPlayer)  | 
|     return  | 
|   | 
| def __CheckPlayerFeastWishAction(curPlayer):  | 
|     ## ¼ì²éÍæ¼Ò»î¶¯ÐÅÏ¢  | 
|       | 
|     playerID = curPlayer.GetPlayerID()  | 
|       | 
|     actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})  | 
|     actID = actInfo.get(ShareDefine.ActKey_ID, 0)  | 
|     state = actInfo.get(ShareDefine.ActKey_State, 0)  | 
|       | 
|     templateID = __GetWishTemplateID()  | 
|     playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishID) # Íæ¼ÒÉíÉϵĻID  | 
|     playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishTemplateID) # Íæ¼ÒÉíÉϵÄÄ£°åID  | 
|     # »î¶¯ID ÏàͬµÄ»°²»´¦Àí  | 
|     if actID == playerActID:  | 
|         GameWorld.DebugLog("½ÚÈÕ×£¸£»î¶¯ID²»±ä£¬²»´¦Àí£¡", curPlayer.GetPlayerID())  | 
|         if state:  | 
|             if templateID and templateID != playerTemplateID:  | 
|                 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishTemplateID, templateID)  | 
|         return  | 
|     GameWorld.DebugLog("½ÚÈÕ×£¸£»î¶¯ÖØÖÃ! actID=%s,playerActID=%s,state=%s,templateID=%s,playerTemplateID=%s"   | 
|                        % (actID, playerActID, state, templateID, playerTemplateID), playerID)  | 
|       | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishID, actID)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishTemplateID, templateID)  | 
|     if playerTemplateID:  | 
|         __SendWishBottleItemMail(curPlayer, playerTemplateID)  | 
|           | 
|     bottleNumList = GetWishBottleNumList()  | 
|     for bottleNum in bottleNumList:  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, 0)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum, 0)  | 
|           | 
|     if state:  | 
|         Sync_FeastWishActionInfo(curPlayer)  | 
|         Sync_FeastWishPlayerInfo(curPlayer)  | 
|     return True  | 
|   | 
| def __SendWishBottleItemMail(curPlayer, playerTemplateID):  | 
|     # Î´ÁìÈ¡µÄ½±ÀøÓʼþ·¢·Å  | 
|       | 
|     if not playerTemplateID:  | 
|         return  | 
|       | 
|     bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", playerTemplateID)  | 
|     if not bottleIpyDataList:  | 
|         return  | 
|       | 
|     playerID = curPlayer.GetPlayerID()  | 
|     batchPlayerIDList, batchAddItemList, batchParamList = [], [], []  | 
|     for ipyData in bottleIpyDataList:  | 
|         bottleNum = ipyData.GetWishBottleNum()  | 
|         choosePrizeItemDict = ipyData.GetChoosePrizeItem()  | 
|           | 
|         curWishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)  | 
|         getState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)  | 
|           | 
|         getIndexList = []  | 
|         for recordIndex in choosePrizeItemDict.keys():  | 
|             if getState & pow(2, recordIndex):  | 
|                 getIndexList.append(recordIndex)  | 
|                   | 
|         getTimes = len(getIndexList)  | 
|         maxTimes = ipyData.GetChooseTimeMax()  | 
|         if getTimes >= maxTimes:  | 
|             continue  | 
|           | 
|         needGiveTimes = min(maxTimes - getTimes, curWishValue / ipyData.GetNeedWishValue())  | 
|         if not needGiveTimes:  | 
|             continue  | 
|           | 
|         awardItemList = []  | 
|         for recordIndex, itemInfo in choosePrizeItemDict.items():  | 
|             if recordIndex in getIndexList:  | 
|                 continue  | 
|             awardItemList.append(itemInfo)  | 
|               | 
|             curWishValue = curWishValue - ipyData.GetNeedWishValue()  | 
|             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, curWishValue)  | 
|               | 
|             getState = getState | pow(2, recordIndex)  | 
|             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum, getState)  | 
|               | 
|             if len(awardItemList) >= needGiveTimes:  | 
|                 break  | 
|               | 
|         if not awardItemList:  | 
|             continue  | 
|           | 
|         batchPlayerIDList.append([playerID])  | 
|         batchAddItemList.append(awardItemList)  | 
|         batchParamList.append([bottleNum])  | 
|           | 
|     if batchPlayerIDList:  | 
|         PlayerControl.SendMailBatch("FeastWishBottleAwardMail", batchPlayerIDList, batchAddItemList, batchParamList)  | 
|           | 
|     return  | 
|   | 
| #// AA 10 ½ÚÈÕ×£¸£Æ¿Ñ¡Ôñ½±ÀøÎïÆ· #tagCMFeastWishBottleChooseItem  | 
| #  | 
| #struct    tagCMFeastWishBottleChooseItem  | 
| #{  | 
| #    tagHead        Head;  | 
| #    BYTE        BottleNum;    //Æ¿×Ó±àºÅ  | 
| #    BYTE        RecordIndex;    //ÎïÆ·Ë÷Òý£¬ÓÃÓÚÑ¡Ôñ¼°¼Ç¼ÊÇ·ñÒÑÑ¡Ôñ  | 
| #};  | 
| def OnFeastWishBottleChooseItem(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     bottleNum = clientData.BottleNum  | 
|     getRecordIndex = clientData.RecordIndex  | 
|       | 
|     templateID = __GetWishTemplateID()  | 
|     GameWorld.DebugLog("½ÚÈÕ×£¸£Æ¿Ñ¡Ôñ½±Àø! templateID=%s,bottleNum=%s,getRecordIndex=%s" % (templateID, bottleNum, getRecordIndex))  | 
|     if not templateID:  | 
|         return  | 
|       | 
|     bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)  | 
|     if not bottleIpyDataList:  | 
|         return  | 
|       | 
|     findIpyData = None  | 
|     for bottleIpyData in bottleIpyDataList:  | 
|         if bottleNum == bottleIpyData.GetWishBottleNum():  | 
|             findIpyData = bottleIpyData  | 
|             break  | 
|           | 
|     if not findIpyData:  | 
|         GameWorld.DebugLog("    ÕÒ²»µ½¶ÔÓ¦½ÚÈÕ×£¸£Æ¿! bottleNum=%s" % bottleNum)  | 
|         return  | 
|       | 
|     choosePrizeItemDict = findIpyData.GetChoosePrizeItem()  | 
|     if getRecordIndex not in choosePrizeItemDict:  | 
|         GameWorld.DebugLog("    ÕÒ²»µ½¶ÔÓ¦½ÚÈÕ×£¸£Æ¿½±ÀøÎïÆ·! getRecordIndex=%s" % getRecordIndex)  | 
|         return  | 
|       | 
|     curWishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)  | 
|     getState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)  | 
|     getTimes = 0  | 
|     for recordIndex in choosePrizeItemDict.keys():  | 
|         if getState & pow(2, recordIndex):  | 
|             getTimes += 1  | 
|             if getRecordIndex == recordIndex:  | 
|                 GameWorld.DebugLog("    ¸ÃÎïÆ·ÒѾѡÔñ¹ý! getRecordIndex=%s,getState=%s" % (getRecordIndex, getState))  | 
|                 return  | 
|               | 
|     if getTimes >= findIpyData.GetChooseTimeMax():  | 
|         GameWorld.DebugLog("    ÒÑûÓÐÁìÈ¡´ÎÊý! getState=%s,getTimes=%s >= %s" % (getState, getTimes, findIpyData.GetChooseTimeMax()))  | 
|         return  | 
|       | 
|     if curWishValue < findIpyData.GetNeedWishValue():  | 
|         GameWorld.DebugLog("    ×£¸£Öµ²»×ãÁìÈ¡! curWishValue=%s < %s" % (curWishValue, findIpyData.GetNeedWishValue()))  | 
|         return  | 
|       | 
|     if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):  | 
|         return  | 
|     itemInfo = choosePrizeItemDict[getRecordIndex]  | 
|     itemID, itemCount, isAuctionItem = itemInfo  | 
|     if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem], ["", False, {}]):  | 
|         return  | 
|       | 
|     updWishValue = curWishValue - findIpyData.GetNeedWishValue()  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, updWishValue)  | 
|       | 
|     updGetState = getState | pow(2, getRecordIndex)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum, updGetState)  | 
|       | 
|     Sync_FeastWishPlayerInfo(curPlayer, [bottleNum])  | 
|       | 
|     GameWorld.DebugLog("    Ñ¡Ôñ³É¹¦: getState=%s,updGetState=%s,curWishValue=%s,updWishValue=%s,itemInfo=%s"   | 
|                        % (getState, updGetState, curWishValue, updWishValue, itemInfo))  | 
|       | 
|     if itemID in findIpyData.GetGoodItemIDList():  | 
|         recFromType = 1 # ¼Ç¼À´Ô´£º 1-×£¸£Æ¿£¬2-×£¸£³Ø  | 
|         valueList = [itemID, itemCount, recFromType]  | 
|         strValueList = [curPlayer.GetPlayerName()]  | 
|         notifyType = 4 # Í¨ÖªÈ«·þµ¥Ìõ  | 
|         GameWorld.AddUniversalGameRec(0, ShareDefine.Def_UniversalGameRecType_FeastWish, valueList, strValueList, notifyType)  | 
|           | 
|         notifyKey = findIpyData.GetWorldNotifyKey()  | 
|         if notifyKey:  | 
|             PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName(), itemID, "", itemCount])  | 
|               | 
|     return  | 
|   | 
| #// AA 11 ½ÚÈÕ×£¸£³Ø×£¸£ #tagCMFeastWishPoolWish  | 
| #  | 
| #struct    tagCMFeastWishPoolWish  | 
| #{  | 
| #    tagHead        Head;  | 
| #    BYTE        WishCount;    //×£¸£´ÎÊý  | 
| #};  | 
| def OnFeastWishPoolWish(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     wishCount = clientData.WishCount  | 
|       | 
|     templateID = __GetWishTemplateID()  | 
|     GameWorld.DebugLog("Íæ¼Ò½ÚÈÕ×£¸£: wishCount=%s,templateID=%s" % (wishCount, templateID))  | 
|     if not templateID:  | 
|         return  | 
|       | 
|     bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)  | 
|     poolIpyData = IpyGameDataPY.GetIpyGameData("ActFeastWishPool", templateID)  | 
|     if not bottleIpyDataList or not poolIpyData:  | 
|         return  | 
|       | 
|     canWishCountList = IpyGameDataPY.GetFuncEvalCfg("FeastWishCfg", 2)  | 
|     if wishCount not in canWishCountList:  | 
|         return  | 
|       | 
|     costItemID = IpyGameDataPY.GetFuncCfg("FeastWishCfg", 1)  | 
|       | 
|     costItemNeedCount = wishCount  | 
|     costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID)  | 
|     lackCount = max(0, costItemNeedCount - bindCnt - unBindCnt)  | 
|     if lackCount > 0:  | 
|         GameWorld.DebugLog("    ËùÐè×£¸£µÀ¾ß²»×ã!costItemID=%s,costItemNeedCount=%s,lackCount=%s"   | 
|                            % (costItemID, costItemNeedCount, lackCount))  | 
|         return  | 
|       | 
|     giveWishValueTotal = 0  | 
|     wishValueRange = IpyGameDataPY.GetFuncEvalCfg("FeastWishCfg", 3)  | 
|       | 
|     giveItemDict = {} # ÓÃÓÚÅжÏÕ¼Óñ³°üÓà  | 
|     giveItemList = [] # ÓÃÓÚʵ¼Ê¸øÎïÆ·¼°Í¨ÖªÇ°¶ËÓã¬Ò»¸ö¸ö¸ø  | 
|     isAuctionItem = 0 # Ä¬Èϸø·ÇÅÄÆ·  | 
|     itemWeightInfoList = poolIpyData.GetWishPoolItemWeightInfo()  | 
|     for _ in xrange(wishCount):  | 
|         randItemInfo = GameWorld.GetResultByWeightList(itemWeightInfoList)  | 
|         if not randItemInfo:  | 
|             GameWorld.ErrLog("½ÚÈÕ×£¸£³ØÎïÆ·È¨ÖØÅäÖÃÒì³£! %s" % itemWeightInfoList)  | 
|             return  | 
|         itemID, itemCount = randItemInfo  | 
|         giveItemList.append([itemID, itemCount, isAuctionItem])  | 
|         giveItemDict[itemID] = giveItemDict.get(itemID, 0) + itemCount  | 
|         giveWishValueTotal += random.randint(wishValueRange[0], wishValueRange[1])  | 
|           | 
|     checkSpaceList = [[itemID, itemCount, isAuctionItem] for itemID, itemCount in giveItemDict.items()]  | 
|     if not ItemControler.CheckPackSpaceEnough(curPlayer, checkSpaceList):  | 
|         return  | 
|       | 
|     GameWorld.DebugLog("    giveWishValueTotal=%s,giveItemList=%s" % (giveWishValueTotal, giveItemList))  | 
|       | 
|     # ¿Û³ýÏûºÄ  | 
|     ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemNeedCount, "FeastWish")  | 
|       | 
|     # ¼Ó×£¸£Öµ  | 
|     syncBottleNumList = []  | 
|     for bottleIpyData in bottleIpyDataList:  | 
|         bottleNum = bottleIpyData.GetWishBottleNum()  | 
|         curWishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)  | 
|         getState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)  | 
|         getTimes = 0  | 
|         for recordIndex in bottleIpyData.GetChoosePrizeItem().keys():  | 
|             if getState & pow(2, recordIndex):  | 
|                 getTimes += 1  | 
|         canGetTimes = max(0, bottleIpyData.GetChooseTimeMax() - getTimes)  | 
|         wishValueMax = bottleIpyData.GetNeedWishValue() * canGetTimes  | 
|         if curWishValue >= wishValueMax:  | 
|             GameWorld.DebugLog("    Æ¿×Ó×£¸£ÖµÒÑÂú! bottleNum=%s,canGetTimes=%s,wishValueMax=%s <= curWishValue=%s"   | 
|                                % (bottleNum, canGetTimes, wishValueMax, curWishValue))  | 
|             continue  | 
|         updWishValue = min(wishValueMax, curWishValue + giveWishValueTotal)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, updWishValue)  | 
|         GameWorld.DebugLog("    Æ¿×Ó×£¸£Öµ¸üÐÂ! bottleNum=%s,canGetTimes=%s,wishValueMax=%s,curWishValue=%s,updWishValue=%s"   | 
|                            % (bottleNum, canGetTimes, wishValueMax, curWishValue, updWishValue))  | 
|         syncBottleNumList.append(bottleNum)  | 
|           | 
|     # ¸øÎïÆ·  | 
|     goodItemIDList = poolIpyData.GetGoodItemIDList()  | 
|     notifyKey = poolIpyData.GetWorldNotifyKey()  | 
|     for itemID, itemCount, isAuctionItem in giveItemList:  | 
|         itemObj = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)  | 
|         itemUserData = itemObj.GetUserData()  | 
|         isOK = ItemControler.DoLogic_PutItemInPack(curPlayer, itemObj, ["FeastWish", False, {}], [IPY_GameWorld.rptItem])  | 
|           | 
|         if isOK and itemID in goodItemIDList:  | 
|             # Í¨ÖªGameServer¼Ç¼ºÃÎïÆ·ÂÖ²¥  | 
|             recFromType = 2 # ¼Ç¼À´Ô´£º 1-×£¸£Æ¿£¬2-×£¸£³Ø  | 
|             valueList = [itemID, itemCount, recFromType]  | 
|             strValueList = [curPlayer.GetPlayerName()]  | 
|             notifyType = 4 # Í¨ÖªÈ«·þµ¥Ìõ  | 
|             GameWorld.AddUniversalGameRec(0, ShareDefine.Def_UniversalGameRecType_FeastWish, valueList, strValueList, notifyType)  | 
|               | 
|             if notifyKey:  | 
|                 PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName(), itemID, itemUserData, itemCount])  | 
|                   | 
|     # Í¨ÖªÇ°¶Ë½á¹û  | 
|     retPack = ChPyNetSendPack.tagMCFeastWishResult()  | 
|     retPack.AddWishValue = giveWishValueTotal  | 
|     retPack.WishResult = str(giveItemList)  | 
|     retPack.WishResultLen = len(retPack.WishResult)  | 
|     NetPackCommon.SendFakePack(curPlayer, retPack)  | 
|       | 
|     if syncBottleNumList:  | 
|         Sync_FeastWishPlayerInfo(curPlayer, syncBottleNumList)  | 
|           | 
|     return  | 
|   | 
| def GetFeastWishDropItemIDList(curPlayer, npcData):  | 
|     ## »ñÈ¡µôÂä×£¸£µÀ¾ßIDÁÐ±í  | 
|     ## @return: [itemID, ...]  | 
|       | 
|     actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})  | 
|     if not actInfo:  | 
|         return []  | 
|       | 
|     if not actInfo.get(ShareDefine.ActKey_State):  | 
|         return []  | 
|       | 
|     if not ChConfig.IsGameBoss(npcData):  | 
|         return []  | 
|       | 
|     npcID = npcData.GetNPCID()  | 
|     killBossCntLimitDict = IpyGameDataPY.GetFuncCfg('KillBossCntLimit', 1)  | 
|     limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, npcID)  | 
|     if limitIndex not in [ShareDefine.Def_Boss_Func_World, ShareDefine.Def_Boss_Func_Home]:  | 
|         # ¹æ¶¨Ö»ÓÐÊÀ½çboss¡¢bossÖ®¼Ò¿ÉµôÂä  | 
|         return  | 
|       | 
|     dropRate = IpyGameDataPY.GetFuncCfg("FeastWishCfg", 4)  | 
|     if not GameWorld.CanHappen(dropRate):  | 
|         return  | 
|     wishItemID = IpyGameDataPY.GetFuncCfg("FeastWishCfg", 1) # Ä¬Èϵô1¸ö  | 
|     #GameWorld.DebugLog("µôÂä½ÚÈÕ×£¸£µÀ¾ß: npcID=%s,dropRate=%s,wishItemID=%s" % (npcID, dropRate, wishItemID))  | 
|     return [wishItemID]  | 
|   | 
| def Sync_FeastWishPlayerInfo(curPlayer, bottleNumList=[]):  | 
|     ## Í¨Öª»î¶¯Íæ¼ÒÐÅÏ¢  | 
|       | 
|     if bottleNumList:  | 
|         syncBottleNumList = bottleNumList  | 
|     else:  | 
|         syncBottleNumList = GetWishBottleNumList()  | 
|       | 
|     playerPack = ChPyNetSendPack.tagMCFeastWishPlayerInfo()  | 
|     playerPack.PlayerBottleInfo = []  | 
|     for bottleNum in syncBottleNumList:  | 
|         playerBottle = ChPyNetSendPack.tagMCFeastWishPlayerBottle()  | 
|         playerBottle.BottleNum = bottleNum  | 
|         playerBottle.WishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)  | 
|         playerBottle.ChooseRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)  | 
|         playerPack.PlayerBottleInfo.append(playerBottle)  | 
|     playerPack.BottleCount = len(playerPack.PlayerBottleInfo)  | 
|     NetPackCommon.SendFakePack(curPlayer, playerPack)  | 
|     return  | 
|   | 
| def GetWishBottleNumList():  | 
|     templateID = __GetWishTemplateID()  | 
|     if not templateID:  | 
|         return []  | 
|       | 
|     bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)  | 
|     if not bottleIpyDataList:  | 
|         return []  | 
|     return [bottleIpyData.GetWishBottleNum() for bottleIpyData in bottleIpyDataList]  | 
|   | 
| def __GetWishTemplateID():  | 
|     actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})  | 
|     if not actInfo:  | 
|         return 0  | 
|       | 
|     if not actInfo.get(ShareDefine.ActKey_State):  | 
|         return 0  | 
|       | 
|     cfgID = actInfo.get(ShareDefine.ActKey_CfgID)  | 
|     ipyData = IpyGameDataPY.GetIpyGameData("ActFeastWish", cfgID)  | 
|     if not ipyData:  | 
|         return 0  | 
|       | 
|     worldLV = actInfo.get(ShareDefine.ActKey_WorldLV)  | 
|     templateID = GameWorld.GetDictValueByRangeKey(ipyData.GetTemplateIDInfo(), worldLV, 0)  | 
|     return templateID  | 
|   | 
| def Sync_FeastWishActionInfo(curPlayer):  | 
|     ## Í¨Öª»î¶¯ÐÅÏ¢  | 
|     actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})  | 
|     if not actInfo:  | 
|         return  | 
|       | 
|     if not actInfo.get(ShareDefine.ActKey_State):  | 
|         return  | 
|       | 
|     cfgID = actInfo.get(ShareDefine.ActKey_CfgID)  | 
|     ipyData = IpyGameDataPY.GetIpyGameData("ActFeastWish", cfgID)  | 
|     if not ipyData:  | 
|         return  | 
|       | 
|     worldLV = actInfo.get(ShareDefine.ActKey_WorldLV)  | 
|     templateID = GameWorld.GetDictValueByRangeKey(ipyData.GetTemplateIDInfo(), worldLV, 0)  | 
|     if not templateID:  | 
|         return  | 
|       | 
|     bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)  | 
|     poolIpyData = IpyGameDataPY.GetIpyGameData("ActFeastWishPool", templateID)  | 
|       | 
|     openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1  | 
|     actPack = ChPyNetSendPack.tagMCFeastWishInfo()  | 
|     actPack.Clear()  | 
|     actPack.StartDate = GameWorld.GetOperationActionDateStr(ipyData.GetStartDate(), openServerDay)  | 
|     actPack.EndtDate = GameWorld.GetOperationActionDateStr(ipyData.GetEndDate(), openServerDay)  | 
|     actPack.ResetType = ipyData.GetResetType()  | 
|     actPack.WishPoolShowItemList = poolIpyData.GetWishPoolClientItemShow() if poolIpyData else []  | 
|     actPack.WishPoolShowCount = len(actPack.WishPoolShowItemList)  | 
|     actPack.BottleInfoList = []  | 
|     if bottleIpyDataList:  | 
|         for bottleIpyData in bottleIpyDataList:  | 
|             bottleInfo = ChPyNetSendPack.tagMCFeastWishBottleInfo()  | 
|             bottleInfo.BottleNum = bottleIpyData.GetWishBottleNum()  | 
|             bottleInfo.NeedWishValue = bottleIpyData.GetNeedWishValue()  | 
|             bottleInfo.ChooseTimeMax = bottleIpyData.GetChooseTimeMax()  | 
|             bottleInfo.ChoosePrizeList = []  | 
|             prizeItemDict = bottleIpyData.GetChoosePrizeItem()  | 
|             for recordIndex, itemInfo in prizeItemDict.items():  | 
|                 itemID, itemCount, isAuctionItem = itemInfo  | 
|                 itemInfo = ChPyNetSendPack.tagMCFeastWishBottleItem()  | 
|                 itemInfo.RecordIndex = recordIndex  | 
|                 itemInfo.ItemID = itemID  | 
|                 itemInfo.ItemCount = itemCount  | 
|                 itemInfo.IsBind = isAuctionItem  | 
|                 bottleInfo.ChoosePrizeList.append(itemInfo)  | 
|             bottleInfo.ChoosePrizeCount = len(bottleInfo.ChoosePrizeList)  | 
|             actPack.BottleInfoList.append(bottleInfo)  | 
|     actPack.BottleCount = len(actPack.BottleInfoList)  | 
|     NetPackCommon.SendFakePack(curPlayer, actPack)  | 
|     return  | 
|   |