hxp
2022-08-17 b7159ca5db25404f507a27a43a970a0ca5fdf5bf
9689 【越南】世界等级修改
1个文件已修改
30 ■■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldAverageLv.py 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldAverageLv.py
@@ -73,7 +73,9 @@
    initOpenServerTime = GameWorld.ChangeTimeNumToDatetime(initOpenServerTime, ChConfig.TYPE_Time_Format)
    openServerSecond = max(0, GameWorld.GetPastSeconds(str(initOpenServerTime)) + diffSecond)
    maxCnt = IpyGameDataPY.IPY_Data().GetWorldLVCount()
    for i in xrange(max(0, beforeLv-1), maxCnt):
    GameWorld.Log("计算世界等级: diffSecond=%s,initOpenServerTime=%s,openServerSecond=%s,maxCnt=%s"
                  % (diffSecond, initOpenServerTime, openServerSecond, maxCnt))
    for i in xrange(maxCnt):
        curIpyData = IpyGameDataPY.IPY_Data().GetWorldLVByIndex(i)
        if i == maxCnt - 1:
            worldLV = curIpyData.GetWorldLV()
@@ -81,13 +83,37 @@
            nextIpyData = IpyGameDataPY.IPY_Data().GetWorldLVByIndex(i+1)
            if curIpyData.GetOpenServerSecond() <= openServerSecond < nextIpyData.GetOpenServerSecond():
                worldLV = curIpyData.GetWorldLV()
                GameWorld.Log("    i=%s,worldLV=%s" % (i, worldLV))
                break
            if openServerSecond < curIpyData.GetOpenServerSecond():
                #防止时间往回调的情况,导致世界等级异常
                worldLV = beforeLv
                GameWorld.Log("    i=%s,worldLV=%s,beforeLv=%s" % (i, worldLV, beforeLv))
                break
    
    return worldLV
    playerAvgLV = 0
    billBoard = GameWorld.GetBillboard().FindBillboard(ShareDefine.Def_BT_LV)
    needPlayerCount = IpyGameDataPY.GetFuncCfg("WorldAverageLv", 1)
    if billBoard and needPlayerCount:
        totalLV = 0
        playerCount = 0
        for index in xrange(billBoard.GetCount()):
            boardData = billBoard.At(index)
            if not boardData:
                continue
            playerCount += 1
            totalLV += boardData.GetCmpValue()
            if playerCount >= needPlayerCount:
                break
        if totalLV > 0 and playerCount > 0:
            playerAvgLV = int(totalLV / float(playerCount))
            GameWorld.Log("    playerAvgLV=%s" % playerAvgLV)
    worldAvgLV = int(eval(IpyGameDataPY.GetFuncCompileCfg("WorldAverageLv", 2)))
    if worldAvgLV < worldLV:
        worldAvgLV = worldLV
    GameWorld.Log("    worldAvgLV=%s" % worldAvgLV)
    return worldAvgLV
def GetWorldLVListByTime(startTime, day=1):
    ##根据时间计算多个世界等级