| | |
| | | import ShareDefine |
| | | import DataRecordPack |
| | | import PlayerCompensation |
| | | import PlayerDBGSEvent |
| | | import PlayerBillboard |
| | | import IpyGameDataPY |
| | | import GameWorld |
| | |
| | | import CrossBillboard |
| | | import PlayerFamily |
| | | import PyDataManager |
| | | import GameXiangong |
| | | |
| | | def OnActStart(actNum): |
| | | ## 活动开启 |
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAward % actNum, 0) |
| | | PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_BossTrialSubmit) |
| | | PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_BossTrialSubmitFamily) |
| | | |
| | |
| | | |
| | | def OnActEnd(actNum, ipyData, dayIndex): |
| | | ## 活动结束 |
| | | OnGiveFamilyOrderAwawrd(actNum, ipyData, dayIndex) |
| | | cfgID = ipyData.GetCfgID() if ipyData else 0 |
| | | # 发放排行奖励 |
| | | GameWorld.Log("=== boss历练活动结束!发放本服个人榜单奖励! === actNum=%s,cfgID=%s,dayIndex=%s" % (actNum, cfgID, dayIndex)) |
| | | if not cfgID: |
| | | return |
| | | BillboardType = ShareDefine.Def_BT_BossTrialSubmit |
| | | billBoard = GameWorld.GetBillboard().FindBillboard(BillboardType) |
| | | if not billBoard: |
| | | return |
| | | templateID = GameWorld.GetTemplateID(ipyData, cfgID, dayIndex) |
| | | if not templateID: |
| | | GameWorld.Log("本次活动没有个人榜奖励!") |
| | | return |
| | | tempIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID) |
| | | if not tempIpyDataList: |
| | | return |
| | | GameWorld.Log("=== boss历练活动结束! === actNum=%s,cfgID=%s,dayIndex=%s" % (actNum, cfgID, dayIndex)) |
| | | |
| | | rankAwardDict = {} |
| | | for tempIpyData in tempIpyDataList: |
| | | rankAwardDict[tempIpyData.GetRank()] = tempIpyData.GetAwardItemList() |
| | | |
| | | GameWorld.Log(" templateID=%s,rankAwardDict=%s" % (templateID, rankAwardDict)) |
| | | billBoard.Sort() |
| | | for index in xrange(billBoard.GetCount()): |
| | | billBoardData = billBoard.At(index) |
| | | if not billBoardData: |
| | | continue |
| | | |
| | | rank = index + 1 |
| | | |
| | | awardItemList = GameWorld.GetOrderValueByDict(rankAwardDict, rank, False) |
| | | if not awardItemList: |
| | | break |
| | | |
| | | playerID = billBoardData.GetID() |
| | | name2 = billBoardData.GetName2() |
| | | cmpValue = billBoardData.GetCmpValue() |
| | | |
| | | GameWorld.Log(" 发放boss历练个人榜单奖励: rank=%s,playerID=%s,cmpValue=%s,awardItemList=%s, %s" |
| | | % (rank, playerID, cmpValue, awardItemList, name2)) |
| | | |
| | | PlayerCompensation.SendMailByKey("BossTrialMail10", [playerID], awardItemList, [rank]) |
| | | |
| | | DataRecordPack.DR_BillboardData(BillboardType, "BossTrial", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex, "templateID":templateID}) |
| | | PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_BossTrialSubmitBak, BillboardType) |
| | | PlayerBillboard.ClearBillboardByIndex(BillboardType) |
| | | __OnEndAward(actNum, ipyData, dayIndex) # 兼容活动没有配置参与时间段的在活动结束补触发结算奖励 |
| | | |
| | | PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_BossTrialSubmitFamilyBak, ShareDefine.Def_BT_BossTrialSubmitFamily) |
| | | PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_BossTrialSubmitBak, ShareDefine.Def_BT_BossTrialSubmit) |
| | | GameWorld.Log("=================================================================================") |
| | | return |
| | | |
| | | def OnGiveFamilyOrderAwawrd(actNum, ipyData, dayIndex): |
| | | cfgID = ipyData.GetCfgID() if ipyData else 0 |
| | | # 发放排行奖励 |
| | | GameWorld.Log("=== boss历练活动结束!发放本服仙盟榜单奖励! === actNum=%s,cfgID=%s,dayIndex=%s" % (actNum, cfgID, dayIndex)) |
| | | if not cfgID: |
| | | def OnActInStateRefresh(actNum, ipyData, dayIndex): |
| | | ## 活动中刷新,每次都需要刷新的逻辑,包含重读配置等 |
| | | if not ipyData: |
| | | return |
| | | BillboardType = ShareDefine.Def_BT_BossTrialSubmitFamily |
| | | billBoard = GameWorld.GetBillboard().FindBillboard(BillboardType) |
| | | cfgID = ipyData.GetCfgID() |
| | | templateID = GameWorld.GetTemplateID(ipyData, cfgID, dayIndex) |
| | | familyTemplateID = GameWorld.GetTemplateIDByList(ipyData.GetFamilyTemplateIDList(), dayIndex) |
| | | |
| | | billboardMgr = PlayerBillboard.GetBillboardMgr() |
| | | if templateID: |
| | | orderRuleList = GetOrderRuleList(templateID) |
| | | billboardObj = billboardMgr.GetBillboardObj(ShareDefine.Def_BT_BossTrialSubmit) |
| | | billboardObj.SetOrderRuleList(orderRuleList) |
| | | |
| | | if familyTemplateID: |
| | | orderRuleList = GetOrderRuleList(familyTemplateID) |
| | | billboardObj = billboardMgr.GetBillboardObj(ShareDefine.Def_BT_BossTrialSubmitFamily) |
| | | billboardObj.SetOrderRuleList(orderRuleList) |
| | | return |
| | | |
| | | def OnActJoinEnd(actNum, ipyData, dayIndex): |
| | | ## 活动参与结束 |
| | | __OnEndAward(actNum, ipyData, dayIndex) |
| | | return |
| | | |
| | | def __OnEndAward(actNum, ipyData, dayIndex): |
| | | ## 结算奖励 |
| | | if not ipyData: |
| | | return |
| | | cfgID = ipyData.GetCfgID() |
| | | awardState = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAward % actNum) |
| | | if awardState: |
| | | #已经结算过该活动 |
| | | GameWorld.Log("boss历练活动已经结算过奖励了! actNum=%s,cfgID=%s,dayIndex=%s" % (actNum, cfgID, dayIndex)) |
| | | return |
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAward % actNum, 1) |
| | | |
| | | GameWorld.Log("=== 本服boss历练活动发放榜单奖励! === actNum=%s,cfgID=%s,dayIndex=%s" % (actNum, cfgID, dayIndex)) |
| | | |
| | | familyTemplateID = GameWorld.GetTemplateIDByList(ipyData.GetFamilyTemplateIDList(), dayIndex) |
| | | __OnEndAward_Family(familyTemplateID, ShareDefine.Def_BT_BossTrialSubmitFamily) |
| | | |
| | | templateID = GameWorld.GetTemplateID(ipyData, cfgID, dayIndex) |
| | | __OnEndAward_Personal(templateID, ShareDefine.Def_BT_BossTrialSubmit) |
| | | |
| | | # 流向备份 |
| | | DataRecordPack.DR_BillboardData(ShareDefine.Def_BT_BossTrialSubmitFamily, "BossTrial", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex}) |
| | | DataRecordPack.DR_BillboardData(ShareDefine.Def_BT_BossTrialSubmit, "BossTrial", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex}) |
| | | GameWorld.Log("=================================================================================") |
| | | return |
| | | |
| | | def __OnEndAward_Personal(templateID, billboardType): |
| | | billBoard = GameWorld.GetBillboard().FindBillboard(billboardType) |
| | | if not billBoard: |
| | | return |
| | | templateIDList = ipyData.GetFamilyTemplateIDList() |
| | | templateID = templateIDList[-1] if dayIndex >= len(templateIDList) else templateIDList[dayIndex] |
| | | if not templateID: |
| | | GameWorld.Log("本次活动没有仙盟榜奖励!") |
| | | GameWorld.Log("本次活动没有个人榜奖励!") |
| | | return |
| | | tempIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID) |
| | | if not tempIpyDataList: |
| | | return |
| | | |
| | | rankAwardDict = {} |
| | | for tempIpyData in tempIpyDataList: |
| | | rankAwardDict[tempIpyData.GetRank()] = [tempIpyData.GetAwardItemList(), tempIpyData.GetMemAwardItemList()] |
| | | |
| | | GameWorld.Log(" templateID=%s,rankAwardDict=%s" % (templateID, rankAwardDict)) |
| | | billboardDataCount = billBoard.GetCount() |
| | | billBoard.Sort() |
| | | |
| | | GameWorld.Log("结算个人榜单奖励: billboardType=%s,templateID=%s,billboardDataCount=%s" % (billboardType, templateID, billboardDataCount)) |
| | | |
| | | orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID) |
| | | if not orderIpyDataList: |
| | | return |
| | | |
| | | rankPre = 0 |
| | | billboardIndex = 0 |
| | | for ipyData in orderIpyDataList: |
| | | rank = ipyData.GetRank() |
| | | needScore = ipyData.GetNeedScore() |
| | | scoreAwardEx = ipyData.GetScoreAwardEx() |
| | | scoreAwardExList = scoreAwardEx.keys() |
| | | scoreAwardExList.sort() |
| | | awardItemList = ipyData.GetAwardItemList() |
| | | orderCountTotal = rank - rankPre # 奖励名次数量 |
| | | rankPre = rank |
| | | |
| | | for index in xrange(billboardIndex, billboardDataCount): |
| | | if orderCountTotal <= 0: |
| | | break |
| | | |
| | | billBoardData = billBoard.At(index) |
| | | playerID = billBoardData.GetID() |
| | | name2 = billBoardData.GetName2() |
| | | cmpValue = billBoardData.GetCmpValue() |
| | | |
| | | if cmpValue < needScore: |
| | | GameWorld.Log(" 积分不足该榜单所需积分,跳过该名次: index=%s,rank=%s,playerID=%s,cmpValue=%s < %s" % (index, rank, playerID, cmpValue, needScore)) |
| | | break |
| | | |
| | | awardItemExList = [] |
| | | for scoreEx in scoreAwardExList: |
| | | if cmpValue < scoreEx: |
| | | break |
| | | awardItemExList = scoreAwardEx[scoreEx] # 取最大满足条件的一档 |
| | | finalAwardItemList = awardItemList + awardItemExList |
| | | |
| | | playerRank = rank - orderCountTotal + 1 |
| | | GameWorld.Log(" 发放boss历练个人榜单奖励: index=%s,rank=%s,playerRank=%s,playerID=%s,cmpValue=%s,awardItemList=%s,scoreAwardEx=%s,finalAwardItemList=%s, %s" |
| | | % (index, rank, playerRank, playerID, cmpValue, awardItemList, scoreAwardEx, finalAwardItemList, name2)) |
| | | PlayerCompensation.SendMailByKey("BossTrialMail10", [playerID], finalAwardItemList, [playerRank]) |
| | | |
| | | orderCountTotal -= 1 |
| | | billboardIndex += 1 |
| | | |
| | | return |
| | | |
| | | def __OnEndAward_Family(familyTemplateID, billboardType): |
| | | billBoard = GameWorld.GetBillboard().FindBillboard(billboardType) |
| | | if not billBoard: |
| | | return |
| | | if not familyTemplateID: |
| | | GameWorld.Log("本次活动没有仙盟榜奖励!") |
| | | return |
| | | billboardDataCount = billBoard.GetCount() |
| | | billBoard.Sort() |
| | | |
| | | GameWorld.Log("结算仙盟榜单奖励: billboardType=%s,familyTemplateID=%s,billboardDataCount=%s" % (billboardType, familyTemplateID, billboardDataCount)) |
| | | |
| | | orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", familyTemplateID) |
| | | if not orderIpyDataList: |
| | | return |
| | | |
| | | familyManager = GameWorld.GetFamilyManager() |
| | | for index in xrange(billBoard.GetCount()): |
| | | billBoardData = billBoard.At(index) |
| | | if not billBoardData: |
| | | continue |
| | | rankPre = 0 |
| | | billboardIndex = 0 |
| | | for ipyData in orderIpyDataList: |
| | | rank = ipyData.GetRank() |
| | | needScore = ipyData.GetNeedScore() |
| | | leaderAwardItemList = ipyData.GetAwardItemList() |
| | | memAwardItemList = ipyData.GetMemAwardItemList() |
| | | orderCountTotal = rank - rankPre # 奖励名次数量 |
| | | rankPre = rank |
| | | |
| | | familyRank = index + 1 |
| | | awardInfo = GameWorld.GetOrderValueByDict(rankAwardDict, familyRank, False) |
| | | if not awardInfo: |
| | | break |
| | | leaderAwardItemList, memAwardItemList = awardInfo |
| | | |
| | | familyID = billBoardData.GetID() |
| | | cmpValue = billBoardData.GetCmpValue() |
| | | |
| | | family = familyManager.FindFamily(familyID) |
| | | if not family: |
| | | continue |
| | | |
| | | familyActionData = GetFamilyBossTrialSubmitActionData(familyID, False) |
| | | if not familyActionData: |
| | | continue |
| | | awardState = GetFamilyAwardState(familyActionData) |
| | | awardIndex = 0 # 本服奖励状态索引 |
| | | if awardState&pow(2, awardIndex): |
| | | GameWorld.ErrLog("该仙盟本服榜奖励已发放! familyID=%s" % familyID) |
| | | continue |
| | | updAwardState = awardState|pow(2, awardIndex) |
| | | SetFamilyAwardState(familyActionData, updAwardState) |
| | | |
| | | memSubCountDict = GetFamilyMemSubCountDict(familyActionData) |
| | | |
| | | leaderID = family.GetLeaderID() |
| | | awardMemIDList = [] |
| | | for index in xrange(family.GetCount()): |
| | | member = family.GetAt(index) |
| | | memPlayerID = member.GetPlayerID() |
| | | if memPlayerID == leaderID: |
| | | for index in xrange(billboardIndex, billboardDataCount): |
| | | if orderCountTotal <= 0: |
| | | break |
| | | |
| | | billBoardData = billBoard.At(index) |
| | | familyID = billBoardData.GetID() |
| | | cmpValue = billBoardData.GetCmpValue() |
| | | |
| | | if cmpValue < needScore: |
| | | GameWorld.Log(" 不足该榜单所需提交数,跳过该名次: index=%s,rank=%s,familyID=%s,cmpValue=%s < %s" % (index, rank, familyID, cmpValue, needScore)) |
| | | break |
| | | |
| | | familyRank = rank - orderCountTotal + 1 |
| | | orderCountTotal -= 1 |
| | | billboardIndex += 1 |
| | | |
| | | family = familyManager.FindFamily(familyID) |
| | | if not family: |
| | | continue |
| | | awardMemIDList.append(memPlayerID) |
| | | |
| | | paramList = [familyRank] |
| | | if not leaderAwardItemList: |
| | | awardMemIDList.append(leaderID) |
| | | else: |
| | | PlayerCompensation.SendMailByKey("BossTrialFamilyLeader", [leaderID], leaderAwardItemList, paramList) |
| | | familyActionData = GetFamilyBossTrialSubmitActionData(familyID, False) |
| | | if not familyActionData: |
| | | GameWorld.ErrLog("该仙盟没有提交凭证ActionData! familyID=%s" % familyID) |
| | | continue |
| | | awardState = GetFamilyAwardState(familyActionData) |
| | | awardIndex = 0 # 本服奖励状态索引 |
| | | if awardState&pow(2, awardIndex): |
| | | GameWorld.ErrLog("该仙盟本服榜奖励已发放! familyID=%s" % familyID) |
| | | continue |
| | | updAwardState = awardState|pow(2, awardIndex) |
| | | SetFamilyAwardState(familyActionData, updAwardState) |
| | | |
| | | PlayerCompensation.SendMailByKey("BossTrialFamilyMember", awardMemIDList, memAwardItemList, paramList) |
| | | GameWorld.Log("发放boss历练活动仙盟榜单奖励本服: familyID=%s,名次=%s,总提交个数=%s,updAwardState=%s,awardMemIDList=%s,memSubCountDict=%s" |
| | | % (familyID, familyRank, cmpValue, updAwardState, awardMemIDList, memSubCountDict)) |
| | | |
| | | DataRecordPack.DR_BillboardData(BillboardType, "BossTrial", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex, "templateID":templateID}) |
| | | PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_BossTrialSubmitFamilyBak, BillboardType) |
| | | PlayerBillboard.ClearBillboardByIndex(BillboardType) |
| | | GameWorld.Log("=================================================================================") |
| | | memSubCountDict = GetFamilyMemSubCountDict(familyActionData) |
| | | |
| | | leaderID = family.GetLeaderID() |
| | | awardMemIDList = [] |
| | | for index in xrange(family.GetCount()): |
| | | member = family.GetAt(index) |
| | | memPlayerID = member.GetPlayerID() |
| | | if memPlayerID == leaderID: |
| | | continue |
| | | awardMemIDList.append(memPlayerID) |
| | | |
| | | paramList = [familyRank] |
| | | if not leaderAwardItemList: |
| | | awardMemIDList.append(leaderID) |
| | | else: |
| | | PlayerCompensation.SendMailByKey("BossTrialFamilyLeader", [leaderID], leaderAwardItemList, paramList) |
| | | |
| | | PlayerCompensation.SendMailByKey("BossTrialFamilyMember", awardMemIDList, memAwardItemList, paramList) |
| | | GameWorld.Log("发放boss历练活动仙盟榜单奖励本服: index=%s,rank=%s,familyID=%s,名次=%s,总提交个数=%s,updAwardState=%s,awardMemIDList=%s,memSubCountDict=%s" |
| | | % (index, rank, familyID, familyRank, cmpValue, updAwardState, awardMemIDList, memSubCountDict)) |
| | | |
| | | return |
| | | |
| | | def MapServer_BossTrial(curPlayer, msgList): |
| | |
| | | |
| | | familyActionData = GetFamilyBossTrialSubmitActionData(familyID, False) |
| | | if not familyActionData: |
| | | GameWorld.ErrLog("该仙盟没有提交凭证ActionData! familyID=%s" % familyID) |
| | | continue |
| | | awardState = GetFamilyAwardState(familyActionData) |
| | | awardIndex = 1 #跨服奖励状态索引 |
| | |
| | | if not actInfo or not actInfo[ShareDefine.ActKey_State]: |
| | | GameWorld.ErrLog("跨服boss历练非活动中,无法提交! cfgID=%s, zoneID=%s" % (cfgID, zoneID)) |
| | | return |
| | | if not actInfo[ShareDefine.ActKey_StateJoin]: |
| | | if actInfo[ShareDefine.ActKey_StateJoin] != ShareDefine.ActStateJoin_Start: |
| | | GameWorld.ErrLog("跨服boss历练非可参与状态,无法提交! cfgID=%s, zoneID=%s" % (cfgID, zoneID)) |
| | | return |
| | | ipyData = IpyGameDataPY.GetIpyGameData("CrossActBossTrial", cfgID) |
| | | if not ipyData: |
| | | return |
| | | personlLimit, familyLimit = ipyData.GetRankLimitList() |
| | | |
| | | personlLimit, familyLimit = 0, 0 |
| | | |
| | | PersonalTemplateID = ipyData.GetPersonalTemplateID() |
| | | pRankIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", PersonalTemplateID) if PersonalTemplateID else None |
| | | if pRankIpyDataList: |
| | | lastRankIpyData = pRankIpyDataList[-1] # 取最后一个为最低上榜积分限制 |
| | | personlLimit = lastRankIpyData.GetNeedScore() |
| | | |
| | | FamilyTemplateID = ipyData.GetFamilyTemplateID() |
| | | fRankIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", FamilyTemplateID) if FamilyTemplateID else None |
| | | if fRankIpyDataList: |
| | | lastRankIpyData = fRankIpyDataList[-1] # 取最后一个为最低上榜积分限制 |
| | | familyLimit = lastRankIpyData.GetNeedScore() |
| | | |
| | | playerID = playerInfo["playerID"] |
| | | playerName = playerInfo["playerName"] |
| | | job = playerInfo["job"] |
| | |
| | | |
| | | return |
| | | |
| | | def OnCrossActIDChange(cfgID, state): |
| | | ## 活动ID变更 |
| | | |
| | | # 先结算活动 |
| | | zoneID = 0 |
| | | ipyData = IpyGameDataPY.GetIpyGameData("CrossActBossTrial", cfgID) |
| | | if ipyData: |
| | | zoneID = ipyData.GetZoneID() |
| | | |
| | | PersonalTemplateID = ipyData.GetPersonalTemplateID() |
| | | FamilyTemplateID = ipyData.GetFamilyTemplateID() |
| | | |
| | | if PersonalTemplateID: |
| | | __GiveCrossOrderAwardPersonal(cfgID, zoneID, PersonalTemplateID) |
| | | |
| | | if FamilyTemplateID: |
| | | __GiveCrossOrderAwardFamily(cfgID, zoneID, FamilyTemplateID) |
| | | |
| | | # 如果有新活动,处理新活动 |
| | | if not state: |
| | | return |
| | | |
| | | if zoneID: |
| | | groupValue1 = zoneID |
| | | billboardMgr = PyDataManager.GetCrossBillboardManager() |
| | | billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmit, groupValue1) |
| | | billboardObj.ClearData() # 新活动重置榜单数据 |
| | | |
| | | billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmitFamily, groupValue1) |
| | | billboardObj.ClearData() # 新活动重置榜单数据 |
| | | |
| | | def OnCrossActIDChange(cfgID, zoneID, ipyData, state): |
| | | ## 跨服活动ID变更 |
| | | if state: |
| | | OnCrossActStart(cfgID, zoneID, ipyData) |
| | | else: |
| | | OnCrossActEnd(cfgID, zoneID, ipyData) |
| | | return |
| | | |
| | | def OnCrossActStart(cfgID, zoneID, ipyData): |
| | | ## 跨服活动开启 |
| | | |
| | | def __GiveCrossOrderAwardPersonal(cfgID, zoneID, templateID): |
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAwardC % zoneID, 0) |
| | | |
| | | groupValue1 = zoneID |
| | | billboardType = ShareDefine.Def_CBT_BossTrialSubmit |
| | | billboardMgr = PyDataManager.GetCrossBillboardManager() |
| | | billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmit, groupValue1) |
| | | billboardObj.ClearData() # 新活动重置榜单数据 |
| | | |
| | | billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmitFamily, groupValue1) |
| | | billboardObj.ClearData() # 新活动重置榜单数据 |
| | | return |
| | | |
| | | def OnCrossActEnd(cfgID, zoneID, ipyData): |
| | | ## 跨服活动结束 |
| | | |
| | | groupValue1 = zoneID |
| | | GameWorld.Log("=== 跨服boss历练活动结束! === cfgID=%s,zoneID=%s" % (cfgID, zoneID)) |
| | | __OnCrossEndAward(cfgID, zoneID, ipyData) |
| | | |
| | | # 备份、清除榜单数据 |
| | | billboardMgr = PyDataManager.GetCrossBillboardManager() |
| | | billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmit, groupValue1) |
| | | CrossBillboard.CopyBillboardEx(ShareDefine.Def_CBT_BossTrialSubmit, ShareDefine.Def_CBT_BossTrialSubmitBak, groupValue1) |
| | | billboardObj.ClearData() |
| | | |
| | | billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmitFamily, groupValue1) |
| | | CrossBillboard.CopyBillboardEx(ShareDefine.Def_CBT_BossTrialSubmitFamily, ShareDefine.Def_CBT_BossTrialSubmitFamilyBak, groupValue1) |
| | | billboardObj.ClearData() |
| | | GameWorld.Log("=================================================================================") |
| | | return |
| | | |
| | | def OnCrossActInStateRefresh(cfgID, zoneID, ipyData): |
| | | ## 活动中刷新,每次都需要刷新的逻辑,包含重读配置等 |
| | | if not ipyData: |
| | | return |
| | | PersonalTemplateID = ipyData.GetPersonalTemplateID() |
| | | FamilyTemplateID = ipyData.GetFamilyTemplateID() |
| | | orderRuleList = GetOrderRuleList(PersonalTemplateID) |
| | | orderRuleListFamily = GetOrderRuleList(FamilyTemplateID) |
| | | |
| | | groupValue1 = zoneID |
| | | billboardMgr = PyDataManager.GetCrossBillboardManager() |
| | | billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmit, groupValue1) |
| | | billboardObj.SetOrderRuleList(orderRuleList) |
| | | |
| | | billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_BossTrialSubmitFamily, groupValue1) |
| | | billboardObj.SetOrderRuleList(orderRuleListFamily) |
| | | return |
| | | |
| | | def GetOrderRuleList(templateID): |
| | | orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID) |
| | | if not orderIpyDataList: |
| | | return |
| | | orderRuleList = [] |
| | | for ipyData in orderIpyDataList: |
| | | orderRuleList.append([ipyData.GetRank(), ipyData.GetNeedScore()]) |
| | | return orderRuleList |
| | | |
| | | def OnCrossActJoinEnd(cfgID, zoneID, ipyData): |
| | | ## 跨服活动参与结束 |
| | | __OnCrossEndAward(cfgID, zoneID, ipyData) |
| | | return |
| | | |
| | | def __OnCrossEndAward(cfgID, zoneID, ipyData): |
| | | ## 结算跨服奖励 |
| | | awardState = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAwardC % zoneID) |
| | | if awardState: |
| | | #已经结算过该活动 |
| | | GameWorld.Log("跨服boss历练活动已经结算过奖励了! cfgID=%s,zoneID=%s" % (cfgID, zoneID)) |
| | | return |
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActBossTrialAwardC % zoneID, 1) |
| | | |
| | | GameWorld.Log("=== 跨服boss历练活动发放榜单奖励! === cfgID=%s,zoneID=%s" % (cfgID, zoneID)) |
| | | |
| | | PersonalTemplateID = ipyData.GetPersonalTemplateID() |
| | | FamilyTemplateID = ipyData.GetFamilyTemplateID() |
| | | serverIDRangeList = ipyData.GetServerIDRangeList() |
| | | |
| | | __GiveCrossOrderAwardPersonal(cfgID, zoneID, PersonalTemplateID, ShareDefine.Def_CBT_BossTrialSubmit, serverIDRangeList) |
| | | __GiveCrossOrderAwardFamily(cfgID, zoneID, FamilyTemplateID, ShareDefine.Def_CBT_BossTrialSubmitFamily) |
| | | GameWorld.Log("=================================================================================") |
| | | return |
| | | |
| | | def __GiveCrossOrderAwardPersonal(cfgID, zoneID, templateID, billboardType, serverIDRangeList): |
| | | |
| | | groupValue1 = zoneID |
| | | #billboardType = ShareDefine.Def_CBT_BossTrialSubmit #榜单类型改为参数传入,异常情况下可特殊处理用备份榜单发奖励 |
| | | billboardMgr = PyDataManager.GetCrossBillboardManager() |
| | | billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1) |
| | | billboardDataCount = billboardObj.GetCount() |
| | | if not billboardDataCount: |
| | | GameWorld.Log("跨服Boss凭证个人排行数据为空! billboardType=%s,cfgID=%s,zoneID=%s,templateID=%s" % (billboardType, cfgID, zoneID, templateID)) |
| | | GameWorld.Log("跨服Boss凭证个人排行数据为空! billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s" % (billboardType, zoneID, cfgID, templateID)) |
| | | return |
| | | |
| | | # 结算时排序并保存榜单数据流向 |
| | | billboardObj.SortData() |
| | | billboardObj.SaveDRData("BossTrial", {"cfgID":cfgID, "zoneID":zoneID}) |
| | | |
| | | GameWorld.Log("结算跨服Boss凭证个人排行奖励: billboardType=%s,cfgID=%s,zoneID=%s,templateID=%s,billboardDataCount=%s" |
| | | % (billboardType, cfgID, zoneID, templateID, billboardDataCount)) |
| | | GameWorld.Log("结算跨服Boss凭证个人排行奖励: billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s,billboardDataCount=%s" |
| | | % (billboardType, zoneID, cfgID, templateID, billboardDataCount)) |
| | | |
| | | orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID) |
| | | if not orderIpyDataList: |
| | | return |
| | | |
| | | syncNewXiangongDict = {} |
| | | rankPre = 0 |
| | | billboardIndex = 0 |
| | | for ipyData in orderIpyDataList: |
| | | rank = ipyData.GetRank() |
| | | needScore = ipyData.GetNeedScore() |
| | | scoreAwardEx = ipyData.GetScoreAwardEx() |
| | | scoreAwardExList = scoreAwardEx.keys() |
| | | scoreAwardExList.sort() |
| | | awardItemList = ipyData.GetAwardItemList() |
| | | xiangongID = ipyData.GetXiangongID() |
| | | orderCountTotal = rank - rankPre # 奖励名次数量 |
| | | rankPre = rank |
| | | orderCount = 0 |
| | | |
| | | for index in xrange(billboardIndex, billboardDataCount): |
| | | if orderCount >= orderCountTotal: |
| | | if orderCountTotal <= 0: |
| | | break |
| | | |
| | | billboardData = billboardObj.At(index) |
| | | playerID = billboardData.ID |
| | | name2 = billboardData.Name2 |
| | | cmpValue = billboardData.CmpValue |
| | | if cmpValue < needScore: |
| | | GameWorld.Log(" 积分不足该榜单所需积分,跳过该名次: index=%s,rank=%s,playerID=%s,cmpValue=%s < %s" % (index, rank, playerID, cmpValue, needScore)) |
| | | break |
| | | |
| | | playerRank = index + 1 |
| | | GameWorld.Log(" 发放boss历练个人榜单奖励: rank=%s,playerID=%s,cmpValue=%s,awardItemList=%s, %s" |
| | | % (rank, playerID, cmpValue, awardItemList, name2)) |
| | | PlayerCompensation.SendMailByKey("BossTrialCrossPlayer", [playerID], awardItemList, [playerRank], crossMail=True) |
| | | awardItemExList = [] |
| | | for scoreEx in scoreAwardExList: |
| | | if cmpValue < scoreEx: |
| | | break |
| | | awardItemExList = scoreAwardEx[scoreEx] # 取最大满足条件的一档 |
| | | finalAwardItemList = awardItemList + awardItemExList |
| | | |
| | | orderCount += 1 |
| | | playerRank = rank - orderCountTotal + 1 |
| | | GameWorld.Log(" 发放boss历练个人榜单奖励: index=%s,rank=%s,playerRank=%s,playerID=%s,cmpValue=%s,awardItemList=%s,scoreAwardEx=%s,finalAwardItemList=%s, %s" |
| | | % (index, rank, playerRank, playerID, cmpValue, awardItemList, scoreAwardEx, finalAwardItemList, name2)) |
| | | PlayerCompensation.SendMailByKey("BossTrialCrossPlayer", [playerID], finalAwardItemList, [playerRank], crossMail=True) |
| | | |
| | | orderCountTotal -= 1 |
| | | billboardIndex += 1 |
| | | |
| | | # 结算完备份、清除榜单数据 |
| | | CrossBillboard.CopyBillboard(billboardType, ShareDefine.Def_CBT_BossTrialSubmitBak) |
| | | billboardObj.ClearData() |
| | | GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict) |
| | | GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict) |
| | | return |
| | | |
| | | def __GiveCrossOrderAwardFamily(cfgID, zoneID, templateID): |
| | | def __GiveCrossOrderAwardFamily(cfgID, zoneID, templateID, billboardType): |
| | | |
| | | groupValue1 = zoneID |
| | | billboardType = ShareDefine.Def_CBT_BossTrialSubmitFamily |
| | | #billboardType = ShareDefine.Def_CBT_BossTrialSubmitFamily |
| | | billboardMgr = PyDataManager.GetCrossBillboardManager() |
| | | billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1) |
| | | billboardDataCount = billboardObj.GetCount() |
| | | if not billboardDataCount: |
| | | GameWorld.Log("跨服Boss凭证仙盟排行数据为空! billboardType=%s,cfgID=%s,zoneID=%s,templateID=%s" % (billboardType, cfgID, zoneID, templateID)) |
| | | GameWorld.Log("跨服Boss凭证仙盟排行数据为空! billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s" % (billboardType, zoneID, cfgID, templateID)) |
| | | return |
| | | |
| | | # 结算时排序并保存榜单数据流向 |
| | | billboardObj.SortData() |
| | | billboardObj.SaveDRData("BossTrial", {"cfgID":cfgID, "zoneID":zoneID}) |
| | | |
| | | GameWorld.Log("结算跨服Boss凭证仙盟排行奖励: billboardType=%s,cfgID=%s,zoneID=%s,templateID=%s,billboardDataCount=%s" |
| | | % (billboardType, cfgID, zoneID, templateID, billboardDataCount)) |
| | | GameWorld.Log("结算跨服Boss凭证仙盟排行奖励: billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s,billboardDataCount=%s" |
| | | % (billboardType, zoneID, cfgID, templateID, billboardDataCount)) |
| | | |
| | | orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID) |
| | | if not orderIpyDataList: |
| | |
| | | billboardIndex = 0 |
| | | for ipyData in orderIpyDataList: |
| | | rank = ipyData.GetRank() |
| | | needScore = ipyData.GetNeedScore() |
| | | leaderAwardItemList = ipyData.GetAwardItemList() |
| | | memAwardItemList = ipyData.GetMemAwardItemList() |
| | | orderCountTotal = rank - rankPre # 奖励名次数量 |
| | | rankPre = rank |
| | | orderCount = 0 |
| | | |
| | | for index in xrange(billboardIndex, billboardDataCount): |
| | | if orderCount >= orderCountTotal: |
| | | if orderCountTotal <= 0: |
| | | break |
| | | |
| | | billboardData = billboardObj.At(index) |
| | | familyID = billboardData.ID |
| | | familySubmitTotal = billboardData.CmpValue |
| | | |
| | | familyRank = index + 1 |
| | | GameWorld.Log(" familyID=%s,名次=%s,总提交个数=%s" % (familyID, familyRank, familySubmitTotal)) |
| | | if familySubmitTotal < needScore: |
| | | GameWorld.Log(" 不足该榜单所需提交数,跳过该名次: index=%s,rank=%s,familyID=%s,familySubmitTotal=%s < %s" % (index, rank, familyID, familySubmitTotal, needScore)) |
| | | break |
| | | |
| | | familyRank = rank - orderCountTotal + 1 |
| | | GameWorld.Log(" index=%s,rank=%s,familyID=%s,名次=%s,总提交个数=%s" % (index, rank, familyID, familyRank, familySubmitTotal)) |
| | | awardFamilyList.append([familyID, familyRank, familySubmitTotal, leaderAwardItemList, memAwardItemList]) |
| | | orderCount += 1 |
| | | |
| | | orderCountTotal -= 1 |
| | | billboardIndex += 1 |
| | | |
| | | # 广播子服发放奖励 |
| | | sendMsg = {"cfgID":cfgID, "zoneID":zoneID, "templateID":templateID, "awardFamilyList":awardFamilyList} |
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_CrossBossTrialFamilyAward, sendMsg) |
| | | |
| | | # 结算完备份、清除榜单数据 |
| | | CrossBillboard.CopyBillboard(billboardType, ShareDefine.Def_CBT_BossTrialSubmitFamilyBak) |
| | | billboardObj.ClearData() |
| | | return |
| | | |