| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package Player.PlayerWishingWell  | 
| #  | 
| # @todo:ÐíÔ¸³Ø  | 
| # @author xdh  | 
| # @date 2018-10-18 19:50  | 
| # @version 1.0  | 
| #  | 
| #  | 
| # ÏêϸÃèÊö: ÐíÔ¸³Ø  | 
| #  | 
| #---------------------------------------------------------------------  | 
| """Version = 2018-10-18 19:50"""  | 
| #---------------------------------------------------------------------  | 
|   | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import ChConfig  | 
| import IpyGameDataPY  | 
| import PlayerControl  | 
| import ChPyNetSendPack  | 
| import NetPackCommon  | 
| import ShareDefine  | 
| import PyGameData  | 
| import ItemControler  | 
| import ItemCommon  | 
|   | 
| import datetime  | 
| import time  | 
|   | 
| g_randomWellDict = {}  | 
|   | 
|   | 
| (  | 
| WellType_Select,  #¿ÉÑ¡¿â  | 
| WellType_Result,  #½á¹û¿â  | 
| WellType_Get,  #¿ÉÁìÈ¡¿â  | 
| ) = range(3)  | 
|   | 
|   | 
| def __GetItemInfoByData(curPlayer, wellType, i):  | 
|     itemData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WishingWellItem % (wellType, i))  | 
|     itemCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WishingWellItemCnt % (wellType, i))  | 
|     itemID, isBind, isSpecial = itemData / 100, itemData % 100 / 10, itemData % 10  | 
|     return itemID, itemCnt, isBind, isSpecial  | 
|   | 
|   | 
| def __SetItemData(curPlayer, wellType, i, itemID, itemCnt, isBind, isSpecial):  | 
|     itemID = __GetJobItemID(curPlayer, itemID)  | 
|     itemData = itemID * 100 + isBind * 10 + isSpecial  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WishingWellItem % (wellType, i), itemData)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WishingWellItemCnt % (wellType, i), itemCnt)  | 
|     return  | 
|   | 
|   | 
| def __GetJobItemID(curPlayer, itemID):  | 
|     if type(itemID) == int:  | 
|         return itemID  | 
|     if type(itemID) != dict:  | 
|         return 0  | 
|     return itemID.get(curPlayer.GetJob(), 0)  | 
|   | 
|   | 
| def OnLogin(curPlayer):  | 
|     isReset = __CheckPlayerWishingWellAction(curPlayer)  | 
|     if not isReset:  | 
|         actCostRebateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WishingWell, {})  | 
|         # »î¶¯ÖÐͬ²½»î¶¯ÐÅÏ¢  | 
|         if actCostRebateInfo.get(ShareDefine.ActKey_State):  | 
|             SyncWishingWellInfo(curPlayer)  | 
|             SyncWishingWellPlayerInfo(curPlayer)  | 
|         elif __GetItemInfoByData(curPlayer, WellType_Get, 0)[0]:  | 
|             SyncWishingWellPlayerInfo(curPlayer)  | 
|     return  | 
|   | 
| def OnDay(curPlayer):  | 
|     actCostRebateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WishingWell, {})  | 
|     if not actCostRebateInfo.get(ShareDefine.ActKey_State):  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WishingWellFreeTime, 0)  | 
|         __SendWishingWellMail(curPlayer, int(time.time()))  | 
|     return  | 
|   | 
| def RefreshWishingWellAction():  | 
|     __InitWishRateList()  | 
|     playerManager = GameWorld.GetPlayerManager()  | 
|     for i in xrange(playerManager.GetPlayerCount()):  | 
|         curPlayer = playerManager.GetPlayerByIndex(i)  | 
|         if curPlayer == None or not curPlayer.GetInitOK():  | 
|             continue  | 
|         __CheckPlayerWishingWellAction(curPlayer)  | 
|     return  | 
|   | 
|   | 
| def __CheckPlayerWishingWellAction(curPlayer):  | 
|     ## ¼ì²éÍæ¼ÒÐíÔ¸³Ø»î¶¯Êý¾ÝÐÅÏ¢  | 
|     global g_randomWellDict  | 
|   | 
|     playerID = curPlayer.GetPlayerID()  | 
|       | 
|     actWishingWellInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WishingWell, {})  | 
|     WishingWellID = actWishingWellInfo.get(ShareDefine.ActKey_ID, 0)  | 
|     state = actWishingWellInfo.get(ShareDefine.ActKey_State, 0)  | 
|     cfgID = actWishingWellInfo.get(ShareDefine.ActKey_CfgID, 0)  | 
|     worldLV = actWishingWellInfo.get(ShareDefine.ActKey_WorldLV, 0)  | 
|     playerWishingWellID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WishingWellID)  # Íæ¼ÒÉíÉϵĻID  | 
|       | 
|     # »î¶¯ID ÏàͬµÄ»°²»´¦Àí  | 
|     if WishingWellID == playerWishingWellID:  | 
|         #GameWorld.DebugLog("ÐíÔ¸³Ø»î¶¯ID²»±ä£¬²»´¦Àí£¡", curPlayer.GetPlayerID())  | 
|         return  | 
|       | 
|     GameWorld.DebugLog("ÐíÔ¸³ØÖØÖÃ! WishingWellID=%s,playerWishingWellID=%s,state=%s,worldLv=%s"   | 
|                        % (WishingWellID, playerWishingWellID, state, worldLV), playerID)  | 
|       | 
|     # Î´ÁìÈ¡µÄ½±ÀøÓʼþ·¢·Å  | 
|     curDataTime = GameWorld.GetCurrentTime()  | 
|     curDayTime = datetime.datetime(curDataTime.year, curDataTime.month, curDataTime.day, 0, 0, 0)  | 
|     curDayTimeNum = GameWorld.ChangeTimeStrToNum(str(curDayTime))  | 
|     __SendWishingWellMail(curPlayer, WishingWellID or curDayTimeNum, state)  | 
|           | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WishingWellID, WishingWellID)  | 
|     #ÿÌì¿ªÊ¼Ëæ»úÒ»´ÎÃâ·ÑÅÌ  | 
|     if state:  | 
|         #g_randomWellDict = {}  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WishingWellRefreshCnt, 0)  | 
|         __DoActWishingRefresh(curPlayer, 1, True)  | 
|    | 
|         SyncWishingWellInfo(curPlayer)  | 
|     SyncWishingWellPlayerInfo(curPlayer)  | 
|     return True  | 
|   | 
|   | 
| def __SendWishingWellMail(curPlayer, curTime, state=-1):  | 
|     lastAwardTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WishingWellAwardTime)  | 
|       | 
|     if not lastAwardTime:  | 
|         if state != -1:  | 
|             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WishingWellAwardTime, curTime)  | 
|             GameWorld.DebugLog('__SendWishingWellMail curTime =%s'%curTime)  | 
|         return  | 
|     GameWorld.DebugLog('ÐíÔ¸³ØÎ´ÁìÈ¡µÄ½±ÀøÓʼþ·¢·Å¼ì²é lastAwardTime=%s,state=%s,pass=%s'%(lastAwardTime, state, curTime - lastAwardTime))  | 
|     passDay = (curTime - lastAwardTime)/86000  | 
|     if passDay <= 0:  | 
|         return  | 
|     isOver = True  | 
|     count = IpyGameDataPY.GetFuncCfg('WishingWellCfg', 4)  | 
|     mailItemList = []  | 
|     saveItemList = []  | 
|     for i in xrange(count):  | 
|         itemID, itemCnt, isBind, isSpecial = __GetItemInfoByData(curPlayer, WellType_Get, i)  | 
|         if itemID:  | 
|             mailItemList.append([itemID, itemCnt, isBind])  | 
|             __SetItemData(curPlayer, WellType_Get, i, 0, 0, 0, 0)  | 
|     j = 0  | 
|     for i in xrange(count):  | 
|         itemID, itemCnt, isBind, isSpecial = __GetItemInfoByData(curPlayer, WellType_Result, i)  | 
|         if not itemID:  | 
|             continue  | 
|           | 
|         if passDay == 1: #Ïà²îÒ»Ì죬´æ´¢½±Àø   | 
|             __SetItemData(curPlayer, WellType_Get, j, itemID, itemCnt, isBind, isSpecial)  | 
|             saveItemList.append([itemID, itemCnt, isBind])  | 
|             isOver = False  | 
|         elif passDay > 1: #´óÓÚ1Ì죬ֱ½ÓÓʼþ·¢½±Àø  | 
|             mailItemList.append([itemID, itemCnt, isBind])  | 
|         __SetItemData(curPlayer, WellType_Result, i, 0, 0, 0, 0)  | 
|         j +=1  | 
|     if state > 0:  | 
|         isOver = False  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WishingWellAwardTime, 0 if isOver else curTime)  | 
|     if mailItemList:  | 
|         PlayerControl.SendMailByKey('WishPool', [curPlayer.GetID()], mailItemList)  | 
|         if state == -1:  | 
|             SyncWishingWellPlayerInfo(curPlayer)  | 
|     GameWorld.DebugLog('ÐíÔ¸³Ø¾àÀëʱ¼ä passDay=%s,mailItemList=%s,saveItemList=%s,isOver=%s,curTime=%s'%(passDay, mailItemList, saveItemList, isOver, curTime), curPlayer.GetID())  | 
|     return  | 
|   | 
|   | 
| def __InitWishRateList():  | 
|     ## ³õʼÐíÔ¸³ØËæ»ú¿â  | 
|     global g_randomWellDict  | 
|     actWishingWellInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WishingWell, {})  | 
|     state = actWishingWellInfo.get(ShareDefine.ActKey_State, 0)  | 
|     cfgID = actWishingWellInfo.get(ShareDefine.ActKey_CfgID, 0)  | 
|     worldLV = actWishingWellInfo.get(ShareDefine.ActKey_WorldLV, 0)  | 
|     if not cfgID or not state:  | 
|         return  | 
|     actIpyData = IpyGameDataPY.GetIpyGameData("ActWishingWell", cfgID)  | 
|     if not actIpyData:  | 
|         return  | 
|     templateID = actIpyData.GetTemplateID()  | 
|     ipyDataList = IpyGameDataPY.GetIpyGameDataList('WishingWell', templateID)  | 
|     if not ipyDataList:  | 
|         return  | 
|     g_randomWellDict = {}  # {ÊÇ·ñÃâ·Ñ:[[È¨ÖØ,[ÎïÆ·ID,ÊýÁ¿,ÊÇ·ñ°ó¶¨,±êʶ]]]}  | 
|     weightDict = {}  | 
|     for ipyData in ipyDataList:  | 
|         worldLVLimit = ipyData.GetWorldLVLimit()  | 
|         if worldLV < worldLVLimit[0] or worldLV > worldLVLimit[1]:  | 
|             continue  | 
|         isFree = ipyData.GetIsFree()  | 
|         itemID = ipyData.GetItemID()  | 
|         itemCnt = ipyData.GetItemCnt()  | 
|         isBind = ipyData.GetIsBind()  | 
|         weight = ipyData.GetWeight()  | 
|         mark = ipyData.GetMark()  | 
|         rare = ipyData.GetRare()  | 
|         weightDict[isFree] = weightDict.get(isFree, 0) + weight  | 
|         if isFree not in g_randomWellDict:  | 
|             g_randomWellDict[isFree] = []  | 
|         g_randomWellDict[isFree].append([weightDict[isFree], [itemID, itemCnt, isBind, mark, rare]])  | 
|           | 
|           | 
|     GameWorld.DebugLog('    ³õʼÐíÔ¸³ØËæ»ú¿â g_randomWellDict=%s' % (g_randomWellDict))  | 
|     return  | 
|   | 
|   | 
| def __GetRandomRateList(isFree):  | 
|     ## »ñÈ¡Ôö³¤ÁÐ±í  | 
|     if not g_randomWellDict:  | 
|         __InitWishRateList()  | 
|     return g_randomWellDict.get(isFree, [])  | 
|   | 
|   | 
| #// AA 07 ÐíÔ¸³Ø»î¶¯Ë¢Ð½±³Ø #tagCMActWishingRefresh  | 
| #struct     tagCMActWishingRefresh  | 
| #{  | 
| #    tagHead        Head;  | 
| #    BYTE        IsFree;         // ÊÇ·ñÃâ·ÑˢР | 
| #};  | 
| def OnActWishingRefresh(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     actBossRebornInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WishingWell, {})  | 
|     state = actBossRebornInfo.get(ShareDefine.ActKey_State, 0)  | 
|     cfgID = actBossRebornInfo.get(ShareDefine.ActKey_CfgID, 0)  | 
|     if not state or not cfgID:  | 
|         return  | 
|       | 
|     isFree = clientData.IsFree  | 
|     __DoActWishingRefresh(curPlayer, isFree)  | 
|     #֪ͨ  | 
|     SyncWishingWellPlayerInfo(curPlayer)  | 
|     return  | 
|   | 
| def __DoActWishingRefresh(curPlayer, isFree, isSystem=False):  | 
|     randomRateList = __GetRandomRateList(isFree)  | 
|     if not randomRateList:  | 
|         GameWorld.DebugLog('    ÐíÔ¸³Ø»î¶¯Ë¢Ð½±³Ø Ëæ»ú¿â»ñÈ¡´íÎ󠣡')  | 
|         return  | 
|     playerID = curPlayer.GetID()  | 
|     GameWorld.DebugLog(' isFree=%s, randomRateList=%s' % (isFree, randomRateList))  | 
|       | 
|     if isFree:  | 
|         if not isSystem:  | 
|             freeStartTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WishingWellFreeTime)  | 
|             curTime = int(time.time())  | 
|             freeCountCD = IpyGameDataPY.GetFuncCfg('WishingWellCfg')  | 
|             if curTime - freeStartTime < freeCountCD:  | 
|                 GameWorld.DebugLog('ÐíÔ¸³Ø»î¶¯Ãâ·Ñˢн±³Ø£¬ Ãâ·ÑCDδµ½£¡ freeCountCD=%s, passTime=%s' % (freeCountCD, curTime - freeStartTime), playerID)  | 
|                 return  | 
|     else:  | 
|         refreshCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WishingWellRefreshCnt)  | 
|         infoDict = {'refreshCnt':refreshCnt}  | 
|         costMoney = eval(IpyGameDataPY.GetFuncCompileCfg('WishingWellCfg', 2))  | 
|         if not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costMoney):  | 
|             return  | 
|           | 
|     randomCnt = IpyGameDataPY.GetFuncCfg('WishingWellCfg', 3)  | 
|     randomResultList = GameWorld.GetResultByRandomListEx(randomRateList, randomCnt, [])  | 
|     if len(randomResultList) != randomCnt:  | 
|         GameWorld.DebugLog('    ÐíÔ¸³Ø»î¶¯Ë¢Ð½±³Ø Ëæ»ú¿â½á¹û »ñÈ¡´íÎ󠣡randomCnt=%s, randomResultList=%s' % (randomCnt, randomResultList))  | 
|         return  | 
|       | 
|     if not isFree:  | 
|         PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costMoney, ChConfig.Def_Cost_WishingWell, infoDict)  | 
|         #Ôö¼Ó´ÎÊý  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WishingWellRefreshCnt, refreshCnt+1)  | 
|     elif not isSystem:  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WishingWellFreeTime, int(time.time()))  | 
|           | 
|     for i, info in enumerate(randomResultList):  | 
|         itemID, itemCnt, isBind, mark, rare = info  | 
|         isSpecial = rare  | 
|         __SetItemData(curPlayer, WellType_Select, i, itemID, itemCnt, isBind, isSpecial)  | 
|     GameWorld.DebugLog(' ÐíÔ¸³Ø»î¶¯Ë¢Ð isFree=%s, randomResultList=%s' % (isFree, randomResultList), playerID)  | 
|     return  | 
|   | 
| #// AA 06 ÐíÔ¸³Ø»î¶¯ÐíÔ¸ #tagCMActWishing  | 
| #struct     tagCMActWishing  | 
| #{  | 
| #    tagHead        Head;  | 
| #    BYTE        SrcWellType;         // À´Ô´¿â 0-¿ÉÑ¡¿â 1-½á¹û¿â  | 
| #    BYTE        SrcIndex;         // À´Ô´Ë÷Òý  | 
| #    BYTE        DesWellType;         // Ä¿±ê¿â 0-¿ÉÑ¡¿â 1-½á¹û¿â  | 
| #    BYTE        DesIndex;         // Ä¿±êË÷Òý  | 
| #};  | 
| def OnActWishingDrag(index, clientData, tick):  | 
|     srcWellType = clientData.SrcWellType  | 
|     srcIndex = clientData.SrcIndex  | 
|     desWellType = clientData.DesWellType  | 
|     desIndex = clientData.DesIndex  | 
|     if srcWellType not in [WellType_Select, WellType_Result] or desWellType not in [WellType_Select, WellType_Result]:  | 
|         return  | 
|     if srcWellType == desWellType:  | 
|         return  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     playerID = curPlayer.GetID()  | 
|     srcitemID, srcitemCnt, srcisBind, srcisSpecial = __GetItemInfoByData(curPlayer, srcWellType, srcIndex)  | 
|     if not srcitemID:  | 
|         GameWorld.DebugLog('ÐíÔ¸³Ø»î¶¯ÍÏ×§ÎïÆ· À´Ô´Î»ÖÃûÓÐÎïÆ· srcWellType=%s, srcIndex=%s' % (srcWellType, srcIndex), playerID)  | 
|         return  | 
|     desitemID, desitemCnt, desisBind, desisSpecial = __GetItemInfoByData(curPlayer, desWellType, desIndex)  | 
|     __SetItemData(curPlayer, desWellType, desIndex, srcitemID, srcitemCnt, srcisBind, srcisSpecial)  | 
|     if desitemID:  | 
|         __SetItemData(curPlayer, srcWellType, srcIndex, desitemID, desitemCnt, desisBind, desisSpecial)  | 
|     else:  | 
|         __SetItemData(curPlayer, srcWellType, srcIndex, 0, 0, 0, 0)  | 
|     GameWorld.DebugLog('ÐíÔ¸³Ø»î¶¯ÍÏ×§ÎïÆ· desWellType=%s,desIndex=%s,srcitemID=%s'%(desWellType, desIndex,srcitemID))  | 
|     #֪ͨ  | 
|     SyncWellItemChange(curPlayer, [[srcWellType, srcIndex],[desWellType, desIndex]])  | 
|     return  | 
|   | 
| def SyncWellItemChange(curPlayer, changeList):  | 
|     packData = ChPyNetSendPack.tagMCActWishingDragResult()  | 
|     packData.InfoList = []  | 
|     for wellType, index in changeList:  | 
|         itemID, itemCnt, isBind, isSpecial = __GetItemInfoByData(curPlayer, wellType, index)  | 
|         changeInfo = ChPyNetSendPack.tagMCPlayerWishingDragInfo()  | 
|         changeInfo.WellType = wellType  | 
|         changeInfo.Index = index  | 
|         changeInfo.ItemID = itemID  | 
|         changeInfo.ItemCnt = itemCnt  | 
|         changeInfo.IsBind = isBind  | 
|         changeInfo.IsSpecial = isSpecial  | 
|         packData.InfoList.append(changeInfo)  | 
|     packData.Cnt = len(packData.InfoList)  | 
|     NetPackCommon.SendFakePack(curPlayer, packData)  | 
|     return  | 
|   | 
| def DoGetWishingAward(curPlayer):  | 
|     ## ÁìÈ¡ÐíÔ¸³Ø½±Àø  | 
|     count = IpyGameDataPY.GetFuncCfg('WishingWellCfg', 4)  | 
|     giveItemList = []  | 
|     for i in xrange(count):  | 
|         itemID, itemCnt, isBind, isSpecial = __GetItemInfoByData(curPlayer, WellType_Get, i)  | 
|         if itemID:  | 
|             giveItemList.append([itemID, itemCnt, isBind])  | 
|     if not giveItemList:  | 
|         GameWorld.Log('ÁìÈ¡ÐíÔ¸³Ø½±Àø Ã»Óн±Àø¿ÉÁìÈ¡£¡', curPlayer.GetID())  | 
|         return  | 
|       | 
|     needSpace = len(giveItemList)  | 
|     packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)  | 
|     if needSpace > packSpace:  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")  | 
|         return  | 
|     for itemID, itemCnt, isBind in giveItemList:  | 
|         ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])  | 
|     for i in xrange(count):  | 
|         __SetItemData(curPlayer, WellType_Get, i, 0, 0, 0, 0)  | 
|     SyncWishingWellPlayerInfo(curPlayer)  | 
|     return  | 
|   | 
|   | 
| def SyncWishingWellInfo(curPlayer):  | 
|     ##ͬ²½ÐíÔ¸³Ø»î¶¯ÐÅÏ¢  | 
|     actBossRebornInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WishingWell, {})  | 
|     state = actBossRebornInfo.get(ShareDefine.ActKey_State, 0)  | 
|     cfgID = actBossRebornInfo.get(ShareDefine.ActKey_CfgID, 0)  | 
|     if not state or not cfgID:  | 
|         return  | 
|     actIpyData = IpyGameDataPY.GetIpyGameData("ActWishingWell", cfgID)  | 
|     if not actIpyData:  | 
|         return  | 
|     startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(actIpyData)  | 
|     actInfo = ChPyNetSendPack.tagMCActWishingWellInfo()  | 
|     actInfo.Clear()  | 
|     actInfo.StartDate = startDateStr  | 
|     actInfo.EndtDate = endDateStr  | 
|     actInfo.IsDayReset = actIpyData.GetIsDayReset()  | 
|     actInfo.ResetType = actIpyData.GetResetType()  | 
|     actInfo.LimitLV = actIpyData.GetLVLimit()  | 
|     actInfo.WellItemInfo = []  | 
|     randomItemList = __GetRandomRateList(0)  | 
|     for itemInfo in randomItemList:  | 
|         itemID, itemCnt, isBind, mark, rare = itemInfo[1]  | 
|         wellItemInfo = ChPyNetSendPack.tagMCWishingWellItem()  | 
|         wellItemInfo.ItemID = itemID  | 
|         wellItemInfo.ItemCnt = itemCnt  | 
|         wellItemInfo.IsBind = isBind  | 
|         wellItemInfo.Mark = mark  | 
|         wellItemInfo.Rare = rare  | 
|         actInfo.WellItemInfo.append(wellItemInfo)  | 
|     actInfo.Count = len(actInfo.WellItemInfo)  | 
|     NetPackCommon.SendFakePack(curPlayer, actInfo)  | 
|     return  | 
|   | 
|   | 
| def SyncWishingWellPlayerInfo(curPlayer):  | 
|     ##ͬ²½ÐíÔ¸³ØÍæ¼ÒÐÅÏ¢  | 
|     packData = ChPyNetSendPack.tagMCActWishingWellPlayerInfo()  | 
|     freeStartTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WishingWellFreeTime)  | 
|     if not freeStartTime:#ûÓÐÔòĬÈϻ¿ªÊ¼Ê±¼ä  | 
|         actBossRebornInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WishingWell, {})  | 
|         cfgID = actBossRebornInfo.get(ShareDefine.ActKey_CfgID, 0)  | 
|         actIpyData = IpyGameDataPY.GetIpyGameData("ActWishingWell", cfgID)  | 
|         if actIpyData:  | 
|             startDate, _ = GameWorld.GetOperationActionDateStr(actIpyData)  | 
|               | 
|             resetType = actIpyData.GetResetType() # ÖØÖÃÀàÐÍ£¬0-0µãÖØÖã»1-5µãÖØÖà  | 
|             if resetType == 1:  | 
|                 startDayDate = "%s 05:00:00" % (startDate)  | 
|             else:  | 
|                 startDayDate = "%s 00:00:00" % (startDate)  | 
|             freeStartTime = GameWorld.ChangeTimeStrToNum(startDayDate, timeFormat=ChConfig.TYPE_Time_Format)  | 
|             GameWorld.DebugLog('ÐíÔ¸³Ø»î¶¯¿ªÊ¼Ê±¼ä startDayDate=%s'%startDayDate)  | 
|                   | 
|           | 
|     packData.FreeStartTime = freeStartTime  | 
|     packData.WishCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WishingWellRefreshCnt)  | 
|     packData.WellItemInfo = []  | 
|     __AddWishingWellItemPackInfo(curPlayer, packData.WellItemInfo, WellType_Select)  | 
|     packData.WellItemCnt = len(packData.WellItemInfo)  | 
|     packData.CurAwardItemInfo = []  | 
|     __AddWishingWellItemPackInfo(curPlayer, packData.CurAwardItemInfo, WellType_Result)  | 
|     packData.CurAwardCnt = len(packData.CurAwardItemInfo)  | 
|     packData.LastAwardItemInfo = []  | 
|     __AddWishingWellItemPackInfo(curPlayer, packData.LastAwardItemInfo, WellType_Get)  | 
|     packData.LastAwardCnt = len(packData.LastAwardItemInfo)  | 
|     NetPackCommon.SendFakePack(curPlayer, packData)  | 
|     return  | 
|   | 
|   | 
| def __AddWishingWellItemPackInfo(curPlayer, itemList, wellType):  | 
|     if wellType == WellType_Select:  | 
|         count = IpyGameDataPY.GetFuncCfg('WishingWellCfg', 3)  | 
|     else:  | 
|         count = IpyGameDataPY.GetFuncCfg('WishingWellCfg', 4)  | 
|     for i in xrange(count):  | 
|         itemID, itemCnt, isBind, isSpecial = __GetItemInfoByData(curPlayer, wellType, i)  | 
|         packData = ChPyNetSendPack.tagMCPlayerWishingWellItem()  | 
|         packData.ItemID = itemID  | 
|         packData.ItemCnt = itemCnt  | 
|         packData.IsBind = isBind  | 
|         packData.IsSpecial = isSpecial  | 
|         itemList.append(packData)  | 
|     return  | 
|   |