|
|
|
Page 1 of 2 |
[ 20 posts ] |
1, 2 Next
|
 Decoding the EQ2 INI file : EverQuest 2 Premium Discussions
|
|
Posted: December 10th, 2004, 2:41 pm
|
|
|
|
richyrich
richyrich's Reps:
|
If anyone has any free cycles, to speed up getting MegaBot converted to EQ2, try to break down the character INI files for EQ2 as I'll need it to pull the X,Y coords from the windows, since all is customizable.
In DAOC, it was easy... was a text file, but in EQ2 it's a binary file, so a little reverse engineering is needed. I've started, but with all the code I have to convert, might take me awhile to get to it.
If you are wondering what MegaBot is, go to the DAOC downloads section and download the latest version and see what we have done in DAOC - same plus more (crafting) coming to EQ2!
Any help from anyone is much appreciated!
Chat logger and API functions for targets is the next big thing to wait for.
Rich
|
|
|
|
|
Posted: December 12th, 2004, 10:16 am
|
|
|
|
dwear2
dwear2's Reps:
|
rich once u get the ini files setup send me over a copy i will do all the classes again... got eq2 last week.. it great
|
|
|
|
|
Posted: December 12th, 2004, 11:32 am
|
|
|
|
richyrich
richyrich's Reps:
|
Still a long way to go until the MEgaBot is useful. Need a chat logger and the basic X, Y coords from the API before it can really work (and Monster/harvesting X,Y). The INI I'm talkin about in the post above is decoding the encoded INI that EQ2 is using to save window placements.
Since Wyv is working on the crafting stuff first, I might try to focus my MegaBot on going out and auto harvesting... but would need the back-end API opened up first, so as soon as Wyv can do that, I'll be moving along!
Rich
|
|
|
|
|
Posted: December 13th, 2004, 9:59 am
|
|
|
|
richyrich
richyrich's Reps:
|
Ok, I have figured out a little bit of the encoded INI file and need some help to write some routines.
VBScript doesn't seem to handle binary files very well... I am trying to use the ADODB class and some sample code I found on the net and it kinda works...
I can get a file to read in in binary mode, but can't seem to do anything with the data once I have it in a variable. Using Typename() I can see it is BYTE type data, but nothing else.
Someone who knows VBScript better than me should be able to quickly figure this one out!
Here is the end result of what I need.
Open the binary file (which will be the EQ2 ini file), skip to a specific part of the file, read in a few bytes, then I'll convert them to Decimal based on what I've decoded them to mean (using HexDump and a slow process)
Below is some sample code to show what I have. For anyone who needs some good debugging code, my debugging Class from MegaBot is included here for reuse - good way to debug and have a log file for your scripts!
Rich
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))): Option Explicit Class DebugClass
Private objLogFileFSO, objLogFile, DebugLevel, i
Private Sub Class_Initialize() Dim sDir, cont Dim sLogFile, sLogFileVersion
sLogFileVersion = 1
DebugLevel = 0 ' Default cont = true
sDir = "c:\dl\logtest"
Set objLogFileFSO = CreateObject("Scripting.FileSystemObject")
do while cont sLogFile = sDir & cStr(sLogFileVersion) & ".log" If objLogFileFSO.FileExists(sLogFile) Then sLogFileVersion = sLogFileVersion + 1 else cont = false end if loop Set objLogFile = objLogFileFSO.OpenTextFile(sLogFile, 8, True)
call Print ("", 0) call Print ("", 0) call Print ("*************************************", 0) call Print ("*************************************", 0) call Print ("*************************************", 0) call Print("LOG File Opened: " & sLogFile, 0) End Sub
Private Sub Class_Terminate() ' Close Log File objLogFile.Close End Sub
Public Sub SetDebugLevel(lvl) DebugLevel = CInt(lvl) End Sub Public Sub PrintDebugLevel() call Print("Debug Level is set to: " & DebugLevel, 0) End Sub
Public Sub Print(str1, lvl) if (DebugLevel >= lvl) then 'objLogFile.WriteLine(Date & " " & Time & ": " & str1) objLogFile.WriteLine(CStr(str1)) end if End Sub
End Class
Function SaveBinaryData(FileName, ByteArray) Const adTypeBinary = 1 Const adSaveCreateOverWrite = 2 'Create Stream object Dim BinaryStream Set BinaryStream = CreateObject("ADODB.Stream") 'Specify stream type - we want To save binary data. BinaryStream.Type = adTypeBinary 'Open the stream And write binary data To the object BinaryStream.Open BinaryStream.Write 1 'BinaryStream.Write ByteArray 'Save binary data To disk BinaryStream.SaveToFile FileName, adSaveCreateOverWrite End Function
Function ReadBinaryFile(FileName) Const adTypeBinary = 1 'Create Stream object Dim BinaryStream Set BinaryStream = CreateObject("ADODB.Stream") 'Specify stream type - we want To get binary data. BinaryStream.Type = adTypeBinary 'Open the stream BinaryStream.Open 'Load the file data from disk To stream object BinaryStream.LoadFromFile FileName 'Open the stream And get binary data from the object ReadBinaryFile = BinaryStream.Read End Function
Function ReadTextFile(FileName, CharSet) Const adTypeText = 2 'Create Stream object Dim BinaryStream Set BinaryStream = CreateObject("ADODB.Stream") 'Specify stream type - we want To get binary data. BinaryStream.Type = adTypeText 'Specify charset For the source text (unicode) data. If Len(CharSet) > 0 Then BinaryStream.CharSet = CharSet End If 'Open the stream BinaryStream.Open 'Load the file data from disk To stream object BinaryStream.LoadFromFile FileName 'Open the stream And get binary data from the object ReadTextFile = BinaryStream.ReadText End Function
Function SaveTextData(FileName, Text, CharSet) Const adTypeText = 2 Const adSaveCreateOverWrite = 2 'Create Stream object Dim BinaryStream Set BinaryStream = CreateObject("ADODB.Stream") 'Specify stream type - we want To save text/string data. BinaryStream.Type = adTypeText 'Specify charset For the source text (unicode) data. If Len(CharSet) > 0 Then BinaryStream.CharSet = CharSet End If 'Open the stream And write binary data To the object BinaryStream.Open BinaryStream.WriteText Text 'Save binary data To disk BinaryStream.SaveToFile FileName, adSaveCreateOverWrite End Function
Dim objDebug, bin, txt, txt2
Set objDebug = New DebugClass objDebug.Print "1", 0 'Call SaveBinaryData("c:\dl\savebin.txt", "12345") bin = ReadBinaryFile("c:\dl\logtest1.log") txt = ReadTextFile("c:\dl\logtest1.log", "") objDebug.Print "2", 0 objDebug.Print TypeName(bin), 0 objDebug.Print TypeName(txt), 0 SaveTextData "c:\dl\output1.txt", txt, "" 'txt2=CStr(txt) 'objDebug.Print txt2, 0 'objDebug.Print CStr(bin(1)), 0 objDebug.Print "3", 0 Set objDebug = NOTHING
|
|
|
|
|
Posted: December 13th, 2004, 10:07 am
|
|
|
|
Admin
Total Posts: 1168
Location: Waco
Joined: May 1st, 2004, 4:00 am
Admin's Reps: 4
|
Doesnt the Scripting.FileSystemObject read in binary files? along with text files?
Did you read up on the syntax for using it?
I dont really tink you want to use a database parser to read files.
_________________
Help our site.. take a moment to click the Digg this post!!! v v v
|
|
|
|
|
Posted: December 13th, 2004, 3:57 pm
|
|
|
|
richyrich
richyrich's Reps:
|
Everywhere I look it always references ADODB as the way to handle binary files... Got me, I don't actually like VBScript... and while I can create a lot of stuff in it, when it comes to things I haven't played with in VBScript, I kinda hack until it works. If someone can jump start me, - please do!
Thx,
Rich
|
|
|
|
|
Posted: December 14th, 2004, 12:55 am
|
|
|
|
wyvernx
Total Posts: 6718
Joined: May 1st, 2004, 4:00 am
wyvernx's Reps: 21
|
_________________
Use Search first, ask questions later!
|
|
|
|
|
Posted: December 14th, 2004, 12:58 am
|
|
|
|
darkfire5252
darkfire5252's Reps:
|
I'm could be wrong about this, but to get the binary value, can you not just use FileSystemObject.OpenTextFile and then use Asc() to get the numerical value? This would be a good example:
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))): Function ReadINI(FileName, Position, NumBytes) Dim fso, ts, buffer, rBuf, byteArr() ReDim byteArr(NumBytes) Const ForReading = 1 Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(FileName,ForReading) ts.Skip(Position-1) buffer = ts.Read(NumBytes) ' ReadINI = StringToBin(buffer) ReadINI = buffer End Function
Dim data data = ReadINI("testlog", 1, 5) For i = 1 to Len(data) WScript.Echo Mid(data,i,1) & " = " & Asc(Mid(data,i,1)) Next
|
|
|
|
|
Posted: December 14th, 2004, 6:01 am
|
|
|
|
richyrich
richyrich's Reps:
|
wyvernx";p="50556 (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', 'WROTE'))):
Yeah, that is where I pulled the sample code I posted from... the problem is, it reads the file just fine with the ADODB but I can't seem to do anything with the var once in memory... every function I try to use on it just gives me a run-time error... 
|
|
|
|
|
Posted: December 14th, 2004, 9:26 am
|
|
|
|
richyrich
richyrich's Reps:
|
darkfire5252";p="50557 (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', 'WROTE'))): I'm could be wrong about this, but to get the binary value, can you not just use FileSystemObject.OpenTextFile and then use Asc() to get the numerical value? This would be a good example: (!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))): Function ReadINI(FileName, Position, NumBytes) Dim fso, ts, buffer, rBuf, byteArr() ReDim byteArr(NumBytes) Const ForReading = 1 Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(FileName,ForReading) ts.Skip(Position-1) buffer = ts.Read(NumBytes) ' ReadINI = StringToBin(buffer) ReadINI = buffer End Function
Dim data data = ReadINI("testlog", 1, 5) For i = 1 to Len(data) WScript.Echo Mid(data,i,1) & " = " & Asc(Mid(data,i,1)) Next
Darkfire - awesome! It worked great! I just figured since it was OpenTextFile that it would skip any non-printable characters when reading the file (which is kinda what the docs say on it), so I never even tried it! I just tried it with the binary INI files from EQ2 and it works great! Thank you - you have saved me a lot of time figuring that out!
Rich
|
|
|
|
|
Posted: December 14th, 2004, 2:10 pm
|
|
|
|
darkfire5252
darkfire5252's Reps:
|
No problem, I've been looking for a good scripting language to use with EQ2 for a while, so let me know if there's anything else I could work on that would help you guys. I used to do a lot of work with VB 6.0 (I actually made a cheat program for Apprentice, the magic the gathering online program, if you ever used that.)
|
|
|
|
|
Posted: December 14th, 2004, 6:09 pm
|
|
|
|
richyrich
richyrich's Reps:
|
I've been writing all my code in VBScript using XU - see the DAOCMegaBot code in the DAOC downloads section for the code I've posted.
|
|
|
|
|
Posted: December 16th, 2004, 6:49 pm
|
|
|
|
grakun
grakun's Reps:
|
richyrich";p="50476 (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', 'WROTE'))): Need a chat logger and the basic X, Y coords from the API before it can really work (and Monster/harvesting X,Y).
Type "/log" in game to turn on chat logging. It will be saved to EQ2DIR\logs\ServerName\eq2log_Charname.txt
|
|
|
|
|
Posted: December 17th, 2004, 7:20 am
|
|
|
|
richyrich
richyrich's Reps:
|
Yes - thank you, Wyv pointed that out and it seems to work!
So getting X,Y coords of objects is really the last thing I'm missing, but I can do a lot of stuff even w/o that.
|
|
|
|
|
Posted: December 17th, 2004, 2:00 pm
|
|
|
|
darkfire5252
darkfire5252's Reps:
|
rich: if you want to do the game-related functionality, I can make a route runner that has good support, all i'd need is the player movement stuff, which I imagine wouldnt be too hard for ya.
|
|
|
|
|
Who is online |
|
Users browsing this forum: No registered users and 208 guests |
|
|
|