|  |  | 
 |  |  |         # 活动中同步活动信息
 | 
 |  |  |         if actCostRebateInfo.get(ShareDefine.ActKey_State):
 | 
 |  |  |             SyncBossRebornInfo(curPlayer)
 | 
 |  |  |             SyncBossRebornPlayerInfo(curPlayer)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | def RefreshOperationAction_BossReborn():
 | 
 |  |  |     playerManager = GameWorld.GetPlayerManager()
 | 
 |  |  | 
 |  |  |     actBossRebornInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_BossReborn, {})
 | 
 |  |  |     bossRebornID = actBossRebornInfo.get(ShareDefine.ActKey_ID, 0)
 | 
 |  |  |     state = actBossRebornInfo.get(ShareDefine.ActKey_State, 0)
 | 
 |  |  |     cfgID = actBossRebornInfo.get(ShareDefine.ActKey_CfgID, 0)
 | 
 |  |  |     
 | 
 |  |  |     playerBossRebornID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossRebornID) # 玩家身上的活动ID
 | 
 |  |  |     playerBossRebornID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossRebornID)  # 玩家身上的活动ID
 | 
 |  |  |     
 | 
 |  |  |     # 活动ID 相同的话不处理
 | 
 |  |  |     if bossRebornID == playerBossRebornID:
 | 
 |  |  |         #GameWorld.DebugLog("BOSS复活活动ID不变,不处理!", curPlayer.GetPlayerID())
 | 
 |  |  |         return
 | 
 |  |  |     BRWorldLV = actBossRebornInfo.get(ShareDefine.ActKey_WorldLV, 0)
 | 
 |  |  |     playerBRWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionWorldLV)
 | 
 |  |  |     GameWorld.DebugLog("BOSS复活重置! costRebateID=%s,playerCostRebateID=%s,state=%s,BRWorldLV=%s,playerBRWorldLV=%s"  | 
 |  |  |                        % (bossRebornID, playerBossRebornID, state, BRWorldLV, playerBRWorldLV), playerID)
 | 
 |  |  |     actWorldLV = actBossRebornInfo.get(ShareDefine.ActKey_WorldLV, 0)
 | 
 |  |  |     playerWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionWorldLV)
 | 
 |  |  |      | 
 |  |  |     templateID = 0
 | 
 |  |  |     if cfgID:
 | 
 |  |  |         actBossIpyData = IpyGameDataPY.GetIpyGameData("ActBossReborn", cfgID)
 | 
 |  |  |         templateID = 0 if not actBossIpyData else actBossIpyData.GetTemplateID()
 | 
 |  |  |     playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossRebornTemplateID)
 | 
 |  |  |      | 
 |  |  |     GameWorld.DebugLog("BOSS复活重置! costRebateID=%s,playerCostRebateID=%s,state=%s,templateID=%s,playerTemplateID=%s"  | 
 |  |  |                        % (bossRebornID, playerBossRebornID, state, templateID, playerTemplateID), playerID)
 | 
 |  |  |     
 | 
 |  |  |     # 未领取的奖励邮件发放
 | 
 |  |  |     __SendBossRebornMail(curPlayer, playerBRWorldLV)
 | 
 |  |  |      | 
 |  |  |     __SendBossRebornMail(curPlayer, playerTemplateID, playerWorldLV)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionWorldLV, actWorldLV)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossRebornID, bossRebornID)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionWorldLV, BRWorldLV)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossRebornTemplateID, templateID)
 | 
 |  |  |     for brid in ChConfig.BossRebornActIDList:
 | 
 |  |  |         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionCurTimes % brid, 0)
 | 
 |  |  |         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionGotTimes % brid, 0)
 | 
 |  |  |      | 
 |  |  |          | 
 |  |  |     SyncBossRebornInfo(curPlayer)
 | 
 |  |  |     SyncBossRebornPlayerInfo(curPlayer)
 | 
 |  |  |     return True
 | 
 |  |  | 
 | 
 |  |  | def __SendBossRebornMail(curPlayer, playerBRWorldLV):
 | 
 |  |  |     #未领取的奖励邮件发放
 | 
 |  |  | 
 | 
 |  |  | def __SendBossRebornMail(curPlayer, playerTemplateID, playerWorldLV):
 | 
 |  |  |     # 未领取的奖励邮件发放
 | 
 |  |  |     ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition("BossReborn", {'TemplateID':playerTemplateID}, True)
 | 
 |  |  |     if not ipyDataList:
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     totalItemDict = {}
 | 
 |  |  |     for brid in ChConfig.BossRebornActIDList:
 | 
 |  |  |         ipyData = IpyGameDataPY.GetIpyGameData('BossReborn', brid)
 | 
 |  |  |         if not ipyData:
 | 
 |  |  |             continue
 | 
 |  |  |     for ipyData in ipyDataList:
 | 
 |  |  |         brid = ipyData.GetID()
 | 
 |  |  |         singleTimes = ipyData.GetSingleTimes()
 | 
 |  |  |         curTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionCurTimes % brid)
 | 
 |  |  |         gotTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionGotTimes % brid)
 | 
 |  |  |         canGotCnt = (curTimes - gotTimes) / singleTimes
 | 
 |  |  |         if not canGotCnt:
 | 
 |  |  |             continue
 | 
 |  |  |         itemDict = __GetAwardItem(curPlayer, playerBRWorldLV, ipyData, canGotCnt)
 | 
 |  |  |         itemDict = __GetAwardItem(curPlayer, ipyData, playerWorldLV, canGotCnt)
 | 
 |  |  |         GameWorld.AddDictValue(totalItemDict, itemDict)
 | 
 |  |  |     
 | 
 |  |  |     #去掉复活点道具
 | 
 |  |  | 
 |  |  |     PlayerControl.SendMailByKey('BossFHUnGetMail', [curPlayer.GetID()], totalItemList)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | def AddBossRebornActionCnt(curPlayer, actionID, addCnt=1):
 | 
 |  |  |     '''增加boss复活相关活动完成次数'''
 | 
 |  |  |     #判断活动是否开启
 | 
 |  |  | 
 |  |  |     state = actBossRebornInfo.get(ShareDefine.ActKey_State, 0)
 | 
 |  |  |     if not state:
 | 
 |  |  |         return
 | 
 |  |  |     ipyData = IpyGameDataPY.GetIpyGameData('BossReborn', actionID)
 | 
 |  |  |     playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossRebornTemplateID)
 | 
 |  |  |     ipyData = IpyGameDataPY.GetIpyGameData('BossReborn', playerTemplateID, actionID)
 | 
 |  |  |     if not ipyData:
 | 
 |  |  |         return
 | 
 |  |  |     totalTimes = ipyData.GetTotalTimes()
 | 
 |  |  | 
 |  |  |     
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionCurTimes % actionID, curTimes + addCnt)
 | 
 |  |  |     
 | 
 |  |  |     SyncBossRebornInfo(curPlayer, actionID)
 | 
 |  |  |     SyncBossRebornPlayerInfo(curPlayer, actionID)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | def GetBossRebornActionAward(curPlayer, actionID):
 | 
 |  |  |     '''领取boss复活活动奖励'''
 | 
 |  |  |     ipyData = IpyGameDataPY.GetIpyGameData('BossReborn', actionID)
 | 
 |  |  |     playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossRebornTemplateID)
 | 
 |  |  |     ipyData = IpyGameDataPY.GetIpyGameData('BossReborn', playerTemplateID, actionID)
 | 
 |  |  |     if not ipyData:
 | 
 |  |  |         return
 | 
 |  |  |     singleTimes = ipyData.GetSingleTimes()
 | 
 |  |  | 
 |  |  |     gotTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionGotTimes % actionID)
 | 
 |  |  |     if curTimes - gotTimes < singleTimes:
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     playerWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionWorldLV)
 | 
 |  |  |     #给奖励
 | 
 |  |  |     curWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionWorldLV)
 | 
 |  |  |     awardDict = __GetAwardItem(curPlayer, curWorldLV, ipyData)
 | 
 |  |  |     awardDict = __GetAwardItem(curPlayer, ipyData, playerWorldLV)
 | 
 |  |  |     # 检查背包
 | 
 |  |  |     needSpace = len(awardDict)
 | 
 |  |  |     packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
 | 
 |  |  | 
 |  |  |     #GameWorld.Log('  actionID=%s,curTimes=%s,gotTimes=%s,singleTimes=%s,newGotTimes=%s'%(actionID, curTimes, gotTimes,singleTimes, newGotTimes))
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BRActionGotTimes % actionID, newGotTimes)
 | 
 |  |  |     for itemID, itemCnt in awardDict.items():
 | 
 |  |  |         ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 1, [IPY_GameWorld.rptItem])
 | 
 |  |  |     SyncBossRebornInfo(curPlayer, actionID)
 | 
 |  |  |         ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])
 | 
 |  |  |     SyncBossRebornPlayerInfo(curPlayer, actionID)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def __GetAwardItem(curPlayer, worldLV, ipyData, times=1):
 | 
 |  |  |     worldLVList = ipyData.GetWorldLVList()
 | 
 |  |  |     playerLV = curPlayer.GetLV()
 | 
 |  |  |      | 
 |  |  |     awardIndex = len(worldLVList) - 1
 | 
 |  |  |     for i, lv in enumerate(worldLVList):
 | 
 |  |  |         prelv = 0 if i ==0 else worldLVList[i-1]
 | 
 |  |  |         if prelv<=playerLV < lv:
 | 
 |  |  |             awardIndex = i
 | 
 |  |  |             break
 | 
 |  |  | 
 | 
 |  |  | def __GetAwardItem(curPlayer, ipyData, worldLV, times=1):
 | 
 |  |  |     awardDict = {}
 | 
 |  |  |     for i in xrange(3): #目前配置3个奖励
 | 
 |  |  |         if not hasattr(ipyData, 'GetRewardItemID%s' % (i + 1)):
 | 
 |  |  |             break
 | 
 |  |  |         itemIDList = getattr(ipyData, 'GetRewardItemID%s' % (i + 1))()
 | 
 |  |  |         itemCntList = getattr(ipyData, 'GetRewardItemCnt%s' % (i + 1))()
 | 
 |  |  |         if awardIndex >= len(itemIDList) or awardIndex >= len(itemCntList):
 | 
 |  |  |             GameWorld.ErrLog('BOSS复活表奖励配置错误!')
 | 
 |  |  |             return awardDict
 | 
 |  |  |         itemID, itemCnt = itemIDList[awardIndex], itemCntList[awardIndex]
 | 
 |  |  | 
 | 
 |  |  |     awardList = GameWorld.GetDictValueByRangeKey(ipyData.GetReward(), worldLV, [])
 | 
 |  |  |     for itemID, itemCnt, isbind in awardList:
 | 
 |  |  |         if not itemID or not itemCnt:
 | 
 |  |  |             continue
 | 
 |  |  |         awardDict[itemID] = awardDict.get(itemID, 0) + itemCnt * times
 | 
 |  |  |         
 | 
 |  |  |     return awardDict
 | 
 |  |  | 
 | 
 |  |  | def SyncBossRebornInfo(curPlayer, actID= -1):
 | 
 |  |  | 
 | 
 |  |  | def SyncBossRebornPlayerInfo(curPlayer, actID=-1):
 | 
 |  |  |     #通知当前次数、已领次数 
 | 
 |  |  |     packData = ChPyNetSendPack.tagMCBossRebornPlayerInfo()
 | 
 |  |  |     packData.DataList = []
 | 
 |  |  |     if actID !=-1:
 | 
 |  |  |     if actID != -1:
 | 
 |  |  |         syneActIDList = [actID]
 | 
 |  |  |     else:
 | 
 |  |  |         syneActIDList = []
 | 
 |  |  | 
 |  |  |     packData.Count = len(packData.DataList)
 | 
 |  |  |     NetPackCommon.SendFakePack(curPlayer, packData)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | def SyncBossRebornInfo(curPlayer):
 | 
 |  |  |     actBossRebornInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_BossReborn, {})
 | 
 |  |  |     state = actBossRebornInfo.get(ShareDefine.ActKey_State, 0)
 | 
 |  |  |     cfgID = actBossRebornInfo.get(ShareDefine.ActKey_CfgID, 0)
 | 
 |  |  |     if not state or not cfgID:
 | 
 |  |  |         return
 | 
 |  |  |     actBossIpyData = IpyGameDataPY.GetIpyGameData("ActBossReborn", cfgID)
 | 
 |  |  |     if not actBossIpyData:
 | 
 |  |  |         return
 | 
 |  |  |     templateID = actBossIpyData.GetTemplateID()
 | 
 |  |  |     if not templateID:
 | 
 |  |  |         return
 | 
 |  |  |     ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition("BossReborn", {'TemplateID':templateID}, True)
 | 
 |  |  |     if not ipyDataList:
 | 
 |  |  |         return
 | 
 |  |  |     worldLV = actBossRebornInfo.get(ShareDefine.ActKey_WorldLV, 0)
 | 
 |  |  |     openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
 | 
 |  |  |     actInfo = ChPyNetSendPack.tagMCBossRebornInfo()
 | 
 |  |  |     actInfo.Clear()
 | 
 |  |  |     actInfo.StartDate = GameWorld.GetOperationActionDateStr(actBossIpyData.GetStartDate(), openServerDay)
 | 
 |  |  |     actInfo.EndtDate = GameWorld.GetOperationActionDateStr(actBossIpyData.GetEndDate(), openServerDay)
 | 
 |  |  |     actInfo.ResetType = actBossIpyData.GetResetType()
 | 
 |  |  |     actInfo.LimitLV = actBossIpyData.GetLVLimit()
 | 
 |  |  |     actInfo.TaskInfo = []
 | 
 |  |  |     for ipyData in ipyDataList:
 | 
 |  |  |         taskInfo = ChPyNetSendPack.tagMCBossRebornTaskInfo()
 | 
 |  |  |         taskInfo.TaskID = ipyData.GetID()
 | 
 |  |  |         taskInfo.TotalTimes = ipyData.GetTotalTimes()
 | 
 |  |  |         taskInfo.SingleTimes = ipyData.GetSingleTimes()
 | 
 |  |  |         taskInfo.AwardItem = []
 | 
 |  |  |         awardList = GameWorld.GetDictValueByRangeKey(ipyData.GetReward(), worldLV, [])
 | 
 |  |  |         for itemID, itemCnt, isBind in awardList:
 | 
 |  |  |             awardItem = ChPyNetSendPack.tagMCBossRebornAwardItem()
 | 
 |  |  |             awardItem.ItemID = itemID
 | 
 |  |  |             awardItem.ItemCount = itemCnt
 | 
 |  |  |             awardItem.IsBind = isBind
 | 
 |  |  |             taskInfo.AwardItem.append(awardItem)
 | 
 |  |  |         taskInfo.AwardItemCount = len(taskInfo.AwardItem)
 | 
 |  |  |         actInfo.TaskInfo.append(taskInfo)
 | 
 |  |  |     actInfo.TaskCnt = len(actInfo.TaskInfo)
 | 
 |  |  |     NetPackCommon.SendFakePack(curPlayer, actInfo)
 | 
 |  |  |     return
 |