[gMS v.99.2] [FuD] Perfect Auto Potion [+Source] [Flawless]

Perfect Autopot, I made this because @CommonSense doesn’t know how to fix values T_T
HP + MP Pointer are 100% accurate, best used if HP MP alert is set to 100
The program pulls the addys + offsets from a webserver. some virus scanners say its a downloader, but it does download o-o
Source is here for learning purposes, DONT credit me if used xD
Should work as long as i update webservers, ENJOY!

Code:
 
///////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include "Form1.h"

using namespace std;
using namespace CreatorsAutoPot;
using namespace System;
using namespace System::IO;

//declarations make everything easier!
#define NewThread(Func) CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)&Func, NULL, NULL, NULL);
#define SendKey(KeyPress) PostMessage(MShWnd, WM_KEYDOWN, KeyPress, MapVirtualKey(KeyPress, 0) << 16);

int CurHP,CurMP; //Int to hold q valus
int UserSetHP,UserSetMP; //Int to hold textbox values

HWND MShWnd;//Window Handle

//Handles so you can terminate the thread
HANDLE hAutoHP;
HANDLE hAutoMP;

DWORD HPKey = 0x21;//page up
DWORD MPKey = 0x22;//page down

/*Main Shit*/
void Main(void)
{
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);
    Application::Run(gcnew Form1);
    Application::Exit();
}
void Message()
{
    MessageBox:: Show("Creators Auto Pot Injected\nThanks Piaggio (GUI)","GameKiller.net");
}

void RunProgram(LPCSTR ThePath)
{
   ShellExecuteA(NULL, "open", ThePath, NULL, NULL, SW_SHOWNORMAL);
}
///////////////////////////////////////////////////////////////////////////////

///////////////

__inline ULONG_PTR ReadPointer(ULONG_PTR* ulBase, INT nOffset)
{
  if (!IsBadReadPtr((VOID*)ulBase, sizeof(ULONG_PTR)))
  {
    if (!IsBadReadPtr((VOID*)((*(ULONG_PTR*)ulBase)+nOffset), sizeof(ULONG_PTR)))
    {
      return *(ULONG_PTR*)((*(ULONG_PTR*)ulBase)+nOffset);
        }
  }
  return 0;
}

HWND FindProcessWindow()
{
  TCHAR szBuffer[200];
  DWORD dwTemp;

  for (HWND hWnd = GetTopWindow(NULL); hWnd != NULL; hWnd = GetNextWindow(hWnd, GW_HWNDNEXT))
  {
    if (!GetClassName(hWnd, szBuffer, 200))
      continue;

    if (strcmp(szBuffer, "MapleStoryClass") != 0)
      continue;

    GetWindowThreadProcessId(hWnd, &dwTemp);

    if (dwTemp == GetCurrentProcessId())
      return hWnd;
  }

  return NULL;
}

BOOL WriteAddress(__in LPVOID lpcvBase, __in LPCVOID lpcvWriteValue, __in size_t uSize)
{
    DWORD old_protection = 0;

    __try
    {
        if(VirtualProtect(lpcvBase, uSize, PAGE_READWRITE, &old_protection))
        {
            memcpy_s(lpcvBase, uSize, lpcvWriteValue, uSize);
            VirtualProtect(lpcvBase, uSize, old_protection, &old_protection);
        }
        else
            return FALSE;
    }
    __except(EXCEPTION_EXECUTE_HANDLER)
    {
        return FALSE;
    }
    return TRUE;
}
///////////////

/****Move Form ~ Piaggio****/
Point *mouse_offset;
void Form1::pictureBox1_MouseDown(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e)
{
                if (e->Button == System::Windows::Forms::MouseButtons::Left)
            {

mouse_offset = new Point(-e->X, -e->Y);
            }
}
void Form1::pictureBox1_MouseMove(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e)
{
                        if (e->Button == System::Windows::Forms::MouseButtons::Left)
            {
                Point mousePos = Control::MousePosition;
                mousePos.Offset(mouse_offset->X, mouse_offset->Y);
                this->Location = mousePos; //move the form to the desired location
            }
}
void Form1::label3_Click(System::Object^  sender, System::EventArgs^  e)
{
    this->Close();
}

