Jump to content
Sign in to follow this  
V3ct0r

Server rates

Recommended Posts

Server rates

In this guide I will tell you how to change server rates.

To change rates open file variable.lua (Server\resource\script\calculate\) and find variables:

EXP_RAID             = 1 -- Experience rate
MF_RAID              = 1 -- Drop rate
RESOURCE_RAID_ADJUST = 1 -- Resource drop rate
TEAMEXP_RAID         = 1 -- Party experience rate
ELEEXP_GETRAD        = 1 -- Fairy growth rate

In that case all rates are equal to x 1

 

How to add rate for Ships:

1) Add in variable.lua (see above) new variable SHIP_RAID. It will store rate for ship experience:

SHIP_RAID = 1 -- Ship experience rate

Ship rate is equal to x 1 in that case

2) Open file exp_and_level.lua (Server\resource\script\calculate\) and find function GetExp_PKM(dead, atk)

Look below for

local ship_expadd = math.floor( math.min(7, (dead_lv / 10 + 2) ) )

and replace it with

local ship_expadd = math.floor( math.min(7, (dead_lv / 10 + 2) ) * SHIP_RAID)

Then save changes. Now you can specify rate for ship experience.

 

How to make auto rates:

You could make rates update automatically depending on your conditions. For example depending on a day time or week day. Let's make so that rates would increase by x 2 every weekends.

1) Experience and ship experience (EXP_RAID and SHIP_RAID).

Open file exp_and_level.lua (Server\resource\script\calculate\) and find function GetExp_PKM(dead, atk)

At the beginning of the function add the following code:

function GetExp_PKM(dead, atk)

	local day_of_week = GetNowWeek()
	if day_of_week == 6 or day_of_week == 0 then
		-- At weekends rates are equal to x 2
		EXP_RAID  = 2
		SHIP_RAID = 2
	else 
		-- At weekdays rates are equal to x 1
		EXP_RAID  = 1
		SHIP_RAID = 1
	end
	
	-- original code .....

end

2) Team experience (TEAMEXP_RAID).

In the file exp_and_level.lua (see above) find function ShareTeamExp(dead, team_atker, dead_exp, The_Killer).

At the beginning of the function add the following code:

function ShareTeamExp(dead, team_atker, dead_exp, The_Killer) 

	local day_of_week = GetNowWeek()
	if day_of_week == 6 or day_of_week == 0 then
		-- At weekends rates are equal to x 2
		TEAMEXP_RAID  = 2
	else 
		-- At weekdays rates are equal to x 1
		TEAMEXP_RAID  = 1
	end
	
	-- original code .....

end

3) Drop rate (MF_RAID).

Open file skilleffect.lua (Server\resource\script\calculate\) and find function Check_Baoliao(ATKER, DEFER, ... ).

At the beginning of the function add the following code:

function Check_Baoliao(ATKER, DEFER, ... ) 

	local day_of_week = GetNowWeek()
	if day_of_week == 6 or day_of_week == 0 then
		-- At weekends rates are equal to x 2
		MF_RAID  = 2
	else 
		-- At weekdays rates are equal to x 1
		MF_RAID  = 1
	end
	
	-- original code .....

end

4) Resource drop rate (RESOURCE_RAID_ADJUST).

In the file skilleffect.lua find function Check_SpawnResource(ATKER, DEFER, lv_skill, diaoliao_count, ...).

At the beginning of the function add the following code:

function Check_SpawnResource(ATKER, DEFER, lv_skill, diaoliao_count, ...)

	local day_of_week = GetNowWeek()
	if day_of_week == 6 or day_of_week == 0 then
		-- At weekends rates are equal to x 2
		RESOURCE_RAID_ADJUST  = 2
	else 
		-- At weekdays rates are equal to x 1
		RESOURCE_RAID_ADJUST  = 1
	end
	
	-- original code .....

end

5) Fairy growth rate (ELEEXP_GETRAD).

Open file functions.lua (Server\resource\script\calculate\) and find function Give_ElfEXP(role, Item, Type, Num).

