SHARE
TWEET

Lingo Trainer+3 :D

a guest Oct 8th, 2013 147 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit UMain;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, ExtCtrls, StdCtrls, TlHelp32;
  8.  
  9. type
  10.   TFrmMain = class(TForm)
  11.     TmrFader: TTimer;
  12.     LblB1: TLabel;
  13.     LblB2: TLabel;
  14.     LblB3: TLabel;
  15.     LblB4: TLabel;
  16.     LblB5: TLabel;
  17.     BtnBAll: TButton;
  18.     BtnB2: TButton;
  19.     BtnB3: TButton;
  20.     BtnB4: TButton;
  21.     BtnB5: TButton;
  22.     BtnGod: TButton;
  23.     ChkGod: TCheckBox;
  24.     TmrLife: TTimer;
  25.     procedure FormCreate(Sender: TObject);
  26.     procedure TmrFaderTimer(Sender: TObject);
  27.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  28.     procedure BtnBAllClick(Sender: TObject);
  29.     procedure BtnB2Click(Sender: TObject);
  30.     procedure BtnB3Click(Sender: TObject);
  31.     procedure BtnB4Click(Sender: TObject);
  32.     procedure BtnB5Click(Sender: TObject);
  33.     procedure ChkGodClick(Sender: TObject);
  34.     procedure TmrLifeTimer(Sender: TObject);
  35.   private
  36.     { Private declarations }
  37.   public
  38.     { Public declarations }
  39.     function OpenPokeProcess: boolean;
  40.     function ClosePokeProcess: boolean;
  41.     function ReadWord: string;
  42.     function WriteLife: boolean;
  43. end;
  44.  
  45. var
  46.   FrmMain: TFrmMain;
  47.  
  48.   g_bFadeUp: boolean = true;
  49.   g_hProcess: THandle;
  50.   g_sPoke: string = '';
  51.  
  52. const
  53.   POKE_WORD = $0040ACF0;
  54.   POKE_LIFE = $0040B02C;
  55.   POKE_PROCESS = 'LINGO.EXE';
  56.  
  57. implementation
  58.  
  59. {$R *.dfm}
  60.  
  61. function TFrmMain.OpenPokeProcess: boolean;
  62. var
  63.   dwPID: DWORD;
  64.   oPEntry: TProcessEntry32;
  65.   oPSnap: THandle;
  66.   sExeFile: string;
  67. begin
  68.   dwPID := 0;
  69.   Result := true;
  70.   oPSnap := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  71.   oPEntry.dwSize := SizeOf(oPEntry);
  72.   try
  73.     if Process32First(oPSnap, oPEntry) then
  74.     repeat
  75.       sExeFile := UpperCase(ExtractFileName(StrPas(oPEntry.szExeFile)));
  76.       if sExeFile = POKE_PROCESS then
  77.       begin
  78.         dwPID := oPEntry.th32ProcessID;
  79.         Break;
  80.       end;
  81.     until not Process32Next(oPSnap, oPEntry);
  82.     if dwPID = 0 then
  83.       Result := false;
  84.   except
  85.     CloseHandle(oPSnap);
  86.     Result := false;
  87.     Exit;
  88.   end;
  89.   if not Result then
  90.     Exit;
  91.   g_hProcess := OpenProcess(PROCESS_VM_READ or PROCESS_VM_WRITE or PROCESS_VM_OPERATION, false, dwPID);
  92.   if g_hProcess = INVALID_HANDLE_VALUE then
  93.   begin
  94.     Result := false;
  95.     Exit;
  96.   end;
  97. end;
  98.  
  99. function TFrmMain.ClosePokeProcess: boolean;
  100. begin
  101.   if g_hProcess <> 0 then
  102.     CloseHandle(g_hProcess);
  103.   Result := true;
  104. end;
  105.  
  106. function TFrmMain.ReadWord: string;
  107. var
  108.   acPoke: array[0..4] of char;
  109.   dwBytes: DWORD;
  110. begin
  111.   if not OpenPokeProcess then
  112.   begin
  113.     MessageBox(0, 'Lingo is not running!', 'FAIL', MB_OK or MB_ICONSTOP);
  114.     Application.Terminate;
  115.   end
  116.   else
  117.   begin
  118.     ReadProcessMemory(g_hProcess, Ptr(POKE_WORD), @acPoke, SizeOf(acPoke), dwBytes);
  119.     g_sPoke := acPoke;
  120.     ClosePokeProcess;
  121.   end;
  122. end;
  123.  
  124. function TFrmMain.WriteLife: boolean;
  125. var
  126.   byPoke: byte;
  127.   dwBytes: DWORD;
  128. begin
  129.   if not OpenPokeProcess then
  130.   begin
  131.     ChkGod.Checked := false;
  132.     TmrLife.Enabled := false;
  133.     MessageBox(0, 'Lingo is not running!', 'FAIL', MB_OK or MB_ICONSTOP);
  134.     Application.Terminate;
  135.   end
  136.   else
  137.   begin
  138.     ReadProcessMemory(g_hProcess, Ptr(POKE_LIFE), @byPoke, SizeOf(byPoke), dwBytes);
  139.     if byPoke <= 1 then
  140.       byPoke := 1;
  141.     WriteProcessMemory(g_hProcess, Ptr(POKE_LIFE), @byPoke, SizeOf(byPoke), dwBytes);
  142.     ClosePokeProcess;
  143.   end;
  144.   Result := true;
  145. end;
  146.  
  147. procedure TFrmMain.FormCreate(Sender: TObject);
  148. begin
  149.   Application.Title := FrmMain.Caption;
  150.   if not OpenPokeProcess then
  151.   begin
  152.     MessageBox(0, 'Lingo is not running!', 'FAIL', MB_OK or MB_ICONSTOP);
  153.     Application.Terminate;
  154.   end;
  155.   TmrFader.Enabled := true;  
  156. end;
  157.  
  158. procedure TFrmMain.TmrFaderTimer(Sender: TObject);
  159. var
  160.   byAlpha: byte;
  161. begin
  162.   byAlpha := FrmMain.AlphaBlendValue;
  163.   if g_bFadeUp then
  164.   begin
  165.     if byAlpha < 220 then
  166.       Inc(byAlpha, 10)
  167.     else
  168.     begin
  169.       TmrFader.Enabled := false;
  170.       g_bFadeUp := false;
  171.     end;
  172.   end
  173.   else
  174.   begin
  175.     if byAlpha > 0 then
  176.       Dec(byAlpha, 10)
  177.     else
  178.     begin
  179.       TmrFader.Enabled := false;
  180.       ClosePokeProcess;
  181.       Application.Terminate;
  182.     end;
  183.   end;
  184.   FrmMain.AlphaBlendValue := byAlpha;
  185. end;
  186.  
  187. procedure TFrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
  188. begin
  189.   Action := caNone;
  190.   if not TmrFader.Enabled then
  191.     TmrFader.Enabled := true;
  192. end;
  193.  
  194. procedure TFrmMain.BtnBAllClick(Sender: TObject);
  195. begin
  196.   ReadWord;
  197.   LblB1.Color := clRed;
  198.   LblB2.Color := clRed;
  199.   LblB3.Color := clRed;
  200.   LblB4.Color := clRed;
  201.   LblB5.Color := clRed;
  202.   LblB1.Caption := g_sPoke[1];
  203.   LblB2.Caption := g_sPoke[2];
  204.   LblB3.Caption := g_sPoke[3];
  205.   LblB4.Caption := g_sPoke[4];
  206.   LblB5.Caption := g_sPoke[5];
  207. end;
  208.  
  209. procedure TFrmMain.BtnB2Click(Sender: TObject);
  210. begin
  211.   ReadWord;
  212.   LblB1.Color := clSilver;
  213.   LblB2.Color := clRed;
  214.   LblB3.Color := clSilver;
  215.   LblB4.Color := clSilver;
  216.   LblB5.Color := clSilver;
  217.   LblB1.Caption := '?';
  218.   LblB2.Caption := g_sPoke[2];
  219.   LblB3.Caption := '?';
  220.   LblB4.Caption := '?';
  221.   LblB5.Caption := '?';
  222. end;
  223.  
  224. procedure TFrmMain.BtnB3Click(Sender: TObject);
  225. begin
  226.   ReadWord;
  227.   LblB1.Color := clSilver;
  228.   LblB3.Color := clRed;
  229.   LblB2.Color := clSilver;
  230.   LblB4.Color := clSilver;
  231.   LblB5.Color := clSilver;
  232.   LblB1.Caption := '?';
  233.   LblB3.Caption := g_sPoke[3];
  234.   LblB2.Caption := '?';
  235.   LblB4.Caption := '?';
  236.   LblB5.Caption := '?';
  237. end;
  238.  
  239. procedure TFrmMain.BtnB4Click(Sender: TObject);
  240. begin
  241.   ReadWord;
  242.   LblB1.Color := clSilver;
  243.   LblB4.Color := clRed;
  244.   LblB3.Color := clSilver;
  245.   LblB2.Color := clSilver;
  246.   LblB5.Color := clSilver;
  247.   LblB1.Caption := '?';
  248.   LblB4.Caption := g_sPoke[4];
  249.   LblB3.Caption := '?';
  250.   LblB2.Caption := '?';
  251.   LblB5.Caption := '?';
  252. end;
  253.  
  254. procedure TFrmMain.BtnB5Click(Sender: TObject);
  255. begin
  256.   ReadWord;
  257.   LblB1.Color := clSilver;
  258.   LblB5.Color := clRed;
  259.   LblB3.Color := clSilver;
  260.   LblB4.Color := clSilver;
  261.   LblB2.Color := clSilver;
  262.   LblB1.Caption := '?';
  263.   LblB5.Caption := g_sPoke[5];
  264.   LblB3.Caption := '?';
  265.   LblB4.Caption := '?';
  266.   LblB2.Caption := '?';
  267. end;
  268.  
  269. procedure TFrmMain.ChkGodClick(Sender: TObject);
  270. begin
  271.   TmrLife.Enabled := ChkGod.Checked;
  272. end;
  273.  
  274. procedure TFrmMain.TmrLifeTimer(Sender: TObject);
  275. begin
  276.   WriteLife;
  277. end;
  278.  
  279. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top