hxp
2025-10-27 6641154f22dbfafdd14f047f7a2491a9bbeae723
16 卡牌服务端(优化榜单,增加更新时间字段;)
4个文件已修改
52 ■■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/StructData/DBBillboard.py 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/Collections/DataServerPlayerData.py 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py
@@ -1768,6 +1768,7 @@
        ('CmpValue', ctypes.c_ulong),
        ('CmpValue2', ctypes.c_ulong),
        ('CmpValue3', ctypes.c_ulong),
        ('Time', ctypes.c_ulong),
        ('DataLen', ctypes.c_ushort),
        ('UserData', ctypes.c_char_p),
        ('ADOResult', ctypes.c_ulong),
@@ -1797,6 +1798,7 @@
        self.CmpValue = 0
        self.CmpValue2 = 0
        self.CmpValue3 = 0
        self.Time = 0
        self.DataLen = 0
        self.UserData = ''
@@ -1825,6 +1827,7 @@
        self.CmpValue, pos = CommFunc.ReadDWORD(buf, pos)
        self.CmpValue2, pos = CommFunc.ReadDWORD(buf, pos)
        self.CmpValue3, pos = CommFunc.ReadDWORD(buf, pos)
        self.Time, pos = CommFunc.ReadDWORD(buf, pos)
        self.DataLen, pos = CommFunc.ReadWORD(buf, pos)
        tmp, pos = CommFunc.ReadString(buf, pos, self.DataLen)
        self.UserData = ctypes.c_char_p(tmp)
@@ -1851,6 +1854,7 @@
        buf = CommFunc.WriteDWORD(buf, self.CmpValue)
        buf = CommFunc.WriteDWORD(buf, self.CmpValue2)
        buf = CommFunc.WriteDWORD(buf, self.CmpValue3)
        buf = CommFunc.WriteDWORD(buf, self.Time)
        buf = CommFunc.WriteWORD(buf, self.DataLen)
        buf = CommFunc.WriteString(buf, self.DataLen, self.UserData)
        return buf
@@ -1865,6 +1869,7 @@
        length += sizeof(ctypes.c_char) * 33
        length += sizeof(ctypes.c_char) * 65
        length += sizeof(ctypes.c_ubyte)
        length += sizeof(ctypes.c_ulong)
        length += sizeof(ctypes.c_ulong)
        length += sizeof(ctypes.c_ulong)
        length += sizeof(ctypes.c_ulong)
@@ -1901,6 +1906,7 @@
            CmpValue = %s,
            CmpValue2 = %s,
            CmpValue3 = %s,
            Time = %s,
            DataLen = %s,
            UserData = %s,
            ADOResult = %s,
@@ -1924,6 +1930,7 @@
                self.CmpValue,
                self.CmpValue2,
                self.CmpValue3,
                self.Time,
                self.DataLen,
                self.UserData,
                self.ADOResult,
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/StructData/DBBillboard.py
@@ -70,6 +70,8 @@
    def SetCmpValue2(self, cmpValue2): self.__dbData.CmpValue2 = cmpValue2
    def GetCmpValue3(self): return self.__dbData.CmpValue3
    def SetCmpValue3(self, cmpValue3): self.__dbData.CmpValue3 = cmpValue3
    def GetTime(self): return self.__dbData.Time
    def SetTime(self, updTime): self.__dbData.Time = updTime
    def GetUserData(self): return self.__dbData.UserData
    def SetUserData(self, userData):
        if not isinstance(userData, str):
@@ -105,6 +107,7 @@
        copyData.SetCmpValue(self.GetCmpValue())
        copyData.SetCmpValue2(self.GetCmpValue2())
        copyData.SetCmpValue3(self.GetCmpValue3())
        copyData.SetTime(self.GetTime())
        return copyData
    
