Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

how to add item to .dat file?

Initiate Mage
Joined
Jun 11, 2013
Messages
4
Reaction score
0
Hi,
I try to implement a trade system.
I was able to read data from .dat(the inventory), delete one item but i want to insert that item to another dat file.
There is any sample code for that?

Thanks,
Emi.
 
Custom Title Activated
Member
Joined
May 26, 2007
Messages
5,545
Reaction score
1,314
Short answer? No.

Any code that can do that has to deal with some complex encoding and checksums, so it won't be simple. But I know some people have done similar things if you feel up to it, they may offer some principals to get you started.
 
Initiate Mage
Joined
Jun 11, 2013
Messages
4
Reaction score
0
Thanks for your answer. I feel up to it:) I want to write it in c#, but any other language is ok, i can redo it. i guess there is some logic behind the checksum and also probably X, Y should change, but i assume there would be other changes, too.

I think it is something in the first part of the file that needs to be changed as the difference between a non working file and working file are all before the offset for actual items.
So my guess is that i need to figure out what other bytes needs to be changed.
Do you know what is at offset: 0000, 0x110, 0x180, 0x1F8 and 0x240?

Thanks,
Emilian.
 
Experienced Elementalist
Joined
Nov 8, 2004
Messages
279
Reaction score
36
the CU(MasterID).exe or CU.exe files from original leaks were used to do that work, also warehouse handling, or searching duplicated items on all files. Anyway im guess nowdays is a little obsolete and new checksums were added into that .dat file structure, but it would be a good place to begin the search if u want an 'easy reverse ing' bcos look on client is a bit of pain :p, also the vb pt emu had some code to work with items and have some of the checksums you may need.

btw... blame shenbr for 'wake me up' from the old graveyard :p
 
Initiate Mage
Joined
Jun 11, 2013
Messages
4
Reaction score
0
For start will be nice to have a list of bytes from .dat and what represents each. for the items part i have that, but for the first part of the file no.
 
Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
723
You can use Gregoos inventory search, coded in PHP. You should know first that each item in the character.dat is compressed, It starts in offset 0x1F8 or anything near it. PT character also contains a TotalItens offset so you can know how many itens you have. Each item block have this structure:

int size;
byte[size] content;

Knowing the size of each item and the total itens you can iterate through every item, decompress it and then get the info you need.

as for adding new item in the character dat directly, IDk if it is possible, but what I do know is that you will have to handle with some item checksums, which Im not familiar with.

Here is the thread:
http://forum.ragezone.com/f399/pt2sqlite-802469/
 
Last edited:
Initiate Mage
Joined
Jun 11, 2013
Messages
4
Reaction score
0
Thanks.
Yes, i'm already using the Gregoos inventory search, that part works fine.
As i said earlier, i checked the dat file and it changed some bytes before 0x1f8.
Hmm, you know what is 0x1F8 and 0x240? :)
Thanks.
 
Back
Top