|  |  |  | 
|---|
|  |  |  | # 活动中同步活动信息 | 
|---|
|  |  |  | if actCostRebateInfo.get(ShareDefine.ActKey_State): | 
|---|
|  |  |  | SyncBossRebornInfo(curPlayer) | 
|---|
|  |  |  | SyncBossRebornPlayerInfo(curPlayer) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def RefreshOperationAction_BossReborn(): | 
|---|
|  |  |  | playerManager = GameWorld.GetPlayerManager() | 
|---|
|  |  |  | 
|---|
|  |  |  | bossRebornID = actBossRebornInfo.get(ShareDefine.ActKey_ID, 0) | 
|---|
|  |  |  | state = actBossRebornInfo.get(ShareDefine.ActKey_State, 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) | 
|---|
|  |  |  | templateID = actBossRebornInfo.get(ShareDefine.ActKey_TemplateID, 0) | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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): | 
|---|
|  |  |  | # 未领取的奖励邮件发放 | 
|---|
|  |  |  | 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, 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() | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #给奖励 | 
|---|
|  |  |  | curWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BRActionWorldLV) | 
|---|
|  |  |  | awardDict = __GetAwardItem(curPlayer, curWorldLV, ipyData) | 
|---|
|  |  |  | awardDict = __GetAwardItem(curPlayer, ipyData) | 
|---|
|  |  |  | # 检查背包 | 
|---|
|  |  |  | needSpace = len(awardDict) | 
|---|
|  |  |  | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | 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, 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] | 
|---|
|  |  |  | 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 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) | 
|---|
|  |  |  | if not state: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | templateID = actBossRebornInfo.get(ShareDefine.ActKey_TemplateID, 0) | 
|---|
|  |  |  | if not templateID: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition("BossReborn", {'TemplateID':templateID}, True) | 
|---|
|  |  |  | if not ipyDataList: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | actInfo = ChPyNetSendPack.tagMCBossRebornInfo() | 
|---|
|  |  |  | actInfo.Clear() | 
|---|
|  |  |  | actInfo.StartDate = actBossRebornInfo.get(ShareDefine.ActKey_StartDate, "") | 
|---|
|  |  |  | actInfo.EndtDate = actBossRebornInfo.get(ShareDefine.ActKey_EndDate, "") | 
|---|
|  |  |  | actInfo.LimitLV = actBossRebornInfo.get(ShareDefine.ActKey_LVLimit, 0) | 
|---|
|  |  |  | actInfo.TaskInfo = [] | 
|---|
|  |  |  | for ipyData in ipyDataList: | 
|---|
|  |  |  | taskInfo = ChPyNetSendPack.tagMCBossRebornTaskInfo() | 
|---|
|  |  |  | taskInfo.TaskID = ipyData.GetID() | 
|---|
|  |  |  | taskInfo.TotalTimes = ipyData.GetTotalTimes() | 
|---|
|  |  |  | taskInfo.SingleTimes = ipyData.GetSingleTimes() | 
|---|
|  |  |  | taskInfo.AwardItem = [] | 
|---|
|  |  |  | for itemID, itemCnt, isBind in ipyData.GetReward(): | 
|---|
|  |  |  | 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 | 
|---|