class Billboard():
@@ -140,7 +143,7 @@
    def SortData(self):
        GameWorld.DebugLog("榜单排序: billboardType=%s,groupValue1=%s,groupValue2=%s,dataCount=%s" 
                      % (self.__billboardType, self.__groupValue1, self.__groupValue2, len(self.__billboardList)))
        self.__billboardList.sort(key=lambda b: (b.GetCmpValue(), b.GetCmpValue2(), b.GetCmpValue3()), reverse=True)
        self.__billboardList.sort(key=lambda b: (b.GetCmpValue(), b.GetCmpValue2(), b.GetCmpValue3(), -b.GetTime()), reverse=True)
        self.__idOrderDict = {} # 排序后重置,下次查询时更新并缓存
        self.__idIndexDict = {}
        self.__sortDelay = False
@@ -239,7 +242,7 @@
                        "Value5":bData.GetValue5(), "Value6":bData.GetValue6(),
                        "Value7":bData.GetValue7(), "Value8":bData.GetValue8(),
                        "CmpValue":bData.GetCmpValue(), "CmpValue2":bData.GetCmpValue2(), 
                        "CmpValue3":bData.GetCmpValue3(), "UserData":bData.GetUserData()}
                        "CmpValue3":bData.GetCmpValue3(), "Time":bData.GetTime(), "UserData":bData.GetUserData()}
            DataRecordPack.SendEventPack(eventTypeStr, dataDict)
            
        return
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py
@@ -220,19 +220,12 @@
    cmpValueChange = isNewData or billboardData.GetCmpValue() != cmpValue or billboardData.GetCmpValue2() != cmpValue2 \
        or (cmpValue3 and billboardData.GetCmpValue3() != cmpValue3)
        
    # 没设置值默认为时间time,先上榜的排前面
    if cmpValue3 == 0:
        # 时间权值仅在比较值变更的情况下才更新, 防止其他附属值更新时导致比较值相同的玩家名次间会变动的问题
        if cmpValueChange:
            calcTime = GameWorld.ChangeTimeStrToNum("2090-01-01 00:00:00")
            cmpValue3 = max(0, calcTime - int(time.time())) # 比较值3如果没指定值则默认存当前更新的time
        else:
            cmpValue3 = billboardData.GetCmpValue3()
    billboardData.SetCmpValue(cmpValue)
    billboardData.SetCmpValue2(cmpValue2)
    billboardData.SetCmpValue3(cmpValue3)
    if cmpValueChange or not billboardData.GetTime():
        billboardData.SetTime(int(time.time()))
    GameWorld.DebugLog("更新排行榜值: billboardType=%s,groupValue1=%s,groupValue2=%s,dataID=%s,cmpValueChange=%s,cmpValue=%s,cmpValue2=%s,cmpValue3=%s" 
                       % (billboardType, groupValue1, groupValue2, dataID, cmpValueChange,
                          cmpValue, cmpValue2, cmpValue3), dataID)
@@ -294,15 +287,6 @@
    cmpValueChange = isNewData or billboardData.GetCmpValue() != cmpValue or billboardData.GetCmpValue2() != cmpValue2 \
        or (cmpValue3 and billboardData.GetCmpValue3() != cmpValue3)
        
    # 没设置值默认为时间time,先上榜的排前面
    if cmpValue3 == 0:
        # 时间权值仅在比较值变更的情况下才更新, 防止其他附属值更新时导致比较值相同的玩家名次间会变动的问题
        if cmpValueChange:
            calcTime = GameWorld.ChangeTimeStrToNum("2090-01-01 00:00:00")
            cmpValue3 = max(0, calcTime - int(time.time())) # 比较值3如果没指定值则默认存当前更新的time
        else:
            cmpValue3 = billboardData.GetCmpValue3()
    # 更新所有值
    billboardData.SetType(billboardType)
    billboardData.SetGroupValue1(groupValue1)
