| | |
| | | import CrossBillboard |
| | | import PyDataManager |
| | | import CrossRealmMsg |
| | | import GameXiangong |
| | | import GameWorship |
| | | import GameWorld |
| | | |
| | | def OnActStart(actNum): |
| | | def OnActStart(actNum, ipyData): |
| | | ## 活动开启 |
| | | if not ipyData: |
| | | return |
| | | personalTemplateID = ipyData.GetPersonalTemplateID() |
| | | if not personalTemplateID: |
| | | GameWorld.DebugLog("仙匣秘境活动没有榜单奖励,不处理OnActStart! actNum=%s" % (actNum)) |
| | | return |
| | | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActXianXiaMJAward % actNum, 0) |
| | | PlayerBillboard.ClearBillboardByIndex(ShareDefine.Def_BT_XianXiaMJScore) |
| | | return |
| | |
| | | |
| | | __OnEndAward(actNum, ipyData, dayIndex) # 兼容活动没有配置参与时间段的在活动结束补触发结算奖励 |
| | | |
| | | DataRecordPack.DR_BillboardData(ShareDefine.Def_BT_XianXiaMJScore, "XianXiaMJ", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex}) |
| | | GameWorld.Log("=================================================================================") |
| | | return |
| | | |
| | | def OnActInStateRefresh(actNum, ipyData): |
| | | ## 活动中刷新,每次都需要刷新的逻辑,包含重读配置等 |
| | | if not ipyData: |
| | | return |
| | | personalTemplateID = ipyData.GetPersonalTemplateID() |
| | | if not personalTemplateID: |
| | | return |
| | | orderRuleList = GetOrderRuleList(personalTemplateID) |
| | | |
| | | billboardMgr = PlayerBillboard.GetBillboardMgr() |
| | | billboardObj = billboardMgr.GetBillboardObj(ShareDefine.Def_BT_XianXiaMJScore) |
| | | billboardObj.SetOrderRuleList(orderRuleList) |
| | | return |
| | | |
| | | def OnActJoinEnd(actNum, ipyData, dayIndex): |
| | |
| | | if not ipyData: |
| | | return |
| | | cfgID = ipyData.GetCfgID() |
| | | personalTemplateID = ipyData.GetPersonalTemplateID() |
| | | if not personalTemplateID: |
| | | GameWorld.DebugLog("仙匣秘境活动没有榜单奖励,不结算榜单奖励! actNum=%s" % (actNum)) |
| | | return |
| | | awardState = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ActXianXiaMJAward % actNum) |
| | | if awardState: |
| | | #已经结算过该活动 |
| | |
| | | GameWorld.Log("=== 本服仙匣秘境活动发放榜单奖励! === actNum=%s,cfgID=%s,dayIndex=%s" % (actNum, cfgID, dayIndex)) |
| | | |
| | | __OnEndAward_Personal(ipyData.GetPersonalTemplateID(), ShareDefine.Def_BT_XianXiaMJScore) |
| | | |
| | | DataRecordPack.DR_BillboardData(ShareDefine.Def_BT_XianXiaMJScore, "XXMJ", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex}) |
| | | GameWorld.Log("=================================================================================") |
| | | return |
| | | |
| | |
| | | if not templateID: |
| | | GameWorld.Log("本次活动没有个人榜奖励!") |
| | | return |
| | | tempIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActXianXiaMJBillTemp", templateID) |
| | | if not tempIpyDataList: |
| | | billboardDataCount = billBoard.GetCount() |
| | | billBoard.Sort() |
| | | |
| | | GameWorld.Log("结算个人榜单奖励: billboardType=%s,templateID=%s,billboardDataCount=%s" % (billboardType, templateID, billboardDataCount)) |
| | | |
| | | orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActXianXiaMJBillTemp", templateID) |
| | | if not orderIpyDataList: |
| | | return |
| | | |
| | | rankAwardDict = {} |
| | | for tempIpyData in tempIpyDataList: |
| | | rankAwardDict[tempIpyData.GetRank()] = tempIpyData.GetAwardItemList() |
| | | 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 |
| | | |
| | | 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(" 发放仙匣秘境个人榜单奖励: rank=%s,playerID=%s,cmpValue=%s,awardItemList=%s, %s" |
| | | % (rank, playerID, cmpValue, awardItemList, name2)) |
| | | |
| | | PlayerCompensation.SendMailByKey("XianXiaMJPlayer", [playerID], awardItemList, [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(" 发放仙匣秘境个人榜单奖励: 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("XianXiaMJPlayer", [playerID], finalAwardItemList, [playerRank]) |
| | | |
| | | orderCountTotal -= 1 |
| | | billboardIndex += 1 |
| | | |
| | | return |
| | | |
| | | def MapServer_XianXiaMJ(curPlayer, msgList): |
| | |
| | | accID = curPlayer.GetAccID() |
| | | playerName = curPlayer.GetName() |
| | | job = curPlayer.GetJob() |
| | | face = curPlayer.GetFace() |
| | | facePic = curPlayer.GetFacePic() |
| | | realmLV = curPlayer.GetOfficialRank() |
| | | _, updLotteryScore = dataMsg |
| | | _, updLotteryScore, isRelationCrossAct = dataMsg |
| | | |
| | | #同步跨服 |
| | | playerInfo = {"playerID":playerID, "playerName":playerName, "accID":accID, "job":job, "realmLV":realmLV, |
| | | "playerLotteryScore":updLotteryScore} |
| | | SyncXianXiaMJToCrossServer(curPlayer, playerInfo) |
| | | # 仙盟榜... |
| | | |
| | | if isRelationCrossAct: |
| | | #同步跨服 |
| | | playerInfo = {"playerID":playerID, "playerName":playerName, "accID":accID, "job":job, "realmLV":realmLV, |
| | | "playerLotteryScore":updLotteryScore, "face":face, "facePic":facePic} |
| | | SyncXianXiaMJToCrossServer(curPlayer, playerInfo) |
| | | return |
| | | |
| | | def SyncXianXiaMJToCrossServer(curPlayer, playerInfo): |
| | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("CrossActXianXiaMJ", cfgID) |
| | | if not ipyData: |
| | | return |
| | | personlLimit = ipyData.GetRankLimitPersonal() |
| | | PersonalTemplateID = ipyData.GetPersonalTemplateID() |
| | | rankIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActXianXiaMJBillTemp", PersonalTemplateID) |
| | | if not rankIpyDataList: |
| | | return |
| | | lastRankIpyData = rankIpyDataList[-1] # 取最后一个为最低上榜积分限制 |
| | | personlLimit = lastRankIpyData.GetNeedScore() |
| | | |
| | | playerID = playerInfo["playerID"] |
| | | playerName = playerInfo["playerName"] |
| | |
| | | accID = playerInfo["accID"] |
| | | realmLV = playerInfo["realmLV"] |
| | | playerLotteryScore = playerInfo["playerLotteryScore"] |
| | | face = playerInfo.get("face", 0) |
| | | facePic = playerInfo.get("facePic", 0) |
| | | |
| | | groupValue1 = zoneID |
| | | |
| | | if playerLotteryScore >= personlLimit: |
| | | name2, type2, value1, value2 = accID, job, realmLV, 0 |
| | | CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_XianXiaMJScore, groupValue1, playerID, playerName, |
| | | name2, type2, value1, value2, playerLotteryScore) |
| | | name2, type2, value1, value2, playerLotteryScore, autoSort=False, value3=face, value4=facePic) |
| | | return |
| | | |
| | | def OnCrossActIDChange(cfgID, zoneID, ipyData, state): |
| | |
| | | GameWorld.Log("=================================================================================") |
| | | return |
| | | |
| | | def OnCrossActInStateRefresh(cfgID, zoneID, ipyData): |
| | | ## 活动中刷新,每次都需要刷新的逻辑,包含重读配置等 |
| | | if not ipyData: |
| | | return |
| | | PersonalTemplateID = ipyData.GetPersonalTemplateID() |
| | | orderRuleList = GetOrderRuleList(PersonalTemplateID) |
| | | |
| | | groupValue1 = zoneID |
| | | billboardMgr = PyDataManager.GetCrossBillboardManager() |
| | | billboardObj = billboardMgr.GetCrossBillboard(ShareDefine.Def_CBT_XianXiaMJScore, groupValue1) |
| | | billboardObj.SetOrderRuleList(orderRuleList) |
| | | return |
| | | |
| | | def GetOrderRuleList(templateID): |
| | | orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActXianXiaMJBillTemp", 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) |
| | |
| | | GameWorld.Log("=== 跨服仙匣秘境活动发放榜单奖励! === cfgID=%s,zoneID=%s" % (cfgID, zoneID)) |
| | | |
| | | PersonalTemplateID = ipyData.GetPersonalTemplateID() |
| | | serverIDRangeList = ipyData.GetServerIDRangeList() |
| | | |
| | | __GiveCrossOrderAwardPersonal(cfgID, zoneID, PersonalTemplateID, ShareDefine.Def_CBT_XianXiaMJScore) |
| | | __GiveCrossOrderAwardPersonal(cfgID, zoneID, PersonalTemplateID, ShareDefine.Def_CBT_XianXiaMJScore, serverIDRangeList) |
| | | GameWorld.Log("=================================================================================") |
| | | return |
| | | |
| | | def __GiveCrossOrderAwardPersonal(cfgID, zoneID, templateID, billboardType): |
| | | def __GiveCrossOrderAwardPersonal(cfgID, zoneID, templateID, billboardType, serverIDRangeList): |
| | | |
| | | groupValue1 = zoneID |
| | | billboardMgr = PyDataManager.GetCrossBillboardManager() |
| | |
| | | |
| | | # 结算时排序并保存榜单数据流向 |
| | | billboardObj.SortData() |
| | | billboardObj.SaveDRData() |
| | | billboardObj.SaveDRData("XXMJ", {"cfgID":cfgID, "zoneID":zoneID}) |
| | | |
| | | GameWorld.Log("结算跨服仙匣秘境个人排行奖励: billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s,billboardDataCount=%s" |
| | | % (billboardType, zoneID, cfgID, templateID, billboardDataCount)) |
| | | |
| | | orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActXianXiaMJBillTemp", templateID) |
| | | if orderIpyDataList: |
| | | rankPre = 0 |
| | | billboardIndex = 0 |
| | | for ipyData in orderIpyDataList: |
| | | rank = ipyData.GetRank() |
| | | awardItemList = ipyData.GetAwardItemList() |
| | | orderCountTotal = rank - rankPre # 奖励名次数量 |
| | | rankPre = rank |
| | | orderCount = 0 |
| | | if not orderIpyDataList: |
| | | return |
| | | |
| | | worshipType = ShareDefine.Def_WorshipType_CrossXianXiaMJ |
| | | syncNewWorshipList = [] |
| | | 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 |
| | | |
| | | for index in xrange(billboardIndex, billboardDataCount): |
| | | if orderCountTotal <= 0: |
| | | break |
| | | |
| | | for index in xrange(billboardIndex, billboardDataCount): |
| | | if orderCount >= orderCountTotal: |
| | | 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 |
| | | |
| | | awardItemExList = [] |
| | | for scoreEx in scoreAwardExList: |
| | | if cmpValue < scoreEx: |
| | | break |
| | | |
| | | billboardData = billboardObj.At(index) |
| | | playerID = billboardData.ID |
| | | name2 = billboardData.Name2 |
| | | cmpValue = billboardData.CmpValue |
| | | |
| | | playerRank = index + 1 |
| | | GameWorld.Log(" 发放仙匣秘境个人榜单奖励: rank=%s,playerID=%s,cmpValue=%s,awardItemList=%s, %s" |
| | | % (rank, playerID, cmpValue, awardItemList, name2)) |
| | | PlayerCompensation.SendMailByKey("XianXiaMJCrossPlayer", [playerID], awardItemList, [playerRank], crossMail=True) |
| | | |
| | | orderCount += 1 |
| | | billboardIndex += 1 |
| | | |
| | | awardItemExList = scoreAwardEx[scoreEx] # 取最大满足条件的一档 |
| | | finalAwardItemList = awardItemList + awardItemExList |
| | | |
| | | playerRank = rank - orderCountTotal + 1 |
| | | GameWorld.Log(" 发放仙匣秘境个人榜单奖励: 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("XianXiaMJCrossPlayer", [playerID], finalAwardItemList, [playerRank], crossMail=True) |
| | | |
| | | orderCountTotal -= 1 |
| | | billboardIndex += 1 |
| | | |
| | | GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict) |
| | | GameWorship.AddWorshipPlayer(worshipType, playerRank, playerID, serverIDRangeList, syncList=syncNewWorshipList) |
| | | GameWorship.SendNewWorshipPlayer(syncNewWorshipList) |
| | | GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict) |
| | | return |
| | | |