home/exedir/workdir/gamed/config/script/server_level.lua是这个文件吗
function GetServerLevelExpAdj(server_level, gmt_exp_factor)
local ret_table = {}
local fac, max
local N = 2
-- if server_level >= 0 then
max = 8.0
-- end
if server_level >= 100 then
fac = 2.0
elseif server_level >= 90 then
fac = 1.8
elseif server_level >= 80 then
fac = 1.6
elseif server_level >= 70 then
fac = 1.4
elseif server_level >= 60 then
fac = 1.2
else
fac = 1.0
end
local temp = 1.3 ^ (0.5 * 1 * N)
for i = 1, server_level -1 do
local diff = server_level - i
if diff < 0 then diff = 0 end
local delta = (70 - i)/3
if delta < 0 then
delta = 0
elseif delta > 2.2 then
delta = 2.2
end
-- 20级以前,没有服务器加速
if i <= 20 then
ret_table = 0.0
-- 距离服务器等级N级(含)以内,经验倍率保持不变
elseif diff <= N then
ret_table = 1.3 ^ (0.5 * 1 * diff) - 1
-- 不在服务器等级N级(含)以内,经验倍率增加(速度受fac影响)
else
ret_table = ( temp + delta )* (1.3 ^ (0.5 * fac * (diff - N))) - 1
end
-- 卡住上限下限
if ret_table > max * gmt_exp_factor then
ret_table = max * gmt_exp_factor
elseif ret_table < 0 then
ret_table = 0
end
end
return ret_table
end
--ret = GetServerLevelExpAdj(10, 1)
--if type(ret) == "table" then
-- for k,v in pairs(ret) do
-- print("k=",k,",v=",v)
-- end
--else
-- print(type(ret))
--end自己改了很多次,都失败了。希望知道的大佬赐教。
|