At the beginning of the function add the following code:

function Give_ElfEXP(role, Item, Type, Num)

	local day_of_week = GetNowWeek()
	if day_of_week == 6 or day_of_week == 0 then
		-- At weekends rates are equal to x 2
		ELEEXP_GETRAD  = 2
	else 
		-- At weekdays rates are equal to x 1
		ELEEXP_GETRAD  = 1
	end
	
	-- original code .....

end

 

That's all! If you have any questions you can ask them here.

  • Like 6
  • Thanks 3

Share this post


Link to post
Share on other sites
SHIP_EXP        = 1 -- Ship experience rate

open file exp_and_level.lua (Server\resource\script\calculate\) and find

if ChaIsBoat (k[item_host] ) == 1 then 

look for

local ship_expadd = math.floor ( math.min ( 7 , ( dead_lv / 10 + 2 ) ) ) 

and replace it

local ship_expadd = math.floor ( math.min ( 7 , ( dead_lv / 10 + 2 ) ) * SHIP_EXP) 

 

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Continuation... Perhaps you want to define EXP by map. Such map like Forsaken City, Dark swamp, and Demonic World should not grant EXP.

MapEXP = {} -- DEFINE EXP BY MAPNAME
    MapEXP["garner"] = 3
    MapEXP["darkswamp"]  = 0
    MapEXP["abandonedcity"] = 0
    MapEXP["abandonedcity2"] = 0
    MapEXP["abandonedcity3"] = 0
    MapEXP["puzzleworld"] = 0
    MapEXP["puzzleworld2"] = 0
    MapEXP["garner2"] = 0

ShareTeamExp:

			local chamap = GetChaMapName(t[i])
			if MapEXP[chamap] ~= nil then
				EXP_RAID_STATE = EXP_RAID_STATE * MapEXP[chamap]
			end

Forge Rates:

ForgeRate = {}
	ForgeRate[1] = 1
	ForgeRate[2] = 1
	ForgeRate[3] = 1
	ForgeRate[4] = 1
	ForgeRate[5] = 0.7
	ForgeRate[6] = 0.5
	ForgeRate[7] = 0.3
	ForgeRate[8] = 0.2
	ForgeRate[9] = 0.1

begin_forge_item(...):

	for i,v in pairs(ForgeRate) do
		if Baoshi_NeedLv == i then
			Check_A = v
			CheckFaild = Percentage_Random(Check_A)
		end
	end

that is what was in old files, in O-Notation(O(n) at most) it is not too optimized, therefore a better approach:

CheckFaild = Percantage_Random(ForgeRage[Baoshi_NeedLv])

O(1)... (not tested)

Socket Rate:

SocketRate = {}
	SocketRate[0] = 1
	SocketRate[1] = 1
	SocketRate[2] = 1
	SocketRate[3] = 0.5

Check_CG_damo:

function Check_CG_damo( Item_damo , Sklv )
	local a = 0
	local Hole_Num = Check_HasHole ( Item_damo )
	if SocketRate[Hole_Num] ~= nil then
		a = SocketRate[Hole_Num]
	end
	local b = Percentage_Random(a)
	return b
end

 

Edited by xtc
  • Like 2

kong.png

a2.png

Share this post


Link to post
Share on other sites

Thank you, @xtc! I will append your addition to the guide


Share this post


Link to post
Share on other sites

No have Forge Rates in my forge.lua.

Serverfiles

Forging, It would be that?

Quote

local Check_A
        local CheckFaild
        
        if Baoshi_NeedLv < 4 then               
                Check_A = 1
                CheckFaild = Percentage_Random ( Check_A )

        elseif Baoshi_NeedLv == 4 then
                Check_A = 0.9
                CheckFaild = Percentage_Random ( Check_A )
                
        elseif Baoshi_NeedLv == 5 then
                Check_A = 0.7
                CheckFaild = Percentage_Random ( Check_A )
                                
        elseif Baoshi_NeedLv == 6 then
                Check_A = 0.6
                CheckFaild = Percentage_Random ( Check_A )              
                
        elseif Baoshi_NeedLv == 7 then
                Check_A = 0.5
                CheckFaild = Percentage_Random ( Check_A )      
                
        elseif Baoshi_NeedLv == 8 then
                Check_A = 0.4
                CheckFaild = Percentage_Random ( Check_A )
                
        elseif Baoshi_NeedLv == 9 then
                Check_A = 0.3
                CheckFaild = Percentage_Random ( Check_A )
        end

 

