| | |
| | |
|
| | | def NoteOssBillboardInfoByDay():
|
| | | ## 每天记录排行榜信息到oss中
|
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | | Def_NoteOssBillboardTypeList = IpyGameDataPY.GetFuncEvalCfg("BillboardSet", 1)
|
| | | for billboardType in Def_NoteOssBillboardTypeList:
|
| | | DataRecordPack.DR_BillboardDataByDay(billboardType)
|
| | | DataRecordPack.DR_BillboardData(billboardType, "OnDay")
|
| | | return
|
| | |
|
| | | def CopyBillboardOnDay():
|
| | |
| | | # BYTE Type; //类型 TBillboardType
|
| | | # DWORD StartIndex; //查看的起始名次索引, 默认0
|
| | | # BYTE WatchCnt; //查看条数,默认20,最大不超过100
|
| | | # BYTE IsWatchSelf; //是否查看自己名次前后,默认10条数据
|
| | | # DWORD WatchID; //查看指定ID名次前后,如玩家ID、家族ID等
|
| | | #};
|
| | | def Client_PYWatchBillboard(index, clientData, tick):
|
| | |
|
| | |
| | | packType = clientData.Type
|
| | | startIndex = clientData.StartIndex
|
| | | watchCnt = clientData.WatchCnt
|
| | | isWatchSelf = clientData.IsWatchSelf
|
| | | if not __CheckWatchCD(curPlayer, packType, tick):
|
| | | return
|
| | | watchID = clientData.WatchID
|
| | | #if not __CheckWatchCD(curPlayer, packType, tick):
|
| | | # return
|
| | |
|
| | | Sync_BillboardEx(curPlayer, packType, isWatchSelf, startIndex, watchCnt)
|
| | | Sync_BillboardEx(curPlayer, packType, watchID, startIndex, watchCnt)
|
| | | return
|
| | |
|
| | | def Sync_BillboardEx(curPlayer, bbType, isWatchSelf=False, startIndex=0, watchCnt=20):
|
| | | def Sync_BillboardEx(curPlayer, bbType, watchID=0, startIndex=0, watchCnt=20):
|
| | | if bbType < 0 or bbType >= ShareDefine.Def_BT_Max:
|
| | | return
|
| | |
|
| | |
| | | GameWorld.ErrLog("找不到排行榜数据!bbType=%s" % (bbType))
|
| | | return
|
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | #playerID = curPlayer.GetPlayerID()
|
| | | count = billBoard.GetCount()
|
| | | endIndex = 0
|
| | | # 查看自己前后名次
|
| | | if isWatchSelf:
|
| | | playerIndex = billBoard.IndexOfByID(playerID)
|
| | | if watchID:
|
| | | playerIndex = billBoard.IndexOfByID(watchID)
|
| | | if playerIndex != -1:
|
| | | # 前5后4,首尾补足10条记录
|
| | | endIndex = min(playerIndex + 5, count)
|
| | |
| | |
|
| | | billBoardData = ChPyNetSendPack.tagPYBillboardData()
|
| | | billBoardData.Clear()
|
| | | billBoardData.IsWatchSelf = isWatchSelf
|
| | | billBoardData.WatchID = watchID
|
| | | billBoardData.Type = bbType
|
| | | billBoardData.Billboard = []
|
| | | for index in xrange(startIndex, endIndex):
|
| | |
| | | return False
|
| | |
|
| | | isNewData = playerBillBoardData.GetID2() == 0 # 是否是新增的数据
|
| | | cmpValueChange = False
|
| | | if isNewData or playerBillBoardData.GetCmpValue() != cmpValue or playerBillBoardData.GetCmpValue2() != cmpValue2 \
|
| | | or playerBillBoardData.GetCmpValue3() != cmpValue3:
|
| | | cmpValueChange = True
|
| | | if cmpValue3 == 0:
|
| | | cmpValueChange = isNewData or playerBillBoardData.GetCmpValue() != cmpValue or playerBillBoardData.GetCmpValue2() != cmpValue2 \
|
| | | or (cmpValue3 and playerBillBoardData.GetCmpValue3() != cmpValue3)
|
| | | if cmpValue3 == 0:
|
| | | if cmpValueChange:
|
| | | # 时间权值仅在比较值变更的情况下才更新, 防止其他附属值更新时导致比较值相同的玩家名次间会变动的问题
|
| | | calcTime = GameWorld.ChangeTimeStrToNum("2080-01-01 00:00:00")
|
| | | cmpValue3 = max(0, calcTime - int(time.time())) # 比较值3如果没指定值则默认存当前更新的time
|
| | | else:
|
| | | cmpValue3 = playerBillBoardData.GetCmpValue3()
|
| | |
|
| | | #设置排行榜数据
|
| | | playerBillBoardData.SetType(billboardIndex)
|
| | |
| | | if cmpValue3 > 0:
|
| | | playerBillBoardData.SetCmpValue3(cmpValue3)
|
| | |
|
| | | GameWorld.DebugLog("更新排行榜值 index=%s,type2=%s,value1=%s,value2=%s,cmpValue=%s,cmpValue2==%s,cmpValue3==%s,isNewData=%s,%s" |
| | | % (billboardIndex, type2, value1, value2, cmpValue, cmpValue2, cmpValue3, isNewData, kwargs), curPlayerID)
|
| | | GameWorld.DebugLog("更新排行榜值 index=%s,type2=%s,value1=%s,value2=%s,cmpValue=%s,cmpValue2==%s,cmpValue3==%s,isNewData=%s,cmpValueChange=%s,%s" |
| | | % (billboardIndex, type2, value1, value2, cmpValue, cmpValue2, cmpValue3, isNewData, cmpValueChange, kwargs), curPlayerID)
|
| | | if not cmpValueChange:
|
| | | return True
|
| | |
|