| | |
| | | type2 = oldBillBoardData.GetType2()
|
| | | value1 = oldBillBoardData.GetValue1()
|
| | | value2 = oldBillBoardData.GetValue2()
|
| | | value3 = oldBillBoardData.GetValue3()
|
| | | value4 = oldBillBoardData.GetValue4()
|
| | | value5 = oldBillBoardData.GetValue5()
|
| | | value6 = oldBillBoardData.GetValue6()
|
| | | value7 = oldBillBoardData.GetValue7()
|
| | | value8 = oldBillBoardData.GetValue8()
|
| | | cmpValue = oldBillBoardData.GetCmpValue()
|
| | | cmpValue2 = oldBillBoardData.GetCmpValue2()
|
| | | cmpValue3 = oldBillBoardData.GetCmpValue3()
|
| | | userData = oldBillBoardData.GetUserData()
|
| | |
|
| | | #---获取排行榜信息---
|
| | | billBoard, billBoardData = GetBillBoardData(newBillboardIndex, id, cmpValue)
|
| | |
| | | billBoardData.SetType2(type2)
|
| | | billBoardData.SetValue1(value1)
|
| | | billBoardData.SetValue2(value2)
|
| | | billBoardData.SetValue3(value3)
|
| | | billBoardData.SetValue4(value4)
|
| | | billBoardData.SetValue5(value5)
|
| | | billBoardData.SetValue6(value6)
|
| | | billBoardData.SetValue7(value7)
|
| | | billBoardData.SetValue8(value8)
|
| | | billBoardData.SetCmpValue(cmpValue)
|
| | | billBoardData.SetCmpValue2(cmpValue2)
|
| | | billBoardData.SetCmpValue3(cmpValue3)
|
| | | billBoardData.SetUserData(userData)
|
| | | billBoardData.SetDataLen(len(userData))
|
| | |
|
| | | GameWorld.Log(" CopyBillboard newBillboardIndex=%s, oldBillboardIndex=%s" % (newBillboardIndex, oldBillboardIndex))
|
| | |
|
| | |
| | | bbInfo.Type2 = bbData.GetType2()
|
| | | bbInfo.Value1 = bbData.GetValue1()
|
| | | bbInfo.Value2 = bbData.GetValue2()
|
| | | bbInfo.Value3 = bbData.GetValue3()
|
| | | bbInfo.Value4 = bbData.GetValue4()
|
| | | bbInfo.Value5 = bbData.GetValue5()
|
| | | bbInfo.Value6 = bbData.GetValue6()
|
| | | bbInfo.Value7 = bbData.GetValue7()
|
| | | bbInfo.Value8 = bbData.GetValue8()
|
| | | bbInfo.CmpValue = bbData.GetCmpValue()
|
| | | bbInfo.CmpValue2 = bbData.GetCmpValue2()
|
| | | bbInfo.CmpValue3 = bbData.GetCmpValue3()
|
| | | bbInfo.UserData = bbData.GetUserData()
|
| | | bbInfo.DataLen = len(bbInfo.UserData)
|
| | |
|
| | | billBoardData.Billboard.append(bbInfo)
|
| | |
|
| | |
| | | bName2 = billInfoDict["Name2"]
|
| | | value1 = billInfoDict["Value1"]
|
| | | value2 = billInfoDict["Value2"]
|
| | | value3 = billInfoDict.get("Value3", 0)
|
| | | value4 = billInfoDict.get("Value4", 0)
|
| | | value5 = billInfoDict.get("Value5", 0)
|
| | | value6 = billInfoDict.get("Value6", 0)
|
| | | value7 = billInfoDict.get("Value7", 0)
|
| | | value8 = billInfoDict.get("Value8", 0)
|
| | | cmpValue = billInfoDict["CmpValue"]
|
| | | cmpValue2 = billInfoDict["CmpValue2"]
|
| | | cmpValue3 = billInfoDict["CmpValue3"]
|
| | | userData = billInfoDict.get("UserData", "")
|
| | | if bType not in ShareDefine.BillboardTypeList:
|
| | | return
|
| | | #if not cmpValue and not cmpValue2 and not cmpValue3:
|
| | | # return
|
| | | kwargs = {"value3":value3, "value4":value4, "value5":value5, "value6":value6, "value7":value7, "value8":value8, "userData":userData}
|
| | |
|
| | | #删除该数据
|
| | | if cmpValue == -1:
|
| | |
| | | gameWorld.SetDict(Def_Key_BillboardSortTick % bType, tick)
|
| | | #GameWorld.DebugLog("更新排行榜:bType=%s,autoSort=%s,tick=%s,lastSortTick=%s,d=%s" % (bType, autoSort, tick, lastSortTick, tick - lastSortTick))
|
| | |
|
| | | UpdatePlayerBillboard(bID, bName, bName2, bType, bType2, value1, value2, cmpValue, autoSort, cmpValue2, cmpValue3)
|
| | | UpdatePlayerBillboard(bID, bName, bName2, bType, bType2, value1, value2, cmpValue, autoSort, cmpValue2, cmpValue3, **kwargs)
|
| | |
|
| | | exInfo = billInfoDict["ExInfo"]
|
| | | # 以下为榜单附加特殊处理
|
| | |
| | | job = playerJob % 10
|
| | | if job in ShareDefine.JobFightPowerBillboardDict:
|
| | | jobBType = ShareDefine.JobFightPowerBillboardDict[job]
|
| | | UpdatePlayerBillboard(bID, bName, bName2, jobBType, bType2, value1, value2, cmpValue, autoSort, cmpValue2)
|
| | | UpdatePlayerBillboard(bID, bName, bName2, jobBType, bType2, value1, value2, cmpValue, autoSort, cmpValue2, **kwargs)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | # if platform in ["tencent"]:
|
| | | # return curPlayer.GetOperateInfo()
|
| | | # return platform
|
| | |
|
| | | def UpdateFamilyBillboard(bType, familyBillInfo, cmpValue, cmpValue2=0):
|
| | | ## 更新仙盟排行榜
|
| | | if "id" not in familyBillInfo:
|
| | | return
|
| | | familyID = familyBillInfo["id"]
|
| | | familyName = familyBillInfo["name"]
|
| | | id2 = familyBillInfo["id2"]
|
| | | name2 = familyBillInfo["name2"]
|
| | | value1 = familyBillInfo["value1"]
|
| | | value2 = familyBillInfo["value2"]
|
| | | value3 = familyBillInfo["value3"]
|
| | | value4 = familyBillInfo["value4"]
|
| | | value5 = familyBillInfo["value5"]
|
| | | type2 = 0
|
| | | autoSort = True
|
| | | UpdatePlayerBillboard(familyID, familyName, name2, bType, type2, value1, value2, cmpValue, autoSort, cmpValue2, |
| | | id2=id2, value3=value3, value4=value4, value5=value5)
|
| | | return
|
| | |
|
| | | def UpdatePlayerBillboardEx(curPlayer, playerID, bType, cmpValue, cmpValue2=0, cmpValue3=0, value1=0, value2=0, autoSort=False):
|
| | | ## 更新玩家排行榜
|
| | |
| | | # @param autoSort 是否自动排序
|
| | | # @return 返回值无意义
|
| | | # @remarks 更新角色排行榜.
|
| | | def UpdatePlayerBillboard(curPlayerID, curPlayerName, curPlayerOpInfo, billboardIndex, billboardType,
|
| | | value1, value2, cmpValue, autoSort = True, cmpValue2 = 0, cmpValue3 = 0):
|
| | | def UpdatePlayerBillboard(curPlayerID, name1, name2, billboardIndex, type2, value1, value2, cmpValue, |
| | | autoSort = True, cmpValue2 = 0, cmpValue3 = 0, **kwargs):
|
| | |
|
| | | playerBillBoard, playerBillBoardData = GetBillBoardData(billboardIndex, curPlayerID, cmpValue, cmpValue2, cmpValue3)
|
| | |
|
| | |
| | | return False
|
| | |
|
| | | isNewData = playerBillBoardData.GetID2() == 0 # 是否是新增的数据
|
| | | |
| | | # 值相同不更新
|
| | | if not isNewData and playerBillBoardData.GetValue1() == value1 and playerBillBoardData.GetValue2() == value2 \
|
| | | and playerBillBoardData.GetCmpValue() == cmpValue and playerBillBoardData.GetCmpValue2() == cmpValue2:
|
| | | GameWorld.DebugLog("更新排行榜值相同不更新! index=%s,type2=%s,value1=%s,value2=%s,cmpValue=%s,cmpValue2==%s,cmpValue3==%s" |
| | | % (billboardIndex, billboardType, value1, value2, cmpValue, cmpValue2, cmpValue3), curPlayerID)
|
| | | opInfo = playerBillBoardData.GetName2()
|
| | | if opInfo != str(curPlayerOpInfo):
|
| | | playerBillBoardData.SetName2(str(curPlayerOpInfo))
|
| | | GameWorld.DebugLog(" 更新operatInfo=%s" % curPlayerOpInfo, curPlayerID)
|
| | | if playerBillBoardData.GetType2() != billboardType:
|
| | | playerBillBoardData.SetType2(billboardType)
|
| | | GameWorld.DebugLog(" 更新Type2=%s" % billboardType, curPlayerID)
|
| | | return False
|
| | | |
| | | # 没设置值默认为时间time,先上榜的排前面
|
| | | if cmpValue3 == 0:
|
| | | # 时间权值仅在比较值变更的情况下才更新, 防止其他附属值更新时导致比较值相同的玩家名次间会变动的问题
|
| | | if isNewData or playerBillBoardData.GetCmpValue() != cmpValue or playerBillBoardData.GetCmpValue2() != cmpValue2:
|
| | | cmpValueChange = False
|
| | | if isNewData or playerBillBoardData.GetCmpValue() != cmpValue or playerBillBoardData.GetCmpValue2() != cmpValue2 \
|
| | | or playerBillBoardData.GetCmpValue3() != cmpValue3:
|
| | | cmpValueChange = True
|
| | | if cmpValue3 == 0:
|
| | | # 时间权值仅在比较值变更的情况下才更新, 防止其他附属值更新时导致比较值相同的玩家名次间会变动的问题
|
| | | calcTime = GameWorld.ChangeTimeStrToNum("2080-01-01 00:00:00")
|
| | | cmpValue3 = max(0, calcTime - int(time.time())) # 比较值3如果没指定值则默认存当前更新的time
|
| | |
|
| | | |
| | | #设置排行榜数据
|
| | | playerBillBoardData.SetType(billboardIndex)
|
| | | #附属类型
|
| | | playerBillBoardData.SetType2(billboardType)
|
| | | playerBillBoardData.SetType2(type2)
|
| | | playerBillBoardData.SetID(curPlayerID)
|
| | | playerBillBoardData.SetID2(curPlayerID)
|
| | | playerBillBoardData.SetName1(curPlayerName)
|
| | | playerBillBoardData.SetName2(str(curPlayerOpInfo))
|
| | | playerBillBoardData.SetID2(kwargs.get("id2", curPlayerID))
|
| | | playerBillBoardData.SetName1(name1)
|
| | | playerBillBoardData.SetName2(str(name2))
|
| | | #SetValue1存储空间为Word
|
| | | playerBillBoardData.SetValue1(value1)
|
| | | #SetValue2存储空间为DWord
|
| | | playerBillBoardData.SetValue2(value2)
|
| | | playerBillBoardData.SetValue3(kwargs.get("value3", 0))
|
| | | playerBillBoardData.SetValue4(kwargs.get("value4", 0))
|
| | | playerBillBoardData.SetValue5(kwargs.get("value5", 0))
|
| | | playerBillBoardData.SetValue6(kwargs.get("value6", 0))
|
| | | playerBillBoardData.SetValue7(kwargs.get("value7", 0))
|
| | | playerBillBoardData.SetValue8(kwargs.get("value8", 0))
|
| | | playerBillBoardData.SetUserData(kwargs.get("userData", ""))
|
| | | playerBillBoardData.SetDataLen(len(playerBillBoardData.GetUserData()))
|
| | | playerBillBoardData.SetCmpValue(cmpValue)
|
| | | playerBillBoardData.SetCmpValue2(cmpValue2)
|
| | | 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)
|
| | | if not cmpValueChange:
|
| | | return True
|
| | |
|
| | | GameWorld.DebugLog("更新排行榜值 index=%s,type2=%s,value1=%s,value2=%s,cmpValue=%s,cmpValue2==%s,cmpValue3==%s,isNewData=%s" |
| | | % (billboardIndex, billboardType, value1, value2, cmpValue, cmpValue2, cmpValue3, isNewData), curPlayerID)
|
| | | if not autoSort:
|
| | | #不自动排序
|
| | | GameWorld.GetGameWorld().SetDict(Def_Key_BillboardNeedSort % billboardIndex, 1) # 设置需要下次查看需要先排序
|