| | |
| | | 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()
|
| | |
| | | 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):
|
| | | ##根据时间计算多个世界等级
|