Coding Part 1

unit UMigEmu;

interface

uses
Windows, SysUtils, Forms, EmuSys, Controls, StdCtrls, Classes, ComCtrls, Menus,
Buttons, Grids, ValEdit, OleCtrls, MSWinsockLib_TLB, ExtCtrls, SysEngine;

type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
GroupBox1: TGroupBox;
RadioButtonGroupA: TRadioButton;
RadioButtonGroupB: TRadioButton;
RadioButtonGroupC: TRadioButton;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
RadioButtonAutoKick: TRadioButton;
RadioButtonRolingKick: TRadioButton;
ComboBoxAutoKick: TComboBox;
RadioButtonStandartKick: TRadioButton;
ComboBoxRolingKick: TComboBox;
ComboBoxStandartKick: TComboBox;
GroupBox4: TGroupBox;
ListBoxUser: TListBox;
CheckBoxAutoReEnter: TCheckBox;
CheckBoxAutoLeaveAfterKick: TCheckBox;
GroupBox5: TGroupBox;
RadioButtonOff: TRadioButton;
RadioButton10Sec: TRadioButton;
RadioButton30Sec: TRadioButton;
RadioButton60Sec: TRadioButton;
GroupBox6: TGroupBox;
CheckBoxAutoLeave: TCheckBox;
CheckBoxAdminDetector: TCheckBox;
CheckBoxAutoTransferCredit: TCheckBox;
GroupBox7: TGroupBox;
ComboBoxChatRoom: TComboBox;
SpeedButtonChatRoomAdd: TSpeedButton;
SpeedButtonCharRoomDelete: TSpeedButton;
GroupBox8: TGroupBox;
ComboBoxProtecId: TComboBox;
SpeedButtonProtecIdAdd: TSpeedButton;
SpeedButtonProtecIdDelete: TSpeedButton;
Label1: TLabel;
EditEnemy: TEdit;
PageControl2: TPageControl;
TabSheet6: TTabSheet;
TabSheet7: TTabSheet;
TabSheet8: TTabSheet;
TabSheet9: TTabSheet;
GroupBox9: TGroupBox;
RadioButton240: TRadioButton;
RadioButton302: TRadioButton;
RadioButton305: TRadioButton;
RadioButton307: TRadioButton;
GroupBox10: TGroupBox;
CheckBoxSignInvisible: TCheckBox;
RadioButtonOnline: TRadioButton;
RadioButtonAway: TRadioButton;
RadioButtonBusy: TRadioButton;
RadioButtonAppearOffLine: TRadioButton;
ButtonEnter: TButton;
ButtonLeave: TButton;
ButtonKick: TButton;
ButtonGetList: TButton;
GroupBox11: TGroupBox;
StatusBar1: TStatusBar;
EditId01: TEdit;
EditId02: TEdit;
EditId04: TEdit;
EditId05: TEdit;
EditId06: TEdit;
EditId07: TEdit;
EditId08: TEdit;
EditId09: TEdit;
EditId10: TEdit;
EditId03: TEdit;
GroupBox12: TGroupBox;
ButtonReconnect: TButton;
ButtonLogOffAll: TButton;
GroupBox13: TGroupBox;
EditPassword: TEdit;
GroupBox14: TGroupBox;
GroupBox15: TGroupBox;
GroupBox16: TGroupBox;
MainMenu1: TMainMenu;
EmulatorMode1: TMenuItem;
MigPro1: TMenuItem;
N1: TMenuItem;
Java1: TMenuItem;
GroupBox17: TGroupBox;
GroupBox18: TGroupBox;
GroupBox19: TGroupBox;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
Winsock1: TWinsock;
Winsock2: TWinsock;
Winsock3: TWinsock;
Winsock4: TWinsock;
Winsock5: TWinsock;
Winsock6: TWinsock;
Winsock7: TWinsock;
Winsock8: TWinsock;
Winsock9: TWinsock;
Winsock10: TWinsock;
Winsock11: TWinsock;
procedure Exit1Click(Sender: TObject);
procedure Winsock1Close(Sender: TObject);
procedure Winsock1Connect(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
Procedure ConnectToServer;
Procedure DisconnectToServer;
Procedure CreateLoginUser(aUserName : String; aWinsock : TWinsock);
Procedure CreateLoginPassword(aPassword : String; aWinsock : TWinsock);
{ Public declarations }
end;

var
Form1: TForm1;
HashTemp : array[1..11]of string;

TempUserName,LengthUserName,TempPassword,LengthPassword,
TempPacked,LengthPacked,TempRoomName,LengthRoomName : String;

implementation

{$R *.dfm}

Procedure TForm1.ConnectToServer;
begin
with Winsock1 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
with Winsock2 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
with Winsock3 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
with Winsock4 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
with Winsock5 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
with Winsock6 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
with Winsock7 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
with Winsock8 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
with Winsock9 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
with Winsock10 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
with Winsock11 do begin
Close;
RemoteHost := 'gateway.mig33.com';
RemotePort := 9119;
Connect;
end;
if Not(Form1.Showing) then
Sleep(3000);
end;

Procedure TFOrm1.DisconnectToServer;
begin
Winsock1.Close;
Winsock2.Close;
Winsock3.Close;
Winsock4.Close;
Winsock5.Close;
Winsock6.Close;
Winsock7.Close;
Winsock8.Close;
Winsock9.Close;
Winsock10.Close;
Winsock11.Close;
end;

Procedure Tform1.CreateLoginUser(aUserName : String; aWinsock : TWinsock);
begin
//
end;

Procedure TForm1.CreateLoginPassword(aPassword : String; aWinsock : TWinsock);
begin
//
end;

procedure TForm1.Exit1Click(Sender: TObject);
begin
Application.Terminate;
end;

procedure TForm1.Winsock1Close(Sender: TObject);
begin
StatusBar1.Panels[0].Text := 'Status : Disconnected';
end;

procedure TForm1.Winsock1Connect(Sender: TObject);
begin
StatusBar1.Panels[0].Text := 'Status : Connected';
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
DisconnectToServer;
end;

end.


Coding Part 2

program MigEmu;

uses
Forms, SysUtils,
UMigEmu in 'UMigEmu.pas' {Form1},
EmuSys in 'EmuSys.pas';

{$R *.res}

begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Form1.ConnectToServer;
Application.Run;
end.

Coding Part 3

//MigEmu 3.02 Created by romantic-illusion
unit EmuSys;

interface

uses SysUtils, Classes;

Procedure Split(const Delimiter: Char;Input: string; const Strings: TStrings);
Function HexToAscii(const InpStr: string): String;
Function AsciiToHex(const InpStr : String): String;
Function GetHash(const tEncode : String) : Longint; stdcall; far; external 'hashGen.dll';
Function GenerateHashCode(aPacket : String): String;

implementation

Procedure Split(const Delimiter: Char;Input: string; const Strings: TStrings);
begin
Assert(Assigned(Strings));
Strings.Clear;
Strings.Delimiter := Delimiter;
Strings.DelimitedText := Input;
end;

Function HexToAscii(const InpStr: string): String;
var
I : Integer;
spliter : TStrings;
begin
spliter := TStringList.Create;
Split(' ',InpStr,spliter);
for I:= 0 to spliter.Count-1 do
Result :=Result+Chr(StrToInt('$' + spliter.Strings[i]));
spliter.Free;
end;

Function AsciiToHex(const InpStr: string): string;
var
i, i2: Integer;
s: string;
begin
i2 := 1;
for i := 1 to Length(InpStr) do
begin
Inc(i2);
if i2 = 2 then
begin
s := s + ' ';
i2 := 1;
end;
s := s + IntToHex(Ord(InpStr[i]), 2);
end;
Result := copy(s,2,length(s));
end;


Function GenerateHashCode(aPacket : String): String;
var aLong : Longint;
TempPacket : String;
begin
aLong := GetHash(aPacket);
TempPacket := IntToHex(along,2);
Result := Copy(TempPacket,1,2)+' '+Copy(TempPacket,3,2)+' '+Copy(TempPacket,5,2)+' '+Copy(TempPacket,7,2);
end;

end.

Ok All It's Sample coding for migEmu 3.02 enjoy it

0 komentar