Rappelz 9.5.2 JP to AP Exchange NPC Code

03/15/2019 03:06 ozman911#1
Just finished this up and implementing on my server tonight at next restart. BTW does anyone know why changes in the StringResourceEN Table don't take effect? I added a unused code, 0 group ID, and a value, then referenced it in the code but it always shows empty string. Same for anytime I change an existing value in that table.

If the code is not "clean" its because I learning LUA on the fly. Though I would share this though incase its useful to others.

Code:
dlg_menu( "JP To AP Exchange", "Exchange_JP_to_AP()" )
Code:
-- JP to AP Exchange Begin --
-- Max AP is 2,147,483 647 --
function Exchange_JP_to_AP()
	
	local exchange_rate = 0.00000001
	
	local numrac, exchange_ap, player_ap, text, numap

	numrac = gv("jp")    -- It fetches the amount of JP that is currently collected.
	exchange_ap = math.floor(numrac * exchange_rate)     -- Calculate the maximum AP amount that can be exchanged.
	player_ap = gv("ap") -- Get player current AP amount.
	numap = tonumber(exchange_ap .. player_ap)	--	The current user AP and the exchange AP are combined.
	
	dlg_title( "GreeneTech Shop" )
	text = sconv("You Have #@rac@# JP To Exchange For #@number@# AP.", "#@rac@#",tostring( numrac ) , "#@number@#",tostring(exchange_ap))   -- Replace variable with actual value (string).	
	dlg_text_without_quest_menu( text )       -- Insert text in the dialog window
		
		-- <Common menu>
		-- All exchange.
	if numrac >= 100000000 then
		dlg_menu( "@90010083", 'PointExchange_AP_num(' .. exchange_ap .. ')' )
	end
		
	local num1, num2, num3, num4

	num1 = 10

	if numrac <3000000000 then
		num1 = 1
		num2 = 5
		num3 = 10
		num4 = 20
	
	elseif numrac < 11000000000 then
		num2 = 30
		num3 = 50
		num4 = 100
		
	elseif numrac < 31000000000 then
		num2 = 50
		num3 = 100
		num4 = 300
	
	else
		num2 = 50
		num3 = 200
		num4 = 500

	end
		
	if numrac >= num1 then
		-- #@ number @ # exchange only. num1
		text = sconv("Purchase #@number@# AP", "#@number@#", tostring( num1 ) )   -- Replace variable with actual value (string).
		dlg_menu( text, 'PointExchange_AP_num(' .. num1 ..')' )
	end
	if numrac >= num2 then
		-- #@ number @ # exchange only. num2

		text = sconv("Purchase #@number@# AP", "#@number@#", tostring( num2 ) )   -- Replace variable with actual value (string)
		dlg_menu( text, 'PointExchange_AP_num(' .. num2 ..')' )
	end
	if numrac >= num3 then
		-- #@ number @ # exchange only. num3

		text = sconv("Purchase #@number@# AP", "#@number@#", tostring( num3 ) )   -- Replace variable with actual value (string)
		dlg_menu( text, 'PointExchange_AP_num(' .. num3 ..')' )
	end
	if numrac >= num4 then
		-- #@ number @ # exchange only. num4

		text = sconv("Purchase #@number@# AP", "#@number@#", tostring( num4 ) )   -- Replace variable with actual value (string)
		dlg_menu( text, 'PointExchange_AP_num(' .. num4 .. ')' )
	end
	dlg_menu( "@99000016", "NPC_RevoTrader_Contact()" )
	-- End conversation
	dlg_menu( "@90010002", "" )

	-- Outputting the dialog
	dlg_show()

end
-- JP to AP Exchange End --

-- JP Currency Exchange Begin --
function PointExchange_AP_num( ap_amount )

	player_jp = gv("jp")
	player_ap = gv("ap")
	ap_cost = ap_amount*100000000

		if player_jp >= ap_cost then
		temp_jp = player_jp - ap_cost
		temp_ap = player_ap + ap_amount
		
		-- Update Player AP Amount
		sv("ap", temp_ap )
		-- Update Player JP Amount		
		sv("jp", temp_jp )
			
		message( sconv( "Recieved #@ap_num@# AP", "#@ap_num@#", tostring(ap_amount) ) )
	end
	
	
end
-- JP Currency Exchange End --
03/15/2019 09:00 test83#2
Hello,