Edited by offzinho

Share this post


Link to post
Share on other sites
25 minutes ago, offzinho said:

No have Forge Rates in my forge.lua.

Serverfiles

Forging, It would be that?

 

OFF: Vi que você é BR então é só você editar o Check_A. 1 = 100% 0.9 = 90% etc. :D

Share this post


Link to post
Share on other sites
1 hour ago, Yomazu said:

OFF: Vi que você é BR então é só você editar o Check_A. 1 = 100% 0.9 = 90% etc. :D

Então e ali mesmo, muito obrigado. estava na duvida por estar diferente do que postado a cima.
Eu lembro um pouco de como funciona os códigos, mexi com servidores a uns 5 anos atras, ai resolvi montar um para jogar com os amigos.


Porem ta complicado ajeitei quase tudo porem o jogo fica dando crash duma hora pra outra, estou achando que e do cliente 1.36 que baixei.
--
Then and there, thank you very much. I was in doubt because it was different from the code above.
I do not remember the right codes, I had a server 5 years ago, 
now I decided to set one up to play with friends. :)

Share this post


Link to post
Share on other sites
On 21/3/2016 at 2:37 AM, KONG said:

Continuation... Perhaps you want to define EXP by map. Such map like Forsaken City, Dark swamp, and Demonic World should not grant EXP.


MapEXP = {} -- DEFINE EXP BY MAPNAME
    MapEXP["garner"] = 3
    MapEXP["darkswamp"]  = 0
    MapEXP["abandonedcity"] = 0
    MapEXP["abandonedcity2"] = 0
    MapEXP["abandonedcity3"] = 0
    MapEXP["puzzleworld"] = 0
    MapEXP["puzzleworld2"] = 0
    MapEXP["garner2"] = 0

ShareTeamExp:


			local chamap = GetChaMapName(t[i])
			if MapEXP[chamap] ~= nil then
				EXP_RAID_STATE = EXP_RAID_STATE * MapEXP[chamap]
			end

 

@KONG hey where i put this code bro


FORO EN ESPAÑOL :)

 

----------------------------------------------------------------------------

M9CMV7K.png

 

 

Share this post


Link to post
Share on other sites
7 hours ago, nectrouler said:

 

@KONG hey where i put this code bro

First one u can put into variable.lua at the end and the second one inside exp_and_level.lua
find: exp_up = exp_up * EXP_RAID_STATE and paste it below

  • Like 1

Share this post


Link to post
Share on other sites

@DangThao Ive changed it but still get like 0.18% each mob
 

Ive put this on end of variable.lua:

MapEXP = {} -- DEFINE EXP BY MAPNAME
    MapEXP["garner"] = 5
    MapEXP["darkswamp"]  = 0
    MapEXP["abandonedcity"] = 0
    MapEXP["abandonedcity2"] = 0
    MapEXP["abandonedcity3"] = 0
    MapEXP["puzzleworld"] = 0
    MapEXP["puzzleworld2"] = 0
    MapEXP["garner2"] = 0

 

And ive put this:


            exp_up = exp_up * EXP_RAID_STATE
            
                local chamap = GetChaMapName(t)
                if MapEXP[chamap] ~= nil then
                    EXP_RAID_STATE = EXP_RAID_STATE * MapEXP[chamap]
                end
            
            if Lv ( TurnToCha(t) ) >= 80 then 
                exp_up = math.floor ( exp_up / 50 ) 
            end 


Hope u can see a fault, because i dont get it.. :3

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...