@@ -324,7 +308,9 @@
    billboardData.SetCmpValue(cmpValue)
    billboardData.SetCmpValue2(cmpValue2)
    billboardData.SetCmpValue3(cmpValue3)
    if cmpValueChange or not billboardData.GetTime():
        billboardData.SetTime(int(time.time()))
    GameWorld.DebugLog("更新排行榜值: billboardType=%s,groupValue1=%s,groupValue2=%s,dataID=%s,isNewData=%s,cmpValueChange=%s,type2=%s,value1=%s,value2=%s,cmpValue=%s,cmpValue2=%s,cmpValue3=%s,%s" 
                       % (billboardType, groupValue1, groupValue2, dataID, isNewData, cmpValueChange,
                          type2, value1, value2, cmpValue, cmpValue2, cmpValue3, kwargs), dataID)
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/Collections/DataServerPlayerData.py
@@ -26275,6 +26275,7 @@
        ('CmpValue', ctypes.c_ulong),
        ('CmpValue2', ctypes.c_ulong),
        ('CmpValue3', ctypes.c_ulong),
        ('Time', ctypes.c_ulong),
        ('DataLen', ctypes.c_ushort),
        ('UserData', ctypes.c_char_p),
        ('ADOResult', ctypes.c_ulong),
@@ -26304,6 +26305,7 @@
        self.CmpValue = 0
        self.CmpValue2 = 0
        self.CmpValue3 = 0
        self.Time = 0
        self.DataLen = 0
        self.UserData = ''
@@ -26335,6 +26337,7 @@
        self.CmpValue, pos = CommFunc.ReadDWORD(buf, pos)
        self.CmpValue2, pos = CommFunc.ReadDWORD(buf, pos)
        self.CmpValue3, pos = CommFunc.ReadDWORD(buf, pos)
        self.Time, pos = CommFunc.ReadDWORD(buf, pos)
        self.DataLen, pos = CommFunc.ReadWORD(buf, pos)
        tmp, pos = CommFunc.ReadString(buf, pos, self.DataLen)
        self.UserData = ctypes.c_char_p(tmp)
@@ -26361,6 +26364,7 @@
        buf = CommFunc.WriteDWORD(buf, self.CmpValue)
        buf = CommFunc.WriteDWORD(buf, self.CmpValue2)
        buf = CommFunc.WriteDWORD(buf, self.CmpValue3)
        buf = CommFunc.WriteDWORD(buf, self.Time)
        buf = CommFunc.WriteWORD(buf, self.DataLen)
        buf = CommFunc.WriteString(buf, self.DataLen, self.UserData)
        return buf
@@ -26375,6 +26379,7 @@
        length += sizeof(ctypes.c_char) * 33
        length += sizeof(ctypes.c_char) * 65
        length += sizeof(ctypes.c_ubyte)
        length += sizeof(ctypes.c_ulong)
        length += sizeof(ctypes.c_ulong)
        length += sizeof(ctypes.c_ulong)
        length += sizeof(ctypes.c_ulong)
@@ -26412,6 +26417,7 @@
        rec[u'CmpValue'] = self.CmpValue
        rec[u'CmpValue2'] = self.CmpValue2
        rec[u'CmpValue3'] = self.CmpValue3
        rec[u'Time'] = self.Time
        rec[u'DataLen'] = self.DataLen
        rec[u'UserData'] = fix_incomingText(self.UserData)
        return rec
@@ -26437,6 +26443,7 @@
        self.CmpValue = rec.get(u'CmpValue', 0)
        self.CmpValue2 = rec.get(u'CmpValue2', 0)
        self.CmpValue3 = rec.get(u'CmpValue3', 0)
        self.Time = rec.get(u'Time', 0)
        self.DataLen = rec.get(u'DataLen', 0)
        self.UserData = fix_outgoingText(rec.get(u'UserData', u''))
@@ -26493,6 +26500,7 @@
            CmpValue = %s,
            CmpValue2 = %s,
            CmpValue3 = %s,
            Time = %s,
            DataLen = %s,
            UserData = %s,
            ADOResult = %s,
@@ -26516,6 +26524,7 @@
                self.CmpValue,
                self.CmpValue2,
                self.CmpValue3,
                self.Time,
                self.DataLen,
                self.UserData,
                self.ADOResult,
@@ -26523,7 +26532,7 @@
        return output
    def dumpString(self):
        output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
        output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
                self.GroupValue1,
                self.GroupValue2,
                self.BillboardType,
@@ -26543,6 +26552,7 @@
                self.CmpValue,
                self.CmpValue2,
                self.CmpValue3,
                self.Time,
                self.DataLen,
                self.UserData,
            )