So this is my first forum (any forum anywhere... please troll people leave me be!) post ever... In the past I have always spent hours tinkering until I'm usually able to find the answer to my questions, however after spending multiple days now, I am resorting to you people @ ownedcore! Let me give you a little background... I have no formal coding training/tutelage; everything I know has been learned via ebooks/Bob Tabor (I purchased a lifetime membership over at LearnVisualStudio.NET). I have created multiple applications both at my place of employment and for personal use; however I cannot seem to wrap my head around reading memory.
I've installed CheatEngine 6.2 and worked through all of the tutorials (Step 9 I had to watch a YouTube video to accomplish); however I am still unable to apply this new knowledge to my current objective. Essentially all that I am trying to accomplish is to read basic attributes from my Diablo III character from memory to populate them in my application. I currently have an application that will take metrics such as weapon DPS, class attribute skill (INT,DEX,STR), and bonus DMG to calculate the total damage. I find it useful when I am hunting for a new weapon from the auction house and want to figure out if it will be an improvement or not.
Before anyone trolls me, I'd like to say that I read what DarkLinux said in the following post about creating my own library and totally agree:
HTML Code:
www.ownedcore.com/forums/general/programming/361232-wtb-c-memoryreading-writing-lessons-give.html
I have been trying to accomplish my goal using the ProcessMemory library provided by yellowspark:
HTML Code:
www.ownedcore.com/forums/general/programming/358768-c-memory-reading-writing-class.html
So I guess I'm just looking for some guidance... I've tried using CE to capture the pointer path to INT; however I can't get past the first pointer... finding the pointer path was sooooo much easier in the tutorial! If someone could give me some guidance as how to go about this seemingly simple task that would be helpful. If someone knows of a good tutorial that exists that would help me in creating my own library that would also rock. I found this tutorial here that shows reading memory in C++, perhaps someone knows of one in C#? If you are unable to provide the aforementioned, but you can help by showing me how to use the ProcessMemory library to read Intelligence with the offsets provided here that would also be something very helpful. I've turned the Attribute IDs that DarthTon posted on page 1 of the link in the previous sentence into an enumerator; however I am unsure how to use them in code... Perhaps someone could enlighten me to this as well?
Let me finish this post by apologizing... I really hate asking for assistance as I feel most answers can be answered if you just read long enough! However I have tackled this for many days now and feel like I haven't made any progress! There is a disconnect in my head somewhere and things just aren't clicking... Thanks to all who take the time to read this and to any who are able to help me understand memory reading better!
Below is the code (written in WPF, however was going to switch it to winforms as I was having problems implementing ProcessMemory class in WPF) that I am looking to modify, essentially I want it to do the same functionality, except I want to auto-populate the fields from memory rather than type them myself! Another sweet addition would be to have the application read the weapon I am currently hovering over in the auction house and pull its properties into the application as well.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DiabloIII_Damage_Calculator
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void comboBoxCharacterClass_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (comboBoxCharacterClass.SelectedIndex == 0)
{
labelSkill.Content = "Skill (Strength)";
}
if (comboBoxCharacterClass.SelectedIndex == 1 || comboBoxCharacterClass.SelectedIndex == 2)
{
labelSkill.Content = "Skill (Dexterity)";
}
if (comboBoxCharacterClass.SelectedIndex == 3 || comboBoxCharacterClass.SelectedIndex == 4)
{
labelSkill.Content = "Skill (Intelligence)";
}
}
private void textBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !e.Text.All(cc => Char.IsNumber(cc) || cc == '.');
base.OnPreviewTextInput(e);
}
private void buttonCalculate_Click(object sender, RoutedEventArgs e)
{
if (!(String.IsNullOrEmpty(textBoxSkill.Text)) && !(String.IsNullOrEmpty(textBoxWeaponDamagerPerSecond.Text)))
{
CalculateDamage();
}
else
{
MessageBox.Show("Weapon Damage Per Second and Skill cannot be null. Cannot calculate damage with an empty value, please populate and try again!");
}
}
private void CalculateDamage()
{
double S = (double.Parse(textBoxSkill.Text) / 100.0) + 1.0;
double DPS = double.Parse(textBoxWeaponDamagerPerSecond.Text);
double ch = 0.0;
double cd = 0.0;
if (String.IsNullOrEmpty(textBoxCriticalHitChance.Text))
{
ch = 5.0 / 100.0;
}
else
{
ch = double.Parse(textBoxCriticalHitChance.Text) / 100.0;
}
if (String.IsNullOrEmpty(textBoxCriticalDamage.Text))
{
cd = 50.0;
}
else
{
cd = double.Parse(textBoxCriticalDamage.Text) / 100.0;
}
double C = (ch * cd) + 1.0;
double DB = 1.0;
if (!(String.IsNullOrEmpty(textBoxSkillDamageBonus.Text)))
{
DB = (double.Parse(textBoxSkillDamageBonus.Text) / 100.0) + 1.0;
}
double TD = DPS * S * C * DB;
textBoxTotalDamage.Text = TD.ToString();
}
}
}