/*Pointers Related*/
DWORD GUIBase = 0x00DC6B5C;
DWORD HPOff = 0x1858;
DWORD MPOff = 0x185C;
//We use timer because it has access to Form1 (for labels)
void Form1::timer1_Tick(System::Object^  sender, System::EventArgs^  e)
{
    CurHP = (int)ReadPointer((ULONG_PTR*)GUIBase,HPOff); //Reads pointer and stores in CurHP
    CurMP = (int)ReadPointer((ULONG_PTR*)GUIBase,MPOff); //Reads pointer and stores in CurMP
    this->label1->Text = "HP : " + CurHP.ToString(); //Set the label
    this->label2->Text = "MP : " + CurMP.ToString();//Set the label
}

/*TextBox Check*/
void Form1::textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e)
{
  if(this->textBox1->Text != "")
  {
    UserSetHP = Convert::ToInt32(this->textBox1->Text);
  }
}
void Form1::textBox2_TextChanged(System::Object^  sender, System::EventArgs^  e)
{
  if(this->textBox2->Text != "")
  {
    UserSetMP = Convert::ToInt32(this->textBox2->Text);
  }
}

/*Auto Potion!*/
void AutoHP()
{
MShWnd = FindProcessWindow(); //Get WindowHandle
for (; ; Sleep(333)) //For infinity sleep 333ms
    {
        if(CurHP < UserSetHP) //If HP less then set
        {
          SendKey (HPKey); //Postmessage to send a key!
        }
    }
}
void AutoMP()
{
MShWnd = FindProcessWindow(); //Get WindowHandle
for (; ; Sleep(333)) //For infinity sleep 333ms
    {
        if(CurMP < UserSetMP) //If MP less then set
        {
          SendKey (MPKey); //Postmessage to send a key!
        }
    }
}

/*Checkbox (Auto Pot)*/
void Form1::checkBox1_CheckedChanged(System::Object^  sender, System::EventArgs^  e)
{
      if(checkBox1->Checked == true)
      {
            hAutoHP = NewThread(AutoHP);
            this->textBox1->Enabled = false;
      }
      else
      {
            TerminateThread(hAutoHP, 0);
            this->textBox1->Enabled = true;
      }
}
void Form1::checkBox2_CheckedChanged(System::Object^  sender, System::EventArgs^  e)
{
      if(checkBox2->Checked == true)
      {
            hAutoMP = NewThread(AutoMP);
            this->textBox2->Enabled = false;
      }
      else
      {
            TerminateThread(hAutoMP, 0);
            this->textBox2->Enabled = true;
      }
}

/*Tubi*/
long TubiAddy = 0x004B0DB7; // 89 86 ? ? ? ? E8 ? ? ? ? 89 ? ? ? ? ? 5E C2
static BYTE TubiOn[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
static BYTE TubiOff[] = {0x89, 0x86, 0xB8, 0x20, 0x00, 0x00};

void Form1::checkBox3_CheckedChanged(System::Object^  sender, System::EventArgs^  e)
{
    if(checkBox3->Checked == true)
    {
        WriteAddress((LPVOID)TubiAddy , TubiOn, sizeof(TubiOn));
    }
    else
    {
        WriteAddress((LPVOID)TubiAddy , TubiOff, sizeof(TubiOff));
    }
}
/*Hide Maple*/
void Form1::button1_Click(System::Object^  sender, System::EventArgs^  e)
{
    if(this->button1->Text == "Hide MapleStory")
    {
        this->button1->Text = "Show MapleStory";
        HWND hWnd = FindWindowA("MapleStoryClass", NULL);
        ShowWindow(hWnd, SW_HIDE);
    }
    else
    {
        this->button1->Text = "Hide MapleStory";
        HWND hWnd = FindWindowA("MapleStoryClass", NULL);
        ShowWindow(hWnd, SW_SHOW);
    }
}

/*Fix Values*/
void Form1::button2_Click(System::Object^  sender, System::EventArgs^  e)
{
    NewThread(WritePointerFix);
}

/*Link Label*/
void Form1::linkLabel1_LinkClicked(System::Object^  sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^  e)
{
RunProgram("www.gamekiller.net");
}
 
Download Link:

http://www.mediafire.com/?6cdozh52wc0zq0a