Did you make your RDB file? StringResource.rdb
03/15/2019 16:55 ozman911#3
No sir, and if I had to guess I'd say that is probably the issue lol. I am very much new to all of this, so please forgive any dumb questions. :-) :D



Quote:
Originally Posted by test83 View Post
Hello,

Did you make your RDB file? StringResource.rdb
So If I modify an existing Text String Code,, Should I then be modifying it elsewhere as well? (In the .rdb file you mentioned above.)
03/15/2019 17:31 ThunderNikk#4
You need to make use of an RDB tool and write a new RDB file from the database table.

With grimoire by Ismokedrow you can rebuild the data files of the client with new updates.

With glandu2's rdb tool you would need to write the RDB hash the file name for ascii or codepage launch and place it in the resource folder of the client.
03/16/2019 09:00 ozman911#5
Trying my best not to have to ask questions but Ive hit a wall here. Im trying to update some of the .png files in the client as well as figure out the NPC Name Change, and the StringResource Names. Ive got a grasp on Grimoirev4 but it seems to not like connecting to my DB. Not really needed right now as I can use glandu2's tool to connect just fine. With Grimoirev4 when I try to update the .png in the data file it tells me the "value" is the wrong size?

Grimoirev2 seems to update the file with the correct .png as I redump it after updating, but with no way to rebuild the client it doesnt take, if I close and reopen its a wash.

Ive dug all the post and searched for hours but I am unable to find any kind of reference to this issue, but I assume its possible to replace the .png files.

Thanks for the previous info! It pointed me in the correct direction.
03/16/2019 15:42 ThunderNikk#6
Which pngs are you trying to replace?

Is it just a matter of not having the right language in the client and if so what client do you need.

As far as your error ismoke may have to assist with that as it is his program...SilentWisdom is the most recent forum name.

As far as resourcing pngs without rebuilding the client, it can be done that way as well.

Get the PNGs you want in the client.

Hash the file names (ascii) or code page if you launch like Windows-1252 or something

Place the hashed file name pngs in the resource folder of the client.
03/16/2019 16:42 ozman911#7
I am using Revolutions 9.5.2 Client from FEAR511's guide. The .png I am trying to change is the lobby_login_logo.png. I grabbed Ink's EN version of it as well but that logo is still Arabic and thought this would be a nice place to start learning the .rdb tools.

I made new MISS, FAIL, DODGE, etc, .png's as well though I believe Ink changed those in his upload.

So if I resource .png, and other items, using the hash filename method that overrides what is in the data.000?

I was waiting till I learn a little more about the tools before I message any of their Devs, These tools have been around a good min so its safe to assume that its an error on my part :-).
03/16/2019 18:09 ThunderNikk#8
What I am finding in the English client is lobby_login_game_logo(ascii).png

That name hashed for an ascii .bat file launch would be...

iWTyMw$#0gZe+def7^X@gNUYc8tf`Ymvgd

If you are talking about this one...

I am just using the US retail client.
03/16/2019 18:35 ozman911#9
I did a full dump on Revo's Client, in the png folder there is only the lobby_login_game_logo.png, (no sign of lobby_login_game_logo(ascii).png) (corrected the name of these files to inclue "game")

I am dumping Inks client at the moment to see what it contains. I believe he used the hashed file name method as it looks to be an identical dump.

I was really hoping to figure out how to insert into the data.XXX just for learning purposes. I will give the hash filename a go though and see if I can at least get some results.

I grabbed the same .png file you linked and that is what I am trying to replace the Arabic version with.

ADDED
Woohoo! The hashed file name at least produced a working result. :-)

So I guess anything in the resource folder overrides what is in the data.xxx files?

Is there a downside to putting a ton of stuff in the resource folder?
03/16/2019 20:38 ThunderNikk#10
Quote:
Originally Posted by ozman911 View Post
Is there a downside to putting a ton of stuff in the resource folder?
Eventually if it gets really large it will slow the game down.

Only the US client will have (ascii) names in the files.

If your bat does not have ascii in it you will not need ascii in the file names.

Your .bat launch argument is the driver behind what you need in the data files for game content.

That is why I like to use an English client for ascii launches it makes everything that much easier.
03/17/2019 08:58 ozman911#11
I managed to get the files inserted into the data.xxx files using grimoire v2 and im getting used to glandu2's rdb editor now. For whatever reason Grimorie v4 is a battle. Thank you for all the help! Its greatly appreciated!