|
You last visited: Today at 14:15
Advertisement
Reading Current Experience from Conquer Process
Discussion on Reading Current Experience from Conquer Process within the CO2 Programming forum part of the Conquer Online 2 category.
12/21/2008, 05:48
|
#1
|
elite*gold: 0
Join Date: Apr 2006
Posts: 23
Received Thanks: 29
|
Reading Current Experience from Conquer Process
Hi, im trying to read the current character experience from the Conquer Process, i am reading from the address 0x5DB490, i found this using CE and am almost certain its the right address (if its not then please correct me). The problem is, when i find the address in CE i find the information i want (that is, the current character experience). But when i read in the data in C# i get a completly wrong value, for example, when i find the value in CE its 2470588, but when i find it in C# its 188. So it seems to me that CE is doing some calculation that im missing (perhaps creating a integer out of subsequent bytes?) Does anyone have a idea of what it is im missing? I tried reading off some subsequent bytes and got the following array:
{188,178,37,0,0,0,0,0,0,0,0,0,50,1}
Thanks in advance for any help.
|
|
|
12/21/2008, 15:16
|
#2
|
elite*gold: 20
Join Date: Aug 2005
Posts: 1,734
Received Thanks: 1,001
|
Mind showing the C# code that you're using to read the memory ? I could check it.
|
|
|
12/21/2008, 17:20
|
#3
|
elite*gold: 0
Join Date: Jun 2006
Posts: 965
Received Thanks: 576
|
is 2470588 the correct value?
edit: whoops, just read it fully, yes it is XD.
You are probably using ReadProcessMemory wrong. It reads bytes and then from there you convert to an integer.
Here is a snippet from CoHealth
Code:
#region ReadX
static int ReadInt(int handle, int addr)
{
byte[] buf = new byte[4];
ReadProcessMemory(handle, addr, buf, 4, 0);
return BitConverter.ToInt32(buf, 0);
}
static int ReadShort(int handle, int addr)
{
byte[] buf = new byte[2];
ReadProcessMemory(handle, addr, buf, 2, 0);
return BitConverter.ToInt16(buf, 0);
}
static byte ReadByte(int handle, int addr)
{
byte[] buf = new byte[1];
ReadProcessMemory(handle, addr, buf, 1, 0);
return buf[0];
}
static byte[] ReadBytes(int handle, int addr, int size)
{
byte[] buf = new byte[size];
ReadProcessMemory(handle, addr, buf, size, 0);
return buf;
}
#endregion
|
|
|
12/21/2008, 18:57
|
#4
|
elite*gold: 0
Join Date: Apr 2006
Posts: 23
Received Thanks: 29
|
thanks for the two replys guys.
to high6: thanks for those code snippits, that BitConverter class might just be what i was looking for, tho i havnt had to use it when getting character level.
to tanelipe: code as requested, once this is completed ill release the whole thing open source.
Code:
private unsafe void timer_Tick(object sender, EventArgs e)
{
if (curProcess != null)
{
pReader.ReadProcess = curProcess;
pReader.OpenProcess();
byte[] bytesLev = pReader.ReadProcessMemory((IntPtr)CHAR_LEVEL_ADDRESS, 1, out bytesReaded);
lblLevel.Text = "Level: " + bytesLev[0];
byte[] bytesExp = pReader.ReadProcessMemory((IntPtr)CHAR_EXPERIENCE_ADDRESS, 4, out bytesReaded);
lblPercent.Text = "Percent: " + convert.ConvertToPc(bytesLev[0],BitConverter.ToInt32(bytesExp,0)) + "%";
lblWater.Text = bytesExp[0].ToString();
pReader.CloseHandle();
}
}
im using someone else's API for doing the auctuall work, i think i understand most of the concepts in it, you can obtain the classes by making a codeproject class and downloading the source files from  . convert is a very simple custom class that has one public method to take the level and current experience and returns a % by using a hard coded look-up table, im sure the code for that is working well.
|
|
|
12/21/2008, 19:07
|
#5
|
elite*gold: 20
Join Date: Aug 2005
Posts: 1,734
Received Thanks: 1,001
|
Experience is ulong so it should be read as 8 bytes instead of 4. (Atleast it's like that on packets.) And when converting from the array you should use Convert.ToInt64 then also. Other than that I don't see whats wrong if the experience address is correct
|
|
|
12/21/2008, 20:00
|
#6
|
elite*gold: 0
Join Date: Apr 2006
Posts: 23
Received Thanks: 29
|
Thanks 
Ill test it out in about 10 hours and report back the result here.
edit: thanks for your help, im all finsihed now, i had one more hurdle to overcome after getting the exp figure correct, that is realising that i had forgotten to multiply curexp/reqexp by 100 :P
|
|
|
Similar Threads
|
Current conquer.exe +1K reward
08/05/2006 - Conquer Online 2 - 2 Replies
Upload Conquer.exe without editing the current one. karma rewarded
|
Read Process memory in Conquer.exe
04/13/2006 - Conquer Online 2 - 6 Replies
Any of you coders here could help me out?
From my program, I'm trying to retrieve/get the SERVER_NAME of the memory of the game. Ex, Conquer-online's Conquer.exe
ReadProcessMemory() could help, but still it confuses me.
Anybody can share detailed info about this?
|
All times are GMT +1. The time now is 14:16.
|
|