| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package Player.PlayerWeekParty  | 
| #  | 
| # @todo:ÖÜ¿ñ»¶  | 
| # @author xdh  | 
| # @date 2018-07-12 16:50  | 
| # @version 1.0  | 
| #  | 
| #  | 
| # ÏêϸÃèÊö: ÖÜ¿ñ»¶  | 
| #  | 
| #---------------------------------------------------------------------  | 
| """Version = 2018-07-12 16:50"""  | 
| #---------------------------------------------------------------------  | 
|   | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import ChConfig  | 
| import IpyGameDataPY  | 
| import PlayerControl  | 
| import ItemControler  | 
| import ChPyNetSendPack  | 
| import Operate_EquipStone  | 
| import PlayerFeastWeekParty  | 
| import DataRecordPack  | 
| import PlayerGodWeapon  | 
| import NetPackCommon  | 
| import ShareDefine  | 
| import PyGameData  | 
| import ItemCommon  | 
|   | 
|   | 
| def OnLogin(curPlayer):  | 
|     isReset = __CheckPlayerWeekPartyAction(curPlayer)  | 
|     if not isReset:  | 
|         actCostRebateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WeekParty, {})  | 
|         # »î¶¯ÖÐͬ²½»î¶¯ÐÅÏ¢  | 
|         SyncWeekPartyInfo(curPlayer)  | 
|         if actCostRebateInfo.get(ShareDefine.ActKey_State):  | 
|             SyncWeekPartyPlayerInfo(curPlayer)  | 
|     return  | 
|   | 
|   | 
| def RefreshOperationAction_WeekParty():  | 
|     playerManager = GameWorld.GetPlayerManager()  | 
|     for i in xrange(playerManager.GetPlayerCount()):  | 
|         curPlayer = playerManager.GetPlayerByIndex(i)  | 
|         if curPlayer == None or not curPlayer.GetInitOK():  | 
|             continue  | 
|         __CheckPlayerWeekPartyAction(curPlayer)  | 
|     return  | 
|   | 
|   | 
| def __CheckPlayerWeekPartyAction(curPlayer):  | 
|     ## ¼ì²éÍæ¼ÒÖÜ¿ñ»¶»î¶¯Êý¾ÝÐÅÏ¢  | 
|     playerID = curPlayer.GetPlayerID()  | 
|       | 
|     actWeekPartyInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WeekParty, {})  | 
|     #WeekPartyID = actWeekPartyInfo.get(ShareDefine.ActKey_ID, 0)  | 
|     state = actWeekPartyInfo.get(ShareDefine.ActKey_State, 0)  | 
|     cfgID = actWeekPartyInfo.get(ShareDefine.ActKey_CfgID, 0)  | 
|     passlv = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_TrialTower_PassLV)  | 
|     if state:  | 
|         #ÿÌì¶¼Òª´¥·¢  | 
|         AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Tower, passlv, False, True, False)  | 
|         AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Login, 1, False, False)  | 
|         AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Stone, Operate_EquipStone.GetTotalStoneLV(curPlayer), False, True, False)  | 
|         AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_GodWeapon, PlayerGodWeapon.GetGodWeaponTotalLV(curPlayer), False, True, False)  | 
|         SyncWeekPartyPlayerInfo(curPlayer)  | 
|     playerWeekPartyID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyID, 0, ChConfig.Def_PDictType_WeekParty)  # Íæ¼ÒÉíÉϵĻID  | 
|     # »î¶¯ID ÏàͬµÄ»°²»´¦Àí  | 
|     if cfgID == playerWeekPartyID:  | 
|         #GameWorld.DebugLog("ÖÜ¿ñ»¶»î¶¯ID²»±ä£¬²»´¦Àí£¡", curPlayer.GetPlayerID())  | 
|         return  | 
|     CheckWeekPartyActionCnt(curPlayer)  | 
|     # Î´ÁìÈ¡µÄ½±ÀøÓʼþ·¢·Å  | 
|     if playerWeekPartyID:  | 
|         __SendWeekPartyMail(curPlayer, playerWeekPartyID)  | 
|       | 
|     if not cfgID:  | 
|         GameWorld.DebugLog('    ÖÜ¿ñ»¶»î¶¯ÖØÖÃ!')  | 
|         curPlayer.ClearNomalDict(ChConfig.Def_PDictType_WeekParty)  | 
|       | 
|     GameWorld.DebugLog("ÖÜ¿ñ»¶±ä¸ü! state=%s,cfgID=%s,playerWeekPartyID=%s" % (state, cfgID, playerWeekPartyID), playerID)  | 
|       | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyID, cfgID, ChConfig.Def_PDictType_WeekParty)  | 
|           | 
|     SyncWeekPartyInfo(curPlayer)  | 
|     return True  | 
|   | 
|   | 
| def __SendWeekPartyMail(curPlayer, cfgID):  | 
|     # Î´ÁìÈ¡µÄ½±ÀøÓʼþ·¢·Å  | 
|     actBossIpyData = IpyGameDataPY.GetIpyGameData("ActWeekParty", cfgID)  | 
|     if not actBossIpyData:  | 
|         return  | 
|     templateIDList = actBossIpyData.GetTemplateID()  | 
|     if not templateIDList:  | 
|         return  | 
|       | 
|     totalItemDict = {}  | 
|     for day, tidList in enumerate(templateIDList):  | 
|         for tid in tidList:  | 
|             ipyData = IpyGameDataPY.GetIpyGameData('WeekParty', tid)  | 
|             if not ipyData:  | 
|                 continue  | 
|             singleTimes = ipyData.GetSingleTimes()  | 
|             curTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyCurTimes % (day, tid), 0, ChConfig.Def_PDictType_WeekParty)  | 
|             gotTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyGotTimes % (day, tid), 0, ChConfig.Def_PDictType_WeekParty)  | 
|             canGotCnt = (curTimes - gotTimes) / singleTimes  | 
|             if not canGotCnt:  | 
|                 continue  | 
|             itemDict = __GetAwardItem(curPlayer, ipyData, canGotCnt)  | 
|             GameWorld.AddDictValue(totalItemDict, itemDict)  | 
|     #»ý·Ö½±Àø  | 
|     for day, awardDict in actBossIpyData.GetPointAward().items():  | 
|         pointList = awardDict.keys()  | 
|         pointList.sort()  | 
|         for i, point in enumerate(pointList):  | 
|             curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyPoint % day, 0, ChConfig.Def_PDictType_WeekParty)  | 
|             if curPoint < point:  | 
|                 continue  | 
|             awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyAwardRecord % day, 0, ChConfig.Def_PDictType_WeekParty)  | 
|             if awardRecord & pow(2, i):  | 
|                 continue  | 
|             itemList = awardDict[point]  | 
|             for itemID, itemCnt, isBind in itemList:  | 
|                 totalItemDict[itemID] = totalItemDict.get(itemID, 0) + itemCnt  | 
|             DataRecordPack.DR_WeekPartyPoint(curPlayer, day, point)  | 
|     if not totalItemDict:  | 
|         return  | 
|     totalItemList = [[itemID, itemCnt, 1] for itemID, itemCnt in totalItemDict.items()]  | 
|     PlayerControl.SendMailByKey('SecondWeekReward', [curPlayer.GetID()], totalItemList)  | 
|     return  | 
|   | 
|   | 
| def AddWeekPartyActionCnt(curPlayer, actionID, addCnt=1, isAdd=True, isCompatible=False, isSync=True):  | 
|     '''Ôö¼ÓÖÜ¿ñ»¶Ïà¹Ø»î¶¯Íê³É´ÎÊý'''  | 
|     PlayerFeastWeekParty.AddFeastWeekPartyActionCnt(curPlayer, actionID, addCnt, isAdd, isCompatible, isSync)  | 
|     #ÅжϻÊÇ·ñ¿ªÆô  | 
|     if not addCnt:  | 
|         return  | 
|     actWeekPartyInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WeekParty, {})  | 
|     state = actWeekPartyInfo.get(ShareDefine.ActKey_State, 0)  | 
|     cfgID = actWeekPartyInfo.get(ShareDefine.ActKey_CfgID, 0)  | 
|       | 
|     if not cfgID:  | 
|         return  | 
|     if not state and actionID not in ChConfig.AheadFinishWPActList:  | 
|         return  | 
|       | 
|     actBossIpyData = IpyGameDataPY.GetIpyGameData("ActWeekParty", cfgID)  | 
|     if not actBossIpyData:  | 
|         return  | 
|     templateIDList = actBossIpyData.GetTemplateID()  | 
|     dayIndex = actWeekPartyInfo.get(ShareDefine.ActKey_DayIndex, 0)  | 
|     if dayIndex >= len(templateIDList):  | 
|         return  | 
|     if actionID in ChConfig.AheadFinishWPActList:  | 
|         isFind = False  | 
|         for day, dayTidList in enumerate(templateIDList[dayIndex:]):  | 
|             findTid = 0  | 
|             for tid in dayTidList:  | 
|                 if tid / 100 == actionID:  | 
|                     findTid = tid  | 
|                     break  | 
|             if not findTid:  | 
|                 continue  | 
|             ipyData = IpyGameDataPY.GetIpyGameData('WeekParty', findTid)  | 
|             if not ipyData:  | 
|                 continue  | 
|             totalTimes = ipyData.GetTotalTimes()  | 
|             if addCnt != totalTimes:  | 
|                 continue  | 
|             dayIndex = day + dayIndex  | 
|             isFind = True  | 
|             break  | 
|         if not isFind:  | 
|             return  | 
|       | 
|     dayTidList = templateIDList[dayIndex]  | 
|     findTid = 0  | 
|     for tid in dayTidList:  | 
|         if tid / 100 == actionID:  | 
|             findTid = tid  | 
|             break  | 
|     if not findTid:  | 
|         return  | 
|     ipyData = IpyGameDataPY.GetIpyGameData('WeekParty', findTid)  | 
|     if not ipyData:  | 
|         return  | 
|     totalTimes = ipyData.GetTotalTimes()  | 
|     curTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyCurTimes % (dayIndex, findTid), 0, ChConfig.Def_PDictType_WeekParty)  | 
|     if isAdd:  | 
|         addCnt = addCnt if totalTimes == 0 else min(totalTimes - curTimes, addCnt)  | 
|         if addCnt <= 0:  | 
|             return  | 
|         updTimes = curTimes + addCnt  | 
|     else:  | 
|         if not isCompatible and addCnt != totalTimes:  | 
|             return  | 
|         updTimes = min(addCnt, totalTimes)  | 
|     realAddCnt = updTimes - curTimes  | 
|     if realAddCnt <= 0:  | 
|         return  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyCurTimes % (dayIndex, findTid), updTimes, ChConfig.Def_PDictType_WeekParty)  | 
|     #¼Ó»ý·Ö  | 
|     singleTimes = ipyData.GetSingleTimes()  | 
|     addPoint = (curTimes % singleTimes + realAddCnt)/singleTimes* ipyData.GetPoint()  | 
|     curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyPoint % dayIndex, 0, ChConfig.Def_PDictType_WeekParty)  | 
|     updPoint = curPoint + addPoint  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyPoint % dayIndex, updPoint, ChConfig.Def_PDictType_WeekParty)  | 
|     GameWorld.DebugLog('   Ôö¼ÓÖÜ¿ñ»¶Ïà¹Ø»î¶¯Íê³É´ÎÊý dayIndex=%s, findTid=%s, realAddCnt=%s,addPoint=%s' % (dayIndex, findTid, realAddCnt, addPoint))  | 
|     if isSync:  | 
|         SyncWeekPartyPlayerInfo(curPlayer, dayIndex, findTid)  | 
|     return True  | 
|   | 
|   | 
| def CheckWeekPartyActionCnt(curPlayer):  | 
|     ipyDataMgr = IpyGameDataPY.IPY_Data()  | 
|     for actionType in ChConfig.AheadFinishWPActList:  | 
|         if actionType == ChConfig.Def_WPAct_Horse:  | 
|             for i in xrange(ipyDataMgr.GetHorseCount()):  | 
|                 ipyData = ipyDataMgr.GetHorseByIndex(i)  | 
|                 index = ipyData.GetHorseID()  | 
|                 lv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % index, 0, ChConfig.Def_PDictType_Horse)  | 
|                 if lv:  | 
|                     AddWeekPartyActionCnt(curPlayer, actionType, index, False)  | 
|         elif actionType == ChConfig.Def_WPAct_Pet:  | 
|             petDataPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptPet)  | 
|             for petDataIndex in range(petDataPack.GetCount()):  | 
|                 petItem = petDataPack.GetAt(petDataIndex)  | 
|                 if petItem.IsEmpty():  | 
|                     continue  | 
|                 petNPCID = petItem.GetUserAttr(ShareDefine.Def_IudetPet_NPCID)  | 
|                 AddWeekPartyActionCnt(curPlayer, actionType, petNPCID, False)  | 
|         elif actionType == ChConfig.Def_WPAct_Dogz:  | 
|             for i in xrange(ipyDataMgr.GetDogzCount()):  | 
|                 ipyData = ipyDataMgr.GetDogzByIndex(i)  | 
|                 if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_DogzFightState, i):  | 
|                     AddWeekPartyActionCnt(curPlayer, actionType, ipyData.GetDogzID(), False)  | 
|         elif actionType == ChConfig.Def_WPAct_Rune:  | 
|             runeHoleCnt = IpyGameDataPY.GetFuncCfg("RuneUnlock", 4)  | 
|             for holeNum in xrange(1, runeHoleCnt + 1):  | 
|                 runeData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Rune_Data % holeNum, 0)  | 
|                 if not runeData:  | 
|                     continue  | 
|                 runeItemID = ItemControler.GetRuneItemID(runeData)  | 
|                 itemData = GameWorld.GetGameData().GetItemByTypeID(runeItemID)  | 
|                 if not itemData:  | 
|                     continue  | 
|                 itemColor = itemData.GetItemColor()  | 
|                 AddWeekPartyActionCnt(curPlayer, actionType, itemColor, False)  | 
|     return  | 
|   | 
| def GetWeekPartyActionAward(curPlayer, day, templateID):  | 
|     '''ÁìÈ¡ÖÜ¿ñ»¶»î¶¯½±Àø'''  | 
|     templateID = GameWorld.ToIntDef(templateID, 0)  | 
|     ipyData = IpyGameDataPY.GetIpyGameData('WeekParty', templateID)  | 
|     if not ipyData:  | 
|         return  | 
|     singleTimes = ipyData.GetSingleTimes()  | 
|     curTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyCurTimes % (day, templateID), 0, ChConfig.Def_PDictType_WeekParty)  | 
|     gotTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyGotTimes % (day, templateID), 0, ChConfig.Def_PDictType_WeekParty)  | 
|     if curTimes - gotTimes < singleTimes:  | 
|         return  | 
|       | 
|     #¸ø½±Àø  | 
|     awardDict = __GetAwardItem(curPlayer, ipyData)  | 
|     # ¼ì²é±³°ü  | 
|     needSpace = len(awardDict)  | 
|     packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)  | 
|     if needSpace > packSpace:  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")  | 
|         return  | 
|     #¸üдÎÊý Ã¿´ÎÁì½±Ö»ÁìÒ»´Î  | 
|     newGotTimes = gotTimes + singleTimes  | 
|       | 
|     #GameWorld.Log('  actionID=%s,curTimes=%s,gotTimes=%s,singleTimes=%s,newGotTimes=%s'%(actionID, curTimes, gotTimes,singleTimes, newGotTimes))  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyGotTimes % (day, templateID), newGotTimes, ChConfig.Def_PDictType_WeekParty)  | 
|     for itemID, itemCnt in awardDict.items():  | 
|         ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])  | 
|     SyncWeekPartyPlayerInfo(curPlayer, day, templateID)  | 
|     return  | 
|   | 
|   | 
| def GetWeekPartyPointAward(curPlayer, day, getPoint):  | 
|     ##ÁìÈ¡ÖÜ¿ñ»¶»ý·Ö½±Àø  | 
|     getPoint = GameWorld.ToIntDef(getPoint, 0)  | 
|     actWeekPartyInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WeekParty, {})  | 
|     state = actWeekPartyInfo.get(ShareDefine.ActKey_State, 0)  | 
|     cfgID = actWeekPartyInfo.get(ShareDefine.ActKey_CfgID, 0)  | 
|     if not state or not cfgID:  | 
|         return  | 
|     actBossIpyData = IpyGameDataPY.GetIpyGameData("ActWeekParty", cfgID)  | 
|     if not actBossIpyData:  | 
|         return  | 
|     curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyPoint % day, 0, ChConfig.Def_PDictType_WeekParty)  | 
|     if curPoint < getPoint:  | 
|         return  | 
|     pointAwardDict = actBossIpyData.GetPointAward().get(day, {})  | 
|     pointList = pointAwardDict.keys()  | 
|     pointList.sort()  | 
|     if getPoint not in pointList:  | 
|         return  | 
|     getIndex = pointList.index(getPoint)  | 
|     awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyAwardRecord % day, 0, ChConfig.Def_PDictType_WeekParty)  | 
|     if awardRecord & pow(2, getIndex):  | 
|         GameWorld.Log(' ÁìÈ¡ÖÜ¿ñ»¶»ý·Ö½±Àø£¬ ÒÑÁìÈ¡ day=%s, getPoint=%s' % (day, getPoint))  | 
|         return  | 
|     itemList = pointAwardDict[getPoint]  | 
|     needSpace = len(itemList)  | 
|     packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)  | 
|     if needSpace > packSpace:  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")  | 
|         return  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyAwardRecord % day, awardRecord | pow(2, getIndex), ChConfig.Def_PDictType_WeekParty)  | 
|     for itemID, itemCnt, isBind in itemList:  | 
|         ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])  | 
|     SyncWeekPartyPlayerInfo(curPlayer, day)  | 
|     DataRecordPack.DR_WeekPartyPoint(curPlayer, day, getPoint)  | 
|     return  | 
|   | 
|   | 
| def __GetAwardItem(curPlayer, ipyData, times=1):  | 
|     awardDict = {}  | 
|     for itemID, itemCnt, isbind in ipyData.GetReward():  | 
|         if not itemID or not itemCnt:  | 
|             continue  | 
|         awardDict[itemID] = awardDict.get(itemID, 0) + itemCnt * times  | 
|           | 
|     return awardDict  | 
|   | 
|   | 
| def SyncWeekPartyPlayerInfo(curPlayer, day=-1, templateID=-1):  | 
|     #֪ͨµ±Ç°´ÎÊý¡¢ÒÑÁì´ÎÊý   | 
|     actWeekPartyInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WeekParty, {})  | 
|     state = actWeekPartyInfo.get(ShareDefine.ActKey_State, 0)  | 
|     cfgID = actWeekPartyInfo.get(ShareDefine.ActKey_CfgID, 0)  | 
|     if not state or not cfgID:  | 
|         return  | 
|     actBossIpyData = IpyGameDataPY.GetIpyGameData("ActWeekParty", cfgID)  | 
|     if not actBossIpyData:  | 
|         return  | 
|     templateIDList = actBossIpyData.GetTemplateID()  | 
|     if not templateIDList:  | 
|         return  | 
|     if day != -1:  | 
|         if day >= len(templateIDList):  | 
|             return  | 
|         syncDayList = [day]  | 
|     else:  | 
|         syncDayList = range(len(templateIDList))  | 
|           | 
|     packData = ChPyNetSendPack.tagMCWeekPartyPlayerInfo()  | 
|     packData.DayInfoList = []  | 
|     for cday in syncDayList:  | 
|         tiemInfo = ChPyNetSendPack.tagMCWeekPartyDayPlayerInfo()  | 
|         tiemInfo.DayIndex = cday  | 
|         tiemInfo.Point = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyPoint % cday, 0, ChConfig.Def_PDictType_WeekParty)  | 
|         tiemInfo.AwardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyAwardRecord % cday, 0, ChConfig.Def_PDictType_WeekParty)  | 
|         tiemInfo.TaskList = []  | 
|         for tID in templateIDList[cday]:  | 
|             if templateID != -1 and tID != templateID:  | 
|                 continue  | 
|             tipyData = IpyGameDataPY.GetIpyGameData('WeekParty', tID)  | 
|             if not tipyData:  | 
|                 continue  | 
|             taskInfo = ChPyNetSendPack.tagMCWeekPartyTaskInfo()  | 
|             taskInfo.TemplateID = tID  | 
|             taskInfo.CurTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyCurTimes % (cday, tID), 0, ChConfig.Def_PDictType_WeekParty)  | 
|             taskInfo.GotTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyGotTimes % (cday, tID), 0, ChConfig.Def_PDictType_WeekParty)  | 
|             tiemInfo.TaskList.append(taskInfo)  | 
|         tiemInfo.ACount = len(tiemInfo.TaskList)  | 
|         packData.DayInfoList.append(tiemInfo)  | 
|     packData.Count = len(packData.DayInfoList)  | 
|     NetPackCommon.SendFakePack(curPlayer, packData)  | 
|     return  | 
|   | 
|   | 
| def SyncWeekPartyInfo(curPlayer):  | 
|     actWeekPartyInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WeekParty, {})  | 
|     state = actWeekPartyInfo.get(ShareDefine.ActKey_State, 0)  | 
|     cfgID = actWeekPartyInfo.get(ShareDefine.ActKey_CfgID, 0)  | 
|     if not cfgID:  | 
|         return  | 
|     actBossIpyData = IpyGameDataPY.GetIpyGameData("ActWeekParty", cfgID)  | 
|     if not actBossIpyData:  | 
|         return  | 
|     templateIDList = actBossIpyData.GetTemplateID()  | 
|     if not templateIDList:  | 
|         return  | 
|     pointAwardDict = actBossIpyData.GetPointAward()  | 
|     openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1  | 
|     actInfo = ChPyNetSendPack.tagMCWeekPartyInfo()  | 
|     actInfo.Clear()  | 
|     actInfo.StartDate = GameWorld.GetOperationActionDateStr(actBossIpyData.GetStartDate(), openServerDay)  | 
|     actInfo.EndtDate = GameWorld.GetOperationActionDateStr(actBossIpyData.GetEndDate(), openServerDay)  | 
|     actInfo.AdvanceMinutes = actBossIpyData.GetAdvanceMinutes()  | 
|     actInfo.IsDayReset = actBossIpyData.GetIsDayReset()  | 
|     actInfo.ResetType = actBossIpyData.GetResetType()  | 
|     actInfo.LimitLV = actBossIpyData.GetLVLimit()  | 
|     actInfo.DayInfoList = []  | 
|     tidList = []  | 
|     for day, dayActList in enumerate(templateIDList):  | 
|         dayInfo = ChPyNetSendPack.tagMCWeekPartyDayInfo()  | 
|         dayInfo.TemplateList = dayActList  | 
|         dayInfo.ActCnt = len(dayActList)  | 
|         for tid in dayActList:  | 
|             if tid not in tidList:  | 
|                 tidList.append(tid)  | 
|         dayInfo.PItemInfo = []  | 
|         for point, itemList in pointAwardDict.get(day, {}).items():  | 
|             for itemID, itemCnt, isBind in itemList:  | 
|                 awardItem = ChPyNetSendPack.tagMCWeekPartyItem()  | 
|                 awardItem.ItemID = itemID  | 
|                 awardItem.ItemCnt = itemCnt  | 
|                 awardItem.IsBind = isBind  | 
|                 awardItem.NeedPoint = point  | 
|                 dayInfo.PItemInfo.append(awardItem)  | 
|         dayInfo.PCount = len(dayInfo.PItemInfo)  | 
|         actInfo.DayInfoList.append(dayInfo)  | 
|     actInfo.DayCnt = len(actInfo.DayInfoList)  | 
|     actInfo.ActionInfo = []  | 
|     for tid in tidList:  | 
|         ipyData = IpyGameDataPY.GetIpyGameData('WeekParty', tid)  | 
|         if not ipyData:  | 
|             GameWorld.ErrLog('    ÖÜ¿ñ»¶Ä£°å±íÕÒ²»µ½Ä£°å%s' % tid)  | 
|             continue  | 
|         tInfo = ChPyNetSendPack.tagMCWeekPartyAction()  | 
|         tInfo.TemplateID = tid  | 
|         tInfo.ActionType = ipyData.GetActionType()  | 
|         tInfo.TotalTimes = ipyData.GetTotalTimes()  | 
|         tInfo.SingleTimes = ipyData.GetSingleTimes()  | 
|         tInfo.Point = ipyData.GetPoint()  | 
|         tInfo.ItemInfo = []  | 
|         for itemID, itemCnt, isBind in ipyData.GetReward():  | 
|             awardItem = ChPyNetSendPack.tagMCWeekPartyItem()  | 
|             awardItem.ItemID = itemID  | 
|             awardItem.ItemCnt = itemCnt  | 
|             awardItem.IsBind = isBind  | 
|             awardItem.NeedPoint = 0  | 
|             tInfo.ItemInfo.append(awardItem)  | 
|         tInfo.Count = len(tInfo.ItemInfo)  | 
|         actInfo.ActionInfo.append(tInfo)  | 
|     actInfo.TCount = len(actInfo.ActionInfo)  | 
|     NetPackCommon.SendFakePack(curPlayer, actInfo)  | 
|     return  |