| | |
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | | import PlayerMail
|
| | | import DBDataMgr
|
| | |
|
| | | import time
|
| | |
|
| | | def OnDay():
|
| | | def OnDay(centerEventValue=0):
|
| | | # @param centerEventValue: 跨服中心事件值,不为0时代表是跨服中心同步的事件,只处理跨服功能需要处理的逻辑
|
| | |
|
| | | drBillboardTypeList = []
|
| | | if GameWorld.IsCrossServer():
|
| | | if centerEventValue:
|
| | | if not GameWorld.IsCrossServer():
|
| | | # 跨服事件只跨服服务器处理
|
| | | return
|
| | | drBillboardTypeList = ShareDefine.CrossBillboardTypeList
|
| | | eventName = "OnDay%s" % centerEventValue
|
| | | |
| | | else:
|
| | | drBillboardTypeList = IpyGameDataPY.GetFuncEvalCfg("BillboardSet", 1)
|
| | | eventName = "OnDay"
|
| | |
|
| | | billboardMgr = DBDataMgr.GetBillboardMgr()
|
| | | for billboardType in drBillboardTypeList:
|
| | |
| | | groupList = billboardMgr.GetBillboardGroupList(billboardType)
|
| | | for billboardType, groupValue1, groupValue2 in groupList:
|
| | | billboardObj = billboardMgr.GetBillboard(billboardType, groupValue1, groupValue2)
|
| | | billboardObj.SaveDRData("OnDay")
|
| | | billboardObj.SaveDRData(eventName)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | ##更新玩家总战斗力
|
| | | return
|
| | |
|
| | | def UpdatePyPetBillboard(curPlayer, isForceUpdate=False, isUpdateTotal=True):
|
| | | ## 更新宠物排行榜
|
| | | return
|
| | |
|
| | | def UpdateRealmBillboard(curPlayer):
|
| | | ##境界榜
|
| | | return
|
| | |
|
| | | #def __CanPlayerBillboardComm(curPlayer):
|
| | | # ## 玩家可否上榜通用检查
|
| | | # if not GameWorld.IsNormalPlayer(curPlayer):
|
| | |
| | | #
|
| | | # return True
|
| | |
|
| | | def UpdatePlayerBillboard(curPlayer, bType, cmpValue, cmpValue2=0, cmpValue3=0, autoSort=False, **kwargs):
|
| | | def UpdatePlayerBillboard(curPlayer, bType, cmpValue, cmpValue2=0, cmpValue3=0, autoSort=False, groupValue1=0, **kwargs):
|
| | | ## 更新玩家排行榜
|
| | |
|
| | | #if not cmpValue and not cmpValue2 and not cmpValue3:
|
| | |
| | | kwargs["value5"] = curPlayer.GetModelMark()
|
| | | kwargs["value6"] = curPlayer.GetEquipShowSwitch()
|
| | |
|
| | | groupValue1 = 0
|
| | | UpdateBillboard(bType, groupValue1, playerID, playerName, playerOpInfo, playerJob, value1, value2,
|
| | | cmpValue, cmpValue2, cmpValue3, autoSort=autoSort, **kwargs)
|
| | | return
|
| | |
| | | clientPack.ViewIDDataList.append(viewData)
|
| | | clientPack.ViewIDDataCnt = len(clientPack.ViewIDDataList)
|
| | | return clientPack
|
| | |
|
| | | def SetOrderRuleListByActTempID(billboardType, templateID, groupValue1=0, groupValue2=0):
|
| | | ## 根据活动榜单模版更新排名规则
|
| | | orderRuleList = []
|
| | | orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBillboardAward", templateID)
|
| | | if orderIpyDataList:
|
| | | for ipyData in orderIpyDataList:
|
| | | orderRuleList.append([ipyData.GetRankB(), ipyData.GetNeedValue()])
|
| | | |
| | | billboardMgr = DBDataMgr.GetBillboardMgr()
|
| | | billBoard = billboardMgr.GetBillboard(billboardType, groupValue1, groupValue2)
|
| | | billBoard.SetOrderRuleList(orderRuleList)
|
| | | return
|
| | |
|
| | | def DoGiveBillboardAwardByActTempID(billboardType, funcName, templateID, mailKey, groupValue1=0, groupValue2=0, isClearData=False):
|
| | | ## 根据活动榜单模版结算排名奖励,邮件发放
|
| | | # @param funcName: 自定义的功能名称
|
| | | billboardAwardDict = {}
|
| | | orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBillboardAward", templateID)
|
| | | if orderIpyDataList:
|
| | | for ipyData in orderIpyDataList:
|
| | | billboardAwardDict[str(ipyData.GetRankB())] = ipyData.GetAwardItemList()
|
| | | DoGiveBillboardAwardByMail(billboardType, funcName, billboardAwardDict, mailKey, groupValue1, groupValue2, isClearData)
|
| | | return
|
| | |
|
| | | def DoGiveBillboardAwardByMail(billboardType, funcName, billboardAwardDict, mailKey, groupValue1=0, groupValue2=0, isClearData=False):
|
| | | ## 结算排行奖励邮件发放
|
| | | # @param funcName: 自定义的功能名称
|
| | | # @param billboardAwardDict: {"名次":[[itemID,itemCnt], ...], ...}
|
| | | # @param mailKey: 邮件模版key
|
| | | |
| | | GameWorld.Log("----- %s 结算排行奖励! -----" % (funcName))
|
| | | if not billboardAwardDict:
|
| | | return
|
| | | orderList = [int(orderStr) for orderStr in billboardAwardDict.keys()]
|
| | | orderList.sort()
|
| | | GameWorld.Log(" 奖励名次列表: %s" % orderList)
|
| | | |
| | | billboardMgr = DBDataMgr.GetBillboardMgr()
|
| | | billBoard = billboardMgr.GetBillboard(billboardType, groupValue1, groupValue2)
|
| | | if not billBoard:
|
| | | return
|
| | | billBoard.SortDelayDo()
|
| | | idOrderDict = billBoard.GetIDOrderDict()
|
| | | |
| | | awardOrder = orderList[0]
|
| | | orderPlayerIDDict = {}
|
| | | billboardCount, billboardMaxCount = billBoard.GetCount(), billBoard.GetMaxCount()
|
| | | GameWorld.Log(" 榜单数据数: %s/%s" % (billboardCount, billboardMaxCount))
|
| | | for index in xrange(billboardCount):
|
| | | billBoardData = billBoard.At(index)
|
| | | if not billBoardData:
|
| | | continue
|
| | | playerID = billBoardData.GetID()
|
| | | order = idOrderDict.get(playerID, index + 1)
|
| | | |
| | | endAward = False # 发奖是否结束
|
| | | while order > awardOrder:
|
| | | nextOrderIndex = orderList.index(awardOrder) + 1
|
| | | if nextOrderIndex >= len(orderList):
|
| | | endAward = True
|
| | | break
|
| | | awardOrder = orderList[nextOrderIndex]
|
| | | if endAward:
|
| | | break
|
| | | |
| | | if playerID < ShareDefine.RealPlayerIDStart:
|
| | | # 非真人不处理
|
| | | continue
|
| | | |
| | | orderPlayerIDDict[playerID] = [order, awardOrder]
|
| | | |
| | | paramList = [order]
|
| | | awardList = billboardAwardDict[str(awardOrder)]
|
| | | PlayerMail.SendMailByKey(mailKey, playerID, awardList, paramList)
|
| | | |
| | | GameWorld.Log(" 奖励玩家名次信息: %s" % orderPlayerIDDict)
|
| | | if isClearData:
|
| | | billBoard.ClearData("Award")
|
| | | GameWorld.Log("---------------------------------------------------")
|
| | | return
|